streamdown-angular 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +23 -0
- package/README.md +246 -0
- package/fesm2022/streamdown-angular.mjs +1936 -0
- package/fesm2022/streamdown-angular.mjs.map +1 -0
- package/package.json +72 -0
- package/types/streamdown-angular.d.ts +625 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamdown-angular.mjs","sources":["../../../projects/ngx-streamdown/src/lib/hast/component-map.ts","../../../projects/ngx-streamdown/src/lib/components/link-modal.service.ts","../../../projects/ngx-streamdown/src/lib/animate/fade.ts","../../../projects/ngx-streamdown/src/lib/hast/hast-renderer.service.ts","../../../projects/ngx-streamdown/src/lib/code-block/code-block-utils.ts","../../../projects/ngx-streamdown/src/lib/code-block/language-registry.ts","../../../projects/ngx-streamdown/src/lib/code-block/shiki-highlighter.service.ts","../../../projects/ngx-streamdown/src/lib/services/icon.service.ts","../../../projects/ngx-streamdown/src/lib/services/translations.service.ts","../../../projects/ngx-streamdown/src/lib/code-block/copy-button.component.ts","../../../projects/ngx-streamdown/src/lib/code-block/download-button.component.ts","../../../projects/ngx-streamdown/src/lib/code-block/code-block.component.ts","../../../projects/ngx-streamdown/src/lib/table/table-utils.ts","../../../projects/ngx-streamdown/src/lib/table/table.component.ts","../../../projects/ngx-streamdown/src/lib/components/image.component.ts","../../../projects/ngx-streamdown/src/lib/register-components.ts","../../../projects/ngx-streamdown/src/lib/animate/caret.ts","../../../projects/ngx-streamdown/src/lib/hast/hast-renderer.component.ts","../../../projects/ngx-streamdown/src/lib/markdown.service.ts","../../../projects/ngx-streamdown/src/lib/block.component.ts","../../../projects/ngx-streamdown/src/lib/components/link-modal.component.ts","../../../projects/ngx-streamdown/src/lib/core/parse-blocks.ts","../../../projects/ngx-streamdown/src/lib/core/detect-direction.ts","../../../projects/ngx-streamdown/src/lib/streamdown.component.ts","../../../projects/ngx-streamdown/src/lib/hast/element.component.ts","../../../projects/ngx-streamdown/src/lib/animate/animate.provider.ts","../../../projects/ngx-streamdown/src/lib/mermaid/mermaid.component.ts","../../../projects/ngx-streamdown/src/lib/mermaid/provider.ts","../../../projects/ngx-streamdown/src/lib/math/sanitize-schema.ts","../../../projects/ngx-streamdown/src/lib/math/provider.ts","../../../projects/ngx-streamdown/src/lib/services/prefix.service.ts","../../../projects/ngx-streamdown/src/public-api.ts","../../../projects/ngx-streamdown/src/streamdown-angular.ts"],"sourcesContent":["import type { Type } from '@angular/core';\nimport { clsx, type ClassValue } from 'clsx';\n\n/**\n * Merges class values into a single string (Streamdown `cn`).\n * Accepts array/object/conditional values: `cn('a', cond && 'b', ['c'])`.\n * (No Tailwind needed — styles now live as plain CSS in `streamdown.css`.)\n */\nexport function cn(...inputs: ClassValue[]): string {\n return clsx(inputs);\n}\n\n/**\n * HTML tagName → extra class. Empty (default) — because all typography is\n * provided via element selectors in `streamdown.css` (`.ngx-streamdown h1` ...) and\n * inlined automatically into `HastRendererComponent` (no Tailwind needed).\n *\n * Users can add their own extra classes for tags here, for example:\n * ELEMENT_CLASSES['h1'] = 'my-heading';\n * This value is merged with the element's own `className` via `cn()`.\n */\nexport const ELEMENT_CLASSES: Record<string, string> = {};\n\n/**\n * Tags that require a dedicated Angular component (tagName → component class).\n * Currently empty; in later stages `pre` → CodeBlock, `table` → Table will be added.\n * Tags not in this map are rendered as generic DOM elements.\n */\nexport const COMPONENT_MAP = new Map<string, Type<unknown>>();\n","import { EnvironmentProviders, Injectable, InjectionToken, makeEnvironmentProviders, signal } from '@angular/core';\n\n/** Whether link safety is enabled (default: no). */\nexport const STREAMDOWN_LINK_SAFETY = new InjectionToken<boolean>('STREAMDOWN_LINK_SAFETY');\n\n/**\n * Manages the confirmation modal shown when an external link is clicked.\n * Angular equivalent of the Streamdown `lib/link-modal.tsx` logic.\n */\n@Injectable({ providedIn: 'root' })\nexport class LinkModalService {\n /** URL awaiting confirmation (modal is closed when null). */\n readonly pendingUrl = signal<string | null>(null);\n\n /** Opens the modal with the given URL. */\n request(url: string): void {\n this.pendingUrl.set(url);\n }\n\n /** Confirms: opens the link in a new window and closes the modal. */\n confirm(): void {\n const url = this.pendingUrl();\n if (url && typeof window !== 'undefined') {\n window.open(url, '_blank', 'noopener,noreferrer');\n }\n this.pendingUrl.set(null);\n }\n\n /** Cancels: closes the modal, the link is not opened. */\n cancel(): void {\n this.pendingUrl.set(null);\n }\n}\n\n/**\n * Enables the confirmation modal for external links (safety UX).\n * When enabled, clicking http(s) links first shows the modal.\n */\nexport function provideStreamdownLinkSafety(): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: STREAMDOWN_LINK_SAFETY, useValue: true }]);\n}\n","/**\n * Fade-in animation for new elements (those that appear during streaming).\n * The styles must be global (the renderer creates DOM outside the Angular template),\n * so we inject them into `document.head` once.\n */\nexport const FADE_CLASS = 'ngx-sd-fade';\n\nlet injected = false;\n\n/** Injects the fade-in keyframe + class styles once. */\nexport function ensureFadeStyles(): void {\n if (injected || typeof document === 'undefined') {\n return;\n }\n injected = true;\n const style = document.createElement('style');\n style.textContent = `\n@keyframes ngx-sd-fadein { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }\n.${FADE_CLASS} { animation: ngx-sd-fadein 0.4s ease-out; }\n@media (prefers-reduced-motion: reduce) { .${FADE_CLASS} { animation: none; } }\n`;\n document.head.appendChild(style);\n}\n","import {\n ComponentRef,\n Injectable,\n InjectionToken,\n Renderer2,\n RendererFactory2,\n ViewContainerRef,\n inject,\n} from '@angular/core';\nimport type { Element, Properties, Text } from 'hast';\nimport { COMPONENT_MAP, ELEMENT_CLASSES, cn } from './component-map';\nimport type { HastChild } from '../types';\nimport { LinkModalService, STREAMDOWN_LINK_SAFETY } from '../components/link-modal.service';\nimport { FADE_CLASS, ensureFadeStyles } from '../animate/fade';\n\n/** Add a fade-in animation to new elements (optional). */\nexport const STREAMDOWN_ANIMATE = new InjectionToken<boolean>('STREAMDOWN_ANIMATE');\n\n/**\n * Internal bookkeeping record for a single rendered HAST node.\n * Diffing (reconciliation) keeps this tree of records and only updates what changed.\n */\nexport interface RenderedNode {\n /** Corresponding HAST node (previous state) */\n hast: HastChild;\n /** Created DOM node (text / element / component host) */\n dom: Node;\n /** For a special tag — the component ref (for cleanup and input updates) */\n componentRef?: ComponentRef<unknown>;\n /** For a generic element — its children's records */\n children?: RenderedNode[];\n}\n\n/**\n * The core of the HAST renderer. Turns a HAST tree into DOM and — most importantly —\n * on subsequent renders **diffs (reconciles)** against the existing DOM instead of\n * rebuilding the whole tree: only changed text/attributes/elements are updated. During streaming this:\n * - eliminates \"flicker\" (unchanged DOM is preserved),\n * - does not break scroll/selection/focus,\n * - updates the `node` input of special components (code-block, table) without recreating them,\n * - applies a fade-in animation naturally to new elements (only for new DOM).\n */\n@Injectable({ providedIn: 'root' })\nexport class HastRendererService {\n // Renderer2 cannot be injected directly in a providedIn:'root' service — use RendererFactory2 instead\n private readonly renderer: Renderer2 = inject(RendererFactory2).createRenderer(null, null);\n // link safety (optional): when enabled, external links are opened through a modal\n private readonly linkModal = inject(LinkModalService);\n private readonly linkSafety = inject(STREAMDOWN_LINK_SAFETY, { optional: true }) ?? false;\n // fade-in animation for new elements (optional)\n private readonly animate = inject(STREAMDOWN_ANIMATE, { optional: true }) ?? false;\n\n /**\n * Renders the `next` HAST nodes into `parent`, diffing against the `previous` records.\n * On the first render `previous` is an empty array. Returns: the new tree of records\n * (passed to the next reconcile).\n */\n reconcile(\n parent: HTMLElement,\n previous: RenderedNode[],\n next: readonly HastChild[],\n vcr: ViewContainerRef,\n ): RenderedNode[] {\n const result: RenderedNode[] = [];\n const length = Math.max(previous.length, next.length);\n\n for (let i = 0; i < length; i++) {\n const old = previous[i] as RenderedNode | undefined;\n const node = next[i] as HastChild | undefined;\n\n // no node — remove the old record\n if (node === undefined) {\n if (old) {\n this.destroyRendered(old, parent);\n }\n continue;\n }\n // no old — create the new one and append it at the end\n if (old === undefined) {\n const created = this.createRendered(node, vcr);\n this.renderer.appendChild(parent, created.dom);\n result.push(created);\n continue;\n }\n // same type — update in place (patch)\n if (sameType(old.hast, node)) {\n result.push(this.patch(old, node, vcr));\n } else {\n // different type — replace (put the new one in place of the old)\n const created = this.createRendered(node, vcr);\n this.renderer.insertBefore(parent, created.dom, old.dom);\n this.destroyRendered(old, parent);\n result.push(created);\n }\n }\n return result;\n }\n\n /** Fully cleans up records rendered via reconcile (destroys component refs). */\n destroyAll(rendered: RenderedNode[]): void {\n for (const rec of rendered) {\n rec.componentRef?.destroy();\n if (rec.children) {\n this.destroyAll(rec.children);\n }\n }\n }\n\n // ── simple (create-only) API — used by table/element components ──────────\n\n /**\n * Creates the `nodes` list into `parent` (without diffing). Returns: the ComponentRefs.\n * Kept for special cases (recursive render inside a table).\n */\n renderNodes(\n nodes: readonly HastChild[],\n parent: HTMLElement,\n vcr: ViewContainerRef,\n ): ComponentRef<unknown>[] {\n const refs: ComponentRef<unknown>[] = [];\n for (const node of nodes) {\n const created = this.createRendered(node, vcr);\n this.renderer.appendChild(parent, created.dom);\n collectRefs(created, refs);\n }\n return refs;\n }\n\n /** Removes the DOM children under `parent` and destroys the ComponentRefs. */\n clear(parent: HTMLElement, refs: ComponentRef<unknown>[]): void {\n for (const ref of refs) {\n ref.destroy();\n }\n while (parent.firstChild) {\n this.renderer.removeChild(parent, parent.firstChild);\n }\n }\n\n // ── internal: create / patch / destroy ─────────────────────────────────────────\n\n /** Creates a new DOM/component for a single HAST node (returns detached dom). */\n private createRendered(node: HastChild, vcr: ViewContainerRef): RenderedNode {\n if (node.type === 'text') {\n // text node — XSS-safe: only createText (NEVER innerHTML)\n return { hast: node, dom: this.renderer.createText((node as Text).value) };\n }\n\n if (node.type === 'element') {\n const el = node as Element;\n const Cmp = COMPONENT_MAP.get(el.tagName);\n\n // special tag — create the Angular component\n if (Cmp) {\n const ref = vcr.createComponent(Cmp);\n ref.setInput('node', el);\n ref.changeDetectorRef.detectChanges();\n return { hast: node, dom: ref.location.nativeElement, componentRef: ref };\n }\n\n // generic tag — a real DOM element\n const domEl: HTMLElement = this.renderer.createElement(el.tagName);\n this.applyProperties(domEl, el.properties);\n this.applyClasses(domEl, el);\n if (el.tagName === 'a') {\n this.enhanceAnchor(domEl, el);\n }\n if (this.animate) {\n ensureFadeStyles();\n this.renderer.addClass(domEl, FADE_CLASS); // new element — fade-in\n }\n const children: RenderedNode[] = [];\n for (const child of el.children) {\n const childRec = this.createRendered(child, vcr);\n this.renderer.appendChild(domEl, childRec.dom);\n children.push(childRec);\n }\n return { hast: node, dom: domEl, children };\n }\n\n // 'comment' | 'doctype' | 'raw' — hold the slot with an empty text node\n return { hast: node, dom: this.renderer.createText('') };\n }\n\n /** Updates existing DOM in place with the new HAST node (without recreating). */\n private patch(old: RenderedNode, node: HastChild, vcr: ViewContainerRef): RenderedNode {\n if (node.type === 'text') {\n const oldValue = (old.hast as Text).value;\n const newValue = (node as Text).value;\n if (oldValue !== newValue) {\n old.dom.nodeValue = newValue;\n }\n return { hast: node, dom: old.dom };\n }\n\n const el = node as Element;\n const domEl = old.dom as HTMLElement;\n\n // special component — do not recreate, only update its `node` input (memoization)\n if (old.componentRef) {\n old.componentRef.setInput('node', el);\n old.componentRef.changeDetectorRef.detectChanges();\n return { hast: node, dom: domEl, componentRef: old.componentRef };\n }\n\n // generic element — apply the attribute/class diff and recursively reconcile children\n this.updateAttributes(domEl, (old.hast as Element).properties, el.properties);\n this.applyClasses(domEl, el);\n const children = this.reconcile(domEl, old.children ?? [], el.children, vcr);\n return { hast: node, dom: domEl, children };\n }\n\n /** Cleans up the record (and its children): destroy the component + remove from DOM. */\n private destroyRendered(rec: RenderedNode, parent: HTMLElement): void {\n rec.componentRef?.destroy();\n if (rec.children) {\n // child DOM is removed together with rec.dom; only destroy the component refs\n this.destroyAll(rec.children);\n }\n if (rec.dom.parentNode === parent) {\n this.renderer.removeChild(parent, rec.dom);\n }\n }\n\n // ── attribute / class / anchor ─────────────────────────────────────────────────\n\n /**\n * For `a` tags: external links get `target=_blank` + `rel=noopener noreferrer`;\n * when link safety is enabled, intercept the click and open through a modal.\n */\n private enhanceAnchor(domEl: HTMLElement, el: Element): void {\n const href = el.properties?.['href'];\n if (typeof href !== 'string') {\n return;\n }\n if (/^https?:\\/\\//i.test(href)) {\n this.renderer.setAttribute(domEl, 'target', '_blank');\n this.renderer.setAttribute(domEl, 'rel', 'noopener noreferrer');\n if (this.linkSafety) {\n this.renderer.listen(domEl, 'click', (event: Event) => {\n event.preventDefault();\n this.linkModal.request(href);\n });\n }\n }\n }\n\n /** Merges the ELEMENT_CLASSES base with the element's own className. */\n private applyClasses(domEl: HTMLElement, el: Element): void {\n const base = ELEMENT_CLASSES[el.tagName] ?? '';\n const own = el.properties?.['className'];\n const ownStr = Array.isArray(own) ? own.join(' ') : typeof own === 'string' ? own : '';\n const animateClass = this.animate && domEl.classList.contains(FADE_CLASS) ? FADE_CLASS : '';\n const merged = cn(base, ownStr, animateClass);\n if (merged) {\n this.renderer.setAttribute(domEl, 'class', merged);\n } else {\n this.renderer.removeAttribute(domEl, 'class');\n }\n }\n\n /** HAST properties → DOM attributes (initial, full application). */\n private applyProperties(domEl: HTMLElement, props: Properties | undefined): void {\n if (!props) {\n return;\n }\n for (const [key, value] of Object.entries(props)) {\n this.setProp(domEl, key, value);\n }\n }\n\n /** Applies the attribute diff: removes the deleted ones, sets the new ones. */\n private updateAttributes(\n domEl: HTMLElement,\n oldProps: Properties | undefined,\n newProps: Properties | undefined,\n ): void {\n const oldP = oldProps ?? {};\n const newP = newProps ?? {};\n // removed attributes\n for (const key of Object.keys(oldP)) {\n if (!(key in newP) && key !== 'className' && !key.toLowerCase().startsWith('on')) {\n this.renderer.removeAttribute(domEl, attrName(key));\n }\n }\n // new/changed attributes\n for (const [key, value] of Object.entries(newP)) {\n this.setProp(domEl, key, value);\n }\n }\n\n /** Writes a single HAST property to a DOM attribute (with safe allowlist logic). */\n private setProp(domEl: HTMLElement, key: string, value: Properties[string]): void {\n // className is handled separately in applyClasses; event handlers (on*) — XSS risk, skip them\n if (key === 'className' || key.toLowerCase().startsWith('on')) {\n return;\n }\n const attr = attrName(key);\n if (value === null || value === undefined || value === false) {\n this.renderer.removeAttribute(domEl, attr);\n return;\n }\n if (value === true) {\n this.renderer.setAttribute(domEl, attr, '');\n return;\n }\n this.renderer.setAttribute(domEl, attr, Array.isArray(value) ? value.join(' ') : String(value));\n }\n}\n\n/** Converts a HAST property name to a DOM attribute name. */\nfunction attrName(key: string): string {\n return key === 'htmlFor' ? 'for' : key.toLowerCase();\n}\n\n/** Are two HAST nodes the same type (text↔text or same tagName)? */\nfunction sameType(a: HastChild, b: HastChild): boolean {\n if (a.type === 'text' && b.type === 'text') {\n return true;\n }\n if (a.type === 'element' && b.type === 'element') {\n return (a as Element).tagName === (b as Element).tagName;\n }\n return false;\n}\n\n/** Collects all ComponentRefs in the record tree. */\nfunction collectRefs(rec: RenderedNode, out: ComponentRef<unknown>[]): void {\n if (rec.componentRef) {\n out.push(rec.componentRef);\n }\n if (rec.children) {\n for (const child of rec.children) {\n collectRefs(child, out);\n }\n }\n}\n","import type { Element, ElementContent } from 'hast';\n\n/** Information extracted about a code block. */\nexport interface CodeInfo {\n /** Raw code text (all text nodes concatenated). */\n code: string;\n /** Language identifier (lowercase), e.g. `'ts'`. Defaults to `'text'` if not found. */\n language: string;\n}\n\n/**\n * Finds the inner `<code>` in a `<pre>` HAST element and extracts the language and raw code.\n *\n * The language is taken from the value starting with `language-...` in the `<code>`'s\n * `className` (e.g. `language-ts` → `ts`). Returns `'text'` if not found.\n * The code is built by concatenating all descendant text nodes of the `<code>`.\n */\nexport function extractCodeInfo(pre: Element): CodeInfo {\n const codeEl = findCodeElement(pre);\n const source = codeEl ?? pre;\n\n return {\n code: collectText(source),\n language: extractLanguage(codeEl),\n };\n}\n\n/** Converts a language name to a file extension (for the download button). Defaults to `'txt'`. */\nexport function languageToExtension(lang: string): string {\n return LANGUAGE_EXTENSIONS[lang.toLowerCase()] ?? 'txt';\n}\n\n// ── internal ─────────────────────────────────────────────────────────────────\n\n/** Finds the first `<code>` element among the direct children of `<pre>`. */\nfunction findCodeElement(pre: Element): Element | undefined {\n for (const child of pre.children) {\n if (child.type === 'element' && child.tagName === 'code') {\n return child;\n }\n }\n return undefined;\n}\n\n/** Finds `language-XXX` in the `<code>`'s className and returns `XXX` (lowercase). */\nfunction extractLanguage(codeEl: Element | undefined): string {\n const className = codeEl?.properties?.['className'];\n const classes = Array.isArray(className)\n ? className.map(String)\n : typeof className === 'string'\n ? className.split(/\\s+/)\n : [];\n\n for (const cls of classes) {\n if (cls.startsWith('language-')) {\n const lang = cls.slice('language-'.length).trim().toLowerCase();\n if (lang) {\n return lang;\n }\n }\n }\n return 'text';\n}\n\n/** Recursively concatenates all text nodes under an element. */\nfunction collectText(node: Element): string {\n let out = '';\n const walk = (children: readonly ElementContent[]): void => {\n for (const child of children) {\n if (child.type === 'text') {\n out += child.value;\n } else if (child.type === 'element') {\n walk(child.children);\n }\n }\n };\n walk(node.children);\n return out;\n}\n\n/** Language → extension table. */\nconst LANGUAGE_EXTENSIONS: Record<string, string> = {\n ts: 'ts',\n typescript: 'ts',\n tsx: 'tsx',\n js: 'js',\n javascript: 'js',\n jsx: 'jsx',\n json: 'json',\n html: 'html',\n css: 'css',\n scss: 'scss',\n sass: 'sass',\n less: 'less',\n python: 'py',\n py: 'py',\n ruby: 'rb',\n rb: 'rb',\n go: 'go',\n rust: 'rs',\n rs: 'rs',\n java: 'java',\n kotlin: 'kt',\n kt: 'kt',\n swift: 'swift',\n c: 'c',\n cpp: 'cpp',\n 'c++': 'cpp',\n csharp: 'cs',\n cs: 'cs',\n php: 'php',\n shell: 'sh',\n bash: 'sh',\n sh: 'sh',\n zsh: 'sh',\n yaml: 'yaml',\n yml: 'yml',\n toml: 'toml',\n xml: 'xml',\n sql: 'sql',\n markdown: 'md',\n md: 'md',\n text: 'txt',\n};\n","import type { Type } from '@angular/core';\n\n/**\n * Language (lowercase) → component registry.\n *\n * Optional plugins (e.g. `mermaid`) can \"claim\" a specific code language:\n * if a component is registered for that language, `CodeBlockComponent` creates\n * that component instead of highlighting with Shiki.\n *\n * A registered component MUST accept a `code: string` (raw code) input.\n */\nexport const CODE_LANGUAGE_COMPONENTS = new Map<string, Type<unknown>>();\n","import { Injectable } from '@angular/core';\n\n/** The surface of the `shiki` module that we need (optional peer dependency). */\ninterface ShikiModule {\n codeToHtml: (code: string, options: ShikiOptions) => Promise<string>;\n}\n\ninterface ShikiOptions {\n lang: string;\n themes: { light: string; dark: string };\n}\n\n/**\n * Service that syntax-highlights code via Shiki.\n *\n * `shiki` is an OPTIONAL peer dependency — so the dynamic `import()` is run\n * once (cached) inside a try/catch. If shiki is not installed, the import\n * fails, or the language is unknown, we fall back to a plain escaped\n * `<pre><code>`. This service NEVER throws.\n */\n@Injectable({ providedIn: 'root' })\nexport class ShikiHighlighterService {\n /** Cached promise for loading the Shiki module once. */\n private shikiPromise: Promise<ShikiModule | null> | null = null;\n\n /**\n * Highlights `code` for the `lang` language and returns HTML.\n * On error, falls back to an escaped `<pre><code>`.\n */\n async highlight(code: string, lang: string): Promise<string> {\n const shiki = await this.loadShiki();\n if (!shiki) {\n return this.fallback(code);\n }\n\n try {\n return await shiki.codeToHtml(code, {\n lang,\n themes: { light: 'github-light', dark: 'github-dark' },\n });\n } catch {\n // unknown language or other error — safe fallback\n return this.fallback(code);\n }\n }\n\n // ── internal ─────────────────────────────────────────────────────────────────\n\n /** Lazily loads the Shiki module (once); returns `null` on failure. */\n private loadShiki(): Promise<ShikiModule | null> {\n if (!this.shikiPromise) {\n this.shikiPromise = (async (): Promise<ShikiModule | null> => {\n try {\n const mod = (await import('shiki')) as unknown as Partial<ShikiModule>;\n if (typeof mod.codeToHtml === 'function') {\n return { codeToHtml: mod.codeToHtml };\n }\n return null;\n } catch {\n // shiki not installed — fallback mode\n return null;\n }\n })();\n }\n return this.shikiPromise;\n }\n\n /** Plain escaped `<pre><code>` (XSS-safe fallback). */\n private fallback(code: string): string {\n return `<pre><code>${escapeHtml(code)}</code></pre>`;\n }\n}\n\n/** Escapes HTML special characters. */\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n","import { EnvironmentProviders, Injectable, InjectionToken, inject, makeEnvironmentProviders } from '@angular/core';\n\n/**\n * Icons (inline SVG strings). Equivalent of Streamdown `icon-context.tsx`.\n * Each value is a full `<svg>...</svg>` string. Override with your own icons\n * via `provideStreamdownIcons({...})` (e.g. lucide/heroicons).\n */\nexport interface StreamdownIcons {\n copy: string;\n check: string;\n download: string;\n externalLink: string;\n close: string;\n chevronDown: string;\n}\n\nconst svg = (paths: string): string =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${paths}</svg>`;\n\n/** Default icons (minimal SVG in lucide style). */\nexport const DEFAULT_ICONS: StreamdownIcons = {\n copy: svg(\n '<rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/>',\n ),\n check: svg('<polyline points=\"20 6 9 17 4 12\"/>'),\n download: svg(\n '<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/>',\n ),\n externalLink: svg(\n '<path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/><polyline points=\"15 3 21 3 21 9\"/><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"/>',\n ),\n close: svg('<line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/>'),\n chevronDown: svg('<polyline points=\"6 9 12 15 18 9\"/>'),\n};\n\nexport const STREAMDOWN_ICONS = new InjectionToken<Partial<StreamdownIcons>>('STREAMDOWN_ICONS');\n\n/** Components get icons through this service. */\n@Injectable({ providedIn: 'root' })\nexport class IconService {\n private readonly overrides = inject(STREAMDOWN_ICONS, { optional: true }) ?? {};\n /** Merged icons (default + override). */\n readonly icons: StreamdownIcons = { ...DEFAULT_ICONS, ...this.overrides };\n}\n\n/** Overrides the icons. */\nexport function provideStreamdownIcons(icons: Partial<StreamdownIcons>): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: STREAMDOWN_ICONS, useValue: icons }]);\n}\n","import { EnvironmentProviders, Injectable, InjectionToken, inject, makeEnvironmentProviders } from '@angular/core';\n\n/**\n * UI strings (i18n). Angular equivalent of Streamdown `translations-context.tsx`.\n * Can be partially or fully overridden via `provideStreamdownTranslations({...})`.\n */\nexport interface StreamdownTranslations {\n // code block\n copy: string;\n copied: string;\n download: string;\n // table\n copyMarkdown: string;\n copyCsv: string;\n downloadCsv: string;\n // link modal\n openLink: string;\n cancel: string;\n open: string;\n linkWarningTitle: string;\n linkWarningBody: string;\n // mermaid\n mermaidError: string;\n renderingDiagram: string;\n // image\n imageError: string;\n}\n\n/** Default (English) strings. */\nexport const DEFAULT_TRANSLATIONS: StreamdownTranslations = {\n copy: 'Copy',\n copied: 'Copied',\n download: 'Download',\n copyMarkdown: 'Copy MD',\n copyCsv: 'Copy CSV',\n downloadCsv: 'Download CSV',\n openLink: 'Open link',\n cancel: 'Cancel',\n open: 'Open',\n linkWarningTitle: 'Open external link?',\n linkWarningBody: 'You are about to open an external link:',\n mermaidError: 'Mermaid render error',\n renderingDiagram: 'Rendering diagram…',\n imageError: 'Failed to load image',\n};\n\nexport const STREAMDOWN_TRANSLATIONS = new InjectionToken<Partial<StreamdownTranslations>>(\n 'STREAMDOWN_TRANSLATIONS',\n);\n\n/** Components get UI strings through this service. */\n@Injectable({ providedIn: 'root' })\nexport class TranslationsService {\n private readonly overrides = inject(STREAMDOWN_TRANSLATIONS, { optional: true }) ?? {};\n /** Merged strings (default + override). */\n readonly t: StreamdownTranslations = { ...DEFAULT_TRANSLATIONS, ...this.overrides };\n}\n\n/**\n * Overrides the UI strings (i18n). For example, in Uzbek:\n * provideStreamdownTranslations({ copy: 'Nusxa', copied: 'Nusxalandi', download: 'Yuklab olish' })\n */\nexport function provideStreamdownTranslations(\n translations: Partial<StreamdownTranslations>,\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: STREAMDOWN_TRANSLATIONS, useValue: translations },\n ]);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n inject,\n signal,\n input,\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { IconService } from '../services/icon.service';\nimport { TranslationsService } from '../services/translations.service';\n\n/**\n * Small button that copies code to the clipboard.\n *\n * On click, `navigator.clipboard.writeText(text())` is called and it briefly\n * switches to the \"copied\" state (signal + setTimeout). The timeout is cleared in\n * `ngOnDestroy`. Text (i18n) comes from `TranslationsService`, the icon from `IconService`.\n */\n@Component({\n selector: 'ngx-cb-copy',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <button\n type=\"button\"\n class=\"sd-btn\"\n [attr.aria-label]=\"copied() ? t.copied : t.copy\"\n [attr.title]=\"copied() ? t.copied : t.copy\"\n (click)=\"copy()\"\n >\n <span [innerHTML]=\"copied() ? checkIcon : copyIcon\"></span>\n <span>{{ copied() ? t.copied : t.copy }}</span>\n </button>\n `,\n})\nexport class CopyButtonComponent implements OnDestroy {\n /** Text to copy to the clipboard. */\n readonly text = input.required<string>();\n\n protected readonly copied = signal(false);\n\n private readonly sanitizer = inject(DomSanitizer);\n private readonly icons = inject(IconService).icons;\n protected readonly t = inject(TranslationsService).t;\n protected readonly copyIcon = this.sanitizer.bypassSecurityTrustHtml(this.icons.copy);\n protected readonly checkIcon = this.sanitizer.bypassSecurityTrustHtml(this.icons.check);\n\n private timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n async copy(): Promise<void> {\n try {\n await navigator.clipboard.writeText(this.text());\n this.copied.set(true);\n this.clearTimer();\n this.timeoutId = setTimeout(() => this.copied.set(false), 2000);\n } catch {\n // clipboard unavailable / permission denied — silently ignore\n }\n }\n\n ngOnDestroy(): void {\n this.clearTimer();\n }\n\n private clearTimer(): void {\n if (this.timeoutId !== null) {\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { IconService } from '../services/icon.service';\nimport { TranslationsService } from '../services/translations.service';\n\n/**\n * Small button that downloads code as a file.\n *\n * On click, a `Blob` is created from the text and the download is triggered via a\n * temporary `<a download>` (the object URL is revoked afterwards).\n */\n@Component({\n selector: 'ngx-cb-download',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <button\n type=\"button\"\n class=\"sd-btn\"\n [attr.aria-label]=\"t.download\"\n [attr.title]=\"t.download\"\n (click)=\"download()\"\n >\n <span [innerHTML]=\"downloadIcon\"></span>\n <span>{{ t.download }}</span>\n </button>\n `,\n})\nexport class DownloadButtonComponent {\n private readonly sanitizer = inject(DomSanitizer);\n protected readonly t = inject(TranslationsService).t;\n protected readonly downloadIcon = this.sanitizer.bypassSecurityTrustHtml(\n inject(IconService).icons.download,\n );\n\n /** Text to write to the file. */\n readonly text = input.required<string>();\n /** Name of the downloaded file. */\n readonly filename = input.required<string>();\n\n download(): void {\n const blob = new Blob([this.text()], { type: 'text/plain;charset=utf-8' });\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement('a');\n anchor.href = url;\n anchor.download = this.filename();\n document.body.appendChild(anchor);\n anchor.click();\n document.body.removeChild(anchor);\n URL.revokeObjectURL(url);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ComponentRef,\n ElementRef,\n OnDestroy,\n ViewContainerRef,\n computed,\n effect,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser';\nimport type { Element } from 'hast';\nimport { extractCodeInfo, languageToExtension } from './code-block-utils';\nimport { CODE_LANGUAGE_COMPONENTS } from './language-registry';\nimport { ShikiHighlighterService } from './shiki-highlighter.service';\nimport { CopyButtonComponent } from './copy-button.component';\nimport { DownloadButtonComponent } from './download-button.component';\n\n/**\n * MAIN component that renders a Markdown code block (`<pre>`).\n *\n * In COMPONENT_MAP this component is bound to the `pre` tag; the renderer\n * calls `setInput('node', preElement)`.\n *\n * Logic:\n * 1) First look up a component by language in `CODE_LANGUAGE_COMPONENTS`\n * (e.g. `mermaid`). If found, create it, pass the `code` input,\n * place it into the body and do NOT run Shiki.\n * 2) Otherwise, show the code card: header (language + copy/download) and\n * body (Shiki output). Until highlighting is ready, plain escaped\n * code is shown (so it appears immediately during streaming).\n */\n@Component({\n selector: 'ngx-code-block',\n standalone: true,\n imports: [CopyButtonComponent, DownloadButtonComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (!hasRegisteredComponent()) {\n <div class=\"sd-codeblock\">\n <!-- header bar -->\n <div class=\"sd-codeblock-header\">\n <span class=\"sd-codeblock-lang\">{{ language() }}</span>\n <span class=\"sd-codeblock-actions\">\n <ngx-cb-copy [text]=\"code()\" />\n <ngx-cb-download [text]=\"code()\" [filename]=\"downloadName()\" />\n </span>\n </div>\n\n <!-- body: Shiki output or (until loaded) plain escaped code -->\n <div class=\"sd-codeblock-body\">\n @if (highlighted(); as html) {\n <div [innerHTML]=\"html\"></div>\n } @else {\n <pre><code>{{ code() }}</code></pre>\n }\n </div>\n </div>\n }\n\n <!-- registered language component (e.g. mermaid) is placed here -->\n <div #pluginHost></div>\n `,\n})\nexport class CodeBlockComponent implements OnDestroy {\n /** The `<pre>` HAST element to render. */\n readonly node = input.required<Element>();\n\n private readonly vcr = inject(ViewContainerRef);\n private readonly highlighter = inject(ShikiHighlighterService);\n private readonly sanitizer = inject(DomSanitizer);\n\n /** Host where the plugin component is placed (for registered languages). */\n private readonly pluginHost =\n viewChild.required<ElementRef<HTMLElement>>('pluginHost');\n\n /** Created plugin ComponentRefs (for cleanup). */\n private pluginRefs: ComponentRef<unknown>[] = [];\n\n /** Code block info: {code, language}. */\n protected readonly info = computed(() => extractCodeInfo(this.node()));\n protected readonly code = computed(() => this.info().code);\n protected readonly language = computed(() => this.info().language);\n\n /** Name of the downloadable file (e.g. `code.ts`). */\n protected readonly downloadName = computed(\n () => `code.${languageToExtension(this.language())}`,\n );\n\n /** Is a dedicated component registered for this language? */\n protected readonly hasRegisteredComponent = computed(() =>\n CODE_LANGUAGE_COMPONENTS.has(this.language()),\n );\n\n /** Shiki-highlighted, sanitized HTML (null until loaded). */\n protected readonly highlighted = signal<SafeHtml | null>(null);\n\n constructor() {\n // Create/update the registered language component (such as mermaid).\n effect(() => {\n const lang = this.language();\n const codeText = this.code();\n const Cmp = CODE_LANGUAGE_COMPONENTS.get(lang);\n\n // each time, dispose the previous plugin components\n this.disposePlugins();\n\n if (Cmp) {\n const ref = this.vcr.createComponent(Cmp);\n ref.setInput('code', codeText);\n ref.changeDetectorRef.detectChanges();\n this.pluginHost().nativeElement.appendChild(ref.location.nativeElement);\n this.pluginRefs.push(ref);\n }\n });\n\n // Shiki highlight (only for non-registered languages).\n effect((onCleanup) => {\n const lang = this.language();\n const codeText = this.code();\n\n if (CODE_LANGUAGE_COMPONENTS.has(lang)) {\n this.highlighted.set(null);\n return;\n }\n\n let cancelled = false;\n // cancel the stale result if the effect re-runs or is destroyed\n onCleanup(() => {\n cancelled = true;\n });\n\n void this.highlighter.highlight(codeText, lang).then((html) => {\n if (cancelled) {\n return;\n }\n // Shiki output is safe (it escapes the code itself) — trust directly.\n this.highlighted.set(this.sanitizer.bypassSecurityTrustHtml(html));\n });\n });\n }\n\n ngOnDestroy(): void {\n this.disposePlugins();\n }\n\n private disposePlugins(): void {\n for (const ref of this.pluginRefs) {\n ref.destroy();\n }\n this.pluginRefs = [];\n }\n}\n","import type { Element, ElementContent, Text } from 'hast';\n\n/**\n * Pure functions that extract plain-text data (rows × cells) from a HAST `table`\n * element and convert it into various formats (CSV, TSV, Markdown).\n *\n * This file has no DOM dependency — it works only on the HAST tree, so it is\n * fully testable and reusable.\n */\n\n/** Type guard that selects only element nodes. */\nfunction isElement(node: ElementContent): node is Element {\n return node.type === 'element';\n}\n\n/** Recursively collects the values of all text nodes under a node. */\nfunction collectText(node: ElementContent): string {\n if (node.type === 'text') {\n return (node as Text).value;\n }\n if (node.type === 'element') {\n let out = '';\n for (const child of node.children) {\n out += collectText(child);\n }\n return out;\n }\n // 'comment' and other node types — produce no text\n return '';\n}\n\n/** Finds the given tags among the element's direct children. */\nfunction childrenByTag(parent: Element, ...tags: readonly string[]): Element[] {\n const set = new Set(tags);\n return parent.children.filter((c): c is Element => isElement(c) && set.has(c.tagName));\n}\n\n/**\n * Walks a HAST `table` element and collects the text of each cell.\n * Structure: table → (thead | tbody) → tr → (th | td). A `tr` placed directly\n * under the table is also supported.\n * Each cell's text is `trim()`-ed.\n */\nexport function extractTableData(table: Element): string[][] {\n const rows: string[][] = [];\n\n // collect the trs: first from thead/tbody/tfoot, then the direct ones\n const trElements: Element[] = [];\n const sections = childrenByTag(table, 'thead', 'tbody', 'tfoot');\n if (sections.length > 0) {\n for (const section of sections) {\n trElements.push(...childrenByTag(section, 'tr'));\n }\n }\n // in some HAST trees a tr can sit directly under the table\n trElements.push(...childrenByTag(table, 'tr'));\n\n for (const tr of trElements) {\n const cells = childrenByTag(tr, 'th', 'td');\n const row = cells.map((cell) => collectText(cell).trim());\n rows.push(row);\n }\n\n return rows;\n}\n\n/**\n * Escapes a single CSV cell per RFC 4180 rules.\n * If it contains a comma, quote, or newline — it is wrapped in quotes and\n * inner quotes are doubled.\n */\nfunction escapeCsvCell(value: string): string {\n if (/[\",\\r\\n]/.test(value)) {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n }\n return value;\n}\n\n/** Converts rows to RFC 4180 CSV text (CRLF row separator). */\nexport function toCsv(rows: string[][]): string {\n return rows.map((row) => row.map(escapeCsvCell).join(',')).join('\\r\\n');\n}\n\n/**\n * Converts rows to TSV (tab-separated) text.\n * Tabs and newlines inside a cell are replaced with spaces (TSV has no escaping).\n */\nexport function toTsv(rows: string[][]): string {\n return rows\n .map((row) => row.map((cell) => cell.replace(/[\\t\\r\\n]+/g, ' ')).join('\\t'))\n .join('\\n');\n}\n\n/** Escapes the `|` character for a Markdown table cell and removes newlines. */\nfunction escapeMarkdownCell(value: string): string {\n return value.replace(/\\|/g, '\\\\|').replace(/[\\r\\n]+/g, ' ');\n}\n\n/**\n * Converts rows to a GFM Markdown table.\n * The first row is taken as the header and a `---` separator row is added after it.\n * Returns an empty string for empty input.\n */\nexport function toMarkdown(rows: string[][]): string {\n if (rows.length === 0) {\n return '';\n }\n\n // table width — the longest row (to pad ragged rows)\n const colCount = rows.reduce((max, row) => Math.max(max, row.length), 0);\n\n const renderRow = (row: string[]): string => {\n const cells: string[] = [];\n for (let i = 0; i < colCount; i++) {\n cells.push(escapeMarkdownCell(row[i] ?? ''));\n }\n return `| ${cells.join(' | ')} |`;\n };\n\n const header = renderRow(rows[0]);\n const separator = `| ${Array.from({ length: colCount }, () => '---').join(' | ')} |`;\n const body = rows.slice(1).map(renderRow);\n\n return [header, separator, ...body].join('\\n');\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ComponentRef,\n ElementRef,\n OnDestroy,\n Renderer2,\n ViewContainerRef,\n effect,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport type { Element } from 'hast';\nimport { HastRendererService } from '../hast/hast-renderer.service';\nimport { TranslationsService } from '../services/translations.service';\nimport { extractTableData, toCsv, toMarkdown } from './table-utils';\n\n/**\n * Custom component bound to `table` HAST tags (`table` → this in COMPONENT_MAP).\n *\n * Operating principle (AVOIDING RECURSION):\n * If we re-render the `table` node ITSELF, we get infinite recursion\n * (because `table` is in COMPONENT_MAP). So we create the `<table>` DOM\n * element ourselves with Renderer2 and render only the node's CHILDREN\n * (thead/tbody/tr ...) into that element.\n *\n * Additionally, a small toolbar is added for copying the table as Markdown/CSV\n * and downloading it as CSV.\n */\n@Component({\n selector: 'ngx-table',\n standalone: true,\n template: `\n <div class=\"sd-table\">\n <div class=\"sd-table-toolbar\">\n <button type=\"button\" class=\"sd-table-btn\" (click)=\"copyMarkdown()\">\n 📋 {{ t.copyMarkdown }}\n </button>\n <button type=\"button\" class=\"sd-table-btn\" (click)=\"copyCsv()\">\n 📋 {{ t.copyCsv }}\n </button>\n <button type=\"button\" class=\"sd-table-btn\" (click)=\"downloadCsv()\">\n ⬇️ {{ t.downloadCsv }}\n </button>\n @if (copied()) {\n <span class=\"sd-table-msg\">{{ copied() }}</span>\n }\n </div>\n <div #tableHost class=\"sd-table-scroll\"></div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TableComponent implements OnDestroy {\n /** HAST `table` element node to render */\n readonly node = input.required<Element>();\n\n protected readonly t = inject(TranslationsService).t;\n\n /** Temporary \"copied\" message for a toolbar action (`null` when none) */\n readonly copied = signal<string | null>(null);\n\n // tableHost — target DOM element for imperatively building the `<table>`\n private readonly hostElRef = viewChild.required<ElementRef<HTMLElement>>('tableHost');\n\n private readonly vcr = inject(ViewContainerRef);\n private readonly renderer = inject(HastRendererService);\n private readonly renderer2 = inject(Renderer2);\n\n private refs: ComponentRef<unknown>[] = [];\n private builtTable: HTMLElement | null = null;\n private feedbackTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n // When node() changes, clear the old table and rebuild a new one\n effect(() => {\n const tableNode = this.node();\n const host = this.hostElRef().nativeElement;\n\n // clear the previous render (destroy ComponentRefs + remove DOM children)\n this.cleanup(host);\n\n // build the `<table>` ourselves — render the node's CHILDREN, not the node ITSELF\n const tableEl: HTMLElement = this.renderer2.createElement('table');\n this.renderer2.setAttribute(tableEl, 'class', 'sd-table-el');\n this.refs = this.renderer.renderNodes(tableNode.children, tableEl, this.vcr);\n this.renderer2.appendChild(host, tableEl);\n this.builtTable = tableEl;\n });\n }\n\n ngOnDestroy(): void {\n const host = this.hostElRef().nativeElement;\n this.cleanup(host);\n if (this.feedbackTimer !== null) {\n clearTimeout(this.feedbackTimer);\n this.feedbackTimer = null;\n }\n }\n\n /** Copies the Markdown representation of the table to the clipboard. */\n async copyMarkdown(): Promise<void> {\n await this.copyToClipboard(toMarkdown(extractTableData(this.node())), this.t.copied);\n }\n\n /** Copies the CSV representation of the table to the clipboard. */\n async copyCsv(): Promise<void> {\n await this.copyToClipboard(toCsv(extractTableData(this.node())), this.t.copied);\n }\n\n /** Downloads the table as a `table.csv` file (via Blob). */\n downloadCsv(): void {\n const csv = toCsv(extractTableData(this.node()));\n // add a BOM so Excel reads UTF-8 correctly\n const blob = new Blob(['', csv], { type: 'text/csv;charset=utf-8;' });\n const url = URL.createObjectURL(blob);\n const a = this.renderer2.createElement('a') as HTMLAnchorElement;\n a.href = url;\n a.download = 'table.csv';\n a.click();\n URL.revokeObjectURL(url);\n this.flashFeedback('Downloaded');\n }\n\n // ── internal ───────────────────────────────────────────────────────────\n\n /** Writes text to the clipboard and shows a temporary message (when the Clipboard API is available). */\n private async copyToClipboard(text: string, message: string): Promise<void> {\n try {\n await navigator.clipboard.writeText(text);\n this.flashFeedback(message);\n } catch {\n // if the clipboard is unavailable (old browser / SSR) — fail silently\n this.flashFeedback('Copy failed');\n }\n }\n\n /** Sets a temporary feedback message visible for ~2s. */\n private flashFeedback(message: string): void {\n this.copied.set(message);\n if (this.feedbackTimer !== null) {\n clearTimeout(this.feedbackTimer);\n }\n this.feedbackTimer = setTimeout(() => {\n this.copied.set(null);\n this.feedbackTimer = null;\n }, 2000);\n }\n\n /** Clears the built table and its ComponentRefs. */\n private cleanup(host: HTMLElement): void {\n if (this.builtTable) {\n this.renderer.clear(this.builtTable, this.refs);\n this.renderer2.removeChild(host, this.builtTable);\n this.builtTable = null;\n } else if (this.refs.length > 0) {\n for (const ref of this.refs) {\n ref.destroy();\n }\n }\n this.refs = [];\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport type { Element } from 'hast';\nimport { TranslationsService } from '../services/translations.service';\n\n/**\n * Component for markdown images (`img`). Equivalent of Streamdown `lib/image.tsx`.\n *\n * Bound to the `img` tag in COMPONENT_MAP. Comes with a loading skeleton, error state and\n * lazy-loading. The `node` input is the hast `img` element node.\n */\n@Component({\n selector: 'ngx-image',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (errored()) {\n <span class=\"sd-img-error\">🖼 {{ t.imageError }}</span>\n } @else {\n @if (!loaded()) {\n <span class=\"sd-img-skeleton\"></span>\n }\n <img\n [src]=\"src()\"\n [alt]=\"alt()\"\n [attr.title]=\"title()\"\n loading=\"lazy\"\n class=\"sd-img\"\n [class.sd-img--hidden]=\"!loaded()\"\n (load)=\"loaded.set(true)\"\n (error)=\"errored.set(true)\"\n />\n }\n `,\n})\nexport class ImageComponent {\n /** hast `img` element node */\n readonly node = input.required<Element>();\n\n protected readonly t = inject(TranslationsService).t;\n protected readonly loaded = signal(false);\n protected readonly errored = signal(false);\n\n protected readonly src = computed(() => this.prop('src'));\n protected readonly alt = computed(() => this.prop('alt'));\n protected readonly title = computed(() => this.prop('title') || null);\n\n private prop(name: string): string {\n const value = this.node().properties?.[name];\n return typeof value === 'string' ? value : '';\n }\n}\n","import { COMPONENT_MAP } from './hast/component-map';\nimport { CodeBlockComponent } from './code-block/code-block.component';\nimport { TableComponent } from './table/table.component';\nimport { ImageComponent } from './components/image.component';\n\nlet registered = false;\n\n/**\n * Registers the default custom components into COMPONENT_MAP (once).\n *\n * Called in the `HastRendererComponent` constructor (at runtime) — so the `pre` and\n * `table` tags are bound to their components before any render begins.\n * The runtime call is safe from bundler tree-shaking (not a side-effect import).\n *\n * After this call, users can add their own tags to COMPONENT_MAP or replace the\n * defaults.\n */\nexport function registerDefaultComponents(): void {\n if (registered) {\n return;\n }\n registered = true;\n if (!COMPONENT_MAP.has('pre')) {\n COMPONENT_MAP.set('pre', CodeBlockComponent); // code blocks (Shiki, copy/download)\n }\n if (!COMPONENT_MAP.has('table')) {\n COMPONENT_MAP.set('table', TableComponent); // tables (copy/download MD/CSV)\n }\n if (!COMPONENT_MAP.has('img')) {\n COMPONENT_MAP.set('img', ImageComponent); // images (loading/error states)\n }\n}\n","/**\n * Streaming \"caret\" (typing cursor) animation. In the spirit of Streamdown `lib/animate.ts`.\n *\n * The caret is placed inside DOM dynamically created by the renderer (not an Angular\n * template), so the styles must be global — we inject them into `document.head` once\n * (to avoid requiring CSS from the consumer).\n */\nexport const CARET_CLASS = 'ngx-sd-caret';\n\nlet injected = false;\n\n/** Injects the global keyframe + class styles for the caret once. */\nexport function ensureCaretStyles(): void {\n if (injected || typeof document === 'undefined') {\n return;\n }\n injected = true;\n const style = document.createElement('style');\n style.textContent = `\n@keyframes ngx-sd-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }\n.${CARET_CLASS} {\n display: inline-block;\n width: 0.5em;\n height: 1em;\n margin-left: 1px;\n vertical-align: text-bottom;\n background: currentColor;\n border-radius: 1px;\n animation: ngx-sd-blink 1s step-start infinite;\n}\n`;\n document.head.appendChild(style);\n}\n\n/** Creates the caret `<span>` element. */\nexport function createCaret(): HTMLElement {\n ensureCaretStyles();\n const span = document.createElement('span');\n span.className = CARET_CLASS;\n span.setAttribute('aria-hidden', 'true');\n return span;\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n ViewContainerRef,\n ViewEncapsulation,\n effect,\n inject,\n input,\n viewChild,\n} from '@angular/core';\nimport type { Root } from 'hast';\nimport { HastRendererService, RenderedNode } from './hast-renderer.service';\nimport { registerDefaultComponents } from '../register-components';\nimport { createCaret } from '../animate/caret';\n\n/**\n * The entry point of the HAST renderer.\n *\n * When the `hast` input (Root) changes, it does not rebuild the whole tree — it\n * **diffs (reconciles)** against the previous render: only changed text/attributes/elements\n * are updated. During streaming this eliminates flicker, preserves scroll/selection, and updates\n * the `node` input of special components (code-block, table) without recreating them.\n */\n@Component({\n selector: 'ngx-hast-renderer',\n standalone: true,\n template: `<div #host class=\"ngx-streamdown\"></div>`,\n // Inline the CSS globally (None) so it also reaches the DOM elements created by\n // Renderer2 (Emulated scope does not work since they are not in the template).\n // Since it is scoped under `.ngx-streamdown` / component tags, it does not leak into the app.\n styleUrl: '../../styles/streamdown.css',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class HastRendererComponent implements OnDestroy {\n /** The HAST Root tree to render */\n readonly hast = input.required<Root>();\n /** Append a streaming caret (text cursor) at the end */\n readonly caret = input(false);\n\n private readonly hostRef = viewChild.required<ElementRef<HTMLElement>>('host');\n private readonly vcr = inject(ViewContainerRef);\n private readonly renderer = inject(HastRendererService);\n private rendered: RenderedNode[] = [];\n private caretEl: HTMLElement | null = null;\n\n constructor() {\n registerDefaultComponents(); // registers the pre/table/img components (once)\n // diff when hast/caret changes (effect tracks signals automatically)\n effect(() => {\n const root = this.hast();\n const showCaret = this.caret();\n const host = this.hostRef().nativeElement;\n\n this.removeCaret(); // remove the caret before diffing (it is not a hast node)\n this.rendered = this.renderer.reconcile(host, this.rendered, root.children, this.vcr);\n if (showCaret) {\n this.addCaret(host);\n }\n });\n }\n\n ngOnDestroy(): void {\n // clean up dynamic components (prevent memory leaks)\n this.renderer.destroyAll(this.rendered);\n }\n\n /** Appends the caret inside the last block element (inline) or to the host. */\n private addCaret(host: HTMLElement): void {\n const target = (host.lastElementChild as HTMLElement | null) ?? host;\n this.caretEl = createCaret();\n target.appendChild(this.caretEl);\n }\n\n /** Removes the existing caret from the DOM. */\n private removeCaret(): void {\n this.caretEl?.remove();\n this.caretEl = null;\n }\n}\n","import { Injectable, InjectionToken, inject } from '@angular/core';\nimport { unified, type PluggableList, type Processor } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkGfm from 'remark-gfm';\nimport remarkRehype from 'remark-rehype';\nimport rehypeRaw from 'rehype-raw';\nimport rehypeSanitize from 'rehype-sanitize';\nimport remend from 'remend';\nimport type { Root } from 'hast';\n\n/**\n * Configuration that plugins add to the pipeline (math, cjk, ...).\n * `provideStreamdown*()` providers populate this token with `multi: true`.\n */\nexport interface StreamdownPipelineConfig {\n /** remark plugins added BEFORE remark-rehype (e.g. remark-math) */\n remarkPlugins?: PluggableList;\n /** rehype plugins added BEFORE rehype-sanitize (e.g. rehype-katex) */\n rehypePlugins?: PluggableList;\n /** Override the rehype-sanitize schema (e.g. to allow katex output) */\n sanitizeSchema?: unknown;\n}\n\nexport const STREAMDOWN_PIPELINE = new InjectionToken<StreamdownPipelineConfig[]>(\n 'STREAMDOWN_PIPELINE',\n);\n\n/**\n * Converts a markdown string into a HAST (HTML AST) tree.\n * Matches the Streamdown `lib/markdown.ts` pipeline, but extensible via plugins:\n * remark-parse → remark-gfm → [remarkPlugins] → remark-rehype → rehype-raw\n * → [rehypePlugins] → rehype-sanitize\n */\n@Injectable({ providedIn: 'root' })\nexport class MarkdownService {\n // Plugin configurations provided via DI (math, ...). Empty if none.\n private readonly configs = inject(STREAMDOWN_PIPELINE, { optional: true }) ?? [];\n private readonly processor: Processor = this.build();\n\n /**\n * Markdown → HAST tree (sync). Uses `runSync` so each render is fast during streaming.\n * @param options.remend \"close\" incomplete markdown (default: true)\n */\n toHast(markdown: string, options?: { remend?: boolean }): Root {\n const source = options?.remend === false ? markdown : remend(markdown);\n const mdast = this.processor.parse(source);\n const hast = this.processor.runSync(mdast);\n return hast as unknown as Root;\n }\n\n /** Builds the pipeline with plugins (once). */\n private build(): Processor {\n const processor = unified().use(remarkParse).use(remarkGfm);\n for (const cfg of this.configs) {\n if (cfg.remarkPlugins) {\n processor.use(cfg.remarkPlugins);\n }\n }\n processor.use(remarkRehype, { allowDangerousHtml: true }).use(rehypeRaw);\n for (const cfg of this.configs) {\n if (cfg.rehypePlugins) {\n processor.use(cfg.rehypePlugins);\n }\n }\n const schema = this.configs.find((c) => c.sanitizeSchema)?.sanitizeSchema;\n processor.use(rehypeSanitize, schema as never);\n return processor as unknown as Processor;\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { HastRendererComponent } from './hast/hast-renderer.component';\nimport { MarkdownService } from './markdown.service';\n\n/**\n * Renders a single markdown block (Streamdown `Block`, memoized).\n *\n * Thanks to `OnPush` + the parent's `@for track $index`, only the changed block\n * re-renders — the streaming equivalent of React's `memo()`.\n */\n@Component({\n selector: 'ngx-block',\n standalone: true,\n imports: [HastRendererComponent],\n template: `<ngx-hast-renderer [hast]=\"hast()\" [caret]=\"caret()\" />`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BlockComponent {\n /** Markdown text of a single block */\n readonly content = input.required<string>();\n /** Fix incomplete markdown (remend) */\n readonly parseIncompleteMarkdown = input<boolean>(true);\n /** Whether to append a streaming caret at the end of this block (last block only) */\n readonly caret = input(false);\n\n private readonly md = inject(MarkdownService);\n\n // React's useMemo(unified.process) → computed\n readonly hast = computed(() =>\n this.md.toHast(this.content(), { remend: this.parseIncompleteMarkdown() }),\n );\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { LinkModalService } from './link-modal.service';\nimport { TranslationsService } from '../services/translations.service';\n\n/**\n * External link confirmation modal. Added to the `StreamdownComponent` template and\n * shown when `LinkModalService.pendingUrl` is set. Otherwise renders nothing.\n */\n@Component({\n selector: 'ngx-link-modal',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (url(); as link) {\n <div class=\"sd-modal-overlay\" (click)=\"cancel()\">\n <div class=\"sd-modal\" (click)=\"$event.stopPropagation()\">\n <h3 class=\"sd-modal-title\">{{ t.linkWarningTitle }}</h3>\n <p class=\"sd-modal-body\">{{ t.linkWarningBody }}</p>\n <p class=\"sd-modal-url\">{{ link }}</p>\n <div class=\"sd-modal-actions\">\n <button type=\"button\" class=\"sd-modal-btn\" (click)=\"cancel()\">\n {{ t.cancel }}\n </button>\n <button type=\"button\" class=\"sd-modal-btn sd-modal-btn--primary\" (click)=\"confirm()\">\n {{ t.open }}\n </button>\n </div>\n </div>\n </div>\n }\n `,\n})\nexport class LinkModalComponent {\n private readonly svc = inject(LinkModalService);\n protected readonly t = inject(TranslationsService).t;\n protected readonly url = this.svc.pendingUrl;\n\n confirm(): void {\n this.svc.confirm();\n }\n cancel(): void {\n this.svc.cancel();\n }\n}\n","import { marked } from 'marked';\n\n/**\n * Splits markdown into top-level blocks (Streamdown `lib/parse-blocks.tsx`).\n *\n * The `marked` lexer breaks markdown into tokens; each token's `raw` text is one block.\n * This matters for streaming: only the changed (last) block re-renders, while the\n * rest stay unchanged thanks to `@for track $index` + OnPush.\n */\nexport function parseMarkdownIntoBlocks(markdown: string): string[] {\n if (!markdown) {\n return [];\n }\n const tokens = marked.lexer(markdown);\n return tokens.map((token) => token.raw);\n}\n","/**\n * Detects text direction (Streamdown `lib/detect-direction.ts`).\n * Returns 'rtl' if RTL characters (Arabic, Hebrew, Persian) are present, otherwise 'ltr'.\n */\nconst RTL_CHARS =\n /[֑-߿܀-ݏހ-ࢠ-ࣿיִ-﷽ﹰ-ﻼ]/;\n\nexport function detectDirection(text: string): 'rtl' | 'ltr' {\n return RTL_CHARS.test(text) ? 'rtl' : 'ltr';\n}\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { BlockComponent } from './block.component';\nimport { LinkModalComponent } from './components/link-modal.component';\nimport { parseMarkdownIntoBlocks } from './core/parse-blocks';\nimport { detectDirection } from './core/detect-direction';\n\n/**\n * Main public component (Streamdown `index.tsx`).\n *\n * Usage:\n * <ngx-streamdown [content]=\"markdown()\" />\n *\n * Data flow (React useMemo chain → Angular computed):\n * content → parseMarkdownIntoBlocks → @for(block) → ngx-block → hast-renderer\n */\n@Component({\n selector: 'ngx-streamdown',\n standalone: true,\n imports: [BlockComponent, LinkModalComponent],\n template: `\n @for (block of blocks(); track $index) {\n <ngx-block\n [content]=\"block\"\n [parseIncompleteMarkdown]=\"parseIncompleteMarkdown()\"\n [caret]=\"caret() && $last\"\n />\n }\n <ngx-link-modal />\n `,\n host: {\n class: 'ngx-streamdown',\n '[attr.dir]': 'dir()',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class StreamdownComponent {\n /** Markdown text to render (grows during streaming) */\n readonly content = input<string>('');\n /** Fix incomplete markdown (such as `**bold` during streaming). Default: true */\n readonly parseIncompleteMarkdown = input<boolean>(true);\n /** Show a streaming caret (typing cursor) at the end of the last block. Default: false */\n readonly caret = input<boolean>(false);\n\n // Split into blocks — only the changed block re-renders\n readonly blocks = computed(() => parseMarkdownIntoBlocks(this.content() ?? ''));\n // Automatic RTL/LTR detection\n readonly dir = computed(() => detectDirection(this.content() ?? ''));\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ComponentRef,\n ElementRef,\n OnDestroy,\n OnInit,\n ViewContainerRef,\n inject,\n input,\n} from '@angular/core';\nimport type { Element } from 'hast';\nimport { HastRendererService } from './hast-renderer.service';\n\n/**\n * A standalone component that renders a single generic HAST element node.\n *\n * The main render path goes through `HastRendererService` directly with Renderer2\n * (wrapper-free, for correct HTML semantics). This component serves as a reusable\n * unit: for when special components want to render their HAST children, or to use it\n * from a template as `<ngx-hast-element [node]=\"...\">`.\n *\n * `:host { display: contents }` — the `<ngx-hast-element>` wrapper does not affect layout.\n */\n@Component({\n selector: 'ngx-hast-element',\n standalone: true,\n template: '',\n styles: [':host { display: contents; }'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class HastElementComponent implements OnInit, OnDestroy {\n /** The HAST element node to render */\n readonly node = input.required<Element>();\n\n private readonly hostRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly vcr = inject(ViewContainerRef);\n private readonly renderer = inject(HastRendererService);\n private refs: ComponentRef<unknown>[] = [];\n\n ngOnInit(): void {\n // render the node itself (and its children) into the host element\n this.refs = this.renderer.renderNodes([this.node()], this.hostRef.nativeElement, this.vcr);\n }\n\n ngOnDestroy(): void {\n this.renderer.clear(this.hostRef.nativeElement, this.refs);\n }\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { STREAMDOWN_ANIMATE } from '../hast/hast-renderer.service';\n\n/**\n * Enables the fade-in animation for elements that newly appear during streaming.\n * Thanks to diffing (reconcile), only NEW DOM is animated — existing elements don't replay.\n * `prefers-reduced-motion` is respected.\n */\nexport function provideStreamdownAnimation(): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: STREAMDOWN_ANIMATE, useValue: true }]);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n effect,\n ElementRef,\n inject,\n input,\n Renderer2,\n signal,\n viewChild,\n} from '@angular/core';\nimport { TranslationsService } from '../services/translations.service';\n\n/**\n * Module-level counter that provides a stable, unique id for each diagram.\n *\n * Instead of `Math.random`/`Date` we use a simple incrementing counter — this is\n * deterministic in SSR/test environments and guarantees the unique id mermaid requires.\n */\nlet diagramCounter = 0;\n\n/**\n * Module-level flag for initializing the mermaid library only once.\n *\n * Since `mermaid` is an optional peer dependency, it is loaded via dynamic `import()`;\n * therefore we also keep the init state at module level (shared across instances).\n */\nlet mermaidInitialized = false;\n\n/**\n * Component that converts a `mermaid` language block into an SVG diagram.\n *\n * It is registered in the code-language registry via `provideStreamdownMermaid()`;\n * after that, ```mermaid code blocks are rendered with this component instead of Shiki highlighting.\n *\n * Data flow:\n * code() changes → effect → renderDiagram() → dynamic import('mermaid') → m.render() → innerHTML\n */\n@Component({\n selector: 'ngx-mermaid',\n standalone: true,\n template: `\n @if (errorMessage(); as err) {\n <div class=\"sd-mermaid-error\">\n <p><strong>{{ t.mermaidError }}</strong></p>\n <p>{{ err }}</p>\n <pre>{{ code() }}</pre>\n </div>\n } @else if (rendering() && !hasRendered()) {\n <p class=\"sd-mermaid-loading\">{{ t.renderingDiagram }}</p>\n }\n <!-- The diagram SVG is placed in this container (shown when there is no error) -->\n <div #host class=\"ngx-mermaid\" [hidden]=\"!!errorMessage()\"></div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MermaidComponent {\n /** Raw mermaid source to render (provided by the registry via the `code` input) */\n readonly code = input.required<string>();\n\n /** Container where the SVG is placed */\n private readonly host = viewChild.required<ElementRef<HTMLDivElement>>('host');\n\n private readonly renderer = inject(Renderer2);\n protected readonly t = inject(TranslationsService).t;\n\n /** Indicates a render is in progress (loading state) */\n protected readonly rendering = signal(false);\n /** Error message (when non-empty, the error box is shown) */\n protected readonly errorMessage = signal<string | null>(null);\n /** Whether at least one successful render has occurred (for streaming UX) */\n protected readonly hasRendered = signal(false);\n\n /**\n * Sequence number of the most recent render request. Async renders may finish out of order —\n * we only write the result of the latest request to the DOM (to avoid a race condition).\n */\n private renderSeq = 0;\n\n constructor() {\n // re-render the diagram whenever code() or host() changes.\n // the effect is created in an injection context (the constructor).\n effect(() => {\n // read the dependencies so the effect re-runs when a signal changes\n this.code();\n this.host();\n // delegate the async work to a separate helper (the effect callback itself must not be async)\n void this.renderDiagram();\n });\n }\n\n /**\n * Dynamically loads mermaid and renders the current `code()` to SVG.\n *\n * IMPORTANT: first we validate the syntax with `mermaid.parse(..., { suppressErrors: true })`.\n * During streaming, when the code is not yet complete, parse returns `false` — in that case\n * we do NOT call `m.render()` AT ALL (so mermaid's \"Syntax error\" bomb graphic does not\n * appear) and we keep the previous diagram.\n */\n private async renderDiagram(): Promise<void> {\n const source = this.code().trim();\n const container = this.host().nativeElement;\n const seq = ++this.renderSeq;\n\n // empty source — do nothing\n if (!source) {\n this.rendering.set(false);\n return;\n }\n\n this.rendering.set(true);\n\n try {\n // mermaid is an optional peer dependency — dynamic import keeps it out of the base bundle\n const m = (await import('mermaid')).default;\n if (seq !== this.renderSeq) {\n return; // this request is stale — a newer one is in flight\n }\n\n // initialize only once; securityLevel 'strict' — output is trusted\n if (!mermaidInitialized) {\n m.initialize({ startOnLoad: false, securityLevel: 'strict', theme: 'default' });\n mermaidInitialized = true;\n }\n\n // validate the syntax without throwing; if false — the code is not yet complete/invalid\n const valid = await m.parse(source, { suppressErrors: true });\n if (seq !== this.renderSeq) {\n return;\n }\n if (!valid) {\n // streaming is ongoing or the code is invalid — don't show the bomb, keep the previous state\n this.errorMessage.set(null);\n this.rendering.set(false);\n return;\n }\n\n const id = `ngx-mermaid-${diagramCounter++}`;\n const { svg } = await m.render(id, source);\n if (seq !== this.renderSeq) {\n return; // the result is stale — don't write it\n }\n\n // with securityLevel 'strict', mermaid's output is considered trusted\n this.renderer.setProperty(container, 'innerHTML', svg);\n this.errorMessage.set(null);\n this.hasRendered.set(true);\n } catch (error) {\n if (seq !== this.renderSeq) {\n return;\n }\n // parse succeeded but render failed unexpectedly — show the error box\n this.errorMessage.set(error instanceof Error ? error.message : String(error));\n } finally {\n if (seq === this.renderSeq) {\n this.rendering.set(false);\n }\n // on a render error mermaid may leave an orphan `#d<id>` element in the DOM — clean it up\n removeOrphanMermaidNodes();\n }\n }\n}\n\n/**\n * Cleans up temporary elements (`#dngx-mermaid-*` and `#ngx-mermaid-*`) left orphaned\n * on `document.body` when mermaid `render()` fails — so the \"bomb\" graphic does not\n * linger on the page.\n */\nfunction removeOrphanMermaidNodes(): void {\n if (typeof document === 'undefined') {\n return;\n }\n const orphans = document.querySelectorAll(\n 'body > [id^=\"dngx-mermaid-\"], body > [id^=\"ngx-mermaid-\"]',\n );\n orphans.forEach((node) => node.remove());\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n provideEnvironmentInitializer,\n} from '@angular/core';\nimport { CODE_LANGUAGE_COMPONENTS } from '../code-block/language-registry';\nimport { MermaidComponent } from './mermaid.component';\n\n/**\n * Enables mermaid diagrams. Add `provideStreamdownMermaid()` in `app.config.ts`:\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [provideStreamdownMermaid()],\n * };\n *\n * This binds the `mermaid` language to the code-language registry, so ```mermaid code blocks\n * are rendered as SVG diagrams via `MermaidComponent`.\n */\nexport function provideStreamdownMermaid(): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideEnvironmentInitializer(() => {\n CODE_LANGUAGE_COMPONENTS.set('mermaid', MermaidComponent);\n }),\n ]);\n}\n","import { defaultSchema } from 'rehype-sanitize';\n\n/**\n * Additional tags allowed for KaTeX MathML/SVG output.\n * The MathML and SVG elements that rehype-katex produces, otherwise\n * rehype-sanitize would strip them.\n */\nconst KATEX_TAG_NAMES: readonly string[] = [\n 'span',\n 'div',\n 'math',\n 'semantics',\n 'annotation',\n 'mrow',\n 'mi',\n 'mo',\n 'mn',\n 'ms',\n 'mtext',\n 'msup',\n 'msub',\n 'msubsup',\n 'mfrac',\n 'msqrt',\n 'mroot',\n 'munder',\n 'mover',\n 'munderover',\n 'mtable',\n 'mtr',\n 'mtd',\n 'mspace',\n 'mpadded',\n 'mphantom',\n 'menclose',\n 'mstyle',\n 'mglyph',\n 'line',\n 'svg',\n 'path',\n 'g',\n];\n\n// `defaultSchema` is loosely typed (the token expects `unknown`), so we\n// cast it to a local type for convenient reading.\nconst base = defaultSchema as {\n attributes?: Record<string, unknown[]>;\n tagNames?: string[];\n [key: string]: unknown;\n};\n\n// Take the existing `attributes['*']` list and allow `className` and `style`\n// (KaTeX uses inline styles) on all elements.\nconst baseWildcardAttributes = base.attributes?.['*'] ?? [];\nconst wildcardAttributes = [\n ...baseWildcardAttributes,\n 'className',\n 'class',\n 'style',\n 'ariaHidden',\n 'aria-hidden',\n];\n\n// Merge the existing tagNames with the KaTeX tags and remove duplicates.\nconst baseTagNames = base.tagNames ?? [];\nconst tagNames = Array.from(new Set([...baseTagNames, ...KATEX_TAG_NAMES]));\n\n/**\n * Sanitize schema that preserves KaTeX output.\n * A deeply extended copy of `defaultSchema`:\n * - allows `className`/`style`/`aria-hidden` on all elements,\n * - adds MathML + SVG (katex) tags to `tagNames`.\n * Loosely typed because the token expects `unknown`.\n */\nexport const katexSanitizeSchema: unknown = {\n ...base,\n attributes: {\n ...(base.attributes ?? {}),\n '*': wildcardAttributes,\n },\n tagNames,\n};\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport remarkMath from 'remark-math';\nimport rehypeKatex from 'rehype-katex';\nimport { STREAMDOWN_PIPELINE, type StreamdownPipelineConfig } from '../markdown.service';\nimport { katexSanitizeSchema } from './sanitize-schema';\n\n/**\n * Enables KaTeX math formulas ($inline$ and $$block$$).\n * IMPORTANT: the consuming app MUST import `katex/dist/katex.min.css`.\n */\nexport function provideStreamdownMath(): EnvironmentProviders {\n const config: StreamdownPipelineConfig = {\n remarkPlugins: [remarkMath],\n rehypePlugins: [rehypeKatex],\n sanitizeSchema: katexSanitizeSchema,\n };\n return makeEnvironmentProviders([\n { provide: STREAMDOWN_PIPELINE, multi: true, useValue: config },\n ]);\n}\n","import { EnvironmentProviders, Injectable, InjectionToken, inject, makeEnvironmentProviders } from '@angular/core';\n\n/**\n * CSS class/data-attribute prefix. Equivalent of Streamdown `prefix-context.tsx`.\n * Provides a stable \"hook\" for styling (e.g. `data-streamdown=\"code-block\"`).\n */\nexport const STREAMDOWN_PREFIX = new InjectionToken<string>('STREAMDOWN_PREFIX');\n\n@Injectable({ providedIn: 'root' })\nexport class PrefixService {\n /** Default prefix 'streamdown'. */\n readonly prefix = inject(STREAMDOWN_PREFIX, { optional: true }) ?? 'streamdown';\n\n /** `prefixed('code-block')` → `'streamdown-code-block'`. */\n prefixed(name: string): string {\n return `${this.prefix}-${name}`;\n }\n}\n\n/** Overrides the class/data-attribute prefix. */\nexport function provideStreamdownPrefix(prefix: string): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: STREAMDOWN_PREFIX, useValue: prefix }]);\n}\n","/*\n * ngx-streamdown — Angular port of the Vercel Streamdown (React) library.\n *\n * Original source: github.com/vercel/streamdown (Apache-2.0, Copyright 2023 Vercel, Inc.)\n * Public API surface of ngx-streamdown.\n */\n\n// ── main public component ───────────────────────────────────────────────────\nexport { StreamdownComponent } from './lib/streamdown.component';\nexport { BlockComponent } from './lib/block.component';\n\n// ── markdown → HAST pipeline ────────────────────────────────────────────────\nexport {\n MarkdownService,\n STREAMDOWN_PIPELINE,\n type StreamdownPipelineConfig,\n} from './lib/markdown.service';\n\n// ── HAST renderer (core, with diffing) ──────────────────────────────────────\nexport { HastRendererComponent } from './lib/hast/hast-renderer.component';\nexport {\n HastRendererService,\n STREAMDOWN_ANIMATE,\n type RenderedNode,\n} from './lib/hast/hast-renderer.service';\nexport { HastElementComponent } from './lib/hast/element.component';\nexport { ELEMENT_CLASSES, COMPONENT_MAP, cn } from './lib/hast/component-map';\n\n// ── animation (fade-in) ─────────────────────────────────────────────────────\nexport { provideStreamdownAnimation } from './lib/animate/animate.provider';\n\n// ── core utilities (framework-agnostic) ─────────────────────────────────────\nexport { parseMarkdownIntoBlocks } from './lib/core/parse-blocks';\nexport { detectDirection } from './lib/core/detect-direction';\n\n// ── code block (Shiki) ──────────────────────────────────────────────────────\nexport { CodeBlockComponent } from './lib/code-block/code-block.component';\nexport { ShikiHighlighterService } from './lib/code-block/shiki-highlighter.service';\nexport { CODE_LANGUAGE_COMPONENTS } from './lib/code-block/language-registry';\nexport { extractCodeInfo, languageToExtension } from './lib/code-block/code-block-utils';\n\n// ── table (copy/download) ───────────────────────────────────────────────────\nexport { TableComponent } from './lib/table/table.component';\nexport { extractTableData, toCsv, toTsv, toMarkdown } from './lib/table/table-utils';\n\n// ── optional plugins (providers) ────────────────────────────────────────────\nexport { MermaidComponent } from './lib/mermaid/mermaid.component';\nexport { provideStreamdownMermaid } from './lib/mermaid/provider';\nexport { provideStreamdownMath } from './lib/math/provider';\nexport { katexSanitizeSchema } from './lib/math/sanitize-schema';\n\n// ── services: i18n / icon / prefix (React Context → Angular DI) ──────────────\nexport {\n TranslationsService,\n provideStreamdownTranslations,\n DEFAULT_TRANSLATIONS,\n STREAMDOWN_TRANSLATIONS,\n type StreamdownTranslations,\n} from './lib/services/translations.service';\nexport {\n IconService,\n provideStreamdownIcons,\n DEFAULT_ICONS,\n STREAMDOWN_ICONS,\n type StreamdownIcons,\n} from './lib/services/icon.service';\nexport {\n PrefixService,\n provideStreamdownPrefix,\n STREAMDOWN_PREFIX,\n} from './lib/services/prefix.service';\n\n// ── images and link safety ──────────────────────────────────────────────────\nexport { ImageComponent } from './lib/components/image.component';\nexport { LinkModalComponent } from './lib/components/link-modal.component';\nexport {\n LinkModalService,\n provideStreamdownLinkSafety,\n STREAMDOWN_LINK_SAFETY,\n} from './lib/components/link-modal.service';\n\n// ── types ───────────────────────────────────────────────────────────────────\nexport type { HastElementInput, HastChild } from './lib/types';\nexport type { CodeInfo } from './lib/code-block/code-block-utils';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["injected","collectText"],"mappings":";;;;;;;;;;;;;;;AAGA;;;;AAIG;AACG,SAAU,EAAE,CAAC,GAAG,MAAoB,EAAA;AACxC,IAAA,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB;AAEA;;;;;;;;AAQG;AACI,MAAM,eAAe,GAA2B;AAEvD;;;;AAIG;AACI,MAAM,aAAa,GAAG,IAAI,GAAG;;AC1BpC;MACa,sBAAsB,GAAG,IAAI,cAAc,CAAU,wBAAwB;AAE1F;;;AAGG;MAEU,gBAAgB,CAAA;;AAElB,IAAA,UAAU,GAAG,MAAM,CAAgB,IAAI,iFAAC;;AAGjD,IAAA,OAAO,CAAC,GAAW,EAAA;AACjB,QAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;IAC1B;;IAGA,OAAO,GAAA;AACL,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE;AAC7B,QAAA,IAAI,GAAG,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACxC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,qBAAq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AAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADA,MAAM,EAAA,CAAA;;4FACnB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAWlC;AACM,SAAU,uBAAuB,CAAC,MAAc,EAAA;AACpD,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AACrF;;ACtBA;;;;;AAKG;AAEH;;ACPA;;AAEG;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "streamdown-angular",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Angular port of Vercel's Streamdown — stream-safe Markdown rendering for AI chat UIs (signals, standalone, OnPush). Code highlighting (Shiki), tables, Mermaid and KaTeX as optional plugins.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"markdown",
|
|
8
|
+
"streamdown",
|
|
9
|
+
"streaming",
|
|
10
|
+
"ai",
|
|
11
|
+
"chat",
|
|
12
|
+
"llm",
|
|
13
|
+
"shiki",
|
|
14
|
+
"mermaid",
|
|
15
|
+
"katex",
|
|
16
|
+
"remark",
|
|
17
|
+
"rehype"
|
|
18
|
+
],
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"author": "xjurayev99 <xjurayev99@gmail.com>",
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@angular/common": "^21.0.0",
|
|
23
|
+
"@angular/core": "^21.0.0",
|
|
24
|
+
"shiki": "^3.0.0 || ^4.0.0",
|
|
25
|
+
"mermaid": "^11.0.0",
|
|
26
|
+
"katex": "^0.16.0 || ^0.17.0",
|
|
27
|
+
"remark-math": "^6.0.0",
|
|
28
|
+
"rehype-katex": "^7.0.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependenciesMeta": {
|
|
31
|
+
"shiki": {
|
|
32
|
+
"optional": true
|
|
33
|
+
},
|
|
34
|
+
"mermaid": {
|
|
35
|
+
"optional": true
|
|
36
|
+
},
|
|
37
|
+
"katex": {
|
|
38
|
+
"optional": true
|
|
39
|
+
},
|
|
40
|
+
"remark-math": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
"rehype-katex": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"tslib": "^2.3.0",
|
|
49
|
+
"unified": "^11.0.0",
|
|
50
|
+
"remark-parse": "^11.0.0",
|
|
51
|
+
"remark-gfm": "^4.0.0",
|
|
52
|
+
"remark-rehype": "^11.0.0",
|
|
53
|
+
"rehype-raw": "^7.0.0",
|
|
54
|
+
"rehype-sanitize": "^6.0.0",
|
|
55
|
+
"remend": "^1.3.0",
|
|
56
|
+
"clsx": "^2.1.0",
|
|
57
|
+
"marked": "^17.0.0 || ^18.0.0"
|
|
58
|
+
},
|
|
59
|
+
"sideEffects": false,
|
|
60
|
+
"module": "fesm2022/streamdown-angular.mjs",
|
|
61
|
+
"typings": "types/streamdown-angular.d.ts",
|
|
62
|
+
"exports": {
|
|
63
|
+
"./package.json": {
|
|
64
|
+
"default": "./package.json"
|
|
65
|
+
},
|
|
66
|
+
".": {
|
|
67
|
+
"types": "./types/streamdown-angular.d.ts",
|
|
68
|
+
"default": "./fesm2022/streamdown-angular.mjs"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"type": "module"
|
|
72
|
+
}
|