efficient-easel 0.100.0 → 0.101.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/chrome/index.js +24 -16
  2. package/dist/{chunk-QKVR3K73.js → chunk-2FZJWH24.js} +1 -1
  3. package/dist/chunk-546BBOPE.js +1 -0
  4. package/dist/{chunk-LGKQXSKO.js → chunk-EOJNJCMJ.js} +8 -8
  5. package/dist/{chunk-A5UK76FC.js → chunk-EWVJSRRY.js} +6 -6
  6. package/dist/chunk-FPOKPNO4.js +1 -0
  7. package/dist/chunk-H24N5TMZ.js +11 -0
  8. package/dist/chunk-IG3U5NWJ.js +1 -0
  9. package/dist/chunk-KTVH2ZRL.js +15 -0
  10. package/dist/{chunk-6EIVTKZZ.js → chunk-L5KW4HG5.js} +21 -20
  11. package/dist/{chunk-TRVZ7C23.js → chunk-QTLAVDJE.js} +1 -1
  12. package/dist/chunk-UH7IGZKF.js +1 -0
  13. package/dist/{chunk-V7GIIXFB.js → chunk-ZFDCDJNZ.js} +1 -1
  14. package/dist/{chunk-DICUMYMG.js → chunk-ZNS7727Y.js} +1 -1
  15. package/dist/copy/copy.css +83 -29
  16. package/dist/copy/index.d.ts +41 -7
  17. package/dist/copy/index.js +32 -31
  18. package/dist/drag/index.js +4 -4
  19. package/dist/fields/fields.css +185 -30
  20. package/dist/fields/index.d.ts +165 -20
  21. package/dist/fields/index.js +22 -37
  22. package/dist/gold/index.js +1 -1
  23. package/dist/icons/index.d.ts +4 -1
  24. package/dist/icons/index.js +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/markup/index.d.ts +18 -1
  27. package/dist/markup/index.js +1 -1
  28. package/dist/menu/index.js +1 -15
  29. package/dist/node-ops/index.js +1 -1
  30. package/dist/panel/index.d.ts +49 -38
  31. package/dist/panel/index.js +18 -18
  32. package/dist/panel/panel.css +99 -81
  33. package/dist/pick/index.d.ts +40 -2
  34. package/dist/pick/index.js +1 -1
  35. package/dist/pick/pick.css +183 -10
  36. package/dist/rail/index.js +1 -1
  37. package/dist/strings/catalogue.d.ts +3 -3
  38. package/dist/strings/catalogue.js +1 -1
  39. package/dist/strings/index.d.ts +3 -3
  40. package/dist/strings/index.js +1 -1
  41. package/dist/style-clipboard/index.js +1 -1
  42. package/dist/text-styles/index.js +13 -13
  43. package/dist/tree/index.js +1 -1
  44. package/dist/{words-CJjUKcV5.d.ts → words-BGrHZAJJ.d.ts} +13 -4
  45. package/dist/{words-CzoyDNHm.d.ts → words-D8kf071T.d.ts} +40 -2
  46. package/dist/{words-DBq7vfHy.d.ts → words-XH0TvZPg.d.ts} +8 -5
  47. package/package.json +1 -1
  48. package/dist/chunk-AZT7V4UM.js +0 -10
  49. package/dist/chunk-HDVD27VB.js +0 -1
  50. package/dist/chunk-JQM3V7XQ.js +0 -1
  51. package/dist/chunk-LA54QLP5.js +0 -1
  52. package/dist/chunk-MH5GUZFQ.js +0 -9
  53. package/dist/chunk-SAJUCHOX.js +0 -1
