efficient-easel 24.2.0 → 25.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -2
- package/dist/{CanvasDragLayer-NZpaX6aq.d.ts → CanvasDragLayer-DXeQGrwJ.d.ts} +42 -3
- package/dist/canvas/index.d.ts +2 -139
- package/dist/canvas/index.js +1 -1
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-6NJHYXJM.js → chunk-3XECMGXX.js} +1 -1
- package/dist/chunk-4OMAA45Q.js +5 -0
- package/dist/{chunk-G67G63O5.js → chunk-4Y3TK65H.js} +1 -1
- package/dist/chunk-53ME3GAI.js +16 -0
- package/dist/{chunk-FRAIEWRC.js → chunk-62UGN7VM.js} +1 -1
- package/dist/{chunk-HNKB2ZYR.js → chunk-6ATIYLUL.js} +1 -1
- package/dist/{chunk-Y53EKN35.js → chunk-6EDVZBUO.js} +1 -1
- package/dist/chunk-7UFKEX72.js +1 -0
- package/dist/chunk-CEC5XLN4.js +1 -0
- package/dist/chunk-CWELHADJ.js +1 -0
- package/dist/chunk-DX3VILZ3.js +6 -0
- package/dist/chunk-ERB6FAZT.js +2 -0
- package/dist/{chunk-TGZCD6IP.js → chunk-EUFDQ4KL.js} +1 -1
- package/dist/chunk-FR7EEKFF.js +1 -0
- package/dist/{chunk-75C6WFNF.js → chunk-FYV6GZXP.js} +1 -1
- package/dist/chunk-GDO4QJ4G.js +1 -0
- package/dist/chunk-GEPSJJWW.js +1 -0
- package/dist/{chunk-GMCZXMOV.js → chunk-GR3XRILS.js} +1 -1
- package/dist/chunk-H6BER2EU.js +1 -0
- package/dist/chunk-JIP5JNRB.js +1 -0
- package/dist/{chunk-AGWKB77Q.js → chunk-K53PQAMP.js} +1 -1
- package/dist/{chunk-CLOS6SSX.js → chunk-KO47WAWR.js} +1 -1
- package/dist/chunk-KTV7ORWF.js +64 -0
- package/dist/chunk-LUG22U5L.js +1 -0
- package/dist/{chunk-DDH2DYQP.js → chunk-LUOY3A3Q.js} +1 -1
- package/dist/{chunk-OITNWE52.js → chunk-M4THI4OO.js} +1 -1
- package/dist/chunk-MBEUSPIN.js +18 -0
- package/dist/chunk-MIX7EGRG.js +2 -0
- package/dist/{chunk-2FYFAAAK.js → chunk-OXOUGEAT.js} +1 -1
- package/dist/chunk-PMRN5Z3T.js +1 -0
- package/dist/{chunk-55KKGABA.js → chunk-PVBDKBJB.js} +1 -1
- package/dist/{chunk-RPMSET77.js → chunk-QTHQPJWA.js} +1 -1
- package/dist/{chunk-ISS72IKO.js → chunk-QZJKWKGH.js} +1 -1
- package/dist/{chunk-IYHO4XQX.js → chunk-S6YOIRXQ.js} +1 -1
- package/dist/{chunk-5PXVT7JY.js → chunk-SBVIW3KJ.js} +1 -1
- package/dist/chunk-SC6E3UUS.js +13 -0
- package/dist/chunk-SSDKT4AY.js +9 -0
- package/dist/chunk-TOKMFZPB.js +1 -0
- package/dist/chunk-U3LTJSBU.js +20 -0
- package/dist/{chunk-WYTPBF3Q.js → chunk-VBEVZZTV.js} +11 -11
- package/dist/chunk-VIUES5R6.js +8 -0
- package/dist/{chunk-4ESG53BH.js → chunk-YFHKE54W.js} +1 -1
- package/dist/chunk-YYD257TD.js +1 -0
- package/dist/chunk-ZLOMH2PD.js +1 -0
- package/dist/{chunk-JMAOCKB2.js → chunk-ZYOQXBJF.js} +3 -3
- package/dist/copy/index.js +13 -13
- package/dist/copy-place-CQIemdtU.d.ts +25 -0
- package/dist/data/index.d.ts +4 -1
- package/dist/data/index.js +1 -1
- package/dist/dom-BpxMcHFP.d.ts +200 -0
- package/dist/drag/index.d.ts +2 -3
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.d.ts +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.d.ts +67 -1
- package/dist/easel/index.js +1 -1
- package/dist/edit-lock/index.d.ts +0 -46
- package/dist/edit-lock/index.js +1 -1
- package/dist/fields/fields.css +6 -40
- package/dist/fields/index.d.ts +1 -6
- package/dist/fields/index.js +1 -1
- package/dist/node-ops/index.js +1 -1
- package/dist/page-copy/index.d.ts +110 -0
- package/dist/page-copy/index.js +5 -0
- package/dist/panel/index.d.ts +29 -34
- package/dist/panel/index.js +1 -1
- package/dist/panel/panel.css +0 -78
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +37 -57
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +19 -11
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +10 -11
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +5 -6
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +8 -9
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +10 -11
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +9 -10
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document/block-set-host.d.ts +55 -0
- package/dist/screen/lib/document/block-set-host.js +1 -0
- package/dist/screen/lib/document/block-types-in.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +70 -3
- package/dist/screen/lib/document/box-fields.js +1 -9
- package/dist/screen/lib/document/device-fields.js +1 -1
- package/dist/screen/lib/document/palette-sections.d.ts +33 -97
- package/dist/screen/lib/document/palette-sections.js +1 -1
- package/dist/screen/lib/document/preview-dom.js +1 -1
- package/dist/screen/lib/document/section-doc.js +1 -1
- package/dist/screen/lib/document/style-clipboard.d.ts +10 -11
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/document-switch.js +1 -1
- package/dist/screen/lib/failure.js +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/page-lock.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +251 -12
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +6 -0
- package/dist/screen/words.d.ts +9 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +4 -1
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +0 -32
- package/dist/style-clipboard/index.js +1 -1
- package/dist/text-styles/index.d.ts +7 -6
- package/dist/text-styles/index.js +37 -36
- package/dist/text-styles/text-styles.css +5 -53
- package/dist/tree/index.d.ts +2 -2
- package/dist/{types-DBy3L69b.d.ts → types-CoUTWUwB.d.ts} +1 -1
- package/dist/words-Dl8Qja4K.d.ts +32 -0
- package/package.json +15 -3
- package/dist/chunk-3FIS2FRS.js +0 -1
- package/dist/chunk-7RSE6KKY.js +0 -1
- package/dist/chunk-CMPFUJ26.js +0 -8
- package/dist/chunk-CZAAGBVL.js +0 -7
- package/dist/chunk-DSKNJXB4.js +0 -1
- package/dist/chunk-FJTCSQWK.js +0 -16
- package/dist/chunk-G7ISR6DI.js +0 -1
- package/dist/chunk-H4Z2V56N.js +0 -21
- package/dist/chunk-K7MMLCTT.js +0 -2
- package/dist/chunk-KRL3IUV3.js +0 -1
- package/dist/chunk-LF3FUSCQ.js +0 -1
- package/dist/chunk-LN43DP2A.js +0 -18
- package/dist/chunk-QORC32JO.js +0 -5
- package/dist/chunk-THWO5YVZ.js +0 -1
- package/dist/chunk-TOHOGVAE.js +0 -15
- package/dist/chunk-UKPZ2YWE.js +0 -64
- package/dist/chunk-V7U33NF2.js +0 -1
- package/dist/chunk-VKPOH6MK.js +0 -1
- package/dist/chunk-YU3WHLGI.js +0 -1
- package/dist/repeat-D65bJS8d.d.ts +0 -49
- package/dist/session-EsjORLQ0.d.ts +0 -43
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{DEFAULT_PANEL_WORDS as e}from"./chunk-KFV7N2DJ.js";import{SettingsField as l}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as n}from"./chunk-DX3VILZ3.js";import{AccordionHeading as a,SettingReset as i,Tooltip as t,Button as s,toast as d}from"efficient-shell/ui";export{AlignmentGrid,BorderInput,CornersInput,SidesEachToggle,SidesInput,borderSides,borderStartEach,sidesStartEach}from"efficient-shell/ui";import{jsx as o,jsxs as c,Fragment as r}from"react/jsx-runtime";import{BackgroundIcon as u,WidthIcon as b}from"efficient-shell/icons/efficient";function h({title:e,level:l=3,id:n,className:i}){/* @__PURE__ */
|
|
2
|
+
return o(a,{title:e,level:l,id:n,className:i?`es-panel-band ${i}`:"es-panel-band"})}function m({title:e,level:l=4,id:n,className:i}){/* @__PURE__ */
|
|
3
|
+
return o(a,{tier:"row",title:e,level:l,id:n,className:i})}function f({label:l,changed:n,onReset:a,detail:t,disabled:s,defaultAction:d,words:c,className:r}){const u={...e,...c},b=u.resetName({label:l});/* @__PURE__ */
|
|
4
|
+
return o(i,{label:l,changed:n,onReset:a,detail:t,disabled:s,defaultAction:d,name:b,tip:t?u.resetTitle({label:l,detail:t}):b,className:r})}function p({name:e,preview:l,offPage:n,status:a,onOpen:i,id:s,className:d}){const u=null!=l;/* @__PURE__ */
|
|
5
|
+
return c("button",{type:"button",id:s,className:d?`es-drill ${d}`:"es-drill",onClick:i,children:[
|
|
6
|
+
/* @__PURE__ */c(t,{content:u?/* @__PURE__ */c(r,{children:[e,
|
|
7
|
+
/* @__PURE__ */o("br",{}),l]}):e,describe:!1,className:"es-drill-text",children:[
|
|
8
|
+
/* @__PURE__ */o("span",{className:"es-drill-name",children:e}),u?/* @__PURE__ */o("span",{className:n?"es-drill-preview is-offpage":"es-drill-preview",children:l}):null]}),a?/* @__PURE__ */o("span",{className:"es-drill-status",children:a}):null,
|
|
9
|
+
/* @__PURE__ */o("span",{className:"es-drill-chev","aria-hidden":"true"})]})}function N({label:e,onPress:l,disabled:n,note:a,doneLabel:i,icon:t,id:r,className:u}){const b=null!=a,h=b&&r?`${r}-note`:void 0;/* @__PURE__ */
|
|
10
|
+
return c("div",{className:u?`es-action-wrap ${u}`:"es-action-wrap",children:[
|
|
11
|
+
/* @__PURE__ */o(s,{variant:"secondary",size:"lg",block:!0,id:r,disabled:n,"aria-describedby":h,onClick:()=>{const e=l();e&&"function"==typeof e.then?e.then(()=>{d.success(i)}):d.success(i)},leftIcon:t?/* @__PURE__ */o("span",{className:"es-action-icon","aria-hidden":"true",children:t}):void 0,children:/* @__PURE__ */o("span",{className:"es-action-label",children:e})}),b?/* @__PURE__ */o("p",{id:h,className:"es-action-note",children:a}):null]})}var v=["full","content"],g={label:"Background",full:"Full width",content:"Content width"};function w({value:e,changed:a,detail:i,onChange:t,onReset:s,disabled:d=!1,hint:c,labelId:r,words:b,resetWords:h}){const m={...g,...b};/* @__PURE__ */
|
|
12
|
+
return o(l,{label:m.label,labelId:r,icon:/* @__PURE__ */o(u,{}),changed:a,hint:c,action:/* @__PURE__ */o(f,{words:h,label:m.label,changed:a,detail:i,onReset:s}),children:/* @__PURE__ */o(n,{options:v.map(e=>({id:e,label:"full"===e?m.full:m.content})),value:e,onChange:t,ariaLabel:m.label,disabled:d})})}var C={label:"Content",full:"Full width",content:"Content width"};function I({mode:e,onMode:a,number:i,changed:t,detail:s,onReset:d,fullClosed:r=!1,disabled:u=!1,hint:h,labelId:m,words:p,resetWords:N}){const g={...C,...p},w=void 0!==e&&a?/* @__PURE__ */o(n,{options:v.map(e=>({id:e,label:"full"===e?g.full:g.content,disabled:"full"===e&&r})),value:e,onChange:a,ariaLabel:g.label,disabled:u}):null;/* @__PURE__ */
|
|
13
|
+
return o(l,{label:g.label,labelId:m,icon:/* @__PURE__ */o(b,{}),changed:t,hint:h,action:/* @__PURE__ */o(f,{words:N,label:g.label,changed:t,detail:s,onReset:d}),children:w&&i?/* @__PURE__ */c("div",{className:"es-width-stack",children:[w,i]}):w??i??null})}export{v as BACKGROUND_WIDTHS,g as DEFAULT_BACKGROUND_WIDTH_WORDS,C as DEFAULT_CONTENT_WIDTH_WORDS,N as SettingsAction,w as SettingsBackgroundWidth,I as SettingsContentWidth,f as SettingsDefaultReset,p as SettingsDrill,h as SettingsGroupHead,m as SettingsGroupSub};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{SettingsDefaultReset as e,sidesStartEach as n,SidesInput as t,SidesEachToggle as l}from"./chunk-SC6E3UUS.js";import{deviceField as a}from"./chunk-OXOUGEAT.js";import{noControlField as o,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as u}from"./chunk-CWELHADJ.js";import{phoneKey as s}from"./chunk-E52W3M5I.js";import{foldMetaOf as c,FOLD_FIELD_MARKER as d}from"./chunk-ANPOR6EY.js";import{useEasel as p,useSelectedHost as m}from"./chunk-53ME3GAI.js";import{DEFAULT_PANEL_WORDS as b}from"./chunk-KFV7N2DJ.js";import{SettingsSwitch as f}from"./chunk-OECWLNKJ.js";import{FieldSelect as h}from"./chunk-KFWNGPW3.js";import{SettingsField as g}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as v}from"./chunk-DX3VILZ3.js";import{useWords as y}from"./chunk-MFIRYGHW.js";import{useState as k}from"react";import{AlignmentIcon as C,BoxJustifyIcon as x,WrapIcon as w,GapIcon as F,WidthIcon as j,PlacementIcon as S,NudgeIcon as L,DesktopIcon as P,BoxXEndIcon as E,BoxXCenterIcon as O,BoxXStartIcon as A,PaddingAllIcon as I,BoxYBetweenIcon as W,BoxYStretchIcon as B,BoxYEndIcon as G,BoxYCenterIcon as N,BoxYStartIcon as T,BoxXBetweenIcon as R,BoxXStretchIcon as K,BoxItemAlignmentIcon as M}from"efficient-shell/icons/efficient";import{Slider as V,textAlignOptions as D,AlignmentGrid as J,PositionInput as X}from"efficient-shell/ui";import{jsx as U,Fragment as z,jsxs as Y}from"react/jsx-runtime";var _=e=>e;function H(){return null}function $(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
|
|
2
|
+
return U(H,{},e)}function Z(e){return e.type===H}function q(e){return Z(e)?void 0:e}function Q(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!c(t)&&u(t,`section:${n}`);return e}function ee(e,n){return{type:"custom",[d]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */U(z,{})}}function ne(e){return ee(e,2)}function te(e){return ee(e,1)}var le=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],ae=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],oe="Wrap",ie=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],re="Direction",ue=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],se={min:-32,max:64,step:2,builtIn:0},ce={min:30,max:100,step:5,fallback:60},de=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],pe="bottom-left",me={"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"},be=de.map(e=>({value:e,label:me[e]}));function fe(e,n=pe){return de.includes(e)?e:n}var he=40,ge=e=>"number"==typeof e?e:null;function ve(e,n,t){const l={};for(const a of["x","y"])t[a]!==n[a]&&(l[e[a]]=t[a]??void 0);return l}var ye=["top","right","bottom","left"],ke={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},Ce=e=>"number"==typeof e?e:null;function xe(e,n,t){const l={};for(const a of ye)t[a]!==n[a]&&(l[e[a]]=t[a]??void 0);return l}var we=["left","center","right"];function Fe(e,{options:n,value:t,onChange:l,ariaLabel:a,disabled:o=!1}){/* @__PURE__ */
|
|
3
|
+
return U(v,{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(a),disabled:o})}function je(e,{label:n,value:t,onChange:l,points:a}){const o=a.find(e=>e.disabled),i=a.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
|
|
4
|
+
return U(g,{label:e(n),icon:/* @__PURE__ */U(S,{}),hint:o?.title?e(o.title):void 0,children:/* @__PURE__ */U(J,{label:e(n),value:t,points:i,onChange:l})})}function Se({say:e,label:n,value:t,onChange:l,pointsFor:a}){const{appState:o,selectedItem:i}=p(e=>e),r=i?.props?.id?String(i.props.id):void 0;return je(e,{label:n,value:t,onChange:l,points:a(o?.data,r)})}function Le({say:n,o:t}){const l=m(),a=y("panel",b),o=l?.values??{},i={x:ge(o[t.keys.x]),y:ge(o[t.keys.y])},r=n(t.label??"Position"),u=Boolean(i.x||i.y),s=e=>{const n=ve(t.keys,i,e);Object.keys(n).length&&l?.onChangeMany(n)},c=/* @__PURE__ */U(X,{label:r,value:i,onChange:s,words:{x:n("Left and right"),y:n("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:t.min,max:t.max,step:t.step??1}),d=/* @__PURE__ */U(e,{words:a,label:r,changed:u,detail:"0 px, 0 px",onReset:()=>s({x:null,y:null})});return null===t.label?/* @__PURE__ */Y("div",{className:"sf-position-line",children:[c,d]}):/* @__PURE__ */U(g,{label:r,icon:/* @__PURE__ */U(L,{}),changed:u,action:d,children:c})}var Pe={x:{start:/* @__PURE__ */U(A,{}),center:/* @__PURE__ */U(O,{}),end:/* @__PURE__ */U(E,{}),stretch:/* @__PURE__ */U(K,{}),between:/* @__PURE__ */U(R,{})},y:{start:/* @__PURE__ */U(T,{}),center:/* @__PURE__ */U(N,{}),end:/* @__PURE__ */U(G,{}),stretch:/* @__PURE__ */U(B,{}),between:/* @__PURE__ */U(W,{})}},Ee=e=>"row"===e?"row":"column";function Oe({say:e,kind:n,label:t,options:l,value:a,onChange:o,o:i}){const r=m(),u="justify"===n==("row"===(i.runs??Ee)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return Fe(e,{options:l.map(e=>({label:e.label,value:e.value,picture:Pe[u][e.value]})),value:a,onChange:o,ariaLabel:t})}function Ae({say:e,tier:a,o:o}){const i=m(),r=i?.values??{},u="mobile"===a?o.phoneKeys:o.keys,s=Object.fromEntries(ye.map(e=>[e,Ce(r[u[e]])])),c=Object.fromEntries(ye.map(e=>[e,String("mobile"===a?Ce(r[o.keys[e]])??o.fallback[e]:o.fallback[e])])),[d,p]=k(()=>n(s,c));/* @__PURE__ */
|
|
5
|
+
return U(g,{label:e("Padding"),icon:/* @__PURE__ */U(I,{}),action:/* @__PURE__ */U(l,{each:d,label:e("Each side"),onChange:p}),children:/* @__PURE__ */U(t,{label:e("Padding"),each:d,value:s,placeholder:c,min:o.min,max:o.max,step:o.step,onChange:e=>{const n=xe(u,s,e);Object.keys(n).length&&i?.onChangeMany(n)},words:{sides:{top:e("Padding top"),right:e("Padding right"),bottom:e("Padding bottom"),left:e("Padding left")},vertical:e("Top and bottom"),horizontal:e("Left and right"),unit:"px"}})})}function Ie(e=_){function n(n,t,l,a,o,i,u="",s){return{type:"custom",...r({},{type:"number",label:n}),render:r=>{const c="number"==typeof r.value?r.value:i;/* @__PURE__ */
|
|
6
|
+
return U(g,{label:e(n),icon:q(t),action:s?s("storedValue"in r?r.storedValue:r.value,r.onChange):void 0,children:/* @__PURE__ */U("div",{className:"sf-slider",children:/* @__PURE__ */U(V,{min:l,max:a,step:o,value:c,suffix:u||void 0,showInput:!0,label:e(n),disabled:!1,size:"sm",boxSize:"md",className:"sf-slider-track",onChange:e=>{null!==e&&e!==c&&r.onChange(e)}})})})}}}function t(n){return Fe(e,n)}function l(n,l,a,o){const i=a.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...r({},{type:"radio",label:n,options:i.map(e=>({value:e.value,label:e.label}))}),render:({value:a,onChange:r,field:u})=>/* @__PURE__ */U(g,{label:e(n),icon:q(l),children:t({options:i,value:i.some(e=>e.value===a)?a:a||u?.currentValue||o,onChange:r,ariaLabel:n})})}}function u(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */U(P,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function c(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function d(e,n,t){return{[e]:a("desktop",n(t)),[s(e)]:a("mobile",n({...t,phone:!0},""))}}function p(e){return u(D(e.allow??we).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function m(e={},n=e.fallback??"left"){return c(l(e.label??"Text alignment",/* @__PURE__ */U(C,{}),p(e),n),e)}function b(e){const n={left:Pe.x.start,center:Pe.x.center,right:Pe.x.end};return u(D((e.allow??we).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function v(e={},n=e.fallback??"left"){return c(l(e.label??"Block alignment",/* @__PURE__ */U(x,{}),b(e),n),e)}function y(n,t,l,a,o,i){return{type:"custom",options:a,fallback:o,...r({},{type:"radio",label:t,options:a.map(e=>({value:e.value,label:e.label}))}),render:({value:r,onChange:u,field:s})=>{const c=s.options??a,d=s.fallback??o,p=c.some(e=>e.value===r)?r:d;/* @__PURE__ */
|
|
7
|
+
return U(g,{label:e(t),icon:q(l),children:/* @__PURE__ */U(Oe,{say:e,kind:n,label:t,options:c,value:p,onChange:u,o:i})})}}}function k(e={}){return y("justify","Justify",/* @__PURE__ */U(x,{}),le,le[0].value,e)}function S(e={}){return y("align","Item alignment",/* @__PURE__ */U(M,{}),ae,"stretch",e)}function L(){const n=oe;return{type:"custom",options:ie,fallback:ie[1].value,...r({},{type:"radio",label:n,options:ie.map(e=>({value:e.value,label:e.label}))}),render:({value:t,onChange:l,id:a,name:o})=>{const i=`${a??o??n}-label`;/* @__PURE__ */
|
|
8
|
+
return U(g,{label:e(n),labelId:i,icon:/* @__PURE__ */U(w,{}),action:/* @__PURE__ */U(f,{checked:(r=t,!0===r||"wrap"===r),onChange:e=>l(e?ie[0].value:ie[1].value),ariaLabelledBy:i})});var r}}}function E({offered:e,fallback:n,resolve:t}){const a=t??(t=>e.some(e=>e.value===t)?t:n),o=l(re,$("`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})),a(void 0));return{type:"custom",render:e=>o.render({...e,value:a(e.value),onChange:n=>e.onChange(n)})}}function O({min:e,max:t,step:l,builtIn:a,resolve:o,action:i,mark:r}){const u=n("Gap",/* @__PURE__ */U(F,{}),e,t,l,a,"px",i),s=o??(e=>"number"==typeof e?e:a);return{...r,type:"custom",render:e=>u.render({...e,value:s(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function A(n,{fallback:t=pe,pointsFor:l}={}){return{type:"custom",render:({value:a,onChange:o})=>{const i=fe(a,t);return l?/* @__PURE__ */U(Se,{say:e,label:n,value:i,onChange:o,pointsFor:l}):je(e,{label:n,value:i,onChange:o,points:be})}}}function I(n){return{[n.keys.x]:{type:"custom",render:()=>/* @__PURE__ */U(Le,{say:e,o:n})},[n.keys.y]:{...o({type:"custom",render:()=>/* @__PURE__ */U(i,{})},"always"),reachedBy:n.keys.x}}}function W(n={}){const t={...ke,...n.keys},l={keys:t,phoneKeys:Object.fromEntries(ye.map(e=>[e,s(t[e])])),fallback:{top:0,right:0,bottom:0,left:0,...n.fallback},min:n.min??0,max:n.max??200,step:n.step??4},r=!1!==n.phone,u=n=>{const t={type:"custom",render:()=>/* @__PURE__ */U(Ae,{say:e,tier:n,o:l})};return r?a(n,t):t},c=()=>o({type:"custom",render:()=>/* @__PURE__ */U(i,{})},"always"),d=ye.filter(e=>"top"!==e);return Q({...!1===n.group?{}:{_gSpacing:ne("Padding")},[l.keys.top]:u("desktop"),...r?{[l.phoneKeys.top]:u("mobile")}:{},...Object.fromEntries(d.map(e=>[l.keys[e],{...c(),reachedBy:l.keys.top}])),...r?Object.fromEntries(d.map(e=>[l.phoneKeys[e],a("mobile",c())])):{}})}return{slider:n,select:function(n,t,l,a,o){return{type:"custom",options:l,fallback:a,...o?{note:o}:{},...r({},{type:"select",label:n}),render:({value:i,onChange:r,field:u})=>{const s=u.options??l,c=u.fallback??a,d=s.some(e=>e.value===i)?i:c;/* @__PURE__ */
|
|
9
|
+
return U(g,{label:e(n),icon:q(t),children:/* @__PURE__ */U(h,{value:d,ariaLabel:e(n),onChange:r,options:[...o?[{label:e(o),value:"\0note",disabled:!0}]:[],...s.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:l,boxJustifyField:k,boxAlignField:S,boxWrapField:L,directionField:E,gapField:O,placementField:A,PlacementGridView:function(n){return je(e,n)},positionFields:I,sidesPaddingFields:W,alignmentField:m,alignmentFields:function(e="align",n={}){return d(e,m,n)},AlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:a,disabled:o=!1}){return t({options:p(e),value:n,onChange:l,ariaLabel:a,disabled:o})},blockAlignmentField:v,blockAlignmentFields:function(e="align",n={}){return d(e,v,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:a,disabled:o=!1}){return t({options:b(e),value:n,onChange:l,ariaLabel:a,disabled:o})},boxFieldSet:function(e={}){const t=e.width??ce,l=e.nudge?.limit??40,a=e.direction??{offered:ue,fallback:"column"},o=a.resolve??(e=>a.offered.some(n=>n.value===e)?e:a.fallback),i={runs:e=>"row"===o(e)?"row":"column"};return{_gLayout:ne("Layout"),placement:A("Placement",e.placement),width:n("Width",/* @__PURE__ */U(j,{}),t.min,t.max,t.step,t.fallback,"%"),direction:E(a),gap:O(e.gap??se),justify:k(i),align:S(i),wrap:L(),_gNudge:ne("Nudge"),...I({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-l,max:l,label:null}),...W(e.padding)}}}}var{slider:We,select:Be,Segmented:Ge,segmented:Ne,boxJustifyField:Te,boxAlignField:Re,boxWrapField:Ke,directionField:Me,gapField:Ve,placementField:De,PlacementGridView:Je,positionFields:Xe,sidesPaddingFields:Ue,alignmentField:ze,alignmentFields:Ye,AlignmentStrip:_e,blockAlignmentField:He,blockAlignmentFields:$e,BlockAlignmentStrip:Ze,boxFieldSet:qe}=Ie();export{me as ANCHOR_LABELS,_e as AlignmentStrip,ae as BOX_ALIGN_POINTS,ue as BOX_DIRECTIONS,re as BOX_DIRECTION_LABEL,se as BOX_GAP,le as BOX_JUSTIFY_POINTS,he as BOX_NUDGE_LIMIT,de as BOX_PLACEMENTS,pe as BOX_PLACEMENT_DEFAULT,ce as BOX_WIDTH,oe as BOX_WRAP_LABEL,ie as BOX_WRAP_POINTS,Ze as BlockAlignmentStrip,be as OPEN_PLACEMENT_POINTS,Je as PlacementGridView,ke as SIDE_PAD_KEYS,Ge as Segmented,ze as alignmentField,Ye as alignmentFields,He as blockAlignmentField,$e as blockAlignmentFields,Re as boxAlignField,Ie as boxFieldBuilders,qe as boxFieldSet,Te as boxJustifyField,Ke as boxWrapField,Me as directionField,Ve as gapField,ne as group,q as iconOf,Z as isNoGlyph,$ as noGlyph,fe as normaliseBoxPlacement,De as placementField,Xe as positionFields,ve as positionPatch,te as section,Ne as segmented,Be as select,Q as sharedStyleKinds,Ue as sidesPaddingFields,xe as sidesPaddingPatch,We as slider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{removeCanvasStyle as e,upsertCanvasStyle as n}from"./chunk-FR7EEKFF.js";import{useState as t,useEffect as o,useRef as r}from"react";var c="[data-easel-block]",s="[data-easel-dropzone]",u="iframe#preview-frame";function i(e){const n=e.contentDocument;if(!n||!e.contentWindow||"loading"===n.readyState||!n.body)return!1;if(e.hasAttribute("srcdoc"))return"about:srcdoc"===n.URL;const t=e.getAttribute("src");return!t||"about:blank"===t||"about:blank"!==n.URL}function l(e,n,{selector:t=u,readySelector:o}={}){let r=null,c=null,s=!1,l=!1,a=null;const d=()=>{a?.observer.disconnect(),a=null},m=()=>{if(l)return;let e=null;if(r&&i(r)){const n=r.contentDocument;(e=>{if(!o||e.querySelector(o))return d(),!0;if(a?.doc!==e){d();const n=e.defaultView?.MutationObserver;if(n){const t=new n(()=>m());t.observe(e,{childList:!0,subtree:!0}),a={doc:e,observer:t}}}return!1})(n)&&(e={frame:r,document:n,window:r.contentWindow})}else d();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&s||(s=!0,c=e,n(c))},f=()=>m(),v=()=>{const n=e.querySelector?.(t);n!==r?(r?.removeEventListener("load",f),r=n,r?.addEventListener("load",f),m()):m()},b=e.ownerDocument?.defaultView??e.defaultView,w=b?.MutationObserver,E=w?new w(e=>(e=>null!==r&&!r.isConnected||e.some(e=>[...e.addedNodes,...e.removedNodes].some(e=>"IFRAME"===e.nodeName||!!e.querySelector?.("iframe"))))(e)&&v()):null;return E?.observe(e,{childList:!0,subtree:!0}),v(),()=>{l=!0,E?.disconnect(),d(),r?.removeEventListener("load",f),r=null}}function a(e,{selector:n,readySelector:r}={}){const[c,s]=t(null);return o(()=>{const t=e.current;if(!t)return;const o=l(t,s,{selector:n,readySelector:r});return()=>{o(),s(null)}},[e,n,r]),c}var d="easel:canvas-typing",m="easel:canvas-typable";function f(e,n,t,{on:c="document",capture:s=!1}={}){const u=r(t);u.current=t;const i=e?.document??null,l=e?.window??null;o(()=>{const e="window"===c?l:i;if(!e)return;const t=e=>u.current(e);return e.addEventListener(n,t,s),()=>e.removeEventListener(n,t,s)},[i,l,n,c,s])}function v(e){const[n,o]=t(!1);return f(e,d,e=>o(Boolean(e.detail?.typing))),n}function b(t,r,c){const s=t?.document??null;o(()=>{if(!s)return;if(!c)return void e(s,r);const t=n(s,r,c),o=s.defaultView?.MutationObserver,u=o?new o(()=>{t.isConnected||n(s,r,c)}):null;return u?.observe(s.head??s.documentElement,{childList:!0}),()=>{u?.disconnect(),e(s,r)}},[s,r,c])}function w(e,{settle:n=[150,450]}={}){const[r,c]=t(0),s=e?.frame??null,u=e?.document??null,i=e?.window??null,l=n.join(",");return o(()=>{if(!s||!u||!i)return;const e=s.ownerDocument.defaultView;let t=!1,o=0;const r=()=>{if(t)return;t=!0;const n=()=>{t=!1,c(e=>e+1)};e?.requestAnimationFrame?o=e.requestAnimationFrame(n):n()},l=[],a=(e,n)=>{e.addEventListener(n,r,!0),l.push(()=>e.removeEventListener(n,r,!0))};a(u,"scroll"),a(i,"resize"),e&&(a(e,"scroll"),a(e,"resize"));const d=e?.ResizeObserver;if(d){const e=new d(r);e.observe(s),u.documentElement&&e.observe(u.documentElement),l.push(()=>e.disconnect())}const m=u.defaultView?.MutationObserver,f=u.body??u.documentElement;if(m&&f){const e=new m(r);e.observe(u===s.ownerDocument?s:f,{childList:!0,subtree:!0}),l.push(()=>e.disconnect())}const v=u.fonts;v&&a(v,"loadingdone");const b=n.map(e=>setTimeout(r,e));return r(),()=>{for(const e of l)e();for(const e of b)clearTimeout(e);o&&e?.cancelAnimationFrame&&e.cancelAnimationFrame(o)}},[s,u,i,l]),r}export{c as BLOCK_SELECTOR,u as CANVAS_SELECTOR,m as CANVAS_TYPABLE_EVENT,d as CANVAS_TYPING_EVENT,s as LIST_SELECTOR,i as isFrameReady,f as useCanvasEvent,a as useCanvasFrame,w as useCanvasLayout,b as useCanvasStyle,v as useCanvasTyping,l as watchCanvasFrame};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{noControlMetaOf as t,deviceMetaOf as l}from"./chunk-YCSZAP7T.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{SETTINGS_BUCKETS as o,SettingsGroup as a}from"./chunk-FM6JO4WF.js";import{DEFAULT_TREE_WORDS as i}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-KFV7N2DJ.js";import{easelMenuEntries as c}from"./chunk-FIVU2COQ.js";import{FieldNumber as d}from"./chunk-Y2T3JX7K.js";import{FieldSelect as u}from"./chunk-KFWNGPW3.js";import{SettingsField as m}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as h}from"./chunk-DX3VILZ3.js";import{DEFAULT_FIELDS_WORDS as p}from"./chunk-JACEEVVF.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{useTreeDrag as b,gapToMoveIndex as g}from"./chunk-3XECMGXX.js";import{withTip as v}from"./chunk-P2VEMZH5.js";import{clone as y}from"./chunk-EUFDQ4KL.js";import{Textarea as k,Input as x,ItemCount as w,SortableList as C,ListRow as O,IconButton as N,ContextMenu as j,tabPanelId as $,Tabs as I,tabButtonId as D}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as S,useState as F,useLayoutEffect as P,useId as L}from"react";import{jsx as E,jsxs as M,Fragment as T}from"react/jsx-runtime";import{LockIcon as W,CloseIcon as z,MoveUpIcon as R,MoveDownIcon as A,DuplicateIcon as K,TrashIcon as V}from"efficient-shell/icons/efficient";function X({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:o=3,readOnly:a=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */E(k,{id:e,size:"sm",className:"es-fin",value:c,rows:o,placeholder:l,readOnly:a,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */E(x,{id:e,size:"md",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:a,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function H(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function Y(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function B(e,n){return e.filter((e,t)=>t!==n)}var G='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',Z={parentId:"list",slot:"items"};function J({label:e,icon:n,noun:t,items:l,onChange:o,newItem:a,summary:s,itemName:d,thumb:u,min:m=0,max:h,readOnly:k=!1,open:x,onOpen:$,renderItem:I,renderRow:D,canRemove:L,lockedReason:X,fixed:J=!1,removeOnRow:Q=!0,canDuplicate:U,above:q,head:_=!0}){const ee=f("fields",p).list,ne=f("tree",i),te=t??ee.item,le=!k&&!J&&("number"!=typeof h||l.length<h),re=l.length<=m,oe=e=>!!L&&!L(l[e],e),ae=e=>!k&&!J&&Q&&!re&&!oe(e),ie=e=>le&&(!U||U(l[e],e)),se=(e,n)=>d?d(e,n):ee.itemName({noun:te,n:n+1}),ce=S([]),de=S(null),[ue,me]=F(null),he=S(null),[pe,fe]=F(null),[be,ge]=F("");P(()=>{const e=de.current;if(!e)return;de.current=null;const n=ce.current[e.index]?.querySelectorAll(G)[e.nth]??ce.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const ve=(e,n)=>{if(n<0||n>=l.length||n===e)return;const t=ce.current[e],r=t?.ownerDocument.activeElement;if(t&&r&&t.contains(r)){const e=[...t.querySelectorAll(G)].indexOf(r),l=r;de.current={index:n,nth:e,start:"number"==typeof l.selectionStart?l.selectionStart:null,end:"number"==typeof l.selectionEnd?l.selectionEnd:null}}o(Y(l,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(x,e,n);a!==x&&$(a),ge(ee.moved({n:n+1,total:l.length}))},ye=e=>{le&&(o(H(l,e,a())),D?(de.current={index:e,nth:0,start:null,end:null},null!==x&&x>=e&&$(x+1)):$(e))},ke=e=>{ae(e)&&(o(B(l,e)),x===e?$(null):null!==x&&x>e&&$(x-1))},xe=b({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===Z.parentId&&n.slot===Z.slot,onDrop:(e,n)=>{const t=g({...Z,index:e},n);t!==e&&ve(e,t)},onStep:(e,n)=>ve(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:k}),we=e=>{const n=[];return e>0&&n.push({label:ee.moveUp,icon:/* @__PURE__ */E(R,{size:14}),shortcut:"⌥↑",onClick:()=>ve(e,e-1)}),e<l.length-1&&n.push({label:ee.moveDown,icon:/* @__PURE__ */E(A,{size:14}),shortcut:"⌥↓",onClick:()=>ve(e,e+1)}),ie(e)&&n.push({label:ee.duplicate,icon:/* @__PURE__ */E(K,{size:14}),onClick:()=>(e=>{ie(e)&&(o(H(l,e+1,y(l[e]))),null!==x&&x>e&&$(x+1))})(e)}),ae(e)&&n.push({label:ee.delete,icon:/* @__PURE__ */E(V,{size:14}),danger:!0,onClick:()=>ke(e)}),n},Ce=(e,n,t,l)=>{k||0===we(e).length||fe({index:e,x:n,y:t,owner:l})},Oe=e=>n=>{const t=l.slice();t[e]=n,o(t)};/* @__PURE__ */
|
|
2
|
+
return M("div",{className:"es-list",children:[_?/* @__PURE__ */M("div",{className:"es-list-head",children:[
|
|
3
|
+
/* @__PURE__ */M("span",{className:"es-list-label",children:[n?/* @__PURE__ */E("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
|
|
4
|
+
/* @__PURE__ */E(w,{count:l.length,label:ee.count({noun:te,n:l.length}),showZero:!0})]}):null,q?/* @__PURE__ */E("div",{className:"es-list-above",children:q}):null,l.length?/* @__PURE__ */M(C,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:xe.rootProps(),children:[l.map((e,n)=>{const t=xe.row({item:n,place:{...Z,index:n}}),l=t.draggable&&ue!==n,o=!D&&x===n,a=!k&&!J&&Q&&oe(n),i=["es-list-row",D?"is-inline":"is-item",o?"is-open":"",l?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */E(r,{...xe.seam({place:{...Z,index:n}}),onAdd:le?()=>ye(n):void 0,label:ee.addHere({noun:te})},`seam-${n}`):null,
|
|
5
|
+
/* @__PURE__ */E(O,{className:i,flat:!!D,active:o,title:D?void 0:/* @__PURE__ */M(T,{children:[
|
|
6
|
+
/* @__PURE__ */E("span",{className:"es-list-row-name",children:se(e,n)}),s?/* @__PURE__ */E("span",{className:"es-list-row-summary",children:s(e,n)}):null]}),thumb:!D&&u?u(e,n):void 0,expanded:D?void 0:o,onToggle:D?void 0:()=>$(o?null:n),draggable:t.draggable,dragHint:ne.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>ve(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ce.current[n]=e},rowProps:{...t.rowProps,draggable:l||void 0,onPointerDown:e=>{const l=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!r,he.current=l&&!r?l:null,me(r?n:null)},onDragStart:e=>{const n=he.current;he.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{k||(e.preventDefault(),e.stopPropagation(),Ce(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void Ce(n,r.left+24,r.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:k||J||!Q?void 0:a?v(X?X(e,n):ee.locked,/* @__PURE__ */E("span",{className:"es-list-lock",role:"img","aria-label":X?X(e,n):ee.locked,children:/* @__PURE__ */E(W,{size:13})})):v(ee.deleteItem({noun:te}),/* @__PURE__ */E(N,{size:"sm",className:"es-list-x","aria-label":ee.deleteItem({noun:te}),disabled:!ae(n),onClick:()=>ke(n),children:/* @__PURE__ */E(z,{size:14,"aria-hidden":"true"})})),below:o?/* @__PURE__ */E("div",{className:"es-list-item",children:I(e,n,Oe(n))}):void 0,children:D?/* @__PURE__ */E("div",{className:"es-list-row-main",children:D(e,n,Oe(n))}):null},n)]}),
|
|
7
|
+
/* @__PURE__ */E(r,{...xe.seam({place:{...Z,index:l.length}})})]}):null,k||J?null:/* @__PURE__ */E("button",{type:"button",className:"es-list-add",disabled:!le,onClick:()=>ye(l.length),children:ee.add({noun:te})}),
|
|
8
|
+
/* @__PURE__ */E("span",{className:"es-list-said","aria-live":"polite",children:be}),pe&&pe.index<l.length?
|
|
9
|
+
/* @__PURE__ */E(j,{at:{x:pe.x,y:pe.y},owner:pe.owner,onClose:()=>fe(null),items:c(we(pe.index))}):null]})}var Q=e=>e<6?e+1:6,U=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function q({field:e,name:t,id:l,value:r,onChange:o,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=F(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
|
|
10
|
+
return E(a,{id:`${l}-group`,title:U(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */E(ee,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>o({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:Q(u)},e))})}function _({field:e,name:t,id:l,value:r,onChange:o,readOnly:a,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=F(null),f=u?d??null:h,b=u??p,g=Array.isArray(r)?r:[],v=e.getItemSummary;/* @__PURE__ */
|
|
11
|
+
return E(J,{label:U(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:o,newItem:()=>y({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:a,open:f,onOpen:b,renderItem:(r,o,d)=>Object.entries(n(e.arrayFields,{values:r,context:s})).map(([e,n])=>/* @__PURE__ */E(ee,{field:n,name:`${t}[${o}].${e}`,id:`${l}-${o}-${e}`,value:r?.[e],onChange:n=>d({...r,[e]:n}),readOnly:a,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function ee(e){const{field:n,name:t,id:l,value:r,onChange:o,readOnly:a,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({field:n,name:t,id:l,value:r,onChange:o,readOnly:a});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:r,onChange:o,readOnly:a};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
12
|
+
return E(m,{label:U(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(X,{id:l,value:"string"==typeof r?r:null==r?"":String(r),onChange:o,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:a})});case"number":/* @__PURE__ */
|
|
13
|
+
return E(m,{label:U(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(d,{id:l,value:"number"==typeof r?r:void 0,onChange:o,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:a})});case"select":{const e=`${l}-label`;/* @__PURE__ */
|
|
14
|
+
return E(m,{label:U(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(u,{id:l,value:r,options:n.options,onChange:o,readOnly:a,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
15
|
+
return E(m,{label:U(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(h,{ariaLabel:U(n,t),value:r,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||a})),onChange:e=>{a||o(e)}})});case"object":/* @__PURE__ */
|
|
16
|
+
return E(q,{...e,field:n});case"array":/* @__PURE__ */
|
|
17
|
+
return E(_,{...e,field:n});case"slot":return null}}function ne(e,n){if("mobile"!==n)return!0;const r=e;if(!r||r.marker||"slot"===r.type||"always"===t(e))return!0;const o=l(e)?.tier;return"mobile"===o||"each"===o}var te={},le=e=>o.includes(e);function re(n,t){let l,r=o[0];const a=[],i=/* @__PURE__ */new Set;for(const[o,s]of Object.entries(n))s&&(le(s.bucket)&&((s.marker||s.bucket!==r)&&(l=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?l={key:o,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||t&&!ne(s,t.context?.device)||(a.push(l?{name:o,field:s,bucket:r,fold:l}:{name:o,field:s,bucket:r}),"slot"!==s.type&&i.add(r)));return{rows:a,buckets:o.filter(e=>i.has(e))}}function oe(e){return new Map(re(e).rows.map(e=>[e.name,e.bucket]))}function ae(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function ie({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,showWhenContext:o,tab:i,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:h,ariaLabel:p,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const w=f("panel",s),C=L(),O=h??`es-insp${C.replace(/:/g,"")}`,N=re(e,{values:n,context:o}),[j,S]=F(void 0),P=i??j,T=P&&N.buckets.includes(P)?P:N.buckets[0],[W,z]=F(null),R=W&&W.panel===O&&N.rows.some(e=>e.name===W.name)?W:null,A=d&&N.buckets.length>1,K=A&&T?$(O,T):`${O}-rows`,[V,X]=F(()=>/* @__PURE__ */new Set),H=y??V,Y=(e,n)=>{/* @__PURE__ */return E(a,{title:e.title,open:!H.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&X(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${O}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},B=e=>A&&e!==T,G=({name:e,field:a,bucket:i,fold:s})=>/* @__PURE__ */E("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!B(i)||void 0,children:/* @__PURE__ */E(ee,{field:a,name:e,id:`${O}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,showWhenContext:o,renderers:m,openItem:R&&R.name===e?R.index:null,onOpenItem:n=>z(null===n?null:{panel:O,name:e,index:n}),headingLevel:s?Q(x):x})},e);/* @__PURE__ */
|
|
18
|
+
return M("div",{className:"es-insp",children:[A?/* @__PURE__ */E("div",{className:"es-insp-tabs",children:/* @__PURE__ */E(I,{variant:"underline",block:!0,"aria-label":p??w.settings,idPrefix:O,value:T,onChange:e=>{const n=e;void 0===i&&S(n),c?.(n)},items:N.buckets.map(e=>{const n=w.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */E("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
19
|
+
/* @__PURE__ */M("div",{className:"es-insp-rows",id:K,role:A?"tabpanel":void 0,"aria-labelledby":A&&T?D(O,T):void 0,children:[b&&ne(te,o?.device)?v?/* @__PURE__ */E("div",{className:"es-insp-band","data-fold":v.key,children:Y(v,b)}):b:null,ae(N.rows).map((e,n)=>{if(!e.fold)return e.rows.map(G);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
20
|
+
return E("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!B(t)&&!l)||void 0,children:Y(e.fold,e.rows.map(G))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{X as FieldText,ie as Inspector,ee as InspectorField,J as ListField,oe as bucketsOf,ne as fieldShownInView,H as insertAt,U as labelOf,Y as moveTo,re as planFields,B as removeAt};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-
|
|
2
|
-
return c("div",{className:"es-topbar",children:e})}function
|
|
3
|
-
return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function
|
|
1
|
+
import{EaselRail as e}from"./chunk-MJM6SFD3.js";import{DEFAULT_NOTICE_WORDS as n,DEFAULT_CHROME_WORDS as i}from"./chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{holderOf as t,describeAge as s,nameOrSomeone as l}from"./chunk-YYD257TD.js";import{DEFAULT_LOCK_WORDS as r}from"./chunk-RE4LP46F.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d}from"react/jsx-runtime";import{Tooltip as h,IconButton as u,Segmented as m,Switch as p,SpinnerRing as v,ResizeHandle as f,Button as k,Text as b,Banner as g}from"efficient-shell/ui";import{useState as y,useEffect as N}from"react";import{LockIcon as w,CloudPauseIcon as O,CloudSlashIcon as x,CloudAlertIcon as z,CloudArrowUpIcon as B,CloudCheckIcon as C}from"efficient-shell/icons/efficient";function R({children:e}){/* @__PURE__ */
|
|
2
|
+
return c("div",{className:"es-topbar",children:e})}function S({kind:e,style:n,children:i}){/* @__PURE__ */
|
|
3
|
+
return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function W(){/* @__PURE__ */
|
|
4
4
|
return c("div",{className:"es-divider-v","aria-hidden":"true"})}function $({items:n,ariaLabel:i,onWords:t}){const s=o("rail",a);/* @__PURE__ */
|
|
5
5
|
return c("div",{className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */c(e,{items:n,ariaLabel:i??s.label,orientation:"row",onLabelsShown:t})})}function j({label:e,tip:n,onClick:i,disabled:a,state:t,buttonRef:s,children:l}){/* @__PURE__ */
|
|
6
6
|
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(u,{ref:s,"aria-label":e,"aria-pressed":t?"active"===t:void 0,className:"es-iconbtn",disabled:a,onClick:i,children:l})})}function L({devices:e,value:n,onChange:a,ariaLabel:t}){const s=o("chrome",i);/* @__PURE__ */
|
|
7
|
-
return c(m,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var M={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function
|
|
8
|
-
return d("span",{className:`es-savestate ${M[e]}`,role:s,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:t,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function
|
|
9
|
-
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(p,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var
|
|
7
|
+
return c(m,{className:"es-devseg",size:"sm",label:t??s.device,value:n,onChange:e=>{e!==n&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var M={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function Y({tone:e,label:n,counting:i,waitMs:a,ringRef:t,role:s}){/* @__PURE__ */
|
|
8
|
+
return d("span",{className:`es-savestate ${M[e]}`,role:s,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:t,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function D({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
|
|
9
|
+
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(p,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}var T={saved:{glyph:()=>/* @__PURE__ */c(C,{}),tone:"muted"},saving:{glyph:()=>/* @__PURE__ */c(v,{className:"",ink:"",style:{width:20,height:20}}),tone:"muted"},pending:{glyph:()=>/* @__PURE__ */c(B,{}),tone:"muted"},failed:{glyph:()=>/* @__PURE__ */c(z,{}),tone:"danger"},offline:{glyph:()=>/* @__PURE__ */c(x,{}),tone:"warning"},paused:{glyph:()=>/* @__PURE__ */c(O,{}),tone:"warning"},locked:{glyph:()=>/* @__PURE__ */c(w,{}),tone:"warning"}},J=e=>T[e].tone;function P({state:e,label:n}){const i=T[e],[a,t]=y(n);return N(()=>t(n),[e]),/* @__PURE__ */d("span",{className:"es-saveicon-wrap",children:[
|
|
10
10
|
/* @__PURE__ */c(h,{content:n,side:"bottom",describe:!1,children:/* @__PURE__ */c("span",{className:"es-saveicon",role:"img","aria-label":n,tabIndex:0,"data-save-state":e,"data-tone":i.tone,children:i.glyph()})}),
|
|
11
|
-
/* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function
|
|
11
|
+
/* @__PURE__ */c("span",{className:"es-vh",role:"status","aria-live":"polite",children:a})]})}function A({side:e,width:n,min:a,max:t,defaultWidth:s,label:l,onResize:r}){const d=o("chrome",i);/* @__PURE__ */
|
|
12
12
|
return c(f,{side:e,width:n,min:a,max:t,defaultWidth:s,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function F({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
|
|
13
13
|
return d("div",{className:"es-insp-head",children:[
|
|
14
14
|
/* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
|
|
15
15
|
/* @__PURE__ */d("div",{className:"es-insp-titles",children:[
|
|
16
16
|
/* @__PURE__ */c(h,{content:n,describe:!1,side:"bottom",className:"es-insp-name-tip",children:/* @__PURE__ */c("h2",{className:"es-insp-name",children:n})}),
|
|
17
|
-
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function
|
|
18
|
-
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(u,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function
|
|
19
|
-
/* @__PURE__ */c(b,{as:"h3",size:"sm",weight:"medium",tone:"inherit",className:"es-insp-level-title",children:s})]}):t?u:/* @__PURE__ */c("div",{className:"es-insp-up",children:u})}function
|
|
20
|
-
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(g,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var
|
|
17
|
+
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function I({label:e,title:n,hasPopup:i,onClick:a,disabled:t,danger:s,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
|
|
18
|
+
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(u,{ref:r,variant:s?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:t,onClick:a,children:o})})}function q({name:e,onSelect:n,label:a,inline:t,title:s}){const l=o("chrome",i),r=a??l.upLevel,u=/* @__PURE__ */c(h,{content:r,side:"bottom",children:/* @__PURE__ */c(k,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":l.upLevelTo({label:r,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:n,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return s?/* @__PURE__ */d("div",{className:t?"es-insp-level":"es-insp-up es-insp-level",children:[u,
|
|
19
|
+
/* @__PURE__ */c(b,{as:"h3",size:"sm",weight:"medium",tone:"inherit",className:"es-insp-level-title",children:s})]}):t?u:/* @__PURE__ */c("div",{className:"es-insp-up",children:u})}function H({name:e,tier:n,of:a},t){const s={...i,...t};return{name:e,kind:"section"===n?s.tierSection:"block"===n?s.tierBlock:a?s.partOf({name:a}):s.tierBlock}}var E={notice:n,lock:r};function G(e,n,i,a=E){const r=a.notice,o=t(e),c={kind:"reload",label:r.reload};if(n){const e=s(n.secondsAgo,a.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:i,when:e}):r.savedByOther({name:l(n.savedBy,a.lock),noun:i,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=l(o.name,a.lock),h=s(o.secondsSinceSeen,a.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:i,when:s(o.secondsSinceHeld,a.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:i,seen:h}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:i}),body:r.editingBody({seen:h}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function V({access:e,conflict:i,noun:a,onTakeOver:t,onViewReadOnly:s,onReload:l}){const d=G(e,i,a,{notice:o("notice",n),lock:o("lock",r)});if(!d)return null;const u={reload:l,"take-over":t,"take-back":t,"view-read-only":s},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(k,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(k,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
|
|
20
|
+
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(g,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var Z={left:288,right:320},K={left:240,right:220},Q=K.right,U=560;function X(e,n){const i=n?K[n]:Q;return Math.min(560,Math.max(i,Math.round(e)))}function _(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function ee(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{Z as DEFAULT_PANEL_W,L as DeviceSwitch,j as EaselIconButton,R as EaselTopBar,V as EditNotice,F as InspectorHead,I as InspectorIconButton,q as InspectorUpLevel,U as MAX_PANEL_W,Q as MIN_PANEL_W,K as MIN_PANEL_W_BY_SIDE,A as PanelResizeHandle,P as SaveIcon,Y as SaveState,D as SaveStateToggle,S as TopBarCluster,W as TopBarDivider,$ as TopBarRail,X as clampPanelWidth,G as editNotice,H as headWords,_ as panelWidthVars,J as saveIconTone,ee as setPanelWidthVars};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-GDO4QJ4G.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as r}from"./chunk-N7E6264U.js";import{sharedSectionsOf as l}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SBVIW3KJ.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-4OMAA45Q.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-S6YOIRXQ.js";import{useEasel as u}from"./chunk-53ME3GAI.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-MBEUSPIN.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as I}from"react";import{SharedIcon as w,AddIcon as O}from"efficient-shell/icons/efficient";import{ContextMenu as C,toast as E,Dialog as M,Button as $}from"efficient-shell/ui";import{jsx as S,jsxs as x,Fragment as A}from"react/jsx-runtime";function F({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=I(null);/* @__PURE__ */
|
|
2
|
+
return S(M,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */x(A,{children:[
|
|
3
|
+
/* @__PURE__ */S($,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
|
|
4
|
+
/* @__PURE__ */S($,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var G=e=>`section:${e}`,Q=e=>`block:${e}`,B=e=>`template:${e}`,T=e=>`shared:${e}`,W=e=>`preset:${e}`;function H({at:I,placeBlocks:M,canTake:$,onPick:H,itemFor:N,session:U,siteWide:z,onClose:D,onHide:J,readOnly:L}){const R=u(e=>e.config),Y=a(),{labelAtLevel:P,categoryLabel:V,firstSection:X,Icon:_,Thumbnail:K}=Y,{blockIsOffered:Z,canAddTo:q}=p(),ee=h("screen",f).add,te=h("drag",g).add,ne=m(),[oe,re]=b([]);v(()=>{let e=!1;const t=e=>Z(e,ne);return r(ne).list().then(n=>{if(e)return;const r=R.components;re(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,ne]);const le=d().shared,ie=h("screen",f).shared,[se,ce]=b([]),[ae,pe]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>Z(e,ne);return l(ne).list().then(n=>{if(e)return;const r=R.components;ce(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,ne,ae]);const[de,me]=b(null),[fe,ue]=b(null),ye=j(()=>e(R,Y),[R]),he=e=>P(e,"section",R.components[e]?.label??e),ke=e=>({type:e.preset?W(e.preset.key):G(e.type),label:e.name,cover:/* @__PURE__ */S(K,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:ee.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ge=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=oe.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=se.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=ye.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},be=e=>/* @__PURE__ */S("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */S(_,{type:e,size:26})}),ve=j(()=>{const e=t(ye,X),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!Z(e.type,ne)||o.set(e.type,e)};for(const t of e?[e]:ye.filter(e=>!e.preset)){const e=q(t.type)?.choices??[];e.forEach(r),e.forEach(e=>q(e.type,1)?.choices?.forEach(r))}M?.forEach(r);const l=new Set(ye.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=e=>({type:Q(e.type),label:e.label,cover:be(e.type),title:ee.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>!e.preset&&o.has(e.type)?{...ke(e),cover:be(e.type)}:ke(e),p=[];se.length>0&&p.push({key:"shared",title:ie.group,tiles:se.map(e=>({type:T(e.id),label:e.title,cover:/* @__PURE__ */S(K,{type:e.node.type}),mark:/* @__PURE__ */S(w,{size:12}),title:ie.onPages({count:e.used_on.length}),keywords:[he(e.node.type),e.node.type]}))}),oe.length>0&&p.push({key:"templates",title:ee.templates,tiles:oe.map(e=>({type:B(e.id),label:e.name,cover:/* @__PURE__ */S(K,{type:e.node.type}),keywords:[he(e.node.type),e.node.type]}))});const d=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(R.categories??{})){const o=ye.filter(e=>e.cat===t);if(0===o.length)continue;const r=e&&o.some(t=>t.type===e.type)?e:null,l=(r?[r,...o.filter(e=>e.type!==r.type)]:o).map(a);r&&!m&&(l.splice(1,0,...d.map(s)),m=!0),p.push({key:`category:${t}`,title:n(R,t,V),tiles:l})}const f=p.find(e=>e.key?.startsWith("category:"));if(!m&&f&&d.length>0&&(f.tiles=[...f.tiles,...d.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!$)return p;const u=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ge(e.type),n=t?$(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[oe,se,ie,ye,R,ee,$,M,ne]);/* @__PURE__ */
|
|
5
|
+
return x(A,{children:[
|
|
6
|
+
/* @__PURE__ */S(i,{icon:/* @__PURE__ */S(O,{size:15}),title:ee.title,context:ee.contextAll,actions:/* @__PURE__ */S(s,{label:ee.done,description:ee.doneDescription,onClick:D}),onHide:J}),
|
|
7
|
+
/* @__PURE__ */x("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */S(k,{groups:ve,session:U,itemFor:e=>N(ge(e)??{kind:"section",type:e}),onInsert:H?e=>{const t=ge(e);t&&H(t)}:void 0,onTileMenu:(e,t)=>{const n=ge(e);return"shared"===n?.kind&&!L&&(me({section:n.section,...t}),!0)},at:I,hint:ee.hint,searchLabel:ee.search,readOnly:L,words:te}),z??null]}),de?/* @__PURE__ */S(C,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),"aria-label":de.section.title,items:y([{label:ie.deleteShared,danger:!0,onClick:()=>{ue(de.section),me(null)}}])}):null,fe?/* @__PURE__ */S(F,{name:fe.title,pages:fe.used_on.length,onDelete:()=>(async e=>{try{await l(ne).remove(e.id)}catch{return void E.error(ie.deleteFailed)}ue(null),le?.removed?.(e),ce(t=>t.filter(t=>t.id!==e.id)),pe(e=>e+1)})(fe),onCancel:()=>ue(null)}):null]})}export{H as AddSidePanel,Q as blockKey,W as presetKey,G as sectionKey,T as sharedKey,B as templateKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-4OMAA45Q.js";import{useEaselHost as e}from"./chunk-LX23TCTP.js";import{createEasel as r,EaselProvider as o}from"./chunk-53ME3GAI.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_LOCK_WORDS as e}from"./chunk-RE4LP46F.js";import{newId as n}from"./chunk-EUFDQ4KL.js";var t=e=>"editing"===e.kind;function r(e){return e?{kind:"checking"}:{kind:"editing"}}var c=e=>"blocked"===e.kind||"readonly"===e.kind||"takenover"===e.kind?e.holder:null;function s(e){if(!e||"object"!=typeof e)return null;const n=e;return"string"!=typeof n.holder_name?null:{name:n.holder_name,secondsSinceSeen:"number"==typeof n.seconds_since_seen?n.seconds_since_seen:0,secondsSinceHeld:"number"==typeof n.seconds_since_held?n.seconds_since_held:0}}var a=e=>e?{edit:!0,insert:!0,delete:!0,duplicate:!0,drag:!1}:{edit:!1,insert:!1,delete:!1,duplicate:!1,drag:!1};function o(n,t=e){if(!Number.isFinite(n)||n<45)return t.justNow;const r=Math.round(n/60);if(r<60)return t.minutesAgo({count:r});const c=Math.round(r/60);return t.hoursAgo({count:c})}var i=(n,t=e)=>n.trim()||t.someone;function d(){return n("tab").slice(0,64)}var u="edit_lock_taken";function l(e,n,r){return!(t(e)||!t(n))&&(r.pending&&r.autoSaveEnabled&&!r.saveConflict)}function f(e,n,r){return!(null===c(e)||!t(n))&&(!r.pending&&!r.saveConflict)}function k(e,n){return e!==n&&Date.parse(e)>=Date.parse(n)}async function h(e){if(!e.ours)return!1;const n=await e.stored().catch(()=>null);return!(!n||!k(n,e.ours)||e.hasPending())&&(e.reload(),!0)}var b=8e3,g=3e4;function _(e){if(e.cancelled())return!1;const n=e.currentAccess();if("checking"!==n.kind)return!1;const t={kind:"editing"};return e.setAccess(t),l(n,t,e.heldWrite())&&e.releaseHeldWrite(),!0}function m(e){const{readFailure:n,conflictCode:t}=e,r=e=>{const t=n(e);return t&&409===t.status?s(t.data):null},c=e=>{const n=r(e);return n?{kind:"blocked",holder:n}:{kind:"editing"}},a=(e,n)=>{const t=r(e);return t?{kind:"blocked",holder:t}:n},o=(e,n)=>{const t=r(e);return t?{kind:"takenover",holder:t}:n},i=e=>{const t=n(e);return null!==t&&(401===t.status||403===t.status)};return{accessAfterClaimFailure:c,accessAfterTakeoverFailure:a,accessAfterHeartbeatFailure:o,isAuthRejection:i,readSaveConflict:e=>{const r=n(e);if(!r||409!==r.status)return null;if(!r.data||"object"!=typeof r.data)return null;const c=r.data;return c.code!==t?null:{savedBy:"string"==typeof c.saved_by?c.saved_by:"",savedByYou:!0===c.saved_by_you,secondsAgo:"number"==typeof c.seconds_ago?c.seconds_ago:0}},readLockTaken:e=>{const t=n(e);return t&&409===t.status&&t.data&&"object"==typeof t.data?t.data.code!==u?null:s(t.data)??{name:"",secondsSinceSeen:0,secondsSinceHeld:0}:null},makeClaimBeat:e=>{let n=!1;return async t=>{let r,s;try{const c=await e.claim(t);if(e.cancelled())return;r=e.currentAccess(),s={kind:"editing"},!n&&c.heartbeat_seconds>0&&(n=!0,e.startHeartbeat(1e3*c.heartbeat_seconds))}catch(n){if(e.cancelled())return;r=e.currentAccess(),s=t?a(n,r):"checking"===r.kind?c(n):o(n,r),i(n)&&e.stopHeartbeat()}e.setAccess(s);const d=e.heldWrite();l(r,s,d)?e.releaseHeldWrite():t&&f(r,s,d)&&e.reloadIfMoved?.()}}}}export{b as CLAIM_FAIL_OPEN_MS,u as EDIT_LOCK_TAKEN,g as FAIL_OPEN_RETRY_MS,r as accessForNewDocument,t as canWriteDocument,m as createEditLock,o as describeAge,a as documentPermissions,k as documentVersionMoved,c as holderOf,i as nameOrSomeone,d as newEaselClientId,_ as openUnansweredClaim,s as readLockHolder,h as reloadIfVersionMoved,l as shouldReleaseHeldWrite,f as shouldReloadAfterTakeover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSectionOps as o}from"./chunk-M4THI4OO.js";import{SELECTION_MODE as e}from"./chunk-4OMAA45Q.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-53ME3GAI.js";import{usePreviewParts as p}from"./chunk-467WWV4I.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=n(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),I?.(n)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=a(o);r&&u.select(r)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-YFHKE54W.js";import{ScreenChrome as e}from"./chunk-KTV7ORWF.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-ERB6FAZT.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-S6YOIRXQ.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 j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const 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
5
|
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{k()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function
|
|
7
|
-
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function F({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),F=t(()=>s(!g),[g]),Y=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:Y.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:F,parts:n,children:/* @__PURE__ */u(C,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:Y.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:Y.waitingForAuthorization})}export{F as DocumentScreen,y as ScreenMount};
|
package/dist/copy/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SettingsSwitch as e}from"../chunk-OECWLNKJ.js";import{TEXT_STYLE_CASES as t}from"../chunk-YHZSBL2N.js";import{selectionToVisible as n,selectionToSource as r,richLayout as l,createHistory as o,colorRunOf as a,textRange as s,selectionBox as c,placeWindow as i,offsetOrigin as u,visibleArea as d,clearRangeOf as p,ColorWindow as h,markPress as m,pasteToMarkup as f,richInput as g,editVisible as y,MARKUP_CLIPBOARD_TYPE as v,markupOfRange as b}from"../chunk-HZSZT3BE.js";export{ColorWindow,MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,clearRangeOf,colorRunOf,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-HZSZT3BE.js";import{DEFAULT_COPY_WORDS as k}from"../chunk-PMRN5Z3T.js";import{FieldNumber as x}from"../chunk-Y2T3JX7K.js";import{FieldSelect as S}from"../chunk-KFWNGPW3.js";import{SettingsField as E}from"../chunk-MIX7EGRG.js";import{SettingsSegmented as w}from"../chunk-DX3VILZ3.js";import"../chunk-JACEEVVF.js";import{useWords as C}from"../chunk-MFIRYGHW.js";import{registerModalEscapeInterceptor as N,textToolbarRows as D,TextToolbar as T,textAlignWords as O,useShellStrings as L,textAlignOptions as R,TEXT_ALIGNS as K,LinkPicker as j,Tooltip as B,IconButton as F}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as H,useState as M,useLayoutEffect as V,useEffect as W,useId as $}from"react";import{RETIRED_MARKS as P,applyMark as z,marksIn as I,STANDARD_MARKUP as Z,listIn as q,colorIn as Y,clearStyle as A,spanFor as G,findLink as U,tokenizeInline as _,colorOver as J,setList as X,unlinkAt as Q,removeLink as ee,linkOver as te,writeLink as ne}from"efficient-shell/markup";import{jsxs as re,jsx as le,Fragment as oe}from"react/jsx-runtime";import{ParagraphSpacingIcon as ae,LetterSpacingIcon as se,LineSpacingIcon as ce,TextSizeIcon as ie,StylesIcon as ue,TypeIcon as de,AlignmentIcon as pe,ListFormatIcon as he,CaseIcon as me,ItalicIcon as fe,NumberedListIcon as ge,ListIcon as ye,ListNoneIcon as ve,CaseLowerIcon as be,CaseCapitalizedIcon as ke,CaseUpperIcon as xe,CaseNormalIcon as Se}from"efficient-shell/icons/efficient";function Ee(e,t,n,r,l){for(const o of l){if(o.kind!==n)continue;if(!e.startsWith(o.open,t))continue;const l=t+o.open.length;if(e.startsWith(r,l)&&e.startsWith(o.close,l+r.length))return o}return null}function we({value:e,rules:t=Z,className:n,layerRef:r}){const l=function(e,t){const n=[];let r=0;for(const l of _(e,t)){if("text"===l.kind){l.text.length>0&&(n.push({kind:"text",text:e.slice(r,r+l.text.length)}),r+=l.text.length);continue}const o=Ee(e,r,l.kind,l.text,t);if(!o)return[{kind:"text",text:e}];const a=r+o.open.length,s=a+l.text.length,c=s+o.close.length;n.push({kind:"delimiter",text:e.slice(r,a)}),n.push({kind:l.kind,text:e.slice(a,s)}),n.push({kind:"delimiter",text:e.slice(s,c)}),r=c}return n.map(e=>e.text).join("")!==e?[{kind:"text",text:e}]:n}(e,t);/* @__PURE__ */
|
|
2
2
|
return le("div",{ref:r,className:["es-gold-layer",n??""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.map((e,t)=>function(e,t){const{kind:n,text:r}=e;switch(n){case"delimiter":/* @__PURE__ */
|
|
3
3
|
return le("span",{className:"es-gold-delim",children:r},t);case"accent":case"highlight":/* @__PURE__ */
|
|
4
4
|
return le("em",{className:"es-gold-mark es-gold-accent",children:r},t);case"bold":/* @__PURE__ */
|
|
@@ -6,24 +6,24 @@ return le("strong",{className:"es-gold-mark es-gold-bold",children:r},t);case"it
|
|
|
6
6
|
return le("em",{className:"es-gold-mark es-gold-italic",children:r},t);case"strike":/* @__PURE__ */
|
|
7
7
|
return le("s",{className:"es-gold-mark es-gold-strike",children:r},t);case"quiet":/* @__PURE__ */
|
|
8
8
|
return le("span",{className:"es-gold-mark es-gold-quiet",children:r},t);default:/* @__PURE__ */
|
|
9
|
-
return le("span",{className:"es-gold-text",children:r},t)}}(e,t))})}function Ce({value:e,onInput:t,onCommit:n,onCancel:r,multiline:l=!1,placeholder:o,className:a,rules:s=
|
|
9
|
+
return le("span",{className:"es-gold-text",children:r},t)}}(e,t))})}function Ce({value:e,onInput:t,onCommit:n,onCancel:r,multiline:l=!1,placeholder:o,className:a,rules:s=Z,ariaLabel:c,disabled:i=!1,inputRef:u}){const d=H(null),p=H(e),h=H(!1);function m(e){h.current&&(h.current=!1,n?.(e))}/* @__PURE__ */
|
|
10
10
|
return re("div",{className:["es-gold",l?"es-gold-is-multiline":"es-gold-is-single",i?"es-gold-is-off":"",a??""].filter(Boolean).join(" "),children:[
|
|
11
11
|
/* @__PURE__ */le(we,{value:e,rules:s,layerRef:d}),o&&""===e?
|
|
12
12
|
/* @__PURE__ */le("div",{className:"es-gold-placeholder","aria-hidden":"true",children:o}):null,
|
|
13
|
-
/* @__PURE__ */le("textarea",{ref:u,className:"es-gold-input",disabled:i,value:e,placeholder:o,"aria-label":c,onChange:function(e){h.current=!0,t(e.currentTarget.value)},onFocus:function(){p.current=e,h.current=!1},onBlur:function(){m(e)},onKeyDown:function(t){return"Escape"===t.key?(t.preventDefault(),h.current=!1,void r?.(p.current)):"Enter"!==t.key||l?void 0:(t.preventDefault(),void m(e))},onScroll:function(e){const t=d.current;t&&(t.scrollTop=e.currentTarget.scrollTop,t.scrollLeft=e.currentTarget.scrollLeft)}})]})}function Ne(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function De(e,t,n,r=
|
|
13
|
+
/* @__PURE__ */le("textarea",{ref:u,className:"es-gold-input",disabled:i,value:e,placeholder:o,"aria-label":c,onChange:function(e){h.current=!0,t(e.currentTarget.value)},onFocus:function(){p.current=e,h.current=!1},onBlur:function(){m(e)},onKeyDown:function(t){return"Escape"===t.key?(t.preventDefault(),h.current=!1,void r?.(p.current)):"Enter"!==t.key||l?void 0:(t.preventDefault(),void m(e))},onScroll:function(e){const t=d.current;t&&(t.scrollTop=e.currentTarget.scrollTop,t.scrollLeft=e.currentTarget.scrollLeft)}})]})}function Ne(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function De(e,t,n,r=z){const{start:l,end:o}=Ne(e,n);return r(e,l,o,t)}function Te(e,t,n){const{start:r,end:l}=Ne(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function Oe(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Le(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Re(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function Ke({value:e,rules:t,multiline:o,readOnly:a=!1,placeholder:s,ariaLabel:c,handle:i,onEdit:u,onSelect:d,onHistory:p,onFormat:h,pending:m,onCommit:k,onCancel:x}){const S=H(null),E=H(null),w=H(null),C=H(null),N=H(null),D=H(e),[T,O]=M(0),L=H({value:e,rules:t,multiline:o,readOnly:a,pending:m,onEdit:u,onHistory:p,onFormat:h});L.current={value:e,rules:t,multiline:o,readOnly:a,pending:m,onEdit:u,onHistory:p,onFormat:h};const R=()=>{const e=S.current,t=E.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Le(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Le(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},K=(e,t)=>{const n=S.current,r=E.current;if(!n||!r)return;const[l,o]=Re(r,e),[a,s]=Re(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};i.current={getSource(){const e=R(),t=E.current;if(!e||!t)return null;const[n,l]=r(t.layout,e[0],e[1]);return{start:n,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},O(e=>e+1)},focus(){S.current?.focus()},rangeOf(e,t){const r=S.current,l=E.current;if(!r||!l)return null;const[o,a]=n(l.layout,e,t),[s,c]=Re(l,o),[i,u]=Re(l,a),d=r.ownerDocument.createRange();return d.setStart(s,c),d.setEnd(i,u),d}},V(()=>{const r=S.current;if(!r||N.current)return;const o=C.current?null:R();E.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Oe(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(r,l(e,t)),w.current=e;const a=C.current;if(!a||a.text!==e)return void(o&&r.ownerDocument.activeElement===r&&K(o[0],Math.min(o[1],E.current.layout.text.length)));C.current=null;const s=E.current.layout,[c,i]=a.vis??n(s,a.src[0],a.src[1]);r.ownerDocument.activeElement!==r&&r.focus(),K(c,i)},[e,t,T]);const j=(e,t,n)=>{const l=E.current,[o,a]=r(l.layout,t[0],t[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==L.current.value?L.current.onEdit(e.text,{start:o,end:a},n):O(e=>e+1)};W(()=>{const e=S.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=L.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=E.current,c=R();if(!s||!c)return;const i="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=i&&!i.collapsed?[Le(s,e,i.startContainer,i.startOffset),Le(s,e,i.endContainer,i.endOffset)]:null,d=g({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:c,target:u,pending:a});d&&("history"!==d.kind?"format"!==d.kind?j(d.edit,d.range,d.kind):L.current.onFormat(d.style):L.current.onHistory(d.dir))},n=()=>{N.current||O(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),W(()=>{const e=S.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=i.current?.getSource();e&&d(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const B=(n,r=!1)=>{const l=R();if(!l||l[0]===l[1])return;n.preventDefault();const o=E.current;n.clipboardData.setData("text/plain",o.layout.text.slice(l[0],l[1])),n.clipboardData.setData(v,b(e,t,l[0],l[1])),r&&!a&&j(y(e,t,l[0],l[1],{text:""}),l,"edit")};/* @__PURE__ */
|
|
14
14
|
return re("div",{className:"es-rich-wrap",children:[s&&""===e?/* @__PURE__ */le("div",{className:"es-rich-placeholder","aria-hidden":"true",children:s}):null,
|
|
15
|
-
/* @__PURE__ */le("div",{ref:S,className:`es-rich${o?" is-multiline":" is-single"}${a?" is-off":""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":o,"aria-label":c,"aria-readonly":a||void 0,"aria-placeholder":s,tabIndex:a?-1:0,spellCheck:!0,onFocus:()=>{D.current=e},onBlur:()=>{e!==D.current&&k?.(e),D.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),x?.(D.current),void(D.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==D.current&&k?.(e),D.current=e)},onCompositionStart:()=>{const e=R()??[0,0];N.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=N.current;if(N.current=null,!t)return;const{value:n,rules:r,pending:l}=
|
|
15
|
+
/* @__PURE__ */le("div",{ref:S,className:`es-rich${o?" is-multiline":" is-single"}${a?" is-off":""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":o,"aria-label":c,"aria-readonly":a||void 0,"aria-placeholder":s,tabIndex:a?-1:0,spellCheck:!0,onFocus:()=>{D.current=e},onBlur:()=>{e!==D.current&&k?.(e),D.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),x?.(D.current),void(D.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==D.current&&k?.(e),D.current=e)},onCompositionStart:()=>{const e=R()??[0,0];N.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=N.current;if(N.current=null,!t)return;const{value:n,rules:r,pending:l}=L.current;e.data?j(y(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):O(e=>e+1)},onCopy:e=>B(e),onCut:e=>B(e,!0),onPaste:n=>{if(n.preventDefault(),a)return;const r=R();if(!r)return;const l=n.clipboardData.getData(v),s=l?o?l:l.replace(/\s*\r?\n\s*/g," "):f({html:n.clipboardData.getData("text/html"),text:n.clipboardData.getData("text/plain")},{doc:n.currentTarget.ownerDocument,multiline:o,rules:t});j(y(e,t,r[0],r[1],{markup:s}),r,"edit")}})]})}var je={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */le(ie,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */le(ce,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */le(se,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */le(ae,{}),unit:"px",step:1,shiftStep:10,min:0}};function Be(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Fe({cells:e,words:t,readOnly:n=!1}){const r=t??k.cells,l=$();/* @__PURE__ */
|
|
16
16
|
return le("div",{className:"es-copy-cells-fit",children:/* @__PURE__ */le("div",{className:"es-copy-cells",children:e.map(e=>{const t=e.scale??1,o=e.name??(e.nameKey?r[e.nameKey]:e.key),a=e.unit??"",s=e.step??1,c=`${l}-${e.key}`;/* @__PURE__ */
|
|
17
17
|
return re("div",{className:"es-copy-cell",children:[
|
|
18
18
|
/* @__PURE__ */le("label",{className:"es-field-label es-copy-cell-name",htmlFor:c,children:o}),
|
|
19
|
-
/* @__PURE__ */le(
|
|
20
|
-
return re("div",{ref:at,className:"es-copy"+(
|
|
21
|
-
/* @__PURE__ */le(T,{className:"es-copy-toolbar","aria-label":K??de.formatting,offered:ht,pressed:
|
|
19
|
+
/* @__PURE__ */le(x,{id:c,value:Be(e.value,t),styleValue:Be(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:n,ariaLabel:o,title:r.tip({name:o,step:s,unit:a})})]},e.key)})})})}function He({target:e,onChange:t}){const n=H(null);return V(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var Me=/* @__PURE__ */new Set([...P,"clear"]);function Ve({value:t,onChange:n,onCommit:r,onCancel:l,multiline:g=!1,placeholder:y,ariaLabel:v,className:b,readOnly:x=!1,rules:S,tools:E=[],writeMark:w,align:O,actions:L,toolbar:R,barLabel:K,renderFooter:B,inputRef:F,barShows:P="always",richText:_=!0,defaultShowMarks:ae=!1,colors:se,cells:ce,letterCase:ie,lastTool:ue}){const de=C("copy",k),pe=H(null),he=F??pe,[me,fe]=M(!1),[ge,ye]=M(null),ve=H(o()).current,be=H(null);W(()=>{const e=be.current;e&&t===e.to?be.current=null:e&&t===e.from||(be.current=null,ve.reset())},[t,ve]);const ke=e=>{be.current={from:be.current?.from??t,to:e},n(e)},xe=e=>({text:t,start:e?.selectionStart??ge?.start??t.length,end:e?.selectionEnd??ge?.end??t.length}),[Se,Ee]=M(ae),we=_&&!(g&&Se),Ne=H(null),Oe=$(),[Le,Re]=M(null),[je,Be]=M(!1),Ve=()=>{if(!we)return he.current;const e=Ne.current?.getSource()??ge;return e?{selectionStart:e.start,selectionEnd:e.end}:null},We=He({target:he,onChange:ke}),$e=e=>(ye({start:e.selectionStart,end:e.selectionEnd}),e),Pe=(e,n)=>{if(!we)return void We(t=>(n&&ve.record(xe(t),"edit",Date.now()),$e(e(t))));const r=Ve(),l=$e(e(r));n&&ve.record(xe(r),"edit",Date.now()),Re(null),l.text!==t&&ke(l.text),Ne.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},ze=e=>Pe(e,!0),Ie=e=>Pe(t=>{const n=xe(t),r=ve[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Ze=H(null);V(()=>{const e=Ze.current;e&&(Ze.current=null,we?Ne.current?.setSource(e.start,e.end,t):(he.current?.focus(),he.current?.setSelectionRange(e.start,e.end),ye(e)))},[we]);const[qe,Ye]=M(null),Ae=S??Z,Ge=("string"==typeof E[0]?E:E.map(e=>e.style)).filter(e=>!Me.has(e)),Ue={};if(ge){const e=I(t,ge.start,ge.end,Ae);for(const t of Ge){const n=e.has(t)||"highlight"===t&&e.has("accent");Ue[t]=!!Le?.add.includes(t)||!Le?.drop.includes(t)&&n}Ue.link=e.has("link")}const _e=()=>{const e=Ve(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Je=e=>{if("link"!==e&&G(0,e)){const{start:n,end:r}=_e();if(n===r&&!we)return void ze(n=>De(t,e,n,(e,t,n,r)=>z(e,t,n,r,Ae,de.placeholders)));const l=m({value:t,rules:Ae,start:n,end:r,style:e,pending:Le});return void("pending"===l.kind?Re(l.pending):ze(()=>l.result))}if("link"!==e){const n=w??((e,t,n,r)=>z(e,t,n,r,Z,de.placeholders));return void ze(r=>De(t,e,r,n))}const n=Ve(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Be(!1),Ye({start:r,end:l,link:U(t,r,l)})},Xe=Boolean(ge&&ge.start!==ge.end),Qe=ge?q(t,ge.start,ge.end,Ae):null,et=ge?Le&&void 0!==Le.color&&Le.at===ge.start?Le.color:Y(t,ge.start,ge.end,Ae):null,tt=a(et,se),nt=e=>{we?e?Ne.current?.setSource(e.start,e.end,t):Ne.current?.focus():(he.current?.focus(),e&&he.current?.setSelectionRange(e.start,e.end))},rt=()=>{const e=qe;Ye(null),nt(e?{start:e.start,end:e.end}:ge)},lt=()=>{const e=at.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Be(!1),t&&nt(ge)},ot=H(lt);ot.current=lt,W(()=>{if(je)return N(e=>{const t=at.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(ot.current(),!0)},()=>at.current?.querySelector(".es-copy-colors"))},[je]);const at=H(null),st=je||null!==qe;W(()=>{const e=at.current;if(!st||!e)return;const t=e.ownerDocument,n=()=>{Be(!1),Ye(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[st]);const ct=qe??(je?ge??{start:t.length,end:t.length}:null),it=H(()=>{});it.current=()=>{const e=at.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!ct)return;const n=we?null:e.querySelector(".es-gold-layer"),r=we?Ne.current?.rangeOf(ct.start,ct.end)??null:n?s(n,ct.start,ct.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?c(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const p=i({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:d(e),parent:u(t)});t.style.top=`${p.top}px`,t.style.left=`${p.left}px`,t.style.setProperty("--es-pop-point",`${p.point}px`),t.dataset.side=p.above?"above":"below"},V(()=>{const e=at.current;if(!st||!e)return;const t=()=>it.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[st,je,qe,ct?.start,ct?.end,we]);const ut="always"===P||me||null!==qe||je,dt=se&&se.length>0?{run:tt,open:je,onToggle:()=>{Ye(null),je?lt():Be(!0)}}:void 0,pt=ut?ue?ue({className:"rosh-tb-btn",disabled:x,selected:Xe,keepCaret:e=>e.preventDefault(),insert:e=>ze(n=>Te(t,e,n))}):"classic"===R?L:void 0:void 0,ht=new Set(Ge),mt=O?{value:O.value,allow:O.allow,onChange:O.onChange,disabled:O.disabled}:void 0,ft={pressed:Qe,onList:e=>{const{start:n,end:r}=_e(),l=q(t,n,r,Ae);ze(()=>X(t,n,r,l===e?null:e,Ae))}},gt=p(ge,t.length),yt=x||A(t,gt.start,gt.end,Ae).text===t?void 0:{onClear:()=>{const{start:e,end:n}=p(_e(),t.length);ze(()=>A(t,e,n,Ae))}},vt=D({offered:ht,color:dt,last:pt,alignment:mt,list:ft,letterCase:ie,clear:yt});/* @__PURE__ */
|
|
20
|
+
return re("div",{ref:at,className:"es-copy"+(b?` ${b}`:""),onFocus:()=>fe(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||fe(!1)},onKeyDown:e=>{const t=e.target===he.current||Boolean(e.target.closest?.(".es-rich"));if(x||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Ie(l||e.shiftKey?"redo":"undo");const o={b:"bold",i:"italic",u:"underline",k:"link"}[`${e.shiftKey?"shift+":""}${n}`];o&&Ge.includes(o)&&(e.preventDefault(),e.stopPropagation(),Je(o))},onPaste:e=>{const n=he.current;if(x||!n||e.target!==n)return;e.preventDefault();const r=f({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:g,rules:Ae});ze(e=>Te(t,r,e))},style:se&&se.length>0?Object.fromEntries(se.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=he.current;e&&e.ownerDocument.activeElement===e&&ye({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[ut&&(vt.words||vt.paragraph)?
|
|
21
|
+
/* @__PURE__ */le(T,{className:"es-copy-toolbar","aria-label":K??de.formatting,offered:ht,pressed:Ue,onMark:e=>Je(e),color:dt,linkOpen:null!==qe,last:pt,alignment:mt,list:ft,letterCase:ie,clear:yt,disabled:x,windows:/* @__PURE__ */re(oe,{children:[je&&se&&se.length>0?/* @__PURE__ */le(h,{colors:se,current:et,words:de.colors??k.colors,onPick:e=>{const{start:n,end:r}=_e();if(n!==r)ze(()=>J(t,n,r,e,Ae));else{if(!we)return;Re({add:Le?.add??[],drop:Le?.drop??[],color:e,at:n})}}}):null,qe?qe&&/* @__PURE__ */le(j,{className:"es-copy-link es-copy-pop",value:qe.link?.href??"",onApply:e=>{const n=qe;Ye(null),ze(()=>we?te(t,n.start,n.end,e,Ae):ne(t,n.start,n.end,e))},onRemove:qe.link?()=>{const e=qe.link,n=qe;Ye(null),e&&ze(()=>we?Q(t,n.start,n.end,Ae):ee(t,e))}:void 0,onCancel:rt}):null]})}):null,ce&&ce.length>0?/* @__PURE__ */le(Fe,{cells:ce,words:de.cells??k.cells,readOnly:x}):null,we?/* @__PURE__ */le(Ke,{value:t,rules:Ae,multiline:g,readOnly:x,placeholder:y,ariaLabel:v,handle:Ne,pending:Le??void 0,onEdit:(e,n,r)=>{ve.record({text:t,start:n.start,end:n.end},r,Date.now()),Re(null),ke(e)},onSelect:e=>{ye(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Le||e.start===Le.at&&e.end===Le.at||Re(null)},onHistory:Ie,onFormat:e=>{Ge.includes(e)&&Je(e)},onCommit:r,onCancel:l}):/* @__PURE__ */le(Ce,{value:t,onInput:e=>{ve.record(xe(null),"type",Date.now()),ke(e)},onCommit:r,onCancel:l,multiline:g,placeholder:y,ariaLabel:v,rules:S,disabled:x,inputRef:he,className:"es-copy-box"}),B?B({focused:me,insert:e=>ze(n=>Te(t,e,n))}):null,_&&g?
|
|
22
22
|
/* @__PURE__ */re("div",{className:"es-copy-marks",children:[
|
|
23
|
-
/* @__PURE__ */le(
|
|
24
|
-
/* @__PURE__ */le("span",{id:
|
|
25
|
-
return le(E,{label:e,icon:t,children:/* @__PURE__ */le(w,{ariaLabel:e,value:s,disabled:a,onChange:e=>{a||o.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(o,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function
|
|
23
|
+
/* @__PURE__ */le(e,{checked:Se,onChange:()=>{const e=Ve();Ze.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ge,Re(null),Ee(e=>!e)},ariaLabelledBy:Oe,disabled:x}),
|
|
24
|
+
/* @__PURE__ */le("span",{id:Oe,className:"es-copy-marks-label",children:de.showMarks??"Show marks"})]}):null]})}var We=["none","bullet","number"],$e=t,Pe={none:/* @__PURE__ */le(ve,{}),bullet:/* @__PURE__ */le(ye,{}),number:/* @__PURE__ */le(ge,{})},ze={none:/* @__PURE__ */le(Se,{}),upper:/* @__PURE__ */le(xe,{}),capitalize:/* @__PURE__ */le(ke,{}),lower:/* @__PURE__ */le(be,{})};function Ie({label:e,icon:t,answers:n,names:r,glyphs:l,row:o,readOnly:a}){const s=o.value||o.styleValue||"";/* @__PURE__ */
|
|
25
|
+
return le(E,{label:e,icon:t,children:/* @__PURE__ */le(w,{ariaLabel:e,value:s,disabled:a,onChange:e=>{a||o.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(o,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function Ze({kept:e,keptHint:t,readOnly:n=!1,style:r,font:l,italic:o,cells:a,align:s,list:c,letterCase:i}){const u=C("copy",k),d=O(L().textToolbar),p=Object.fromEntries(R(K).map(e=>[e.value,e.icon])),h={...k.panel,...u.panel},m=r&&!n?[r.onEditStyles&&{label:h.editStyles,onSelect:r.onEditStyles},r.onUpdateStyle&&{label:h.updateStyle,onSelect:r.onUpdateStyle}].filter(e=>!!e):[],f=!!o&&(o.value??o.styleValue??!1),g=o?/* @__PURE__ */le(B,{content:h.italic,children:/* @__PURE__ */le(F,{size:"md",variant:"ghost","aria-label":h.italic,"aria-pressed":f,disabled:n,onClick:()=>{if(n)return;const e=!f;o.onChange(e===(o.styleValue??!1)?void 0:e)},children:/* @__PURE__ */le(fe,{})})}):null;/* @__PURE__ */
|
|
26
26
|
return re("div",{className:"es-tpp",children:[e?/* @__PURE__ */re("div",{className:"es-tpp-kept",children:[
|
|
27
|
-
/* @__PURE__ */le(
|
|
28
|
-
/* @__PURE__ */le("div",{className:"es-tpp-font-select",children:/* @__PURE__ */le(
|
|
29
|
-
/* @__PURE__ */le(E,{label:h.italic,icon:/* @__PURE__ */le(de,{}),children:/* @__PURE__ */le("div",{className:"es-tpp-font",children:g})}):null,a?.length?/* @__PURE__ */le(Fe,{cells:a,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */le(Ie,{label:u.alignment,icon:/* @__PURE__ */le(pe,{}),answers:K.filter(e=>!s.allow||s.allow.includes(e)),names:d,glyphs:p,row:s,readOnly:n}):null,c?/* @__PURE__ */le(Ie,{label:h.list,icon:/* @__PURE__ */le(he,{}),answers
|
|
27
|
+
/* @__PURE__ */le(Ve,{...e,readOnly:n||e.readOnly}),t?/* @__PURE__ */le("p",{className:"es-field-hint",children:t}):null]}):null,r?/* @__PURE__ */le(E,{label:h.style,icon:/* @__PURE__ */le(ue,{}),children:/* @__PURE__ */le(S,{ariaLabel:h.style,value:r.value,options:r.options,onChange:r.onChange,changed:r.changed,footer:m,readOnly:n})}):null,l?/* @__PURE__ */le(E,{label:h.font,icon:/* @__PURE__ */le(de,{}),children:/* @__PURE__ */re("div",{className:"es-tpp-font",children:[
|
|
28
|
+
/* @__PURE__ */le("div",{className:"es-tpp-font-select",children:/* @__PURE__ */le(S,{ariaLabel:h.font,value:l.value||void 0,placeholder:l.styleValue,options:l.options,onChange:l.onChange,searchable:l.searchable,readOnly:n})}),g]})}):g?
|
|
29
|
+
/* @__PURE__ */le(E,{label:h.italic,icon:/* @__PURE__ */le(de,{}),children:/* @__PURE__ */le("div",{className:"es-tpp-font",children:g})}):null,a?.length?/* @__PURE__ */le(Fe,{cells:a,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */le(Ie,{label:u.alignment,icon:/* @__PURE__ */le(pe,{}),answers:K.filter(e=>!s.allow||s.allow.includes(e)),names:d,glyphs:p,row:s,readOnly:n}):null,c?/* @__PURE__ */le(Ie,{label:h.list,icon:/* @__PURE__ */le(he,{}),answers:We,names:h.lists,glyphs:Pe,row:c,readOnly:n}):null,i?/* @__PURE__ */le(Ie,{label:h.capitalization,icon:/* @__PURE__ */le(me,{}),answers:$e,names:h.cases,glyphs:ze,row:i,readOnly:n}):null]})}export{je as COPY_CELLS,Ve as CopyBox,Fe as CopyCells,Ke as RichBox,Ze as TextPartPanel,Te as insertSelection,De as markSelection,He as useCaretEdit};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** One drawn copy's place. */
|
|
2
|
+
interface RepeatCopy {
|
|
3
|
+
/** The block whose slot is drawn once per row. */
|
|
4
|
+
ownerId: string;
|
|
5
|
+
/** That slot (`template`). */
|
|
6
|
+
slot: string;
|
|
7
|
+
/** The row this copy is drawn for; 0 is the main copy. */
|
|
8
|
+
index: number;
|
|
9
|
+
/** How many copies the owner draws (greys a host's "move later" on the last). */
|
|
10
|
+
count: number;
|
|
11
|
+
/**
|
|
12
|
+
* The copy of an OUTER template this copy's owner is drawn in, when there
|
|
13
|
+
* is one: the inner index alone names no row (row 2 of the cards in outer
|
|
14
|
+
* row 1). Left out at the top.
|
|
15
|
+
*/
|
|
16
|
+
outer?: RepeatCopy;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The copy `el` is in — the NEAREST wrapper with both names, with the chain
|
|
20
|
+
* of outer copies round it — or null outside every copy, or where the
|
|
21
|
+
* wrapper's zone key or index cannot be read.
|
|
22
|
+
*/
|
|
23
|
+
declare function repeatCopyAt(el: Element): RepeatCopy | null;
|
|
24
|
+
|
|
25
|
+
export { type RepeatCopy as R, repeatCopyAt as r };
|
package/dist/data/index.d.ts
CHANGED
|
@@ -316,6 +316,9 @@ declare function getList(data: Data, config: DataConfig, address: SlotAddress):
|
|
|
316
316
|
* A document already in shape is returned as the same object.
|
|
317
317
|
*/
|
|
318
318
|
declare function normalizeData(data: DataInput | Data, config: DataConfig): Data;
|
|
319
|
+
/** A plain copy that shares nothing with the original; `undefined` stays
|
|
320
|
+
* `undefined`. The one deep copy of the package (a document is JSON). */
|
|
321
|
+
declare function clone<T>(value: T): T;
|
|
319
322
|
/**
|
|
320
323
|
* A new block, the way the Add panel makes one — the old library's `insert` recipe:
|
|
321
324
|
* `{ ...defaultProps, id }`, plus any `props` the caller starts it with. The
|
|
@@ -380,4 +383,4 @@ declare function replaceNode(data: Data, config: DataConfig, id: string, node: N
|
|
|
380
383
|
/** Merge `patch` into the root's props, the same way `setProps` does. */
|
|
381
384
|
declare function setRoot(data: Data, config: DataConfig, patch: Record<string, unknown>): Data;
|
|
382
385
|
|
|
383
|
-
export { Data, DataConfig, DataError, type DataErrorCode, type DataInput, Found, Node, Place, ROOT_ID, ROOT_LIST, ROOT_SLOT, type Segment, SlotAddress, SlotEntry, type TranslatableItem, type TranslatablePath, type TranslatedValue, type TranslationEntries, type TranslationOverlay, type TranslationRef, type TranslationStatus, WalkInfo, applyTranslation, copyNode, copyTranslation, createNode, duplicate, extractTranslation, find, getIn, getList, insert, isNode, isNodeList, mapIds, move, newId, normalizeData, parseZoneKey, pruneTranslation, rebaseTranslation, remove, replaceNode, setProps, setRoot, slotsOf, translatablePaths, translationFingerprint, translationStatus, walk, zoneKey };
|
|
386
|
+
export { Data, DataConfig, DataError, type DataErrorCode, type DataInput, Found, Node, Place, ROOT_ID, ROOT_LIST, ROOT_SLOT, type Segment, SlotAddress, SlotEntry, type TranslatableItem, type TranslatablePath, type TranslatedValue, type TranslationEntries, type TranslationOverlay, type TranslationRef, type TranslationStatus, WalkInfo, applyTranslation, clone, copyNode, copyTranslation, createNode, duplicate, extractTranslation, find, getIn, getList, insert, isNode, isNodeList, mapIds, move, newId, normalizeData, parseZoneKey, pruneTranslation, rebaseTranslation, remove, replaceNode, setProps, setRoot, slotsOf, translatablePaths, translationFingerprint, translationStatus, walk, zoneKey };
|
package/dist/data/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DataError,ROOT_ID,ROOT_LIST,ROOT_SLOT,applyTranslation,changedProps,copyNode,copyTranslation,createNode,createResolveCache,deepEqual,duplicate,extractTranslation,find,getList,insert,mapIds,move,newId,normalizeData,parseZoneKey,pruneTranslation,rebaseTranslation,remove,replaceNode,resolveNodeData,setProps,setRoot,slotsOf,translatablePaths,translationFingerprint,translationStatus,walk,zoneKey}from"../chunk-
|
|
1
|
+
export{DataError,ROOT_ID,ROOT_LIST,ROOT_SLOT,applyTranslation,changedProps,clone,copyNode,copyTranslation,createNode,createResolveCache,deepEqual,duplicate,extractTranslation,find,getList,insert,mapIds,move,newId,normalizeData,parseZoneKey,pruneTranslation,rebaseTranslation,remove,replaceNode,resolveNodeData,setProps,setRoot,slotsOf,translatablePaths,translationFingerprint,translationStatus,walk,zoneKey}from"../chunk-EUFDQ4KL.js";export{getIn,isNode,isNodeList}from"../chunk-KXM6YRG2.js";
|