@monowind/ascii 0.2.4 → 0.2.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAExE;AAID,QAAA,MAAM,eAAe,EAEhB,OAAO,WAAW,CAAC;AAsBxB;;;;0DAI0D;AAC1D,qBAAa,gBAAiB,SAAQ,eAAe;;IAInD,cAKC;IAED,IAAI,IAAI,IAAI,SAAS,GAAG,IAAI,CAE3B;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,EAG9B;IAED;;iDAE6C;IAC7C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAGhC;CACF;AAyCD;oCACoC;AACpC,wBAAgB,eAAe,IAAI,IAAI,CAStC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAExE;AAID,QAAA,MAAM,eAAe,EAEhB,OAAO,WAAW,CAAC;AAsBxB;;;;0DAI0D;AAC1D,qBAAa,gBAAiB,SAAQ,eAAe;;IAInD,cAKC;IAED,IAAI,IAAI,IAAI,SAAS,GAAG,IAAI,CAE3B;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,EAG9B;IAED;;iDAE6C;IAC7C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAGhC;CACF;AAyCD;oCACoC;AACpC,wBAAgB,eAAe,IAAI,IAAI,CAUtC"}
package/dist/index.js CHANGED
@@ -194,7 +194,8 @@ function w() {
194
194
  typeof customElements > "u" || customElements.get("mono-ascii") || (customElements.define("mono-ascii", x), i({
195
195
  tag: "mono-ascii",
196
196
  observedAttributes: ["font", "effect"],
197
- render: S
197
+ render: S,
198
+ selectionTarget: (e) => e.shadowRoot?.getElementById("mirror") ?? null
198
199
  }));
199
200
  }
