efficient-easel 26.5.0 → 26.6.1
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 +3 -1
- package/dist/{chunk-XC4PINYS.js → chunk-2QXMDK67.js} +8 -8
- package/dist/{chunk-XVQNVPIK.js → chunk-3JIBSQZI.js} +40 -40
- package/dist/{chunk-LKP5V3GT.js → chunk-A2B6FLZP.js} +1 -1
- package/dist/chunk-BAI7MIH4.js +1 -0
- package/dist/{chunk-OKJ6KH24.js → chunk-CVS3RPO6.js} +1 -1
- package/dist/{chunk-UJU42JM4.js → chunk-EEIDFHOG.js} +11 -11
- package/dist/{chunk-YAFMYW4J.js → chunk-EVYIDHCK.js} +18 -15
- package/dist/chunk-EZXQJN6V.js +4 -0
- package/dist/{chunk-R76RCEEC.js → chunk-GQXH7DQV.js} +1 -1
- package/dist/{chunk-2C2IUWBH.js → chunk-M42IJ4HT.js} +4 -4
- package/dist/chunk-ODHJRBJV.js +5 -0
- package/dist/{chunk-Y5M64LEB.js → chunk-QYSNJDMW.js} +1 -1
- package/dist/chunk-TGFPW4YU.js +1 -0
- package/dist/{chunk-UQAN4BIP.js → chunk-YBDSG4BV.js} +1 -1
- package/dist/draw/index.d.ts +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +15 -15
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/content/style-keys.d.ts +13 -1
- package/dist/screen/lib/content/style-keys.js +1 -1
- package/dist/screen/lib/document/block-set-host.js +1 -1
- package/dist/screen/lib/document/block-size-fields.js +1 -1
- package/dist/screen/lib/document/box-fields.js +1 -1
- package/dist/screen/lib/document/button-fields.d.ts +4 -0
- package/dist/screen/lib/document/button-fields.js +1 -1
- package/dist/screen/lib/document/image-fields.js +4 -4
- package/dist/screen/lib/document/style-fields.d.ts +5 -0
- package/dist/screen/lib/document/style-fields.js +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4O4FSRJL.js +0 -1
- package/dist/chunk-BTQ3FJKT.js +0 -1
- package/dist/chunk-FWPKYUGM.js +0 -5
- package/dist/chunk-SS2NY7PP.js +0 -4
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{sidesStartEach as e,SidesInput as n,SidesEachToggle as t}from"./chunk-CLAADE4J.js";import{SettingsDefaultReset as l}from"./chunk-2T22IY3J.js";import{deviceField as o}from"./chunk-7GGNFLHT.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as s}from"./chunk-CWELHADJ.js";import{phoneKey as u}from"./chunk-E52W3M5I.js";import{foldMetaOf as c,FOLD_FIELD_MARKER as d}from"./chunk-ANPOR6EY.js";import{useSelectedHost as p,useEaselApi as f,useEasel as b}from"./chunk-
|
|
2
|
-
return Y(q,{},e)}function ee(e){return e.type===q}function ne(e){return ee(e)?void 0:e}function te(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!c(t)&&s(t,`section:${n}`);return e}function le(e,n){return{type:"custom",[d]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */Y(_,{})}}function oe(e){return le(e,2)}function ae(e){return le(e,1)}var ie=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],re=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],se="Wrap",ue=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],ce="Direction",de=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],pe={min:-32,max:64,step:2,builtIn:0},fe={min:30,max:100,step:5,fallback:60},be=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],me="bottom-left",he={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},ve=be.map(e=>({value:e,label:he[e]}));function ge(e,n=me){return be.includes(e)?e:n}var ye=40,ke=e=>"number"==typeof e?e:null;function we(e,n,t){const l={};for(const o of["x","y"])t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}var xe=["top","right","bottom","left"],Ce={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},
|
|
1
|
+
import{sidesStartEach as e,SidesInput as n,SidesEachToggle as t}from"./chunk-CLAADE4J.js";import{SettingsDefaultReset as l}from"./chunk-2T22IY3J.js";import{deviceField as o}from"./chunk-7GGNFLHT.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as s}from"./chunk-CWELHADJ.js";import{phoneKey as u}from"./chunk-E52W3M5I.js";import{foldMetaOf as c,FOLD_FIELD_MARKER as d}from"./chunk-ANPOR6EY.js";import{useSelectedHost as p,useEaselApi as f,useEasel as b}from"./chunk-EVYIDHCK.js";import{DEFAULT_PANEL_WORDS as m}from"./chunk-56ID6FKZ.js";import{SettingsSwitch as h}from"./chunk-OECWLNKJ.js";import{FieldSelect as v}from"./chunk-KFWNGPW3.js";import{SettingsField as g}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as y}from"./chunk-DX3VILZ3.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{useState as w}from"react";import{AlignmentIcon as x,BoxJustifyIcon as C,WrapIcon as j,GapIcon as F,WidthIcon as L,PlacementIcon as O,NudgeIcon as S,DesktopIcon as E,BoxXEndIcon as P,BoxXCenterIcon as I,BoxXStartIcon as R,PaddingAllIcon as A,BoxYBetweenIcon as M,BoxYStretchIcon as K,BoxYEndIcon as W,BoxYCenterIcon as B,BoxYStartIcon as G,BoxXBetweenIcon as N,BoxXStretchIcon as T,BoxItemAlignmentIcon as V}from"efficient-shell/icons/efficient";import{textAlignOptions as $,AlignmentGrid as D,PositionInput as H,Slider as J}from"efficient-shell/ui";import{jsx as Y,Fragment as _,jsxs as X}from"react/jsx-runtime";var z=e=>e;function Z(e,n){return e("{value} on desktop").replace("{value}",n)}var U=()=>{};function q(){return null}function Q(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
|
|
2
|
+
return Y(q,{},e)}function ee(e){return e.type===q}function ne(e){return ee(e)?void 0:e}function te(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!c(t)&&s(t,`section:${n}`);return e}function le(e,n){return{type:"custom",[d]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */Y(_,{})}}function oe(e){return le(e,2)}function ae(e){return le(e,1)}var ie=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],re=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],se="Wrap",ue=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],ce="Direction",de=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],pe={min:-32,max:64,step:2,builtIn:0},fe={min:30,max:100,step:5,fallback:60},be=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],me="bottom-left",he={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},ve=be.map(e=>({value:e,label:he[e]}));function ge(e,n=me){return be.includes(e)?e:n}var ye=40,ke=e=>"number"==typeof e?e:null;function we(e,n,t){const l={};for(const o of["x","y"])t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}var xe=["top","right","bottom","left"],Ce={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},je=e=>"number"==typeof e?e:null;function Fe(e,n,t){const l={};for(const o of xe)t[o]!==n[o]&&(l[e[o]]=t[o]??void 0);return l}function Le(e){if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const n=e&&"object"==typeof e?e:{};return Object.fromEntries(xe.map(e=>[e,je(n[e])]))}function Oe(e){const n={};for(const t of xe)"number"==typeof e[t]&&(n[t]=e[t]);return Object.keys(n).length?n:void 0}function Se(e,n={}){const t=n=>{const t=n[e];return t&&"object"==typeof t?t:{}},l=e=>Object.hasOwn(n,e)?n[e]:e;return{read:(e,n)=>t(e)[l(n)],write:(n,o,a)=>{const i={...t(n)};return void 0===a?delete i[l(o)]:i[l(o)]=a,{[e]:Object.keys(i).length?i:void 0}}}}function Ee(e,n,t){const l=Pe(e),o=p();if(t)return[t.value,t.onChange];const a=o?.values??{};return[e.read(a,n),e=>l([[n,e]])]}function Pe(e){const n=p(),t=function(){try{return f()}catch{return null}}();return l=>{if(!n)return;const o=t?.getState(),a=(o?"root"===n.id?o.appState.data.root.props:o.getItemById(n.id)?.props:void 0)??n.values??{};let i={};for(const[n,t]of l)i={...i,...e.write({...a,...i},n,t)};n.onChangeMany(i)}}var Ie={read:(e,n)=>e[n],write:(e,n,t)=>({[n]:t})},Re={fieldKey:u,ownField:!0,read:(e,n)=>e[u(n)],write:(e,n,t)=>({[u(n)]:t})};function Ae(e){return{...Se(e),fieldKey:n=>`_${e}_${n}`}}function Me({row:e,desktopKey:n,access:t,props:l}){const o=p(),a=o?.values?.[n],[i,r]=Ee(t,n);return t.ownField?e.render({...l,follows:a,twinAccess:t}):e.render({...l,value:i,storedValue:i,follows:a,twinAccess:t,onChange:r})}function Ke(e,n,t=Re,l={}){const a=l.phoneRow??n,i={...a,render:n=>/* @__PURE__ */Y(Me,{row:a,desktopKey:e,access:t,props:n})};return{[e]:o("desktop",n),[t.fieldKey(e)]:o("mobile",i)}}var We=["left","center","right"];function Be(e,{options:n,value:t,onChange:l,ariaLabel:o,disabled:a=!1}){/* @__PURE__ */
|
|
3
3
|
return Y(y,{options:n.map(n=>n.picture?{id:n.value,label:n.picture,title:e(n.title??n.label)}:{id:n.value,label:e(n.label),title:void 0===n.title?void 0:e(n.title)}),value:t,onChange:l,ariaLabel:e(o),disabled:a})}function Ge(e,{label:n,value:t,onChange:l,points:o}){const a=o.find(e=>e.disabled),i=o.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
|
|
4
|
-
return Y(g,{label:e(n),icon:/* @__PURE__ */Y(O,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */Y(
|
|
5
|
-
return Y(_e,{say:e,o:t,fallback:o,value:s,follows:u,readOnly:l.readOnly,onChange:e=>{const n=
|
|
4
|
+
return Y(g,{label:e(n),icon:/* @__PURE__ */Y(O,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */Y(D,{label:e(n),value:t,points:i,onChange:l})})}function Ne({say:e,label:n,value:t,onChange:l,pointsFor:o}){const{appState:a,selectedItem:i}=b(e=>e),r=i?.props?.id?String(i.props.id):void 0;return Ge(e,{label:n,value:t,onChange:l,points:o(a?.data,r)})}function Te({say:e,o:n}){const t=p(),o=k("panel",m),a=t?.values??{},i={x:ke(a[n.keys.x]),y:ke(a[n.keys.y])},r=e(n.label??"Position"),s=Boolean(i.x||i.y),u=e=>{const l=we(n.keys,i,e);Object.keys(l).length&&t?.onChangeMany(l)},c=/* @__PURE__ */Y(H,{label:r,value:i,onChange:u,words:{x:e("Left and right"),y:e("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:n.min,max:n.max,step:n.step??1}),d=/* @__PURE__ */Y(l,{words:o,label:r,changed:s,detail:"0 px, 0 px",onReset:()=>u({x:null,y:null})});return null===n.label?/* @__PURE__ */X("div",{className:"sf-position-line",children:[c,d]}):/* @__PURE__ */Y(g,{label:r,icon:/* @__PURE__ */Y(S,{}),changed:s,action:d,children:c})}var Ve={x:{start:/* @__PURE__ */Y(R,{}),center:/* @__PURE__ */Y(I,{}),end:/* @__PURE__ */Y(P,{}),stretch:/* @__PURE__ */Y(T,{}),between:/* @__PURE__ */Y(N,{})},y:{start:/* @__PURE__ */Y(G,{}),center:/* @__PURE__ */Y(B,{}),end:/* @__PURE__ */Y(W,{}),stretch:/* @__PURE__ */Y(K,{}),between:/* @__PURE__ */Y(M,{})}},$e=e=>"row"===e?"row":"column";function De({say:e,kind:n,label:t,options:l,value:o,onChange:a,o:i}){const r=p(),s="justify"===n==("row"===(i.runs??$e)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return Be(e,{options:l.map(e=>({label:e.label,value:e.value,picture:Ve[s][e.value]})),value:o,onChange:a,ariaLabel:t})}function He(e,n){const t=(e.useFallback??U)(n);return Object.fromEntries(xe.map(n=>[n,t?.[n]??e.fallback[n]]))}function Je({say:e,tier:n,o:t,props:l}){const o=He(t,l),a=p(),i=a?.values??{},r="mobile"===n?t.phoneKeys:t.keys,s=Object.fromEntries(xe.map(e=>[e,je(i[r[e]])])),u="mobile"===n?Object.fromEntries(xe.map(e=>[e,je(i[t.keys[e]])])):null;/* @__PURE__ */
|
|
5
|
+
return Y(_e,{say:e,o:t,fallback:o,value:s,follows:u,readOnly:l.readOnly,onChange:e=>{const n=Fe(r,s,e);Object.keys(n).length&&a?.onChangeMany(n)}})}function Ye({say:e,o:n,props:t}){const l=He(n,t);/* @__PURE__ */
|
|
6
6
|
return Y(_e,{say:e,o:n,fallback:l,value:Le(t.value),follows:"follows"in t?Le(t.follows):null,readOnly:t.readOnly,onChange:e=>t.onChange(Oe(e))})}function _e({say:l,o:o,fallback:a,value:i,follows:r,readOnly:s,onChange:u}){const c=Object.fromEntries(xe.map(e=>[e,String(r?.[e]??a[e])])),[d,p]=w(()=>e(i,c));/* @__PURE__ */
|
|
7
|
-
return Y(g,{label:l(o.label),icon:o.icon??/* @__PURE__ */Y(
|
|
8
|
-
return Y(g,{label:e??n,action:u,children:s})}function Ue({draw:e,props:n,useMax:t,useHint:l}){return e(n,{max:(t??U)(n),hint:(l??U)(n)})}function qe(e=z){function n(n,t,l,o,a,i,s="",u){const c="function"==typeof u?{action:u}:u??{},{action:d,clear:p}=c,f=(r,u)=>{const f="storedValue"in r?r.storedValue:r.value,b="follows"in r,m=b&&!1!==p?.phoneFollows,h=b||void 0!==p,v="number"==typeof r.value,y=void 0===p?i:u.hint??("function"==typeof p.hint?p.hint(r):p.hint)??i,k=m&&"number"==typeof r.follows?r.follows:y,w=Xe(s),x=!p?.emptyLabel||m&&"number"==typeof r.follows?void 0:p.emptyLabel,C=x??`${k}${w}`,
|
|
9
|
-
return Y(g,{label:e(n),icon:ne(t),hint:void 0===
|
|
7
|
+
return Y(g,{label:l(o.label),icon:o.icon??/* @__PURE__ */Y(A,{}),action:/* @__PURE__ */Y(t,{each:d,label:l("Each side"),onChange:p,disabled:s}),children:/* @__PURE__ */Y(n,{label:l(o.label),each:d,value:i,placeholder:c,min:o.min,max:o.max,step:o.step,readOnly:s,onChange:u,words:{sides:{top:l("Padding top"),right:l("Padding right"),bottom:l("Padding bottom"),left:l("Padding left")},vertical:l("Top and bottom"),horizontal:l("Left and right"),unit:"px"}})})}var Xe=e=>""===e||"px"===e?e:` ${e}`;function ze({label:e,value:n,onChange:t,min:o,max:a,step:i=1,unit:r="",hint:s,emptyLabel:u,inputMax:c,readOnly:d=!1,clears:p,detail:f,resetWords:b}){const m="number"==typeof n,h=p?/* @__PURE__ */Y(l,{label:e,changed:m,detail:f??u??(void 0===s?void 0:`${s}${Xe(r)}`),disabled:d,onReset:()=>t(void 0),...b?{words:b}:{}}):void 0;return{track:/* @__PURE__ */Y("div",{className:"sf-slider",children:/* @__PURE__ */Y(J,{min:o,max:a,step:i,value:n,suffix:r||void 0,showInput:!0,label:e,disabled:d,...p&&void 0!==s?{placeholderValue:s}:{},...u?{emptyLabel:u}:{},...void 0!==c?{inputMax:c}:{},size:"sm",boxSize:"md",className:"sf-slider-track",onChange:e=>{null===e?p&&m&&t(void 0):e!==n&&t(e)}})}),reset:h}}function Ze({caption:e,label:n,value:t,hint:l,emptyLabel:o,...a}){const i=void 0!==l||void 0!==o,r="number"==typeof t,{track:s,reset:u}=ze({...a,label:n,value:r?t:i?null:a.min,hint:l,emptyLabel:o,clears:i});/* @__PURE__ */
|
|
8
|
+
return Y(g,{label:e??n,action:u,children:s})}function Ue({draw:e,props:n,useMax:t,useHint:l}){return e(n,{max:(t??U)(n),hint:(l??U)(n)})}function qe(e=z){function n(n,t,l,o,a,i,s="",u){const c="function"==typeof u?{action:u}:u??{},{action:d,clear:p}=c,f=(r,u)=>{const f="storedValue"in r?r.storedValue:r.value,b="follows"in r,m=b&&!1!==p?.phoneFollows,h=b||void 0!==p,v="number"==typeof r.value,y=void 0===p?i:u.hint??("function"==typeof p.hint?p.hint(r):p.hint)??i,k=m&&"number"==typeof r.follows?r.follows:y,w=Xe(s),x=!p?.emptyLabel||m&&"number"==typeof r.follows?void 0:p.emptyLabel,C=x??`${k}${w}`,j="function"==typeof c.hint?c.hint(r):c.hint,{track:F,reset:L}=ze({label:e(n),value:v?r.value:h?null:i,onChange:e=>r.onChange(e),min:l,max:u.max??o,step:a,unit:s,hint:h?k:void 0,emptyLabel:x,inputMax:c.inputMax,readOnly:!0===r.readOnly,clears:h,detail:m?Z(e,C):C});/* @__PURE__ */
|
|
9
|
+
return Y(g,{label:e(n),icon:ne(t),hint:void 0===j?void 0:e(j),action:h?L:d?d(f,r.onChange):void 0,children:F})},b=c.useMax,m=p?.useHint;return{type:"custom",...r({},{type:"number",label:n}),render:b||m?e=>/* @__PURE__ */Y(Ue,{draw:f,props:e,useMax:b,useHint:m}):e=>f(e,{})}}function t(n){return Be(e,n)}function s(n,o,a,i,s={}){const u=a.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...r({},{type:"radio",label:n,options:u.map(e=>({value:e.value,label:e.label}))}),render:a=>{const{value:r,onChange:c,field:d}=a,p=u.some(e=>e.value===r),f=!0===a.readOnly;if("follows"in a&&!u.some(e=>""===e.value)){const d=s.phoneRest?s.phoneRest(a.follows):a.follows,b=u.find(e=>e.value===d)??u.find(e=>e.value===i);/* @__PURE__ */
|
|
10
10
|
return Y(g,{label:e(n),icon:ne(o),action:/* @__PURE__ */Y(l,{label:e(n),changed:p,detail:Z(e,e(b?.label??"")),disabled:f,onReset:()=>c(void 0)}),children:t({options:u,value:p?r:b?.value??i,onChange:c,ariaLabel:n,disabled:f})})}const b="follows"in a&&s.followsLabel?s.followsLabel(a.follows):void 0;/* @__PURE__ */
|
|
11
|
-
return Y(g,{label:e(n),icon:ne(o),action:"follows"in a&&s.followsLabel?/* @__PURE__ */Y(l,{label:e(n),changed:null!=r&&""!==r,detail:void 0===b?void 0:Z(e,e(b)),disabled:f,onReset:()=>c(void 0)}):void 0,children:t({options:u,value:p?r:r||d?.currentValue||i,onChange:c,ariaLabel:n,disabled:f})})}}}function c(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */Y(E,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function d(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function p(e,n,t,l){if(l.access){const o=l.inherit?"":l.fallback??"left",a=t({...l,phone:!1}),i=e=>{const n="string"==typeof e&&""!==e&&a.some(n=>n.value===e)?e:o;return a.find(e=>e.value===n)?.label};return
|
|
12
|
-
return Y(g,{label:e(t),icon:ne(l),children:/* @__PURE__ */Y(
|
|
13
|
-
return Y(g,{label:e(n),labelId:i,icon:/* @__PURE__ */Y(
|
|
14
|
-
return Y(g,{label:e(n),icon:ne(t),action:b?/* @__PURE__ */Y(l,{label:e(n),changed:null!=s&&""!==s,detail:m?Z(e,e(m.label)):void 0,disabled:y,onReset:()=>u(void 0)}):void 0,children:/* @__PURE__ */Y(v,{value:h,ariaLabel:e(n),readOnly:y,onChange:u,options:[...i?[{label:e(i),value:"\0note",disabled:!0}]:[],...d.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:s,boxJustifyField:w,boxAlignField:O,boxWrapField:S,directionField:P,gapField:
|
|
11
|
+
return Y(g,{label:e(n),icon:ne(o),action:"follows"in a&&s.followsLabel?/* @__PURE__ */Y(l,{label:e(n),changed:null!=r&&""!==r,detail:void 0===b?void 0:Z(e,e(b)),disabled:f,onReset:()=>c(void 0)}):void 0,children:t({options:u,value:p?r:r||d?.currentValue||i,onChange:c,ariaLabel:n,disabled:f})})}}}function c(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */Y(E,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function d(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function p(e,n,t,l){if(l.access){const o=l.inherit?"":l.fallback??"left",a=t({...l,phone:!1}),i=e=>{const n="string"==typeof e&&""!==e&&a.some(n=>n.value===e)?e:o;return a.find(e=>e.value===n)?.label};return Ke(e,n(l,o),l.access,{phoneRow:n({...l,phone:!0},"",i)})}return{[e]:o("desktop",n(l)),[u(e)]:o("mobile",n({...l,phone:!0},""))}}function f(e){return c($(e.allow??We).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function b(e,n=e.fallback??"left",t){return d(s(e.label??"Text alignment",/* @__PURE__ */Y(x,{}),f(e),n,t?{followsLabel:t}:{}),e)}function m(e){const n={left:Ve.x.start,center:Ve.x.center,right:Ve.x.end};return c($((e.allow??We).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function y(e,n=e.fallback??"left",t){return d(s(e.label??"Block alignment",/* @__PURE__ */Y(C,{}),m(e),n,t?{followsLabel:t}:{}),e)}function k(n,t,l,o,a,i){return{type:"custom",options:o,fallback:a,...r({},{type:"radio",label:t,options:o.map(e=>({value:e.value,label:e.label}))}),render:({value:r,onChange:s,field:u})=>{const c=u.options??o,d=u.fallback??a,p=c.some(e=>e.value===r)?r:d;/* @__PURE__ */
|
|
12
|
+
return Y(g,{label:e(t),icon:ne(l),children:/* @__PURE__ */Y(De,{say:e,kind:n,label:t,options:c,value:p,onChange:s,o:i})})}}}function w(e={}){return k("justify","Justify",/* @__PURE__ */Y(C,{}),ie,ie[0].value,e)}function O(e={}){return k("align","Item alignment",/* @__PURE__ */Y(V,{}),re,"stretch",e)}function S(){const n=se;return{type:"custom",options:ue,fallback:ue[1].value,...r({},{type:"radio",label:n,options:ue.map(e=>({value:e.value,label:e.label}))}),render:({value:t,onChange:l,id:o,name:a})=>{const i=`${o??a??n}-label`;/* @__PURE__ */
|
|
13
|
+
return Y(g,{label:e(n),labelId:i,icon:/* @__PURE__ */Y(j,{}),action:/* @__PURE__ */Y(h,{checked:(r=t,!0===r||"wrap"===r),onChange:e=>l(e?ue[0].value:ue[1].value),ariaLabelledBy:i})});var r}}}function P({offered:e,fallback:n,resolve:t}){const l=t??(t=>e.some(e=>e.value===t)?t:n),o=s(ce,Q("`Direction` names how a container’s children run — a MODIFIER, not a thing. doc/naming.md N10.1 gives the idea a dash in its Glyph column; the shell’s own `direction` meaning says the bare row is CORRECT and not an omission (SS seat, 2026-09-11)."),e.map(e=>({label:e.label,value:e.value})),l(void 0));return{type:"custom",render:e=>o.render({...e,value:l(e.value),onChange:n=>e.onChange(n)})}}function I({min:e,max:t,step:l,builtIn:o,resolve:a,action:i,mark:r}){const s=n("Gap",/* @__PURE__ */Y(F,{}),e,t,l,o,"px",i),u=a??(e=>"number"==typeof e?e:o);return{...r,type:"custom",render:e=>s.render({...e,value:u(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function R(n,{fallback:t=me,pointsFor:l}={}){return{type:"custom",render:({value:o,onChange:a})=>{const i=ge(o,t);return l?/* @__PURE__ */Y(Ne,{say:e,label:n,value:i,onChange:a,pointsFor:l}):Ge(e,{label:n,value:i,onChange:a,points:ve})}}}function A(n){return{[n.keys.x]:{type:"custom",render:()=>/* @__PURE__ */Y(Te,{say:e,o:n})},[n.keys.y]:{...a({type:"custom",render:()=>/* @__PURE__ */Y(i,{})},"always"),reachedBy:n.keys.x}}}function M(n={}){const t={...Ce,...n.keys},l={keys:t,phoneKeys:Object.fromEntries(xe.map(e=>[e,u(t[e])])),fallback:{top:0,right:0,bottom:0,left:0,...n.fallback},useFallback:n.useFallback,label:n.label??"Padding",icon:n.icon,min:n.min??0,max:n.max??200,step:n.step??4},r=!1!==n.phone,s=!1===n.group?{}:{_gSpacing:oe("Padding")};if(n.object){const t={type:"custom",render:n=>/* @__PURE__ */Y(Ye,{say:e,o:l,props:n})};return te({...s,...r?Ke(n.object.key,t,n.object.phone):{[n.object.key]:t}})}const c=n=>{const t={type:"custom",render:t=>/* @__PURE__ */Y(Je,{say:e,tier:n,o:l,props:t})};return r?o(n,t):t},d=()=>a({type:"custom",render:()=>/* @__PURE__ */Y(i,{})},"always"),p=xe.filter(e=>"top"!==e);return te({...s,[l.keys.top]:c("desktop"),...r?{[l.phoneKeys.top]:c("mobile")}:{},...Object.fromEntries(p.map(e=>[l.keys[e],{...d(),reachedBy:l.keys.top}])),...r?Object.fromEntries(p.map(e=>[l.phoneKeys[e],o("mobile",d())])):{}})}return{slider:n,select:function(n,t,o,a,i){return{type:"custom",options:o,fallback:a,...i?{note:i}:{},...r({},{type:"select",label:n}),render:r=>{const{value:s,onChange:u,field:c}=r,d=c.options??o,p=c.fallback??a,f=d.some(e=>e.value===s),b="follows"in r,m=b?d.find(e=>e.value===r.follows)??d.find(e=>e.value===p):void 0,h=f?s:m?.value??p,y=!0===r.readOnly;/* @__PURE__ */
|
|
14
|
+
return Y(g,{label:e(n),icon:ne(t),action:b?/* @__PURE__ */Y(l,{label:e(n),changed:null!=s&&""!==s,detail:m?Z(e,e(m.label)):void 0,disabled:y,onReset:()=>u(void 0)}):void 0,children:/* @__PURE__ */Y(v,{value:h,ariaLabel:e(n),readOnly:y,onChange:u,options:[...i?[{label:e(i),value:"\0note",disabled:!0}]:[],...d.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:s,boxJustifyField:w,boxAlignField:O,boxWrapField:S,directionField:P,gapField:I,placementField:R,PlacementGridView:function(n){return Ge(e,n)},positionFields:A,sidesPaddingFields:M,alignmentField:function(e={},n=e.fallback??"left"){return b(e,n)},alignmentFields:function(e="align",n={}){return p(e,b,f,n)},AlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:o,disabled:a=!1}){return t({options:f(e),value:n,onChange:l,ariaLabel:o,disabled:a})},blockAlignmentField:function(e={},n=e.fallback??"left"){return y(e,n)},blockAlignmentFields:function(e="align",n={}){return p(e,y,m,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:o,disabled:a=!1}){return t({options:m(e),value:n,onChange:l,ariaLabel:o,disabled:a})},boxFieldSet:function(e={}){const t=e.width??fe,l=e.nudge?.limit??40,o=e.direction??{offered:de,fallback:"column"},a=o.resolve??(e=>o.offered.some(n=>n.value===e)?e:o.fallback),i={runs:e=>"row"===a(e)?"row":"column"};return{_gLayout:oe("Layout"),placement:R("Placement",e.placement),width:n("Width",/* @__PURE__ */Y(L,{}),t.min,t.max,t.step,t.fallback,"%"),direction:P(o),gap:I(e.gap??pe),justify:w(i),align:O(i),wrap:S(),_gNudge:oe("Nudge"),...A({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-l,max:l,label:null}),...M(e.padding)}}}}var{slider:Qe,select:en,Segmented:nn,segmented:tn,boxJustifyField:ln,boxAlignField:on,boxWrapField:an,directionField:rn,gapField:sn,placementField:un,PlacementGridView:cn,positionFields:dn,sidesPaddingFields:pn,alignmentField:fn,alignmentFields:bn,AlignmentStrip:mn,blockAlignmentField:hn,blockAlignmentFields:vn,BlockAlignmentStrip:gn,boxFieldSet:yn}=qe();export{he as ANCHOR_LABELS,mn as AlignmentStrip,re as BOX_ALIGN_POINTS,de as BOX_DIRECTIONS,ce as BOX_DIRECTION_LABEL,pe as BOX_GAP,ie as BOX_JUSTIFY_POINTS,ye as BOX_NUDGE_LIMIT,be as BOX_PLACEMENTS,me as BOX_PLACEMENT_DEFAULT,fe as BOX_WIDTH,se as BOX_WRAP_LABEL,ue as BOX_WRAP_POINTS,gn as BlockAlignmentStrip,Ie as FLAT_ACCESS,ve as OPEN_PLACEMENT_POINTS,Re as PHONE_KEY_ACCESS,cn as PlacementGridView,Ce as SIDE_PAD_KEYS,nn as Segmented,Ze as SliderControl,fn as alignmentField,bn as alignmentFields,hn as blockAlignmentField,vn as blockAlignmentFields,on as boxAlignField,qe as boxFieldBuilders,yn as boxFieldSet,ln as boxJustifyField,an as boxWrapField,rn as directionField,sn as gapField,oe as group,ne as iconOf,ee as isNoGlyph,Q as noGlyph,ge as normaliseBoxPlacement,Se as objectAccess,Z as onDesktopWords,Ae as phoneObjectAccess,Ke as phoneTwinFields,un as placementField,dn as positionFields,we as positionPatch,ae as section,tn as segmented,en as select,te as sharedStyleKinds,Le as sidesFromObject,pn as sidesPaddingFields,Fe as sidesPaddingPatch,Oe as sidesToObject,Qe as slider,Pe as useAccessPatch,Ee as useAccessValue};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import{findCopy as e,repeatCopyWithWrapper as t}from"./chunk-JQQFB7EZ.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-TBY3DFKS.js";import{useResolvedFields as o}from"./chunk-K53PQAMP.js";import{toItemSelector as r,fromItemSelector as l,useNodeOps as i,parentStep as s,clickPickPart as a,clickPick as c}from"./chunk-QTHQPJWA.js";import{selectionBox as u,placeWindow as d,offsetOrigin as p,colorRunOf as f,ColorWindow as h,startCanvasTyping as m,textMap as g,richLayout as v}from"./chunk-HZSZT3BE.js";import{DEFAULT_COPY_WORDS as y}from"./chunk-PMRN5Z3T.js";import{useWords as w}from"./chunk-MFIRYGHW.js";import{CANVAS_TYPABLE_EVENT as b,CANVAS_TYPING_EVENT as k}from"./chunk-TOKMFZPB.js";import{setCanvasNonce as S,related as C,isTypingTarget as E,upsertCanvasStyle as x,removeCanvasStyle as I,WORDS_CLEAR as D,frameRectToHost as A,drawnBox as O}from"./chunk-FR7EEKFF.js";import{queryAllCopies as M}from"./chunk-7UFKEX72.js";import{find as $,ROOT_ID as P,getList as R,remove as z,parseZoneKey as N,move as j,duplicate as V,replaceNode as L,createNode as B,insert as K,normalizeData as Z,createResolveCache as F,slotsOf as T,resolveNodeData as H,ROOT_SLOT as W}from"./chunk-EUFDQ4KL.js";import{topLevelSlotKeys as q,fieldsFrom as Q,drawnBlockCount as Y,defaultsFrom as U}from"./chunk-KXM6YRG2.js";import{createContext as X,useEffect as G,useContext as J,useRef as _,useSyncExternalStore as ee,useState as te,useReducer as ne,createElement as oe,useMemo as re,useCallback as le,useLayoutEffect as ie}from"react";import{jsx as se,jsxs as ae,Fragment as ce}from"react/jsx-runtime";import{createPortal as ue}from"react-dom";import{registerModalEscapeInterceptor as de,FloatingBar as pe,TextToolbar as fe,LinkPicker as he}from"efficient-shell/ui";function me(e){return!["setData","setUi","set"].includes(e.type)}var ge=(e,t,n,o)=>{const r=R(e,t,N(n));return r?.[o]??null},ve=(e,t,n,o,r)=>{const l=ge(e,t,n,o);if(!l)throw new Error(`${r}: nothing at ${n}[${o}]`);return l};function ye(e,t){const{selection:n}=e;return{...e.ui,itemSelector:r(e.data,t,n),selectedSlot:n&&"slot"===n.kind?{parentId:n.parentId,slot:n.slot}:null}}function we(e,t,n){return n?"node"===n.kind?$(e,t,n.id)?n:null:n.parentId===P?R(e,t,n)?n:null:$(e,t,n.parentId)&&R(e,t,n)?n:null:null}function be(e,t,n,o=!1){const{itemSelector:r,selectedSlot:i,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=l(e.data,t,r??null)),"selectedSlot"in n&&(i?a=(c=i)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:o?s:{...e.ui,...s}}}function ke(e,t,n){const o=Se(e,t,n);if(o===e)return e;const r=we(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function Se(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 be(e,n,"function"==typeof t.ui?t.ui(ye(e,n)):t.ui);case"set":{const r={data:o,ui:ye(e,n)},l="function"==typeof t.state?t.state(r):t.state;let i=l.data?{...e,data:l.data}:e;return l.ui&&(i=be(i,n,l.ui,!0)),i}case"insert":{const r={...N(t.destinationZone),index:t.destinationIndex},l=B(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:K(o,n,r,l)}}case"replace":{const r=ve(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:L(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=ve(o,n,t.sourceZone,t.sourceIndex,"duplicate"),l=V(o,n,r.props.id),i=ge(l,n,t.sourceZone,t.sourceIndex+1);return{...e,data:l,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return Se(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ge(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const l={...N(t.destinationZone),index:t.destinationIndex};return{...e,data:j(o,n,r.props.id,l)}}case"remove":{const r=ve(o,n,t.zone,t.index,"remove");return{...e,data:z(o,n,r.props.id)}}default:return e}}var Ce={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},Ee={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},xe=0,Ie=()=>`history-${xe+=1}`;function De(e){let t=e.config;const n=e.now??(()=>Date.now()),o=e.historyCoalesceMs??250;let i=e.permissions??{};const s=Z(e.data,t);let a=s,c={data:s,selection:null,ui:{...Ee}};if(e.ui){const{itemSelector:n,selectedSlot:o,...r}=e.ui;c={data:s,selection:o?{kind:"slot",...o}:l(s,t,n??null),ui:{...Ee,...r}}}let u=[{core:c,at:-1/0,sealed:!0,id:Ie()}],d=0;const p=e=>{const t=u[d],r=n();!e&&d===u.length-1&&d>0&&!t.sealed&&r-t.at<o?u=[...u.slice(0,d),{...t,core:c,at:r}]:(u=[...u.slice(0,d+1),{core:c,at:r,sealed:e,id:Ie()}],d=u.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=()=>{u=[...u.slice(0,d),{...u[d],core:c},...u.slice(d+1)]},k=(t,n)=>{g>0?y=y||n:(n?p(!1):c!==t&&b(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&w())},S=e=>{const n=c;if(c=ke(c,e,t),c===n)return;const o=e.recordHistory??me(e);k(n,o&&c.data!==n.data)},C=t=>{0===g&&(v=c,y=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&v&&(c=v,v=null),e}if(g-=1,g>0||!v)return;const n=v;v=null,y&&c.data!==n.data?p(!0):c!==n&&b(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},E=e=>{const n=c,o=we(c.data,t,e);var r,l;(r=o,l=c.selection,r===l||r&&l&&r.kind===l.kind&&("node"===r.kind&&"node"===l.kind?r.id===l.id:"slot"===r.kind&&"slot"===l.kind&&r.parentId===l.parentId&&r.slot===l.slot))||(c={...c,selection:o},k(n,!1))},x=t=>{const n=c;d=t,c=u[d].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},I=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...Ce,...i,...n}};let D=I();const A=F(),O={resolveCache:A,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},l=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([H(r,t,{cache:A,trigger:e,metadata:n}),...l.map(o=>H(o,t,{cache:A,trigger:e,metadata:n}))]);C(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const i=l[n].props.id,s=$(r,t,i)?.node;s&&s===$(o,t,i)?.node&&(r=L(r,t,i,e.node))}),i.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:i.node.props,readOnly:i.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:we(r,t,c.selection)},k(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=$(c.data,t,e)?.node;if(!r)return!1;const l=await H(r,t,{cache:A,trigger:n,metadata:o});if(!l.didChange)return!1;let i=!1;return C(()=>{const n=c;if($(c.data,t,e)?.node!==r)return;const o=L(c.data,t,e,l.node);o!==c.data&&(c={...c,data:o,selection:we(o,t,c.selection)},k(n,!1),i=!0)}),i},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,n={data:e.data,ui:ye(e,t)},o="node"===e.selection?.kind?$(e.data,t,e.selection.id)?.node??null:null;return h={appState:n,selection:e.selection,selectedItem:o,config:t,dispatch:S,history:{back:()=>O.undo(),forward:()=>O.redo(),hasPast:d>0,hasFuture:d<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:ye(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==d&&x(e)}},getPermissions:D,getItemById:n=>$(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return R(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:n=>{const o=r(e.data,t,{kind:"node",id:n});return o?{index:o.index,zone:o.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:S,batch:C,group:()=>{const e=d,t=u[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,u[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(u=[...u.slice(0,d),{...u[d],sealed:!0},...u.slice(d+1)]));const o=u[d];u=[...u.slice(0,e+1),{...o,sealed:!0},...u.slice(d+1)],d=e+1}}},select:e=>E(e?{kind:"node",id:e}:null),selectSlot:e=>E(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){C(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:we(e.data,t,o)},k(n,e.data!==n.data)})},load(e,n={}){const o=c,r=Z(e,t);c={...c,data:r,selection:we(r,t,n.selection??c.selection)},a=r,n.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:Ie()}],d=0),c!==o&&w()},undo(){d>0&&x(d-1)},redo(){d<u.length-1&&x(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,i)||(i=e,D=I(),h=null,w())},setConfig(e){e!==t&&(t=e,D=I(),h=null,w())}};return O}function Ae(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&&E(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 Oe=X(null),Me=X(!0);function $e({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return G(()=>{n&&e.resolveAll()},[e,n]),G(()=>{if(t&&"undefined"!=typeof document)return Ae(document,e)},[e,t]),/* @__PURE__ */se(Oe.Provider,{value:e,children:/* @__PURE__ */se(Me.Provider,{value:t,children:o})})}function Pe(){const e=J(Oe);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function Re(e){const t=Pe(),n=_({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 l=e(o);return r.has&&Object.is(r.value,l)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:l,has:!0},l)};return ee(t.subscribe,o,o)}function ze(){return function(e){return Re(e)}}var Ne=["--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"],je="host-tokens";function Ve(e,t){const n=function(e){const t=e.ownerDocument.defaultView;if(!t)return"";const n=t.getComputedStyle(e),o=[];for(const e of Ne){const t=n.getPropertyValue(e).trim();t&&o.push(`${e}: ${t};`)}return o.length?`:root { ${o.join(" ")} }`:""}(e);n?x(t,je,n):I(t,je)}var Le="data-easel-block",Be="data-easel-dropzone",Ke={},Ze="data-es-mirror",Fe="undefined"==typeof window?G:ie;function Te(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ze}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ze,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function He({children:e,id:t="preview-frame",title:o,className:r,style:l,mirrorStyles:i=!0,onDocument:s,height:a="auto",nonce:c}){const u=w("canvas",n),d=_(null),[p,f]=te(null);return Fe(()=>{const e=d.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]),Fe(()=>{let e=d.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=d.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),S(e,c),f(t),s?.(e);let n=null;const o=d.current?.ownerDocument;if(i&&o){Te(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Te(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}let r=null;const l=d.current;if(l&&o){Ve(l,e);const t=o.defaultView;if(t&&"MutationObserver"in t){r=new t.MutationObserver(()=>Ve(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__ */se("iframe",{ref:d,id:t,title:o??u.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:l,children:p?ue(e,p):null})}var We=X(null),qe=X(Ke),Qe=[];function Ye({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:l=120}){const i=Pe(),s=Re(n=>R(n.appState.data,i.config,{parentId:e,slot:t})??Qe),a=Re(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==P),c=Re(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=J(We),d=["es-zone"];return s.length&&d.push("has-children"),e===P&&d.push("is-root"),(a||c)&&d.push("is-area-selected"),null!==u&&u===e&&e!==P&&d.push("is-hovering-area"),n&&d.push(n),/* @__PURE__ */se("div",{className:d.join(" "),[Be]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${l}px`},children:s.map(e=>/* @__PURE__ */se(nt,{node:e},e.props.id))})}function Ue(e,t,n,o){const r=re(()=>{const n={};for(const o of q(Q(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
|
|
1
|
+
import{findCopy as e,repeatCopyWithWrapper as t}from"./chunk-JQQFB7EZ.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-TBY3DFKS.js";import{useResolvedFields as o}from"./chunk-K53PQAMP.js";import{toItemSelector as r,fromItemSelector as l,useNodeOps as i,parentStep as s,clickPickPart as a,clickPick as c}from"./chunk-QTHQPJWA.js";import{selectionBox as u,placeWindow as d,offsetOrigin as p,colorRunOf as f,ColorWindow as h,startCanvasTyping as m,textMap as g,richLayout as v}from"./chunk-HZSZT3BE.js";import{DEFAULT_COPY_WORDS as y}from"./chunk-PMRN5Z3T.js";import{useWords as w}from"./chunk-MFIRYGHW.js";import{CANVAS_TYPABLE_EVENT as b,CANVAS_TYPING_EVENT as k}from"./chunk-TOKMFZPB.js";import{setCanvasNonce as S,related as x,isTypingTarget as C,upsertCanvasStyle as E,removeCanvasStyle as I,WORDS_CLEAR as D,frameRectToHost as A,drawnBox as M}from"./chunk-FR7EEKFF.js";import{queryAllCopies as $}from"./chunk-7UFKEX72.js";import{find as O,ROOT_ID as P,getList as z,remove as R,parseZoneKey as j,move as N,duplicate as V,replaceNode as L,createNode as B,insert as K,normalizeData as Z,createResolveCache as F,slotsOf as T,resolveNodeData as H,ROOT_SLOT as q}from"./chunk-EUFDQ4KL.js";import{topLevelSlotKeys as W,fieldsFrom as Q,drawnBlockCount as Y,defaultsFrom as U}from"./chunk-KXM6YRG2.js";import{createContext as X,useEffect as G,useContext as J,useRef as _,useSyncExternalStore as ee,useState as te,useReducer as ne,createElement as oe,useMemo as re,useCallback as le,useLayoutEffect as ie}from"react";import{jsx as se,jsxs as ae,Fragment as ce}from"react/jsx-runtime";import{createPortal as ue}from"react-dom";import{registerModalEscapeInterceptor as de,FloatingBar as pe,TextToolbar as fe,LinkPicker as he}from"efficient-shell/ui";function me(e){return!["setData","setUi","set"].includes(e.type)}var ge=(e,t,n,o)=>{const r=z(e,t,j(n));return r?.[o]??null},ve=(e,t,n,o,r)=>{const l=ge(e,t,n,o);if(!l)throw new Error(`${r}: nothing at ${n}[${o}]`);return l};function ye(e,t){const{selection:n}=e;return{...e.ui,itemSelector:r(e.data,t,n),selectedSlot:n&&"slot"===n.kind?{parentId:n.parentId,slot:n.slot}:null}}function we(e,t,n){return n?"node"===n.kind?O(e,t,n.id)?n:null:n.parentId===P?z(e,t,n)?n:null:O(e,t,n.parentId)&&z(e,t,n)?n:null:null}function be(e,t,n,o=!1){const{itemSelector:r,selectedSlot:i,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=l(e.data,t,r??null)),"selectedSlot"in n&&(i?a=(c=i)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:o?s:{...e.ui,...s}}}function ke(e,t,n){const o=Se(e,t,n);if(o===e)return e;const r=we(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function Se(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 be(e,n,"function"==typeof t.ui?t.ui(ye(e,n)):t.ui);case"set":{const r={data:o,ui:ye(e,n)},l="function"==typeof t.state?t.state(r):t.state;let i=l.data?{...e,data:l.data}:e;return l.ui&&(i=be(i,n,l.ui,!0)),i}case"insert":{const r={...j(t.destinationZone),index:t.destinationIndex},l=B(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:K(o,n,r,l)}}case"replace":{const r=ve(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:L(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=ve(o,n,t.sourceZone,t.sourceIndex,"duplicate"),l=V(o,n,r.props.id),i=ge(l,n,t.sourceZone,t.sourceIndex+1);return{...e,data:l,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return Se(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ge(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const l={...j(t.destinationZone),index:t.destinationIndex};return{...e,data:N(o,n,r.props.id,l)}}case"remove":{const r=ve(o,n,t.zone,t.index,"remove");return{...e,data:R(o,n,r.props.id)}}default:return e}}var xe={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},Ce={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},Ee=0,Ie=()=>`history-${Ee+=1}`;function De(e){let t=e.config;const n=e.now??(()=>Date.now()),o=e.historyCoalesceMs??250;let i=e.permissions??{};const s=Z(e.data,t);let a=s,c={data:s,selection:null,ui:{...Ce}};if(e.ui){const{itemSelector:n,selectedSlot:o,...r}=e.ui;c={data:s,selection:o?{kind:"slot",...o}:l(s,t,n??null),ui:{...Ce,...r}}}let u=[{core:c,at:-1/0,sealed:!0,id:Ie()}],d=0;const p=e=>{const t=u[d],r=n();!e&&d===u.length-1&&d>0&&!t.sealed&&r-t.at<o?u=[...u.slice(0,d),{...t,core:c,at:r}]:(u=[...u.slice(0,d+1),{core:c,at:r,sealed:e,id:Ie()}],d=u.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=()=>{u=[...u.slice(0,d),{...u[d],core:c},...u.slice(d+1)]},k=(t,n)=>{g>0?y=y||n:(n?p(!1):c!==t&&b(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&w())},S=e=>{const n=c;if(c=ke(c,e,t),c===n)return;const o=e.recordHistory??me(e);k(n,o&&c.data!==n.data)},x=t=>{0===g&&(v=c,y=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&v&&(c=v,v=null),e}if(g-=1,g>0||!v)return;const n=v;v=null,y&&c.data!==n.data?p(!0):c!==n&&b(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},C=e=>{const n=c,o=we(c.data,t,e);var r,l;(r=o,l=c.selection,r===l||r&&l&&r.kind===l.kind&&("node"===r.kind&&"node"===l.kind?r.id===l.id:"slot"===r.kind&&"slot"===l.kind&&r.parentId===l.parentId&&r.slot===l.slot))||(c={...c,selection:o},k(n,!1))},E=t=>{const n=c;d=t,c=u[d].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},I=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...xe,...i,...n}};let D=I();const A=F(),M={resolveCache:A,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},l=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([H(r,t,{cache:A,trigger:e,metadata:n}),...l.map(o=>H(o,t,{cache:A,trigger:e,metadata:n}))]);x(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const i=l[n].props.id,s=O(r,t,i)?.node;s&&s===O(o,t,i)?.node&&(r=L(r,t,i,e.node))}),i.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:i.node.props,readOnly:i.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:we(r,t,c.selection)},k(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=O(c.data,t,e)?.node;if(!r)return!1;const l=await H(r,t,{cache:A,trigger:n,metadata:o});if(!l.didChange)return!1;let i=!1;return x(()=>{const n=c;if(O(c.data,t,e)?.node!==r)return;const o=L(c.data,t,e,l.node);o!==c.data&&(c={...c,data:o,selection:we(o,t,c.selection)},k(n,!1),i=!0)}),i},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,n={data:e.data,ui:ye(e,t)},o="node"===e.selection?.kind?O(e.data,t,e.selection.id)?.node??null:null;return h={appState:n,selection:e.selection,selectedItem:o,config:t,dispatch:S,history:{back:()=>M.undo(),forward:()=>M.redo(),hasPast:d>0,hasFuture:d<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:ye(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==d&&E(e)}},getPermissions:D,getItemById:n=>O(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return z(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:n=>{const o=r(e.data,t,{kind:"node",id:n});return o?{index:o.index,zone:o.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:S,batch:x,group:()=>{const e=d,t=u[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,u[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(u=[...u.slice(0,d),{...u[d],sealed:!0},...u.slice(d+1)]));const o=u[d];u=[...u.slice(0,e+1),{...o,sealed:!0},...u.slice(d+1)],d=e+1}}},select:e=>C(e?{kind:"node",id:e}:null),selectSlot:e=>C(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){x(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:we(e.data,t,o)},k(n,e.data!==n.data)})},load(e,n={}){const o=c,r=Z(e,t);c={...c,data:r,selection:we(r,t,n.selection??c.selection)},a=r,n.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:Ie()}],d=0),c!==o&&w()},undo(){d>0&&E(d-1)},redo(){d<u.length-1&&E(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,i)||(i=e,D=I(),h=null,w())},setConfig(e){e!==t&&(t=e,D=I(),h=null,w())}};return M}function Ae(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&&C(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 Me=X(null),$e=X(!0);function Oe({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return G(()=>{n&&e.resolveAll()},[e,n]),G(()=>{if(t&&"undefined"!=typeof document)return Ae(document,e)},[e,t]),/* @__PURE__ */se(Me.Provider,{value:e,children:/* @__PURE__ */se($e.Provider,{value:t,children:o})})}function Pe(){const e=J(Me);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ze(e){const t=Pe(),n=_({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 l=e(o);return r.has&&Object.is(r.value,l)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:l,has:!0},l)};return ee(t.subscribe,o,o)}function Re(){return function(e){return ze(e)}}var je=["--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"],Ne="host-tokens";function Ve(e,t){const n=function(e){const t=e.ownerDocument.defaultView;if(!t)return"";const n=t.getComputedStyle(e),o=[];for(const e of je){const t=n.getPropertyValue(e).trim();t&&o.push(`${e}: ${t};`)}return o.length?`:root { ${o.join(" ")} }`:""}(e);n?E(t,Ne,n):I(t,Ne)}var Le="data-easel-block",Be="data-easel-dropzone",Ke={},Ze="data-es-mirror",Fe="undefined"==typeof window?G:ie;function Te(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Ze}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Ze,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function He({children:e,id:t="preview-frame",title:o,className:r,style:l,mirrorStyles:i=!0,onDocument:s,height:a="auto",nonce:c}){const u=w("canvas",n),d=_(null),[p,f]=te(null);return Fe(()=>{const e=d.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]),Fe(()=>{let e=d.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=d.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),S(e,c),f(t),s?.(e);let n=null;const o=d.current?.ownerDocument;if(i&&o){Te(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Te(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}let r=null;const l=d.current;if(l&&o){Ve(l,e);const t=o.defaultView;if(t&&"MutationObserver"in t){r=new t.MutationObserver(()=>Ve(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__ */se("iframe",{ref:d,id:t,title:o??u.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:l,children:p?ue(e,p):null})}var qe=X(null),We=X(Ke),Qe=[];function Ye({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:l=120}){const i=Pe(),s=ze(n=>z(n.appState.data,i.config,{parentId:e,slot:t})??Qe),a=ze(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==P),c=ze(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=J(qe),d=["es-zone"];return s.length&&d.push("has-children"),e===P&&d.push("is-root"),(a||c)&&d.push("is-area-selected"),null!==u&&u===e&&e!==P&&d.push("is-hovering-area"),n&&d.push(n),/* @__PURE__ */se("div",{className:d.join(" "),[Be]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${l}px`},children:s.map(e=>/* @__PURE__ */se(nt,{node:e},e.props.id))})}function Ue(e,t,n,o){const r=re(()=>{const n={};for(const o of W(Q(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
|
|
2
2
|
return se(Ye,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=Y(n[e],o);return r}function Xe(e){return re(()=>function({zone:t,...n}){/* @__PURE__ */
|
|
3
|
-
return se(Ye,{parentId:e,slot:t,...n})},[e])}var Ge=["top","bottom","zIndex"];function Je(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function _e(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));Je(e,"position",t?"sticky":"relative");for(const n of Ge)Je(e,n,t?.[n]??"");return!!t}var et="data-es-canvas-relative";function tt(e){e.hasAttribute(et)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(et));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(et,"")),!1)}function nt({node:e}){const t=Pe().config,n=t.components[e.type],o=e.props.id,r=_(null),l=function(e,t){return re(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Le),o.removeAttribute("data-easel-dnd")),t.current=n,n&&(n.setAttribute(Le,e),n.setAttribute("data-easel-dnd",e),tt(n))},[e,t])}(o,r),i=_(null),s=!!n?.inline;!function(e,t){const n=_(!1),o=_(()=>{});o.current=()=>{const o=e(),l=n.current;n.current=!!o&&t(o),l!==n.current&&r.current()};const r=_(()=>{});Fe(()=>o.current()),Fe(()=>{const t=e(),l=t?.ownerDocument.defaultView;if(!t||!l)return;const i=()=>o.current();l.addEventListener("resize",i);const s=l.ResizeObserver,a=s?new s(i):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&l.MutationObserver&&(c=new l.MutationObserver(i),c.observe(e,{attributes:!0}))},r.current(),()=>{l.removeEventListener("resize",i),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>s?r.current:i.current,e=>s?tt(e):_e(e));const a=J(
|
|
4
|
-
/* @__PURE__ */se("div",{ref:i,[Le]:o,"data-easel-dnd":o,style:{position:"relative"},children:/* @__PURE__ */se(d,{...p,editor:f,editMode:!0})})}function ot({metadata:e}){const t=
|
|
5
|
-
return se(
|
|
6
|
-
return se("div",{ref:
|
|
7
|
-
return se("div",{ref:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/* @__PURE__ */se(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
|
|
15
|
-
/* @__PURE__ */se(
|
|
16
|
-
|
|
3
|
+
return se(Ye,{parentId:e,slot:t,...n})},[e])}var Ge=["top","bottom","zIndex"];function Je(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function _e(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));Je(e,"position",t?"sticky":"relative");for(const n of Ge)Je(e,n,t?.[n]??"");return!!t}var et="data-es-canvas-relative";function tt(e){e.hasAttribute(et)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(et));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(et,"")),!1)}function nt({node:e}){const t=Pe().config,n=t.components[e.type],o=e.props.id,r=_(null),l=function(e,t){return re(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Le),o.removeAttribute("data-easel-dnd")),t.current=n,n&&(n.setAttribute(Le,e),n.setAttribute("data-easel-dnd",e),tt(n))},[e,t])}(o,r),i=_(null),s=!!n?.inline;!function(e,t){const n=_(!1),o=_(()=>{});o.current=()=>{const o=e(),l=n.current;n.current=!!o&&t(o),l!==n.current&&r.current()};const r=_(()=>{});Fe(()=>o.current()),Fe(()=>{const t=e(),l=t?.ownerDocument.defaultView;if(!t||!l)return;const i=()=>o.current();l.addEventListener("resize",i);const s=l.ResizeObserver,a=s?new s(i):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&l.MutationObserver&&(c=new l.MutationObserver(i),c.observe(e,{attributes:!0}))},r.current(),()=>{l.removeEventListener("resize",i),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>s?r.current:i.current,e=>s?tt(e):_e(e));const a=J(We),c=Ue(n,o,e.props,t.components),u=Xe(o);if(!n?.render)return null;const d=n.render,p={...U(n),...e.props,...c},f={renderDropZone:u,isEditing:!0,dragRef:n.inline?l:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */se(d,{...p,editor:f,editMode:!0}):
|
|
4
|
+
/* @__PURE__ */se("div",{ref:i,[Le]:o,"data-easel-dnd":o,style:{position:"relative"},children:/* @__PURE__ */se(d,{...p,editor:f,editMode:!0})})}function ot({metadata:e}){const t=ze(e=>e.config),n=ze(e=>e.appState.data.root).props??{},o=t.root?.render,r=Ue(t.root,P,n,t.components),l=Xe(P),i=/* @__PURE__ */se(Ye,{parentId:P,slot:q}),s=o?/* @__PURE__ */se(o,{id:"page-root",...n,...r,editor:{renderDropZone:l,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:i}):i;/* @__PURE__ */
|
|
5
|
+
return se(We.Provider,{value:e??Ke,children:s})}var rt=X(void 0),lt=X(void 0);function it(e,t,n,o){const r=O(e,t,n);return!!r&&(T(r.node,t).length>0||!1===o.whole)}var st=X(void 0),at="data-es-chrome",ct=X(void 0);function ut(e){const t=e?.closest?.(`[${at}]`)??null,n=t?.getAttribute(at);return t&&n?{id:n,element:t}:null}function dt({element:e,clip:t=!1}){const n=_(null),o=ht(n,e?()=>e:null,e),r=J(kt);/* @__PURE__ */
|
|
6
|
+
return se("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,clipPath:t?bt(o,r):void 0}:{display:"none"}})}var pt={"--es-words-clear":`${D}px`};function ft({element:e,words:t=!1,clip:n=!1}){const o=_(null),r=ht(o,e?()=>e:null,e),l=J(kt);/* @__PURE__ */
|
|
7
|
+
return se("div",{ref:o,"aria-hidden":"true",className:"es-canvas-outline is-selected is-selected-part"+(t?" is-words":""),style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height,clipPath:n?bt(r,l):void 0,...pt}:{display:"none"}})}function ht(e,t,n){return gt(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var mt=[];function gt(e,t,n){const[o,r]=te(mt),l=_(t);return l.current=t,Fe(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!l.current)return void r(mt);let o=0;const i=()=>{o=0;const n=e.current?.parentElement??null,i=(l.current?l.current(t):[]).map(e=>function(e,t){if(!e||!t)return null;const n=M(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=i)||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:i.length?i:mt;var t,n})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(i))};i();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),n.addEventListener("scroll",s,{capture:!0,passive:!0}),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),n.removeEventListener("scroll",s,{capture:!0}),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}var vt=D+2,yt=vt+2,wt=1;function bt(e,t){const n=e.left+e.width,o=e.top+e.height,r=t.map(t=>{const r=t.left+t.width,l=t.top+t.height;if(!(r>e.left-vt&&t.left<n+vt&&l>e.top-vt&&t.top<o+vt))return null;const i=Math.max(t.left<=e.left&&r>e.left?Math.min(t.left,e.left-wt):t.left,e.left-yt)-e.left,s=Math.max(t.top<=e.top&&l>e.top?Math.min(t.top,e.top-wt):t.top,e.top-yt)-e.top,a=Math.min(r>=n&&t.left<n?Math.max(r,n+wt):r,n+yt)-e.left,c=Math.min(l>=o&&t.top<o?Math.max(l,o+wt):l,o+yt)-e.top;return a>i&&c>s?{x:i,y:s,w:a-i,h:c-s}:null}).filter(e=>null!==e);if(!r.length)return;const l=function(e){if(e.length<2)return e;const t=Array.from(new Set(e.flatMap(e=>[e.x,e.x+e.w]))).sort((e,t)=>e-t),n=Array.from(new Set(e.flatMap(e=>[e.y,e.y+e.h]))).sort((e,t)=>e-t),o=[];for(let r=0;r<n.length-1;r++){const l=o=>e.some(e=>e.x<=t[o]&&t[o+1]<=e.x+e.w&&e.y<=n[r]&&n[r+1]<=e.y+e.h);for(let e=0;e<t.length-1;e++){if(!l(e))continue;let i=e+1;for(;i<t.length-1&&l(i);)i++;const s={x:t[e],y:n[r],w:t[i]-t[e],h:n[r+1]-n[r]},a=o.find(e=>e.x===s.x&&e.w===s.w&&e.y+e.h===s.y);a?a.h+=s.h:o.push(s),e=i-1}}return o}(r);return`path(evenodd, "${`M${-yt} ${-yt}h${e.width+2*yt}v${e.height+2*yt}h${-(e.width+2*yt)}z`}${l.map(e=>`M${e.x} ${e.y}h${e.w}v${e.h}h${-e.w}z`).join("")}")`}var kt=X([]);function St({children:e}){const t=_(null),n=J(ct),o=gt(t,n?e=>Array.from(e.querySelectorAll(`[${at}]`)):null,n?1:0);/* @__PURE__ */
|
|
8
|
+
return ae("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
|
|
9
|
+
/* @__PURE__ */se("span",{ref:t,hidden:!0,"aria-hidden":"true"}),
|
|
10
|
+
/* @__PURE__ */se(kt.Provider,{value:o,children:e})]})}function xt({id:e,kind:t,overlay:n}){const o=_(null),r=J(lt),l=null!==e&&!0===r?.(e),i=gt(o,e?t=>$(t,`[${Le}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=i,c=J(kt),u=`es-canvas-outline is-${t}${l?" is-shared":""}`,d=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height,clipPath:bt(e,c)}),p=/* @__PURE__ */ae(ce,{children:[
|
|
11
|
+
/* @__PURE__ */se("div",{ref:o,"aria-hidden":"true",className:u,style:s?d(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */se("div",{"aria-hidden":"true",className:u,style:d(e)},t))]});return n&&e?/* @__PURE__ */se(n,{componentId:e,kind:t,children:p}):p}function Ct(e,n){return Array.from(e.querySelectorAll(`[${Le}]`)).find(o=>o.getAttribute(Le)===n&&t(o)?.wrapper===e)??null}function Et(e,t,n){const o=g(e,n),r=o.text.length,l=e.ownerDocument;if(!t)return[r,r];let i=null;const s=l.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))i=o.at(s.offsetNode,s.offset);else{const n=l.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(i=o.at(n.startContainer,n.startOffset))}if(null===i)return[r,r];const a=o.text;let c=i,u=i;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;u<a.length&&!/\s/.test(a[u]);)u+=1;return[c,u]}function It({s:e,element:t,toolbar:n,label:o,keys:r}){const l=w("copy",y),i=e.pressed(),s=new Set(n.offered),a=n.colors&&n.colors.length>0?n.colors:null,c=_(null),[m,g]=te(!1),[v,b]=te(null),k=m||null!==v,S=()=>{e.hold(),g(!1),b({href:e.pressed().href})},x=()=>{g(!1),b(null),e.resume()};ie(()=>{r.current={escape:()=>!!k&&(x(),!0),link:()=>!!s.has("link")&&(S(),!0)}}),ie(()=>()=>{r.current=null},[r]);const C=_(x);C.current=x,G(()=>{if(m)return de(e=>{const t=c.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(C.current(),!0)},()=>c.current?.querySelector(".es-copy-colors"))},[m]),G(()=>{const n=c.current;if(!k||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const l=o=>{const r=o.target;if(r&&n.contains(r))return;g(!1),b(null);const l=t();r&&l&&l.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",l,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",l,!0)}},[k,e,t]),ie(()=>{const e=c.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,l=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,i=(l?u(l,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,a=s?A(s,{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top}):{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top},f=o.getBoundingClientRect(),h=s?A(s,{left:f.left,top:f.top,width:f.width,height:f.height}):{left:f.left,top:f.top,width:f.width,height:f.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:a.left,right:a.left+a.width,top:Math.min(a.top,h.top-6,m.top),bottom:Math.max(a.top+a.height,h.top+h.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=d({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:p(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=a?{run:f(i.color,a),open:m,onToggle:()=>{b(null),m?x():(e.hold(),g(!0))}}:void 0;/* @__PURE__ */
|
|
12
|
+
return se(pe,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?A(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__ */se("div",{ref:c,children:/* @__PURE__ */se(fe,{layout:"row",offered:s,pressed:i.marks,onMark:t=>{"link"===t?S():e.press(t)},color:E,linkOpen:null!==v,list:{pressed:i.list,onList:t=>e.list(t)},clear:i.clearable?{onClear:()=>e.clear()}:void 0,alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:i.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */ae(ce,{children:[m&&a?/* @__PURE__ */se(h,{colors:a,current:i.color,words:l.colors??y.colors,onPick:t=>e.color(t)}):null,v?
|
|
13
|
+
/* @__PURE__ */se(he,{className:"es-copy-link es-copy-pop",value:v.href??"",onApply:t=>{b(null),e.link(t)},onRemove:null!==v.href?()=>{b(null),e.link(null)}:void 0,onCancel:x}):null]})})})})}function Dt({element:e,which:t}){const n=_(null),o=ht(n,()=>e(),t),r=J(kt);/* @__PURE__ */
|
|
14
|
+
return se("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,clipPath:bt(o,r),...pt}:{display:"none"}})}function At({frame:o=!0,className:r,style:l,metadata:i,mirrorStyles:u,onDocument:d,height:p,title:f,nonce:h,hotkeys:y,frameWrapper:S,overlay:C,children:E,typing:I,passThrough:D}){const A=Pe(),M=J(rt),$=D??M,P=J($e),z=w("canvas",n),R=y??P,[j,N]=te(void 0),V=ze(e=>"node"===e.selection?.kind?e.selection.id:null),[L,B]=te(null),[K,Z]=te(null),F=J(st),H=J(ct),[q,W]=te(null),[,Q]=ne(e=>e+1,0),[,Y]=ne(e=>e+1,0),U=e=>{F?.select(e),Y()},[X,ee]=te(null),oe=_(null),re=_(null),[,le]=te(0),ie=_(I);ie.current=I;const ce=_(null),ue=_(null),de=()=>{if(!V)return null;const e=ie.current?.atSelection?.()?.element()??null;if(!e)return null;const t=ue.current?.ownerDocument;if(F){const n=F.selected()&&t?F.selectedPart?.(t)??null:null;return n&&x(n.element,e)?n.element:null}const n=O(A.getState().appState.data,A.config,V);return n&&0===T(n.node,A.config).length?e:null},pe=ze(e=>e.appState.data),fe=F?.selected()??null;G(()=>{const e=ue.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=V&&!X&&ie.current?.atSelection?.()?V:null,o=n?de():null;e.dispatchEvent(new t(b,{detail:o?{id:n,words:o}:{id:n}}))},[V,X,pe,fe]);const he=e=>{const t=ue.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(k,{detail:{typing:e}}))},me=(e,t)=>{oe.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=ge(e,n),r=A.group(),l=e.element,i=m({element:l,value:o?.value??e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Et(n,t,e.skip),write:o?.write??e.write,remount:e.remount,onSelect:()=>le(e=>e+1),onEscape:()=>ce.current?.escape()??!1,onLinkKey:()=>ce.current?.link()??!1,end:e=>{r.close(),oe.current?.element===l&&(oe.current=null),ee(null),he(!1),ie.current?.onChange?.({typing:!1,why:e})}});if(!i)return r.close(),!1;const s=n.closest?.(`[${Le}]`)?.getAttribute(Le);return s&&A.select(s),oe.current={s:i,element:l,target:e},ee(()=>l),B(null),he(!0),ie.current?.onChange?.({typing:!0,element:n}),!0},ge=(e,n)=>{const o=e.key;if(!o||!ie.current?.onCopyText)return null;const r=t(n),l=n.closest?.(`[${Le}]`),i=l?.getAttribute(Le);if(!r||!i||!r.wrapper.contains(l))return null;const{copy:s}=r,a=ie.current.copyValue?.({...s,nodeId:i,key:o}),c=g(n,e.skip).text,u=a??(v(e.value,e.rules).text===c?e.value:c),d={ownerId:s.ownerId,slot:s.slot,index:s.index,...s.outer?{outer:s.outer}:{},nodeId:i,key:o};return{value:u,write:t=>{const n=ie.current?.onCopyText;n&&!1!==n({...d,text:t})||e.write(t)}}};G(()=>()=>oe.current?.s.stop("stop"),[]);const ve=e=>{const t=oe.current?.element();return Boolean(t&&t.contains(e))},ye=(e,t)=>it(A.getState().appState.data,A.config,e,t),we=e=>{const t=e.closest?.(`[${Le}]`)?.getAttribute(Le);if(!t)return;const n=A.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=F?.partAt(e,t)??null;if(r){const e=a(n.appState.data,A.config,t,r.id,o,F?.selected()??null,$);if(e)return{node:e.node,part:e.part?r:null}}return{node:c(n.appState.data,A.config,t,o,$)??t,part:null}},be=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(oe.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=ke(),o=void 0===n?ie.current?.atSelection?.():n;o&&me(o,null)&&e.preventDefault()},ke=()=>{const t=ie.current,n=re.current;if(!t?.onCopyText||!n?.copy||n.node!==V)return;const o=ue.current,r=o?e(o,n.copy):null,l=r?Ct(r,n.node):null;if(!l)return null;const i=t.atSelection?.()??null,s=i?.element()??null;if(!i||!s)return null;if(l.contains(s))return i;const a=function(e,t){const n=e.closest(`[${Le}]`);if(!n||n.getAttribute(Le)!==t.getAttribute(Le))return null;const o=[];for(let t=e;t!==n;t=t.parentElement)o.unshift(Array.prototype.indexOf.call(t.parentElement.children,t));let r=t;for(const e of o)r=r?.children[e];return r&&r.tagName===e.tagName?r:null}(s,l);return a?t.at(a):null},Se=(e,n)=>{if(!ie.current?.onCopyText)return null;const o=t(e);return o&&Ct(o.wrapper,n)?o.copy:null},xe=ue.current?.ownerDocument??null,Ce=F?.selected()&&xe&&V?F.selectedPart?.(xe)??null:null,Ee=Ce&&V&&ye(V,Ce)?Ce.element:null,Ie=H?.selected()??null,De=Ie&&xe?Array.from(xe.querySelectorAll(`[${at}]`)).find(e=>e.getAttribute(at)===Ie)??null:null,Me=X?null:de(),Oe=/* @__PURE__ */ae("div",{ref:ue,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),oe.current){if(ve(t))return;oe.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=H?ut(t):null;if(H&&o)return H.select(o.id),W(null),void Q();const r=we(t);if(re.current=void 0!==r?{node:r.node,copy:Se(t,r.node)}:null,void 0!==r)return A.select(r.node),void(F&&(r.part?.id??null)!==F.selected()&&U(r.part?.id??null));t.hasAttribute?.(Be)||(A.select(null),F?.selected()&&U(null))},onDoubleClick:e=>{const t=ie.current;if(!t||ve(e.target))return;const n=t.at(e.target);n&&me(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>be(e),onMouseOver:e=>{if(oe.current)return;const t=H?ut(e.target):null;if(t?.element!==q?.element&&W(t),t)return null!==L&&B(null),void(null!==K&&Z(null));const n=we(e.target),o=!!n?.part&&ye(n.node,n.part),r=n?.part&&o&&n.part.id!==F?.selected()?n.part:null,l=!n||n.part&&o?null:n.node;l!==L&&B(l),r?.id===K?.id&&r?.element===K?.element||Z(r)},onMouseLeave:()=>{B(null),Z(null),W(null)},children:[
|
|
15
|
+
/* @__PURE__ */se(qe.Provider,{value:L,children:/* @__PURE__ */se(ot,{metadata:i})}),
|
|
16
|
+
/* @__PURE__ */ae(St,{children:[
|
|
17
|
+
/* @__PURE__ */se(xt,{id:!X&&L&&L!==V?L:null,kind:"hover",overlay:C}),F?/* @__PURE__ */se(dt,{clip:!0,element:X||!K||K.id===F.selected()?null:K.element}):null,Me||Ee?/* @__PURE__ */se(ft,{clip:!0,element:X?null:Me??Ee,words:null!==Me}):null,H?/* @__PURE__ */se(dt,{element:X||!q||q.element===De?null:q.element}):null,De?/* @__PURE__ */se(ft,{element:X?null:De}):null,
|
|
18
|
+
/* @__PURE__ */se(xt,{id:X||Ee||Me||De?null:V,kind:"selected",overlay:C}),X?/* @__PURE__ */se(Dt,{element:()=>{const e=X?.()??null;return e?Ce&&x(Ce.element,e)?Ce.element:e:null},which:Ce?.element??X}):null]}),E]}),Re=S?/* @__PURE__ */se(S,{document:j,children:Oe}):Oe;G(()=>{if(j&&R)return Ae(j,A)},[j,R,A]),G(()=>{if(!j)return;const e=e=>{if("Enter"===e.key)return void be(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=A.getState();if("node"!==n.selection?.kind)return;if(F?.selected())return void U(null);const o=s(n.appState.data,A.config,n.selection);"node"===o?.kind&&A.select(o.id)};return j.addEventListener("keydown",e),()=>j.removeEventListener("keydown",e)},[j,A,F]);/* @__PURE__ */
|
|
19
|
+
return ae("div",{className:"es-canvas"+(r?` ${r}`:""),style:l,"data-easel-preview":"","data-es-typing":X?"":void 0,children:[X&&oe.current?.target.toolbar?/* @__PURE__ */se(It,{s:oe.current.s,element:oe.current.element,toolbar:oe.current.target.toolbar,label:z.textTools,keys:ce}):null,o?/* @__PURE__ */se(He,{mirrorStyles:u,onDocument:e=>{N(e??void 0),d?.(e)},height:p,title:f,nonce:h,children:Re}):/* @__PURE__ */se("div",{id:"preview-frame","data-easel-entry":"",children:Re})]})}function Mt(e={}){const t=Pe(),n=ze(e=>e.appState.data);return i({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function $t(){return jt(ze(e=>e.selectedItem))}function Ot(){const e=J(Pt);try{return function(e){const t=ze(e=>e.selectedItem);return jt("root"===e?null:t)}(e)}catch{return null}}var Pt=X("selected");function zt({children:e}){return oe(Pt.Provider,{value:"root"},e)}function Rt(){return jt(null)}function jt(e){const t=Pe(),n=ze(e=>e.config),r=t.resolveCache,l=ze(e=>e.appState.data.root),i=e?e.props.id:"root",s=l.props??{},a=re(()=>e||{type:"root",props:s},[e,s]),c=e?n.components[e.type]:n.root,u=t.getState(),d=e?O(u.appState.data,n,i):null,p=d&&"root"!==d.place.parentId?d.place.parentId:null,f=p?u.getItemById(p)??null:null,{fields:h}=o({id:i,node:a,block:c,parent:f,appState:u.appState}),m=ze(t=>!1===t.getPermissions(e?{item:e}:{root:!0}).edit),g=le(e=>{(async()=>{const o=t.getState();if("root"!==i){const l=o.getItemById(i),s=o.getSelectorForId(i);if(!l||!s)return;const a={...l,props:{...l.props,...e}},{node:c}=await H(a,n,{cache:r,trigger:"replace"}),u=t.getState().getSelectorForId(i);if(!u)return;return void t.dispatch({type:"replace",destinationZone:u.zone??"root:default-zone",destinationIndex:u.index,data:c})}const l=o.appState.data.root.props??{},{node:s}=await H({type:"root",props:{...l,...e}},n,{cache:r,trigger:"replace"});t.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[t,n,r,i]),v=le((e,t)=>g({[e]:t}),[g]);return{id:i,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{at as CHROME_ATTR,ct as CanvasChromeContext,He as CanvasFrame,st as CanvasPartsContext,rt as CanvasPassThroughContext,lt as CanvasSharedContext,Ce as DEFAULT_UI,At as EaselCanvas,Oe as EaselProvider,ot as EditDocument,zt as RootHostScope,Ae as bindUndoKeys,De as createEasel,Re as createUseEasel,it as partHasOwnBox,me as recordsByDefault,ke as reduce,ye as uiView,ze as useEasel,Pe as useEaselApi,Mt as useEaselNodeOps,Rt as useRootFields,$t as useSelectedFields,Ot as useSelectedHost,we as validSelection};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{useAccessPatch as e,FLAT_ACCESS as o,onDesktopWords as r,useAccessValue as t}from"./chunk-EEIDFHOG.js";import{CornersInput as s,BorderInput as l,SettingsColour as n}from"./chunk-CLAADE4J.js";import{SettingsDefaultReset as i}from"./chunk-2T22IY3J.js";import{noControlField as c,NoControlMark as a}from"./chunk-22I55W37.js";import{normalizeCornerSides as d,CORNER_SIDES as u}from"./chunk-BAI7MIH4.js";import{DEFAULT_PANEL_WORDS as p,DEFAULT_COLOUR_ROW_WORDS as y}from"./chunk-56ID6FKZ.js";import{SettingsField as f}from"./chunk-MIX7EGRG.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{CornerIcon as m,BorderAllIcon as b}from"efficient-shell/icons/efficient";import{jsx as w}from"react/jsx-runtime";var g=e=>e;function v(e,o){const r=o.twinAccess;return r?{key:e.key,access:r,ownField:r.ownField}:e}function k(e,r){const s=!e.access||e.ownField?{value:r.value,onChange:r.onChange}:void 0;return t(e.access??o,e.key,s)}function F(e,r){return t(e.access??o,r??"")}function j(e){return{...c({type:"custom",render:()=>/* @__PURE__ */w(a,{})},"always"),reachedBy:e}}function B({o:t,say:s,props:l}){const i=h("colourRow",y),c=h("panel",p),a=t.useFollows(),d=t.usePresets?.(),u=t.opacity?.useUnset?.()??100,f=v(t,l),[m,b]=k(f,l),[g,j]=F(f,t.opacity?.key),B=e(f.access??o),C="string"==typeof m?m:"",O="number"==typeof g,A="follows"in l,I=(A&&"string"==typeof l.follows&&""!==l.follows?l.follows:void 0)??a,x=t.access||A?void 0:"";/* @__PURE__ */
|
|
2
|
+
return w(n,{label:s(t.label),icon:t.icon,value:C,onChange:e=>b(""===e?x:e),inherited:I,presets:d,changed:""!==C||O,onReset:()=>{O&&t.opacity?B([[t.key,x],[t.opacity.key,void 0]]):b(x)},resetTo:A?r(s,I.toUpperCase()):t.resetTo?t.resetTo(a.toUpperCase()):a.toUpperCase(),...t.opacity?{opacity:O?g:u,onOpacityChange:e=>j(e)}:{},readOnly:l.readOnly,words:i,resetWords:c})}var C=20;function O({o:e,say:o,props:t}){const s=e.useFollows(),[n,c]=k(v(e,t),t),a=n&&"object"==typeof n?n:{},d="follows"in t,u=d&&t.follows&&"object"==typeof t.follows?t.follows:{},p="number"==typeof u.width?u.width:s.width,y="string"==typeof u.color&&""!==u.color?u.color:s.color,h=Object.keys(a).length>0,m={width:o("Border width"),sides:{top:o("Border top"),right:o("Border right"),bottom:o("Border bottom"),left:o("Border left")},style:o("Border style"),styles:{solid:o("Solid"),dashed:o("Dashed"),dotted:o("Dotted")},color:o("Border color"),unit:"px"};/* @__PURE__ */
|
|
3
|
+
return w(f,{label:o("Border"),icon:/* @__PURE__ */w(b,{}),action:d?/* @__PURE__ */w(i,{label:o("Border"),changed:h,detail:r(o,`${p}px`),disabled:t.readOnly,onReset:()=>c(void 0)}):void 0,children:/* @__PURE__ */w(l,{label:o("Border"),value:a,each:!1,onChange:o=>c(function(e){const o=Object.fromEntries(Object.entries(e).filter(([,e])=>null!=e&&""!==e));return Object.keys(o).length?o:void 0}(e.styles?{width:o.width,color:o.color,style:o.style}:{width:o.width,color:o.color})),placeholder:{sides:{top:p,right:p,bottom:p,left:p},style:u.style??"solid",color:y},presets:[y],words:m,styles:e.styles??!1,max:20,readOnly:t.readOnly})})}var A=40,I=()=>null;function x({o:r,say:t,props:l}){const n=h("panel",p),c=r.useFollows(),[a,y]=k(r,l),[b,g]=F(r,r.sidesKey),v=e(r.access??o),j=r.access?void 0:null,B="number"==typeof a&&Number.isFinite(a)?a:null,C=d((r.useFollowsSides??I)())??[...u],O=d(b)??C,A=[{value:"tl",label:t("Top left")},{value:"tr",label:t("Top right")},{value:"bl",label:t("Bottom left")},{value:"br",label:t("Bottom right")}];/* @__PURE__ */
|
|
4
|
+
return w(f,{label:t("Corners"),icon:/* @__PURE__ */w(m,{}),changed:null!==B||Array.isArray(b),action:/* @__PURE__ */w(i,{label:t("Corners"),changed:null!==B||Array.isArray(b),detail:`${c}px`,onReset:()=>Array.isArray(b)?v([[r.key,j],[r.sidesKey,j]]):y(j),words:n}),children:/* @__PURE__ */w(s,{label:t("Corners"),value:O,corners:A,onChange:e=>{const o=u.filter(o=>e.includes(o)),r=o.length===C.length&&o.every(e=>C.includes(e));g(r?j:o)},radius:B,onRadiusChange:e=>y(e??j),radiusMin:0,radiusMax:40,radiusStep:r.step??1,radiusPlaceholder:String(c),disabled:l.readOnly})})}function R(e=g){return{colourField:o=>({type:"custom",render:r=>/* @__PURE__ */w(B,{o:o,say:e,props:r})}),borderField:o=>({type:"custom",render:r=>/* @__PURE__ */w(O,{o:o,say:e,props:r})}),cornersField:o=>({type:"custom",render:r=>/* @__PURE__ */w(x,{o:o,say:e,props:r})})}}var{colourField:T,borderField:D,cornersField:E}=R();export{C as BORDER_WIDTH_MAX,A as CORNER_RADIUS_MAX,D as borderField,T as colourField,E as cornersField,j as keptByRow,R as styleFieldBuilders};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-ODHJRBJV.js";import{useEaselHost as e}from"./chunk-LX23TCTP.js";import{createEasel as r,EaselProvider as o}from"./chunk-EVYIDHCK.js";import{useState as n,useEffect as s}from"react";import{jsx as a}from"react/jsx-runtime";function i({config:i,data:c,onChange:m,permissions:p,parts:f,children:u}){const[d]=n(()=>r({config:i,data:c,permissions:p}));s(()=>{d.setConfig(i)},[d,i]),s(()=>{if(!m)return;let t=d.getState().appState.data,e=!1;return d.subscribe(()=>{const r=d.getState().appState.data;r!==t&&(t=r,(e||r!==d.loaded)&&(e=!0,m(r)))})},[d,m]),s(()=>{p&&d.setPermissions(p)},[d,p]);const h=e();/* @__PURE__ */
|
|
2
2
|
return a(o,{easel:d,hotkeys:h.ownsDocument,children:/* @__PURE__ */a(t,{parts:f,children:u})})}export{i as ScreenStoreProvider};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-GQXH7DQV.js";import{ScreenChrome as e}from"./chunk-3JIBSQZI.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-BYONFJVQ.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-Q3VAJMXS.js";import{documentPermissions as s}from"./chunk-YYD257TD.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 k=r(n),C=r(e);function N({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const k=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
4
|
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
|
-
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function
|
|
7
|
-
/* @__PURE__ */u(
|
|
5
|
+
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{k()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function Q({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),Q=t(()=>s(!g),[g]),D=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:D.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:Q,parts:n,children:/* @__PURE__ */u(C,{})}),f&&/* @__PURE__ */u(N,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:D.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:D.waitingForAuthorization})}export{Q as DocumentScreen,j as ScreenMount};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-EVYIDHCK.js";import{Inspector as i}from"./chunk-C7IFWSUA.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={},C=()=>b,O=()=>"",j=()=>null,S=()=>{},w={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},I={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},N={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
|
|
2
|
+
return f(r,{height:"fill"})}function A(){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 B=l({});function F({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return f(B.Provider,{value:n,children:e})}function x(){return s(B)}function G(){return(x().useOwnerName??O)()}function T(){return(x().useDocumentLabel??j)()}function Y(n,e,t,r){return(x().useBridges??C)(n,e,t,r)}function V(n){return(x().useStandaloneBridges??C)(n)}function E(n,e){(x().useDocumentPass??S)(n,e)}function H(){return x().blockRules??w}function K(){return x().blockLook??I}function Q(){return x().devices??L}function R(){return x().leftView??D}function W(){return x().pinned??N}function X(){return x().saveSwitch??!0}function M(e){n(!0===x().pickFollowsSelection,e)}function U(){return x().storageNamespace||void 0}function Z(){return x().styleClipboard??null}function q(){return x().nodeKeys??!0}function z(){return x().notify??null}function J(){return x().Canvas??P}function $(){return x().CanvasHead??null}function _(){return x().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 x().Inspector??A}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,F 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,K as useScreenBlockLook,H as useScreenBlockRules,Y as useScreenBridges,_ as useScreenCanvasDrag,J as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,Q as useScreenDevices,T as useScreenDocumentLabel,E as useScreenDocumentPass,rn as useScreenInspectorPanel,R as useScreenLeftView,q as useScreenNodeKeys,z as useScreenNotify,G as useScreenOwnerName,x as useScreenParts,M as useScreenPickFollowsSelection,W as useScreenPinned,X as useScreenSaveSwitch,U as useScreenStorageNamespace,Z as useScreenStyleClipboard,V as useStandaloneScreenBridges};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-
|
|
1
|
+
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-ODHJRBJV.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-Q3VAJMXS.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{ItemCount as n,DropdownMenu as c}from"efficient-shell/ui";import{jsxs as a,jsx as o,Fragment as i}from"react/jsx-runtime";function m({choices:m,onPick:p}){const{Icon:u}=t(),f=r("screen",l),h=e(s(m)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */a("span",{className:"flex w-full items-center gap-2",children:[
|
|
2
2
|
/* @__PURE__ */o("span",{children:e.group}),
|
|
3
3
|
/* @__PURE__ */o(n,{count:e.items.length,label:f.blockCount({count:e.items.length}),className:"ml-auto"})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(u,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
4
4
|
return o(c,{align:"start",triggerClassName:"sf-add-card",items:h,trigger:/* @__PURE__ */a(i,{children:[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{styleFieldBuilders as e,keptByRow as s}from"./chunk-EZXQJN6V.js";import{boxFieldBuilders as o,PHONE_KEY_ACCESS as l,phoneTwinFields as r,section as i}from"./chunk-EEIDFHOG.js";import{deviceField as t}from"./chunk-7GGNFLHT.js";import{BUTTON_STYLE_KEYS as c,BUTTON_PAD_KEYS as n}from"./chunk-BAI7MIH4.js";import{TextColorIcon as u,GroundIcon as d}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";function a(a){const F=o(a.say),p=e(a.say),y=c,m=a.style,k=a.phone??l;return{_dSize:i("Size"),...F.sidesPaddingFields({keys:n,group:!1,...a.padding}),_dDesign:i("Design"),[y.fill]:p.colourField({key:y.fill,access:m,label:"Fill color",icon:/* @__PURE__ */f(d,{}),useFollows:a.follows.useFill,usePresets:a.usePresets,resetTo:a.resetTo,opacity:{key:y.fillOpacity,useUnset:a.follows.useFillOpacity}}),[y.fillOpacity]:s(y.fill),[y.border]:p.borderField({key:y.border,access:m,useFollows:a.follows.useBorder}),[y.text]:p.colourField({key:y.text,access:m,label:"Text color",icon:/* @__PURE__ */f(u,{}),useFollows:a.follows.useText,usePresets:a.usePresets,resetTo:a.resetTo}),[y.corners]:p.cornersField({key:y.corners,access:m,sidesKey:y.cornerSides,useFollows:a.follows.useCorners,useFollowsSides:a.follows.useCornerSides}),[y.cornerSides]:s(y.corners),_dLayout:i("Layout"),...r("align",F.blockAlignmentField({phone:!0},""),k),align:t("desktop",F.blockAlignmentField())}}export{a as buttonFieldSet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-ODHJRBJV.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-EVYIDHCK.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
package/dist/draw/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export { HERO_SLIDER_GOTO_EVENT, HeroSliderGotoDetail } from '../screen/lib/docu
|
|
|
9
9
|
export { B as BLOCK_ATTRIBUTE, R as REPEAT_ATTRIBUTE, a as REPEAT_INDEX_ATTRIBUTE } from '../dom-BpxMcHFP.js';
|
|
10
10
|
export { TEXT_STYLE_CASES, TEXT_STYLE_CASE_CSS, TextStyleCase, TextStyleCaseCss, isTextStyleCase, textStyleCaseCss, textStyleCaseOfCss } from '../text-styles/model.js';
|
|
11
11
|
export { BLOCK_FIXED_WIDTH, BLOCK_SIZE_KEYS, BLOCK_WIDTH_FIT_DEFAULT, BLOCK_WIDTH_FIT_POINTS, BLOCK_WIDTH_LIMIT, BlockSizeKey, BlockWidthFit, TEXT_FIT_MIN_FONT, TEXT_FIT_POINTS, TextFit, parseBlockWidthFit, parseTextFit } from '../screen/lib/content/block-size.js';
|
|
12
|
-
export { BUTTON_PAD_KEYS, BUTTON_STYLE_KEYS, CORNER_SIDES, CornerSide } from '../screen/lib/content/style-keys.js';
|
|
12
|
+
export { BUTTON_PAD_KEYS, BUTTON_STYLE_KEYS, CORNER_SIDES, CornerSide, hasCornerSubset, normalizeCornerSides } from '../screen/lib/content/style-keys.js';
|
|
13
13
|
import '../words-B5Gb7KFq.js';
|
package/dist/draw/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SCALAR_TEXT_CONTROLS,TEXT_CONTROL_KINDS}from"../chunk-I6SK6ZDT.js";export{BUTTON_PAD_KEYS,BUTTON_STYLE_KEYS,CORNER_SIDES}from"../chunk-
|
|
1
|
+
export{SCALAR_TEXT_CONTROLS,TEXT_CONTROL_KINDS}from"../chunk-I6SK6ZDT.js";export{BUTTON_PAD_KEYS,BUTTON_STYLE_KEYS,CORNER_SIDES,hasCornerSubset,normalizeCornerSides}from"../chunk-BAI7MIH4.js";export{BLOCK_FIXED_WIDTH,BLOCK_SIZE_KEYS,BLOCK_WIDTH_FIT_DEFAULT,BLOCK_WIDTH_FIT_POINTS,BLOCK_WIDTH_LIMIT,TEXT_FIT_MIN_FONT,TEXT_FIT_POINTS,parseBlockWidthFit,parseTextFit}from"../chunk-X3EMJ2EX.js";export{AUTO_RULES,FOLLOW_RULES,VIEW_DESKTOP_MIN,VIEW_TABLET_MIN,VIEW_TIERS,VIEW_TIER_LABEL,isAuto,phoneKey,resolveViewValue,tabletKey,viewTierForWidth}from"../chunk-E52W3M5I.js";export{rootRowName,sectionRenameProp,slotChildName,slotChildRenameProp,slotChildRowName}from"../chunk-5NHQ452C.js";export{HERO_SLIDER_GOTO_EVENT}from"../chunk-AJ2SUSET.js";export{hidableText,readHidable}from"../chunk-6UAEFOJ4.js";export{ANCHOR_FIELD_KEYS,FOLD_FIELD_MARKER,LINK_FIELD_MARKER,MEDIA_FIELD_MARKER,SCAFFOLD_FIELD_MARKER,TEXT_FIELD_MARKER,foldMetaOf,textFieldIdentifier}from"../chunk-ANPOR6EY.js";export{PART_SEP,decodePartId,encodePartId}from"../chunk-R4AUZVA3.js";export{FOOTER_TYPE,HEADER_TYPE,ROOT_ZONE,TREE_MAX_DEPTH,blockNodeActions,childSlotsOf,locateNode,missingPinnedTypes,nestsInTree,newNodeId,pinnedDuplicateIds,pinnedDuplicateIndices,slotChildrenIn,slotFieldsOf}from"../chunk-TCAAOYQY.js";export{TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,isTextStyleCase,textStyleCaseCss,textStyleCaseOfCss}from"../chunk-YHZSBL2N.js";export{BLOCK_ATTRIBUTE}from"../chunk-FR7EEKFF.js";export{REPEAT_ATTRIBUTE,REPEAT_INDEX_ATTRIBUTE}from"../chunk-7UFKEX72.js";
|
package/dist/easel/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{CHROME_ATTR,CanvasChromeContext,CanvasFrame,CanvasPartsContext,CanvasPassThroughContext,CanvasSharedContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,RootHostScope,bindUndoKeys,createEasel,createUseEasel,partHasOwnBox,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useRootFields,useSelectedFields,useSelectedHost,validSelection}from"../chunk-
|
|
1
|
+
export{CHROME_ATTR,CanvasChromeContext,CanvasFrame,CanvasPartsContext,CanvasPassThroughContext,CanvasSharedContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,RootHostScope,bindUndoKeys,createEasel,createUseEasel,partHasOwnBox,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useRootFields,useSelectedFields,useSelectedHost,validSelection}from"../chunk-EVYIDHCK.js";export{repeatCopyAt}from"../chunk-JQQFB7EZ.js";import"../chunk-TBY3DFKS.js";import"../chunk-K53PQAMP.js";import"../chunk-QTHQPJWA.js";import"../chunk-HZSZT3BE.js";import"../chunk-PMRN5Z3T.js";import"../chunk-MFIRYGHW.js";import"../chunk-TOKMFZPB.js";import"../chunk-FR7EEKFF.js";import"../chunk-7UFKEX72.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddBlockRow as default}from"../../chunk-
|
|
1
|
+
export{AddBlockRow as default}from"../../chunk-QYSNJDMW.js";import"../../chunk-RUQOIQWI.js";import"../../chunk-ODHJRBJV.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-LX23TCTP.js";import"../../chunk-Q3VAJMXS.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-EVYIDHCK.js";import"../../chunk-JQQFB7EZ.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-C7IFWSUA.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-FM6JO4WF.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-K53PQAMP.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-QTHQPJWA.js";import"../../chunk-HZSZT3BE.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-Y2T3JX7K.js";import"../../chunk-KFWNGPW3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-JACEEVVF.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-3XECMGXX.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-TOKMFZPB.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";import"../../chunk-EUFDQ4KL.js";import"../../chunk-KXM6YRG2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{blockKey,AddSidePanel as default,presetKey,sectionKey,sharedKey,templateKey}from"../../chunk-
|
|
1
|
+
export{blockKey,AddSidePanel as default,presetKey,sectionKey,sharedKey,templateKey}from"../../chunk-2QXMDK67.js";import"../../chunk-GDO4QJ4G.js";import"../../chunk-IZGFJWH4.js";import"../../chunk-N7E6264U.js";import"../../chunk-N3MJOHAG.js";import"../../chunk-SBVIW3KJ.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-RUQOIQWI.js";import"../../chunk-ODHJRBJV.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-YM4UEGBV.js";import"../../chunk-SNF5764Q.js";import"../../chunk-LX23TCTP.js";import"../../chunk-Q3VAJMXS.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-EVYIDHCK.js";import"../../chunk-JQQFB7EZ.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-C7IFWSUA.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-FM6JO4WF.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-K53PQAMP.js";import"../../chunk-ZKY45F5G.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-QTHQPJWA.js";import"../../chunk-VBEVZZTV.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-AJSDWWJW.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-YYD257TD.js";import"../../chunk-RE4LP46F.js";import"../../chunk-HZSZT3BE.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-Y2T3JX7K.js";import"../../chunk-KFWNGPW3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-JACEEVVF.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-SQTVXE5D.js";import"../../chunk-TQ5Y6S2X.js";import"../../chunk-3XECMGXX.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-TOKMFZPB.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";import"../../chunk-EUFDQ4KL.js";import"../../chunk-KXM6YRG2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ScreenChrome as default}from"../../chunk-
|
|
1
|
+
export{ScreenChrome as default}from"../../chunk-3JIBSQZI.js";import"../../chunk-OXZDSOZV.js";import"../../chunk-7OCEPOEJ.js";import"../../chunk-JYVQ62TL.js";import"../../chunk-UMBNBCL4.js";import"../../chunk-5XL2RXFU.js";import"../../chunk-3QB2ZQXK.js";import"../../chunk-7GGNFLHT.js";import"../../chunk-22I55W37.js";import"../../chunk-LUOY3A3Q.js";import"../../chunk-CVS3RPO6.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6EDVZBUO.js";import"../../chunk-A2B6FLZP.js";import"../../chunk-YBDSG4BV.js";import"../../chunk-TOEJCZUO.js";import"../../chunk-PVBDKBJB.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-BYONFJVQ.js";import"../../chunk-QZJKWKGH.js";import"../../chunk-ERR437B5.js";import"../../chunk-JIP5JNRB.js";import"../../chunk-GR3XRILS.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-6ATIYLUL.js";import"../../chunk-KO47WAWR.js";import"../../chunk-NQW6XCAY.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-5545A3PC.js";import"../../chunk-2QXMDK67.js";import"../../chunk-GDO4QJ4G.js";import"../../chunk-IZGFJWH4.js";import"../../chunk-N7E6264U.js";import"../../chunk-N3MJOHAG.js";import"../../chunk-SBVIW3KJ.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-RUQOIQWI.js";import"../../chunk-ODHJRBJV.js";import"../../chunk-T2RINM7R.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-STQDOTHF.js";import"../../chunk-YM4UEGBV.js";import"../../chunk-SNF5764Q.js";import"../../chunk-LX23TCTP.js";import"../../chunk-XFYFKITX.js";import"../../chunk-Q3VAJMXS.js";import"../../chunk-CWELHADJ.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-5NHQ452C.js";import"../../chunk-AJ2SUSET.js";import"../../chunk-6UAEFOJ4.js";import"../../chunk-ANPOR6EY.js";import"../../chunk-R4AUZVA3.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-EVYIDHCK.js";import"../../chunk-JQQFB7EZ.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-C7IFWSUA.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-FM6JO4WF.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-K53PQAMP.js";import"../../chunk-ZKY45F5G.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-P5VYGWYO.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-QTHQPJWA.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-VBEVZZTV.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-AJSDWWJW.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-YYD257TD.js";import"../../chunk-RE4LP46F.js";import"../../chunk-HZSZT3BE.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-Y2T3JX7K.js";import"../../chunk-KFWNGPW3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-JACEEVVF.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-SQTVXE5D.js";import"../../chunk-TQ5Y6S2X.js";import"../../chunk-3XECMGXX.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-TOKMFZPB.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";import"../../chunk-EUFDQ4KL.js";import"../../chunk-KXM6YRG2.js";import"../../chunk-BSPCSC45.js";import"../../chunk-467WWV4I.js";import"../../chunk-TIAWIOGD.js";import"../../chunk-MGVI67QV.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DocumentScreen,ScreenMount as default}from"../../chunk-
|
|
1
|
+
export{DocumentScreen,ScreenMount as default}from"../../chunk-M42IJ4HT.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-GQXH7DQV.js";import"../../chunk-3JIBSQZI.js";import"../../chunk-OXZDSOZV.js";import"../../chunk-7OCEPOEJ.js";import"../../chunk-JYVQ62TL.js";import"../../chunk-UMBNBCL4.js";import"../../chunk-5XL2RXFU.js";import"../../chunk-3QB2ZQXK.js";import"../../chunk-7GGNFLHT.js";import"../../chunk-22I55W37.js";import"../../chunk-LUOY3A3Q.js";import"../../chunk-CVS3RPO6.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-6EDVZBUO.js";import"../../chunk-A2B6FLZP.js";import"../../chunk-YBDSG4BV.js";import"../../chunk-TOEJCZUO.js";import"../../chunk-PVBDKBJB.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-BYONFJVQ.js";import"../../chunk-QZJKWKGH.js";import"../../chunk-ERR437B5.js";import"../../chunk-JIP5JNRB.js";import"../../chunk-GR3XRILS.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-6ATIYLUL.js";import"../../chunk-KO47WAWR.js";import"../../chunk-NQW6XCAY.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-5545A3PC.js";import"../../chunk-2QXMDK67.js";import"../../chunk-GDO4QJ4G.js";import"../../chunk-IZGFJWH4.js";import"../../chunk-N7E6264U.js";import"../../chunk-N3MJOHAG.js";import"../../chunk-SBVIW3KJ.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-RUQOIQWI.js";import"../../chunk-ODHJRBJV.js";import"../../chunk-T2RINM7R.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-STQDOTHF.js";import"../../chunk-YM4UEGBV.js";import"../../chunk-SNF5764Q.js";import"../../chunk-LX23TCTP.js";import"../../chunk-XFYFKITX.js";import"../../chunk-Q3VAJMXS.js";import"../../chunk-CWELHADJ.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-5NHQ452C.js";import"../../chunk-AJ2SUSET.js";import"../../chunk-6UAEFOJ4.js";import"../../chunk-ANPOR6EY.js";import"../../chunk-R4AUZVA3.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-EVYIDHCK.js";import"../../chunk-JQQFB7EZ.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-C7IFWSUA.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-FM6JO4WF.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-K53PQAMP.js";import"../../chunk-ZKY45F5G.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-P5VYGWYO.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-QTHQPJWA.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-VBEVZZTV.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-AJSDWWJW.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-YYD257TD.js";import"../../chunk-RE4LP46F.js";import"../../chunk-HZSZT3BE.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-Y2T3JX7K.js";import"../../chunk-KFWNGPW3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-JACEEVVF.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-SQTVXE5D.js";import"../../chunk-TQ5Y6S2X.js";import"../../chunk-3XECMGXX.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-TOKMFZPB.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";import"../../chunk-EUFDQ4KL.js";import"../../chunk-KXM6YRG2.js";import"../../chunk-BSPCSC45.js";import"../../chunk-467WWV4I.js";import"../../chunk-TIAWIOGD.js";import"../../chunk-MGVI67QV.js";
|