@@ -1 +1 @@
1
- import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"../chunk-6WY6ZXJG.js";import{CopyStyleIcon as e,PasteStyleIcon as n}from"../chunk-6EIVTKZZ.js";import{jsx as o}from"react/jsx-runtime";var r="__styleKind";function u(t,e){return t[r]=e,t}function c(t,e){return`${t}:${e.map(t=>String(t)).sort().join("|")}`}function i(t){if(!t)return null;const e=t.indexOf(":");if(e<0)return null;const n=t.slice(0,e);return s.has(n)?{control:n,values:t.slice(e+1).split("|")}:null}var s=/* @__PURE__ */new Set(["choice","select","radio"]);function l(t){if(!t||"object"!=typeof t)return null;const e=t;return"string"==typeof e[r]?e[r]:"text"===e.type||"textarea"===e.type||"number"===e.type?e.type:"select"!==e.type&&"radio"!==e.type||!Array.isArray(e.options)?null:c(e.type,e.options.map(t=>t?.value))}function a(t){return null!=t&&""!==t}function p(t,e){let n=t;for(const t of e){if(!n||"object"!=typeof n)return;n=n[t]}return n}function f(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function d(t,e,n){const[o,...r]=e,u={...t};if(0===r.length)return void 0===n?delete u[o]:u[o]=n,u;const c=u[o],i=d(c&&"object"==typeof c?c:{},r,n);return 0===Object.keys(i).length?delete u[o]:u[o]=i,u}var y=t=>t.join("."),h="editor-shell:style-clipboard",g=null,m=!1,v=/* @__PURE__ */new Set;function S(){try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}function b(){if(!m){m=!0;try{const t=S()?.getItem(h);t&&(g=JSON.parse(t))}catch{g=null}}}function k(t){b(),g={scope:t.scope,sourceType:t.type,sourceLabel:t.label,rows:t.rows.map(e=>{const n=p(t.props,e.path);return{path:[...e.path],kind:e.kind,counted:!1!==e.counted,value:a(n)?f(n):void 0}})};try{S()?.setItem(h,JSON.stringify(g))}catch{}return v.forEach(t=>t()),g}function N(t){return b(),g&&g.scope===t?g:null}function j(t){return v.add(t),()=>{v.delete(t)}}function C(){g=null,m=!0;try{S()?.removeItem(h)}catch{}v.forEach(t=>t())}function w(t,e,n){if(t.kind===e.kind)return null!==e.kind||n;const o=i(t.kind),r=i(e.kind);return!(!o||!r||o.control!==r.control)&&(!a(t.value)||r.values.includes(String(t.value)))}function E(t,e){const n=t.sourceType===e.type,o=new Map(t.rows.map(t=>[y(t.path),t]));let r=e.props,u=0,c=!1;for(const t of e.rows){const e=o.get(y(t.path));if(!e)continue;if(!w(e,t,n))continue;const i=p(r,t.path),s=void 0===e.value?void 0:f(e.value);JSON.stringify(a(i)?i:void 0)!==JSON.stringify(s)&&(r=d(r,t.path,s),c=!0),!1!==t.counted&&(u+=1)}return{props:r,pasted:u,changed:c}}function K(e,n,o,r=t){return 0===e.pasted?r.nothing({source:n,target:o}):r.pasted({count:e.pasted,source:n})}var O="⌥⌘C",J="⌥⌘V";function T(r){const u=r.words??t,c=[];return r.canCopy&&c.push({label:u.copy,icon:/* @__PURE__ */o(e,{}),shortcut:"⌥⌘C",onClick:r.onCopy}),r.held&&c.push({label:u.paste({source:r.held.sourceLabel}),icon:/* @__PURE__ */o(n,{}),shortcut:"⌥⌘V",onClick:r.onPaste}),c}function x(t){if(!t.altKey||t.shiftKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.target;return e&&(e.isContentEditable||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName)?null:"KeyC"===t.code?"copy":"KeyV"===t.code?"paste":null}export{O as COPY_STYLE_SHORTCUT,J as PASTE_STYLE_SHORTCUT,r as STYLE_KIND,c as choiceKind,C as clearStyle,k as copyStyle,l as fieldKind,N as heldStyle,K as pasteMessage,E as planPaste,T as styleMenuItems,x as styleShortcut,j as subscribeStyle,u as withStyleKind};
1
+ import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"../chunk-6WY6ZXJG.js";import{CopyStyleIcon as e,PasteStyleIcon as n}from"../chunk-L5KW4HG5.js";import{jsx as o}from"react/jsx-runtime";var r="__styleKind";function u(t,e){return t[r]=e,t}function c(t,e){return`${t}:${e.map(t=>String(t)).sort().join("|")}`}function i(t){if(!t)return null;const e=t.indexOf(":");if(e<0)return null;const n=t.slice(0,e);return s.has(n)?{control:n,values:t.slice(e+1).split("|")}:null}var s=/* @__PURE__ */new Set(["choice","select","radio"]);function l(t){if(!t||"object"!=typeof t)return null;const e=t;return"string"==typeof e[r]?e[r]:"text"===e.type||"textarea"===e.type||"number"===e.type?e.type:"select"!==e.type&&"radio"!==e.type||!Array.isArray(e.options)?null:c(e.type,e.options.map(t=>t?.value))}function a(t){return null!=t&&""!==t}function p(t,e){let n=t;for(const t of e){if(!n||"object"!=typeof n)return;n=n[t]}return n}function f(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function d(t,e,n){const[o,...r]=e,u={...t};if(0===r.length)return void 0===n?delete u[o]:u[o]=n,u;const c=u[o],i=d(c&&"object"==typeof c?c:{},r,n);return 0===Object.keys(i).length?delete u[o]:u[o]=i,u}var y=t=>t.join("."),h="editor-shell:style-clipboard",g=null,m=!1,v=/* @__PURE__ */new Set;function S(){try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}function b(){if(!m){m=!0;try{const t=S()?.getItem(h);t&&(g=JSON.parse(t))}catch{g=null}}}function k(t){b(),g={scope:t.scope,sourceType:t.type,sourceLabel:t.label,rows:t.rows.map(e=>{const n=p(t.props,e.path);return{path:[...e.path],kind:e.kind,counted:!1!==e.counted,value:a(n)?f(n):void 0}})};try{S()?.setItem(h,JSON.stringify(g))}catch{}return v.forEach(t=>t()),g}function N(t){return b(),g&&g.scope===t?g:null}function j(t){return v.add(t),()=>{v.delete(t)}}function C(){g=null,m=!0;try{S()?.removeItem(h)}catch{}v.forEach(t=>t())}function w(t,e,n){if(t.kind===e.kind)return null!==e.kind||n;const o=i(t.kind),r=i(e.kind);return!(!o||!r||o.control!==r.control)&&(!a(t.value)||r.values.includes(String(t.value)))}function K(t,e){const n=t.sourceType===e.type,o=new Map(t.rows.map(t=>[y(t.path),t]));let r=e.props,u=0,c=!1;for(const t of e.rows){const e=o.get(y(t.path));if(!e)continue;if(!w(e,t,n))continue;const i=p(r,t.path),s=void 0===e.value?void 0:f(e.value);JSON.stringify(a(i)?i:void 0)!==JSON.stringify(s)&&(r=d(r,t.path,s),c=!0),!1!==t.counted&&(u+=1)}return{props:r,pasted:u,changed:c}}function O(e,n,o,r=t){return 0===e.pasted?r.nothing({source:n,target:o}):r.pasted({count:e.pasted,source:n})}var E="⌥⌘C",J="⌥⌘V";function T(r){const u=r.words??t,c=[];return r.canCopy&&c.push({label:u.copy,icon:/* @__PURE__ */o(e,{}),shortcut:"⌥⌘C",onClick:r.onCopy}),r.held&&c.push({label:u.paste({source:r.held.sourceLabel}),icon:/* @__PURE__ */o(n,{}),shortcut:"⌥⌘V",onClick:r.onPaste}),c}function x(t){if(!t.altKey||t.shiftKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.target;return e&&(e.isContentEditable||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName)?null:"KeyC"===t.code?"copy":"KeyV"===t.code?"paste":null}export{E as COPY_STYLE_SHORTCUT,J as PASTE_STYLE_SHORTCUT,r as STYLE_KIND,c as choiceKind,C as clearStyle,k as copyStyle,l as fieldKind,N as heldStyle,O as pasteMessage,K as planPaste,T as styleMenuItems,x as styleShortcut,j as subscribeStyle,u as withStyleKind};
@@ -1,21 +1,21 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as e}from"../chunk-M6F6LS3H.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-M6F6LS3H.js";import{FieldSelect as t,FieldSlider as n}from"../chunk-LGKQXSKO.js";import{hexReadout as s,ColourWindow as i,typedHex as a}from"../chunk-AZT7V4UM.js";import{DEFAULT_PICK_WORDS as l}from"../chunk-ZAOM6PFH.js";import"../chunk-A5UK76FC.js";import"../chunk-LA54QLP5.js";import{useWords as r}from"../chunk-MFIRYGHW.js";import{ChevronIcon as o,TrashIcon as d,BoldIcon as c,ItalicIcon as u,CaseLowerIcon as m,CaseUpperIcon as p,CaseNormalIcon as f}from"../chunk-6EIVTKZZ.js";import{useState as h,useRef as v,useId as g,useEffect as y,Fragment as k}from"react";import{jsxs as b,jsx as w,Fragment as x}from"react/jsx-runtime";var S=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],N=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],C=["heading","body"],M=7,O={heading:3,body:5},z={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},$={size:z,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:z},A=(e,t)=>`${"heading"===e?"Heading":"Body"} ${t}`;function L(e=({kind:e,n:t})=>A(e,t)){return C.flatMap(t=>Array.from({length:O[t]},(n,s)=>({id:`${t}-${s+1}`,kind:t,name:e({kind:t,n:s+1}),values:{}})))}function j(e,t,n=M){return e.filter(e=>e.kind===t).length<n}function F(e,t){const n=new RegExp(`^${t}-([1-9]\\d*)$`).exec(e);return n?Number(n[1]):void 0}function E(e){const t=F(e.id,e.kind);return void 0!==t&&t<=O[e.kind]}function T(e,t,n={}){const{max:s=M,name:i=({kind:e,n:t})=>A(e,t),make:a}=n;if(!j(e,t,s))return null;const l=e.filter(e=>e.kind===t);let r=l.length+1;const o=new Set(e.map(e=>e.name));for(;o.has(i({kind:t,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(F(e.id,t)??0)+1));for(;d.has(`${t}-${c}`);)c+=1;const u=l.at(-1),m=a?a(t,r):{id:`${t}-${c}`,kind:t,name:i({kind:t,n:r}),values:{...u?.values??{}}},p=u?e.indexOf(u)+1:"heading"===t?0:e.length;return{styles:[...e.slice(0,p),m,...e.slice(p)],added:m}}function W(e,t,n={}){const{name:s=({kind:e,n:t})=>A(e,t)}=n,i=e.find(e=>e.id===t);if(!i||E(i))return null;const a=e.filter(e=>e.kind===i.kind),l=a.indexOf(i),r=/* @__PURE__ */new Map;return a.forEach((e,t)=>{t>l&&e.name===s({kind:e.kind,n:t+1})&&r.set(e,s({kind:e.kind,n:t}))}),{styles:e.filter(e=>e!==i).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:i}}function I(e,t){const n=e.find(e=>e.id===t);if(n)return n;for(const n of C){const s=F(t,n);if(void 0===s)continue;let i;for(const t of e){const e=t.kind===n?F(t.id,n):void 0;void 0!==e&&e<s&&(!i||e>i.n)&&(i={n:e,style:t})}return i?.style}}function D(e,t,n){return e.map(e=>{if(e.id!==t)return e;const s={...e.values};for(const[e,t]of Object.entries(n))void 0===t?delete s[e]:s[e]=t;return{...e,values:s}})}function H(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function B(e,t){const n=t.weights;return[n.thin,n.extraLight,n.light,n.regular,n.medium,n.semibold,n.bold,n.extraBold,n.black][Math.min(8,Math.max(0,Math.round(e/100)-1))]}function K(e,t,n,s={}){const i=t.find(t=>t.value===e.font)?.label??e.font??"",a=void 0===e.size?s.autoSize?n.auto:"":n.px({n:e.size});return n.summary({font:i,size:a,weight:B(e.weight??400,n)})}function R({value:e,hex:t,colours:n,label:a,followsWord:o,anyWord:d,onChange:c,readOnly:u=!1}){const m=r("pick",l),[p,f]=h(!1),k=v(null),x=v(null),S=g(),N=void 0!==e&&n.some(t=>t.key===e),C=void 0!==e&&!N;return y(()=>{if(!p)return;const e=k.current?.ownerDocument;if(!e)return;const t=e=>{k.current&&!k.current.contains(e.target)&&f(!1)};return e.addEventListener("click",t,!0),()=>e.removeEventListener("click",t,!0)},[p]),/* @__PURE__ */b("div",{ref:k,className:"es-ts-set","data-ts-setting":"color",children:[
1
+ import{DEFAULT_TEXT_STYLES_WORDS as e}from"../chunk-M6F6LS3H.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-M6F6LS3H.js";import{FieldSelect as t,FieldSlider as n}from"../chunk-EOJNJCMJ.js";import{hexReadout as s,ColourWindow as i,typedHex as a}from"../chunk-H24N5TMZ.js";import{DEFAULT_PICK_WORDS as l}from"../chunk-ZAOM6PFH.js";import"../chunk-EWVJSRRY.js";import"../chunk-FPOKPNO4.js";import{useWords as r}from"../chunk-MFIRYGHW.js";import{ChevronIcon as o,TrashIcon as d,BoldIcon as c,ItalicIcon as u,CaseLowerIcon as m,CaseUpperIcon as p,CaseNormalIcon as f}from"../chunk-L5KW4HG5.js";import{useState as h,useRef as v,useId as g,useEffect as y,Fragment as k}from"react";import{jsxs as b,jsx as w,Fragment as x}from"react/jsx-runtime";var S=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],N=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],C=["heading","body"],M=7,O={heading:3,body:5},z={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},$={size:z,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:z},j=(e,t)=>`${"heading"===e?"Heading":"Body"} ${t}`;function A(e=({kind:e,n:t})=>j(e,t)){return C.flatMap(t=>Array.from({length:O[t]},(n,s)=>({id:`${t}-${s+1}`,kind:t,name:e({kind:t,n:s+1}),values:{}})))}function L(e,t,n=M){return e.filter(e=>e.kind===t).length<n}function W(e,t){const n=new RegExp(`^${t}-([1-9]\\d*)$`).exec(e);return n?Number(n[1]):void 0}function E(e){const t=W(e.id,e.kind);return void 0!==t&&t<=O[e.kind]}function F(e,t,n={}){const{max:s=M,name:i=({kind:e,n:t})=>j(e,t),make:a}=n;if(!L(e,t,s))return null;const l=e.filter(e=>e.kind===t);let r=l.length+1;const o=new Set(e.map(e=>e.name));for(;o.has(i({kind:t,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(W(e.id,t)??0)+1));for(;d.has(`${t}-${c}`);)c+=1;const u=l.at(-1),m=a?a(t,r):{id:`${t}-${c}`,kind:t,name:i({kind:t,n:r}),values:{...u?.values??{}}},p=u?e.indexOf(u)+1:"heading"===t?0:e.length;return{styles:[...e.slice(0,p),m,...e.slice(p)],added:m}}function H(e,t,n={}){const{name:s=({kind:e,n:t})=>j(e,t)}=n,i=e.find(e=>e.id===t);if(!i||E(i))return null;const a=e.filter(e=>e.kind===i.kind),l=a.indexOf(i),r=/* @__PURE__ */new Map;return a.forEach((e,t)=>{t>l&&e.name===s({kind:e.kind,n:t+1})&&r.set(e,s({kind:e.kind,n:t}))}),{styles:e.filter(e=>e!==i).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:i}}function R(e,t){const n=e.find(e=>e.id===t);if(n)return n;for(const n of C){const s=W(t,n);if(void 0===s)continue;let i;for(const t of e){const e=t.kind===n?W(t.id,n):void 0;void 0!==e&&e<s&&(!i||e>i.n)&&(i={n:e,style:t})}return i?.style}}function T(e,t,n){return e.map(e=>{if(e.id!==t)return e;const s={...e.values};for(const[e,t]of Object.entries(n))void 0===t?delete s[e]:s[e]=t;return{...e,values:s}})}function D(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function I(e,t){const n=t.weights;return[n.thin,n.extraLight,n.light,n.regular,n.medium,n.semibold,n.bold,n.extraBold,n.black][Math.min(8,Math.max(0,Math.round(e/100)-1))]}function B(e,t,n,s={}){const i=t.find(t=>t.value===e.font)?.label??e.font??"",a=void 0===e.size?s.autoSize?n.auto:"":n.px({n:e.size});return n.summary({font:i,size:a,weight:I(e.weight??400,n)})}function J({value:e,hex:t,colours:n,label:a,followsWord:o,anyWord:d,onChange:c,readOnly:u=!1}){const m=r("pick",l),[p,f]=h(!1),k=v(null),x=v(null),S=g(),N=void 0!==e&&n.some(t=>t.key===e),C=void 0!==e&&!N;return y(()=>{if(!p)return;const e=k.current?.ownerDocument;if(!e)return;const t=e=>{k.current&&!k.current.contains(e.target)&&f(!1)};return e.addEventListener("click",t,!0),()=>e.removeEventListener("click",t,!0)},[p]),/* @__PURE__ */b("div",{ref:k,className:"es-ts-set","data-ts-setting":"color",children:[
2
2
  /* @__PURE__ */b("div",{className:"es-ts-top",children:[
3
3
  /* @__PURE__ */w("span",{className:"es-ts-sub",children:a}),
4
4
  /* @__PURE__ */w("span",{className:"es-ts-colour-read",children:t?s(t):o})]}),
5
5
  /* @__PURE__ */b("div",{className:"es-ts-swatches",role:"group","aria-label":a,children:[n.map(t=>/* @__PURE__ */w("button",{type:"button",className:"es-ts-swatch",style:{background:t.value},"aria-label":t.name,title:`${t.name} · ${s(t.value)}`,"aria-pressed":e===t.key,disabled:u,onClick:()=>c(t.key)},t.key)),
6
- /* @__PURE__ */w("button",{ref:x,type:"button",className:"es-ts-swatch es-ts-swatch--any","aria-label":d,title:d,"aria-pressed":C,"aria-expanded":p,"aria-controls":p?S:void 0,disabled:u,onClick:()=>f(e=>!e)})]}),p?/* @__PURE__ */w(i,{id:S,value:t??"",onChange:e=>c(e),label:a,words:m.colour,readOnly:u,onClose:()=>{f(!1),x.current?.focus()}}):null]})}function U({styles:t,onChange:n,fonts:s,colours:i=[],settings:a=N,auto:l=[],fallback:c,sample:u,openId:m,defaultOpenId:p=null,onOpenChange:f,onAdd:x,rowActions:O,onRemove:z,max:$=M,readOnly:A=!1}){const L=r("textStyles",e),F=g(),[I,B]=h(p),R=void 0!==m?m:I,U=e=>{void 0===m&&B(e),f?.(e)},Z=new Set(l),q=S.filter(e=>a.includes(e)),_=v(null),[G,P]=h(null);y(()=>{if(!G||!_.current)return;const e=[..._.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===G.id),t=e?e.querySelector(".es-ts-row"):_.current.querySelector(`.es-ts-add[data-ts-kind="${G.kind}"]`);t?.focus(),P(null)},[G]);/* @__PURE__ */
7
- return w("div",{className:"es-ts",ref:_,children:C.map(e=>{const a=t.filter(t=>t.kind===e),l=`${F}-${e}`,r=!A&&j(t,e,$);/* @__PURE__ */
6
+ /* @__PURE__ */w("button",{ref:x,type:"button",className:"es-ts-swatch es-ts-swatch--any","aria-label":d,title:d,"aria-pressed":C,"aria-expanded":p,"aria-controls":p?S:void 0,disabled:u,onClick:()=>f(e=>!e)})]}),p?/* @__PURE__ */w(i,{id:S,value:t??"",onChange:e=>c(e),label:a,words:m.colour,readOnly:u,onClose:()=>{f(!1),x.current?.focus()}}):null]})}function q({styles:t,onChange:n,fonts:s,colours:i=[],settings:a=N,auto:l=[],fallback:c,sample:u,openId:m,defaultOpenId:p=null,onOpenChange:f,onAdd:x,rowActions:O,onRemove:z,max:$=M,readOnly:j=!1}){const A=r("textStyles",e),W=g(),[R,I]=h(p),J=void 0!==m?m:R,q=e=>{void 0===m&&I(e),f?.(e)},K=new Set(l),P=S.filter(e=>a.includes(e)),_=v(null),[G,U]=h(null);y(()=>{if(!G||!_.current)return;const e=[..._.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===G.id),t=e?e.querySelector(".es-ts-row"):_.current.querySelector(`.es-ts-add[data-ts-kind="${G.kind}"]`);t?.focus(),U(null)},[G]);/* @__PURE__ */
7
+ return w("div",{className:"es-ts",ref:_,children:C.map(e=>{const a=t.filter(t=>t.kind===e),l=`${W}-${e}`,r=!j&&L(t,e,$);/* @__PURE__ */
8
8
  return b("section",{className:"es-ts-section","aria-labelledby":l,children:[
9
- /* @__PURE__ */w("div",{className:"es-ts-group",id:l,children:L.groups[e]}),a.map(e=>{const a=R===e.id,l={...c?.(e)??{},...e.values},r=s.find(e=>e.value===l.font),m=`${F}-open-${e.id}`,p=O?.(e),f=null!=p&&!1!==p,h=Boolean(z)&&!A&&!E(e),v={fontFamily:r?.family,fontSize:`${H(l.size??16)}px`,fontWeight:l.weight,fontStyle:l.italic?"italic":void 0};/* @__PURE__ */
9
+ /* @__PURE__ */w("div",{className:"es-ts-group",id:l,children:A.groups[e]}),a.map(e=>{const a=J===e.id,l={...c?.(e)??{},...e.values},r=s.find(e=>e.value===l.font),m=`${W}-open-${e.id}`,p=O?.(e),f=null!=p&&!1!==p,h=Boolean(z)&&!j&&!E(e),v={fontFamily:r?.family,fontSize:`${D(l.size??16)}px`,fontWeight:l.weight,fontStyle:l.italic?"italic":void 0};/* @__PURE__ */
10
10
  return b(k,{children:[
11
11
  /* @__PURE__ */b("div",{className:"es-ts-item","data-ts-id":e.id,children:[
12
- /* @__PURE__ */b("button",{type:"button",className:"es-ts-row","aria-expanded":a,"aria-controls":a?m:void 0,onClick:()=>U(a?null:e.id),children:[
12
+ /* @__PURE__ */b("button",{type:"button",className:"es-ts-row","aria-expanded":a,"aria-controls":a?m:void 0,onClick:()=>q(a?null:e.id),children:[
13
13
  /* @__PURE__ */w("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */w(o,{size:12})}),
14
14
  /* @__PURE__ */w("span",{className:"es-ts-name",style:v,children:e.name}),
15
- /* @__PURE__ */w("span",{className:"es-ts-meta",children:K(l,s,L,{autoSize:Z.has("size")&&void 0===e.values.size})})]}),h||f?/* @__PURE__ */b("div",{className:"es-ts-actions",children:[h?/* @__PURE__ */w("button",{type:"button",className:"es-ts-del",title:L.remove,"aria-label":L.removeNamed({name:e.name}),onClick:()=>(e=>{if(A||!z)return;const s=W(t,e.id,{name:L.styleName});if(!s)return;const i=t.filter(t=>t.kind===e.kind),a=i[i.indexOf(e)+1];R===e.id&&U(null),n(s.styles),z(s.removed),P({id:a?.id??null,kind:e.kind})})(e),children:/* @__PURE__ */w(d,{size:14,"aria-hidden":"true"})}):null,f?p:null]}):null]}),a?/* @__PURE__ */w("div",{className:"es-ts-open",id:m,children:/* @__PURE__ */w(V,{style:e,values:l,fonts:s,colours:i,settings:q,autoSet:Z,sample:u??L.sample,words:L,readOnly:A,set:s=>n(D(t,e.id,s))})}):null]},e.id)}),
16
- /* @__PURE__ */b("button",{type:"button",className:"es-ts-add","data-ts-kind":e,disabled:!r,title:r?void 0:L.full({kind:e,max:$}),onClick:()=>(e=>{if(A)return;const s=T(t,e,{max:$,name:L.styleName,make:x});s&&n(s.styles)})(e),children:[
17
- /* @__PURE__ */w("span",{className:"es-ts-add-word",children:L.add[e]}),
18
- /* @__PURE__ */w("span",{className:"es-ts-count",children:L.count({n:a.length,max:$})})]})]},e)})})}var Z={none:f,upper:p,lower:m},q={none:"none",upper:"uppercase",lower:"lowercase"};function V({style:e,values:t,fonts:s,colours:i,settings:l,autoSet:r,sample:o,words:d,readOnly:m,set:p}){const f=e.values,h=s.find(e=>e.value===t.font),v=function(e,t){return e?t.find(t=>t.key===e)?.value??a(e)??void 0:void 0}(t.color,i),g=e=>"largestSize"===e||r.has(e),y=e=>g(e)?f[e]:t[e],k=y("size"),S=y("lineSpacing"),N=y("letterSpacing"),C=g("letterCase")?f.letterCase:t.letterCase,M={fontFamily:h?.family,fontSize:void 0===k?void 0:`${k}px`,fontWeight:t.weight,fontStyle:t.italic?"italic":void 0,lineHeight:void 0===S?void 0:String(S/100),letterSpacing:void 0===N?void 0:`${N}px`,color:v,textTransform:C?q[C]:void 0},O=e=>{const s=$[e],i=g(e);/* @__PURE__ */
15
+ /* @__PURE__ */w("span",{className:"es-ts-meta",children:B(l,s,A,{autoSize:K.has("size")&&void 0===e.values.size})})]}),h||f?/* @__PURE__ */b("div",{className:"es-ts-actions",children:[h?/* @__PURE__ */w("button",{type:"button",className:"es-ts-del",title:A.remove,"aria-label":A.removeNamed({name:e.name}),onClick:()=>(e=>{if(j||!z)return;const s=H(t,e.id,{name:A.styleName});if(!s)return;const i=t.filter(t=>t.kind===e.kind),a=i[i.indexOf(e)+1];J===e.id&&q(null),n(s.styles),z(s.removed),U({id:a?.id??null,kind:e.kind})})(e),children:/* @__PURE__ */w(d,{size:14,"aria-hidden":"true"})}):null,f?p:null]}):null]}),a?/* @__PURE__ */w("div",{className:"es-ts-open",id:m,children:/* @__PURE__ */w(Y,{style:e,values:l,fonts:s,colours:i,settings:P,autoSet:K,sample:u??A.sample,words:A,readOnly:j,set:s=>n(T(t,e.id,s))})}):null]},e.id)}),
16
+ /* @__PURE__ */b("button",{type:"button",className:"es-ts-add","data-ts-kind":e,disabled:!r,title:r?void 0:A.full({kind:e,max:$}),onClick:()=>(e=>{if(j)return;const s=F(t,e,{max:$,name:A.styleName,make:x});s&&n(s.styles)})(e),children:[
17
+ /* @__PURE__ */w("span",{className:"es-ts-add-word",children:A.add[e]}),
18
+ /* @__PURE__ */w("span",{className:"es-ts-count",children:A.count({n:a.length,max:$})})]})]},e)})})}var K={none:f,upper:p,lower:m},P={none:"none",upper:"uppercase",lower:"lowercase"};function Y({style:e,values:t,fonts:s,colours:i,settings:l,autoSet:r,sample:o,words:d,readOnly:m,set:p}){const f=e.values,h=s.find(e=>e.value===t.font),v=function(e,t){return e?t.find(t=>t.key===e)?.value??a(e)??void 0:void 0}(t.color,i),g=e=>"largestSize"===e||r.has(e),y=e=>g(e)?f[e]:t[e],k=y("size"),S=y("lineSpacing"),N=y("letterSpacing"),C=g("letterCase")?f.letterCase:t.letterCase,M={fontFamily:h?.family,fontSize:void 0===k?void 0:`${k}px`,fontWeight:t.weight,fontStyle:t.italic?"italic":void 0,lineHeight:void 0===S?void 0:String(S/100),letterSpacing:void 0===N?void 0:`${N}px`,color:v,textTransform:C?P[C]:void 0},O=e=>{const s=$[e],i=g(e);/* @__PURE__ */
19
19
  return w("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */w(n,{label:d.settings[e],value:f[e],onChange:t=>p({[e]:t}),min:s.min,max:s.max,step:s.step,shiftStep:s.shiftStep,sliderMin:s.sliderMin,sliderMax:s.sliderMax,unit:s.unit||void 0,styleValue:i?void 0:t[e],auto:i?d.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
20
20
  return b(x,{children:[
21
21
  /* @__PURE__ */w("div",{className:"es-ts-preview",style:M,"aria-label":d.preview,children:o}),l.map(n=>{switch(n){case"font":/* @__PURE__ */
@@ -26,13 +26,13 @@ return b("div",{className:"es-ts-set","data-ts-setting":n,children:[
26
26
  /* @__PURE__ */b("div",{className:"es-ts-icons",children:[
27
27
  /* @__PURE__ */w("button",{type:"button",className:"es-ts-icon","aria-label":d.bold,title:d.bold,"aria-pressed":e,disabled:m,onClick:()=>p({weight:e?400:700}),children:/* @__PURE__ */w(c,{size:16})}),
28
28
  /* @__PURE__ */w("button",{type:"button",className:"es-ts-icon","aria-label":d.italic,title:s?d.italic:d.italicMissing,"aria-pressed":Boolean(t.italic),disabled:m||!s,onClick:()=>p({italic:!t.italic||void 0}),children:/* @__PURE__ */w(u,{size:16})})]})]},n)}case"letterCase":/* @__PURE__ */
29
- return w(P,{value:f.letterCase??t.letterCase,auto:g("letterCase"),words:d,readOnly:m,set:p},n);case"largestSize":return"heading"===e.kind?O(n):null;default:return O(n)}})]})}function _({value:e,fonts:n,words:s,readOnly:i,set:a}){const l=g();/* @__PURE__ */
29
+ return w(U,{value:f.letterCase??t.letterCase,auto:g("letterCase"),words:d,readOnly:m,set:p},n);case"largestSize":return"heading"===e.kind?O(n):null;default:return O(n)}})]})}function _({value:e,fonts:n,words:s,readOnly:i,set:a}){const l=g();/* @__PURE__ */
30
30
  return b("div",{className:"es-ts-set","data-ts-setting":"font",children:[
31
31
  /* @__PURE__ */w("span",{className:"es-ts-sub",id:l,children:s.settings.font}),
32
32
  /* @__PURE__ */w(t,{value:e,options:n.map(e=>({label:e.label,value:e.value})),onChange:e=>a({font:e}),ariaLabelledBy:l,readOnly:i})]})}function G({value:e,hex:t,colours:n,words:s,readOnly:i,set:a}){/* @__PURE__ */
33
- return w(R,{value:e,hex:t,colours:n,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:i,onChange:e=>a({color:e})})}function P({value:e,auto:t,words:n,readOnly:s,set:i}){const a=t?["auto","none","upper","lower"]:["none","upper","lower"],l=e??(t?"auto":"none"),r=v([]),o=e=>i({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
33
+ return w(J,{value:e,hex:t,colours:n,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:i,onChange:e=>a({color:e})})}function U({value:e,auto:t,words:n,readOnly:s,set:i}){const a=t?["auto","none","upper","lower"]:["none","upper","lower"],l=e??(t?"auto":"none"),r=v([]),o=e=>i({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
34
34
  return b("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
35
35
  /* @__PURE__ */w("span",{className:"es-ts-sub",children:n.settings.letterCase}),
36
36
  /* @__PURE__ */w("div",{className:"es-ts-icons",role:"radiogroup","aria-label":n.settings.letterCase,onKeyDown:e=>{const t="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!t||s)return;e.preventDefault();const n=(a.indexOf(l)+t+a.length)%a.length;o(a[n]),r.current[n]?.focus()},children:a.map((e,t)=>{const i=e===l;if("auto"===e)/* @__PURE__ */
37
- return w("button",{ref:e=>{r.current[t]=e},type:"button",role:"radio",className:"es-ts-icon es-ts-icon--word","aria-checked":i,tabIndex:i?0:-1,title:n.case.autoTitle,disabled:s,onClick:()=>o(e),children:n.case.auto},e);const a=Z[e];/* @__PURE__ */
38
- return w("button",{ref:e=>{r.current[t]=e},type:"button",role:"radio",className:"es-ts-icon","aria-checked":i,"aria-label":n.case[e],title:n.case[e],tabIndex:i?0:-1,disabled:s,onClick:()=>o(e),children:/* @__PURE__ */w(a,{size:16})},e)})})]})}export{N as CAMPAIGN_TEXT_STYLE_SETTINGS,R as ColourSwatchRow,O as TEXT_STYLE_DEFAULT_COUNT,C as TEXT_STYLE_KINDS,M as TEXT_STYLE_MAX,$ as TEXT_STYLE_RANGES,S as TEXT_STYLE_SETTINGS,U as TextStylesList,T as addTextStyle,j as canAddTextStyle,L as defaultTextStyles,K as describeTextStyle,E as isDefaultTextStyle,W as removeTextStyle,I as resolveTextStyle,H as textStyleRowSize,D as updateTextStyle,B as weightWord};
37
+ return w("button",{ref:e=>{r.current[t]=e},type:"button",role:"radio",className:"es-ts-icon es-ts-icon--word","aria-checked":i,tabIndex:i?0:-1,title:n.case.autoTitle,disabled:s,onClick:()=>o(e),children:n.case.auto},e);const a=K[e];/* @__PURE__ */
38
+ return w("button",{ref:e=>{r.current[t]=e},type:"button",role:"radio",className:"es-ts-icon","aria-checked":i,"aria-label":n.case[e],title:n.case[e],tabIndex:i?0:-1,disabled:s,onClick:()=>o(e),children:/* @__PURE__ */w(a,{size:16})},e)})})]})}export{N as CAMPAIGN_TEXT_STYLE_SETTINGS,J as ColourSwatchRow,O as TEXT_STYLE_DEFAULT_COUNT,C as TEXT_STYLE_KINDS,M as TEXT_STYLE_MAX,$ as TEXT_STYLE_RANGES,S as TEXT_STYLE_SETTINGS,q as TextStylesList,F as addTextStyle,L as canAddTextStyle,A as defaultTextStyles,B as describeTextStyle,E as isDefaultTextStyle,H as removeTextStyle,R as resolveTextStyle,D as textStyleRowSize,T as updateTextStyle,I as weightWord};
@@ -1 +1 @@
1
- export{LayersTree,Subtree,TREE_DRAG_HINT,TreeEmptySlot,TreeGroupLabel,TreeRow,TreeRowAction,TreeSeam}from"../chunk-V7GIIXFB.js";import"../chunk-3EDSDPIP.js";import"../chunk-6EIVTKZZ.js";
1
+ export{LayersTree,Subtree,TREE_DRAG_HINT,TreeEmptySlot,TreeGroupLabel,TreeRow,TreeRowAction,TreeSeam}from"../chunk-ZFDCDJNZ.js";import"../chunk-3EDSDPIP.js";import"../chunk-L5KW4HG5.js";
@@ -20,18 +20,27 @@ type PanelWords = {
20
20
  settings: string;
21
21
  /** The word each tab shows, by its key. */
22
22
  buckets: Record<SettingsBucket, string>;
23
- /** `SettingsDefaultReset`, resting: the value follows its default. */
23
+ /** @deprecated Not drawn since option E (2026-10-07): an unchanged setting
24
+ * shows nothing. Kept so a host's catalogue still type-checks. */
24
25
  followsDefault: string;
25
- /** `SettingsDefaultReset`, changed: the button that clears the value. */
26
+ /** @deprecated Not drawn since option E: the ↺ button's words are
27
+ * `resetName`. Kept so a host's catalogue still type-checks. */
26
28
  reset: string;
27
- /** The Reset button's accessible name — which setting it resets. */
29
+ /** The ↺ button's accessible name AND tooltip — which setting it resets. */
28
30
  resetName: (p: {
29
31
  label: string;
30
32
  }) => string;
31
- /** The Reset button's tooltip, when the host says what the default is. */
33
+ /** @deprecated Not drawn since option E (the tooltip is `resetTitle`). Kept
34
+ * so a host's catalogue still type-checks. */
32
35
  backToDefault: (p: {
33
36
  detail: string;
34
37
  }) => string;
38
+ /** The ↺ tooltip when the host says what the default is (GG 2026-10-07):
39
+ * "Reset Gap (back to 24px from Site styles)". */
40
+ resetTitle: (p: {
41
+ label: string;
42
+ detail: string;
43
+ }) => string;
35
44
  };
