efficient-easel 23.2.0 → 24.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 +10 -0
- package/dist/{ScreenDocumentContext-BDLUYzlM.d.ts → ScreenDocumentContext-DPW_6gOC.d.ts} +16 -1
- package/dist/{chunk-UNVKPVZW.js → chunk-3FIS2FRS.js} +1 -1
- package/dist/{chunk-VNDPFDO5.js → chunk-4ESG53BH.js} +1 -1
- package/dist/chunk-5NHQ452C.js +1 -0
- package/dist/{chunk-MYAJ7MGI.js → chunk-75C6WFNF.js} +1 -1
- package/dist/chunk-7RSE6KKY.js +1 -0
- package/dist/chunk-AAAZ2CQR.js +1 -0
- package/dist/{chunk-QWLWSIDH.js → chunk-CE5SGCN2.js} +4 -4
- package/dist/chunk-CMPFUJ26.js +8 -0
- package/dist/chunk-CZAAGBVL.js +7 -0
- package/dist/chunk-FJTCSQWK.js +16 -0
- package/dist/{chunk-CMBJHSHY.js → chunk-FRAIEWRC.js} +1 -1
- package/dist/{chunk-4RRIYPAV.js → chunk-G67G63O5.js} +1 -1
- package/dist/{chunk-6QSFJCJT.js → chunk-H4Z2V56N.js} +16 -16
- package/dist/{chunk-77IWWW6X.js → chunk-ISS72IKO.js} +1 -1
- package/dist/chunk-K7MMLCTT.js +2 -0
- package/dist/chunk-LX23TCTP.js +2 -0
- package/dist/{chunk-ZOPYJQFS.js → chunk-MRWVYSU5.js} +43 -43
- package/dist/{chunk-FHCKFOCD.js → chunk-NCXYC7WI.js} +2 -2
- package/dist/{chunk-BIK3AO2V.js → chunk-NQW6XCAY.js} +1 -1
- package/dist/{chunk-RMQDKVGW.js → chunk-OITNWE52.js} +1 -1
- package/dist/chunk-QORC32JO.js +5 -0
- package/dist/{chunk-2G6MAXPY.js → chunk-T2RINM7R.js} +1 -1
- package/dist/chunk-TOHOGVAE.js +15 -0
- package/dist/copy/index.js +10 -10
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.d.ts +20 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.js +1 -15
- package/dist/panel/panel.css +8 -0
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaPopup.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +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 +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/usePartBridge.d.ts +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +389 -0
- package/dist/screen/lib/document/box-fields.js +9 -0
- package/dist/screen/lib/document/slot-child-name.js +1 -1
- package/dist/screen/lib/document/style-clipboard.d.ts +1 -1
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/use-section-ops.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 +1 -1
- package/dist/screen/lib/host.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-panel.js +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +32 -0
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +21 -21
- package/package.json +9 -3
- package/dist/chunk-33P4J2SF.js +0 -1
- package/dist/chunk-A6ZP5II4.js +0 -2
- package/dist/chunk-C57RLYDQ.js +0 -8
- package/dist/chunk-DCBSRZ6Z.js +0 -5
- package/dist/chunk-FEF3OQRT.js +0 -16
- package/dist/chunk-J5OSNZPU.js +0 -1
- package/dist/chunk-MQA7OFRA.js +0 -2
- package/dist/chunk-S3DUFDQ6.js +0 -6
- package/dist/chunk-SSRYU3YG.js +0 -1
package/dist/strings/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DEFAULT_SCREEN_WORDS as r}from"../chunk-IYHO4XQX.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as m}from"../chunk-WK3AFPXY.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as s}from"../chunk-H6DDIBQ4.js";import{DEFAULT_COPY_WORDS as u}from"../chunk-KRL3IUV3.js";import{DEFAULT_FIELDS_WORDS as f}from"../chunk-JACEEVVF.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as l}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as h}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as j}from"../chunk-RE4LP46F.js";import{stringsContext as k}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as a}from"../chunk-TQ5Y6S2X.js";import{useContext as Y,useMemo as W}from"react";import{jsx as y}from"react/jsx-runtime";var F={notice:l,lock:j,save:s,chrome:p,rail:h,tree:e,panel:i,fields:f,pick:t,drag:a,menu:m,styleClipboard:o,copy:u,canvas:c,textStyles:n,screen:r},d=r=>"object"==typeof r&&null!==r;function v(r,o){const n={};for(const t of Object.keys(r)){const c=r[t],e=o[t];null==e?n[t]=c:d(c)?n[t]=d(e)?v(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function D(r,o){return o?v(r,o):r}function J({value:r,locale:o,children:n}){const t=k(),c=Y(t),e=c?.strings??F,m=o??c?.locale??"en",i=W(()=>({strings:D(e,r),locale:m}),[e,r,m]);/* @__PURE__ */
|
|
2
2
|
return y(t.Provider,{value:i,children:n})}function O(){return Y(k())?.strings??F}function H(){return Y(k())?.locale??"en"}export{F as DEFAULT_EASEL_STRINGS,J as EaselStringsProvider,D as mergeEaselStrings,H as useEaselLocale,O as useEaselStrings};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-ZEH6QLBH.js";import{TEXT_STYLE_KINDS as l,canAddTextStyle as i,TEXT_STYLE_MAX as r,isDefaultTextStyle as o,CAMPAIGN_TEXT_STYLE_SETTINGS as d,TEXT_STYLE_SETTINGS as c,textStyleRowSize as u,describeTextStyle as m,updateTextStyle as h,textStyleCaseCss as f,TEXT_STYLE_CASES as p,addTextStyle as v,removeTextStyle as y,TEXT_STYLE_RANGES as S}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{FieldSelect as g}from"../chunk-KFWNGPW3.js";import"../chunk-JACEEVVF.js";import{useWords as b}from"../chunk-MFIRYGHW.js";import{withTip as k}from"../chunk-P2VEMZH5.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as E,useId as z,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as $,CaseCapitalizedIcon as W,CaseUpperIcon as Y,CaseNormalIcon as I}from"efficient-shell/icons/efficient";import{jsxs as D,jsx as X,Fragment as F}from"react/jsx-runtime";var H=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function P({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=E(null),h=E(null),f=z(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */D("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
2
|
/* @__PURE__ */D("div",{className:"es-ts-top",children:[
|
|
3
3
|
/* @__PURE__ */X("span",{className:"es-ts-sub",children:l}),
|
|
4
|
-
/* @__PURE__ */X("span",{className:"es-ts-colour-read",children:
|
|
5
|
-
/* @__PURE__ */D("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */X(C,{content:`${s.name} · ${
|
|
6
|
-
/* @__PURE__ */X(C,{content:r,children:/* @__PURE__ */X(x,{ref:h,color:H,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */X(
|
|
7
|
-
return X("div",{className:"es-ts",ref:I,children:l.map(
|
|
8
|
-
return D(G,{label:A.groups[
|
|
9
|
-
return X(R,{style:
|
|
10
|
-
/* @__PURE__ */X("span",{className:"es-ts-add-word",children:A.add[
|
|
11
|
-
/* @__PURE__ */X("span",{className:"es-ts-count",children:A.count({n:l.length,max:x})})]})),_||!r?null:/* @__PURE__ */X("span",{id:`${j}-full-${
|
|
4
|
+
/* @__PURE__ */X("span",{className:"es-ts-colour-read",children:a?e(a):i})]}),
|
|
5
|
+
/* @__PURE__ */D("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */X(C,{content:`${s.name} · ${e(s.value)}`,children:/* @__PURE__ */X(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__ */X(C,{content:r,children:/* @__PURE__ */X(x,{ref:h,color:H,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */X(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function B({styles:e,onChange:s,fonts:t,colours:n=[],settings:c=d,auto:u=[],fallback:m,sample:h,openId:f,defaultOpenId:p=null,onOpenChange:S,onAdd:g,rowActions:N,onRemove:C,max:x=r,device:T="desktop",readOnly:_=!1}){const A=b("textStyles",a),j=z(),[M,$]=w(p),W=void 0!==f?f:M,Y=e=>{void 0===f&&$(e),S?.(e)},I=E(null),[H,P]=w(null);O(()=>{if(!H||!I.current)return;const e=[...I.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===H.id),s=e?e.querySelector(".es-ts-row"):I.current.querySelector(`.es-ts-add[data-ts-kind="${H.kind}"]`);s?.focus(),P(null)},[H]);/* @__PURE__ */
|
|
7
|
+
return X("div",{className:"es-ts",ref:I,children:l.map(a=>{const l=e.filter(e=>e.kind===a),r=!i(e,a,x),d=!_&&!r;/* @__PURE__ */
|
|
8
|
+
return D(G,{label:A.groups[a],children:[l.map(a=>{const l=N?.(a),i=null!=l&&!1!==l,r=Boolean(C)&&!_&&!o(a);/* @__PURE__ */
|
|
9
|
+
return X(R,{style:a,fonts:t,colours:n,settings:c,auto:u,fallback:m,sample:h,device:T,readOnly:_,open:W===a.id,onOpenChange:e=>Y(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:r||i?/* @__PURE__ */D(F,{children:[r?k(A.remove,/* @__PURE__ */X("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=y(e,t.id,{name:A.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];W===t.id&&Y(null),s(a.styles),C(a.removed),P({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */X(L,{size:14,"aria-hidden":"true"})})):null,i?l:null]}):null},a.id)}),k(!_&&r?A.full({kind:a,max:x}):void 0,/* @__PURE__ */D("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!r)||void 0,"aria-describedby":!_&&r?`${j}-full-${a}`:void 0,onClick:()=>{d&&(t=>{if(_)return;const a=v(e,t,{max:x,name:A.styleName,make:g});a&&s(a.styles)})(a)},children:[
|
|
10
|
+
/* @__PURE__ */X("span",{className:"es-ts-add-word",children:A.add[a]}),
|
|
11
|
+
/* @__PURE__ */X("span",{className:"es-ts-count",children:A.count({n:l.length,max:x})})]})),_||!r?null:/* @__PURE__ */X("span",{id:`${j}-full-${a}`,className:"es-vh",children:A.full({kind:a,max:x})})]},a)})})}function G({label:e,children:s}){const t=z();/* @__PURE__ */
|
|
12
12
|
return D("section",{className:"es-ts-section","aria-labelledby":t,children:[
|
|
13
|
-
/* @__PURE__ */X("div",{className:"es-ts-group",id:t,children:e}),s]})}function R({style:
|
|
13
|
+
/* @__PURE__ */X("div",{className:"es-ts-group",id:t,children:e}),s]})}function R({style:e,fonts:s,colours:t=[],settings:n=d,auto:l=[],fallback:i,sample:r,open:o,onOpenChange:f,onChange:p,actions:v,device:y="desktop",readOnly:S=!1}){const g=b("textStyles",a),k=`${z()}-open-${e.id}`,N=new Set(l),C=c.filter(e=>n.includes(e)),x={...i?.(e)??{},...e.values},T="phone"===y,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,E=s.find(e=>e.value===x.font),O={fontFamily:E?.family,fontSize:`${u(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
|
|
14
14
|
return D(_,{children:[
|
|
15
|
-
/* @__PURE__ */D("div",{className:"es-ts-item","data-ts-id":
|
|
15
|
+
/* @__PURE__ */D("div",{className:"es-ts-item","data-ts-id":e.id,children:[
|
|
16
16
|
/* @__PURE__ */D("button",{type:"button",className:"es-ts-row","aria-expanded":o,"aria-controls":o?k:void 0,onClick:()=>f(!o),children:[
|
|
17
17
|
/* @__PURE__ */X("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */X(A,{size:12})}),
|
|
18
|
-
/* @__PURE__ */X("span",{className:"es-ts-name",style:O,children:
|
|
19
|
-
/* @__PURE__ */X("span",{className:"es-ts-meta",children:m(w,
|
|
20
|
-
return X("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */X(
|
|
18
|
+
/* @__PURE__ */X("span",{className:"es-ts-name",style:O,children:e.name}),
|
|
19
|
+
/* @__PURE__ */X("span",{className:"es-ts-meta",children:m(w,s,g,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),v?/* @__PURE__ */X("div",{className:"es-ts-actions",children:v}):null]}),o?/* @__PURE__ */X("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */X(V,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:r??g.sample,words:g,phone:T,readOnly:S,set:s=>p(h([e],e.id,s)[0])})}):null]})}var U={none:I,upper:Y,capitalize:W,lower:$};function V({style:e,values:s,fonts:a,colours:l,settings:i,autoSet:r,sample:o,words:d,phone:c,readOnly:u,set:m}){const h=e.values,p=a.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,l),y=e=>"largestSize"===e||r.has(e),g=e=>y(e)?h[e]:s[e],b=g("size"),N=c&&void 0!==h.sizePhone?h.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=y("letterCase")?h.letterCase:s.letterCase,E={fontFamily:p?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:v,textTransform:f(w)},z=e=>{const t=S[e],a=y(e);/* @__PURE__ */
|
|
20
|
+
return X("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */X(n,{label:d.settings[e],value:h[e],onChange:s=>m({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?d.auto:void 0,readOnly:u})},e)};/* @__PURE__ */
|
|
21
21
|
return D(F,{children:[
|
|
22
|
-
/* @__PURE__ */X("div",{className:"es-ts-preview",style:E,"aria-label":d.preview,children:o}),i.map(
|
|
23
|
-
return X(Z,{value:h.font,fonts:a,words:d,readOnly:u,set:m},
|
|
24
|
-
return X(K,{value:h.color,hex:v,colours:l,words:d,readOnly:u,set:m},
|
|
25
|
-
return D("div",{className:"es-ts-set","data-ts-setting":
|
|
22
|
+
/* @__PURE__ */X("div",{className:"es-ts-preview",style:E,"aria-label":d.preview,children:o}),i.map(t=>{switch(t){case"font":/* @__PURE__ */
|
|
23
|
+
return X(Z,{value:h.font,fonts:a,words:d,readOnly:u,set:m},t);case"color":/* @__PURE__ */
|
|
24
|
+
return X(K,{value:h.color,hex:v,colours:l,words:d,readOnly:u,set:m},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==p?.italic;/* @__PURE__ */
|
|
25
|
+
return D("div",{className:"es-ts-set","data-ts-setting":t,children:[
|
|
26
26
|
/* @__PURE__ */X("span",{className:"es-ts-sub",children:d.settings.emphasis}),
|
|
27
|
-
/* @__PURE__ */D("div",{className:"es-ts-icons",children:[k(d.bold,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":d.bold,"aria-pressed":e,disabled:u,onClick:()=>m({weight:e?400:700}),children:/* @__PURE__ */X(j,{size:16})})),u||
|
|
28
|
-
return X(q,{value:h.letterCase??
|
|
29
|
-
return X("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */X(
|
|
27
|
+
/* @__PURE__ */D("div",{className:"es-ts-icons",children:[k(d.bold,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":d.bold,"aria-pressed":e,disabled:u,onClick:()=>m({weight:e?400:700}),children:/* @__PURE__ */X(j,{size:16})})),u||a?k(d.italic,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),disabled:u,onClick:()=>m({italic:!s.italic||void 0}),children:/* @__PURE__ */X(M,{size:16})})):/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:d.italicMissing,children:/* @__PURE__ */X(M,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
|
|
28
|
+
return X(q,{value:h.letterCase??s.letterCase,auto:y("letterCase"),words:d,readOnly:u,set:m},t);case"largestSize":return"heading"===e.kind?z(t):null;case"size":return c?(()=>{const e=S.size;/* @__PURE__ */
|
|
29
|
+
return X("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */X(n,{label:d.settings.size,value:h.sizePhone,onChange:e=>m({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:u})},"size")})():z(t);default:return z(t)}})]})}function Z({value:e,fonts:s,words:t,readOnly:a,set:n}){const l=z();/* @__PURE__ */
|
|
30
30
|
return D("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
31
31
|
/* @__PURE__ */X("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
|
|
32
32
|
/* @__PURE__ */X(g,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:l,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.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",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"./screen/lib/document/add-target-types",
|
|
95
95
|
"./screen/lib/document/block-choice",
|
|
96
96
|
"./screen/lib/document/block-types-in",
|
|
97
|
+
"./screen/lib/document/box-fields",
|
|
97
98
|
"./screen/lib/document/device-fields",
|
|
98
99
|
"./screen/lib/document/field-buckets",
|
|
99
100
|
"./screen/lib/document/field-markers",
|
|
@@ -427,6 +428,11 @@
|
|
|
427
428
|
"import": "./dist/screen/lib/document/content-tree.js",
|
|
428
429
|
"default": "./dist/screen/lib/document/content-tree.js"
|
|
429
430
|
},
|
|
431
|
+
"./screen/lib/document/box-fields": {
|
|
432
|
+
"types": "./dist/screen/lib/document/box-fields.d.ts",
|
|
433
|
+
"import": "./dist/screen/lib/document/box-fields.js",
|
|
434
|
+
"default": "./dist/screen/lib/document/box-fields.js"
|
|
435
|
+
},
|
|
430
436
|
"./screen/lib/document/device-fields": {
|
|
431
437
|
"types": "./dist/screen/lib/document/device-fields.d.ts",
|
|
432
438
|
"import": "./dist/screen/lib/document/device-fields.js",
|
|
@@ -627,7 +633,7 @@
|
|
|
627
633
|
"dist"
|
|
628
634
|
],
|
|
629
635
|
"peerDependencies": {
|
|
630
|
-
"efficient-shell": "^10.
|
|
636
|
+
"efficient-shell": "^10.20.0",
|
|
631
637
|
"react": ">=18",
|
|
632
638
|
"react-dom": ">=18"
|
|
633
639
|
},
|
|
@@ -637,7 +643,7 @@
|
|
|
637
643
|
"@types/node": "^22.0.0",
|
|
638
644
|
"@types/react": "^18.2.0",
|
|
639
645
|
"@types/react-dom": "^18.2.0",
|
|
640
|
-
"efficient-shell": "^10.
|
|
646
|
+
"efficient-shell": "^10.20.0",
|
|
641
647
|
"esbuild": "^0.27.0",
|
|
642
648
|
"jsdom": "^26.1.0",
|
|
643
649
|
"react": "^18.2.0",
|
package/dist/chunk-33P4J2SF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-RMQDKVGW.js";import{SELECTION_MODE as e}from"./chunk-DCBSRZ6Z.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-FEF3OQRT.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=n(o=>o),f=o(),{setSelectedPartId:k,setSelectHandler:l}=p(),I=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{l(I)},[l,I]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{k(h)},[h,k]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&f.select(r)},[i,u,f]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-A6ZP5II4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{routeSharedHostMessage as e}from"./chunk-77IWWW6X.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-BIK3AO2V.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-YM4UEGBV.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-SNF5764Q.js";import{useEaselHost as k}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-IYHO4XQX.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as b,CLAIM_FAIL_OPEN_MS as S,holderOf as I}from"./chunk-THWO5YVZ.js";import{useWords as P}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as O,useCallback as E,useEffect as H,useRef as A}from"react";import{jsx as C}from"react/jsx-runtime";var M={content:[],root:{},zones:{}};var N=j(null);function T(){const e=R(N);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function F({target:j,addressing:R=o,onHostMessage:T,children:F}){const V=R,{homeSlug:D,entryMayBounce:L,entryBounce:W,onSwitch:Y,tellsHost:X,adapterFor:K,migrateRenamedProps:U,describeMissing:Z,onLoadFailed:x}=V,[G,Q]=B(j),z=k(),_=d(),q=O(()=>f(_),[_]),J=O(()=>t(_),[_]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??D??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=_.blocks,oe=O(()=>K(G,q,te),[K,q,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=E(e=>_.documentHooks?.stored?.(e)??e,[_]);H(()=>{m(_,ne)},[_,ne]);const se=A(G);H(()=>{se.current=G},[G]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(T?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!_.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(q.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,be]=B(null),Se=P("screen",v),Ie=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,Se):null,[Pe,je]=B(null),Re=A(null),Be=A(null),[Oe,Ee]=B(!1),He=A(null),[Ae,Ce]=B(null),Me=A(null),[Ne,Te]=B(null),[Fe,Ve]=B(!1),De=A(null);H(()=>{De.current=Ne},[Ne]);const[Le,We]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=A(Le);H(()=>{Ye.current=Le},[Le]);const Xe=A(()=>Promise.resolve(!1)),Ke=E(e=>{Be.current=e,Ee(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Xe.current(e,r)){if(!p(Ye.current))return void Ke({id:e,data:r});throw new Error("page save did not land")}}else Ke({id:e,data:r})},onFailure:(e,r)=>{0===r&&z.send("storefront-editor:save-failed")}}),{state:Ze,push:xe,flush:Ge,pause:Qe,resume:ze,stop:_e,reset:qe,retryNow:Je,hasPending:$e}=Ue,er=A(Ze);H(()=>{er.current=Ze},[Ze]);const rr=u(Ze),nr=E(()=>{const e=Be.current;e&&(Be.current=null,Ee(!1),xe(e))},[xe]),tr=A("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=A(!1),[sr,ir]=B(L(j)),lr=A(!1);H(()=>{if(lr.current)return;lr.current=!0;const e=z.address.search(),r=W(j,e);r?z.address.load(r):L(j)&&ir(!1)},[j,z]);const cr=z.send;H(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=_.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==D&&re!==D?void z.address.load({kind:"page",slug:D,siteId:ne??void 0}):(be({target:t,slug:re,missing:!0,sentence:Z?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),Me.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:M,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),be({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},_),cause:r(o,_)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=E(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=E(async e=>{const r=le.current;if(!r&&_.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,_)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,_]),mr=E(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=E(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(De.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,Me.current,tr.current));if(t.ok)return Me.current=t.value.version??Me.current,Ve(!1),!0;const o=J.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,We(e),!1}const u=J.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Me.current=n.value,Xe.current(e,r,!0)}_e(),De.current=u,Te(u)}return Ve(i(t.error,_)?.status===c),!1},[oe,fr,_e,_]);H(()=>{Xe.current=kr},[kr]);const vr=E(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Ye.current)?xe({id:ke,data:r}):Ke({id:ke,data:r})},[ke,cr,Ke,xe,ae]),gr=E(async()=>{p(Ye.current)&&nr();return await Ge()&&null==Be.current},[nr,Ge]),pr=A(gr);H(()=>{pr.current=gr},[gr]);const hr=A(fr);H(()=>{hr.current=fr},[fr]);const yr=E(()=>{z.address.reload()},[z]),wr=A(()=>Promise.resolve(!1));H(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Me.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const br=null!==Pe;H(()=>{if(!fe||!ke||!de||br)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=De.current}),setAccess:e=>{Ye.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=J.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(b)},S)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,br]);const Sr=E(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=E(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=E(()=>{er.current.paused?(p(Ye.current)&&nr(),ze()):Qe()},[nr,Qe,ze]),jr=E(()=>{Je()},[Je]),Rr=E(e=>{He.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{qe(),Be.current=null,Ee(!1)},setVersion:e=>{Me.current=e},setSaveConflict:Te,setAccess:We}),Y(e),Q(e),Re.current=null,je(null),ve(null),pe(null),ye(null),be(null),z.address.show(e),"document"!==e.kind&&X(e)&&z.send("storefront-editor:navigated",{target:e})},[qe,z,me,Y,X]),Br=E(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,D))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Ce(e):Ge().then(r=>{r?Rr(e):Ce(e)})},[Rr,$e,Ge,D]),Or=E(()=>Ce(null),[]),Er=E(()=>{Ce(e=>(e&&Rr(e),null))},[Rr]),Hr=E(async()=>{const e=Ae;if(!e)return;await gr()&&(Ce(null),Rr(e))},[Ae,gr,Rr]),Ar=E(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||De.current)return;const r=ae(e);if(!await kr(ke,r))return void(De.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,Me.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Me.current=t.value.version??Me.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
|
|
2
|
-
return C(N.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>He.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Ze,autoSaveEnabled:!Ze.paused,autoSaveStoppedByConflict:Ze.stopped,hasUnsavedEdits:Ze.pending||Oe,toggleAutoSave:Pr,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Ar,access:Le,readOnly:null!==I(Le)||null!==Pe||null!==Ne,readOnlyReason:Pe,takeOverEditing:Sr,viewReadOnly:Ir,saveConflict:Ne,saveUnreachable:Fe,reloadFromServer:yr,navigate:Br,pendingNav:Ae,cancelPendingNav:Or,discardAndNavigate:Er,saveAndNavigate:Hr},children:F})}export{N as ScreenDocumentContext,F as ScreenDocumentProvider,T as useScreenDocument};
|
package/dist/chunk-C57RLYDQ.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-VKPOH6MK.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as l}from"./chunk-N7E6264U.js";import{sharedSectionsOf as r}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-5PXVT7JY.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-DCBSRZ6Z.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-IYHO4XQX.js";import{useEasel as u}from"./chunk-FEF3OQRT.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LN43DP2A.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as O}from"efficient-shell/icons/efficient";import{ContextMenu as F,toast as I,Dialog as E,Button as T}from"efficient-shell/ui";import{jsx as $,jsxs as x,Fragment as H}from"react/jsx-runtime";function M({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=w(null);/* @__PURE__ */
|
|
2
|
-
return $(E,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */x(H,{children:[
|
|
3
|
-
/* @__PURE__ */$(T,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
-
/* @__PURE__ */$(T,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var Q=e=>`section:${e}`,S=e=>`block:${e}`,A=e=>`template:${e}`,B=e=>`shared:${e}`;function D({at:w,placeBlocks:E,canTake:T,onPick:D,itemFor:L,session:N,siteWide:P,onClose:R,onHide:W,readOnly:Y}){const z=u(e=>e.config),G=a(),{labelAtLevel:U,categoryLabel:V,firstSection:X,Icon:J,Thumbnail:Z}=G,{blockIsOffered:K,canAddTo:_}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>K(e,te);return l(te).list().then(n=>{if(e)return;const l=z.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[z,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=>K(e,te);return r(te).list().then(n=>{if(e)return;const l=z.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[z,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(z,G),[z]),ye=e=>U(e,"section",z.components[e]?.label??e),he=e=>({type:Q(e.type),label:e.name,cover:/* @__PURE__ */$(Z,{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__ */$(J,{type:e,size:26})}),be=j(()=>{const e=t(ue,X),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!K(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=_(t.type)?.choices??[];e.forEach(l),e.forEach(e=>_(e.type,1)?.choices?.forEach(l))}E?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:S(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:B(e.id),label:e.title,cover:/* @__PURE__ */$(Z,{type:e.node.type}),mark:/* @__PURE__ */$(C,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:A(e.id),label:e.name,cover:/* @__PURE__ */$(Z,{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(z.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(z,t,V),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)})}),!T)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?T(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,z,q,T,E,te]);/* @__PURE__ */
|
|
5
|
-
return x(H,{children:[
|
|
6
|
-
/* @__PURE__ */$(i,{icon:/* @__PURE__ */$(O,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */$(s,{label:q.done,description:q.doneDescription,onClick:R}),onHide:W}),
|
|
7
|
-
/* @__PURE__ */x("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
-
/* @__PURE__ */$(k,{groups:be,session:N,itemFor:e=>L(ke(e)??{kind:"section",type:e}),onInsert:D?e=>{const t=ke(e);t&&D(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!Y&&(pe({section:n.section,...t}),!0)},at:w,hint:q.hint,searchLabel:q.search,readOnly:Y,words:ee}),P??null]}),de?/* @__PURE__ */$(F,{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__ */$(M,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void I.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{D as AddSidePanel,S as blockKey,Q as sectionKey,B as sharedKey,A as templateKey};
|
package/dist/chunk-DCBSRZ6Z.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-FHCKFOCD.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-FEF3OQRT.js";import{Inspector as i}from"./chunk-6QSFJCJT.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,j=()=>"",C=()=>null,F=()=>{},S={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},w={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},L={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},D={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},P={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function T(){/* @__PURE__ */
|
|
2
|
-
return f(r,{height:"fill"})}function B(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
|
|
3
|
-
return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var N=l({});function x({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return f(N.Provider,{value:n,children:e})}function A(){return s(N)}function G(){return(A().useOwnerName??j)()}function I(){return(A().useDocumentLabel??C)()}function Q(n,e,t,r){return(A().useBridges??O)(n,e,t,r)}function R(n){return(A().useStandaloneBridges??O)(n)}function E(n,e){(A().useDocumentPass??F)(n,e)}function H(){return A().blockRules??S}function J(){return A().blockLook??w}function K(){return A().devices??L}function V(){return A().leftView??D}function Y(){return A().pinned??P}function M(){return A().saveSwitch??!0}function X(e){n(!0===A().pickFollowsSelection,e)}function Z(){return A().storageNamespace||void 0}function q(){return A().styleClipboard??null}function z(){return A().nodeKeys??!0}function U(){return A().notify??null}function W(){return A().Canvas??T}function $(){return A().CanvasHead??null}function _(){return A().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return A().Inspector??B}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,x as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,J as useScreenBlockLook,H as useScreenBlockRules,Q as useScreenBridges,_ as useScreenCanvasDrag,W as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,K as useScreenDevices,I as useScreenDocumentLabel,E as useScreenDocumentPass,rn as useScreenInspectorPanel,V as useScreenLeftView,z as useScreenNodeKeys,U as useScreenNotify,G as useScreenOwnerName,A as useScreenParts,X as useScreenPickFollowsSelection,Y as useScreenPinned,M as useScreenSaveSwitch,Z as useScreenStorageNamespace,q as useScreenStyleClipboard,R as useStandaloneScreenBridges};
|
package/dist/chunk-FEF3OQRT.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{toItemSelector as e,fromItemSelector as t,useNodeOps as n,parentStep as o,clickPickPart as r,clickPick as i}from"./chunk-RPMSET77.js";import{DEFAULT_CANVAS_WORDS as l}from"./chunk-TBY3DFKS.js";import{useResolvedFields as s}from"./chunk-AGWKB77Q.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-HZSZT3BE.js";import{DEFAULT_COPY_WORDS as m}from"./chunk-KRL3IUV3.js";import{useWords as g}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as v,CANVAS_TYPABLE_EVENT as y,related as w,isTypingTarget as b,upsertCanvasStyle as k,removeCanvasStyle as S,WORDS_CLEAR as C,frameRectToHost as I,CANVAS_TYPING_EVENT as D,drawnBox as E}from"./chunk-YU3WHLGI.js";import{queryAllCopies as x}from"./chunk-LF3FUSCQ.js";import{find as O,ROOT_ID as M,getList as A,remove as R,parseZoneKey as z,move as P,duplicate as $,replaceNode as V,createNode as L,insert as j,normalizeData as N,createResolveCache as B,slotsOf as K,resolveNodeData as Z,ROOT_SLOT as F}from"./chunk-TGZCD6IP.js";import{topLevelSlotKeys as T,fieldsFrom as H,drawnBlockCount as W,defaultsFrom as Y}from"./chunk-KXM6YRG2.js";import{createContext as U,useEffect as q,useContext as G,useRef as Q,useSyncExternalStore as X,useState as J,useReducer as _,useMemo as ee,useCallback as te,useLayoutEffect as ne}from"react";import{jsx as oe,jsxs as re,Fragment as ie}from"react/jsx-runtime";import{createPortal as le}from"react-dom";import{registerModalEscapeInterceptor as se,FloatingBar as ae,TextToolbar as ce,LinkPicker as de}from"efficient-shell/ui";function ue(e){return!["setData","setUi","set"].includes(e.type)}var pe=(e,t,n,o)=>{const r=A(e,t,z(n));return r?.[o]??null},fe=(e,t,n,o,r)=>{const i=pe(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function he(t,n){const{selection:o}=t;return{...t.ui,itemSelector:e(t.data,n,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function me(e,t,n){return n?"node"===n.kind?O(e,t,n.id)?n:null:n.parentId===M?A(e,t,n)?n:null:O(e,t,n.parentId)&&A(e,t,n)?n:null:null}function ge(e,n,o,r=!1){const{itemSelector:i,selectedSlot:l,...s}=o;let a=e.selection;var c;return"itemSelector"in o&&(a=t(e.data,n,i??null)),"selectedSlot"in o&&(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 ve(e,t,n){const o=ye(e,t,n);if(o===e)return e;const r=me(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function ye(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 ge(e,n,"function"==typeof t.ui?t.ui(he(e,n)):t.ui);case"set":{const r={data:o,ui:he(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=ge(l,n,i.ui,!0)),l}case"insert":{const r={...z(t.destinationZone),index:t.destinationIndex},i=L(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:j(o,n,r,i)}}case"replace":{const r=fe(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:V(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=fe(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=$(o,n,r.props.id),l=pe(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return ye(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=pe(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...z(t.destinationZone),index:t.destinationIndex};return{...e,data:P(o,n,r.props.id,i)}}case"remove":{const r=fe(o,n,t.zone,t.index,"remove");return{...e,data:R(o,n,r.props.id)}}default:return e}}var we={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},be={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},ke=0,Se=()=>`history-${ke+=1}`;function Ce(n){let o=n.config;const r=n.now??(()=>Date.now()),i=n.historyCoalesceMs??250;let l=n.permissions??{};const s=N(n.data,o);let a=s,c={data:s,selection:null,ui:{...be}};if(n.ui){const{itemSelector:e,selectedSlot:r,...i}=n.ui;c={data:s,selection:r?{kind:"slot",...r}:t(s,o,e??null),ui:{...be,...i}}}let d=[{core:c,at:-1/0,sealed:!0,id:Se()}],u=0;const p=e=>{const t=d[u],n=r();!e&&u===d.length-1&&u>0&&!t.sealed&&n-t.at<i?d=[...d.slice(0,u),{...t,core:c,at:n}]:(d=[...d.slice(0,u+1),{core:c,at:n,sealed:e,id:Se()}],u=d.length-1)},f=/* @__PURE__ */new Set;let h=null,m=null,g=0,v=null,y=!1;const w=()=>{for(const e of[...f])e()},b=()=>{d=[...d.slice(0,u),{...d[u],core:c},...d.slice(u+1)]},k=(e,t)=>{g>0?y=y||t:(t?p(!1):c!==e&&b(),c.data!==e.data&&n.onChange?.(c.data),c!==e&&w())},S=e=>{const t=c;if(c=ve(c,e,o),c===t)return;const n=e.recordHistory??ue(e);k(t,n&&c.data!==t.data)},C=e=>{0===g&&(v=c,y=!1),g+=1;try{e()}catch(e){throw g-=1,0===g&&v&&(c=v,v=null),e}if(g-=1,g>0||!v)return;const t=v;v=null,y&&c.data!==t.data?p(!0):c!==t&&b(),c.data!==t.data&&n.onChange?.(c.data),c!==t&&w()},I=e=>{const t=c,n=me(c.data,o,e);var r,i;(r=n,i=c.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))||(c={...c,selection:n},k(t,!1))},D=e=>{const t=c;u=e,c=d[u].core,c.data!==t.data&&n.onChange?.(c.data),c!==t&&w()},E=()=>(e={})=>{const t=e.root?o.root?.permissions:o.components[e.item?.type??e.type??""]?.permissions;return{...we,...l,...t}};let x=E();const M=B(),R={resolveCache:M,async resolveAll({trigger:e="load",metadata:t}={}){const n=c.data,r={type:"root",props:{...n.root.props??{}}},i=[...n.content,...Object.values(n.zones??{}).flat()],[l,...s]=await Promise.all([Z(r,o,{cache:M,trigger:e,metadata:t}),...i.map(n=>Z(n,o,{cache:M,trigger:e,metadata:t}))]);C(()=>{const t=c;let r=c.data;s.forEach((e,t)=>{if(!e.didChange)return;const l=i[t].props.id,s=O(r,o,l)?.node;s&&s===O(n,o,l)?.node&&(r=V(r,o,l,e.node))}),l.didChange&&r.root===n.root&&(r={...r,root:{...r.root,props:l.node.props,readOnly:l.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:me(r,o,c.selection)},k(t,!1))})},async resolveNode(e,{trigger:t="replace",metadata:n}={}){const r=O(c.data,o,e)?.node;if(!r)return!1;const i=await Z(r,o,{cache:M,trigger:t,metadata:n});if(!i.didChange)return!1;let l=!1;return C(()=>{const t=c;if(O(c.data,o,e)?.node!==r)return;const n=V(c.data,o,e,i.node);n!==c.data&&(c={...c,data:n,selection:me(n,o,c.selection)},k(t,!1),l=!0)}),l},get config(){return o},get loaded(){return a},getState(){if(h&&m===c)return h;const t=c,n={data:t.data,ui:he(t,o)},r="node"===t.selection?.kind?O(t.data,o,t.selection.id)?.node??null:null;return h={appState:n,selection:t.selection,selectedItem:r,config:o,dispatch:S,history:{back:()=>R.undo(),forward:()=>R.redo(),hasPast:u>0,hasFuture:u<d.length-1,histories:d.map(e=>({id:e.id,state:{data:e.core.data,ui:he(e.core,o)}})),index:u,setHistoryIndex:e=>{e>=0&&e<d.length&&e!==u&&D(e)}},getPermissions:x,getItemById:e=>O(t.data,o,e)?.node,getItemBySelector:e=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return A(e,t,{parentId:o,slot:r})?.[n.index]}(t.data,o,e),getSelectorForId:n=>{const r=e(t.data,o,{kind:"node",id:n});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},m=t,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:S,batch:C,group:()=>{const e=u,t=d[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,d[e]?.id!==t)return;if(u<=e+1)return void(u===e+1&&(d=[...d.slice(0,u),{...d[u],sealed:!0},...d.slice(u+1)]));const o=d[u];d=[...d.slice(0,e+1),{...o,sealed:!0},...d.slice(u+1)],u=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){C(()=>{const t=c,n=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:me(e.data,o,n)},k(t,e.data!==t.data)})},load(e,t={}){const n=c,r=N(e,o);c={...c,data:r,selection:me(r,o,t.selection??c.selection)},a=r,t.keepHistory||(d=[{core:c,at:-1/0,sealed:!0,id:Se()}],u=0),c!==n&&w()},undo(){u>0&&D(u-1)},redo(){u<d.length-1&&D(u+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,x=E(),h=null,w())},setConfig(e){e!==o&&(o=e,x=E(),h=null,w())}};return R}function Ie(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&&b(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 De=U(null),Ee=U(!0);function xe({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return q(()=>{n&&e.resolveAll()},[e,n]),q(()=>{if(t&&"undefined"!=typeof document)return Ie(document,e)},[e,t]),/* @__PURE__ */oe(De.Provider,{value:e,children:/* @__PURE__ */oe(Ee.Provider,{value:t,children:o})})}function Oe(){const e=G(De);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function Me(e){const t=Oe(),n=Q({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 X(t.subscribe,o,o)}function Ae(){return function(e){return Me(e)}}var Re=["--es-accent","--es-accent-tint","--es-accent-tint-strong","--es-accent-line","--es-accent-text","--es-accent-ring","--es-accent-shadow","--es-on-accent","--status-success-solid","--elevation-panel"],ze="host-tokens";function Pe(e,t){const n=function(e){const t=e.ownerDocument.defaultView;if(!t)return"";const n=t.getComputedStyle(e),o=[];for(const e of Re){const t=n.getPropertyValue(e).trim();t&&o.push(`${e}: ${t};`)}return o.length?`:root { ${o.join(" ")} }`:""}(e);n?k(t,ze,n):S(t,ze)}var $e="data-easel-block",Ve="data-easel-dropzone",Le={},je="data-es-mirror",Ne="undefined"==typeof window?q:ne;function Be(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${je}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(je,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Ke({children:e,id:t="preview-frame",title:n,className:o,style:r,mirrorStyles:i=!0,onDocument:s,height:a="auto",nonce:c}){const d=g("canvas",l),u=Q(null),[p,f]=J(null);return Ne(()=>{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]),Ne(()=>{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-easel-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(i&&o){Be(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Be(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}let r=null;const l=u.current;if(l&&o){Pe(l,e);const t=o.defaultView;if(t&&"MutationObserver"in t){r=new t.MutationObserver(()=>Pe(l,e)),r.observe(o.head,{childList:!0,subtree:!0,characterData:!0});const n={attributes:!0,attributeFilter:["class","style","data-theme"]};for(const e of[o.documentElement,o.body,l.closest(".es-editor")])e&&r.observe(e,n)}}return()=>{n?.disconnect(),r?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */oe("iframe",{ref:u,id:t,title:n??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",o??""].filter(Boolean).join(" "),style:r,children:p?le(e,p):null})}var Ze=U(null),Fe=U(Le),Te=[];function He({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=Oe(),s=Me(n=>A(n.appState.data,l.config,{parentId:e,slot:t})??Te),a=Me(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==M),c=Me(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=G(Ze),u=["es-zone"];return s.length&&u.push("has-children"),e===M&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==M&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */oe("div",{className:u.join(" "),[Ve]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */oe(Je,{node:e},e.props.id))})}function We(e,t,n,o){const r=ee(()=>{const n={};for(const o of T(H(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
|
|
2
|
-
return oe(He,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=W(n[e],o);return r}function Ye(e){return ee(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return oe(He,{parentId:e,slot:t,...n})},[e])}var Ue=["top","bottom","zIndex"];function qe(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ge(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));qe(e,"position",t?"sticky":"relative");for(const n of Ue)qe(e,n,t?.[n]??"");return!!t}var Qe="data-es-canvas-relative";function Xe(e){e.hasAttribute(Qe)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Qe));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Qe,"")),!1)}function Je({node:e}){const t=Oe().config,n=t.components[e.type],o=e.props.id,r=Q(null),i=function(e,t){return ee(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute($e),o.removeAttribute("data-easel-dnd")),t.current=n,n&&(n.setAttribute($e,e),n.setAttribute("data-easel-dnd",e),Xe(n))},[e,t])}(o,r),l=Q(null),s=!!n?.inline;!function(e,t){const n=Q(!1),o=Q(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=Q(()=>{});Ne(()=>o.current()),Ne(()=>{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=()=>{}}},[])}(()=>s?r.current:l.current,e=>s?Xe(e):Ge(e));const a=G(Fe),c=We(n,o,e.props,t.components),d=Ye(o);if(!n?.render)return null;const u=n.render,p={...Y(n),...e.props,...c},f={renderDropZone:d,isEditing:!0,dragRef:n.inline?i:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */oe(u,{...p,editor:f,editMode:!0}):
|
|
4
|
-
/* @__PURE__ */oe("div",{ref:l,[$e]:o,"data-easel-dnd":o,style:{position:"relative"},children:/* @__PURE__ */oe(u,{...p,editor:f,editMode:!0})})}function _e({metadata:e}){const t=Me(e=>e.config),n=Me(e=>e.appState.data.root).props??{},o=t.root?.render,r=We(t.root,M,n,t.components),i=Ye(M),l=/* @__PURE__ */oe(He,{parentId:M,slot:F}),s=o?/* @__PURE__ */oe(o,{id:"page-root",...n,...r,editor:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
|
|
5
|
-
return oe(Fe.Provider,{value:e??Le,children:s})}var et=U(void 0),tt=U(void 0);function nt(e,t,n,o){const r=O(e,t,n);return!!r&&(K(r.node,t).length>0||!1===o.whole)}var ot=U(void 0);function rt({element:e}){const t=Q(null),n=st(t,e?()=>e:null,e);/* @__PURE__ */
|
|
6
|
-
return oe("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"}})}var it={"--es-words-clear":`${C}px`};function lt({element:e,words:t=!1}){const n=Q(null),o=st(n,e?()=>e:null,e);/* @__PURE__ */
|
|
7
|
-
return oe("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-selected is-selected-part"+(t?" is-words":""),style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,...it}:{display:"none"}})}function st(e,t,n){return ct(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var at=[];function ct(e,t,n){const[o,r]=J(at),i=Q(t);return i.current=t,Ne(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(at);let o=0;const l=()=>{o=0;const n=e.current?.parentElement??null,l=(i.current?i.current(t):[]).map(e=>function(e,t){if(!e||!t)return null;const n=E(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(e,n)).filter(e=>null!==e);r(e=>{return(t=e)===(n=l)||t.length===n.length&&t.every((e,t)=>function(e,t){return e===t||!!e&&!!t&&e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height}(e,n[t]))?e:l.length?l:at;var t,n})},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 dt({id:e,kind:t,overlay:n}){const o=Q(null),r=G(tt),i=null!==e&&!0===r?.(e),l=ct(o,e?t=>x(t,`[${$e}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=l,c=`es-canvas-outline is-${t}${i?" is-shared":""}`,d=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height}),u=/* @__PURE__ */re(ie,{children:[
|
|
8
|
-
/* @__PURE__ */oe("div",{ref:o,"aria-hidden":"true",className:c,style:s?d(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */oe("div",{"aria-hidden":"true",className:c,style:d(e)},t))]});return n&&e?/* @__PURE__ */oe(n,{componentId:e,kind:t,children:u}):u}function ut(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 pt({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=Q(null),[v,y]=J(!1),[w,b]=J(null),k=v||null!==w,S=()=>{e.hold(),y(!1),b({href:e.pressed().href})},C=()=>{y(!1),b(null),e.resume()};ne(()=>{r.current={escape:()=>!!k&&(C(),!0),link:()=>!!s.has("link")&&(S(),!0)}}),ne(()=>()=>{r.current=null},[r]);const D=Q(C);D.current=C,q(()=>{if(v)return se(e=>{const t=h.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(D.current(),!0)},()=>h.current?.querySelector(".es-copy-colors"))},[v]),q(()=>{const n=h.current;if(!k||!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),b(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)}},[k,e,t]),ne(()=>{const e=h.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(k&&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?I(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?I(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 b=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=`${b.top}px`,n.style.left=`${b.left}px`,n.style.setProperty("--es-pop-point",`${b.point}px`),n.dataset.side=b.above?"above":"below"});const E=f?{run:u(l.color,f),open:v,onToggle:()=>{b(null),v?C():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
|
|
9
|
-
return oe(ae,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?I(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__ */oe("div",{ref:h,children:/* @__PURE__ */oe(ce,{layout:"row",offered:s,pressed:l.marks,onMark:t=>{"link"===t?S():e.press(t)},color:E,linkOpen:null!==w,list:{pressed:l.list,onList:t=>e.list(t)},clear:l.clearable?{onClear:()=>e.clear()}:void 0,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__ */re(ie,{children:[v&&f?/* @__PURE__ */oe(p,{colors:f,current:l.color,words:i.colors??m.colors,onPick:t=>e.color(t)}):null,w?
|
|
10
|
-
/* @__PURE__ */oe(de,{className:"es-copy-link es-copy-pop",value:w.href??"",onApply:t=>{b(null),e.link(t)},onRemove:null!==w.href?()=>{b(null),e.link(null)}:void 0,onCancel:C}):null]})})})})}function ft({element:e,which:t}){const n=Q(null),o=st(n,()=>e(),t);/* @__PURE__ */
|
|
11
|
-
return oe("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,...it}:{display:"none"}})}function ht({frame:e=!0,className:t,style:n,metadata:s,mirrorStyles:a,onDocument:c,height:d,title:u,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:b,typing:k,passThrough:S}){const C=Oe(),I=G(et),E=S??I,x=G(Ee),M=g("canvas",l),A=h??x,[R,z]=J(void 0),P=Me(e=>"node"===e.selection?.kind?e.selection.id:null),[$,V]=J(null),[L,j]=J(null),N=G(ot),[,B]=_(e=>e+1,0),Z=e=>{N?.select(e),B()},[F,T]=J(null),H=Q(null),[,W]=J(0),Y=Q(k);Y.current=k;const U=Q(null),X=Q(null),ee=()=>{if(!P)return null;const e=Y.current?.atSelection?.()?.element()??null;if(!e)return null;const t=X.current?.ownerDocument;if(N){const n=N.selected()&&t?N.selectedPart?.(t)??null:null;return n&&w(n.element,e)?n.element:null}const n=O(C.getState().appState.data,C.config,P);return n&&0===K(n.node,C.config).length?e:null},te=Me(e=>e.appState.data),ne=N?.selected()??null;q(()=>{const e=X.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=P&&!F&&Y.current?.atSelection?.()?P:null,o=n?ee():null;e.dispatchEvent(new t(y,{detail:o?{id:n,words:o}:{id:n}}))},[P,F,te,ne]);const ie=e=>{const t=X.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(D,{detail:{typing:e}}))},le=(e,t)=>{H.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:ut(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>W(e=>e+1),onEscape:()=>U.current?.escape()??!1,onLinkKey:()=>U.current?.link()??!1,end:e=>{o.close(),H.current?.element===r&&(H.current=null),T(null),ie(!1),Y.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${$e}]`)?.getAttribute($e);return l&&C.select(l),H.current={s:i,element:r,target:e},T(()=>r),V(null),ie(!0),Y.current?.onChange?.({typing:!0,element:n}),!0};q(()=>()=>H.current?.s.stop("stop"),[]);const se=e=>{const t=H.current?.element();return Boolean(t&&t.contains(e))},ae=(e,t)=>nt(C.getState().appState.data,C.config,e,t),ce=e=>{const t=e.closest?.(`[${$e}]`)?.getAttribute($e);if(!t)return;const n=C.getState(),o="node"===n.selection?.kind?n.selection.id:null,l=N?.partAt(e,t)??null;if(l){const e=r(n.appState.data,C.config,t,l.id,o,N?.selected()??null,E);if(e)return{node:e.node,part:e.part?l:null}}return{node:i(n.appState.data,C.config,t,o,E)??t,part:null}},de=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(H.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=Y.current?.atSelection?.();n&&le(n,null)&&e.preventDefault()},ue=X.current?.ownerDocument??null,pe=N?.selected()&&ue&&P?N.selectedPart?.(ue)??null:null,fe=pe&&P&&ae(P,pe)?pe.element:null,he=F?null:ee(),me=/* @__PURE__ */re("div",{ref:X,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),H.current){if(se(t))return;H.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=ce(t);if(void 0!==o)return C.select(o.node),void(N&&(o.part?.id??null)!==N.selected()&&Z(o.part?.id??null));t.hasAttribute?.(Ve)||(C.select(null),N?.selected()&&Z(null))},onDoubleClick:e=>{const t=Y.current;if(!t||se(e.target))return;const n=t.at(e.target);n&&le(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>de(e),onMouseOver:e=>{if(H.current)return;const t=ce(e.target),n=!!t?.part&&ae(t.node,t.part),o=t?.part&&n&&t.part.id!==N?.selected()?t.part:null,r=!t||t.part&&n?null:t.node;r!==$&&V(r),o?.id===L?.id&&o?.element===L?.element||j(o)},onMouseLeave:()=>{V(null),j(null)},children:[
|
|
12
|
-
/* @__PURE__ */oe(Ze.Provider,{value:$,children:/* @__PURE__ */oe(_e,{metadata:s})}),
|
|
13
|
-
/* @__PURE__ */re("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
14
|
-
/* @__PURE__ */oe(dt,{id:!F&&$&&$!==P?$:null,kind:"hover",overlay:v}),N?/* @__PURE__ */oe(rt,{element:F||!L||L.id===N.selected()?null:L.element}):null,he||fe?/* @__PURE__ */oe(lt,{element:F?null:he??fe,words:null!==he}):null,
|
|
15
|
-
/* @__PURE__ */oe(dt,{id:F||fe||he?null:P,kind:"selected",overlay:v}),F?/* @__PURE__ */oe(ft,{element:()=>{const e=F?.()??null;return e?pe&&w(pe.element,e)?pe.element:e:null},which:pe?.element??F}):null]}),b]}),ge=m?/* @__PURE__ */oe(m,{document:R,children:me}):me;q(()=>{if(R&&A)return Ie(R,C)},[R,A,C]),q(()=>{if(!R)return;const e=e=>{if("Enter"===e.key)return void de(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 Z(null);const r=o(n.appState.data,C.config,n.selection);"node"===r?.kind&&C.select(r.id)};return R.addEventListener("keydown",e),()=>R.removeEventListener("keydown",e)},[R,C,N]);/* @__PURE__ */
|
|
16
|
-
return re("div",{className:"es-canvas"+(t?` ${t}`:""),style:n,"data-easel-preview":"","data-es-typing":F?"":void 0,children:[F&&H.current?.target.toolbar?/* @__PURE__ */oe(pt,{s:H.current.s,element:H.current.element,toolbar:H.current.target.toolbar,label:M.textTools,keys:U}):null,e?/* @__PURE__ */oe(Ke,{mirrorStyles:a,onDocument:e=>{z(e??void 0),c?.(e)},height:d,title:u,nonce:p,children:ge}):/* @__PURE__ */oe("div",{id:"preview-frame","data-easel-entry":"",children:ge})]})}function mt(e={}){const t=Oe(),o=Me(e=>e.appState.data);return n({...e,data:o,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function gt(){return yt(Me(e=>e.selectedItem))}function vt(){return yt(null)}function yt(e){const t=Oe(),n=Me(e=>e.config),o=t.resolveCache,r=Me(e=>e.appState.data.root),i=e?e.props.id:"root",l=r.props??{},a=ee(()=>e||{type:"root",props:l},[e,l]),c=e?n.components[e.type]:n.root,d=t.getState(),u=e?O(d.appState.data,n,i):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=s({id:i,node:a,block:c,parent:f,appState:d.appState}),m=Me(t=>!1===t.getPermissions(e?{item:e}:{root:!0}).edit),g=te(e=>{(async()=>{const r=t.getState();if("root"!==i){const l=r.getItemById(i),s=r.getSelectorForId(i);if(!l||!s)return;const a={...l,props:{...l.props,...e}},{node:c}=await Z(a,n,{cache:o,trigger:"replace"}),d=t.getState().getSelectorForId(i);if(!d)return;return void t.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const l=r.appState.data.root.props??{},{node:s}=await Z({type:"root",props:{...l,...e}},n,{cache:o,trigger:"replace"});t.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[t,n,o,i]),v=te((e,t)=>g({[e]:t}),[g]);return{id:i,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{Ke as CanvasFrame,ot as CanvasPartsContext,et as CanvasPassThroughContext,tt as CanvasSharedContext,be as DEFAULT_UI,ht as EaselCanvas,xe as EaselProvider,_e as EditDocument,Ie as bindUndoKeys,Ce as createEasel,Ae as createUseEasel,nt as partHasOwnBox,ue as recordsByDefault,ve as reduce,he as uiView,Me as useEasel,Oe as useEaselApi,mt as useEaselNodeOps,vt as useRootFields,gt as useSelectedFields,me as validSelection};
|
package/dist/chunk-J5OSNZPU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-YM4UEGBV.js";import{useHostEscape as t}from"./chunk-MQA7OFRA.js";import{createNodeClipboard as o,nodeMenuItems as l}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as r}from"./chunk-WK3AFPXY.js";import{DEFAULT_SCREEN_WORDS as i}from"./chunk-IYHO4XQX.js";import{ROOT_ZONE as c}from"./chunk-TCAAOYQY.js";import{easelMenuEntries as s,menuLabel as a}from"./chunk-FIVU2COQ.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-YU3WHLGI.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as y}from"./chunk-TGZCD6IP.js";import{useState as h,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,StylesIcon as O,LayersIcon as z,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function Y(e,n){const t=[],o=/* @__PURE__ */new Set;let l={zone:n.zone,index:n.index};for(;l;){const n=e.nodeAt(l.zone,l.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:l.zone,index:l.index,node:n,parentType:null}),l.zone===c)break;const r=l.zone.lastIndexOf(":");if(r<=0)break;l=e.locate(l.zone.slice(0,r))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var j=o(),D=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return j;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",o);let t=D.get(n);return t||(t=o(),D.set(n,t)),t}function I(){return M(n())}function K(e,n,t){if(n===c){const{floor:n,cap:o}=e.sectionBand();return{parentId:y,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 T(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 S(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?K(e,t.zone,t.index+1):null;for(const l of Y(e,t)){const t=K(e,l.zone,l.index+1);if(o(n,t))return t}return null}function X(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=T(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:S(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function L(n,t){const{zone:o,index:r}=t,i=n.nodeAt(o,r);if(!i)return[];const s=i.props.id,a=n.labelOf(i.type,o),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,o),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),y=n.permits?.(i)??{duplicate:!0,delete:!0},h=T(n,i,o),k=Y(n,t),b=d.held,v=b&&!p?S(n,b,t):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,o),onCopy:()=>n.style?.copy(i,o),onPaste:()=>n.style?.paste(o,r,i),words:n.words?.styleClipboard}):[];return l({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,t)=>{const o={label:n.rowNameOf(e.node,e.zone),checked:0===t,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},l=e.zone===c?null:n.slotRung?.(e.zone)??null;return l?[o,{label:l.label,checked:!1,onClick:l.select}]:[o]})},actions:{duplicate:g&&m&&y.duplicate?()=>d.duplicate(s):void 0,...R(g&&!p,e=>d.canStep(s,e),e=>d.step(s,e)),copy:h.copy?()=>d.copy(s,a):void 0,cut:g&&h.cut?()=>d.cut(s,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,o)?()=>n.beginRename(o,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:g&&m&&y.delete?()=>d.remove(s):void 0},style:w,extras:n.menuRows?.(i,o,r)??void 0,pinnedLine:p?U(n).pinned:void 0})}function R(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var U=e=>e.words?.screen??i.menu;function V(e){const n=U(e),t=!e.readOnly,o=[];t&&e.history.hasPast&&o.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),t&&e.history.hasFuture&&o.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const l=[],s=e.nodeOps.held,a=K(e,c,e.sectionBand().cap);if(t&&s&&(e.canPasteAt?e.canPasteAt(s,a):f(s.from)===c)){const n=a,t=e.words?.menu??r;l.push({label:t.pasteNamed({paste:t.paste,label:s.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[o,l,[...e.openPageStyles?[{label:e.pageStylesLabel??i.pageStyles,icon:/* @__PURE__ */A(O,{}),onClick:e.openPageStyles}]:[],{label:n.collapseAll,icon:/* @__PURE__ */A(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),i=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},c=e.words?.menu??r,s=U(e),a=[];l&&(a.push({label:c.copy,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),a.push({label:c.cut,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),i("")}})),a.push({label:c.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&i(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 F(e){return e.shiftKey}function N(e,n){const[o,l]=h(null),r=k(()=>l(null),[]);t(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=X(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(n,"keydown",c);const a=k(n=>{if(F(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(n,"contextmenu",t=>{if(F(t)||!n)return;const o=t.target?.closest?.("[data-easel-block]")??null,r=o?.getAttribute("data-easel-block"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(G,{host:e,target:o,onClose:r}):null,closeMenu:r}}function G({host:e,target:n,onClose:t}){const o="node"===n.kind?L(e,n):"input"===n.kind?B(e,n.el):V(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{j as EASEL_NODE_CLIPBOARD,Y as ancestorChain,M as nodeClipboardOf,T as nodeClipboardRules,L as nodeMenuItems,X as nodeShortcut,V as pageMenuItems,S as pastePlace,E as runNodeShortcut,B as textMenuItems,I as useNodeClipboard,N as useNodeContextMenu};
|
package/dist/chunk-MQA7OFRA.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createContext as e,useContext as n,useRef as r,useEffect as c}from"react";import{jsx as s}from"react/jsx-runtime";var t={connected:!1,ownsDocument:!0,send:()=>{},subscribe:()=>()=>{},address:{search:()=>"",show:()=>{},load:()=>{},reload:()=>{}}},o=e(t);function a({host:e,children:n}){/* @__PURE__ */
|
|
2
|
-
return s(o.Provider,{value:e,children:n})}function d(){return n(o)}function i(e,n){const s=d(),t=r(n);t.current=n,c(()=>{if(e&&s.claimEscape)return s.claimEscape(e=>"Escape"===e.key&&(t.current(),!0))},[e,s])}function l(e){const n=/* @__PURE__ */new Set;return{host:{connected:!0,ownsDocument:!1,send:(n,r)=>{e.onMessage({type:n,...r})},subscribe:e=>(n.add(e),()=>{n.delete(e)}),address:e.address,...e.claimEscape?{claimEscape:e.claimEscape}:null,...e.panels?{panels:e.panels}:null},deliver:e=>{for(const r of[...n])r(e)}}}export{t as DETACHED_EASEL_HOST,o as EaselHostContext,a as EaselHostProvider,l as createEaselHost,d as useEaselHost,i as useHostEscape};
|
package/dist/chunk-S3DUFDQ6.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{SettingRow as e,Segmented as a,Tooltip as i}from"efficient-shell/ui";import{jsx as s,jsxs as l}from"react/jsx-runtime";function n({label:a,labelId:i,icon:l,value:n,hint:t,changed:c,htmlFor:d,action:o,children:r,className:b}){/* @__PURE__ */
|
|
2
|
-
return s(e,{size:"compact",label:a,labelId:i,icon:l,readout:n,description:t,changed:c,controlId:d,action:o,value:r,className:b})}function t({options:e,value:n,onChange:t,ariaLabel:c,fit:d,disabled:o=!1,className:r}){const b=d&&function(e,a){return{"--es-fit-count":e,"--es-fit-labels":`${a.labelsPx}px`,"--es-fit-widest":`${a.widestLabelPx}px`}}(e.length,d),m=e.findIndex(e=>e.id===n);
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
return s("div",{className:"es-segs-fit","data-disabled":o||void 0,style:b,children:/* @__PURE__ */s(a,{size:"sm",label:c,className:`es-segs${b?" is-measured":""}${r?` ${r}`:""}`,value:m<0?"":String(m),onChange:a=>t(e[Number(a)].id),options:e.map((e,a)=>{const n=e.title??("string"==typeof e.label?e.label:void 0),t="string"!=typeof e.label,c=a=>n&&(e.icon||t)?/* @__PURE__ */s(i,{content:n,children:a}):a;return{value:String(a),disabled:o||!0===e.disabled,icon:e.icon?c(
|
|
5
|
-
/* @__PURE__ */s("span",{className:"es-seg-icon","aria-hidden":"true",children:e.icon})):void 0,label:t?/* @__PURE__ */l("span",{className:"es-seg-word",children:[c(/* @__PURE__ */s("span",{"aria-hidden":"true",children:e.label})),
|
|
6
|
-
/* @__PURE__ */s("span",{className:"es-vh",children:n})]}):/* @__PURE__ */s("span",{className:"es-seg-word",children:e.label})}})})})}export{n as SettingsField,t as SettingsSegmented};
|
package/dist/chunk-SSRYU3YG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{textFieldIdentifier as n}from"./chunk-ANPOR6EY.js";import{hidableText as r}from"./chunk-6UAEFOJ4.js";function t(n,t){const o=r(n.props.name);if(o)return o;const e=r(n.props.altName);if(e)return e;const c=n.props.collection?.name;if(c)return c;const u=n.props.source?.title;if(u)return u;const s=n.props.code;return s?t?.(s)??s:""}function o(n,r,o,e,c){const u=o(t(n,e))||r(n.type);return c?c(n,"block",u):u}function e(r){if(!r)return null;for(const t of["name","altName"])if(n(r[t]))return t;return null}function c(r){const t=r?.name;return void 0===t||n(t)?"name":null}function u(n,t,o){const e=r(n.props?.name).trim()||t;return o?o(n,"section",e):e}export{u as rootRowName,c as sectionRenameProp,t as slotChildName,e as slotChildRenameProp,o as slotChildRowName};
|