efficient-easel 10.2.0 → 10.3.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.
@@ -296,6 +296,40 @@ interface TextStylesListProps {
296
296
  * email or a storefront keeps its styles, nor what they were once called.
297
297
  */
298
298
  declare function TextStylesList({ styles, onChange, fonts, colours, settings, auto, fallback, sample, openId, defaultOpenId, onOpenChange, onAdd, rowActions, onRemove, max, readOnly, }: TextStylesListProps): react.JSX.Element;
299
+ interface TextStylesGroupProps {
300
+ /** The group's name: "Headings", "Body", or a host's own ("Accent"). */
301
+ label: ReactNode;
302
+ children?: ReactNode;
303
+ }
304
+ /** A group of styles under its heading, as the list draws Headings and Body. */
305
+ declare function TextStylesGroup({ label, children }: TextStylesGroupProps): react.JSX.Element;
306
+ interface TextStyleItemProps {
307
+ style: TextStyle;
308
+ fonts: readonly TextStyleFont[];
309
+ colours?: readonly TextStyleColour[];
310
+ /** Which settings the open style shows, in the design's order. Left out: the campaign's set. */
311
+ settings?: readonly TextStyleSetting[];
312
+ /** Which settings may be Auto. */
313
+ auto?: readonly TextStyleAuto[];
314
+ /** The numbers shown grey for a setting with nothing of its own. */
315
+ fallback?: (style: TextStyle) => TextStyleValues;
316
+ sample?: string;
317
+ open: boolean;
318
+ onOpenChange: (open: boolean) => void;
319
+ /** The whole style after one change. */
320
+ onChange: (next: TextStyle) => void;
321
+ /** Buttons at the end of the row, outside the button that opens it. */
322
+ actions?: ReactNode;
323
+ readOnly?: boolean;
324
+ }
325
+ /**
326
+ * ONE STYLE, DRAWN EXACTLY AS THE LIST DRAWS IT (GG 2026-10-16, one grammar):
327
+ * the row (chevron, the name in its own face, the grey line) and, open, the
328
+ * preview and the settings. `TextStylesList` draws every style through this,
329
+ * so a host's style that is not in the list (the website's Accent) looks and
330
+ * works the same, with no second copy.
331
+ */
332
+ declare function TextStyleItem({ style, fonts, colours, settings, auto, fallback, sample, open, onOpenChange, onChange, actions, readOnly, }: TextStyleItemProps): react.JSX.Element;
299
333
 
300
334
  interface ColourSwatchRowProps {
301
335
  /** The stored colour: a theme colour's `key`, a `#rrggbb`, or `undefined` for none of its own. */
@@ -334,4 +368,4 @@ interface ColourSwatchRowProps {
334
368
  */
335
369
  declare function ColourSwatchRow({ value, hex, colours, label, followsWord, anyWord, onChange, readOnly }: ColourSwatchRowProps): react.JSX.Element;
336
370
 
337
- export { CAMPAIGN_TEXT_STYLE_SETTINGS, ColourSwatchRow, type ColourSwatchRowProps, TEXT_STYLE_DEFAULT_COUNT, TEXT_STYLE_KINDS, TEXT_STYLE_MAX, TEXT_STYLE_RANGES, TEXT_STYLE_SETTINGS, type TextStyle, type TextStyleAuto, type TextStyleCase, type TextStyleColour, type TextStyleFont, type TextStyleKind, type TextStyleNumber, type TextStyleRange, type TextStyleSetting, type TextStyleValues, TextStylesList, type TextStylesListProps, TextStylesWords, addTextStyle, canAddTextStyle, defaultTextStyles, describeTextStyle, isDefaultTextStyle, removeTextStyle, resolveTextStyle, textStyleRowSize, updateTextStyle, weightWord };
371
+ export { CAMPAIGN_TEXT_STYLE_SETTINGS, ColourSwatchRow, type ColourSwatchRowProps, TEXT_STYLE_DEFAULT_COUNT, TEXT_STYLE_KINDS, TEXT_STYLE_MAX, TEXT_STYLE_RANGES, TEXT_STYLE_SETTINGS, type TextStyle, type TextStyleAuto, type TextStyleCase, type TextStyleColour, type TextStyleFont, TextStyleItem, type TextStyleItemProps, type TextStyleKind, type TextStyleNumber, type TextStyleRange, type TextStyleSetting, type TextStyleValues, TextStylesGroup, type TextStylesGroupProps, TextStylesList, type TextStylesListProps, TextStylesWords, addTextStyle, canAddTextStyle, defaultTextStyles, describeTextStyle, isDefaultTextStyle, removeTextStyle, resolveTextStyle, textStyleRowSize, updateTextStyle, weightWord };
@@ -1,33 +1,35 @@
1
- import{hexReadout as e,ColourWindow as n,typedHex as t}from"../chunk-FPAVNX3Y.js";import{DEFAULT_TEXT_STYLES_WORDS as s}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-ZAOM6PFH.js";import{FieldSlider as i}from"../chunk-XWFH2NHZ.js";import{FieldSelect as a}from"../chunk-65Z5FSAW.js";import"../chunk-FFYXVAAL.js";import{useWords as l}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{hsvToHex as o,Tooltip as d,ColorSwatch as c,IconButton as u}from"efficient-shell/ui";import{useState as m,useRef as f,useId as h,useEffect as p,Fragment as v}from"react";import{ChevronIcon as g,TrashIcon as k,BoldIcon as y,ItalicIcon as b,CaseLowerIcon as x,CaseCapitalizedIcon as w,CaseUpperIcon as N,CaseNormalIcon as S}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as z,Fragment as M}from"react/jsx-runtime";var O=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],$=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],A=["heading","body"],j=7,F={heading:3,body:5},E={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},W={size:E,weight:{min:100,max:900,sliderMin:300,sliderMax:900,step:100,shiftStep:100,unit:""},lineSpacing:{min:50,max:250,sliderMin:50,sliderMax:250,step:1,shiftStep:10,unit:"%"},letterSpacing:{min:-10,max:void 0,sliderMin:-5,sliderMax:10,step:.1,shiftStep:1,unit:"px"},paragraphSpacing:{min:0,max:void 0,sliderMin:0,sliderMax:48,step:1,shiftStep:10,unit:"px"},largestSize:E},H=(e,n)=>`${"heading"===e?"Heading":"Body"} ${n}`;function L(e=({kind:e,n:n})=>H(e,n)){return A.flatMap(n=>Array.from({length:F[n]},(t,s)=>({id:`${n}-${s+1}`,kind:n,name:e({kind:n,n:s+1}),values:{}})))}function B(e,n,t=j){return e.filter(e=>e.kind===n).length<t}function D(e,n){const t=new RegExp(`^${n}-([1-9]\\d*)$`).exec(e);return t?Number(t[1]):void 0}function I(e){const n=D(e.id,e.kind);return void 0!==n&&n<=F[e.kind]}function R(e,n,t={}){const{max:s=j,name:i=({kind:e,n:n})=>H(e,n),make:a}=t;if(!B(e,n,s))return null;const l=e.filter(e=>e.kind===n);let r=l.length+1;const o=new Set(e.map(e=>e.name));for(;o.has(i({kind:n,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(D(e.id,n)??0)+1));for(;d.has(`${n}-${c}`);)c+=1;const u=l.at(-1),m=a?a(n,r):{id:`${n}-${c}`,kind:n,name:i({kind:n,n:r}),values:{...u?.values??{}}},f=u?e.indexOf(u)+1:"heading"===n?0:e.length;return{styles:[...e.slice(0,f),m,...e.slice(f)],added:m}}function T(e,n,t={}){const{name:s=({kind:e,n:n})=>H(e,n)}=t,i=e.find(e=>e.id===n);if(!i||I(i))return null;const a=e.filter(e=>e.kind===i.kind),l=a.indexOf(i),r=/* @__PURE__ */new Map;return a.forEach((e,n)=>{n>l&&e.name===s({kind:e.kind,n:n+1})&&r.set(e,s({kind:e.kind,n:n}))}),{styles:e.filter(e=>e!==i).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:i}}function V(e,n){const t=e.find(e=>e.id===n);if(t)return t;for(const t of A){const s=D(n,t);if(void 0===s)continue;let i;for(const n of e){const e=n.kind===t?D(n.id,t):void 0;void 0!==e&&e<s&&(!i||e>i.n)&&(i={n:e,style:n})}return i?.style}}function X(e,n,t){return e.map(e=>{if(e.id!==n)return e;const s={...e.values};for(const[e,n]of Object.entries(t))void 0===n?delete s[e]:s[e]=n;return{...e,values:s}})}function Y(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function Z(e,n){const t=n.weights;return[t.thin,t.extraLight,t.light,t.regular,t.medium,t.semibold,t.bold,t.extraBold,t.black][Math.min(8,Math.max(0,Math.round(e/100)-1))]}function q(e,n,t,s={}){const i=n.find(n=>n.value===e.font)?.label??e.font??"",a=void 0===e.size?s.autoSize?t.auto:"":t.px({n:e.size});return t.summary({font:i,size:a,weight:Z(e.weight??400,t)})}var G=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>o({h:e,s:1,v:1})).join(", ")})`;function P({value:t,hex:s,colours:i,label:a,followsWord:l,anyWord:r,onChange:o,readOnly:u=!1}){const[v,g]=m(!1),k=f(null),y=f(null),b=h(),x=void 0!==t&&i.some(e=>e.key===t),w=void 0!==t&&!x;return p(()=>{if(!v)return;const e=k.current?.ownerDocument;if(!e)return;const n=e=>{k.current&&!k.current.contains(e.target)&&g(!1)};return e.addEventListener("click",n,!0),()=>e.removeEventListener("click",n,!0)},[v]),/* @__PURE__ */C("div",{ref:k,className:"es-ts-set","data-ts-setting":"color",children:[
1
+ import{hexReadout as e,ColourWindow as n,typedHex as t}from"../chunk-FPAVNX3Y.js";import{DEFAULT_TEXT_STYLES_WORDS as s}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-ZAOM6PFH.js";import{FieldSlider as a}from"../chunk-XWFH2NHZ.js";import{FieldSelect as i}from"../chunk-65Z5FSAW.js";import"../chunk-FFYXVAAL.js";import{useWords as l}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{hsvToHex as o,Tooltip as d,ColorSwatch as c,IconButton as u}from"efficient-shell/ui";import{useState as m,useRef as f,useId as h,useEffect as p,Fragment as v}from"react";import{TrashIcon as g,ChevronIcon as y,BoldIcon as k,ItalicIcon as b,CaseLowerIcon as x,CaseCapitalizedIcon as w,CaseUpperIcon as S,CaseNormalIcon as N}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as z,Fragment as O}from"react/jsx-runtime";var M=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],$=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],A=["heading","body"],j=7,F={heading:3,body:5},E={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},W={size:E,weight:{min:100,max:900,sliderMin:300,sliderMax:900,step:100,shiftStep:100,unit:""},lineSpacing:{min:50,max:250,sliderMin:50,sliderMax:250,step:1,shiftStep:10,unit:"%"},letterSpacing:{min:-10,max:void 0,sliderMin:-5,sliderMax:10,step:.1,shiftStep:1,unit:"px"},paragraphSpacing:{min:0,max:void 0,sliderMin:0,sliderMax:48,step:1,shiftStep:10,unit:"px"},largestSize:E},H=(e,n)=>`${"heading"===e?"Heading":"Body"} ${n}`;function L(e=({kind:e,n:n})=>H(e,n)){return A.flatMap(n=>Array.from({length:F[n]},(t,s)=>({id:`${n}-${s+1}`,kind:n,name:e({kind:n,n:s+1}),values:{}})))}function B(e,n,t=j){return e.filter(e=>e.kind===n).length<t}function D(e,n){const t=new RegExp(`^${n}-([1-9]\\d*)$`).exec(e);return t?Number(t[1]):void 0}function I(e){const n=D(e.id,e.kind);return void 0!==n&&n<=F[e.kind]}function R(e,n,t={}){const{max:s=j,name:a=({kind:e,n:n})=>H(e,n),make:i}=t;if(!B(e,n,s))return null;const l=e.filter(e=>e.kind===n);let r=l.length+1;const o=new Set(e.map(e=>e.name));for(;o.has(a({kind:n,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(D(e.id,n)??0)+1));for(;d.has(`${n}-${c}`);)c+=1;const u=l.at(-1),m=i?i(n,r):{id:`${n}-${c}`,kind:n,name:a({kind:n,n:r}),values:{...u?.values??{}}},f=u?e.indexOf(u)+1:"heading"===n?0:e.length;return{styles:[...e.slice(0,f),m,...e.slice(f)],added:m}}function T(e,n,t={}){const{name:s=({kind:e,n:n})=>H(e,n)}=t,a=e.find(e=>e.id===n);if(!a||I(a))return null;const i=e.filter(e=>e.kind===a.kind),l=i.indexOf(a),r=/* @__PURE__ */new Map;return i.forEach((e,n)=>{n>l&&e.name===s({kind:e.kind,n:n+1})&&r.set(e,s({kind:e.kind,n:n}))}),{styles:e.filter(e=>e!==a).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:a}}function V(e,n){const t=e.find(e=>e.id===n);if(t)return t;for(const t of A){const s=D(n,t);if(void 0===s)continue;let a;for(const n of e){const e=n.kind===t?D(n.id,t):void 0;void 0!==e&&e<s&&(!a||e>a.n)&&(a={n:e,style:n})}return a?.style}}function X(e,n,t){return e.map(e=>{if(e.id!==n)return e;const s={...e.values};for(const[e,n]of Object.entries(t))void 0===n?delete s[e]:s[e]=n;return{...e,values:s}})}function Y(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function Z(e,n){const t=n.weights;return[t.thin,t.extraLight,t.light,t.regular,t.medium,t.semibold,t.bold,t.extraBold,t.black][Math.min(8,Math.max(0,Math.round(e/100)-1))]}function q(e,n,t,s={}){const a=n.find(n=>n.value===e.font)?.label??e.font??"",i=void 0===e.size?s.autoSize?t.auto:"":t.px({n:e.size});return t.summary({font:a,size:i,weight:Z(e.weight??400,t)})}var G=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>o({h:e,s:1,v:1})).join(", ")})`;function P({value:t,hex:s,colours:a,label:i,followsWord:l,anyWord:r,onChange:o,readOnly:u=!1}){const[v,g]=m(!1),y=f(null),k=f(null),b=h(),x=void 0!==t&&a.some(e=>e.key===t),w=void 0!==t&&!x;return p(()=>{if(!v)return;const e=y.current?.ownerDocument;if(!e)return;const n=e=>{y.current&&!y.current.contains(e.target)&&g(!1)};return e.addEventListener("click",n,!0),()=>e.removeEventListener("click",n,!0)},[v]),/* @__PURE__ */C("div",{ref:y,className:"es-ts-set","data-ts-setting":"color",children:[
2
2
  /* @__PURE__ */C("div",{className:"es-ts-top",children:[
3
- /* @__PURE__ */z("span",{className:"es-ts-sub",children:a}),
3
+ /* @__PURE__ */z("span",{className:"es-ts-sub",children:i}),
4
4
  /* @__PURE__ */z("span",{className:"es-ts-colour-read",children:s?e(s):l})]}),
5
- /* @__PURE__ */C("div",{className:"es-ts-swatches",role:"group","aria-label":a,children:[i.map(n=>/* @__PURE__ */z(d,{content:`${n.name} · ${e(n.value)}`,children:/* @__PURE__ */z(c,{color:n.value,size:"sm",className:"es-ts-swatch","aria-label":n.name,selected:t===n.key,disabled:u,onClick:()=>o(n.key)})},n.key)),
6
- /* @__PURE__ */z(d,{content:r,children:/* @__PURE__ */z(c,{ref:y,color:G,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:w,"aria-expanded":v,"aria-controls":v?b:void 0,disabled:u,onClick:()=>g(e=>!e)})})]}),v?/* @__PURE__ */z(n,{id:b,value:s??"",onChange:e=>o(e),label:a,readOnly:u,onClose:()=>{g(!1),y.current?.focus()}}):null]})}function _({styles:e,onChange:n,fonts:t,colours:i=[],settings:a=$,auto:o=[],fallback:d,sample:c,openId:u,defaultOpenId:y=null,onOpenChange:b,onAdd:x,rowActions:w,onRemove:N,max:S=j,readOnly:M=!1}){const F=l("textStyles",s),E=h(),[W,H]=m(y),L=void 0!==u?u:W,D=e=>{void 0===u&&H(e),b?.(e)},V=new Set(o),Z=O.filter(e=>a.includes(e)),G=f(null),[P,_]=m(null);p(()=>{if(!P||!G.current)return;const e=[...G.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===P.id),n=e?e.querySelector(".es-ts-row"):G.current.querySelector(`.es-ts-add[data-ts-kind="${P.kind}"]`);n?.focus(),_(null)},[P]);/* @__PURE__ */
7
- return z("div",{className:"es-ts",ref:G,children:A.map(s=>{const a=e.filter(e=>e.kind===s),l=`${E}-${s}`,o=!B(e,s,S),u=!M&&!o;/* @__PURE__ */
8
- return C("section",{className:"es-ts-section","aria-labelledby":l,children:[
9
- /* @__PURE__ */z("div",{className:"es-ts-group",id:l,children:F.groups[s]}),a.map(s=>{const a=L===s.id,l={...d?.(s)??{},...s.values},o=t.find(e=>e.value===l.font),u=`${E}-open-${s.id}`,m=w?.(s),f=null!=m&&!1!==m,h=Boolean(N)&&!M&&!I(s),p={fontFamily:o?.family,fontSize:`${Y(l.size??16)}px`,fontWeight:l.weight,fontStyle:l.italic?"italic":void 0};/* @__PURE__ */
5
+ /* @__PURE__ */C("div",{className:"es-ts-swatches",role:"group","aria-label":i,children:[a.map(n=>/* @__PURE__ */z(d,{content:`${n.name} · ${e(n.value)}`,children:/* @__PURE__ */z(c,{color:n.value,size:"sm",className:"es-ts-swatch","aria-label":n.name,selected:t===n.key,disabled:u,onClick:()=>o(n.key)})},n.key)),
6
+ /* @__PURE__ */z(d,{content:r,children:/* @__PURE__ */z(c,{ref:k,color:G,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:w,"aria-expanded":v,"aria-controls":v?b:void 0,disabled:u,onClick:()=>g(e=>!e)})})]}),v?/* @__PURE__ */z(n,{id:b,value:s??"",onChange:e=>o(e),label:i,readOnly:u,onClose:()=>{g(!1),k.current?.focus()}}):null]})}function _({styles:e,onChange:n,fonts:t,colours:a=[],settings:i=$,auto:o=[],fallback:d,sample:c,openId:u,defaultOpenId:v=null,onOpenChange:y,onAdd:k,rowActions:b,onRemove:x,max:w=j,readOnly:S=!1}){const N=l("textStyles",s),M=h(),[F,E]=m(v),W=void 0!==u?u:F,H=e=>{void 0===u&&E(e),y?.(e)},L=f(null),[D,V]=m(null);p(()=>{if(!D||!L.current)return;const e=[...L.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===D.id),n=e?e.querySelector(".es-ts-row"):L.current.querySelector(`.es-ts-add[data-ts-kind="${D.kind}"]`);n?.focus(),V(null)},[D]);/* @__PURE__ */
7
+ return z("div",{className:"es-ts",ref:L,children:A.map(s=>{const l=e.filter(e=>e.kind===s),u=!B(e,s,w),m=!S&&!u;/* @__PURE__ */
8
+ return C(U,{label:N.groups[s],children:[l.map(s=>{const l=b?.(s),u=null!=l&&!1!==l,m=Boolean(x)&&!S&&!I(s);/* @__PURE__ */
9
+ return z(K,{style:s,fonts:t,colours:a,settings:i,auto:o,fallback:d,sample:c,readOnly:S,open:W===s.id,onOpenChange:e=>H(e?s.id:null),onChange:t=>n(e.map(e=>e.id===t.id?t:e)),actions:m||u?/* @__PURE__ */C(O,{children:[m?r(N.remove,/* @__PURE__ */z("button",{type:"button",className:"es-ts-del","aria-label":N.removeNamed({name:s.name}),onClick:()=>(t=>{if(S||!x)return;const s=T(e,t.id,{name:N.styleName});if(!s)return;const a=e.filter(e=>e.kind===t.kind),i=a[a.indexOf(t)+1];W===t.id&&H(null),n(s.styles),x(s.removed),V({id:i?.id??null,kind:t.kind})})(s),children:/* @__PURE__ */z(g,{size:14,"aria-hidden":"true"})})):null,u?l:null]}):null},s.id)}),r(!S&&u?N.full({kind:s,max:w}):void 0,/* @__PURE__ */C("button",{type:"button",className:"es-ts-add","data-ts-kind":s,disabled:S,"aria-disabled":!(S||!u)||void 0,"aria-describedby":!S&&u?`${M}-full-${s}`:void 0,onClick:()=>{m&&(t=>{if(S)return;const s=R(e,t,{max:w,name:N.styleName,make:k});s&&n(s.styles)})(s)},children:[
10
+ /* @__PURE__ */z("span",{className:"es-ts-add-word",children:N.add[s]}),
11
+ /* @__PURE__ */z("span",{className:"es-ts-count",children:N.count({n:l.length,max:w})})]})),S||!u?null:/* @__PURE__ */z("span",{id:`${M}-full-${s}`,className:"es-vh",children:N.full({kind:s,max:w})})]},s)})})}function U({label:e,children:n}){const t=h();/* @__PURE__ */
12
+ return C("section",{className:"es-ts-section","aria-labelledby":t,children:[
13
+ /* @__PURE__ */z("div",{className:"es-ts-group",id:t,children:e}),n]})}function K({style:e,fonts:n,colours:t=[],settings:a=$,auto:i=[],fallback:r,sample:o,open:d,onOpenChange:c,onChange:u,actions:m,readOnly:f=!1}){const p=l("textStyles",s),g=`${h()}-open-${e.id}`,k=new Set(i),b=M.filter(e=>a.includes(e)),x={...r?.(e)??{},...e.values},w=n.find(e=>e.value===x.font),S={fontFamily:w?.family,fontSize:`${Y(x.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
10
14
  return C(v,{children:[
11
- /* @__PURE__ */C("div",{className:"es-ts-item","data-ts-id":s.id,children:[
12
- /* @__PURE__ */C("button",{type:"button",className:"es-ts-row","aria-expanded":a,"aria-controls":a?u:void 0,onClick:()=>D(a?null:s.id),children:[
13
- /* @__PURE__ */z("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */z(g,{size:12})}),
14
- /* @__PURE__ */z("span",{className:"es-ts-name",style:p,children:s.name}),
15
- /* @__PURE__ */z("span",{className:"es-ts-meta",children:q(l,t,F,{autoSize:V.has("size")&&void 0===s.values.size})})]}),h||f?/* @__PURE__ */C("div",{className:"es-ts-actions",children:[h?r(F.remove,/* @__PURE__ */z("button",{type:"button",className:"es-ts-del","aria-label":F.removeNamed({name:s.name}),onClick:()=>(t=>{if(M||!N)return;const s=T(e,t.id,{name:F.styleName});if(!s)return;const i=e.filter(e=>e.kind===t.kind),a=i[i.indexOf(t)+1];L===t.id&&D(null),n(s.styles),N(s.removed),_({id:a?.id??null,kind:t.kind})})(s),children:/* @__PURE__ */z(k,{size:14,"aria-hidden":"true"})})):null,f?m:null]}):null]}),a?/* @__PURE__ */z("div",{className:"es-ts-open",id:u,children:/* @__PURE__ */z(J,{style:s,values:l,fonts:t,colours:i,settings:Z,autoSet:V,sample:c??F.sample,words:F,readOnly:M,set:t=>n(X(e,s.id,t))})}):null]},s.id)}),r(!M&&o?F.full({kind:s,max:S}):void 0,/* @__PURE__ */C("button",{type:"button",className:"es-ts-add","data-ts-kind":s,disabled:M,"aria-disabled":!(M||!o)||void 0,"aria-describedby":!M&&o?`${E}-full-${s}`:void 0,onClick:()=>{u&&(t=>{if(M)return;const s=R(e,t,{max:S,name:F.styleName,make:x});s&&n(s.styles)})(s)},children:[
16
- /* @__PURE__ */z("span",{className:"es-ts-add-word",children:F.add[s]}),
17
- /* @__PURE__ */z("span",{className:"es-ts-count",children:F.count({n:a.length,max:S})})]})),M||!o?null:/* @__PURE__ */z("span",{id:`${E}-full-${s}`,className:"es-vh",children:F.full({kind:s,max:S})})]},s)})})}var U={none:S,upper:N,capitalize:w,lower:x},K={none:"none",upper:"uppercase",capitalize:"capitalize",lower:"lowercase"};function J({style:e,values:n,fonts:s,colours:a,settings:l,autoSet:o,sample:d,words:c,readOnly:m,set:f}){const h=e.values,p=s.find(e=>e.value===n.font),v=function(e,n){return e?n.find(n=>n.key===e)?.value??t(e)??void 0:void 0}(n.color,a),g=e=>"largestSize"===e||o.has(e),k=e=>g(e)?h[e]:n[e],x=k("size"),w=k("lineSpacing"),N=k("letterSpacing"),S=g("letterCase")?h.letterCase:n.letterCase,O={fontFamily:p?.family,fontSize:void 0===x?void 0:`${x}px`,fontWeight:n.weight,fontStyle:n.italic?"italic":void 0,lineHeight:void 0===w?void 0:String(w/100),letterSpacing:void 0===N?void 0:`${N}px`,color:v,textTransform:S?K[S]:void 0},$=e=>{const t=W[e],s=g(e);/* @__PURE__ */
18
- return z("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */z(i,{label:c.settings[e],value:h[e],onChange:n=>f({[e]:n}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:s?void 0:n[e],auto:s?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
19
- return C(M,{children:[
20
- /* @__PURE__ */z("div",{className:"es-ts-preview",style:O,"aria-label":c.preview,children:d}),l.map(t=>{switch(t){case"font":/* @__PURE__ */
21
- return z(Q,{value:h.font,fonts:s,words:c,readOnly:m,set:f},t);case"color":/* @__PURE__ */
22
- return z(ee,{value:h.color,hex:v,colours:a,words:c,readOnly:m,set:f},t);case"emphasis":{const e=(n.weight??400)>=600,s=!1!==p?.italic;/* @__PURE__ */
15
+ /* @__PURE__ */C("div",{className:"es-ts-item","data-ts-id":e.id,children:[
16
+ /* @__PURE__ */C("button",{type:"button",className:"es-ts-row","aria-expanded":d,"aria-controls":d?g:void 0,onClick:()=>c(!d),children:[
17
+ /* @__PURE__ */z("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */z(y,{size:12})}),
18
+ /* @__PURE__ */z("span",{className:"es-ts-name",style:S,children:e.name}),
19
+ /* @__PURE__ */z("span",{className:"es-ts-meta",children:q(x,n,p,{autoSize:k.has("size")&&void 0===e.values.size})})]}),m?/* @__PURE__ */z("div",{className:"es-ts-actions",children:m}):null]}),d?/* @__PURE__ */z("div",{className:"es-ts-open",id:g,children:/* @__PURE__ */z(ee,{style:e,values:x,fonts:n,colours:t,settings:b,autoSet:k,sample:o??p.sample,words:p,readOnly:f,set:n=>u(X([e],e.id,n)[0])})}):null]})}var J={none:N,upper:S,capitalize:w,lower:x},Q={none:"none",upper:"uppercase",capitalize:"capitalize",lower:"lowercase"};function ee({style:e,values:n,fonts:s,colours:i,settings:l,autoSet:o,sample:d,words:c,readOnly:m,set:f}){const h=e.values,p=s.find(e=>e.value===n.font),v=function(e,n){return e?n.find(n=>n.key===e)?.value??t(e)??void 0:void 0}(n.color,i),g=e=>"largestSize"===e||o.has(e),y=e=>g(e)?h[e]:n[e],x=y("size"),w=y("lineSpacing"),S=y("letterSpacing"),N=g("letterCase")?h.letterCase:n.letterCase,M={fontFamily:p?.family,fontSize:void 0===x?void 0:`${x}px`,fontWeight:n.weight,fontStyle:n.italic?"italic":void 0,lineHeight:void 0===w?void 0:String(w/100),letterSpacing:void 0===S?void 0:`${S}px`,color:v,textTransform:N?Q[N]:void 0},$=e=>{const t=W[e],s=g(e);/* @__PURE__ */
20
+ return z("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */z(a,{label:c.settings[e],value:h[e],onChange:n=>f({[e]:n}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:s?void 0:n[e],auto:s?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
21
+ return C(O,{children:[
22
+ /* @__PURE__ */z("div",{className:"es-ts-preview",style:M,"aria-label":c.preview,children:d}),l.map(t=>{switch(t){case"font":/* @__PURE__ */
23
+ return z(ne,{value:h.font,fonts:s,words:c,readOnly:m,set:f},t);case"color":/* @__PURE__ */
24
+ return z(te,{value:h.color,hex:v,colours:i,words:c,readOnly:m,set:f},t);case"emphasis":{const e=(n.weight??400)>=600,s=!1!==p?.italic;/* @__PURE__ */
23
25
  return C("div",{className:"es-ts-set","data-ts-setting":t,children:[
24
26
  /* @__PURE__ */z("span",{className:"es-ts-sub",children:c.settings.emphasis}),
25
- /* @__PURE__ */C("div",{className:"es-ts-icons",children:[r(c.bold,/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */z(y,{size:16})})),m||s?r(c.italic,/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),disabled:m,onClick:()=>f({italic:!n.italic||void 0}),children:/* @__PURE__ */z(b,{size:16})})):/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */z(b,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
26
- return z(ne,{value:h.letterCase??n.letterCase,auto:g("letterCase"),words:c,readOnly:m,set:f},t);case"largestSize":return"heading"===e.kind?$(t):null;default:return $(t)}})]})}function Q({value:e,fonts:n,words:t,readOnly:s,set:i}){const l=h();/* @__PURE__ */
27
+ /* @__PURE__ */C("div",{className:"es-ts-icons",children:[r(c.bold,/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */z(k,{size:16})})),m||s?r(c.italic,/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),disabled:m,onClick:()=>f({italic:!n.italic||void 0}),children:/* @__PURE__ */z(b,{size:16})})):/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */z(b,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
28
+ return z(se,{value:h.letterCase??n.letterCase,auto:g("letterCase"),words:c,readOnly:m,set:f},t);case"largestSize":return"heading"===e.kind?$(t):null;default:return $(t)}})]})}function ne({value:e,fonts:n,words:t,readOnly:s,set:a}){const l=h();/* @__PURE__ */
27
29
  return C("div",{className:"es-ts-set","data-ts-setting":"font",children:[
28
30
  /* @__PURE__ */z("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
29
- /* @__PURE__ */z(a,{value:e,options:n.map(e=>({label:e.label,value:e.value})),onChange:e=>i({font:e}),ariaLabelledBy:l,readOnly:s})]})}function ee({value:e,hex:n,colours:t,words:s,readOnly:i,set:a}){/* @__PURE__ */
30
- return z(P,{value:e,hex:n,colours:t,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:i,onChange:e=>a({color:e})})}function ne({value:e,auto:n,words:t,readOnly:s,set:i}){const a=n?["auto","none","upper","capitalize","lower"]:["none","upper","capitalize","lower"],l=e??(n?"auto":"none"),o=f([]),d=e=>i({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
31
+ /* @__PURE__ */z(i,{value:e,options:n.map(e=>({label:e.label,value:e.value})),onChange:e=>a({font:e}),ariaLabelledBy:l,readOnly:s})]})}function te({value:e,hex:n,colours:t,words:s,readOnly:a,set:i}){/* @__PURE__ */
32
+ return z(P,{value:e,hex:n,colours:t,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:a,onChange:e=>i({color:e})})}function se({value:e,auto:n,words:t,readOnly:s,set:a}){const i=n?["auto","none","upper","capitalize","lower"]:["none","upper","capitalize","lower"],l=e??(n?"auto":"none"),o=f([]),d=e=>a({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
31
33
  return C("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
32
34
  /* @__PURE__ */z("span",{className:"es-ts-sub",children:t.settings.letterCase}),
33
- /* @__PURE__ */z("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const n="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!n||s)return;e.preventDefault();const t=(a.indexOf(l)+n+a.length)%a.length;d(a[t]),o.current[t]?.focus()},children:a.map((e,n)=>{const i=e===l;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */z(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon es-ts-icon--word","aria-checked":i,"aria-label":t.case.auto,tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:t.case.auto},e));const a=U[e];return r(t.case[e],/* @__PURE__ */z(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon","aria-checked":i,"aria-label":t.case[e],tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:/* @__PURE__ */z(a,{size:16})},e))})})]})}export{$ as CAMPAIGN_TEXT_STYLE_SETTINGS,P as ColourSwatchRow,F as TEXT_STYLE_DEFAULT_COUNT,A as TEXT_STYLE_KINDS,j as TEXT_STYLE_MAX,W as TEXT_STYLE_RANGES,O as TEXT_STYLE_SETTINGS,_ as TextStylesList,R as addTextStyle,B as canAddTextStyle,L as defaultTextStyles,q as describeTextStyle,I as isDefaultTextStyle,T as removeTextStyle,V as resolveTextStyle,Y as textStyleRowSize,X as updateTextStyle,Z as weightWord};
35
+ /* @__PURE__ */z("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const n="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!n||s)return;e.preventDefault();const t=(i.indexOf(l)+n+i.length)%i.length;d(i[t]),o.current[t]?.focus()},children:i.map((e,n)=>{const a=e===l;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */z(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:a,className:"es-ts-icon es-ts-icon--word","aria-checked":a,"aria-label":t.case.auto,tabIndex:a?0:-1,disabled:s,onClick:()=>d(e),children:t.case.auto},e));const i=J[e];return r(t.case[e],/* @__PURE__ */z(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:a,className:"es-ts-icon","aria-checked":a,"aria-label":t.case[e],tabIndex:a?0:-1,disabled:s,onClick:()=>d(e),children:/* @__PURE__ */z(i,{size:16})},e))})})]})}export{$ as CAMPAIGN_TEXT_STYLE_SETTINGS,P as ColourSwatchRow,F as TEXT_STYLE_DEFAULT_COUNT,A as TEXT_STYLE_KINDS,j as TEXT_STYLE_MAX,W as TEXT_STYLE_RANGES,M as TEXT_STYLE_SETTINGS,K as TextStyleItem,U as TextStylesGroup,_ as TextStylesList,R as addTextStyle,B as canAddTextStyle,L as defaultTextStyles,q as describeTextStyle,I as isDefaultTextStyle,T as removeTextStyle,V as resolveTextStyle,Y as textStyleRowSize,X as updateTextStyle,Z as weightWord};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "10.2.0",
3
+ "version": "10.3.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",