/** * @file * * Mock of Obsidian's `StringValue`, the Bases value wrapping a string. */ import type { StringValue as StringValueOriginal } from 'obsidian'; import type { RenderContext } from './RenderContext.cjs'; import type { Value } from './Value.cjs'; import { PrimitiveValue } from './PrimitiveValue.cjs'; /** * Mock of Obsidian's `StringValue`: a primitive value holding a string. */ export declare class StringValue extends PrimitiveValue { /** * The value type's identifier, `'String'` - Obsidian's own name for this class of value. */ static type: string; /** * The lucide icon name standing for this value's type. */ icon: string; /** * Creates a string value. * * @param value - The wrapped string. */ constructor(value?: string); /** * Mock-only factory: creates a string value, spyable via `vi.spyOn(StringValue, 'create__')`. * * @param value - The wrapped string. * @returns The new string value. */ static create__(value?: string): StringValue; /** * Mock-only: views a value typed as Obsidian's `StringValue` as this mock. * * @param value - The value typed as the original `StringValue`. * @returns The same object, typed as the mock. */ static fromOriginalType4__(value: StringValueOriginal): StringValue; /** * Mock-only: views this mock as Obsidian's `StringValue` type. * * @returns The same object, typed as the original `StringValue`. */ asOriginalType4__(): StringValueOriginal; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(StringValue.prototype, 'constructor4__')`. * * @param _value - The string the value was created with. */ constructor4__(_value?: string): void; /** * Lists the property keys {@link StringValue.objectAccess} answers for. * * @returns The inherited keys followed by `length`. */ keys(): string[]; /** * Reads a named sub-property of this value. * * @param key - The property key, matched without regard to case. * @returns The string's length as a `NumberValue` for `length`, and otherwise whatever the base answers. */ objectAccess(key: string): null | Value; /** * Renders the value into an element, as Obsidian does: the wrapped string as the element's text. * * It is the base's behavior written out against `data` rather than through `toString()`, which is * Obsidian's own shape. The difference shows in the subclasses that both inherit this and override * `toString`: {@link RelativeDateValue} prints a relative date but is not reached here, while an * {@link ImageValue} and an {@link HTMLValue} override this method itself. * * @param el - The element to render into. * @param _context - The rendering context; unused. */ renderTo(el: HTMLElement, _context: RenderContext): void; }