/** * @file * * Mock of Obsidian's `IconValue`, the Bases value wrapping a renderable icon. */ import type { IconValue as IconValueOriginal } from 'obsidian'; import type { RenderContext } from './RenderContext.mjs'; import { StringValue } from './StringValue.mjs'; /** * Mock of Obsidian's `IconValue`: a string value holding an icon id. */ export declare class IconValue extends StringValue { /** * The lucide icon name standing for this value's type. */ icon: string; /** * Creates an icon value. * * @param value - The icon id. */ constructor(value?: string); /** * Mock-only factory: creates an icon value, spyable via `vi.spyOn(IconValue, 'create2__')`. The subclass variant * of {@link StringValue.create__}. * * @param value - The icon id. * @returns The new icon value. */ static create2__(value?: string): IconValue; /** * Mock-only: views a value typed as Obsidian's `IconValue` as this mock. * * @param value - The value typed as the original `IconValue`. * @returns The same object, typed as the mock. */ static fromOriginalType5__(value: IconValueOriginal): IconValue; /** * Mock-only: views this mock as Obsidian's `IconValue` type. * * @returns The same object, typed as the original `IconValue`. */ asOriginalType5__(): IconValueOriginal; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(IconValue.prototype, 'constructor5__')`. * * @param _value - The icon id the value was created with. */ constructor5__(_value: string): void; /** * Renders the icon into an element, as Obsidian does: the SVG the icon id resolves to, falling back to * `question-mark-glyph` when the id is unknown, and rendering NOTHING when even that does not resolve. * * In practice the mock takes that last branch: `src/internal/icon-registry.ts` starts EMPTY on purpose - * Obsidian's Lucide set and its own glyphs are deliberately not bundled - so both lookups answer `null` * unless a test has registered the id with `addIcon`. That is a property of the registry rather than of * this method: register `question-mark-glyph` and every unknown icon renders it, exactly as in the app. * * @param el - The element to render into. * @param _context - The rendering context; unused. */ renderTo(el: HTMLElement, _context: RenderContext): void; }