obsidian-typings
Version:
Extended type definitions for the Obsidian API (https://obsidian.md)
31,804 lines • 814 kB
text/typescript
// Generated by dts-bundle-generator v9.5.1
import type { Capacitor, CapacitorPlatforms } from '@capacitor/core';
import type { ParseContext } from '@codemirror/language';
import type { SearchQuery } from '@codemirror/search';
import type { ChangeDesc, Extension, Facet, StateEffectType, StateField, Transaction } from '@codemirror/state';
import type { EditorView, ViewPlugin, ViewUpdate } from '@codemirror/view';
import type { NodeProp, Tree as LezerTree } from '@lezer/common';
import type { default as CodeMirror$1 } from 'codemirror';
import type { default as DOMPurify$1 } from 'dompurify';
import * as electron from 'electron';
import type { App as App$1, BrowserWindow, IpcRenderer } from 'electron';
import type { default as i18next } from 'i18next';
import type { Mermaid } from 'mermaid';
import * as fs from 'node:fs';
import type { FSWatcher, Stats } from 'node:fs';
import * as fsPromises from 'node:fs/promises';
import * as path from 'node:path';
import type { App, BasesConfigFileFilter, BlockCache, CacheItem, CachedMetadata, CloseableComponent, ColorComponent, Command, Component, Constructor, DataAdapter, Debouncer, EditableFileView, Editor, EditorPosition, EditorRange, EditorRangeOrCaret, EditorSuggest, EmbedCache, EventRef, Events, FileStats, FileView, FrontmatterLinkCache, FuzzySuggestModal, HoverLinkSource, HoverParent, HoverPopover, IconName, ItemView, KeymapInfo, LinkCache, MarkdownEditView, MarkdownFileInfo, MarkdownPostProcessorContext, MarkdownPreviewView, MarkdownView, Menu, Modal, Notice, ObsidianProtocolHandler, PaneType, Plugin as Plugin, PluginManifest, PluginSettingTab, PopoverSuggest, Reference, ReferenceCache, RenderContext, Scope, SearchComponent, SearchResult, Setting, SettingTab, SplitDirection, TAbstractFile, TFile, TFolder, TextComponent, TextFileView, Vault, View, ViewCreator, ViewState, Workspace, WorkspaceLeaf, WorkspaceTabs, moment as moment$1, request, requestUrl } from 'obsidian';
import type { default as pdfjsLib } from 'pdfjs-dist';
import type { Application, Container, Graphics, ICanvas, Sprite, Text as Text$1, TextStyle, default as PIXI } from 'pixi.js';
import type { default as Prism$1 } from 'prismjs';
import type { default as scrypt$1 } from 'scrypt-js';
import type { default as TurndownService } from 'turndown';
declare global {
/**
* Augments the built-in {@link ArrayConstructor} interface.
*/
interface ArrayConstructor {
/**
* Combines an array of arrays into a single array.
*
* @typeParam T - The type of the elements in the arrays.
* @param arrays - The array of arrays to combine.
* @returns A single array containing all elements from the input arrays.
* @example
* ```ts
* console.log(Array.combine([[1, 2], [3, 4], [5, 6]])); // [1, 2, 3, 4, 5, 6]
* ```
* @official
*/
combine<T>(arrays: T[][]): T[];
}
}
declare global {
/**
* Augments the built-in {@link Array} interface.
*
* @typeParam T - The type of the elements in the array.
*/
interface Array<T> {
/**
* Checks if the array contains a specific element.
*
* @param target - The element to check for.
* @returns `true` if the element is found, `false` otherwise.
* @example
* ```ts
* console.log([1, 2, 3].contains(2)); // true
* console.log([1, 2, 3].contains(4)); // false
* ```
* @official
*/
contains(target: T): boolean;
/**
* Returns the index of the last element that satisfies the provided predicate.
*
* @param predicate - The predicate to test each element.
* @returns The index of the last element that satisfies the predicate, or `-1` if no such element is found.
* @example
* ```ts
* console.log([1, 2, 3, 2, 1].findLastIndex(x => x === 2)); // 3
* console.log([1, 2, 3, 2, 1].findLastIndex(x => x === 4)); // -1
* ```
* @official
* @since 1.4.4
*/
findLastIndex(predicate: (value: T) => boolean): number;
/**
* Returns the first element of the array.
*
* @returns The first element of the array, or `undefined` if the array is empty.
* @example
* ```ts
* console.log([1, 2, 3].first()); // 1
* console.log([].first()); // undefined
* ```
* @official
*/
first(): T | undefined;
/**
* Returns the last element of the array.
*
* @returns The last element of the array, or `undefined` if the array is empty.
* @example
* ```ts
* console.log([1, 2, 3].last()); // 3
* console.log([].last()); // undefined
* ```
* @official
*/
last(): T | undefined;
/**
* Removes an element from the array, if it exists, otherwise returns the array unchanged.
*
* @param target - The element to remove.
* @example
* ```ts
* let arr = [1, 2, 3];
* arr.remove(2);
* console.log(arr); // [1, 3]
* arr = [1, 2, 3];
* arr.remove(4);
* console.log(arr); // [1, 2, 3]
* ```
* @official
*/
remove(target: T): void;
/**
* Shuffles the array in place.
*
* @returns The array itself.
* @example
* ```ts
* const arr = [1, 2, 3];
* console.log(arr.shuffle()); // something like [2, 3, 1]
* console.log(arr); // same as above
* ```
* @official
*/
shuffle(): this;
/**
* Returns a new array with unique elements.
*
* @returns A new array with unique elements.
* @example
* ```ts
* console.log([1, 2, 3, 2, 1].unique()); // [1, 2, 3]
* ```
* @official
*/
unique(): T[];
}
}
declare global {
/**
* Augments the built-in {@link DocumentFragment} interface.
*/
interface DocumentFragment extends Node, NonElementParentNode, ParentNode {
/**
* Finds the first descendant element that matches the selector.
*
* @param selector - The selector to find the element with.
* @returns The first descendant element that matches the selector, or `null` if no match is found.
* @example
* ```ts
* const fragment = createFragment();
* fragment.createEl('strong', { cls: 'foo' });
* console.log(fragment.find('.foo')); // <strong class="foo"></strong>
* console.log(fragment.find('.bar')); // null
* ```
* @remarks See bug {@link https://forum.obsidian.md/t/bug-find-findall-findallself/98108}.
* @official
*/
find(selector: string): Element | null;
/**
* Finds all descendant elements that match the selector.
*
* @param selector - The selector to find the elements with.
* @returns An array of all descendant elements that match the selector.
* @example
* ```ts
* const fragment = createFragment();
* fragment.createEl('strong', { cls: 'foo' });
* fragment.createEl('strong', { cls: 'foo' });
* console.log(fragment.findAll('.foo')); // [<strong class="foo"></strong>, <strong class="foo"></strong>]
* console.log(fragment.findAll('.bar')); // []
* ```
* @remarks See bug {@link https://forum.obsidian.md/t/bug-find-findall-findallself/98108}.
* @official
*/
findAll(selector: string): Element[];
}
}
declare global {
/**
* Augments the built-in {@link Document} interface.
*/
interface Document {
/**
* The event listeners of the document.
* @official
*/
_EVENTS?: {
[K in keyof DocumentEventMap]?: EventListenerInfo[];
};
/**
* Removes an event listener from the document.
*
* @typeParam K - The type of the event to listen for.
* @param this - The document to remove the event listener from.
* @param type - The type of event to listen for.
* @param selector - The selector of the event target.
* @param listener - The listener to call when the event is triggered.
* @param options - The options of the event listener.
* @example
* ```ts
* document.off('click', 'div', document.body._EVENTS.click[0].listener);
* ```
* @official
*/
off<K extends keyof DocumentEventMap>(this: Document, type: K, selector: string, listener: (this: Document, ev: DocumentEventMap[K], delegateTarget: HTMLElement) => any, options?: boolean | AddEventListenerOptions): void;
/**
* Adds an event listener to the document.
*
* @typeParam K - The type of the event to listen for.
* @param this - The document to add the event listener to.
* @param type - The type of event to listen for.
* @param selector - The selector of the event target.
* @param listener - The listener to call when the event is triggered.
* @param options - The options of the event listener.
* @example
* ```ts
* document.on('click', 'div', (ev) => {
* console.log(ev);
* });
* ```
* @official
*/
on<K extends keyof DocumentEventMap>(this: Document, type: K, selector: string, listener: (this: Document, ev: DocumentEventMap[K], delegateTarget: HTMLElement) => any, options?: boolean | AddEventListenerOptions): void;
}
}
declare global {
/**
* Augments the built-in {@link Element} interface.
*/
interface Element extends Node {
/**
* Adds a class to the element.
*
* @param classes - The class to add.
* @example
* ```ts
* const element = createEl('p');
* element.addClass('foo', 'bar');
* console.log(element.className); // foo
* @official
*/
addClass(...classes: string[]): void;
/**
* Adds multiple classes to the element.
*
* @param classes - The classes to add.
* @example
* ```ts
* const element = createEl('p');
* element.addClasses(['foo', 'bar']);
* console.log(element.className); // foo bar
* ```
* @official
*/
addClasses(classes: string[]): void;
/**
* Finds the first descendant element that matches the selector.
*
* @param selector - The selector to find the element with.
* @returns The first descendant element that matches the selector, or `null` if no match is found.
* @example
* ```ts
* const element = createEl('p');
* element.createEl('strong', { cls: 'foo' });
* console.log(element.find('.foo')); // <strong class="foo"></strong>
* console.log(element.find('.bar')); // null
* ```
* @official
*/
find(selector: string): Element | null;
/**
* Finds all descendant elements that match the selector.
*
* @param selector - The selector to find the elements with.
* @returns An array of all descendant elements that match the selector.
* @example
* ```ts
* const element = createEl('p');
* element.createEl('strong', { cls: 'foo' });
* element.createEl('strong', { cls: 'foo' });
* console.log(element.findAll('.foo')); // [<strong class="foo"></strong>, <strong class="foo"></strong>]
* console.log(element.findAll('.bar')); // []
* ```
* @remarks See bug {@link https://forum.obsidian.md/t/bug-find-findall-findallself/98108}.
* @official
*/
findAll(selector: string): Element[];
/**
* Finds all descendant elements or self that match the selector.
*
* @param selector - The selector to find the elements with.
* @returns An array of all descendant elements or self that match the selector.
* @example
* ```ts
* const element = createEl('p', { cls: 'foo' });
* element.createEl('strong', { cls: 'foo' });
* console.log(element.findAllSelf('.foo')); // [<p class="foo"></p>, <strong class="foo"></strong>]
* console.log(element.findAllSelf('.bar')); // []
* ```
* @remarks See bug {@link https://forum.obsidian.md/t/bug-find-findall-findallself/98108}.
* @official
*/
findAllSelf(selector: string): Element[];
/**
* Gets an attribute from the element.
*
* @param qualifiedName - The name of the attribute to get.
* @returns The value of the attribute.
* @example
* ```ts
* const element = createEl('p');
* element.setAttr('data-foo', 'bar');
* console.log(element.getAttr('data-foo')); // bar
* ```
* @official
*/
getAttr(qualifiedName: string): string | null;
/**
* Gets the value of a CSS property of the element.
*
* @param property - The property to get the value of.
* @param pseudoElement - The pseudo-element to get the value of.
* @returns The value of the CSS property.
* @example
* ```ts
* const element = document.body.createEl('p');
* element.style.color = 'red';
* console.log(element.getCssPropertyValue('color')); // rgb(255, 0, 0)
* console.log(element.getCssPropertyValue('color', ':after')); // rgb(255, 0, 0)
* ```
* @official
*/
getCssPropertyValue(property: string, pseudoElement?: string): string;
/**
* Returns the text content of the element.
*
* @returns The text content of the element.
* @example
* ```ts
* const element = createEl('p');
* element.createEl('strong', { text: 'foo' });
* element.createEl('strong', { text: 'bar' });
* console.log(element.getText()); // foobar
* ```
* @official
*/
getText(): string;
/**
* Checks if the element has a class.
*
* @param cls - The class to check for.
* @returns `true` if the element has the class, `false` otherwise.
* @example
* ```ts
* const element = createEl('p');
* element.addClass('foo', 'bar');
* console.log(element.hasClass('foo')); // true
* console.log(element.hasClass('baz')); // false
* ```
* @official
*/
hasClass(cls: string): boolean;
/**
* Checks if the element is the active element.
*
* @returns `true` if the element is the active element, `false` otherwise.
* @example
* ```ts
* const element = document.body.createEl('p');
* console.log(element.isActiveElement()); // false
* console.log(document.activeElement.isActiveElement()); // true
* ```
* @official
*/
isActiveElement(): boolean;
/**
* Matches the selector recursively up the DOM tree.
*
* @param selector - The selector to match the parent with.
* @param lastParent - The last parent to stop matching against.
* @returns The matched element or `null` if no match is found.
* @example
* ```ts
* const element = createEl('p');
* console.log(element.matchParent('p')); // <p></p>
* console.log(element.matchParent('strong')); // null
* const child = element.createEl('strong');
* console.log(child.matchParent('strong')); // <strong></strong>
* console.log(child.matchParent('p')); // <p></p>
* const grandchild = child.createEl('em');
* console.log(grandchild.matchParent('p', child)); // null
* ```
* @official
*/
matchParent(selector: string, lastParent?: Element): Element | null;
/**
* Removes a class from the element.
*
* @param classes - The class to remove.
* @example
* ```ts
* const element = createEl('p');
* element.addClass('foo bar');
* element.removeClass('foo', 'baz');
* console.log(element.className); // bar
* ```
* @official
*/
removeClass(...classes: string[]): void;
/**
* Removes multiple classes from the element.
*
* @param classes - The classes to remove.
* @example
* ```ts
* const element = createEl('p');
* element.addClass('foo bar');
* element.removeClasses(['foo', 'baz']);
* console.log(element.className); // bar
* ```
* @official
*/
removeClasses(classes: string[]): void;
/**
* Sets an attribute on the element.
*
* @param qualifiedName - The name of the attribute to set.
* @param value - The value to set the attribute to.
* @example
* ```ts
* const element = createEl('p');
* element.setAttr('data-foo', 'bar');
* console.log(element.getAttr('data-foo')); // bar
* ```
* @official
*/
setAttr(qualifiedName: string, value: string | number | boolean | null): void;
/**
* Sets multiple attributes on the element.
*
* @param obj - The attributes to set.
* @example
* ```ts
* const element = createEl('p');
* element.setAttrs({
* 'data-foo': 'bar',
* 'data-baz': 'qux',
* });
* console.log(element.getAttr('data-foo')); // bar
* console.log(element.getAttr('data-baz')); // qux
* ```
* @official
*/
setAttrs(obj: {
[key: string]: string | number | boolean | null;
}): void;
/**
* Sets the text content of the element.
*
* @param val - The text content to set.
* @example
* ```ts
* const element = createEl('p');
* element.setText('foo');
* console.log(element); // <p>foo</p>
* const fragment = createFragment();
* fragment.createEl('strong', { text: 'bar' });
* element.setText(fragment);
* console.log(element); // <p><strong>bar</strong></p>
* ```
* @official
*/
setText(val: string | DocumentFragment): void;
/**
* Toggles a class on the element.
*
* @param classes - The class to toggle.
* @param value - If `true`, the class will be added, if `false`, the class will be removed.
* @example
* ```ts
* const element = createEl('p');
* element.addClass('foo', 'bar');
* element.toggleClass('foo', false);
* console.log(element.className); // bar
* element.toggleClass('foo', true);
* console.log(element.className); // bar foo
* element.toggleClass('baz', false);
* console.log(element.className); // bar foo
* element.toggleClass('baz', true);
* console.log(element.className); // bar foo baz
* ```
* @official
*/
toggleClass(classes: string | string[], value: boolean): void;
}
}
declare global {
/**
* Augments the built-in {@link HTMLElement} interface.
*/
interface HTMLElement extends Element {
/**
* The event listeners of the element.
* @official
*/
_EVENTS?: {
[K in keyof HTMLElementEventMap]?: EventListenerInfo[];
};
/**
* Get the inner height of this element without padding.
* @official
*/
readonly innerHeight: number;
/**
* Get the inner width of this element without padding.
* @official
*/
readonly innerWidth: number;
/**
* Hides the element using css `display` property.
*
* @example
* ```ts
* document.body.hide();
* ```
* @official
*/
hide(): void;
/**
* Returns whether this element is shown, when the element is attached to the DOM and.
* none of the parent and ancestor elements are hidden with `display: none`.
*
* Exception: Does not work on `<body>` and `<html>`, or on elements with `position: fixed`.
*
* @example
* ```ts
* const element = document.body.createEl('p');
* console.log(element.isShown()); // true
* element.hide();
* console.log(element.isShown()); // false
* ```
* @official
*/
isShown(): boolean;
/**
* Removes an event listener from the element.
*
* @typeParam K - The type of the event to listen for.
* @param this - The element to remove the event listener from.
* @param type - The type of event to listen for.
* @param selector - The selector of the event target.
* @param listener - The listener to call when the event is triggered.
* @param options - The options of the event listener.
* @example
* ```ts
* document.body.off('click', 'div', document.body._EVENTS.click[0].listener);
* ```
* @official
*/
off<K extends keyof HTMLElementEventMap>(this: HTMLElement, type: K, selector: string, listener: (this: HTMLElement, ev: HTMLElementEventMap[K], delegateTarget: HTMLElement) => any, options?: boolean | AddEventListenerOptions): void;
/**
* Adds an event listener to the element.
*
* @typeParam K - The type of the event to listen for.
* @param this - The element to add the event listener to.
* @param type - The type of event to listen for.
* @param selector - The selector of the event target.
* @param listener - The listener to call when the event is triggered.
* @param options - The options of the event listener.
* @example
* ```ts
* document.body.on('click', 'div', (ev) => {
* console.log(ev);
* });
* ```
* @official
*/
on<K extends keyof HTMLElementEventMap>(this: HTMLElement, type: K, selector: string, listener: (this: HTMLElement, ev: HTMLElementEventMap[K], delegateTarget: HTMLElement) => any, options?: boolean | AddEventListenerOptions): void;
/**
* Adds a click event listener to the element.
*
* @param this - The element to add the event listener to.
* @param listener - The listener to call when the click event is triggered.
* @param options - The options of the click event listener.
* @example
* ```ts
* document.body.onClickEvent((ev) => {
* console.log(ev);
* });
* ```
* @official
*/
onClickEvent(this: HTMLElement, listener: (this: HTMLElement, ev: MouseEvent) => any, options?: boolean | AddEventListenerOptions): void;
/**
* Adds an event listener to the element when it is inserted into the DOM.
*
* @param listener - the callback to call when this node is inserted into the DOM.
* @param once - if true, this will only fire once and then unhook itself.
* @returns destroy - a function to remove the event handler to avoid memory leaks.
* @example
* ```ts
* document.body.onNodeInserted(() => {
* console.log('node inserted');
* });
* ```
* @official
*/
onNodeInserted(this: HTMLElement, listener: () => any, once?: boolean): () => void;
/**
* Adds an event listener to the element when it is migrated to another window.
*
* @param listener - the callback to call when this node has been migrated to another window.
* @returns destroy - a function to remove the event handler to avoid memory leaks.
* @example
* ```ts
* document.body.onWindowMigrated((win) => {
* console.log('window migrated');
* });
* @official
*/
onWindowMigrated(this: HTMLElement, listener: (win: Window) => any): () => void;
/**
* Sets the CSS properties of the element.
*
* @param props - The properties to set.
* @example
* ```ts
* const element = document.body.createEl('p');
* element.setCssProps({ color: 'red', 'font-size': '16px' });
* ```
* @official
*/
setCssProps(props: Record<string, string>): void;
/**
* Sets the CSS styles of the element.
*
* @param styles - The styles to set.
* @example
* ```ts
* const element = document.body.createEl('p');
* element.setCssStyles({ color: 'red', fontSize: '16px' });
* ```
* @official
*/
setCssStyles(styles: Partial<CSSStyleDeclaration>): void;
/**
* Shows the element using css `display` property.
*
* @example
* ```ts
* document.body.show();
* ```
* @official
*/
show(): void;
/**
* Toggles the visibility of the element using css `display` property.
*
* @param show - Whether to show the element.
* @example
* ```ts
* document.body.toggle(true);
* document.body.toggle(false);
* ```
* @official
*/
toggle(show: boolean): void;
/**
* Toggles the visibility of the element using css `visibility` property.
*
* @param visible - Whether to show the element.
* @example
* ```ts
* document.body.toggleVisibility(true);
* document.body.toggleVisibility(false);
* ```
* @official
*/
toggleVisibility(visible: boolean): void;
/**
* Triggers an event on the element.
*
* @param eventType - the type of event to trigger.
* @example
* ```ts
* document.body.trigger('click');
* ```
* @official
*/
trigger(eventType: string): void;
}
}
declare global {
/**
* Augments the built-in {@link Math} interface.
*/
interface Math {
/**
* Clamps a value between a minimum and maximum.
*
* @param value - The value to clamp.
* @param min - The minimum value.
* @param max - The maximum value.
* @returns The clamped value.
* @example
* ```ts
* console.log(Math.clamp(10, 0, 5)); // 5
* console.log(Math.clamp(-10, 0, 5)); // 0
* console.log(Math.clamp(3, 0, 5)); // 3
* ```
* @official
*/
clamp(value: number, min: number, max: number): number;
/**
* Returns the square of a number.
*
* @param value - The number to square.
* @returns The square of the number.
* @example
* ```ts
* console.log(Math.square(2)); // 4
* console.log(Math.square(-2)); // 4
* ```
* @official
*/
square(value: number): number;
}
}
declare global {
/**
* Augments the built-in {@link Node} interface.
*/
interface Node {
/**
* Global window object.
* @official
*/
constructorWin: Window;
/**
* The document this node belongs to, or the global document.
* @official
*/
doc: Document;
/**
* The window object this node belongs to, or the global window.
* @official
*/
win: Window;
/**
* Appends a text node to the node.
*
* @param val - The text to append.
* @example
* ```ts
* const parent = createEl('p');
* parent.createEl('strong', { text: 'foo' });
* parent.appendText('bar');
* console.log(parent); // <p><strong>foo</strong>bar</p>
* ```
* @official
*/
appendText(val: string): void;
/**
* Creates a new `<div>` element.
*
* @param o - The options object.
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* document.body.createDiv({ text: 'foo' }, (div) => {
* div.createEl('strong', { text: 'bar' });
* });
* ```
* @official
*/
createDiv(o?: DomElementInfo | string, callback?: (el: HTMLDivElement) => void): HTMLDivElement;
/**
* Create an element and append it to this node.
*
* @typeParam K - The type of the element to create.
* @param tag - The tag name of the element to create.
* @param o - The options object.
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* document.body.createEl('p', { text: 'foo' }, (div) => {
* div.createEl('strong', { text: 'bar' });
* });
* ```
* @official
*/
createEl<K extends keyof HTMLElementTagNameMap>(tag: K, o?: DomElementInfo | string, callback?: (el: HTMLElementTagNameMap[K]) => void): HTMLElementTagNameMap[K];
/**
* Creates a new `<span>` element.
*
* @param o - The options object.
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* document.body.createSpan({ text: 'foo' }, (span) => {
* span.createEl('strong', { text: 'bar' });
* });
* ```
* @official
*/
createSpan(o?: DomElementInfo | string, callback?: (el: HTMLSpanElement) => void): HTMLSpanElement;
/**
* Creates a new svg element such as `<svg>`, `<circle>`, `<rect>`, etc.
*
* @typeParam K - The type of the element to create.
* @param tag - The tag name of the element to create.
* @param o - The options object.
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* document.body.createSvg('svg', { cls: 'foo bar' }, (svg) => {
* svg.createSvg('circle');
* });
* @official
*/
createSvg<K extends keyof SVGElementTagNameMap>(tag: K, o?: SvgElementInfo | string, callback?: (el: SVGElementTagNameMap[K]) => void): SVGElementTagNameMap[K];
/**
* Detaches the node from the DOM.
*
* @example
* ```ts
* const node = document.body.createEl('p');
* console.log(document.body.contains(node)); // true
* node.detach();
* console.log(document.body.contains(node)); // false
* ```
* @official
*/
detach(): void;
/**
* Empties the node.
*
* @example
* ```ts
* const parent = createEl('p');
* parent.createEl('strong');
* console.log(parent.childNodes.length); // 1
* parent.empty();
* console.log(parent.childNodes.length); // 0
* ```
* @official
*/
empty(): void;
/**
* Returns the index of the node or `-1` if the node is not found.
*
* @param other - The node to find.
* @returns The index of the node or `-1` if the node is not found.
* @official
*/
indexOf(other: Node): number;
/**
* Inserts a child node after the current node.
*
* @typeParam T - The type of the node to insert.
* @param node - The node to insert.
* @param child - The child node to insert after.
* @returns The inserted node.
* @example
* ```ts
* const parent = createEl('p');
* const child1 = parent.createEl('strong', { text: '1' });
* const child2 = parent.createEl('strong', { text: '2' });
* const child3 = parent.createEl('strong', { text: '3' });
* const newNode = createEl('em', { text: '4' });
* parent.insertAfter(newNode, child2);
* console.log(parent); // <p><strong>1</strong><strong>2</strong><em>4</em><strong>3</strong></p>
* ```
* @official
*/
insertAfter<T extends Node>(node: T, child: Node | null): T;
/**
* Cross-window capable instanceof check, a drop-in replacement.
* for instanceof checks on DOM Nodes. Remember to also check
* for nulls when necessary.
*
* @typeParam T - The type of the instance.
* @param type - The type to check.
* @returns `true` if the node is of the given type, `false` otherwise.
* @example
* ```ts
* const node = createEl('p');
* console.log(node.instanceOf(HTMLParagraphElement)); // true
* console.log(node.instanceOf(HTMLSpanElement)); // false
* ```
* @official
*/
instanceOf<T>(type: {
new (): T;
}): this is T;
/**
* Sets the children of the node.
*
* @param children - The children to set.
* @example
* ```ts
* const parent = createEl('p');
* const child1 = parent.createEl('strong', { text: '1' });
* const child2 = parent.createEl('strong', { text: '2' });
* const child3 = createEl('strong', { text: '3' });
* parent.setChildrenInPlace([child1, child3]);
* console.log(parent); // <p><strong>1</strong><strong>3</strong></p>
* ```
* @official
*/
setChildrenInPlace(children: Node[]): void;
}
}
declare global {
/**
* Augments the built-in {@link NumberConstructor} interface.
*/
interface NumberConstructor {
/**
* Type guard to check if a value is a number.
*
* @param obj - The value to check.
* @returns `true` if the value is a number, `false` otherwise.
* @example
* ```ts
* console.log(Number.isNumber(123)); // true
* console.log(Number.isNumber('123')); // false
* console.log(Number.isNumber(NaN)); // true
* console.log(Number.isNumber(Infinity)); // true
* console.log(Number.isNumber(-Infinity)); // true
* ```
* @remarks Regarding `NaN` see: {@link https://forum.obsidian.md/t/bug-number-isnumber-definition/98104}.
* @official
*/
isNumber(obj: any): obj is number;
}
}
declare global {
/**
* Augments the built-in {@link ObjectConstructor} interface.
*/
interface ObjectConstructor {
/**
* Check if all properties in an object satisfy a condition.
*
* @typeParam T - The type of the properties in the object.
* @param object - The object to check.
* @param callback - The condition to check.
* @param context - The context passed as `this` to the `callback`.
* @returns `true` if all properties satisfy the condition, `false` otherwise.
* @example
* ```ts
* console.log(Object.each({ a: 1, b: 2 }, function(value) { return value > this.min }, { min: 0 })); // true
* console.log(Object.each({ a: 1, b: 2 }, function(value) { return value > this.min }, { min: 1 }); // false
* ```
* @official
*/
each<T>(object: {
[key: string]: T;
}, callback: (value: T, key?: string) => boolean | void, context?: any): boolean;
/**
* Checks if an object is empty.
*
* @param object - The object to check.
* @returns `true` if the object is empty, `false` otherwise.
* @example
* ```ts
* console.log(Object.isEmpty({})); // true
* console.log(Object.isEmpty({ a: 1 })); // false
* ```
* @official
*/
isEmpty(object: Record<string, any>): boolean;
}
}
declare global {
/**
* Augments the built-in {@link SVGElement} interface.
*/
interface SVGElement extends Element {
/**
* Sets the CSS properties of the element.
*
* @param props - The properties to set.
* @example
* ```ts
* const element = document.body.createEl('svg');
* element.setCssProps({ color: 'red', 'font-size': '16px' });
* ```
* @official
*/
setCssProps(props: Record<string, string>): void;
/**
* Sets the CSS styles of the element.
*
* @param styles - The styles to set.
* @example
* ```ts
* const element = document.body.createEl('svg');
* element.setCssStyles({ color: 'red', fontSize: '16px' });
* ```
* @official
*/
setCssStyles(styles: Partial<CSSStyleDeclaration>): void;
}
}
declare global {
/**
* Augments the built-in {@link StringConstructor} interface.
*/
interface StringConstructor {
/**
* Type guard to check if a value is a string.
*
* @param obj - The value to check.
* @returns `true` if the value is a string, `false` otherwise.
* @example
* ```ts
* console.log(String.isString('foo')); // true
* console.log(String.isString(123)); // false
* ```
* @official
*/
isString(obj: any): obj is string;
}
}
declare global {
/**
* Augments the built-in {@link String} interface.
*/
interface String {
/**
* Checks if the string contains a specific substring.
*
* @param target - The substring to check for.
* @returns `true` if the string contains the substring, `false` otherwise.
* @example
* ```ts
* console.log('foo'.contains('oo')); // true
* console.log('foo'.contains('bar')); // false
* ```
* @official
*/
contains(target: string): boolean;
/**
* Checks if the string ends with a specific substring.
*
* @param searchString - The substring to check for.
* @param endPosition - The position to end checking at.
* @returns `true` if the string ends with the substring, `false` otherwise.
* @example
* ```ts
* console.log('foo'.endsWith('oo')); // true
* console.log('foo'.endsWith('fo')); // false
* console.log('foo'.endsWith('foo', 2)); // false
* console.log('foo'.endsWith('fo', 2)); // true
* ```
* @remarks The original version had different argument names.
* See bug: {@link https://forum.obsidian.md/t/bug-string-endwith-definition/98103}.
* @official
*/
endsWith(searchString: string, endPosition?: number): boolean;
/**
* Formats a string using the indexed placeholders.
*
* @param args - The arguments to format the string with.
* @returns The formatted string.
* @example
* ```ts
* console.log('foo {0} bar {1} baz {0}'.format('qux', 'quux')); // foo qux bar quux baz qux
* ```
* @official
*/
format(...args: string[]): string;
/**
* Checks if the string starts with a specific substring.
*
* @param searchString - The substring to check for.
* @param position - The position to start checking from.
* @returns `true` if the string starts with the substring, `false` otherwise.
* @example
* ```ts
* console.log('foo'.startsWith('fo')); // true
* console.log('foo'.startsWith('oo')); // false
* console.log('foo'.startsWith('foo', 1)); // false
* console.log('foo'.startsWith('oo', 1)); // true
* ```
* @official
*/
startsWith(searchString: string, position?: number): boolean;
}
}
declare global {
/**
* Augments the built-in {@link Touch} interface.
*/
interface Touch {
/**
* The type of touch.
* @official
*/
touchType: "stylus" | "direct";
}
}
declare global {
/**
* Augments the built-in {@link UIEvent} interface.
*/
interface UIEvent extends Event {
/**
* The document of the event.
* @official
*/
doc: Document;
/**
* The target node of the event.
* @official
*/
targetNode: Node | null;
/**
* The window of the event.
* @official
*/
win: Window;
/**
* Cross-window capable instanceof check, a drop-in replacement.
* for instanceof checks on UIEvents.
*
* @typeParam T - The type to check.
* @param type - The type to check.
* @returns Whether the event is an instance of the type.
* @example
* ```ts
* if (event.instanceOf(MouseEvent)) {
* console.log('event is a mouse event');
* }
* ```
* @official
*/
instanceOf<T>(type: {
new (...data: any[]): T;
}): this is T;
}
}
declare global {
/**
* Augments the built-in {@link Window} interface.
*/
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage {
/**
* The actively focused Document object. This is usually the same as `document` but.
* it will be different when using popout windows.
*
* @official
*/
activeDocument: Document;
/**
* The actively focused Window object. This is usually the same as `window` but.
* it will be different when using popout windows.
*
* @official
*/
activeWindow: Window;
/**
* Global reference to the app.
*
* @unofficial
* @deprecated - Prefer not to use this value directly.
*/
app: App;
/**
* @todo Documentation incomplete.
* @unofficial
*/
bl: typeof Object.hasOwnProperty;
/**
* @todo Documentation incomplete.
* @unofficial
* @hidden
*/
blinkfetch: typeof fetch;
/**
* @todo Documentation incomplete.
* @unofficial
*/
blinkFormData: typeof FormData;
/**
* @todo Documentation incomplete.
* @unofficial
*/
blinkHeaders: typeof Headers;
/**
* @todo Documentation incomplete.
* @unofficial
*/
blinkRequest: typeof Request;
/**
* @todo Documentation incomplete.
* @unofficial
*/
blinkResponse: typeof Response;
/**
* @todo Documentation incomplete.
* @unofficial
*/
Capacitor: typeof Capacitor;
/**
* @todo Documentation incomplete.
* @unofficial
*/
CapacitorPlatforms: typeof CapacitorPlatforms;
/**
* @todo Documentation incomplete.
* @unofficial
*/
Cf: typeof Object.getOwnPropertyDescriptors;
/**
* @todo Documentation incomplete.
* @unofficial
*/
CodeMirror: typeof CodeMirror$1;
/**
* @todo Documentation incomplete.
* @unofficial
*/
CodeMirrorAdapter: CodeMirrorAdapterEx;
/**
* DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG.
*
* @unofficial
*/
DOMPurify: typeof DOMPurify$1;
/**
* @todo Documentation incomplete.
* @unofficial
*/
El: typeof Object.propertyIsEnumerable;
/**
* @todo Documentation incomplete.
* @unofficial
*/
electron: typeof electron;
/**
* @todo Documentation incomplete.
* @unofficial
*/
electronWindow: ElectronWindow;
/**
* @todo Documentation incomplete.
* @unofficial
*/
frameDom: FrameDom;
/**
* Constructor for the Capacitor file system adapter.
*
* @unofficial
*/
FS: CapacitorAdapterFsConstructor;
/**
* @todo Documentation incomplete.
* @unofficial
*/
i18next: typeof i18next;
/**
* @todo Documentation incomplete.
* @unofficial
*/
MathJax?: MathJax;
/**
* @todo Documentation incomplete.
* @unofficial
*/
mermaid?: Mermaid;
/**
* Parse, validate, manipulate, and display dates in javascript.
*
* @unofficial
*
* Commented out because the global variable is already declared in the `moment` package.
*/
moment: typeof moment$1;
/**
* @todo Documentation incomplete.
* @unofficial
*/
mr: typeof Object.getOwnPropertySymbols;
/**
* Notification component. Use to present timely, high-value information.
*
* @unofficial
*/
Notice: typeof Notice;
/**
* Invoke obsidian protocol action.
*
* @unofficial
*/
OBS_ACT: ObsidianProtocolHandler;
/**
* @todo Documentation incomplete.
* @unofficial
*/
OBSIDIAN_DEFAULT_I18N: Localization;
/**
* @todo Documentation incomplete.
* @unofficial
*/
pdfjsLib: typeof pdfjsLib;
/**
* @todo Documentation incomplete.
* @unofficial
*/
pdfjsTestingUtils: PdfJsTestingUtils;
/**
* @todo Documentation incomplete.
* @unofficial
*/
PIXI: typeof PIXI;
/**
* @todo Documentation incomplete.
* @unofficial
*/
Prism?: typeof Prism$1;
/**
* Similar to `fetch()`, request a URL using HTTP/HTTPS, without any CORS restrictions.
*
* Returns the text value of the response.
* @unofficial
*/
request: typeof request;
/**
* Similar to `fetch()`, request a URL using HTTP/HTTPS, without any CORS restrictions.
*
* @unofficial
*/
requestUrl: typeof requestUrl;
/**
* @todo Documentation incomplete.
* @unofficial
*/
scrypt: typeof scrypt$1;
/**
* @todo Documentation incomplete.
* @unofficial
*/
Sf: typeof Object.defineProperties;
/**
* @todo Documentation incomplete.
* @unofficial
*/
temp1: Database["changeVersion"];
/**
* @todo Documentation incomplete.
* @unofficial
*/
titlebarStyle: string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
TurndownService: typeof TurndownService;
/**
* @todo Documentation incomplete.
* @unofficial
*/
WebView: electron.WebviewTag;
/**
* @todo Documentation incomplete.
* @unofficial
*/
wf: typeof Object.defineProperty;
/**
* Sends an AJAX request.
*
* @param options - The options for the AJAX request.
* @example
* ```ts
* ajax({
* url: 'https://example.com',
* success: (response) => {
* console.log(response);
* },
* error: (error) => {
* console.error(error);
* }
* });
* ```
* @official
*/
ajax(options: AjaxOptions): void;
/**
* Sends an AJAX request and returns a promise.
*
* @param options - The options for the AJAX request.
* @returns A promise that resolves to the response.
* @example
* ```ts
* const response = await ajaxPromise({ url: 'https://example.com' });
* console.log(response);
* ```
* @official
*/
ajaxPromise(options: AjaxOptions): Promise<any>;
/**
* Creates a new `<div>` element.
*
* @param o - The options object.
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* createDiv({ text: 'foo' }, (div) => {
* div.createEl('strong', { text: 'bar' });
* });
* ```
* @official
*/
createDiv(o?: DomElementInfo | string, callback?: (el: HTMLDivElement) => void): HTMLDivElement;
/**
* Creates a new element.
*
* @typeParam K - The type of the element to create.
* @param tag - The tag name of the element to create.
* @param o - The options object.
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* createEl('p', { text: 'foo' }, (p) => {
* p.createEl('strong', { text: 'bar' });
* });
* ```
* @official
*/
createEl<K extends keyof HTMLElementTagNameMap>(tag: K, o?: DomElementInfo | string, callback?: (el: HTMLElementTagNameMap[K]) => void): HTMLElementTagNameMap[K];
/**
* Creates a new document fragment.
*
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* createFragment((fragment) => {
* fragment.createEl('p', { text: 'foo' });
* });
* ```
* @official
*/
createFragment(callback?: (el: DocumentFragment) => void): DocumentFragment;
/**
* Creates a new `<span>` element.
*
* @param o - The options object.
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* createSpan({ text: 'foo' }, (span) => {
* span.createEl('strong', { text: 'bar' });
* });
* ```
* @official
*/
createSpan(o?: DomElementInfo | string, callback?: (el: HTMLSpanElement) => void): HTMLSpanElement;
/**
* Creates a new svg element such as `<svg>`, `<circle>`, `<rect>`, etc.
*
* @param tag - The tag name of the element to create.
* @param o - The options object.
* @param callback - A callback function to be called when the element is created.
* @returns The created element.
* @example
* ```ts
* createSvg('svg', { cls: 'foo bar' }, (svg) => {
* svg.createSvg('circle');
* });
* ```
* @official
*/
createSvg<K extends keyof SVGElementTagNameMap>(tag: K, o?: SvgElementInfo | string, callback?: (el: SVGElementTagNameMap[K]) => void): SVGElementTagNameMap[K];
/**
* Finds the first element that matches the selector.
*
* @param selector - The selector to find the element with.
* @returns The first element that matches the selector, or `null` if no match is found.
* @example
* ```ts
* const element = document.body.createEl('p');
* element.createEl('strong', { cls: 'foo' });
* console.log(fish('.foo')); // <strong class="foo"></span>
* console.log(fish('.bar')); // null
* ```
* @official
*/
fish(selector: string): HTMLElement | null;
/**
* Finds all elements that match the selector.
*
* @param selector - The selector to find the elements with.
* @returns An array of all elements that match the selector.
* @example
* ```ts
* const element = document.body.createEl('p');
* element.createEl('strong', { cls: 'foo' });
* element.createEl('strong', { cls: 'foo' });
* console.log(fishAll('.foo')); // [<strong class="foo"></strong>, <strong class="foo"></strong>]
* console.log(fishAll('.bar')); // []
* ```
* @official
*/
fishAll(selector: string): HTMLElement[];
/**
* @todo Documentation incomplete.
* @unofficial
*/
globalEnhance(): void;
/**
* vim.js based on https://github.com/codemirror/CodeMirror/commit/793c9e65e09ec7fba3f4f5aaf366b3d36e1a709e (2021-12-04)
*
* Modified from https://github.com/nightwing/cm6-vim-mode-experiment/blob/master/src/vim.js 103a9b5 2021-12-03
*
* CodeMirror, copyright (c) by Marijn Haverbeke and others
*
* Distributed under an MIT license: https://codemirror.net/5/LICENSE
*
* Supported keybindings:
* Too many to list. Refer to defaultKeymap below.
*
* Supported Ex commands:
* Refer to defaultExCommandMap below.
*
* Registers: unnamed, -, ., :, /, _, a-z, A-Z, 0-9
* (Does not respect the special case for number registers when delete
* operator is made with these commands: %, (, ), , /, ?, n, N, {, } )
* TODO: Implement the remaining registers.
*
* Marks: a-z, A-Z, and 0-9
* TODO: Implement the remaining special marks. They have more complex
* behavior.
*
* Events:
* 'vim-mode-change' - raised on the editor anytime the current mode changes,
* Event object: {mode: "visual", subMode: "linewise"}
*
* Code structure:
* 1. Default keymap
* 2. Variable declarations and short basic helpers
* 3. Instance (External API) implementation
* 4. Internal state tracking objects (input state, counter) implementation
* and instantiation
* 5. Key handler (the main command dispatcher) implementation
* 6. Motion, operator, and action implementations
* 7. Helper functions for the key handler, motions, operators, and actions
* 8. Set up Vim to work as a keymap for CodeMirror.
* 9. Ex command implementations.
*
* @unofficial
*/
initVimMode(CodeMirror: CodeMirrorAdapterEx): VimApi;
/**
* Checks if the given object is a boolean.
*
* @param obj - The object to check.
* @returns `true` if the object is a boolean, `false` otherwise.
* @example
* ```ts
* console.log(isBoolean(false)); // true
* console.log(isBoolean('not a boolean')); // false
* ```
* @official
*/
isBoolean(obj: any): obj is boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
li(target: object, source: object): object;
/**
* @todo Documentation incomplete.
* @unofficial
*/
mo(target: object, propertyNames: string[]): object;
/**
* Waits for the next frame.
*
* @returns A promise that resolves after the next frame.
* @example
* ```ts
* await nextFrame();
* ```
* @official
*/
nextFrame(): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
openDatabase(name: string, version: string, displayName: string, estimatedSize: number, creationCallback?: (database: Database) => void): Database;
/**
* Executes a function when the DOM is ready.
*
* @param fn - The function to execute when the DOM is ready.
* @example
* ```ts
* ready(() => {
* console.log('DOM is ready');
* });
* @official
*/
ready(fn: () => any): void;
/**
* Select a language file location.
*
* @unofficial
*/
selectLanguageFileLocation(): void;
/**
* Sleeps for a given number of milliseconds.
*
* @param ms - The number of milliseconds to sleep.
* @returns A promise that resolves after the given number of milliseconds.
* @example
* ```ts
* await sleep(1000);
* ```
* @official
*/
sleep(ms: number): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
St(target: object, source: object | undefined): object;
/**
* @todo Documentation incomplete.
* @unofficial
*/
Tl(target: object, propertyName: string, propertyValue: unknown): unknown;
}
}
declare global {
/**
* Global reference to the app.
*
* @unofficial
* @deprecated - Prefer not to use this value directly.
*/
var app: Window["app"];
}
declare global {
/**
* Information about HTMLElement event listener.
*/
interface EventListenerInfo {
/**
* Wrapper function of the event listener.
* @official
*/
callback: Function;
/**
* The listener of the event.
* @official
*/
listener: Function;
/**
* The options of the event listener.
* @official
*/
options?: boolean | AddEventListenerOptions;
/**
* The selector of the event target.
* @official
*/
selector: string;
}
}
declare global {
/**
* Options for an {@link ajax} request.
*/
interface AjaxOptions {
/**
* The data of the AJAX request.
* @official
*/
data?: object | string | ArrayBuffer;
/**
* The error callback of the AJAX request.
* @official
*/
error?: (error: any, req: XMLHttpRequest) => any;
/**
* The headers of the AJAX request.
* @official
*/
headers?: Record<string, string>;
/**
* The method of the AJAX request.
* @official
*/
method?: "GET" | "POST";
/**
* The XMLHttpRequest object.
* @official
*/
req?: XMLHttpRequest;
/**
* The success callback of the AJAX request.
* @official
*/
success?: (response: any, req: XMLHttpRequest) => any;
/**
* The URL of the AJAX request.
* @official
*/
url: string;
/**
* Whether to send credentials with the AJAX request.
* @official
*/
withCredentials?: boolean;
}
}
declare global {
/**
* Options object passed to {@link createEl}.
*/
interface DomElementInfo {
/**
* @todo Documentation incomplete.
* @unofficial
*/
[eventName: `on${string}`]: EventListenerOrEventListenerObject;
/**
* HTML attributes to be added.
*
* @example
* ```ts
* createEl('p', { attr: { id: 'foo', 'data-bar': 'baz' } });
* ```
* @official
*/
attr?: {
[key: string]: string | number | boolean | null;
};
/**
* The class to be assigned. Can be a space-separated string or an array of strings.
*
* @example
* ```ts
* createEl('p', { cls: 'foo bar' });
* createEl('p', { cls: ['foo', 'bar'] });
* ```
* @official
*/
cls?: string | string[];
/**
* The href to be assigned. Applies to `<a>`, `<link>`, and `<base>` elements.
*
* @example
* ```ts
* createEl('a', { href: 'https://example.com' });
* ```
* @official
*/
href?: string;
/**
* The parent element to be assigned to.
*
* @example
* ```ts
* createEl('strong', { parent: document.body });
* ```
* @official
*/
parent?: Node;
/**
* The placeholder to be assigned. Applies to `<input>` elements.
*
* @example
* ```ts
* createEl('input', { placeholder: 'foo' });
* ```
* @official
*/
placeholder?: string;
/**
* Whether to prepend the element to the parent.
* If `true`, the element will be inserted before the first child of the parent.
* If `false` or omitted, the element will be inserted after the last child of the parent.
*
* @example
* ```ts
* createEl('input', { prepend: true });
* ```
* @official
*/
prepend?: boolean;
/**
* The textContent to be assigned.
*
* @example
* ```ts
* createEl('p', { text: 'foo' });
* const fragment = createFragment();
* fragment.createEl('strong', { text: 'bar' });
* createEl('p', { text: fragment });
* ```
* @official
*/
text?: string | DocumentFragment;
/**
* HTML title (for hover tooltip).
*
* @example
* ```ts
* createEl('p', { title: 'foo' });
* ```
* @official
*/
title?: string;
/**
* The type to be assigned. Applies to `<input>` and `<style>` elements.
*
* @example
* ```ts
* createEl('input', { type: 'text' });
* @official
*/
type?: string;
/**
* The value to be assigned. Applies to `<input>`, `<select>`, and `<option>` elements.
*
* @example
* ```ts
* createEl('input', { value: 'foo' });
* ```
* @official
*/
value?: string;
}
}
declare global {
/**
* Options object passed to {@link createSvg}.
*/
interface SvgElementInfo {
/**
* HTML attributes to be added.
*
* @example
* ```ts
* createSvg('svg', { attr: { id: 'foo', 'data-bar': 'baz' } });
* ```
* @official
*/
attr?: {
[key: string]: string | number | boolean | null;
};
/**
* The class to be assigned. Can be a space-separated string or an array of strings.
*
* @example
* ```ts
* createSvg('svg', { cls: 'foo bar' });
* createSvg('svg', { cls: ['foo', 'bar'] });
* ```
* @official
*/
cls?: string | string[];
/**
* The parent element to be assigned to.
*
* @example
* ```ts
* createSvg('svg', { parent: document.body });
* ```
* @official
*/
parent?: Node;
/**
* Whether to prepend the element to the parent.
* If `true`, the element will be inserted before the first child of the parent.
* If `false` or omitted, the element will be inserted after the last child of the parent.
*
* @example
* ```ts
* createSvg('svg', { prepend: true });
* ```
* @official
*/
prepend?: boolean;
}
}
declare module "@codemirror/language" {
/**
* @see https://github.com/lishid/cm-language/blob/main/src/stream-parser.ts
* @todo Documentation incomplete.
* @remark This only exists and can only be used in Obsidian.
* @unofficial
*/
const ignoreSpellcheckToken: Facet<string, string[]>;
/**
* The `NodeProp` that holds the CSS class of corresponding line-mode token.
*
* @see https://github.com/lishid/cm-language/blob/main/src/stream-parser.ts
* @remark This only exists and can only be used in Obsidian.
* @unofficial
*/
const lineClassNodeProp: NodeProp<string>;
/**
* This extension installs a highlighter that highlights lines based on `lineClassNodeProp`
* and `tokenClassNodeProp`.
*
* @see https://github.com/lishid/cm-language/blob/main/src/stream-parser.ts
* @remark This only exists and can only be used in Obsidian.
* @unofficial
*/
const lineHighlighter: Extension;
/**
* The `NodeProp` that holds the CSS class of corresponding line-level token.
*
* @see https://github.com/lishid/cm-language/blob/main/src/stream-parser.ts
* @remark This only exists and can only be used in Obsidian.
* @unofficial
*/
const tokenClassNodeProp: NodeProp<string>;
}
declare module "@codemirror/language" {
/**
* A language object manages parsing and per-language
* [metadata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt). Parse data is
* managed as a [Lezer](https://lezer.codemirror.net) tree. The class
* can be used directly, via the [`LRLanguage`](https://codemirror.net/6/docs/ref/#language.LRLanguage)
* subclass for [Lezer](https://lezer.codemirror.net/) LR parsers, or
* via the [`StreamLanguage`](https://codemirror.net/6/docs/ref/#language.StreamLanguage) subclass
* for stream parsers.
*/
namespace Language {
/**
* @todo Documentation incomplete.
* @unofficial
*/
const setState: StateEffectType<LanguageState>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
const state: StateField<LanguageState>;
}
}
declare module "@codemirror/language" {
/**
* Encapsulates a single line of input. Given to stream syntax code,
* which uses it to tokenize the content.
*/
interface StringStream {
/**
* @see https://github.com/lishid/cm-language/blob/main/src/stringstream.ts
* @todo Documentation incomplete.
* @remark This only exists and can only be used in Obsidian.
* @unofficial
*/
lookAhead: (n: number) => string;
}
}
declare module "@codemirror/state" {
/**
* Changes to the editor state are grouped into transactions.
* Typically, a user action creates a single transaction, which may
* contain any number of document changes, may change the selection,
* or have other effects. Create a transaction by calling
* [`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update), or immediately
* dispatch one by calling
* [`EditorView.dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch).
*/
interface Transaction {
/**
* Check whether the user deletes backward from the selection.
* Included in `'delete'` event.
*
* @official
*/
isUserEvent(event: "delete.backward"): boolean;
/**
* Check whether the user cuts a content to the clipboard.
* Included in `'delete'` event.
*
* @official
*/
isUserEvent(event: "delete.cut"): boolean;
/**
* Check whether the user dedents a line or lines, usually by typing `Shift + Tab` keys.
* Included in `'delete'` event.
*
* @unofficial
*/
isUserEvent(event: "delete.dedent"): boolean;
/**
* Check whether the user deletes forward from the selection.
* Included in `'delete'` event.
*
* @official
*/
isUserEvent(event: "delete.forward"): boolean;
/**
* Check whether the user deletes a line or lines, usually by typing `Ctrl + Shift + K` keys.
* Included in `'delete'` event.
*
* @unofficial
*/
isUserEvent(event: "delete.line"): boolean;
/**
* Check whether the user deletes selected content.
* Included in `'delete'` event.
*
* @official
*/
isUserEvent(event: "delete.selection"): boolean;
/**
* Check whether the user deletes a content.
*
* @official
*/
isUserEvent(event: "delete"): boolean;
/**
* Check whether the user inputs a content through Obsidian editor suggest autocompletion.
* Currently, this event is only dispatched when autocompleting a wikilink or inserting Markdown link through command.
* Included in `'input'` event.
*
* @unofficial
*/
isUserEvent(event: "input.autocomplete"): boolean;
/**
* Check whether the user inputs a content through CodeMirror native autocompletion.
* Included in `'input'` event.
*
* @official
*/
isUserEvent(event: "input.complete"): boolean;
/**
* Check whether the user creates a copy of the selected lines.
* Usually dispatched when performing [`copyLineUp`](https://codemirror.net/docs/ref/#commands.copyLineUp) or [`copyLineDown`](https://codemirror.net/docs/ref/#commands.copyLineDown) commands.
* Included in `'input'` event.
*
* @unofficial
*/
isUserEvent(event: "input.copyline"): boolean;
/**
* Check whether the user inputs a content through drop event.
* Included in `'input'` event.
*
* @official
*/
isUserEvent(event: "input.drop"): boolean;
/**
* Check whether the user indents a line or lines, usually by typing `Tab` key.
* Included in `'input'` event.
*
* @unofficial
*/
isUserEvent(event: "input.indent"): boolean;
/**
* Check whether the user pastes a content into the editor.
* Included in `'input'` event.
*
* @official
*/
isUserEvent(event: "input.paste"): boolean;
/**
* Check whether the user input triggers auto-renumbering ordered list.
* Included in `'input'` event.
*
* @remark This event cannot be captured since Obsidian will filtered it out as soon as it was dispatched.
* @official
*/
isUserEvent(event: "input.renumber"): boolean;
/**
* Check whether the user replaces all search matches.
* Usually dispatched when performing [`replaceAll`](https://codemirror.net/docs/ref/#commands.replaceAll) command.
* Included in `'input'` and `'input.replace'` events.
*
* @remark Obsidian native editor search does not dispatch this event.
* @unofficial
*/
isUserEvent(event: "input.replace.matches"): boolean;
/**
* Check whether the user replaces search match(es).
* Usually dispatched when performing [`replaceNext`](https://codemirror.net/docs/ref/#commands.replaceNext) or [`replaceAll`](https://codemirror.net/docs/ref/#commands.replaceAll) commands.
* Included in `'input'` event.
*
* @remark Obsidian native editor search does not dispatch this event.
* @unofficial
*/
isUserEvent(event: "input.replace"): boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
isUserEvent(event: "input.type.compose.start"): boolean;
/**
* Check whether the user inputs a content through composition.
* Included in `'input'` and `'input.type'` events.
*
* @official
*/
isUserEvent(event: "input.type.compose"): boolean;
/**
* Check whether the user inputs a content through typed input.
* Included in `'input'` event.
*
* @official
*/
isUserEvent(event: "input.type"): boolean;
/**
* Check whether the user inputs a content.
*
* @official
*/
isUserEvent(event: "input"): boolean;
/**
* Check whether the user flips the characters before and after the cursor(s).
* Usually dispatched when performing [`transposeChars`](https://codemirror.net/docs/ref/#commands.transposeChars) command.
* Included in `'move'` event.
*
* @unofficial
*/
isUserEvent(event: "move.character"): boolean;
/**
* Check whether the user moves a content within the editor through drag-and-drop.
* Included in `'move'` event.
*
* @official
*/
isUserEvent(event: "move.drop"): boolean;
/**
* Check whether the user moves the selected line up or down.
* Usually dispatched when performing [`moveLineUp`](https://codemirror.net/docs/ref/#commands.moveLineUp) or [`moveLineDown`](https://codemirror.net/docs/ref/#commands.moveLineDown) commands.
* Included in `'move'` event.
*
* @unofficial
*/
isUserEvent(event: "move.line"): boolean;
/**
* Check whether the user moves a content.
*
* @official
*/
isUserEvent(event: "move"): boolean;
/**
* Check whether the user redoes a content change.
*
* @official
*/
isUserEvent(event: "redo"): boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
isUserEvent(event: "scroll"): boolean;
/**
* Check whether the user changes the selection with mouse or other pointing device.
* Included in `'select'` event.
*
* @official
*/
isUserEvent(event: "select.pointer"): boolean;
/**
* Check whether the user redoes a selection change.
* Usually dispatched when performing [`redoSelection`](https://codemirror.net/docs/ref/#commands.redoSelection) command.
* Included in `'select'` event.
*
* @unofficial
*/
isUserEvent(event: "select.redo"): boolean;
/**
* Check whether the user selects all search matches.
* Usually dispatched when performing [`selectMatches`](https://codemirror.net/docs/ref/#search.selectMatches) and [`selectSelectionMatches`](https://codemirror.net/docs/ref/#search.selectSelectionMatches) commands.
* Included in `'select'` event.
*
* @remark Obsidian native editor search does not dispatch this event.
* @unofficial
*/
isUserEvent(event: "select.search.matches"): boolean;
/**
* Check whether the user selects search match(es).
* Usually dispatched when performing [`findNext`](https://codemirror.net/docs/ref/#search.findNext) and [`findPrevious`](https://codemirror.net/docs/ref/#search.findPrevious) commands.
* Included in `'select'` and `'select.search'` events.
*
* @remark Obsidian native editor search does not dispatch this event.
* @unofficial
*/
isUserEvent(event: "select.search"): boolean;
/**
* Check whether the user undoes a selection change.
* Usually dispatched when performing [`undoSelection`](https://codemirror.net/docs/ref/#commands.undoSelection) command.
* Included in `'select'` event.
*
* @unofficial
*/
isUserEvent(event: "select.undo"): boolean;
/**
* Check whether the user explicitly changes the selection.
*
* @official
*/
isUserEvent(event: "select"): boolean;
/**
* Check whether a content change is not made explicitly by the user. It happens in some circumstances, for instance:
* - Change made externally, e.g. by other text editor programs.
* - Change made by another editor view that holds the same note.
* - Change made by the vault, file manager, and file system API.
*
* @unofficial
*/
isUserEvent(event: "set"): boolean;
/**
* Check whether the user undoes a content change.
*
* @official
*/
isUserEvent(event: "undo"): boolean;
}
}
declare module "@codemirror/view" {
/**
* An editor view represents the editor's user interface. It holds
* the editable DOM surface, and possibly other elements such as the
* line number gutter. It handles events and dispatches state
* transactions for editing actions.
*/
interface EditorView {
/**
* @todo Documentation incomplete.
* @unofficial
*/
cm?: VimEditor;
/**
* @todo Documentation incomplete.
* @unofficial
*/
viewState: EditorViewState;
/**
* @todo Documentation incomplete.
* @unofficial
*/
measure(): void;
}
}
declare module "@codemirror/view" {
/**
* Widgets added to the content are described by subclasses of this
* class. Using a description object like that makes it possible to
* delay creating of the DOM structure for a widget until it is
* needed, and to avoid redrawing widgets even if the decorations
* that define them are recreated.
*/
interface WidgetType {
/**
* Setting this to true causes widgets to never be reused. The default
* implementation just returns `false`.
*
* @see https://github.com/lishid/cm-view/blob/main/src/decoration.ts
* @remark This only exists and can only be used in Obsidian.
* @unofficial
*/
get noReuse(): boolean;
/**
* Called when a previous DOM element created by a widget of the
* same type is about to be reused. Equivalent to `updateDOM`, but
* for when `eq` returns true.
*
* Can be used as widget ownership transfer.
*
* @see https://github.com/lishid/cm-view/blob/main/src/decoration.ts
* @remark This only exists and can only be used in Obsidian.
* @unofficial
*/
become(dom: HTMLElement, widget: WidgetType): void;
}
}
declare module "i18next" {
/**
* @todo Documentation incomplete.
*
* @unofficial
*/
var isLanguageChangingTo: string | undefined;
/**
* @todo Documentation incomplete.
* @unofficial
*/
var logger: unknown;
/**
* @todo Documentation incomplete.
*
* @unofficial
*/
var observers: object;
/**
* @todo Documentation incomplete.
*
* @unofficial
*/
var translator: unknown;
}
declare module "obsidian" {
/**
* @todo Documentation incomplete.
* @since 1.10.0
*
* @deprecated - Added only for typing purposes. Use {@link BasesConfigFileFilter} instead.
*/
type BasesConfigFileFilter__ = string | BasesConfigFileFilterAndClause | BasesConfigFileFilterOrClause | BasesConfigFileFilterNotClause;
}
declare module "obsidian" {
/**
* @todo Documentation incomplete.
* @since 1.10.0
*/
interface BasesConfigFileView {
/**
* Additional filters, applied only to this view.
*
* @official
* @since 1.10.0
*/
filters?: BasesConfigFileFilter;
/**
* Configuration for grouping the results of this view.
*
* @official
* @since 1.10.0
*/
groupBy?: {};
/**
* Friendly name for this view, displayed in the UI to select between views.
*
* @official
* @since 1.10.0
*/
name: string;
/**
* An ordered list of the properties to display in this view.
*
* @official
* @since 1.10.0
*/
order?: string[];
/**
* Configuration of summaries to display for each property in this view.
*
* Key: Property name.
* Value: Summary formula name.
*
* @official
* @since 1.10.0
*/
summaries?: Record<string, string>;
/**
* Unique identifier for the view type. Used to select the correct view renderer.
*
* @official
* @since 1.10.0
*/
type: string;
}
}
declare module "obsidian" {
/**
* A button component.
* @since 0.9.7
*/
interface ButtonComponent extends BaseComponent {
/**
* The HTML element representation of the button.
*
* @official
* @since 0.9.7
*/
buttonEl: HTMLButtonElement;
/**
* The function that's called after clicking the button.
*
* @remark Using `ButtonComponent.onClick(callback)` assigns the callback to this method.
* @unofficial
*/
clickCallback?(): void;
/**
* The constructor for the button component.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Sets the click event callback for the button component.
*
* @param callback - The callback to set.
* @returns The button component.
* @example
* ```ts
* button.onClick(() => {
* console.log('Button clicked');
* });
* ```
* @official
* @since 0.12.16
*/
onClick(callback: (evt: MouseEvent) => any): this;
/**
* Removes the call to action style from the button component.
* `CTA` stands for `call to action`.
*
* @returns The button component.
* @official
* @since 0.9.20
*/
removeCta(): this;
/**
* Sets the text for the button component.
*
* @param name - The name to set.
* @returns The button component.
* @example
* ```ts
* button.setButtonText('My button');
* ```
* @official
* @since 0.9.7
*/
setButtonText(name: string): this;
/**
* Sets the class for the button component.
*
* @param cls - The class to set.
* @returns The button component.
* @example
* ```ts
* button.setClass('my-class');
* ```
* @official
* @since 0.9.7
*/
setClass(cls: string): this;
/**
* Sets the button component to a call to action button.
* `CTA` stands for `call to action`.
* It changes how the button is styled, to make it stand out.
* Use it sparingly, to make the button stand out from others nearby.
*
* @returns The button component.
* @example `Check for updates` button in the `General` options settings.
* @official
* @since 0.9.7
*/
setCta(): this;
/**
* Sets the disabled state of the button component.
*
* @param disabled - Whether to disable the button component.
* @returns The button component.
* @example
* ```ts
* button.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Sets the icon for the button component.
*
* @param icon - The icon to set.
* @returns The button component.
* @example
* ```ts
* button.setIcon('dice');
* ```
* @official
* @since 1.1.0
*/
setIcon(icon: IconName): this;
/**
* Sets the tooltip for the button component.
*
* @param tooltip - The tooltip to set.
* @param options - The options for the tooltip.
* @returns The button component.
* @official
* @since 1.1.0
*/
setTooltip(tooltip: string, options?: TooltipOptions): this;
/**
* Sets the button component to a warning button.
* Usually it's added to buttons that perform destructive actions, such as deleting user's data.
*
* @example `Uninstall` button in the modal of uninstalling a community plugin
* @example `Clear` button in the `File recovery` core plugin setting
* @returns The button component.
* @official
* @since 0.11.0
*/
setWarning(): this;
}
}
declare module "obsidian" {
/**
* A cache item with a position within a note.
*/
interface CacheItem {
/**
* Position of this item in the note.
*
* @official
*/
position: Pos;
}
}
declare module "obsidian" {
/**
* A cached metadata for a note.
*
* Linktext is any internal link that is composed of a path and a subpath, such as 'My note#Heading'
* Linkpath (or path) is the path part of a linktext
* Subpath is the heading/block ID part of a linktext.
*/
interface MetadataCache extends Events {
/**
* Called by preload() which is in turn called by initialize()
*
* @unofficial
*/
_preload: () => Promise<void>;
/**
* Reference to App.
*
* @unofficial
*/
app: App;
/**
* @todo Documentation incomplete.
* @unofficial
*/
blockCache: BlockCache;
/**
* IndexedDB database
*
* @unofficial
*/
db: IDBDatabase;
/**
* @todo Documentation incomplete.
* @unofficial
*/
didFinish: Debouncer<[
], void>;
/**
* File contents cache
*
* @unofficial
*/
fileCache: MetadataCacheFileCacheRecord;
/**
* Whether the cache is fully loaded
*
* @unofficial
*/
initialized: boolean;
/**
* Amount of tasks currently in progress
*
* @unofficial
*/
inProgressTaskCount: number;
/**
* @todo Documentation incomplete.
* @unofficial
*/
linkResolverQueue: ItemQueue<TFile | null> | null;
/**
* File hash to metadata cache entry mapping
*
* @unofficial
*/
metadataCache: MetadataCacheMetadataCacheRecord;
/**
* Callbacks to execute on cache clean
*
* @unofficial
*/
onCleanCacheCallbacks: (() => void)[];
/**
* @todo Documentation incomplete.
* @unofficial
*/
preload: () => Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
preloadPromise: Promise<void> | null;
/**
* Contains all resolved links. This object maps each source file's path to an object of destination file paths with the link count.
* Source and destination paths are all vault absolute paths that comes from `TFile.path` and can be used with `Vault.getAbstractFileByPath(path)`.
*
* @official
*/
resolvedLinks: Record<string, Record<string, number>>;
/**
* Mapping of filename to collection of files that share the same name
*
* @unofficial
*/
uniqueFileLookup: CustomArrayDict<TFile>;
/**
* Contains all unresolved links. This object maps each source file to an object of unknown destinations with count.
* Source paths are all vault absolute paths, similar to {@link resolvedLinks}.
*
* @official
*/
unresolvedLinks: Record<string, Record<string, number>>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
userIgnoreFilterCache: Record<string, boolean>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
userIgnoreFilters: RegExp[] | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
userIgnoreFiltersString: string;
/**
* Reference to Vault.
*
* @unofficial
*/
vault: Vault;
/**
* @todo Documentation incomplete.
* @unofficial
*/
worker: Worker;
/**
* @todo Documentation incomplete.
* @unofficial
*/
workerResolve: ((value: CachedMetadata | PromiseLike<CachedMetadata>) => void) | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
workQueue: PromisedQueue;
/**
* @todo Documentation incomplete.
* @unofficial
*/
_getLinkpathDest(origin: string, path: string): TFile[];
/**
* Clear all caches to null values
*
* @unofficial
*/
cleanupDeletedCache(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
clear(): Promise<void>;
/**
* Called by initialize()
*
* @unofficial
*/
computeFileMetadataAsync(file: TFile): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
computeMetadataAsync(arrayBuffer: ArrayBuffer): Promise<CachedMetadata | undefined>;
/**
* Remove all entries that contain deleted path
*
* @unofficial
*/
deletePath(path: string): void;
/**
* Generates a linktext for a file.
*
* If file name is unique, use the filename.
* If not unique, use full path.
*
* @param file - The file to generate a linktext for.
* @param sourcePath - The source path to generate a linktext for.
* @param omitMdExtension - Whether to omit the `.md` extension from the linktext.
* @returns The linktext for the file.
* @example
* ```ts
* const file = app.vault.getFileByPath('foo/bar.md');
* console.log(app.metadataCache.fileToLinktext(file, 'baz/qux.md')); // 'bar' or 'foo/bar' depending on whether the file name is unique
* ```
* @official
*/
fileToLinktext(file: TFile, sourcePath: string, omitMdExtension?: boolean): string;
/**
* Get all property infos of the vault.
*
* @unofficial
*/
getAllPropertyInfos(): Record<string, PropertyInfo>;
/**
* Get all backlink information for a file.
*
* @unofficial
*/
getBacklinksForFile(file: TFile): CustomArrayDict<Reference>;
/**
* Get the cached metadata for a path.
*
* @param path - The path to get the cached metadata for.
* @returns The cached metadata for the path or `null` if the metadata for the path is not cached.
* @example
* ```ts
* const cache = app.metadataCache.getCache('foo/bar.md');
* ```
* @official
* @since 0.14.5
*/
getCache(path: string): CachedMetadata | null;
/**
* Get paths of all files cached in the vault.
*
* @unofficial
*/
getCachedFiles(): string[];
/**
* Get the cached metadata for a file.
*
* @param file - The file to get the cached metadata for.
* @returns The cached metadata for the file or `null` if the metadata for the file is not cached.
* @example
* ```ts
* const file = app.vault.getFileByPath('foo/bar.md');
* const cache = app.metadataCache.getFileCache(file);
* ```
* @official
* @since 0.9.21
*/
getFileCache(file: TFile): CachedMetadata | null;
/**
* Get an entry from the file cache.
*
* @unofficial
*/
getFileInfo(path: string): FileCacheEntry | undefined;
/**
* Get the best match for a linkpath.
*
* @param linkpath - The linkpath to get the best match for.
* @param sourcePath - The source path to get the best match for.
* @returns The best match for the linkpath or `null` if the linkpath is not found.
* @example
* ```ts
* console.log(app.metadataCache.getFirstLinkpathDest('foo/bar', 'baz/qux.md'); // `TFile` with path: 'baz/foo/bar.md' or 'some/other/path/foo/bar.md'
* ```
* @official
* @since 0.12.5
*/
getFirstLinkpathDest(linkpath: string, sourcePath: string): TFile | null;
/**
* Get property values for frontmatter property key.
*
* @unofficial
*/
getFrontmatterPropertyValuesForKey(key: string): string[];
/**
* Get destination of link path.
*
* @unofficial
*/
getLinkpathDest(origin: string, path: string): TFile[];
/**
* Get all links within the vault per file.
*
* @unofficial
*/
getLinks(): Record<string, Reference[]>;
/**
* Get all links (resolved or unresolved) in the vault.
*
* If the note has multiple aliases, it will be returned multiple times for each alias.
*
* @unofficial
*/
getLinkSuggestions(): LinkSuggestion[];
/**
* Get all tags within the vault and their usage count.
*
* @unofficial
*/
getTags(): Record<string, number>;
/**
* Initialize Database connection and load up caches
*
* @unofficial
*/
initialize(): Promise<void>;
/**
* Check whether there are no cache tasks in progress
*
* @unofficial
*/
isCacheClean(): boolean;
/**
* Check whether file can support metadata (by checking extension support)
*
* @unofficial
*/
isSupportedFile(file: TFile): boolean;
/**
* Check whether string is part of the user ignore filters
*
* @unofficial
*/
isUserIgnored(path: string): boolean;
/**
* Iterate over all link references in the vault with callback.
*
* @unofficial
*/
iterateReferences(callback: (path: string) => void): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
linkResolver(): void;
/**
* Called when a file has been indexed, and its (updated) cache is now available.
*
* @param name - Should be `'changed'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.metadataCache.on('changed', (file, data, cache) => {
* console.log(file, data, cache);
* });
* ```
*
* Note: This is not called when a file is renamed for performance reasons.
* You must hook the {@link Vault.on | Vault.on(name: 'rename')} event for those.
* @official
*/
on(name: "changed", callback: (file: TFile, data: string, cache: CachedMetadata) => any, ctx?: any): EventRef;
/**
* Called when a file has been deleted. A best-effort previous version of the cached metadata is presented,.
* but it could be `null` in case the file was not successfully cached previously.
*
* @param name - Should be `'deleted'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.metadataCache.on('deleted', (file, prevCache) => {
* console.log(file, prevCache);
* });
* ```
* @official
*/
on(name: "deleted", callback: (file: TFile, prevCache: CachedMetadata | null) => any, ctx?: any): EventRef;
/**
* Called whenever the metadatacache has finished updating.
*
* @unofficial
*/
on(name: "finished", callback: () => void): EventRef;
/**
* Called whenever the metadatacache is fully loaded in.
*
* @remark 'finished' is also emitted when the cache is initialized.
* @unofficial
*/
on(name: "initialized", callback: () => void): EventRef;
/**
* Called when a file has been resolved for {@link resolvedLinks} and {@link unresolvedLinks | unresolvedLinks}.
* This happens sometimes after a file has been indexed.
*
* @param name - Should be `'resolve'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.metadataCache.on('resolve', (file) => {
* console.log(file);
* });
* ```
* @official
*/
on(name: "resolve", callback: (file: TFile) => any, ctx?: any): EventRef;
/**
* Called when all files has been resolved. This will be fired each time files get modified after the initial load.
*
* @param name - Should be `'resolved'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.metadataCache.on('resolved', () => {
* console.log('All files have been resolved');
* });
* ```
* @official
*/
on(name: "resolved", callback: () => any, ctx?: any): EventRef;
/**
* Execute onCleanCache callbacks if cache is clean
*
* @unofficial
* @unofficial
*/
onCleanCache(onCleanCacheCallback: () => void): void;
/**
* On creation of the cache: update metadata cache
*
* @unofficial
*/
onCreate(file: TAbstractFile): void;
/**
* On creation or modification of the cache: update metadata cache
*
* @unofficial
*/
onCreateOrModify(file: TAbstractFile): void;
/**
* On deletion of the cache: update metadata cache
*
* @unofficial
*/
onDelete(file: TAbstractFile): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onReceiveMessageFromWorker(message: MetadataCacheWorkerMessage): void;
/**
* On rename of the cache: update metadata cache
*
* @unofficial
*/
onRename(file: TAbstractFile, oldPath: string): void;
/**
* Check editor for unresolved links and mark these as unresolved
*
* @unofficial
*/
resolveLinks(path: string): void;
/**
* Update file cache entry and sync to indexedDB
*
* @unofficial
*/
saveFileCache(path: string, entry: FileCacheEntry): void;
/**
* Update metadata cache entry and sync to indexedDB
*
* @unofficial
*/
saveMetaCache(hash: string, entry: CachedMetadata): void;
/**
* Show a notice that the cache is being rebuilt
*
* @unofficial
*/
showIndexingNotice(): void;
/**
* Re-resolve all links for changed path
*
* @unofficial
*/
updateRelatedLinks(path: string): void;
/**
* Update user ignore filters from settings
*
* @unofficial
*/
updateUserIgnoreFilters(): void;
/**
* Bind actions to listeners on vault
*
* @unofficial
*/
watchVaultChanges(): void;
/**
* Send message to worker to update metadata cache
*
* @unofficial
*/
work(arrayBuffer: ArrayBuffer): Promise<CachedMetadata>;
}
}
declare module "obsidian" {
/**
* A closeable component that can get dismissed via the Android 'back' button.
*/
interface CloseableComponent {
/**
* Close the component.
*
* @official
*/
close(): void;
}
}
declare module "obsidian" {
/**
* A color in RGB format.
* @since 0.16.0
*/
interface RGB {
/**
* Blue integer value between 0 and 255.
*
* @official
*/
b: number;
/**
* Green integer value between 0 and 255.
*
* @official
*/
g: number;
/**
* Red integer value between 0 and 255.
*
* @official
*/
r: number;
}
}
declare module "obsidian" {
/**
* A command that can be executed from the command palette or toolbar buttons.
*/
interface Command {
/**
* Whether the editor command can be executed when the note is in preview mode.
*
* @remarks `Editor command` is the command with defined {@link editorCallback}/{@link editorCheckCallback}.
* @unofficial
*/
allowPreview?: boolean;
/**
* Whether the editor command can be executed when the properties panel is shown.
*
* @remarks `Editor command` is the command with defined {@link editorCallback}/{@link editorCheckCallback}.
* @unofficial
*/
allowProperties?: boolean;
/**
* Simple callback, triggered globally.
*
* @example
* ```ts
* this.addCommand({
* id: 'print-greeting-to-console',
* name: 'Print greeting to console',
* callback: () => {
* console.log('Hey, you!');
* },
* });
* ```
* @official
*/
callback?: () => any;
/**
* Complex callback, overrides the simple callback.
* Used to 'check' whether your command can be performed in the current circumstances.
* For example, if your command requires the active focused pane to be a MarkdownView, then
* you should only return `true` if the condition is satisfied. Returning `false` or `undefined` causes
* the command to be hidden from the command palette.
*
* @param checking - Whether the command palette is just 'checking' if your command should show right now.
* If checking is `true`, then this function should not perform any action.
* If checking is `false`, then this function should perform the action.
* @returns Whether this command can be executed at the moment.
* @example
* ```ts
* this.addCommand({
* id: 'example-command',
* name: 'Example command',
* checkCallback: (checking: boolean) => {
* const value = getRequiredValue();
*
* if (value) {
* if (!checking) {
* doCommand(value);
* }
* return true;
* }
*
* return false;
* }
* });
* ```
* @official
*/
checkCallback?: (checking: boolean) => boolean | void;
/**
* A command callback that is only triggered when the user is in an editor.
* Overrides `callback` and `checkCallback`
*
* @example
* ```ts
* this.addCommand({
* id: 'example-command',
* name: 'Example command',
* editorCallback: (editor: Editor, view: MarkdownView) => {
* const sel = editor.getSelection();
*
* console.log(`You have selected: ${sel}`);
* }
* });
* ```
* @official
* @since 0.12.2
*/
editorCallback?: (editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => any;
/**
* A command callback that is only triggered when the user is in an editor.
* Overrides `editorCallback`, `callback` and `checkCallback`
*
* @example
* ```ts
* this.addCommand({
* id: 'example-command',
* name: 'Example command',
* editorCheckCallback: (checking: boolean, editor: Editor, view: MarkdownView) => {
* const value = getRequiredValue();
*
* if (value) {
* if (!checking) {
* doCommand(value);
* }
*
* return true;
* }
*
* return false;
* }
* });
* ```
* @official
* @since 0.12.2
*/
editorCheckCallback?: (checking: boolean, editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => boolean | void;
/**
* Sets the default hotkey. It is recommended for plugins to avoid setting default hotkeys if possible,.
* to avoid conflicting hotkeys with one that's set by the user, even though customized hotkeys have higher priority.
*
* @example
* ```ts
* this.addCommand({
* id: 'example-command',
* name: 'Example command',
* // WARNING: as per comment above, it's not recommended to set default hotkeys
* // this example is just for syntax demonstration purposes, not the recommended way to do it
* hotkeys: [{
* modifiers: ['Mod', 'Shift'],
* key: 'l',
* }],
* });
* ```
* @official
*/
hotkeys?: Hotkey[];
/**
* Icon ID to be used in the toolbar.
*
* See {@link https://docs.obsidian.md/Plugins/User+interface/Icons} for available icons and how to add your own.
*
* @example
* ```ts
* const command: Command = {
* id: 'example-command',
* name: 'Example command',
* icon: 'dice',
* };
* ```
* @official
*/
icon?: IconName;
/**
* Globally unique ID to identify this command.
*
* @official
*/
id: string;
/**
* Whether the command is only available on mobile.
*
* @official
*/
mobileOnly?: boolean;
/**
* Human friendly name for searching.
*
* @official
*/
name: string;
/**
* Whether holding the hotkey should repeatedly trigger this command.
*
* @defaultValue false.
* @official
*/
repeatable?: boolean;
/**
* Whether the non-editor command button can be shown on the mobile toolbar.
*
* @remarks `Non-editor command` is the command without {@link editorCallback}/{@link editorCheckCallback}.
* @unofficial
*/
showOnMobileToolbar?: boolean;
}
}
declare module "obsidian" {
/**
* A common interface that bridges the gap between CodeMirror 5 and CodeMirror 6.
*/
interface Editor {
/**
* CodeMirror editor instance.
*
* @unofficial
*/
cm: EditorView;
/**
* HTML instance the CM editor is attached to.
*
* @unofficial
*/
containerEl: HTMLElement;
/**
* Linked Editor manager instance.
*
* @unofficial
*/
editorComponent: undefined | MarkdownScrollableEditView;
/**
* Currently active CM instance.
*
* @remark Can be null when Editor is not instantiated.
* @unofficial
*/
get activeCM(): EditorView | null;
/**
* Whether the editor is embedded in a table cell.
* @unofficial
*/
get inTableCell(): boolean;
/**
* Make ranges of text highlighted within the editor given specified class (style).
*
* @unofficial
*/
addHighlights(ranges: EditorRange[], style: "is-flashing" | "obsidian-search-match-highlight", remove_previous: boolean, range?: EditorSelection): void;
/**
* Clean-up function executed after indenting lists.
*
* @unofficial
*/
afterIndent(): void;
/**
* Blur the editor.
*
* @example
* ```ts
* editor.blur();
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link blur} instead.
* @since 0.11.11
*/
blur__?(): void;
/**
* Convert editor position to screen position.
*
* @param pos Editor position.
* @param relative_to_editor Relative to the editor or the application window.
* @unofficial
*/
coordsAtPos(pos: EditorPosition, relative_to_editor: boolean): Coords;
/**
* Execute a command.
*
* @param command - The command to execute.
* @example
* ```ts
* editor.exec('goUp');
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link exec} instead.
* @since 0.12.2
*/
exec__(command: EditorCommandName): void;
/**
* Expand text.
*
* @unofficial
*/
expandText(): void;
/**
* Focus the editor.
*
* @example
* ```ts
* editor.focus();
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link focus} instead.
* @since 0.11.11
*/
focus__?(): void;
/**
* Unfolds all folded lines one level up.
*
* @remark If level 1 and 2 headings are folded, level 2 headings will be unfolded.
* @unofficial
*/
foldLess(): void;
/**
* Folds all the blocks that are of the lowest unfolded level.
*
* @remark If there is a document with level 1 and 2 headings, level 2 headings will be folded.
* @unofficial
*/
foldMore(): void;
/**
* Get all ranges that can be folded away in the editor.
*
* @unofficial
*/
getAllFoldableLines(): Fold[];
/**
* Get a clickable link - if it exists - at specified position.
*
* @unofficial
*/
getClickableTokenAt(pos: EditorPosition): ClickableToken | null;
/**
* Get the cursor position.
*
* @param string - The type of cursor to get.
* @returns The cursor position.
* @example
* ```ts
* console.log(editor.getCursor('from'));
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link getCursor} instead.
* @since 0.11.11
*/
getCursor__(string?: "from" | "to" | "head" | "anchor"): EditorPosition;
/**
* Get the editor instance.
*
* @returns The editor instance.
* @official
* @since 0.11.11
*/
getDoc(): this;
/**
* Get all blocks that were folded by their starting character position.
*
* @unofficial
*/
getFoldOffsets(): Set<number>;
/**
* Get the text at line index (0-based).
*
* @param line - The line index.
* @returns The text at the line.
* @example
* ```ts
* console.log(editor.getLine(42));
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link getLine} instead.
* @since 0.11.11
*/
getLine__(line: number): string;
/**
* Get the range between two positions.
*
* @param from - The start position.
* @param to - The end position.
* @returns The range between the two positions.
* @example
* ```ts
* console.log(editor.getRange(from, to));
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link getRange} instead.
* @since 0.11.11
*/
getRange__(from: EditorPosition, to: EditorPosition): string;
/**
* Get the scroll info (horizontal and vertical scroll positions).
*
* @returns The scroll info.
* @official
* @since 0.11.11
*/
getScrollInfo__?(): CoordsLeftTop;
/**
* Get the selection.
*
* @returns The selection.
* @official
* @deprecated - Added only for typing purposes. Use {@link getSelection} instead.
* @since 0.11.11
*/
getSelection__?(): string;
/**
* Get the content of the editor.
*
* @returns The content of the editor.
* @official
* @deprecated - Added only for typing purposes. Use {@link getValue} instead.
* @since 0.11.11
*/
getValue__?(): string;
/**
* Check if the editor is focused.
*
* @returns Whether the editor is focused.
* @official
* @since 0.11.11
*/
hasFocus__?(): boolean;
/**
* Checks whether the editor has a highlight of specified class.
*
* @remark If no style is specified, checks whether the editor has unknown highlights.
* @unofficial
*/
hasHighlight(style?: string): boolean;
/**
* Indents a list by one level.
*
* @unofficial
*/
indentList(): void;
/**
* Wraps current line around specified characters.
*
* @remark Was added in a recent Obsidian update (1.4.0 update cycle).
* @unofficial
*/
insertBlock(start: string, end: string): void;
/**
* Insert a template callout at the current cursor position.
*
* @unofficial
*/
insertCallout(): void;
/**
* Insert a template code block at the current cursor position.
*
* @unofficial
*/
insertCodeblock(): void;
/**
* Insert a markdown link at the current cursor position.
*
* @unofficial
*/
insertLink(): void;
/**
* Insert a mathjax equation block at the current cursor position.
*
* @unofficial
*/
insertMathJax(): void;
/**
* Insert specified text at the current cursor position.
*
* @param text - The text to insert.
* @remark Might be broken, inserts at the end of the document.
* @unofficial
*/
insertText(text: string): void;
/**
* Get the index of the last line (0-indexed).
*
* @returns The index of the last line.
* @official
* @deprecated - Added only for typing purposes. Use {@link lastLine} instead.
* @since 0.11.11
*/
lastLine__?(): number;
/**
* Gets the amount of lines in the document.
*
* @returns The amount of lines in the document.
* @official
* @deprecated - Added only for typing purposes. Use {@link lineCount} instead.
* @since 0.11.11
*/
lineCount__?(): number;
/**
* Get the list of selections if multiple cursors are active.
*
* @returns The list of selections.
* @official
* @deprecated - Added only for typing purposes. Use {@link listSelections} instead.
* @since 0.11.11
*/
listSelections__?(): EditorSelection[];
/**
* Inserts a new line and continues a markdown bullet point list at the same level.
*
* @unofficial
*/
newlineAndIndentContinueMarkdownList(): void;
/**
* Inserts a new line at the same indent level.
*
* @unofficial
*/
newlineAndIndentOnly(): void;
/**
* Convert an offset to a position.
*
* @param offset - The offset to convert.
* @returns The position.
* @example
* ```ts
* console.log(editor.offsetToPos(123));
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link offsetToPos} instead.
* @since 0.11.11
*/
offsetToPos__(offset: number): EditorPosition;
/**
* Get the closest character position to the specified coordinates.
*
* @param x - The `x` coordinate.
* @param y - The `y` coordinate.
* @returns The closest character position to the specified coordinates.
* @unofficial
*/
posAtCoords(x: number, y: number): EditorPosition;
/**
* Get the character position at a mouse event.
*
* @param evt - The mouse event.
* @returns The character position at the mouse event.
* @unofficial
*/
posAtMouse(evt: MouseEvent): EditorPosition;
/**
* Convert a position to an offset.
*
* @param pos - The position to convert.
* @returns The offset.
* @example
* ```ts
* console.log(editor.posToOffset({ line: 12, ch: 3 }));
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link posToOffset} instead.
* @since 0.11.11
*/
posToOffset__(pos: EditorPosition): number;
/**
* Process lines.
*
* @typeParam T - The type of the value to process.
* @param read - The function to convert the line to a value.
* @param write - The function to convert the line with a value to the editor change.
* @param ignoreEmpty - Whether to ignore empty lines.
* @example
* ```ts
* editor.processLines((line, lineText) => {
* return lineText.length;
* }, (line, lineText, value) => {
* return { text: line + value, from: { line, ch: 0 }, to: { line, ch: lineText.length } };
* }, true);
* ```
* @official
* @since 0.13.26
*/
processLines<T>(read: (line: number, lineText: string) => T | null, write: (line: number, lineText: string, value: T | null) => EditorChange | void, ignoreEmpty?: boolean): void;
/**
* Redo the last action.
*
* @example
* ```ts
* editor.redo();
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link redo} instead.
* @since 0.11.11
*/
redo__?(): void;
/**
* Refresh the editor.
*
* @example
* ```ts
* editor.refresh();
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link refresh} instead.
* @since 0.11.11
*/
refresh__?(): void;
/**
* Removes all highlights of specified class.
*
* @unofficial
*/
removeHighlights(style: string): void;
/**
* Replace the range between two positions.
*
* @param replacement - The replacement text.
* @param from - The start position.
* @param to - The end position.
* @param origin - The user event that triggered the replacement.
* @example
* ```ts
* editor.replaceRange('foo', from, to);
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link replaceRange} instead.
* @since 0.11.11
*/
replaceRange__(replacement: string, from: EditorPosition, to?: EditorPosition, origin?: string): void;
/**
* @official
* @since 0.11.11
* @deprecated - Added only for typing purposes. Use {@link replaceSelection} instead.
*/
replaceSelection__(replacement: string, origin?: string): void;
/**
* Scroll into view.
*
* @param range - The range to scroll into view.
* @param center - Whether to center the range.
* @example
* ```ts
* editor.scrollIntoView({ from: { line: 12, ch: 3 }, to: { line: 23, ch: 4 } }, true);
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link scrollIntoView} instead.
* @since 0.13.0
*/
scrollIntoView__(range: EditorRange, center?: boolean): void;
/**
* Scroll to a specific position.
*
* @param x - The horizontal scroll position.
* @param y - The vertical scroll position.
* @example
* ```ts
* editor.scrollTo(12, 34);
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link scrollTo} instead.
* @since 0.11.11
*/
scrollTo__(x?: number | null, y?: number | null): void;
/**
* Adds a search cursor to the editor.
*
* @unofficial
*/
searchCursor(searchString: string): SearchCursor;
/**
* Set the cursor position.
*
* @param pos - The position to set the cursor to.
* @param ch - The character index to set the cursor to (0-based).
* @example
* ```ts
* editor.setCursor({ line: 12, ch: 3 });
* editor.setCursor(12, 3);
* ```
* @official
* @since 0.11.11
*/
setCursor(pos: EditorPosition | number, ch?: number): void;
/**
* Set the text at line index (0-based).
*
* @param n - The line index.
* @param text - The text to set.
* @example
* ```ts
* editor.setLine(42, 'foo');
* ```
* @official
* @since 0.11.11
*/
setLine(n: number, text: string): void;
/**
* Set the selection.
*
* @param anchor - The start selection position.
* @param head - The end selection position.
* @example
* ```ts
* editor.setSelection({ line: 12, ch: 3 }, { line: 23, ch: 4 });
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link setSelection} instead.
* @since 0.11.11
*/
setSelection__(anchor: EditorPosition, head?: EditorPosition): void;
/**
* Set the selections.
*
* @param ranges - The ranges to set the selections to.
* @param main - The main selection index.
* @example
* ```ts
* editor.setSelections([
* { anchor: { line: 12, ch: 3 }, head: { line: 23, ch: 4 } },
* { anchor: { line: 34, ch: 5 }, head: { line: 45, ch: 6 } }
* ], 1);
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link setSelections} instead.
* @since 0.12.11
*/
setSelections__(ranges: EditorSelectionOrCaret[], main?: number): void;
/**
* Set the content of the editor.
*
* @param content - The content to set.
* @example
* ```ts
* editor.setValue('foo');
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link setValue} instead.
* @since 0.11.11
*/
setValue__(content: string): void;
/**
* Check if there is a selection.
*
* @returns Whether there is a selection.
* @official
* @since 0.11.11
*/
somethingSelected(): boolean;
/**
* Toggles blockquote syntax on paragraph under cursor.
*
* @unofficial
*/
toggleBlockquote(): void;
/**
* Toggle bullet point list syntax on paragraph under cursor.
*
* @unofficial
*/
toggleBulletList(): void;
/**
* Toggle checkbox syntax on paragraph under cursor.
*
* @unofficial
*/
toggleCheckList(): void;
/**
* Applies specified markdown syntax to selected text or word under cursor.
*
* @unofficial
*/
toggleMarkdownFormatting(syntax: "bold" | "italic" | "strikethrough" | "highlight" | "code" | "math" | "comment"): void;
/**
* Toggle numbered list syntax on paragraph under cursor.
*
* @unofficial
*/
toggleNumberList(): void;
/**
* @official
* @since 0.13.0
* @deprecated - Added only for typing purposes. Use {@link transaction} instead.
*/
transaction__(tx: EditorTransaction, origin?: string): void;
/**
* Convert word under cursor into a wikilink.
*
* @param embed - Whether to embed the link or not.
* @unofficial
*/
triggerWikiLink(embed: boolean): void;
/**
* Undo the last action.
*
* @example
* ```ts
* editor.undo();
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link undo} instead.
* @since 0.11.11
*/
undo__?(): void;
/**
* Unindents a list by one level.
*
* @unofficial
*/
unindentList(): void;
/**
* Get the word at a specific position.
*
* @param pos - The position to get the word at.
* @returns A range object containing the word or `null` if there is no word at the position.
* @example
* ```ts
* console.log(editor.wordAt({ line: 12, ch: 3 }));
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link wordAt} instead.
* @since 0.11.11
*/
wordAt__(pos: EditorPosition): EditorRange | null;
}
}
declare module "obsidian" {
/**
* A component for context menus.
*/
interface Menu extends Component, CloseableComponent {
/**
* Background for the suggestion menu.
*
* @unofficial
*/
bgEl: HTMLElement;
/**
* The currently active submenu, if any.
*
* @unofficial
*/
currentSubmenu?: Menu;
/**
* DOM element of the menu.
*
* @unofficial
*/
dom: HTMLElement;
/**
* Items and separators contained in the menu.
*
* @unofficial
*/
items: (MenuItem | MenuSeparator)[];
/**
* Parent menu of the current menu.
*
* @unofficial
*/
parentMenu: Menu | null;
/**
* Scope in which the menu is active.
*
* @unofficial
*/
scope: Scope;
/**
* Sections within the menu.
*
* @unofficial
*/
sections: string[];
/**
* Which menuitem is currently selected.
*
* @unofficial
*/
selected: number;
/**
* Configurations for the submenu configs.
*
* @unofficial
*/
submenuConfig: MenuSubmenuConfigRecord;
/**
* Whether the submenu is currently unloading.
*
* @unofficial
*/
unloading: boolean;
/**
* Whether the menu is rendered in native mode.
*
* @unofficial
*/
useNativeMenu: boolean;
/**
* Adds a menu item. Only works when menu is not shown yet.
*
* @param cb - The callback function.
* @returns The menu instance.
* @example
* ```ts
* menu.addItem((item) => {
* item.setTitle('foo');
* });
* ```
* @official
*/
addItem(cb: (item: MenuItem) => any): this;
/**
* Add a section to the menu.
*
* @unofficial
*/
addSections(items: string[]): this;
/**
* Adds a separator. Only works when menu is not shown yet.
*
* @returns The menu instance.
* @official
*/
addSeparator(): this;
/**
* Close the menu.
*
* @returns The menu instance.
* @official
*/
close(): void;
/**
* Close the currently open submenu.
*
* @unofficial
*/
closeSubmenu(): void;
/**
* Create a new menu.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__?(): this;
/**
* Hide the menu.
*
* @returns The menu instance.
* @official
*/
hide(): this;
/**
* Callback to execute when the menu is hidden.
*
* @unofficial
*/
hideCallback(): void;
/**
* Check whether the clicked element is inside the menu.
*
* @unofficial
*/
isInside(e: HTMLElement): boolean;
/**
* Move selection to the next item in the menu.
*
* @param e - Keyboard event.
* @unofficial
*/
onArrowDown(e: KeyboardEvent): boolean;
/**
* Move selection out of the submenu.
*
* @unofficial
*/
onArrowLeft(e: KeyboardEvent): boolean;
/**
* Move selection into the submenu.
*
* @unofficial
*/
onArrowRight(e: KeyboardEvent): boolean;
/**
* Move selection to the previous item in the menu.
*
* @param e - Keyboard event.
* @unofficial
*/
onArrowUp(e: KeyboardEvent): boolean;
/**
* Execute selected menu item (does nothing if item is submenu).
*
* @param e - Keyboard event.
* @unofficial
*/
onEnter(e: KeyboardEvent): boolean;
/**
* Add a callback to be called when the menu is hidden.
*
* @param callback - The callback function.
* @returns The menu instance.
* @example
* ```ts
* menu.onHide(() => {
* console.log('Menu hidden');
* });
* ```
* @official
*/
onHide(callback: () => any): void;
/**
* Preemptively closes the menu if click is registered on menu item.
*
* @param e - Mouse event.
* @unofficial
*/
onMenuClick(e: MouseEvent): void;
/**
* Opens submenu if mouse is hovering over item with submenu.
*
* @param e - Mouse event.
* @unofficial
*/
onMouseOver(e: MouseEvent): boolean;
/**
* Registers dom events and scope for the menu.
*
* @param item - Menu item.
* @unofficial
*/
openSubmenu(item: MenuItem): void;
/**
* Callback that opens the submenu after a delay.
*
* @unofficial
*/
openSubmenuSoon(): void;
/**
* Select the item at the specified index (after either hovering or arrowing over it).
*
* @param index - Index of the item to select.
* @unofficial
*/
select(index: number): void;
/**
* Set the menu to not use an icon.
*
* @returns The menu instance.
* @official
*/
setNoIcon(): this;
/**
* Set the parent element of the menu (i.e. for workspace leaf context menu).
*
* @param el - Element to set as parent.
* @unofficial
*/
setParentElement(el: HTMLElement): this;
/**
* Add a section to the submenu config.
*
* @param section - Section to add.
* @param submenu - Submenu to add.
* @unofficial
*/
setSectionSubmenu(section: string, submenu: Submenu): this;
/**
* Force this menu to use native or DOM.
* (Only works on the desktop app)
*
* @param useNativeMenu - Whether to use a native menu.
* @returns The menu instance.
* @example
* ```ts
* menu.setUseNativeMenu(true);
* ```
* @official
* @since 0.16.0
*/
setUseNativeMenu(useNativeMenu: boolean): this;
/**
* Show the menu at the position of the mouse event.
*
* @param evt - The mouse event.
* @returns The menu instance.
* @example
* ```ts
* menu.showAtMouseEvent(evt);
* ```
* @official
* @since 0.12.6
*/
showAtMouseEvent(evt: MouseEvent): this;
/**
* Show the menu at a specific position.
*
* @param position - The position of the menu.
* @param doc - The document. Use if you need to show the menu in another window.
* @returns The menu instance.
* @example
* ```ts
* menu.showAtPosition({ x: 100, y: 100 });
* ```
* @official
* @since 1.1.0
*/
showAtPosition(position: MenuPositionDef, doc?: Document): this;
/**
* Sort the items in the menu.
*
* @unofficial
*/
sort(): void;
/**
* Unselect the currently selected item and closes the submenu.
*
* @unofficial
*/
unselect(): void;
}
namespace Menu {
/**
* Get or create a menu from a mouse event.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link forEvent} instead.
* @since 1.6.0
*/
function forEvent__(evt: MouseEvent): Menu;
}
}
declare module "obsidian" {
/**
* A component that allows you to format dates using `Moment.js`.
* @since 0.9.7
*/
interface MomentFormatComponent extends TextComponent {
/**
* The HTML element that represents the sample value.
*
* @official
* @since 0.9.7
*/
sampleEl: HTMLElement;
/**
* Called when the value of the component changes.
*
* @official
* @since 0.9.7
*/
onChanged(): void;
/**
* Sets the default format when input is cleared. Also used for placeholder.
*
* @param defaultFormat - The default format.
* @returns The component instance.
* @example
* ```ts
* momentFormatComponent.setDefaultFormat('YYYY-MM-DD');
* ```
* @official
* @since 0.9.7
*/
setDefaultFormat(defaultFormat: string): this;
/**
* Sets the sample HTML element.
*
* @param sampleEl - The sample HTML element.
* @returns The component instance.
* @example
* ```ts
* momentFormatComponent.setSampleEl(createEl('strong'));
* ```
* @official
* @since 0.9.7
*/
setSampleEl(sampleEl: HTMLElement): this;
/**
* Sets the value of the component.
*
* @param value - The value of the component.
* @returns The component instance.
* @example
* ```ts
* momentFormatComponent.setValue('2025-01-01');
* ```
* @official
* @since 0.9.7
*/
setValue(value: string): this;
/**
* Updates the sample value.
*
* @official
* @since 0.9.7
*/
updateSample(): void;
}
}
declare module "obsidian" {
/**
* A component that can be loaded and unloaded.
*/
interface Component {
/**
* Child Components attached to current component, will be unloaded on unloading parent component.
*
* @unofficial
*/
_children: Component[];
/**
* Events that are attached to the current component, will be detached on unloading parent component.
*
* @unofficial
*/
_events: EventRef[];
/**
* Whether the component and its children are loaded.
*
* @unofficial
*/
_loaded: boolean;
/**
* Adds a child component, loading it if this component is loaded.
*
* @typeParam T - The type of the component to add.
* @param component - The component to add.
* @returns The added component.
* @example
* ```ts
* component.addChild(childComponent);
* ```
* @official
* @since 0.12.0
*/
addChild<T extends Component>(component: T): T;
/**
* Load this component and its children.
*
* @official
* @since 0.9.7
*/
load(): void;
/**
* Override this to load your component.
*
* @example
* ```ts
* class MyComponent extends Component {
* public override onload(): void {
* console.log('MyComponent loaded');
* }
* }
* ```
* @virtual
* @official
* @since 0.9.7
*/
onload(): void;
/**
* Override this to unload your component
*
* @virtual
* @official
* @since 0.9.7
*/
onunload(): void;
/**
* Registers a callback to be called when unloading.
*
* @param cb - The callback to be called when unloading.
* @example
* ```ts
* component.register(() => {
* console.log('MyComponent unloaded');
* });
* ```
* @official
* @since 0.9.7
*/
register(cb: () => any): void;
/**
* Registers a DOM event to be detached when unloading.
*
* @typeParam K - The type of the event to register.
* @param el - The element to register the event on.
* @param type - The type of the event to register.
* @param callback - The callback to be called when the event is triggered.
* @param options - The options for the event.
* @example
* ```ts
* component.registerDomEvent(document, 'click', () => {
* console.log('Document clicked');
* });
* ```
* @official
* @since 0.14.8
*/
registerDomEvent<K extends keyof DocumentEventMap>(el: Document, type: K, callback: (this: HTMLElement, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
/**
* Registers a DOM event to be detached when unloading.
*
* @typeParam K - The type of the event to register.
* @param el - The element to register the event on.
* @param type - The type of the event to register.
* @param callback - The callback to be called when the event is triggered.
* @param options - The options for the event.
* @example
* ```ts
* component.registerDomEvent(document.body, 'click', () => {
* console.log('Body clicked');
* });
* ```
* @official
*/
registerDomEvent<K extends keyof HTMLElementEventMap>(el: HTMLElement, type: K, callback: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
/**
* Registers a DOM event to be detached when unloading.
*
* @typeParam K - The type of the event to register.
* @param el - The element to register the event on.
* @param type - The type of the event to register.
* @param callback - The callback to be called when the event is triggered.
* @param options - The options for the event.
* @example
* ```ts
* component.registerDomEvent(window, 'click', () => {
* console.log('Window clicked');
* });
* ```
* @official
*/
registerDomEvent<K extends keyof WindowEventMap>(el: Window, type: K, callback: (this: HTMLElement, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
/**
* Registers an event to be detached when unloading.
*
* @param eventRef - The event to be registered.
* @example
* ```ts
* component.registerEvent(eventRef);
* ```
* @official
* @since 0.9.7
*/
registerEvent(eventRef: EventRef): void;
/**
* Registers an interval (from setInterval) to be cancelled when unloading.
* Use {@link window.setInterval} instead of {@link setInterval} to avoid TypeScript confusing between NodeJS vs Browser API
*
* @param id - The id of the interval to register.
* @returns The id of the interval.
* @example
* ```ts
* component.registerInterval(window.setInterval(() => {
* console.log('Interval');
* }, 1000));
* ```
* @official
* @since 0.13.8
*/
registerInterval(id: number): number;
/**
* @todo Documentation incomplete.
* @unofficial
*/
registerScopeEvent(keymapEventHandler: KeymapEventHandler): void;
/**
* Removes a child component, unloading it.
*
* @typeParam T - The type of the component to remove.
* @param component - The component to remove.
* @returns The removed component.
* @example
* ```ts
* component.removeChild(childComponent);
* ```
* @official
* @since 0.12.0
*/
removeChild<T extends Component>(component: T): T;
/**
* Override this to unload your component.
*
* @example
* ```ts
* class MyComponent extends Component {
* public override onunload(): void {
* console.log('MyComponent unloaded');
* }
* }
* ```
* @virtual
* @official
* @since 0.9.7
*/
unload(): void;
}
}
declare module "obsidian" {
/**
* A component that displays a progress bar.
* @since 1.4.4
*/
interface ProgressBarComponent extends ValueComponent<number> {
/**
* Access the "line" element which is a child of the progressBar element.
*
* @unofficial
*/
lineEl: HTMLDivElement;
/**
* Access the "bar" element.
*
* @unofficial
*/
progressBar: HTMLDivElement;
/**
* Creates a new ProgressBarComponent.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Get the current value of the progress bar (0-100).
*
* @returns The current value of the progress bar.
* @official
*/
getValue(): number;
/**
* Set the current value of the progress bar.
*
* @param value - The progress amount, a value between 0-100.
* @returns The progress bar component.
* @official
*/
setValue(value: number): this;
/**
* Shows/hides the component.
*
* @param visible Whether the setting should be visible.
* @returns The component.
* @unofficial
*/
setVisibility(visible: boolean): this;
}
}
declare module "obsidian" {
/**
* A component to register as a child component for the markdown preview.
*/
interface MarkdownRenderChild extends Component {
/**
* The container element of the markdown render child.
*
* @official
*/
containerEl: HTMLElement;
/**
* Create a new markdown render child.
*
* @param containerEl - This HTMLElement will be used to test whether this component is still alive.
* It should be a child of the Markdown preview sections, and when it's no longer attached
* (for example, when it is replaced with a new version because the user edited the Markdown source code),
* this component will be unloaded.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
}
}
declare module "obsidian" {
/**
* A data object for `obsidian://` URLs.
*
* @example
* `obsidian://foo?bar=baz&qux=true`
*/
interface ObsidianProtocolData {
/**
* The action to perform.
*
* @example
* ```ts
* console.log(obsidianProtocolData.action); // foo
* ```
* @official
*/
action: string;
/**
* Additional parameters.
*
* @example
* ```ts
* console.log(obsidianProtocolData['bar']); // baz
* console.log(obsidianProtocolData['qux']); // true
* ```
* @official
* @deprecated - Added only for typing purposes. Use `this[key]` instead.
*/
index__: string | "true";
}
}
declare module "obsidian" {
/**
* A debouncer wrapper for a function.
*
* @typeParam T - The type of the arguments of the function to debounce.
* @typeParam V - The type of the return value of the function to debounce.
*/
interface Debouncer<T extends unknown[], V> {
/**
* Call the debounced function.
*
* @param args - The arguments to pass to the function.
* @returns The debouncer.
* @example
* ```ts
* debouncer('foo');
* ```
* @official
*/
(...args: [
...T
]): this;
/**
* Cancel any pending debounced function call.
*
* @returns The debouncer.
* @example
* ```ts
* debouncer.cancel();
* ```
* @official
*/
cancel(): this;
/**
* If there is any pending function call, clear the timer and call the function immediately.
*
* @returns The return value of the function or `void` if the are no pending function calls.
* @example
* ```ts
* debouncer.run();
* ```
* @official
* @since 1.4.4
*/
run(): V | void;
}
}
declare module "obsidian" {
/**
* A definition for the position of the menu.
* @since 1.1.0
*/
interface MenuPositionDef {
/**
* Whether the menu should be aligned to the left.
*
* @official
*/
left?: boolean;
/**
* Whether the menu should overlap the position.
*
* @official
*/
overlap?: boolean;
/**
* The width of the menu.
*
* @official
*/
width?: number;
/**
* The x position of the menu.
*
* @official
*/
x: number;
/**
* The y position of the menu.
*
* @official
*/
y: number;
}
}
declare module "obsidian" {
/**
* A dropdown menu allowing selection of a property.
*
* @since 1.10.0
*/
interface PropertyOption extends BaseOption {
/**
* Default value.
*
* @official
* @since 1.10.0
*/
default?: string;
/**
* If provided, only properties which pass the filter will be included for selection in the property dropdown.
*
* @param prop - The property to filter.
* @returns A boolean indicating whether the property should be included.
* @official
* @since 1.10.0
*/
filter?: (prop: BasesPropertyId) => boolean;
/**
* Placeholder.
*
* @official
* @since 1.10.0
*/
placeholder?: string;
/**
* Type.
*
* @official
* @since 1.10.0
*/
type: "property";
}
}
declare module "obsidian" {
/**
* A file.
* @since 0.9.7
*/
interface TFile extends TAbstractFile {
/**
* The basename of the file (name without extension).
*
* @official
* @since 0.9.7
*/
basename: string;
/**
* The extension of the file.
*
* @official
* @since 0.9.7
*/
extension: string;
/**
* The name of the file (with extension).
*
* @official
*/
name: string;
/**
* Whether the file is being saved.
*
* @unofficial
*/
saving: boolean;
/**
* The stats of the file.
*
* @official
* @since 0.9.7
*/
stat: FileStats;
/**
* Caches file's content, that can be retrieved via `await app.vault.cachedRead(file)`.
*
* @param content The content to cache. If `null`, the cache is cleared.
* @unofficial
*/
cache(content: string | null): void;
/**
* Gets the short name of the file.
*
* For `a/b/c.md`, it returns `c`.
*
* For `a/b/c.any-other-extension` it returns `c.any-other-extension`.
*
* @returns The short name of the file.
* @unofficial
*/
getShortName(): string;
/**
* Removes the file from the cache if its content length greater than `app.vault.cacheLimit`.
*
* @unofficial
*/
updateCacheLimit(): unknown;
}
}
declare module "obsidian" {
/**
* A folder.
* @since 0.9.7
*/
interface TFolder extends TAbstractFile {
/**
* The children of the folder.
*
* @official
* @since 0.9.7
*/
children: TAbstractFile[];
/**
* Gets the count of files in the folder.
*
* @returns The number of files in the folder.
* @unofficial
*/
getFileCount(): number;
/**
* Gets the count of subfolders in the folder.
*
* @returns The number of subfolders in the folder.
* @unofficial
*/
getFolderCount(): number;
/**
* Returns the prefix of the folder path.
*
* If the folder is in the root '/', it returns an empty string.
* If the folder is 'a/b/c', it returns 'a/b/'.
*
* @returns The prefix of the folder.
* @unofficial
*/
getParentPrefix(): string;
/**
* Check if the folder is the root folder.
*
* @returns Whether the folder is the root folder.
* @official
* @since 0.9.7
*/
isRoot(): boolean;
}
}
declare module "obsidian" {
/**
* A group of BasesEntry objects for a given value of the groupBy key.
* If there are entries in the results which do not have a value for the
* groupBy key, the key will be the {@link NullValue}.
*
* @since 1.10.0
*/
interface BasesEntryGroup {
/**
* Entries in this group.
*
* @official
* @since 1.10.0
*/
entries: BasesEntry[];
/**
* The value of the groupBy key for this entry group.
*
* @official
* @since 1.10.0
*/
key?: Value;
/**
* Whether this entry group has a non-null key.
*
* @returns `true` iff this entry group has a non-null key.
* @official
* @since 1.10.0
*/
hasKey(): boolean;
}
}
declare module "obsidian" {
/**
* A handler for `obsidian://` URLs.
*
* @param params - The parameters of the `obsidian://` URL.
* @returns The result of the handler. The result is discarded. Usually it's `void` or `Promise<void>`.
*
* @deprecated - Added only for typing purposes. Use {@link ObsidianProtocolHandler} instead.
*/
type ObsidianProtocolHandler__ = (params: ObsidianProtocolData) => any;
}
declare module "obsidian" {
/**
* A hotkey.
*
* @example
* ```ts
* const hotkey: Hotkey = { modifiers: ['Mod'], key: 'a' };
* ```
*/
interface Hotkey {
/**
* The main key of the hotkey.
*
* @example
* ```ts
* console.log(hotkey.key); // a
* ```
* @official
*/
key: string;
/**
* The modifiers of the hotkey.
*
* @example
* ```ts
* console.log(hotkey.modifiers); // ['Mod']
* ```
* @official
*/
modifiers: Modifier[];
}
}
declare module "obsidian" {
/**
* A hover popover.
* @since 0.15.0
*/
interface HoverPopover extends Component {
/**
* The HTML element representation of the hover popover.
*
* @official
*/
hoverEl: HTMLElement;
/**
* The state of the hover popover.
*
* @official
*/
state: PopoverState;
/**
* Create a new hover popover.
*
* @param parent - The parent of the hover popover.
* @param targetEl - The target element of the hover popover.
* @param waitTime - The wait time of the hover popover.
* @param staticPos - The static position of the hover popover.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(parent: HoverParent, targetEl: HTMLElement | null, waitTime?: number, staticPos?: Point | null): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
watchResize(): void;
}
}
declare module "obsidian" {
/**
* A menu item.
*/
interface MenuItem {
/**
* Whether the menu item is checked.
*
* @unofficial
*/
checked: boolean | null;
/**
* Check icon element of the menu item, only present if the item is checked.
*
* @unofficial
*/
checkIconEl?: HTMLElement;
/**
* Whether the menu item is disabled.
*
* @unofficial
*/
disabled: boolean;
/**
* Dom element of the menu item.
*
* @unofficial
*/
dom: HTMLElement;
/**
* Icon element of the menu item.
*
* @unofficial
*/
iconEl: HTMLElement;
/**
* Menu the item is in.
*
* @unofficial
*/
menu: Menu;
/**
* The section the item belongs to.
*
* @unofficial
*/
section: string;
/**
* The submenu that is attached to the item.
*
* @unofficial
*/
submenu: Menu | null;
/**
* Title of the menu item.
*
* @unofficial
*/
titleEl: HTMLElement;
/**
* The callback that is executed when the menu item is clicked.
*
* @unofficial
*/
callback?(): void;
/**
* Private constructor. Use {@link Menu.addItem} instead.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__?(): this;
/**
* Executes the callback of the onClick event (if not disabled).
*
* @param e - Mouse or keyboard event.
* @unofficial
*/
handleEvent(e: MouseEvent | KeyboardEvent): void;
/**
* Set the callback function to be called when the menu item is clicked.
*
* @param callback - The callback function.
* @returns The menu item instance.
* @example
* ```ts
* menuItem.onClick(() => {
* console.log('Menu item clicked');
* });
* ```
* @official
*/
onClick(callback: (evt: MouseEvent | KeyboardEvent) => any): this;
/**
* Remove the icon element from the menu item.
*
* @unofficial
*/
removeIcon(): void;
/**
* Calls `setChecked`, prefer usage of that function instead.
*
* @param active - Whether the menu item should be checked.
* @deprecated
* @unofficial
*/
setActive(active: boolean): this;
/**
* Set the checked state of the menu item.
*
* @param checked - Whether the menu item is checked.
* @returns The menu item instance.
* @example
* ```ts
* menuItem.setChecked(true);
* ```
* @official
*/
setChecked(checked: boolean | null): this;
/**
* Set the disabled state of the menu item.
*
* @param disabled - Whether the menu item is disabled.
* @returns The menu item instance.
* @example
* ```ts
* menuItem.setDisabled(true);
* ```
* @official
*/
setDisabled(disabled: boolean): this;
/**
* Set the icon of the menu item.
*
* @param icon - ID of the icon, can use any icon loaded with {@link addIcon} or from the built-in lucide library.
* @see The Obsidian icon library includes the {@link https://lucide.dev/ Lucide icon library}, any icon name from their site will work here.
* @returns The menu item instance.
* @example
* ```ts
* menuItem.setIcon('dice');
* ```
* @official
*/
setIcon(icon: IconName | null): this;
/**
* Set the menu item to be a label.
*
* @param isLabel - Whether the menu item is a label.
* @returns The menu item instance.
* @example
* ```ts
* menuItem.setIsLabel(true);
* ```
* @official
* @since 0.15.0
*/
setIsLabel(isLabel: boolean): this;
/**
* Sets the section this menu item should belong in.
* To find the section IDs of an existing menu, inspect the DOM elements
* to see their `data-section` attribute.
*
* @param section - The section of the menu item.
* @returns The menu item instance.
* @example
* ```ts
* menuItem.setSection('danger');
* ```
* @official
*/
setSection(section: string): this;
/**
* Create a submenu on the menu item.
*
* @tutorial Creates the foldable menus with more options as seen when you right-click in the editor (e.g. 'Insert', 'Format', ...).
* @unofficial
*/
setSubmenu(): Menu;
/**
* Set the title of the menu item.
*
* @param title - The title of the menu item.
* @returns The menu item instance.
* @example
* ```ts
* menuItem.setTitle('foo');
*
* const fragment = createFragment();
* fragment.createEl('strong', { text: 'bar' });
* menuItem.setTitle(fragment);
* ```
* @official
*/
setTitle(title: string | DocumentFragment): this;
/**
* Add warning styling to the menu item.
*
* @param warning - Whether the menu item should be styled as a warning.
* If set to `true` the MenuItem's title and icon will become red. Or whatever color is applied to the class 'is-warning' by a theme.
* @unofficial
* @since 0.15.0
*/
setWarning(warning: boolean): this;
}
}
declare module "obsidian" {
/**
* A parent for hover links.
* @since 0.11.13
*/
interface HoverParent {
/**
* The hover popover.
*
* @official
* @since 0.11.13
*/
hoverPopover: HoverPopover | null;
}
}
declare module "obsidian" {
/**
* A parsed version of the {@link BasesPropertyId}.
*
* @since 1.10.0
*/
interface BasesProperty {
/**
* Name.
*
* @official
* @since 1.10.0
*/
name: string;
/**
* Type.
*
* @official
* @since 1.10.0
*/
type: BasesPropertyType;
}
}
declare module "obsidian" {
/**
* A post processor receives an element which is a section of the preview.
*
* Post processors can mutate the DOM to render various things, such as mermaid graphs, latex equations, or custom controls.
*
* If your post processor requires lifecycle management, for example, to clear an interval, kill a subprocess, etc when this element is
* removed from the app, look into {@link MarkdownPostProcessorContext.addChild}
* @since 0.10.12
*/
interface MarkdownPostProcessor {
/**
* The processor function itself.
*
* @official
*/
(el: HTMLElement, ctx: MarkdownPostProcessorContext): Promise<any> | void;
/**
* An optional integer sort order. Defaults to 0. Lower number runs before higher numbers.
*
* @official
*/
sortOrder?: number;
}
}
declare module "obsidian" {
/**
* A reference to a link.
*/
interface ReferenceCache extends Reference, CacheItem {
}
}
declare module "obsidian" {
/**
* A renderer for markdown.
* @since 0.9.7
*/
interface MarkdownRenderer extends MarkdownRenderChild, MarkdownPreviewEvents, HoverParent {
/**
* The Obsidian app instance.
*
* @official
*/
app: App;
/**
* The hover popover of the markdown renderer.
*
* @official
*/
hoverPopover: HoverPopover | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
get path(): unknown;
/**
* The file of the markdown renderer.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link file} instead.
*/
file__?(): TFile;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onCheckboxClick(e: unknown, n: unknown, i: unknown): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onFileChange(e: unknown): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onFoldChange(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onload(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onRenderComplete(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onScroll(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
postProcess(e: unknown, t: unknown, n: unknown): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
resolveLinks(e: unknown): unknown;
}
namespace MarkdownRenderer {
/**
* Renders Markdown string to an HTML element.
*
* @param app - A reference to the app object.
* @param markdown - The Markdown source code.
* @param el - The element to append to.
* @param sourcePath - The normalized path of this Markdown file, used to resolve relative internal links.
* @param component - A parent component to manage the lifecycle of the rendered child components.
* @returns A promise that resolves when the markdown is rendered.
*
* @example
* ```ts
* MarkdownRenderer.render(app, '**foo** bar', document.body, 'baz.md', new Component());
* ```
*
* @official
* @deprecated - Added only for typing purposes. Use {@link render} instead.
*/
function render__(app: App, markdown: string, el: HTMLElement, sourcePath: string, component: Component): Promise<void>;
/**
* Renders Markdown string to an HTML element.
*
* @param markdown - The Markdown source code.
* @param el - The element to append to.
* @param sourcePath - The normalized path of this Markdown file, used to resolve relative internal links.
* @param component - A parent component to manage the lifecycle of the rendered child components.
* @returns A promise that resolves when the markdown is rendered.
*
* @example
* ```ts
* MarkdownRenderer.renderMarkdown('**foo** bar', document.body, 'baz.md', new Component());
* ```
*
* @deprecated - use {@link MarkdownRenderer.render}
* @official
* @deprecated - Added only for typing purposes. Use {@link renderMarkdown} instead.
* @since 0.10.6
*/
function renderMarkdown__(markdown: string, el: HTMLElement, sourcePath: string, component: Component): Promise<void>;
}
}
declare module "obsidian" {
/**
* A result of a subpath search.
*/
interface SubpathResult {
/**
* The end location of the subpath.
*
* @official
*/
end: Loc | null;
/**
* The start location of the subpath.
*
* @official
*/
start: Loc;
}
}
declare module "obsidian" {
/**
* A scope receives keyboard events and binds callbacks to given hotkeys.
* Only one scope is active at a time, but scopes may define parent scopes (in the constructor) and inherit their hotkeys.
*/
interface Scope {
/**
* Callback to execute when scope is matched
*
* @unofficial
*/
cb: (() => boolean) | undefined;
/**
* Overridden keys that exist in this scope.
*
* @unofficial
*/
keys: KeyScope[];
/**
* Scope that this scope is a child of
*
* @unofficial
*/
parent: Scope | undefined;
/**
* @todo Documentation incomplete.
* @unofficial
*/
tabFocusContainerEl: HTMLElement | null;
/**
* Create a new scope.
*
* @param parent - The parent scope.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(parent?: Scope): this;
/**
* Execute keypress within this scope.
*
* @param event - Keyboard event.
* @param keypress - Pressed key information.
* @unofficial
*/
handleKey(event: KeyboardEvent, keypress: KeymapInfo): unknown;
/**
* Add a keymap event handler to this scope.
*
* @param modifiers - `Mod`, `Ctrl`, `Meta`, `Shift`, or `Alt`. `Mod` translates to `Meta` on macOS and `Ctrl` otherwise. Pass `null` to capture all events matching the `key`, regardless of modifiers.
* @param key - Keycode from https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key%5FValues.
* @param func - the callback that will be called when a user triggers the keybind.
* @returns The keymap event handler.
* @example
* ```ts
* scope.register(['Ctrl', 'Shift'], 'l', (evt, ctx) => {
* console.log('Ctrl+Shift+L pressed');
* });
* ```
* @official
*/
register(modifiers: Modifier[] | null, key: string | null, func: KeymapEventListener): KeymapEventHandler;
/**
* @todo Documentation incomplete.
* @unofficial
*/
setTabFocusContainer(container: HTMLElement): void;
/**
* Remove an existing keymap event handler.
*
* @param handler - The keymap event handler to remove.
* @example
* ```ts
* scope.unregister(handler);
* ```
* @official
*/
unregister(handler: KeymapEventHandler): void;
}
}
declare module "obsidian" {
/**
* A search component.
* @since 0.9.21
*/
interface SearchComponent extends AbstractTextComponent<HTMLInputElement> {
/**
* The HTML element for the clear button.
*
* @official
* @since 0.9.21
*/
clearButtonEl: HTMLElement;
/**
* The containing element for the component's `clearButtonEl` and `inputEl`.
*
* @unofficial
*/
containerEl: HTMLElement;
/**
* Adds a decorator to the right side of the search component.
*
* @unofficial
*/
addRightDecorator(decoratorFn: (containerEl: HTMLElement) => void): this;
/**
* Create a new search component.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Called when the search component's value changes.
*
* @official
*/
onChanged(): void;
/**
* Adds a class to the search component.
*
* @unofficial
*/
setClass(cls: string): this;
}
}
declare module "obsidian" {
/**
* A search matches.
*
* @deprecated - Added only for typing purposes. Use {@link SearchMatches} instead.
*/
type SearchMatches__ = SearchMatchPart[];
}
declare module "obsidian" {
/**
* A search result container.
* @since 0.9.21
*/
interface SearchResultContainer {
/**
* The search result.
*
* @official
*/
match: SearchResult;
}
}
declare module "obsidian" {
/**
* A search result.
* @since 0.9.21
*/
interface SearchResult {
/**
* The matches of the search result.
*
* @official
*/
matches: SearchMatches;
/**
* The score of the search result.
*
* @official
*/
score: number;
}
}
declare module "obsidian" {
/**
* A secret storage.
* @since 1.11.4
*/
interface SecretStorage {
/**
* Gets a secret from storage
*
* @param id - the secret ID
* @returns the secret value or null if not found
* @official
* @since 1.11.4
*/
getSecret(id: string): string | null;
/**
* Loads all secrets from storage
*
* @official
* @since 1.11.4
* @deprecated - Added only for typing purposes. Use {@link loadSecrets} instead.
*/
loadSecrets__(): void;
/**
* Lists all secrets in storage
*
* @returns array of secret IDs
* @official
* @since 1.11.4
*/
listSecrets(): string[];
/**
* Sets a secret in the storage.
*
* @param id - lowercase alphanumeric ID with optional dashes
* @param secret - the secret value to store
* @throws Error if ID is invalid
* @official
* @since 1.11.4
*/
setSecret(id: string, secret: string): void;
}
}
declare module "obsidian" {
/**
* A separator for the menu.
* @since 0.15.3
*/
interface MenuSeparator {
}
}
declare module "obsidian" {
/**
* A setting tab.
*
* @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings#Register+a+settings+tab}.
* @since 0.9.7
*/
interface SettingTab {
/**
* Reference to the app instance.
*
* @official
*/
app: App;
/**
* HTML element for the setting tab content.
*
* @official
*/
containerEl: HTMLElement;
/**
* The icon to display in the settings sidebar.
*
* @official
* @since 1.11.0
*/
icon: IconName;
/**
* Unique ID of the tab.
*
* @unofficial
*/
id: string;
/**
* Reference to installed plugins element.
*
* Tab is the community plugins tab.
*
* @unofficial
*/
installedPluginsEl?: HTMLElement;
/**
* Sidebar name of the tab.
*
* @unofficial
*/
name: string;
/**
* Sidebar navigation element of the tab.
*
* @unofficial
*/
navEl: HTMLElement;
/**
* Reference to the plugin that initialized the tab.
*
* Tab is a plugin tab.
*
* @unofficial
*/
plugin?: Plugin;
/**
* Reference to the settings modal.
*
* @unofficial
*/
setting: Setting;
/**
* Called when the settings tab should be rendered.
* @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings#Register+a+settings+tab}.
* @official
* @deprecated - Added only for typing purposes. Use {@link display} instead.
*/
display__?(): void;
/**
* Hides the contents of the setting tab.
* Any registered components should be unloaded when the view is hidden.
* Override this if you need to perform additional cleanup.
*
* @official
*/
hide(): void;
}
}
declare module "obsidian" {
/**
* A setting.
* @since 0.9.7
*/
interface Setting {
/**
* The components for the setting.
*
* @official
* @since 0.9.7
*/
components: BaseComponent[];
/**
* The HTML element for the control.
*
* @official
* @since 0.9.7
*/
controlEl: HTMLElement;
/**
* The HTML element for the description.
*
* @official
* @since 0.9.7
*/
descEl: HTMLElement;
/**
* The HTML element for the info.
*
* @official
* @since 0.9.7
*/
infoEl: HTMLElement;
/**
* The HTML element for the name.
*
* @official
* @since 0.9.7
*/
nameEl: HTMLElement;
/**
* The HTML element for the setting.
*
* @official
* @since 0.9.7
*/
settingEl: HTMLElement;
/**
* Add a button to the setting.
*
* @param cb - The callback to add the button.
* @returns The setting.
* @example
* ```ts
* setting.addButton((button) => {
* button.setText('foo');
* });
* ```
* @official
* @since 0.9.7
*/
addButton(cb: (component: ButtonComponent) => any): this;
/**
* Add a color picker component to the setting.
*
* @param cb - The callback to add the color picker component.
* @returns The setting.
* @example
* ```ts
* setting.addColorPicker((colorPicker) => {
* colorPicker.setValue('#000000');
* });
* ```
* @official
*/
addColorPicker(cb: (component: ColorComponent) => any): this;
/**
* Add a component to the setting.
*
* @param cb - The callback to add the component.
* @returns The setting.
* @example
* ```ts
* setting.addComponent((el) => {
* return new TextComponent(el);
* });
* @official
* @since 1.11.0
*/
addComponent<T extends BaseComponent>(cb: (el: HTMLElement) => T): this;
/**
* Add a dropdown component to the setting.
*
* @param cb - The callback to add the dropdown component.
* @returns The setting.
* @example
* ```ts
* setting.addDropdown((dropdown) => {
* dropdown.addOption('foo', 'bar');
* });
* ```
* @official
*/
addDropdown(cb: (component: DropdownComponent) => any): this;
/**
* Add an extra button to the setting.
*
* @param cb - The callback to add the extra button.
* @returns The setting.
* @example
* ```ts
* setting.addExtraButton((extraButton) => {
* extraButton.setIcon('dice');
* });
* ```
* @official
* @since 0.9.16
*/
addExtraButton(cb: (component: ExtraButtonComponent) => any): this;
/**
* Add a moment format component to the setting.
*
* @param cb - The callback to add the moment format component.
* @returns The setting.
* @example
* ```ts
* setting.addMomentFormat((momentFormat) => {
* momentFormat.setValue('YYYY-MM-DD');
* });
* ```
* @official
* @since 0.9.7
*/
addMomentFormat(cb: (component: MomentFormatComponent) => any): this;
/**
* Add a progress bar component to the setting.
*
* @param cb - The callback to add the progress bar component.
* @returns The setting.
* @example
* ```ts
* setting.addProgressBar((progressBar) => {
* progressBar.setValue(50);
* });
* ```
* @official
*/
addProgressBar(cb: (component: ProgressBarComponent) => any): this;
/**
* Add a search component to the setting.
*
* @param cb - The callback to add the search component.
* @returns The setting.
* @example
* ```ts
* setting.addSearch((search) => {
* search.setValue('foo');
* });
* ```
* @official
* @since 0.9.21
*/
addSearch(cb: (component: SearchComponent) => any): this;
/**
* Add a slider component to the setting.
*
* @param cb - The callback to add the slider component.
* @returns The setting.
* @example
* ```ts
* setting.addSlider((slider) => {
* slider.setValue(50);
* });
* ```
* @official
* @since 0.9.7
*/
addSlider(cb: (component: SliderComponent) => any): this;
/**
* Add a text component to the setting.
*
* @param cb - The callback to add the text component.
* @returns The setting.
* @example
* ```ts
* setting.addText((text) => {
* text.setValue('foo');
* });
* ```
* @official
* @since 0.9.7
*/
addText(cb: (component: TextComponent) => any): this;
/**
* Add a text area component to the setting.
*
* @param cb - The callback to add the text area component.
* @returns The setting.
* @example
* ```ts
* setting.addTextArea((textArea) => {
* textArea.setValue('foo');
* });
* ```
* @official
* @since 0.9.7
*/
addTextArea(cb: (component: TextAreaComponent) => any): this;
/**
* Add a toggle to the setting.
*
* @param cb - The callback to add the toggle.
* @returns The setting.
* @example
* ```ts
* setting.addToggle((toggle) => {
* toggle.setValue(true);
* });
* ```
* @official
* @since 0.9.7
*/
addToggle(cb: (component: ToggleComponent) => any): this;
/**
* Clear the setting.
*
* @returns The setting.
* @example
* ```ts
* setting.clear();
* ```
* @official
* @since 0.13.8
*/
clear(): this;
/**
* Create a new setting.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Set the class of the setting.
*
* @param cls - The class of the setting.
* @returns The setting.
* @example
* ```ts
* setting.setClass('foo');
* ```
* @official
* @since 0.9.7
*/
setClass(cls: string): this;
/**
* Set the description of the setting.
*
* @param desc - The description of the setting.
* @returns The setting.
* @example
* ```ts
* setting.setDesc('foo');
* ```
* @official
* @since 0.9.7
*/
setDesc(desc: string | DocumentFragment): this;
/**
* Disable the setting.
*
* @param disabled - Whether to disable the setting.
* @returns The setting.
* @example
* ```ts
* setting.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Make the setting a heading.
*
* @returns The setting.
* @example
* ```ts
* setting.setHeading();
* ```
* @official
* @since 0.9.16
*/
setHeading(): this;
/**
* Set the name of the setting.
*
* @param name - The name of the setting.
* @returns The setting.
* @example
* ```ts
* setting.setName('foo');
*
* const fragment = createFragment();
* fragment.createEl('strong', { text: 'bar' });
* setting.setName(fragment);
* ```
* @official
* @since 0.12.16
*/
setName(name: string | DocumentFragment): this;
/**
* Hide the info section of the setting.
*
* @unofficial
*/
setNoInfo(): this;
/**
* Set the tooltip of the setting.
*
* @param tooltip - The tooltip of the setting.
* @returns The setting.
* @example
* ```ts
* setting.setTooltip('foo');
* ```
* @official
* @since 1.1.0
*/
setTooltip(tooltip: string, options?: TooltipOptions): this;
/**
* Shows/hides the setting.
*
* @param visible Whether the setting should be visible.
* @unofficial
*/
setVisibility(visible: boolean): this;
/**
* Facilitates chaining.
*
* @param cb - The callback to chain.
* @returns The setting.
* @example
* ```ts
* setting.then((x) => {
* x.setName('foo');
* });
* ```
* @official
* @since 0.9.20
*/
then(cb: (setting: this) => any): this;
}
}
declare module "obsidian" {
/**
* A slider component.
* @since 0.9.7
*/
interface SliderComponent extends ValueComponent<number> {
/**
* The HTML element that represents the slider.
*
* @official
*/
sliderEl: HTMLInputElement;
/**
* The function that's called after changing the value of the component.
*
* @remark Using `SliderComponent.onChange(callback)` assigns the callback to this method.
* @unofficial
*/
changeCallback?(value: number): void;
/**
* Create a new slider component.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Get the value of the slider.
*
* @returns The value of the slider.
* @official
* @since 0.9.7
*/
getValue(): number;
/**
* Get the pretty value of the slider.
*
* @returns The pretty value of the slider.
* @official
* @since 0.9.7
*/
getValuePretty(): string;
/**
* Set the callback to be called when the slider value changes.
*
* @param callback - The callback to be called when the slider value changes.
* @returns The slider.
* @example
* ```ts
* slider.onChange((value) => {
* console.log(value);
* });
* ```
* @official
* @since 0.9.7
*/
onChange(callback: (value: number) => any): this;
/**
* Disable the slider.
*
* @param disabled - Whether to disable the slider.
* @returns The slider.
* @example
* ```ts
* slider.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Set the dynamic tooltip of the slider.
*
* @returns The slider.
* @official
* @since 0.9.7
*/
setDynamicTooltip(): this;
/**
* Set whether or not the value should get updated while the slider is dragging.
*
* @param instant - Whether or not the value should get updated while the slider is dragging.
* @returns The slider.
* @example
* ```ts
* slider.setInstant(true);
* ```
* @official
* @since 1.6.6
*/
setInstant(instant: boolean): this;
/**
* Set the limits of the slider.
*
* @param min - The minimum value.
* @param max - The maximum value.
* @param step - The step value.
* @returns The slider.
* @example
* ```ts
* slider.setLimits(0, 100, 1);
* ```
* @official
* @since 0.9.7
*/
setLimits(min: number, max: number, step: number | "any"): this;
/**
* Set the value of the slider.
*
* @param value - The value to set.
* @returns The slider.
* @example
* ```ts
* slider.setValue(50);
* ```
* @official
* @since 0.9.7
*/
setValue(value: number): this;
/**
* Show the tooltip of the slider.
*
* @official
* @since 0.9.7
*/
showTooltip(): void;
}
}
declare module "obsidian" {
/**
* A source for hover links.
*/
interface HoverLinkSource {
/**
* Whether the `hover-link` event requires the 'Mod' key to be pressed to trigger.
*
* @official
*/
defaultMod: boolean;
/**
* Text displayed in the 'Page preview' plugin settings.
* It should match the plugin's display name.
*
* @official
*/
display: string;
}
}
declare module "obsidian" {
/**
* A stat for a file or folder.
*/
interface Stat {
/**
* Time of creation, represented as a unix timestamp.
*
* @official
*/
ctime: number;
/**
* Time of last modification, represented as a unix timestamp.
*
* @official
*/
mtime: number;
/**
* Size on disk in bytes.
*
* @official
*/
size: number;
/**
* The type of the stat.
*
* @official
*/
type: "file" | "folder";
}
}
declare module "obsidian" {
/**
* A sub view of the markdown view.
*/
interface MarkdownSubView {
/**
* Apply the scroll position.
*
* @param scroll - The scroll position.
* @example
* ```ts
* markdownSubView.applyScroll(100);
* ```
* @official
*/
applyScroll(scroll: number): void;
/**
* Get the markdown content.
*
* @official
*/
get(): string;
/**
* Get the scroll position.
*
* @official
*/
getScroll(): number;
/**
* Set the markdown content.
*
* @param data - The markdown content.
* @param clear - Whether to clear the content before setting it.
* @example
* ```ts
* markdownSubView.set('**foo** bar', true);
* ```
* @official
*/
set(data: string, clear: boolean): void;
}
}
declare module "obsidian" {
/**
* A suggest modal.
*
* @typeParam T - The type of the suggestion items.
*/
interface SuggestModal<T> extends Modal, ISuggestOwner<T> {
/**
* @todo Documentation incomplete.
* @unofficial
*/
chooser: SuggestModalChooser<T, this>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
clearButtonEl: HTMLDivElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
ctaEl: HTMLDivElement;
/**
* The text to display when there are no suggestions.
*
* @official
* @since 0.9.20
*/
emptyStateText: string;
/**
* The input element.
*
* @official
*/
inputEl: HTMLInputElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
instructionsEl: HTMLDivElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
isOpen: boolean;
/**
* The limit of the number of suggestions.
*
* @official
*/
limit: number;
/**
* The result container element.
*
* @official
* @since 0.9.20
*/
resultContainerEl: HTMLElement;
/**
* Create a suggest modal.
*
* @param app - The Obsidian app instance .
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(app: App): this;
/**
* Get the suggestions.
*
* @param query - The query to get the suggestions for.
* @returns The suggestions.
* @example
* ```ts
* class MySuggestModal extends SuggestModal<string> {
* public override getSuggestions(query: string): string[] {
* return ['foo', 'bar'];
* }
* }
* ```
* @example
* ```ts
* class MySuggestModal extends SuggestModal<string> {
* public override async getSuggestions(query: string): Promise<string[]> {
* return Promise.resolve(['foo', 'bar']);
* }
* }
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link getSuggestions} instead.
* @since 1.5.7
*/
getSuggestions__(query: string): T[] | Promise<T[]>;
/**
* Choose a suggestion.
*
* @param item - The item to choose.
* @param evt - The event that triggered the choice.
* @example
* ```ts
* class MySuggestModal extends SuggestModal<string> {
* public override onChooseSuggestion(item: string, evt: MouseEvent | KeyboardEvent): void {
* console.log(item);
* }
* }
* @official
* @deprecated - Added only for typing purposes. Use {@link onChooseSuggestion} instead.
* @since 1.5.7
*/
onChooseSuggestion__(item: T, evt: MouseEvent | KeyboardEvent): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onInput(): void;
/**
* Set the callback to be called when there are no suggestions.
*
* @param callback - The callback to be called when there are no suggestions.
* @official
* @since 0.9.20
*/
onNoSuggestion(): void;
/**
* Render a suggestion.
*
* @param value - The value of the suggestion.
* @param el - The element to render the suggestion to.
* @example
* ```ts
* class MySuggestModal extends SuggestModal<string> {
* public override renderSuggestion(value: string, el: HTMLElement): void {
* el.createEl('strong', { text: value });
* }
* }
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link renderSuggestion} instead.
* @since 1.5.7
*/
renderSuggestion__(value: T, el: HTMLElement): void;
/**
* Select the active suggestion.
*
* @param evt - The event that triggered the selection.
* @official
* @since 1.7.2
*/
selectActiveSuggestion(evt: MouseEvent | KeyboardEvent): void;
/**
* Select a suggestion.
*
* @param value - The value of the suggestion.
* @param evt - The event that triggered the selection.
* @official
* @since 0.9.20
*/
selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void;
/**
* Set the instructions.
*
* @param instructions - The instructions.
* @official
* @since 0.9.20
*/
setInstructions(instructions: Instruction[]): void;
/**
* Set the placeholder text.
*
* @param placeholder - The placeholder text.
* @official
* @since 0.9.20
*/
setPlaceholder(placeholder: string): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
updateSuggestions(): void;
}
}
declare module "obsidian" {
/**
* A task manager.
* @since 0.10.2
*/
interface Tasks {
/**
* Add a task.
*
* @param callback - The callback to add the task.
* @official
* @since 0.10.2
*/
add(callback: () => Promise<any>): void;
/**
* Add a promise.
*
* @param promise - The promise to add.
* @official
* @since 0.10.2
*/
addPromise(promise: Promise<any>): void;
/**
* Check if the tasks are empty.
*
* @returns Whether the tasks are empty.
* @official
* @since 0.10.2
*/
isEmpty(): boolean;
/**
* Get the promise.
*
* @returns The promise.
* @official
*/
promise(): Promise<any>;
}
}
declare module "obsidian" {
/**
* A text area component.
* @since 0.9.7
*/
interface TextAreaComponent extends AbstractTextComponent<HTMLTextAreaElement> {
/**
* Create a new text area component.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
}
}
declare module "obsidian" {
/**
* A text component.
* @since 0.9.21
*/
interface TextComponent extends AbstractTextComponent<HTMLInputElement> {
/**
* Create a new text component.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
}
}
declare module "obsidian" {
/**
* A text input allowing selection of a file from in the vault.
*
* @since 1.10.2
*/
interface FileOption extends BaseOption {
/**
* The default value of the option.
*
* @official
* @since 1.10.2
*/
default?: string;
/**
* Filter the files to be displayed in the file picker.
*
* @param file - The file to filter.
* @returns `true` if the file should be displayed, `false` otherwise.
* @official
* @since 1.10.2
*/
filter?: (file: TFile) => boolean;
/**
* The placeholder of the option.
*
* @official
* @since 1.10.2
*/
placeholder?: string;
/**
* The type of the option.
*
* @official
* @since 1.10.2
*/
type: "file";
}
}
declare module "obsidian" {
/**
* A text input allowing selection of a folder from in the vault.
*
* @since 1.10.2
*/
interface FolderOption extends BaseOption {
/**
* The default value of the option.
*
* @official
* @since 1.10.2
*/
default?: string;
/**
* Filter the folders to be displayed in the folder picker.
*
* @param folder - The folder to filter.
* @returns `true` if the folder should be displayed, `false` otherwise.
* @official
* @since 1.10.2
*/
filter?: (folder: TFolder) => boolean;
/**
* The placeholder of the option.
*
* @official
* @since 1.10.2
*/
placeholder?: string;
/**
* The type of the option.
*
* @official
* @since 1.10.2
*/
type: "folder";
}
}
declare module "obsidian" {
/**
* A text input supporting formula evaluation.
*
* @since 1.10.2
*/
interface FormulaOption extends BaseOption {
/**
* The default value of the option.
*
* @official
* @since 1.10.2
*/
default?: string;
/**
* The placeholder of the option.
*
* @official
* @since 1.10.2
*/
placeholder?: string;
/**
* The type of the option.
*
* @official
* @since 1.10.2
*/
type: "formula";
}
}
declare module "obsidian" {
/**
* A toggle component.
* @since 0.9.7
*/
interface ToggleComponent extends ValueComponent<boolean> {
/**
* The HTML element that represents the toggle.
*
* @official
* @since 0.9.7
*/
toggleEl: HTMLElement;
/**
* The function that's called after changing the value of the component.
*
* @remark Using `ToggleComponent.onChange(callback)` assigns the callback to this method.
* @unofficial
*/
changeCallback?(value: boolean): void;
/**
* Create a new toggle component.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
* @since 0.9.7
*/
constructor__(containerEl: HTMLElement): this;
/**
* Get the value of the toggle.
*
* @returns The value of the toggle.
* @official
* @since 0.9.7
*/
getValue(): boolean;
/**
* Handle the change event of the toggle.
*
* @param callback - The callback to handle the change event.
* @returns The toggle.
* @example
* ```ts
* toggle.onChange((value) => {
* console.log(value);
* });
* ```
* @official
* @since 0.9.7
*/
onChange(callback: (value: boolean) => any): this;
/**
* Handle the click event of the toggle.
*
* @official
* @since 0.9.7
*/
onClick(): void;
/**
* Disable the toggle.
*
* @param disabled - Whether to disable the toggle.
* @returns The toggle.
* @example
* ```ts
* toggle.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Set the tooltip of the toggle.
*
* @param tooltip - The tooltip text to show.
* @param options - The options for the tooltip.
* @returns The toggle.
* @official
* @since 1.1.1
*/
setTooltip(tooltip: string, options?: TooltipOptions): this;
/**
* Set the value of the toggle.
*
* @param on - Whether the toggle is on.
* @returns The toggle.
* @example
* ```ts
* toggle.setValue(true);
* ```
* @official
* @since 0.9.7
*/
setValue(on: boolean): this;
}
}
declare module "obsidian" {
/**
* A value component.
* @since 0.9.7
*/
interface ValueComponent<T> extends BaseComponent {
/**
* Get the value of the component.
*
* @returns The value of the component.
* @official
* @deprecated - Added only for typing purposes. Use {@link getValue} instead.
* @since 0.9.7
*/
getValue__?(): T;
/**
* Register an option listener.
*
* @param listeners - The listeners to register.
* @param key - The key of the option.
* @returns The component.
* @example
* ```ts
* valueComponent.registerOptionListener({
* 'foo': (value) => {
* console.log(value);
* }
* }, 'foo');
* ```
* @official
* @since 0.9.7
*/
registerOptionListener(listeners: Record<string, (value?: T) => T>, key: string): this;
/**
* Set the value of the component.
*
* @param value - The value to set.
* @returns The component.
* @example
* ```ts
* valueComponent.setValue('foo');
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link setValue} instead.
* @since 0.9.7
*/
setValue__(value: T): this;
}
}
declare module "obsidian" {
/**
* A view creator.
*
* @deprecated - Added only for typing purposes. Use {@link ViewCreator} instead.
*/
type ViewCreator__ = (leaf: WorkspaceLeaf) => View;
}
declare module "obsidian" {
/**
* A view for markdown files.
*/
interface MarkdownView extends TextFileView {
/**
* Backlinks component.
*
* @unofficial
*/
backlinks: BacklinkComponent | null;
/**
* The embedded backlinks element for the current file.
*
* @unofficial
*/
backlinksEl: HTMLElement;
/**
* The current mode of the markdown view.
*
* @official
*/
currentMode: MarkdownSubView;
/**
* Editor component of the view.
*
* @unofficial
*/
editMode: MarkdownEditView;
/**
* The editor of the markdown view.
*
* @official
*/
editor: Editor;
/**
* The hover popover of the markdown view.
*
* @official
*/
hoverPopover: HoverPopover | null;
/**
* Editable title element of the view.
*
* @unofficial
*/
inlineTitleEl: HTMLElement;
/**
* Frontmatter editor of the editor.
*
* @unofficial
*/
metadataEditor: MetadataEditor;
/**
* Button for switching between different modes of the view.
*
* @unofficial
*/
modeButtonEl: HTMLAnchorElement;
/**
* The registered modes of the view.
*
* @unofficial
*/
modes: MarkdownViewModes;
/**
* The preview mode of the markdown view.
*
* @official
*/
previewMode: MarkdownPreviewView;
/**
* File frontmatter as a raw string.
*
* @unofficial
*/
rawFrontmatter: string;
/**
* Current scroll position of the editor.
*
* @unofficial
*/
scroll: null | number;
/**
* Whether to show backlinks in the editor.
*
* @unofficial
*/
showBacklinks: boolean;
/**
* @deprecated - CM5 Editor
* @unofficial
*/
sourceMode: MarkdownViewSourceMode;
/**
* Whether the editor can render properties according to the current mode and config.
*
* @unofficial
*/
canShowProperties(): boolean;
/**
* Whether the editor can toggle backlinks according to current mode.
*
* @unofficial
*/
canToggleBacklinks(): boolean;
/**
* Clear the view data of the markdown view.
*
* @official
*/
clear(): void;
/**
* Collapse the properties editor.
*
* @unofficial
*/
collapseProperties(collapse: boolean): void;
/**
* Create a new markdown view.
*
* @param leaf - The workspace leaf to attach the markdown view to.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(leaf: WorkspaceLeaf): this;
/**
* Edit the focused property in the metadata editor.
*
* @remark Parameter is not used.
* @unofficial
*/
editProperty(unused: undefined): void;
/**
* The associated file.
*
* @example
* ```ts
* console.log(markdownFileInfo.file);
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link file} instead.
*/
file__?(): TFile | null;
/**
* Focus on the metadata editor given property information.
*
* @unofficial
*/
focusMetadata(focus?: FocusMetadataOptions): void;
/**
* Gets the ephemeral (non-persistent) state of the editor.
*
* @unofficial
*/
getEphemeralState(): MarkdownViewEphemeralState;
/**
* Get the file attached to the view.
*
* @unofficial
*/
getFile(): TFile | null;
/**
* Get the hover source of the editor.
*
* @unofficial
*/
getHoverSource(): string;
/**
* Get the current mode of the markdown view.
*
* @returns A string representing the current mode.
* @official
*/
getMode(): MarkdownViewModeType;
/**
* Get selection of current mode.
*
* @unofficial
*/
getSelection(): string;
/**
* Get the view data of the markdown view.
*
* @returns A string representing the view data.
* @official
*/
getViewData(): string;
/**
* Get the view type of the markdown view.
*
* @returns A string representing the view type.
* @official - changed the return type.
*/
getViewType(): typeof ViewType.Markdown;
/**
* Validate correctness of frontmatter and update metadata editor.
*
* @unofficial
*/
loadFrontmatter(data: string): void;
/**
* Whether the metadata editor has focus.
*
* @unofficial
*/
metadataHasFocus(): boolean;
/**
* On app css change, update source mode editor.
*
* @unofficial
*/
onCssChange(): void;
/**
* Update editor on external data change (from sync plugin).
*
* @unofficial
*/
onExternalDataChange(file: TFile, data: string): void;
/**
* On blur of inline title, save new filename.
*
* @unofficial
*/
onInlineTitleBlur(): Promise<void>;
/**
* On data change of editor, update internal data and metadata editor.
*
* @unofficial
*/
onInternalDataChange(): void;
/**
* On loading markdown view, register resize, css-change and quick-preview events.
*
* @unofficial
*/
onload(): void;
/**
* On fold of markdown in source editor, save fold info to fold manager.
*
* @unofficial
*/
onMarkdownFold(): void;
/**
* On markdown scroll in editors, update scroll, sync state and trigger markdown scroll event.
*
* @unofficial
*/
onMarkdownScroll(): void;
/**
* On mod click, opens editor of opposite mode in split view to right.
*
* @unofficial
*/
onSwitchView(event: KeyboardEvent | MouseEvent): Promise<void>;
/**
* Opens PDF modal for exporting PDF of the current file.
*
* @unofficial
*/
printToPdf(): void;
/**
* Redo action of source mode editor.
*
* @unofficial
*/
redo(): void;
/**
* Register editor mode component to view.
*
* @unofficial
*/
registerMode(mode: MarkdownSubView): MarkdownSubView;
/**
* Save the frontmatter of the file.
*
* @unofficial
*/
saveFrontmatter(properties: Record<string, any>): void;
/**
* Set the mode of the editor.
*
* @unofficial
*/
setMode(component: MarkdownSubView): Promise<void>;
/**
* Set the view data of the markdown view.
*
* @param data - The view data.
* @param clear - Whether to clear the view data before setting it.
* @example
* ```ts
* markdownView.setViewData('**foo** bar', true);
* ```
* @official
*/
setViewData(data: string, clear: boolean): void;
/**
* Shift focus to first line of editor.
*
* @unofficial
*/
shiftFocusAfter(): void;
/**
* Shift focus to inline title.
*
* @unofficial
*/
shiftFocusBefore(): void;
/**
* Show the search modal.
*
* @param replace - Whether to perform a search & replace.
* - `true` - Perform a search & replace.
* - `false` - Perform a search.
* @example
* ```ts
* markdownView.showSearch(true);
* ```
* @official
*/
showSearch(replace?: boolean): void;
/**
* Toggle backlinks on editor.
*
* @unofficial
*/
toggleBacklinks(): Promise<void>;
/**
* Toggle collapse status of properties editor if allowed.
*
* @unofficial
*/
toggleCollapseProperties(): void;
/**
* Toggle between source and preview mode.
*
* @unofficial
*/
toggleMode(): void;
/**
* Execute functionality of token (open external link, open internal link in leaf, ...).
*
* @unofficial
*/
triggerClickableToken(token: Token, new_leaf: boolean): void;
/**
* Undo action of source mode editor.
*
* @unofficial
*/
undo(): void;
/**
* Update the backlinks component for new file.
*
* @unofficial
*/
updateBacklinks(): void;
/**
* Update reading/source view action buttons of modeButtonEl with current mode.
*
* @unofficial
*/
updateButtons(): void;
/**
* Update options of the editors from settings.
*
* @unofficial
*/
updateOptions(): void;
/**
* Hide/render backlinks component.
*
* @unofficial
*/
updateShowBacklinks(): void;
}
}
declare module "obsidian" {
/**
* A view that displays an item.
* @since 0.9.7
*/
interface ItemView extends View {
/**
* Container of actions for the view.
*
* @unofficial
*/
actionsEl: HTMLElement;
/**
* Back button element for changing view history.
*
* @unofficial
*/
backButtonEl: HTMLButtonElement;
/**
* Whether the view may be dropped anywhere in workspace.
*
* @unofficial
*/
canDropAnywhere: boolean;
/**
* The parent element of the content.
*
* @official
*/
contentEl: HTMLElement;
/**
* Forward button element for changing view history.
*
* @unofficial
*/
forwardButtonEl: HTMLButtonElement;
/**
* Header bar container of view.
*
* @unofficial
*/
headerEl: HTMLElement;
/**
* Icon element for the view (for dragging).
*
* @unofficial
*/
iconEl: HTMLElement;
/**
* Anchor button for revealing more view actions.
*
* @unofficial
*/
moreOptionsButtonEl: HTMLAnchorElement;
/**
* Container for the title of the view.
*
* @unofficial
*/
titleContainerEl: HTMLElement;
/**
* Title element for the view.
*
* @unofficial
*/
titleEl: HTMLElement;
/**
* Title of the parent.
*
* @remark Used for breadcrumbs rendering.
* @unofficial
*/
titleParentEl: HTMLElement;
/**
* Add an action to the item view.
*
* @param icon - The icon of the action.
* @param title - The title of the action.
* @param callback - The callback to call when the action is clicked.
* @returns The DOM element of the action.
* @example
* ```ts
* const action = itemView.addAction('dice', 'foo', () => {
* console.log('bar');
* });
* ```
* @official
* @since 1.1.0
*/
addAction(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
/**
* Create a new item view.
*
* @param leaf - The workspace leaf to create the item view in.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(leaf: WorkspaceLeaf): this;
/**
* @todo Documentation incomplete.
* @unofficial
*/
handleDrop(event: DragEvent, draggable: Draggable, isOver: boolean): DropResult | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onGroupChange(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onMoreOptions(event: Event): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onMoreOptionsMenu(e: unknown): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
updateNavButtons(): void;
}
}
declare module "obsidian" {
/**
* A workspace.
* @since 0.9.7
*/
interface Workspace extends Events {
/**
* A component managing the current editor.
* This can be `null` if the active view has no editor.
*
* @official
*/
activeEditor: MarkdownFileInfo | null;
/**
* Indicates the currently focused leaf, if one exists.
*
* Please avoid using `activeLeaf` directly, especially without checking whether
* `activeLeaf` is null.
*
* @deprecated The use of this field is discouraged.
* The recommended alternatives are:
* - If you need information about the current view, use {@link Workspace.getActiveViewOfType}.
* - If you need to open a new file or navigate a view, use {@link Workspace.getLeaf}.
* @official
* @since 0.9.7
*/
activeLeaf: WorkspaceLeaf | null;
/**
* Currently active tab group.
*
* @unofficial
*/
activeTabGroup: WorkspaceTabs;
/**
* Reference to App.
*
* @unofficial
*/
app: App;
/**
* @todo Documentation incomplete.
* @unofficial
*/
backlinkInDocument?: unknown;
/**
* The container element of the workspace.
*
* @official
* @since 0.9.7
*/
containerEl: HTMLElement;
/**
* Registered CodeMirror editor extensions, to be applied to all CM instances.
*
* @unofficial
*/
editorExtensions: Extension[];
/**
* @todo Documentation incomplete.
* @unofficial
*/
editorSuggest: EditorSuggestEx;
/**
* @todo Documentation incomplete.
* @unofficial
*/
floatingSplit: WorkspaceSplit;
/**
* @todo Documentation incomplete.
* @unofficial
*/
hoverLinkSources: WorkspaceHoverLinkSourcesRecord;
/**
* Last opened file in the vault.
*
* @unofficial
*/
lastActiveFile: TFile;
/**
* @todo Documentation incomplete.
* @unofficial
*/
lastTabGroupStacked: boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
layoutItemQueue: unknown[];
/**
* Whether the layout of the app has been successfully initialized.
* To react to the layout becoming ready, use {@link Workspace.onLayoutReady}
*
* @official
* @since 0.9.7
*/
layoutReady: boolean;
/**
* The left ribbon of the workspace.
*
* @official
* @since 0.9.7
*/
leftRibbon: WorkspaceRibbon;
/**
* @todo Documentation incomplete.
* @unofficial
*/
leftSidebarToggleButtonEl: HTMLElement;
/**
* The left split of the workspace.
*
* @official
* @since 0.9.7
*/
leftSplit: WorkspaceSidedock | WorkspaceMobileDrawer;
/**
* Array of renderCallbacks
*
* @unofficial
*/
mobileFileInfos: unknown[];
/**
* @todo Documentation incomplete.
* @unofficial
*/
onLayoutReadyCallbacks?: unknown;
/**
* Protocol handlers registered on the workspace.
*
* @unofficial
*/
protocolHandlers: Map<string, ObsidianProtocolHandler>;
/**
* Tracks last opened files in the vault.
*
* @unofficial
*/
recentFileTracker: RecentFileTracker;
/**
* Save the state of the current workspace layout.
*
* @official
* @since 0.16.0
*/
requestSaveLayout: Debouncer<[
], Promise<void>>;
/**
* The right ribbon of the workspace.
*
* @deprecated No longer used
* @official
*/
rightRibbon: WorkspaceRibbon;
/**
* @todo Documentation incomplete.
* @unofficial
*/
rightSidebarToggleButtonEl: HTMLElement;
/**
* The right split of the workspace.
*
* @official
* @since 0.9.7
*/
rightSplit: WorkspaceSidedock | WorkspaceMobileDrawer;
/**
* The root split of the workspace.
*
* @official
* @since 0.9.7
*/
rootSplit: WorkspaceRoot;
/**
* Keyscope registered to the vault
*
* @unofficial
*/
scope: Scope;
/**
* List of states that were closed and may be reopened.
*
* @unofficial
*/
undoHistory: StateHistory[];
/**
* Change active leaf and trigger leaf change event
*
* @unofficial
*/
activeLeafEvents(): void;
/**
* Add file to mobile file info
*
* @unofficial
*/
addMobileFileInfo(file: unknown): void;
/**
* Change the layout of the workspace.
*
* @param workspace - The workspace to change the layout to.
* @returns A promise that resolves when the layout is changed.
* @official
* @since 0.9.7
*/
changeLayout(workspace: any): Promise<void>;
/**
* Clear layout of workspace and destruct all leaves
*
* @unofficial
*/
clearLayout(): Promise<void>;
/**
* Create a leaf by a split.
*
* @param leaf - The leaf to create the leaf by.
* @param direction - The direction to create the leaf in.
* @param before - Whether to create the leaf before the current leaf.
* @returns The leaf that was created.
* @official
* @since 0.9.7
*/
createLeafBySplit(leaf: WorkspaceLeaf, direction?: SplitDirection, before?: boolean): WorkspaceLeaf;
/**
* Create a leaf in a parent.
*
* @param parent - The parent to create the leaf in.
* @param index - The index to create the leaf in.
* @returns The leaf that was created.
* @official
* @since 0.9.11
*/
createLeafInParent(parent: WorkspaceSplit, index: number): WorkspaceLeaf;
/**
* Create a leaf in the selected tab group or last used tab group.
*
* @param tabs Tab group to create leaf in.
* @unofficial
*/
createLeafInTabGroup(tabs?: WorkspaceTabs): WorkspaceLeaf;
/**
* Deserialize workspace entries into actual Leaf objects.
*
* @param leaf - Leaf entry to deserialize.
* @param ribbon - Whether the leaf belongs to the left or right ribbon.
* @unofficial
*/
deserializeLayout(leaf: LeafEntry, ribbon?: "left" | "right"): Promise<WorkspaceLeaf>;
/**
* Remove all leaves of the given type.
*
* @param viewType - The type of the view to remove.
* @official
* @since 0.9.7
*/
detachLeavesOfType(viewType: string): void;
/**
* Duplicate a leaf.
*
* @param leaf - The leaf to duplicate.
* @param direction - The direction to duplicate the leaf in.
* @returns The promise that resolves to the leaf that was created.
* @deprecated - Use the new form of this method instead
* @official
* @since 0.13.8
*/
duplicateLeaf(leaf: WorkspaceLeaf, direction?: SplitDirection): Promise<WorkspaceLeaf>;
/**
* Duplicate a leaf.
*
* @param leaf - The leaf to duplicate.
* @param leafType - The type of the leaf to duplicate.
* @param direction - The direction to duplicate the leaf in.
* @returns The promise that resolves to the leaf that was created.
* @official
*/
duplicateLeaf(leaf: WorkspaceLeaf, leafType: PaneType | boolean, direction?: SplitDirection): Promise<WorkspaceLeaf>;
/**
* Get side leaf or create one if one does not exist.
*
* @param type - The type of the leaf to get or create.
* @param side - The side of the leaf to get or create.
* @param options - The options to pass to the leaf.
* @returns The promise that is resolved to the leaf that was created.
* @official - Changed signature.
* @since 1.7.2
*/
ensureSideLeaf(type: string, side: Side, options?: EnsureSideLeafOptions): Promise<WorkspaceLeaf>;
/**
* Returns the file for the current view if it's a `FileView`.
* Otherwise, it will return the most recently active file.
*
* @returns The active file or `null` if no file is active.
* @official
*/
getActiveFile(): TFile | null;
/**
* Get active file view if exists.
*
* @unofficial
*/
getActiveFileView(): FileView | null;
/**
* @deprecated - Use {@link getActiveViewOfType} instead
* @unofficial
*/
getActiveLeafOfViewType<T extends View>(type: Constructor<T>): T | null;
/**
* Get the currently active view of a given type.
*
* @param type - The type of the view to get.
* @returns The active view of the given type or `null` if no view of the given type is active.
* @official
* @since 0.9.16
*/
getActiveViewOfType<T extends View>(type: Constructor<T>): T | null;
/**
* Get adjacent leaf in specified direction.
*
* @remark Potentially does not work.
* @unofficial
*/
getAdjacentLeafInDirection(leaf: WorkspaceLeaf, direction: "top" | "bottom" | "left" | "right"): WorkspaceLeaf | null;
/**
* Get the direction where the leaf should be dropped on dragevent
*
* @unofficial
*/
getDropDirection(e: DragEvent, rect: DOMRect, directions: [
"left",
"right"
], leaf: WorkspaceLeaf): "left" | "right" | "top" | "bottom" | "center";
/**
* Get the leaf where the leaf should be dropped on dragevent.
*
* @param e Drag event.
* @unofficial
*/
getDropLocation(e: DragEvent): WorkspaceLeaf | null;
/**
* Get the workspace split for the currently focused container.
*
* @unofficial
*/
getFocusedContainer(): WorkspaceSplit;
/**
* Get all leaves that belong to a group.
*
* @param group - The id of the group to get the leaves from.
* @returns The leaves that belong to the group.
* @official
* @since 0.9.7
*/
getGroupLeaves(group: string): WorkspaceLeaf[];
/**
* Get the filenames of the 10 most recently opened files.
*
* @returns The filenames of the 10 most recently opened files.
* @official
* @since 0.9.7
*/
getLastOpenFiles(): string[];
/**
* Get the layout of the workspace.
*
* @returns The layout of the workspace.
* @official
* @since 0.9.7
*/
getLayout(): Record<string, unknown>;
/**
* Creates a new leaf in a leaf adjacent to the currently active leaf.
* If direction is `'vertical'`, the leaf will appear to the right.
* If direction is `'horizontal'`, the leaf will appear below the current leaf.
*
* @official
* @since 0.16.0
*/
getLeaf(newLeaf?: "split", direction?: SplitDirection): WorkspaceLeaf;
/**
* If newLeaf is `false` (or not set) then an existing leaf which can be navigated.
* is returned, or a new leaf will be created if there was no leaf available.
*
* If newLeaf is `'tab'` or `true` then a new leaf will be created in the preferred
* location within the root split and returned.
*
* If newLeaf is `'split'` then a new leaf will be created adjacent to the currently active leaf.
*
* If newLeaf is `'window'` then a popout window will be created with a new leaf inside.
*
* @param newLeaf - The type of the leaf to get or `true` to create a new leaf or `false` to get an existing leaf.
* @returns The leaf that was created.
* @official
*/
getLeaf(newLeaf?: PaneType | boolean): WorkspaceLeaf;
/**
* Retrieve a leaf by its id.
*
* @param id id of the leaf to retrieve.
* @returns The leaf that was retrieved.
* @official
* @since 1.5.1
*/
getLeafById(id: string): WorkspaceLeaf | null;
/**
* Get all leaves of a given type.
*
* @param viewType - The type of the view to get.
* @returns The leaves of the given type.
* @official
* @since 0.9.7
*/
getLeavesOfType(viewType: string): WorkspaceLeaf[];
/**
* Get leaves of a specific view type.
*
* @unofficial
*/
getLeavesOfType<TViewType extends ViewTypeType>(viewType: TViewType): TypedWorkspaceLeaf<ViewTypeViewMapping[TViewType]>[];
/**
* Create a new leaf inside the left sidebar.
*
* @param split - Should the existing split be split up?.
* @returns The leaf that was created or `null` if the left sidebar is not open.
* @official
* @since 0.9.7
*/
getLeftLeaf(split: boolean): WorkspaceLeaf | null;
/**
* Get the most recently active leaf in a given workspace root. Useful for interacting with the leaf in the root split while a sidebar leaf might be active.
*
* @param root - The root to get the most recently active leaf from. If a root is not provided, the `rootSplit` and leaves within pop-outs will be searched.
* @returns The most recently active leaf.
* @official
* @since 0.15.4
*/
getMostRecentLeaf(root?: WorkspaceParent): WorkspaceLeaf | null;
/**
* Get n last opened files of type (defaults to 10).
*
* @unofficial
*/
getRecentFiles(options?: GetRecentFilesOptions): string[];
/**
* Create a new leaf inside the right sidebar.
*
* @param split - Should the existing split be split up?.
* @returns The leaf that was created or `null` if the right sidebar is not open.
* @official
* @since 0.9.7
*/
getRightLeaf(split: boolean): WorkspaceLeaf | null;
/**
* Get leaf in the side ribbon/dock and split if necessary.
*
* @param sideRibbon Side ribbon to get leaf from.
* @param split Whether to split the leaf if it does not exist.
* @unofficial
*/
getSideLeaf(sideRibbon: WorkspaceSidedock | WorkspaceMobileDrawer, split: boolean): WorkspaceLeaf;
/**
* Get the unpinned leaf.
*
* @returns The unpinned leaf.
* @deprecated - You should use {@link Workspace.getLeaf|getLeaf(false)} instead which does the same thing.
* @official
*/
getUnpinnedLeaf(): WorkspaceLeaf;
/**
* @todo Documentation incomplete.
* @unofficial
*/
handleExternalLinkContextMenu(menu: Menu, linkText: string): void;
/**
* @todo Documentation incomplete.
* @unofficial
* @since 0.12.10
*/
handleLinkContextMenu(menu: Menu, linkText: string, sourcePath: string): void;
/**
* Check if leaf has been attached to the workspace
*
* @unofficial
*/
isAttached(leaf?: WorkspaceLeaf): boolean;
/**
* Iterate through all leaves, including main area leaves, floating leaves, and sidebar leaves.
*
* @param callback - The callback to call for each leaf.
* @official
* @since 0.9.7
*/
iterateAllLeaves(callback: (leaf: WorkspaceLeaf) => any): void;
/**
* Iterate the leaves of a split.
*
* @unofficial
*/
iterateLeaves(split: WorkspaceSplit, callback: (leaf: WorkspaceLeaf) => unknown): void;
/**
* Iterate through all leaves in the main area of the workspace.
*
* @param callback - The callback to call for each leaf.
* @official
* @since 0.9.7
*/
iterateRootLeaves(callback: (leaf: WorkspaceLeaf) => any): void;
/**
* Iterate the tabs of a split till meeting a condition.
*
* @unofficial
*/
iterateTabs(tabs: WorkspaceSplit | WorkspaceSplit[], cb: (leaf: WorkspaceLeaf) => boolean): boolean;
/**
* Load workspace from disk and initialize
*
* @unofficial
*/
loadLayout(): Promise<void>;
/**
* Migrates this leaf to a new popout window.
* Only works on the desktop app.
*
* @param leaf - The leaf to migrate to a popout window.
* @param data - The data to pass to the popout window.
* @returns The popout window that was created.
* @throws Error if the app does not support popout windows (i.e. on mobile or if Electron version is too old).
* @official
* @since 0.15.4
*/
moveLeafToPopout(leaf: WorkspaceLeaf, data?: WorkspaceWindowInitData): WorkspaceWindow;
/**
* Triggered when the active leaf changes.
*
* @param name - Should be `'active-leaf-change'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('active-leaf-change', (leaf) => {
* console.log(leaf);
* });
* ```
* @official
* @since 0.10.9
*/
on(name: "active-leaf-change", callback: (leaf: WorkspaceLeaf | null) => any, ctx?: any): EventRef;
/**
* Triggers when the browser history is updated.
*
* @param name - 'browser:update-history'.
* @param callback - Callback function.
* @param ctx - Context.
* @returns Event reference.
* @unofficial
*/
on(name: "browser:update-history", callback: () => unknown, ctx?: unknown): EventRef;
/**
* Triggers when the user opens a context menu on a connection in the canvas.
*
* @unofficial
*/
on(name: "canvas:edge-menu", callback: (menu: Menu, connection: CanvasConnection) => void, ctx?: unknown): EventRef;
/**
* Triggers when the user drops edge connection to empty space in the canvas.
*
* @unofficial
*/
on(name: "canvas:node-connection-drop-menu", callback: (menu: Menu, originalNode: CanvasNode, connection: CanvasConnection) => void, ctx?: unknown): EventRef;
/**
* Triggers when the user opens a context menu on a single node in the canvas.
*
* @unofficial
*/
on(name: "canvas:node-menu", callback: (menu: Menu, node: CanvasNode) => void, ctx?: unknown): EventRef;
/**
* Triggers when the user opens a context menu on a selection of multiple nodes in the canvas.
*
* @unofficial
*/
on(name: "canvas:selection-menu", callback: (menu: Menu, canvasView: CanvasView) => void, ctx?: unknown): EventRef;
/**
* Triggered when the CSS of the app has changed.
*
* @param name - Should be `'css-change'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('css-change', () => {
* console.log('css-change');
* });
* @official
*/
on(name: "css-change", callback: () => any, ctx?: any): EventRef;
/**
* Triggered when changes to an editor has been applied, either programmatically or from a user event.
*
* @param name - Should be `'editor-change'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('editor-change', (editor, info) => {
* console.log(editor, info);
* });
* ```
* @official
*/
on(name: "editor-change", callback: (editor: Editor, info: MarkdownView | MarkdownFileInfo) => any, ctx?: any): EventRef;
/**
* Triggered when the editor receives a drop event.
* Check for `evt.defaultPrevented` before attempting to handle this event, and return if it has been already handled.
* Use `evt.preventDefault()` to indicate that you've handled the event.
*
* @param name - Should be `'editor-drop'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('editor-drop', (evt, editor, info) => {
* console.log(evt, editor, info);
* });
* ```
* @official
*/
on(name: "editor-drop", callback: (evt: DragEvent, editor: Editor, info: MarkdownView | MarkdownFileInfo) => any, ctx?: any): EventRef;
/**
* Triggered when the user opens the context menu on an editor.
*
* @param name - Should be `'editor-menu'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('editor-menu', (menu, editor, info) => {
* console.log(menu, editor, info);
* });
* ```
* @official
*/
on(name: "editor-menu", callback: (menu: Menu, editor: Editor, info: MarkdownView | MarkdownFileInfo) => any, ctx?: any): EventRef;
/**
* Triggered when the editor receives a paste event.
* Check for `evt.defaultPrevented` before attempting to handle this event, and return if it has been already handled.
* Use `evt.preventDefault()` to indicate that you've handled the event.
*
* @param name - Should be `'editor-paste'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('editor-paste', (evt, editor, info) => {
* console.log(evt, editor, info);
* });
* ```
* @official
*/
on(name: "editor-paste", callback: (evt: ClipboardEvent, editor: Editor, info: MarkdownView | MarkdownFileInfo) => any, ctx?: any): EventRef;
/**
* Triggers when the editor selection changes.
*
* @param name - 'editor-selection-change'.
* @param callback - Callback function.
* @param ctx - Context.
* @returns Event reference.
* @unofficial
*/
on(name: "editor-selection-change", callback: (editor: Editor, info: MarkdownView | MarkdownFileInfo) => unknown, ctx?: unknown): EventRef;
/**
* Triggered when the user opens the context menu on a file.
*
* @param name - Should be `'file-menu'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('file-menu', (menu, file, source, leaf) => {
* console.log(menu, file, source, leaf);
* });
* ```
* @official
*/
on(name: "file-menu", callback: (menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf) => any, ctx?: any): EventRef;
/**
* Triggered when the active file changes. The file could be in a new leaf, an existing leaf,.
* or an embed.
*
* @param name - Should be `'file-open'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('file-open', (file) => {
* console.log(file);
* });
* ```
* @official
*/
on(name: "file-open", callback: (file: TFile | null) => any, ctx?: any): EventRef;
/**
* Triggered when the user opens the context menu with multiple files selected in the File Explorer.
*
* @param name - Should be `'files-menu'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('files-menu', (menu, files, source, leaf) => {
* console.log(menu, files, source, leaf);
* });
* ```
* @official
*/
on(name: "files-menu", callback: (menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf) => any, ctx?: any): EventRef;
/**
* Triggers when user hovers over any note link element (file explorer, editor, ...).
*
* @remark Used for preparing (Ctrl) hover previews.
* @unofficial
*/
on(name: "hover-link", callback: (event: HoverLinkEvent) => void, ctx?: unknown): EventRef;
/**
* Triggered when the layout of the workspace changes.
*
* @param name - Should be `'layout-change'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('layout-change', () => {
* console.log('layout-change');
* });
* ```
* @official
*/
on(name: "layout-change", callback: () => any, ctx?: any): EventRef;
/**
* Triggers when workspace layout is loaded.
*
* @remark Prefer usage of onLayoutReady instead.
* @unofficial
*/
on(name: "layout-ready", callback: () => void, ctx?: unknown): EventRef;
/**
* Triggers when the leaf menu is opened.
*
* @param name - 'leaf-menu'.
* @param callback - Callback function.
* @param ctx - Context.
* @returns Event reference.
* @unofficial
*/
on(name: "leaf-menu", callback: (menu: Menu, leaf: WorkspaceLeaf) => unknown, ctx?: unknown): EventRef;
/**
* Triggers when the markdown scroll event is fired.
*
* @param name - 'markdown-scroll'.
* @param callback - Callback function.
* @param ctx - Context.
* @returns Event reference.
* @unofficial
*/
on(name: "markdown-scroll", callback: (view: MarkdownScrollableEditView) => unknown, ctx?: unknown): EventRef;
/**
* Triggers when the markdown viewport menu is opened.
*
* @param name - 'markdown-viewport-menu'.
* @param callback - Callback function.
* @param ctx - Context.
* @returns Event reference.
* @unofficial
*/
on(name: "markdown-viewport-menu", callback: (menu: Menu, view: MarkdownView, sectionName: string, menuItem: string) => unknown, ctx?: unknown): EventRef;
/**
* Triggered when the active Markdown file is modified. React to file changes before they.
* are saved to disk.
*
* @param name - Should be `'quick-preview'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('quick-preview', (file, data) => {
* console.log(file, data);
* });
* ```
* @official
*/
on(name: "quick-preview", callback: (file: TFile, data: string) => any, ctx?: any): EventRef;
/**
* Triggered when the app is about to quit.
* Not guaranteed to actually run.
* Perform some best effort cleanup here.
*
* @param name - Should be `'quit'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('quit', (tasks: Tasks) => {
* console.log(tasks);
* });
* ```
* @official
*/
on(name: "quit", callback: (tasks: Tasks) => any, ctx?: any): EventRef;
/**
* Triggered when user shares files on mobile.
*
* @param name - Should be `'receive-files-menu'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('receive-files-menu', (menu, files) => {
* console.log(menu, files);
* });
* ```
* @unofficial
*/
on(name: "receive-files-menu", callback: (menu: Menu, files: TFile[]) => void, ctx?: unknown): EventRef;
/**
* Triggered when user shares text on mobile.
*
* @param name - Should be `'receive-text-menu'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('receive-text-menu', (menu, text) => {
* console.log(menu, text);
* });
* ```
* @unofficial
*/
on(name: "receive-text-menu", callback: (menu: Menu, text: string) => void, ctx?: unknown): EventRef;
/**
* Triggered when a `WorkspaceItem` is resized or the workspace layout has changed.
*
* @param name - Should be `'resize'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('resize', () => {
* console.log('resize');
* });
* ```
* @official
*/
on(name: "resize", callback: () => any, ctx?: any): EventRef;
/**
* Triggers when user clicks on 'N results' button in search view.
*
* @unofficial
*/
on(name: "search:results-menu", callback: (menu: Menu, search: TypedWorkspaceLeaf<SearchView>) => void, ctx?: unknown): EventRef;
/**
* Triggers when user swipes open left/right sidebar
*
* @unofficial
*/
on(name: "swipe", callback: (touchEvents: ObsidianTouchEvent[]) => void, ctx?: unknown): EventRef;
/**
* Called whenever user opens tab group menu (contains e.g. stacked tabs button)
*
* @unofficial
*/
on(name: "tab-group-menu", callback: (tabMenu: Menu, tabsLeaf: WorkspaceTabs) => void, ctx?: unknown): EventRef;
/**
* Triggered when the user opens the context menu on an external URL.
*
* @param name - Should be `'url-menu'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('url-menu', (menu, url) => {
* console.log(menu, url);
* });
* ```
* @official
*/
on(name: "url-menu", callback: (menu: Menu, url: string) => any, ctx?: any): EventRef;
/**
* Triggered when a popout window is closed.
*
* @param name - Should be `'window-close'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('window-close', (win, window) => {
* console.log(win, window);
* });
* ```
* @official
*/
on(name: "window-close", callback: (win: WorkspaceWindow, window: Window) => any, ctx?: any): EventRef;
/**
* Triggered when a new popout window is created.
*
* @param name - Should be `'window-open'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.workspace.on('window-open', (win, window) => {
* console.log(win, window);
* });
* @official
*/
on(name: "window-open", callback: (win: WorkspaceWindow, window: Window) => any, ctx?: any): EventRef;
/**
* Handles drag event on leaf
*
* @unofficial
*/
onDragLeaf(e: DragEvent, leaf: WorkspaceLeaf): void;
/**
* Handles layout change and saves layout to disk
*
* @unofficial
*/
onLayoutChange(leaf?: WorkspaceLeaf): void;
/**
* Runs the callback function right away if layout is already ready,.
* or push it to a queue to be called later when layout is ready.
*
* @param callback - The callback to run.
* @example
* ```ts
* workspace.onLayoutReady(() => {
* console.log('layout is ready');
* });
* ```
* @official
* @since 0.11.0
*/
onLayoutReady(callback: () => any): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onLinkContextMenu(args: unknown[]): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onQuickPreview(args: unknown[]): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onResize(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onStartLink(leaf: WorkspaceLeaf): void;
/**
* Open a link text.
*
* @param linktext - The link text to open.
* @param sourcePath - The source path to open.
* @param newLeaf - The type of the leaf to open.
* @param openViewState - The view state to open.
* @example
* ```ts
* app.workspace.openLinkText('foo', 'bar.md', 'tab');
* ```
* @official
* @since 0.16.0
*/
openLinkText(linktext: string, sourcePath: string, newLeaf?: PaneType | boolean, openViewState?: OpenViewState): Promise<void>;
/**
* Open a leaf in a popup window.
*
* @remark Prefer usage of `app.workspace.openPopoutLeaf`.
* @unofficial
*/
openPopout(data?: WorkspaceWindowInitData): WorkspaceWindow;
/**
* Open a new popout window with a single new leaf and return that leaf.
* Only works on the desktop app.
*
* @param data - The data to pass to the popout window.
* @returns The leaf that was created.
* @official
* @since 0.15.4
*/
openPopoutLeaf(data?: WorkspaceWindowInitData): WorkspaceLeaf;
/**
* Push leaf change to history
*
* @unofficial
*/
pushUndoHistory(leaf: WorkspaceLeaf, parentID: string, rootID: string): void;
/**
* Get drag event target location
*
* @unofficial
*/
recursiveGetTarget(e: DragEvent, leaf: WorkspaceLeaf): WorkspaceTabs | null;
/**
* Register a CodeMirror editor extension.
*
* @remark Prefer registering the extension via the Plugin class.
* @unofficial
*/
registerEditorExtension(extension: Extension): void;
/**
* Registers hover link source
*
* @unofficial
*/
registerHoverLinkSource(key: string, source: HoverLinkSource): void;
/**
* Registers Obsidian protocol handler
*
* @unofficial
*/
registerObsidianProtocolHandler(protocol: string, handler: ObsidianProtocolHandler): void;
/**
* Constructs hook for receiving URI actions
*
* @unofficial
*/
registerUriHook(): void;
/**
* Request execution of activeLeaf change events
*
* @unofficial
*/
requestActiveLeafEvents(): void;
/**
* Request execution of resize event
*
* @unofficial
*/
requestResize(): void;
/**
* Request execution of layout update event
*
* @unofficial
*/
requestUpdateLayout(): void;
/**
* Bring a given leaf to the foreground. If the leaf is in a sidebar, the sidebar will be uncollapsed.
* `await` this function to ensure your view has been fully loaded and is not deferred.
*
* @param leaf - The leaf to bring to the foreground.
* @returns A promise that resolves when the leaf is brought to the foreground.
* @official
* @since 1.7.2
*/
revealLeaf(leaf: WorkspaceLeaf): Promise<void>;
/**
* Save workspace layout to disk.
*
* @unofficial
*/
saveLayout(): Promise<void>;
/**
* Sets the active leaf.
*
* @param leaf - The new active leaf.
* @param params - Parameter object of whether to set the focus.
* @example
* ```ts
* app.workspace.setActiveLeaf(app.workspace.getLeaf(false), { focus: true });
* ```
* @official
* @since 0.16.3
*/
setActiveLeaf(leaf: WorkspaceLeaf, params?: {
/** @official */
focus?: boolean;
}): void;
/**
* Sets the active leaf.
*
* @param leaf - The new active leaf.
* @param pushHistory - Whether to push the history.
* @param focus - Whether to focus the leaf.
* @example
* ```ts
* app.workspace.setActiveLeaf(app.workspace.getLeaf(false), true, true);
* ```
* @deprecated - function signature changed. Use other form instead.
* @official
*/
setActiveLeaf(leaf: WorkspaceLeaf, pushHistory: boolean, focus: boolean): void;
/**
* Use deserialized layout data to reconstruct the workspace
*
* @unofficial
*/
setLayout(data: SerializedWorkspace): Promise<void>;
/**
* Split the active leaf.
*
* @param direction - The direction to split the leaf in.
* @returns The leaf that was created.
* @deprecated - You should use {@link Workspace.getLeaf|getLeaf(true)} instead which does the same thing.
* @official
* @since 0.9.7
*/
splitActiveLeaf(direction?: SplitDirection): WorkspaceLeaf;
/**
* Split leaves in specified direction
*
* @unofficial
*/
splitLeaf(leaf: WorkspaceLeaf, newLeaf: WorkspaceLeaf, direction?: SplitDirection, before?: boolean): void;
/**
* Split provided leaf, or active leaf if none provided.
*
* @unofficial
*/
splitLeafOrActive(leaf?: WorkspaceLeaf, direction?: SplitDirection): WorkspaceLeaf;
/**
* Unregister a CodeMirror editor extension
*
* @unofficial
*/
unregisterEditorExtension(extension: Extension): void;
/**
* Unregister hover link source
*
* @unofficial
*/
unregisterHoverLinkSource(key: string): void;
/**
* Unregister Obsidian protocol handler
*
* @unofficial
*/
unregisterObsidianProtocolHandler(protocol: string): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
updateFrameless(): void;
/**
* Invoke workspace layout update, redraw and save
*
* @unofficial
*/
updateLayout(): void;
/**
* Update visibility of tab group
*
* @unofficial
*/
updateMobileVisibleTabGroup(): void;
/**
* Calling this function will update/reconfigure the options of all Markdown views.
* It is fairly expensive, so it should not be called frequently.
*
* @official
* @since 0.13.21
*/
updateOptions(): void;
/**
* Update the internal title of the application.
*
* @remark This title is shown as the application title in the OS taskbar.
* @unofficial
*/
updateTitle(): void;
}
}
declare module "obsidian" {
/**
* Abstract constructor type.
*
* @typeParam T - The type of the class to create.
* @param args - The arguments to pass to the constructor.
* @returns A new instance of the class.
*
* @example
* ```ts
* abstract class AbstractClass {}
* const ctor: Constructor<AbstractClass> = AbstractClass;
* class ChildClass extends ctor {}
* ```
*
* @deprecated - Added only for typing purposes. Use {@link Constructor} instead.
*/
type Constructor__<T> = abstract new (...args: any[]) => T;
}
declare module "obsidian" {
/**
* Adds an icon to the library.
*
* @param iconId - the icon ID.
* @param svgContent - the content of the SVG.
*
* @example
* ```ts
* addIcon('my-icon', '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle cx="50" cy="50" r="40"/></svg>');
* ```
*
* @official
*/
function addIcon(iconId: string, svgContent: string): void;
/**
* Converts an `ArrayBuffer` to a base64 string.
*
* @param buffer - The `ArrayBuffer` to convert.
* @returns The base64 string.
*
* @example
* ```ts
* console.log(arrayBufferToBase64(new Uint8Array([1,2,3]).buffer)); // AQID
* ```
*
* @official
*/
function arrayBufferToBase64(buffer: ArrayBuffer): string;
/**
* Converts an `ArrayBuffer` to a hex string.
*
* @param buffer - The `ArrayBuffer` to convert.
* @returns The hex string.
*
* @example
* ```ts
* console.log(arrayBufferToHex(new Uint8Array([1,2,3]).buffer)); // 010203
* ```
*
* @official
*/
function arrayBufferToHex(data: ArrayBuffer): string;
/**
* Converts a base64 string to an `ArrayBuffer`.
*
* @param base64 - The base64 string to convert.
* @returns The `ArrayBuffer`.
*
* @example
* ```ts
* console.log(base64ToArrayBuffer('AQID'));
* ```
*
* @official
*/
function base64ToArrayBuffer(base64: string): ArrayBuffer;
/**
* A standard debounce function.
* Use this to have a time-delayed function only be called once in a given timeframe.
*
* @typeParam T - The type of the arguments of the function to debounce.
* @typeParam V - The type of the return value of the function to debounce.
* @param cb - The function to call.
* @param timeout - The timeout to wait, in milliseconds.
* @param resetTimer - Whether to reset the timeout when the debouncer is called again.
* @returns a debounced function that takes the same parameter as the original function.
*
* @example
* ```ts
* const debounced = debounce((text: string) => {
* console.log(text);
* }, 1000, true);
* debounced('foo'); // this will not be printed
* await sleep(500);
* debounced('bar'); // this will be printed to the console.
* ```
*
* @official
*/
function debounce<T extends unknown[], V>(cb: (...args: [
...T
]) => V, timeout?: number, resetTimer?: boolean): Debouncer<T, V>;
/**
* Manually trigger a tooltip that will appear over the provided element.
* To display a tooltip on hover, use {@link setTooltip} instead.
*
* @param newTargetEl - The element to display the tooltip over.
* @param content - The content of the tooltip.
* @param options - The options for the tooltip.
*
* @example
* ```ts
* displayTooltip(document.body, 'foo');
* ```
*
* @official
* @since 1.8.7
*/
function displayTooltip(newTargetEl: HTMLElement, content: string | DocumentFragment, options?: TooltipOptions): void;
/**
* Flush the MathJax stylesheet.
*
* @official
*/
function finishRenderMath(): Promise<void>;
/**
* Fuzzy search.
*
* @param queryForFuzzySearch - the query for fuzzy search.
* @param text - the text to search in.
* @returns the search result or `null` if the text does not match the query.
*
* @unofficial
*/
function fuzzySearch(queryForFuzzySearch: QueryForFuzzySearch, text: string): SearchResult | null;
/**
* Combines all tags from frontmatter and note content into a single array.
*
* @example
* For the following note:
*
* ```markdown
* ---
* tags:
* - foo
* - bar
* ---
*
* #baz
* ```
*
* Usage:
*
* ```ts
* console.log(getAllTags(cache)); // ['foo', 'bar', 'baz']
* ```
*
* @official
*/
function getAllTags(cache: CachedMetadata): string[] | null;
/**
* Converts a Blob to an ArrayBuffer.
*
* @param blob - The Blob to convert.
* @returns The ArrayBuffer.
*
* @example
* ```ts
* console.log(await getBlobArrayBuffer(blob));
* ```
*
* @official
*/
function getBlobArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
/**
* Given the contents of a file, get information about the frontmatter of the file, including
* whether there is a frontmatter block, the offsets of where it starts and ends, and the frontmatter text.
*
* @example
* ```ts
* const content = `---
* key1: value1
* key2: value2
* ---
* main content
* `;
* console.log(getFrontMatterInfo(content));
* ```
*
* @official
* @since 1.5.7
*/
function getFrontMatterInfo(content: string): FrontMatterInfo;
/**
* Create an SVG from an iconId. Returns `null` if no icon associated with the iconId.
*
* @param iconId - the icon ID.
* @returns the SVG element or `null` if no icon associated with the iconId.
*
* @example
* ```ts
* console.log(getIcon('dice')); // <svg>...</svg>
* ```
*
* @official
*/
function getIcon(iconId: string): SVGSVGElement | null;
/**
* Get the list of registered icons.
*
* @official
*/
function getIconIds(): IconName[];
/**
* Get the ISO code for the currently configured app language. Defaults to 'en'.
* See {@link https://github.com/obsidianmd/obsidian-translations?tab=readme-ov-file#existing-languages} for list of options.
*
* @official
* @since 1.8.7
*/
function getLanguage(): string;
/**
* Converts the linktext to a linkpath.
*
* @param linktext A wikilink without the leading [[ and trailing ]].
* @returns the name of the file that is being linked to.
*
* @example
* ```ts
* console.log(getLinkpath('foo#bar')); // foo
* ```
*
* @official
*/
function getLinkpath(linktext: string): string;
/**
* Converts a hex string to an ArrayBuffer.
*
* @param hex - The hex string to convert.
* @returns The ArrayBuffer.
*
* @example
* ```ts
* console.log(hexToArrayBuffer('00112233445566778899aabbccddeeff'));
* ```
*
* @official
*/
function hexToArrayBuffer(hex: string): ArrayBuffer;
/**
* Converts HTML to a Markdown string.
*
* @example
* ```ts
* console.log(htmlToMarkdown('<h1>foo</h1>')); // # foo
* const el = createDiv();
* el.createEl('h2', { text: 'bar' });
* console.log(htmlToMarkdown(el)); // ## bar
* const fragment = createFragment();
* fragment.createEl('h3', { text: 'baz' });
* console.log(htmlToMarkdown(fragment)); // ### baz
* ```
*
* @official
*/
function htmlToMarkdown(html: string | HTMLElement | Document | DocumentFragment): string;
/**
* Iterate links and embeds.
* If callback returns true, the iteration process will be interrupted.
*
* @param cache - The cache to iterate.
* @param cb - The callback to call for each link or embed.
* @returns `true` if callback ever returns `true`, `false` otherwise.
*
* @example
* ```ts
* iterateCacheRefs(cache, (ref) => {
* console.log(ref);
* return true;
* });
* @official
* @deprecated - Use {@link iterateRefs} instead.
*/
function iterateCacheRefs(cache: CachedMetadata, cb: (ref: ReferenceCache) => boolean | void): boolean;
/**
* If callback returns true, the iteration process will be interrupted.
*
* @param refs - The references to iterate.
* @param cb - The callback to call for each reference.
* @returns `true` if callback ever returns true, `false` otherwise.
*
* @example
* ```ts
* iterateRefs(refs, (ref) => {
* console.log(ref);
* return true;
* });
* @official
*/
function iterateRefs(refs: Reference[], cb: (ref: Reference) => boolean | void): boolean;
/**
* Load MathJax.
*
* @returns A promise that resolves when MathJax is loaded.
*
* @see {@link https://www.mathjax.org/ Official MathJax documentation}.
* @official
*/
function loadMathJax(): Promise<void>;
/**
* Load Mermaid and return a promise to the global mermaid object.
* Can also use {@link Window.mermaid} after this promise resolves to get the same reference.
*
* @returns A promise that resolves to the global {@link Window.mermaid} object.
*
* @remark For more specific return type, use:
*
* ```ts
* import type { loadMermaid } from 'obsidian-typings/implementations';
*
* const mermaid = await loadMermaid();
* ```
*
* @see {@link https://mermaid.js.org/ Official Mermaid documentation}.
* @official
*/
function loadMermaid(): Promise<any>;
/**
* Load PDF.js and return a promise to the global pdfjsLib object.
* Can also use {@link Window.pdfjsLib} after this promise resolves to get the same reference.
*
* @returns A promise that resolves to the global {@link Window.pdfjsLib} object.
*
* @remark For more specific return type, use:
*
* ```ts
* import type { loadPdfJs } from 'obsidian-typings/implementations';
*
* const pdfjsLib = await loadPdfJs();
* ```
*
* @see {@link https://mozilla.github.io/pdf.js/ Official PDF.js documentation}.
* @official
*/
function loadPdfJs(): Promise<any>;
/**
* Load Prism.js and return a promise to the global Prism object.
* Can also use {@link Window.Prism} after this promise resolves to get the same reference.
*
* @returns A promise that resolves to the global {@link Window.Prism} object.
*
* @remark For more specific return type, use:
*
* ```ts
* import type { loadPrism } from 'obsidian-typings/implementations';
*
* const Prism = await loadPrism();
* ```
*
* @see {@link https://prismjs.com/ Official Prism documentation}.
* @official
*/
function loadPrism(): Promise<any>;
/**
* Normalizes a path replacing all invalid symbols.
*
* @param path - The path to normalize.
* @returns The normalized path.
*
* @example
* ```ts
* normalizePath('foo/bar'); // foo/bar
* normalizePath('/foo/bar'); // foo/bar
* normalizePath('foo/bar/'); // foo/bar
* normalizePath('foo//bar'); // foo/bar
* normalizePath('foo\\bar'); // foo/bar
* normalizePath('foo\u00A0bar'); // foo bar
* normalizePath('foo\u202Fbar'); // foo bar
* ```
*
* @official
*/
function normalizePath(path: string): string;
/**
* Parses the frontmatter aliases from the frontmatter object.
*
* @param frontmatter - The frontmatter object.
* @returns The aliases of the note or `null` if no aliases are found.
*
* @example
* ```ts
* console.log(parseFrontMatterAliases({ aliases: ['foo', 'bar'] })); // ['foo', 'bar']
* console.log(parseFrontMatterAliases({ alias: ['foo', 'bar'] })); // ['foo', 'bar']
* console.log(parseFrontMatterAliases({ aliases: 'baz' })); // ['baz']
* ```
*
* @official
*/
function parseFrontMatterAliases(frontmatter: any | null): string[] | null;
/**
* Parses a frontmatter entry from the frontmatter object.
*
* @param frontmatter - The frontmatter object.
* @param key - The key to parse.
* @returns The parsed entry or `null` if the key is not found.
*
* @example
* ```ts
* console.log(parseFrontMatterEntry({ foo: 'bar' }, 'foo')); // bar
* console.log(parseFrontMatterEntry({ baz: 'qux' }, /ba./)); // qux
* ```
*
* @official
*/
function parseFrontMatterEntry(frontmatter: any | null, key: string | RegExp): any | null;
/**
* Parses a frontmatter string array from the frontmatter object.
*
* @param frontmatter - The frontmatter object.
* @param key - The key to parse.
* @param nospaces - Whether to remove spaces from the array.
* @returns The parsed entry or `null` if the key is not found.
*
* @example
* ```ts
* console.log(parseFrontMatterStringArray({ foo: ['bar', 'baz'] }, 'foo')); // ['bar', 'baz']
* console.log(parseFrontMatterStringArray({ foo: 'bar,baz' }, 'foo')); // ['bar', 'baz']
* console.log(parseFrontMatterStringArray({ foo: 'bar\nbaz' }, 'foo')); // ['bar', 'baz']
* console.log(parseFrontMatterStringArray({ foo: 'bar baz' }, 'foo')); // ['bar baz']
* console.log(parseFrontMatterStringArray({ foo: 'bar baz' }, 'foo', false)); // ['bar baz']
* console.log(parseFrontMatterStringArray({ foo: 'bar baz' }, 'foo', true)); // ['bar', 'baz']
* console.log(parseFrontMatterStringArray({ foo: ['bar', 'baz'] }, /fo./)); // ['bar', 'baz']
* ```
*
* @official
*/
function parseFrontMatterStringArray(frontmatter: any | null, key: string | RegExp, nospaces?: boolean): string[] | null;
/**
* Parses the frontmatter tags from the frontmatter object.
*
* @param frontmatter - The frontmatter object.
* @returns The tags of the note or `null` if no tags are found.
*
* @example
* ```ts
* console.log(parseFrontMatterTags({ tags: ['foo', 'bar'] })); // ['#foo', '#bar']
* console.log(parseFrontMatterTags({ tag: ['foo', 'bar'] })); // ['#foo', '#bar']
* console.log(parseFrontMatterTags({ tags: 'foo bar' })); // ['#foo', '#bar']
* ```
*
* @official
*/
function parseFrontMatterTags(frontmatter: any | null): string[] | null;
/**
* Parses the linktext of a wikilink into its component parts.
*
* @param linktext A wikilink without the leading [[ and trailing ]].
* @returns filepath and subpath (subpath can refer either to a block id, or a heading).
*
* @example
* ```ts
* console.log(parseLinktext('[[foo]]')); // { path: 'foo', subpath: '' }
* console.log(parseLinktext('[[foo#bar]]')); // { path: 'foo', subpath: 'bar' }
* ```
*
* @official
*/
function parseLinktext(linktext: string): {
/**
* @official
*/
path: string;
/**
* @official
*/
subpath: string;
};
/**
* Split a Bases property ID into constituent parts.
*
* @official
* @since 1.10.0
*/
function parsePropertyId(propertyId: BasesPropertyId): BasesProperty;
/**
* Parses a YAML string into an object.
*
* @param yaml - The YAML string to parse.
* @returns The parsed object.
*
* @example
* ```ts
* console.log(parseYaml('foo: bar')); // { foo: 'bar' }
* ```
*
* @official
*/
function parseYaml(yaml: string): any;
/**
* Construct a fuzzy search callback that runs on a target string.
* Performance may be an issue if you are running the search for more than a few thousand times.
* If performance is a problem, consider using `prepareSimpleSearch` instead.
*
* @param query - the fuzzy query.
* @return fn - the callback function to apply the search on or `null` if the query is empty.
*
* @official
*/
function prepareFuzzySearch(query: string): (text: string) => SearchResult | null;
/**
* Prepare a query for fuzzy search.
*
* @param query - the query.
* @returns the query for fuzzy search.
*
* @unofficial
*/
function prepareQuery(query: string): QueryForFuzzySearch;
/**
* Construct a simple search callback that runs on a target string.
*
* @param query - the space-separated words.
* @return fn - the callback function to apply the search on or `null` if the query is empty.
*
* @official
*/
function prepareSimpleSearch(query: string): (text: string) => SearchResult | null;
/**
* Remove a custom icon from the library.
*
* @param iconId - the icon ID.
*
* @example
* ```ts
* removeIcon('my-icon');
* ```
*
* @official
*/
function removeIcon(iconId: string): void;
/**
* Render the matches of a search.
*
* @param el - The element to render the matches to.
* @param text - The text to render the matches to.
* @param matches - The matches to render.
* @param offset - The offset to render the matches to.
*
* @example
* ```ts
* renderMatches(document.body, 'foo', [[0, 3]]);
* ```
*
* @official
*/
function renderMatches(el: HTMLElement | DocumentFragment, text: string, matches: SearchMatches | null, offset?: number): void;
/**
* Render some LaTeX math using the MathJax engine. Returns an HTMLElement.
* Requires calling `finishRenderMath` when rendering is all done to flush the MathJax stylesheet.
*
* @param source - The LaTeX source code.
* @param display - Whether to render the math in display mode.
* @returns The rendered math element.
*
* @example
* ```ts
* console.log(renderMath('\\frac{1}{2}', true));
* ```
*
* @official
*/
function renderMath(source: string, display: boolean): HTMLElement;
/**
* Render the results of a search.
*
* @param el - The element to render the results to.
* @param text - The text to render the results to.
* @param result - The result to render.
* @param offset - The offset to render the results to.
*
* @example
* ```ts
* renderResults(document.body, 'foo', {
* score: 0.5,
* matches: [[0, 3]],
* });
* ```
*
* @official
*/
function renderResults(el: HTMLElement, text: string, result: SearchResult, offset?: number): void;
/**
* Similar to {@link fetch}, request a URL using HTTP/HTTPS, without any CORS restrictions.
*
* @param request - The request parameters.
* @returns The promise that resolves to the text value of the response.
*
* @example
* ```ts
* console.log(await request({ url: 'https://google.com' }));
* console.log(await request('https://google.com'));
* ```
*
* @official
* @since 0.12.11
*/
function request(request: RequestUrlParam | string): Promise<string>;
/**
* Similar to {@link fetch}, request a URL using HTTP/HTTPS, without any CORS restrictions.
*
* @param request - The request parameters.
* @returns The response.
*
* @example
* ```ts
* const response = requestUrl({ url: 'https://google.com' });
* console.log(await response);
* console.log(await response.arrayBuffer());
* console.log(await response.json());
* console.log(await response.text());
* console.log(await requestUrl('https://google.com'));
* ```
*
* @official
*/
function requestUrl(request: RequestUrlParam | string): RequestUrlResponsePromise;
/**
* Returns `true` if the API version is equal or higher than the requested version.
* Use this to limit functionality that require specific API versions to avoid
* crashing on older Obsidian builds.
*
* @param version - The version to check against.
* @returns `true` if the API version is equal or higher than the requested version.
*
* @example
* ```ts
* console.log(requireApiVersion('1.8.9')); // true
* ```
*
* @official
*/
function requireApiVersion(version: string): boolean;
/**
* Resolve the given subpath to a reference in the MetadataCache.
*
* @param cache - The cached metadata to resolve the subpath in.
* @param subpath - The subpath to resolve.
* @returns The resolved subpath or `null` if the subpath is not found.
*
* @example
* ```ts
* console.log(resolveSubpath(cache, '#foo'));
* ```
*
* @official
*/
function resolveSubpath(cache: CachedMetadata, subpath: string): HeadingSubpathResult | BlockSubpathResult | FootnoteSubpathResult | null;
/**
* Sanitize HTML to a DOM fragment.
*
* @param html - The HTML to sanitize.
* @returns The sanitized DOM fragment.
*
* @example
* ```ts
* console.log(sanitizeHTMLToDom('<div>foo</div>')); #document-fragment
* ```
*
* @official
*/
function sanitizeHTMLToDom(html: string): DocumentFragment;
/**
* Insert an SVG into the element from an iconId. Does nothing if no icon associated with the iconId.
*
* @param parent - the HTML element to insert the icon.
* @param iconId - the icon ID.
* @see The Obsidian icon library includes the {@link https://lucide.dev/ Lucide icon library}, any icon name from their site will work here.
*
* @example
* ```ts
* setIcon(document.body, 'dice');
* ```
*
* @official
*/
function setIcon(parent: HTMLElement, iconId: IconName): void;
/**
* Set a tooltip on an element.
*
* @param el - The element to show the tooltip on.
* @param tooltip - The tooltip text to show.
* @param options - The options for the tooltip.
*
* @example
* ```ts
* setTooltip(document.body, 'foo');
* ```
*
* @official
* @since 1.4.4
*/
function setTooltip(el: HTMLElement, tooltip: string, options?: TooltipOptions): void;
/**
* Sort search results.
*
* @param results - The search results to sort.
*
* @example
* ```ts
* sortSearchResults([{ match: { score: 1, matches: [[0, 3]]} }]);
* ```
*
* @official
*/
function sortSearchResults(results: SearchResultContainer[]): void;
/**
* Stringify a YAML object.
*
* @param obj - The object to stringify.
* @returns The stringified object.
*
* @example
* ```ts
* console.log(stringifyYaml({ foo: 'bar' })); // foo: bar
* ```
*
* @official
*/
function stringifyYaml(obj: any): string;
/**
* Normalizes headings for link matching by stripping out special characters and shrinking consecutive spaces.
*
* @param heading - The heading to normalize.
* @returns The normalized heading.
*
* @example
* ```ts
* console.log(stripHeading('foo!"#$%&()*+,.:;<=>?@^`{|}~\/\[\]\\\r\nbar')); // foo bar
* ```
*
* @official
*/
function stripHeading(heading: string): string;
/**
* Prepares headings for linking by stripping out some bad combinations of special characters that could break links.
*
* @param heading - The heading to prepare.
* @returns The prepared heading.
*
* @example
* ```ts
* console.log(stripHeadingForLink('foo:#|^\\\r\n%%[[]]bar')); // foo bar
* ```
*
* @official
*/
function stripHeadingForLink(heading: string): string;
}
declare module "obsidian" {
/**
* An instruction for the modal.
*
* @example
* ```ts
* const instruction: Instruction = { command: '↑↓', purpose: 'Navigate' };
* ```
* @since 0.9.20
*/
interface Instruction {
/**
* The command or the key combination.
*
* @example
* ```ts
* console.log(instruction.command); // ↑↓
* ```
* @official
* @since 0.9.20
*/
command: string;
/**
* The purpose of the command.
*
* @example
* ```ts
* console.log(instruction.purpose); // Navigate
* ```
* @official
* @since 0.9.20
*/
purpose: string;
}
}
declare module "obsidian" {
/**
* An owner that controls UI suggestions.
*
* @typeParam T - The type of the suggestion items.
*/
interface ISuggestOwner<T> {
/**
* Render the suggestion item into DOM.
*
* @param value - The value of the suggestion.
* @param el - The DOM element to render the suggestion into.
* @example
* ```ts
* class MySuggestOwner implements ISuggestOwner<string> {
* public renderSuggestion(value: string, el: HTMLElement): void {
* el.createEl('strong', { text: value });
* }
* }
* ```
* @official
*/
renderSuggestion(value: T, el: HTMLElement): void;
/**
* Called when the user makes a selection.
*
* @param value - The value of the suggestion.
* @param evt - The event that triggered the selection.
* @example
* ```ts
* class MySuggestOwner implements ISuggestOwner<string> {
* public selectSuggestion(value: string, evt: MouseEvent | KeyboardEvent): void {
* console.log(value, evt);
* }
* }
* ```
* @official
*/
selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void;
}
}
declare module "obsidian" {
/**
* Attach to an `<input>` element or a `<div contentEditable>` to add type-ahead
* support.
*
* @typeParam T - The type of the suggestion items.
* @since 1.4.10
*/
interface AbstractInputSuggest<T> extends PopoverSuggest<T> {
/**
* @todo Documentation incomplete.
* @unofficial
*/
lastRect: DOMRect;
/**
* Limit to the number of elements rendered at once. Set to 0 to disable. Defaults to 100.
*
* @official
* @since 1.4.10
*/
limit: number;
/**
* @todo Documentation incomplete.
* @unofficial
*/
textInputEl: HTMLInputElement | HTMLDivElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
autoReposition(): void;
/**
* Accepts an `<input>` text box or a contenteditable div.
*
* @param app - The app instance.
* @param textInputEl - The text input element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__2(app: App, textInputEl: HTMLInputElement | HTMLDivElement): this;
/**
* Gets the suggestions for the input element.
*
* @param query - The query to get suggestions for.
* @returns The suggestions for the input element.
* @example
* ```ts
* class MyInputSuggest extends AbstractInputSuggest<string> {
* protected override getSuggestions(query: string): string[] {
* return ['foo', 'bar'];
* }
* }
* ```
* @example
* ```ts
* class MyInputSuggest extends AbstractInputSuggest<string> {
* protected override async getSuggestions(query: string): Promise<string[]> {
* return await Promise.resolve(['foo', 'bar']);
* }
* }
* @official
* @deprecated - Added only for typing purposes. Use {@link getSuggestions} instead.
* @since 1.5.7
*/
getSuggestions__(query: string): T[] | Promise<T[]>;
/**
* Gets the value from the input element.
*
* @returns The value from the input element.
* @official
* @since 1.4.10
*/
getValue(): string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onInputChange(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onInputFocus(): void;
/**
* Registers a callback to handle when a suggestion is selected by the user.
*
* @param callback - The callback to handle when a suggestion is selected by the user.
* @returns The input suggest instance.
* @example
* ```ts
* inputSuggest.onSelect((value, evt) => {
* console.log(value, evt);
* });
* ```
* @official
* @since 1.4.10
*/
onSelect(callback: (value: T, evt: MouseEvent | KeyboardEvent) => unknown): this;
/**
* Callback for selecting a suggestion.
*
* @param value - The value of the suggestion.
* @param evt - The event that occurred.
* @returns The result of the callback.
* @unofficial
*/
selectCb?(value: T, evt: MouseEvent | KeyboardEvent): unknown;
/**
* Select a suggestion.
*
* @param value - The value of the suggestion.
* @param evt - The event that occurred.
* @example
* ```ts
* inputSuggest.selectSuggestion('foo', new MouseEvent('click'));
* ```
* @official
* @since 1.6.6
*/
selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void;
/**
* Sets the value into the input element.
*
* @param value - The value to set.
* @example
* ```ts
* inputSuggest.setValue('foo');
* ```
* @official
* @since 1.4.10
*/
setValue(value: string): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
showSuggestions(suggestions: SearchResult[]): void;
}
}
declare module "obsidian" {
/**
* Base class for adding a type-ahead popover.
*
* @typeParam T - The type of the suggestion items.
*/
interface PopoverSuggest<T> extends ISuggestOwner<T>, CloseableComponent {
/**
* The Obsidian app instance.
*
* @official
*/
app: App;
/**
* Whether the suggestion popup is currently open and visible.
*
* @unofficial
*/
isOpen: boolean;
/**
* The scope for the keymaps.
*
* @official
*/
scope: Scope;
/**
* Suggestion container element.
*
* @unofficial
*/
suggestEl: HTMLDivElement;
/**
* Handles selection and rendering of the suggestions.
*
* @unofficial
*/
suggestions: SuggestionContainer<T>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
autoDestroy?(): void;
/**
* Closes the popover.
*
* @official
*/
close(): void;
/**
* Creates a new PopoverSuggest.
*
* @param app - The Obsidian app instance.
* @param scope - The scope for the keymaps.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(app: App, scope?: Scope): this;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onEscapeKey(): void;
/**
* Opens the popover.
*
* @official
*/
open(): void;
/**
* Render the suggestion.
*
* @param value - The value to render.
* @param el - The element to render the suggestion to.
* @example
* ```ts
* class MyPopoverSuggest extends PopoverSuggest<string> {
* public override renderSuggestion(value: string, el: HTMLElement): void {
* el.createEl('strong', { text: value });
* }
* }
* ```
* @inheritDoc
* @official
* @deprecated - Added only for typing purposes. Use {@link renderSuggestion} instead.
*/
renderSuggestion__(value: T, el: HTMLElement): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
reposition(rect: DOMRect, textDirection?: TextDirection): void;
/**
* Select the suggestion.
*
* @param value - The value to select.
* @param evt - The event that triggered the selection.
* @example
* ```ts
* class MyPopoverSuggest extends PopoverSuggest<string> {
* public override selectSuggestion(value: string, evt: MouseEvent | KeyboardEvent): void {
* console.log(value);
* }
* }
* ```
* @inheritDoc
* @official
* @deprecated - Added only for typing purposes. Use {@link selectSuggestion} instead.
*/
selectSuggestion__(value: T, evt: MouseEvent | KeyboardEvent): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
setAutoDestroy(el: HTMLElement): void;
}
}
declare module "obsidian" {
/**
* Base class for all plugins.
* @since 0.9.7
*/
interface Plugin extends Component {
/**
* The Obsidian app instance.
*
* @official
* @since 0.9.7
*/
app: App;
/**
* The plugin manifest.
*
* @official
* @since 0.9.7
*/
manifest: PluginManifest;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onConfigFileChange: Debouncer<[
], Promise<void>>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
_onConfigFileChange(): Promise<void>;
/**
* Register a command globally.
* Registered commands will be available from the {@link https://help.obsidian.md/Plugins/Command+palette Command palette}.
* The command id and name will be automatically prefixed with this plugin's id and name.
*
* @param command - The command to register.
* @returns The command object.
* @example
* ```ts
* plugin.addCommand({
* id: 'foo',
* name: 'Foo',
* });
* ```
* @official
* @since 0.9.7
*/
addCommand(command: Command): Command;
/**
* Adds a ribbon icon to the left bar.
*
* @param icon - The icon name to be used. See {@link addIcon}.
* @param title - The title to be displayed in the tooltip.
* @param callback - The `click` callback.
* @returns The HTMLElement for the ribbon icon.
* @example
* ```ts
* plugin.addRibbonIcon('dice', 'foo', (evt) => {
* console.log('clicked');
* });
* ```
* @official
* @since 0.9.7
*/
addRibbonIcon(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
/**
* Register a settings tab, which allows users to change settings.
* @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings#Register+a+settings+tab}.
* @param settingTab - The setting tab to register.
* @example
* ```ts
* plugin.addSettingTab(mySettingTab);
* ```
* @official
* @since 0.9.7
*/
addSettingTab(settingTab: PluginSettingTab): void;
/**
* Adds a status bar item to the bottom of the app.
* Not available on mobile.
* @see {@link https://docs.obsidian.md/Plugins/User+interface/Status+bar}.
* @return HTMLElement - element to modify.
* @official
* @since 0.9.7
*/
addStatusBarItem(): HTMLElement;
/**
* The constructor for the plugin.
*
* @param app - The Obsidian app instance.
* @param manifest - The plugin manifest.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(app: App, manifest: PluginManifest): this;
/**
* Load settings data from disk.
* Data is stored in `data.json` in the plugin folder.
* @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings}.
* @returns The promise that resolves to the settings data.
* @official
* @since 0.9.7
*/
loadData(): Promise<any>;
/**
* Called when the `data.json` file is modified on disk externally from Obsidian.
* This usually means that a Sync service or external program has modified
* the plugin settings.
*
* Implement this method to reload plugin settings when they have changed externally.
*
* @returns The result is discarded. The result is discarded. Usually it's `void` or `Promise<void>`.
* @official
* @since 1.5.7
*/
onExternalSettingsChange?(): any;
/**
* Called when the plugin is loaded.
*
* @official
* @since 0.9.7
*/
onload(): Promise<void> | void;
/**
* Perform any initial setup code. The user has explicitly interacted with the plugin.
* so its safe to engage with the user. If your plugin registers a custom view,
* you can open it here.
*
* @official
* @since 1.7.2
*/
onUserEnable(): void;
/**
* Register a Base view handler that can be used to render data from property queries.
*
* @param viewId - The id of the view to register.
* @param registration - The registration of the view to register.
* @returns false if bases are not enabled in this vault.
* @official
* @since 1.10.0
*/
registerBasesView(viewId: string, registration: BasesViewRegistration): boolean;
/**
* Registers a CodeMirror 6 extension.
* To reconfigure cm6 extensions for a plugin on the fly, an array should be passed in, and modified dynamically.
* Once this array is modified, calling {@link Workspace.updateOptions} will apply the changes.
* @param extension - must be a CodeMirror 6 `Extension`, or an array of Extensions.
* @example
* ```ts
* const myViewPlugin = ViewPlugin.fromClass(MyViewPlugin);
* const myStateField = StateField.define<DecorationSet>(myStateField);
* plugin.registerEditorExtension([myViewPlugin, myStateField]);
* ```
* @official
* @since 0.12.8
*/
registerEditorExtension(extension: Extension): void;
/**
* Register an EditorSuggest which can provide live suggestions while the user is typing.
*
* @param editorSuggest - The editor suggest to register.
* @example
* ```ts
* plugin.registerEditorSuggest(myEditorSuggest);
* ```
* @official
* @since 0.12.7
*/
registerEditorSuggest(editorSuggest: EditorSuggest<any>): void;
/**
* Register a set of extensions for a view type.
*
* @param extensions - The extensions to register.
* @param viewType - The type of the view to register.
* @example
* ```ts
* plugin.registerExtensions(['foo', 'bar'], 'baz');
* ```
* @official
* @since 0.9.7
*/
registerExtensions(extensions: string[], viewType: string): void;
/**
* Registers a view with the 'Page preview' core plugin as an emitter of the 'hover-link' event.
*
* @param id - The id of the view to register.
* @param info - The info of the view to register.
* @example
* ```ts
* plugin.registerHoverLinkSource('foo', {
* display: 'bar',
* defaultMod: true,
* });
* ```
* @official
* @since 1.1.0
*/
registerHoverLinkSource(id: string, info: HoverLinkSource): void;
/**
* Register a special post processor that handles fenced code given a language and a handler.
* This special post processor takes care of removing the `<pre><code>` and create a `<div>` that
* will be passed to the handler, and is expected to be filled with custom elements.
* @see {@link https://docs.obsidian.md/Plugins/Editor/Markdown+post+processing#Post-process+Markdown+code+blocks}.
* @param language - The language of the code block to register.
* @param handler - The handler to register.
* @param sortOrder - The sort order of the post processor.
* @returns The code block processor.
* @example
* ```ts
* plugin.registerMarkdownCodeBlockProcessor('foo', (source, el, ctx) => {
* el.createEl('strong');
* });
* ```
* @official
* @since 0.9.7
*/
registerMarkdownCodeBlockProcessor(language: string, handler: (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise<any> | void, sortOrder?: number): MarkdownPostProcessor;
/**
* Registers a post processor, to change how the document looks in reading mode.
* @see {@link https://docs.obsidian.md/Plugins/Editor/Markdown+post+processing}.
* @param postProcessor - The post processor to register.
* @param sortOrder - The sort order of the post processor.
* @returns The post processor.
* @example
* ```ts
* plugin.registerMarkdownPostProcessor((el, ctx) => {
* el.createEl('strong');
* });
* ```
* @official
* @since 0.9.7
*/
registerMarkdownPostProcessor(postProcessor: MarkdownPostProcessor, sortOrder?: number): MarkdownPostProcessor;
/**
* Register a handler for obsidian:// URLs.
*
* @param action - the action string. For example, 'open' corresponds to `obsidian://open`.
* @param handler - the callback to trigger. A key-value pair that is decoded from the query will be passed in.
* For example, `obsidian://open?key=value` would generate `{'action': 'open', 'key': 'value'}`.
* @example
* ```ts
* plugin.registerObsidianProtocolHandler('foo', (params) => {
* console.log(params);
* });
* ```
* @official
* @since 0.11.0
*/
registerObsidianProtocolHandler(action: string, handler: ObsidianProtocolHandler): void;
/**
* Register a custom view.
*
* @param type - The type of the view to register.
* @param viewCreator - The view creator to register.
* @example
* ```ts
* plugin.registerView('my-view', (leaf) => {
* return new MyView(leaf);
* });
* ```
* @official
* @since 0.9.7
*/
registerView(type: string, viewCreator: ViewCreator): void;
/**
* Manually remove a command from the list of global commands.
* This should not be needed unless your plugin registers commands dynamically.
*
* @param commandId - The id of the command to remove.
* @example
* ```ts
* plugin.removeCommand('foo');
* ```
* @official
* @since 1.7.2
*/
removeCommand(commandId: string): void;
/**
* Write settings data to disk.
* Data is stored in `data.json` in the plugin folder.
* @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings}.
* @param data - The settings data to save.
* @returns The promise that resolves when the data is saved.
* @example
* ```ts
* await plugin.saveData({ foo: 'bar' });
* ```
* @official
* @since 0.9.7
*/
saveData(data: any): Promise<void>;
}
}
declare module "obsidian" {
/**
* Base class for all views.
* @since 0.9.7
*/
interface View extends Component {
/**
* The Obsidian app instance.
*
* @official
* @since 0.9.7
*/
app: App;
/**
* Whether the leaf may close the view.
*
* @unofficial
*/
closeable: boolean;
/**
* The container HTML element for the component.
*
* @official
* @since 0.9.7
*/
containerEl: HTMLElement;
/**
* The icon of the view.
*
* @official
* @since 1.1.0
*/
icon: IconName;
/**
* The leaf of the view.
*
* @official
* @since 0.9.7
*/
leaf: WorkspaceLeaf;
/**
* Whether or not the view is intended for navigation.
* If your view is a static view that is not intended to be navigated away, set this to false.
* (For example: File explorer, calendar, etc.)
* If your view opens a file or can be otherwise navigated, set this to true.
* (For example: Markdown editor view, Kanban view, PDF view, etc.)
*
* @official
* @since 0.15.1
*/
navigation: boolean;
/**
* Assign an optional scope to your view to register hotkeys for when the view.
* is in focus.
*
* @example
* ```ts
* this.scope = new Scope(this.app.scope);
* ```
* @default `null`
* @official
* @since 1.5.7
*/
scope: Scope | null;
/**
* Closes the view.
*
* @unofficial
*/
close(): Promise<void>;
/**
* Creates a new view.
*
* @param leaf - The leaf of the view.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
* @since 0.9.7
*/
constructor__(leaf: WorkspaceLeaf): this;
/**
* Get the display text of the view.
*
* @returns The display text of the view.
* @official
* @deprecated - Added only for typing purposes. Use {@link getDisplayText} instead.
* @since 0.9.7
*/
getDisplayText__?(): string;
/**
* Get the ephemeral state of the view.
*
* @returns The ephemeral state of the view.
* @official
* @since 0.9.7
*/
getEphemeralState(): Record<string, unknown>;
/**
* Get the icon of the view.
*
* @returns The icon of the view.
* @official
* @since 1.1.0
*/
getIcon(): IconName;
/**
* Returns the placement of the tooltip.
*
* @unofficial
*/
getSideTooltipPlacement(): "left" | "right" | undefined;
/**
* Get the state of the view.
*
* @returns The state of the view.
* @official
* @since 0.9.7
*/
getState(): Record<string, unknown>;
/**
* The type of the view.
*
* @returns The type of the view.
* @official
* @deprecated - Added only for typing purposes. Use {@link getViewType} instead.
* @since 0.9.7
*/
getViewType__?(): string;
/**
* Handle copy event on metadata editor and serialize properties.
*
* @unofficial
*/
handleCopy(event: ClipboardEvent): void;
/**
* Handle cut event on metadata editor and serialize and remove properties.
*
* @unofficial
*/
handleCut(event: ClipboardEvent): void;
/**
* Handle paste event of properties on metadata editor.
*
* @unofficial
*/
handlePaste(event: ClipboardEvent): void;
/**
* Called when the view is closed.
*
* @returns A promise that resolves when the view is closed.
* @official
* @deprecated - Added only for typing purposes. Use {@link onClose} instead.
* @since 0.9.7
*/
onClose__?(): Promise<void>;
/**
* @deprecated use {@link onPaneMenu} instead
* @unofficial
*/
onHeaderMenu(e: unknown): void;
/**
* Called when the view is opened.
*
* @returns A promise that resolves when the view is opened.
* @official
* @deprecated - Added only for typing purposes. Use {@link onOpen} instead.
* @since 0.9.7
*/
onOpen__?(): Promise<void>;
/**
* Populates the pane menu.
*
* (Replaces the previously removed `onHeaderMenu` and `onMoreOptionsMenu`)
*
* @param menu - The menu to populate.
* @param source - The source of the menu.
* @official
* @since 0.15.3
*/
onPaneMenu(menu: Menu, source: "more-options" | "tab-header" | string): void;
/**
* Called when the size of this view is changed.
*
* @official
* @since 0.9.7
*/
onResize(): void;
/**
* Adds the menu items to the menu.
*
* @param menu the menu to fill.
* @unofficial
*/
onTabMenu(menu: Menu): void;
/**
* Opens the view.
*
* @param parentEl The node the view get attached to.
* @unofficial
*/
open(parentEl: Node): Promise<void>;
/**
* Set the ephemeral state of the view.
*
* @param state - The ephemeral state of the view.
* @example
* ```ts
* this.setEphemeralState({ foo: 'bar' });
* ```
* @official
* @since 0.9.7
*/
setEphemeralState(state: unknown): void;
/**
* Set the state of the view.
*
* @param state - The state of the view.
* @param result - The result of the view.
* @returns A promise that resolves when the state is set.
* @example
* ```ts
* this.setState({ foo: 'bar' }, { history: true });
* ```
* @official
* @since 0.9.7
*/
setState(state: unknown, result: ViewStateResult): Promise<void>;
}
}
declare module "obsidian" {
/**
* Base interface for items that point to a different location.
*/
interface Reference {
/**
* Display text of the link.
*
* @example
* For the following links:
*
* ```md
* [[foo|bar]]
* [[foo]]
* [foo](bar.md)
* 
* ```
*
* `displayText` will be:
*
* ```
* 'bar'
* 'foo'
* 'foo'
* ''
* ```
* @official
*/
displayText?: string;
/**
* Link destination.
*
* @official
*/
link: string;
/**
* Contains the text as it's written in the document. Not available on Publish.
*
* @official
*/
original: string;
}
}
declare module "obsidian" {
/**
* Base option.
*
* @since 1.10.0
*/
interface BaseOption {
/**
* Display name.
*
* @official
* @since 1.10.0
*/
displayName: string;
/**
* Key.
*
* @official
* @since 1.10.0
*/
key: string;
/**
* If provided, the option will be hidden if the function returns true.
*
* @param config - Read-only copy of the current view configuration.
* @returns `true` if the option should be hidden, false otherwise.
* @official
* @since 1.10.2
*/
shouldHide?: (config: BasesViewConfig) => boolean;
/**
* Type
* @official
* @since 1.10.0
*/
type: string;
}
}
declare module "obsidian" {
/**
* Base type for all non-null {@link Values}.
*
* @since 1.10.0
*/
interface NotNullValue extends Value {
}
}
declare module "obsidian" {
/**
* Base type for {@link Values} which wrap a single primitive.
*
* @since 1.10.0
*/
interface PrimitiveValue<T> extends NotNullValue {
/**
* Constructor.
*
* @param value - The value to wrap.
* @returns The new PrimitiveValue.
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link PrimitiveValue.constructor} instead.
*/
constructor__(value: T): this;
/**
* Returns a boolean indicating whether this PrimitiveValue is truthy.
*
* @returns A boolean indicating whether this PrimitiveValue is truthy.
* @official
* @since 1.10.0
*/
isTruthy(): boolean;
/**
* Get the string representation of this PrimitiveValue.
*
* @returns The string representation of this PrimitiveValue.
* @official
* @since 1.10.0
*/
toString(): string;
}
}
declare module "obsidian" {
/**
* Bases sort config.
*
* @since 1.10.0
*/
interface BasesSortConfig__ {
/**
* Direction.
*
* @official
* @since 1.10.0
*/
direction: "ASC" | "DESC";
/**
* Property.
*
* @official
* @since 1.10.0
*/
property: BasesPropertyId;
}
}
declare module "obsidian" {
/**
* Cached metadata for a note.
*/
interface CachedMetadata {
/**
* The cache of the blocks in the note.
*
* ```markdown
* foo ^bar
* ```
*
* @official
*/
blocks?: Record<string, BlockCache>;
/**
* The cache of the embeds in the note.
*
* ```markdown
* ![[wikilink]]
* ![[wikilink|alias]]
* 
* ```
*
* @official
*/
embeds?: EmbedCache[];
/**
* The cache of the footnote references in the note.
*
* ```markdown
* foo [^1]
*
* [^1]: bar
*
* baz [^qux]
*
* [^qux]: quux
* ```
*
* @official
* @since 1.8.7
*/
footnoteRefs?: FootnoteRefCache[];
/**
* The cache of the footnotes in the note.
*
* ```markdown
* foo [^1]
*
* [^1]: bar
*
* baz [^qux]
*
* [^qux]: quux
* ```
*
* @official
* @since 1.6.6
*/
footnotes?: FootnoteCache[];
/**
* The cache of the frontmatter in the note.
* Frontmatter is a block of metadata that is used to store information about the note.
*
* ```markdown
* ---
* key1: "value1",
* key2: 42
* ---
* ```
*
* @official
*/
frontmatter?: FrontMatterCache;
/**
* The cache of the links in the frontmatter.
*
* ```markdown
* ---
* key1: "[[wikilink]]"
* key2: "[[wikilink|alias]]"
* ---
* ```
*
* @official
* @since 1.4.0
*/
frontmatterLinks?: FrontmatterLinkCache[];
/**
* Position of the frontmatter in the file.
*
* ```markdown
* ---
* key1: "value1",
* key2: 42
* ---
*
* ```
*
* @official
* @since 1.4.0
*/
frontmatterPosition?: Pos;
/**
* The cache of the headings in the note.
*
* ```markdown
* # foo
* ## bar
* ### baz
* ```
*
* @official
*/
headings?: HeadingCache[];
/**
* The cache of the links in the note.
*
* ```markdown
* [[wikilink]]
* [[wikilink|alias]]
* [alias](markdown-link)
* ```
*
* @official
*/
links?: LinkCache[];
/**
* The cache of the list items in the note.
* List items are markdown blocks that are used to create lists.
*
* ```markdown
* - Unordered List Item 1
* - Unordered List Item 2
* - Unordered List Item 3
*
* 1. Ordered List Item 1
* 2. Ordered List Item 2
* 3. Ordered List Item 3
* ```
*
* @official
*/
listItems?: ListItemCache[];
/**
* The cache of the reference links in the note.
*
* ```markdown
* [google]
*
* [google]: https://google.com
* ```
*
* @official
* @since 1.8.7
*/
referenceLinks?: ReferenceLinkCache[];
/**
* The cache of the sections in the note.
* Sections are root level markdown blocks, which can be used to divide the document up.
*
* ```markdown
* # Heading section
*
* Paragraph section
*
* > [!NOTE]
* > Callout section
* ```
*
* @official
*/
sections?: SectionCache[];
/**
* The cache of the tags in the note.
*
* ```markdown
* ---
* tags:
* - foo
* - bar
* ---
*
* #baz
* ```
*
* @official
*/
tags?: TagCache[];
}
}
declare module "obsidian" {
/**
* Can be any Lucide icon name or an internal icon name.
*
* @deprecated - Added only for typing purposes. Use {@link IconName} instead.
*/
type IconName__ = string;
}
declare module "obsidian" {
/**
* Collapsible container for other ViewOptions.
*
* @since 1.10.0
*/
interface GroupOption {
/**
* Display name.
*
* @official
* @since 1.10.0
*/
displayName: string;
/**
* Items.
*
* @official
* @since 1.10.0
*/
items: Exclude<ViewOption, GroupOption>[];
/**
* If provided, the group will be hidden if the function returns true.
*
* @param config - Read-only copy of the current view configuration.
* @returns `true` if the group should be hidden, `false` otherwise.
* @official
* @since 1.10.2
*/
shouldHide?: (config: BasesViewConfig) => boolean;
/**
* Type.
*
* @official
* @since 1.10.0
*/
type: "group";
}
}
declare module "obsidian" {
/**
* Color picker component. Values are by default 6-digit hash-prefixed hex strings like `#000000`.
* @since 1.0.0
*/
interface ColorComponent extends ValueComponent<string> {
/**
* Access the underlying input element of type "color".
*
* @unofficial
*/
colorPickerEl: HTMLInputElement;
/**
* The function that's called after changing the value of the component.
*
* @remark Using `ColorComponent.onChange(callback)` assigns the callback to this method.
* @unofficial
*/
changeCallback?(value: HexString): void;
/**
* Create a new color picker component.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Get the current value of the color picker.
*
* @returns The current value of the color picker.
* @official
* @since 1.0.0
*/
getValue(): HexString;
/**
* Get the current value of the color picker as an HSL object.
*
* @returns The current value of the color picker as an HSL object.
* @official
* @since 1.0.0
*/
getValueHsl(): HSL;
/**
* @todo Documentation incomplete.
* @unofficial
*/
getValueInt(): number;
/**
* Get the current value of the color picker as an RGB object.
*
* @returns The current value of the color picker as an RGB object.
* @official
* @since 1.0.0
*/
getValueRgb(): RGB;
/**
* Set the callback to be called when the color picker value changes.
*
* @param callback - The callback to be called when the color picker value changes.
* @returns The color picker.
* @example
* ```ts
* colorPicker.onChange((value) => {
* console.log(value);
* });
* ```
* @official
* @since 1.0.0
*/
onChange(callback: (value: string) => any): this;
/**
* Disable the color picker.
*
* @param disabled - Whether to disable the color picker.
* @example
* ```ts
* colorPicker.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Set the current value of the color picker.
*
* @param value - The value to set the color picker to.
* @returns The color picker.
* @example
* ```ts
* colorPicker.setValue('#000000');
* ```
* @official
* @since 1.0.0
*/
setValue(value: HexString): this;
/**
* Set the current value of the color picker as an HSL object.
*
* @param hsl - The HSL object to set the color picker to.
* @returns The color picker.
* @example
* ```ts
* colorPicker.setValueHsl({ h: 0, s: 0, l: 0 });
* ```
* @official
* @since 1.0.0
*/
setValueHsl(hsl: HSL): this;
/**
* @todo Documentation incomplete.
* @unofficial
*/
setValueInt(value: number): this;
/**
* Set the current value of the color picker as an RGB object.
*
* @param rgb - The RGB object to set the color picker to.
* @returns The color picker.
* @example
* ```ts
* colorPicker.setValueRgb({ r: 0, g: 0, b: 0 });
* ```
* @official
* @since 1.0.0
*/
setValueRgb(rgb: RGB): this;
}
}
declare module "obsidian" {
/**
* Component for a secret input.
*
* @since 1.11.1
*/
interface SecretComponent extends BaseComponent {
/**
* Creates a new secret component.
*
* @param app - the application instance.
* @param containerEl - the container element.
* @returns the secret component instance.
* @official
* @since 1.11.1
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(app: App, containerEl: HTMLElement): this;
/**
* Sets the callback function to be called when the value of the secret component changes.
*
* @param cb - the callback function.
* @returns the secret component instance.
* @public
* @since 1.11.4
* @unofficial ERROR: Missing `@unofficial` or `@official` tag
*/
onChange(cb: (value: string) => unknown): this;
/**
* Sets the value of the secret component.
*
* @param value - the value to set.
* @returns the secret component instance.
* @public
* @since 1.11.4
* @unofficial ERROR: Missing `@unofficial` or `@official` tag
*/
setValue(value: string): this;
}
}
declare module "obsidian" {
/**
* Component for a text input or text area.
*
* @typeParam T - The type of the input element.
* @since 0.9.21
*/
interface AbstractTextComponent<T extends HTMLInputElement | HTMLTextAreaElement> extends ValueComponent<string> {
/**
* The input element.
*
* @official
* @since 0.9.7
*/
inputEl: T;
/**
* The function that's called after changing the value of the component.
*
* @remark Using `AbstractTextComponent.onChange(callback)` assigns the callback to this method.
* @unofficial
*/
changeCallback?(value: string): void;
/**
* Creates a new text component.
*
* @param inputEl - The input element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(inputEl: T): this;
/**
* Gets the value of the input element.
*
* @returns The value of the input element.
* @official
* @since 0.9.7
*/
getValue(): string;
/**
* Sets the callback to handle when the value of the input element changes.
*
* @param callback - The callback to handle when the value of the input element changes.
* @returns The text component.
* @example
* ```ts
* textComponent.onChange((value) => {
* console.log(value);
* });
* ```
* @official
* @since 0.9.7
*/
onChange(callback: (value: string) => any): this;
/**
* Manually invokes the callback registered with `onChange`.
*
* @official
* @since 0.9.21
*/
onChanged(): void;
/**
* Sets the disabled state of the input element.
*
* @param disabled - Whether to disable the input element.
* @returns The text component.
* @example
* ```ts
* textComponent.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Sets the placeholder of the input element.
*
* @param placeholder - The placeholder to set.
* @returns The text component.
* @example
* ```ts
* textComponent.setPlaceholder('foo');
* ```
* @official
* @since 0.9.7
*/
setPlaceholder(placeholder: string): this;
/**
* Sets the value of the input element.
*
* @param value - The value to set.
* @returns The text component.
* @example
* ```ts
* textComponent.setValue('foo');
* ```
* @official
* @since 0.9.7
*/
setValue(value: string): this;
}
}
declare module "obsidian" {
/**
* Container for options when registering a new Bases view type.
*
* @since 1.10.0
*/
interface BasesViewRegistration {
/**
* Factory.
*
* @official
* @since 1.10.0
*/
factory: BasesViewFactory;
/**
* Icon ID to be used in the Bases view selector.
* See {@link https://docs.obsidian.md/Plugins/User+interface/Icons} for available icons and how to add your own.
* @official
* @since 1.10.0
*/
icon: IconName;
/**
* Name.
*
* @official
* @since 1.10.0
*/
name: string;
/**
* Options.
*
* @official
* @since 1.10.0
*/
options?: () => ViewOption[];
}
}
declare module "obsidian" {
/**
* Container type for data which can expose functions for retrieving, comparing, and rendering the data.
* Most commonly used in conjunction with formulas for Bases. Values can be used as formula parameters,
* intermediate values, and the result of evaluation.
*
* @since 1.10.0
*/
interface Value {
/**
* Returns a boolean indicating whether this Value is equal to the provided Value.
*
* @param other - The Value to compare to.
* @returns A boolean indicating whether this Value is equal to the provided Value.
* @official
* @since 1.10.0
*/
equals(other: this): boolean;
/**
* Returns a boolean indicating whether this Value is truthy.
*
* @returns A boolean indicating whether this Value is truthy.
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link Value.isTruthy} instead.
*/
isTruthy__(): boolean;
/**
* Returns a boolean indicating whether this Value is loosely equal to the provided Value.
*
* @param other - The Value to compare to.
* @returns A boolean indicating whether this Value is loosely equal to the provided Value.
* @official
* @since 1.10.0
*/
looseEquals(other: Value): boolean;
/**
* Render this value into the provided HTMLElement.
*
* @param el - The HTMLElement to render to.
* @param ctx - The RenderContext to render to.
* @official
* @since 1.10.0
*/
renderTo(el: HTMLElement, ctx: RenderContext): void;
/**
* Get the string representation of this Value.
*
* @returns The string representation of this Value.
* @deprecated - Added only for typing purposes. Use {@link Value.toString} instead.
* @official
* @since 1.10.0
*/
toString__(): string;
}
namespace Value {
/**
* The type of the value.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link Value.type} instead.
*/
let type__: string;
/**
* Equals.
*
* @param a - The Value to compare to.
* @param b - The Value to compare to.
* @returns A boolean indicating whether this Value is equal to the provided Value.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link Value.equals} instead.
*/
function equals__(a: Value | null, b: Value | null): boolean;
/**
* Loose equals.
*
* @param a - The Value to compare to.
* @param b - The Value to compare to.
* @returns A boolean indicating whether this Value is loosely equal to the provided Value.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link Value.looseEquals} instead.
*/
function looseEquals__(a: Value | null, b: Value | null): boolean;
}
}
declare module "obsidian" {
/**
* Context of the keymap.
*/
interface KeymapContext extends KeymapInfo {
/**
* Interpreted virtual key.
*
* @official
*/
vkey: string;
}
}
declare module "obsidian" {
/**
* Custom options for writing to a file.
*/
interface DataWriteOptions {
/**
* Time of creation, represented as a unix timestamp, in milliseconds.
* Omit this if you want to keep the default behavior.
*
* @official
*/
ctime?: number;
/**
* Time of last modification, represented as a unix timestamp, in milliseconds.
* Omit this if you want to keep the default behavior.
*
* @official
*/
mtime?: number;
}
}
declare module "obsidian" {
/**
* Describes a text range in a Markdown document.
*/
interface Pos {
/**
* End location.
*
* @official
*/
end: Loc;
/**
* Starting location.
*
* @official
*/
start: Loc;
}
}
declare module "obsidian" {
/**
* Dropdown component
* @since 0.9.7
*/
interface DropdownComponent extends ValueComponent<string> {
/**
* The HTML element representation of the dropdown.
*
* @official
* @since 0.9.7
*/
selectEl: HTMLSelectElement;
/**
* Add an option to the dropdown.
*
* @param value - The value of the option.
* @param display - The display of the option.
* @returns The dropdown component.
* @example
* ```ts
* dropdown.addOption('foo', 'bar');
* ```
* @official
* @since 0.9.7
*/
addOption(value: string, display: string): this;
/**
* Add multiple options to the dropdown.
*
* @param options - The options to add.
* @returns The dropdown component.
* @example
* ```ts
* dropdown.addOptions({ foo: 'bar', baz: 'qux' });
* ```
* @official
* @since 0.9.7
*/
addOptions(options: Record<string, string>): this;
/**
* The function that's called after changing the value of the component.
*
* @remark Using `DropdownComponent.onChange(callback)` assigns the callback to this method.
* @unofficial
*/
changeCallback?(value: string): void;
/**
* Create a dropdown component.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Get the selected value of the dropdown.
*
* @returns The selected value of the dropdown.
* @official
* @since 0.9.7
*/
getValue(): string;
/**
* Set the callback function to be called when the dropdown value changes.
*
* @param callback - The callback function.
* @returns The dropdown component.
* @example
* ```ts
* dropdown.onChange((value) => console.log(value));
* ```
* @official
* @since 0.9.7
*/
onChange(callback: (value: string) => any): this;
/**
* Set the disabled state of the dropdown.
*
* @param disabled - Whether the dropdown is disabled.
* @returns The dropdown component.
* @example
* ```ts
* dropdown.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Set the selected value of the dropdown.
*
* @param value - The value to set.
* @returns The dropdown component.
* @example
* ```ts
* dropdown.setValue('foo');
* ```
* @official
* @since 0.9.7
*/
setValue(value: string): this;
}
}
declare module "obsidian" {
/**
* Dropdown option.
*
* @since 1.10.0
*/
interface DropdownOption extends BaseOption {
/**
* Default value.
*
* @official
* @since 1.10.0
*/
default?: string;
/**
* Options.
*
* @official
* @since 1.10.0
*/
options: Record<string, string>;
/**
* Type.
*
* @official
* @since 1.10.0
*/
type: "dropdown";
}
}
declare module "obsidian" {
/**
* Editable file view
* @since 0.9.7
*/
interface EditableFileView extends FileView {
/**
* The file that is currently being renamed.
*
* @unofficial
*/
fileBeingRenamed: null | TFile;
/**
* Is called when the titleEl looses focus.
*
* Event type: 'blur'.
*
* @unofficial
*/
onTitleBlur(): Promise<void>;
/**
* Is called when the titleEl is changed.
*
* Event type: 'input'.
*
* @unofficial
* @param titleEl The titleEl of the view.
*/
onTitleChange(titleEl: HTMLElement): void;
/**
* Is called when the titleEl gains focus.
*
* Event type: 'focus'.
*
* @unofficial
*/
onTitleFocus(): void;
/**
* Is called when the titleEl is focused and a keydown is triggered.
*
* Event type: 'keydown'.
*
* @param event The KeyboardEvent which triggered this function.
* @unofficial
*/
onTitleKeydown(event: KeyboardEvent): void;
/**
* Is called when the titleEl is focused and a paste event is triggered.
*
* Event type: 'paste'.
*
* @param titleEl The titleEl of the view.
* @param event The ClipboardEvent which triggered this function.
* @unofficial
*/
onTitlePaste(titleEl: HTMLElement, event: ClipboardEvent): void;
/**
* Updates the file to match the updated title.
*
* @param titleEl The current titleEl.
* @unofficial
*/
saveTitle(titleEl: HTMLElement): Promise<void>;
}
}
declare module "obsidian" {
/**
* Event emitter implementation
* @since 0.9.7
*/
interface Events {
/**
* @todo Documentation incomplete.
* @unofficial
*/
_: Record<string, EventsEntry[]>;
/**
* Remove an event listener.
*
* @param name - The name of the event.
* @param callback - The callback to remove.
* @example
* ```ts
* events.off('my-event', myListener);
* ```
* @official
* @since 0.9.7
*/
off(name: string, callback: (...data: unknown[]) => unknown): void;
/**
* Remove an event listener by reference.
*
* @param ref - The reference to the event listener.
* @example
* ```ts
* events.offref(myRef);
* ```
* @official
* @since 0.9.7
*/
offref(ref: EventRef): void;
/**
* Add an event listener.
*
* @param name - The name of the event.
* @param callback - The callback to call when the event is triggered.
* @param ctx - The context passed as `this` to the `callback`.
* @returns A reference to the event listener.
* @example
* ```ts
* events.on('my-event', (arg1, arg2) => {
* console.log(arg1, arg2);
* });
* ```
* @official
* @since 0.9.7
*/
on(name: string, callback: (...data: unknown[]) => unknown, ctx?: any): EventRef;
/**
* Trigger an event, executing all the listeners in order even if some of them throw an error.
*
* @param name - The name of the event.
* @param data - The data to pass to the event listeners.
* @example
* ```ts
* events.trigger('my-event', 'arg1', 'arg2');
* ```
* @official
* @since 0.9.7
*/
trigger(name: string, ...data: unknown[]): void;
/**
* Try to trigger an event, executing all the listeners in order even if some of them throw an error.
*
* @param evt - The event reference.
* @param args - The data to pass to the event listeners.
* @example
* ```ts
* events.tryTrigger(myRef, ['arg1', 'arg2']);
* ```
* @official
* @since 0.9.7
*/
tryTrigger(evt: EventRef, args: unknown[]): void;
}
}
declare module "obsidian" {
/**
* Event handler for the keymap.
*/
interface KeymapEventHandler extends KeymapInfo {
/**
* The scope of the keymap.
*
* @official
*/
scope: Scope;
}
}
declare module "obsidian" {
/**
* Event reference
*/
interface EventRef {
/**
* Context applied to the event callback.
*
* @unofficial
*/
ctx?: unknown;
/**
* Events object the event was registered on.
*
* @unofficial
*/
e: Events;
/**
* Event name the event was registered on.
*
* @unofficial
*/
name: string;
/**
* Function to be called on event trigger on the events object.
*
* @unofficial
*/
fn(...arg: unknown[]): void;
}
}
declare module "obsidian" {
/**
* Extra button component, for secondary actions.
* @since 0.9.7
*/
interface ExtraButtonComponent extends BaseComponent {
/**
* The HTML element representation of the extra button.
*
* @official
* @since 0.9.7
*/
extraSettingsEl: HTMLElement;
/**
* The function that's called after clicking the button.
*
* @remark Using `ExtraButtonComponent.onClick(callback)` assigns the callback to this method.
* @unofficial
*/
changeCallback?(): void;
/**
* Create a new ExtraButtonComponent.
*
* @param containerEl - The container element.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Set the click callback of the extra button.
*
* @param callback - The callback to call when the button is clicked.
* @returns The extra button component.
* @example
* ```ts
* extraButton.onClick(() => {
* console.log('Button clicked');
* });
* ```
* @official
* @since 0.9.7
*/
onClick(callback: () => any): this;
/**
* Set the disabled state of the extra button.
*
* @param disabled - Whether the button is disabled.
* @returns The extra button component.
* @example
* ```ts
* extraButton.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Set the icon of the extra button.
*
* @param icon - ID of the icon, can use any icon loaded with {@link addIcon} or from the inbuilt library.
* @see The Obsidian icon library includes the {@link https://lucide.dev/ Lucide icon library}, any icon name from their site will work here.
* @returns The extra button component.
* @example
* ```ts
* extraButton.setIcon('dice');
* ```
* @official
* @since 0.9.7
*/
setIcon(icon: IconName): this;
/**
* Set the tooltip of the extra button.
*
* @param tooltip - The tooltip text.
* @param options - The tooltip options.
* @returns The extra button component.
* @example
* ```ts
* extraButton.setTooltip('Tooltip text');
* ```
* @official
* @since 1.1.0
*/
setTooltip(tooltip: string, options?: TooltipOptions): this;
}
}
declare module "obsidian" {
/**
* File stats
*/
interface FileStats {
/**
* Time of creation, represented as a unix timestamp, in milliseconds.
*
* @official
*/
ctime: number;
/**
* Time of last modification, represented as a unix timestamp, in milliseconds.
*
* @official
*/
mtime: number;
/**
* Size on disk, as bytes.
*
* @official
*/
size: number;
}
}
declare module "obsidian" {
/**
* File view
*/
interface FileView extends ItemView {
/**
* Whether the view may be run without an attached file..
*
* @official
*/
allowNoFile: boolean;
/**
* The file that is currently being viewed.
*
* @official
*/
file: TFile | null;
/**
* Whether the file view can be navigated (`true` by default).
*
* @inheritDoc
* @official
*/
navigation: boolean;
/**
* Whether the file view can accept an extension.
*
* @param extension - The extension to check.
* @returns Whether the file view can accept the extension.
* @example
* ```ts
* console.log(fileView.canAcceptExtension('md'));
* ```
* @official
* @since 0.9.7
*/
canAcceptExtension(extension: string): boolean;
/**
* Create a new file view.
*
* @param leaf - The workspace leaf to create the file view in.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(leaf: WorkspaceLeaf): this;
/**
* Get the display text for the file view.
*
* @returns The display text for the file view.
* @official
*/
getDisplayText(): string;
/**
* Get the state of the file view.
*
* @returns The state of the file view.
* @official
*/
getState(): Record<string, unknown>;
/**
* Get view state for sync plugin.
*
* @unofficial
*/
getSyncViewState(): unknown;
/**
* Loads the file with the onLoadFile function.
*
* @param file The File to load.
* @unofficial
*/
loadFile(file: TFile): Promise<unknown>;
/**
* Updates the view if it contains the deleted file.
*
* @param file The file that is deleted.
* @unofficial
*/
onDelete(file: TFile): Promise<void>;
/**
* Called when the file view is loaded.
*
* @official
*/
onload(): void;
/**
* Called when the file is loaded.
*
* @param file - The file that is being loaded.
* @returns A promise that resolves when the file is loaded.
* @example
* ```ts
* class MyFileView extends FileView {
* public override async onLoadFile(file: TFile): Promise<void> {
* await super.onLoadFile(file);
* console.log(file);
* }
* }
* ```
* @official
*/
onLoadFile(file: TFile): Promise<void>;
/**
* Called when the file is renamed.
*
* @param file - The file that is being renamed.
* @returns A promise that resolves when the file is renamed.
* @example
* ```ts
* class MyFileView extends FileView {
* public override async onRename(file: TFile): Promise<void> {
* await super.onRename(file);
* console.log(file);
* }
* }
* @official
*/
onRename(file: TFile): Promise<void>;
/**
* Called when the file is unloaded.
*
* @param file - The file that is being unloaded.
* @returns A promise that resolves when the file is unloaded.
* @example
* ```ts
* class MyFileView extends FileView {
* public override async onUnloadFile(file: TFile): Promise<void> {
* await super.onUnloadFile(file);
* console.log(file);
* }
* }
* @official
*/
onUnloadFile(file: TFile): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
renderBreadcrumbs(): void;
/**
* Set the state of the file view.
*
* @param state - The state to set.
* @param result - The result of the state.
* @returns A promise that resolves when the state is set.
* @example
* ```ts
* await fileView.setState({ foo: 'bar' }, { history: true });
* ```
* @official
* @since 0.9.7
*/
setState(state: any, result: ViewStateResult): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
syncState(e: boolean): Promise<unknown>;
}
}
declare module "obsidian" {
/**
* Hex strings are 6-digit hash-prefixed rgb strings in lowercase form.
*
* @example
* ```ts
* const hexString: HexString = '#ffffff';
* ```
*
* @deprecated - Added only for typing purposes. Use {@link HexString} instead.
*/
type HexString__ = string;
}
declare module "obsidian" {
/**
* Implement this factory function in a {@link BasesViewRegistration} to create a
* new instance of a custom Bases view.
* @param containerEl - The container below the Bases toolbar where the view will be displayed.
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link BasesViewFactory} instead.
*/
type BasesViewFactory__ = (controller: QueryController, containerEl: HTMLElement) => BasesView;
}
declare module "obsidian" {
/**
* Implementation of the vault adapter for desktop.
*
* `app.vault.adapter` returns an instance of `FileSystemAdapter` on desktop devices.
*/
interface FileSystemAdapter extends DataAdapter {
/**
* @todo Documentation incomplete.
* @unofficial
*/
btime: Btime;
/**
* Reference to node fs module.
*
* @unofficial
*/
fs: typeof fs;
/**
* Reference to node fs:promises module.
*
* @unofficial
*/
fsPromises: typeof fsPromises;
/**
* Reference to electron ipcRenderer module.
*
* @unofficial
*/
ipcRenderer?: IpcRenderer;
/**
* Kill last action.
*
* @unofficial
*/
killLastAction: null | ((e: Error) => void);
/**
* Reference to node path module.
*
* @unofficial
*/
path: typeof path;
/**
* Reference to node URL module.
*
* @unofficial
*/
url: typeof URL;
/**
* Seems to always be `null` and unused.
*
* @unofficial
*/
watcher: null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
watchers: DataAdapterWatchersRecord;
/**
* Appends data to a file.
*
* @param normalizedPath - The path to append.
* @param data - The data to append.
* @param options - The options to append.
* @returns A promise that resolves when the file is appended.
* @example
* ```ts
* await app.vault.adapter.append('foo/bar.md', 'baz');
* ```
* @official
*/
append(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
/**
* Apply data write options to file.
*
* @param normalizedPath Path to file.
* @param options Data write options.
* @unofficial
*/
applyWriteOptions(normalizedPath: string, options: DataWriteOptions): Promise<void>;
/**
* Copies a file.
*
* @param normalizedPath - The path to copy.
* @param normalizedNewPath - The new path.
* @returns A promise that resolves when the file is copied.
* @example
* ```ts
* await app.vault.adapter.copy('foo/bar.md', 'baz/qux.md');
* ```
* @official
*/
copy(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* Copy a file or directory recursively.
*
* @param sourcePath - Source path.
* @param destinationPath - Destination path.
* @returns A promise that resolves when the copy is complete.
* @unofficial
*/
copyRecursive(sourcePath: string, destinationPath: string): Promise<void>;
/**
* Checks if a file exists.
*
* @param normalizedPath - The path to check.
* @param sensitive - Whether to check case-sensitivity.
* @returns A promise that resolves with whether the file exists.
* @example
* ```ts
* console.log(await app.vault.adapter.exists('foo/bar.md'));
* ```
* @official
*/
exists(normalizedPath: string, sensitive?: boolean): Promise<boolean>;
/**
* Get the absolute path to the vault.
*
* @official
*/
getBasePath(): string;
/**
* Returns the file:// path of this file.
*
* @param normalizedPath - The path to get the file path for.
* @returns The file path.
* @example
* ```ts
* console.log('foo/bar.md'); // file:///C:/Users/John/Documents/ObsidianVault/foo/bar.md
* ```
* @official
* @since 0.14.3
*/
getFilePath(normalizedPath: string): string;
/**
* Gets the full path for a file.
*
* @param normalizedPath - The path to get the full path for.
* @returns The full path for the file.
* @example
* ```ts
* console.log(app.vault.adapter.getFullPath('foo/bar.md')) // C:\Users\John\Documents\ObsidianVault\foo\bar.md
* ```
* @official
*/
getFullPath(normalizedPath: string): string;
/**
* Get the name of the vault.
*
* @official
*/
getName(): string;
/**
* Returns a URI for the browser engine to use, for example to embed an image.
*
* @param normalizedPath - The path to get the resource path for.
* @returns A URI for the browser engine to use.
* @example
* ```ts
* console.log(app.vault.adapter.getResourcePath('foo/bar.jpg'));
* ```
* @official
*/
getResourcePath(normalizedPath: string): string;
/**
* Kill file system action due to timeout.
*
* @unofficial
*/
kill(): void;
/**
* Lists all files and folders inside a folder.
*
* @param normalizedPath - The path to list.
* @returns A promise that resolves with the listed files.
* @example
* ```ts
* console.log(await app.vault.adapter.list('foo'));
* ```
* @official
*/
list(normalizedPath: string): Promise<ListedFiles>;
/**
* Generates `this.files` from the file system.
*
* @unofficial
*/
listAll(): Promise<void>;
/**
* Helper function for `listRecursive` reads children of directory.
*
* @param normalizedPath Path to directory.
* @param child File entry.
* @unofficial
*/
listRecursiveChild(normalizedPath: string, child: string): Promise<void>;
/**
* Creates a new directory.
*
* @param normalizedPath - The path to create the directory.
* @returns A promise that resolves when the directory is created.
* @example
* ```ts
* await app.vault.adapter.mkdir('foo');
* ```
* @official
*/
mkdir(normalizedPath: string): Promise<void>;
/**
* Atomically read, modify, and save the contents of a plaintext file.
*
* @param normalizedPath - The path to process.
* @param fn - The function to process the file.
* @param options - The options to process the file.
* @returns A promise that resolves with the processed file.
* @example
* ```ts
* await app.vault.adapter.process('foo/bar.md', (data) => {
* return data.replace('foo', 'bar');
* });
* ```
* @official
*/
process(normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;
/**
* Reads a file.
*
* @param normalizedPath - The path to read.
* @returns A promise that resolves with the file content.
* @example
* ```ts
* console.log(await app.vault.adapter.read('foo/bar.md'));
* ```
* @official
*/
read(normalizedPath: string): Promise<string>;
/**
* Reads a file as a binary buffer.
*
* @param normalizedPath - The path to read.
* @returns A promise that resolves with the file content.
* @example
* ```ts
* console.log(await app.vault.adapter.readBinary('foo/bar.jpg'));
* ```
* @official
*/
readBinary(normalizedPath: string): Promise<ArrayBuffer>;
/**
* Reconcile file creation.
*
* @param normalizedPath - Path to file.
* @param normalizedNewPath - Path to new file.
* @param stats - Stats object.
* @unofficial
*/
reconcileFileCreation(normalizedPath: string, normalizedNewPath: string, stats: Stats): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
reconcileFileInternal(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* Removes a file.
*
* @param normalizedPath - The path to remove.
* @returns A promise that resolves when the file is removed.
* @example
* ```ts
* await app.vault.adapter.remove('foo/bar.md');
* ```
* @official
*/
remove(normalizedPath: string): Promise<void>;
/**
* Renames a file.
*
* @param normalizedPath - The path to rename.
* @param normalizedNewPath - The new path.
* @returns A promise that resolves when the file is renamed.
* @example
* ```ts
* await app.vault.adapter.rename('foo/bar.md', 'baz/qux.md');
* ```
* @official
*/
rename(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* Deletes a directory.
*
* @param normalizedPath - The path to delete.
* @param recursive - Whether to delete the directory recursively.
* @returns A promise that resolves when the directory is deleted.
* @example
* ```ts
* await app.vault.adapter.rmdir('foo', true);
* ```
* @official
*/
rmdir(normalizedPath: string, recursive: boolean): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
startWatchPath(normalizedPath: string): Promise<void>;
/**
* Retrieves file stats about a file.
*
* @param normalizedPath - The path to retrieve stats for.
* @returns A promise that resolves with the stats.
* @example
* ```ts
* console.log(await app.vault.adapter.stat('foo/bar.md'));
* ```
* @official
* @since 0.12.2
*/
stat(normalizedPath: string): Promise<Stat | null>;
/**
* Remove listener on specific path.
*
* @unofficial
*/
stopWatchPath(normalizedPath: string): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
thingsHappening(): Debouncer<[
], void>;
/**
* Move to local trash.
* Files will be moved into the `.trash` folder at the root of the vault.
*
* @param normalizedPath - The path to delete.
* @returns A promise that resolves when the file or directory is deleted.
* @example
* ```ts
* await app.vault.adapter.trashLocal('foo/bar.md');
* ```
* @official
*/
trashLocal(normalizedPath: string): Promise<void>;
/**
* Try moving to system trash.
*
* @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
* @returns Returns a promise that resolves to `true` if succeeded. This can fail due to system trash being disabled.
* @example
* ```ts
* console.log(await app.vault.adapter.trashSystem('foo/bar.jpg'));
* ```
* @official
*/
trashSystem(normalizedPath: string): Promise<boolean>;
/**
* Watch recursively for changes.
*
* @unofficial
*/
watchHiddenRecursive(normalizedPath: string): Promise<void>;
/**
* Writes a file.
*
* @param normalizedPath - The path to write.
* @param data - The data to write.
* @param options - The options to write.
* @returns A promise that resolves when the file is written.
* @example
* ```ts
* await app.vault.adapter.write('foo/bar.md', 'baz');
* ```
* @official
*/
write(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
/**
* Writes a file as a binary buffer.
*
* @param normalizedPath - The path to write.
* @param data - The data to write.
* @param options - The options to write.
* @returns A promise that resolves when the file is written.
* @example
* ```ts
* await app.vault.adapter.writeBinary('foo/bar.jpg', new Uint8Array([1, 2, 3]).buffer);
* ```
* @official
*/
writeBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
}
namespace FileSystemAdapter {
/**
* Create a new directory.
*
* @param path - The absolute path to create the directory at.
* @returns A promise that resolves when the directory is created.
*
* @example
* ```ts
* await FileSystemAdapter.mkdir('C:\\Users\\John\\Documents\\ObsidianVault\\foo\\bar');
* ```
*
* @official
* @deprecated - Added only for typing purposes. Use {@link mkdir} instead.
*/
function mkdir__(path: string): Promise<void>;
/**
* Read a local file.
*
* @param path - The absolute path to read the file from.
* @returns A promise that resolves with the file content.
*
* @example
* ```ts
* console.log(await FileSystemAdapter.readLocalFile('C:\\Users\\John\\Documents\\ObsidianVault\\foo\\bar.md'));
* ```
*
* @official
* @deprecated - Added only for typing purposes. Use {@link readLocalFile} instead.
*/
function readLocalFile__(path: string): Promise<ArrayBuffer>;
}
}
declare module "obsidian" {
/**
* Implementation of the vault adapter for mobile devices.
*
* `app.vault.adapter` returns an instance of `CapacitorAdapter` on mobile devices.
* @since 1.7.2
*/
interface CapacitorAdapter extends DataAdapter {
/**
* @todo Documentation incomplete.
* @unofficial
*/
fs: CapacitorAdapterFs;
/**
* Appends data to a file.
*
* @param normalizedPath - The path to append.
* @param data - The data to append.
* @param options - The options to append.
* @returns A promise that resolves when the file is appended.
* @example
* ```ts
* await app.vault.adapter.append('foo/bar.md', 'baz');
* ```
* @official
* @since 1.7.2
*/
append(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
/**
* Copies a file.
*
* @param normalizedPath - The path to copy.
* @param normalizedNewPath - The new path.
* @returns A promise that resolves when the file is copied.
* @example
* ```ts
* await app.vault.adapter.copy('foo/bar.md', 'baz/qux.md');
* ```
* @official
* @since 1.7.2
*/
copy(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* Checks if a file exists.
*
* @param normalizedPath - The path to check.
* @param sensitive - Whether to check case-sensitivity.
* @returns A promise that resolves with whether the file exists.
* @example
* ```ts
* console.log(await app.vault.adapter.exists('foo/bar.md'));
* ```
* @official
* @since 1.7.2
*/
exists(normalizedPath: string, sensitive?: boolean): Promise<boolean>;
/**
* Gets the full path for a file.
*
* @param normalizedPath - The path to get the full path for.
* @returns The full path for the file.
* @example
* ```ts
* console.log(app.vault.adapter.getFullPath('foo/bar.md')) // /storage/emulated/0/path/to/vault/foo/bar.md
* ```
* @official
* @since 1.7.2
*/
getFullPath(normalizedPath: string): string;
/**
* Get the name of the vault.
*
* @returns The name of the vault.
* @official
* @since 1.7.2
*/
getName(): string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
getNativePath(normalizedPath: string): string;
/**
* Returns a URI for the browser engine to use, for example to embed an image.
*
* @param normalizedPath - The path to get the resource path for.
* @returns A URI for the browser engine to use.
* @example
* ```ts
* console.log(app.vault.adapter.getResourcePath('foo/bar.jpg'));
* ```
* @official
* @since 1.7.2
*/
getResourcePath(normalizedPath: string): string;
/**
* Lists all files and folders inside a folder.
*
* @param normalizedPath - The path to list.
* @returns A promise that resolves with the listed files.
* @example
* ```ts
* console.log(await app.vault.adapter.list('foo'));
* ```
* @official
* @since 1.7.2
*/
list(normalizedPath: string): Promise<ListedFiles>;
/**
* Helper function for `listRecursive` reads children of directory.
*
* @param normalizedPath Path to directory.
* @unofficial
*/
listRecursiveChild(normalizedPath: string, child: FileEntry): Promise<void>;
/**
* Creates a new directory.
*
* @param normalizedPath - The path to create the directory.
* @returns A promise that resolves when the directory is created.
* @example
* ```ts
* await app.vault.adapter.mkdir('foo');
* ```
* @official
* @since 1.7.2
*/
mkdir(normalizedPath: string): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onFileChange(normalizedPath: string): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
open(normalizedPath: string): Promise<void>;
/**
* Atomically read, modify, and save the contents of a plaintext file.
*
* @param normalizedPath - The path to process.
* @param fn - The function to process the file.
* @param options - The options to process the file.
* @returns A promise that resolves with the processed file.
* @example
* ```ts
* await app.vault.adapter.process('foo/bar.md', (data) => {
* return data.replace('foo', 'bar');
* });
* ```
* @official
* @since 1.7.2
*/
process(normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
quickList(normalizedFolderPath: string, fileEntry: FileEntry): void;
/**
* Reads a file.
*
* @param normalizedPath - The path to read.
* @returns A promise that resolves with the file content.
* @example
* ```ts
* console.log(await app.vault.adapter.read('foo/bar.md'));
* ```
* @official
* @since 1.7.2
*/
read(normalizedPath: string): Promise<string>;
/**
* Reads a file as a binary buffer.
*
* @param normalizedPath - The path to read.
* @returns A promise that resolves with the file content.
* @example
* ```ts
* console.log(await app.vault.adapter.readBinary('foo/bar.jpg'));
* ```
* @official
* @since 1.7.2
*/
readBinary(normalizedPath: string): Promise<ArrayBuffer>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
reconcileFileCreation(normalizedPath: string, normalizedNewPath: string, fileEntry: CapacitorFileEntry): Promise<void>;
/**
* Removes a file.
*
* @param normalizedPath - The path to remove.
* @returns A promise that resolves when the file is removed.
* @example
* ```ts
* await app.vault.adapter.remove('foo/bar.md');
* ```
* @official
* @since 1.7.2
*/
remove(normalizedPath: string): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
removeFile(normalizedPath: string): Promise<void>;
/**
* Renames a file.
*
* @param normalizedPath - The path to rename.
* @param normalizedNewPath - The new path.
* @returns A promise that resolves when the file is renamed.
* @example
* ```ts
* await app.vault.adapter.rename('foo/bar.md', 'baz/qux.md');
* ```
* @official
* @since 1.7.2
*/
rename(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* Deletes a directory.
*
* @param normalizedPath - The path to delete.
* @param recursive - Whether to delete the directory recursively.
* @returns A promise that resolves when the directory is deleted.
* @example
* ```ts
* await app.vault.adapter.rmdir('foo', true);
* ```
* @official
* @since 1.7.2
*/
rmdir(normalizedPath: string, recursive: boolean): Promise<void>;
/**
* Retrieves file stats about a file.
*
* @param normalizedPath - The path to retrieve stats for.
* @returns A promise that resolves with the stats.
* @example
* ```ts
* console.log(await app.vault.adapter.stat('foo/bar.md'));
* ```
* @official
* @since 1.7.2
*/
stat(normalizedPath: string): Promise<Stat | null>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
stopWatch(): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
testInsensitive(): Promise<void>;
/**
* Move to local trash.
* Files will be moved into the `.trash` folder at the root of the vault.
*
* @param normalizedPath - The path to delete.
* @returns A promise that resolves when the file or directory is deleted.
* @example
* ```ts
* await app.vault.adapter.trashLocal('foo/bar.md');
* ```
* @official
* @since 1.7.2
*/
trashLocal(normalizedPath: string): Promise<void>;
/**
* Try moving to system trash.
*
* @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
* @returns Returns a promise that resolves to `true` if succeeded. This can fail due to system trash being disabled.
* @example
* ```ts
* console.log(await app.vault.adapter.trashSystem('foo/bar.jpg'));
* ```
* @official
* @since 1.7.2
*/
trashSystem(normalizedPath: string): Promise<boolean>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
update(normalizedPath: string): Promise<void>;
/**
* Writes a file.
*
* @param normalizedPath - The path to write.
* @param data - The data to write.
* @param options - The options to write.
* @returns A promise that resolves when the file is written.
* @example
* ```ts
* await app.vault.adapter.write('foo/bar.md', 'baz');
* ```
* @official
* @since 1.7.2
*/
write(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
/**
* Writes a file as a binary buffer.
*
* @param normalizedPath - The path to write.
* @param data - The data to write.
* @param options - The options to write.
* @returns A promise that resolves when the file is written.
* @example
* ```ts
* await app.vault.adapter.writeBinary('foo/bar.jpg', new Uint8Array([1, 2, 3]).buffer);
* ```
* @official
* @since 1.7.2
*/
writeBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
}
}
declare module "obsidian" {
/**
* Information about the key combination.
* @since 0.10.4
*/
interface KeymapInfo {
/**
* The main key of the keymap.
*
* @official
* @since 0.10.4
*/
key: string | null;
/**
* The modifiers of the keymap.
*
* @official
* @since 0.10.4
*/
modifiers: string | null;
}
}
declare module "obsidian" {
/**
* Listed content of the folder.
*/
interface ListedFiles {
/**
* List of files in the folder.
*
* @official
*/
files: string[];
/**
* List of subfolders in the folder.
*
* @official
*/
folders: string[];
}
}
declare module "obsidian" {
/**
* Location within a Markdown document
*/
interface Loc {
/**
* Column number. 0-based.
* @official
*/
col: number;
/**
* Line number. 0-based.
* @official
*/
line: number;
/**
* Number of characters from the beginning of the file.
* @official
*/
offset: number;
}
}
declare module "obsidian" {
/**
* Manage the creation, deletion and renaming of files from the UI.
* @since 0.9.7
*/
interface FileManager {
/**
* Reference to App.
*
* @unofficial
*/
app: App;
/**
* @todo Documentation incomplete.
* @unofficial
*/
fileParentCreatorByType: Record<string, (path: string) => TFolder>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
inProgressUpdates: null | LinkUpdatesHandler[];
/**
* @todo Documentation incomplete.
* @unofficial
*/
linkUpdaters: LinkUpdaters;
/**
* @todo Documentation incomplete.
* @unofficial
*/
updateQueue: PromisedQueue;
/**
* Reference to Vault.
*
* @unofficial
*/
vault: Vault;
/**
* @todo Documentation incomplete.
* @unofficial
*/
canCreateFileWithExt(extension: string): boolean;
/**
* Creates a new Markdown file in specified location and opens it in a new view.
*
* @param path - Path to the file to create (missing folders will be created).
* @param location - Where to open the view containing the new file.
* @unofficial
*/
createAndOpenMarkdownFile(path: string, location: PaneType): Promise<void>;
/**
* Create a new file in the vault at specified location.
*
* @param location - Location to create the file in, defaults to root.
* @param filename - Name of the file to create, defaults to 'Untitled' (incremented if file already exists).
* @param extension - Extension of the file to create, defaults to 'md'.
* @param contents - Contents of the file to create, defaults to empty string.
* @unofficial
*/
createNewFile(location?: TFolder, filename?: string, extension?: string, contents?: string): Promise<TFile>;
/**
* Creates a new untitled folder in the vault at specified location.
*
* @param location - Location to create the folder in, defaults to root.
* @unofficial
*/
createNewFolder(location: TFolder): Promise<TFolder>;
/**
* Creates a new Markdown file in the vault at specified location.
*
* @unofficial
*/
createNewMarkdownFile(location: TFolder, filename: string, contents: string): Promise<TFile>;
/**
* Creates a new Markdown file based on linktext and path.
*
* @param filename - Name of the file to create.
* @param path - Path to where the file should be created.
* @unofficial
*/
createNewMarkdownFileFromLinktext(filename: string, path: string): Promise<TFile>;
/**
* Download attachments for note.
*
* @unofficial
*/
downloadAttachmentsForNote(file: TFile): Promise<void>;
/**
* Generate a Markdown link based on the user's preferences.
*
* @param file - the file to link to.
* @param sourcePath - where the link is stored in, used to compute relative links.
* @param subpath - A subpath, starting with `#`, used for linking to headings or blocks.
* @param alias - The display text if it's to be different than the file name. Pass empty string to use file name.
* @returns A markdown link.
* @example
* ```ts
* const file = app.vault.getFileByPath('foo/bar.md');
* console.log(app.fileManager.generateMarkdownLink(file, 'baz/qux.md', '#heading', 'Display text')); // [[bar#heading|Display text]]
* ```
* @official
* @since 0.12.0
*/
generateMarkdownLink(file: TFile, sourcePath: string, subpath?: string, alias?: string): string;
/**
* Always returns an empty array.
*
* @unofficial
*/
getAllLinkResolutions(): [
];
/**
* Resolves a unique path for the attachment file being saved.
* Ensures that the parent directory exists and dedupes the
* filename if the destination filename already exists.
*
* @param filename Name of the attachment being saved.
* @param sourcePath The path to the note associated with this attachment, defaults to the workspace's active file.
* @returns A promise that resolves to the full path for where the attachment should be saved, according to the user's settings.
* @example
* ```ts
* console.log(await app.fileManager.getAvailablePathForAttachment('image.png'));
* ```
* @official
* @since 1.5.7
*/
getAvailablePathForAttachment(filename: string, sourcePath?: string): Promise<string>;
/**
* Gets the folder that new markdown files should be saved to, based on the current settings.
*
* @param path - The path of the current opened/focused file, used when the user wants new files to be created in the same folder as the current file.
* @unofficial
*/
getMarkdownNewFileParent(path: string): TFolder;
/**
* Gets the folder that new files should be saved to, given the user's preferences.
*
* @param sourcePath - The path to the current open/focused file,
* used when the user wants new files to be created 'in the same folder'.
* Use an empty string if there is no active file.
* @param newFilePath - The path to the file that will be newly created,
* used to infer what settings to use based on the path's extension.
* @returns The folder that new files should be saved to.
* @example
* ```ts
* console.log(app.fileManager.getNewFileParent('foo/bar.md', 'baz/qux.md'));
* ```
* @official
* @since 1.1.13
*/
getNewFileParent(sourcePath: string, newFilePath?: string): TFolder;
/**
* Insert text into a file.
*
* @unofficial
*/
insertIntoFile(file: TFile, text: string, position?: "append" | "prepend"): Promise<void>;
/**
* Iterate over all links in the vault with callback.
*
* @param callback - Callback to execute for each link.
* @unofficial
*/
iterateAllRefs(callback: (path: string, link: PositionedReference) => void): void;
/**
* Merge two files.
*
* @param file - File to merge to.
* @param otherFile - File to merge from.
* @param override - If not empty, will override the contents of the file with this string.
* @param atStart - Whether to insert text at the start or end of the file.
* @unofficial
*/
mergeFile(file: TFile, otherFile: TFile, override: string, atStart: boolean): Promise<void>;
/**
* Atomically read, modify, and save the frontmatter of a note.
* The frontmatter is passed in as a JS object, and should be mutated directly to achieve the desired result.
*
* Remember to handle errors thrown by this method.
*
* @param file - the file to be modified. Must be a Markdown file.
* @param fn - a callback function which mutates the frontmatter object synchronously.
* @param options - write options.
* @throws YAMLParseError if the YAML parsing fails.
* @throws any errors that your callback function throws.
* @example
* ```ts
* await app.fileManager.processFrontMatter(file, (frontmatter) => {
* frontmatter['key1'] = value;
* delete frontmatter['key2'];
* });
* ```
* @official
* @since 1.4.4
*/
processFrontMatter(file: TFile, fn: (frontmatter: any) => void, options?: DataWriteOptions): Promise<void>;
/**
* Prompt the user to delete a file.
*
* @unofficial
* @since 0.15.0
*/
promptForDeletion(file: TAbstractFile): Promise<void>;
/**
* Prompt the user to delete a file.
*
* @unofficial
*/
promptForFileDeletion(file: TFile): Promise<void>;
/**
* Prompt the user to rename a file.
*
* @unofficial
*/
promptForFileRename(file: TFile): Promise<void>;
/**
* Prompt the user to delete a folder.
*
* @unofficial
*/
promptForFolderDeletion(folder: TFolder): Promise<void>;
/**
* Prompt the user to download an image.
*
* @unofficial
*/
promptForImageDownload(urls: string[]): Promise<undefined | null | Record<string, TFile>>;
/**
* Register an extension to be the parent for a specific file type.
*
* @unofficial
*/
registerFileParentCreator(extension: string, location: TFolder): void;
/**
* Rename or move a file or folder safely, and update all links to it depending on the user's preferences.
*
* @param file - the file or folder to rename.
* @param newPath - the new path for the file or folder.
* @returns A promise that resolves when the file or folder is renamed.
* @example
* ```ts
* const file = app.vault.getFileByPath('foo/bar.md');
* await app.fileManager.renameFile(file, 'baz/qux.md');
* ```
* @official
* @since 0.11.0
*/
renameFile(file: TAbstractFile, newPath: string): Promise<void>;
/**
* Rename's a property for all notes currently that have the old key.
*
* @remark The current property type is maintained.
* @remark Is case sensitive, despite Obsidian *typically* ignoring case for property names.
* @unofficial
*/
renameProperty(oldKey: string, newKey: string): Promise<void>;
/**
* Run async link update.
*
* @unofficial
*/
runAsyncLinkUpdate(linkUpdatesHandler: LinkUpdatesHandler): Promise<void>;
/**
* Store text file backup.
*
* @unofficial
*/
storeTextFileBackup(path: string, data: string): void;
/**
* Remove a file or a folder from the vault according the user's preferred 'trash'.
* options (either moving the file to .trash/ or the OS trash bin).
*
* @param file - the file or folder to trash.
* @returns A promise that resolves when the file or folder is trashed.
* @example
* ```ts
* const file = app.vault.getFileByPath('foo/bar.md');
* await app.fileManager.trashFile(file);
* ```
* @official
* @since 1.6.6
*/
trashFile(file: TAbstractFile): Promise<void>;
/**
* Unregister extension as root input directory for file type.
*
* @unofficial
*/
unregisterFileCreator(extension: string): void;
/**
* Update all links.
*
* @unofficial
*/
updateAllLinks(links: LinkUpdate[]): Promise<void>;
/**
* Update internal links.
*
* @unofficial
*/
updateInternalLinks(data: Map<string, LinkChangeUpdate>): Promise<void>;
}
}
declare module "obsidian" {
/**
* Manages keymap lifecycle for different {@link Scope}s.
* @since 0.13.9
*/
interface Keymap {
/**
* Remove a scope from the scope stack.
* If the given scope is active, the next scope in the stack will be made active.
*
* @param scope - The scope to pop.
* @example
* ```ts
* keymap.popScope(new Scope());
* @official
* @since 0.13.9
*/
popScope(scope: Scope): void;
/**
* Push a scope onto the scope stack, setting it as the active scope to handle all key events.
*
* @param scope - The scope to push.
* @example
* ```ts
* keymap.pushScope(new Scope());
* ```
* @official
* @since 0.13.9
*/
pushScope(scope: Scope): void;
}
namespace Keymap {
/**
* Translates an event into the type of pane that should open.
*
* @param evt - The event to check.
* @returns The type of pane that should open.
* - Returns `false` if `evt` is `null`, `undefined` or none of the modifier keys are pressed.
* - Returns `'tab'` if the modifier key Cmd/Ctrl is pressed OR if `evt` is a middle-click {@link MouseEvent}.
* - Returns `'split'` if Cmd/Ctrl+Alt is pressed.
* - Returns `'window'` if Cmd/Ctrl+Alt+Shift is pressed.
*
* @example
* ```ts
* console.log(Keymap.isModEvent(evt));
* ```
*
* @official
* @deprecated - Added only for typing purposes. Use {@link isModEvent} instead.
* @since 0.16.0
*/
function isModEvent__(evt?: UserEvent | null): PaneType | boolean;
/**
* Checks whether the modifier key is pressed during this event.
*
* @param evt - The event to check.
* @param modifier - The modifier to check.
* @returns `true` if the modifier key is pressed, `false` otherwise.
*
* @example
* ```ts
* if (Keymap.isModifier(evt, 'Ctrl')) {
* console.log('Ctrl is pressed');
* }
* ```
*
* @official
* @deprecated - Added only for typing purposes. Use {@link isModifier} instead.
* @since 0.12.17
*/
function isModifier__(evt: MouseEvent | TouchEvent | KeyboardEvent, modifier: Modifier): boolean;
}
}
declare module "obsidian" {
/**
* Markdown section information.
*/
interface MarkdownSectionInformation {
/**
* The end line of the section (0-based).
*
* @official
*/
lineEnd: number;
/**
* The start line of the section (0-based).
*
* @official
*/
lineStart: number;
/**
* The text of the section.
*
* @official
*/
text: string;
}
}
declare module "obsidian" {
/**
* Metadata about a Community plugin.
* @see {@link https://docs.obsidian.md/Reference/Manifest}.
*/
interface PluginManifest {
/**
* The author's name.
*
* @official
*/
author: string;
/**
* A URL to the author's website.
*
* @official
*/
authorUrl?: string;
/**
* A description of the plugin.
*
* @official
*/
description: string;
/**
* Vault path to the plugin folder in the config directory.
*
* @official
*/
dir?: string;
/**
* URL for funding the author.
*
* @unofficial
*/
fundingUrl?: string;
/**
* The plugin ID.
*
* @official
*/
id: string;
/**
* Whether the plugin can be used only on desktop.
*
* @official
*/
isDesktopOnly?: boolean;
/**
* The minimum required Obsidian version to run this plugin.
*
* @official
*/
minAppVersion: string;
/**
* The display name.
*
* @official
*/
name: string;
/**
* The current version, using {@link https://semver.org/ Semantic Versioning}.
*
* @official
*/
version: string;
}
}
declare module "obsidian" {
/**
* Mod = Cmd on MacOS and Ctrl on other OS
* Ctrl = Ctrl key for every OS
* Meta = Cmd on MacOS and Win key on other OS
*
* @deprecated - Added only for typing purposes. Use {@link Modifier} instead.
*/
type Modifier__ = "Mod" | "Ctrl" | "Meta" | "Shift" | "Alt";
}
declare module "obsidian" {
/**
* Modal dialog component.
*/
interface Modal extends CloseableComponent {
/**
* The Obsidian app instance.
*
* @official
*/
app: App;
/**
* Background applied to application to dim it
*
* @unofficial
*/
bgEl: HTMLElement;
/**
* Opacity percentage of the background
*
* @unofficial
*/
bgOpacity: string;
/**
* The container HTML element for the modal.
*
* @official
*/
containerEl: HTMLElement;
/**
* The HTML element that represents the content of the modal.
*
* @official
*/
contentEl: HTMLElement;
/**
* Whether the background is being dimmed
*
* @unofficial
*/
dimBackground: boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
headerEl: HTMLDivElement;
/**
* The HTML element that represents the modal.
*
* @official
*/
modalEl: HTMLElement;
/**
* The scope for the keymaps.
*
* @official
*/
scope: Scope;
/**
* Selection logic handler
*
* @unofficial
*/
selection: WindowSelection | null;
/**
* Whether the modal should animate
*
* @unofficial
*/
shouldAnimate: boolean;
/**
* Whether the modal should restore the selection when it is opened or closed.
*
* @official
* @since 0.9.16
*/
shouldRestoreSelection: boolean;
/**
* The HTML element that represents the title of the modal.
*
* @official
*/
titleEl: HTMLElement;
/**
* Reference to the global Window object.
*
* @unofficial
*/
win: Window | null;
/**
* Performed when animation is complete
*
* @unofficial
*/
animateClose(): Promise<void>;
/**
* Performed when animation is started
*
* @unofficial
*/
animateOpen(): Promise<void>;
/**
* Close the modal.
*
* @official
*/
close(): void;
/**
* Create a new modal.
*
* @param app - The Obsidian app instance.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(app: App): this;
/**
* Called when the modal is closed.
*
* @example
* ```ts
* class MyModal extends Modal {
* public override onClose(): void {
* console.log('MyModal closed');
* }
* }
* ```
* @official
*/
onClose(): void;
/**
* On escape key press close modal
*
* @unofficial
*/
onEscapeKey(): void;
/**
* Called when the modal is opened.
*
* @example
* ```ts
* class MyModal extends Modal {
* public override onOpen(): void {
* console.log('MyModal opened');
* }
* }
* ```
* @official
*/
onOpen(): void;
/**
* On closing of the modal
*
* @unofficial
*/
onWindowClose(): void;
/**
* Show the modal on the the active window. On mobile, the modal will animate on screen.
*
* @official
*/
open(): void;
/**
* Set the background opacity of the dimmed background.
*
* @param opacity Opacity percentage.
* @unofficial
*/
setBackgroundOpacity(opacity: string): this;
/**
* Set the callback to be called when the modal is closed.
*
* @param callback - The callback to be called when the modal is closed.
* @returns The modal instance.
* @example
* ```ts
* modal.setCloseCallback(() => {
* console.log('Modal closed');
* });
* ```
* @official
* @since 1.10.0
*/
setCloseCallback(callback: () => any): this;
/**
* Set the content of the modal.
*
* @param content - The content of the modal.
* @returns The modal instance.
* @example
* ```ts
* modal.setContent('foo');
*
* const fragment = createFragment();
* fragment.createEl('strong', { text: 'foo' });
* modal.setContent(fragment);
* ```
* @official
*/
setContent(content: string | DocumentFragment): this;
/**
* Set whether the background should be dimmed.
*
* @param dim Whether the background should be dimmed.
* @unofficial
*/
setDimBackground(dim: boolean): this;
/**
* Set the title of the modal.
*
* @param title - The title of the modal.
* @returns The modal instance.
* @example
* ```ts
* modal.setTitle('foo');
* ```
* @official
*/
setTitle(title: string): this;
}
}
declare module "obsidian" {
/**
* Multitext option.
*
* @since 1.10.0
*/
interface MultitextOption extends BaseOption {
/**
* Default value.
*
* @official
* @since 1.10.0
*/
default?: string[];
/**
* Type.
*
* @official
* @since 1.10.0
*/
type: "multitext";
}
}
declare module "obsidian" {
/**
* Notification component. Use to present timely, high-value information.
* @since 0.9.7
*/
interface Notice {
/**
* The container HTML element for the notice.
*
* @official
* @since 1.8.7
*/
containerEl: HTMLElement;
/**
* The HTML element that represents the message of the notice.
*
* @official
* @since 1.8.7
*/
messageEl: HTMLElement;
/**
* The HTML element that represents the notice.
*
* @deprecated Use `messageEl` instead
* @official
* @since 0.9.7
*/
noticeEl: HTMLElement;
/**
* Creates a new notice.
*
* @param message - The message to be displayed, can either be a simple string or a {@link DocumentFragment}.
* @param duration - Time in milliseconds to show the notice for. If this is `0`, the
* `Notice` will stay visible until the user manually dismisses it.
* @example
* ```ts
* new Notice('foo');
*
* const fragment = createFragment();
* fragment.createEl('strong', { text: 'bar' });
* new Notice(fragment);
*
* new Notice('baz', 1000); // will be visible for 1 second
* new Notice('qux', 0); // will stay visible until the user manually dismisses it
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(message: string | DocumentFragment, duration?: number): this;
/**
* Hide the notice.
*
* @official
* @since 0.9.7
*/
hide(): void;
/**
* Change the message of this notice.
*
* @param message - The message to be displayed, can either be a simple string or a {@link DocumentFragment}.
* @returns The notice instance.
* @example
* ```ts
* notice.setMessage('foo');
*
* const fragment = createFragment();
* fragment.createEl('strong', { text: 'bar' });
* notice.setMessage(fragment);
* ```
* @official
* @since 0.9.7
*/
setMessage(message: string | DocumentFragment): this;
}
}
declare module "obsidian" {
/**
* Options for the tooltip.
*/
interface TooltipOptions {
/**
* The classes of the tooltip.
*
* @official
* @since 1.8.7
*/
classes?: string[];
/**
* The delay of showing the tooltip in milliseconds.
*
* @official
* @since 1.4.11
*/
delay?: number;
/**
* The gap of the tooltip in pixels.
*
* @official
* @since 1.8.7
*/
gap?: number;
/**
* The placement of the tooltip.
*
* @official
*/
placement?: TooltipPlacement;
}
}
declare module "obsidian" {
/**
* Plugins can create a class which extends this in order to render a Base.
* Plugins should create a {@link BaseViewHandlerFactory} function, then call
* `plugin.registerView` to register the view factory.
*
* @since 1.10.0
*/
interface BasesView extends Component {
/**
* All available properties from the dataset.
* @official
* @since 1.10.0
*/
allProperties: BasesPropertyId[];
/**
* @official
* @since 1.10.0
*/
app: App;
/**
* The config object for this view.
* @official
* @since 1.10.0
*/
config: BasesViewConfig;
/**
* The most recent output from executing the bases query, applying filters, and evaluating formulas.
* This object will be replaced with a new result set when changes to the vault or Bases config occur,
* so views should not keep a reference to it. Also note the contained BasesEntry objects will be recreated.
* @official
* @since 1.10.0
*/
data: BasesQueryResult;
/**
* The type ID of this view
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link type} instead.
*/
type__: string;
/**
* Constructor.
*
* @param controller - The query controller.
* @returns The new BasesView.
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(controller: QueryController): this;
/**
* Display the new note menu for a file with the provided filename and optionally a function to modify the frontmatter.
*
* @param baseFileName - The filename of the base file.
* @param frontmatterProcessor - A function to modify the frontmatter.
* @returns A promise that resolves when the file is created.
* @official
* @since 1.10.2
*/
createFileForView(baseFileName?: string, frontmatterProcessor?: (frontmatter: any) => void): Promise<void>;
/**
* Called when there is new data for the query. This view should rerender with the updated data.
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link onDataUpdated} instead.
*/
onDataUpdated__(): void;
}
}
declare module "obsidian" {
/**
* Provides a unified interface for users to configure the plugin.
* @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings#Register+a+settings+tab}.
* @since 0.9.7
*/
interface PluginSettingTab extends SettingTab {
/**
* Creates a new PluginSettingTab.
*
* @param app - The Obsidian app instance.
* @param plugin - The plugin instance.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(app: App, plugin: Plugin): this;
}
}
declare module "obsidian" {
/**
* Represent a single "row" or file in a base.
*
* @since 1.10.0
*/
interface BasesEntry extends FormulaContext {
/**
* File.
*
* @official
* @since 1.10.0
*/
file: TFile;
/**
* Get the value of the property.
* Note: Errors are returned as {@link ErrorValue}
*
* @official
* @since 1.10.0
*/
getValue(propertyId: BasesPropertyId): Value | null;
}
}
declare module "obsidian" {
/**
* Represents a autocomplete suggestion in the editor
*
* @typeParam T - The type of the suggestion items.
* @since 0.12.17
*/
interface EditorSuggest<T> extends PopoverSuggest<T> {
/**
* Current suggestion context, containing the result of `onTrigger`.
* This will be `null` any time the `EditorSuggest` is not supposed to run.
*
* @official
* @since 0.12.17
*/
context: EditorSuggestContext | null;
/**
* Override this to use a different limit for suggestion items.
*
* @official
* @since 0.12.17
*/
limit: number;
/**
* Create a new EditorSuggest.
*
* @param app - The app instance.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(app: App): this;
/**
* Generate suggestion items based on this context. Can be async, but preferably sync.
* When generating async suggestions, you should pass the context along.
*
* @param context - The context of the suggestion.
* @returns The suggestion items.
* @example
* ```ts
* class MyEditorSuggest extends EditorSuggest<string> {
* public override getSuggestions(context: EditorSuggestContext): string[] {
* return ['Item 1', 'Item 2', 'Item 3'];
* }
* }
* ```
* @example
* ```ts
* class MyEditorSuggest extends EditorSuggest<string> {
* public override getSuggestions(context: EditorSuggestContext): Promise<string[]> {
* return Promise.resolve(['Item 1', 'Item 2', 'Item 3']);
* }
* }
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link getSuggestions} instead.
* @since 0.12.17
*/
getSuggestions__(context: EditorSuggestContext): T[] | Promise<T[]>;
/**
* Based on the editor line and cursor position, determine if this EditorSuggest should be triggered at this moment.
* Typically, you would run a regular expression on the current line text before the cursor.
* Return `null` to indicate that this editor suggest is not supposed to be triggered.
*
* Please be mindful of performance when implementing this function, as it will be triggered very often (on each keypress).
* Keep it simple, and return `null` as early as possible if you determine that it is not the right time.
*
* @param cursor - The cursor position.
* @param editor - The editor instance.
* @param file - The file instance.
* @returns The trigger info or `null` if the suggestion is not supposed to be triggered.
* @example
* ```ts
* class MyEditorSuggest extends EditorSuggest<string> {
* public override onTrigger(cursor: EditorPosition, editor: Editor, file: TFile | null): EditorSuggestTriggerInfo | null {
* return {
* start: cursor,
* end: cursor,
* query: file?.basename ?? ''
* };
* }
* }
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link onTrigger} instead.
* @since 1.1.13
*/
onTrigger__(cursor: EditorPosition, editor: Editor, file: TFile | null): EditorSuggestTriggerInfo | null;
/**
* Set the instructions for the suggestion.
*
* @param instructions - The instructions for the suggestion.
* @example
* ```ts
* suggest.setInstructions([{ command: '↑↓', purpose: 'Navigate' }]);
* ```
* @official
* @since 0.13.0
*/
setInstructions(instructions: Instruction[]): void;
/**
* Show suggestions.
*
* @unofficial
*/
showSuggestions(results: SearchResult[]): void;
}
}
declare module "obsidian" {
/**
* Represents a change to the editor
* @since 0.12.11
*/
interface EditorChange extends EditorRangeOrCaret {
/**
* The text to replace the range with.
*
* @official
*/
text: string;
}
}
declare module "obsidian" {
/**
* Represents a point in a 2D coordinate system.
*/
interface Point {
/**
* The x coordinate.
*
* @official
*/
x: number;
/**
* The y coordinate.
*
* @official
*/
y: number;
}
}
declare module "obsidian" {
/**
* Represents a position in the editor
* @since 0.12.11
*/
interface EditorPosition {
/**
* The character index (0-based).
*
* @official
*/
ch: number;
/**
* The line number (0-based).
*
* @official
*/
line: number;
}
}
declare module "obsidian" {
/**
* Represents a range in the editor
* @since 0.12.11
*/
interface EditorRange {
/**
* The start position.
*
* @official
*/
from: EditorPosition;
/**
* The end position.
*
* @official
*/
to: EditorPosition;
}
}
declare module "obsidian" {
/**
* Represents a range or caret in the editor
* @since 0.12.11
*/
interface EditorRangeOrCaret {
/**
* The start position.
*
* @official
*/
from: EditorPosition;
/**
* The end position. If not provided, the caret is used.
*
* @official
*/
to?: EditorPosition;
}
}
declare module "obsidian" {
/**
* Represents a selection in the editor
* @since 0.12.11
*/
interface EditorSelection {
/**
* The selection start position.
*
* @official
*/
anchor: EditorPosition;
/**
* The selection end position.
*
* @official
*/
head: EditorPosition;
}
}
declare module "obsidian" {
/**
* Represents a selection or caret in the editor
* @since 0.12.11
*/
interface EditorSelectionOrCaret {
/**
* The selection start position.
*
* @official
*/
anchor: EditorPosition;
/**
* The selection end position. If not provided, the caret is used.
*
* @official
*/
head?: EditorPosition;
}
}
declare module "obsidian" {
/**
* Represents an HSL color.
* @since 0.16.0
*/
interface HSL {
/**
* Hue integer value between 0 and 360.
*
* @official
* @since 0.16.0
*/
h: number;
/**
* Lightness integer value between 0 and 100.
*
* @official
* @since 0.16.0
*/
l: number;
/**
* Saturation integer value between 0 and 100.
*
* @official
* @since 0.16.0
*/
s: number;
}
}
declare module "obsidian" {
/**
* Represents the serialized format of a Bases query as stored in a `.base` file.
*
* @since 1.10.0
*/
interface BasesConfigFile {
/**
* @official
* @since 1.10.0
*/
filters?: BasesConfigFileFilter;
/**
* Configuration for formulas used in this Base.
*
* Key: Formula property name.
* Value: Formula string.
*
* @official
* @since 1.10.0
*/
formulas?: Record<string, string>;
/**
* Configuration for properties in this Base.
*
* Valid keys for this object currently include:
*
* - displayName: string
*
* @official
* @since 1.10.0
*/
properties?: Record<string, Record<string, any>>;
/**
* Configuration for summary formulas used in this Base.
*
* Key: Summary formula name.
* Value: Formula string.
*
* @official
* @since 1.10.0
*/
summaries?: Record<string, string>;
/**
* Configuration for views used in this Base.
*
* @official
* @since 1.10.0
*/
views?: BasesConfigFileView[];
}
}
declare module "obsidian" {
/**
* Responsible for executing the Bases query and evaluating filters and formulas.
* Notifies views of updated results.
*
* @since 1.10.0
*/
interface QueryController extends Component {
}
}
declare module "obsidian" {
/**
* Result of resolving footnotes using {@link resolveSubpath}
* @since 1.7.2
*/
interface FootnoteSubpathResult extends SubpathResult {
/**
* The found footnote.
*
* @official
*/
footnote: FootnoteCache;
/**
* The type of the subpath result.
*
* @official
*/
type: "footnote";
}
}
declare module "obsidian" {
/**
* Scroll info for the editor
* @since 0.15.0
*/
interface EditorScrollInfo {
/**
* The width of the editor.
*
* @official
*/
clientWidth: number;
/**
* The height of the editor.
*
* @official
*/
height: number;
/**
* The horizontal scroll position.
*
* @official
*/
left: number;
/**
* The vertical scroll position.
*
* @official
*/
top: number;
}
}
declare module "obsidian" {
/**
* Setting group.
*
* @since 1.11.0
*/
interface SettingGroup {
/**
* The components of the setting group.
*
* @unofficial
*/
components: BaseComponent[];
/**
* The control element of the setting group.
*
* @unofficial
*/
controlEl: HTMLDivElement;
/**
* The group element of the setting group.
*
* @unofficial
*/
groupEl: HTMLDivElement;
/**
* The header element of the setting group.
*
* @unofficial
*/
headerEl: HTMLDivElement;
/**
* The header inner element of the setting group.
*
* @unofficial
*/
headerInnerEl: HTMLDivElement;
/**
* The list element of the setting group.
*
* @unofficial
*/
listEl: HTMLDivElement;
/**
* Add a CSS class to the setting group.
*
* @param cls - The CSS class to add.
* @returns The setting group.
* @example
* ```ts
* settingGroup.addClass('foo');
* ```
* @official
* @since 1.11.0
*/
addClass(cls: string): this;
/**
* Add an extra button to the setting group.
*
* @param cb - the callback function.
* @returns the setting group.
* @official
* @since 1.11.0
*/
addExtraButton(cb: (component: ExtraButtonComponent) => any): this;
/**
* Add a search input at the beginning of the setting group. Useful for filtering
* results or adding an input for quick entry.
*
* @param cb - the callback function.
* @returns the setting group.
* @official
* @since 1.11.0
*/
addSearch(cb: (component: SearchComponent) => any): this;
/**
* Add a setting to the setting group.
*
* @param cb - The callback to add the setting.
* @returns The setting group.
* @example
* ```ts
* settingGroup.addSetting((setting) => {
* setting.setName('foo');
* });
* ```
* @official
* @since 1.11.0
*/
addSetting(cb: (setting: Setting) => void): this;
/**
* Create a new setting group.
*
* @param containerEl - The container element.
* @returns The setting group.
* @official
* @since 1.11.0
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(containerEl: HTMLElement): this;
/**
* Set the heading of the setting group.
*
* @param text - The text to set the heading to.
* @returns The setting group.
* @example
* ```ts
* settingGroup.setHeading('foo');
* ```
* @official
* @since 1.11.0
*/
setHeading(text: string | DocumentFragment): this;
}
}
declare module "obsidian" {
/**
* Slider option.
*
* @since 1.10.0
*/
interface SliderOption extends BaseOption {
/**
* Default value.
*
* @official
* @since 1.10.0
*/
default?: number;
/**
* Is instant.
*
* @official
* @since 1.10.0
*/
instant?: boolean;
/**
* Maximum value.
*
* @official
* @since 1.10.0
*/
max?: number;
/**
* Minimum value.
*
* @official
* @since 1.10.0
*/
min?: number;
/**
* Step.
*
* @official
* @since 1.10.0
*/
step?: number;
/**
* Type.
*
* @official
* @since 1.10.0
*/
type: "slider";
}
}
declare module "obsidian" {
/**
* Subpath result for a block from {@link resolveSubpath}
*
* @example
* ```ts
* console.log(resolveSubpath(myNoteCache, '#^foo'));
* ```
* @since 0.13.26
*/
interface BlockSubpathResult extends SubpathResult {
/**
* The block cache.
*
* @official
*/
block: BlockCache;
/**
* The list item cache, in case the block is a list item.
*
* @official
*/
list?: ListItemCache;
/**
* The type of the subpath result.
*
* @official
*/
type: "block";
}
}
declare module "obsidian" {
/**
* Subpath result for a heading from {@link resolveSubpath}
*
* @example
* ```ts
* console.log(resolveSubpath(myNoteCache, '#foo'));
* ```
* @since 0.9.16
*/
interface HeadingSubpathResult extends SubpathResult {
/**
* The cache of the found heading.
*
* @official
* @since 0.9.16
*/
current: HeadingCache;
/**
* The cache of the next heading on the same or higher level.
*
* @official
* @since 0.9.16
*/
next: HeadingCache;
/**
* The type of the subpath result.
*
* @official
* @since 0.9.16
*/
type: "heading";
}
}
declare module "obsidian" {
/**
* Suggest modal for fuzzy search.
*
* @typeParam T - The type of the item that was searched for.
* @since 0.9.20
*/
interface FuzzySuggestModal<T> extends SuggestModal<FuzzyMatch<T>> {
/**
* Get the items to be used in the fuzzy search.
*
* @returns the items to be used in the fuzzy search.
* @example
* ```ts
* class MyFuzzySuggestModal extends FuzzySuggestModal<string> {
* public override getItems(): string[] {
* return ['foo', 'bar', 'baz'];
* }
* }
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link getItems} instead.
* @since 0.9.20
*/
getItems__?(): T[];
/**
* Get the text to be used in the fuzzy search.
*
* @param item - The item to get the text for.
* @returns The text to be displayed in the suggestion.
* @example
* ```ts
* class MyFuzzySuggestModal extends FuzzySuggestModal<string> {
* public override getItemText(item: string): string {
* return `--- ${item} ---`;
* }
* }
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link getItemText} instead.
* @since 0.9.20
*/
getItemText__(item: T): string;
/**
* Get the suggestions for the fuzzy match.
*
* @param query - The query to search for.
* @returns The suggestions for the fuzzy match.
* @example
* ```ts
* class MyFuzzySuggestModal extends FuzzySuggestModal<string> {
* public override getSuggestions(query: string): FuzzyMatch<string>[] {
* return [{ item: 'foo' + query, match: { score: 1, matches: [[0, 3]] } }];
* }
* }
* ```
* @official
* @since 0.9.20
*/
getSuggestions(query: string): FuzzyMatch<T>[];
/**
* Called when an item is chosen.
*
* @param item - The item that was chosen.
* @param evt - The event that occurred.
* @example
* ```ts
* class MyFuzzySuggestModal extends FuzzySuggestModal<string> {
* public override onChooseItem(item: string, evt: MouseEvent | KeyboardEvent): void {
* console.log(item);
* }
* }
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link onChooseSuggestion} instead.
* @since 0.9.20
*/
onChooseItem__(item: T, evt: MouseEvent | KeyboardEvent): void;
/**
* Called when a suggestion is chosen.
*
* @param item - The item that was chosen.
* @param evt - The event that occurred.
* @example
* ```ts
* class MyFuzzySuggestModal extends FuzzySuggestModal<string> {
* public override onChooseSuggestion(item: FuzzyMatch<string>, evt: MouseEvent | KeyboardEvent): void {
* console.log(item);
* }
* }
* ```
* @official
* @since 0.9.20
*/
onChooseSuggestion(item: FuzzyMatch<T>, evt: MouseEvent | KeyboardEvent): void;
/**
* Render the suggestion.
*
* @param item - The item to render.
* @param el - The element to render the suggestion to.
* @example
* ```ts
* class MyFuzzySuggestModal extends FuzzySuggestModal<string> {
* public override renderSuggestion(item: FuzzyMatch<string>, el: HTMLElement): void {
* el.createEl('strong', { text: item.item });
* }
* }
* ```
* @official
* @since 0.9.20
*/
renderSuggestion(item: FuzzyMatch<T>, el: HTMLElement): void;
}
}
declare module "obsidian" {
/**
* Text option.
*
* @since 1.10.0
*/
interface TextOption extends BaseOption {
/**
* Default value.
*
* @official
* @since 1.10.0
*/
default?: string;
/**
* Placeholder.
*
* @official
* @since 1.10.0
*/
placeholder?: string;
/**
* Type.
*
* @official
* @since 1.10.0
*/
type: "text";
}
}
declare module "obsidian" {
/**
* Text position offsets within text file. Represents
* a text range `[fromOffset, toOffset]`.
*
* @deprecated - Added only for typing purposes. Use {@link SearchMatchPart} instead.
*/
type SearchMatchPart__ = [
number,
number
];
}
declare module "obsidian" {
/**
* The BasesQueryResult contains all of the available information from executing the
* bases query, applying filters, and evaluating formulas. The `data` or `groupedData`
* should be displayed by your view.
*
* @since 1.10.0
*/
interface BasesQueryResult {
/**
* An ungrouped version of the data, with user-configured sort and limit applied.
* Where appropriate, views should support groupBy by using `groupedData` instead of this value.
*
* @official
* @since 1.10.0
*/
data: BasesEntry[];
/**
* Applies a summary function to a single property over a set of entries.
* @official
* @since 1.10.0
*/
getSummaryValue(queryController: QueryController, entries: BasesEntry[], prop: BasesPropertyId, summaryKey: string): Value;
/**
* The data to be rendered, grouped according to the groupBy config.
* If there is no groupBy configured, returns a single group with an empty key.
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link groupedData} instead.
*/
groupedData__(): BasesEntryGroup[];
/**
* Visible properties defined by the user.
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link properties} instead.
*/
properties__(): BasesPropertyId[];
}
}
declare module "obsidian" {
/**
* The base class for all components.
* @since 0.10.3
*/
interface BaseComponent {
/**
* Whether the component is disabled.
*
* @official
* @since 0.10.3
*/
disabled: boolean;
/**
* Sets the disabled state of the component.
*
* @param disabled - Whether to disable the component.
* @returns The component instance.
* @example
* ```ts
* component.setDisabled(true);
* ```
* @official
* @since 1.2.3
*/
setDisabled(disabled: boolean): this;
/**
* Facilitates chaining.
*
* @param cb - The callback to execute.
* @returns The component instance.
* @example
* ```ts
* component.then((x) => {
* console.log(x);
* });
* ```
* @official
* @since 0.9.7
*/
then(cb: (component: this) => any): this;
}
}
declare module "obsidian" {
/**
* The cache of the block in the note.
*
* ```markdown
* foo ^bar
* ```
* @since 0.11.13
*/
interface BlockCache extends CacheItem {
/**
* Reference to App.
*
* @unofficial
*/
app: App;
/**
* @todo Documentation incomplete.
* @unofficial
*/
cache: unknown;
/**
* The ID of the block.
*
* @example
* ```ts
* console.log(blockCache.id); // bar
* ```
* @official
*/
id: string;
}
}
declare module "obsidian" {
/**
* The cache of the embed in the note.
*
* ```markdown
* ![[wikilink]]
* ![[wikilink|alias]]
* 
* ```
* @since 0.9.7
*/
interface EmbedCache extends ReferenceCache {
}
}
declare module "obsidian" {
/**
* The cache of the footnote in the note.
*
* ```markdown
* foo [^1]
*
* [^1]: bar
*
* baz [^qux]
*
* [^qux]: quux
* ```
*/
interface FootnoteCache extends CacheItem {
/**
* The ID of the footnote.
*
* @example
* ```ts
* console.log(footnoteCache.id); // 1
* console.log(footnoteCache.id); // qux
* ```
* @official
*/
id: string;
}
}
declare module "obsidian" {
/**
* The cache of the footnote reference in the note.
*
* ```markdown
* foo [^1]
*
* [^1]: bar
*
* baz [^qux]
*
* [^qux]: quux
* ```
*/
interface FootnoteRefCache extends CacheItem {
/**
* The ID of the footnote reference.
*
* @example
* ```ts
* console.log(footnoteRefCache.id); // 1
* console.log(footnoteRefCache.id); // qux
* ```
* @official
*/
id: string;
}
}
declare module "obsidian" {
/**
* The cache of the frontmatter in the note.
* Frontmatter is a block of metadata that is used to store information about the note.
*
* ```markdown
* ---
* key1: "value1",
* key2: 42
* ---
* ```
*/
interface FrontMatterCache {
/**
* The key-value pairs in the frontmatter.
*
* @example
* ```ts
* console.log(frontmatterCache['key1']); // value1
* console.log(frontmatterCache['key2']); // 42
* ```
* @official
* @deprecated - Added only for typing purposes. Use `this[key]` instead.
*/
index__(key: string): any;
}
}
declare module "obsidian" {
/**
* The cache of the heading in the note.
*
* ```markdown
* # foo
* ## bar
* ### baz
* ```
*/
interface HeadingCache extends CacheItem {
/**
* The heading text.
*
* @example
* ```ts
* console.log(headingCache.heading); // foo
* ```
* @official
*/
heading: string;
/**
* Number between 1 and 6.
*
* @example
* ```ts
* console.log(headingCache.level); // 1
* ```
* @official
*/
level: number;
}
}
declare module "obsidian" {
/**
* The cache of the link in the note.
*
* ```markdown
* [[wikilink]]
* [[wikilink|alias]]
* [alias](markdown-link)
* ```
* @since 0.9.7
*/
interface LinkCache extends ReferenceCache {
}
}
declare module "obsidian" {
/**
* The cache of the links in the frontmatter.
*
* ```markdown
* ---
* key1: "[[wikilink]]"
* key2: "[[wikilink|alias]]"
* ---
* ```
*/
interface FrontmatterLinkCache extends Reference {
/**
* The key of the link.
*
* @example
* ```ts
* console.log(frontmatterLinkCache.key); // key1
* console.log(frontmatterLinkCache.key); // key2
* ```
* @official
*/
key: string;
}
}
declare module "obsidian" {
/**
* The cache of the list item in the note.
* List items are markdown blocks that are used to create lists.
*
* ```markdown
* - Unordered List Item 1
* - Unordered List Item 2
* - Unordered List Item 3
*
* 1. Ordered List Item 1
* 2. Ordered List Item 2
* 3. Ordered List Item 3
* ```
*/
interface ListItemCache extends CacheItem {
/**
* The block ID of this list item, if defined.
*
* @official
*/
id?: string | undefined;
/**
* Line number of the parent list item (position.start.line).
* If this item has no parent (e.g. it's a root level list),
* then this value is the negative of the line number of the first list item (start of the list).
*
* Can be used to deduce which list items belongs to the same group (item1.parent === item2.parent).
* Can be used to reconstruct hierarchy information (parentItem.position.start.line === childItem.parent).
*
* @official
*/
parent: number;
/**
* A single character indicating the checked status of a task.
* The space character `' '` is interpreted as an incomplete task.
* Any other character is interpreted as completed task.
* `undefined` if this item isn't a task.
*
* @official
*/
task?: string | undefined;
}
}
declare module "obsidian" {
/**
* The cache of the reference link in the note.
*
* ```markdown
* [google]
*
* [google]: https://google.com
* ```
* @since 1.8.7
*/
interface ReferenceLinkCache extends CacheItem {
/**
* The ID of the reference link.
*
* @example
* ```ts
* console.log(referenceLinkCache.id); // google
* ```
* @official
*/
id: string;
/**
* The link of the reference link.
*
* @example
* ```ts
* console.log(referenceLinkCache.link); // https://google.com
* ```
* @official
*/
link: string;
}
}
declare module "obsidian" {
/**
* The cache of the section in the note.
* Sections are root level markdown blocks, which can be used to divide the document up.
*
* ```markdown
* # Heading section
*
* Paragraph section
*
* > [!NOTE]
* > Callout section
* ```
*/
interface SectionCache extends CacheItem {
/**
* The block ID of this section, if defined.
*
* @official
*/
id?: string | undefined;
/**
* The type string generated by the parser.
* Typing is non-exhaustive, more types can be available than are documented here.
*
* @official
*/
type: "blockquote" | "callout" | "code" | "element" | "footnoteDefinition" | "heading" | "html" | "list" | "paragraph" | "table" | "text" | "thematicBreak" | "yaml" | string;
}
}
declare module "obsidian" {
/**
* The cache of the tag in the note.
*
* ```markdown
* ---
* tags:
* - foo
* - bar
* ---
*
* #baz
* ```
* @since 0.9.7
*/
interface TagCache extends CacheItem {
/**
* The tag.
*
* @example #foo
* @official
*/
tag: string;
}
}
declare module "obsidian" {
/**
* The context of the markdown post processor.
*/
interface MarkdownPostProcessorContext {
/**
* The ID of the document.
*
* @official
*/
docId: string;
/**
* The frontmatter of the document.
*
* @official
*/
frontmatter: any | null | undefined;
/**
* The path to the associated file. Any links are assumed to be relative to the `sourcePath`.
*
* @official
*/
sourcePath: string;
/**
* Adds a child component that will have its lifecycle managed by the renderer.
*
* Use this to add a dependent child to the renderer such that if the containerEl
* of the child is ever removed, the component's unload will be called.
*
* @param child - The child component to add.
* @official
*/
addChild(child: MarkdownRenderChild): void;
/**
* Gets the section information of this element at this point in time.
* Only call this function right before you need this information to get the most up-to-date version.
* This function may also return `null` in many circumstances; if you use it, you must be prepared to deal with `null`s.
*
* @param el - The element to get the section information from.
* @returns The section information or `null` if no section information is available.
* @official
*/
getSectionInfo(el: HTMLElement): MarkdownSectionInformation | null;
}
}
declare module "obsidian" {
/**
* The context of the suggestion
* @since 0.12.17
*/
interface EditorSuggestContext extends EditorSuggestTriggerInfo {
/**
* The editor instance.
*
* @official
*/
editor: Editor;
/**
* The file instance.
*
* @official
*/
file: TFile;
}
}
declare module "obsidian" {
/**
* The direction of the leaf split.
*
* @deprecated - Added only for typing purposes. Use {@link SplitDirection} instead.
*/
type SplitDirection__ = "vertical" | "horizontal";
}
declare module "obsidian" {
/**
* The event listener for the keymap.
* Return `false` to automatically preventDefault.
*
* @deprecated - Added only for typing purposes. Use {@link KeymapEventListener} instead.
*/
type KeymapEventListener__ = (evt: KeyboardEvent, ctx: KeymapContext) => false | any;
}
declare module "obsidian" {
/**
* The events of the markdown preview.
*/
interface MarkdownPreviewEvents extends Component {
}
}
declare module "obsidian" {
/**
* The full ID of a property, used in the bases config file. The prefixed
* {@link BasesPropertyType} disambiguates properties of the same name but from different sources.
*
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link BasesPropertyId} instead.
*/
type BasesPropertyId__ = `${BasesPropertyType}.${string}`;
}
declare module "obsidian" {
/**
* The in-memory representation of a single entry in the "views" section of a Bases file.
* Contains settings and configuration options set by the user from the toolbar menus and view options.
*
* @since 1.10.0
*/
interface BasesViewConfig {
/**
* User-friendly name for this view.
*
* @official
* @since 1.10.0
*/
name: string;
/**
* Retrieve the user-configured value of options exposed in `BasesViewRegistration.options`.
*
* @official
* @since 1.10.0
*/
get(key: string): unknown;
/**
* Retrieve a user-configured value from the config, converting it to a BasesPropertyId.
* Returns `null` if the requested key is not present in the config, or if the value is invalid.
*
* @param key - The key to retrieve.
* @returns The value of the key.
* @official
* @since 1.10.0
*/
getAsPropertyId(key: string): BasesPropertyId | null;
/**
* Retrieve a friendly name for the provided property.
* If the property has been renamed by the user in the Base config, that value is returned.
* File properties may have a default name that is returned, otherwise the name with the property
* type prefix removed is returned.
*
* @official
* @since 1.10.0
*/
getDisplayName(propertyId: BasesPropertyId): string;
/**
* Retrieve a user-configured value from the config, evaluating it as a
* formula in the context of the current Base. For embedded bases, or bases
* in the sidebar, this means evaluating the formula against the currently
* active file.
*
* @param view - The view to evaluate the formula in the context of.
* @param key - The key to evaluate the formula for.
* @returns the {@link Value} result from evaluating the formula, or {@link NullValue} if the formula is invalid, or the key is not present.
* @official
* @since 1.10.2
*/
getEvaluatedFormula(view: BasesView, key: string): Value;
/**
* Ordered list of properties to display in this view.
* In a table, these can be interpreted as the list of visible columns.
* Order is configured by the user through the properties toolbar menu.
*
* @returns The ordered list of properties.
* @official
* @since 1.10.0
*/
getOrder(): BasesPropertyId[];
/**
* Retrieve the sorting config for this view. Sort is configured by the user through the sort toolbar menu.
* Removes invalid sort configs. If no (valid) sort config, returns an empty array.
* Does not validate that the properties exists.
*
* Note that data from {@link BasesQueryResult} will be presorted.
*
* @official
* @since 1.10.0
*/
getSort(): BasesSortConfig[];
/**
* Store configuration data for the view. Views should prefer `BasesViewRegistration.options`
* to allow users to configure options where appropriate.
*
* @param key - The key to set.
* @param value - The value to set.
* @official
* @since 1.10.0
*/
set(key: string, value: any | null): void;
}
}
declare module "obsidian" {
/**
* The information about the frontmatter in the note.
*/
interface FrontMatterInfo {
/**
* Offset where the frontmatter block ends (including the ---)
*
* @official
*/
contentStart: number;
/**
* Whether this file has a frontmatter block.
*
* @official
*/
exists: boolean;
/**
* Start offset of the frontmatter contents (excluding the ---).
*
* @official
*/
from: number;
/**
* String representation of the frontmatter.
*
* @official
*/
frontmatter: string;
/**
* End offset of the frontmatter contents (excluding the ---).
*
* @official
*/
to: number;
}
}
declare module "obsidian" {
/**
* The main app object.
* @since 0.9.7
*/
interface App {
/**
* ID that uniquely identifies the vault.
*
* @tutorial Used for implementing device *and* vault-specific data storage using LocalStorage or IndexedDB.
* @unofficial
*/
appId: string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
appMenuBarManager: AppMenuBarManager;
/**
* Contains all registered commands.
*
* @tutorial Can be used to manually invoke the functionality of a specific command.
* @unofficial
*/
commands: Commands;
/**
* Custom CSS (snippets/themes) applied to the application.
*
* @tutorial Can be used to view which snippets are enabled or available, or inspect loaded-in theme manifests.
* @unofficial
*/
customCss: CustomCSS;
/**
* References to important DOM elements of the application.
*
* @unofficial
*/
dom: ObsidianDOM;
/**
* @todo Documentation incomplete.
* @unofficial
*/
dragManager: DragManager;
/**
* Registry that manages the creation of generic media type embeds.
*
* @unofficial
*/
embedRegistry: EmbedRegistry;
/**
* The file manager object.
*
* @official
* @since 0.11.0
*/
fileManager: FileManager;
/**
* @todo Documentation incomplete.
* @unofficial
*/
foldManager: FoldManager;
/**
* Manages global hotkeys.
*
* @tutorial Can be used for manually invoking a command, or finding which hotkey is assigned to a specific key input.
* @remark This should not be used for adding hotkeys to your custom commands, this can easily be done via the official API.
* @unofficial
*/
hotkeyManager: HotkeyManager;
/**
* Manager of internal 'core' plugins.
*
* @tutorial Can be used to check whether a specific internal plugin is enabled, or grab specific parts from its config for simplifying your own plugin's settings.
* @unofficial
*/
internalPlugins: InternalPlugins;
/**
* Whether the application is currently running on mobile.
*
* @remark Prefer usage of `{@link Platform.isMobile}`.
* @remark Will be true if `app.emulateMobile()` was enabled.
* @unofficial
*/
isMobile: boolean;
/**
* The keymap object.
*
* @official
* @since 0.9.7
*/
keymap: Keymap;
/**
* The last known user interaction event, to help commands find out what modifier keys are pressed.
*
* @official
* @since 0.12.17
*/
lastEvent: UserEvent | null;
/**
* Manages the gathering and updating of metadata for all files in the vault.
*
* @tutorial Use for finding tags and backlinks for specific files, grabbing frontmatter properties, ...
* @unofficial
* @since 0.9.7
*/
metadataCache: MetadataCache;
/**
* Manages the frontmatter properties of the vault and the rendering of the properties.
*
* @tutorial Fetching properties used in all frontmatter fields, may potentially be used for adding custom frontmatter widgets.
* @unofficial
*/
metadataTypeManager: MetadataTypeManager;
/**
* @todo Documentation incomplete.
* @unofficial
*/
mobileNavbar: MobileNavbar | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
mobileTabSwitcher: MobileTabSwitcher | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
mobileToolbar: MobileToolbar | null;
/**
* Events to execute on the next frame
*
* @unofficial
*/
nextFrameEvents: (() => void)[];
/**
* Timer for the next frame
*
* @unofficial
*/
nextFrameTimer: number | null;
/**
* Manages loading and enabling of community (non-core) plugins.
*
* @tutorial Can be used to communicate with other plugins, custom plugin management, ...
* @remark Be careful when overriding loading logic, as this may result in other plugins not loading.
* @unofficial
*/
plugins: Plugins;
/**
* The render context.
*
* @official
* @since 1.10.0
*/
renderContext: RenderContext;
/**
* The scope object.
*
* @official
* @since 0.9.7
*/
scope: Scope;
/**
* The secret storage.
*
* @public
* @since 1.11.4
* @unofficial ERROR: Missing `@unofficial` or `@official` tag
*/
secretStorage: SecretStorage;
/**
* Manages the settings modal and its tabs.
*
* @tutorial Can be used to open the settings modal to a specific tab, extend the settings modal functionality, ...
* @remark Do not use this to get settings values from other plugins, it is better to do this via `app.plugins.getPlugin(ID)?.settings` (check how the plugin stores its settings).
* @unofficial
*/
setting: AppSetting;
/**
* @todo Documentation incomplete.
* @unofficial
*/
shareReceiver: ShareReceiver;
/**
* Status bar of the application
*
* @unofficial
*/
statusBar: StatusBar;
/**
* Name of the vault with version suffix.
*
* @remark Formatted as 'NAME - Obsidian vX.Y.Z'.
* @unofficial
*/
title: string;
/**
* The vault object.
*
* Manages all file operations for the vault, contains hooks for file changes, and an adapter for low-level file system operations.
*
* @tutorial Used for creating your own files and folders, renaming, ...
* @tutorial Use `app.vault.adapter` for accessing files outside the vault.
* @remark Prefer using the regular `vault` whenever possible.
* @official
* @since 0.9.7
*/
vault: Vault;
/**
* Manages the construction of appropriate views when opening a file of a certain type.
*
* @remark Prefer usage of view registration via the Plugin class.
* @unofficial
*/
viewRegistry: ViewRegistry;
/**
* The workspace object.
*
* Manages the workspace layout, construction, rendering and manipulation of leaves.
*
* @tutorial Used for accessing the active editor leaf, grabbing references to your views, ...
* @official
* @since 0.9.7
*/
workspace: Workspace;
/**
* Sets the accent color of the application (light/dark mode).
*
* @unofficial
*/
changeTheme(theme: "moonstone" | "obsidian"): void;
/**
* Copies Obsidian URI of given file to clipboard.
*
* @param file File to generate URI for.
* @unofficial
*/
copyObsidianUrl(file: TFile): void;
/**
* Toggles debug mode.
*
* @param isEnabled Whether to enable or disable debug mode.
* @unofficial
*/
debugMode(isEnabled: boolean): void;
/**
* Disables all CSS transitions in the vault (until manually re-enabled).
*
* @unofficial
*/
disableCssTransition(): void;
/**
* Restarts Obsidian and renders workspace in mobile mode.
*
* @tutorial Very useful for testing the rendering of your plugin on mobile devices.
* @unofficial
*/
emulateMobile(emulate: boolean): void;
/**
* Enables all CSS transitions in the vault.
*
* @unofficial
*/
enableCssTransition(): void;
/**
* Manually fix all file links pointing towards image/audio/video resources in element.
*
* @param element Element to fix links in.
* @unofficial
*/
fixFileLinks(element: HTMLElement): void;
/**
* Applies an obfuscation font to all text characters in the vault.
*
* @tutorial Useful for hiding sensitive information or sharing pretty screenshots of your vault.
* @remark Uses the `Flow Circular` font.
* @remark You will have to restart the app to get normal text back.
* @unofficial
*/
garbleText(): void;
/**
* Get the accent color of the application.
*
* @remark Often a better alternative than `app.vault.getConfig('accentColor')` as it returns an empty string if no accent color was set.
* @unofficial
*/
getAccentColor(): string;
/**
* Get the current title of the application.
*
* @remark The title is based on the currently active leaf.
* @unofficial
*/
getAppTitle(): string;
/**
* Get the URI for opening specified file in Obsidian.
*
* @unofficial
*/
getObsidianUrl(file: TFile): string;
/**
* Get currently active spellcheck languages.
*
* @remark Originally spellcheck languages were stored in app settings, languages are now stored in `localStorage.getItem('spellcheck-languages')`.
* @unofficial
*/
getSpellcheckLanguages(): string[];
/**
* Get the current color scheme of the application.
*
* @remark Identical to `app.vault.getConfig('theme')`.
* @unofficial
*/
getTheme(): "moonstone" | "obsidian";
/**
* Import attachments into specified folder.
*
* @param attachmentsToImport - The attachments to import.
* @param folder - The folder to import the attachments to.
* @unofficial
*/
importAttachments(attachmentsToImport: ImportedAttachment[], folder: TFolder | null): Promise<void>;
/**
* Initialize the entire application using the provided FS adapter
*
* @unofficial
*/
initializeWithAdapter(adapter: DataAdapter): Promise<void>;
/**
* Check if the application is in dark mode.
*
* @official
* @since 1.10.0
*/
isDarkMode(): boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
isVimEnabled(): boolean;
/**
* Retrieve value from `localStorage` for this vault.
*
* @param key - The key to retrieve.
* @returns The value from `localStorage`.
* @remark This method is device *and* vault specific.
* @tutorial Use load/saveLocalStorage for saving configuration data that needs to be unique to the current vault.
* @official - Changed return type.
* @since 1.8.7
*/
loadLocalStorage(key: string): null | unknown;
/**
* Add callback to execute on next frame
*
* @unofficial
*/
nextFrame(callback: () => void): void;
/**
* Add callback to execute on next frame, and remove after execution
*
* @unofficial
*/
nextFrameOnceCallback(callback: () => void): void;
/**
* Add callback to execute on next frame with promise
*
* @unofficial
*/
nextFramePromise(callback: () => Promise<void>): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
on(): void;
/**
* Execute all logged callback (called when next frame is loaded)
*
* @unofficial
*/
onNextFrame(callback: () => void): void;
/**
* Open the help vault (or site if mobile).
*
* @unofficial
*/
openHelp(): void;
/**
* Open the vault picker.
*
* @unofficial
*/
openVaultChooser(): void;
/**
* Open the file with OS defined default file browser application.
*
* @unofficial
*/
openWithDefaultApp(path: string): void;
/**
* Register all basic application commands
*
* @unofficial
*/
registerCommands(): void;
/**
* Register a hook for saving workspace data before unload
*
* @unofficial
*/
registerQuitHook(): void;
/**
* Save attachment at default attachments location
*
* @unofficial
*/
saveAttachment(name: string, extension: string, data: ArrayBuffer): Promise<TFile>;
/**
* Save vault-specific value to `localStorage`. If data is `null`, the entry will be cleared.
*
* @param key - The key to save.
* @param data - The value to save. Must be serializable.
* @example
* ```ts
* app.saveLocalStorage('my-key', 'my-value');
* ```
* @remark This method is device *and* vault specific.
* @tutorial Use load/saveLocalStorage for saving configuration data that needs to be unique to the current vault.
* @official
* @since 1.8.7
*/
saveLocalStorage(key: string, data: unknown | null): void;
/**
* Set the accent color of the application.
*
* @remark Also updates the CSS `--accent` variables.
* @unofficial
*/
setAccentColor(color: string): void;
/**
* Set the path where attachments should be stored.
*
* @unofficial
*/
setAttachmentFolder(path: string): void;
/**
* Set the spellcheck languages.
*
* @unofficial
*/
setSpellcheckLanguages(languages: string[]): void;
/**
* Set the current color scheme of the application and reload the CSS.
*
* @unofficial
*/
setTheme(theme: "moonstone" | "obsidian"): void;
/**
* Open the OS file picker at path location.
*
* @unofficial
*/
showInFolder(path: string): void;
/**
* Show the release notes for provided version as a new leaf.
*
* @param version Version to show release notes for (defaults to current version).
* @unofficial
*/
showReleaseNotes(version?: string): void;
/**
* Updates the accent color and reloads the CSS.
*
* @unofficial
*/
updateAccentColor(): void;
/**
* Update the font family of the application and reloads the CSS.
*
* @unofficial
*/
updateFontFamily(): void;
/**
* Update the font size of the application and reloads the CSS.
*
* @unofficial
*/
updateFontSize(): void;
/**
* Update the inline title rendering in notes.
*
* @unofficial
*/
updateInlineTitleDisplay(): void;
/**
* Update the ribbon display.
*
* @unofficial
*/
updateRibbonDisplay(): void;
/**
* Update the color scheme of the application and reloads the CSS.
*
* @unofficial
*/
updateTheme(): void;
/**
* Update the view header display in notes.
*
* @unofficial
*/
updateViewHeaderDisplay(): void;
}
namespace App {
/**
* Get the override config directory for the given app ID.
*
* @unofficial
*/
function getOverrideConfigDir(appId: string): string | null;
}
}
declare module "obsidian" {
/**
* The markdown file info.
*/
interface MarkdownFileInfo extends HoverParent {
/**
* The Obsidian app instance.
*
* @official
*/
app: App;
/**
* The editor associated with the markdown edit view.
*
* @example
* ```ts
* console.log(markdownFileInfo.editor);
* ```
* @official
*/
editor?: Editor;
/**
* @todo Documentation incomplete.
* @unofficial
*/
metadataEditor?: MetadataEditor;
/**
* The associated file.
*
* @example
* ```ts
* console.log(markdownFileInfo.file);
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link file} instead.
*/
file__?(): TFile | null;
}
}
declare module "obsidian" {
/**
* The markdown preview view.
*/
interface MarkdownPreviewView extends MarkdownRenderer, MarkdownSubView, MarkdownPreviewEvents {
/**
* The container element of the markdown preview view.
*
* @official
*/
containerEl: HTMLElement;
/**
* Unique identifier for the rendered element.
*
* @unofficial
*/
docId: string;
/**
* HTML renderer for the Markdown.
*
* @unofficial
*/
renderer: ReadViewRenderer;
/**
* @todo Documentation incomplete.
* @unofficial
*/
search: null | unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
type: "preview" | string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
view: MarkdownView;
/**
* @todo Documentation incomplete.
* @unofficial
*/
applyFoldInfo(e: unknown): unknown;
/**
* Apply the scroll position to the markdown preview view.
*
* @example
* ```ts
* markdownPreviewView.applyScroll(100);
* ```
* @official
*/
applyScroll(scroll: number): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
beforeUnload(): unknown;
/**
* Clear the markdown content of the markdown preview view.
*
* @example
* ```ts
* markdownPreviewView.clear();
* ```
* @official
*/
clear(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
edit(e: unknown): unknown;
/**
* The file associated with the markdown preview view.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link file} instead.
*/
file__?(): TFile;
/**
* @todo Documentation incomplete.
* @unofficial
*/
foldAll(): unknown;
/**
* Get the markdown content of the markdown preview view.
*
* @official
*/
get(): string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
getEphemeralState(e: unknown): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
getFoldInfo(): unknown;
/**
* Get the scroll position of the markdown preview view.
*
* @official
*/
getScroll(): number;
/**
* @todo Documentation incomplete.
* @unofficial
*/
getSelection(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
hide(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onFoldChange(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onload(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onResize(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onScroll(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
requestUpdateLinks(): unknown;
/**
* Force the markdown preview view to rerender.
*
* @param full - Whether to rerender the entire preview or just the changed parts.
* @example
* ```ts
* markdownPreviewView.rerender(true);
* ```
* @official
*/
rerender(full?: boolean): void;
/**
* Set the markdown content of the markdown preview view.
*
* @param data - The markdown content.
* @param clear - Whether to clear the content before setting it.
* @example
* ```ts
* markdownPreviewView.set('**foo** bar', true);
* ```
* @official
*/
set(data: string, clear: boolean): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
setEphemeralState(e: unknown): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
show(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
showSearch(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
unfoldAll(): unknown;
/**
* @todo Documentation incomplete.
* @unofficial
*/
updateOptions(): unknown;
}
}
declare module "obsidian" {
/**
* The mode of the markdown view.
*
* @deprecated - Added only for typing purposes. Use {@link MarkdownViewModeType} instead.
*/
type MarkdownViewModeType__ = "source" | "preview";
}
declare module "obsidian" {
/**
* The name of a command you can execute with {@link Editor.exec}
*
* @deprecated - Added only for typing purposes. Use {@link EditorCommandName} instead.
*/
type EditorCommandName__ = "goUp" | "goDown" | "goLeft" | "goRight" | "goStart" | "goEnd" | "goWordLeft" | "goWordRight" | "indentMore" | "indentLess" | "newlineAndIndent" | "swapLineUp" | "swapLineDown" | "deleteLine" | "toggleFold" | "foldAll" | "unfoldAll";
}
declare module "obsidian" {
/**
* The object stored in the view plugin {@link livePreviewState}
*/
interface LivePreviewStateType {
/**
* Whether the left mouse is currently held down in the editor.
* (for example, when drag-to-select text).
*
* @official
*/
mousedown: boolean;
}
}
declare module "obsidian" {
/**
* The pane type of the leaf.
*
* @deprecated - Added only for typing purposes. Use {@link PaneType} instead.
*/
type PaneType__ = "tab" | "split" | "window";
}
declare module "obsidian" {
/**
* The parameters for the {@link requestUrl} function.
*/
interface RequestUrlParam {
/**
* The body of the request.
*
* @example
* ```ts
* 'foo'
* new Uint8Array([1, 2, 3]).buffer
* ```
* @official
*/
body?: string | ArrayBuffer;
/**
* The content type of the request.
*
* @example application/json
* @official
*/
contentType?: string;
/**
* The headers of the request.
*
* @example
* ```ts
* { 'Content-Type': 'application/json' }
* ```
* @official
*/
headers?: Record<string, string>;
/**
* The method to use for the request.
*
* @example GET
* @example POST
* @official
*/
method?: string;
/**
* Whether to throw an error when the status code is 400+.
* Defaults to `true`.
*
* @official
*/
throw?: boolean;
/**
* The URL to request.
*
* @example https://google.com
* @official
*/
url: string;
}
}
declare module "obsidian" {
/**
* The placement of the tooltip.
*
* @deprecated - Added only for typing purposes. Use {@link TooltipPlacement} instead.
*/
type TooltipPlacement__ = "bottom" | "right" | "left" | "top";
}
declare module "obsidian" {
/**
* The promise of the {@link requestUrl} function.
*/
interface RequestUrlResponsePromise extends Promise<RequestUrlResponse> {
/**
* The promise that resolves to the body of the response as an {@link ArrayBuffer}.
*
* @official
*/
arrayBuffer: Promise<ArrayBuffer>;
/**
* The promise that resolves to the body of the response as a JSON object.
*
* @official
*/
json: Promise<any>;
/**
* The promise that resolves to the body of the response as a string.
*
* @official
*/
text: Promise<string>;
}
}
declare module "obsidian" {
/**
* The renderer of the markdown preview.
* @since 0.9.7
*/
interface MarkdownPreviewRenderer {
}
namespace MarkdownPreviewRenderer {
/**
* The currently registered code block post processors.
*
* @unofficial
*/
const codeBlockPostProcessors: Record<string, CodeBlockPostProcessorHandler>;
/**
* Create a code block post processor.
*
* @param language - The language of the code block.
* @param handler - The handler of the code block.
* @param ctx - The context of the code block post processor.
* @returns The code block post processor.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link createCodeBlockPostProcessor} instead.
* @since 0.12.11
*/
function createCodeBlockPostProcessor__(language: string, handler: (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise<any> | void): (el: HTMLElement, ctx: MarkdownPostProcessorContext) => void;
/**
* Registers the DOM events.
*
* @param el - The element to register the events on.
* @param handlers - The handlers to register.
* @param childElFn - The function to determine if `childEl` belongs to the `el`.
*
* @unofficial
*/
function registerDomEvents(el: HTMLElement, handlers: DomEventsHandlers, childElFn?: (childEl: HTMLElement) => boolean): void;
/**
* Register a post processor.
*
* @param postProcessor - The post processor to register.
* @param sortOrder - The sort order of the post processor.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link registerPostProcessor} instead.
* @since 0.10.12
*/
function registerPostProcessor__(postProcessor: MarkdownPostProcessor, sortOrder?: number): void;
/**
* Remove the code block post processor currently registered with the given language.
*
* @param language - The language to unregister the post processor for.
*
* @remark Views will not reflect the removal until being re-rendered.
* @unofficial
*/
function unregisterCodeBlockPostProcessor(language: string): void;
/**
* Unregister a post processor.
*
* @param postProcessor - The post processor to unregister.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link unregisterPostProcessor} instead.
* @since 0.9.7
*/
function unregisterPostProcessor__(postProcessor: MarkdownPostProcessor): void;
}
}
declare module "obsidian" {
/**
* The response from the {@link requestUrl} function.
*/
interface RequestUrlResponse {
/**
* The body of the response as an ArrayBuffer.
*
* @official
*/
arrayBuffer: ArrayBuffer;
/**
* The headers of the response.
*
* @example
* ```ts
* { 'Content-Type': 'application/json' }
* ```
* @official
*/
headers: Record<string, string>;
/**
* The body of the response as a JSON object.
*
* @official
*/
json: any;
/**
* The status code of the response.
*
* @example 200
* @official
*/
status: number;
/**
* The body of the response as a string.
*
* @official
*/
text: string;
}
}
declare module "obsidian" {
/**
* The result of a fuzzy search.
*
* @typeParam T - The type of the item that was searched for.
* @since 0.9.20
*/
interface FuzzyMatch<T> {
/**
* The item that was matched.
*
* @official
* @since 0.9.20
*/
item: T;
/**
* Search result of the fuzzy match.
*
* @official
*/
match: SearchResult;
}
}
declare module "obsidian" {
/**
* The result of the view state.
*/
interface ViewStateResult {
/**
* Set this to `true` to indicate that there is a state change which should be recorded in the navigation history.
*
* @official
*/
history: boolean;
}
}
declare module "obsidian" {
/**
* The side of the leaf.
*
* @deprecated - Added only for typing purposes. Use {@link Side} instead.
*/
type Side__ = "left" | "right";
}
declare module "obsidian" {
/**
* The state of the view.
*/
interface ViewState {
/**
* Whether the view is active.
*
* @official
*/
active?: boolean;
/**
* The leaf group of the view.
*
* @official
*/
group?: WorkspaceLeaf;
/**
* Whether the view is pinned.
*
* @official
*/
pinned?: boolean;
/**
* The state of the view.
*
* @official
*/
state?: Record<string, unknown>;
/**
* The type of the view.
*
* @official
*/
type: string;
}
}
declare module "obsidian" {
/**
* The three valid "sources" of a property in a Base.
*
* - `note`: Properties from the frontmatter of markdown files in the vault.
* - `formula`: Properties calculated by evaluating a formula from the base config file.
* - `file`: Properties inherent to a file, such as the name, extension, size, etc.
*
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link BasesPropertyType} instead.
*/
type BasesPropertyType__ = "note" | "formula" | "file";
}
declare module "obsidian" {
/**
* The trigger info for the suggestion
* @since 0.12.17
*/
interface EditorSuggestTriggerInfo {
/**
* The end position of the triggering text. This is used to position the popover.
*
* @official
*/
end: EditorPosition;
/**
* They query string (usually the text between start and end) that will be used to generate the suggestion content.
*
* @official
*/
query: string;
/**
* The start position of the triggering text. This is used to position the popover.
*
* @official
*/
start: EditorPosition;
}
}
declare module "obsidian" {
/**
* The user event.
*
* @deprecated - Added only for typing purposes. Use {@link UserEvent} instead.
*/
type UserEvent__ = MouseEvent | KeyboardEvent | TouchEvent | PointerEvent;
}
declare module "obsidian" {
/**
* This can be either a {@link TFile} or a {@link TFolder}.
* @since 0.9.7
*/
interface TAbstractFile {
/**
* Whether the file or folder is being deleted.
*
* @unofficial
*/
deleted: boolean;
/**
* The name of the file.
*
* @official
* @since 0.9.7
*/
name: string;
/**
* The parent folder of the file.
*
* @official
* @since 0.9.7
*/
parent: TFolder | null;
/**
* The path of the file.
*
* @official
* @since 0.9.7
*/
path: string;
/**
* The vault.
*
* @official
* @since 0.9.7
*/
vault: Vault;
/**
* Gets the path after renaming the file or folder.
*
* @param newName The new name of the file or folder.
* @returns The new path of the file or folder.
* @unofficial
*/
getNewPathAfterRename(newName: string): string;
/**
* @unofficial
*
* Sets the path of the file or folder.
* @param path The new path of the file or folder.
* @unofficial
*/
setPath(path: string): void;
}
}
declare module "obsidian" {
/**
* This class implements a plaintext-based editable file view, which can be loaded and saved given an editor.
*
* Note that by default, this view only saves when it's closing. To implement auto-save, your editor should
* call `this.requestSave()` when the content is changed.
* @since 0.10.12
*/
interface TextFileView extends EditableFileView {
/**
* In-memory data.
*
* @official
* @since 0.10.12
*/
data: string;
/**
* Whether current file is dirty (different from saved contents).
*
* @unofficial
*/
dirty: boolean;
/**
* Whether editor should be rendered as plaintext.
*
* @unofficial
*/
isPlaintext: boolean;
/**
* The data that was last saved.
*
* @unofficial
*/
lastSavedData: null | string;
/**
* Debounced save in 2 seconds from now.
*
* @official
* @since 0.10.12
*/
requestSave: () => void;
/**
* Whether on saving, the file should be saved again (for dirtiness checks).
*
* @unofficial
*/
saveAgain: boolean;
/**
* Whether the file is currently saving.
*
* @unofficial
*/
saving: boolean;
/**
* Clear the editor. This is usually called when we're about to open a completely.
* different file, so it's best to clear any editor states like undo-redo history,
* and any caches/indexes associated with the previous file contents.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link clear} instead.
*/
clear__?(): void;
/**
* Create a new text file view.
*
* @param leaf - The leaf to create the view in.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(leaf: WorkspaceLeaf): this;
/**
* Gets the data from the editor. This will be called to save the editor contents to the file.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link getViewData} instead.
* @since 0.10.12
*/
getViewData__?(): string;
/**
* @todo Documentation incomplete.
* @unofficial
* @since 0.10.12
*/
loadFileInternal(file: TFile, clear: boolean): Promise<unknown>;
/**
* On load file.
*
* @param file - The file to load.
* @returns The promise that resolves when the file is loaded.
* @official
* @since 0.10.12
*/
onLoadFile(file: TFile): Promise<void>;
/**
* Is called when the vault has a 'modify' event. Reloads the file if the view is currently not saving the file and the modified file is the file in this view.
*
* @param file The modified file.
* @unofficial
*/
onModify(file: TFile): void;
/**
* On unload file.
*
* @param file - The file to unload.
* @returns The promise that resolves when the file is unloaded.
* @official
* @since 0.10.12
*/
onUnloadFile(file: TFile): Promise<void>;
/**
* Save the file.
*
* @param clear - Whether to clear the file.
* @returns The promise that resolves when the file is saved.
* @official
* @since 0.10.12
*/
save(clear?: boolean): Promise<void>;
/**
* If any changes(dirty = true) in the file forces the file to save.
*
* @unofficial
*/
saveImmediately(): void;
/**
* Set the data to the editor. This is used to load the file contents.
*
* @param data The new data.
* @param clear If clear is set, then it means we're opening a completely different file. In that case, you should call clear(), or implement a slightly more efficient clearing mechanism given the new data to be set.
* @unofficial
*/
setData(data: string, clear: boolean): void;
/**
* Set the data to the editor. This is used to load the file contents.
*
* If `clear` is set, then it means we're opening a completely different file.
* In that case, you should call {@link TextFileView.clear}(), or implement a slightly more efficient
* clearing mechanism given the new data to be set.
*
* @param data - The data to set.
* @param clear - Whether to clear the file.
* @official
* @deprecated - Added only for typing purposes. Use {@link setViewData} instead.
* @since 0.10.12
*/
setViewData__(data: string, clear: boolean): void;
}
}
declare module "obsidian" {
/**
* This is the API version of the app, which follows the release cycle of the desktop app.
* Example: '0.13.21'
*
* @official
* @deprecated - Added only for typing purposes. Use {@link apiVersion} instead.
*/
let apiVersion__: string;
/**
* Use this `CodeMirror` {@link StateField} to get a reference to the {@link EditorView}
*
* @official
* @deprecated - Added only for typing purposes. Use {@link editorEditorField} instead.
*/
const editorEditorField__: StateField<EditorView>;
/**
* Use this `CodeMirror` {@link StateField} to get {@link MarkdownFileInfo} about this Markdown editor, such as the associated file, or the Editor.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link editorInfoField} instead.
*/
const editorInfoField__: StateField<MarkdownFileInfo>;
/**
* Use this `CodeMirror` {@link StateField} to check whether `Live Preview` is active
*
* @official
* @deprecated - Added only for typing purposes. Use {@link editorLivePreviewField} instead.
*/
const editorLivePreviewField__: StateField<boolean>;
/**
* This is now deprecated - it is now mapped directly to {@link editorInfoField}, which return a {@link MarkdownFileInfo}, which may be a {@link MarkdownView} but not necessarily.
*
* @official
* @deprecated - use {@link editorInfoField} instead.
* @deprecated - Added only for typing purposes. Use {@link editorViewField} instead.
*/
const editorViewField__: StateField<MarkdownFileInfo>;
/**
* `CodeMirror` {@link ViewPlugin} for `Live Preview`.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link livePreviewState} instead.
*/
const livePreviewState__: ViewPlugin<LivePreviewStateType, undefined>;
/**
* An instance of `Moment.js` library.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link moment} instead.
*/
const moment__: typeof moment$1;
/**
* Information about the current platform.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link Platform} instead.
*/
const Platform__: PlatformEx;
}
declare module "obsidian" {
/**
* This is the editor for Obsidian Mobile as well as the upcoming WYSIWYG editor.
*/
interface MarkdownEditView extends MarkdownSubView, HoverParent, MarkdownFileInfo, MarkdownScrollableEditView {
/**
* The Obsidian app instance.
*
* @official
*/
app: App;
/**
* The hover popover.
*
* @official
*/
hoverPopover: HoverPopover;
/**
* Frontmatter editor extension for the editor.
*
* @unofficial
*/
propertiesExtension: Extension[];
/**
* Editing mode of the editor.
*
* @unofficial
*/
type: "source";
/**
* View the source view editor is attached to.
*
* @unofficial
*/
view: MarkdownView;
/**
* Apply the scroll position to the edit view.
*
* @example
* ```ts
* markdownEditView.applyScroll(100);
* ```
* @official
*/
applyScroll(scroll: number): void;
/**
* Save functionality to execute before editor view unload.
*
* @unofficial
*/
beforeUnload(): void;
/**
* Clear the markdown edit view.
*
* @example
* ```ts
* markdownEditView.clear();
* ```
* @official
*/
clear(): void;
/**
* Create a new markdown edit view.
*
* @param view - The markdown view.
* @official
* @deprecated - Added only for typing purposes. Use {@link constructor} instead.
*/
constructor__(view: MarkdownView): this;
/**
* Destroy/Detach the editor view.
*
* @unofficial
*/
destroy(): void;
/**
* Get the file associated with the edit view.
*
* @example
* ```ts
* console.log(markdownEditView.file);
* ```
* @official
* @deprecated - Added only for typing purposes. Use {@link file} instead.
*/
file__?(): TFile;
/**
* Get the markdown content of the edit view.
*
* @official
*/
get(): string;
/**
* Constructs extensions for the editor based on user settings.
*
* @remark Creates extension for properties rendering.
* @unofficial
*/
getDynamicExtensions(): Extension[];
/**
* Gets the ephemeral (non-persistent) state of the editor.
*
* @unofficial
*/
getEphemeralState(state: unknown): MarkdownEditViewEphemeralState;
/**
* Get the current folds of the editor.
*
* @unofficial
*/
getFoldInfo(): null | FoldInfo;
/**
* Get the scroll position of the edit view.
*
* @official
*/
getScroll(): number;
/**
* Get the selection of the edit view.
*
* @official
*/
getSelection(): string;
/**
* Add highlights for specified ranges.
*
* @remark Only ranges parameter is used.
* @unofficial
*/
highlightSearchMatches(ranges: EditorRange[], style?: "is-flashing" | "obsidian-search-match-highlight", remove_previous?: boolean, range?: EditorSelection): void;
/**
* Execute functionality on CM editor state update.
*
* @unofficial
*/
onUpdate(update: ViewUpdate, changed: boolean): void;
/**
* Debounced onInternalDataChange of view.
*
* @unofficial
*/
requestOnInternalDataChange(): void;
/**
* Debounced onMarkdownFold of view.
*
* @unofficial
*/
requestSaveFolds(): unknown;
/**
* Set the markdown content of the edit view.
*
* @param data - The markdown content.
* @param clear - Whether to clear the content before setting it.
* @example
* ```ts
* markdownEditView.set('**foo** bar', true);
* ```
* @official
*/
set(data: string, clear: boolean): void;
/**
* Set the ephemeral (non-persistent) state of the editor.
*
* @unofficial
*/
setEphemeralState(state: unknown): void;
/**
* Set highlight of any search match.
*
* @unofficial
*/
setHighlight(match: SetHighlightMatch): void;
/**
* Set the state of the editor (applies selections, scrolls, ...).
*
* @unofficial
*/
setState(state: unknown): void;
/**
* Render the editor and the metadata-editor element.
*
* @unofficial
*/
show(): void;
/**
* Update the bottom padding of the CodeMirror contentdom (based on backlinksEl).
*
* @unofficial
*/
updateBottomPadding(height: number): void;
/**
* Update options of the editor from settings.
*
* @unofficial
*/
updateOptions(): void;
}
}
declare module "obsidian" {
/**
* Toggle option.
*
* @since 1.10.0
*/
interface ToggleOption extends BaseOption {
/**
* Default value.
*
* @official
* @since 1.10.0
*/
default?: boolean;
/**
* Type.
*
* @official
* @since 1.10.0
*/
type: "toggle";
}
}
declare module "obsidian" {
/**
* Transaction for the editor
*/
interface EditorTransaction {
/**
* The changes to the editor.
*
* @official
*/
changes?: EditorChange[];
/**
* The replacement text.
*
* @official
*/
replaceSelection?: string;
/**
* The main selection.
*
* @official
*/
selection?: EditorRangeOrCaret;
/**
* List of selections for multiple cursors.
*
* @official
*/
selections?: EditorRangeOrCaret[];
}
}
declare module "obsidian" {
/**
* Utility functions for rendering Values within the app.
*
* @since 1.10.0
*/
interface RenderContext extends HoverParent {
/**
* Hover popover.
*
* @official
* @since 1.10.0
*/
hoverPopover: HoverPopover | null;
}
}
declare module "obsidian" {
/**
* View state for the `open` action.
*/
interface OpenViewState {
/**
* Whether the view is active.
*
* @official
*/
active?: boolean;
/**
* The ephemeral state of the view.
*
* @official
*/
eState?: Record<string, unknown>;
/**
* The group leaf of the view.
*
* @official
*/
group?: WorkspaceLeaf;
/**
* The state of the view.
*
* @official
*/
state?: Record<string, unknown>;
}
}
declare module "obsidian" {
/**
* ViewOption and the associated sub-types are configuration-driven settings controls
* which can be provided by a {@link BasesViewRegistration} to expose configuration options
* to users in the view config menu of the Bases toolbar.
*
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link ViewOption} instead.
*/
type ViewOption__ = DropdownOption | FileOption | FolderOption | FormulaOption | GroupOption | MultitextOption | PropertyOption | SliderOption | TextOption | ToggleOption;
}
declare module "obsidian" {
/**
* Work directly with files and folders inside a vault.
* If possible prefer using the {@link Vault} API over this.
*/
interface DataAdapter extends PromisedQueue {
/**
* Base OS path for the vault (e.g. /home/user/vault, or C:\Users\user\documents\vault).
*
* @unofficial
*/
basePath: string;
/**
* Mapping of file/folder path to vault entry, includes non-MD files.
*
* @unofficial
*/
files: DataAdapterFilesRecord;
/**
* Handles vault events.
*
* @unofficial
*/
handler: FileSystemWatchHandler | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
insensitive: boolean;
/**
* Triggers handler for vault events.
*
* @unofficial
*/
trigger: FileSystemWatchHandler;
/**
* Check if a file exists.
*
* @param fullPath Full path to the file.
* @param sensitive Whether to check case-sensitive.
* @returns A promise that resolves to `true` if the file exists, `false` otherwise.
* @unofficial
*/
_exists(fullPath: string, sensitive?: boolean): Promise<boolean>;
/**
* Add text to the end of a plaintext file.
*
* @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
* @param data - the text to append.
* @param options - write options.
* @returns A promise that resolves when the file is written.
* @example
* ```ts
* await app.vault.adapter.append('foo/bar.md', 'baz');
* ```
* @official
*/
append(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
/**
* Create a copy of a file.
* This will fail if there is already a file at `normalizedNewPath`.
*
* @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
* @param normalizedNewPath - path to file, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves when the file is copied.
* @example
* ```ts
* await app.vault.adapter.copy('foo/bar.jpg', 'baz/qux.jpg');
* ```
* @official
*/
copy(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* Check if something exists at the given path. For a faster way to synchronously check.
* if a note or attachment is in the vault, use {@link Vault.getAbstractFileByPath}.
*
* @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
* @param sensitive - Some file systems/operating systems are case-insensitive, set to `true` to force a case-sensitivity check.
* @returns A promise that resolves to `true` if the file/folder exists, `false` otherwise.
* @example
* ```ts
* console.log(await app.vault.adapter.exists('foo/bar.md'));
* ```
* @official
*/
exists(normalizedPath: string, sensitive?: boolean): Promise<boolean>;
/**
* Get canonical full path of file.
*
* @param path Path to file.
* @returns Full path to file.
* @unofficial
*/
getFullPath(path: string): string;
/**
* Get canonical full path of file.
*
* @param normalizedPath Normalized path to file.
* @returns String full path to file.
* @unofficial
*/
getFullRealPath(normalizedPath: string): string;
/**
* Gets the name of the vault.
*
* @official
*/
getName(): string;
/**
* Get normalized path.
*
* For vault-relative path, it's normalized vault-relative path.
* For absolute path, it's path as is.
*
* @param path Path to file.
* @returns Normalized path.
* @unofficial
*/
getRealPath(path: string): string;
/**
* Returns a URI for the browser engine to use, for example to embed an image.
*
* @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
* @returns A URI for the browser engine to use.
* @example
* ```ts
* console.log(app.vault.adapter.getResourcePath('foo/bar.jpg'));
* ```
* @official
*/
getResourcePath(normalizedPath: string): string;
/**
* Retrieve a list of all files and folders inside the given folder, non-recursive.
*
* @param normalizedPath - path to folder, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves to the list of files and folders inside the given folder.
* @example
* ```ts
* console.log(await app.vault.adapter.list('foo'));
* ```
* @official
*/
list(normalizedPath: string): Promise<ListedFiles>;
/**
* Generates `this.files` for specific directory of the vault
*
* @unofficial
*/
listRecursive(normalizedPath: string): Promise<void>;
/**
* Create a directory.
*
* @param normalizedPath - path to use for new folder, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves when the directory is created.
* @example
* ```ts
* await app.vault.adapter.mkdir('foo');
* ```
* @official
*/
mkdir(normalizedPath: string): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onFileChange(normalizedPath: string | null): void;
/**
* Atomically read, modify, and save the contents of a plaintext file.
*
* @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
* @param fn - a callback function which returns the new content of the file synchronously.
* @param options - write options.
* @returns A promise that resolves to the text value of the file that was written.
* @example
* ```ts
* await app.vault.adapter.process('foo/bar.md', (data) => {
* return data.replace('foo', 'bar');
* });
* ```
* @official
*/
process(normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;
/**
* Read the contents of a file.
*
* @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves to the contents of the file.
* @example
* ```ts
* console.log(await app.vault.adapter.read('foo/bar.md'));
* ```
* @official
*/
read(normalizedPath: string): Promise<string>;
/**
* Read the contents of a binary file.
*
* @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves to the contents of the file.
* @example
* ```ts
* console.log(await app.vault.adapter.readBinary('foo/bar.jpg'));
* ```
* @official
*/
readBinary(normalizedPath: string): Promise<ArrayBuffer>;
/**
* Reconcile a deletion.
*
* @param normalizedPath Path to file.
* @param normalizedNewPath New path to file.
* @param shouldSkipDeletionTimeout Whether the deletion timeout should be skipped (default: `true`).
* @returns A promise that resolves when the file is reconciled.
* @unofficial
*/
reconcileDeletion(normalizedPath: string, normalizedNewPath: string, shouldSkipDeletionTimeout?: boolean): Promise<void>;
/**
* Reconcile a file.
*
* @param normalizedPath Path to file.
* @param normalizedNewPath New path to file.
* @param shouldSkipDeletionTimeout Whether the deletion timeout should be skipped - applies only to {@link reconcileDeletion}.
* @returns A promise that resolves when the file is reconciled.
* @unofficial
*/
reconcileFile(normalizedPath: string, normalizedNewPath: string, shouldSkipDeletionTimeout?: boolean): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
reconcileFolderCreation(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
reconcileInternalFile(normalizedPath: string): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
reconcileSymbolicLinkCreation(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* Delete a file.
*
* @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves when the file is deleted.
* @example
* ```ts
* await app.vault.adapter.remove('foo/bar.jpg');
* ```
* @official
*/
remove(normalizedPath: string): Promise<void>;
/**
* Remove file from files listing and trigger deletion event.
*
* @unofficial
*/
removeFile(normalizedPath: string): void;
/**
* Rename a file or folder.
*
* @param normalizedPath - current path to file/folder, use {@link normalizePath} to normalize beforehand.
* @param normalizedNewPath - new path to file/folder, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves when the file is renamed.
* @example
* ```ts
* await app.vault.adapter.rename('foo/bar.jpg', 'baz/qux.jpg');
* ```
* @official
*/
rename(normalizedPath: string, normalizedNewPath: string): Promise<void>;
/**
* Remove a directory.
*
* @param normalizedPath - path to folder, use {@link normalizePath} to normalize beforehand.
* @param recursive - If `true`, delete folders under this folder recursively, if `false` the folder needs to be empty.
* @example
* ```ts
* await app.vault.adapter.rmdir('foo', true);
* ```
* @official
*/
rmdir(normalizedPath: string, recursive: boolean): Promise<void>;
/**
* Retrieve metadata about the given file/folder.
*
* @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves to the stats of the file/folder, or `null` if it does not exist.
* @example
* ```ts
* console.log(await app.vault.adapter.stat('foo/bar.md'));
* ```
* @official
* @since 0.12.2
*/
stat(normalizedPath: string): Promise<Stat | null>;
/**
* Remove all listeners.
*
* @unofficial
*/
stopWatch(): void;
/**
* Move to local trash.
* Files will be moved into the `.trash` folder at the root of the vault.
*
* @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
* @returns A promise that resolves when the file is moved to the local trash.
* @example
* ```ts
* await app.vault.adapter.trashLocal('foo/bar.jpg');
* ```
* @official
*/
trashLocal(normalizedPath: string): Promise<void>;
/**
* Try moving to system trash.
*
* @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
* @returns Returns a promise that resolves to `true` if succeeded. This can fail due to system trash being disabled.
* @example
* ```ts
* console.log(await app.vault.adapter.trashSystem('foo/bar.jpg'));
* ```
* @official
*/
trashSystem(normalizedPath: string): Promise<boolean>;
/**
* Set whether OS is insensitive to case.
*
* @unofficial
*/
update(normalizedPath: string): Promise<void>;
/**
* Add change watcher to path.
*
* @unofficial
*/
watch(handler: FileSystemWatchHandler): Promise<void>;
/**
* Write to a plaintext file.
* If the file exists its content will be overwritten, otherwise the file will be created.
*
* @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
* @param data - new file content.
* @param options - write options.
* @returns A promise that resolves when the file is written.
* @example
* ```ts
* await app.vault.adapter.write('foo/bar.md', 'baz');
* ```
* @official
*/
write(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
/**
* Write to a binary file.
* If the file exists its content will be overwritten, otherwise the file will be created.
*
* @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
* @param data - the new file content.
* @param options - write options.
* @returns A promise that resolves when the file is written.
* @example
* ```ts
* await app.vault.adapter.writeBinary('foo/bar.jpg', new Uint8Array([1, 2, 3]).buffer);
* ```
* @official
*/
writeBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
}
}
declare module "obsidian" {
/**
* Work with files and folders stored inside a vault.
* @see {@link https://docs.obsidian.md/Plugins/Vault}.
* @since 0.9.7
*/
interface Vault extends Events {
/**
* The low-level adapter of the vault.
*
* @official
* @since 0.9.7
*/
adapter: DataAdapter;
/**
* Max size of the cache in bytes
*
* @unofficial
*/
cacheLimit: number;
/**
* Object containing all config settings for the vault (editor, appearance, ... settings).
*
* @remark Prefer usage of `app.vault.getConfig(key)` to get settings, config does not contain settings that were not changed from their default value.
* @unofficial
*/
config: AppVaultConfig;
/**
* Gets the path to the config folder.
* This value is typically `.obsidian` but it could be different.
*
* @official
* @since 0.11.1
*/
configDir: string;
/**
* Timestamp of the last config change
*
* @unofficial
*/
configTs: number;
/**
* Mapping of path to Obsidian folder or file structure
*
* @unofficial
*/
fileMap: VaultFileMapRecord;
/**
* Listener for all events on the vault
*
* @unofficial
*/
onChange: FileSystemWatchHandler;
/**
* Debounced function for saving config
*
* @unofficial
*/
requestSaveConfig: Debouncer<[
], Promise<void>>;
/**
* The same TFolder object as `.fileMap["/"]`
*
* @unofficial
*/
root: TFolder;
/**
* Add file as child/parent to respective folders
*
* @unofficial
*/
addChild(file: TAbstractFile): void;
/**
* Add text to the end of a plaintext file inside the vault.
*
* @param file - The file.
* @param data - The text to append.
* @param options - Write options.
* @returns The promise that resolves when the text is appended.
* @official
* @since 0.13.0
*/
append(file: TFile, data: string, options?: DataWriteOptions): Promise<void>;
/**
* Read the content of a plaintext file stored inside the vault.
* Use this if you only want to display the content to the user.
* If you want to modify the file content afterward use {@link Vault.read}
*
* @param file - The file to read.
* @returns The promise that resolves to the cached file content.
* @official
* @since 0.9.7
*/
cachedRead(file: TFile): Promise<string>;
/**
* Check whether new file path is available
*
* @unofficial
*/
checkForDuplicate(file: TAbstractFile, newPath: string): boolean;
/**
* Check whether path has valid formatting (no dots/spaces at end, ...)
*
* @unofficial
*/
checkPath(path: string): boolean;
/**
* Create a copy of a file or folder.
*
* @param file - The file or folder.
* @param newPath - Vault absolute path for the new copy.
* @returns The promise that resolves to the new copy.
* @official
* @since 1.8.7
*/
copy<T extends TAbstractFile>(file: T, newPath: string): Promise<T>;
/**
* Create a new plaintext file inside the vault.
*
* @param path - Vault absolute path for the new file, with extension.
* @param data - Text content for the new file.
* @param options - Write options.
* @returns The promise that resolves to the new file.
* @example
* ```ts
* await vault.create('foo.md', 'bar');
* ```
* @official
* @since 0.9.7
*/
create(path: string, data: string, options?: DataWriteOptions): Promise<TFile>;
/**
* Create a new binary file inside the vault.
*
* @param path - Vault absolute path for the new file, with extension.
* @param data - Content for the new file.
* @param options - Write options.
* @returns The promise that resolves to the new file.
* @throws Error if file already exists.
* @example
* ```ts
* await vault.createBinary('foo.png', new Uint8Array([1, 2, 3]).buffer);
* ```
* @official
* @since 0.9.7
*/
createBinary(path: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<TFile>;
/**
* Create a new folder inside the vault.
*
* @param path - Vault absolute path for the new folder.
* @throws Error if folder already exists.
* @returns The promise that resolves to the new folder.
* @example
* ```ts
* await vault.createFolder('foo');
* ```
* @official
* @since 1.4.0
*/
createFolder(path: string): Promise<TFolder>;
/**
* Deletes the file completely.
*
* @param file - The file or folder to be deleted.
* @param force - Should attempt to delete folder even if it has hidden children.
* @returns The promise that resolves when the file is deleted.
* @official
* @since 0.9.7
*/
delete(file: TAbstractFile, force?: boolean): Promise<void>;
/**
* Remove a vault config file
*
* @unofficial
*/
deleteConfigJson(configFile: string): Promise<void>;
/**
* Check whether a path exists in the vault.
*
* @unofficial
*/
exists(path: string, isCaseSensitive?: boolean): Promise<boolean>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
generateFiles(e: AsyncGenerator<TFile>, t: boolean): Promise<void>;
/**
* Get a file or folder inside the vault at the given path. To check if the return type is.
* a file, use `instanceof TFile`. To check if it is a folder, use `instanceof TFolder`.
*
* @param path - vault absolute path to the folder or file, with extension, case sensitive.
* @returns the abstract file, if it's found.
* @example
* ```ts
* console.log(vault.getAbstractFileByPath('existent-file.md')); // TFile
* console.log(vault.getAbstractFileByPath('existent-folder')); // TFolder
* console.log(vault.getAbstractFileByPath('non-existent-file.md')); // null
* console.log(vault.getAbstractFileByPath('non-existent-folder')); // null
* ```
* @official
* @since 0.11.11
*/
getAbstractFileByPath(path: string): TAbstractFile | null;
/**
* Get an abstract file by path, insensitive to case.
*
* @unofficial
*/
getAbstractFileByPathInsensitive(path: string): TAbstractFile | null;
/**
* Get all folders in the vault.
*
* @param includeRoot - Should the root folder (`/`) be returned.
* @returns All folders in the vault.
* @official
* @since 1.6.6
*/
getAllFolders(includeRoot?: boolean): TFolder[];
/**
* Get all files and folders in the vault.
*
* @returns All files and folders in the vault.
* @official
* @since 0.9.7
*/
getAllLoadedFiles(): TAbstractFile[];
/**
* Get path for file that does not conflict with other existing files
*
* @unofficial
*/
getAvailablePath(path: string, extension: string): string;
/**
* Get path for attachment that does not conflict with other existing files
*
* @unofficial
*/
getAvailablePathForAttachments(filename: string, extension: string, file: TFile | null): Promise<string>;
/**
* Get value from config by key.
*
* @param string Key of config value.
* @remark Default value will be selected if config value was not manually changed.
* @unofficial
*/
getConfig(string: ConfigItem): unknown;
/**
* Get path to config file (relative to vault root).
*
* @unofficial
*/
getConfigFile(configFile: string): string;
/**
* Get direct parent of file.
*
* @param file File to get parent of.
* @unofficial
*/
getDirectParent(file: TAbstractFile): TFolder | null;
/**
* Get a file inside the vault at the given path.
*
* @param path - The path to the file.
* @returns The file or `null` if it does not exist.
* @example
* ```ts
* console.log(vault.getFileByPath('existent-file.md')); // TFile
* console.log(vault.getFileByPath('non-existent-file.md')); // null
* ```
* @official
* @since 1.5.7
*/
getFileByPath(path: string): TFile | null;
/**
* Get all files in the vault.
*
* @returns All files in the vault.
* @official
* @since 0.9.7
*/
getFiles(): TFile[];
/**
* Get a folder inside the vault at the given path.
*
* @param path - The path to the folder.
* @returns The folder or `null` if it does not exist.
* @example
* ```ts
* console.log(vault.getFolderByPath('existent-folder')); // TFolder
* console.log(vault.getFolderByPath('non-existent-folder')); // null
* ```
* @official
* @since 1.5.7
*/
getFolderByPath(path: string): TFolder | null;
/**
* Get all Markdown files in the vault.
*
* @returns All Markdown files in the vault.
* @official
* @since 0.9.7
*/
getMarkdownFiles(): TFile[];
/**
* Gets the name of the vault.
*
* @official
* @since 0.9.7
*/
getName(): string;
/**
* Returns a URI for the browser engine to use, for example to embed an image.
*
* @param file - The file to get the resource path for.
* @returns The resource path for the file.
* @official
* @since 0.9.7
*/
getResourcePath(file: TFile): string;
/**
* Get the root folder of the current vault.
*
* @returns The root folder of the current vault.
* @official
* @since 0.9.7
*/
getRoot(): TFolder;
/**
* Check whether files map cache is empty
*
* @unofficial
*/
isEmpty(): boolean;
/**
* Iterate over the files and read them
*
* @unofficial
*/
iterateFiles(files: TFile[], cachedRead: boolean): void;
/**
* Load vault adapter
*
* @unofficial
*/
load(): Promise<void>;
/**
* Modify the contents of a plaintext file.
*
* @param file - The file.
* @param data - The new file content.
* @param options - Write options.
* @returns The promise that resolves when the file is modified.
* @official
* @since 0.9.7
*/
modify(file: TFile, data: string, options?: DataWriteOptions): Promise<void>;
/**
* Modify the contents of a binary file.
*
* @param file - The file.
* @param data - The new file content.
* @param options - Write options.
* @returns The promise that resolves when the file is modified.
* @official
* @since 0.9.7
*/
modifyBinary(file: TFile, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
/**
* Called whenever any of Obsidian's settings are changed.
*
* @remark Does *not* trigger when a particular plugin's settings are changed, for that, you could monkey-patch the `saveSettings` method of a plugin instance.
* @unofficial
* @since 0.9.7
*/
on(name: "config-changed", callback: (configKey: string) => void, ctx?: unknown): EventRef;
/**
* Called when a file is created.
* This is also called when the vault is first loaded for each existing file
* If you do not wish to receive create events on vault load, register your event handler inside {@link Workspace.onLayoutReady}.
*
* @param name - Should be `'create'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.vault.on('create', (file) => {
* console.log(file);
* });
* ```
* @official
*/
on(name: "create", callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
/**
* Called when a file is deleted.
*
* @param name - Should be `'delete'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.vault.on('delete', (file) => {
* console.log(file);
* });
* ```
* @official
*/
on(name: "delete", callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
/**
* Called when a file is modified.
*
* @param name - Should be `'modify'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.vault.on('modify', (file) => {
* console.log(file);
* });
* ```
* @official
*/
on(name: "modify", callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
/**
* Triggered whenever a file gets loaded internally
*
* @unofficial
*/
on(name: "raw", callback: (path: string) => void, ctx?: unknown): EventRef;
/**
* Called when a file is renamed.
*
* @param name - Should be `'rename'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* app.vault.on('rename', (file, oldPath) => {
* console.log(file, oldPath);
* });
* ```
* @official
*/
on(name: "rename", callback: (file: TAbstractFile, oldPath: string) => any, ctx?: any): EventRef;
/**
* Atomically read, modify, and save the contents of a note.
*
* @param file - The file to be read and modified.
* @param fn - A callback function which returns the new content of the note synchronously.
* @param options - Write options.
* @returns The promise that resolves to the text value of the note that was written.
* @example
* ```ts
* await app.vault.process(file, (data) => {
* return data.replace('foo', 'bar');
* });
* ```
* @official
* @since 1.1.0
*/
process(file: TFile, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;
/**
* Read a plaintext file that is stored inside the vault, directly from disk.
* Use this if you intend to modify the file content afterwards.
* Use {@link Vault.cachedRead} otherwise for better performance.
*
* @param file - The file to read.
* @returns The promise that resolves to the file content.
* @official
* @since 0.9.7
*/
read(file: TFile): Promise<string>;
/**
* Read the content of a binary file stored inside the vault.
*
* @param file - The file to read.
* @returns The promise that resolves to the binary file content.
* @official
* @since 0.9.7
*/
readBinary(file: TFile): Promise<ArrayBuffer>;
/**
* Read a config file from the vault and parse it as JSON.
*
* @param config Name of config file.
* @unofficial
*/
readConfigJson(config: string): Promise<null | object>;
/**
* Read a config file (full path) from the vault and parse it as JSON.
*
* @param path Full path to config file.
* @unofficial
*/
readJson(path: string): Promise<null | object>;
/**
* Read a plugin config file (full path relative to vault root) from the vault and parse it as JSON.
*
* @param path Full path to plugin config file.
* @unofficial
*/
readPluginData(path: string): Promise<null | object>;
/**
* Read a file from the vault as a string.
*
* @param path Path to file.
* @unofficial
*/
readRaw(path: string): Promise<string>;
/**
* Reload all config files
*
* @unofficial
*/
reloadConfig(): void;
/**
* Remove file as child/parent from respective folders.
*
* @param file File to remove.
* @unofficial
*/
removeChild(file: TAbstractFile): void;
/**
* Rename or move a file. To ensure links are automatically renamed,.
* use {@link FileManager.renameFile} instead.
*
* @param file - The file to rename/move.
* @param newPath - Vault absolute path to move file to.
* @returns The promise that resolves when the file is renamed.
* @official
* @since 0.9.11
*/
rename(file: TAbstractFile, newPath: string): Promise<void>;
/**
* Get the file by absolute path.
*
* @param path Path to file.
* @unofficial
*/
resolveFilePath(path: string): TAbstractFile | null;
/**
* Get the file by Obsidian URL
*
* @unofficial
*/
resolveFileUrl(url: string): TAbstractFile | null;
/**
* Save app and appearance configs to disk
*
* @unofficial
*/
saveConfig(): Promise<void>;
/**
* Set value of config by key.
*
* @param key Key of config value.
* @param value Value to set.
* @unofficial
*/
setConfig(key: ConfigItem, value: unknown): void;
/**
* Set where the config files are stored (relative to vault root).
*
* @param configDir Path to config files.
* @unofficial
*/
setConfigDir(configDir: string): void;
/**
* Set file cache limit
*
* @unofficial
*/
setFileCacheLimit(limit: number): void;
/**
* Load all config files into memory
*
* @unofficial
*/
setupConfig(): Promise<void>;
/**
* Tries to move to system trash. If that isn't successful/allowed, use local trash.
*
* @param file - The file or folder to be trashed.
* @param system - Set to `false` to use local trash by default.
* @returns The promise that resolves when the file is trashed.
* @official
* @since 0.9.7
*/
trash(file: TAbstractFile, system: boolean): Promise<void>;
/**
* Write a config file to disk.
*
* @param config Name of config file.
* @param data Data to write.
* @unofficial
*/
writeConfigJson(config: string, data: object): Promise<void>;
/**
* Write a config file (full path) to disk.
*
* @param path Full path to config file.
* @param data Data to write.
* @param pretty Whether to insert tabs or spaces.
* @unofficial
*/
writeJson(path: string, data: object, pretty?: boolean): Promise<void>;
/**
* Write a plugin config file (path relative to vault root) to disk.
*
* @unofficial
*/
writePluginData(path: string, data: object): Promise<void>;
}
namespace Vault {
/**
* Recursively iterate over all files and folders in the vault.
*
* @param root - The root folder to iterate over.
* @param cb - A callback function that will be called for each file and folder.
*
* @example
* ```ts
* Vault.recurseChildren(vault.getRoot(), (file) => {
* console.log(file);
* });
* ```
*
* @official
* @deprecated - Added only for typing purposes. Use {@link recurseChildren} instead.
* @since 0.9.7
*/
function recurseChildren__(root: TFolder, cb: (file: TAbstractFile) => any): void;
}
}
declare module "obsidian" {
/**
* Workspace container.
* @since 0.15.4
*/
interface WorkspaceContainer extends WorkspaceSplit {
/**
* The document object.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link doc} instead.
* @since 0.15.4
*/
doc__: Document;
/**
* The window object.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link win} instead.
* @since 0.15.4
*/
win__: Window;
}
}
declare module "obsidian" {
/**
* Workspace floating.
* @since 0.15.2
*/
interface WorkspaceFloating extends WorkspaceParent {
/**
* The parent of the floating.
*
* @official
* @since 0.15.2
*/
parent: WorkspaceParent;
}
}
declare module "obsidian" {
/**
* Workspace item.
* @since 0.10.2
*/
interface WorkspaceItem extends Events {
/**
* @todo Documentation incomplete.
* @unofficial
*/
app: App;
/**
* @todo Documentation incomplete.
* @unofficial
*/
component: Component;
/**
* @todo Documentation incomplete.
* @unofficial
*/
containerEl: HTMLDivElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
dimension: number | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
id: string;
/**
* The direct parent of the leaf.
*
* @official
* @deprecated - Added only for typing purposes. Use {@link WorkspaceItem.parent} instead.
* @since 1.6.6
*/
parent__: WorkspaceParent;
/**
* @todo Documentation incomplete.
* @unofficial
*/
resizeHandleEl: HTMLHRElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
type: string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
workspace: Workspace;
/**
* @todo Documentation incomplete.
* @unofficial
*/
get parentSplit(): WorkspaceParent;
/**
* @todo Documentation incomplete.
* @unofficial
*/
detach(): void;
/**
* Get the root container parent item, which can be one of:.
* - {@link WorkspaceRoot}
* - {@link WorkspaceWindow}
*
* @official
* @since 0.15.4
*/
getContainer(): WorkspaceContainer;
/**
* @todo Documentation incomplete.
* @unofficial
*/
getIcon(): IconName;
/**
* Get the root item.
*
* @official
* @since 0.10.2
*/
getRoot(): WorkspaceItem;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onResizeStart(evt: MouseEvent): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
serialize(): SerializedWorkspaceItem;
/**
* @todo Documentation incomplete.
* @unofficial
*/
setDimension(dimension: number | null): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
setParent(parent: WorkspaceParent): void;
}
}
declare module "obsidian" {
/**
* Workspace leaf.
*/
interface WorkspaceLeaf extends WorkspaceItem, HoverParent {
/**
* @todo Documentation incomplete.
* @unofficial
*/
activeTime: number;
/**
* @todo Documentation incomplete.
* @unofficial
*/
group: string | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
height: number;
/**
* @todo Documentation incomplete.
* @unofficial
*/
history: WorkspaceLeafHistory;
/**
* The hover popover associated with this leaf.
*
* @official
*/
hoverPopover: HoverPopover | null;
/**
* The direct parent of the leaf.
*
* On desktop, a leaf is always a child of a `WorkspaceTabs` component.
* On mobile, a leaf might be a child of a `WorkspaceMobileDrawer`.
* Perform an `instanceof` check before making an assumption about the
* `parent`.
*
* @official
*/
parent: WorkspaceTabs | WorkspaceMobileDrawer;
/**
* @todo Documentation incomplete.
* @unofficial
*/
pinned: boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
resizeObserver: ResizeObserver | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
tabHeaderCloseEl: HTMLDivElement | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
tabHeaderEl: HTMLElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
tabHeaderInnerIconEl: HTMLElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
tabHeaderInnerTitleEl: HTMLElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
tabHeaderStatusContainerEl: HTMLDivElement | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
tabHeaderStatusLinkEl: HTMLDivElement | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
tabHeaderStatusPinEl: HTMLDivElement | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
type: "leaf";
/**
* The view associated with this leaf. Do not attempt to cast this to your
* custom `View` without first checking `instanceof`.
*
* @official
*/
view: View;
/**
* @todo Documentation incomplete.
* @unofficial
*/
width: number;
/**
* @todo Documentation incomplete.
* @unofficial
*/
working: boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
canNavigate(): boolean;
/**
* Detach this leaf from its parent.
*
* @official
*/
detach(): void;
/**
* Get the display text of this leaf.
*
* @returns The display text of the leaf.
* @official
*/
getDisplayText(): string;
/**
* Get the ephemeral state of this leaf.
*
* @returns The ephemeral state of the leaf.
* @official
*/
getEphemeralState(): any;
/**
* @todo Documentation incomplete.
* @unofficial
*/
getHistoryState(): WorkspaceLeafHistoryState;
/**
* Get the icon of this leaf.
*
* @returns The icon of the leaf.
* @official
*/
getIcon(): IconName;
/**
* Get the view state of this leaf.
*
* @official
*/
getViewState(): ViewState;
/**
* @todo Documentation incomplete.
* @unofficial
*/
handleDrop(event: DragEvent, draggable: Draggable, isOver: boolean): DropResult | null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
highlight(): void;
/**
* Returns `true` if this leaf is currently deferred because it is in the background.
* A deferred leaf will have a DeferredView as its view, instead of the View that
* it should normally have for its type (like MarkdownView for the `markdown` type).
*
* @returns Whether the leaf is deferred.
* @since 1.7.2
* @official
* @deprecated - Added only for typing purposes. Use {@link isDeferred} instead.
*/
isDeferred__?(): boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
isVisible(): boolean;
/**
* If this view is currently deferred, load it and await that it has fully loaded.
*
* @returns A promise that resolves when the leaf is loaded.
* @since 1.7.2
* @official
*/
loadIfDeferred(): Promise<void>;
/**
* Handle the group-change event.
*
* @param name - Should be `'group-change'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* leaf.on('group-change', (group) => {
* console.log(group);
* });
* ```
* @official
*/
on(name: "group-change", callback: (group: string) => any, ctx?: any): EventRef;
/**
* Triggers when the leaf's history gets updated (e.g. when new file is opened, or moving through history).
*
* @unofficial
*/
on(name: "history-change", callback: () => void, ctx?: unknown): EventRef;
/**
* Triggers when context menu action is executed on the leaf.
*
* @unofficial
*/
on(name: "leaf-menu", callback: (menu: Menu, leaf: WorkspaceLeaf) => void, ctx?: unknown): EventRef;
/**
* Handle the pinned-change event.
*
* @param name - Should be `'pinned-change'`.
* @param callback - The callback function.
* @param ctx - The context passed as `this` to the `callback` function.
* @returns The event reference.
* @example
* ```ts
* leaf.on('pinned-change', (pinned) => {
* console.log(pinned);
* });
* ```
* @official
*/
on(name: "pinned-change", callback: (pinned: boolean) => any, ctx?: any): EventRef;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onOpenTabHeaderMenu(evt: MouseEvent, parentEl: HTMLElement): void;
/**
* Handle the resize event.
*
* @official
*/
onResize(): void;
/**
* Open a view in this leaf.
*
* @param view - The view to open.
* @returns A promise that resolves to the opened view.
* @official
*/
open(view: View): Promise<View>;
/**
* Open a file in this leaf.
*
* @param file - The file to open.
* @param openState - The open state of the file.
* @returns A promise that resolves when the file is opened.
* @official
*/
openFile(file: TFile, openState?: OpenViewState): Promise<void>;
/**
* Open a link in the current leaf.
*
* @param linktext - The link text to open.
* @param sourcePath - The path of the source file.
* @param openViewState - The view state to open the link in.
* @unofficial
*/
openLinkText(linktext: string, sourcePath: string, openViewState?: OpenViewState): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
rebuildView(): Promise<void>;
/**
* @todo Documentation incomplete.
* @unofficial
*/
recordHistory(state: WorkspaceLeafHistoryState): void;
/**
* Set the vertical height a leaf may occupy if it is in a split. The height is not set directly, but.
*
* by setting the flex-grow (css) of the element. This means to predictably affect the height, you.
* also need to use setDimension on the other leafs of the column. (The flex-grow values of every leaf.
* work basically like a ratio, e.g. 1:2 meaning the first leaf takes 33% of the height, and the.
* second 67%.).
*
* @param flexgrow - Sets the flex-grow of the leaf. (0-100).
* @unofficial
*/
setDimension(flexgrow?: number | null): void;
/**
* Set the ephemeral state of this leaf.
*
* @param state - The ephemeral state to set.
* @official
*/
setEphemeralState(state: any): void;
/**
* Set the group of this leaf.
*
* @param group - The group to set.
* @official
*/
setGroup(group: string): void;
/**
* Set the group of this leaf.
*
* @param group - The group to set.
* @official
*/
setGroupMember(other: WorkspaceLeaf): void;
/**
* Set the pinned state of this leaf.
*
* @param pinned - Whether the leaf should be pinned.
* @official
*/
setPinned(pinned: boolean): void;
/**
* Set the view state of this leaf.
*
* @param viewState - The view state to set.
* @param eState - The ephemeral state to set.
* @official
*/
setViewState(viewState: ViewState, eState?: any): Promise<void>;
/**
* Toggle the pinned state of this leaf.
*
* @official
*/
togglePinned(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
unhighlight(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
updateHeader(): void;
}
}
declare module "obsidian" {
/**
* Workspace mobile drawer.
* @since 1.6.6
*/
interface WorkspaceMobileDrawer extends WorkspaceParent {
/**
* Whether the mobile drawer is collapsed.
*
* @official
*/
collapsed: boolean;
/**
* The parent of the mobile drawer.
*
* @official
*/
parent: WorkspaceParent;
/**
* Collapse the mobile drawer.
*
* @official
*/
collapse(): void;
/**
* Expand the mobile drawer.
*
* @official
*/
expand(): void;
/**
* Toggle the mobile drawer.
*
* @official
*/
toggle(): void;
}
}
declare module "obsidian" {
/**
* Workspace parent.
* @since 0.9.7
*/
interface WorkspaceParent extends WorkspaceItem {
}
}
declare module "obsidian" {
/**
* Workspace ribbon.
*/
interface WorkspaceRibbon {
}
}
declare module "obsidian" {
/**
* Workspace root.
* @since 0.15.2
*/
interface WorkspaceRoot extends WorkspaceContainer {
/**
* The document object.
*
* @official
*/
doc: Document;
/**
* The window object.
*
* @official
*/
win: Window;
}
}
declare module "obsidian" {
/**
* Workspace sidedock.
* @since 0.15.4
*/
interface WorkspaceSidedock extends WorkspaceSplit {
/**
* @todo Documentation incomplete.
* @unofficial
*/
allowSingleChild: boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
autoManageDOM: boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
children: WorkspaceTabs[];
/**
* Whether the sidedock is collapsed.
*
* @official
* @since 0.12.11
*/
collapsed: boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
direction: string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
emptyStateEl: HTMLDivElement;
/**
* @todo Documentation incomplete.
* @unofficial
*/
isResizing: boolean;
/**
* @todo Documentation incomplete.
* @unofficial
*/
originalSizes: null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
resizeStartPos: null;
/**
* @todo Documentation incomplete.
* @unofficial
*/
side: string;
/**
* @todo Documentation incomplete.
* @unofficial
*/
size: number;
/**
* Collapse the sidedock.
*
* @official
* @since 0.12.11
*/
collapse(): void;
/**
* Expand the sidedock.
*
* @official
* @since 0.12.11
*/
expand(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
onSidedockResizeStart(evt: MouseEvent): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
recomputeChildrenDimensions(): void;
/**
* @todo Documentation incomplete.
* @unofficial
*/
serialize(): SerializedWorkspaceSidedock;
/**
* @todo Documentation incomplete.
* @unofficial
*/
setSize(size: number): void;
/**
* Toggle the sidedock.
*
* @official
* @since 0.12.11
*/
toggle(): void;
}
}
declare module "obsidian" {
/**
* Workspace split.
* @since 0.9.7
*/
interface WorkspaceSplit extends WorkspaceParent {
/**
* The parent of the split.
*
* @official
*/
parent: WorkspaceParent;
}
}
declare module "obsidian" {
/**
* Workspace tabs.
*/
interface WorkspaceTabs extends WorkspaceParent {
/**
* The parent of the tabs.
*
* @official
*/
parent: WorkspaceSplit;
}
}
declare module "obsidian" {
/**
* Workspace window.
* @since 0.15.4
*/
interface WorkspaceWindow extends WorkspaceContainer {
/**
* The document object.
*
* @official
*/
doc: Document;
/**
* The window object.
*
* @official
*/
win: Window;
}
}
declare module "obsidian" {
/**
* {@link Value} which represents null.
* NullValue is a singleton and `NullValue.value` should be used instead of calling the constructor.
*
* @since 1.10.0
*/
interface NullValue extends Value {
/**
* Returns a boolean indicating whether this NullValue is truthy.
*
* @returns A boolean indicating whether this NullValue is truthy.
* @official
* @since 1.10.0
*/
isTruthy(): boolean;
/**
* Get the string representation of this NullValue.
*
* @returns The string representation of this NullValue.
* @official
* @since 1.10.0
*/
toString(): string;
}
namespace NullValue {
/**
* Value.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link NullValue.value} instead.
*/
var value__: NullValue;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a Date.
*
* @since 1.10.0
*/
interface DateValue extends NotNullValue {
/**
* Returns a new DateValue with any time portion in this DateValue removed.
*
* @returns a new DateValue with any time portion in this DateValue removed.
* @official
* @since 1.10.0
*/
dateOnly(): DateValue;
/**
* Returns a boolean indicating whether this DateValue is truthy.
*
* @returns a boolean indicating whether this DateValue is truthy.
* @official
* @since 1.10.0
*/
isTruthy(): boolean;
/**
* Returns a new {@link RelativeDateValue} based on this DateValue.
*
* @returns a new {@link RelativeDateValue} based on this DateValue.
* @official
* @since 1.10.0
*/
relative(): string;
/**
* String representation of this DateValue.
*
* @returns The string representation of this DateValue.
* @official
* @since 1.10.0
*/
toString(): string;
}
namespace DateValue {
/**
* Create new DateValue from an input string.
*
* @param input - An ISO 8601 date or datetime string.
* @returns A new DateValue from the input string.
*
* @example
* ```typescript
* parseFromString("2025-12-31")
* parseFromString("2025-12-31T23:59")
* parseFromString("2025-12-31T23:59:59")
* parseFromString("2025-12-31T23:59:59Z-07")
* ```
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link DateValue.parseFromString} instead.
*/
function parseFromString__(input: string): DateValue | null;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a Date.
* RelativeDateValue behaves the same as a {@link DateValue} however it renders as a time relative to now.
*
* @since 1.10.0
*/
interface RelativeDateValue extends DateValue {
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a RegExp pattern.
*
* @since 1.10.0
*/
interface RegExpValue extends NotNullValue {
/**
* Returns a boolean indicating whether this RegExpValue is truthy.
*
* @returns A boolean indicating whether this RegExpValue is truthy.
* @official
* @since 1.10.0
*/
isTruthy(): boolean;
/**
* Get the string representation of this RegExpValue.
*
* @returns The string representation of this RegExpValue.
* @official
* @since 1.10.0
*/
toString(): string;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a boolean.
*
* @since 1.10.0
*/
interface BooleanValue extends PrimitiveValue<boolean> {
}
namespace BooleanValue {
/**
* Type.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link BooleanValue.type} instead.
*/
var type__: string;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a duration. Durations can be used to modify a {@link DateValue} or can
* result from subtracting a DateValue from another.
*
* @since 1.10.0
*/
interface DurationValue extends NotNullValue {
/**
* Modifies the provided {@DateValue} by this duration.
*
* @param value - The DateValue to modify.
* @param subtract - Whether to subtract the duration from the DateValue.
* @returns The modified DateValue.
* @official
* @since 1.10.0
*/
addToDate(value: DateValue, subtract?: boolean): DateValue;
/**
* Convert this duration into milliseconds.
*
* @returns The duration in milliseconds.
* @official
* @since 1.10.0
*/
getMilliseconds(): number;
/**
* Returns a boolean indicating whether this DurationValue is truthy.
*
* @returns A boolean indicating whether this DurationValue is truthy.
* @official
* @since 1.10.0
*/
isTruthy(): boolean;
/**
* String representation of this DurationValue.
*
* @returns The string representation of this DurationValue.
* @official
* @since 1.10.0
*/
toString(): string;
}
namespace DurationValue {
/**
* Create a new DurationValue from milliseconds.
*
* @param milliseconds - The milliseconds to create a DurationValue from.
* @returns The new DurationValue.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link DurationValue.fromMilliseconds} instead.
*/
function fromMilliseconds__(milliseconds: number): DurationValue;
/**
* Create a new DurationValue using an ISO 8601 duration.
* See {@link https://en.wikipedia.org/wiki/ISO_8601#Durations} for duration format details.
*
* @param input - The ISO 8601 duration string.
* @returns The new DurationValue.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link DurationValue.parseFromString} instead.
*/
function parseFromString__(input: string): DurationValue | null;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a file in Obsidian.
*
* @since 1.10.0
*/
interface FileValue extends NotNullValue {
/**
* Returns a boolean indicating whether this FileValue is truthy.
*
* @returns A boolean indicating whether this FileValue is truthy.
* @official
* @since 1.10.0
*/
isTruthy(): boolean;
/**
* String representation of this FileValue.
*
* @returns The string representation of this FileValue.
* @official
* @since 1.10.0
*/
toString(): string;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a number.
*
* @since 1.10.0
*/
interface NumberValue extends PrimitiveValue<number> {
}
namespace NumberValue {
/**
* Type.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link NumberValue.type} instead.
*/
var type__: string;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a path to an image resource in the vault.
*
* @since 1.10.0
*/
interface ImageValue extends StringValue {
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a renderable icon.
*
* @since 1.10.0
*/
interface IconValue extends StringValue {
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping a string.
*
* @since 1.10.0
*/
interface StringValue extends PrimitiveValue<string> {
}
namespace StringValue {
/**
* Type.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link StringValue.type} instead.
*/
var type__: string;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping an Obsidian tag.
*
* @since 1.10.0
*/
interface TagValue extends StringValue {
/**
* Constructor.
*
* @param value - The value to wrap.
* @returns The new TagValue.
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link TagValue.constructor} instead.
*/
constructor__(value: string): this;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping an array of Values. Values do not all need to be of the same type.
*
* @since 1.10.0
*/
interface ListValue extends NotNullValue {
/**
* Get a new ListValue containing the elements from this ListValue and the provided ListValue.
*
* @param other - The ListValue to concatenate with.
* @returns A new ListValue containing the elements from this ListValue and the provided ListValue.
* @official
* @since 1.10.0
*/
concat(other: ListValue): ListValue;
/**
* The array passed in will be modified!
* @param value - Contents of the list.
* @returns The new ListValue.
* @official
* @since 1.10.0
*/
constructor__(value: (unknown | Value)[]): this;
/**
* Get the value at the provided index.
*
* @param index - The index to get the value from.
* @returns The value at the provided index, or {@link NullValue}.
* @official
* @since 1.10.0
*/
get(index: number): Value;
/**
* Returns a boolean indicating whether any elements in this list loosely equal the provided value.
*
* @param value - The value to check for.
* @returns A boolean indicating whether any elements in this list loosely equal the provided value.
* @official
* @since 1.10.0
*/
includes(value: Value): boolean;
/**
* Returns a boolean indicating whether this ListValue is truthy.
*
* @returns A boolean indicating whether this ListValue is truthy.
* @official
* @since 1.10.0
*/
isTruthy(): boolean;
/**
* Get the number of elements in this list.
*
* @returns the number of elements in this list.
* @official
* @since 1.10.0
*/
length(): number;
/**
* Get the string representation of this ListValue.
*
* @returns The string representation of this ListValue.
* @official
* @since 1.10.0
*/
toString(): string;
}
namespace ListValue {
/**
* Type.
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link ListValue.type} instead.
*/
var type__: string;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping an external link.
*
* @since 1.10.0
*/
interface UrlValue extends StringValue {
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping an internal wikilink.
*
* @since 1.10.0
*/
interface LinkValue extends StringValue {
}
namespace LinkValue {
/**
* Create a new LinkValue from wikilink syntax.
*
* @param app - The app instance.
* @param input - The wikilink syntax.
* @param sourcePath - The source path.
* @returns The new LinkValue.
*
* @example
* ```typescript
* parseFromString("[[Welcome|Example Link]]")
* ```
*
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link LinkValue.parseFromString} instead.
*/
function parseFromString__(app: App, input: string, sourcePath: string): LinkValue | null;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping an object.
*
* @since 1.10.0
*/
interface ObjectValue extends NotNullValue {
/**
* Get the {@link Value} associated with the provided key, or {@link NullValue}.
* If the referenced property in the object is not a Value, it will be wrapped before returning.
*
* @param key - The key to get the value from.
* @returns The {@link Value} associated with the provided key, or {@link NullValue}.
* @official
* @since 1.10.0
*/
get(key: string): Value | null;
/**
* Returns a boolean indicating whether this ObjectValue is empty.
*
* @returns A boolean indicating whether this ObjectValue is empty.
* @official
* @since 1.10.0
*/
isEmpty(): boolean;
/**
* Returns a boolean indicating whether this ObjectValue is truthy.
*
* @returns A boolean indicating whether this ObjectValue is truthy.
* @official
* @since 1.10.0
*/
isTruthy(): boolean;
/**
* Get the string representation of this ObjectValue.
*
* @returns The string representation of this ObjectValue.
* @official
* @since 1.10.0
*/
toString(): string;
}
namespace ObjectValue {
/**
* @official
* @since 1.10.0
* @deprecated - Added only for typing purposes. Use {@link ObjectValue.type} instead.
*/
var type__: string;
}
}
declare module "obsidian" {
/**
* {@link Value} wrapping raw HTML.
*
* @since 1.10.0
*/
interface HTMLValue extends StringValue {
}
}
declare module "obsidian" {
export enum PopoverState {
}
}
declare module "obsidian" {
interface FormulaContext {
}
}
declare module "obsidian" {
interface WorkspaceWindowInitData {
/**
* The suggested size.
*
* @official
*/
size?: {
/**
* The width.
* @official
*/
width: number;
/**
* The height.
*
* @official
*/
height: number;
};
/**
* The x position.
*
* @official
*/
x?: number;
/**
* The y position.
*
* @official
*/
y?: number;
}
}
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export declare class CustomArrayDictImpl<T> implements CustomArrayDict<T> {
data: Map<string, T[]>;
add(key: string, value: T): void;
remove(key: string, value: T): void;
get(key: string): T[] | null;
keys(): string[];
clear(key: string): void;
clearAll(): void;
contains(key: string, value: T): boolean;
count(): number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export declare class HighlightOutline extends Outline {
/** @todo Documentation incomplete. */
constructor(outlines: unknown, box: unknown, lastPoint: any);
/** @todo Documentation incomplete. */
lastPoint: unknown;
/** @todo Documentation incomplete. */
get box(): Object | null;
/** @todo Documentation incomplete. */
get classNamesForOutlining(): string[];
/**
* Serialize the outlines into the PDF page coordinate system.
*
* @param bbox - the bounding box of the annotation.
* @param rotation - the rotation of the annotation.
* @returns Serialized outlines.
*/
serialize(bbox: [
blX: string,
blY: string,
trX: string,
trY: string
], rotation: number): Array<Array<number>>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export declare class HighlightOutliner {
/**
* Construct an outliner.
*
* @param boxes - An array of axis-aligned rectangles.
* @param borderWidth - The width of the border of the boxes, it.
* allows to make the boxes bigger (or smaller).
* @param innerMargin - The margin between the boxes and the.
* outlines. It's important to not have a null innerMargin when we want to.
* draw the outline else the stroked outline could be clipped because of its.
* width.
* @param isLTR - true if we're in LTR mode. It's used to determine.
* the last point of the boxes.
*/
constructor(boxes: Array<Object>, borderWidth?: number, innerMargin?: number, isLTR?: boolean);
/** @todo Documentation incomplete. */
getOutlines(): HighlightOutline;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export declare class Outline {
/** @todo Documentation incomplete. */
static PRECISION: number;
/**
* The bounding box of the outline.
*
* @returns The bounding box of the outline.
*/
get box(): Object | null;
/** @todo Documentation incomplete. */
serialize(bbox: [
blX: string,
blY: string,
trX: string,
trY: string
], rotation: number): void;
/** @todo Documentation incomplete. */
static _normalizePagePoint(x: unknown, y: unknown, rotation: unknown): unknown[];
/** @todo Documentation incomplete. */
static _normalizePoint(x: unknown, y: unknown, parentWidth: unknown, parentHeight: unknown, rotation: unknown): number[];
/** @todo Documentation incomplete. */
static _rescale(src: unknown, tx: unknown, ty: unknown, sx: unknown, sy: unknown, dest: unknown): unknown;
/** @todo Documentation incomplete. */
static _rescaleAndSwap(src: unknown, tx: unknown, ty: unknown, sx: unknown, sy: unknown, dest: unknown): unknown;
/** @todo Documentation incomplete. */
static _translate(src: unknown, tx: unknown, ty: unknown, dest: unknown): unknown;
/** @todo Documentation incomplete. */
static createBezierPoints(x1: unknown, y1: unknown, x2: unknown, y2: unknown, x3: unknown, y3: unknown): number[];
/** @todo Documentation incomplete. */
static svgRound(x: unknown): number;
/**
* Converts the outline to an SVG path.
*
* @returns The SVG path of the outline.
*/
toSVGPath(): string;
}
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export declare const FileExtension: {
readonly _3gp: "3gp";
readonly avif: "avif";
readonly bmp: "bmp";
readonly canvas: "canvas";
readonly flac: "flac";
readonly gif: "gif";
readonly jpeg: "jpeg";
readonly jpg: "jpg";
readonly m4a: "m4a";
readonly md: "md";
readonly mkv: "mkv";
readonly mov: "mov";
readonly mp3: "mp3";
readonly mp4: "mp4";
readonly oga: "oga";
readonly ogg: "ogg";
readonly ogv: "ogv";
readonly opus: "opus";
readonly pdf: "pdf";
readonly png: "png";
readonly svg: "svg";
readonly wav: "wav";
readonly webm: "webm";
readonly webp: "webp";
};
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export declare const InternalPluginName: {
/**
* Plugin name in UI: Audio recorder.
*/
readonly AudioRecorder: "audio-recorder";
/**
* Plugin name in UI: Backlinks.
*/
readonly Backlink: "backlink";
/**
* Plugin name in UI: Bases.
*/
readonly Bases: "bases";
/**
* Plugin name in UI: Bookmarks.
*/
readonly Bookmarks: "bookmarks";
/**
* Plugin name in UI: Canvas.
*/
readonly Canvas: "canvas";
/**
* Plugin name in UI: Command palette.
*/
readonly CommandPalette: "command-palette";
/**
* Plugin name in UI: Daily notes.
*/
readonly DailyNotes: "daily-notes";
/**
* Plugin name in UI: (hidden).
*/
readonly EditorStatus: "editor-status";
/**
* Plugin name in UI: Files.
*/
readonly FileExplorer: "file-explorer";
/**
* Plugin name in UI: File recovery.
*/
readonly FileRecovery: "file-recovery";
/**
* Plugin name in UI: Footnotes.
*/
readonly Footnotes: "footnotes";
/**
* Plugin name in UI: Search.
*/
readonly GlobalSearch: "global-search";
/**
* Plugin name in UI: Graph view.
*/
readonly Graph: "graph";
/**
* Plugin name in UI: Format converter.
*/
readonly MarkdownImporter: "markdown-importer";
/**
* Plugin name in UI: Note composer.
*/
readonly NoteComposer: "note-composer";
/**
* Plugin name in UI: Outgoing links.
*/
readonly OutgoingLink: "outgoing-link";
/**
* Plugin name in UI: Outline.
*/
readonly Outline: "outline";
/**
* Plugin name in UI: Page preview.
*/
readonly PagePreview: "page-preview";
/**
* Plugin name in UI: Properties view.
*/
readonly Properties: "properties";
/**
* Plugin name in UI: Publish.
*/
readonly Publish: "publish";
/**
* Plugin name in UI: Random note.
*/
readonly RandomNote: "random-note";
/**
* Plugin name in UI: Slash commands.
*/
readonly SlashCommand: "slash-command";
/**
* Plugin name in UI: Slides.
*/
readonly Slides: "slides";
/**
* Plugin name in UI: Quick Switcher.
*/
readonly Switcher: "switcher";
/**
* Plugin name in UI: Sync.
*/
readonly Sync: "sync";
/**
* Plugin name in UI: Tags view.
*/
readonly TagPane: "tag-pane";
/**
* Plugin name in UI: Templates.
*/
readonly Templates: "templates";
/**
* Plugin name in UI: Web viewer.
*/
readonly Webviewer: "webviewer";
/**
* Plugin name in UI: Word count.
*/
readonly WordCount: "word-count";
/**
* Plugin name in UI: Workspaces.
*/
readonly Workspaces: "workspaces";
/**
* Plugin name in UI: Unique note creator.
*/
readonly ZkPrefixer: "zk-prefixer";
};
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export declare const ViewType: {
readonly AllProperties: "all-properties";
readonly Audio: "audio";
readonly Backlink: "backlink";
readonly Bases: "bases";
readonly Bookmarks: "bookmarks";
readonly Canvas: "canvas";
readonly Empty: "empty";
readonly FileExplorer: "file-explorer";
readonly FileProperties: "file-properties";
readonly Graph: "graph";
readonly Image: "image";
readonly LocalGraph: "localgraph";
readonly Markdown: "markdown";
readonly OutgoingLink: "outgoing-link";
readonly Outline: "outline";
readonly Pdf: "pdf";
readonly ReleaseNotes: "release-notes";
readonly Search: "search";
readonly Sync: "sync";
readonly Table: "table";
readonly Tag: "tag";
readonly Video: "video";
readonly Webviewer: "webviewer";
readonly WebviewerHistory: "webviewer-history";
};
/**
* Creates and properly initializes the instance of TFile even the underlying file does not exist.
* This doesn't create the missing file on the file system.
*
* @public
* @unofficial
*/
export declare function createTFileInstance(app: App, path: string): TFile;
/**
* Creates and properly initializes the instance of TFolder even the underlying folder does not exist.
* This doesn't create the missing folder on the file system.
*
* @public
* @unofficial
*/
export declare function createTFolderInstance(app: App, path: string): TFolder;
/**
* Get the App constructor.
*
* @returns The App constructor.
*
* @public
* @unofficial
*/
export declare function getAppConstructor(): AppConstructor;
/**
* Get the InternalPlugin constructor.
*
* @param app - The app instance.
* @returns The InternalPlugin constructor.
*
* @public
* @unofficial
*/
export declare function getInternalPluginConstructor<Instance>(app: App): InternalPluginConstructor<Instance>;
/**
* Get the InternalPlugins constructor.
*
* @param app - The app instance.
* @returns The InternalPlugins constructor.
*
* @public
* @unofficial
*/
export declare function getInternalPluginsConstructor(app: App): InternalPluginsConstructor;
/**
* Get the TFile constructor.
*
* @returns The TFile constructor.
*
* @public
* @unofficial
*/
export declare function getTFileConstructor(): TFileConstructor;
/**
* Get the TFolder constructor.
*
* @returns The TFolder constructor.
*
* @public
* @unofficial
*/
export declare function getTFolderConstructor(): TFolderConstructor;
/**
* Get the view constructor by view type.
*
* @param app - The app.
* @param viewType - The view type.
* @returns The view constructor.
*
* @public
* @unofficial
*/
export declare function getViewConstructorByViewType<TViewType extends ViewTypeType>(app: App, viewType: TViewType): ViewTypeViewConstructorMapping[TViewType];
/**
* Check if the reference is an embed cache.
*
* @param reference - The reference to check.
* @returns Whether the reference is an embed cache.
*
* @public
* @unofficial
*/
export declare function isEmbedCache(reference: Reference): reference is EmbedCache;
/**
* Check if the reference is a frontmatter link cache.
*
* @param reference - The reference to check.
* @returns Whether the reference is a frontmatter link cache.
*
* @public
* @unofficial
*/
export declare function isFrontmatterLinkCache(reference: Reference): reference is FrontmatterLinkCache;
/**
* Check if the reference is a link cache.
*
* @param reference - The reference to check.
* @returns Whether the reference is a link cache.
*
* @public
* @unofficial
*/
export declare function isLinkCache(reference: Reference): reference is LinkCache;
/**
* Check if the reference is a reference cache.
*
* @param reference - The reference to check.
* @returns Whether the reference is a reference cache.
*
* @public
* @unofficial
*/
export declare function isReferenceCache(reference: Reference): reference is ReferenceCache;
/**
* Load Mermaid and return a promise to the global mermaid object.
* Can also use `window.mermaid` after this promise resolves to get the same reference.
*
* @returns A promise that resolves to the global `window.mermaid` object.
*
* @see {@link https://mermaid.js.org/ | Official Mermaid documentation}.
* @public
* @unofficial
*/
export declare function loadMermaid(): Promise<Mermaid>;
/**
* Load PDF.js and return a promise to the global pdfjsLib object.
* Can also use `window.pdfjsLib` after this promise resolves to get the same reference.
*
* @returns A promise that resolves to the global `window.pdfjsLib` object.
*
* @see {@link https://mozilla.github.io/pdf.js/ | Official PDF.js documentation}.
* @public
* @unofficial
*/
export declare function loadPdfJs(): Promise<typeof pdfjsLib>;
/**
* Load Prism.js and return a promise to the global Prism object.
* Can also use `window.Prism` after this promise resolves to get the same reference.
*
* @returns A promise that resolves to the global `window.Prism` object.
*
* @see {@link https://prismjs.com/ | Official Prism documentation}.
* @public
* @unofficial
*/
export declare function loadPrism(): Promise<typeof Prism$1>;
/**
* Get the parent folder path of a given path.
*
* @param path - The path to get the parent folder path of.
* @returns The parent folder path.
*
* @public
* @unofficial
*/
export declare function parentFolderPath(path: string): string;
/**
* Function `Abs`.
* @public
* @unofficial
*/
export interface AbsFunction extends BasesFunction, HasGetDisplayName {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AbstractFileTreeItem<T extends TAbstractFile> extends TreeItem {
/**
* Associated file with this item.
*/
file: T;
/** @todo Documentation incomplete. */
info: TreeNodeInfo;
/** @todo Documentation incomplete. */
parent: FileTreeItemParent;
/** @todo Documentation incomplete. */
rendered: boolean;
/** @todo Documentation incomplete. */
view: FileExplorerView;
/** @todo Documentation incomplete. */
getTitle(): string;
/** @todo Documentation incomplete. */
isFullTimeShown(): boolean;
/** @todo Documentation incomplete. */
onRender(): void;
/** @todo Documentation incomplete. */
startRename(): void;
/** @todo Documentation incomplete. */
stopRename(): void;
/** @todo Documentation incomplete. */
updateTitle(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AbstractSearchComponent {
/**
* Reference to the app.
*/
app: App;
/**
* The container element in which the search component exists (i.e. Editor).
*/
containerEl: HTMLElement;
/**
* Container for the replacement input field.
*/
replaceInputEl: HTMLInputElement;
/**
* Keyscope for search component.
*/
scope: Scope;
/**
* Container for all the action buttons.
*/
searchButtonContainerEl: HTMLElement;
/**
* Container for the search component itself.
*/
searchContainerEl: HTMLElement;
/**
* Container for the search input field.
*/
searchInputEl: HTMLInputElement;
/**
* Returns the current search query.
*/
getQuery(): string;
/**
* Switch to the next inputElement.
*/
goToNextInput(event: KeyboardEvent): unknown;
/**
* Invokes findNextOrReplace.
*/
onEnter(event: KeyboardEvent): unknown;
/**
* Invokes findPrevious.
*/
onShiftEnter(event: KeyboardEvent): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Account {
/**
* The company associated with the activated commercial license.
*/
company: string;
/**
* The email address associated with the account.
*/
email: string;
/** @todo Documentation incomplete. */
expiry: number;
/** @todo Documentation incomplete. */
key: string | undefined;
/** @todo Documentation incomplete. */
keyValidation: string;
/**
* The license available to the account.
*/
license: "" | "insider";
/**
* Profile name.
*/
name: string;
/** @todo Documentation incomplete. */
seats: number;
/** @todo Documentation incomplete. */
token: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AddOverlayOptions {
/** @todo Documentation incomplete. */
query: RegExp;
}
/**
* Property widget component for aliases.
*
* @public
* @unofficial
*/
export interface AliasesPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The container element for the property widget. */
containerEl: HTMLElement;
/** The render context for the property widget. */
ctx: PropertyRenderContext;
/** The hover popover for the property widget. */
hoverPopover: null;
/** The multiselect component for the property widget. */
multiselect: Multiselect;
/** The type of the property widget. */
type: "aliases";
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AllPropertiesView extends ItemView {
/**
* Try to rename the file.
*/
acceptRename(): Promise<void>;
/**
* Cancels the rename.
*/
cancelRename(): void;
/**
* Quits the rename.
*/
exitRename(): void;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.AllProperties;
/** @todo Documentation incomplete */
isItem(e: unknown): boolean;
/**
* Select the item in focus if pressed 'Enter'.
*
* @param event - The event triggered this function.
*/
onKeyEnterInFocus(event: KeyboardEvent): void;
/**
* Called when 'Enter' is pressed while rename. Accepts the rename.
*
* @param event - The event triggered this function.
*/
onKeyEnterInRename(event: KeyboardEvent): void;
/**
* Toggles the visibility of the search.
*/
onToggleShowSearch(): void;
/** @todo Documentation incomplete */
setShowSearch(e: boolean): void;
/**
* Updates the sort order and sort by it.
*
* @param order - The sort order.
*/
setSortOrder(order: unknown): void;
/**
* Shows the search and focus is.
*/
showSearch(): void;
/** @todo Documentation incomplete */
startRename(e: unknown): Promise<unknown>;
/** @todo Documentation incomplete */
update(): void;
/**
* Updates the search.
*/
updateSearch(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AllPropertiesViewConstructor extends TypedViewConstructor<AllPropertiesView> {
}
/**
* The App constructor.
*
* @public
* @unofficial
*/
export interface AppConstructor extends ConstructorBase<[
adapter: DataAdapter,
appId: string
], App> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AppMenuBarManager {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
constructor: AppMenuBarManagerConstructor;
/** @todo Documentation incomplete. */
onLayoutChange: Debouncer<[
], unknown>;
/** @todo Documentation incomplete. */
onWindowFrameChange: Debouncer<[
], unknown>;
/** @todo Documentation incomplete. */
requestRender: Debouncer<[
], unknown>;
/** @todo Documentation incomplete. */
_onLayoutChange(): unknown;
/** @todo Documentation incomplete. */
applyHotkeys(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
buildMenu(): unknown;
/** @todo Documentation incomplete. */
getAcceleratorFromHotkey(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
hideUnregisteredCommands(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
render(): unknown;
/** @todo Documentation incomplete. */
updateShareMenuItem(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
updateViewState(): unknown;
/** @todo Documentation incomplete. */
updateWorkspace(): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AppMenuBarManagerConstructor {
/** @todo Documentation incomplete. */
updateMenuItems(arg1: unknown, arg2: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AppSetting extends Modal {
/**
* Current active tab of the settings modal.
*/
activeTab: SettingTab | null;
/**
* Closeable component for the active tab.
*/
activeTabCloseable: CloseableComponent | null;
/**
* Container element containing the community plugins
*/
communityPluginTabContainer: HTMLElement;
/**
* Container element containing the community plugins header.
*/
communityPluginTabHeaderGroup: HTMLElement;
/**
* Container element containing the core plugins.
*/
corePluginTabContainer: HTMLElement;
/**
* Container element containing the core plugins header.
*/
corePluginTabHeaderGroup: HTMLElement;
/**
* Previously opened tab ID.
*/
lastTabId: string;
/**
* List of all plugin tabs (core and community, ordered by precedence).
*/
pluginTabs: SettingTab[];
/**
* List of all core settings tabs (editor, files & links, ...).
*/
settingTabs: SettingTab[];
/**
* Container element containing the core settings.
*/
tabContainer: HTMLElement;
/**
* Container for currently active settings tab.
*/
tabContentContainer: HTMLElement;
/**
* Container for all settings tabs.
*/
tabHeadersEl: HTMLElement;
/**
* Add a new plugin tab to the settings modal.
*
* @param tab - Tab to add.
*/
addSettingTab(tab: SettingTab): void;
/**
* Closes the currently active tab.
*/
closeActiveTab(): void;
/**
* Check whether tab is a plugin tab.
*
* @param tab - Tab to check.
*/
isPluginSettingTab(tab: SettingTab): boolean;
/**
* Open a specific tab by tab reference.
*
* @param tab - Tab to open.
*/
openTab(tab: SettingTab): void;
/** @todo Documentation incomplete. */
openTabById(id: "hotkeys"): HotkeysSettingTab;
/**
* Open a specific tab by ID.
*
* @param id - ID of the tab to open.
*/
openTabById(id: string): SettingTab;
/**
* Remove a plugin tab from the settings modal.
*
* @param tab - Tab to remove.
*/
removeSettingTab(tab: SettingTab): void;
/**
* Update the title of the modal.
*
* @param tab - Tab to update the title to.
*/
updateModalTitle(tab: SettingTab): void;
/**
* Update a tab section.
*/
updatePluginSection(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AppVaultConfig {
/**
* Appearance \> Accent color.
*/
accentColor: "" | string;
/**
* Files & Links \> Automatically update internal links.
*/
alwaysUpdateLinks?: false | boolean;
/**
* Files & Links \> Attachment folder path.
*/
attachmentFolderPath?: "/" | string;
/**
* Editor \> Auto convert HTML.
*/
autoConvertHtml?: true | boolean;
/**
* Editor \> Auto pair brackets.
*/
autoPairBrackets?: true | boolean;
/**
* Editor \> Auto pair Markdown syntax.
*/
autoPairMarkdown?: true | boolean;
/**
* Appearance \> Font size.
*/
baseFontSize?: 16 | number;
/**
* Appearance \> Quick font size adjustment.
*/
baseFontSizeAction?: true | boolean;
/**
* Community Plugins \> Browse \> Sort order.
*/
communityPluginSortOrder: "download" | "update" | "release" | "alphabetical";
/**
* Themes \> Browse \> Sort order.
*/
communityThemeSortOrder: "download" | "update" | "release" | "alphabetical";
/**
* Appearance \> Theme.
*
* @remark is the default Obsidian theme.
*/
cssTheme?: "" | string;
/**
* Editor \> Default view for new tabs.
*/
defaultViewMode?: "source" | "preview";
/** @todo Documentation incomplete. */
emacsyKeys?: true | boolean;
/**
* Appearance \> CSS snippets.
*/
enabledCssSnippets?: string[];
/** @todo Documentation incomplete. */
fileSortOrder?: "alphabetical";
/**
* Editor \> Always focus new tabs.
*/
focusNewTab?: true | boolean;
/**
* Editor \> Fold heading.
*/
foldHeading?: true | boolean;
/**
* Editor \> Fold indent.
*/
foldIndent?: true | boolean;
/**
* Hotkeys.
*
* @deprecated Likely not used anymore.
*/
hotkeys?: AppVaultConfigHotkeysRecord;
/**
* Appearance \> Interface font.
*/
interfaceFontFamily?: "" | string;
/**
* Editor \> Use legacy editor.
*/
legacyEditor?: false | boolean;
/** @todo Documentation incomplete. */
livePreview?: true | boolean;
/**
* Mobile \> Configure mobile Quick Action.
*/
mobilePullAction?: "command-palette:open" | string;
/** @todo Documentation incomplete. */
mobileQuickRibbonItem?: "" | string;
/**
* Mobile \> Manage toolbar options.
*/
mobileToolbarCommands?: string[];
/** @todo Documentation incomplete. */
monospaceFontFamily?: "" | string;
/**
* Appearance \> Native menus.
*/
nativeMenus?: null | boolean;
/**
* Files & Links \> Default location for new notes | 'folder' \> Folder to create new notes in.
*/
newFileFolderPath?: "/" | string;
/**
* Files & Links \> Default location for new notes.
*/
newFileLocation?: "root" | "current" | "folder";
/**
* Files & Links \> New link format.
*/
newLinkFormat?: "shortest" | "relative" | "absolute";
/**
* Saved on executing 'Export to PDF' command.
*/
pdfExportSettings?: PdfExportSettings;
/**
* Files & Links \> Confirm line deletion.
*/
promptDelete?: true | boolean;
/**
* Editor \> Properties in document.
*/
propertiesInDocument?: "visible" | "hidden" | "source";
/**
* Editor \> Readable line length.
*/
readableLineLength?: true | boolean;
/**
* Editor \> Right-to-left (RTL).
*/
rightToLeft?: false | boolean;
/**
* Editor \> Show indentation guides.
*/
showIndentGuide?: true | boolean;
/**
* Editor \> Show inline title.
*/
showInlineTitle?: true | boolean;
/**
* Editor \> Show line numbers.
*/
showLineNumber?: false | boolean;
/**
* Appearance \> Show ribbon.
*/
showRibbon?: true | boolean;
/**
* Files & Links \> Detect all file extensions.
*/
showUnsupportedFiles?: false | boolean;
/**
* Appearance \> Show tab title bar.
*/
showViewHeader?: false | boolean;
/**
* Editor \> Smart indent lists.
*/
smartIndentList?: true | boolean;
/**
* Editor \> Spellcheck.
*/
spellcheck?: false | boolean;
/**
* Editor \> Spellcheck languages.
*/
spellcheckLanguages?: null | string[];
/**
* Editor \> Strict line breaks.
*/
strictLineBreaks?: false | boolean;
/**
* Editor \> Tab indent size.
*/
tabSize?: 4 | number;
/**
* Appearance \> Text font.
*/
textFontFamily?: "" | string;
/**
* Appearance \> Base color scheme.
*
* @remark Not be confused with cssTheme, this setting is for the light/dark mode.
* @remark moonstone is light theme, 'obsidian' is dark theme.
*/
theme?: "moonstone" | "obsidian";
/**
* Appearance \> Translucent window.
*/
translucency?: false | boolean;
/**
* Files & Links \> Deleted files.
*/
trashOption?: "system" | "local" | "none";
/** @deprecated Probably left-over code from old properties type storage */
types: object;
/**
* Files & Links \> Use [[Wikilinks]].
*/
useMarkdownLinks?: false | boolean;
/**
* Files & Links \> Excluded files.
*/
userIgnoreFilters?: null | string[];
/**
* Editor \> Indent using tabs.
*/
useTab?: true | boolean;
/**
* Editor \> Vim key bindings.
*/
vimMode?: false | boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AppVaultConfigHotkeysRecord extends Record<string, string> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AudioRecorderPlugin extends InternalPlugin<AudioRecorderPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AudioRecorderPluginInstance extends InternalPluginInstance<AudioRecorderPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
extension: string;
/** @todo Documentation incomplete. */
plugin: AudioRecorderPlugin;
/** @todo Documentation incomplete. */
recorder: MediaRecorder | null;
/** @todo Documentation incomplete. */
recording: boolean;
/** @todo Documentation incomplete. */
checkPermission(): Promise<boolean>;
/** @todo Documentation incomplete. */
onRecordAudio(): Promise<void>;
/** @todo Documentation incomplete. */
onStartRecording(): Promise<void>;
/** @todo Documentation incomplete. */
onStopRecording(): void;
/** @todo Documentation incomplete. */
saveRecording(audioBuffer: ArrayBuffer): Promise<void>;
/** @todo Documentation incomplete. */
showRecordingMessage(message: string, isError: boolean): void;
/** @todo Documentation incomplete. */
startRecording(stream: MediaStream): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AudioView extends EditableFileView {
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Audio;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface AudioViewConstructor extends TypedViewConstructor<AudioView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BBox {
/** @todo Documentation incomplete. */
maxX: number;
/** @todo Documentation incomplete. */
maxY: number;
/** @todo Documentation incomplete. */
minX: number;
/** @todo Documentation incomplete. */
minY: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BacklinkComponent extends Component {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
backlinkCollapsed: boolean;
/** @todo Documentation incomplete. */
backlinkCountEl: HTMLSpanElement;
/** @todo Documentation incomplete. */
backlinkDom: ResultDom;
/** @todo Documentation incomplete. */
backlinkFile: TFile | null;
/** @todo Documentation incomplete. */
backlinkHeaderEl: HTMLDivElement;
/** @todo Documentation incomplete. */
backlinkQueue: ItemQueue<TFile> | null;
/** @todo Documentation incomplete. */
collapseAll: boolean;
/** @todo Documentation incomplete. */
collapseAllButtonEl: HTMLDivElement;
/** @todo Documentation incomplete. */
extraContext: boolean;
/** @todo Documentation incomplete. */
extraContextButtonEl: HTMLDivElement;
/** @todo Documentation incomplete. */
file: TFile | null;
/** @todo Documentation incomplete. */
headerDom: HeaderDom;
/** @todo Documentation incomplete. */
isShowingSearch: boolean;
/** @todo Documentation incomplete. */
searchComponent: SearchComponent;
/** @todo Documentation incomplete. */
searchQuery: null;
/** @todo Documentation incomplete. */
showSearchButtonEl: HTMLDivElement;
/** @todo Documentation incomplete. */
sortOrder: string;
/** @todo Documentation incomplete. */
tooltipPlacement: string;
/** @todo Documentation incomplete. */
unlinkedAliases: string;
/** @todo Documentation incomplete. */
unlinkedCollapsed: boolean;
/** @todo Documentation incomplete. */
unlinkedCountEl: HTMLSpanElement;
/** @todo Documentation incomplete. */
unlinkedDom: ResultDom;
/** @todo Documentation incomplete. */
unlinkedFile: null;
/** @todo Documentation incomplete. */
unlinkedHeaderEl: HTMLDivElement;
/** @todo Documentation incomplete. */
unlinkedQueue: null;
/** @todo Documentation incomplete. */
addLinkFunction(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
getState(): unknown;
/** @todo Documentation incomplete. */
onFileChanged(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onFileDeleted(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onFileRename(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onload(): unknown;
/** @todo Documentation incomplete. */
onMetadataChanged(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onResize(): unknown;
/** @todo Documentation incomplete. */
onToggleCollapseClick(): unknown;
/** @todo Documentation incomplete. */
onToggleMoreContextClick(): unknown;
/** @todo Documentation incomplete. */
onToggleShowSearch(): unknown;
/** @todo Documentation incomplete. */
passSearchFilter(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
recomputeBacklink(backlinkFile: TFile | null): void;
/** @todo Documentation incomplete. */
recomputeUnlinked(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setBacklinkCollapsed(arg1: unknown, arg2: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
setCollapseAll(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setExtraContext(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setSectionCollapsed(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
setShowSearch(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setSortOrder(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setState(arg1: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
setUnlinkedCollapsed(arg1: unknown, arg2: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
stopBacklinkSearch(): void;
/** @todo Documentation incomplete. */
stopUnlinkedSearch(): unknown;
/** @todo Documentation incomplete. */
toggleBacklinkCollapsed(): unknown;
/** @todo Documentation incomplete. */
toggleUnlinkedCollapsed(): unknown;
/** @todo Documentation incomplete. */
update(): unknown;
/** @todo Documentation incomplete. */
updateHeaderTooltip(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
updateSearch(): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BacklinkPlugin extends InternalPlugin<BacklinkPluginInstance> {
/** @todo Documentation incomplete. */
views: BacklinkPluginViews;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BacklinkPluginInstance extends InternalPluginInstance<BacklinkPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
file?: TFile | null;
/** @todo Documentation incomplete. */
options: BacklinkPluginInstanceOptions;
/** @todo Documentation incomplete. */
plugin: BacklinkPlugin;
/** @todo Documentation incomplete. */
initLeaf(): void;
/** @todo Documentation incomplete. */
onEnable(app: App, plugin: BacklinkPlugin): Promise<void>;
/** @todo Documentation incomplete. */
onExternalSettingsChange(): Promise<void>;
/** @todo Documentation incomplete. */
onFileMenu(menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf): void;
/** @todo Documentation incomplete. */
onFileOpen(file: TAbstractFile): void;
/** @todo Documentation incomplete. */
onUserDisable(app: App): void;
/** @todo Documentation incomplete. */
onUserEnable(): void;
/** @todo Documentation incomplete. */
openBacklinksForActiveFile(skipSplit: boolean): boolean | undefined;
/** @todo Documentation incomplete. */
toggleBacklinksInDocument(skip: boolean): boolean | undefined;
/** @todo Documentation incomplete. */
updateBacklinks(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BacklinkPluginInstanceOptions {
/** @todo Documentation incomplete. */
backlinkInDocument?: boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BacklinkPluginViews extends Record<string, ViewCreator> {
/** @todo Documentation incomplete. */
backlink(left: WorkspaceLeaf): BacklinkView;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BacklinkView extends InfoFileView {
/** @todo Documentation incomplete. */
backlink: BacklinkComponent;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Backlink;
/**
* Shows the search.
*/
showSearch(): void;
/** @todo Documentation incomplete */
update(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BacklinkViewConstructor extends TypedViewConstructor<BacklinkView> {
}
/**
* BasesConfigFileFilter `and` clause.
*
* @public
* @unofficial
*/
export interface BasesConfigFileFilterAndClause {
/**
* All of the following filters must match.
*
* @public
* @since 1.10.0
* @example
* ```ts
* {
* and: [
* '*.md',
* '*.txt',
* ],
* }
* ```
*/
and: BasesConfigFileFilter[];
}
/**
* BasesConfigFileFilter `not` clause.
*
* @public
* @unofficial
*/
export interface BasesConfigFileFilterNotClause {
/**
* None of the following filters should match.
*
* @public
* @since 1.10.0
* @example
* ```ts
* {
* not: [
* '*.md',
* '*.txt',
* ],
* }
* ```
*/
not: BasesConfigFileFilter[];
}
/**
* BasesConfigFileFilter `or` clause.
*
* @public
* @unofficial
*/
export interface BasesConfigFileFilterOrClause {
/**
* Some of the following filters should match.
*
* @public
* @since 1.10.0
* @example
* ```ts
* {
* or: [
* '*.md',
* '*.txt',
* ],
* }
* ```
*/
or: BasesConfigFileFilter[];
}
/**
* Bases context
*
* @public
* @unofficial
*/
export interface BasesContext extends Component {
/**
* Local context.
*/
_local: BasesLocal;
}
/**
* Table view constructor.
*
* @public
* @unofficial
*/
export interface BasesContextConstructor extends ConstructorBase<[
app: App,
filter: Record<string, BasesFilter>,
formulas: Record<string, BasesFormula>,
file: TFile | null
], BasesContext> {
}
/**
* Bases control.
*
* @public
* @unofficial
*/
export interface BasesControl {
/**
* Render to.
*
* @param containerEl - The container element.
* @param t - The data to render.
*/
renderTo(containerEl: HTMLElement, renderContext: RenderContext): void;
}
/**
* Controller for the view.
*
* @public
* @unofficial
*/
export interface BasesController extends Component {
/**
* The Obsidian app instance.
*/
app: App;
/**
* The context of the view controller.
*/
ctx: BasesContext;
/**
* The current file.
*/
currentFile: TFile | null;
/**
* The current error.
*/
error: string | null;
/**
* The error element.
*/
errorEl: HTMLDivElement;
/**
* The errors.
*/
errors: Set<string>;
/**
* The events.
*/
events: Events;
/**
* The filter menu.
*/
filterMenu: BasesFilterMenu;
/**
* Whether the initial scan has been completed.
*/
initialScan: boolean;
/**
* The mock context.
*/
mockContext: BasesMockContext;
/**
* The new item menu.
*/
newItemMenu: BasesNewItemMenu;
/**
* The plugin instance.
*/
plugin: BasesPluginInstance;
/**
* The property menu.
*/
propertyMenu: BasesPropertyMenu;
/**
* The query.
*/
query: BasesQuery | null;
/**
* The query state.
*/
queryState: string;
/**
* The queue.
*/
queue: PromisedQueue;
/**
* The relevant properties.
*/
relevantProperties: Set<string>;
/**
* The request to notify the view.
*/
requestNotifyView: Debouncer<[
], void>;
/**
* The results.
*/
results: Map<unknown, unknown>;
/**
* The results menu.
*/
resultsMenu: BasesResultsMenu;
/**
* The sort menu.
*/
sortMenu: BasesSortMenu;
/**
* The view.
*/
view: View;
/**
* The view container element.
*/
viewContainerEl: HTMLDivElement;
/**
* The view states.
*/
viewEstates: Record<string, unknown>;
/**
* The view header element.
*/
viewHeaderEl: HTMLDivElement;
/**
* The view menu.
*/
viewMenu: BasesViewMenu;
/**
* The view name.
*/
viewName: string;
/**
* Adds a result to the results.
*/
addResult(result: unknown, arg2: unknown): unknown;
/**
* Builds the bases context.
*/
buildBasesContext(filter: BasesFilter): BasesContext;
/**
* Clears the view controller.
*/
clear(): void;
/**
* Clears the error.
*/
clearError(): void;
/**
* Displays an error.
*/
displayError(error: string, arg2: unknown): void;
/**
* Evaluates the relevant properties.
*/
evaluateRelevantProperties(relevantProperties: string[]): void;
/**
* Gets the active bases view of a given type.
*/
getActiveBasesViewOfType(viewType: string): View | null;
/**
* Gets the current file.
*/
getCurrentFile(): TFile | null;
/**
* Gets the editor language support.
*/
getEditorLanguageSupport(): EditorLanguageSupport;
/**
* Gets the mock value.
*/
getMockValue(arg1: unknown): unknown;
/**
* Gets the mock value for an ident.
*/
getMockValueForIdent(arg1: unknown): unknown;
/**
* Gets the properties.
*/
getProperties(): unknown[];
/**
* Gets the query view names.
*/
getQueryViewNames(): string[];
/**
* Gets the view config.
*/
getViewConfig(): unknown;
/**
* Gets the widget for an ident.
*/
getWidgetForIdent(type: string): string;
/**
* Notifies the view.
*/
notifyView(): void;
/**
* On config changed.
*/
onConfigChanged(configKey: string): void;
/**
* On resize.
*/
onResize(): void;
/**
* Prompt for add view.
*/
promptForAddView(): void;
/**
* Removes a result.
*/
removeResult(arg1: unknown): unknown;
/**
* Runs a query.
*/
runQuery(arg1: unknown): void;
/**
* Selects a view.
*/
selectView(viewName: string): void;
/**
* Sets the query.
*/
setQuery(queryOrError: BasesQuery | Error): void;
/**
* Sets the query and view.
*/
setQueryAndView(queryOrError: BasesQuery | Error, viewName: string): void;
/**
* Starts the loader.
*/
startLoader(): void;
/**
* Stops the loader.
*/
stopLoader(): void;
/**
* Updates the view.
*/
update(): void;
/**
* Updates the current file.
*/
updateCurrentFile(file: TFile): void;
}
/**
* Bases external link.
*
* @public
* @unofficial
*/
export interface BasesExternalLink extends BasesControl {
}
/**
* Bases file.
*
* @public
* @unofficial
*/
export interface BasesFile extends BasesControl {
/**
* Gets the links.
*
* @returns The links.
*/
getLinks(): BasesList;
}
/**
* Bases filter.
*
* @public
* @unofficial
*/
export interface BasesFilter {
}
/**
* Bases filter menu.
*
* @public
* @unofficial
*/
export interface BasesFilterMenu {
}
/**
* Bases formula.
*
* @public
* @unofficial
*/
export interface BasesFormula {
}
/**
* Bases function.
*
* @public
* @unofficial
*/
export interface BasesFunction {
/**
* An Obsidian app instance.
*/
app: App;
/**
* The arguments.
*/
args: BasesFunctionArg[];
/**
* Whether the function is an operator.
*/
isOperator: boolean;
/**
* The name of the function.
*/
name: string;
/**
* The return type of the function.
*/
returnType: string;
/**
* Applies the function.
*/
apply(...args: unknown[]): unknown;
/**
* Serializes the function.
*/
serialize(...args: unknown[]): string;
}
/**
* Bases function argument.
*
* @public
* @unofficial
*/
export interface BasesFunctionArg {
/**
* Whether to include custom types.
*/
include_custom_types?: boolean;
/**
* The name of the argument.
*/
name: string;
/**
* Whether the argument is optional.
*/
optional?: boolean;
/**
* The types of the argument.
*/
type: string[];
/**
* Whether the argument is variadic.
*/
variadic?: boolean;
}
/**
* Bases functions.
*
* @public
* @unofficial
*/
export interface BasesFunctions {
/**
* The not equal function.
*/
"!=": NotEqualFunction;
/**
* The less than function.
*/
"<": LessFunction;
/**
* The less than or equal to function.
*/
"<=": LessOrEqualFunction;
/**
* The equal function.
*/
"==": EqualFunction;
/**
* The greater than function.
*/
">": GreaterFunction;
/**
* The greater than or equal to function.
*/
">=": GreaterOrEqualFunction;
/**
* The absolute function.
*/
abs: AbsFunction;
/**
* The ceiling function.
*/
ceil: CeilFunction;
/**
* The concat function.
*/
concat: ConcatFunction;
/**
* The contains function.
*/
contains: ContainsFunction;
/**
* The contains all function.
*/
containsAll: ContainsAllFunction;
/**
* The contains any function.
*/
containsAny: ContainsAnyFunction;
/**
* The contains none function.
*/
containsNone: ContainsNoneFunction;
/**
* The date after function.
*/
dateAfter: DateAfterFunction;
/**
* The date before function.
*/
dateBefore: DateBeforeFunction;
/**
* The date diff function.
*/
dateDiff: DateDiffFunction;
/**
* The date equals function.
*/
dateEquals: DateEqualsFunction;
/**
* The date modify function.
*/
dateModify: DateModifyFunction;
/**
* The date not equals function.
*/
dateNotEquals: DateNotEqualsFunction;
/**
* The date on or after function.
*/
dateOnOrAfter: DateOnOrAfterFunction;
/**
* The date on or before function.
*/
dateOnOrBefore: DateOnOrBeforeFunction;
/**
* The day function.
*/
day: DayFunction;
/**
* The empty function.
*/
empty: EmptyFunction;
/**
* The flat function.
*/
flat: FlatFunction;
/**
* The floor function.
*/
floor: FloorFunction;
/**
* The hour function.
*/
hour: HourFunction;
/**
* The if function.
*/
if: IfFunction;
/**
* The index function.
*/
index: IndexFunction;
/**
* The in folder function.
*/
inFolder: InFolderFunction;
/**
* The join function.
*/
join: JoinFunction;
/**
* The length function.
*/
len: LenFunction;
/**
* The links to function.
*/
linksTo: LinksToFunction;
/**
* The minimum function.
*/
min: MinFunction;
/**
* The minute function.
*/
minute: MinuteFunction;
/**
* The month function.
*/
month: MonthFunction;
/**
* The not function.
*/
not: NotFunction;
/**
* The not contains function.
*/
notContains: NotContainsFunction;
/**
* The not empty function.
*/
notEmpty: NotEmptyFunction;
/**
* The now function.
*/
now: NowFunction;
/**
* The round function.
*/
round: RoundFunction;
/**
* The second function.
*/
second: SecondFunction;
/**
* The slice function.
*/
slice: SliceFunction;
/**
* The tagged with function.
*/
taggedWith: TaggedWithFunction;
/**
* The title function.
*/
title: TitleFunction;
/**
* The trim function.
*/
trim: TrimFunction;
/**
* The unique function.
*/
unique: UniqueFunction;
/**
* The year function.
*/
year: YearFunction;
}
/**
* Bases handlers.
*
* @public
* @unofficial
*/
export interface BasesHandlers extends Record<string, ViewFactory> {
/**
* The table view factory.
*/
table: ViewFactory<TableView>;
}
/**
* Bases link.
*
* @public
* @unofficial
*/
export interface BasesLink extends BasesControl {
/**
* The link.
*/
link: string;
}
/**
* Bases link constructor.
*
* @public
* @unofficial
*/
export interface BasesLinkConstructor extends ConstructorBase<[
app: App,
linkText: string,
sourcePath: string,
displayText: string
], BasesLink> {
/**
* Parse {@link BasesLink} from string.
*
* @param app - The Obsidian application instance.
* @param str - The string to parse.
* @param sourcePath - The source path.
* @returns The parsed {@link BasesLink}.
*/
parseFromString(app: App, str: string, sourcePath: string): BasesLink;
}
/**
* Bases list.
*
* @public
* @unofficial
*/
export interface BasesList extends BasesControl {
/**
* The controls.
*/
data: Record<string, BasesControl>;
/**
* Gets a value by key.
*
* @param key - The key.
* @returns The value.
*/
get(key: string): BasesControl;
}
/**
* Bases local.
*
* @public
* @unofficial
*/
export interface BasesLocal {
/**
* Implicit.
*/
implicit: BasesFile;
/**
* Note.
*/
note: BasesNote;
}
/**
* Bases view controller mock context.
*
* @public
* @unofficial
*/
export interface BasesMockContext {
}
/**
* Bases view controller new item menu.
*
* @public
* @unofficial
*/
export interface BasesNewItemMenu {
}
/**
* Bases note.
*
* @public
* @unofficial
*/
export interface BasesNote {
/**
* Data.
*/
data: Record<string, unknown>;
/**
* Get control.
*
* @param key - The key.
* @returns The control.
*/
get(key: string): BasesControl;
}
/**
* Bases plugin.
*
* @public
* @unofficial
*/
export interface BasesPlugin extends InternalPlugin<BasesPluginInstance> {
}
/**
* Bases plugin instance.
*
* @public
* @unofficial
*/
export interface BasesPluginInstance extends InternalPluginInstance<BasesPlugin> {
/**
* An Obsidian app instance.
*/
app: App;
/**
* Whether the default on.
*/
defaultOn: boolean;
/**
* The functions.
*/
functions: BasesFunctions;
/**
* The handlers.
*/
handlers: BasesHandlers;
/**
* Creates and embeds a base.
*/
createAndEmbedBase(editor: Editor): Promise<void>;
/**
* Creates a new bases file.
*/
createNewBasesFile(location?: TFolder, filename?: string, contents?: string): Promise<TFile>;
/**
* Deregisters a function.
*/
deregisterFunction(name: string): void;
/**
* Deregisters a view.
*/
deregisterView(type: string): void;
/**
* Gets a function.
*/
getFunction(name: string): BasesFunction | null;
/**
* Gets the operator functions.
*/
getOperatorFunctions(): BasesFunction[];
/**
* Gets a view factory.
*/
getViewFactory(type: string): ViewFactory | null;
/**
* Gets the view types.
*/
getViewTypes(): string[];
/**
* On file menu.
*/
onFileMenu(menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf): void;
/**
* Registers a function.
*/
registerFunction(fn: BasesFunction): void;
/**
* Registers a view.
*/
registerView(type: string, viewFactory: ViewFactory): void;
}
/**
* Bases property.
*
* @public
* @unofficial
*/
export interface BasesProperty {
/**
* The property ID.
*/
propertyId: string;
/**
* The query.
*/
query: BasesQuery;
/**
* The unrecognized data.
*/
unrecognizedData: object;
/**
* Gets the display name.
*/
getDisplayName(): string;
/**
* Migrates the display name.
*/
migrateDisplayName(getDisplayName: string): string;
/**
* Serializes the property.
*/
serialize(): object;
/**
* Sets the display name.
*/
setDisplayName(displayName: string): void;
}
/**
* Bases view controller property menu.
*
* @public
* @unofficial
*/
export interface BasesPropertyMenu {
}
/**
* Bases query.
*
* @public
* @unofficial
*/
export interface BasesQuery {
/**
* The formulas.
*/
formulas: Record<string, BasesFormula>;
/**
* The properties.
*/
properties: Record<string, BasesProperty>;
/**
* The unrecognized data.
*/
unrecognizedData: object;
/**
* The views.
*/
views: BasesSubView[];
/**
* Clones the query.
*/
clone(): this;
/**
* Gets the property config.
*/
getPropertyConfig(key: string): unknown;
/**
* Gets the serializable data.
*/
getSerializable(): object;
/**
* Gets the view config.
*/
getViewConfig(key: string): unknown;
/**
* Removes a formula.
*/
removeFormula(key: string): void;
/**
* Saves the query.
*/
save(): void;
/**
* Saves the query.
*/
saveFn(query: this): void;
/**
* Sets the formulas.
*/
setFormulas(formulas: Record<string, BasesFormula>): void;
/**
* Sets the global filters.
*/
setGlobalFilters(filter: BasesFilter): void;
/**
* Sets the view filters.
*/
setViewFilters(key: string, filters: BasesFilter): void;
}
/**
* Bases view controller results menu.
*
* @public
* @unofficial
*/
export interface BasesResultsMenu {
}
/**
* Bases view controller sort menu.
*
* @public
* @unofficial
*/
export interface BasesSortMenu {
}
/**
* Bases sub view.
*
* @public
* @unofficial
*/
export interface BasesSubView {
/**
* The name.
*/
name: string;
/**
* The query.
*/
query: BasesQuery;
/**
* The type.
*/
type: string;
/**
* Clones the sub view.
*/
clone(name: string): this;
/**
* Gets the sub view.
*/
get(arg1: unknown): unknown;
/**
* Gets all the sub views.
*/
getAll(): unknown;
/**
* Gets the display name.
*/
getDisplayName(arg1: unknown): unknown;
/**
* Gets the limit.
*/
getLimit(): unknown;
/**
* Gets the order.
*/
getOrder(): unknown;
/**
* Gets the property config.
*/
getPropertyConfig(arg1: unknown): unknown;
/**
* Gets the sort.
*/
getSort(): unknown;
/**
* Gets the view name.
*/
getViewName(): string;
/**
* Serializes the sub view.
*/
serialize(): SerializedBasesSubView;
/**
* Sets the sub view.
*/
set(arg1: unknown, arg2: unknown): unknown;
/**
* Sets the limit.
*/
setLimit(arg1: unknown): unknown;
/**
* Sets the order.
*/
setOrder(arg1: unknown): unknown;
/**
* Sets the sort property.
*/
setSortProperty(arg1: unknown, arg2: unknown): unknown;
}
/**
* View for the `Bases` plugin.
*
* @public
* @unofficial
*/
export interface BasesView extends TextFileView {
/**
* The controller for the view.
*/
controller: BasesController;
/**
* The last data of the view.
*/
lastData: string;
/**
* Bases plugin.
*/
plugin: BasesPluginInstance;
/**
* The query for the view.
*/
query: BasesQuery;
/**
* Get view type.
*/
getViewType(): typeof ViewType.Bases;
/**
* Called when the layout of the view changes.
*/
onLayoutChange(): void;
/**
* Called when the view changes.
*/
onViewChanged(): void;
/**
* Receives the sync state.
*/
receiveSyncState(fileView: FileView): void;
/**
* Saves the query.
*/
saveQuery(query: BasesQuery): void;
/**
* Updates the current file.
*
* @param file - The file to update.
*/
updateCurrentFile(file: TFile | null): void;
}
/**
* Bases view constructor.
*
* @public
* @unofficial
*/
export interface BasesViewConstructor extends TypedViewConstructor<BasesView, [
basesPluginInstance: BasesPluginInstance
]> {
}
/**
* Bases view menu.
*
* @public
* @unofficial
*/
export interface BasesViewMenu {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Bezier {
/** @todo Documentation incomplete. */
cp1: Pointer;
/** @todo Documentation incomplete. */
cp2: Pointer;
/** @todo Documentation incomplete. */
from: Pointer;
/** @todo Documentation incomplete. */
path: string;
/** @todo Documentation incomplete. */
to: Pointer;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Bookmark {
/** @todo Documentation incomplete. */
assoc: number;
/** @todo Documentation incomplete. */
cm: CodeMirrorEditor;
/** @todo Documentation incomplete. */
id: number;
/** @todo Documentation incomplete. */
offset: number;
/** @todo Documentation incomplete. */
clear(): void;
/** @todo Documentation incomplete. */
find(): EditorPosition | null;
/** @todo Documentation incomplete. */
update(changeDesc: ChangeDesc): void;
}
/**
* A bookmark item in the bookmarks plugin.
*
* @public
* @unofficial
*/
export interface BookmarkItem {
/**
* The creation time of the bookmark item.
*/
ctime: number;
/**
* The items of the bookmark item.
*/
items?: BookmarkItem[];
/**
* The path of the bookmark item.
*/
path?: string;
/**
* The query of the bookmark item.
*/
query?: string;
/**
* The subpath of the bookmark item.
*/
subpath?: string;
/**
* The title of the bookmark item.
*/
title: string;
/**
* The type of the bookmark item.
*/
type: "file" | "folder" | "group" | "graph" | "search" | "url";
/**
* The URL of the bookmark item.
*/
url?: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BookmarksPlugin extends InternalPlugin<BookmarksPluginInstance> {
/** @todo Documentation incomplete. */
views: BookmarksPluginViews;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BookmarksPluginInstance extends InternalPluginInstance<BookmarksPlugin>, Events {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
bookmarkedViews: WeakMap<View, HTMLElement>;
/** @todo Documentation incomplete. */
bookmarkLookup: Record<string, BookmarkItem>;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
hasValidData: boolean;
/** @todo Documentation incomplete. */
items: BookmarkItem[];
/** @todo Documentation incomplete. */
onItemsChanged: Debouncer<[
boolean
], void>;
/** @todo Documentation incomplete. */
plugin: BookmarksPlugin;
/** @todo Documentation incomplete. */
urlBookmarkLookup: Record<string, BookmarkItem>;
/** @todo Documentation incomplete. */
_onItemsChanged(shouldSave: boolean): void;
/** @todo Documentation incomplete. */
addItem(item: BookmarkItem, instance?: BookmarksPluginInstance): void;
/** @todo Documentation incomplete. */
editItem(item: BookmarkItem): void;
/** @todo Documentation incomplete. */
findBookmarkByView(view: FileView): BookmarkItem | null | undefined;
/** @todo Documentation incomplete. */
getBookmarks(): BookmarkItem[];
/** @todo Documentation incomplete. */
getItemTitle(item: BookmarkItem): string;
/** @todo Documentation incomplete. */
initLeaf(): void;
/** @todo Documentation incomplete. */
loadData(): Promise<boolean>;
/** @todo Documentation incomplete. */
moveItem(item: BookmarkItem, instance: BookmarksPluginInstance | undefined, index: number): void;
/** @todo Documentation incomplete. */
onEditorMenu(menu: Menu, editor: Editor, info: MarkdownView | MarkdownFileInfo): void;
/** @todo Documentation incomplete. */
onEnable(app: App, plugin: BookmarksPlugin): Promise<void>;
/** @todo Documentation incomplete. */
onExternalSettingsChange(): Promise<void>;
/** @todo Documentation incomplete. */
onFileMenu(menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): void;
/** @todo Documentation incomplete. */
onFileRename(file: TFile, oldPath: string): void;
/** @todo Documentation incomplete. */
onFilesMenu(menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): void;
/** @todo Documentation incomplete. */
onLeafMenu(menu: Menu, leaf: WorkspaceLeaf): void;
/** @todo Documentation incomplete. */
onSearchResultsMenu(menu: Menu, search: TypedWorkspaceLeaf<SearchView>): void;
/** @todo Documentation incomplete. */
onTabGroupMenu(menu: Menu, tabsLeaf: WorkspaceTabs): void;
/** @todo Documentation incomplete. */
onUserEnable(): void;
/** @todo Documentation incomplete. */
openBookmark(item: BookmarkItem, newLeaf: PaneType | boolean, newLeaf2?: PaneType | boolean): Promise<void>;
/** @todo Documentation incomplete. */
openBookmarkInLeaf(item: BookmarkItem, leaf: WorkspaceLeaf, newLeaf?: PaneType | boolean): Promise<void>;
/** @todo Documentation incomplete. */
openBookmarks(items: BookmarkItem[], newLeaf?: PaneType | boolean): Promise<void>;
/** @todo Documentation incomplete. */
rebuildBookmarkCache(): void;
/** @todo Documentation incomplete. */
removeItem(item: BookmarkItem): void;
/** @todo Documentation incomplete. */
saveData(): void;
/** @todo Documentation incomplete. */
updateTabHeaders(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BookmarksPluginViews extends Record<string, ViewCreator> {
/** @todo Documentation incomplete. */
bookmarks(left: WorkspaceLeaf): BookmarksView;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BookmarksView extends ItemView {
/** @todo Documentation incomplete */
_copyToClipboard(e: unknown, t: unknown): void;
/** @todo Documentation incomplete */
_getActiveBookmarks(): unknown[];
/**
* Attaches the handleDrag of DragManager.
*/
attachDragHandler(e: unknown): void;
/**
* Attaches the handleDrop of DragManager to containerEl.
*/
attachDropHandler(): void;
/** @todo Documentation incomplete */
createNewGroup(e: unknown): void;
/** @todo Documentation incomplete */
dragSelectedBookmarks(e: unknown, t: unknown): unknown | null;
/** @todo Documentation incomplete */
getItemDom(e: unknown): unknown;
/** @todo Documentation incomplete */
getNodeId(e: unknown): string;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Bookmarks;
/** @todo Documentation incomplete */
handleCollapseAll(e: unknown): void;
/** @todo Documentation incomplete */
isItem(item: unknown): boolean;
/** @todo Documentation incomplete */
onContextMenu(event: unknown): void;
/**
* Called when delete is requested.
*
* @param event - The event triggered this function.
*/
onDeleteSelectedItems(event: unknown): unknown;
/**
* Called when a file is created.
*
* @param file - The created file.
*/
onFileCreate(file: TFile): void;
/**
* Called when a file is deleted.
*
* @param file - The deleted file.
*/
onFileDelete(file: TFile): void;
/** @todo Documentation incomplete */
onFileOpen(file: TFile): void;
/**
* Called when the rename shortcut is pressed.
*
* @param event - The event triggered this function.
*/
onRenameKey(event: KeyboardEvent): void;
/** @todo Documentation incomplete */
update(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface BookmarksViewConstructor extends TypedViewConstructor<BookmarksView, [
bookmarksPluginInstance: BookmarksPluginInstance
]> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Bracket {
/** @todo Documentation incomplete. */
ch: string;
/** @todo Documentation incomplete. */
pos: EditorPosition;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Btime {
/** @todo Documentation incomplete. */
btime(path: string, btime: number): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasConnection {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasDataManager {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
handleDelete(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
handleRename(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
load(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
remove(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
save(arg1: unknown, arg2: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasEmbed {
/** @todo Documentation incomplete. */
file: string;
/** @todo Documentation incomplete. */
subpath?: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasIndex extends Component {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
fileQueue: unknown[];
/** @todo Documentation incomplete. */
frame: null;
/** @todo Documentation incomplete. */
index: Record<string, CanvasIndexEntry>;
/** @todo Documentation incomplete. */
refNodeIds: WeakMap<object, unknown>;
/** @todo Documentation incomplete. */
canProcess(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
get(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
getAll(): unknown;
/** @todo Documentation incomplete. */
getForPath(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onCreate(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onDelete(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onload(): unknown;
/** @todo Documentation incomplete. */
onModify(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onRename(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
onunload(): unknown;
/** @todo Documentation incomplete. */
parseText(arg1: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
process(arg1: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
queue(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
requestFrame(): unknown;
/** @todo Documentation incomplete. */
run(): Promise<unknown>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasIndexEntry {
/** @todo Documentation incomplete. */
caches: Record<string, CachedMetadata>;
/** @todo Documentation incomplete. */
embeds: CanvasEmbed[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasLinkUpdater extends LinkUpdater {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
canvas: CanvasPluginInstance;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasMenu {
/** @todo Documentation incomplete. */
canvas: CanvasViewCanvas;
/** @todo Documentation incomplete. */
containerEl: HTMLDivElement;
/** @todo Documentation incomplete. */
menuEl: HTMLDivElement;
/** @todo Documentation incomplete. */
selection: CanvasSelection;
/** @todo Documentation incomplete. */
render(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
updateZIndex(arg1: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasNode {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasPlugin extends InternalPlugin<CanvasPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasPluginInstance extends InternalPluginInstance<CanvasPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
index: CanvasIndex;
/** @todo Documentation incomplete. */
localDataManager: CanvasDataManager;
/** @todo Documentation incomplete. */
options: CanvasPluginInstanceOptions;
/** @todo Documentation incomplete. */
plugin: CanvasPlugin;
/** @todo Documentation incomplete. */
renameQueue: PromisedQueue;
/** @todo Documentation incomplete. */
renames: unknown[];
/** @todo Documentation incomplete. */
requestProcessRename: Debouncer<[
], unknown>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasPluginInstanceOptions {
/** @todo Documentation incomplete. */
cardLabelVisibility?: "always" | "hover" | "never";
/** @todo Documentation incomplete. */
defaultModDragBehavior?: "card" | "group" | "media" | "menu" | "note" | "webpage";
/** @todo Documentation incomplete. */
defaultWheelBehavior?: "pan" | "zoom";
/** @todo Documentation incomplete. */
newFileFolderPath?: string;
/** @todo Documentation incomplete. */
newFileLocation?: "root" | "current" | "folder";
/** @todo Documentation incomplete. */
snapToGrid?: boolean;
/** @todo Documentation incomplete. */
snapToObjects?: boolean;
/** @todo Documentation incomplete. */
zoomBreakpoint?: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasRectEx {
/** @todo Documentation incomplete. */
cx: number;
/** @todo Documentation incomplete. */
cy: number;
/** @todo Documentation incomplete. */
height: number;
/** @todo Documentation incomplete. */
left: number;
/** @todo Documentation incomplete. */
maxX: number;
/** @todo Documentation incomplete. */
maxY: number;
/** @todo Documentation incomplete. */
minX: number;
/** @todo Documentation incomplete. */
minY: number;
/** @todo Documentation incomplete. */
top: number;
/** @todo Documentation incomplete. */
width: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasSelection {
/** @todo Documentation incomplete. */
bbox: BBox;
/** @todo Documentation incomplete. */
canvas: CanvasViewCanvas;
/** @todo Documentation incomplete. */
resizerEls: HTMLDivElement[];
/** @todo Documentation incomplete. */
selectionEl: HTMLDivElement;
/** @todo Documentation incomplete. */
hide(): unknown;
/** @todo Documentation incomplete. */
onResizePointerdown(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
update(arg1: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasView extends TextFileView {
/** @todo Documentation incomplete. */
canvas: CanvasViewCanvas;
/** @todo Documentation incomplete. */
hoverPopover: null | HoverPopover;
/** @todo Documentation incomplete. */
plugin: CanvasPluginInstance;
/**
* Loads the local data of the canvas.
*/
getLocalData(): unknown;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Canvas;
/**
* Saves the local data of the canvas.
*/
saveLocalData(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvas {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
backgroundPatternEl: SVGPatternElement;
/** @todo Documentation incomplete. */
canvasControlsEl: HTMLDivElement;
/** @todo Documentation incomplete. */
canvasEl: HTMLDivElement;
/** @todo Documentation incomplete. */
canvasRect: CanvasRectEx;
/** @todo Documentation incomplete. */
cardMenuEl: HTMLDivElement;
/** @todo Documentation incomplete. */
config: CanvasViewConfig;
/** @todo Documentation incomplete. */
data: CanvasViewData;
/** @todo Documentation incomplete. */
dirty: Set<unknown>;
/** @todo Documentation incomplete. */
edgeContainerEl: SVGElement;
/** @todo Documentation incomplete. */
edgeEndContainerEl: SVGElement;
/** @todo Documentation incomplete. */
edgeFrom: MapOfSets<CanvasViewCanvasEdge, CanvasViewCanvasNode>;
/** @todo Documentation incomplete. */
edgeIndex: EdgeIndex;
/** @todo Documentation incomplete. */
edges: Map<string, CanvasViewCanvasEdge>;
/** @todo Documentation incomplete. */
edgeTo: MapOfSets<CanvasViewCanvasEdge, CanvasViewCanvasNode>;
/** @todo Documentation incomplete. */
finishViewportAnimation: boolean;
/** @todo Documentation incomplete. */
frame: number;
/** @todo Documentation incomplete. */
frameWin: null;
/** @todo Documentation incomplete. */
gridSpacing: number;
/** @todo Documentation incomplete. */
history: CanvasViewHistory;
/** @todo Documentation incomplete. */
isDragging: boolean;
/** @todo Documentation incomplete. */
isHoldingSpace: boolean;
/** @todo Documentation incomplete. */
keys: Object;
/** @todo Documentation incomplete. */
lastEdgesInViewport: Set<CanvasViewCanvasEdge>;
/** @todo Documentation incomplete. */
lastNodesInViewport: Set<CanvasViewCanvasNode>;
/** @todo Documentation incomplete. */
menu: CanvasMenu;
/** @todo Documentation incomplete. */
moved: Set<unknown>;
/** @todo Documentation incomplete. */
moverEl: HTMLDivElement;
/** @todo Documentation incomplete. */
nodeIndex: EdgeIndex;
/** @todo Documentation incomplete. */
nodeInteractionLayer: NodeInteractionLayer;
/** @todo Documentation incomplete. */
nodes: Map<string, CanvasViewCanvasNode>;
/** @todo Documentation incomplete. */
options?: unknown;
/** @todo Documentation incomplete. */
pauseAnimation: number;
/** @todo Documentation incomplete. */
pointer: Pointer;
/** @todo Documentation incomplete. */
pointerFrame: number;
/** @todo Documentation incomplete. */
pointerFrameWin: null;
/** @todo Documentation incomplete. */
quickSettingsButton: HTMLDivElement;
/** @todo Documentation incomplete. */
readonly: boolean;
/** @todo Documentation incomplete. */
redoBtnEl: HTMLDivElement;
/** @todo Documentation incomplete. */
requestPushHistory: Debouncer<[
], unknown>;
/** @todo Documentation incomplete. */
requestUpdateFileOpen: Debouncer<[
], unknown>;
/** @todo Documentation incomplete. */
scale: number;
/** @todo Documentation incomplete. */
screenshotting: boolean;
/** @todo Documentation incomplete. */
selection: Set<Selection>;
/** @todo Documentation incomplete. */
selectionChanged: boolean;
/** @todo Documentation incomplete. */
snapDistance?: unknown;
/** @todo Documentation incomplete. */
staleSelection: null;
/** @todo Documentation incomplete. */
tx: number;
/** @todo Documentation incomplete. */
ty: number;
/** @todo Documentation incomplete. */
tZoom: number;
/** @todo Documentation incomplete. */
undoBtnEl: HTMLDivElement;
/** @todo Documentation incomplete. */
view: CanvasView;
/** @todo Documentation incomplete. */
viewportChanged: boolean;
/** @todo Documentation incomplete. */
wasAnimating: boolean;
/** @todo Documentation incomplete. */
wrapperEl: HTMLDivElement;
/** @todo Documentation incomplete. */
x: number;
/** @todo Documentation incomplete. */
y: number;
/** @todo Documentation incomplete. */
zIndexCounter: number;
/** @todo Documentation incomplete. */
zoom: number;
/** @todo Documentation incomplete. */
zoomBreakpoint?: unknown;
/** @todo Documentation incomplete. */
zoomCenter: null;
/** @todo Documentation incomplete. */
zoomToFitQueued: boolean;
/** @todo Documentation incomplete. */
addEdge(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
addNode(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
applyHistory(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
cancelFrame(): unknown;
/** @todo Documentation incomplete. */
canSnap(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
clear(): unknown;
/** @todo Documentation incomplete. */
clearSnapPoints(): unknown;
/** @todo Documentation incomplete. */
cloneData(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
createFileNode(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
createFileNodes(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
createGroupNode(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
createLinkNode(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
createPlaceholder(): unknown;
/** @todo Documentation incomplete. */
createTextNode(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
deleteSelection(): unknown;
/** @todo Documentation incomplete. */
deselect(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
deselectAll(): unknown;
/** @todo Documentation incomplete. */
domFromPos(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
domPosFromClient(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
domPosFromEvt(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
dragTempNode(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
endSnapPointRendering(): unknown;
/** @todo Documentation incomplete. */
generateHDImage(): Promise<unknown>;
/** @todo Documentation incomplete. */
getContainingNodes(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
getData(): unknown;
/** @todo Documentation incomplete. */
getEdgesForNode(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
getIntersectingEdges(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
getIntersectingNodes(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
getSelectionData(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
getSnapping(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown;
/** @todo Documentation incomplete. */
getState(): unknown;
/** @todo Documentation incomplete. */
getViewportBBox(): unknown;
/** @todo Documentation incomplete. */
getViewportNodes(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
getZIndex(): unknown;
/** @todo Documentation incomplete. */
handleCopy(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
handleCut(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
handleDragToSelect(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
handleDragWithPan(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
handleMoverPointerdown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
handlePaste(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
handleSelectionDrag(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
hitTestNode(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
importData(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
interactionHitTest(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
load(): unknown;
/** @todo Documentation incomplete. */
markDirty(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
markMoved(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
markViewportChanged(): unknown;
/** @todo Documentation incomplete. */
nudgeSelection(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
onContextMenu(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onDoubleClick(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onGlobalKeydown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onGlobalKeyup(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onKeydown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onPointerdown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onPointermove(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onPriorityPointerdown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onResize(): unknown;
/** @todo Documentation incomplete. */
onSelectionContextMenu(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onTouchdown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onWheel(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
overrideHistory(): unknown;
/** @todo Documentation incomplete. */
panBy(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
panIntoView(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
panTo(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
posCenter(): unknown;
/** @todo Documentation incomplete. */
posFromClient(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
posFromDom(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
posFromEvt(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
posInViewport(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
pushHistory(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
redo(): unknown;
/** @todo Documentation incomplete. */
removeEdge(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
removeNode(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
renderSnapPoints(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown;
/** @todo Documentation incomplete. */
requestFrame(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
requestSave(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
rerenderViewport(): unknown;
/** @todo Documentation incomplete. */
select(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
selectAll(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
selectOnly(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setData(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setDragging(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setReadonly(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setState(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setViewport(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
showCreationMenu(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
showQuickSettingsMenu(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
smartZoom(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
takeScreenshot(arg1: unknown, arg2: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
toggleGridSnapping(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
toggleObjectSnapping(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
toggleSelect(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
undo(): unknown;
/** @todo Documentation incomplete. */
unload(): unknown;
/** @todo Documentation incomplete. */
updateFileOpen(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
updateHistoryUI(): unknown;
/** @todo Documentation incomplete. */
updateSelection(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
virtualize(): unknown;
/** @todo Documentation incomplete. */
zoomBy(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
zoomToBbox(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
zoomToFit(): unknown;
/** @todo Documentation incomplete. */
zoomToSelection(): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasEdge {
/** @todo Documentation incomplete. */
bbox: BBox;
/** @todo Documentation incomplete. */
bezier: Bezier;
/** @todo Documentation incomplete. */
canvas: CanvasViewCanvas;
/** @todo Documentation incomplete. */
color: string;
/** @todo Documentation incomplete. */
from: CanvasViewCanvasEdgeLink;
/** @todo Documentation incomplete. */
fromLineEnd: CanvasViewCanvasEdgeLineEnd | null;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
initialized: boolean;
/** @todo Documentation incomplete. */
isAttached?: unknown;
/** @todo Documentation incomplete. */
label: string;
/** @todo Documentation incomplete. */
lineEndGroupEl: SVGGElement;
/** @todo Documentation incomplete. */
lineGroupEl: SVGGElement;
/** @todo Documentation incomplete. */
path: CanvasViewCanvasEdgePath;
/** @todo Documentation incomplete. */
to: CanvasViewCanvasEdgeLink;
/** @todo Documentation incomplete. */
toLineEnd: CanvasViewCanvasEdgeLineEnd | null;
/** @todo Documentation incomplete. */
unknownData: Object;
/** @todo Documentation incomplete. */
attach(): unknown;
/** @todo Documentation incomplete. */
blur(): unknown;
/** @todo Documentation incomplete. */
createEdgeEnd(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
deselect(): unknown;
/** @todo Documentation incomplete. */
destroy(): unknown;
/** @todo Documentation incomplete. */
detach(): unknown;
/** @todo Documentation incomplete. */
editLabel(): unknown;
/** @todo Documentation incomplete. */
focus(): unknown;
/** @todo Documentation incomplete. */
getBBox(): unknown;
/** @todo Documentation incomplete. */
getCenter(): unknown;
/** @todo Documentation incomplete. */
getData(): unknown;
/** @todo Documentation incomplete. */
initialize(): unknown;
/** @todo Documentation incomplete. */
onClick(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onConnectionPointerdown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onContextMenu(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
render(): unknown;
/** @todo Documentation incomplete. */
select(): unknown;
/** @todo Documentation incomplete. */
setColor(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
setData(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setLabel(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
showMenu(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
update(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
updatePath(): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasEdgeLineEnd {
/** @todo Documentation incomplete. */
el: SVGGElement;
/** @todo Documentation incomplete. */
type: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasEdgeLink {
/** @todo Documentation incomplete. */
end: string;
/** @todo Documentation incomplete. */
node: CanvasViewCanvasNode;
/** @todo Documentation incomplete. */
side: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasEdgePath {
/** @todo Documentation incomplete. */
display: SVGPathElement;
/** @todo Documentation incomplete. */
interaction: SVGPathElement;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasNode extends CanvasViewCanvasNodeBase {
/** @todo Documentation incomplete. */
alwaysKeepLoaded: boolean;
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
aspectRatio: number;
/** @todo Documentation incomplete. */
bbox: BBox;
/** @todo Documentation incomplete. */
canvas: CanvasViewCanvas;
/** @todo Documentation incomplete. */
child: WidgetEditorView;
/** @todo Documentation incomplete. */
color: string;
/** @todo Documentation incomplete. */
containerEl: HTMLDivElement;
/** @todo Documentation incomplete. */
contentBlockerEl: HTMLDivElement;
/** @todo Documentation incomplete. */
contentEl: HTMLDivElement;
/** @todo Documentation incomplete. */
destroyed: boolean;
/** @todo Documentation incomplete. */
file: TFile;
/** @todo Documentation incomplete. */
filePath: string;
/** @todo Documentation incomplete. */
height: number;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
initialized: boolean;
/** @todo Documentation incomplete. */
isContentMounted: boolean;
/** @todo Documentation incomplete. */
isEditing: boolean;
/** @todo Documentation incomplete. */
nodeEl: HTMLDivElement;
/** @todo Documentation incomplete. */
placeholderEl: HTMLDivElement;
/** @todo Documentation incomplete. */
renderedZIndex: number;
/** @todo Documentation incomplete. */
resizeDirty: boolean;
/** @todo Documentation incomplete. */
subpath: string;
/** @todo Documentation incomplete. */
unknownData: CanvasViewCanvasNodeUnknownData;
/** @todo Documentation incomplete. */
width: number;
/** @todo Documentation incomplete. */
x: number;
/** @todo Documentation incomplete. */
y: number;
/** @todo Documentation incomplete. */
zIndex: number;
/** @todo Documentation incomplete. */
blur(): unknown;
/** @todo Documentation incomplete. */
focus(): unknown;
/** @todo Documentation incomplete. */
getData(): unknown;
/** @todo Documentation incomplete. */
initFile(): unknown;
/** @todo Documentation incomplete. */
initialize(): unknown;
/** @todo Documentation incomplete. */
onFileFocus(): unknown;
/** @todo Documentation incomplete. */
onLabelClick(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onLabelDblClick(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onPointerdown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
render(): unknown;
/** @todo Documentation incomplete. */
setData(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setFile(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
setFilePath(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
showMenu(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
updateBreakpoint(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
updateNodeLabel(arg1: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasNodeBase extends CanvasViewCanvasNodeBaseBase {
/** @todo Documentation incomplete. */
blur(): unknown;
/** @todo Documentation incomplete. */
destroy(): unknown;
/** @todo Documentation incomplete. */
focus(): unknown;
/** @todo Documentation incomplete. */
initialize(): unknown;
/** @todo Documentation incomplete. */
isEditable(): unknown;
/** @todo Documentation incomplete. */
moveAndResize(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onClick(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onResizeDblclick(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
render(): unknown;
/** @todo Documentation incomplete. */
startEditing(arg1?: unknown): unknown;
/** @todo Documentation incomplete. */
unloadChild(): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasNodeBaseBase extends CanvasViewCanvasNodeBaseBaseBase {
/** @todo Documentation incomplete. */
attach(): unknown;
/** @todo Documentation incomplete. */
detach(): unknown;
/** @todo Documentation incomplete. */
initialize(): unknown;
/** @todo Documentation incomplete. */
mountContent(): unknown;
/** @todo Documentation incomplete. */
preDetach(): unknown;
/** @todo Documentation incomplete. */
unmountContent(): unknown;
/** @todo Documentation incomplete. */
updateBreakpoint(arg1: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasNodeBaseBaseBase {
/** @todo Documentation incomplete. */
isAttached?: unknown;
/** @todo Documentation incomplete. */
isFocused?: unknown;
/** @todo Documentation incomplete. */
rect: CanvasRect;
/** @todo Documentation incomplete. */
attach(): unknown;
/** @todo Documentation incomplete. */
blur(): unknown;
/** @todo Documentation incomplete. */
deselect(): unknown;
/** @todo Documentation incomplete. */
destroy(): unknown;
/** @todo Documentation incomplete. */
detach(): unknown;
/** @todo Documentation incomplete. */
focus(): unknown;
/** @todo Documentation incomplete. */
getBBox(): unknown;
/** @todo Documentation incomplete. */
getConnectedFiles(): unknown;
/** @todo Documentation incomplete. */
getData(): unknown;
/** @todo Documentation incomplete. */
initialize(): unknown;
/** @todo Documentation incomplete. */
isEditable(): unknown;
/** @todo Documentation incomplete. */
moveAndResize(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
moveTo(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onClick(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onConnectionPointerdown(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
onContextMenu(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onPointerdown(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onResizeDblclick(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
onResizePointerdown(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
preDetach(): unknown;
/** @todo Documentation incomplete. */
render(): unknown;
/** @todo Documentation incomplete. */
renderZIndex(): unknown;
/** @todo Documentation incomplete. */
resize(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
select(): unknown;
/** @todo Documentation incomplete. */
setColor(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
setData(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setIsEditing(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
showMenu(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
startEditing(): unknown;
/** @todo Documentation incomplete. */
updateBreakpoint(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
updateZIndex(): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewCanvasNodeUnknownData {
/** @todo Documentation incomplete. */
file: string;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
type: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewConfig {
/** @todo Documentation incomplete. */
defaultFileNodeDimensions: Dimensions;
/** @todo Documentation incomplete. */
defaultTextNodeDimensions: Dimensions;
/** @todo Documentation incomplete. */
minContainerDimension: number;
/** @todo Documentation incomplete. */
objectSnapDistance: number;
/** @todo Documentation incomplete. */
zoomMultiplier: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewConstructor extends TypedViewConstructor<CanvasView, [
canvasPluginInstance: CanvasPluginInstance
]> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewData {
/** @todo Documentation incomplete. */
edges: CanvasViewDataEdge[];
/** @todo Documentation incomplete. */
nodes: CanvasViewDataNode[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewDataEdge {
/** @todo Documentation incomplete. */
fromNode: string;
/** @todo Documentation incomplete. */
fromSide: string;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
toNode: string;
/** @todo Documentation incomplete. */
toSide: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewDataNode {
/** @todo Documentation incomplete. */
file: string;
/** @todo Documentation incomplete. */
height: number;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
subpath?: unknown;
/** @todo Documentation incomplete. */
type: string;
/** @todo Documentation incomplete. */
width: number;
/** @todo Documentation incomplete. */
x: number;
/** @todo Documentation incomplete. */
y: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CanvasViewHistory {
/** @todo Documentation incomplete. */
current: number;
/** @todo Documentation incomplete. */
data: CanvasViewData[];
/** @todo Documentation incomplete. */
max: number;
/** @todo Documentation incomplete. */
canRedo(): unknown;
/** @todo Documentation incomplete. */
canUndo(): unknown;
/** @todo Documentation incomplete. */
clear(): unknown;
/** @todo Documentation incomplete. */
push(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
redo(): unknown;
/** @todo Documentation incomplete. */
replace(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
undo(): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CapacitorAdapterFs {
/** @todo Documentation incomplete. */
dir: string | null;
/** @todo Documentation incomplete. */
uri: string;
/** @todo Documentation incomplete. */
append(realPath: string, data: string): Promise<void>;
/** @todo Documentation incomplete. */
copy(realPath: string, newRealPath: string): Promise<void>;
/** @todo Documentation incomplete. */
delete(realPath: string): Promise<void>;
/** @todo Documentation incomplete. */
exists(realPath: string): Promise<boolean>;
/** @todo Documentation incomplete. */
getNativeUri(realPath: string): string;
/** @todo Documentation incomplete. */
getUri(realPath: string): string;
/** @todo Documentation incomplete. */
init(): Promise<void>;
/** @todo Documentation incomplete. */
mkdir(realPath: string): Promise<void>;
/** @todo Documentation incomplete. */
open(realPath: string): Promise<void>;
/** @todo Documentation incomplete. */
read(realPath: string): Promise<string>;
/** @todo Documentation incomplete. */
readBinary(realPath: string): Promise<ArrayBuffer>;
/** @todo Documentation incomplete. */
readdir(realPath: string): Promise<CapacitorFileEntry[]>;
/** @todo Documentation incomplete. */
rename(realPath: string, newRealPath: string): Promise<void>;
/** @todo Documentation incomplete. */
rmdir(realPath: string): Promise<void>;
/** @todo Documentation incomplete. */
setTimes(realPath: string, ctime: number, mtime: number): Promise<void>;
/** @todo Documentation incomplete. */
stat(realPath: string): Promise<CapacitorFileEntry>;
/** @todo Documentation incomplete. */
trash(realPath: string): Promise<void>;
/** @todo Documentation incomplete. */
verifyIcloud(realPath: string): Promise<void>;
/** @todo Documentation incomplete. */
watch(realPath: string): Promise<void>;
/** @todo Documentation incomplete. */
watchAndStatAll(realPath: string): Promise<{
children: CapacitorFileEntry[];
}>;
/** @todo Documentation incomplete. */
write(realPath: string, data: string): Promise<void>;
/** @todo Documentation incomplete. */
writeBinary(realPath: string, data: ArrayBuffer): Promise<void>;
/** @todo Documentation incomplete. */
writeBinaryInternal(realPath: string, data: ArrayBuffer): Promise<void>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CapacitorFileEntry extends Partial<FileStats> {
/** @todo Documentation incomplete. */
name: string;
/** @todo Documentation incomplete. */
type: "file" | "directory";
/** @todo Documentation incomplete. */
uri: string;
}
/**
* Function `Ceil`.
* @public
* @unofficial
*/
export interface CeilFunction extends BasesFunction, HasGetDisplayName {
}
/**
* Property widget component for checkboxes.
*
* @public
* @unofficial
*/
export interface CheckboxPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The checkbox element for the property widget. */
checkboxEl: HTMLInputElement;
/** The type of the property widget. */
type: "checkbox";
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ClickableToken {
/** @todo Documentation incomplete. */
end: EditorPosition;
/** @todo Documentation incomplete. */
start: EditorPosition;
/** @todo Documentation incomplete. */
text: string;
/** @todo Documentation incomplete. */
type: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ClipboardManager {
/**
* Reference to the app.
*/
app: App;
/**
* Reference to the Editor View.
*/
info: MarkdownView;
/**
* Get current path of editor view for determining storage location embed.
*/
getPath(): string;
/**
* Process incoming data (image, text, url, html).
*
* @remark When processing HTML, function will be async.
*/
handleDataTransfer(data: DataTransfer): null | Promise<void>;
/**
* Handle an incoming drag-over event.
*/
handleDragOver(event: DragEvent): void;
/**
* Handle an incoming drag-drop event.
*/
handleDrop(event: DragEvent): boolean;
/**
* Process a drop event into the editor.
*/
handleDropIntoEditor(event: DragEvent): null | string;
/**
* Handle an incoming paste event.
*/
handlePaste(event: ClipboardEvent): boolean;
/**
* Insert single file as embed into the editor.
*/
insertAttachmentEmbed(file: TAbstractFile, replace: boolean): Promise<void>;
/**
* Insert files from drop-event into the editor.
*/
insertFiles(importedAttachments: ImportedAttachment[]): Promise<void>;
/**
* Save an attachment of specified name and extension to the vault.
*
* @remark Invokes insertAttachmentEmbed.
*/
saveAttachment(name: string, extension: string, data: ArrayBuffer, replace: boolean): Promise<void>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CodeMirrorAdapterEx {
/** @todo Documentation incomplete. */
new (cm6: VimEditor): CodeMirrorEditor;
/** @todo Documentation incomplete. */
commands: CodeMirrorAdapterExCommands;
/** @todo Documentation incomplete. */
isMac: boolean;
/** @todo Documentation incomplete. */
keyMap: Record<string, unknown>;
/** @todo Documentation incomplete. */
keys: Record<string, unknown>;
/** @todo Documentation incomplete. */
Pos: new (line: number, ch: number) => EditorPosition;
/** @todo Documentation incomplete. */
StringStream: unknown;
/** @todo Documentation incomplete. */
Vim: VimApi;
/** @todo Documentation incomplete. */
addClass(element: HTMLElement, className: string): void;
/** @todo Documentation incomplete. */
defineOption(option: string, defaultValue: unknown, handler: () => void): void;
/** @todo Documentation incomplete. */
e_preventDefault(event: Event): void;
/** @todo Documentation incomplete. */
e_stop(event: Event): void;
/** @todo Documentation incomplete. */
findEnclosingTag(doc: CodeMirrorAdapterEx, pos: EditorPosition): EnclosingTag | undefined;
/** @todo Documentation incomplete. */
findMatchingTag(doc: CodeMirrorAdapterEx, pos: EditorPosition): void;
/** @todo Documentation incomplete. */
isWordChar(char: string): boolean;
/** @todo Documentation incomplete. */
keyName(event: KeyboardEvent): string;
/** @todo Documentation incomplete. */
lookupKey(key: string, context: unknown, callback: (action: (codeMirrorAdapter: CodeMirrorAdapterEx) => boolean) => void): void;
/** @todo Documentation incomplete. */
off(event: string, listener: EventListenerOrEventListenerObject): void;
/** @todo Documentation incomplete. */
on(event: string, listener: EventListenerOrEventListenerObject): void;
/** @todo Documentation incomplete. */
rmClass(element: HTMLElement, className: string): void;
/** @todo Documentation incomplete. */
signal(target: unknown, type: string, ...values: unknown[]): void;
/** @todo Documentation incomplete. */
vimKey(event: KeyboardEvent): string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CodeMirrorAdapterExCommands {
/** @todo Documentation incomplete. */
cursorCharLeft(editor: CodeMirrorEditor): void;
/** @todo Documentation incomplete. */
indentAuto(editor: CodeMirrorEditor): void;
/** @todo Documentation incomplete. */
newlineAndIndent(editor: CodeMirrorEditor): void;
/** @todo Documentation incomplete. */
newlineAndIndentBefore(editor: CodeMirrorEditor): void;
/** @todo Documentation incomplete. */
redo(editor: CodeMirrorEditor): void;
/** @todo Documentation incomplete. */
undo(editor: CodeMirrorEditor): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CodeMirrorEditor {
/** @todo Documentation incomplete. */
$lineHandleChanges: LineHandleChange[] | undefined;
/** @todo Documentation incomplete. */
addOverlay(options: AddOverlayOptions): SearchQuery | undefined;
/** @todo Documentation incomplete. */
blur(): void;
/** @todo Documentation incomplete. */
charCoords(pos: EditorPosition, mode: "local" | "page" | "window" | "div"): Coords;
/** @todo Documentation incomplete. */
clipPos(pos: EditorPosition): EditorPosition;
/** @todo Documentation incomplete. */
coordsChar(coords: Coords, mode: "local" | "page" | "window" | "div"): EditorPosition;
/** @todo Documentation incomplete. */
defaultTextHeight(): number;
/** @todo Documentation incomplete. */
destroy(): void;
/** @todo Documentation incomplete. */
execCommand(command: string): void;
/** @todo Documentation incomplete. */
findMatchingBracket(pos: EditorPosition): MatchingBracket;
/** @todo Documentation incomplete. */
findPosV(start: EditorPosition, amount: number, unit: "line" | "page", goalColumn: number): EditorPosition;
/** @todo Documentation incomplete. */
firstLine(): number;
/** @todo Documentation incomplete. */
focus(): void;
/** @todo Documentation incomplete. */
foldCode(line: number): void;
/** @todo Documentation incomplete. */
forEachSelection(fn: () => void): void;
/** @todo Documentation incomplete. */
getCursor(type?: "head" | "anchor" | "start" | "end"): EditorPosition;
/** @todo Documentation incomplete. */
getInputField(): HTMLElement;
/** @todo Documentation incomplete. */
getLastEditEnd(): EditorPosition;
/** @todo Documentation incomplete. */
getLine(line: number): string;
/** @todo Documentation incomplete. */
getLineHandle(line: number): LineHandle;
/** @todo Documentation incomplete. */
getLineNumber(handle: LineHandle): number | null;
/** @todo Documentation incomplete. */
getMainSelection(): EditorSelection;
/** @todo Documentation incomplete. */
getMode(): CodeMirrorEditorMode;
/** @todo Documentation incomplete. */
getOption(option: string): unknown;
/** @todo Documentation incomplete. */
getRange(from: EditorPosition, to: EditorPosition): string;
/** @todo Documentation incomplete. */
getScrollInfo(): ScrollInfo;
/** @todo Documentation incomplete. */
getSearchCursor(query: RegExp, pos: EditorPosition): CodeMirrorEditorSearchCursor;
/** @todo Documentation incomplete. */
getSelection(): string;
/** @todo Documentation incomplete. */
getSelections(): string[];
/** @todo Documentation incomplete. */
getTokenTypeAt(pos: EditorPosition): string;
/** @todo Documentation incomplete. */
getValue(): string;
/** @todo Documentation incomplete. */
getWrapperElement(): HTMLElement;
/** @todo Documentation incomplete. */
hardWrap(options: HardWrapOptions): void;
/** @todo Documentation incomplete. */
indentLess(): void;
/** @todo Documentation incomplete. */
indentLine(line: number, more?: boolean): void;
/** @todo Documentation incomplete. */
indentMore(): void;
/** @todo Documentation incomplete. */
indexFromPos(pos: EditorPosition): number;
/** @todo Documentation incomplete. */
isInMultiSelectMode(): boolean;
/** @todo Documentation incomplete. */
lastLine(): number;
/** @todo Documentation incomplete. */
lineCount(): number;
/** @todo Documentation incomplete. */
listSelections(): Array<{
anchor: EditorPosition;
head: EditorPosition;
}>;
/** @todo Documentation incomplete. */
moveByChar(pos: EditorPosition, dir: "left" | "right", unit: number): EditorPosition;
/** @todo Documentation incomplete. */
moveH(dir: number, unit: string): void;
/** @todo Documentation incomplete. */
off(event: string, listener: EventListenerOrEventListenerObject): void;
/** @todo Documentation incomplete. */
on(event: string, listener: EventListenerOrEventListenerObject): void;
/** @todo Documentation incomplete. */
onBeforeEndOperation(): void;
/** @todo Documentation incomplete. */
onChange(lineHandleChange: LineHandleChange): void;
/** @todo Documentation incomplete. */
onSelectionChange(): void;
/** @todo Documentation incomplete. */
openDialog(template: string, keyValidator: (keyValue: string) => boolean, options?: Partial<OpenDialogOptions>): void;
/** @todo Documentation incomplete. */
openNotification(message: string, options?: OpenNotificationOptions): () => void;
/** @todo Documentation incomplete. */
operation<T>(fn: () => T): T;
/** @todo Documentation incomplete. */
overWriteSelection(text: string): void;
/** @todo Documentation incomplete. */
posFromIndex(index: number): EditorPosition;
/** @todo Documentation incomplete. */
refresh(): void;
/** @todo Documentation incomplete. */
releaseLineHandles(): void;
/** @todo Documentation incomplete. */
removeOverlay(overlay?: SearchQuery): void;
/** @todo Documentation incomplete. */
replaceRange(text: string, from: EditorPosition, to?: EditorPosition): void;
/** @todo Documentation incomplete. */
replaceSelection(text: string): void;
/** @todo Documentation incomplete. */
replaceSelections(texts: string[]): void;
/** @todo Documentation incomplete. */
scanForBracket(from: EditorPosition, direction: number, style?: string): Bracket | null;
/** @todo Documentation incomplete. */
scrollInfo(): ScrollInfo;
/** @todo Documentation incomplete. */
scrollIntoView(pos?: EditorPosition, margin?: number): void;
/** @todo Documentation incomplete. */
scrollTo(x?: number, y?: number): void;
/** @todo Documentation incomplete. */
setBookmark(pos: EditorPosition, options?: SetBookmarkOptions): Bookmark;
/** @todo Documentation incomplete. */
setCursor(line: number, ch: number): void;
/** @todo Documentation incomplete. */
setOption(option: string, value: unknown): void;
/** @todo Documentation incomplete. */
setSelection(anchor: EditorPosition, head: EditorPosition, options?: SetSelectionOptions): void;
/** @todo Documentation incomplete. */
setSelections(selections: EditorSelection[], primaryIndex?: number): void;
/** @todo Documentation incomplete. */
setSize(width: number, height: number): void;
/** @todo Documentation incomplete. */
setValue(content: string): void;
/** @todo Documentation incomplete. */
signal(event: string, ...args: unknown[]): void;
/** @todo Documentation incomplete. */
somethingSelected(): boolean;
/** @todo Documentation incomplete. */
toggleOverwrite(overwrite: boolean): void;
/** @todo Documentation incomplete. */
virtualSelectionMode(): boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CodeMirrorEditorMode {
/** @todo Documentation incomplete. */
name: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CodeMirrorEditorSearchCursor {
/** @todo Documentation incomplete. */
find(reverse?: boolean): boolean;
/** @todo Documentation incomplete. */
findNext(): boolean;
/** @todo Documentation incomplete. */
findPrevious(): boolean;
/** @todo Documentation incomplete. */
from(): EditorPosition | void;
/** @todo Documentation incomplete. */
replace(text: string): void;
/** @todo Documentation incomplete. */
to(): EditorPosition | void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CommandPaletteModal extends FuzzySuggestModal<Command> {
/** @todo Documentation incomplete. */
commands: Command[] | null;
/** @todo Documentation incomplete. */
plugin: CommandPalettePluginInstance;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CommandPaletteOptions {
/** @todo Documentation incomplete. */
pinned: string[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CommandPalettePlugin extends InternalPlugin<CommandPalettePluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CommandPalettePluginInstance extends InternalPluginInstance<CommandPalettePlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
modal: CommandPaletteModal;
/** @todo Documentation incomplete. */
options: CommandPaletteOptions;
/** @todo Documentation incomplete. */
plugin: CommandPalettePlugin;
/** @todo Documentation incomplete. */
recentCommands: string[];
/** @todo Documentation incomplete. */
getCommands(): Command[];
/** @todo Documentation incomplete. */
onExternalSettingsChange(): Promise<void>;
/** @todo Documentation incomplete. */
onOpen(): boolean;
/** @todo Documentation incomplete. */
openCallback(): boolean;
/** @todo Documentation incomplete. */
saveSettings(plugin: CommandPalettePlugin): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Commands {
/**
* Reference to App.
*/
app: App;
/**
* Commands *without* editor callback, will always be available in the command palette.
*
* @example `app:open-vault` or `app:reload`.
*/
commands: CommandsCommandsRecord;
/**
* Commands *with* editor callback, will only be available when editor is active and callback returns.
* true.
*
* @example `editor:fold-all` or `command-palette:open`.
*/
editorCommands: CommandsEditorCommandsRecord;
/**
* Add a command to the command registry.
*
* @param command - Command to add.
*/
addCommand(command: Command): void;
/**
* Execute a command by reference.
*
* @param command - Command to execute.
*/
executeCommand(command: Command): boolean;
/**
* Execute a command by ID.
*
* @param commandId - ID of command to execute.
*/
executeCommandById(commandId: string): boolean;
/**
* Find a command by ID.
*
* @param commandId - ID of command to find.
*/
findCommand(commandId: string): Command | undefined;
/**
* Lists **all** commands, both with and without editor callback.
*/
listCommands(): Command[];
/**
* Remove a command from the command registry.
*
* @param commandId - ID of command to remove.
*/
removeCommand(commandId: string): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CommandsCommandsRecord extends Record<string, Command> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CommandsEditorCommandsRecord extends Record<string, Command> {
}
/**
* Function `Concat`.
* @public
* @unofficial
*/
export interface ConcatFunction extends BasesFunction {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ConstructorBase<Args extends unknown[], Instance> {
/** @todo Documentation incomplete. */
new (...args: Args): Instance;
/** @todo Documentation incomplete. */
prototype: Instance;
}
/**
* Function `ContainsAll`.
* @public
* @unofficial
*/
export interface ContainsAllFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* Function `ContainsAny`.
* @public
* @unofficial
*/
export interface ContainsAnyFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* Function `Contains`.
* @public
* @unofficial
*/
export interface ContainsFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* Function `ContainsNone`.
* @public
* @unofficial
*/
export interface ContainsNoneFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Coords {
/** @todo Documentation incomplete. */
bottom: number;
/** @todo Documentation incomplete. */
left: number;
/** @todo Documentation incomplete. */
right: number;
/** @todo Documentation incomplete. */
top: number;
}
/**
* Left and top coordinates.
*
* @public
* @unofficial
* @since 0.11.11
*/
export interface CoordsLeftTop {
/**
* Left coordinate
*
* @since 0.11.11
*/
left: number;
/**
* Top coordinate
*
* @since 0.11.11
*/
top: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CustomArrayDict<T> {
/** @todo Documentation incomplete. */
data: Map<string, T[]>;
/** @todo Documentation incomplete. */
add(key: string, value: T): void;
/** @todo Documentation incomplete. */
clear(key: string): void;
/** @todo Documentation incomplete. */
clearAll(): void;
/** @todo Documentation incomplete. */
contains(key: string, value: T): boolean;
/** @todo Documentation incomplete. */
count(): number;
/** @todo Documentation incomplete. */
get(key: string): T[] | null;
/** @todo Documentation incomplete. */
keys(): string[];
/** @todo Documentation incomplete. */
remove(key: string, value: T): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CustomCSS extends Component {
/**
* Reference to App.
*/
app: App;
/**
* Cache of CSS snippet filepath (relative to vault root) to CSS snippet contents.
*/
csscache: Map<string, string>;
/**
* Set of enabled snippet, given by filenames.
*/
enabledSnippets: Set<string>;
/**
* Contains references to Style elements containing custom CSS snippets.
*/
extraStyleEls: HTMLStyleElement[];
/**
* List of theme names not fully updated to post v1.0.0 theme guidelines.
*/
oldThemes: string[];
/** @todo Documentation incomplete. */
queue: PromisedQueue;
/** @todo Documentation incomplete. */
requestLoadSnippets: Debouncer<[
], void>;
/** @todo Documentation incomplete. */
requestLoadTheme: Debouncer<[
], void>;
/** @todo Documentation incomplete. */
requestReadThemes: Debouncer<[
], void>;
/**
* List of snippets detected by Obsidian, given by their filenames.
*/
snippets: string[];
/**
* Currently active theme, given by its name.
*
* @remark is the default Obsidian theme.
*/
theme: "" | string;
/**
* Mapping of theme names to their manifest.
*/
themes: CustomCSSThemesRecord;
/** @todo Documentation incomplete. */
updates: CustomCSSUpdatesRecord;
/** @todo Documentation incomplete. */
boundRaw(themeName: string): void;
/**
* Check whether a specific theme can be updated.
*
* @param themeName - Name of the theme to check.
*/
checkForUpdate(themeName: string): void;
/**
* Check all themes for updates.
*/
checkForUpdates(): void;
/**
* Disable translucency of application background.
*/
disableTranslucency(): void;
/**
* Fetch legacy theme CSS using the pre-v1.0.0 theme download pipeline.
*
* @returns String obsidian.css contents.
*/
downloadLegacyTheme(options: DownloadLegacyThemeOptions): Promise<string>;
/**
* Enable translucency of application background.
*/
enableTranslucency(): void;
/**
* Fetch a theme's manifest using repository URL.
*
* @remark Do **not** include github prefix, only `username/repo`.
*/
getManifest(repoUrl: string): Promise<ThemeManifest>;
/**
* Convert snippet name to its corresponding filepath (relative to vault root).
*
* @returns String `.obsidian/snippets/${snippetName}.css`.
*/
getSnippetPath(snippetName: string): string;
/**
* Returns the folder path where snippets are stored (relative to vault root).
*/
getSnippetsFolder(): string;
/**
* Returns the folder path where themes are stored (relative to vault root).
*/
getThemeFolder(): string;
/**
* Convert theme name to its corresponding filepath (relative to vault root).
*
* @returns String `.obsidian/themes/${themeName}/theme.css`.
*/
getThemePath(themeName: string): string;
/**
* Returns whether there are themes that can be updated.
*/
hasUpdates(): boolean;
/**
* Install a legacy theme using the pre-v1.0.0 theme download pipeline<br> Will create a corresponding.
* dummy manifest for the theme.
*
* @remark Name will be used as the folder name for the theme.
*/
installLegacyTheme(options: InstallThemeOptions): Promise<void>;
/**
* Install a theme using the regular theme download pipeline.
*/
installTheme(options: InstallThemeOptions, version: string): Promise<void>;
/**
* Check whether a specific theme is installed by theme name.
*/
isThemeInstalled(themeName: string): boolean;
/** @todo Documentation incomplete. */
loadCss(arg1: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
loadData(): unknown;
/** @todo Documentation incomplete. */
loadSnippets(): unknown;
/** @todo Documentation incomplete. */
loadTheme(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onload(): void;
/** @todo Documentation incomplete. */
onRaw(themeName: string): void;
/** @todo Documentation incomplete. */
readSnippets(): void;
/** @todo Documentation incomplete. */
readThemes(): void;
/**
* Remove a theme by theme name.
*/
removeTheme(themeName: string): Promise<void>;
/**
* Set the activation status of a snippet by snippet name.
*/
setCssEnabledStatus(snippetName: string, enabled: boolean): void;
/**
* Set the active theme by theme name.
*/
setTheme(themeName: string): void;
/**
* Set the translucency of application background.
*/
setTranslucency(translucency: boolean): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CustomCSSThemesRecord extends Record<string, ThemeManifest> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface CustomCSSUpdatesRecord extends Record<string, unknown> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DailyNotesOptions {
/** Open the daily note automatically whenever the vault is opened. */
autorun?: boolean;
/** New daily notes will be placed here. */
folder?: string;
/**
* Naming syntax for daily note in Moment.js syntax.
* https://momentjs.com/docs/#/displaying/format/.
*/
format?: string;
/** Path to the file to use as a template. */
template?: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DailyNotesPlugin extends InternalPlugin<DailyNotesPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DailyNotesPluginInstance extends InternalPluginInstance<DailyNotesPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
options: DailyNotesOptions;
/** @todo Documentation incomplete. */
plugin: DailyNotesPlugin;
/** @todo Documentation incomplete. */
getCurrentFileDateTimestamp(): null | number;
/** @todo Documentation incomplete. */
getDailyNote(date: typeof moment$1): Promise<TFile | null | undefined>;
/** @todo Documentation incomplete. */
getFormat(): string;
/** @todo Documentation incomplete. */
gotoNextExisting(timestamp: number): Promise<void>;
/** @todo Documentation incomplete. */
gotoPreviousExisting(timestamp: number): Promise<void>;
/** @todo Documentation incomplete. */
iterateDailyNotes(callback: (file: TFile, timestamp: number) => void): void;
/** @todo Documentation incomplete. */
onExternalSettingsChange(): Promise<void>;
/** @todo Documentation incomplete. */
onOpenDailyNote(evt: Event): Promise<void>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DataAdapterFilesRecord extends Record<string, FileEntry> {
}
/**
* A mapping between a vault-relative folder paths to the corresponding watcher entries.
*
* @public
* @unofficial
*/
export interface DataAdapterWatchersRecord extends Record<string, DataAdapterWatchersRecordEntry> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DataAdapterWatchersRecordEntry {
/**
* Resolved full path to the folder.
*/
resolvedPath: string;
/**
* Node.js file system watcher.
*/
watcher: FSWatcher;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Database {
/** @todo Documentation incomplete. */
version: string;
/** @todo Documentation incomplete. */
changeVersion(oldVersion: string, newVersion: string, callback?: (transaction: SQLTransaction) => void, errorCallback?: (error: SQLError) => void, successCallback?: () => void): void;
/** @todo Documentation incomplete. */
readTransaction(callback: (transaction: SQLTransaction) => void, errorCallback?: (error: SQLError) => void, successCallback?: () => void): void;
/** @todo Documentation incomplete. */
transaction(callback: (transaction: SQLTransaction) => void, errorCallback?: (error: SQLError) => void, successCallback?: () => void): void;
}
/**
* Function `DateAfter`.
* @public
* @unofficial
*/
export interface DateAfterFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Function `DateBefore`.
* @public
* @unofficial
*/
export interface DateBeforeFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Function `DateDiff`.
* @public
* @unofficial
*/
export interface DateDiffFunction extends BasesFunction {
}
/**
* Function `DateEquals`.
* @public
* @unofficial
*/
export interface DateEqualsFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Function `DateModify`.
* @public
* @unofficial
*/
export interface DateModifyFunction extends BasesFunction {
}
/**
* Function `DateNotEquals`.
* @public
* @unofficial
*/
export interface DateNotEqualsFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Function `DateOnOrAfter`.
* @public
* @unofficial
*/
export interface DateOnOrAfterFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Function `DateOnOrBefore`.
* @public
* @unofficial
*/
export interface DateOnOrBeforeFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Property widget component for dates.
*
* @public
* @unofficial
*/
export interface DatePropertyWidgetComponent extends DatePropertyWidgetComponentBase {
/** The button element for the property widget. */
buttonEl: HTMLDivElement | null;
/** The type of the property widget. */
type: "date";
}
/**
* Base interface for date property widget components.
*
* @public
* @unofficial
*/
export interface DatePropertyWidgetComponentBase extends PropertyWidgetComponentBase {
/** The date of the property widget. */
date?: moment.Moment;
/** Whether the property widget is dirty. */
dirty: boolean;
/** The hover popup for the property widget. */
hoverPopup: HoverPopover | null;
/** The input element for the property widget. */
inputEl: HTMLInputElement;
/** The value of the property widget. */
value: string;
/**
* Build the input element for the property widget.
*
* @param parentEl - The parent element.
* @returns The input element.
*/
buildInput(parentEl: HTMLElement): HTMLInputElement;
/**
* Format the date input.
*
* @param input - The input to format.
* @returns The formatted date.
*/
format(input: moment.Moment): string;
/**
* Parse the date input.
*
* @param input - The input to parse.
* @returns The parsed date.
*/
parse(input: moment.MomentInput): void;
}
/**
* Property widget component for datetimes.
*
* @public
* @unofficial
*/
export interface DatetimePropertyWidgetComponent extends DatePropertyWidgetComponentBase {
/** The type of the property widget. */
type: "datetime";
}
/**
* Function `Day`.
* @public
* @unofficial
*/
export interface DayFunction extends BasesFunction, HasExtract {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DeferredView extends View {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Dimensions {
/** @todo Documentation incomplete. */
height: number;
/** @todo Documentation incomplete. */
width: number;
}
/**
* The handlers for the DOM events.
*
* @public
* @unofficial
*/
export interface DomEventsHandlers {
/**
* Handles the external link click event.
*
* @param evt - The mouse event.
* @param targetEl - The target element.
* @param linkText - The link text.
*/
onExternalLinkClick(evt: MouseEvent, targetEl: HTMLElement, linkText: string): unknown;
/**
* Handles the external link right click event.
*
* @param evt - The mouse event.
* @param targetEl - The target element.
* @param linkText - The link text.
*/
onExternalLinkRightClick(evt: MouseEvent, targetEl: HTMLElement, linkText: string): unknown;
/**
* Handles the internal link click event.
*
* @param evt - The mouse event.
* @param targetEl - The target element.
* @param linkText - The link text.
*/
onInternalLinkClick(evt: MouseEvent, targetEl: HTMLElement, linkText: string): unknown;
/**
* Handles the internal link drag event.
*
* @param evt - The mouse event.
* @param targetEl - The target element.
* @param linkText - The link text.
* @param title - The title.
*/
onInternalLinkDrag(evt: MouseEvent, targetEl: HTMLElement, linkText: string, title?: string): unknown;
/**
* Handles the internal link mouseover event.
*
* @param evt - The mouse event.
* @param targetEl - The target element.
* @param linkText - The link text.
*/
onInternalLinkMouseover(evt: MouseEvent, targetEl: HTMLElement, linkText: string): unknown;
/**
* Handles the internal link right click event.
*
* @param evt - The mouse event.
* @param targetEl - The target element.
* @param linkText - The link text.
*/
onInternalLinkRightClick(evt: MouseEvent, targetEl: HTMLElement, linkText: string): unknown;
/**
* Handles the tag click event.
*
* @param evt - The mouse event.
* @param targetEl - The target element.
* @param linkText - The link text.
*/
onTagClick(evt: MouseEvent, targetEl: HTMLElement, tag: string): unknown;
}
/**
* The DomEventsHandlers constructor.
*
* @public
* @unofficial
*/
export interface DomEventsHandlersConstructor extends ConstructorBase<[
info: DomEventsHandlersInfo
], DomEventsHandlers> {
}
/**
* Information about the DOM events handlers.
*
* @public
* @unofficial
*/
export interface DomEventsHandlersInfo extends HoverParent {
/**
* Obsidian app instance.
*/
app: App;
/**
* The path to calculate relative links from.
*/
path: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DownloadLegacyThemeOptions {
/** @todo Documentation incomplete. */
repo: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DragManager {
/** @todo Documentation incomplete. */
actionEl: HTMLElement | null;
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
draggable: Draggable | null;
/** @todo Documentation incomplete. */
dragStart: DragStartEvent | null;
/** @todo Documentation incomplete. */
ghostEl: HTMLElement | null;
/** @todo Documentation incomplete. */
hoverClass: string;
/** @todo Documentation incomplete. */
hoverEl: HTMLElement | null;
/** @todo Documentation incomplete. */
isDragOverHandled: boolean;
/** @todo Documentation incomplete. */
overlayEl: HTMLElement;
/** @todo Documentation incomplete. */
shouldHideOverlay: boolean;
/** @todo Documentation incomplete. */
sourceClass: string;
/** @todo Documentation incomplete. */
sourceEls: HTMLElement[] | null;
/** @todo Documentation incomplete. */
dragFile(event: DragEvent, file: TFile, source?: unknown): Draggable;
/** @todo Documentation incomplete. */
dragFiles(event: DragEvent, files: TAbstractFile[], source?: unknown): Draggable | null;
/** @todo Documentation incomplete. */
dragFolder(event: DragEvent, folder: TFolder, source?: unknown): Draggable;
/** @todo Documentation incomplete. */
dragLink(event: DragEvent, linkText: string, sourcePath: string, title?: string, source?: unknown): Draggable;
/** @todo Documentation incomplete. */
handleDrag(el: HTMLElement, draggableGetter: (event: DragEvent) => Draggable | null): void;
/** @todo Documentation incomplete. */
handleDrop(el: HTMLElement, dropHandler: (event: DragEvent, draggable: Draggable, isOver: boolean) => DropResult | null, draggable?: boolean): void;
/** @todo Documentation incomplete. */
hideOverlay(): void;
/** @todo Documentation incomplete. */
onDragEnd(): void;
/** @todo Documentation incomplete. */
onDragLeave(event: DragEvent): void;
/** @todo Documentation incomplete. */
onDragOver(event: DragEvent): void;
/** @todo Documentation incomplete. */
onDragOverFirst(): void;
/** @todo Documentation incomplete. */
onDragStart(event: DragEvent, draggable: Draggable): void;
/** @todo Documentation incomplete. */
onDragStartGlobal(event: DragEvent): void;
/** @todo Documentation incomplete. */
onTouchEnd(event: TouchEvent): void;
/** @todo Documentation incomplete. */
removeOverlay(): void;
/** @todo Documentation incomplete. */
setAction(action: string | null): void;
/** @todo Documentation incomplete. */
showOverlay(doc: Document, rect: DOMRect): void;
/** @todo Documentation incomplete. */
updateHover(hoverEl: HTMLElement | null, hoverClass: string): void;
/** @todo Documentation incomplete. */
updateSource(sourceEls: HTMLElement[] | null, sourceClass: string): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DragStartEvent {
/** @todo Documentation incomplete. */
evt: DragEvent;
/** @todo Documentation incomplete. */
moved: boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Draggable {
/** @todo Documentation incomplete. */
file?: TAbstractFile;
/** @todo Documentation incomplete. */
files?: TAbstractFile[];
/** @todo Documentation incomplete. */
icon: string;
/** @todo Documentation incomplete. */
linktext?: string;
/** @todo Documentation incomplete. */
source?: unknown;
/** @todo Documentation incomplete. */
sourcePath?: string;
/** @todo Documentation incomplete. */
title: string;
/** @todo Documentation incomplete. */
type: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface DropResult {
/** @todo Documentation incomplete. */
action: string | null;
/** @todo Documentation incomplete. */
dropEffect: "none" | "copy" | "link" | "move";
/** @todo Documentation incomplete. */
hoverClass?: string;
/** @todo Documentation incomplete. */
hoverEl?: HTMLElement | null;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EdgeIndex extends EdgeIndexBase {
/** @todo Documentation incomplete. */
_maxEntries: number;
/** @todo Documentation incomplete. */
_minEntries: number;
/** @todo Documentation incomplete. */
data: EdgeIndexData;
/** @todo Documentation incomplete. */
compareMinX(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
compareMinY(arg1: unknown, arg2: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EdgeIndexBase extends EdgeIndexBaseBase {
/** @todo Documentation incomplete. */
insert(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
remove(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
toBBox(arg1: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EdgeIndexBaseBase {
/** @todo Documentation incomplete. */
_adjustParentBBoxes(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
_all(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
_allDistMargin(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown;
/** @todo Documentation incomplete. */
_build(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown;
/** @todo Documentation incomplete. */
_chooseSplitAxis(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
_chooseSplitIndex(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
_chooseSubtree(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown;
/** @todo Documentation incomplete. */
_condense(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
_insert(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
_split(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
_splitRoot(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
all(): unknown;
/** @todo Documentation incomplete. */
clear(): unknown;
/** @todo Documentation incomplete. */
collides(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
compareMinX(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
compareMinY(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
fromJSON(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
insert(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
load(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
remove(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
search(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
toBBox(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
toJSON(): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EdgeIndexData {
/** @todo Documentation incomplete. */
children: CanvasViewCanvasEdge[];
/** @todo Documentation incomplete. */
height: number;
/** @todo Documentation incomplete. */
leaf: boolean;
/** @todo Documentation incomplete. */
maxX: number;
/** @todo Documentation incomplete. */
maxY: number;
/** @todo Documentation incomplete. */
minX: number;
/** @todo Documentation incomplete. */
minY: number;
}
/**
* Editor language support.
*
* @public
* @unofficial
*/
export interface EditorLanguageSupport {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EditorRangeEx {
/** @todo Documentation incomplete. */
from: EditorPosition | null;
/** @todo Documentation incomplete. */
to: EditorPosition | null;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EditorSearchComponent extends AbstractSearchComponent {
/**
* Search cursor for editor, handles search and replace functionality for editor.
*/
cursor: null | SearchCursor;
/**
* Linked editor for search component.
*/
editor: Editor;
/**
* Whether search component is currently rendering.
*/
isActive: boolean;
/**
* Whether search component is replacing text (includes 'Replace' input field).
*/
isReplace: boolean;
/**
* Remove all highlights from editor.
*/
clear(): void;
/**
* Find next search results from cursor and highlights it.
*/
findNext(): void;
/**
* Replace cursor with replacement string if not null and moves to next search result.
*/
findNextOrReplace(): void;
/**
* Find previous search results from cursor and highlights it.
*/
findPrevious(): void;
/**
* Hide/detaches the search component and removes cursor highlights.
*/
hide(): void;
/**
* Add highlights for specified ranges.
*
* @remark Invokes editor.addHighlights.
*/
highlight(ranges: EditorRange[]): void;
/**
* Highlights all matches if search element focused.
*/
onAltEnter(e?: KeyboardEvent): void;
/**
* Replace all search results with specified text if replace mode and replacement element is focused.
*/
onModAltEnter(e?: KeyboardEvent): void;
/**
* Updates search cursor on new input query and highlights search results.
*/
onSearchInput(): void;
/**
* Replaces all search results with replacement query.
*/
replaceAll(): void;
/**
* Replace current search result, if any, with replacement query.
*/
replaceCurrentMatch(): void;
/**
* Find all matches of search query and highlights them.
*/
searchAll(): void;
/**
* Reveal the search (and replace) component.
*/
show(replace: boolean): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EditorSelection {
/** @todo Documentation incomplete. */
anchor: EditorPosition;
/** @todo Documentation incomplete. */
head: EditorPosition;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EditorStatusPlugin extends InternalPlugin<EditorStatusPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EditorStatusPluginInstance extends InternalPluginInstance<EditorStatusPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
hiddenFromList: true;
/** @todo Documentation incomplete. */
plugin: EditorStatusPlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EditorSuggestEx {
/** @todo Documentation incomplete. */
currentSuggest?: EditorSuggest<unknown>;
/** @todo Documentation incomplete. */
suggests: EditorSuggest<unknown>[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EditorSuggests {
/**
* Currently active and rendered editor suggestion popup.
*/
currentSuggest: null | EditorSuggest<unknown>;
/**
* Registered editor suggestions.
*
* @remark Used for providing autocompletions for specific strings.
* @tutorial Reference official documentation under EditorSuggest<T> for usage.
*/
suggests: EditorSuggest<unknown>[];
/**
* Add a new editor suggestion to the list of registered suggestion providers.
*/
addSuggest(suggest: EditorSuggest<unknown>): void;
/**
* Close the currently active editor suggestion popup.
*/
close(): void;
/**
* Whether there is a editor suggestion popup active and visible.
*/
isShowingSuggestion(): boolean;
/**
* Remove a registered editor suggestion from the list of registered suggestion providers.
*/
removeSuggest(suggest: EditorSuggest<unknown>): void;
/**
* Update position of currently active and rendered editor suggestion popup.
*/
reposition(): void;
/**
* Set the currently active editor suggestion popup to specified suggester.
*/
setCurrentSuggest(suggest: EditorSuggest<unknown>): void;
/**
* Run check on focused editor to see whether a suggestion should be triggered and rendered.
*/
trigger(editor: MarkdownBaseView, t: TFile, n: boolean): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EditorViewState {
/** @todo Documentation incomplete. */
printing: boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ElectronWindow extends BrowserWindow {
/** @todo Documentation incomplete. */
_browserViews: unknown;
/** @todo Documentation incomplete. */
_events: unknown;
/** @todo Documentation incomplete. */
_eventsCount: unknown;
/** @todo Documentation incomplete. */
devToolsWebContents: unknown;
}
/**
* A component that renders an embedded audio file.
*
* @public
* @unofficial
*/
export interface EmbedAudioComponent extends EmbedComponent {
}
/**
* A component that renders an embedded canvas file.
*
* @public
* @unofficial
*/
export interface EmbedCanvasComponent extends EmbedComponent {
}
/**
* The component that renders the embedded file.
*
* @public
* @unofficial
*/
export interface EmbedComponent extends Component {
/**
* Load the file into the component.
*/
loadFile(): void;
}
/**
* A context to configure embedding of a file.
*
* @public
* @unofficial
*/
export interface EmbedContext {
/**
* Reference to the app.
*/
app: App;
/**
* Element where the embed should be displayed.
*/
containerEl: HTMLElement;
/**
* Depth of the embed within its container (how many levels of embeds are above it).
*/
depth?: number;
/**
* Whether the embed should be dynamic (CM) or static (postProcessed).
*/
displayMode?: boolean;
/**
* Text that should be displayed in the embed.
*/
linktext?: string;
/**
* Whether the embed should be an inline embed.
*/
showInline?: boolean;
/**
* Optional path to the current open file.
*/
sourcePath?: string;
/** @todo Documentation incomplete. */
state?: unknown;
}
/**
* A component that renders an embedded image file.
*
* @public
* @unofficial
*/
export interface EmbedImageComponent extends EmbedComponent {
}
/**
* A component that renders an embedded markdown file.
*
* @public
* @unofficial
*/
export interface EmbedMarkdownComponent extends EmbedComponent {
}
/**
* A component that renders an embedded PDF file.
*
* @public
* @unofficial
*/
export interface EmbedPdfComponent extends EmbedComponent {
}
/**
* A registry for embeddable files components.
*
* @public
* @unofficial
*/
export interface EmbedRegistry extends Events {
/**
* Mapping of file extensions to constructors for embeddable widgets.
*/
embedByExtension: EmbedRegistryEmbedByExtensionRecord;
/**
* Get the embed constructor for a specific file type.
*/
getEmbedCreator(file: TFile): EmbedCreator | null;
/**
* Check whether a file extension has a registered embed constructor.
*/
isExtensionRegistered(extension: string): boolean;
/**
* Register an embed constructor for a specific file extension.
*/
registerExtension(extension: string, embedCreator: EmbedCreator): void;
/**
* Register an embed constructor for a list of file extensions.
*/
registerExtensions(extensions: string[], embedCreator: EmbedCreator): void;
/**
* Unregister an embed constructor for a specific file extension.
*/
unregisterExtension(extension: string): void;
/**
* Unregister an embed constructor for a list of file extensions.
*/
unregisterExtensions(extensions: string[]): void;
}
/**
* A record of embeddable file extensions and their creators.
*
* @public
* @unofficial
*/
export interface EmbedRegistryEmbedByExtensionRecord extends Record<string, EmbedCreator> {
/**
* Creates an embed component for a 3GP file.
*/
[FileExtension._3gp]: (context: EmbedContext, file: TFile) => EmbedAudioComponent;
/**
* Creates an embed component for an AVIF file.
*/
[FileExtension.avif]: (context: EmbedContext, file: TFile) => EmbedImageComponent;
/**
* Creates an embed component for a BMP file.
*/
[FileExtension.bmp]: (context: EmbedContext, file: TFile) => EmbedImageComponent;
/**
* Creates an embed component for a canvas file.
*/
[FileExtension.canvas]: (context: EmbedContext, file: TFile, subpath?: string) => EmbedCanvasComponent;
/**
* Creates an embed component for a FLAC file.
*/
[FileExtension.flac]: (context: EmbedContext, file: TFile) => EmbedAudioComponent;
/**
* Creates an embed component for a GIF file.
*/
[FileExtension.gif]: (context: EmbedContext, file: TFile) => EmbedImageComponent;
/**
* Creates an embed component for a JPEG file.
*/
[FileExtension.jpeg]: (context: EmbedContext, file: TFile) => EmbedImageComponent;
/**
* Creates an embed component for a JPG file.
*/
[FileExtension.jpg]: (context: EmbedContext, file: TFile) => EmbedImageComponent;
/**
* Creates an embed component for an M4A file.
*/
[FileExtension.m4a]: (context: EmbedContext, file: TFile) => EmbedAudioComponent;
/**
* Creates an embed component for a markdown file.
*/
[FileExtension.md]: (context: EmbedContext, file: TFile, subpath?: string) => EmbedMarkdownComponent;
/**
* Creates an embed component for a MKV file.
*/
[FileExtension.mkv]: (context: EmbedContext, file: TFile) => EmbedVideoComponent;
/**
* Creates an embed component for a MOV file.
*/
[FileExtension.mov]: (context: EmbedContext, file: TFile) => EmbedVideoComponent;
/**
* Creates an embed component for an MP3 file.
*/
[FileExtension.mp3]: (context: EmbedContext, file: TFile) => EmbedAudioComponent;
/**
* Creates an embed component for an MP4 file.
*/
[FileExtension.mp4]: (context: EmbedContext, file: TFile) => EmbedVideoComponent;
/**
* Creates an embed component for an OGA file.
*/
[FileExtension.oga]: (context: EmbedContext, file: TFile) => EmbedAudioComponent;
/**
* Creates an embed component for an OGG file.
*/
[FileExtension.ogg]: (context: EmbedContext, file: TFile) => EmbedAudioComponent;
/**
* Creates an embed component for an OGV file.
*/
[FileExtension.ogv]: (context: EmbedContext, file: TFile) => EmbedVideoComponent;
/**
* Creates an embed component for an OPUS file.
*/
[FileExtension.opus]: (context: EmbedContext, file: TFile) => EmbedAudioComponent;
/**
* Creates an embed component for a PDF file.
*/
[FileExtension.pdf]: (context: EmbedContext, file: TFile, subpath?: string) => EmbedPdfComponent;
/**
* Creates an embed component for a PNG file.
*/
[FileExtension.png]: (context: EmbedContext, file: TFile) => EmbedImageComponent;
/**
* Creates an embed component for an SVG file.
*/
[FileExtension.svg]: (context: EmbedContext, file: TFile) => EmbedImageComponent;
/**
* Creates an embed component for a WAV file.
*/
[FileExtension.wav]: (context: EmbedContext, file: TFile) => EmbedAudioComponent;
/**
* Creates an embed component for a WEBM file.
*/
[FileExtension.webm]: (context: EmbedContext, file: TFile) => EmbedVideoComponent;
/**
* Creates an embed component for a WEBP file.
*/
[FileExtension.webp]: (context: EmbedContext, file: TFile) => EmbedImageComponent;
}
/**
* A component that renders an embedded video file.
*
* @public
* @unofficial
*/
export interface EmbedVideoComponent extends EmbedComponent {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EmbeddedEditorView extends Component {
/**
* Reference to the app.
*/
app: App;
/**
* Container element for the embedded view.
*/
containerEl: HTMLElement;
/**
* Whether the view is currently saving.
*/
dirty: boolean;
/**
* Whether the editor may be edited.
*
* @remark Fun fact, setting this to true and calling showEditor() for embedded MD views, allows them to be edited.
* Though the experience is a little buggy.
*/
editable: boolean;
/**
* Editor component of the view.
*/
editMode?: IFramedMarkdownEditor | undefined;
/**
* Container in which the editor is embedded.
*/
editorEl: HTMLElement;
/**
* File to which the view is attached.
*/
file: null | TFile;
/**
* Hover element container.
*/
hoverPopover: null | HoverPopover;
/**
* Element containing the preview for the embedded markdown.
*/
previewEl: HTMLElement;
/**
* Preview component of the view.
*/
previewMode: MarkdownPreviewView;
/**
* Current state of the editor.
*/
state: unknown;
/**
* Text contents being embedded.
*/
text: string;
/**
* Whether the view renders contents using an iFrame.
*/
useIframe: boolean;
/**
* Get the preview editor, if exists.
*/
get editor(): IFramedMarkdownEditor | null;
/**
* Get the path to the file, if any file registered.
*/
get path(): string;
/**
* Get the scroll of the file renderer component.
*/
get scroll(): unknown;
/**
* Destroy edit component editor and save contents if specified.
*/
destroyEditor(save?: boolean): void;
/**
* Gets currently active mode (editMode returns 'source').
*/
getMode(): "source" | "preview";
/**
* On load of editor, show preview.
*/
onload(): void;
/**
* Trigger markdown scroll on workspace.
*/
onMarkdownScroll(): void;
/**
* On unload of editor, destroy editor and unset workspace activeEditor.
*/
onunload(): void;
/**
* Debounced save of contents.
*/
requestSave(): void;
/**
* Debounced save of editor folds.
*/
requestSaveFolds(): void;
/**
* Set file contents.
*/
save(data: string, save?: boolean): void;
/**
* Set the state of the editor.
*/
set(data: string, clear: boolean): void;
/**
* Reveal the editor if editable widget and applies saved state.
*/
showEditor(): void;
/**
* Reveal preview mode and destroy editor, save if specified.
*/
showPreview(save?: boolean): void;
/**
* Reveal search component in file renderer component.
*/
showSearch(replace?: boolean): void;
/**
* Toggle between edit and preview mode.
*/
toggleMode(): void;
}
/**
* Function `Empty`.
* @public
* @unofficial
*/
export interface EmptyFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EmptyView extends ItemView {
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Empty;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EmptyViewConstructor extends TypedViewConstructor<EmptyView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EnclosingTag {
/** @todo Documentation incomplete. */
close: EditorRangeEx;
/** @todo Documentation incomplete. */
open: EditorRangeEx;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EnsureSideLeafOptions {
/** @official */
active?: boolean;
/** @official */
reveal?: boolean;
/** @official */
split?: boolean;
/** @official */
state?: any;
}
/**
* Function `Equal`.
* @public
* @unofficial
*/
export interface EqualFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface EventsEntry {
/** @todo Documentation incomplete. */
ctx: unknown;
/** @todo Documentation incomplete. */
e: Events;
/** @todo Documentation incomplete. */
name: string;
/** @todo Documentation incomplete. */
fn(...data: unknown[]): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ExtendedMetrics {
/** @todo Documentation incomplete. */
containerWidth: number;
/** @todo Documentation incomplete. */
em: number;
/** @todo Documentation incomplete. */
ex: number;
/** @todo Documentation incomplete. */
family: string;
/** @todo Documentation incomplete. */
lineWidth: number;
/** @todo Documentation incomplete. */
scale: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileBookmarkItem extends BookmarkItem {
/** @todo Documentation incomplete. */
path: string;
/** @todo Documentation incomplete. */
subpath: string;
/** @todo Documentation incomplete. */
type: "file";
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileCacheEntry {
/**
* Hash of file contents.
*/
hash: string;
/**
* Last modified time of file.
*/
mtime: number;
/**
* Size of file in bytes.
*/
size: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileEntry extends Partial<FileStats> {
/**
* Name of file or folder.
*/
name?: string;
/**
* Full path to file or folder.
*
* @remark Might be used for resolving symlinks.
*/
realpath: string;
/**
* Type of entry.
*/
type: "file" | "folder";
/**
* URI of file or folder.
*/
uri?: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileExplorerPlugin extends InternalPlugin<FileExplorerPluginInstance> {
/**
* Reveals a file or folder in the file explorer view, opens the view if it is not already.
* open/visible.
*/
revealInFolder(item: TFile | TFolder): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileExplorerPluginInstance extends InternalPluginInstance<FileExplorerPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
plugin: FileExplorerPlugin;
/**
* Reveals a file or folder in the file explorer view, opens the view if it is not already.
* open/visible.
*/
revealInFolder(item: TFile | TFolder): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileExplorerView extends View {
/**
* Mapping of file path to tree item.
*/
fileItems: FileExplorerViewFileItemsRecord;
/**
* Mapping of tree self element to abstract file.
*/
files: WeakMapWrapper<HTMLElement, TAbstractFile>;
/**
* Last dragged over folder item element.
* `null` when there is no folder item being dragged over.
*/
lastDropTargetEl: HTMLElement | null;
/** @todo Documentation incomplete. */
mouseoverExpandTimeout: number | null;
/**
* Indicate ready state of the view.
*/
ready: boolean;
/**
* Try to sort tree items.
*/
requestSort: Debouncer<[
], void>;
/**
* Current sort order of file tree items.
*/
sortOrder: FileExplorerViewSortOrder;
/**
* Tree view of files.
*/
tree: Tree<FileTreeItem | FolderTreeItem>;
/**
* Try to rename the file.
*/
acceptRename(): Promise<void>;
/**
* Is Executed after creating the file or folder and opens the view and/or starts the rename.
*
* @param file - The created file.
* @param newLeaf - Where to open the view for this file.
*/
afterCreate(file: TFile, newLeaf: PaneType | boolean): Promise<void>;
/**
* Used internally to attach drop handler to the tree root and folder items.
*
* @param folder - Folder that's associated with the item.
* @param el - Element of the tree root or folder item.
*/
attachDropHandler(folder: TFolder, el: HTMLElement): void;
/** @todo Documentation incomplete */
attachFileEvents(e: unknown): void;
/**
* Creates an file or folder.
*
* @param type - The type of file to create.
* @param location - The location where to create the file.
* @param newLeaf - Where to open the view for this file.
*/
createAbstractFile(type: "file" | "folder", location: TFolder, newLeaf: PaneType | boolean): Promise<void>;
/** @todo Documentation incomplete */
createFolderDom(folder: TFolder): unknown;
/** @todo Documentation incomplete */
createItemDom(file: TFile): unknown;
/** @todo Documentation incomplete */
displayError(message: string, fileItem: unknown): void;
/** @todo Documentation incomplete */
dragFiles(event: DragEvent, t: unknown): unknown;
/**
* Quits the rename.
*/
exitRename(): void;
/** @todo Documentation incomplete */
getNodeId(e: unknown): unknown;
/**
* Get a sorted list of the tree items for a specific folder).
*/
getSortedFolderItems(folder: TFolder): FileTreeItem[];
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.FileExplorer;
/** @todo Documentation incomplete maybe FileTreeItem */
isItem(item: unknown): boolean;
/**
* Is called when a new file is created in vault. Updates the file tree.
*
* @param file - The new file or folder.
*/
onCreate(file: TAbstractFile): void;
/**
* Is called when on the new folder icon is clicked. Call createAbstractFile().
*
* @param event - The MouseEvent which triggered this function.
*/
onCreateNewFolderClick(event: MouseEvent): Promise<void>;
/**
* Is called when on the new note icon is clicked. Call createAbstractFile().
*
* @param event - The MouseEvent which triggered this function.
*/
onCreateNewNoteClick(event: MouseEvent): Promise<void>;
/**
* Is called when a file in vault is deleted. Updates the file tree.
*
* @param file - The deleted file or folder.
*/
onDelete(file: TAbstractFile): void;
/**
* Called when delete is requested.
*
* @param event - The event triggered this function.
*/
onDeleteSelectedFiles(event: unknown): unknown;
/**
* Called when a extensions update is triggered.
* Event: 'extensions-updated'.
*/
onExtensionsUpdated(): void;
/**
* Called when the mouse pointer moves away from an element.
* Event: 'mouseout'.
*
* @param event - The event triggered this function.
* @param targetEl - The target Element.
*/
onFileMouseout(event: MouseEvent, targetEl: HTMLElement): void;
/**
* Called when the mouse pointer is moved over an element. Updates the tooltip information.
* Event: 'mouseover'.
*
* @param event - The event triggered this function.
* @param targetEl - The target Element.
*/
onFileMouseover(event: MouseEvent, targetEl: HTMLElement): void;
/**
* Called when a file is opened. Brings the file to the front.
*
* @param file - The opened file.
*/
onFileOpen(file: TFile): void;
/** @todo Documentation incomplete */
onFileRenameInput(e: unknown): void;
/**
* Called when 'Enter' is pressed while rename. Accepts the rename.
*
* @param event - The event triggered this function.
*/
onKeyEnterInRename(event: KeyboardEvent): void;
/**
* Called when 'ESC' is pressed while rename. Denies the rename.
*/
onKeyEscInRename(): void;
/**
* Called when the rename shortcut is pressed.
*
* @param event - The event triggered this function.
*/
onKeyRename(event: KeyboardEvent): void;
/**
* Request a sort if not sorted properly.
*/
onModify(): void;
/**
* Is called when a file in vault is renamed. Updates the file tree.
*
* @param file - The renamed file or folder.
* @param oldPath - The old file or folder path.
*/
onRename(file: TAbstractFile, oldPath: string): void;
/**
* Called when the title is deselected. Calls acceptRename().
*/
onTitleBlur(): void;
/**
* Opens the context menu for the file item.
*
* @param event - The event.
* @param fileItemEl - The file item clicked on.
*/
openFileContextMenu(event: Event, fileItemEl: HTMLElement): void;
/**
* Reveal a file or folder in the file tree.
*/
revealInFolder(file: TFile | TFolder): void;
/** @todo Documentation incomplete */
setIsAllCollapsed(e: unknown): void;
/**
* Updates the sort order and sort by it.
*
* @param order - The sort order.
*/
setSortOrder(order: unknown): void;
/**
* Sorts the file items in this view.
*/
sort(): void;
/** @todo Documentation incomplete */
startRenameFile(e: unknown): unknown;
/**
* Reloads the config from vault and update all items.
*/
updateConfig(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileExplorerViewConstructor extends TypedViewConstructor<FileExplorerView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileExplorerViewFileItemsRecord extends Record<string, FileTreeItem | FolderTreeItem> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FilePropertiesView extends InfoFileView {
/**
* Returns the file.
*/
getFile(): TFile;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.FileProperties;
/**
* Checks the file is an markdown file.
*
* @param file - The file to check.
*/
isSupportedFile(file: TFile): boolean;
/** @todo Documentation incomplete */
onFileChange(file: TFile): Promise<unknown>;
/** @todo Documentation incomplete */
onQuickPreview(file: TFile, t: unknown): void;
/**
* Reads the file if it is supported.
*
* @param file - The file to read.
*/
readSupportedFile(file: TFile): Promise<unknown>;
/** @todo Documentation incomplete */
saveFrontmatter(e: unknown): void;
/** @todo Documentation incomplete */
shiftFocusAfter(): void;
/** @todo Documentation incomplete */
shiftFocusBefore(): void;
/** @todo Documentation incomplete */
update(): void;
/** @todo Documentation incomplete */
updateEmptyState(): void;
/** @todo Documentation incomplete */
updateFrontmatter(file: TFile, t: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FilePropertiesViewConstructor extends TypedViewConstructor<FilePropertiesView, [
propertiesPluginInstance: PropertiesPluginInstance
]> {
}
/**
* Property widget component for files.
*
* @public
* @unofficial
*/
export interface FilePropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The input element for the property widget. */
inputEl: HTMLInputElement;
/** The type of the property widget. */
type: "file";
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileRecoveryPlugin extends InternalPlugin<FileRecoveryPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileRecoveryPluginInstance extends InternalPluginInstance<FileRecoveryPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileSuggest<T> extends EditorSuggest<T> {
/**
* Manages fetching of suggestions from metadatacache.
*/
suggestManager: FileSuggestManager;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileSuggestManager {
/**
* Reference to the app.
*/
app: App;
/**
* Selection of files and their paths that can be matched to.
*/
fileSuggestions: null | {
file: TFile | null;
path: string;
}[];
/**
* Whether search should be vault-wide rather than scoped to current file.
*/
global: boolean;
/**
* Type of suggestions that should be provided.
*/
mode: "file" | "heading" | "block" | "display" | string;
/**
* Executor of the search.
*/
runnable: null | Runnable;
/**
* Get suggestions for block query.
*/
getBlockSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>;
/**
* Get suggestions for display alias query.
*/
getDisplaySuggestions(runner: Runnable, linkpath: string, subpath: string, alias: string): Promise<SearchResult[]>;
/**
* Get suggestions for file query.
*/
getFileSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
/**
* Get suggestions for global block query.
*/
getGlobalBlockSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
/**
* Get suggestions for global heading query.
*/
getGlobalHeadingSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>;
/**
* Get suggestions for file heading query.
*/
getHeadingSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>;
/**
* Generate instructions for specific actions in suggestion manager (e.g. accept, select, ...).
*/
getInstructions(): [
{
command: "string";
purpose: "string";
}
];
/**
* Determine the source path of current context.
*/
getSourcePath(): null | string;
/**
* Get suggestions for current input text.
*
* @remark Type is determined from text: e.g. [[Thi]] will give completions for files, [[Thi^]] for blocks, etc.
*/
getSuggestionsAsync(runner: Runnable, text: string): Promise<SearchResult[]>;
/**
* Match search fragments to a block.
*/
matchBlock(path: string, file: TFile, block: BlockCache, sourcePath: null | string, content: string, text_parts: string[]): SearchResult | null;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileSystemWatchHandler {
/** @todo Documentation incomplete. */
(eventType: "raw" | "folder-created" | "folder-removed" | "file-removed", path: string): void;
/** @todo Documentation incomplete. */
(eventType: "modified" | "file-created", path: string, oldPath: undefined, stats: FileStats): void;
/** @todo Documentation incomplete. */
(eventType: "renamed", path: string, oldPath: string): void;
/** @todo Documentation incomplete. */
(eventType: "closed"): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FileTreeItem extends AbstractFileTreeItem<TFile> {
/**
* Element that indicates associated file extension,
* if it wasn't a Markdown file.
*/
tagEl: HTMLElement | null;
/** @todo Documentation incomplete. */
isSupported(): boolean;
}
/**
* Function `Flat`.
* @public
* @unofficial
*/
export interface FlatFunction extends BasesFunction {
}
/**
* Function `Floor`.
* @public
* @unofficial
*/
export interface FloorFunction extends BasesFunction, HasGetDisplayName {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FocusMetadataOptions {
/** @todo Documentation incomplete. */
focusHeading: boolean;
/** @todo Documentation incomplete. */
propertyIdx?: number;
/** @todo Documentation incomplete. */
propertyKey?: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Fold {
/** @todo Documentation incomplete. */
from: number;
/** @todo Documentation incomplete. */
to: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FoldInfo {
/** @todo Documentation incomplete. */
folds: Fold[];
/** @todo Documentation incomplete. */
lines: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FoldManager {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
cleanup(): unknown;
/** @todo Documentation incomplete. */
load(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
loadPath(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
save(arg1: unknown, arg2: unknown): unknown;
/** @todo Documentation incomplete. */
savePath(arg1: unknown, arg2: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FolderBookmarkItem extends BookmarkItem {
/** @todo Documentation incomplete. */
path: string;
/** @todo Documentation incomplete. */
type: "folder";
}
/**
* Property widget component for folders.
*
* @public
* @unofficial
*/
export interface FolderPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The input element for the property widget. */
inputEl: HTMLInputElement;
/** The type of the property widget. */
type: "folder";
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FolderTreeItem extends AbstractFileTreeItem<TFile>, TreeCollapsibleItem {
/** @todo Documentation incomplete. */
pusherEl: HTMLElement;
/** @todo Documentation incomplete. */
vChildren: TreeNodeVChildren<FolderTreeItem | FileTreeItem, FolderTreeItem>;
/**
* Sort file items inside by current sort order.
*/
sort(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FootnotesPlugin extends InternalPlugin<FootnotesPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FootnotesPluginInstance extends InternalPluginInstance<FootnotesPlugin> {
/** @todo Documentation incomplete. */
initLeaf(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface FrameDom {
/** @todo Documentation incomplete. */
eWin: Electron.BrowserWindow;
/** @todo Documentation incomplete. */
isMac: boolean;
/** @todo Documentation incomplete. */
leftButtonContainerEl: HTMLDivElement;
/** @todo Documentation incomplete. */
titleBarEl: HTMLDivElement;
/** @todo Documentation incomplete. */
titleBarInnerEl: HTMLDivElement;
/** @todo Documentation incomplete. */
titleBarTextEl: HTMLDivElement;
/** @todo Documentation incomplete. */
win: Window;
/** @todo Documentation incomplete. */
updateStatus(): void;
/** @todo Documentation incomplete. */
updateTitle(): void;
}
/**
* Options for getting recent files.
* @public
* @unofficial
*/
export interface GetRecentFilesOptions {
/**
* The maximum number of files to return.
*/
maxCount?: number;
/**
* Whether to show canvas files.
*/
showCanvas?: boolean;
/**
* Whether to show image files.
*/
showImages?: boolean;
/**
* Whether to show markdown files.
*/
showMarkdown?: boolean;
/**
* Whether to show non-attachments (canvas, base).
*/
showNonAttachments?: boolean;
/**
* Whether to show non-image attachments.
*/
showNonImageAttachments?: boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GlobalSearchPlugin extends InternalPlugin<GlobalSearchPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GlobalSearchPluginInstance extends InternalPluginInstance<GlobalSearchPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
plugin: GlobalSearchPlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphBookmarkItem extends BookmarkItem {
/** @todo Documentation incomplete. */
options: GraphPluginInstanceOptions;
/** @todo Documentation incomplete. */
title: string;
/** @todo Documentation incomplete. */
type: "graph";
}
/**
* Color attributes.
*
* @public
* @unofficial
*/
export interface GraphColorAttributes {
/** Alpha channel. */
a: number;
/** Color stored as an integer (`rgb = c.r << 16 | c.g << 8 | c.b` where channels are 8-bits unsigned integers). */
rgb: number;
}
/**
* Group of nodes set by the user.
*
* @public
* @unofficial
*/
export interface GraphColorGroup {
/** Color associated to the group. */
color: GraphColorAttributes;
/** Query associated to the group. */
query: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphColorGroupOptions extends GraphOptions {
/** @todo Documentation incomplete. */
groups: GraphColorGroupOptionsGroup[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphColorGroupOptionsGroup {
/** @todo Documentation incomplete. */
color: ColorComponent;
/** @todo Documentation incomplete. */
el: HTMLDivElement;
/** @todo Documentation incomplete. */
query: TextComponent;
}
/**
* Data selected to be rendered in the graph based on the current options.
*
* @public
* @unofficial
*/
export interface GraphData {
/** Record of nodes selected to be rendered. Their IDs are used as keys. */
nodes: Record<string, GraphNodeData>;
/** Number of links. */
numLinks: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphDisplayOptions extends GraphOptions {
}
/**
* Engine of a graph view.
*
* @public
* @unofficial
*/
export interface GraphEngine {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
colorGroupOptions: GraphColorGroupOptions;
/** @todo Documentation incomplete. */
controlsEl: HTMLDivElement;
/** @todo Documentation incomplete. */
currentFocusFile: string;
/** @todo Documentation incomplete. */
displayOptions: GraphDisplayOptions;
/** @todo Documentation incomplete. */
fileFilter: GraphFileFilter;
/** @todo Documentation incomplete. */
filterOptions: GraphFilterOptions;
/** @todo Documentation incomplete. */
forceOptions: GraphForceOptions;
/** @todo Documentation incomplete. */
hasFilter: boolean;
/** @todo Documentation incomplete. */
hoverPopover: unknown;
/** @todo Documentation incomplete. */
lastHoverLink: unknown;
/** @todo Documentation incomplete. */
options: GraphPluginInstanceOptions;
/** @todo Documentation incomplete. */
progression: number;
/** @todo Documentation incomplete. */
progressionSpeed: number;
/** @todo Documentation incomplete. */
renderer: GraphRenderer;
/** @todo Documentation incomplete. */
searchQueries: GraphColorGroup[];
/** @todo Documentation incomplete. */
view: LocalGraphView | GraphView;
/**
* Gets the engine options.
*/
getOptions(): GraphPluginInstanceOptions;
/**
* Rerenders the graph.
*/
render(): void;
/**
* Sets the engine options.
*
* @param options - New options. Undefined elements will not be considered.
*/
setOptions(options: GraphPluginInstanceOptions | undefined): void;
/**
* Updates the engine after the search filter has changed.
*/
updateSearch(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphFileFilter extends Record<string, GraphColorAttributes | boolean> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphFilterOptions extends GraphOptions {
/** @todo Documentation incomplete. */
search: SearchComponent;
/** @todo Documentation incomplete. */
searchSetting: Setting;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphForceOptions extends GraphOptions {
}
/**
* Graph forces.
*
* @public
* @unofficial
*/
export interface GraphForces {
/** @todo Documentation incomplete. */
centerStrength?: number;
/** @todo Documentation incomplete. */
linkDistance?: number;
/** @todo Documentation incomplete. */
linkStrength?: number;
/** @todo Documentation incomplete. */
repelStrength?: number;
}
/**
* Represents a link in a graph view.
*
* @public
* @unofficial
*/
export interface GraphLink {
/** PixiJS element for the arrow, child of `GraphRenderer.hanger`. */
arrow: Graphics | null;
/** PixiJS element for the line. */
line: Sprite | null;
/** Parent of `GraphLink.line`, child of `GraphRenderer.hanger`. */
px: Container | null;
/** @todo Documentation incomplete. */
rendered: boolean;
/** `GraphRenderer` managing this node. */
renderer: GraphRenderer;
/** Source node of the link. */
source: GraphNode;
/** Target node of the link. */
target: GraphNode;
/**
* Destroy the graphics and its children, and remove them from the scene.
*/
clearGraphics(): void;
/**
* Initialize the link (line and arrow), and add them to the scene.
*/
initGraphics(): void;
/**
* Render the link.
*/
render(): void;
}
/**
* Represents a node in the graph view.
*
* @public
* @unofficial
*/
export interface GraphNode {
/** PixiJS element for the circle, child of `GraphRenderer.hanger`. */
circle: Graphics | null;
/** Computed color for the node. */
color: GraphColorAttributes;
/** @todo Documentation incomplete. */
fadeAlpha: number;
/** Indicates if the text needs to be re-rendered when the node is rendered. */
fontDirty: boolean;
/** Record of forward links. Keys are the id of the neighbor nodes. */
forward: Record<string, GraphLink>;
/** Forced x position when the node is dragged. */
fx: number | null;
/** Forced y position when the node is dragged. */
fy: number | null;
/** Colored circle added if the node is highlighted, child of `GraphNode.circle`. */
highlight: Graphics | null;
/** ID of the node (path, tag, or name for non-existing files). */
id: string;
/** Displacement of the text, changed when the node is hovered */
moveText: number;
/** @todo Documentation incomplete. */
rendered: boolean;
/** `GraphRenderer` managing this node */
renderer: GraphRenderer;
/** Record of backward links. Keys are the id of the neighbor nodes. */
reverse: Record<string, GraphLink>;
/** PixiJS element for the name, child of `GraphNode.circle`. */
text: Text$1 | null;
/** Type of the node, can be of value `"tag"`, `"unresolved"`, `"attachment"`, or an empty string for markdown nodes. */
type: string;
/** Weight of the node depending on the number of related nodes (forwards and backward). */
weight: number;
/** X-axis position of the node in the graph */
x: number;
/** Y-axis position of the node in the graph */
y: number;
/**
* Destroy the graphics and its children, and remove them from the scene.
*/
clearGraphics(): void;
/**
* Get the displayed text associated to the node.
* @returns The displayed text of the node.
*/
getDisplayText(): string;
/**
* Get the current fill color.
* @returns The color of the node.
*/
getFillColor(): GraphColorAttributes;
/**
* Get the ids of connected nodes (back and forward links).
* @returns An array of string ids of connected nodes.
*/
getRelated(): string[];
/**
* Get the current size of the node, after weight and node size multiplier have been applied.
* @returns The size of the node.
*/
getSize(): number;
/**
* Get the text style of the node.
*
* @returns The text style of the node.
*/
getTextStyle(): TextStyle;
/**
* Initialize the node, text, listeners, and add them to the scene.
*/
initGraphics(): void;
/**
* Method called when the node (circle) is clicked, trigger the context menu if it's a right click
*/
onClick(e: MouseEvent): void;
/**
* Render the node.
*/
render(): void;
}
/**
* Node data, used before the rendering process.
*
* @public
* @unofficial
*/
export interface GraphNodeData {
/** Color of the node if it is part of a group */
color?: GraphColorAttributes;
/** Record of forward neighbor nodes. */
links: Record<string, boolean>;
/** Type of the node, can be of value `"tag"`, `"unresolved"`, `"attachment"`, or an empty string for markdown nodes. */
type: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphOptions extends TreeCollapsibleItem {
/** @todo Documentation incomplete. */
getOptions(e: unknown): unknown;
/** @todo Documentation incomplete. */
setOptions(e: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphPlugin extends InternalPlugin<GraphPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphPluginInstance extends InternalPluginInstance<GraphPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
options: GraphPluginInstanceOptions;
/** @todo Documentation incomplete. */
plugin: GraphPlugin;
/** @todo Documentation incomplete. */
onExternalSettingsChange(): Promise<void>;
/** @todo Documentation incomplete. */
onFileMenu(menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf): void;
/** @todo Documentation incomplete. */
openGraphView(newLeaf: boolean): void;
/** @todo Documentation incomplete. */
openLocalGraph(checking: boolean): true | undefined;
/**
* Saves the options in graph.json.
*/
saveOptions(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphPluginInstanceOptions {
/** @todo Documentation incomplete. */
"collapse-color-groups"?: boolean;
/** @todo Documentation incomplete. */
"collapse-display"?: boolean;
/** @todo Documentation incomplete. */
"collapse-filter"?: boolean;
/** @todo Documentation incomplete. */
"collapse-forces"?: boolean;
/** @todo Documentation incomplete. */
centerStrength?: number;
/** @todo Documentation incomplete. */
close?: boolean;
/** @todo Documentation incomplete. */
colorGroups?: GraphColorGroup[];
/** @todo Documentation incomplete. */
hideUnresolved?: boolean;
/** @todo Documentation incomplete. */
lineSizeMultiplier?: number;
/** @todo Documentation incomplete. */
linkDistance?: number;
/** @todo Documentation incomplete. */
linkStrength?: number;
/** @todo Documentation incomplete. */
localBacklinks?: boolean;
/** @todo Documentation incomplete. */
localForelinks?: boolean;
/** @todo Documentation incomplete. */
localInterlinks?: boolean;
/** @todo Documentation incomplete. */
localJumps?: number;
/** @todo Documentation incomplete. */
nodeSizeMultiplier?: number;
/** @todo Documentation incomplete. */
repelStrength?: number;
/** @todo Documentation incomplete. */
scale?: number;
/** @todo Documentation incomplete. */
search?: string;
/** @todo Documentation incomplete. */
showArrow?: boolean;
/** @todo Documentation incomplete. */
showAttachments?: boolean;
/** @todo Documentation incomplete. */
showOrphans?: boolean;
/** @todo Documentation incomplete. */
showTags?: boolean;
/** @todo Documentation incomplete. */
textFadeMultiplier?: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphRenderer {
/** General colors of the elements in the graph view, computed from the app CSS. */
colors: Record<GraphColor, GraphColorAttributes>;
/** `<div>` element containing the graph, with class `.view-content`. */
containerEl: HTMLDivElement;
/** Node currently being dragged, if any. */
dragNode: GraphNode | null;
/** Factor for the thickness of the links. */
fLineSizeMult: number;
/** Factor for the size of the nodes. */
fNodeSizeMult: number;
/** Indicates if arrows should be displayed. */
fShowArrow: boolean;
/** Text fade threshold. */
fTextShowMult: number;
/** Main container to which nodes, links and arrows are added. */
hanger: Container;
/** Height of the graph view, in pixel. */
height: number;
/** @todo Documentation incomplete. */
hidePowerTag: boolean;
/** Node currently being highlighted, if any. */
highlightNode: GraphNode | null;
/** Number of idle frames. The simulation stops running at 60. */
idleFrames: number;
/** `<iframe>` element in which the graph is rendered. */
iframeEl: HTMLIFrameElement;
/** `<canvas>` element bound to the event system of `GraphRenderer.px` to capture events. */
interactiveEl: HTMLCanvasElement;
/** @todo Documentation incomplete. */
keyboardActions: KeyboardActions;
/** List of links currently rendered. */
links: GraphLink[];
/** Mouse x coordinate in the graph view. */
mouseX: number | null;
/** Mouse y coordinate in the graph view. */
mouseY: number | null;
/** Record of the nodes currently rendered, with `GraphNode.id` used as key. */
nodeLookup: Record<string, GraphNode>;
/** List of nodes currently rendered. */
nodes: GraphNode[];
/** Scale of the nodes based on the zoom level of the graph view. */
nodeScale: number;
/** @todo Documentation incomplete. */
panning: boolean;
/** @todo Documentation incomplete. */
panvX: number;
/** @todo Documentation incomplete. */
panvY: number;
/** @todo Documentation incomplete. */
panX: number;
/** @todo Documentation incomplete. */
panY: number;
/** @todo Documentation incomplete. */
powerTag: PowerTag;
/** PixiJS application rendering everything. */
px: Application;
/** Timer (request ID) associated to the requestAnimationFrame rendering the graph. */
renderTimer: null | number;
/** Current zoom level of the graph view, interpolated between the previous one and the `targetScale`. */
scale: number;
/** Target zoom level of the graph view. */
targetScale: number;
/** Current alpha of the nodes names based on the graph scale. */
textAlpha: number;
/** @todo Documentation incomplete. */
viewport: Coords;
/** Width of the graph view, in pixel. */
width: number;
/** Web Worker thread running the graph simulation. */
worker: Worker;
/** @todo Documentation incomplete. */
workerResults: WorkerResults;
/** X coordinate of the zoom action. */
zoomCenterX: number;
/** Y coordinate of the zoom action. */
zoomCenterY: number;
/**
* Specify that the renderer has changed and needs to be rendered again.
*/
changed(): void;
/** @todo Documentation incomplete. */
destroy(): void;
/** Destroy all the graphics of the graph. */
destroyGraphics(): void;
/** @todo Documentation incomplete. */
getBackgroundScreenshot(): HTMLCanvasElement;
/** Returns the currently highlighted node, if any. */
getHighlightNode(): GraphNode | null;
/** @todo Documentation incomplete. */
getTransparentScreenshot(): ICanvas;
/** Initialize all the graphics of the graph. */
initGraphics(): void;
/** @todo Documentation incomplete. */
onIframeLoad(): void;
/** @todo Documentation incomplete. */
onIframeUnload(): void;
/** @todo Documentation incomplete. */
onMouseMove(evt: MouseEvent): void;
/** @todo Documentation incomplete. */
onNodeClick(evt: MouseEvent, id: string, type: string): void;
/** @todo Documentation incomplete. */
onNodeHover(evt: MouseEvent, id: string, type: string): void;
/** @todo Documentation incomplete. */
onNodeRightClick(evt: MouseEvent, id: string, type: string): void;
/** @todo Documentation incomplete. */
onNodeUnhover(): void;
/** @todo Documentation incomplete. */
onPointerDown(renderer: GraphRenderer, evt: PointerEvent): void;
/** @todo Documentation incomplete. */
onPointerOut(): void;
/** @todo Documentation incomplete. */
onPointerOver(renderer: GraphRenderer, evt: PointerEvent): void;
/** @todo Documentation incomplete. */
onResize(): void;
/** @todo Documentation incomplete. */
onWheel(evt: WheelEvent): void;
/** @todo Documentation incomplete. */
queueRender(): void;
/** @todo Documentation incomplete. */
renderCallback(): void;
/** @todo Documentation incomplete. */
resetPan(): void;
/** @todo Documentation incomplete. */
setData(data: GraphData): void;
/** @todo Documentation incomplete. */
setForces(forces: GraphForces): void;
/** @todo Documentation incomplete. */
setPan(panX: number, panY: number): void;
/** @todo Documentation incomplete. */
setRenderOptions(options: GraphPluginInstanceOptions): void;
/** @todo Documentation incomplete. */
setScale(scale: number): void;
/** @todo Documentation incomplete. */
testCSS(): void;
/** @todo Documentation incomplete. */
updateZoom(): void;
/** @todo Documentation incomplete. */
zoomTo(scale: number, pointer: Pointer): void;
}
/**
* Obsidian view for a global graph.
*
* @public
* @unofficial
*/
export interface GraphView extends ItemView {
/** @todo Documentation incomplete. */
dataEngine: GraphEngine;
/** @todo Documentation incomplete. */
renderer: GraphRenderer;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Graph;
/**
* Updates the options from the plugin when changed in view.
*/
onOptionsChange(): void;
/**
* Renders the graph.
*/
update(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GraphViewConstructor extends TypedViewConstructor<GraphView> {
}
/**
* Function `Greater`.
* @public
* @unofficial
*/
export interface GreaterFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Function `GreaterOrEqual`.
* @public
* @unofficial
*/
export interface GreaterOrEqualFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface GroupBookmarkItem extends BookmarkItem {
/** @todo Documentation incomplete. */
items: BookmarkItem[];
/** @todo Documentation incomplete. */
title: string;
/** @todo Documentation incomplete. */
type: "group";
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface HardWrapOptions {
/** @todo Documentation incomplete. */
allowMerge?: boolean;
/** @todo Documentation incomplete. */
column?: number;
/** @todo Documentation incomplete. */
from?: number;
/** @todo Documentation incomplete. */
to?: number;
}
/**
* Has compare.
*
* @public
* @unofficial
*/
export interface HasCompare {
/**
* Compares two values.
*/
compare(a: unknown, b: unknown): boolean;
}
/**
* Has extract.
*
* @public
* @unofficial
*/
export interface HasExtract {
/**
* Extracts a date.
*/
extract(date: Date): number;
}
/**
* Has get display name.
*
* @public
* @unofficial
*/
export interface HasGetDisplayName {
/**
* Gets the display name.
*/
getDisplayName(type: string): string;
}
/**
* Has get RHS widget type.
*
* @public
* @unofficial
*/
export interface HasGetRHSWidgetType {
/**
* Gets the RHS widget type.
*/
getRHSWidgetType(type: string): string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface HeaderDom {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
navButtonsEl: HTMLDivElement;
/** @todo Documentation incomplete. */
navHeaderEl: HTMLDivElement;
/** @todo Documentation incomplete. */
addNavButton(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown;
/** @todo Documentation incomplete. */
addSortButton(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface HeadingInfo {
/** @todo Documentation incomplete. */
end: EditorPosition;
/** @todo Documentation incomplete. */
heading: string;
/** @todo Documentation incomplete. */
start: EditorPosition;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface HotkeyManager {
/**
* Reference to App.
*/
app: App;
/**
* Whether hotkeys have been baked (checks completed).
*/
baked: boolean;
/**
* Assigned hotkeys.
*/
bakedHotkeys: KeymapInfo[];
/**
* Array of hotkey index to command ID.
*/
bakedIds: string[];
/**
* Custom (non-Obsidian default) hotkeys, one to many mapping of command ID to assigned hotkey.
*/
customKeys: HotkeyManagerCustomKeysRecord;
/**
* Default hotkeys, one to many mapping of command ID to assigned hotkey.
*/
defaultKeys: HotkeyManagerDefaultKeysRecord;
/** @todo Documentation incomplete. */
onConfigFileChange: Debouncer<[
], Promise<void>>;
/**
* Add a hotkey to the default hotkeys.
*
* @param command - Command ID to add hotkey to.
* @param keys - Hotkeys to add.
*/
addDefaultHotkeys(command: string, keys: KeymapInfo[]): void;
/**
* Bake hotkeys (create mapping of pressed key to command ID).
*/
bake(): void;
/**
* Get hotkey associated with command ID.
*
* @param command - Command ID to get hotkey for.
*/
getDefaultHotkeys(command: string): KeymapInfo[];
/**
* Get hotkey associated with command ID.
*
* @param command - Command ID to get hotkey for.
*/
getHotkeys(command: string): KeymapInfo[];
/**
* Load hotkeys from storage.
*/
load(): void;
/** @todo Documentation incomplete. */
onRaw(e: unknown): void;
/**
* Trigger a command by keyboard event.
*
* @param event - Keyboard event to trigger command with.
* @param keypress - Pressed key information.
*/
onTrigger(event: KeyboardEvent, keypress: KeymapInfo): boolean;
/**
* Pretty-print hotkey of a command.
*
* @param commandId - Command ID to print hotkey for.
*/
printHotkeyForCommand(commandId: string): string;
/** @todo Documentation incomplete. */
registerListeners(): void;
/**
* Remove a hotkey from the default hotkeys.
*
* @param command - Command ID to remove hotkey from.
*/
removeDefaultHotkeys(command: string): void;
/**
* Remove a hotkey from the custom hotkeys.
*
* @param command - Command ID to remove hotkey from.
*/
removeHotkeys(command: string): void;
/**
* Save custom hotkeys to storage.
*/
save(): void;
/**
* Add a hotkey to the custom hotkeys (overrides default hotkeys).
*
* @param command - Command ID to add hotkey to.
* @param keys - Hotkeys to add.
*/
setHotkeys(command: string, keys: KeymapInfo[]): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface HotkeyManagerCustomKeysRecord extends Record<string, KeymapInfo[]> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface HotkeyManagerDefaultKeysRecord extends Record<string, KeymapInfo[]> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface HotkeysSettingTab extends SettingTab {
/** @todo Documentation incomplete. */
searchComponent: SearchComponent;
/** @todo Documentation incomplete. */
updateHotkeyVisibility(): void;
}
/**
* Function `Hour`.
* @public
* @unofficial
*/
export interface HourFunction extends BasesFunction, HasExtract {
}
/**
* Event triggered when a link is hovered.
*
* @public
* @unofficial
*/
export interface HoverLinkEvent {
/**
* The mouse event.
*/
event: MouseEvent;
/**
* The hover parent.
*/
hoverParent: HoverParent;
/**
* The link text.
*/
linktext: string;
/**
* The source of the event.
*/
source: "search" | "editor" | "preview" | "properties" | "graph" | "file-explorer" | "hover-link";
/**
* The source path.
*/
sourcePath?: string;
/**
* The state of the event.
*/
state?: HoverLinkEventState;
/**
* The target element.
*/
targetEl: HTMLElement | null;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface HoverLinkEventState {
/** @todo Documentation incomplete. */
scroll: unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface IFramedMarkdownEditor extends MarkdownScrollableEditView {
/**
* Function that cleans up the iframe and listeners.
*/
cleanup: null | (() => void);
/**
* Element where the editor is embedded into.
*/
iframeEl: null | HTMLIFrameElement;
/**
* Executes cleanup function if exists.
*/
cleanupIframe(): void;
/**
* Constructs extensions for the editor based on user settings.
*
* @remark Creates extension for overriding escape keymap to showPreview.
*/
getDynamicExtensions(): Extension[];
/**
* Loads the iframe element and prepare cleanup function.
*/
onIframeLoad(): void;
/**
* Execute cleanup of the iframe.
*/
onunload(): void;
/**
* Execute functionality on CM editor state update.
*/
onUpdate(update: ViewUpdate, changed: boolean): void;
}
/**
* Function `If`.
* @public
* @unofficial
*/
export interface IfFunction extends BasesFunction {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ImageView extends EditableFileView {
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Image;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ImageViewConstructor extends TypedViewConstructor<ImageView> {
}
/**
* Imported attachment.
*
* @public
* @unofficial
*/
export interface ImportedAttachment {
/** Promise that resolves to the attachment file content. */
data: Promise<ArrayBuffer>;
/** An attachment file extension. */
extension: string;
/** An attachment file path. */
filepath: string;
/** An attachment file name. */
name: string;
}
/**
* Function `InFolder`.
* @public
* @unofficial
*/
export interface InFolderFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* Function `Index`.
* @public
* @unofficial
*/
export interface IndexFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface InfinityScroll {
/** @todo Documentation incomplete. */
height: number;
/** @todo Documentation incomplete. */
lastScroll: number;
/** @todo Documentation incomplete. */
queued: unknown | null;
/** @todo Documentation incomplete. */
renderBlockSize: number;
/** @todo Documentation incomplete. */
rootEl: unknown;
/** @todo Documentation incomplete. */
scrollEl: HTMLElement;
/** @todo Documentation incomplete. */
setWidth: boolean;
/** @todo Documentation incomplete. */
width: number;
/** @todo Documentation incomplete. */
_layout(x: unknown, y: unknown): unknown;
/** @todo Documentation incomplete. */
_measure(x: unknown): unknown;
/** @todo Documentation incomplete. */
_precompute(x: unknown): unknown;
/** @todo Documentation incomplete. */
compute(x: unknown): unknown;
/** @todo Documentation incomplete. */
findElementTop(x: unknown, y: unknown, z: unknown): unknown;
/** @todo Documentation incomplete. */
getRootTop(): unknown;
/** @todo Documentation incomplete. */
invalidate(x: unknown, y: unknown): unknown;
/** @todo Documentation incomplete. */
invalidateAll(): unknown;
/** @todo Documentation incomplete. */
measure(x: unknown, y: unknown): unknown;
/** @todo Documentation incomplete. */
onResize(): unknown;
/** @todo Documentation incomplete. */
onScroll(): unknown;
/** @todo Documentation incomplete. */
queueCompute(): unknown;
/** @todo Documentation incomplete. */
scrollIntoView(x: unknown, y: unknown): unknown;
/** @todo Documentation incomplete. */
update(x: unknown, y: unknown, z: unknown, u: unknown, v: unknown, w: unknown): unknown;
/** @todo Documentation incomplete. */
updateVirtualDisplay(x: unknown): unknown;
}
/**
* Info file view.
*
* @remark This is probably not the right term.
* @public
* @unofficial
*/
export interface InfoFileView extends FileView {
/**
* Called when a file is opened. Loads the file and requests a content update.
*
* @param file - The opened file.
*/
onFileOpen(file: TFile): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface InstallThemeOptions {
/** @todo Documentation incomplete. */
author: string;
/** @todo Documentation incomplete. */
name: string;
/** @todo Documentation incomplete. */
repo: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface InternalPlugin<InternalPluginInstance> extends Component {
/** @todo Documentation incomplete. */
addedButtonEls: HTMLDivElement[];
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
commands: Command[];
/** @todo Documentation incomplete. */
enabled: boolean;
/** @todo Documentation incomplete. */
hasStatusBarItem: boolean;
/** @todo Documentation incomplete. */
instance: InternalPluginInstance;
/** @todo Documentation incomplete. */
lastSave: number;
/** @todo Documentation incomplete. */
manager: InternalPlugins;
/** @todo Documentation incomplete. */
mobileFileInfo: MobileFileInfo[];
/** @todo Documentation incomplete. */
onConfigFileChange: Debouncer<[
], Promise<void>>;
/** @todo Documentation incomplete. */
ribbonItems: RibbonItem[];
/** @todo Documentation incomplete. */
statusBarEl: HTMLDivElement | null;
/** @todo Documentation incomplete. */
views: Record<string, ViewCreator>;
/** @todo Documentation incomplete. */
addSettingTab(settingTab: PluginSettingTab): void;
/** @todo Documentation incomplete. */
deleteData(): Promise<void>;
/** @todo Documentation incomplete. */
disable(isDisabledByUser?: boolean): void;
/** @todo Documentation incomplete. */
enable(isEnabledByUser?: boolean): Promise<void>;
/** @todo Documentation incomplete. */
getModifiedTime(): Promise<number | undefined>;
/** @todo Documentation incomplete. */
handleConfigFileChange(): Promise<void>;
/** @todo Documentation incomplete. */
init(): void;
/** @todo Documentation incomplete. */
loadData(): Promise<object | null>;
/** @todo Documentation incomplete. */
registerGlobalCommand(command: Command): void;
/** @todo Documentation incomplete. */
registerMobileFileInfo(renderCallback: (el: HTMLElement) => void): void;
/** @todo Documentation incomplete. */
registerRibbonItem(title: string, icon: IconName, callback: () => Promise<void>): void;
/** @todo Documentation incomplete. */
registerStatusBarItem(): void;
/** @todo Documentation incomplete. */
registerViewType(type: string, creator: ViewCreator): void;
/** @todo Documentation incomplete. */
saveData(data: object): Promise<void>;
}
/**
* The InternalPlugin constructor.
*
* @public
* @unofficial
*/
export interface InternalPluginConstructor<Instance> extends ConstructorBase<[
app: App,
instance: Instance,
internalPlugins: InternalPlugins
], InternalPlugin<Instance>> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface InternalPluginInstance<InternalPlugin> {
/** @todo Documentation incomplete. */
description: string;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
name: string;
/** @todo Documentation incomplete. */
init(app: App, plugin: InternalPlugin): void;
/** @todo Documentation incomplete. */
onDisable?(app: App, plugin: InternalPlugin): void;
/** @todo Documentation incomplete. */
onEnable?(app: App, plugin: InternalPlugin): Promise<void>;
/** @todo Documentation incomplete. */
onUserDisable?(app: App): void;
/** @todo Documentation incomplete. */
onUserEnable?(app: App): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface InternalPlugins extends Events {
/**
* Reference to App.
*/
app: App;
/**
* Mapping of whether an internal plugin is enabled.
*/
config: InternalPluginsConfigRecord;
/**
* Plugin configs for internal plugins.
*
* @remark Prefer usage of getPluginById to access a plugin.
*/
plugins: InternalPluginNamePluginsMapping;
/**
* Request save of plugin configs.
*/
requestSaveConfig: Debouncer<[
], Promise<void>>;
/**
* - Load plugin configs and enable plugins.
*/
enable(): Promise<void>;
/**
* Get an enabled internal plugin by ID.
*
* @param id - ID of the plugin to get.
*/
getEnabledPluginById<ID extends InternalPluginNameType>(id: ID): InternalPluginNameInstancesMapping[ID] | null;
/**
* Get all enabled internal plugins.
*/
getEnabledPlugins(): InternalPlugin<unknown>[];
/**
* Get an internal plugin by ID.
*
* @param id - ID of the plugin to get.
*/
getPluginById<ID extends InternalPluginNameType>(id: ID): InternalPluginNamePluginsMapping[ID] | null;
/** @todo Documentation incomplete. */
loadPlugin<Instance extends InternalPluginInstance<unknown>>(internalPluginInstance: Instance): Instance;
/** @todo Documentation incomplete. */
onRaw(configPath: string): void;
/**
* - Save current plugin configs.
*/
saveConfig(): Promise<void>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface InternalPluginsConfigRecord extends Record<InternalPluginNameType, boolean> {
}
/**
* The InternalPlugins constructor.
*
* @public
* @unofficial
*/
export interface InternalPluginsConstructor extends ConstructorBase<[
app: App
], InternalPlugins> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ItemQueue<T> {
/** @todo Documentation incomplete. */
items: ItemQueueItems<T>;
/** @todo Documentation incomplete. */
promise: PromiseWithResolvers<T> | null;
/** @todo Documentation incomplete. */
runnable: Runnable;
/** @todo Documentation incomplete. */
add(item: T): void;
/** @todo Documentation incomplete. */
addList(items: T[]): void;
/** @todo Documentation incomplete. */
cancel(): void;
/** @todo Documentation incomplete. */
clear(): void;
/** @todo Documentation incomplete. */
generator(): AsyncGenerator<T>;
/** @todo Documentation incomplete. */
notify(): void;
/** @todo Documentation incomplete. */
remove(item: T): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ItemQueueItems<T> {
/** @todo Documentation incomplete. */
length: number;
/** @todo Documentation incomplete. */
offset: number;
/** @todo Documentation incomplete. */
queue: T[];
/** @todo Documentation incomplete. */
clear(): void;
/** @todo Documentation incomplete. */
dequeue(): T | undefined;
/** @todo Documentation incomplete. */
enqueue(item: T): void;
/** @todo Documentation incomplete. */
enqueueArray(items: T[]): void;
/** @todo Documentation incomplete. */
get(): T[];
/** @todo Documentation incomplete. */
isEmpty(): boolean;
/** @todo Documentation incomplete. */
peek(): T | undefined;
/** @todo Documentation incomplete. */
remove(item: T): void;
}
/**
* Function `Join`.
* @public
* @unofficial
*/
export interface JoinFunction extends BasesFunction {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface KeyScope {
/**
* Key to match.
*/
key: string | null;
/**
* Modifiers to match.
*/
modifiers: string | null;
/**
* Scope where the key interceptor is registered.
*/
scope: Scope;
/**
* Callback of function to execute when key is pressed.
*/
func(): void;
}
/**
* Keyboard actions.
*
* @public
* @unofficial
*/
export interface KeyboardActions {
/** @todo Documentation incomplete. */
down?: boolean;
/** @todo Documentation incomplete. */
left?: boolean;
/** @todo Documentation incomplete. */
right?: boolean;
/** @todo Documentation incomplete. */
shift?: boolean;
/** @todo Documentation incomplete. */
up?: boolean;
/** @todo Documentation incomplete. */
zoomin?: boolean;
/** @todo Documentation incomplete. */
zoomout?: boolean;
}
/**
* @see https://github.com/codemirror/language/blob/main/src/language.ts
* @todo Documentation incomplete.
* @unofficial
* @public
*/
export interface LanguageState {
/**
* A mutable parse state that is used to preserve work done during
* the lifetime of a state when moving to the next state.
*/
context: ParseContext;
/**
* The current tree. Immutable, because directly accessible from the editor state.
*/
tree: LezerTree;
/** @todo Documentation incomplete. */
apply(tr: Transaction): LanguageState;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LeafEntry {
/** @todo Documentation incomplete. */
children?: LeafEntry[];
/** @todo Documentation incomplete. */
direction?: SplitDirection;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
state?: ViewState;
/** @todo Documentation incomplete. */
type: string;
/** @todo Documentation incomplete. */
width?: number;
}
/**
* Function `Len`.
* @public
* @unofficial
*/
export interface LenFunction extends BasesFunction {
}
/**
* Function `Less`.
* @public
* @unofficial
*/
export interface LessFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Function `LessOrEqual`.
* @public
* @unofficial
*/
export interface LessOrEqualFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LineHandle {
/** @todo Documentation incomplete. */
index: number;
/** @todo Documentation incomplete. */
row: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LineHandleChange {
/** @todo Documentation incomplete. */
changes: ChangeDesc;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LinkChangeUpdate {
/** @todo Documentation incomplete. */
change: string;
/** @todo Documentation incomplete. */
reference: ReferenceCache;
/** @todo Documentation incomplete. */
sourcePath: string;
}
/**
* @public
* @unofficial
* Suggestion for a link to a file.
*/
export interface LinkSuggestion {
/**
* Resolved link note alias.
*/
alias?: string;
/**
* File that is suggested. `null` if the link cannot be resolved.
*/
file: TFile | null;
/**
* Path to the file if the link can be resolved.
* Link text if the link cannot be resolved.
*/
path: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LinkUpdate {
/**
* Link position in the file.
*/
reference: PositionedReference;
/**
* File that was resolved.
*/
resolvedFile: TFile;
/**
* Paths the file could have been resolved to.
*/
resolvedPaths: string[];
/**
* File that contains the link.
*/
sourceFile: TFile;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LinkUpdater {
/** @todo Documentation incomplete. */
applyUpdates(file: TFile, updates: LinkChangeUpdate[]): Promise<void>;
/** @todo Documentation incomplete. */
iterateReferences(callback: (path: string, reference: ReferenceCache) => void): void;
/** @todo Documentation incomplete. */
renameSubpath(file: TFile, oldSubpath: string, newSubpath: string): Promise<void>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LinkUpdaters extends Record<string, LinkUpdater> {
/** @todo Documentation incomplete. */
canvas?: CanvasLinkUpdater;
}
/**
* Function `LinksTo`.
* @public
* @unofficial
*/
export interface LinksToFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LoadProgress {
}
/**
* Obsidian view for a local graph.
*
* @public
* @unofficial
*/
export interface LocalGraphView extends InfoFileView {
/** @todo Documentation incomplete. */
engine: GraphEngine;
/** @todo Documentation incomplete. */
renderer: GraphRenderer;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.LocalGraph;
/**
* Requests a update if the changed file is the opened file.
*
* @param file - The changed file.
*/
onFileChanged(file: TFile): void;
/**
* Updates the options from the plugin when changed in view.
*/
onOptionsChange(): void;
/**
* Renders the graph.
*/
update(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface LocalGraphViewConstructor extends TypedViewConstructor<LocalGraphView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Localization {
/** @todo Documentation incomplete. */
[key: string]: string | Localization;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MapOfSets<Key, Value> {
/** @todo Documentation incomplete. */
data: Map<Key, Set<Value>>;
/** @todo Documentation incomplete. */
add(key: Key, value: Value): void;
/** @todo Documentation incomplete. */
delete(key: Key, value: Value): void;
/** @todo Documentation incomplete. */
get(key: Key): Set<Value> | null;
/** @todo Documentation incomplete. */
getArray(key: Key): Value[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownBaseView extends Component {
/**
* Reference to the app.
*/
app: App;
/**
* Callback to clear all elements.
*/
cleanupLivePreview: null | (() => void);
/**
* Manager that handles pasting text, html and images into the editor.
*/
clipboardManager: ClipboardManager;
/**
* Codemirror editor instance.
*/
cm: EditorView;
/**
* Whether CodeMirror is initialized.
*/
cmInit: boolean;
/**
* Container element of the editor view.
*/
containerEl: HTMLElement;
/**
* Popup element for internal link.
*/
cursorPopupEl: HTMLElement | null;
/**
* Obsidian editor instance.
*
* @remark Handles formatting, table creation, highlight adding, etc.
*/
editor?: Editor;
/**
* Element in which the CodeMirror editor resides.
*/
editorEl: HTMLElement;
/**
* Editor suggester for autocompleting files, links, aliases, etc.
*/
editorSuggest: EditorSuggests;
/**
* The CodeMirror plugins that handle the rendering of, and interaction with Obsidian's Markdown.
*/
livePreviewPlugin: Extension[];
/**
* Local (always active) extensions for the editor.
*/
localExtensions: Extension[];
/**
* Controller of the editor view.
*/
owner: MarkdownFileInfo;
/**
* Whether live preview rendering is disabled.
*/
sourceMode: boolean;
/**
* Reference to editor attached to table cell, if any.
*/
tableCell: null | TableCellEditor;
/**
* Currently active CM instance (table cell CM or main CM).
*/
get activeCM(): EditorView;
/**
* Returns attached file of the owner instance.
*/
get file(): TFile | null;
/**
* Returns path of the attached file.
*/
get path(): string;
/**
* Apply fold history to editor.
*/
applyFoldInfo(info: FoldInfo): void;
/**
* Constructs local (always active) extensions for the editor.
*
* @remark Creates extensions for handling dom events, editor info state fields, update listener, suggestions.
*/
buildLocalExtensions(): Extension[];
/**
* Cleanup live preview, remove and then re-add all editor extensions.
*/
clear(): void;
/**
* Clean up live preview, remove all extensions, destroy editor.
*/
destroy(): void;
/**
* Removes specified tablecell.
*/
destroyTableCell(cell?: TableCellEditor): void;
/**
* Edit a specified table cell, creating a table cell editor.
*/
editTableCell(cell: TableEditor, new_cell: TableCell): TableCellEditor;
/**
* Get the current editor document as a string.
*/
get(): string;
/**
* Constructs extensions for the editor based on user settings.
*
* @remark Creates extension for tab size, RTL rendering, spellchecking, pairing markdown syntax, live preview and vim.
*/
getDynamicExtensions(): Extension[];
/**
* Get the current folds of the editor.
*/
getFoldInfo(): null | FoldInfo;
/**
* Builds all local extensions and assigns to this.localExtensions.
*
* @remark Will build extensions if they were not already built.
*/
getLocalExtensions(): unknown;
/**
* Creates menu on right mouse click.
*/
onContextMenu(event: PointerEvent, x: boolean): Promise<void>;
/**
* Execute click functionality on token on mouse click.
*/
onEditorClick(event: MouseEvent, element?: HTMLElement): void;
/**
* Execute drag functionality on drag start.
*
* @remark Interfaces with dragManager.
*/
onEditorDragStart(event: DragEvent): void;
/**
* Execute hover functionality on mouse over event.
*/
onEditorLinkMouseover(event: MouseEvent, target: HTMLElement): void;
/**
* Execute context menu functionality on right mouse click.
*
* @deprecated Use {@link MarkdownBaseView.onContextMenu} instead.
*/
onMenu(event: MouseEvent): void;
/**
* Reposition suggest and scroll position on resize.
*/
onResize(): void;
/**
* Execute functionality on CM editor state update.
*/
onUpdate(update: ViewUpdate, changed: boolean): void;
/**
* Reinitialize the editor inside new container.
*/
reinit(): void;
/**
* Move the editor into the new container.
*/
reparent(new_container: HTMLElement): void;
/**
* Bodge to reset the syntax highlighting.
*
* @remark Uses single-character replacement transaction.
*/
resetSyntaxHighlighting(): void;
/**
* Save history of file and data (for caching, for faster reopening of same file in editor).
*/
saveHistory(): void;
/**
* Set the state of the editor.
*/
set(data: string, clear: boolean): void;
/**
* Enables/disables frontmatter folding.
*/
toggleFoldFrontmatter(): void;
/**
* Toggle source mode for editor and dispatch effect.
*/
toggleSource(): void;
/**
* Execute functionality of token (open external link, open internal link in leaf, ...).
*/
triggerClickableToken(token: Token, new_leaf: boolean): void;
/**
* Callback for onUpdate functionality added as an extension.
*/
updateEvent(): (update: ViewUpdate) => void;
/**
* In mobile, creates a popover link on clickable token, if exists.
*/
updateLinkPopup(): void;
/**
* Reconfigure/re-add all the dynamic extensions.
*/
updateOptions(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownEditViewEphemeralState {
/** @todo Documentation incomplete. */
cursor: EditorRange;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownImporterPlugin extends InternalPlugin<MarkdownImporterPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownImporterPluginInstance extends InternalPluginInstance<MarkdownImporterPlugin> {
/** @todo Documentation incomplete. */
app: App;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownScrollableEditView extends MarkdownBaseView {
/**
* List of CSS classes applied to the editor.
*/
cssClasses: [
];
/**
* Whether the editor is currently scrolling.
*/
isScrolling: boolean;
/**
* Scope for the search component, if exists.
*/
scope: Scope | undefined;
/**
* Search component for the editor, provides highlight and search functionality.
*/
search: EditorSearchComponent;
/**
* Container for the editor, handles editor size.
*/
sizerEl: HTMLElement;
/**
* Set the scroll count of the editor scrollbar.
*/
applyScroll(scroll: number): void;
/**
* Constructs local (always active) extensions for the editor.
*
* @remark Creates extensions for list indentation, tab indentations.
*/
buildLocalExtensions(): Extension[];
/**
* Focus the editor (and for mobile: render keyboard).
*/
focus(): void;
/**
* Constructs extensions for the editor based on user settings.
*
* @remark Creates toggleable extensions for showing line numbers, indentation guides,.
* folding, brackets pairing and properties rendering.
*/
getDynamicExtensions(): Extension[];
/**
* Get the current scroll count of the editor scrollbar.
*/
getScroll(): number;
/**
* Invokes onMarkdownScroll on scroll.
*/
handleScroll(): void;
/**
* Hides the editor (sets display: none).
*/
hide(): void;
/**
* Clear editor cache and refreshes editor on app css change.
*/
onCssChange(): void;
/**
* Update editor size and bottom padding on resize.
*/
onResize(): void;
/**
* Update editor suggest position and invokes handleScroll on scroll.
*/
onScroll(): void;
/**
* Execute functionality on CM editor state update.
*/
onUpdate(update: ViewUpdate, changed: boolean): void;
/**
* Close editor suggest and removes highlights on click.
*/
onViewClick(event?: MouseEvent): void;
/**
* Add classes to the editor, functions as a toggle.
*/
setCssClass(classes: string[]): void;
/**
* Reveal the editor (sets display: block).
*/
show(): void;
/**
* Reveal the search (and replace) component.
*/
showSearch(replace: boolean): void;
/**
* Update the bottom padding of the CodeMirror contentdom.
*/
updateBottomPadding(height: number): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownViewConstructor extends TypedViewConstructor<MarkdownView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownViewEphemeralState extends Record<string, unknown> {
/** @todo Documentation incomplete. */
scroll: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownViewModes {
/** @todo Documentation incomplete. */
preview: MarkdownPreviewView;
/** @todo Documentation incomplete. */
source: MarkdownEditView;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MarkdownViewSourceMode {
/** @todo Documentation incomplete. */
cmEditor: unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MatchingBracket {
/** @todo Documentation incomplete. */
to?: EditorPosition;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MathJax {
/** @todo Documentation incomplete. */
config: unknown;
/** @todo Documentation incomplete. */
loader: unknown;
/** @todo Documentation incomplete. */
options: unknown;
/** @todo Documentation incomplete. */
version: string;
/** @todo Documentation incomplete. */
chtmlStylesheet(): HTMLStyleElement;
/** @todo Documentation incomplete. */
getMetricsFor(node: HTMLElement, display?: boolean): ExtendedMetrics;
/** @todo Documentation incomplete. */
tex2chtml(math: string, options?: Record<string, unknown>): HTMLElement;
/** @todo Documentation incomplete. */
tex2chtmlPromise(math: string, options?: Record<string, unknown>): Promise<HTMLElement>;
/** @todo Documentation incomplete. */
tex2mml(math: string, options?: Record<string, unknown>): string;
/** @todo Documentation incomplete. */
tex2mmlPromise(math: string, options?: Record<string, unknown>): Promise<string>;
/** @todo Documentation incomplete. */
texReset(): void;
/** @todo Documentation incomplete. */
typeset(elements?: unknown[] | null): void;
/** @todo Documentation incomplete. */
typesetClear(elements?: unknown[] | null): void;
/** @todo Documentation incomplete. */
typesetPromise(elements?: unknown[] | null): Promise<void>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MenuSubmenuConfigRecord extends Record<string, {
title: string;
icon: string;
}> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataCacheFileCacheRecord extends Record<string, FileCacheEntry> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataCacheMetadataCacheRecord extends Record<string, CachedMetadata> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataCacheWorkerMessage {
/** @todo Documentation incomplete. */
data: CachedMetadata;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataEditor extends Component {
/**
* Button element for adding a new property.
*/
addPropertyButtonEl: HTMLButtonElement;
/**
* Reference to the app.
*/
app: App;
/**
* Whether the frontmatter editor is collapsed.
*/
collapsed: boolean;
/**
* Container element for the metadata editor.
*/
containerEl: HTMLElement;
/**
* Element containing metadata table and addPropertyButton.
*/
contentEl: HTMLElement;
/**
* The currently focused property.
*/
focusedLine: null | MetadataEditorProperty;
/**
* Fold button for folding away the frontmatter editor on hovering over headingEl.
*/
foldEl: HTMLElement;
/**
* Heading element for the metadata editor.
*/
headingEl: HTMLElement;
/**
* Hover element container.
*/
hoverPopover: null | HoverPopover;
/**
* Owner of the metadata editor.
*/
owner: MarkdownView;
/**
* All properties existing in the metadata editor.
*/
properties: PropertyEntryData<unknown>[];
/**
* Element containing all property elements.
*/
propertyListEl: HTMLElement;
/**
* List of all property field editors.
*/
rendered: MetadataEditorProperty[];
/**
* Set of all selected property editors.
*/
selectedLines: Set<MetadataEditorProperty>;
/**
* Convert given properties to a serialized object and store in clipboard as obsidian/properties.
*/
_copyToClipboard(event: ClipboardEvent, properties: MetadataEditorProperty[]): void;
/**
* Uncollapse editor if collapsed and create a new property row.
*/
addProperty(): void;
/**
* Clear all properties.
*/
clear(): void;
/**
* Unselect all lines.
*/
clearSelection(): void;
/**
* Focus on property field with given key.
*/
focusKey(key: string): void;
/**
* Focus on property.
*/
focusProperty(property: MetadataEditorProperty): void;
/**
* Focus on property at specified index.
*/
focusPropertyAtIndex(index: number): void;
/**
* Focus on property with value.
*/
focusValue(value: string, mode: FocusMode): void;
/**
* Handle copy event on selection and serialize properties.
*/
handleCopy(event: ClipboardEvent): void;
/**
* Handle cut event and serialize and remove properties.
*/
handleCut(event: ClipboardEvent): void;
/**
* Handle selection of item for drag handling.
*/
handleItemSelection(event: PointerEvent, property: MetadataEditorProperty): boolean;
/**
* Handle key press event for controlling selection or movement of property up/down.
*/
handleKeypress(event: KeyboardEvent): void;
/**
* Handle paste event of properties into metadata editor.
*/
handlePaste(event: ClipboardEvent): void;
/**
* Whether the editor has focus.
*/
hasFocus(): boolean;
/**
* Whether there is a property that is focused.
*/
hasPropertyFocused(): boolean;
/**
* Add new properties to the metadata editor and save.
*/
insertProperties(properties: Record<string, any>): void;
/**
* On loading of the metadata editor, register on metadata type change event.
*/
onload(): void;
/**
* On vault metadata update, update property render.
*/
onMetadataTypeChange(property: MetadataEditorProperty): void;
/**
* Remove specified properties from the metadata editor and save, and reset focus if specified.
*/
removeProperties(properties: MetadataEditorProperty[], reset_focus?: boolean): unknown;
/**
* Reorder the entry to specified index position and save.
*/
reorderKey(entry: PropertyEntryData<unknown>, index: number): unknown;
/**
* Serialize the properties and save frontmatter.
*/
save(): void;
/**
* Select all property fields.
*/
selectAll(): void;
/**
* Mark specified property as selected.
*/
selectProperty(property: MetadataEditorProperty | undefined, select: boolean): void;
/**
* Convert properties to a serialized object.
*/
serialize(): Record<string, any>;
/**
* Sets frontmatter as collapsed or uncollapsed.
*/
setCollapse(collapsed: boolean, x: boolean): void;
/**
* On context menu event on header element, show property menu.
*/
showPropertiesMenu(event: MouseEvent): void;
/**
* Synchronize data with given properties and re-render them.
*/
synchronize(data: Record<string, any>): void;
/**
* Toggle collapsed state of the metadata editor.
*/
toggleCollapse(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataEditorProperty extends Component {
/**
* Reference to the app.
*/
app: App;
/**
* Container element for the metadata editor property.
*/
containerEl: HTMLElement;
/**
* Entry information for the property.
*/
entry: PropertyEntryData<unknown>;
/**
* Icon element of the property.
*/
iconEl: HTMLSpanElement;
/**
* Key value of the property.
*/
keyEl: HTMLElement;
/**
* Input field for key value of the property.
*/
keyInputEl: HTMLInputElement;
/**
* Metadata editor the property is attached to.
*/
metadataEditor: MetadataEditor;
/**
* Widget that handles user input for this property widget type.
*/
rendered: MetadataWidget | null;
/**
* Info about the inferred and expected property widget given key-value pair.
*/
typeInfo: MetadataEditorPropertyTypeInfo;
/**
* Element that contains the value input or widget.
*/
valueEl: HTMLElement;
/**
* Element containing the displayed warning on malformed property field.
*/
warningEl: HTMLElement;
/**
* Focus on the key input element.
*/
focusKey(): void;
/**
* Focus on the property (container element).
*/
focusProperty(): void;
/**
* Focus on the value input element.
*/
focusValue(mode?: FocusMode): void;
/**
* Reveal the property menu on click event.
*/
handleItemClick(event: MouseEvent): void;
/**
* Focus on property on blur event.
*/
handlePropertyBlur(): void;
/**
* Update key of property and saves, returns false if error.
*/
handleUpdateKey(key: string): boolean;
/**
* Update value of property and saves.
*/
handleUpdateValue(value: unknown): void;
/**
* Loads as draggable property element.
*/
onload(): void;
/**
* Render property widget based on type.
*/
renderProperty(entry: PropertyEntryData<unknown>, check_errors?: boolean, use_expected_type?: boolean): void;
/**
* Set the selected class of property.
*/
setSelected(selected: boolean): void;
/**
* Reveal property selection menu at mouse event.
*/
showPropertyMenu(event: MouseEvent): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataEditorPropertyTypeInfo {
/** @todo Documentation incomplete. */
expected: PropertyWidget;
/** @todo Documentation incomplete. */
inferred: PropertyWidget;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataTypeManager extends Events {
/**
* Reference to App.
*/
app: App;
/**
* Associated widget types for each property.
*/
assignedWidgets: MetadataTypeManagerTypesRecord;
/**
* Unix timestamp of the last save
*/
lastSave: number;
/** @todo Documentation incomplete. */
onConfigFileChange: Debouncer<[
], Promise<void>>;
/**
* Registered properties of the vault.
*/
properties: MetadataTypeManagerPropertiesRecord;
/**
* Registered type widgets.
*/
registeredTypeWidgets: MetadataTypeManagerRegisteredTypeWidgetsRecord;
/**
* Get all registered properties of the vault.
*/
getAllProperties(): Record<string, PropertyInfo>;
/**
* Get assigned widget type for property.
*/
getAssignedWidget(property: string): PropertyWidgetType | null;
/**
* Get info for property.
*/
getPropertyInfo(property: string): PropertyInfo;
/**
* Get expected widget type for property and the one inferred from the property value.
*/
getTypeInfo(property: string, value: unknown): TypeInfo;
/**
* Get property widget.
*/
getWidget(type: string): PropertyWidget;
/**
* Load property types from config.
*/
loadData(): Promise<void>;
/** @todo Documentation incomplete. */
onRaw(e: unknown): void;
/** @todo Documentation incomplete. */
registerListeners(): void;
/**
* Save property types to config.
*/
save(): Promise<void>;
/**
* Set widget type for property.
*/
setType(property: string, type: PropertyWidgetType): Promise<void>;
/**
* Unset widget type for property.
*/
unsetType(property: string): Promise<void>;
/**
* Updates `this.properties` to match the MetadataCache
*/
updatePropertyInfoCache(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataTypeManagerPropertiesRecord extends Record<string, PropertyInfo> {
}
/**
* Registered type widgets.
*
* @public
* @unofficial
*/
export interface MetadataTypeManagerRegisteredTypeWidgetsRecord extends Record<PropertyWidgetType, PropertyWidget> {
/** Property widget for aliases. */
aliases: PropertyWidget<AliasesPropertyWidgetComponent>;
/** Property widget for checkboxes. */
checkbox: PropertyWidget<CheckboxPropertyWidgetComponent>;
/** Property widget for dates. */
date: PropertyWidget<DatePropertyWidgetComponent>;
/** Property widget for datetimes. */
datetime: PropertyWidget<DatetimePropertyWidgetComponent>;
/** Property widget for files. */
file: PropertyWidget<FilePropertyWidgetComponent>;
/** Property widget for folders. */
folder: PropertyWidget<FolderPropertyWidgetComponent>;
/** Property widget for multitexts. */
multitext: PropertyWidget<MultitextPropertyWidgetComponent>;
/** Property widget for numbers. */
number: PropertyWidget<NumberPropertyWidgetComponent>;
/** Property widget for properties. */
property: PropertyWidget<PropertyPropertyWidgetComponent>;
/** Property widget for tags. */
tags: PropertyWidget<TagsPropertyWidgetComponent>;
/** Property widget for text. */
text: PropertyWidget<TextPropertyWidgetComponent>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataTypeManagerTypesRecord extends Record<string, PropertyWidgetEntry> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MetadataWidget {
}
/**
* Function `Min`.
* @public
* @unofficial
*/
export interface MinFunction extends BasesFunction {
}
/**
* Function `Minute`.
* @public
* @unofficial
*/
export interface MinuteFunction extends BasesFunction, HasExtract {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MobileFileInfo {
/** @todo Documentation incomplete. */
renderCallback(el: HTMLElement): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MobileNavbar {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MobileTabSwitcher {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
cacheDir: string;
/** @todo Documentation incomplete. */
containerEl: HTMLDivElement;
/** @todo Documentation incomplete. */
innerScrollEl: HTMLDivElement;
/** @todo Documentation incomplete. */
isVisible: boolean;
/** @todo Documentation incomplete. */
requestRender: Debouncer<[
], void>;
/** @todo Documentation incomplete. */
scrollEl: HTMLDivElement;
/** @todo Documentation incomplete. */
tabPreviewLookup: WeakMap<object, unknown>;
/** @todo Documentation incomplete. */
close(): void;
/** @todo Documentation incomplete. */
hide(): void;
/** @todo Documentation incomplete. */
onLayoutChange(): void;
/** @todo Documentation incomplete. */
render(): void;
/** @todo Documentation incomplete. */
setupCacheDir(): Promise<void>;
/** @todo Documentation incomplete. */
show(): Promise<void>;
/** @todo Documentation incomplete. */
showTabManagementMenu(e: MouseEvent): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface MobileToolbar {
}
/**
* Function `Month`.
* @public
* @unofficial
*/
export interface MonthFunction extends BasesFunction, HasExtract {
}
/**
* Multiselect component.
*
* @public
* @unofficial
*/
export interface Multiselect {
/** The elements of the multiselect. */
elements: HTMLDivElement[];
/** The input element of the multiselect. */
inputEl: HTMLDivElement;
/** The text of the input element of the multiselect. */
readonly inputText: string;
/** The root element of the multiselect. */
rootEl: HTMLDivElement;
/** The values of the multiselect. */
values: string[];
/**
* Create a new element for the multiselect.
*
* @param value - the value of the element.
* @returns the created element or `null` if the value is not valid.
*/
_createElement(value: string): string | null;
/** Create a new input element for the multiselect. */
_createInputEl(): HTMLDivElement;
/**
* Add a new element to the multiselect.
*
* @param value - the value of the element.
* @returns `true` if the element was added, `false` otherwise.
*/
addElement(value: string): boolean;
/**
* Allow creating options for the multiselect.
*
* @param createOption - the function to create an option.
* @returns the multiselect.
*/
allowCreatingOptions(createOption: (this: Multiselect, value: string) => string | undefined): this;
/**
* The callback for the change event.
*
* @param values - the values of the multiselect.
*/
changeCallback?(values: string[]): void;
/**
* Create a new option for the multiselect.
*
* @param value - the value of the option.
* @returns the created option or `undefined` if the value is not valid.
*/
createOption?(this: Multiselect, value: string): string | undefined;
/**
* Edit an element of the multiselect.
*
* @param index - the index of the element.
*/
editElement(index: number): void;
/**
* Find a duplicate in the multiselect.
*
* @param value - the value that will be checked for being a duplicate.
* @param values - the values to find a duplicate in.
* @returns the index of value if duplicate, otherwise `-1`.
*/
findDuplicate?(value: string, values: string[]): number;
/**
* Focus an element of the multiselect.
*
* @param index - the index of the element.
*/
focusElement(index: number): void;
/**
* Handle the change event of the multiselect.
*
* @param changeCallback - the callback to handle the change event.
*/
onChange(changeCallback: (values: string[]) => void): void;
/**
* Handle the context menu event of the multiselect.
*
* @param menu - the menu to handle the context menu event.
* @param value - the value of the element.
*/
onOptionContextmenu?(this: Multiselect, menu: Menu, value: string, ctx: MultiselectOptionContextMenuContext): void;
/** The renderer for the options of the multiselect. */
optionRenderer?(value: string, ctx: MultiselectOptionContextMenuContext): void;
/**
* Prevent duplicates in the multiselect.
*
* @param findDuplicate - the function to find a duplicate.
* @returns the multiselect.
*/
preventDuplicates(findDuplicate: (value: string, values: string[]) => number): this;
/**
* Remove an element of the multiselect.
*
* @param index - the index of the element.
*/
removeElement(index: number, shouldFocus?: boolean): void;
/** Render the values of the multiselect. */
renderValues(): void;
/**
* Set the text of the input element of the multiselect.
*
* @param text - the text to set.
*/
setInputText(text: string): void;
/**
* Set the context menu handler of the multiselect.
*
* @param onOptionContextmenu - the function to handle the context menu event.
* @returns the multiselect.
*/
setOptionContextmenuHandler(onOptionContextmenu: (this: Multiselect, menu: Menu, value: string, ctx: MultiselectOptionContextMenuContext) => void): this;
/**
* Set the option renderer of the multiselect.
*
* @param optionRenderer - the function to render the options.
* @returns the multiselect.
*/
setOptionRenderer(optionRenderer: (value: string, ctx: MultiselectOptionContextMenuContext) => void): this;
/**
* The setup function for the input element of the multiselect.
*
* @param inputEl - the input element.
* @param initializer - the initializer function.
*/
setupInput?(this: Multiselect, inputEl: HTMLDivElement, initializer: (value: string, shouldFocus?: boolean) => unknown): void;
/**
* Set the setup function for the input element of the multiselect.
*
* @param setupInput - the function to setup the input element.
* @returns the multiselect.
*/
setupInputEl(setupInput: (this: Multiselect, inputEl: HTMLDivElement, initializer: (value: string, shouldFocus?: boolean) => unknown) => void): this;
/**
* Set the values of the multiselect.
*
* @param values - the values to set.
* @returns the multiselect.
*/
setValues(values: string[] | null): this;
/** Trigger the change event of the multiselect. */
triggerChange(): void;
}
/**
* Multiselect option context menu context.
*
* @public
* @unofficial
*/
export interface MultiselectOptionContextMenuContext {
/** The element of the option context. */
el: HTMLDivElement;
/** The pill element of the option context. */
pillEl: HTMLDivElement;
}
/**
* Property widget component for multiple texts.
*
* @public
* @unofficial
*/
export interface MultitextPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The hover popover for the property widget. */
hoverPopover: null;
/** The multiselect component for the property widget. */
multiselect: Multiselect;
/** The type of the property widget. */
type: "multitext";
/** The values of the property widget. */
valueSet: Set<string>;
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface NodeInteractionLayer {
/** @todo Documentation incomplete. */
canvas: CanvasViewCanvas;
/** @todo Documentation incomplete. */
interactionEl: HTMLDivElement;
/** @todo Documentation incomplete. */
target: null;
/** @todo Documentation incomplete. */
render(): unknown;
/** @todo Documentation incomplete. */
setTarget(arg1: unknown): unknown;
}
/**
* Function `NotContains`.
* @public
* @unofficial
*/
export interface NotContainsFunction extends BasesFunction {
}
/**
* Function `NotEmpty`.
* @public
* @unofficial
*/
export interface NotEmptyFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* Function `NotEqual`.
* @public
* @unofficial
*/
export interface NotEqualFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType {
}
/**
* Function `Not`.
* @public
* @unofficial
*/
export interface NotFunction extends BasesFunction {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface NoteComposerPlugin extends InternalPlugin<NoteComposerPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface NoteComposerPluginInstance extends InternalPluginInstance<NoteComposerPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
onEnable: (app: App, plugin: NoteComposerPlugin) => Promise<void>;
/** @todo Documentation incomplete. */
options: NoteComposerPluginOptions;
/** @todo Documentation incomplete. */
pluginInstance: NoteComposerPlugin;
/** @todo Documentation incomplete. */
applyTemplate(content: string, fromTitle: string, newTitle: string): Promise<string>;
/** @todo Documentation incomplete. */
extractHeading(file: TFile, editor: Editor): void;
/** @todo Documentation incomplete. */
getSelectionUnderHeading(file: TFile, editor: Editor, line: number): HeadingInfo | null;
/** @todo Documentation incomplete. */
onEditorMenu(menu: Menu, editor: Editor, info: MarkdownView | MarkdownFileInfo): void;
/** @todo Documentation incomplete. */
onExternalSettingsChange(): Promise<void>;
/** @todo Documentation incomplete. */
onFileMenu(menu: Menu, file: TFile, source: string): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface NoteComposerPluginOptions {
/** @todo Documentation incomplete. */
askBeforeMerging?: boolean;
/** @todo Documentation incomplete. */
replacementText?: "link" | "embed" | "none";
/** @todo Documentation incomplete. */
template?: string;
}
/**
* Function `Now`.
* @public
* @unofficial
*/
export interface NowFunction extends BasesFunction {
}
/**
* Property widget component for numbers.
*
* @public
* @unofficial
*/
export interface NumberPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The input element for the property widget. */
inputEl: HTMLInputElement;
/** The type of the property widget. */
type: "number";
/** Show the error message. */
showError(): void;
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ObsidianDOM {
/**
* Root element of the application.
*/
appContainerEl: HTMLElement;
/**
* Child of `appContainerEl` containing the main content of the application.
*/
horizontalMainContainerEl: HTMLElement;
/**
* Status bar element containing word count among other things.
*/
statusBarEl: HTMLElement;
/**
* Child of `horizontalMainContainerEl` containing the workspace DOM.
*/
workspaceEl: HTMLElement;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ObsidianTouchEvent {
/** @todo Documentation incomplete. */
direction: "x" | "y";
/** @todo Documentation incomplete. */
evt: TouchEvent;
/** @todo Documentation incomplete. */
points: number;
/** @todo Documentation incomplete. */
registerCallback: ObsidianTouchEventRegisterCallback;
/** @todo Documentation incomplete. */
startX: number;
/** @todo Documentation incomplete. */
startY: number;
/** @todo Documentation incomplete. */
targetEl: HTMLElement;
/** @todo Documentation incomplete. */
touch: Touch;
/** @todo Documentation incomplete. */
x: number;
/** @todo Documentation incomplete. */
y: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ObsidianTouchEventRegisterCallback {
/** @todo Documentation incomplete. */
cancel(): void;
/** @todo Documentation incomplete. */
finish(x: number, y: number, z: number): void;
/** @todo Documentation incomplete. */
move(x: number): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OpenDialogOptions {
/** @todo Documentation incomplete. */
bottom: number;
/** @todo Documentation incomplete. */
closeOnBlur: boolean;
/** @todo Documentation incomplete. */
closeOnEnter: boolean;
/** @todo Documentation incomplete. */
selectValueOnOpen: boolean;
/** @todo Documentation incomplete. */
value: string;
/** @todo Documentation incomplete. */
onClose(div: HTMLDivElement): void;
/** @todo Documentation incomplete. */
onInput(e: KeyboardEvent, value: string, callback: (value: unknown) => void): void;
/** @todo Documentation incomplete. */
onKeyDown(e: KeyboardEvent, value: string, callback: (value: unknown) => void): void;
/** @todo Documentation incomplete. */
onKeyUp(e: KeyboardEvent, value: string, callback: (value: unknown) => void): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OpenNotificationOptions {
/** @todo Documentation incomplete. */
bottom?: boolean;
/** @todo Documentation incomplete. */
duration?: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OutgoingLinkPlugin extends InternalPlugin<OutgoingLinkPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OutgoingLinkPluginInstance extends InternalPluginInstance<OutgoingLinkPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
plugin: OutgoingLinkPlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OutgoingLinkView extends InfoFileView {
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.OutgoingLink;
/** @todo Documentation incomplete */
update(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OutgoingLinkViewConstructor extends TypedViewConstructor<OutgoingLinkView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OutlinePlugin extends InternalPlugin<OutlinePluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OutlinePluginInstance extends InternalPluginInstance<OutlinePlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
plugin: OutlinePlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OutlineView extends InfoFileView {
/** @todo Documentation incomplete */
createItemDom(e: unknown): unknown;
/** @todo Documentation incomplete */
filterSearchResults(): void;
/** @todo Documentation incomplete */
findActiveHeading(e: unknown): unknown | undefined;
/**
* Finds the active leaf.
*/
findCorrespondingLeaf(): WorkspaceLeaf | null;
/**
* Returns the headings of the active file.
*/
getHeadings(): string[];
/**
* Finds the view to the active leaf.
*/
getOwner(): View | null;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Outline;
/** @todo Documentation incomplete */
handleCollapseAll(e: unknown): void;
/** @todo Documentation incomplete */
handleSelectionChange(): void;
/** @todo Documentation incomplete */
onFileChanged(file: TFile): void;
/** @todo Documentation incomplete */
onMarkdownScroll(e: unknown): void;
/**
* Toggles the visibility of the search.
*/
onToggleShowSearch(): void;
/** @todo Documentation incomplete */
setHighlightedItem(e: unknown): void;
/** @todo Documentation incomplete */
setShowSearch(e: unknown): void;
/**
* Shows the search.
*/
showSearch(): void;
/** @todo Documentation incomplete */
update(): void;
/**
* Updates the search.
*/
updateSearch(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface OutlineViewConstructor extends TypedViewConstructor<OutlineView, [
outlinePluginInstance: OutlinePluginInstance
]> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PagePreviewPlugin extends InternalPlugin<PagePreviewPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PagePreviewPluginInstance extends InternalPluginInstance<PagePreviewPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PdfExportSettings {
/**
* Default: 100.
*/
downscalePercent: number;
/**
* Default: false.
*/
landscape: boolean;
/**
* Default: '0'.
*/
margin: string;
/**
* Default: 'letter'.
*/
pageSize: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PdfJsTestingUtils {
/** @todo Documentation incomplete. */
HighlightOutliner: HighlightOutliner;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PdfView extends EditableFileView {
/** @todo Documentation incomplete. */
viewer: unknown;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Pdf;
/**
* Is called when the vault has a 'modify' event. Reloads the file if the modified file is the file in this view.
*
* @param file - The modified file.
*/
onModify(file: TFile): void;
/**
* Shows the search.
*/
showSearch(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PdfViewConstructor extends TypedViewConstructor<PdfView> {
}
/**
* @public
* @unofficial
*
* Due to limitations of TypeScript, we cannot extend the `Platform` constant directly.
* @example
*
* ```ts
* import type { Platform } from 'obsidian';
* import type { PlatformEx } from 'obsidian-typings';
* const platformEx = Platform as PlatformEx;
* console.log(platformEx.canDisplayRibbon);
* ```
*/
export interface PlatformEx {
/** @todo Documentation incomplete. */
canDisplayRibbon: boolean;
/** @todo Documentation incomplete. */
canExportPdf: boolean;
/** @todo Documentation incomplete. */
canPopoutWindow: boolean;
/** @todo Documentation incomplete. */
canSplit: boolean;
/** @todo Documentation incomplete. */
canStackTabs: boolean;
/**
* We're running the `Android` app.
*
* @official
*/
isAndroidApp: boolean;
/**
* The UI is in desktop mode.
*
* @official
*/
isDesktop: boolean;
/**
* We're running the `Electron`-based desktop app.
*
* @official
*/
isDesktopApp: boolean;
/**
* We're running the `iOS` app.
*
* @official
*/
isIosApp: boolean;
/**
* We're on a Linux device.
*
* @official
*/
isLinux: boolean;
/**
* We're on a macOS device, or a device that pretends to be one (like iPhones and iPads).
* Typically used to detect whether to use command-based hotkeys vs ctrl-based hotkeys.
*
* @official
*/
isMacOS: boolean;
/**
* The UI is in mobile mode.
*
* @official
*/
isMobile: boolean;
/**
* We're running the `Capacitor` mobile app.
*
* @official
*/
isMobileApp: boolean;
/**
* We're in a mobile app that has very limited screen space.
*
* @official
*/
isPhone: boolean;
/**
* We're running in Safari.
* Typically used to provide workarounds for Safari bugs.
*
* @official
*/
isSafari: boolean;
/**
* We're in a mobile app that has sufficiently large screen space.
* @official
*/
isTablet: boolean;
/**
* We're on a Windows device.
*
* @official
*/
isWin: boolean;
/** @todo Documentation incomplete. */
mobileDeviceHeight: number;
/** @todo Documentation incomplete. */
mobileKeyboardHeight: number;
/** @todo Documentation incomplete. */
mobileSoftKeyboardVisible: boolean;
/**
* The path prefix for resolving local files on this platform.
* This returns:
* - `file:///` on mobile.
* - `app://random-id/` on desktop (Replaces the old format of `app://local/`).
*
* @official
*/
resourcePathPrefix: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PluginUpdateManifest {
/**
* Manifest of the plugin.
*/
manifest: PluginManifest;
/**
* Repository of the plugin.
*/
repo: string;
/**
* New version of the plugin.
*/
version: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Plugins {
/**
* Reference to App.
*/
app: App;
/**
* Set of enabled plugin IDs.
*
* @remark The plugin ids aren't guaranteed to be either active (in `app.plugins.plugins`) or installed (in `app.plugins.manifests`).
*/
enabledPlugins: Set<string>;
/**
* Plugin ID that is currently being enabled.
*/
loadingPluginId: string | null;
/**
* Manifests of all the plugins that are installed.
*/
manifests: PluginsManifestsRecord;
/**
* Mapping of plugin ID to active plugin instance.
*
* @remark Prefer usage of getPlugin to access a plugin.
*/
plugins: PluginsPluginsRecord;
/** @todo Documentation incomplete. */
requestSaveConfig: Debouncer<[
], Promise<void>>;
/**
* Mapping of plugin ID to available updates.
*/
updates: Map<string, PluginUpdateManifest>;
/**
* Check online list for deprecated plugins to automatically disable.
*/
checkForDeprecations(): Promise<void>;
/**
* Check for plugin updates.
*/
checkForUpdates(): Promise<void>;
/**
* Unload a plugin by ID.
*/
disablePlugin(id: string): Promise<void>;
/**
* Unload a plugin by ID and save config for persistence.
*/
disablePluginAndSave(id: string): Promise<void>;
/**
* Enable a plugin by ID.
*/
enablePlugin(id: string): Promise<void>;
/**
* Enable a plugin by ID and save config for persistence.
*/
enablePluginAndSave(id: string): Promise<void>;
/**
* Get a plugin by ID.
*/
getPlugin(id: string): Plugin | null;
/**
* Get the folder where plugins are stored.
*/
getPluginFolder(): string;
/**
* Load plugin manifests and enable plugins from config.
*/
initialize(): Promise<void>;
/**
* Install a plugin from a given URL.
*/
installPlugin(repo: string, version: string, manifest: PluginManifest): Promise<void>;
/**
* Check whether a plugin is deprecated.
*/
isDeprecated(id: string): boolean;
/**
* Check whether community plugins are enabled.
*/
isEnabled(): boolean;
/**
* Load a specific plugin's manifest by its folder path.
*/
loadManifest(path: string): Promise<void>;
/**
* Load all plugin manifests from plugin folder.
*/
loadManifests(): Promise<void>;
/**
* Load a plugin by its ID.
*/
loadPlugin(id: string): Promise<Plugin>;
/** @todo Documentation incomplete. */
onRaw(e: unknown): void;
/**
* - Save current plugin configs.
*/
saveConfig(): Promise<void>;
/**
* Toggle whether community plugins are enabled.
*/
setEnable(enabled: boolean): Promise<void>;
/**
* Uninstall a plugin by ID.
*/
uninstallPlugin(id: string): Promise<void>;
/**
* Unload a plugin by ID.
*/
unloadPlugin(id: string): Promise<void>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PluginsManifestsRecord extends Record<string, PluginManifest> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PluginsPluginsRecord extends Record<string, Plugin> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Pointer {
/** @todo Documentation incomplete. */
x: number;
/** @todo Documentation incomplete. */
y: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PositionedReference extends Reference, CacheItem {
}
/**
* Power tag.
*
* @public
* @unofficial
*/
export interface PowerTag {
/** @todo Documentation incomplete. */
rendered: boolean;
/** @todo Documentation incomplete. */
renderer: GraphRenderer;
/** @todo Documentation incomplete. */
text: Text$1;
/** @todo Documentation incomplete. */
clearGraphics(): void;
/** @todo Documentation incomplete. */
getTextStyle(): TextStyle;
/** @todo Documentation incomplete. */
initGraphics(): void;
/** @todo Documentation incomplete. */
render(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PromisedQueue {
/** @todo Documentation incomplete. */
promise: Promise<unknown>;
/** @todo Documentation incomplete. */
queue<T>(fn: () => T | Promise<T>): Promise<T>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PropertiesPlugin extends InternalPlugin<PropertiesPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PropertiesPluginInstance extends InternalPluginInstance<PropertiesPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: false;
/** @todo Documentation incomplete. */
plugin: PropertiesPlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PropertyEntryData<T> {
/**
* Property key.
*/
key: string;
/**
* Property widget type.
*/
type: string;
/**
* Property value.
*/
value: T;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PropertyInfo {
/**
* Name of property.
*/
name: string;
/**
* Usage count of property.
*/
occurrences: number;
/**
* Type of property.
*/
widget: string;
}
/**
* Property widget component for properties.
*
* @public
* @unofficial
*/
export interface PropertyPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The combobox component for the property widget. */
combobox: PropertyPropertyWidgetComponentComboBox;
/** The input element for the property widget. */
inputEl: HTMLInputElement;
/** The type of the property widget. */
type: "property";
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* Combobox component for {@link PropertyPropertyWidgetComponent}.
*
* @public
* @unofficial
*/
export interface PropertyPropertyWidgetComponentComboBox extends PopoverSuggest<PropertyPropertyWidgetComponentComboBoxItem> {
/** The items of the combobox. */
_items: PropertyPropertyWidgetComponentComboBoxItem[];
/** The background element of the combobox. */
bgEl: HTMLDivElement;
/** The button element of the combobox. */
buttonEl: HTMLDivElement;
/** Whether the combobox is clearable. */
clearable: boolean;
/** The icon element of the combobox. */
iconEl: HTMLDivElement;
/** The label element of the combobox. */
labelEl: HTMLDivElement;
/** The search component of the combobox. */
searchComponent: SearchComponent;
/** The current value of the combobox. */
value: PropertyPropertyWidgetComponentComboBoxItem | null;
/**
* Callback for `onClose`.
*/
_onClose?(): void;
/**
* Callback for `onOpen`.
*/
_onOpen?(): void;
/** Attach the DOM of the combobox. */
attachDom(): void;
/** Detach the DOM of the combobox. */
detachDom(): Promise<void>;
/** Focus the combobox. */
focus(): void;
/** Get the items of the combobox. */
getItems(): PropertyPropertyWidgetComponentComboBoxItem[];
/**
* Callback for `getSuggestions`.
*/
getSuggestions(query: string): SearchResult[];
/**
* Register a callback for `close` event.
*
* @param callback - the callback to register.
*/
onClose(callback: () => void): this;
/**
* Handle the input change event of the combobox.
*
* @param query - the query to handle.
*/
onInputChange(query: string): void;
/**
* Register a callback for `open` event.
*
* @param callback - the callback to register.
*/
onOpen(callback: () => void): this;
/**
* Register a callback for `select` event.
*
* @param callback - the callback to register.
*/
onSelect(callback: (item: PropertyPropertyWidgetComponentComboBoxItem) => void): this;
/** Render the label of the combobox. */
renderLabel(): void;
/**
* Callback for `onSelect`.
*
* @param item - the item that was selected.
*/
selectCb?(item: PropertyPropertyWidgetComponentComboBoxItem): void;
/**
* Set the clearable state of the combobox.
*
* @param clearable - whether the combobox should be clearable.
* @returns the combobox.
*/
setClearable(clearable: boolean): this;
/**
* Set the items of the combobox.
*
* @param items - the items to set.
* @returns the combobox.
*/
setItems(items: PropertyPropertyWidgetComponentComboBoxItem[]): this;
/**
* Set the placeholder of the combobox.
*
* @param placeholder - the placeholder to set.
* @returns the combobox.
*/
setPlaceholder(placeholder: string): this;
/**
* Set the value of the combobox.
*
* @param value - the value to set.
* @returns the combobox.
*/
setValue(value: PropertyPropertyWidgetComponentComboBoxItem): this;
/**
* Set the value of the combobox by its id.
*
* @param id - the id of the value to set.
* @returns the combobox.
*/
setValueById(id: string): this;
/** Toggle the combobox. */
toggle(): unknown;
/**
* Update the value of the combobox.
*
* @param value - the value to update.
* @returns the combobox.
*/
updateValue(value: PropertyPropertyWidgetComponentComboBoxItem): this;
}
/**
* Combo box item for {@link PropertyPropertyWidgetComponentComboBox}.
*
* @public
* @unofficial
*/
export interface PropertyPropertyWidgetComponentComboBoxItem {
/** The icon of the item. */
icon: string;
/** The value of the item. */
value: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PropertyRenderContext {
/**
* Reference to the app.
*/
app: App;
/**
* Key of the property field.
*/
key: string;
/**
* Determine the source path of current context.
*/
sourcePath: string;
/**
* Callback called on property field unfocus.
*/
blur(): void;
/**
* Callback called on property value change.
*/
onChange(value: unknown): void;
}
/**
* Property widget.
*
* @public
* @unofficial
*/
export interface PropertyWidget<ComponentType extends PropertyWidgetComponentBase = PropertyWidgetComponentBase> {
/**
* Lucide-dev icon associated with the widget.
*/
icon: string;
/**
* Reserved keys for the widget.
*/
reservedKeys?: string[];
/**
* Identifier for the widget.
*/
type: string;
/**
* Returns the I18N name of the widget.
*/
name(): string;
/**
* Render function for the widget on field container given context and data.
*/
render(containerEl: HTMLElement, data: unknown, context: PropertyRenderContext): ComponentType;
/**
* Validate whether the input value to the widget is correct.
*/
validate(value: unknown): boolean;
}
/**
* Base class for property widget components.
*
* @public
* @unofficial
*/
export interface PropertyWidgetComponentBase {
/** The type of the property widget. */
type: string;
/**
* Focus the property widget.
*
* @param mode - The focus mode.
*/
focus(mode?: FocusMode): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PropertyWidgetEntry {
/** @todo Documentation incomplete. */
name: string;
/** @todo Documentation incomplete. */
widget: PropertyWidgetType;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PublishPlugin extends InternalPlugin<PublishPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface PublishPluginInstance extends InternalPluginInstance<PublishPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
plugin: PublishPlugin;
}
/**
* Query for fuzzy search.
*
* @public
* @unofficial
*/
export interface QueryForFuzzySearch {
/** */
/**
* The fuzzy tokens of the query.
*/
fuzzy: string[];
/**
* The query string.
*/
query: string;
/**
* The tokens of the query.
*/
tokens: string[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface RandomNotePlugin extends InternalPlugin<RandomNotePluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface RandomNotePluginInstance extends InternalPluginInstance<RandomNotePlugin> {
/** @todo Documentation incomplete. */
app: App;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ReadViewRenderer {
/** @todo Documentation incomplete. */
addBottomPadding: boolean;
/** @todo Documentation incomplete. */
asyncSections: unknown[];
/** @todo Documentation incomplete. */
lastRender: number;
/** @todo Documentation incomplete. */
lastScroll: number;
/** @todo Documentation incomplete. */
lastText: string;
/** @todo Documentation incomplete. */
previewEl: HTMLElement;
/** @todo Documentation incomplete. */
pusherEl: HTMLElement;
/** @todo Documentation incomplete. */
recycledSections: unknown[];
/** @todo Documentation incomplete. */
rendered: unknown[];
/** @todo Documentation incomplete. */
sections: RendererSection[];
/** @todo Documentation incomplete. */
text: string;
/** @todo Documentation incomplete. */
clear(): void;
/** @todo Documentation incomplete. */
parseAsync(): void;
/** @todo Documentation incomplete. */
parseSync(): void;
/** @todo Documentation incomplete. */
queueRender(): void;
/** @todo Documentation incomplete. */
set(text: string): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface RecentFileTracker {
/**
* List of last opened file paths, limited to 50.
*/
lastOpenFiles: string[];
/**
* Reference to Vault.
*/
vault: Vault;
/**
* Reference to Workspace.
*/
workspace: Workspace;
/** @todo Documentation incomplete. */
collect(file: TFile): void;
/**
* Returns the last 10 opened files.
*/
getLastOpenFiles(): string[];
/**
* Get last n files of type (defaults to 10).
*/
getRecentFiles(options?: GetRecentFilesOptions): string[];
/**
* Set the last opened files.
*/
load(savedFiles: string[]): void;
/**
* On file create, save file to last opened files.
*/
onFileCreated(file: TFile): void;
/**
* On file open, save file to last opened files.
*/
onFileOpen(prevFile: TFile, file: TFile): void;
/**
* On file rename, update file path in last opened files.
*/
onRename(file: TFile, oldPath: string): void;
/**
* Get last opened files.
*/
serialize(): string[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ReleaseNotesView extends ItemView {
/**
* Get the release notes from GitHub.
*
* @param version - The version of the release notes.
*/
fetchReleaseNotes(version: string): Promise<unknown>;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.ReleaseNotes;
/**
* Renders the release notes.
*/
render(): Promise<unknown>;
/** @todo Documentation incomplete */
showPatchNotes(e: unknown, version: string): Promise<unknown>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ReleaseNotesViewConstructor extends TypedViewConstructor<ReleaseNotesView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface RendererSection {
/** @todo Documentation incomplete. */
el: HTMLElement;
/** @todo Documentation incomplete. */
html: string;
/** @todo Documentation incomplete. */
rendered: boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ResultDom {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
changed: Debouncer<[
], unknown>;
/** @todo Documentation incomplete. */
childrenEl: HTMLDivElement;
/** @todo Documentation incomplete. */
collapseAll: boolean;
/** @todo Documentation incomplete. */
el: HTMLDivElement;
/** @todo Documentation incomplete. */
emptyStateEl: HTMLDivElement;
/** @todo Documentation incomplete. */
extraContext: boolean;
/** @todo Documentation incomplete. */
focusedItem: null;
/** @todo Documentation incomplete. */
infinityScroll: InfinityScroll;
/** @todo Documentation incomplete. */
info: TreeNodeInfo;
/** @todo Documentation incomplete. */
pusherEl: HTMLDivElement;
/** @todo Documentation incomplete. */
resultDomLookup: Map<TFile, ResultDomItem>;
/** @todo Documentation incomplete. */
showingEmptyState: boolean;
/** @todo Documentation incomplete. */
sortOrder: string;
/** @todo Documentation incomplete. */
vChildren: TreeNodeVChildren<ResultDomItem, ResultDom>;
/** @todo Documentation incomplete. */
working: boolean;
/** @todo Documentation incomplete. */
addResult(file: TFile, result: ResultDomResult, content: string, shouldShowTitle?: boolean): ResultDomItem;
/** @todo Documentation incomplete. */
changeFocusedItem(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
emptyResults(): unknown;
/** @todo Documentation incomplete. */
getFiles(): unknown;
/** @todo Documentation incomplete. */
getMatchCount(): number;
/** @todo Documentation incomplete. */
getResult(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onChange(): unknown;
/** @todo Documentation incomplete. */
onResize(): unknown;
/** @todo Documentation incomplete. */
removeResult(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setCollapseAll(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setExtraContext(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setFocusedItem(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
startLoader(): unknown;
/** @todo Documentation incomplete. */
stopLoader(): unknown;
/** @todo Documentation incomplete. */
toggle(arg1: unknown, arg2: unknown): Promise<unknown>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ResultDomItem extends TreeNode {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
childrenEl: HTMLDivElement;
/** @todo Documentation incomplete. */
collapsed: boolean;
/** @todo Documentation incomplete. */
collapseEl: HTMLDivElement;
/** @todo Documentation incomplete. */
collapsible: boolean;
/** @todo Documentation incomplete. */
containerEl: HTMLDivElement;
/** @todo Documentation incomplete. */
content: string;
/** @todo Documentation incomplete. */
extraContext: boolean;
/** @todo Documentation incomplete. */
file: TFile;
/** @todo Documentation incomplete. */
info: TreeNodeInfo;
/** @todo Documentation incomplete. */
onMatchRender: null;
/** @todo Documentation incomplete. */
parent: ResultDom;
/** @todo Documentation incomplete. */
parentDom: ResultDom;
/** @todo Documentation incomplete. */
pusherEl: HTMLDivElement;
/** @todo Documentation incomplete. */
result: ResultDomResult;
/** @todo Documentation incomplete. */
separateMatches: boolean;
/** @todo Documentation incomplete. */
showTitle: boolean;
/** @todo Documentation incomplete. */
vChildren: TreeNodeVChildren<ResultDomItem, ResultDomItemChild>;
/** @todo Documentation incomplete. */
getMatchExtraPositions(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
invalidate(): unknown;
/** @todo Documentation incomplete. */
onCollapseClick(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onResultClick(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onResultContextMenu(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
onResultMouseover(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
/** @todo Documentation incomplete. */
renderContentMatches(): void;
/** @todo Documentation incomplete. */
setCollapse(arg1: unknown, arg2: unknown): Promise<unknown>;
/** @todo Documentation incomplete. */
setCollapsible(arg1: unknown): unknown;
/** @todo Documentation incomplete. */
setExtraContext(arg1: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ResultDomItemChild extends TreeNode {
/** @todo Documentation incomplete. */
cache: CachedMetadata;
/** @todo Documentation incomplete. */
content: string;
/** @todo Documentation incomplete. */
end: number;
/** @todo Documentation incomplete. */
info: TreeNodeInfo;
/** @todo Documentation incomplete. */
matches: ContentPosition[];
/** @todo Documentation incomplete. */
mutateEState: unknown;
/** @todo Documentation incomplete. */
onMatchRender: unknown;
/** @todo Documentation incomplete. */
parent: ResultDomItem;
/** @todo Documentation incomplete. */
parentDom: ResultDomItem;
/** @todo Documentation incomplete. */
showMoreAfterEl: HTMLElement;
/** @todo Documentation incomplete. */
showMoreBeforeEl: HTMLElement;
/** @todo Documentation incomplete. */
start: number;
/** @todo Documentation incomplete. */
getNextPos(arg1: unknown): number;
/** @todo Documentation incomplete. */
getPrevPos(arg1: unknown): number;
/** @todo Documentation incomplete. */
onFocusEnter(event?: UIEvent): void;
/** @todo Documentation incomplete. */
onFocusExit(event?: UIEvent): void;
/** @todo Documentation incomplete. */
onResultClick(event: UIEvent): void;
/** @todo Documentation incomplete. */
render(hasTextBefore: boolean, hasTextAfter: boolean): void;
/** @todo Documentation incomplete. */
showMoreAfter(): void;
/** @todo Documentation incomplete. */
showMoreBefore(): void;
/** @todo Documentation incomplete. */
toggleShowMoreContextButtons(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ResultDomResult {
/** @todo Documentation incomplete. */
content: ContentPosition[];
/** @todo Documentation incomplete. */
properties: ResultProperty[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ResultProperty {
/** @todo Documentation incomplete. */
key: string;
/** @todo Documentation incomplete. */
pos: ContentPosition;
/** @todo Documentation incomplete. */
subkey: (number | string)[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface RibbonItem {
/** @todo Documentation incomplete. */
hidden: boolean;
/** @todo Documentation incomplete. */
icon: IconName;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
title: string;
/** @todo Documentation incomplete. */
callback(): Promise<void>;
}
/**
* Function `Round`.
* @public
* @unofficial
*/
export interface RoundFunction extends BasesFunction, HasGetDisplayName {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Runnable {
/** @todo Documentation incomplete. */
cancelled: boolean;
/** @todo Documentation incomplete. */
onCancel: null | (() => void);
/** @todo Documentation incomplete. */
onStart: null | (() => void);
/** @todo Documentation incomplete. */
onStop: null | (() => void);
/** @todo Documentation incomplete. */
running: boolean;
/** @todo Documentation incomplete. */
cancel(): void;
/** @todo Documentation incomplete. */
isCancelled(): boolean;
/** @todo Documentation incomplete. */
isRunning(): boolean;
/** @todo Documentation incomplete. */
start(): void;
/** @todo Documentation incomplete. */
stop(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SQLError {
/** @todo Documentation incomplete. */
code: number;
/** @todo Documentation incomplete. */
message: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SQLResultSet {
/** @todo Documentation incomplete. */
insertId: number;
/** @todo Documentation incomplete. */
rows: SQLResultSetRowList;
/** @todo Documentation incomplete. */
rowsAffected: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SQLResultSetRowList {
/** @todo Documentation incomplete. */
length: number;
/** @todo Documentation incomplete. */
item(index: number): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SQLTransaction {
/** @todo Documentation incomplete. */
executeSql(sqlStatement: string, arguments?: unknown[], callback?: (transaction: SQLTransaction, resultSet: SQLResultSet) => void, errorCallback?: (transaction: SQLTransaction, error: SQLError) => boolean): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ScrollInfo {
/** @todo Documentation incomplete. */
clientHeight: number;
/** @todo Documentation incomplete. */
clientWidth: number;
/** @todo Documentation incomplete. */
height: number;
/** @todo Documentation incomplete. */
left: number;
/** @todo Documentation incomplete. */
top: number;
/** @todo Documentation incomplete. */
width: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SearchBookmarkItem extends BookmarkItem {
/** @todo Documentation incomplete. */
query: string;
/** @todo Documentation incomplete. */
type: "search";
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SearchCursor {
/**
* Current editor search position.
*/
current(): EditorRange;
/**
* All search results.
*/
findAll(): EditorRange[];
/**
* Next editor search position.
*/
findNext(): EditorRange;
/**
* Previous editor search position.
*/
findPrevious(): EditorRange;
/**
* Replace current search result with specified text.
*
* @remark origin is used by CodeMirror to determine which component was responsible for the change.
*/
replace(replacement: string, origin: string): void;
/**
* Replace all search results with specified text.
*/
replaceAll(replacement: string, origin: string): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SearchView extends View {
/**
* Returns the value of the search element.
*/
getQuery(): string;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Search;
/** @todo Documentation incomplete */
onCopyResultsClick(event: MouseEvent): void;
/** @todo Documentation incomplete */
onKeyArrowDownInFocus(event: KeyboardEvent): void;
/** @todo Documentation incomplete */
onKeyArrowLeftInFocus(event: KeyboardEvent): void;
/** @todo Documentation incomplete */
onKeyArrowRightInFocus(event: KeyboardEvent): void;
/** @todo Documentation incomplete */
onKeyArrowUpInFocus(event: KeyboardEvent): void;
/** @todo Documentation incomplete */
onKeyEnterInFocus(event: KeyboardEvent): void;
/** @todo Documentation incomplete */
onKeyShowMoreAfter(e: unknown): void;
/** @todo Documentation incomplete */
onKeyShowMoreBefore(e: unknown): void;
/**
* Called when the tap header is clicked. Brings this tab to the front.
*/
onTabHeaderClick(): void;
/** @todo Documentation incomplete */
renderSearchInfo(e: unknown, parentEl: HTMLElement): void;
/**
* Saves the current search string to the recent searches in Local Storage.
*/
saveSearch(): void;
/** @todo Documentation incomplete */
setCollapseAll(e: unknown): void;
/** @todo Documentation incomplete */
setExplainSearch(e: unknown): void;
/** @todo Documentation incomplete */
setExtraContext(e: unknown): void;
/** @todo Documentation incomplete */
setMatchingCase(e: unknown): void;
/**
* Sets the value of the search element.
*
* @param value - The search string.
*/
setQuery(value: string): void;
/** @todo Documentation incomplete */
setSortOrder(sortOrder: unknown): void;
/**
* Starts the search and renders the results.
*/
startSearch(): void;
/**
* Stops the search and clears the results.
*/
stopSearch(): void;
/**
* Toggles the visibility of the filter section. Called if clicked on 'Search settings'.
*/
toggleFilterSection(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SearchViewConstructor extends TypedViewConstructor<SearchView> {
}
/**
* Function `Second`.
* @public
* @unofficial
*/
export interface SecondFunction extends BasesFunction, HasExtract {
}
/**
* Serialized bases sub view.
*
* @public
* @unofficial
*/
export interface SerializedBasesSubView {
/**
* The name.
*/
name: string;
/**
* The type.
*/
type: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SerializedWorkspace {
/**
* Last active leaf.
*/
active: string;
/**
* Last opened files.
*/
lastOpenFiles: string[];
/**
* Left opened leaf.
*/
left: LeafEntry;
/**
* Left ribbon.
*/
leftRibbon: SerializedWorkspaceLeftRibbon;
/**
* Main (center) workspace leaf.
*/
main: LeafEntry;
/**
* Right opened leaf.
*/
right: LeafEntry;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SerializedWorkspaceItem {
/** @todo Documentation incomplete. */
dimension?: number;
/** @todo Documentation incomplete. */
id: string;
/** @todo Documentation incomplete. */
type: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SerializedWorkspaceLeafHistory {
/** @todo Documentation incomplete. */
backHistory: WorkspaceLeafHistoryState[];
/** @todo Documentation incomplete. */
forwardHistory: WorkspaceLeafHistoryState[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SerializedWorkspaceLeftRibbon {
/** @todo Documentation incomplete. */
hiddenItems: SerializedWorkspaceLeftRibbonHiddenItemsRecord;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SerializedWorkspaceLeftRibbonHiddenItemsRecord extends Record<string, boolean> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SerializedWorkspaceSidedock extends SerializedWorkspaceItem {
/** @todo Documentation incomplete. */
collapsed: boolean;
/** @todo Documentation incomplete. */
width: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SetBookmarkOptions {
/** @todo Documentation incomplete. */
insertLeft?: boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SetHighlightMatch {
/** @todo Documentation incomplete. */
endLoc?: number;
/** @todo Documentation incomplete. */
focus: boolean;
/** @todo Documentation incomplete. */
line?: number;
/** @todo Documentation incomplete. */
match?: unknown;
/** @todo Documentation incomplete. */
startLoc?: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SetSelectionOptions {
/** @todo Documentation incomplete. */
origin?: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ShareReceiver {
/** @todo Documentation incomplete. */
app: App;
/**
* Handles shared files.
*
* @param files - Shared files.
*/
handleShareFiles(files: SharedFile[]): Promise<void>;
/**
* Handles shared text.
*
* @param text - Shared text.
*/
handleShareText(text: string): Promise<void>;
/**
* Imports shared files.
*
* @param files - Shared files.
*/
importFiles(files: SharedFile[]): Promise<void>;
/**
* Configures mobile native events to handle file and text sharing.
*/
setupNative(): void;
/**
* Configures the workspace to handle file and text sharing.
*/
setupWorkspace(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SharedFile {
/** @todo Documentation incomplete. */
name: string;
/** @todo Documentation incomplete. */
uri: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SlashCommandPlugin extends InternalPlugin<SlashCommandPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SlashCommandPluginInstance extends InternalPluginInstance<SlashCommandPlugin> {
/** @todo Documentation incomplete. */
defaultOn: false;
}
/**
* Function `Slice`.
* @public
* @unofficial
*/
export interface SliceFunction extends BasesFunction {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SlidesPlugin extends InternalPlugin<SlidesPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SlidesPluginInstance extends InternalPluginInstance<SlidesPlugin> {
/** @todo Documentation incomplete. */
app: App;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface StateHistory {
/**
* Ephemeral cursor state within Editor of leaf.
*/
eState: StateHistoryEphemeralState;
/**
* Icon of the leaf.
*/
icon?: string;
/**
* History of previous and future states of leaf.
*/
leafHistory?: StateHistoryLeafHistory;
/**
* Id of parent to which the leaf belonged.
*/
parentId?: string;
/**
* Id of root to which the leaf belonged.
*/
rootId?: string;
/**
* Last state of the leaf.
*/
state: ViewState;
/**
* Title of the leaf.
*/
title?: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface StateHistoryEphemeralState {
/** @todo Documentation incomplete. */
cursor: EditorRange;
/** @todo Documentation incomplete. */
scroll: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface StateHistoryLeafHistory {
/** @todo Documentation incomplete. */
backHistory: StateHistory[];
/** @todo Documentation incomplete. */
forwardHistory: StateHistory[];
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface StatusBar {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
containerEl: HTMLElement;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Submenu {
/** @todo Documentation incomplete. */
icon: string;
/** @todo Documentation incomplete. */
title: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SuggestModalChooser<T, TModal> {
/** @todo Documentation incomplete. */
chooser: TModal;
/** @todo Documentation incomplete. */
containerEl: HTMLDivElement;
/** @todo Documentation incomplete. */
numVisibleItems: number;
/** @todo Documentation incomplete. */
rowHeight: number;
/** @todo Documentation incomplete. */
selectedItem: number;
/** @todo Documentation incomplete. */
suggestions: HTMLDivElement[];
/** @todo Documentation incomplete. */
values: T[] | null;
/** @todo Documentation incomplete. */
addMessage(text: string | DocumentFragment): void;
/** @todo Documentation incomplete. */
addSuggestion(value: T): void;
/** @todo Documentation incomplete. */
forceSetSelectedItem(index: number, evt: MouseEvent | KeyboardEvent): void;
/** @todo Documentation incomplete. */
moveDown(evt: KeyboardEvent): false | void;
/** @todo Documentation incomplete. */
moveUp(evt: KeyboardEvent): false | void;
/** @todo Documentation incomplete. */
onSuggestionClick(evt: MouseEvent, suggestion: HTMLDivElement): void;
/** @todo Documentation incomplete. */
onSuggestionMouseover(evt: MouseEvent, suggestion: HTMLDivElement): void;
/** @todo Documentation incomplete. */
pageDown(evt: KeyboardEvent): false | void;
/** @todo Documentation incomplete. */
pageUp(evt: KeyboardEvent): false | void;
/** @todo Documentation incomplete. */
setSelectedItem(index: number, evt: MouseEvent | KeyboardEvent): void;
/** @todo Documentation incomplete. */
setSuggestions(values: T[] | null): void;
/** @todo Documentation incomplete. */
useSelectedItem(evt: MouseEvent | KeyboardEvent): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SuggestionContainer<T> {
/**
* Which suggestions should be picked from.
*/
chooser: EditorSuggest<T>;
/**
* Pop-up element that displays the suggestions.
*/
containerEl: HTMLElement;
/**
* The currently focused item.
*/
selectedItem: number;
/**
* List of all possible suggestions as elements.
*/
suggestions: HTMLElement[];
/**
* List of all possible suggestions as data.
*/
values: SearchResult[];
/**
* Amount of suggestions that can be displayed at once within containerEl.
*/
get numVisibleItems(): number;
/**
* Height in pixels of the selected item.
*/
get rowHeight(): number;
/**
* Add an empty message with provided text.
*/
addMessage(text: string): HTMLElement;
/**
* Add suggestion to container.
*/
addSuggestion(suggestion: SearchResult): void;
/**
* Set selected item to one specified by index, if keyboard navigation, force scroll into view.
*
* @remark Prefer setSelectedItem, which clamps the index to within suggestions array.
*/
forceSetSelectedItem(index: number, event: Event): void;
/** @todo Documentation incomplete. */
getSelectedElement(): HTMLElement | null;
/** @todo Documentation incomplete. */
getSelectedValue(): SearchResult | null;
/**
* Move selected item to next suggestion.
*/
moveDown(event: KeyboardEvent): boolean;
/**
* Move selected item to previous suggestion.
*/
moveUp(event: KeyboardEvent): boolean;
/**
* Process click on suggestion item.
*/
onSuggestionClick(event: MouseEvent, element: HTMLElement): void;
/**
* Process hover on suggestion item.
*/
onSuggestionMouseover(event: MouseEvent, element: HTMLElement): unknown;
/**
* Move selected item to the one in the next 'page' (next visible block).
*/
pageDown(event: KeyboardEvent): boolean;
/**
* Move selected item to the one in the previous 'page' (previous visible block).
*/
pageUp(event: KeyboardEvent): boolean;
/**
* Set selected item to one specified by index, invokes forceSetSelectedItem.
*/
setSelectedItem(index: number, event: Event): void;
/**
* Empties original container and adds multiple suggestions.
*/
setSuggestions(suggestions: SearchResult[]): void;
/**
* Use currently selected suggestion as the accepted one.
*/
useSelectedItem(event: Event): boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SwitcherPlugin extends InternalPlugin<SwitcherPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SwitcherPluginInstance extends InternalPluginInstance<SwitcherPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
plugin: SwitcherPlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SyncPlugin extends InternalPlugin<SyncPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SyncPluginInstance extends InternalPluginInstance<SyncPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
plugin: SyncPlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SyncView extends View {
/** @todo Documentation incomplete. */
getViewType(): typeof ViewType.Sync;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface SyncViewConstructor extends TypedViewConstructor<SyncView, [
syncPluginInstance: SyncPluginInstance
]> {
}
/**
* The TFile constructor.
*
* @public
* @unofficial
*/
export interface TFileConstructor extends ConstructorBase<[
vault: Vault,
path: string
], TFile> {
}
/**
* The TFolder constructor.
*
* @public
* @unofficial
*/
export interface TFolderConstructor extends ConstructorBase<[
vault: Vault,
path: string
], TFolder> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TableCell {
/** @todo Documentation incomplete. */
col: number;
/** @todo Documentation incomplete. */
contentEl: HTMLElement;
/** @todo Documentation incomplete. */
dirty: boolean;
/** @todo Documentation incomplete. */
el: HTMLElement;
/** @todo Documentation incomplete. */
end: number;
/** @todo Documentation incomplete. */
padEnd: number;
/** @todo Documentation incomplete. */
padStart: number;
/** @todo Documentation incomplete. */
row: number;
/** @todo Documentation incomplete. */
start: number;
/** @todo Documentation incomplete. */
table: TableCellEditor;
/** @todo Documentation incomplete. */
text: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TableCellEditor extends MarkdownBaseView, TableCell {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TableEditor {
}
/**
* Table view.
*
* @public
* @unofficial
*/
export interface TableView extends View {
/**
* Get view type.
*/
getViewType(): typeof ViewType.Table;
}
/**
* Table view constructor.
*
* @public
* @unofficial
*/
export interface TableViewConstructor extends ConstructorBase<[
app: App,
containerEl: HTMLElement
], TableView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TagPanePlugin extends InternalPlugin<TagPanePluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TagPanePluginInstance extends InternalPluginInstance<TagPanePlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
plugin: TagPanePlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TagView extends View {
/** @todo Documentation incomplete */
getNodeId(e: unknown): unknown;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Tag;
/** @todo Documentation incomplete */
isItem(item: unknown): boolean;
/** @todo Documentation incomplete */
onKeyEnterInFocus(event: KeyboardEvent): void;
/** @todo Documentation incomplete */
setIsAllCollapsed(e: unknown): void;
/** @todo Documentation incomplete */
setUseHierarchy(e: unknown): void;
/**
* Reloads all tags from vault, update all items and sort those.
*/
updateTags(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TagViewConstructor extends TypedViewConstructor<TagView> {
}
/**
* Function `TaggedWith`.
* @public
* @unofficial
*/
export interface TaggedWithFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType {
}
/**
* Property widget component for tags.
*
* @public
* @unofficial
*/
export interface TagsPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The multiselect component for the property widget. */
multiselect: Multiselect;
/** The type of the property widget. */
type: "tags";
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TemplatesPlugin extends InternalPlugin<TemplatesPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TemplatesPluginInstance extends InternalPluginInstance<TemplatesPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
plugin: TemplatesPlugin;
}
/**
* Property widget component for text.
*
* @public
* @unofficial
*/
export interface TextPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The container element for the property widget. */
containerEl: HTMLElement;
/** The render context for the property widget. */
ctx: PropertyRenderContext;
/** The input element for the property widget. */
inputEl: HTMLInputElement;
/** The hover popover for the property widget. */
hoverPopover: null;
/** The type of the property widget. */
type: "text";
/** The value of the property widget. */
value: string;
/**
* Render the property widget.
*/
render(): void;
/**
* Handle focus event.
*
* @param mode - The focus mode.
*/
onFocus(): void;
/**
* Set the value of the property widget.
*
* @param value - The value to set.
*/
setValue(value: unknown): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ThemeManifest {
/**
* Name of the author of the theme.
*/
author: string;
/**
* URL to the author's website.
*/
authorUrl?: string;
/**
* Storage location of the theme relative to the vault root.
*/
dir: string;
/**
* URL for funding the author.
*/
fundingUrl?: string;
/**
* Minimum Obsidian version compatible with the theme.
*/
minAppVersion: string;
/**
* Name of the theme.
*/
name: string;
/**
* Version of the theme.
*
* @remark Defaults to '0.0.0' if no theme manifest was provided in the repository.
*/
version: "0.0.0" | string;
}
/**
* Function `Title`.
* @public
* @unofficial
*/
export interface TitleFunction extends BasesFunction {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Token extends EditorRange {
/** @todo Documentation incomplete. */
text: string;
/** @todo Documentation incomplete. */
type: "tag" | "external-link" | "internal-link";
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface Tree<T extends TreeItem> {
/**
* Currently active item in tree view.
*/
activeDom: T | null;
/**
* Reference to App.
*/
app: App;
/**
* Container element of the tree view.
*/
containerEl: HTMLElement;
/**
* Currently focused item in tree view.
*/
focusedItem: T | null;
/**
* Handle collapsing of all nodes.
*/
handleCollapseAll: () => void;
/**
* Handle renaming of focused item.
*/
handleRenameFocusedItem: (event: KeyboardEvent) => void;
/**
* ID of the view the tree is associated with.
*/
id: string;
/**
* Facilitates rendering of tree view.
*/
infinityScroll: InfinityScroll;
/**
* Whether all items in the tree are collapsed.
*/
isAllCollapsed: boolean;
/**
* Whether tree items should default to collapsed state.
*/
prefersCollapsed: boolean;
/**
* Request saving of the current fold states.
*/
requestSaveFolds: () => void;
/**
* Key scope for tree view.
*/
scope: Scope;
/**
* Currently selected items in tree view.
*/
selectedDoms: Set<T>;
/**
* The view the tree is associated with.
*/
view: View;
/**
* Root item of the tree view.
*/
get root(): TreeRoot<T>;
/**
* Change the focused item to the next item in specified direction.
*/
changeFocusedItem(direction: "forwards" | "backwards"): void;
/**
* Unselect all selected items in the tree view.
*/
clearSelectedDoms(): void;
/**
* Mark tree item as deselected.
*/
deselectItem(node: T): void;
/**
* Get the local storage key for the saved tree view folds.
*/
getFoldKey(): string;
/**
* Gets the ID of a tree item given its Node.
*/
getNodeId(node: T): string | undefined;
/**
* Handle deletion of selected nodes.
*/
handleDeleteSelectedItems(event: KeyboardEvent): Promise<void>;
/**
* Handle selection of tree item via keyboard event.
*/
handleItemSelection(event: MouseEvent, node: T): void;
/**
* Registers all keyboard actions to the tree view keyscope.
*/
initializeKeyboardNav(): void;
/**
* Check whether item is a valid tree item.
*/
isItem(node: T | undefined): boolean;
/**
* Load the saved fold states of the tree view from local storage.
*/
loadFolds(): void;
/**
* Handle keyboard event for moving/selecting tree item below.
*/
onKeyArrowDown(event: KeyboardEvent): void;
/**
* Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding).
*/
onKeyArrowLeft(event: KeyboardEvent): void;
/**
* Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding).
*/
onKeyArrowRight(event: KeyboardEvent): void;
/**
* Handle keyboard event for moving/selecting tree item above.
*/
onKeyArrowUp(event: KeyboardEvent): void;
/**
* Handle keyboard event for opening tree item.
*/
onKeyOpen(event: KeyboardEvent): void;
/**
* Update scroll representation on resize.
*/
onResize(): void;
/**
* Save the current fold states of the tree view to local storage.
*/
saveFolds(): void;
/**
* Mark tree item as selected.
*/
selectItem(node: T): void;
/**
* Set all items in the tree view to be collapsed or expanded.
*/
setCollapseAll(collapse: boolean): void;
/**
* Set the focused item in the tree view.
*/
setFocusedItem(node: T, scrollIntoView?: boolean): void;
/**
* (Un)Collapse all items in the tree view.
*/
toggleCollapseAll(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TreeCollapsibleItem extends TreeItem {
/** @todo Documentation incomplete. */
childrenEl: HTMLElement;
/**
* Current collapsed state of tree item.
*/
collapsed: boolean;
/** @todo Documentation incomplete. */
collapseEl: HTMLElement | null;
/**
* Whether tree item is able to be collapsed or not.
*/
collapsible: boolean;
/**
* Execute collapse functionality on mouse click.
*/
onCollapseClick(event: MouseEvent): void;
/**
* Set collapsed state of tree item.
*
* @param animate - If set to true, will animate on collapse.
*/
setCollapsed(value: boolean, animate?: boolean): Promise<undefined>;
/**
* Set collapsible state of tree item.
*/
setCollapsible(value: boolean): void;
/**
* Toggle collapsed state of tree item.
*
* @param animate - If set to true, will animate on collapse.
*/
toggleCollapsed(animate?: boolean): Promise<undefined>;
/**
* Update the tree item's cover element.
*
* @param animate - If set to true, will animate on collapse.
* @todo Documentation incomplete.
*/
updateCollapsed(animate?: boolean): Promise<undefined>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TreeItem extends TreeNode {
/** @todo Documentation incomplete */
coverEl: HTMLElement;
/** @todo Documentation incomplete */
innerEl: HTMLElement;
/** @todo Documentation incomplete */
selfEl: HTMLElement;
/**
* Execute item functionality on clicking tree item.
*/
onSelfClick(event: MouseEvent): void;
/**
* Set clickable state of tree item.
*/
setClickable(value: boolean): void;
}
/**
* Tree node.
*
* @public
* @unofficial
*/
export interface TreeNode {
/**
* The element of the tree node.
*/
el: HTMLElement;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TreeNodeInfo {
/** @todo Documentation incomplete. */
childLeft: number;
/** @todo Documentation incomplete. */
childLeftPadding: number;
/** @todo Documentation incomplete. */
childTop: number;
/** @todo Documentation incomplete. */
computed: boolean;
/** @todo Documentation incomplete. */
height: number;
/** @todo Documentation incomplete. */
hidden: boolean;
/** @todo Documentation incomplete. */
next: boolean;
/** @todo Documentation incomplete. */
queued: boolean;
/** @todo Documentation incomplete. */
width: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TreeNodeVChildren<Item extends TreeNode, Owner extends TreeNode> {
/** @todo Documentation incomplete. */
_children: Item[];
/** @todo Documentation incomplete. */
owner: Owner;
/** @todo Documentation incomplete. */
get children(): Item[];
/** @todo Documentation incomplete. */
addChild(item: Item): void;
/** @todo Documentation incomplete. */
clear(): void;
/** @todo Documentation incomplete. */
first(): Item | undefined;
/** @todo Documentation incomplete. */
hasChildren(): boolean;
/** @todo Documentation incomplete. */
last(): Item | undefined;
/** @todo Documentation incomplete. */
removeChild(item: Item): void;
/** @todo Documentation incomplete. */
setChildren(children: Item[]): void;
/** @todo Documentation incomplete. */
size(): number;
/** @todo Documentation incomplete. */
sort(compareFn: (a: Item, b: Item) => number): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TreeRoot<Item extends TreeItem> extends TreeNode {
/** @todo Documentation incomplete */
childrenEl: HTMLElement;
/** @todo Documentation incomplete */
info: TreeNodeInfo;
/** @todo Documentation incomplete */
pusherEl: HTMLElement;
/** @todo Documentation incomplete */
vChildren: TreeNodeVChildren<Item, TreeRoot<Item>>;
}
/**
* Function `Trim`.
* @public
* @unofficial
*/
export interface TrimFunction extends BasesFunction {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TypeInfo {
/** @todo Documentation incomplete. */
expected: PropertyWidget;
/** @todo Documentation incomplete. */
inferred: PropertyWidget;
}
/**
* A constructor for a view that is typed to a specific view type.
*
* @public
* @unofficial
*/
export interface TypedViewConstructor<TView extends View, Args extends unknown[] = [
]> extends ConstructorBase<[
leaf: WorkspaceLeaf,
...args: Args
], TView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface TypedWorkspaceLeaf<TView extends View> extends WorkspaceLeaf {
/** @todo Documentation incomplete. */
view: MaybeDeferredView<TView>;
}
/**
* Function `Unique`.
* @public
* @unofficial
*/
export interface UniqueFunction extends BasesFunction {
}
/**
* Property widget component for unknown types.
*
* @public
* @unofficial
*/
export interface UnknownPropertyWidgetComponent extends PropertyWidgetComponentBase {
/** The element of the property widget. */
el: HTMLSpanElement;
/** The type of the property widget. */
type: "unknown";
}
/**
* Views of plugins that have been deactivated become an UnknownView.
*
* @remark This is probably not the right term.
* @public
* @unofficial
*/
export interface UnknownView extends EmptyView {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface UrlBookmarkItem extends BookmarkItem {
/** @todo Documentation incomplete. */
title: string;
/** @todo Documentation incomplete. */
type: "url";
/** @todo Documentation incomplete. */
url: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VaultFileMapRecord extends Record<string, TAbstractFile> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VideoView extends EditableFileView {
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Video;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VideoViewConstructor extends TypedViewConstructor<VideoView> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ViewEphemeralState {
/** @todo Documentation incomplete. */
cursor?: EditorRangeOrCaret;
/** @todo Documentation incomplete. */
focus: boolean;
/** @todo Documentation incomplete. */
focusOnMobile: boolean;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ViewRegistry extends Events {
/**
* Mapping of file extensions to view type.
*/
typeByExtension: ViewRegistryTypeByExtensionRecord;
/**
* Mapping of view type to view constructor.
*/
viewByType: ViewRegistryViewByTypeRecord;
/**
* Get the view type associated with a file extension.
*
* @param extension - File extension.
*/
getTypeByExtension(extension: string): string | undefined;
/** @todo Documentation incomplete. */
getViewCreatorByType(type: string): ViewCreator | undefined;
/**
* Get the view constructor associated with a view type.
*/
getViewCreatorByType<TViewType extends ViewTypeType>(type: TViewType): TypedViewCreator<ViewTypeViewMapping[TViewType]> | undefined;
/**
* Check whether a view type is registered.
*/
isExtensionRegistered(extension: string): boolean;
/**
* Called when the file extensions mapping has been updated.
*/
on(name: "extensions-updated", callback: () => void): EventRef;
/**
* Called when a view of type has been registered into the registry.
*/
on(name: "view-registered", callback: (type: string) => void): EventRef;
/**
* Called when a view of type has been unregistered from the registry.
*/
on(name: "view-unregistered", callback: (type: string) => void): EventRef;
/**
* Register a view type for a file extension.
*
* @param extension - File extension.
* @param type - View type.
* @remark Prefer registering the extension via the Plugin class.
*/
registerExtensions(extension: string[], type: string): void;
/**
* Register a view constructor for a view type.
*/
registerView(type: string, viewCreator: ViewCreator): void;
/**
* Register a view and its associated file extensions.
*/
registerViewWithExtensions(extensions: string[], type: string, viewCreator: ViewCreator): void;
/**
* Unregister extensions for a view type.
*/
unregisterExtensions(extension: string[]): void;
/**
* Unregister a view type.
*/
unregisterView(type: string): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ViewRegistryTypeByExtensionRecord extends Record<string, string> {
/** @todo Documentation incomplete. */
[FileExtension._3gp]: typeof ViewType.Audio;
/** @todo Documentation incomplete. */
[FileExtension.avif]: typeof ViewType.Image;
/** @todo Documentation incomplete. */
[FileExtension.bmp]: typeof ViewType.Image;
/** @todo Documentation incomplete. */
[FileExtension.canvas]: typeof ViewType.Canvas;
/** @todo Documentation incomplete. */
[FileExtension.flac]: typeof ViewType.Audio;
/** @todo Documentation incomplete. */
[FileExtension.gif]: typeof ViewType.Image;
/** @todo Documentation incomplete. */
[FileExtension.jpeg]: typeof ViewType.Image;
/** @todo Documentation incomplete. */
[FileExtension.jpg]: typeof ViewType.Image;
/** @todo Documentation incomplete. */
[FileExtension.m4a]: typeof ViewType.Audio;
/** @todo Documentation incomplete. */
[FileExtension.md]: typeof ViewType.Markdown;
/** @todo Documentation incomplete. */
[FileExtension.mkv]: typeof ViewType.Video;
/** @todo Documentation incomplete. */
[FileExtension.mov]: typeof ViewType.Video;
/** @todo Documentation incomplete. */
[FileExtension.mp3]: typeof ViewType.Audio;
/** @todo Documentation incomplete. */
[FileExtension.mp4]: typeof ViewType.Video;
/** @todo Documentation incomplete. */
[FileExtension.oga]: typeof ViewType.Audio;
/** @todo Documentation incomplete. */
[FileExtension.ogg]: typeof ViewType.Audio;
/** @todo Documentation incomplete. */
[FileExtension.ogv]: typeof ViewType.Video;
/** @todo Documentation incomplete. */
[FileExtension.opus]: typeof ViewType.Audio;
/** @todo Documentation incomplete. */
[FileExtension.pdf]: typeof ViewType.Pdf;
/** @todo Documentation incomplete. */
[FileExtension.png]: typeof ViewType.Image;
/** @todo Documentation incomplete. */
[FileExtension.svg]: typeof ViewType.Image;
/** @todo Documentation incomplete. */
[FileExtension.wav]: typeof ViewType.Audio;
/** @todo Documentation incomplete. */
[FileExtension.webm]: typeof ViewType.Video;
/** @todo Documentation incomplete. */
[FileExtension.webp]: typeof ViewType.Image;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ViewRegistryViewByTypeRecord extends Record<string, ViewCreator>, Mapping {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VimApi {
/** @todo Documentation incomplete. */
suppressErrorLogging: boolean;
/** @todo Documentation incomplete. */
_mapCommand(command: unknown): unknown;
/** @todo Documentation incomplete. */
buildKeyMap(): void;
/** @todo Documentation incomplete. */
defineAction(name: string, fn: (cm: VimEditor, actionArgs: unknown, vim: VimState["vim"]) => void): void;
/** @todo Documentation incomplete. */
defineEx(name: unknown, prefix: unknown, func: unknown): unknown;
/** @todo Documentation incomplete. */
defineMotion(name: unknown, fn: unknown): unknown;
/** @todo Documentation incomplete. */
defineOperator(name: unknown, fn: unknown): unknown;
/** @todo Documentation incomplete. */
defineOption(name: unknown, defaultValue: unknown, type: unknown, aliases: unknown, callback: unknown): unknown;
/** @todo Documentation incomplete. */
defineRegister(name: unknown, register: unknown): unknown;
/** @todo Documentation incomplete. */
enterInsertMode(cm: unknown): unknown;
/** @todo Documentation incomplete. */
enterVimMode(cm: unknown): unknown;
/** @todo Documentation incomplete. */
exitInsertMode(cm: unknown, keepCursor: unknown): unknown;
/** @todo Documentation incomplete. */
exitVisualMode(cm: unknown, moveHead: unknown): unknown;
/** @todo Documentation incomplete. */
findKey(cm: unknown, key: unknown, origin: unknown): unknown;
/** @todo Documentation incomplete. */
getOption(name: unknown, cm: unknown, cfg: unknown): unknown;
/** @todo Documentation incomplete. */
getRegisterController(): unknown;
/** @todo Documentation incomplete. */
getVimGlobalState_(): unknown;
/** @todo Documentation incomplete. */
handleEx(cm: unknown, input: unknown): unknown;
/** @todo Documentation incomplete. */
handleKey(cm: unknown, key: unknown, origin: unknown): unknown;
/** @todo Documentation incomplete. */
InsertModeKey(keyName: string): void;
/** @todo Documentation incomplete. */
leaveVimMode(cm: unknown): unknown;
/** @todo Documentation incomplete. */
map(lhs: unknown, rhs: unknown, ctx: unknown): unknown;
/** @todo Documentation incomplete. */
mapclear(ctx: unknown): unknown;
/** @todo Documentation incomplete. */
mapCommand(keys: unknown, type: unknown, name: unknown, args: unknown, extra: unknown): unknown;
/** @todo Documentation incomplete. */
maybeInitVimState_(cm: unknown): unknown;
/** @todo Documentation incomplete. */
multiSelectHandleKey(cm: unknown, key: unknown, origin: unknown): unknown;
/** @todo Documentation incomplete. */
noremap(lhs: unknown, rhs: unknown, ctx: unknown): unknown;
/** @todo Documentation incomplete. */
resetVimGlobalState_(): unknown;
/** @todo Documentation incomplete. */
setOption(name: unknown, value: unknown, cm: unknown, cfg: unknown): unknown;
/** @todo Documentation incomplete. */
unmap(lhs: unknown, ctx: unknown): unknown;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VimEditor {
/** @todo Documentation incomplete. */
state: VimState;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VimState {
/** @todo Documentation incomplete. */
vim: VimStateVim;
/** @todo Documentation incomplete. */
vimPlugin: VimStateVimPlugin;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VimStateVim {
/** @todo Documentation incomplete. */
inputState: VimStateVimInputState;
/** @todo Documentation incomplete. */
insertMode: false;
/** @todo Documentation incomplete. */
insertModeRepeat: undefined;
/** @todo Documentation incomplete. */
lastEditActionCommand: undefined;
/** @todo Documentation incomplete. */
lastEditInputState: undefined;
/** @todo Documentation incomplete. */
lastHPos: number;
/** @todo Documentation incomplete. */
lastHSPos: number;
/** @todo Documentation incomplete. */
lastMotion: VimStateVimLastMotion;
/** @todo Documentation incomplete. */
lastPastedText: null;
/** @todo Documentation incomplete. */
lastSelection: null;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VimStateVimInputState {
/** @todo Documentation incomplete. */
changeQueue: null;
/** @todo Documentation incomplete. */
keyBuffer: [
];
/** @todo Documentation incomplete. */
motion: null;
/** @todo Documentation incomplete. */
motionArgs: null;
/** @todo Documentation incomplete. */
motionRepeat: [
];
/** @todo Documentation incomplete. */
operator: null;
/** @todo Documentation incomplete. */
operatorArgs: null;
/** @todo Documentation incomplete. */
prefixRepeat: [
];
/** @todo Documentation incomplete. */
registerName: null;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VimStateVimLastMotion {
/** @todo Documentation incomplete. */
name?: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface VimStateVimPlugin {
/** @todo Documentation incomplete. */
lastKeydown: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WeakMapWrapper<K extends object, V> extends WeakMap<K, V> {
/** @todo Documentation incomplete. */
map: WeakMap<K, V>;
}
/**
* Stores and manages all history items and cached fav icons.
*
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WebviewerDBStore {
/**
* Reference to App.
*/
app: App;
/**
* Underlying database used to store history items and fav icons via IndexedDB.
*
* @remark Use methods such as `addHistoryItem` etc. to interact with the stored history.
*/
db: IDBDatabase;
/**
* Add a history item to the database.
*/
addHistoryItem(url: string, title?: string): Promise<void>;
/**
* Clear all history items.
*/
clearHistoryItems(): Promise<void>;
/** @todo Documentation incomplete */
connect(): Promise<void>;
/**
* Get all history items.
*/
getHistoryItems(): Promise<WebviewerHistoryItem[]>;
/**
* Load stored icon in Base64 encoded string. If no stored icon available in the database,
* it also stores the icon.
*
* @param domain - Domain name only, e.g. "obsidian.md".
* @param source - Source url of the icon, e.g. "https://obsidian.md/favicon.ico".
* Used as a fallback source if there is no icon stored with corresponding domain.
* @returns Icon in Base64 encoded string.
*/
loadIcon(domain: string, source?: string): Promise<string | null>;
/**
* Remove specific history item based on its {@link WebviewerHistoryItem.id | id}.
*/
removeHistoryItem(item: WebviewerHistoryItem): Promise<void>;
/**
* Add a fav icon to the element.
*/
setIcon(el: HTMLElement, url: string, source?: string): Promise<void>;
/**
* Store specific icon for the given domain name in Base64 string.
*
* @param domain - Domain name only, e.g. "obsidian.md".
* @param source - Source url of the icon, e.g. "https://obsidian.md/favicon.ico".
* @returns Icon in Base64 encoded string.
*/
storeIcon(domain: string, source?: string): Promise<string | null>;
}
/**
* Description of Webviewer history item.
*
* @public
* @unofficial
*/
export interface WebviewerHistoryItem {
/**
* Timestamp when the URL was visited.
*/
accessTs: number;
/**
* Unique ID of history item.
*/
id: number;
/**
* Title of the URL.
*/
title: string;
/**
* Destination URL.
*/
url: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WebviewerHistoryView extends ItemView {
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.WebviewerHistory;
/** @todo Documentation incomplete */
update(): Promise<unknown>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WebviewerHistoryViewConstructor extends TypedViewConstructor<WebviewerHistoryView, [
browserPluginInstance: WebviewerPluginInstance
]> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WebviewerPlugin extends InternalPlugin<WebviewerPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WebviewerPluginInstance extends InternalPluginInstance<WebviewerPlugin> {
/**
* Stored history items and cached fav icons.
*/
db: WebviewerDBStore;
/** @todo Documentation incomplete. */
defaultOn: false;
/** @todo Documentation incomplete. */
pendingIgnoredURLs: string[];
/** @todo Documentation incomplete. */
getSearchEngineUrl(searchQuery: string): string;
/** @todo Documentation incomplete. */
handleOpenUrl(event: CustomEvent<{
url: string;
newLeaf?: PaneType | boolean;
active?: boolean;
}>): void;
/** @todo Documentation incomplete. */
openUrl(url: string, newLeaf?: PaneType | boolean, active?: boolean): void;
/** @todo Documentation incomplete. */
openUrlExternally(url: string): void;
/** @todo Documentation incomplete. */
updateSession(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WebviewerView extends ItemView {
/** @todo Documentation incomplete */
closeSearch(): void;
/** @todo Documentation incomplete */
commitPageLoad(): unknown;
/** @todo Documentation incomplete */
configureWebContents(): void;
/** @todo Documentation incomplete */
contextMenuItemsForImg(e: unknown): unknown;
/** @todo Documentation incomplete */
contextMenuItemsForLink(e: unknown, t: unknown): unknown;
/** @todo Documentation incomplete */
contextMenuItemsForSelection(e: unknown, t: unknown): unknown;
/** @todo Documentation incomplete */
displayBlank(): void;
/** @todo Documentation incomplete */
displayContextMenu(e: unknown): void;
/**
* Shows the error view.
*/
displayErrorView(): void;
/** @todo Documentation incomplete */
displayReaderView(): Promise<unknown>;
/**
* Shows the webview.
*/
displayWebView(): void;
/** @todo Documentation incomplete */
getReaderModeContent(): Promise<unknown>;
/**
* Get the current view type.
*/
getViewType(): typeof ViewType.Webviewer;
/** @todo Documentation incomplete */
hideAll(): void;
/**
* Setup the webview.
*/
instantiateWebView(): void;
/** @todo Documentation incomplete */
navigate(e: unknown, t: unknown): unknown;
/** @todo Documentation incomplete */
onCheckboxClick(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
onExternalLinkClick(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
onExternalLinkRightClick(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
onFoldChange(): void;
/** @todo Documentation incomplete */
onInternalLinkClick(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
onInternalLinkDrag(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
onInternalLinkMouseover(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
onInternalLinkRightClick(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
onReaderModeContextMenu(e: unknown): void;
/** @todo Documentation incomplete */
onRenderComplete(): void;
/** @todo Documentation incomplete */
onScroll(): void;
/** @todo Documentation incomplete */
onTagClick(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
postProcess(e: unknown, t: unknown, n: unknown): void;
/** @todo Documentation incomplete */
pushViewStackHistory(e: unknown): void;
/** @todo Documentation incomplete */
reportPageLoad(url: string, title: string, navigate: unknown): void;
/** @todo Documentation incomplete */
saveAsMarkdown(): Promise<unknown>;
/** @todo Documentation incomplete */
selectFavicon(e: unknown): unknown;
/** @todo Documentation incomplete */
setFavicon(e: unknown): unknown;
/** @todo Documentation incomplete */
showSearch(): void;
/**
* Stores the title of the current webview.
*/
storeCurrentPageTitle(): Promise<unknown>;
/**
* Toggles the reader mode.
*/
toggleReaderMode(): void;
/**
* Zoom in the webview.
*/
zoomIn(): void;
/**
* Zoom out the webview.
*/
zoomOut(): void;
/**
* Resets the zoom factor of the webview.
*/
zoomReset(): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WebviewerViewConstructor extends TypedViewConstructor<WebviewerView, [
browserPluginInstance: WebviewerPluginInstance
]> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WidgetEditorView extends EmbeddedEditorView {
/**
* Data after reference.
*/
after: string;
/**
* Data before reference.
*/
before: string;
/**
* Full file contents.
*/
data: string;
/**
* File being currently renamed.
*/
fileBeingRenamed: null | TFile;
/**
* Current heading.
*/
heading: string;
/**
* Indent.
*/
indent: string;
/**
* Inline title element.
*/
inlineTitleEl: HTMLElement;
/**
* Full inline content string.
*/
lastSavedData: null | string;
/**
* Whether embedding should be saved twice on save.
*/
saveAgain: boolean;
/**
* Whether the widget is currently saving.
*/
saving: boolean;
/**
* Subpath reference of the path.
*/
subpath: string;
/**
* Whether the subpath was not found in the cache.
*/
subpathNotFound: boolean;
/**
* Push/pop current scope.
*/
applyScope(scope: Scope): void;
/**
* Get the current folds of the editor.
*/
getFoldInfo(): null | FoldInfo;
/**
* Splice incoming data at according to subpath for correct reference, then update heading and render.
*/
loadContents(data: string, cache: CachedMetadata): void;
/**
* Load file from cache based on stored path.
*/
loadFile(): Promise<void>;
/**
* Load file and check if data is different from last saved data, then loads contents.
*/
loadFileInternal(data: string, cache?: CachedMetadata): void;
/**
* Update representation on file finished updating.
*/
onFileChanged(file: TFile, data: string, cache: CachedMetadata): void;
/**
* Update representation on file rename.
*/
onFileRename(file: TAbstractFile, oldPath: string): void;
/**
* On loading widget, register vault change and rename events.
*/
onload(): void;
/**
* Save fold made in the editor to foldManager.
*/
onMarkdownFold(): void;
/**
* On change of editor title element.
*/
onTitleChange(element: HTMLElement): void;
/**
* On keypress on editor title element.
*/
onTitleKeydown(event: KeyboardEvent): void;
/**
* On pasting on editor title element.
*/
onTitlePaste(element: HTMLElement, event: ClipboardEvent): void;
/**
* On unloading widget, unload component and remove scope.
*/
onunload(): void;
/**
* Save changes made in editable widget.
*/
save(data: string, delayed?: boolean): Promise<void>;
/**
* On blur widget, save title.
*/
saveTitle(element: HTMLElement): void;
/**
* Show preview of widget.
*/
showPreview(show?: boolean): void;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WindowSelection {
/** @todo Documentation incomplete. */
focusEl: HTMLElement;
/** @todo Documentation incomplete. */
range: Range;
/** @todo Documentation incomplete. */
win: Window;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WordCountPlugin extends InternalPlugin<WordCountPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WordCountPluginInstance extends InternalPluginInstance<WordCountPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
defaultOn: true;
/** @todo Documentation incomplete. */
plugin: WordCountPlugin;
}
/**
* Worker results.
*
* @public
* @unofficial
*/
export interface WorkerResults {
/** @todo Documentation incomplete. */
buffer: SharedArrayBuffer;
/** @todo Documentation incomplete. */
id: number[];
/** @todo Documentation incomplete. */
v?: number;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WorkspaceHoverLinkSourcesRecord extends Record<string, HoverLinkSource> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WorkspaceLeafHistory {
/** @todo Documentation incomplete. */
backHistory: WorkspaceLeafHistoryState[];
/** @todo Documentation incomplete. */
forwardHistory: WorkspaceLeafHistoryState[];
/** @todo Documentation incomplete. */
owner: WorkspaceLeaf;
/** @todo Documentation incomplete. */
back(): Promise<void>;
/** @todo Documentation incomplete. */
deserialize(e: SerializedWorkspaceLeafHistory): void;
/** @todo Documentation incomplete. */
forward(): Promise<void>;
/** @todo Documentation incomplete. */
go(step: number): Promise<void>;
/** @todo Documentation incomplete. */
pushState(state: WorkspaceLeafHistoryState): void;
/** @todo Documentation incomplete. */
serialize(): SerializedWorkspaceLeafHistory;
/** @todo Documentation incomplete. */
updateState(state: WorkspaceLeafHistoryState): Promise<void>;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WorkspaceLeafHistoryState {
/** @todo Documentation incomplete. */
eState: unknown;
/** @todo Documentation incomplete. */
icon: IconName;
/** @todo Documentation incomplete. */
state: unknown;
/** @todo Documentation incomplete. */
title: string;
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WorkspacesPlugin extends InternalPlugin<WorkspacesPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface WorkspacesPluginInstance extends InternalPluginInstance<WorkspacesPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
plugin: WorkspacesPlugin;
}
/**
* Function `Year`.
* @public
* @unofficial
*/
export interface YearFunction extends BasesFunction, HasExtract {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ZkPrefixerPlugin extends InternalPlugin<ZkPrefixerPluginInstance> {
}
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export interface ZkPrefixerPluginInstance extends InternalPluginInstance<ZkPrefixerPlugin> {
/** @todo Documentation incomplete. */
app: App;
/** @todo Documentation incomplete. */
plugin: ZkPrefixerPlugin;
}
/**
* The constructor for the CapacitorAdapterFs class.
*
* @public
* @unofficial
*/
export type CapacitorAdapterFsConstructor = new (dir: string) => CapacitorAdapterFs;
/**
* Handler function for post processing a code block.
*
* @public
* @unofficial
*/
export type CodeBlockPostProcessorHandler = (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise<void> | void;
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type ConfigItem = "accentColor" | "alwaysUpdateLinks" | "attachmentFolderPath" | "autoConvertHtml" | "autoPairBrackets" | "autoPairMarkdown" | "baseFontSize" | "baseFontSizeAction" | "cssTheme" | "defaultViewMode" | "enabledCssSnippets" | "focusNewTab" | "foldHeading" | "foldIndent" | "hotkeys" | "interfaceFontFamily" | "livePreview" | "mobilePullAction" | "mobileQuickRibbonItem" | "mobileToolbarCommands" | "monospaceFontFamily" | "nativeMenus" | "newFileFolderPath" | "newFileLocation" | "newLinkFormat" | "pdfExportSettings" | "promptDelete" | "propertiesInDocument" | "readableLineLength" | "rightToLeft" | "showIndentGuide" | "showInlineTitle" | "showLineNumber" | "showRibbon" | "showUnsupportedFiles" | "showViewHeader" | "smartIndentList" | "spellcheck" | "spellcheckLanguages" | "strictLineBreaks" | "tabSize" | "textFontFamily" | "theme" | "translucency" | "trashOption" | "types" | "uriCallbacks" | "useMarkdownLinks" | "useTab" | "userIgnoreFilters" | "vimMode";
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type ContentPosition = [
startOffset: number,
endOffset: number
];
/**
* Creates an embed component for a given file.
*
* @param context - Context used to embed the file.
* @param file - File to embed.
* @param subpath - Optional subpath within the file.
* @returns An embed component.
*
* @public
* @unofficial
*/
export type EmbedCreator = (context: EmbedContext, file: TFile, subpath?: string) => EmbedComponent;
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type FileExplorerViewSortOrder = "alphabetical" | "alphabeticalReverse" | "byCreatedTime" | "byCreatedTimeReverse" | "byModifiedTime" | "byModifiedTimeReverse";
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type FileTreeItemParent = FolderTreeItem | TreeRoot<FileTreeItem | FolderTreeItem>;
/**
* @todo Documentation incomplete.
* @public
* @unofficial
*/
export type FocusMode = "both" | "end" | "start";
/**
* Available color types.
*
* @public
* @unofficial
*/
export type GraphColor = "arrow" | "circle" | "fill" | "fillAttachment" | "fillFocused" | "fillHighlight" | "fillTag" | "fillUnresolved" | "line" | "lineHighlight" | "text";
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type InternalPluginNameInstancesMapping = {
[InternalPluginName.AudioRecorder]: AudioRecorderPluginInstance;
[InternalPluginName.Backlink]: BacklinkPluginInstance;
[InternalPluginName.Bases]: BasesPluginInstance;
[InternalPluginName.Bookmarks]: BookmarksPluginInstance;
[InternalPluginName.Webviewer]: WebviewerPluginInstance;
[InternalPluginName.Canvas]: CanvasPluginInstance;
[InternalPluginName.CommandPalette]: CommandPalettePluginInstance;
[InternalPluginName.DailyNotes]: DailyNotesPluginInstance;
[InternalPluginName.EditorStatus]: EditorStatusPluginInstance;
[InternalPluginName.FileExplorer]: FileExplorerPluginInstance;
[InternalPluginName.FileRecovery]: FileRecoveryPluginInstance;
[InternalPluginName.Footnotes]: FootnotesPluginInstance;
[InternalPluginName.GlobalSearch]: GlobalSearchPluginInstance;
[InternalPluginName.Graph]: GraphPluginInstance;
[InternalPluginName.MarkdownImporter]: MarkdownImporterPluginInstance;
[InternalPluginName.NoteComposer]: NoteComposerPluginInstance;
[InternalPluginName.OutgoingLink]: OutgoingLinkPluginInstance;
[InternalPluginName.Outline]: OutlinePluginInstance;
[InternalPluginName.PagePreview]: PagePreviewPluginInstance;
[InternalPluginName.Properties]: PropertiesPluginInstance;
[InternalPluginName.Publish]: PublishPluginInstance;
[InternalPluginName.RandomNote]: RandomNotePluginInstance;
[InternalPluginName.SlashCommand]: SlashCommandPluginInstance;
[InternalPluginName.Slides]: SlidesPluginInstance;
[InternalPluginName.Switcher]: SwitcherPluginInstance;
[InternalPluginName.Sync]: SyncPluginInstance;
[InternalPluginName.TagPane]: TagPanePluginInstance;
[InternalPluginName.Templates]: TemplatesPluginInstance;
[InternalPluginName.WordCount]: WordCountPluginInstance;
[InternalPluginName.Workspaces]: WorkspacesPluginInstance;
[InternalPluginName.ZkPrefixer]: ZkPrefixerPluginInstance;
};
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type InternalPluginNamePluginsMapping = {
[InternalPluginName.AudioRecorder]: AudioRecorderPlugin;
[InternalPluginName.Backlink]: BacklinkPlugin;
[InternalPluginName.Bases]: BasesPlugin;
[InternalPluginName.Bookmarks]: BookmarksPlugin;
[InternalPluginName.Webviewer]: WebviewerPlugin;
[InternalPluginName.Canvas]: CanvasPlugin;
[InternalPluginName.CommandPalette]: CommandPalettePlugin;
[InternalPluginName.DailyNotes]: DailyNotesPlugin;
[InternalPluginName.EditorStatus]: EditorStatusPlugin;
[InternalPluginName.FileExplorer]: FileExplorerPlugin;
[InternalPluginName.FileRecovery]: FileRecoveryPlugin;
[InternalPluginName.Footnotes]: FootnotesPlugin;
[InternalPluginName.GlobalSearch]: GlobalSearchPlugin;
[InternalPluginName.Graph]: GraphPlugin;
[InternalPluginName.MarkdownImporter]: MarkdownImporterPlugin;
[InternalPluginName.NoteComposer]: NoteComposerPlugin;
[InternalPluginName.OutgoingLink]: OutgoingLinkPlugin;
[InternalPluginName.Outline]: OutlinePlugin;
[InternalPluginName.PagePreview]: PagePreviewPlugin;
[InternalPluginName.Properties]: PropertiesPlugin;
[InternalPluginName.Publish]: PublishPlugin;
[InternalPluginName.RandomNote]: RandomNotePlugin;
[InternalPluginName.SlashCommand]: SlashCommandPlugin;
[InternalPluginName.Slides]: SlidesPlugin;
[InternalPluginName.Switcher]: SwitcherPlugin;
[InternalPluginName.Sync]: SyncPlugin;
[InternalPluginName.TagPane]: TagPanePlugin;
[InternalPluginName.Templates]: TemplatesPlugin;
[InternalPluginName.WordCount]: WordCountPlugin;
[InternalPluginName.Workspaces]: WorkspacesPlugin;
[InternalPluginName.ZkPrefixer]: ZkPrefixerPlugin;
};
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type InternalPluginNameType = (typeof InternalPluginName)[keyof typeof InternalPluginName];
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type LinkUpdatesHandler = (linkUpdates: LinkUpdate[]) => Promise<void>;
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type Mapping = {
[TViewType in ViewTypeType]: TypedViewCreator<ViewTypeViewMapping[TViewType]>;
};
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type MaybeDeferredView<TView extends View> = TView | DeferredView;
/**
* Property widget type.
*
* @public
* @unofficial
*/
export type PropertyWidgetType = "aliases" | "checkbox" | "date" | "datetime" | "multitext" | "number" | "tags" | "text" | string;
/**
* The direction of the text.
* @public
* @unofficial
*/
export type TextDirection = "auto" | "ltr" | "rtl";
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type TypedViewCreator<TView extends View> = (leaf: WorkspaceLeaf) => TView;
/**
* View factory.
*
* @public
* @unofficial
*/
export type ViewFactory<TView extends View = View> = (containerEl: HTMLElement) => TView;
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type ViewTypeType = (typeof ViewType)[keyof typeof ViewType];
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type ViewTypeViewConstructorMapping = {
[ViewType.AllProperties]: AllPropertiesViewConstructor;
[ViewType.Audio]: AudioViewConstructor;
[ViewType.Backlink]: BacklinkViewConstructor;
[ViewType.Bases]: BasesViewConstructor;
[ViewType.Bookmarks]: BookmarksViewConstructor;
[ViewType.Webviewer]: WebviewerViewConstructor;
[ViewType.WebviewerHistory]: WebviewerHistoryViewConstructor;
[ViewType.Canvas]: CanvasViewConstructor;
[ViewType.Empty]: EmptyViewConstructor;
[ViewType.FileExplorer]: FileExplorerViewConstructor;
[ViewType.FileProperties]: FilePropertiesViewConstructor;
[ViewType.Graph]: GraphViewConstructor;
[ViewType.Image]: ImageViewConstructor;
[ViewType.LocalGraph]: LocalGraphViewConstructor;
[ViewType.Markdown]: MarkdownViewConstructor;
[ViewType.OutgoingLink]: OutgoingLinkViewConstructor;
[ViewType.Outline]: OutlineViewConstructor;
[ViewType.Pdf]: PdfViewConstructor;
[ViewType.ReleaseNotes]: ReleaseNotesViewConstructor;
[ViewType.Search]: SearchViewConstructor;
[ViewType.Sync]: SyncViewConstructor;
[ViewType.Table]: TableViewConstructor;
[ViewType.Tag]: TagViewConstructor;
[ViewType.Video]: VideoViewConstructor;
};
/**
* @todo Documentation incomplete.
*
* @public
* @unofficial
*/
export type ViewTypeViewMapping = {
[ViewType.AllProperties]: AllPropertiesView;
[ViewType.Audio]: AudioView;
[ViewType.Backlink]: BacklinkView;
[ViewType.Bases]: BasesView;
[ViewType.Bookmarks]: BookmarksView;
[ViewType.Webviewer]: WebviewerView;
[ViewType.WebviewerHistory]: WebviewerHistoryView;
[ViewType.Canvas]: CanvasView;
[ViewType.Empty]: EmptyView;
[ViewType.FileExplorer]: FileExplorerView;
[ViewType.FileProperties]: FilePropertiesView;
[ViewType.Graph]: GraphView;
[ViewType.Image]: ImageView;
[ViewType.LocalGraph]: LocalGraphView;
[ViewType.Markdown]: MarkdownView;
[ViewType.OutgoingLink]: OutgoingLinkView;
[ViewType.Outline]: OutlineView;
[ViewType.Pdf]: PdfView;
[ViewType.ReleaseNotes]: ReleaseNotesView;
[ViewType.Search]: SearchView;
[ViewType.Sync]: SyncView;
[ViewType.Table]: TableView;
[ViewType.Tag]: TagView;
[ViewType.Video]: VideoView;
};
export {};