@monowind/ascii 0.2.5 → 0.2.7

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 (2) hide show
  1. package/dist/cdn.js +1 -1
  2. package/package.json +4 -4
package/dist/cdn.js CHANGED
@@ -30163,5 +30163,5 @@ of new full-width/kern/smush alternatives, but default output is NOT changed.
30163
30163
  #mirror::selection { color: var(--mw-bg, canvas); text-shadow: 0 0 0 var(--mw-bg, canvas); background: var(--mw-fg, canvastext); }
30164
30164
  .alt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; user-select: none; -webkit-user-select: none; }
30165
30165
  </style><pre id="mirror" aria-hidden="true"></pre><span class="alt"><slot></slot></span>`,j=class extends k{#e=null;#t=null;constructor(){super();let e=this.attachShadow({mode:`open`});e.innerHTML=A,this.#t=e.getElementById(`mirror`)}get font(){return this.#e}set font(t){this.#e=t,(0,e.invalidateLeaves)()}syncMirror(e){let t=e.join(`
30166
- `);this.#t&&this.#t.textContent!==t&&(this.#t.textContent=t)}};function M(e){let t=N(e);return e.syncMirror?.(t.lines),t}function N(e){let t=(e.textContent??``).replace(/\s+/g,` `).trim();e.children.length>0&&!E.has(e)&&(E.add(e),console.warn(`[monowind] <mono-ascii> takes text only; element children are ignored.`,e));let n=e.getAttribute(`font`)??`standard`,r=e.font??m(n);if(!r)return T.has(`font:${n}`)||(T.add(`font:${n}`),D?D(n):console.warn(`[monowind] <mono-ascii>: no registered font "${n}"; rendering plain text.`,e)),{lines:t?[t]:[]};if(!t)return{lines:[]};let i=h(t,r),a=e.getAttribute(`effect`);return a&&C(a)?{lines:i.lines,runs:w(a,i.lines)}:{lines:i.lines,runs:i.runs}}function P(){typeof customElements>`u`||customElements.get(`mono-ascii`)||(customElements.define(`mono-ascii`,j),(0,e.registerLeafRenderer)({tag:`mono-ascii`,observedAttributes:[`font`,`effect`],render:M,selectionTarget:e=>e.shadowRoot?.getElementById(`mirror`)??null}))}P();var F=`@layer base{mono-ascii{display:block}}`,I=document.createElement(`style`);I.setAttribute(`data-monowind-ascii`,``),I.textContent=F,document.head.appendChild(I);var L=new Map;function R(e){let t=e.toLowerCase().replace(/\.(flf|tlf)$/,``),n=L.get(t);if(n)return n;let r=z(t).finally(()=>L.delete(t));return L.set(t,r),r}async function z(e){let t=m(e);if(t)return t;for(let t of[`fonts/`,`https://cdn.jsdelivr.net/npm/@monowind/ascii@0.2.5/fonts/`])for(let n of[`flf`,`tlf`])try{let r=await fetch(`${t}${e}.${n}`);if(r.ok)return p(e,await r.text())}catch{}return console.warn(`[monowind] loadFont("${e}"): no such bundled font.`),null}O(e=>void R(e));var B=globalThis.monowind;Object.assign(globalThis,{monowind:{...B,ascii:{...B?.ascii,asciiFont:m,loadFont:R,registerAsciiFont:p,version:`0.2.5`}}})})(monowind);
30166
+ `);this.#t&&this.#t.textContent!==t&&(this.#t.textContent=t)}};function M(e){let t=N(e);return e.syncMirror?.(t.lines),t}function N(e){let t=(e.textContent??``).replace(/\s+/g,` `).trim();e.children.length>0&&!E.has(e)&&(E.add(e),console.warn(`[monowind] <mono-ascii> takes text only; element children are ignored.`,e));let n=e.getAttribute(`font`)??`standard`,r=e.font??m(n);if(!r)return T.has(`font:${n}`)||(T.add(`font:${n}`),D?D(n):console.warn(`[monowind] <mono-ascii>: no registered font "${n}"; rendering plain text.`,e)),{lines:t?[t]:[]};if(!t)return{lines:[]};let i=h(t,r),a=e.getAttribute(`effect`);return a&&C(a)?{lines:i.lines,runs:w(a,i.lines)}:{lines:i.lines,runs:i.runs}}function P(){typeof customElements>`u`||customElements.get(`mono-ascii`)||(customElements.define(`mono-ascii`,j),(0,e.registerLeafRenderer)({tag:`mono-ascii`,observedAttributes:[`font`,`effect`],render:M,selectionTarget:e=>e.shadowRoot?.getElementById(`mirror`)??null}))}P();var F=`@layer base{mono-ascii{display:block}}`,I=document.createElement(`style`);I.setAttribute(`data-monowind-ascii`,``),I.textContent=F,document.head.appendChild(I);var L=new Map;function R(e){let t=e.toLowerCase().replace(/\.(flf|tlf)$/,``),n=L.get(t);if(n)return n;let r=z(t).finally(()=>L.delete(t));return L.set(t,r),r}async function z(e){let t=m(e);if(t)return t;for(let t of[`fonts/`,`https://cdn.jsdelivr.net/npm/@monowind/ascii@0.2.7/fonts/`])for(let n of[`flf`,`tlf`])try{let r=await fetch(`${t}${e}.${n}`);if(r.ok)return p(e,await r.text())}catch{}return console.warn(`[monowind] loadFont("${e}"): no such bundled font.`),null}O(e=>void R(e));var B=globalThis.monowind;Object.assign(globalThis,{monowind:{...B,ascii:{...B?.ascii,asciiFont:m,loadFont:R,registerAsciiFont:p,version:`0.2.7`}}})})(monowind);
30167
30167
  //# sourceMappingURL=cdn.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monowind/ascii",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "FIGlet/TOIlet ascii-art banner text for monowind: the <mono-ascii> element and a font library",
5
5
  "keywords": [
6
6
  "ascii-art",
@@ -44,14 +44,14 @@
44
44
  "@types/figlet": "^1.7.0",
45
45
  "@types/node": "^26.4.1",
46
46
  "figlet": "^1.11.4",
47
- "happy-dom": "^20.13.2",
48
- "monowind": "^0.2.5",
47
+ "happy-dom": "^20.14.0",
48
+ "monowind": "^0.2.7",
49
49
  "typescript": "^7.0.2",
50
50
  "vite": "^8.2.2",
51
51
  "vitest": "^4.1.11"
52
52
  },
53
53
  "peerDependencies": {
54
- "monowind": "^0.2.5"
54
+ "monowind": "^0.2.7"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "node scripts/generate-fonts.mjs && vite build && vite build -c vite.cdn.config.ts && tsc -p tsconfig.build.json && node -e \"fs.readdirSync('dist/fonts').filter(f=>f.endsWith('.map')).forEach(f=>fs.rmSync('dist/fonts/'+f))\"",