efficient-easel 11.3.0 → 12.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 +20 -41
- package/dist/{canvas-typing-DvoqQINU.d.ts → canvas-typing-CZ11Y5tb.d.ts} +16 -105
- package/dist/chrome/chrome.css +5 -5
- package/dist/chunk-2SOOKBHH.js +21 -0
- package/dist/{chunk-66LWADFP.js → chunk-2XMHLXMA.js} +1 -1
- package/dist/chunk-33C6ALT5.js +1 -0
- package/dist/{chunk-XJCMEEBH.js → chunk-36LVP5WD.js} +7 -7
- package/dist/chunk-47JTYRQC.js +2 -0
- package/dist/{chunk-EXKKLTXH.js → chunk-5NM5TPAX.js} +1 -1
- package/dist/{chunk-ZXGQT75B.js → chunk-5QP7ZE35.js} +1 -1
- package/dist/chunk-5R7FE4VT.js +57 -0
- package/dist/{chunk-FPAVNX3Y.js → chunk-5XUMLKQF.js} +3 -3
- package/dist/{chunk-PPL7GB7D.js → chunk-62VPYC7F.js} +1 -1
- package/dist/chunk-643PVCEG.js +1 -0
- package/dist/chunk-AYWN5NRH.js +1 -0
- package/dist/{chunk-4ACVXF5V.js → chunk-CZYR5V77.js} +1 -1
- package/dist/{chunk-PPHUWGLZ.js → chunk-EC2I7SIY.js} +1 -1
- package/dist/{chunk-DGAXQTDW.js → chunk-FHLYUIJJ.js} +1 -1
- package/dist/{chunk-65Z5FSAW.js → chunk-G3GWAP5R.js} +5 -5
- package/dist/{chunk-2FZJWH24.js → chunk-H4UMY7QF.js} +1 -1
- package/dist/chunk-KE2CXEIK.js +13 -0
- package/dist/chunk-KR4OCYRP.js +1 -0
- package/dist/{chunk-IFS5P7CO.js → chunk-LZS7JZK5.js} +1 -1
- package/dist/chunk-O3RLI7XE.js +1 -0
- package/dist/{chunk-47RGVCPH.js → chunk-QFVRMARS.js} +12 -12
- package/dist/chunk-TBF5CVPA.js +1 -0
- package/dist/chunk-UMDQ6CLQ.js +2 -0
- package/dist/chunk-UX7UJPC5.js +5 -0
- package/dist/chunk-VVPZMWJE.js +1 -0
- package/dist/chunk-WDQY6JMM.js +7 -0
- package/dist/chunk-WP7AZDCV.js +5 -0
- package/dist/chunk-WRFD4EXD.js +1 -0
- package/dist/{chunk-AFSSKGTD.js → chunk-WUO2GBPO.js} +1 -1
- package/dist/{chunk-BPFPM3L4.js → chunk-WY5U4XFO.js} +3 -3
- package/dist/{chunk-XWK7WZQS.js → chunk-X4VIDPKV.js} +1 -1
- package/dist/{chunk-TWFM6GNK.js → chunk-XY5ZHRMR.js} +1 -1
- package/dist/chunk-YHZSBL2N.js +1 -0
- package/dist/copy/copy.css +8 -108
- package/dist/copy/index.d.ts +39 -9
- package/dist/copy/index.js +18 -19
- package/dist/drag/drag.css +8 -8
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +3 -3
- package/dist/easel/index.js +1 -1
- package/dist/fields/fields.css +8 -8
- package/dist/fields/index.js +1 -1
- package/dist/gold/index.d.ts +3 -3
- package/dist/gold/index.js +1 -1
- package/dist/icons/index.d.ts +1 -0
- package/dist/markup/index.d.ts +1 -629
- package/dist/markup/index.js +1 -1
- package/dist/menu/menu.css +1 -1
- package/dist/panel/index.js +1 -1
- package/dist/panel/panel.css +12 -12
- package/dist/pick/index.d.ts +30 -8
- package/dist/pick/index.js +3 -7
- package/dist/pick/pick.css +10 -84
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/PanelToggleIcon.d.ts +6 -5
- package/dist/screen/components/PanelToggleIcon.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +15 -15
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/slot-child-name.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +16 -16
- package/dist/screen/words.js +1 -1
- package/dist/shell/shell.css +10 -8
- package/dist/strings/catalogue.d.ts +2 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.d.ts +14 -233
- package/dist/text-styles/index.js +36 -35
- package/dist/text-styles/model.d.ts +267 -0
- package/dist/text-styles/model.js +1 -0
- package/dist/text-styles/text-styles.css +6 -6
- package/dist/{words-dsex49Jh.d.ts → words-notpwHR2.d.ts} +13 -7
- package/package.json +8 -3
- package/dist/chunk-26GHWMNN.js +0 -21
- package/dist/chunk-546BBOPE.js +0 -1
- package/dist/chunk-AZOCY74V.js +0 -57
- package/dist/chunk-BHRC3ASL.js +0 -1
- package/dist/chunk-DD7A6RRL.js +0 -5
- package/dist/chunk-EQFBUNEB.js +0 -1
- package/dist/chunk-FAAZZXIS.js +0 -1
- package/dist/chunk-FFYXVAAL.js +0 -1
- package/dist/chunk-FGJSCWUN.js +0 -7
- package/dist/chunk-GCCBEY2W.js +0 -2
- package/dist/chunk-GG4FGBFR.js +0 -1
- package/dist/chunk-KQMML6JM.js +0 -4
- package/dist/chunk-Q6AM43CA.js +0 -1
- package/dist/chunk-SJPKSE5G.js +0 -13
- package/dist/chunk-U7KFFC7N.js +0 -5
- package/dist/chunk-VWXUMVCD.js +0 -1
- package/dist/chunk-ZAOM6PFH.js +0 -1
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import{hexReadout as e,ColourWindow as
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
return
|
|
8
|
-
return
|
|
9
|
-
return
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
return
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
return
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
return
|
|
21
|
-
return
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
return
|
|
24
|
-
return
|
|
25
|
-
return
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
return
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */
|
|
1
|
+
import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-5XUMLKQF.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-643PVCEG.js";import{FieldSlider as n}from"../chunk-XWFH2NHZ.js";import{withTip as l}from"../chunk-P2VEMZH5.js";import{TEXT_STYLE_KINDS as i,canAddTextStyle as r,TEXT_STYLE_MAX as o,isDefaultTextStyle as d,CAMPAIGN_TEXT_STYLE_SETTINGS as c,TEXT_STYLE_SETTINGS as u,textStyleRowSize as m,describeTextStyle as h,updateTextStyle as f,textStyleCaseCss as p,TEXT_STYLE_CASES as v,addTextStyle as y,removeTextStyle as S,TEXT_STYLE_RANGES as g}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{FieldSelect as b}from"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import{useWords as k}from"../chunk-MFIRYGHW.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as E,useId as z,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as M,ItalicIcon as j,CaseLowerIcon as X,CaseCapitalizedIcon as $,CaseUpperIcon as W,CaseNormalIcon as Y}from"efficient-shell/icons/efficient";import{jsxs as D,jsx as G,Fragment as I}from"react/jsx-runtime";var P=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function F({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=E(null),h=E(null),f=z(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */D("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
|
+
/* @__PURE__ */D("div",{className:"es-ts-top",children:[
|
|
3
|
+
/* @__PURE__ */G("span",{className:"es-ts-sub",children:l}),
|
|
4
|
+
/* @__PURE__ */G("span",{className:"es-ts-colour-read",children:a?e(a):i})]}),
|
|
5
|
+
/* @__PURE__ */D("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */G(C,{content:`${s.name} · ${e(s.value)}`,children:/* @__PURE__ */G(x,{color:s.value,size:"sm",className:"es-ts-swatch","aria-label":s.name,selected:t===s.key,disabled:d,onClick:()=>o(s.key)})},s.key)),
|
|
6
|
+
/* @__PURE__ */G(C,{content:r,children:/* @__PURE__ */G(x,{ref:h,color:P,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */G(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function H({styles:e,onChange:s,fonts:t,colours:n=[],settings:u=c,auto:m=[],fallback:h,sample:f,openId:p,defaultOpenId:v=null,onOpenChange:g,onAdd:b,rowActions:N,onRemove:C,max:x=o,device:T="desktop",readOnly:_=!1}){const A=k("textStyles",a),M=z(),[j,X]=w(v),$=void 0!==p?p:j,W=e=>{void 0===p&&X(e),g?.(e)},Y=E(null),[P,F]=w(null);O(()=>{if(!P||!Y.current)return;const e=[...Y.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===P.id),s=e?e.querySelector(".es-ts-row"):Y.current.querySelector(`.es-ts-add[data-ts-kind="${P.kind}"]`);s?.focus(),F(null)},[P]);/* @__PURE__ */
|
|
7
|
+
return G("div",{className:"es-ts",ref:Y,children:i.map(a=>{const i=e.filter(e=>e.kind===a),o=!r(e,a,x),c=!_&&!o;/* @__PURE__ */
|
|
8
|
+
return D(R,{label:A.groups[a],children:[i.map(a=>{const i=N?.(a),r=null!=i&&!1!==i,o=Boolean(C)&&!_&&!d(a);/* @__PURE__ */
|
|
9
|
+
return G(B,{style:a,fonts:t,colours:n,settings:u,auto:m,fallback:h,sample:f,device:T,readOnly:_,open:$===a.id,onOpenChange:e=>W(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:o||r?/* @__PURE__ */D(I,{children:[o?l(A.remove,/* @__PURE__ */G("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=S(e,t.id,{name:A.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];$===t.id&&W(null),s(a.styles),C(a.removed),F({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */G(L,{size:14,"aria-hidden":"true"})})):null,r?i:null]}):null},a.id)}),l(!_&&o?A.full({kind:a,max:x}):void 0,/* @__PURE__ */D("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!o)||void 0,"aria-describedby":!_&&o?`${M}-full-${a}`:void 0,onClick:()=>{c&&(t=>{if(_)return;const a=y(e,t,{max:x,name:A.styleName,make:b});a&&s(a.styles)})(a)},children:[
|
|
10
|
+
/* @__PURE__ */G("span",{className:"es-ts-add-word",children:A.add[a]}),
|
|
11
|
+
/* @__PURE__ */G("span",{className:"es-ts-count",children:A.count({n:i.length,max:x})})]})),_||!o?null:/* @__PURE__ */G("span",{id:`${M}-full-${a}`,className:"es-vh",children:A.full({kind:a,max:x})})]},a)})})}function R({label:e,children:s}){const t=z();/* @__PURE__ */
|
|
12
|
+
return D("section",{className:"es-ts-section","aria-labelledby":t,children:[
|
|
13
|
+
/* @__PURE__ */G("div",{className:"es-ts-group",id:t,children:e}),s]})}function B({style:e,fonts:s,colours:t=[],settings:n=c,auto:l=[],fallback:i,sample:r,open:o,onOpenChange:d,onChange:p,actions:v,device:y="desktop",readOnly:S=!1}){const g=k("textStyles",a),b=`${z()}-open-${e.id}`,N=new Set(l),C=u.filter(e=>n.includes(e)),x={...i?.(e)??{},...e.values},T="phone"===y,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,E=s.find(e=>e.value===x.font),O={fontFamily:E?.family,fontSize:`${m(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
|
|
14
|
+
return D(_,{children:[
|
|
15
|
+
/* @__PURE__ */D("div",{className:"es-ts-item","data-ts-id":e.id,children:[
|
|
16
|
+
/* @__PURE__ */D("button",{type:"button",className:"es-ts-row","aria-expanded":o,"aria-controls":o?b:void 0,onClick:()=>d(!o),children:[
|
|
17
|
+
/* @__PURE__ */G("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */G(A,{size:12})}),
|
|
18
|
+
/* @__PURE__ */G("span",{className:"es-ts-name",style:O,children:e.name}),
|
|
19
|
+
/* @__PURE__ */G("span",{className:"es-ts-meta",children:h(w,s,g,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),v?/* @__PURE__ */G("div",{className:"es-ts-actions",children:v}):null]}),o?/* @__PURE__ */G("div",{className:"es-ts-open",id:b,children:/* @__PURE__ */G(V,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:r??g.sample,words:g,phone:T,readOnly:S,set:s=>p(f([e],e.id,s)[0])})}):null]})}var U={none:Y,upper:W,capitalize:$,lower:X};function V({style:e,values:s,fonts:a,colours:i,settings:r,autoSet:o,sample:d,words:c,phone:u,readOnly:m,set:h}){const f=e.values,v=a.find(e=>e.value===s.font),y=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,i),S=e=>"largestSize"===e||o.has(e),b=e=>S(e)?f[e]:s[e],k=b("size"),N=u&&void 0!==f.sizePhone?f.sizePhone:k,C=b("lineSpacing"),x=b("letterSpacing"),w=S("letterCase")?f.letterCase:s.letterCase,E={fontFamily:v?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:y,textTransform:p(w)},z=e=>{const t=g[e],a=S(e);/* @__PURE__ */
|
|
20
|
+
return G("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */G(n,{label:c.settings[e],value:f[e],onChange:s=>h({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
|
|
21
|
+
return D(I,{children:[
|
|
22
|
+
/* @__PURE__ */G("div",{className:"es-ts-preview",style:E,"aria-label":c.preview,children:d}),r.map(t=>{switch(t){case"font":/* @__PURE__ */
|
|
23
|
+
return G(Z,{value:f.font,fonts:a,words:c,readOnly:m,set:h},t);case"color":/* @__PURE__ */
|
|
24
|
+
return G(q,{value:f.color,hex:y,colours:i,words:c,readOnly:m,set:h},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==v?.italic;/* @__PURE__ */
|
|
25
|
+
return D("div",{className:"es-ts-set","data-ts-setting":t,children:[
|
|
26
|
+
/* @__PURE__ */G("span",{className:"es-ts-sub",children:c.settings.emphasis}),
|
|
27
|
+
/* @__PURE__ */D("div",{className:"es-ts-icons",children:[l(c.bold,/* @__PURE__ */G(T,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>h({weight:e?400:700}),children:/* @__PURE__ */G(M,{size:16})})),m||a?l(c.italic,/* @__PURE__ */G(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),disabled:m,onClick:()=>h({italic:!s.italic||void 0}),children:/* @__PURE__ */G(j,{size:16})})):/* @__PURE__ */G(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */G(j,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
|
|
28
|
+
return G(K,{value:f.letterCase??s.letterCase,auto:S("letterCase"),words:c,readOnly:m,set:h},t);case"largestSize":return"heading"===e.kind?z(t):null;case"size":return u?(()=>{const e=g.size;/* @__PURE__ */
|
|
29
|
+
return G("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */G(n,{label:c.settings.size,value:f.sizePhone,onChange:e=>h({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:k,readOnly:m})},"size")})():z(t);default:return z(t)}})]})}function Z({value:e,fonts:s,words:t,readOnly:a,set:n}){const l=z();/* @__PURE__ */
|
|
30
|
+
return D("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
31
|
+
/* @__PURE__ */G("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
|
|
32
|
+
/* @__PURE__ */G(b,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:l,readOnly:a})]})}function q({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
|
|
33
|
+
return G(F,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function K({value:e,auto:s,words:t,readOnly:a,set:n}){const i=s?["auto",...v]:v,r=e??(s?"auto":"none"),o=E([]),d=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
|
|
34
|
+
return D("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
|
|
35
|
+
/* @__PURE__ */G("span",{className:"es-ts-sub",children:t.settings.letterCase}),
|
|
36
|
+
/* @__PURE__ */G("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(i.indexOf(r)+s+i.length)%i.length;d(i[t]),o.current[t]?.focus()},children:i.map((e,s)=>{const n=e===r;if("auto"===e)return l(t.case.autoTitle,/* @__PURE__ */G(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon es-ts-icon--word","aria-checked":n,"aria-label":t.case.auto,tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:t.case.auto},e));const i=U[e];return l(t.case[e],/* @__PURE__ */G(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon","aria-checked":n,"aria-label":t.case[e],tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:/* @__PURE__ */G(i,{size:16})},e))})})]})}export{F as ColourSwatchRow,B as TextStyleItem,R as TextStylesGroup,H as TextStylesList};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { T as TextStylesWords } from '../words-gIDCeRv3.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The text styles as data (plan step E6): what a style is, the list both
|
|
5
|
+
* editors start from, the design's ranges, and the pure changes the list
|
|
6
|
+
* makes. No React and no browser global, so P3 and S2 can use it where they
|
|
7
|
+
* read and write their own storage.
|
|
8
|
+
*
|
|
9
|
+
* What this does NOT know is where a host keeps its styles, or what its old
|
|
10
|
+
* values were called. Turning an email's "Label" into Body 5, or the website's
|
|
11
|
+
* "Tight" into 95 % / −0.01 em, is the host's (P3, S2). The units here are the
|
|
12
|
+
* panel's: px, and % for line spacing.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type TextStyleKind = 'heading' | 'body';
|
|
16
|
+
/**
|
|
17
|
+
* The letter cases, in the panel's order: As typed · Uppercase · Capitalized ·
|
|
18
|
+
* Lowercase (Lewis 2026-10-15, S4: Capitalized is kept in both editors). This
|
|
19
|
+
* is the ONE list of them: the text styles, the text part panel and every host
|
|
20
|
+
* read it, so a case cannot be offered in one place and dropped in another.
|
|
21
|
+
* No value on a style = Auto where the host offers it, As typed where not.
|
|
22
|
+
*/
|
|
23
|
+
declare const TEXT_STYLE_CASES: readonly ["none", "upper", "capitalize", "lower"];
|
|
24
|
+
type TextStyleCase = (typeof TEXT_STYLE_CASES)[number];
|
|
25
|
+
/**
|
|
26
|
+
* The CSS `text-transform` each case draws. `none` is a real declaration, so a
|
|
27
|
+
* case can beat a built-in uppercase class. A host that stores the CSS word
|
|
28
|
+
* itself (the campaign designer's boxes) turns it back with
|
|
29
|
+
* {@link textStyleCaseOfCss}; it never keeps a table of its own.
|
|
30
|
+
*/
|
|
31
|
+
declare const TEXT_STYLE_CASE_CSS: {
|
|
32
|
+
readonly none: "none";
|
|
33
|
+
readonly upper: "uppercase";
|
|
34
|
+
readonly capitalize: "capitalize";
|
|
35
|
+
readonly lower: "lowercase";
|
|
36
|
+
};
|
|
37
|
+
type TextStyleCaseCss = (typeof TEXT_STYLE_CASE_CSS)[TextStyleCase];
|
|
38
|
+
/** True for one of the four cases, and for nothing else a document may hold. */
|
|
39
|
+
declare function isTextStyleCase(value: unknown): value is TextStyleCase;
|
|
40
|
+
/** The `text-transform` a case draws, or `undefined` for no case (or a word
|
|
41
|
+
* that is not one of the four). */
|
|
42
|
+
declare function textStyleCaseCss(value: unknown): TextStyleCaseCss | undefined;
|
|
43
|
+
/** The case a `text-transform` word is, or `undefined` for anything else
|
|
44
|
+
* (`full-width`, an empty string, junk). */
|
|
45
|
+
declare function textStyleCaseOfCss(css: unknown): TextStyleCase | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* One style's own settings. A missing key has nothing of its own: it is Auto
|
|
48
|
+
* where the host offers Auto for that setting, and otherwise shows the host's
|
|
49
|
+
* `fallback`, grey.
|
|
50
|
+
*/
|
|
51
|
+
interface TextStyleValues {
|
|
52
|
+
/** A font's `value`, from the host's list. */
|
|
53
|
+
font?: string;
|
|
54
|
+
/** A theme colour's `key`, or a `#rrggbb`. */
|
|
55
|
+
color?: string;
|
|
56
|
+
/** px. */
|
|
57
|
+
size?: number;
|
|
58
|
+
/** 100–900. */
|
|
59
|
+
weight?: number;
|
|
60
|
+
italic?: boolean;
|
|
61
|
+
/** % of the font size; below 100 is tighter than the type. */
|
|
62
|
+
lineSpacing?: number;
|
|
63
|
+
/** px; may be negative. */
|
|
64
|
+
letterSpacing?: number;
|
|
65
|
+
/** px. */
|
|
66
|
+
paragraphSpacing?: number;
|
|
67
|
+
letterCase?: TextStyleCase;
|
|
68
|
+
/** px; headings only — the largest a heading is drawn anywhere on the site. */
|
|
69
|
+
largestSize?: number;
|
|
70
|
+
/**
|
|
71
|
+
* px; the size on a PHONE (Lewis 2026-10-19: Heading 1 at 106 px on a 390 px
|
|
72
|
+
* screen). Absent = the phone draws `size`. Edited on the Size row itself,
|
|
73
|
+
* in the phone view (`TextStylesList`'s `device`), never as a row of its own.
|
|
74
|
+
*/
|
|
75
|
+
sizePhone?: number;
|
|
76
|
+
}
|
|
77
|
+
/** Which view the list edits: the phone view's Size row writes `sizePhone`. */
|
|
78
|
+
type TextStyleDevice = 'desktop' | 'phone';
|
|
79
|
+
interface TextStyle {
|
|
80
|
+
/** The host's, stable: the list never renames an id. */
|
|
81
|
+
id: string;
|
|
82
|
+
kind: TextStyleKind;
|
|
83
|
+
/** Stored, so the host's words: "Heading 1", "Body 5". */
|
|
84
|
+
name: string;
|
|
85
|
+
values: TextStyleValues;
|
|
86
|
+
}
|
|
87
|
+
/** A font the host offers. */
|
|
88
|
+
interface TextStyleFont {
|
|
89
|
+
value: string;
|
|
90
|
+
label: string;
|
|
91
|
+
/** The CSS `font-family` the list draws the name and the preview in. */
|
|
92
|
+
family: string;
|
|
93
|
+
/** `false` when this font has no italic loaded: the Italic button is off. */
|
|
94
|
+
italic?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/** A theme colour the host offers, stored by its key. */
|
|
97
|
+
interface TextStyleColour {
|
|
98
|
+
key: string;
|
|
99
|
+
name: string;
|
|
100
|
+
/** `#rrggbb`. */
|
|
101
|
+
value: string;
|
|
102
|
+
}
|
|
103
|
+
/** Every setting an open style can show, in the order it shows them. */
|
|
104
|
+
declare const TEXT_STYLE_SETTINGS: readonly ["font", "color", "size", "weight", "emphasis", "lineSpacing", "letterSpacing", "paragraphSpacing", "letterCase", "largestSize"];
|
|
105
|
+
type TextStyleSetting = (typeof TEXT_STYLE_SETTINGS)[number];
|
|
106
|
+
/** The settings an Email styles list shows — the campaign design page. */
|
|
107
|
+
declare const CAMPAIGN_TEXT_STYLE_SETTINGS: readonly TextStyleSetting[];
|
|
108
|
+
/** The settings that may be Auto, when the host says so (Site styles). */
|
|
109
|
+
type TextStyleAuto = 'size' | 'lineSpacing' | 'letterSpacing' | 'letterCase';
|
|
110
|
+
/** The kinds, in the order the list draws them. */
|
|
111
|
+
declare const TEXT_STYLE_KINDS: readonly TextStyleKind[];
|
|
112
|
+
/** At most this many of EACH kind (Lewis, 2026-10-02). */
|
|
113
|
+
declare const TEXT_STYLE_MAX = 7;
|
|
114
|
+
/** How many of each the list starts with: Heading 1–3, Body 1–5. */
|
|
115
|
+
declare const TEXT_STYLE_DEFAULT_COUNT: Readonly<Record<TextStyleKind, number>>;
|
|
116
|
+
/** A number setting's slider: its travel, the typed limits, the steps and the unit. */
|
|
117
|
+
interface TextStyleRange {
|
|
118
|
+
/** The lowest a typed value may be; `undefined` = no limit. */
|
|
119
|
+
min: number | undefined;
|
|
120
|
+
/** The highest a typed value may be; `undefined` = no limit. */
|
|
121
|
+
max: number | undefined;
|
|
122
|
+
sliderMin: number;
|
|
123
|
+
sliderMax: number;
|
|
124
|
+
step: number;
|
|
125
|
+
shiftStep: number;
|
|
126
|
+
unit: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The design's numbers (campaign page, "the three boxes' rules" and the slider
|
|
130
|
+
* ranges; website page §5). A typed value may go past the slider; only `min`
|
|
131
|
+
* and `max` hold it. Line spacing down to 50 % and letter spacing down to
|
|
132
|
+
* −10 px are Lewis's (2026-10-06).
|
|
133
|
+
*/
|
|
134
|
+
declare const TEXT_STYLE_RANGES: {
|
|
135
|
+
readonly size: TextStyleRange;
|
|
136
|
+
readonly weight: {
|
|
137
|
+
readonly min: 100;
|
|
138
|
+
readonly max: 900;
|
|
139
|
+
readonly sliderMin: 300;
|
|
140
|
+
readonly sliderMax: 900;
|
|
141
|
+
readonly step: 100;
|
|
142
|
+
readonly shiftStep: 100;
|
|
143
|
+
readonly unit: "";
|
|
144
|
+
};
|
|
145
|
+
readonly lineSpacing: {
|
|
146
|
+
readonly min: 50;
|
|
147
|
+
readonly max: 250;
|
|
148
|
+
readonly sliderMin: 50;
|
|
149
|
+
readonly sliderMax: 250;
|
|
150
|
+
readonly step: 1;
|
|
151
|
+
readonly shiftStep: 10;
|
|
152
|
+
readonly unit: "%";
|
|
153
|
+
};
|
|
154
|
+
readonly letterSpacing: {
|
|
155
|
+
readonly min: -10;
|
|
156
|
+
readonly max: undefined;
|
|
157
|
+
readonly sliderMin: -5;
|
|
158
|
+
readonly sliderMax: 10;
|
|
159
|
+
readonly step: 0.1;
|
|
160
|
+
readonly shiftStep: 1;
|
|
161
|
+
readonly unit: "px";
|
|
162
|
+
};
|
|
163
|
+
readonly paragraphSpacing: {
|
|
164
|
+
readonly min: 0;
|
|
165
|
+
readonly max: undefined;
|
|
166
|
+
readonly sliderMin: 0;
|
|
167
|
+
readonly sliderMax: 48;
|
|
168
|
+
readonly step: 1;
|
|
169
|
+
readonly shiftStep: 10;
|
|
170
|
+
readonly unit: "px";
|
|
171
|
+
};
|
|
172
|
+
readonly largestSize: TextStyleRange;
|
|
173
|
+
};
|
|
174
|
+
type TextStyleNumber = keyof typeof TEXT_STYLE_RANGES;
|
|
175
|
+
/** Heading 1–3 then Body 1–5, ids `heading-1` … `body-5`, no values: the host fills them. */
|
|
176
|
+
declare function defaultTextStyles(name?: (v: {
|
|
177
|
+
kind: TextStyleKind;
|
|
178
|
+
n: number;
|
|
179
|
+
}) => string): TextStyle[];
|
|
180
|
+
/** Whether another style of this kind fits under the cap. */
|
|
181
|
+
declare function canAddTextStyle(styles: readonly TextStyle[], kind: TextStyleKind, max?: number): boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Whether a style is one the list starts with (Heading 1–3, Body 1–5), which
|
|
184
|
+
* can never be deleted. Decided by the fixed id (`heading-1` … `body-5`),
|
|
185
|
+
* never by the name: a host's words name the styles.
|
|
186
|
+
*/
|
|
187
|
+
declare function isDefaultTextStyle(style: TextStyle): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* A new style of `kind`, after the last one of that kind: a copy of that
|
|
190
|
+
* one's values, named the next free number ("Heading 4"). `null` at the cap.
|
|
191
|
+
* The list given is not changed.
|
|
192
|
+
*
|
|
193
|
+
* The name and the id are chosen apart. The name is the next number after
|
|
194
|
+
* the styles of its kind, skipping a name already taken, so after a delete
|
|
195
|
+
* the names have no gap. The id is above every id of its kind
|
|
196
|
+
* (`heading-7` when `heading-6` is there), and the name's number when that
|
|
197
|
+
* is higher. So an id freed by a delete is used again only when it was the
|
|
198
|
+
* highest of its kind, and then the new style is a copy of the one that
|
|
199
|
+
* id's text was already drawn as (`resolveTextStyle`): nothing on the page
|
|
200
|
+
* jumps.
|
|
201
|
+
*
|
|
202
|
+
* `make` lets a host build the new style itself (its own ids); it gets the
|
|
203
|
+
* kind and the number the new style is called.
|
|
204
|
+
*/
|
|
205
|
+
declare function addTextStyle(styles: readonly TextStyle[], kind: TextStyleKind, options?: {
|
|
206
|
+
max?: number;
|
|
207
|
+
name?: (v: {
|
|
208
|
+
kind: TextStyleKind;
|
|
209
|
+
n: number;
|
|
210
|
+
}) => string;
|
|
211
|
+
make?: (kind: TextStyleKind, n: number) => TextStyle;
|
|
212
|
+
}): {
|
|
213
|
+
styles: TextStyle[];
|
|
214
|
+
added: TextStyle;
|
|
215
|
+
} | null;
|
|
216
|
+
/**
|
|
217
|
+
* The list without one ADDED style. `null` for a default (they are never
|
|
218
|
+
* deleted) or an id not in the list. The list given is not changed.
|
|
219
|
+
*
|
|
220
|
+
* The styles of its kind after it close the gap by NAME — "Heading 5" becomes
|
|
221
|
+
* "Heading 4" — when their name is still the number of their place. Their
|
|
222
|
+
* ids never change, so text on them stays on them. Text on the deleted one
|
|
223
|
+
* is not rewritten: `resolveTextStyle` draws it as the nearest earlier style
|
|
224
|
+
* of its kind.
|
|
225
|
+
*
|
|
226
|
+
* `name` is the host's words for a style's name, as `addTextStyle` takes it.
|
|
227
|
+
*/
|
|
228
|
+
declare function removeTextStyle(styles: readonly TextStyle[], id: string, options?: {
|
|
229
|
+
name?: (v: {
|
|
230
|
+
kind: TextStyleKind;
|
|
231
|
+
n: number;
|
|
232
|
+
}) => string;
|
|
233
|
+
}): {
|
|
234
|
+
styles: TextStyle[];
|
|
235
|
+
removed: TextStyle;
|
|
236
|
+
} | null;
|
|
237
|
+
/**
|
|
238
|
+
* The style text on `id` draws as: that style, or — when it was deleted —
|
|
239
|
+
* the nearest EARLIER style of its kind still in the list (`heading-5` gone:
|
|
240
|
+
* Heading 4's id, else `heading-3`). The defaults are never deleted, so an
|
|
241
|
+
* id the model made always finds one. `undefined` for an id the model did
|
|
242
|
+
* not make (a host's own, through `make`): that host resolves its own.
|
|
243
|
+
*
|
|
244
|
+
* Read every stored style id through this, so a deleted style's text keeps
|
|
245
|
+
* drawing — in a saved page and in a sent email alike — and nothing stored
|
|
246
|
+
* is rewritten.
|
|
247
|
+
*/
|
|
248
|
+
declare function resolveTextStyle(styles: readonly TextStyle[], id: string): TextStyle | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* The list with one style's values changed. A key given as `undefined` is
|
|
251
|
+
* removed: the setting has nothing of its own again. Nothing is changed in
|
|
252
|
+
* place, and the other styles are the same objects.
|
|
253
|
+
*/
|
|
254
|
+
declare function updateTextStyle(styles: readonly TextStyle[], id: string, patch: Partial<TextStyleValues>): TextStyle[];
|
|
255
|
+
/** The size a style's NAME is drawn at in the list: half its size plus 6, kept within 12–20 px. */
|
|
256
|
+
declare function textStyleRowSize(px: number): number;
|
|
257
|
+
/** A weight's name, by the hundred it is nearest. */
|
|
258
|
+
declare function weightWord(weight: number, words: TextStylesWords): string;
|
|
259
|
+
/**
|
|
260
|
+
* A row's grey line, "Playfair Display · 28 px · Semibold". `autoSize`: a
|
|
261
|
+
* size with no number reads the Auto word. A weight with none is Regular.
|
|
262
|
+
*/
|
|
263
|
+
declare function describeTextStyle(values: TextStyleValues, fonts: readonly TextStyleFont[], words: TextStylesWords, options?: {
|
|
264
|
+
autoSize?: boolean;
|
|
265
|
+
}): string;
|
|
266
|
+
|
|
267
|
+
export { CAMPAIGN_TEXT_STYLE_SETTINGS, TEXT_STYLE_CASES, TEXT_STYLE_CASE_CSS, TEXT_STYLE_DEFAULT_COUNT, TEXT_STYLE_KINDS, TEXT_STYLE_MAX, TEXT_STYLE_RANGES, TEXT_STYLE_SETTINGS, type TextStyle, type TextStyleAuto, type TextStyleCase, type TextStyleCaseCss, type TextStyleColour, type TextStyleDevice, type TextStyleFont, type TextStyleKind, type TextStyleNumber, type TextStyleRange, type TextStyleSetting, type TextStyleValues, addTextStyle, canAddTextStyle, defaultTextStyles, describeTextStyle, isDefaultTextStyle, isTextStyleCase, removeTextStyle, resolveTextStyle, textStyleCaseCss, textStyleCaseOfCss, textStyleRowSize, updateTextStyle, weightWord };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
.es-ts-group {
|
|
39
39
|
margin: 0 0 var(--es-space-4, 4px);
|
|
40
|
-
font-size: 11px;
|
|
40
|
+
font-size: var(--text-2xs, 11px);
|
|
41
41
|
font-weight: 600;
|
|
42
42
|
letter-spacing: 0.06em;
|
|
43
43
|
text-transform: uppercase;
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
overflow: hidden;
|
|
152
152
|
text-overflow: ellipsis;
|
|
153
153
|
white-space: nowrap;
|
|
154
|
-
font-size: 12px;
|
|
154
|
+
font-size: var(--text-xs, 12px);
|
|
155
155
|
line-height: 1.4;
|
|
156
156
|
color: var(--es-muted, var(--ink-faint));
|
|
157
157
|
}
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
overflow: hidden;
|
|
197
197
|
text-overflow: ellipsis;
|
|
198
198
|
white-space: nowrap;
|
|
199
|
-
font-size: 12px;
|
|
199
|
+
font-size: var(--text-xs, 12px);
|
|
200
200
|
font-weight: 500;
|
|
201
201
|
color: var(--es-text-secondary, var(--ink));
|
|
202
202
|
}
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
.es-ts-icon--word {
|
|
241
241
|
width: auto;
|
|
242
242
|
padding: 0 var(--es-space-8, 8px);
|
|
243
|
-
font-size: 14px;
|
|
243
|
+
font-size: var(--text-sm, 14px);
|
|
244
244
|
font-weight: 500;
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
justify-content: space-between;
|
|
263
263
|
gap: var(--es-space-8, 8px);
|
|
264
264
|
padding: var(--es-space-12, 12px) 0 0;
|
|
265
|
-
font-size: 14px;
|
|
265
|
+
font-size: var(--text-sm, 14px);
|
|
266
266
|
font-weight: 500;
|
|
267
267
|
color: var(--es-accent, var(--accent-600, var(--submit-bg)));
|
|
268
268
|
cursor: pointer;
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
.es-ts-add:disabled,
|
|
272
272
|
.es-ts-add[aria-disabled='true'] { color: var(--es-disabled, var(--ink-faintest)); cursor: not-allowed; }
|
|
273
273
|
.es-ts-count {
|
|
274
|
-
font-size: 12px;
|
|
274
|
+
font-size: var(--text-xs, 12px);
|
|
275
275
|
font-weight: 400;
|
|
276
276
|
color: var(--es-field-placeholder, var(--ink-faintest));
|
|
277
277
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MarkStyle, MarkPlaceholders } from '
|
|
1
|
+
import { MarkStyle, MarkPlaceholders } from 'efficient-shell/markup';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -86,7 +86,7 @@ declare const COPY_ALIGN_FIT: {
|
|
|
86
86
|
* the host's language (`useEaselStrings().copy.align`, 0.95.0); left out,
|
|
87
87
|
* English. */
|
|
88
88
|
declare function copyAlignOptions(allow: readonly CopyAlign[], labels?: Record<CopyAlign, string>): {
|
|
89
|
-
id: "left" | "
|
|
89
|
+
id: "left" | "center" | "right" | "justify";
|
|
90
90
|
label: string;
|
|
91
91
|
icon: ReactNode;
|
|
92
92
|
title: string;
|
|
@@ -100,7 +100,7 @@ declare function copyAlignOptions(allow: readonly CopyAlign[], labels?: Record<C
|
|
|
100
100
|
* catalogue's (`ShellStringsProvider`, `link`).
|
|
101
101
|
*
|
|
102
102
|
* NO REACT here, and no import but the grammar: the marks' names, tooltips and
|
|
103
|
-
* placeholders are READ from `efficient-
|
|
103
|
+
* placeholders are READ from `efficient-shell/markup` (`MARKUP_TOOLS`,
|
|
104
104
|
* `MARK_PLACEHOLDERS`) rather than typed a second time, so the English lives
|
|
105
105
|
* once, in the grammar, where the campaign designer's own toolbar reads it too.
|
|
106
106
|
*/
|
|
@@ -117,6 +117,10 @@ type CopyWords = {
|
|
|
117
117
|
* `name` is what the button is called; `title` its tooltip, which also says
|
|
118
118
|
* what the mark writes and its shortcut. A host's own descriptors
|
|
119
119
|
* (`MarkupTool[]`) are used as given and never read these.
|
|
120
|
+
*
|
|
121
|
+
* @deprecated Read by nothing since the copy box's one bar became the shell's
|
|
122
|
+
* `TextToolbar`, which names its buttons in the shell catalogue
|
|
123
|
+
* (`ShellStringsProvider`, `textToolbar`). Removed in 12.0.0.
|
|
120
124
|
*/
|
|
121
125
|
marks: Record<MarkStyle, {
|
|
122
126
|
name: string;
|
|
@@ -128,11 +132,13 @@ type CopyWords = {
|
|
|
128
132
|
* (E5a). Optional, so a host's words from before still type; English when
|
|
129
133
|
* left out. */
|
|
130
134
|
showMarks?: string;
|
|
131
|
-
/** Clear changes
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
+
/** "Clear changes": the Style list's item in the one text panel
|
|
136
|
+
* (`TextPartPanel`). It was also a button on the line under the box until
|
|
137
|
+
* Lewis took that out (2026-10-19). Optional, so a host's words from before
|
|
138
|
+
* still type; English when left out. */
|
|
135
139
|
clearStyle?: string;
|
|
140
|
+
/** @deprecated The tooltip of the button under the box, which is gone
|
|
141
|
+
* (2026-10-19). Read by nothing; removed in 12.0.0. */
|
|
136
142
|
clearStyleEmpty?: string;
|
|
137
143
|
/** The colour window: its name, the theme row's label, and Remove. */
|
|
138
144
|
colors?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -102,6 +102,11 @@
|
|
|
102
102
|
"import": "./dist/text-styles/index.js",
|
|
103
103
|
"default": "./dist/text-styles/index.js"
|
|
104
104
|
},
|
|
105
|
+
"./text-styles/model": {
|
|
106
|
+
"types": "./dist/text-styles/model.d.ts",
|
|
107
|
+
"import": "./dist/text-styles/model.js",
|
|
108
|
+
"default": "./dist/text-styles/model.js"
|
|
109
|
+
},
|
|
105
110
|
"./text-styles.css": "./dist/text-styles/text-styles.css",
|
|
106
111
|
"./easel": {
|
|
107
112
|
"types": "./dist/easel/index.d.ts",
|
|
@@ -527,7 +532,7 @@
|
|
|
527
532
|
"dist"
|
|
528
533
|
],
|
|
529
534
|
"peerDependencies": {
|
|
530
|
-
"efficient-shell": "^7.
|
|
535
|
+
"efficient-shell": "^7.69.1",
|
|
531
536
|
"react": ">=18",
|
|
532
537
|
"react-dom": ">=18"
|
|
533
538
|
},
|
|
@@ -537,7 +542,7 @@
|
|
|
537
542
|
"@types/node": "^22.0.0",
|
|
538
543
|
"@types/react": "^18.2.0",
|
|
539
544
|
"@types/react-dom": "^18.2.0",
|
|
540
|
-
"efficient-shell": "^7.
|
|
545
|
+
"efficient-shell": "^7.69.1",
|
|
541
546
|
"esbuild": "^0.27.0",
|
|
542
547
|
"jsdom": "^26.1.0",
|
|
543
548
|
"react": "^18.2.0",
|
package/dist/chunk-26GHWMNN.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{TreeSeam as e}from"./chunk-4JSBIW5H.js";import{SETTINGS_BUCKETS as n,SettingsGroup as l}from"./chunk-RC25EGHD.js";import{DEFAULT_TREE_WORDS as t}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as a}from"./chunk-KFV7N2DJ.js";import{EaselMenuItems as r}from"./chunk-EA2HTX37.js";import{FieldNumber as o}from"./chunk-66LWADFP.js";import{FieldSelect as i}from"./chunk-65Z5FSAW.js";import{SettingsField as s,SettingsSegmented as c}from"./chunk-XJCMEEBH.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-FFYXVAAL.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{useTreeDrag as m,gapToMoveIndex as p}from"./chunk-67GNT6PF.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{Textarea as f,Input as b,SortableList as g,ListRow as v,ContextMenu as y,tabPanelId as k,Tabs as x,tabButtonId as w}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as N,useState as C,useLayoutEffect as O,useId as $}from"react";import{jsx as j,jsxs as S}from"react/jsx-runtime";import{ChevronIcon as D,LockIcon as I,MoveUpIcon as F,MoveDownIcon as L,DuplicateIcon as P,TrashIcon as A}from"efficient-shell/icons/efficient";function E({id:e,value:n,onChange:l,placeholder:t,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */j(f,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:t,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>l(e.target.value)}):/* @__PURE__ */j(b,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:t,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>l(e.target.value)})}function M(e,n,l){const t=e.slice();return t.splice(Math.max(0,Math.min(n,t.length)),0,l),t}function T(e,n,l){const t=e.slice(),[a]=t.splice(n,1);return t.splice(Math.max(0,Math.min(l,t.length)),0,a),t}function H(e,n){return e.filter((e,l)=>l!==n)}function R(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var z='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function J({label:n,icon:l,noun:a,items:o,onChange:i,newItem:s,summary:c,itemName:f,thumb:b,min:k=0,max:x,readOnly:w=!1,open:$,onOpen:E,renderItem:J,renderRow:K,canRemove:Y,lockedReason:V,fixed:W=!1,removeOnRow:X=!0,canDuplicate:G,above:Z,head:q=!0}){const Q=u("fields",d).list,U=u("tree",t),_=a??Q.item,ee=!w&&!W&&("number"!=typeof x||o.length<x),ne=o.length<=k,le=e=>!!Y&&!Y(o[e],e),te=e=>!w&&!W&&X&&!ne&&!le(e),ae=e=>ee&&(!G||G(o[e],e)),re=(e,n)=>f?f(e,n):Q.itemName({noun:_,n:n+1}),oe=N([]),ie=N(null),[se,ce]=C(null),de=N(null),[ue,me]=C(null),[pe,he]=C("");O(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(z)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=o.length||n===e)return;const l=oe.current[e],t=l?.ownerDocument.activeElement;if(l&&t&&l.contains(t)){const e=[...l.querySelectorAll(z)].indexOf(t),a=t;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(T(o,e,n));const a=function(e,n,l){return null===e?null:e===n?l:n<e&&l>=e?e-1:n>e&&l<=e?e+1:e}($,e,n);a!==$&&E(a),he(Q.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(M(o,e,s())),K?(ie.current={index:e,nth:0,start:null,end:null},null!==$&&$>=e&&E($+1)):E(e))},ge=e=>{te(e)&&(i(H(o,e)),$===e?E(null):null!==$&&$>e&&E($-1))},ve=m({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const l=p({...B,index:e},n);l!==e&&fe(e,l)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Q.moveUp,icon:/* @__PURE__ */j(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Q.moveDown,icon:/* @__PURE__ */j(L,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Q.duplicate,icon:/* @__PURE__ */j(P,{size:14}),onClick:()=>(e=>{ae(e)&&(i(M(o,e+1,R(o[e]))),null!==$&&$>e&&E($+1))})(e)}),te(e)&&n.push({label:Q.delete,icon:/* @__PURE__ */j(A,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,l,t)=>{w||0===ye(e).length||me({index:e,x:n,y:l,owner:t})},xe=e=>n=>{const l=o.slice();l[e]=n,i(l)};/* @__PURE__ */
|
|
2
|
-
return S("div",{className:"es-list",children:[q?/* @__PURE__ */S("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */S("span",{className:"es-list-label",children:[l?/* @__PURE__ */j("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,n]}),
|
|
4
|
-
/* @__PURE__ */j("span",{className:"es-list-count",children:o.length})]}):null,Z?/* @__PURE__ */j("div",{className:"es-list-above",children:Z}):null,o.length?/* @__PURE__ */S(g,{"aria-label":n,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((n,l)=>{const t=ve.row({item:l,place:{...B,index:l}}),a=t.draggable&&se!==l,r=!K&&$===l,o=!w&&!W&&X&&le(l),i=["es-list-row",K?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[l>0?/* @__PURE__ */j(e,{...ve.seam({place:{...B,index:l}}),onAdd:ee?()=>be(l):void 0,label:Q.addHere({noun:_})},`seam-${l}`):null,
|
|
5
|
-
/* @__PURE__ */j(v,{className:i,flat:!!K,active:r,draggable:t.draggable,dragHint:U.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>fe(l,"up"===e?l-1:l+1):void 0,rowRef:e=>{oe.current[l]=e},rowProps:{...t.rowProps,draggable:a||void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!a,de.current=n&&!a?n:null,ce(a?l:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(l,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,t=e=>e.preventDefault();n.addEventListener("contextmenu",t,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",t,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(l,a.left+24,a.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:w||W||!X?void 0:o?h(V?V(n,l):Q.locked,/* @__PURE__ */j("span",{className:"es-list-lock",role:"img","aria-label":V?V(n,l):Q.locked,children:/* @__PURE__ */j(I,{size:13})})):h(Q.deleteItem({noun:_}),/* @__PURE__ */j("button",{type:"button",className:"es-list-x","aria-label":Q.deleteItem({noun:_}),disabled:!te(l),onClick:()=>ge(l),children:"×"})),below:r?/* @__PURE__ */j("div",{className:"es-list-item",children:J(n,l,xe(l))}):void 0,children:K?/* @__PURE__ */j("div",{className:"es-list-row-main",children:K(n,l,xe(l))}):/* @__PURE__ */S("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>E(r?null:l),children:[b?/* @__PURE__ */j("span",{className:"es-list-thumb","aria-hidden":"true",children:b(n,l)}):null,
|
|
6
|
-
/* @__PURE__ */j("span",{className:"es-list-row-name",children:re(n,l)}),/* @__PURE__ */j("span",c?{className:"es-list-row-summary",children:c(n,l)}:{className:"es-list-row-summary"}),
|
|
7
|
-
/* @__PURE__ */j(D,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},l)]}),
|
|
8
|
-
/* @__PURE__ */j(e,{...ve.seam({place:{...B,index:o.length}})})]}):null,w||W?null:/* @__PURE__ */j("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Q.add({noun:_})}),
|
|
9
|
-
/* @__PURE__ */j("span",{className:"es-list-said","aria-live":"polite",children:pe}),ue&&ue.index<o.length?
|
|
10
|
-
/* @__PURE__ */j(y,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),children:/* @__PURE__ */j(r,{items:ye(ue.index),onClose:()=>me(null)})}):null]})}var K=e=>e<6?e+1:6,Y=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function V({field:e,name:n,id:t,value:a,onChange:r,readOnly:o,context:i,renderers:s,headingLevel:c=3}){const[d,u]=C(!0),m=a&&"object"==typeof a?a:{};/* @__PURE__ */
|
|
11
|
-
return j(l,{id:`${t}-group`,title:Y(e,n),open:d,onToggle:u,level:c,children:Object.entries(e.objectFields).map(([e,l])=>/* @__PURE__ */j(X,{field:l,name:`${n}.${e}`,id:`${t}-${e}`,value:m[e],onChange:n=>r({...m,[e]:n}),readOnly:o,context:i,renderers:s,headingLevel:K(c)},e))})}function W({field:e,name:n,id:l,value:t,onChange:a,readOnly:r,context:o,renderers:i,openItem:s,onOpenItem:c,headingLevel:d}){const[u,m]=C(null),p=c?s??null:u,h=c??m,f=Array.isArray(t)?t:[],b=e.getItemSummary;/* @__PURE__ */
|
|
12
|
-
return j(J,{label:Y(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:f,onChange:a,newItem:()=>R({...e.defaultItemProps??{}}),summary:b?(e,n)=>b(e,n):void 0,min:e.min,max:e.max,readOnly:r,open:p,onOpen:h,renderItem:(t,a,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */j(X,{field:c,name:`${n}[${a}].${e}`,id:`${l}-${a}-${e}`,value:t?.[e],onChange:n=>s({...t,[e]:n}),readOnly:r,context:o,renderers:i,headingLevel:d},e))})}function X(e){const{field:n,name:l,id:t,value:a,onChange:r,readOnly:d,context:u,renderers:m}=e;if(!n||n.marker||!1===n.visible)return null;const p=m?.[n.type];if(p)return p({field:n,name:l,id:t,value:a,onChange:r,readOnly:d});switch(n.type){case"custom":{const e={...u,field:n,name:l,id:t,value:a,onChange:r,readOnly:d};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
-
return j(s,{label:Y(n,l),htmlFor:t,icon:n.icon,hint:n.hint,children:/* @__PURE__ */j(E,{id:t,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:d})});case"number":/* @__PURE__ */
|
|
14
|
-
return j(s,{label:Y(n,l),htmlFor:t,icon:n.icon,hint:n.hint,children:/* @__PURE__ */j(o,{id:t,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:d})});case"select":{const e=`${t}-label`;/* @__PURE__ */
|
|
15
|
-
return j(s,{label:Y(n,l),labelId:e,htmlFor:t,icon:n.icon,hint:n.hint,children:/* @__PURE__ */j(i,{id:t,value:a,options:n.options,onChange:r,readOnly:d,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
-
return j(s,{label:Y(n,l),icon:n.icon,hint:n.hint,children:/* @__PURE__ */j(c,{ariaLabel:Y(n,l),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||d})),onChange:e=>{d||r(e)}})});case"object":/* @__PURE__ */
|
|
17
|
-
return j(V,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
-
return j(W,{...e,field:n});case"slot":return null}}var G=e=>n.includes(e);function Z(e){let l,t=n[0];const a=[],r=/* @__PURE__ */new Set;for(const[n,o]of Object.entries(e))o&&(G(o.bucket)&&((o.marker||o.bucket!==t)&&(l=void 0),t=o.bucket),o.marker&&"string"==typeof o.fold?l={key:n,title:o.fold}:o.marker&&!1===o.fold&&(l=void 0),o.marker||!1===o.visible||(a.push(l?{name:n,field:o,bucket:t,fold:l}:{name:n,field:o,bucket:t}),"slot"!==o.type&&r.add(t)));return{rows:a,buckets:n.filter(e=>r.has(e))}}function q(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function Q(e){const n=[];for(const l of e){const e=n[n.length-1];e&&e.fold?.key===l.fold?.key?e.rows.push(l):n.push({fold:l.fold,rows:[l]})}return n}function U({fields:e,values:n,onChange:t,readOnly:r=!1,context:o,tab:i,onTab:s,tabs:c=!0,tabIcons:d,renderers:m,idPrefix:p,ariaLabel:h,lead:f,children:b,leadFold:g,closedFolds:v,onFold:y,headingLevel:N=3}){const O=u("panel",a),D=$(),I=p??`es-insp${D.replace(/:/g,"")}`,F=Z(e),[L,P]=C(void 0),A=i??L,E=A&&F.buckets.includes(A)?A:F.buckets[0],[M,T]=C(null),H=M&&M.panel===I&&F.rows.some(e=>e.name===M.name)?M:null,R=c&&F.buckets.length>1,z=R&&E?k(I,E):`${I}-rows`,[B,J]=C(()=>/* @__PURE__ */new Set),Y=v??B,V=(e,n)=>{/* @__PURE__ */return j(l,{title:e.title,open:!Y.has(e.key),onToggle:n=>((e,n)=>{void 0===v&&J(l=>{const t=new Set(l);return n?t.delete(e):t.add(e),t}),y?.(e,n)})(e.key,n),id:`${I}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:N,children:n});var t},W=e=>R&&e!==E,G=({name:e,field:l,bucket:a,fold:i})=>/* @__PURE__ */j("div",{className:"es-insp-row","data-field":e,"data-bucket":a,hidden:!!W(a)||void 0,children:/* @__PURE__ */j(X,{field:l,name:e,id:`${I}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:r,context:o,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>T(null===n?null:{panel:I,name:e,index:n}),headingLevel:i?K(N):N})},e);/* @__PURE__ */
|
|
19
|
-
return S("div",{className:"es-insp",children:[R?/* @__PURE__ */j("div",{className:"es-insp-tabs",children:/* @__PURE__ */j(x,{variant:"underline",block:!0,"aria-label":h??O.settings,idPrefix:I,value:E,onChange:e=>{const n=e;void 0===i&&P(n),s?.(n)},items:F.buckets.map(e=>{const n=O.buckets[e],l=d?.[e];return l?{id:e,icon:l,label:/* @__PURE__ */j("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
|
-
/* @__PURE__ */S("div",{className:"es-insp-rows",id:z,role:R?"tabpanel":void 0,"aria-labelledby":R&&E?w(I,E):void 0,children:[f?g?/* @__PURE__ */j("div",{className:"es-insp-band","data-fold":g.key,children:V(g,f)}):f:null,Q(F.rows).map((e,n)=>{if(!e.fold)return e.rows.map(G);const l=e.rows[0].bucket,t=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
|
-
return j("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":l,hidden:!(!W(l)&&!t)||void 0,children:V(e.fold,e.rows.map(G))},`fold-${e.fold.key}-${n}`)}),b]})]})}export{E as FieldText,U as Inspector,X as InspectorField,J as ListField,q as bucketsOf,R as copyItem,M as insertAt,Y as labelOf,T as moveTo,Z as planFields,H as removeAt};
|