36
45
 
37
46
  export type { PanelWords as P };
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * The settings rows' own words (`efficient-easel/strings`, 0.95.0): the number
3
- * box's two buttons, the dropdown's empty state and everything a list field
4
- * says. A row's label, its options and its hint are the block's.
3
+ * box's two buttons, the dropdown's empty state, everything a list field
4
+ * says and the link picker's own words. A row's label, its options and its
5
+ * hint are the block's; the link picker's kinds, targets and filters are its
6
+ * host's.
5
7
  *
6
8
  * A plain module with no import. `noun` is one item's word, lower case — the
7
9
  * field's own (`noun: 'slide'`) or `list.item`.
@@ -49,6 +51,42 @@ type FieldsWords = {
49
51
  addHere: (v: {
50
52
  noun: string;
51
53
  }) => string;
54
+ /** The right-click menu's step up. */
55
+ moveUp: string;
56
+ /** The right-click menu's step down. */
57
+ moveDown: string;
58
+ /** The right-click menu's delete (the row says which). */
59
+ delete: string;
60
+ /** A row that cannot be taken out, when its host says no reason. */
61
+ locked: string;
62
+ /** Read out after a move: "Moved to 2 of 5". */
63
+ moved: (v: {
64
+ n: number;
65
+ total: number;
66
+ }) => string;
67
+ };
68
+ /** `LinkPicker`. Optional: a host's older catalogue falls back to the English. */
69
+ link?: {
70
+ /** The Link type list's accessible name. */
71
+ linkType: string;
72
+ /** The typed address box's accessible name. */
73
+ address: string;
74
+ /** What the empty address box says. */
75
+ addressPlaceholder: string;
76
+ /** Under the address box when what was typed cannot be saved. */
77
+ unsafe: string;
78
+ /** A saved target, filter or value the host no longer offers. */
79
+ unavailable: (v: {
80
+ value: string;
81
+ }) => string;
82
+ /** The Filter box's accessible name. */
83
+ filter: string;
84
+ /** The Filter box's first option: the listing with no filter. */
85
+ noFilter: string;
86
+ /** The Value box's accessible name. */
87
+ value: string;
88
+ /** Under the boxes while a Filter is offered. */
89
+ filterHint: string;
52
90
  };
