obsidian-dev-utils
Version:
This is the collection of useful functions that you can use for your Obsidian plugin development
38 lines (37 loc) • 1.01 kB
text/typescript
/**
* @packageDocumentation
*
* Text based component utilities.
*/
/**
* A component based on a text input.
*
* @typeParam T - The type of the value to set.
*/
export interface TextBasedComponent<T> {
/**
* Empties the component.
*/
empty(): void;
/**
* Checks if the component is empty.
*
* @returns `true` if the component is empty, `false` otherwise.
*/
isEmpty(): boolean;
/**
* Sets the placeholder value of the component.
*
* @param placeholderValue - The placeholder value to set.
* @returns The component.
*/
setPlaceholderValue(placeholderValue: T): this;
}
/**
* Gets the text based component value of the component.
*
* @typeParam T - The type of the value to get.
* @param obj - Any object.
* @returns The text based component value of the component or `null` if the component is not a text based component.
*/
export declare function getTextBasedComponentValue<T>(obj: unknown): null | TextBasedComponent<T>;