200
201
  w();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/render.ts","../src/effects.ts","../src/index.ts"],"sourcesContent":["/**\n * Horizontal FIGlet composition: glyphs join under the font's own\n * layout mode — full width, kerning, or smushing (universal, or\n * controlled by the header's rule bits 1–6, per the FIGfont spec).\n * Vertical smushing is out of scope (single-line banners). Per-cell\n * color state from SGR-colored glyphs rides along and comes out as\n * paint runs.\n */\n\nimport type { AsciiFont, Glyph } from \"./font.ts\";\nimport type { CellColor } from \"./sgr.ts\";\nimport type { LeafPaint, LeafRun } from \"monowind\";\n\nexport interface RenderedAscii {\n lines: string[];\n runs: LeafRun[];\n}\n\ninterface Row {\n chars: string[];\n paints: (CellColor | undefined)[];\n}\n\nexport function renderAscii(text: string, font: AsciiFont): RenderedAscii {\n const rows: Row[] = Array.from({ length: font.height }, () => ({ chars: [], paints: [] }));\n const missing: Glyph = {\n lines: Array.from({ length: font.height }, () => \" \"),\n width: 1,\n };\n let first = true;\n for (const ch of text) {\n const glyph = font.glyphs.get(ch.codePointAt(0)!) ?? missing;\n const overlap = first ? 0 : smushAmount(rows, glyph, font);\n merge(rows, glyph, overlap, font);\n first = false;\n }\n const lines = rows.map((row) => row.chars.map((c) => (c === font.hardblank ? \" \" : c)).join(\"\"));\n return { lines, runs: collectRuns(rows) };\n}\n\n/** How far the next glyph slides left: the minimum over rows of\n * (trailing spaces + leading spaces), plus one when the touching pair\n * can smush. */\nfunction smushAmount(rows: Row[], glyph: Glyph, font: AsciiFont): number {\n if (font.layout === \"full\") return 0;\n let amount = Number.POSITIVE_INFINITY;\n for (let y = 0; y < rows.length; y++) {\n const a = rows[y]!.chars;\n const b = glyph.lines[y] ?? \"\";\n let trailing = 0;\n while (trailing < a.length && a[a.length - 1 - trailing] === \" \") trailing++;\n let leading = 0;\n while (leading < b.length && b.charAt(leading) === \" \") leading++;\n let amt = trailing + leading;\n if (font.layout !== \"kerning\") {\n const c1 = a[a.length - 1 - trailing];\n const c2 = b.charAt(leading);\n if (c1 !== undefined && c2 !== \"\" && smushem(c1, c2, font) !== null) amt++;\n }\n amount = Math.min(amount, amt);\n }\n return Number.isFinite(amount) ? amount : 0;\n}\n\nfunction merge(rows: Row[], glyph: Glyph, overlap: number, font: AsciiFont): void {\n for (let y = 0; y < rows.length; y++) {\n const row = rows[y]!;\n const line = glyph.lines[y] ?? \"\";\n const colors = glyph.colors?.[y];\n const cut = Math.min(overlap, row.chars.length, line.length);\n const base = row.chars.length - cut;\n for (let k = 0; k < cut; k++) {\n const c1 = row.chars[base + k]!;\n const c2 = line.charAt(k);\n const p1 = row.paints[base + k];\n const p2 = colors?.[k];\n if (c1 === \" \") {\n row.chars[base + k] = c2;\n row.paints[base + k] = c2 === \" \" ? p1 : p2;\n } else if (c2 !== \" \") {\n const smushed = smushem(c1, c2, font);\n row.chars[base + k] = smushed ?? c2;\n row.paints[base + k] = smushed === c1 ? p1 : p2;\n }\n }\n for (let k = cut; k < line.length; k++) {\n row.chars.push(line.charAt(k));\n row.paints.push(colors?.[k]);\n }\n }\n}\n\n/** The smushed character for a touching pair, or null when the pair\n * cannot smush (FIGfont spec, horizontal rules). */\nfunction smushem(c1: string, c2: string, font: AsciiFont): string | null {\n if (c1 === \" \") return c2;\n if (c2 === \" \") return c1;\n const { hardblank } = font;\n if (font.layout === \"smush-universal\") {\n // Universal smushing: the later character wins; hardblanks only\n // yield to other hardblanks.\n if (c1 === hardblank || c2 === hardblank) return null;\n return c2;\n }\n const rules = font.rules;\n if (c1 === hardblank || c2 === hardblank) {\n return rules & 32 && c1 === hardblank && c2 === hardblank ? hardblank : null;\n }\n if (rules & 1 && c1 === c2) return c1;\n if (rules & 2) {\n if (c1 === \"_\" && \"|/\\\\[]{}()<>\".includes(c2)) return c2;\n if (c2 === \"_\" && \"|/\\\\[]{}()<>\".includes(c1)) return c1;\n }\n if (rules & 4) {\n const classOf = (c: string) =>\n c === \"|\"\n ? 1\n : \"/\\\\\".includes(c)\n ? 2\n : \"[]\".includes(c)\n ? 3\n : \"{}\".includes(c)\n ? 4\n : \"()\".includes(c)\n ? 5\n : \"<>\".includes(c)\n ? 6\n : 0;\n const k1 = classOf(c1);\n const k2 = classOf(c2);\n if (k1 && k2 && k1 !== k2) return k1 > k2 ? c1 : c2;\n }\n if (rules & 8) {\n const pairs = [\"[]\", \"][\", \"{}\", \"}{\", \"()\", \")(\"];\n if (pairs.includes(c1 + c2)) return \"|\";\n }\n if (rules & 16) {\n if (c1 === \"/\" && c2 === \"\\\\\") return \"|\";\n if (c1 === \"\\\\\" && c2 === \"/\") return \"Y\";\n if (c1 === \">\" && c2 === \"<\") return \"X\";\n }\n return null;\n}\n\nfunction collectRuns(rows: Row[]): LeafRun[] {\n const runs: LeafRun[] = [];\n rows.forEach((row, line) => {\n let start = -1;\n let current: CellColor | undefined;\n const flush = (end: number) => {\n if (start >= 0 && current) runs.push({ line, start, end, paint: toPaint(current) });\n start = -1;\n current = undefined;\n };\n row.paints.forEach((paint, x) => {\n if (!samePaint(paint, current)) {\n flush(x);\n if (paint) {\n start = x;\n current = paint;\n }\n }\n });\n flush(row.paints.length);\n });\n return runs;\n}\n\nfunction toPaint(color: CellColor): LeafPaint {\n const paint: LeafPaint = {};\n if (color.color) paint.color = color.color;\n if (color.backgroundColor) paint.backgroundColor = color.backgroundColor;\n if (color.bold) paint.fontWeight = \"bold\";\n return paint;\n}\n\nfunction samePaint(a: CellColor | undefined, b: CellColor | undefined): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return a.color === b.color && a.backgroundColor === b.backgroundColor && a.bold === b.bold;\n}\n","/**\n * TOIlet-style render filters as the `effect` attribute — per-cell\n * color mapping defined against the theme tokens (styles.css), so\n * effects are themeable by construction, never hardcoded RGB. An\n * effect replaces any font-embedded colors (it's a whole-banner look).\n */\n\nimport type { LeafRun } from \"monowind\";\n\nconst EFFECTS = {\n // Column stripes through the six ANSI hues (toilet --gay).\n rainbow: [\"red\", \"yellow\", \"green\", \"cyan\", \"blue\", \"magenta\"],\n // Row bands from bright to dark (toilet --metal's shine).\n metal: [\"bright-white\", \"white\", \"bright-cyan\", \"bright-blue\", \"blue\"],\n} as const;\n\nexport type Effect = keyof typeof EFFECTS;\n\nexport function isEffect(name: string): name is Effect {\n return name in EFFECTS;\n}\n\nexport function effectRuns(effect: Effect, lines: string[]): LeafRun[] {\n const palette = EFFECTS[effect];\n const color = (index: number) => `var(--mw-ansi-${palette[index % palette.length]})`;\n const runs: LeafRun[] = [];\n if (effect === \"metal\") {\n lines.forEach((line, y) => {\n if (line.length > 0) {\n runs.push({\n line: y,\n start: 0,\n end: line.length,\n paint: { color: color(Math.floor((y * palette.length) / Math.max(1, lines.length))) },\n });\n }\n });\n return runs;\n }\n // Column-striped effects: one run per stripe per line.\n const stripe = 2; // two cells per hue reads better than one\n lines.forEach((line, y) => {\n for (let x = 0; x < line.length; x += stripe) {\n runs.push({\n line: y,\n start: x,\n end: Math.min(line.length, x + stripe),\n paint: { color: color(Math.floor(x / stripe)) },\n });\n }\n });\n return runs;\n}\n","/**\n * `@monowind/ascii` — FIGlet/TOIlet banner text on the monowind grid:\n * the `<mono-ascii>` element (a leaf renderer, specs/leaf-renderers.md\n * in the monowind repo) plus the font registry. The package entry\n * registers the element and the default fonts; additional fonts are\n * per-module imports (`@monowind/ascii/fonts/<name>`) or\n * `registerAsciiFont(name, data)` with data you source yourself.\n */\n\nimport { invalidateLeaves, registerLeafRenderer } from \"monowind\";\n// Default fonts (self-registering): figlet's canonical `standard`,\n// its compact sibling, and a TLF representative.\nimport \"./fonts/standard.ts\";\nimport \"./fonts/small.ts\";\nimport \"./fonts/mono9.ts\";\nimport { asciiFont } from \"./registry.ts\";\nimport { renderAscii } from \"./render.ts\";\nimport { effectRuns, isEffect } from \"./effects.ts\";\nimport type { AsciiFont } from \"./font.ts\";\nimport type { LeafContent } from \"monowind\";\n\nexport { asciiFont, registerAsciiFont } from \"./registry.ts\";\nexport { parseFont } from \"./font.ts\";\nexport { renderAscii } from \"./render.ts\";\nexport type { AsciiFont, Glyph, HorizontalLayout } from \"./font.ts\";\nexport type { RenderedAscii } from \"./render.ts\";\n\nconst warned = new Set<string>();\nconst warnedChildren = new WeakSet<Element>();\n\n/** CDN hook: called once per unknown font NAME so the bundle can\n * lazy-load it (bundler consumers import font modules instead). */\nlet unknownFontHandler: ((name: string) => void) | null = null;\nexport function onUnknownAsciiFont(handler: (name: string) => void): void {\n unknownFontHandler = handler;\n}\n\n// Import-safe outside the browser (SSR, Node scripts): same guard as\n// the core element.\nconst HTMLElementBase = (\n typeof HTMLElement === \"undefined\" ? class {} : HTMLElement\n) as typeof HTMLElement;\n\n/* The shadow pairs the two representations (grid glyphs stay the\n * visible paint): a transparent art transcript that overlays the grid\n * cell-for-cell — the host inherits the engine's typography lock, so\n * the pre aligns by construction — and the slotted semantic string,\n * visually hidden for the accessibility tree. Selection and copy read\n * the transcript natively (real text, real newlines, in every\n * sweep — drags, overshoots, select-all); the string never leaks into\n * a copy. */\n// No whitespace between top-level nodes: the host inherits the\n// engine's white-space: pre lock, so stray template newlines would\n// render as real empty lines above the transcript.\nconst SHADOW_TEMPLATE = `<style>\n :host { display: block; }\n #mirror { margin: 0; font: inherit; line-height: inherit; letter-spacing: inherit; white-space: pre; color: transparent; }\n /* The engine's light-DOM ::selection invert cannot pierce this\n * shadow; mirror of the canonical rule in core's styles.css. */\n #mirror::selection { color: var(--mw-bg, canvas); text-shadow: 0 0 0 var(--mw-bg, canvas); background: var(--mw-fg, canvastext); }\n .alt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; user-select: none; -webkit-user-select: none; }\n</style><pre id=\"mirror\" aria-hidden=\"true\"></pre><span class=\"alt\"><slot></slot></span>`;\n\n/** `<mono-ascii>`: renders its text content as ascii art. The `font`\n * ATTRIBUTE names a registered font (default: \"standard\"); the `font`\n * PROPERTY takes a parsed font object directly and wins over the\n * attribute. The light DOM keeps the semantic text (a11y); the shadow\n * transcript is what select=\"text\" selects and copies. */\nexport class MonoAsciiElement extends HTMLElementBase {\n #font: AsciiFont | null = null;\n #mirror: HTMLElement | null = null;\n\n constructor() {\n super();\n const shadow = this.attachShadow({ mode: \"open\" });\n shadow.innerHTML = SHADOW_TEMPLATE;\n this.#mirror = shadow.getElementById(\"mirror\");\n }\n\n get font(): AsciiFont | null {\n return this.#font;\n }\n\n set font(font: AsciiFont | null) {\n this.#font = font;\n invalidateLeaves();\n }\n\n /** Keep the transcript in step with the art (called from the leaf\n * renderer each pass — the shadow is invisible to the engine, so\n * the sync never feeds back into layout). */\n syncMirror(lines: string[]): void {\n const text = lines.join(\"\\n\");\n if (this.#mirror && this.#mirror.textContent !== text) this.#mirror.textContent = text;\n }\n}\n\nfunction renderLeaf(el: Element): LeafContent {\n const content = renderContent(el);\n (el as Partial<MonoAsciiElement>).syncMirror?.(content.lines);\n return content;\n}\n\nfunction renderContent(el: Element): LeafContent {\n // The banner is the normalized textContent: trimmed, all whitespace\n // (newlines included) collapsed — a one-line banner by contract.\n const text = (el.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n if (el.children.length > 0 && !warnedChildren.has(el)) {\n warnedChildren.add(el);\n console.warn(\"[monowind] <mono-ascii> takes text only; element children are ignored.\", el);\n }\n const name = el.getAttribute(\"font\") ?? \"standard\";\n const font = (el as MonoAsciiElement).font ?? asciiFont(name);\n if (!font) {\n // Content never disappears: no (or unknown) font falls back to\n // the plain text.\n if (!warned.has(`font:${name}`)) {\n warned.add(`font:${name}`);\n if (unknownFontHandler) unknownFontHandler(name);\n else\n console.warn(\n `[monowind] <mono-ascii>: no registered font \"${name}\"; rendering plain text.`,\n el,\n );\n }\n return { lines: text ? [text] : [] };\n }\n if (!text) return { lines: [] };\n const rendered = renderAscii(text, font);\n const effect = el.getAttribute(\"effect\");\n if (effect && isEffect(effect)) {\n return { lines: rendered.lines, runs: effectRuns(effect, rendered.lines) };\n }\n return { lines: rendered.lines, runs: rendered.runs };\n}\n\n/** Idempotent registration of the element + leaf renderer (safe under\n * HMR and multiple entry loads). */\nexport function defineMonoAscii(): void {\n if (typeof customElements === \"undefined\") return;\n if (customElements.get(\"mono-ascii\")) return;\n customElements.define(\"mono-ascii\", MonoAsciiElement);\n registerLeafRenderer({\n tag: \"mono-ascii\",\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gDAAgD,EAAK,2BACrD,CACF,IAEG,EAAE,OAAO,IAAO,CAAC,CAAI,IAAI,CAAC,EAAE;CAErC,IAAI,CAAC,GAAM,OAAO,EAAE,OAAO,CAAC,EAAE;CAC9B,IAAM,IAAW,EAAY,GAAM,CAAI,GACjC,IAAS,EAAG,aAAa,QAAQ;CAIvC,OAHI,KAAU,EAAS,CAAM,IACpB;EAAE,OAAO,EAAS;EAAO,MAAM,EAAW,GAAQ,EAAS,KAAK;CAAE,IAEpE;EAAE,OAAO,EAAS;EAAO,MAAM,EAAS;CAAK;AACtD;AAIA,SAAgB,IAAwB;CAClC,OAAO,iBAAmB,OAC1B,eAAe,IAAI,YAAY,MACnC,eAAe,OAAO,cAAc,CAAgB,GACpD,EAAqB;EACnB,KAAK;EACL,oBAAoB,CAAC,QAAQ,QAAQ;EACrC,QAAQ;CACV,CAAC;AACH;AAEA,EAAgB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/render.ts","../src/effects.ts","../src/index.ts"],"sourcesContent":["/**\n * Horizontal FIGlet composition: glyphs join under the font's own\n * layout mode — full width, kerning, or smushing (universal, or\n * controlled by the header's rule bits 1–6, per the FIGfont spec).\n * Vertical smushing is out of scope (single-line banners). Per-cell\n * color state from SGR-colored glyphs rides along and comes out as\n * paint runs.\n */\n\nimport type { AsciiFont, Glyph } from \"./font.ts\";\nimport type { CellColor } from \"./sgr.ts\";\nimport type { LeafPaint, LeafRun } from \"monowind\";\n\nexport interface RenderedAscii {\n lines: string[];\n runs: LeafRun[];\n}\n\ninterface Row {\n chars: string[];\n paints: (CellColor | undefined)[];\n}\n\nexport function renderAscii(text: string, font: AsciiFont): RenderedAscii {\n const rows: Row[] = Array.from({ length: font.height }, () => ({ chars: [], paints: [] }));\n const missing: Glyph = {\n lines: Array.from({ length: font.height }, () => \" \"),\n width: 1,\n };\n let first = true;\n for (const ch of text) {\n const glyph = font.glyphs.get(ch.codePointAt(0)!) ?? missing;\n const overlap = first ? 0 : smushAmount(rows, glyph, font);\n merge(rows, glyph, overlap, font);\n first = false;\n }\n const lines = rows.map((row) => row.chars.map((c) => (c === font.hardblank ? \" \" : c)).join(\"\"));\n return { lines, runs: collectRuns(rows) };\n}\n\n/** How far the next glyph slides left: the minimum over rows of\n * (trailing spaces + leading spaces), plus one when the touching pair\n * can smush. */\nfunction smushAmount(rows: Row[], glyph: Glyph, font: AsciiFont): number {\n if (font.layout === \"full\") return 0;\n let amount = Number.POSITIVE_INFINITY;\n for (let y = 0; y < rows.length; y++) {\n const a = rows[y]!.chars;\n const b = glyph.lines[y] ?? \"\";\n let trailing = 0;\n while (trailing < a.length && a[a.length - 1 - trailing] === \" \") trailing++;\n let leading = 0;\n while (leading < b.length && b.charAt(leading) === \" \") leading++;\n let amt = trailing + leading;\n if (font.layout !== \"kerning\") {\n const c1 = a[a.length - 1 - trailing];\n const c2 = b.charAt(leading);\n if (c1 !== undefined && c2 !== \"\" && smushem(c1, c2, font) !== null) amt++;\n }\n amount = Math.min(amount, amt);\n }\n return Number.isFinite(amount) ? amount : 0;\n}\n\nfunction merge(rows: Row[], glyph: Glyph, overlap: number, font: AsciiFont): void {\n for (let y = 0; y < rows.length; y++) {\n const row = rows[y]!;\n const line = glyph.lines[y] ?? \"\";\n const colors = glyph.colors?.[y];\n const cut = Math.min(overlap, row.chars.length, line.length);\n const base = row.chars.length - cut;\n for (let k = 0; k < cut; k++) {\n const c1 = row.chars[base + k]!;\n const c2 = line.charAt(k);\n const p1 = row.paints[base + k];\n const p2 = colors?.[k];\n if (c1 === \" \") {\n row.chars[base + k] = c2;\n row.paints[base + k] = c2 === \" \" ? p1 : p2;\n } else if (c2 !== \" \") {\n const smushed = smushem(c1, c2, font);\n row.chars[base + k] = smushed ?? c2;\n row.paints[base + k] = smushed === c1 ? p1 : p2;\n }\n }\n for (let k = cut; k < line.length; k++) {\n row.chars.push(line.charAt(k));\n row.paints.push(colors?.[k]);\n }\n }\n}\n\n/** The smushed character for a touching pair, or null when the pair\n * cannot smush (FIGfont spec, horizontal rules). */\nfunction smushem(c1: string, c2: string, font: AsciiFont): string | null {\n if (c1 === \" \") return c2;\n if (c2 === \" \") return c1;\n const { hardblank } = font;\n if (font.layout === \"smush-universal\") {\n // Universal smushing: the later character wins; hardblanks only\n // yield to other hardblanks.\n if (c1 === hardblank || c2 === hardblank) return null;\n return c2;\n }\n const rules = font.rules;\n if (c1 === hardblank || c2 === hardblank) {\n return rules & 32 && c1 === hardblank && c2 === hardblank ? hardblank : null;\n }\n if (rules & 1 && c1 === c2) return c1;\n if (rules & 2) {\n if (c1 === \"_\" && \"|/\\\\[]{}()<>\".includes(c2)) return c2;\n if (c2 === \"_\" && \"|/\\\\[]{}()<>\".includes(c1)) return c1;\n }\n if (rules & 4) {\n const classOf = (c: string) =>\n c === \"|\"\n ? 1\n : \"/\\\\\".includes(c)\n ? 2\n : \"[]\".includes(c)\n ? 3\n : \"{}\".includes(c)\n ? 4\n : \"()\".includes(c)\n ? 5\n : \"<>\".includes(c)\n ? 6\n : 0;\n const k1 = classOf(c1);\n const k2 = classOf(c2);\n if (k1 && k2 && k1 !== k2) return k1 > k2 ? c1 : c2;\n }\n if (rules & 8) {\n const pairs = [\"[]\", \"][\", \"{}\", \"}{\", \"()\", \")(\"];\n if (pairs.includes(c1 + c2)) return \"|\";\n }\n if (rules & 16) {\n if (c1 === \"/\" && c2 === \"\\\\\") return \"|\";\n if (c1 === \"\\\\\" && c2 === \"/\") return \"Y\";\n if (c1 === \">\" && c2 === \"<\") return \"X\";\n }\n return null;\n}\n\nfunction collectRuns(rows: Row[]): LeafRun[] {\n const runs: LeafRun[] = [];\n rows.forEach((row, line) => {\n let start = -1;\n let current: CellColor | undefined;\n const flush = (end: number) => {\n if (start >= 0 && current) runs.push({ line, start, end, paint: toPaint(current) });\n start = -1;\n current = undefined;\n };\n row.paints.forEach((paint, x) => {\n if (!samePaint(paint, current)) {\n flush(x);\n if (paint) {\n start = x;\n current = paint;\n }\n }\n });\n flush(row.paints.length);\n });\n return runs;\n}\n\nfunction toPaint(color: CellColor): LeafPaint {\n const paint: LeafPaint = {};\n if (color.color) paint.color = color.color;\n if (color.backgroundColor) paint.backgroundColor = color.backgroundColor;\n if (color.bold) paint.fontWeight = \"bold\";\n return paint;\n}\n\nfunction samePaint(a: CellColor | undefined, b: CellColor | undefined): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return a.color === b.color && a.backgroundColor === b.backgroundColor && a.bold === b.bold;\n}\n","/**\n * TOIlet-style render filters as the `effect` attribute — per-cell\n * color mapping defined against the theme tokens (styles.css), so\n * effects are themeable by construction, never hardcoded RGB. An\n * effect replaces any font-embedded colors (it's a whole-banner look).\n */\n\nimport type { LeafRun } from \"monowind\";\n\nconst EFFECTS = {\n // Column stripes through the six ANSI hues (toilet --gay).\n rainbow: [\"red\", \"yellow\", \"green\", \"cyan\", \"blue\", \"magenta\"],\n // Row bands from bright to dark (toilet --metal's shine).\n metal: [\"bright-white\", \"white\", \"bright-cyan\", \"bright-blue\", \"blue\"],\n} as const;\n\nexport type Effect = keyof typeof EFFECTS;\n\nexport function isEffect(name: string): name is Effect {\n return name in EFFECTS;\n}\n\nexport function effectRuns(effect: Effect, lines: string[]): LeafRun[] {\n const palette = EFFECTS[effect];\n const color = (index: number) => `var(--mw-ansi-${palette[index % palette.length]})`;\n const runs: LeafRun[] = [];\n if (effect === \"metal\") {\n lines.forEach((line, y) => {\n if (line.length > 0) {\n runs.push({\n line: y,\n start: 0,\n end: line.length,\n paint: { color: color(Math.floor((y * palette.length) / Math.max(1, lines.length))) },\n });\n }\n });\n return runs;\n }\n // Column-striped effects: one run per stripe per line.\n const stripe = 2; // two cells per hue reads better than one\n lines.forEach((line, y) => {\n for (let x = 0; x < line.length; x += stripe) {\n runs.push({\n line: y,\n start: x,\n end: Math.min(line.length, x + stripe),\n paint: { color: color(Math.floor(x / stripe)) },\n });\n }\n });\n return runs;\n}\n","/**\n * `@monowind/ascii` — FIGlet/TOIlet banner text on the monowind grid:\n * the `<mono-ascii>` element (a leaf renderer, specs/leaf-renderers.md\n * in the monowind repo) plus the font registry. The package entry\n * registers the element and the default fonts; additional fonts are\n * per-module imports (`@monowind/ascii/fonts/<name>`) or\n * `registerAsciiFont(name, data)` with data you source yourself.\n */\n\nimport { invalidateLeaves, registerLeafRenderer } from \"monowind\";\n// Default fonts (self-registering): figlet's canonical `standard`,\n// its compact sibling, and a TLF representative.\nimport \"./fonts/standard.ts\";\nimport \"./fonts/small.ts\";\nimport \"./fonts/mono9.ts\";\nimport { asciiFont } from \"./registry.ts\";\nimport { renderAscii } from \"./render.ts\";\nimport { effectRuns, isEffect } from \"./effects.ts\";\nimport type { AsciiFont } from \"./font.ts\";\nimport type { LeafContent } from \"monowind\";\n\nexport { asciiFont, registerAsciiFont } from \"./registry.ts\";\nexport { parseFont } from \"./font.ts\";\nexport { renderAscii } from \"./render.ts\";\nexport type { AsciiFont, Glyph, HorizontalLayout } from \"./font.ts\";\nexport type { RenderedAscii } from \"./render.ts\";\n\nconst warned = new Set<string>();\nconst warnedChildren = new WeakSet<Element>();\n\n/** CDN hook: called once per unknown font NAME so the bundle can\n * lazy-load it (bundler consumers import font modules instead). */\nlet unknownFontHandler: ((name: string) => void) | null = null;\nexport function onUnknownAsciiFont(handler: (name: string) => void): void {\n unknownFontHandler = handler;\n}\n\n// Import-safe outside the browser (SSR, Node scripts): same guard as\n// the core element.\nconst HTMLElementBase = (\n typeof HTMLElement === \"undefined\" ? class {} : HTMLElement\n) as typeof HTMLElement;\n\n/* The shadow pairs the two representations (grid glyphs stay the\n * visible paint): a transparent art transcript that overlays the grid\n * cell-for-cell — the host inherits the engine's typography lock, so\n * the pre aligns by construction — and the slotted semantic string,\n * visually hidden for the accessibility tree. Selection and copy read\n * the transcript natively (real text, real newlines, in every\n * sweep — drags, overshoots, select-all); the string never leaks into\n * a copy. */\n// No whitespace between top-level nodes: the host inherits the\n// engine's white-space: pre lock, so stray template newlines would\n// render as real empty lines above the transcript.\nconst SHADOW_TEMPLATE = `<style>\n :host { display: block; }\n #mirror { margin: 0; font: inherit; line-height: inherit; letter-spacing: inherit; white-space: pre; color: transparent; }\n /* The engine's light-DOM ::selection invert cannot pierce this\n * shadow; mirror of the canonical rule in core's styles.css. */\n #mirror::selection { color: var(--mw-bg, canvas); text-shadow: 0 0 0 var(--mw-bg, canvas); background: var(--mw-fg, canvastext); }\n .alt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; user-select: none; -webkit-user-select: none; }\n</style><pre id=\"mirror\" aria-hidden=\"true\"></pre><span class=\"alt\"><slot></slot></span>`;\n\n/** `<mono-ascii>`: renders its text content as ascii art. The `font`\n * ATTRIBUTE names a registered font (default: \"standard\"); the `font`\n * PROPERTY takes a parsed font object directly and wins over the\n * attribute. The light DOM keeps the semantic text (a11y); the shadow\n * transcript is what select=\"text\" selects and copies. */\nexport class MonoAsciiElement extends HTMLElementBase {\n #font: AsciiFont | null = null;\n #mirror: HTMLElement | null = null;\n\n constructor() {\n super();\n const shadow = this.attachShadow({ mode: \"open\" });\n shadow.innerHTML = SHADOW_TEMPLATE;\n this.#mirror = shadow.getElementById(\"mirror\");\n }\n\n get font(): AsciiFont | null {\n return this.#font;\n }\n\n set font(font: AsciiFont | null) {\n this.#font = font;\n invalidateLeaves();\n }\n\n /** Keep the transcript in step with the art (called from the leaf\n * renderer each pass — the shadow is invisible to the engine, so\n * the sync never feeds back into layout). */\n syncMirror(lines: string[]): void {\n const text = lines.join(\"\\n\");\n if (this.#mirror && this.#mirror.textContent !== text) this.#mirror.textContent = text;\n }\n}\n\nfunction renderLeaf(el: Element): LeafContent {\n const content = renderContent(el);\n (el as Partial<MonoAsciiElement>).syncMirror?.(content.lines);\n return content;\n}\n\nfunction renderContent(el: Element): LeafContent {\n // The banner is the normalized textContent: trimmed, all whitespace\n // (newlines included) collapsed — a one-line banner by contract.\n const text = (el.textContent ?? \"\").replace(/\\s+/g, \" \").trim();\n if (el.children.length > 0 && !warnedChildren.has(el)) {\n warnedChildren.add(el);\n console.warn(\"[monowind] <mono-ascii> takes text only; element children are ignored.\", el);\n }\n const name = el.getAttribute(\"font\") ?? \"standard\";\n const font = (el as MonoAsciiElement).font ?? asciiFont(name);\n if (!font) {\n // Content never disappears: no (or unknown) font falls back to\n // the plain text.\n if (!warned.has(`font:${name}`)) {\n warned.add(`font:${name}`);\n if (unknownFontHandler) unknownFontHandler(name);\n else\n console.warn(\n `[monowind] <mono-ascii>: no registered font \"${name}\"; rendering plain text.`,\n el,\n );\n }\n return { lines: text ? [text] : [] };\n }\n if (!text) return { lines: [] };\n const rendered = renderAscii(text, font);\n const effect = el.getAttribute(\"effect\");\n if (effect && isEffect(effect)) {\n return { lines: rendered.lines, runs: effectRuns(effect, rendered.lines) };\n }\n return { lines: rendered.lines, runs: rendered.runs };\n}\n\n/** Idempotent registration of the element + leaf renderer (safe under\n * HMR and multiple entry loads). */\nexport function defineMonoAscii(): void {\n if (typeof customElements === \"undefined\") return;\n if (customElements.get(\"mono-ascii\")) return;\n customElements.define(\"mono-ascii\", MonoAsciiElement);\n registerLeafRenderer({\n tag: \"mono-ascii\",\n observedAttributes: [\"font\", \"effect\"],\n render: renderLeaf,\n selectionTarget: (el) => el.shadowRoot?.getElementById(\"mirror\") ?? null,\n });\n}\n\ndefineMonoAscii();\n"],"mappings":";;;;;;AAuBA,SAAgB,EAAY,GAAc,GAAgC;CACxE,IAAM,IAAc,MAAM,KAAK,EAAE,QAAQ,EAAK,OAAO,UAAU;EAAE,OAAO,CAAC;EAAG,QAAQ,CAAC;CAAE,EAAE,GACnF,IAAiB;EACrB,OAAO,MAAM,KAAK,EAAE,QAAQ,EAAK,OAAO,SAAS,GAAG;EACpD,OAAO;CACT,GACI,IAAQ;CACZ,KAAK,IAAM,KAAM,GAAM;EACrB,IAAM,IAAQ,EAAK,OAAO,IAAI,EAAG,YAAY,CAAC,CAAE,KAAK;EAGrD,AADA,EAAM,GAAM,GADI,IAAQ,IAAI,EAAY,GAAM,GAAO,CAAI,G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CAAC,QAAQ,QAAQ;EACrC,QAAQ;EACR,kBAAkB,MAAO,EAAG,YAAY,eAAe,QAAQ,KAAK;CACtE,CAAC;AACH;AAEA,EAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monowind/ascii",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
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",
@@ -45,13 +45,13 @@
45
45
  "@types/node": "^26.4.1",
46
46
  "figlet": "^1.11.4",
47
47
  "happy-dom": "^20.13.2",
48
- "monowind": "^0.2.4",
48
+ "monowind": "^0.2.5",
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.4"
54
+ "monowind": "^0.2.5"
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))\"",