53
91
  };
54
92
 
@@ -143,11 +143,16 @@ type CopyWords = {
143
143
  * (E5a). Optional, so a host's words from before still type; English when
144
144
  * left out. */
145
145
  showMarks?: string;
146
+ /** Clear style, on the line under the box (owner ruling 2026-10-07), and its
147
+ * tooltip while nothing is selected. Optional, so a host's words from
148
+ * before still type; English when left out. */
149
+ clearStyle?: string;
150
+ clearStyleEmpty?: string;
146
151
  /**
147
152
  * The final toolbar's buttons (E5b, design final 2026-10-06): what each is
148
- * called — its accessible name and tooltip. Undo's tooltip also says how to
149
- * redo, since there is no Redo button. Optional, like every E5b word, so a
150
- * host's words from before still type.
153
+ * called — its accessible name and tooltip. No Undo since 2026-10-07
154
+ * (owner ruling): ⌘Z still undoes and needs no word. Optional, like every
155
+ * E5b word, so a host's words from before still type.
151
156
  */
152
157
  toolbar?: {
153
158
  bold: string;
@@ -158,8 +163,6 @@ type CopyWords = {
158
163
  link: string;
159
164
  sup: string;
160
165
  sub: string;
161
- undo: string;
162
- undoTitle: string;
163
166
  bullet: string;
164
167
  number: string;
165
168
  letterCase: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "0.100.0",
3
+ "version": "0.101.1",
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",
@@ -1,10 +0,0 @@
1
- import{DEFAULT_PICK_WORDS as e}from"./chunk-ZAOM6PFH.js";import{useId as t,useState as n,useRef as a,useEffect as r}from"react";import{jsxs as l,jsx as o}from"react/jsx-runtime";var i=/^(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,s=7;function c(e){const t=e.trim().replace(/^#/,"");if(!i.test(t))return null;return`#${(3===t.length?[...t].map(e=>e+e).join(""):t).toLowerCase()}`}var u=e=>e.toUpperCase(),h=(e,t,n)=>Math.min(n,Math.max(t,e));function d(e){const t=c(e)??"#000000",n=parseInt(t.slice(1,3),16)/255,a=parseInt(t.slice(3,5),16)/255,r=parseInt(t.slice(5,7),16)/255,l=Math.max(n,a,r),o=l-Math.min(n,a,r);let i=0;return 0!==o&&(i=l===n?(a-r)/o%6*60:l===a?60*((r-n)/o+2):60*((n-a)/o+4)),{h:(i+360)%360,s:0===l?0:o/l,v:l}}function p({h:e,s:t,v:n}){const a=(e%360+360)%360,r=h(t,0,1),l=h(n,0,1),o=l*r,i=o*(1-Math.abs(a/60%2-1)),s=l-o,[c,u,d]=a<60?[o,i,0]:a<120?[i,o,0]:a<180?[0,o,i]:a<240?[0,i,o]:a<300?[i,0,o]:[o,0,i],p=e=>Math.round(255*(e+s)).toString(16).padStart(2,"0");return`#${p(c)}${p(u)}${p(d)}`}function m(e,t,n){return{s:n.width>0?h((e-n.left)/n.width,0,1):0,v:n.height>0?1-h((t-n.top)/n.height,0,1):0}}function v(e,t){return t.width>0?360*h((e-t.left)/t.width,0,1):0}function g(e){if(/^(data|blob):/i.test(e))return"";const t=(e.split(/[?#]/)[0]??"").split("/").filter(Boolean).pop()??"";try{return decodeURIComponent(t)}catch{return t}}function w({value:i,onChange:s,label:h,theme:d,caption:p,id:m,readOnly:v,words:g=e.colour}){const w=t(),[b,y]=n(!1),x=a(null),C=a(null);r(()=>{if(!b)return;const e=x.current?.ownerDocument;if(!e)return;const t=e=>{x.current&&!x.current.contains(e.target)&&y(!1)};return e.addEventListener("click",t,!0),()=>e.removeEventListener("click",t,!0)},[b]);const M=void 0===p||i&&c(p)===c(i)?null:p,N=M??(i?u(i):g.notSet);/* @__PURE__ */
2
- return l("div",{ref:x,className:"es-pick-colour",children:[
3
- /* @__PURE__ */l("div",{className:"es-pick-colour-row",children:[
4
- /* @__PURE__ */o("button",{ref:C,id:m,type:"button",className:i?"es-pick-swatch":"es-pick-swatch is-unset",style:i?{background:i}:void 0,"aria-label":g.swatch({label:h,shown:N}),"aria-expanded":b,"aria-controls":b?w:void 0,disabled:v,onClick:()=>y(e=>!e)}),null===M?/* @__PURE__ */o(k,{value:i,onChange:e=>{v||e===i||s(e)},name:g.hex({label:h}),readOnly:v}):/* @__PURE__ */o("span",{className:"es-pick-caption",children:M})]}),b?/* @__PURE__ */o(f,{id:w,value:i,onChange:s,label:h,theme:d,readOnly:v,words:g,onClose:()=>{y(!1),C.current?.focus()}}):null]})}function f({value:t,onChange:i,label:s,theme:h,onClose:g,id:w,readOnly:f,words:b=e.colour,swatch:y=!1,dragWrites:x="live"}){const[C,M]=n(()=>d(t||"#000000")),N=a(t);r(()=>{t!==N.current&&(N.current=t,t&&M(d(t)))},[t]);const D=e=>{f||e===t||(N.current=e,i(e))},A=e=>{M(d(e)),D(e)},O=e=>{M(e),D(p(e))},[$,I]=n(!1),P=a(C);P.current=C;const E=e=>({onPointerDown:t=>{if(f)return;t.currentTarget.setPointerCapture?.(t.pointerId);const n=e(t,P.current);"end"===x?(I(!0),M(n)):O(n)},onPointerMove:t=>{if(!(1&t.buttons))return;const n=e(t,P.current);"end"===x?M(n):O(n)},onPointerUp:t=>{"end"===x&&$&&(I(!1),O(e(t,P.current)))}}),K=E((e,t)=>({...t,...m(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),L=E((e,t)=>({...t,h:v(e.clientX,e.currentTarget.getBoundingClientRect())})),T=$?p(C):t,R=e=>`${Math.round(100*e)}%`;/* @__PURE__ */
5
- return l("div",{id:w,role:"dialog","aria-label":b.dialog({label:s}),className:"es-pick-window",onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),g?.())},children:[h&&h.length>0?/* @__PURE__ */o("div",{role:"group","aria-label":b.theme,className:"es-pick-theme",children:h.map(e=>/* @__PURE__ */o("button",{type:"button",className:"es-pick-theme-swatch",style:{background:e.value},title:b.themeSwatchTitle({name:e.name,hex:u(e.value)}),"aria-label":b.themeSwatch({name:e.name,hex:u(e.value)}),"aria-pressed":c(e.value)===t,onClick:()=>A(c(e.value)??e.value)},`${e.name}:${e.value}`))}):null,
6
- /* @__PURE__ */o("div",{className:"es-pick-sv",role:"slider",tabIndex:0,"aria-label":b.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*C.v),"aria-valuetext":b.squareValue({saturation:R(C.s),brightness:R(C.v)}),style:{backgroundColor:p({h:C.h,s:1,v:1})},onKeyDown:e=>{const t=e.shiftKey?.1:.01,n={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowDown:[0,-t],ArrowUp:[0,t]}[e.key];n&&(e.preventDefault(),O({...C,s:Math.min(1,Math.max(0,C.s+n[0])),v:Math.min(1,Math.max(0,C.v+n[1]))}))},...K,children:/* @__PURE__ */o("span",{className:"es-pick-sv-thumb",style:{left:R(C.s),top:R(1-C.v)}})}),
7
- /* @__PURE__ */o("div",{className:"es-pick-hue",role:"slider",tabIndex:0,"aria-label":b.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(C.h),onKeyDown:e=>{const t=e.shiftKey?10:1,n="ArrowLeft"===e.key||"ArrowDown"===e.key?-t:"ArrowRight"===e.key||"ArrowUp"===e.key?t:null,a="Home"===e.key?0:"End"===e.key?359:null===n?null:Math.min(359,Math.max(0,C.h+n));null!==a&&(e.preventDefault(),O({...C,h:a}))},...L,children:/* @__PURE__ */o("span",{className:"es-pick-hue-thumb",style:{left:C.h/360*100+"%"}})}),y?/* @__PURE__ */l("div",{className:"es-pick-hex-row",children:[
8
- /* @__PURE__ */o("span",{className:"es-pick-hex-swatch","aria-hidden":"true",style:{background:T||p(C)}}),
9
- /* @__PURE__ */o(k,{value:T,onChange:A,name:b.hex({label:s}),readOnly:f})]}):/* @__PURE__ */o(k,{value:T,onChange:A,name:b.hex({label:s}),readOnly:f})]})}function k({value:e,onChange:t,name:a,readOnly:r}){const[l,i]=n(null);/* @__PURE__ */
10
- return o("input",{type:"text",className:"es-pick-hex",value:l??(e?u(e):""),"aria-label":a,maxLength:7,spellCheck:!1,autoComplete:"off",readOnly:r,onChange:n=>{i(n.target.value);const a=c(n.target.value);null!==a&&a!==e&&t(a)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),e.stopPropagation(),i(null),e.currentTarget.blur())},onBlur:()=>i(null)})}export{w as ColourPicker,f as ColourWindow,s as HEX_MAX_LENGTH,u as hexReadout,d as hexToHsv,p as hsvToHex,v as hueFromPoint,g as mediaName,m as svFromPoint,c as typedHex};
@@ -1 +0,0 @@
1
- var e={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};function t(e){return/^[a-z][a-z0-9-]*$/.test(e)}function n(e){return t(e)||/^#[0-9a-fA-F]{6}$/.test(e)}function l(e){return n(e)?e.startsWith("#")?e.toLowerCase():e:null}function r(e,t){const n=/^\{(underline|sup|sub|color=([a-z][a-z0-9-]*|#[0-9a-fA-F]{6}))\}/.exec(e.slice(t,t+64));return n?void 0===n[2]?{kind:n[1],length:n[0].length}:{kind:"color",color:n[2],length:n[0].length}:null}var s={bold:e.bold.placeholder,italic:e.italic.placeholder,strike:e.strike.placeholder,code:e.code.placeholder,highlight:e.highlight.placeholder,quiet:e.quiet.placeholder,link:"link text",underline:e.underline.placeholder,sup:e.sup.placeholder,sub:e.sub.placeholder,color:"colored text"},i={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function o(t,n,l,r,o=k,c=s){if("clear"===r)return N(t,n,l,o);const a=t.slice(n,l);if("link"===r){const e=a||c.link,r=`[${e}](https://)`;return{text:t.slice(0,n)+r+t.slice(l),selectionStart:n+e.length+3,selectionEnd:n+r.length-1}}const h=i[r];if(h){const e=t.lastIndexOf("\n",Math.max(n-1,0))+1,r=t.indexOf("\n",l),s=-1===r?t.length:r,i=t.slice(e,s).split("\n"),o=i.every((e,t)=>e.startsWith(h(t))),c=i.map((e,t)=>o?e.slice(h(t).length):h(t)+e).join("\n");return{text:t.slice(0,e)+c+t.slice(s),selectionStart:e,selectionEnd:e+c.length}}const{open:d,close:f}=e[r],m=r,p=c[m]??s[m];if(u(t,n,l,r))return{text:t.slice(0,n-d.length)+a+t.slice(l+f.length),selectionStart:n-d.length,selectionEnd:n-d.length+a.length};const b=a||p;return{text:t.slice(0,n)+d+b+f+t.slice(l),selectionStart:n+d.length,selectionEnd:n+d.length+b.length}}function c(e,t,n,i,o=s){const c={text:e,selectionStart:t,selectionEnd:n};if(null!==i){const e=l(i);if(null===e)return c;i=e}const u=e.slice(t,n),a=t>=1&&"["===e[t-1]&&"]"===e[n]?r(e,n+1):null;if("color"===a?.kind){const l=t-1,r=e.slice(n+1+a.length);return null===i?{text:e.slice(0,l)+u+r,selectionStart:l,selectionEnd:l+u.length}:{text:`${e.slice(0,n)}]{color=${i}}${r}`,selectionStart:t,selectionEnd:n}}if(null===i)return c;const h=u||(o.color??s.color);return{text:`${e.slice(0,t)}[${h}]{color=${i}}${e.slice(n)}`,selectionStart:t+1,selectionEnd:t+1+h.length}}function u(t,n,l,r){const s=e[r];if(!s)return!1;const{open:i,close:o}=s;return n>=i.length&&t.slice(n-i.length,n)===i&&t.slice(l,l+o.length)===o}function a(e,t,n){const l=0===t?0:e.lastIndexOf("\n",t-1)+1;for(let r=e.lastIndexOf("[",t);r>=l;r=0===r?-1:e.lastIndexOf("[",r-1)){const t=B(e,r);if(t&&n<=t.end)return{start:r,end:t.end,label:t.label,href:t.href}}return null}function h(e,t,n,l){const r=a(e,t,n),s=r?r.start:t,i=r?r.end:n,o=`[${r?r.label:e.slice(t,n)||l}](${l})`,c=s+o.length;return{text:e.slice(0,s)+o+e.slice(i),selectionStart:c,selectionEnd:c}}function d(e,t){return{text:e.slice(0,t.start)+t.label+e.slice(t.end),selectionStart:t.start,selectionEnd:t.start+t.label.length}}var f=[{style:"bold",label:"B",name:"Strong",title:"Strong · **words** · ⌘B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic · _words_ · ⌘I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough · ~~words~~"},{style:"highlight",label:"◆",name:"Emphasis",title:"Emphasis · ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet · ^^words^^"},{style:"code",label:"‹›",name:"Code",title:"Code"},{style:"link",label:"🔗",name:"Link",title:"Link · [words](https://…) · ⌘K",shortcut:"k"},{style:"bullet",label:"•",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"❝",name:"Quote",title:"Quote"},{style:"clear",label:"T×",name:"Clear marks",title:"Clear marks · ⌘⇧X",shortcut:"shift+x"}],m={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function p(e){return f.filter(t=>e.includes(t.style))}var k=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold"}],b=["highlight","quiet"],g=f.map(e=>e.style).filter(e=>k.some(t=>t.kind===e)).filter(e=>!b.includes(e)),x=[...k,{open:"*",close:"*",kind:"accent"}],S=[...k,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];function v(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function w(e,t){const n=[];let l="",r=0;for(;r<e.length;){const s=y(e,r,t);s?(n.push({kind:"text",text:l}),l="",n.push({kind:s.rule.kind,text:s.inner}),r=s.end):(l+=e[r],r+=1)}return n.push({kind:"text",text:l}),n}function y(e,t,n){for(const l of n){if(!e.startsWith(l.open,t))continue;if(l.wordBoundary&&t>0&&v(e[t-1]))continue;const n=t+l.open.length,s=e.indexOf(l.close,n);if(s<n+1)continue;const i=e.slice(n,s);if(i.includes(l.close[0]))continue;if(i.includes("\n"))continue;const o=s+l.close.length,c=e[o];if((!l.notBefore||void 0===c||!l.notBefore.includes(c))&&!(l.notBeforeBlock&&r(e,o)||l.wordBoundary&&void 0!==c&&v(c)))return{rule:l,inner:i,end:o}}return null}function E(e,t){return w(e,t).map(e=>e.text).join("")}var M=["http","https","mailto","tel"];function $(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||M.includes(t[1].toLowerCase())}function B(e,t){if("["!==e[t])return null;const n=e.indexOf("]",t+1);if(n<t+2||"("!==e[n+1])return null;const l=e.slice(t+1,n);if(l.includes("["))return null;const r=e.indexOf(")",n+2);if(-1===r)return null;const s=e.slice(n+2,r);return $(s)?{label:l,href:s,end:r+1}:null}function z(e,t){if("["!==e[t])return null;let n=0;for(let l=t;l<e.length;l+=1){const s=e[l];if("\n"===s)return null;if("["===s)n+=1;else if("]"===s){if(n-=1,n>0)continue;if(l===t+1)return null;const s=r(e,l+1);return s?{kind:s.kind,color:s.color,label:e.slice(t+1,l),close:e.slice(l,l+1+s.length),end:l+1+s.length}:null}}return null}var q=4;function I(e,t,n){const l=[];let r="";const s=()=>{r&&l.push({kind:"text",text:r}),r=""},i=e=>n+1<q?I(e,t,n+1):[{kind:"text",text:e}];let o=0;for(;o<e.length;){const n=B(e,o);if(n){s(),l.push({kind:"link",href:n.href,children:i(n.label)}),o=n.end;continue}const c=z(e,o);if(c){s(),l.push({kind:c.kind,open:"[",close:c.close,...void 0===c.color?{}:{color:c.color},children:i(c.label)}),o=c.end;continue}const u=y(e,o,t);u?(s(),l.push({kind:u.rule.kind,open:u.rule.open,close:u.rule.close,children:i(u.inner)}),o=u.end):(r+=e[o],o+=1)}return s(),l}function O(e,t){return e.split("\n").map(e=>{const{bullet:n,number:l,rest:r}=function(e){if(e.startsWith("- ")&&""!==e.slice(2).trim())return{bullet:!0,number:null,rest:e.slice(2)};const t=/^([0-9]{1,3})\. /.exec(e);return t&&""!==e.slice(t[0].length).trim()?{bullet:!1,number:t[1],rest:e.slice(t[0].length)}:{bullet:!1,number:null,rest:e}}(e);return{bullet:n,number:l,children:I(r,t,0)}})}function C(e){return null!=e.number?`${e.number}. `:e.bullet?"- ":""}function _(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${_(e.children)}](${e.href})`:e.open+_(e.children)+e.close).join("")}function j(e){return e.map(e=>C(e)+_(e.children)).join("\n")}function Q(t,n,r){if("link"===n)return void 0===r?null:{id:t,kind:"link",open:"[",close:`](${r})`,href:r};if("color"===n){const e=void 0===r?null:l(r);return null===e?null:{id:t,kind:"color",open:"[",close:`]{color=${e}}`,color:e}}const s=e[n];return s&&"code"!==n?{id:t,kind:n,open:s.open,close:s.close}:null}function A(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[r]=O(e,t);let s=l+C(r).length;l+=e.length+1;const i=[],o=(e,t)=>{for(const l of e){if("text"===l.kind){for(const e of l.text)i.push({ch:e,marks:t,at:s}),s+=e.length;continue}const e="link"===l.kind?Q(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close,...void 0===l.color?{}:{color:l.color}};s+=e.open.length,o(l.children,[...t,e]),s+=e.close.length}};return o(r.children,[]),{bullet:r.bullet,number:r.number??null,chars:i}})}function L(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),t+=C(e);const r=[],s=[];for(const n of e.chars){let e=0;for(;e<r.length&&e<n.marks.length&&r[e].id===n.marks[e].id;)e+=1;for(;r.length>e;)t+=r.pop().close;for(let l=e;l<n.marks.length;l+=1)t+=n.marks[l].open,r.push(n.marks[l]);s.push(t.length),t+=n.ch}for(;r.length>0;)t+=r.pop().close;n.push(s)}),{text:t,at:n}}function W(e,t){return e.length===t.length&&e.every((e,n)=>{const l=t[n];return e.bullet===l.bullet&&(e.number??null)===(l.number??null)&&(e.chars.length===l.chars.length&&e.chars.every((e,t)=>{const n=l.chars[t];return e.ch===n.ch&&e.marks.length===n.marks.length&&e.marks.every((e,t)=>e.kind===n.marks[t].kind&&e.href===n.marks[t].href&&e.color===n.marks[t].color)}))})}function N(e,t,n,l=k){const r=A(e,l),s=r.flatMap(e=>e.chars),i={text:e,selectionStart:t,selectionEnd:n},o=e=>r.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:t.marks.filter(n=>"link"===n.kind||!e(t,n))}))})),c=e=>{const t=L(e);return W(e,A(t.text,l))?t:null},u=(e,t)=>{let n=s.indexOf(t);for(let t=0;t<e.at.length;t+=1){if(n<e.at[t].length)return e.at[t][n];n-=e.at[t].length}return 0};if(t===n){const e=[...s].reverse().find(e=>e.at<t),n=s.find(e=>e.at>=t),l=new Set([...e?.marks??[],...n?.marks??[]].map(e=>e.id));if(![...l].some(e=>s.some(t=>t.marks.some(t=>t.id===e&&"link"!==t.kind))))return i;const r=c(o((e,t)=>l.has(t.id)));if(!r)return i;const a=n?u(r,n):e?u(r,e)+e.ch.length:0;return{text:r.text,selectionStart:a,selectionEnd:a}}const a=new Set(s.filter(e=>e.at>=t&&e.at<n));if(0===a.size)return i;const h=new Set([...a].flatMap(e=>e.marks.map(e=>e.id))),d=c(K(o(e=>a.has(e)),h))??c(o((e,t)=>h.has(t.id)));if(!d)return i;const f=s.find(e=>a.has(e)),m=[...s].reverse().find(e=>a.has(e));return{text:d.text,selectionStart:u(d,f),selectionEnd:u(d,m)+m.ch.length}}function F(e){return e.at.flat()}function Z(e,t){const n=L(e);return W(e,A(n.text,t))?n:null}function K(e,t){return e.map(e=>{const n=e.chars.map(e=>({...e}));for(const e of t){const t=t=>t.marks.some(t=>t.id===e),l=n.flatMap((e,n)=>t(e)?[n]:[]),r=t=>{n[t].marks=n[t].marks.filter(t=>t.id!==e)};for(let e=0;e<l.length&&/\s/.test(n[l[e]].ch);e+=1)r(l[e]);for(let e=l.length-1;e>=0&&/\s/.test(n[l[e]].ch)&&t(n[l[e]]);e-=1)r(l[e])}return{bullet:e.bullet,number:e.number,chars:n}})}function T(e,t){return t.kind===e||"highlight"===e&&"accent"===t.kind}function X(e,t,n){const l=e.findIndex(e=>n(e.id));return-1===l?[...e,t]:[...e.slice(0,l),t,...e.slice(l)]}function D(e,t,n,l,r,s){if(!l)return{text:e,selectionStart:r,selectionEnd:s};const i=F(l),o=t.flatMap((e,t)=>n.has(e)?[t]:[]),c=o[0],u=o[o.length-1];return{text:l.text,selectionStart:i[c],selectionEnd:i[u]+t[u].ch.length}}function G(e,t,n,l,r=k){if(t===n||!Q(0,l))return o(e,t,n,l,r);const s=A(e,r),i=s.flatMap(e=>e.chars),c=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===c.size)return{text:e,selectionStart:t,selectionEnd:n};const u=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))}));if([...c].every(e=>e.marks.some(e=>T(l,e)))){const s=new Set([...c].flatMap(e=>e.marks.filter(e=>T(l,e)).map(e=>e.id))),o=Z(K(u(e=>c.has(e)?e.marks.filter(e=>!T(l,e)):e.marks),s),r)??Z(u(e=>e.marks.filter(e=>!s.has(e.id))),r);return D(e,i,c,o,t,n)}const a=new Set([...c].flatMap(e=>e.marks.filter(e=>T(l,e)).map(e=>e.id))),h=new Set(i.filter(e=>c.has(e)||e.marks.some(e=>a.has(e.id)))),d=Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,f=Q(d,l),m=e=>i.every(t=>!t.marks.some(t=>t.id===e)||h.has(t)),p=Z(K(u(e=>h.has(e)?X(e.marks.filter(e=>!T(l,e)),f,m):e.marks),/* @__PURE__ */new Set([d])),r);return D(e,i,c,p,t,n)}function H(e,t,n,l=k){const r=A(e,l).flatMap(e=>e.chars);let s;if(t===n){const n=[...r].reverse().find(n=>n.at<t&&!e.slice(n.at,t).includes("\n"));s=n?[n]:[]}else s=r.filter(e=>e.at>=t&&e.at<n);if(0===s.length)/* @__PURE__ */return new Set;const i=s.map(e=>new Set(e.marks.map(e=>e.kind)));return new Set([...i[0]].filter(e=>i.every(t=>t.has(e))))}function J(e,t,n){const l=t===n?[[...e].reverse().find(e=>e.at<t),e.find(e=>e.at>=t)]:e.filter(e=>e.at>=t&&e.at<n);for(const e of l){const t=e?.marks.find(e=>"link"===e.kind);if(t)return t.id}return null}function P(e,t,n,l,r=k){const s=A(e,r),i=s.flatMap(e=>e.chars),o=e=>s.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),c=(e,t,n)=>{const l=F(e),r=i.reduce((e,n,l)=>t(n)?l:e,-1),s=l[r]+i[r].ch.length+n.close.length;return{text:e.text,selectionStart:s,selectionEnd:s}};if(t===n){const s=J(i,t,n);if(null===s)return h(e,t,n,l);const u=Q(s,"link",l),a=Z(o(e=>e.marks.map(e=>e.id===s?u:e)),r);return a?c(a,e=>e.marks.some(e=>e.id===s),u):{text:e,selectionStart:t,selectionEnd:n}}const u=new Set(i.filter(e=>e.at>=t&&e.at<n));if(0===u.size)return h(e,t,n,l);const a=Q(Math.max(0,...i.flatMap(e=>e.marks.map(e=>e.id)))+1,"link",l),d=e=>i.every(t=>!t.marks.some(t=>t.id===e)||u.has(t)),f=Z(o(e=>u.has(e)?X(e.marks.filter(e=>"link"!==e.kind),a,d):e.marks),r);return f?c(f,e=>u.has(e),a):{text:e,selectionStart:t,selectionEnd:n}}function R(e,t,n,l=k){const r=A(e,l),s=r.flatMap(e=>e.chars),i=J(s,t,n);if(null===i)return{text:e,selectionStart:t,selectionEnd:n};const o=new Set(s.filter(e=>e.marks.some(e=>e.id===i)));return D(e,s,o,Z(r.map(e=>({bullet:e.bullet,number:e.number,chars:e.chars.map(e=>({...e,marks:e.marks.filter(e=>e.id!==i)}))})),l),t,n)}function U(e,t,l,r,s=k){const i={text:e,selectionStart:t,selectionEnd:l};if(t===l||null!==r&&!n(r))return i;const o=A(e,s),c=o.flatMap(e=>e.chars),u=new Set(c.filter(e=>e.at>=t&&e.at<l));if(0===u.size)return i;const a=e=>o.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:e(t)}))})),h=new Set([...u].flatMap(e=>e.marks.filter(e=>"color"===e.kind).map(e=>e.id)));if(null===r){const n=Z(K(a(e=>u.has(e)?e.marks.filter(e=>"color"!==e.kind):e.marks),h),s)??Z(a(e=>e.marks.filter(e=>!h.has(e.id))),s);return D(e,c,u,n,t,l)}const d=Math.max(0,...c.flatMap(e=>e.marks.map(e=>e.id)))+1,f=Q(d,"color",r),m=e=>c.every(t=>!t.marks.some(t=>t.id===e)||u.has(t)),p=Z(K(a(e=>u.has(e)?X(e.marks.filter(e=>"color"!==e.kind),f,m):e.marks),/* @__PURE__ */new Set([d,...h])),s);return D(e,c,u,p,t,l)}function V(e,t,n,l=k){const r=A(e,l).flatMap(e=>e.chars),s=t===n?[[...r].reverse().find(n=>n.at<t&&!e.slice(n.at,t).includes("\n"))].filter(e=>void 0!==e):r.filter(e=>e.at>=t&&e.at<n);if(0===s.length)return null;const i=e=>e.marks.filter(e=>"color"===e.kind).pop()?.color??null,o=i(s[0]);return null!==o&&s.every(e=>i(e)===o)?o:null}var Y=/^(?:- |([0-9]{1,3})\. )$/;function ee(e,t,n){const l=e.split("\n"),r=[];let s=0;for(const e of l)r.push(s),s+=e.length+1;const i=e=>{let t=0;for(;t+1<r.length&&r[t+1]<=e;)t+=1;return t};return{first:i(t),last:i(Math.max(t,n)),starts:r}}function te(e,t){if(null!=t.number)return"number";if(t.bullet)return"bullet";const n=Y.exec(e);return n?void 0===n[1]?"bullet":"number":null}function ne(e,t,n,l,r=k){const s=e.split("\n"),i=A(e,r),{first:o,last:c}=ee(e,t,n),u=i.map((e,t)=>null===te(s[t],e)||e.bullet||null!=e.number?{bullet:e.bullet,number:e.number??null,chars:e.chars}:{bullet:!1,number:null,chars:[]});let a=0;if("number"===l&&o>0&&"number"===te(s[o-1],i[o-1])){const e=i[o-1].number??Y.exec(s[o-1])?.[1]??"0";a=Number(e)}const h=L(u.map((e,t)=>t<o||t>c?e:"bullet"===l?{bullet:!0,number:null,chars:e.chars}:"number"===l?{bullet:!1,number:String(a+=1),chars:e.chars}:{bullet:!1,number:null,chars:e.chars})).text.split("\n").map((e,t)=>t<o||t>c?s[t]:e),d=h.join("\n"),{starts:f}=ee(e,0,0),m=t=>{const{first:n}=ee(e,t,t);let l=0;for(let e=0;e<n;e+=1)l+=h[e].length-s[e].length;const r=null===te(s[o=n],i[o])||i[o].bullet||null!=i[o].number?C(i[o]).length:s[o].length;var o;const c=h[n].length-(s[n].length-r),u=t-f[n];return f[n]+l+(u<r?c:u-r+c)};return{text:d,selectionStart:m(t),selectionEnd:m(n)}}function le(e,t,n,l=k){const r=e.split("\n"),s=A(e,l),{first:i,last:o}=ee(e,t,n),c=new Set(s.slice(i,o+1).map((e,t)=>te(r[i+t],e)));return 1===c.size?[...c][0]:null}export{S as CAMPAIGN_MARKUP,g as COPY_FIELD_TOOLS,f as MARKUP_TOOLS,m as MARK_NAMES,s as MARK_PLACEHOLDERS,b as RETIRED_MARKS,k as STANDARD_MARKUP,x as STOREFRONT_MARKUP,c as applyColor,o as applyMark,N as clearMarks,V as colorIn,U as colorOver,a as findLink,t as isColorName,n as isColorValue,$ as isSafeLinkHref,P as linkOver,le as listIn,u as markedAt,A as markedLines,H as marksIn,p as markupTools,O as parseMarkup,d as removeLink,W as sameMarks,j as serializeMarkup,ne as setList,Q as spanFor,E as stripInline,G as toggleMark,w as tokenizeInline,R as unlinkAt,h as writeLink,L as writeMarkedLines};
@@ -1 +0,0 @@
1
- import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-HDVD27VB.js";var r={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},link:{title:"Link",label:"Link",placeholder:"https://… or /page",refused:"Use a web address (https://…), a page on this site (/…), mailto: or tel:.",remove:"Remove",cancel:"Cancel",apply:"Apply"},marks:Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),placeholders:t,showMarks:"Show marks",toolbar:{bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",color:"Color",link:"Link",sup:"Superscript",sub:"Subscript",undo:"Undo",undoTitle:"Undo · ⌘Z (Redo · ⇧⌘Z)",bullet:"Bulleted list",number:"Numbered list",letterCase:"Letter case",caseNone:"Normal",caseUpper:"Uppercase",caseLower:"Lowercase"},colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:r})=>`${e} · step ${t} ${r} · Shift ×10`}};export{r as DEFAULT_COPY_WORDS};
@@ -1 +0,0 @@
1
- var e={less:"Less",more:"More",choose:"Choose…",search:"Search…",noMatches:"No matches",list:{item:"item",itemName:({noun:e,n:t})=>{return`${o=e,o?o[0].toUpperCase()+o.slice(1):o} ${t}`;var o},position:({n:e,total:t})=>`${e} of ${t}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`}};export{e as DEFAULT_FIELDS_WORDS};
@@ -1,9 +0,0 @@
1
- import{DEFAULT_CHROME_WORDS as e}from"./chunk-ZJEBF4NB.js";import{useWords as n}from"./chunk-MFIRYGHW.js";import{jsxs as i,jsx as s}from"react/jsx-runtime";function a({icon:e,name:n,kind:a,actions:l}){/* @__PURE__ */
2
- return i("div",{className:"es-insp-head",children:[
3
- /* @__PURE__ */s("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
4
- /* @__PURE__ */i("div",{className:"es-insp-titles",children:[
5
- /* @__PURE__ */s("h2",{className:"es-insp-name",children:n}),
6
- /* @__PURE__ */s("div",{className:"es-insp-kind",children:a})]}),l?/* @__PURE__ */s("div",{className:"es-insp-actions",children:l}):null]})}function l({label:e,title:n,hasPopup:i,onClick:a,disabled:l,danger:c,expanded:t,buttonRef:r,children:p}){/* @__PURE__ */
7
- return s("button",{ref:r,type:"button",className:c?"es-insp-iconbtn es-insp-iconbtn--danger":"es-insp-iconbtn",title:n??e,"aria-label":e,"aria-haspopup":i,"aria-expanded":t,disabled:l,onClick:a,children:p})}function c({name:a,onSelect:l,label:c,inline:t}){const r=n("chrome",e),p=c??r.upLevel,d=/* @__PURE__ */i("button",{type:"button",className:"es-insp-up-btn",title:p,"aria-label":r.upLevelTo({label:p,name:a}),onClick:l,children:[
8
- /* @__PURE__ */s("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),
9
- /* @__PURE__ */s("span",{className:"es-insp-up-name",children:a})]});return t?d:/* @__PURE__ */s("div",{className:"es-insp-up",children:d})}export{a as InspectorHead,l as InspectorIconButton,c as InspectorUpLevel};
@@ -1 +0,0 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_CANVAS_WORDS as t}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as m}from"./chunk-3EDSDPIP.js";import{DEFAULT_PANEL_WORDS as n}from"./chunk-TRVZ7C23.js";import{DEFAULT_NODE_MENU_WORDS as c}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as s}from"./chunk-H6DDIBQ4.js";import{DEFAULT_LOCK_WORDS as f}from"./chunk-RE4LP46F.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as i}from"./chunk-ZJEBF4NB.js";import{DEFAULT_RAIL_WORDS as u}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as e}from"./chunk-JQM3V7XQ.js";import{DEFAULT_PICK_WORDS as k}from"./chunk-ZAOM6PFH.js";import{DEFAULT_FIELDS_WORDS as j}from"./chunk-LA54QLP5.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";var l={notice:i,lock:f,save:s,chrome:p,rail:u,tree:m,panel:n,fields:j,pick:k,drag:h,menu:c,styleClipboard:r,copy:e,canvas:t,textStyles:o},a=o=>"object"==typeof o&&null!==o;function y(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:a(n)?t[m]=a(c)?y(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function F(o,r){return r?y(o,r):o}export{l as DEFAULT_EASEL_STRINGS,F as mergeEaselStrings};