1701 lines
85 KiB
Forth
1701 lines
85 KiB
Forth
|
module rec Obsidian
|
||
|
open System
|
||
|
open Fable.Core
|
||
|
open Fable.Core.JS
|
||
|
open Browser.Types
|
||
|
|
||
|
open System.Drawing
|
||
|
|
||
|
type Array<'T> = System.Collections.Generic.IList<'T>
|
||
|
type Function = System.Action
|
||
|
type RegExp = System.Text.RegularExpressions.Regex
|
||
|
|
||
|
|
||
|
type [<AllowNullLiteral>] IExports =
|
||
|
abstract isBoolean: obj: obj option -> bool
|
||
|
abstract fish: selector: string -> HTMLElement option
|
||
|
abstract fishAll: selector: string -> ResizeArray<HTMLElement>
|
||
|
abstract createDiv: ?o: U2<DomElementInfo, string> * ?callback: (HTMLDivElement -> unit) -> HTMLDivElement
|
||
|
abstract createSpan: ?o: U2<DomElementInfo, string> * ?callback: (HTMLSpanElement -> unit) -> HTMLSpanElement
|
||
|
abstract createFragment: ?callback: (DocumentFragment -> unit) -> DocumentFragment
|
||
|
abstract ajax: options: AjaxOptions -> unit
|
||
|
abstract ajaxPromise: options: AjaxOptions -> Promise<obj option>
|
||
|
abstract ready: fn: (unit -> obj option) -> unit
|
||
|
abstract AbstractTextComponent: AbstractTextComponentStatic
|
||
|
/// <summary>Adds an icon to the library</summary>
|
||
|
/// <param name="iconId">- the icon ID</param>
|
||
|
/// <param name="svgContent">- the content of the SVG, without the <svg>. Must fit viewBox="0 0 100 100".</param>
|
||
|
abstract addIcon: iconId: string * svgContent: string -> unit
|
||
|
abstract App: AppStatic
|
||
|
abstract BaseComponent: BaseComponentStatic
|
||
|
abstract ButtonComponent: ButtonComponentStatic
|
||
|
abstract Component: ComponentStatic
|
||
|
abstract Constructor: ConstructorStatic
|
||
|
/// <summary>A standard debounce function.</summary>
|
||
|
/// <param name="cb">- The function to call.</param>
|
||
|
/// <param name="timeout">- The timeout to wait.</param>
|
||
|
/// <param name="resetTimer">- Whether to reset the timeout when the debouncer is called again.</param>
|
||
|
abstract debounce: cb: (obj -> obj option) * ?timeout: float * ?resetTimer: bool -> Debouncer<'T>
|
||
|
abstract DropdownComponent: DropdownComponentStatic
|
||
|
abstract EditableFileView: EditableFileViewStatic
|
||
|
abstract Editor: EditorStatic
|
||
|
abstract EditorSuggest: EditorSuggestStatic
|
||
|
abstract Events: EventsStatic
|
||
|
abstract ExtraButtonComponent: ExtraButtonComponentStatic
|
||
|
abstract FileManager: FileManagerStatic
|
||
|
abstract FileSystemAdapter: FileSystemAdapterStatic
|
||
|
abstract FileView: FileViewStatic
|
||
|
/// Flush the MathJax stylesheet.
|
||
|
abstract finishRenderMath: unit -> Promise<unit>
|
||
|
abstract fuzzySearch: q: PreparedQuery * text: string -> SearchResult option
|
||
|
abstract FuzzySuggestModal: FuzzySuggestModalStatic
|
||
|
abstract getAllTags: cache: CachedMetadata -> ResizeArray<string> option
|
||
|
abstract getLinkpath: linktext: string -> string
|
||
|
abstract HoverPopover: HoverPopoverStatic
|
||
|
/// Converts HTML to Markdown using Turndown Service.
|
||
|
abstract htmlToMarkdown: html: string -> string
|
||
|
abstract ItemView: ItemViewStatic
|
||
|
/// Iterate links and embeds. If callback returns true, the iteration process will be interrupted.
|
||
|
abstract iterateCacheRefs: cache: CachedMetadata * cb: (ReferenceCache -> U2<bool, unit>) -> bool
|
||
|
abstract iterateRefs: refs: ResizeArray<ReferenceCache> * cb: (ReferenceCache -> U2<bool, unit>) -> bool
|
||
|
abstract Keymap: KeymapStatic
|
||
|
/// Load MathJax.
|
||
|
abstract loadMathJax: unit -> Promise<unit>
|
||
|
/// Load Mermaid and return a promise to the global mermaid object.
|
||
|
/// Can also use `mermaid` after this promise resolves to get the same reference.
|
||
|
abstract loadMermaid: unit -> Promise<obj option>
|
||
|
/// 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.
|
||
|
abstract loadPdfJs: unit -> Promise<obj option>
|
||
|
/// Load Prism.js and return a promise to the global Prism object.
|
||
|
/// Can also use `Prism` after this promise resolves to get the same reference.
|
||
|
abstract loadPrism: unit -> Promise<obj option>
|
||
|
abstract MarkdownEditView: MarkdownEditViewStatic
|
||
|
abstract MarkdownPreviewRenderer: MarkdownPreviewRendererStatic
|
||
|
abstract MarkdownPreviewView: MarkdownPreviewViewStatic
|
||
|
abstract MarkdownRenderChild: MarkdownRenderChildStatic
|
||
|
abstract MarkdownRenderer: MarkdownRendererStatic
|
||
|
abstract MarkdownSourceView: MarkdownSourceViewStatic
|
||
|
abstract MarkdownView: MarkdownViewStatic
|
||
|
abstract Menu: MenuStatic
|
||
|
abstract MenuItem: MenuItemStatic
|
||
|
abstract MetadataCache: MetadataCacheStatic
|
||
|
abstract Modal: ModalStatic
|
||
|
abstract MomentFormatComponent: MomentFormatComponentStatic
|
||
|
abstract normalizePath: path: string -> string
|
||
|
abstract Notice: NoticeStatic
|
||
|
abstract parseFrontMatterAliases: frontmatter: obj option option -> ResizeArray<string> option
|
||
|
abstract parseFrontMatterEntry: frontmatter: obj option option * key: U2<string, RegExp> -> obj option option
|
||
|
abstract parseFrontMatterStringArray: frontmatter: obj option option * key: U2<string, RegExp> * ?nospaces: bool -> ResizeArray<string> option
|
||
|
abstract parseFrontMatterTags: frontmatter: obj option option -> ResizeArray<string> option
|
||
|
abstract parseLinktext: linktext: string -> ParseLinktextReturn
|
||
|
abstract parseYaml: yaml: string -> obj option
|
||
|
abstract Plugin: PluginStatic
|
||
|
abstract PluginSettingTab: PluginSettingTabStatic
|
||
|
abstract PopoverSuggest: PopoverSuggestStatic
|
||
|
/// <summary>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.</summary>
|
||
|
/// <param name="query">- the fuzzy query.</param>
|
||
|
abstract prepareFuzzySearch: query: string -> (string -> SearchResult option)
|
||
|
abstract prepareQuery: query: string -> PreparedQuery
|
||
|
/// <summary>Construct a simple search callback that runs on a target string.</summary>
|
||
|
/// <param name="query">- the space-separated words</param>
|
||
|
abstract prepareSimpleSearch: query: string -> (string -> SearchResult option)
|
||
|
abstract renderMatches: el: U2<HTMLElement, DocumentFragment> * text: string * matches: SearchMatches option * ?offset: float -> unit
|
||
|
/// Render some LaTeX math using the MathJax engine. Returns an HTMLElement.
|
||
|
/// Requires calling `finishRenderMath` when rendering is all done to flush the MathJax stylesheet.
|
||
|
abstract renderMath: source: string * display: bool -> HTMLElement
|
||
|
abstract renderResults: el: HTMLElement * text: string * result: SearchResult * ?offset: float -> unit
|
||
|
/// Similar to `fetch()`, request a URL using HTTP/HTTPS, without any CORS restrictions.
|
||
|
/// Returns the text value of the response.
|
||
|
abstract request: request: RequestUrlParam -> Promise<string>
|
||
|
/// Similar to `fetch()`, request a URL using HTTP/HTTPS, without any CORS restrictions.
|
||
|
abstract requestUrl: request: RequestUrlParam -> Promise<RequestUrlResponse>
|
||
|
/// 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.
|
||
|
abstract requireApiVersion: version: string -> bool
|
||
|
abstract resolveSubpath: cache: CachedMetadata * subpath: string -> U2<HeadingSubpathResult, BlockSubpathResult>
|
||
|
abstract sanitizeHTMLToDom: html: string -> DocumentFragment
|
||
|
abstract Scope: ScopeStatic
|
||
|
abstract SearchComponent: SearchComponentStatic
|
||
|
/// <param name="parent">- the HTML element to insert the icon</param>
|
||
|
/// <param name="iconId">- the icon ID</param>
|
||
|
/// <param name="size">- the pixel size for width and height, defaults to 16</param>
|
||
|
abstract setIcon: parent: HTMLElement * iconId: string * ?size: float -> unit
|
||
|
abstract Setting: SettingStatic
|
||
|
abstract SettingTab: SettingTabStatic
|
||
|
abstract SliderComponent: SliderComponentStatic
|
||
|
abstract sortSearchResults: results: ResizeArray<SearchResultContainer> -> unit
|
||
|
abstract stringifyYaml: obj: obj option -> string
|
||
|
/// This function normalizes headings for link matching by stripping out special characters and shrinking consecutive spaces.
|
||
|
abstract stripHeading: heading: string -> string
|
||
|
abstract SuggestModal: SuggestModalStatic
|
||
|
abstract TAbstractFile: TAbstractFileStatic
|
||
|
abstract Tasks: TasksStatic
|
||
|
abstract TextAreaComponent: TextAreaComponentStatic
|
||
|
abstract TextComponent: TextComponentStatic
|
||
|
abstract TextFileView: TextFileViewStatic
|
||
|
abstract TFile: TFileStatic
|
||
|
abstract TFolder: TFolderStatic
|
||
|
abstract ToggleComponent: ToggleComponentStatic
|
||
|
abstract ValueComponent: ValueComponentStatic
|
||
|
abstract Vault: VaultStatic
|
||
|
abstract View: ViewStatic
|
||
|
abstract Workspace: WorkspaceStatic
|
||
|
abstract WorkspaceItem: WorkspaceItemStatic
|
||
|
abstract WorkspaceLeaf: WorkspaceLeafStatic
|
||
|
abstract WorkspaceMobileDrawer: WorkspaceMobileDrawerStatic
|
||
|
abstract WorkspaceParent: WorkspaceParentStatic
|
||
|
abstract WorkspaceRibbon: WorkspaceRibbonStatic
|
||
|
abstract WorkspaceSidedock: WorkspaceSidedockStatic
|
||
|
abstract WorkspaceSplit: WorkspaceSplitStatic
|
||
|
abstract WorkspaceTabs: WorkspaceTabsStatic
|
||
|
|
||
|
type [<AllowNullLiteral>] ParseLinktextReturn =
|
||
|
abstract path: string with get, set
|
||
|
abstract subpath: string with get, set
|
||
|
|
||
|
|
||
|
type [<AllowNullLiteral>] ObjectConstructor =
|
||
|
|
||
|
abstract each: ``object``: ObjectConstructorEachObject * callback: ('T -> string -> U2<bool, unit>) * ?context: obj -> bool
|
||
|
abstract assign: target: obj option * [<ParamArray>] sources: obj option -> obj option
|
||
|
abstract entries: obj: obj option -> ResizeArray<obj option>
|
||
|
|
||
|
type [<AllowNullLiteral>] ObjectConstructorEachObject =
|
||
|
[<Emit "$0[$1]{{=$2}}">] abstract Item: key: string -> obj with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] Math =
|
||
|
abstract clamp: value: float * min: float * max: float -> float
|
||
|
abstract square: value: float -> float
|
||
|
|
||
|
type [<AllowNullLiteral>] StringConstructor =
|
||
|
abstract isString: obj: obj option -> bool
|
||
|
|
||
|
type [<AllowNullLiteral>] String =
|
||
|
abstract contains: target: string -> bool
|
||
|
abstract startsWith: searchString: string * ?position: float -> bool
|
||
|
abstract endsWith: target: string * ?length: float -> bool
|
||
|
abstract format: [<ParamArray>] args: ResizeArray<string> -> string
|
||
|
|
||
|
type [<AllowNullLiteral>] NumberConstructor =
|
||
|
abstract isNumber: obj: obj option -> bool
|
||
|
|
||
|
type [<AllowNullLiteral>] Window =
|
||
|
inherit EventTarget
|
||
|
inherit GlobalEventHandlers
|
||
|
inherit WindowLocalStorage
|
||
|
inherit WindowSessionStorage
|
||
|
abstract isBoolean: obj: obj option -> bool
|
||
|
abstract fish: selector: string -> HTMLElement option
|
||
|
abstract fishAll: selector: string -> ResizeArray<HTMLElement>
|
||
|
abstract ElementList: obj option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] Element =
|
||
|
inherit Node
|
||
|
abstract getText: unit -> string
|
||
|
abstract setText: ``val``: U2<string, DocumentFragment> -> unit
|
||
|
abstract addClass: [<ParamArray>] classes: ResizeArray<string> -> unit
|
||
|
abstract addClasses: classes: ResizeArray<string> -> unit
|
||
|
abstract removeClass: [<ParamArray>] classes: ResizeArray<string> -> unit
|
||
|
abstract removeClasses: classes: ResizeArray<string> -> unit
|
||
|
abstract toggleClass: classes: U2<string, ResizeArray<string>> * value: bool -> unit
|
||
|
abstract hasClass: cls: string -> bool
|
||
|
abstract setAttr: qualifiedName: string * value: U3<string, float, bool> option -> unit
|
||
|
abstract setAttrs: obj: ElementSetAttrsObj -> unit
|
||
|
abstract getAttr: qualifiedName: string -> string option
|
||
|
abstract matchParent: selector: string * ?lastParent: Element -> Element option
|
||
|
abstract find: selector: string -> Element option
|
||
|
abstract findAll: selector: string -> ResizeArray<HTMLElement>
|
||
|
abstract findAllSelf: selector: string -> ResizeArray<HTMLElement>
|
||
|
|
||
|
type [<AllowNullLiteral>] ElementSetAttrsObj =
|
||
|
[<Emit "$0[$1]{{=$2}}">] abstract Item: key: string -> U3<string, float, bool> option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] Node =
|
||
|
abstract detach: unit -> unit
|
||
|
abstract empty: unit -> unit
|
||
|
abstract insertAfter: other: Node -> unit
|
||
|
abstract indexOf: other: Node -> float
|
||
|
abstract setChildrenInPlace: children: ResizeArray<Node> -> unit
|
||
|
abstract appendText: ``val``: string -> unit
|
||
|
/// Create an element and append it to this node.
|
||
|
abstract createEl: tag: 'K * ?o: U2<DomElementInfo, string> * ?callback: (obj -> unit) -> obj
|
||
|
abstract createDiv: ?o: U2<DomElementInfo, string> * ?callback: (HTMLDivElement -> unit) -> HTMLDivElement
|
||
|
abstract createSpan: ?o: U2<DomElementInfo, string> * ?callback: (HTMLSpanElement -> unit) -> HTMLSpanElement
|
||
|
|
||
|
type [<AllowNullLiteral>] HTMLElement =
|
||
|
inherit Element
|
||
|
abstract show: unit -> unit
|
||
|
abstract hide: unit -> unit
|
||
|
abstract toggle: show: bool -> unit
|
||
|
abstract toggleVisibility: visible: bool -> unit
|
||
|
/// 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`.
|
||
|
abstract isShown: unit -> bool
|
||
|
abstract find: selector: string -> HTMLElement
|
||
|
abstract findAll: selector: string -> ResizeArray<HTMLElement>
|
||
|
abstract findAllSelf: selector: string -> ResizeArray<HTMLElement>
|
||
|
abstract _EVENTS: obj option with get, set
|
||
|
abstract on: this: HTMLElement * ``type``: 'K * selector: string * listener: (HTMLElement -> obj -> HTMLElement -> obj option) * ?options: U2<bool, AddEventListenerOptions> -> unit
|
||
|
abstract off: this: HTMLElement * ``type``: 'K * selector: string * listener: (HTMLElement -> obj -> HTMLElement -> obj option) * ?options: U2<bool, AddEventListenerOptions> -> unit
|
||
|
abstract onClickEvent: this: HTMLElement * listener: (HTMLElement -> MouseEvent -> obj option) * ?options: U2<bool, AddEventListenerOptions> -> unit
|
||
|
/// <param name="listener">- the callback to call when this node is inserted into the DOM.</param>
|
||
|
/// <param name="once">- if true, this will only fire once and then unhook itself.</param>
|
||
|
abstract onNodeInserted: this: HTMLElement * listener: (unit -> obj option) * ?once: bool -> (unit -> unit)
|
||
|
abstract trigger: eventType: string -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] DomElementInfo =
|
||
|
/// The class to be assigned. Can be a space-separated string or an array of strings.
|
||
|
abstract cls: U2<string, ResizeArray<string>> option with get, set
|
||
|
/// The textContent to be assigned.
|
||
|
abstract text: U2<string, DocumentFragment> option with get, set
|
||
|
/// HTML attributes to be added.
|
||
|
abstract attr: DomElementInfoAttr option with get, set
|
||
|
/// HTML title (for hover tooltip).
|
||
|
abstract title: string option with get, set
|
||
|
/// The parent element to be assigned to.
|
||
|
abstract parent: Node option with get, set
|
||
|
abstract value: string option with get, set
|
||
|
abstract ``type``: string option with get, set
|
||
|
abstract prepend: bool option with get, set
|
||
|
abstract href: string option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] Document =
|
||
|
abstract _EVENTS: obj option with get, set
|
||
|
abstract on: this: Document * ``type``: 'K * selector: string * listener: (Document -> obj -> HTMLElement -> obj option) * ?options: U2<bool, AddEventListenerOptions> -> unit
|
||
|
abstract off: this: Document * ``type``: 'K * selector: string * listener: (Document -> obj -> HTMLElement -> obj option) * ?options: U2<bool, AddEventListenerOptions> -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] EventListenerInfo =
|
||
|
abstract selector: string with get, set
|
||
|
abstract listener: Function with get, set
|
||
|
abstract options: U2<bool, AddEventListenerOptions> option with get, set
|
||
|
abstract callback: Function with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] AjaxOptions =
|
||
|
abstract ``method``: AjaxOptionsMethod option with get, set
|
||
|
abstract url: string with get, set
|
||
|
abstract success: (obj option -> XMLHttpRequest -> obj option) option with get, set
|
||
|
abstract error: (obj option -> XMLHttpRequest -> obj option) option with get, set
|
||
|
abstract data: U3<obj, string, ArrayBuffer> option with get, set
|
||
|
abstract headers: obj option with get, set
|
||
|
abstract withCredentials: bool option with get, set
|
||
|
abstract req: XMLHttpRequest option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] AbstractTextComponent<'T> =
|
||
|
inherit ValueComponent<string>
|
||
|
abstract inputEl: 'T with get, set
|
||
|
abstract setDisabled: disabled: bool -> AbstractTextComponent<'T>
|
||
|
abstract getValue: unit -> string
|
||
|
abstract setValue: value: string -> AbstractTextComponent<'T>
|
||
|
abstract setPlaceholder: placeholder: string -> AbstractTextComponent<'T>
|
||
|
abstract onChanged: unit -> unit
|
||
|
abstract onChange: callback: (string -> obj option) -> AbstractTextComponent<'T>
|
||
|
|
||
|
type [<AllowNullLiteral>] AbstractTextComponentStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: inputEl: 'T -> AbstractTextComponent<'T>
|
||
|
|
||
|
type [<AllowNullLiteral>] App =
|
||
|
abstract keymap: Keymap with get, set
|
||
|
abstract scope: Scope with get, set
|
||
|
abstract workspace: Workspace with get, set
|
||
|
abstract vault: Vault with get, set
|
||
|
abstract metadataCache: MetadataCache with get, set
|
||
|
abstract fileManager: FileManager with get, set
|
||
|
/// The last known user interaction event, to help commands find out what modifier keys are pressed.
|
||
|
abstract lastEvent: UserEvent option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] AppStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> App
|
||
|
|
||
|
type [<AllowNullLiteral>] BaseComponent =
|
||
|
abstract disabled: bool with get, set
|
||
|
/// Facilitates chaining
|
||
|
abstract ``then``: cb: (BaseComponent -> obj option) -> BaseComponent
|
||
|
abstract setDisabled: disabled: bool -> BaseComponent
|
||
|
|
||
|
type [<AllowNullLiteral>] BaseComponentStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> BaseComponent
|
||
|
|
||
|
type [<AllowNullLiteral>] BlockCache =
|
||
|
inherit CacheItem
|
||
|
abstract id: string with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] BlockSubpathResult =
|
||
|
inherit SubpathResult
|
||
|
abstract ``type``: string with get, set
|
||
|
abstract block: BlockCache with get, set
|
||
|
abstract list: ListItemCache option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] ButtonComponent =
|
||
|
inherit BaseComponent
|
||
|
abstract buttonEl: HTMLButtonElement with get, set
|
||
|
abstract setDisabled: disabled: bool -> ButtonComponent
|
||
|
abstract setCta: unit -> ButtonComponent
|
||
|
abstract removeCta: unit -> ButtonComponent
|
||
|
abstract setWarning: unit -> ButtonComponent
|
||
|
abstract setTooltip: tooltip: string -> ButtonComponent
|
||
|
abstract setButtonText: name: string -> ButtonComponent
|
||
|
abstract setIcon: icon: string -> ButtonComponent
|
||
|
abstract setClass: cls: string -> ButtonComponent
|
||
|
abstract onClick: callback: (MouseEvent -> obj option) -> ButtonComponent
|
||
|
|
||
|
type [<AllowNullLiteral>] ButtonComponentStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: containerEl: HTMLElement -> ButtonComponent
|
||
|
|
||
|
type [<AllowNullLiteral>] CachedMetadata =
|
||
|
abstract links: ResizeArray<LinkCache> option with get, set
|
||
|
abstract embeds: ResizeArray<EmbedCache> option with get, set
|
||
|
abstract tags: ResizeArray<TagCache> option with get, set
|
||
|
abstract headings: ResizeArray<HeadingCache> option with get, set
|
||
|
/// Sections are root level markdown blocks, which can be used to divide the document up.
|
||
|
abstract sections: ResizeArray<SectionCache> option with get, set
|
||
|
abstract listItems: ResizeArray<ListItemCache> option with get, set
|
||
|
abstract frontmatter: FrontMatterCache option with get, set
|
||
|
abstract blocks: obj option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] CacheItem =
|
||
|
abstract position: Pos with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] CloseableComponent =
|
||
|
abstract close: unit -> obj option
|
||
|
|
||
|
type [<AllowNullLiteral>] Command =
|
||
|
/// Globally unique ID to identify this command.
|
||
|
abstract id: string with get, set
|
||
|
/// Human friendly name for searching.
|
||
|
abstract name: string with get, set
|
||
|
/// Icon ID to be used in the toolbar.
|
||
|
abstract icon: string option with get, set
|
||
|
abstract mobileOnly: bool option with get, set
|
||
|
/// Simple callback, triggered globally.
|
||
|
abstract callback: (unit -> obj option) option with get, set
|
||
|
/// 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 MarkdownSourceView, 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.
|
||
|
abstract checkCallback: (bool -> U2<bool, unit>) option with get, set
|
||
|
/// A command callback that is only triggered when the user is in an editor.
|
||
|
/// Overrides `callback` and `checkCallback`
|
||
|
abstract editorCallback: (Editor -> MarkdownView -> obj option) option with get, set
|
||
|
/// A command callback that is only triggered when the user is in an editor.
|
||
|
/// Overrides `editorCallback`, `callback` and `checkCallback`
|
||
|
abstract editorCheckCallback: (bool -> Editor -> MarkdownView -> U2<bool, unit>) option with get, set
|
||
|
/// 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.
|
||
|
abstract hotkeys: ResizeArray<Hotkey> option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] Component =
|
||
|
/// Load this component and its children
|
||
|
abstract load: unit -> unit
|
||
|
/// Override this to load your component
|
||
|
abstract onload: unit -> unit
|
||
|
/// Unload this component and its children
|
||
|
abstract unload: unit -> unit
|
||
|
/// Override this to unload your component
|
||
|
abstract onunload: unit -> unit
|
||
|
/// Adds a child component, loading it if this component is loaded
|
||
|
abstract addChild: ``component``: 'T -> 'T
|
||
|
/// Removes a child component, unloading it
|
||
|
abstract removeChild: ``component``: 'T -> 'T
|
||
|
/// Registers a callback to be called when unloading
|
||
|
abstract register: cb: (unit -> obj option) -> unit
|
||
|
/// Registers an event to be detached when unloading
|
||
|
abstract registerEvent: eventRef: EventRef -> unit
|
||
|
/// Registers an DOM event to be detached when unloading
|
||
|
abstract registerDomEvent: el: HTMLElement * ``type``: 'K * callback: (HTMLElement -> obj -> obj option) -> unit
|
||
|
/// Registers an key event to be detached when unloading
|
||
|
abstract registerScopeEvent: keyHandler: KeymapEventHandler -> unit
|
||
|
/// 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
|
||
|
abstract registerInterval: id: float -> float
|
||
|
|
||
|
type [<AllowNullLiteral>] ComponentStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> Component
|
||
|
|
||
|
type [<AllowNullLiteral>] Constructor<'T> =
|
||
|
interface end
|
||
|
|
||
|
type [<AllowNullLiteral>] ConstructorStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: [<ParamArray>] args: ResizeArray<obj option> -> Constructor<'T>
|
||
|
|
||
|
type [<AllowNullLiteral>] DataAdapter =
|
||
|
abstract getName: unit -> string
|
||
|
abstract exists: normalizedPath: string * ?sensitive: bool -> Promise<bool>
|
||
|
abstract stat: normalizedPath: string -> Promise<Stat option>
|
||
|
abstract list: normalizedPath: string -> Promise<ListedFiles>
|
||
|
abstract read: normalizedPath: string -> Promise<string>
|
||
|
abstract readBinary: normalizedPath: string -> Promise<ArrayBuffer>
|
||
|
abstract write: normalizedPath: string * data: string * ?options: DataWriteOptions -> Promise<unit>
|
||
|
abstract writeBinary: normalizedPath: string * data: ArrayBuffer * ?options: DataWriteOptions -> Promise<unit>
|
||
|
abstract append: normalizedPath: string * data: string * ?options: DataWriteOptions -> Promise<unit>
|
||
|
abstract getResourcePath: normalizedPath: string -> string
|
||
|
abstract mkdir: normalizedPath: string -> Promise<unit>
|
||
|
abstract trashSystem: normalizedPath: string -> Promise<bool>
|
||
|
abstract trashLocal: normalizedPath: string -> Promise<unit>
|
||
|
abstract rmdir: normalizedPath: string * recursive: bool -> Promise<unit>
|
||
|
abstract remove: normalizedPath: string -> Promise<unit>
|
||
|
abstract rename: normalizedPath: string * normalizedNewPath: string -> Promise<unit>
|
||
|
abstract copy: normalizedPath: string * normalizedNewPath: string -> Promise<unit>
|
||
|
|
||
|
type [<AllowNullLiteral>] DataWriteOptions =
|
||
|
abstract ctime: float option with get, set
|
||
|
abstract mtime: float option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] Debouncer<'T> =
|
||
|
[<Emit "$0($1...)">] abstract Invoke: [<ParamArray>] args: obj -> unit
|
||
|
abstract cancel: unit -> Debouncer<'T>
|
||
|
|
||
|
type [<AllowNullLiteral>] DropdownComponent =
|
||
|
inherit ValueComponent<string>
|
||
|
abstract selectEl: HTMLSelectElement with get, set
|
||
|
abstract setDisabled: disabled: bool -> DropdownComponent
|
||
|
abstract addOption: value: string * display: string -> DropdownComponent
|
||
|
abstract addOptions: options: obj -> DropdownComponent
|
||
|
abstract getValue: unit -> string
|
||
|
abstract setValue: value: string -> DropdownComponent
|
||
|
abstract onChange: callback: (string -> obj option) -> DropdownComponent
|
||
|
|
||
|
type [<AllowNullLiteral>] DropdownComponentStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: containerEl: HTMLElement -> DropdownComponent
|
||
|
|
||
|
type [<AllowNullLiteral>] EditableFileView =
|
||
|
inherit FileView
|
||
|
|
||
|
type [<AllowNullLiteral>] EditableFileViewStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> EditableFileView
|
||
|
|
||
|
/// A common interface that bridges the gap between CodeMirror 5 and CodeMirror 6.
|
||
|
type [<AllowNullLiteral>] Editor =
|
||
|
abstract getDoc: unit -> Editor
|
||
|
abstract refresh: unit -> unit
|
||
|
abstract getValue: unit -> string
|
||
|
abstract setValue: content: string -> unit
|
||
|
/// Get the text at line (0-indexed)
|
||
|
abstract getLine: line: float -> string
|
||
|
abstract setLine: n: float * text: string -> unit
|
||
|
/// Gets the number of lines in the document
|
||
|
abstract lineCount: unit -> float
|
||
|
abstract lastLine: unit -> float
|
||
|
abstract getSelection: unit -> string
|
||
|
abstract somethingSelected: unit -> bool
|
||
|
abstract getRange: from: EditorPosition * ``to``: EditorPosition -> string
|
||
|
abstract replaceSelection: replacement: string * ?origin: string -> unit
|
||
|
abstract replaceRange: replacement: string * from: EditorPosition * ?``to``: EditorPosition * ?origin: string -> unit
|
||
|
abstract getCursor: ?string: EditorGetCursorString -> EditorPosition
|
||
|
abstract listSelections: unit -> ResizeArray<EditorSelection>
|
||
|
abstract setCursor: pos: U2<EditorPosition, float> * ?ch: float -> unit
|
||
|
abstract setSelection: anchor: EditorPosition * ?head: EditorPosition -> unit
|
||
|
abstract setSelections: ranges: ResizeArray<EditorSelectionOrCaret> * ?main: float -> unit
|
||
|
abstract focus: unit -> unit
|
||
|
abstract blur: unit -> unit
|
||
|
abstract hasFocus: unit -> bool
|
||
|
abstract getScrollInfo: unit -> EditorGetScrollInfoReturn
|
||
|
abstract scrollTo: ?x: float * ?y: float -> unit
|
||
|
abstract scrollIntoView: range: EditorRange * ?center: bool -> unit
|
||
|
abstract undo: unit -> unit
|
||
|
abstract redo: unit -> unit
|
||
|
abstract exec: command: EditorCommandName -> unit
|
||
|
abstract transaction: tx: EditorTransaction * ?origin: string -> unit
|
||
|
abstract wordAt: pos: EditorPosition -> EditorRange option
|
||
|
abstract posToOffset: pos: EditorPosition -> float
|
||
|
abstract offsetToPos: offset: float -> EditorPosition
|
||
|
abstract processLines: read: (float -> string -> 'T option) * write: (float -> string -> 'T option -> U2<EditorChange, unit>) * ?ignoreEmpty: bool -> unit
|
||
|
|
||
|
type [<StringEnum>] [<RequireQualifiedAccess>] EditorGetCursorString =
|
||
|
| From
|
||
|
| To
|
||
|
| Head
|
||
|
| Anchor
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorGetScrollInfoReturn =
|
||
|
abstract top: float with get, set
|
||
|
abstract left: float with get, set
|
||
|
|
||
|
/// A common interface that bridges the gap between CodeMirror 5 and CodeMirror 6.
|
||
|
type [<AllowNullLiteral>] EditorStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> Editor
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorChange =
|
||
|
inherit EditorRangeOrCaret
|
||
|
abstract text: string with get, set
|
||
|
|
||
|
type [<StringEnum>] [<RequireQualifiedAccess>] EditorCommandName =
|
||
|
| GoUp
|
||
|
| GoDown
|
||
|
| GoLeft
|
||
|
| GoRight
|
||
|
| GoStart
|
||
|
| GoEnd
|
||
|
| IndentMore
|
||
|
| IndentLess
|
||
|
| NewlineAndIndent
|
||
|
| SwapLineUp
|
||
|
| SwapLineDown
|
||
|
| DeleteLine
|
||
|
| ToggleFold
|
||
|
| FoldAll
|
||
|
| UnfoldAll
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorPosition =
|
||
|
abstract line: float with get, set
|
||
|
abstract ch: float with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorRange =
|
||
|
abstract from: EditorPosition with get, set
|
||
|
abstract ``to``: EditorPosition with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorRangeOrCaret =
|
||
|
abstract from: EditorPosition with get, set
|
||
|
abstract ``to``: EditorPosition option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorSelection =
|
||
|
abstract anchor: EditorPosition with get, set
|
||
|
abstract head: EditorPosition with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorSelectionOrCaret =
|
||
|
abstract anchor: EditorPosition with get, set
|
||
|
abstract head: EditorPosition option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorSuggest<'T> =
|
||
|
inherit PopoverSuggest<'T>
|
||
|
/// Current suggestion context, containing the result of `onTrigger`.
|
||
|
/// This will be null any time the EditorSuggest is not supposed to run.
|
||
|
abstract context: EditorSuggestContext option with get, set
|
||
|
/// Override this to use a different limit for suggestion items
|
||
|
abstract limit: float with get, set
|
||
|
abstract setInstructions: instructions: ResizeArray<Instruction> -> unit
|
||
|
/// 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.
|
||
|
abstract onTrigger: cursor: EditorPosition * editor: Editor * file: TFile -> EditorSuggestTriggerInfo option
|
||
|
/// Generate suggestion items based on this context. Can be async, but preferably sync.
|
||
|
/// When generating async suggestions, you should pass the context along.
|
||
|
abstract getSuggestions: context: EditorSuggestContext -> U2<ResizeArray<'T>, Promise<ResizeArray<'T>>>
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorSuggestStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: app: App -> EditorSuggest<'T>
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorSuggestContext =
|
||
|
inherit EditorSuggestTriggerInfo
|
||
|
abstract editor: Editor with get, set
|
||
|
abstract file: TFile with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorSuggestTriggerInfo =
|
||
|
/// The start position of the triggering text. This is used to position the popover.
|
||
|
abstract start: EditorPosition with get, set
|
||
|
/// The end position of the triggering text. This is used to position the popover.
|
||
|
abstract ``end``: EditorPosition with get, set
|
||
|
/// They query string (usually the text between start and end) that will be used to generate the suggestion content.
|
||
|
abstract query: string with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] EditorTransaction =
|
||
|
abstract replaceSelection: string option with get, set
|
||
|
abstract changes: ResizeArray<EditorChange> option with get, set
|
||
|
/// Multiple selections, overrides `selection`.
|
||
|
abstract selections: ResizeArray<EditorRangeOrCaret> option with get, set
|
||
|
abstract selection: EditorRangeOrCaret option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] EmbedCache =
|
||
|
inherit ReferenceCache
|
||
|
|
||
|
type [<AllowNullLiteral>] EventRef =
|
||
|
interface end
|
||
|
|
||
|
type [<AllowNullLiteral>] Events =
|
||
|
abstract on: name: string * callback: (obj option -> obj option) * ?ctx: obj -> EventRef
|
||
|
abstract off: name: string * callback: (obj option -> obj option) -> unit
|
||
|
abstract offref: ref: EventRef -> unit
|
||
|
abstract trigger: name: string * [<ParamArray>] data: ResizeArray<obj option> -> unit
|
||
|
abstract tryTrigger: evt: EventRef * args: ResizeArray<obj option> -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] EventsStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> Events
|
||
|
|
||
|
type [<AllowNullLiteral>] ExtraButtonComponent =
|
||
|
inherit BaseComponent
|
||
|
abstract extraSettingsEl: HTMLElement with get, set
|
||
|
abstract setDisabled: disabled: bool -> ExtraButtonComponent
|
||
|
abstract setTooltip: tooltip: string -> ExtraButtonComponent
|
||
|
abstract setIcon: icon: string -> ExtraButtonComponent
|
||
|
abstract onClick: callback: (unit -> obj option) -> ExtraButtonComponent
|
||
|
|
||
|
type [<AllowNullLiteral>] ExtraButtonComponentStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: containerEl: HTMLElement -> ExtraButtonComponent
|
||
|
|
||
|
/// Manage the creation, deletion and renaming of files from the UI.
|
||
|
type [<AllowNullLiteral>] FileManager =
|
||
|
/// <summary>Gets the folder that new files should be saved to, given the user's preferences.</summary>
|
||
|
/// <param name="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>
|
||
|
abstract getNewFileParent: sourcePath: string -> TFolder
|
||
|
/// <summary>Rename or move a file safely, and update all links to it depending on the user's preferences.</summary>
|
||
|
/// <param name="file">- the file to rename</param>
|
||
|
/// <param name="newPath">- the new path for the file</param>
|
||
|
abstract renameFile: file: TAbstractFile * newPath: string -> Promise<unit>
|
||
|
/// <summary>Generate a markdown link based on the user's preferences.</summary>
|
||
|
/// <param name="file">- the file to link to.</param>
|
||
|
/// <param name="sourcePath">- where the link is stored in, used to compute relative links.</param>
|
||
|
/// <param name="subpath">- A subpath, starting with `#`, used for linking to headings or blocks.</param>
|
||
|
/// <param name="alias">- The display text if it's to be different than the file name. Pass empty string to use file name.</param>
|
||
|
abstract generateMarkdownLink: file: TFile * sourcePath: string * ?subpath: string * ?alias: string -> string
|
||
|
|
||
|
/// Manage the creation, deletion and renaming of files from the UI.
|
||
|
type [<AllowNullLiteral>] FileManagerStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> FileManager
|
||
|
|
||
|
type [<AllowNullLiteral>] FileStats =
|
||
|
abstract ctime: float with get, set
|
||
|
abstract mtime: float with get, set
|
||
|
abstract size: float with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] FileSystemAdapter =
|
||
|
inherit DataAdapter
|
||
|
abstract getName: unit -> string
|
||
|
abstract getBasePath: unit -> string
|
||
|
abstract mkdir: normalizedPath: string -> Promise<unit>
|
||
|
abstract trashSystem: normalizedPath: string -> Promise<bool>
|
||
|
abstract trashLocal: normalizedPath: string -> Promise<unit>
|
||
|
abstract rmdir: normalizedPath: string * recursive: bool -> Promise<unit>
|
||
|
abstract read: normalizedPath: string -> Promise<string>
|
||
|
abstract readBinary: normalizedPath: string -> Promise<ArrayBuffer>
|
||
|
abstract write: normalizedPath: string * data: string * ?options: DataWriteOptions -> Promise<unit>
|
||
|
abstract writeBinary: normalizedPath: string * data: ArrayBuffer * ?options: DataWriteOptions -> Promise<unit>
|
||
|
abstract append: normalizedPath: string * data: string * ?options: DataWriteOptions -> Promise<unit>
|
||
|
abstract getResourcePath: normalizedPath: string -> string
|
||
|
abstract remove: normalizedPath: string -> Promise<unit>
|
||
|
abstract rename: normalizedPath: string * normalizedNewPath: string -> Promise<unit>
|
||
|
abstract copy: normalizedPath: string * normalizedNewPath: string -> Promise<unit>
|
||
|
abstract exists: normalizedPath: string * ?sensitive: bool -> Promise<bool>
|
||
|
abstract stat: normalizedPath: string -> Promise<Stat option>
|
||
|
abstract list: normalizedPath: string -> Promise<ListedFiles>
|
||
|
abstract getFullPath: normalizedPath: string -> string
|
||
|
|
||
|
type [<AllowNullLiteral>] FileSystemAdapterStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> FileSystemAdapter
|
||
|
abstract readLocalFile: path: string -> Promise<ArrayBuffer>
|
||
|
abstract mkdir: path: string -> Promise<unit>
|
||
|
|
||
|
type [<AllowNullLiteral>] FileView =
|
||
|
inherit ItemView
|
||
|
abstract allowNoFile: bool with get, set
|
||
|
abstract file: TFile with get, set
|
||
|
abstract getDisplayText: unit -> string
|
||
|
/// Override this to load your component
|
||
|
abstract onload: unit -> unit
|
||
|
abstract getState: unit -> obj option
|
||
|
abstract setState: state: obj option * result: ViewStateResult -> Promise<unit>
|
||
|
abstract onLoadFile: file: TFile -> Promise<unit>
|
||
|
abstract onUnloadFile: file: TFile -> Promise<unit>
|
||
|
abstract onMoreOptionsMenu: menu: Menu -> unit
|
||
|
abstract onHeaderMenu: menu: Menu -> unit
|
||
|
abstract canAcceptExtension: extension: string -> bool
|
||
|
|
||
|
type [<AllowNullLiteral>] FileViewStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: leaf: WorkspaceLeaf -> FileView
|
||
|
|
||
|
type [<AllowNullLiteral>] FrontMatterCache =
|
||
|
inherit CacheItem
|
||
|
[<Emit "$0[$1]{{=$2}}">] abstract Item: key: string -> obj option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] FuzzyMatch<'T> =
|
||
|
abstract item: 'T with get, set
|
||
|
abstract ``match``: SearchResult with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] FuzzySuggestModal<'T> =
|
||
|
inherit SuggestModal<FuzzyMatch<'T>>
|
||
|
abstract getSuggestions: query: string -> ResizeArray<FuzzyMatch<'T>>
|
||
|
/// Render the suggestion item into DOM.
|
||
|
abstract renderSuggestion: item: FuzzyMatch<'T> * el: HTMLElement -> unit
|
||
|
abstract onChooseSuggestion: item: FuzzyMatch<'T> * evt: U2<MouseEvent, KeyboardEvent> -> unit
|
||
|
abstract getItems: unit -> ResizeArray<'T>
|
||
|
abstract getItemText: item: 'T -> string
|
||
|
abstract onChooseItem: item: 'T * evt: U2<MouseEvent, KeyboardEvent> -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] FuzzySuggestModalStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> FuzzySuggestModal<'T>
|
||
|
|
||
|
type [<AllowNullLiteral>] HeadingCache =
|
||
|
inherit CacheItem
|
||
|
abstract heading: string with get, set
|
||
|
abstract level: float with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] HeadingSubpathResult =
|
||
|
inherit SubpathResult
|
||
|
abstract ``type``: string with get, set
|
||
|
abstract current: HeadingCache with get, set
|
||
|
abstract next: HeadingCache with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] Hotkey =
|
||
|
abstract modifiers: ResizeArray<Modifier> with get, set
|
||
|
abstract key: string with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] HoverParent =
|
||
|
abstract hoverPopover: HoverPopover option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] HoverPopover =
|
||
|
inherit Component
|
||
|
abstract state: obj with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] HoverPopoverStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: parent: HoverParent * targetEl: HTMLElement option * ?waitTime: float -> HoverPopover
|
||
|
|
||
|
type [<AllowNullLiteral>] Instruction =
|
||
|
abstract command: string with get, set
|
||
|
abstract purpose: string with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] ISuggestOwner<'T> =
|
||
|
/// Render the suggestion item into DOM.
|
||
|
abstract renderSuggestion: value: 'T * el: HTMLElement -> unit
|
||
|
/// Called when the user makes a selection.
|
||
|
abstract selectSuggestion: value: 'T * evt: U2<MouseEvent, KeyboardEvent> -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] ItemView =
|
||
|
inherit View
|
||
|
abstract contentEl: HTMLElement with get, set
|
||
|
abstract onMoreOptionsMenu: menu: Menu -> unit
|
||
|
abstract addAction: icon: string * title: string * callback: (MouseEvent -> obj option) * ?size: float -> HTMLElement
|
||
|
abstract onHeaderMenu: menu: Menu -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] ItemViewStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: leaf: WorkspaceLeaf -> ItemView
|
||
|
|
||
|
type [<AllowNullLiteral>] Keymap =
|
||
|
abstract pushScope: scope: Scope -> unit
|
||
|
abstract popScope: scope: Scope -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] KeymapStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> Keymap
|
||
|
/// Checks whether the modifier key is pressed during this event
|
||
|
abstract isModifier: evt: U3<MouseEvent, TouchEvent, KeyboardEvent> * modifier: Modifier -> bool
|
||
|
/// Returns true if the modifier key Cmd/Ctrl is pressed OR if this is a middle-click MouseEvent.
|
||
|
abstract isModEvent: ?evt: UserEvent -> bool
|
||
|
|
||
|
type [<AllowNullLiteral>] KeymapContext =
|
||
|
inherit KeymapInfo
|
||
|
abstract vkey: string with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] KeymapEventHandler =
|
||
|
inherit KeymapInfo
|
||
|
abstract scope: Scope with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] KeymapEventListener =
|
||
|
[<Emit "$0($1...)">] abstract Invoke: evt: KeyboardEvent * ctx: KeymapContext -> U2<bool, unit>
|
||
|
|
||
|
type [<AllowNullLiteral>] KeymapInfo =
|
||
|
abstract modifiers: string option with get, set
|
||
|
abstract key: string option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] LinkCache =
|
||
|
inherit ReferenceCache
|
||
|
|
||
|
type [<AllowNullLiteral>] ListedFiles =
|
||
|
abstract files: ResizeArray<string> with get, set
|
||
|
abstract folders: ResizeArray<string> with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] ListItemCache =
|
||
|
inherit CacheItem
|
||
|
/// The block ID of this list item, if defined.
|
||
|
abstract id: string option with get, set
|
||
|
/// A single character indicating the checked status of a task.
|
||
|
/// The space character `' '` is interpreted as an incomplete task.
|
||
|
/// An other character is interpreted as completed task.
|
||
|
/// `undefined` if this item isn't a task.
|
||
|
abstract task: string option with get, set
|
||
|
/// 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).
|
||
|
abstract parent: float with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] Loc =
|
||
|
abstract line: float with get, set
|
||
|
abstract col: float with get, set
|
||
|
abstract offset: float with get, set
|
||
|
|
||
|
/// This is the editor for Obsidian Mobile as well as the upcoming WYSIWYG editor.
|
||
|
type [<AllowNullLiteral>] MarkdownEditView =
|
||
|
inherit MarkdownSubView
|
||
|
inherit HoverParent
|
||
|
abstract hoverPopover: HoverPopover with get, set
|
||
|
abstract clear: unit -> unit
|
||
|
abstract get: unit -> string
|
||
|
abstract set: data: string * clear: bool -> unit
|
||
|
abstract getSelection: unit -> string
|
||
|
abstract getScroll: unit -> float
|
||
|
abstract applyScroll: scroll: float -> unit
|
||
|
|
||
|
/// This is the editor for Obsidian Mobile as well as the upcoming WYSIWYG editor.
|
||
|
type [<AllowNullLiteral>] MarkdownEditViewStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: view: MarkdownView -> MarkdownEditView
|
||
|
|
||
|
/// 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}
|
||
|
type [<AllowNullLiteral>] MarkdownPostProcessor =
|
||
|
/// The processor function itself.
|
||
|
[<Emit "$0($1...)">] abstract Invoke: el: HTMLElement * ctx: MarkdownPostProcessorContext -> U2<Promise<obj option>, unit>
|
||
|
/// An optional integer sort order. Defaults to 0. Lower number runs before higher numbers.
|
||
|
abstract sortOrder: float option with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownPostProcessorContext =
|
||
|
abstract docId: string with get, set
|
||
|
abstract sourcePath: string with get, set
|
||
|
abstract frontmatter: obj option option with get, set
|
||
|
/// 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.
|
||
|
abstract addChild: child: MarkdownRenderChild -> unit
|
||
|
/// 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 nulls.
|
||
|
abstract getSectionInfo: el: HTMLElement -> MarkdownSectionInformation option
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownPreviewEvents =
|
||
|
inherit Component
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownPreviewRenderer =
|
||
|
interface end
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownPreviewRendererStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> MarkdownPreviewRenderer
|
||
|
abstract registerPostProcessor: postProcessor: MarkdownPostProcessor * ?sortOrder: float -> unit
|
||
|
abstract unregisterPostProcessor: postProcessor: MarkdownPostProcessor -> unit
|
||
|
abstract createCodeBlockPostProcessor: language: string * handler: (string -> HTMLElement -> MarkdownPostProcessorContext -> U2<Promise<obj option>, unit>) -> (HTMLElement -> MarkdownPostProcessorContext -> unit)
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownPreviewView =
|
||
|
inherit MarkdownRenderer
|
||
|
inherit MarkdownSubView
|
||
|
inherit MarkdownPreviewEvents
|
||
|
abstract containerEl: HTMLElement with get, set
|
||
|
abstract get: unit -> string
|
||
|
abstract set: data: string * clear: bool -> unit
|
||
|
abstract clear: unit -> unit
|
||
|
abstract rerender: ?full: bool -> unit
|
||
|
abstract getScroll: unit -> float
|
||
|
abstract applyScroll: scroll: float -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownPreviewViewStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> MarkdownPreviewView
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownRenderChild =
|
||
|
inherit Component
|
||
|
abstract containerEl: HTMLElement with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownRenderChildStatic =
|
||
|
/// <param name="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.</param>
|
||
|
[<Emit "new $0($1...)">] abstract Create: containerEl: HTMLElement -> MarkdownRenderChild
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownRenderer =
|
||
|
inherit MarkdownRenderChild
|
||
|
inherit MarkdownPreviewEvents
|
||
|
inherit HoverParent
|
||
|
abstract hoverPopover: HoverPopover with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownRendererStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> MarkdownRenderer
|
||
|
/// <summary>Renders markdown string to an HTML element.</summary>
|
||
|
/// <param name="markdown">- The markdown source code</param>
|
||
|
/// <param name="el">- The element to append to</param>
|
||
|
/// <param name="sourcePath">- The normalized path of this markdown file, used to resolve relative internal links</param>
|
||
|
/// <param name="component">- A parent component to manage the lifecycle of the rendered child components, if any</param>
|
||
|
abstract renderMarkdown: markdown: string * el: HTMLElement * sourcePath: string * ``component``: Component -> Promise<unit>
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownSectionInformation =
|
||
|
abstract text: string with get, set
|
||
|
abstract lineStart: float with get, set
|
||
|
abstract lineEnd: float with get, set
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownSourceView =
|
||
|
inherit MarkdownSubView
|
||
|
inherit HoverParent
|
||
|
abstract cmEditor: obj with get, set
|
||
|
abstract hoverPopover: HoverPopover with get, set
|
||
|
abstract clear: unit -> unit
|
||
|
abstract get: unit -> string
|
||
|
abstract set: data: string * clear: bool -> unit
|
||
|
abstract getSelection: unit -> string
|
||
|
abstract getScroll: unit -> float
|
||
|
abstract applyScroll: scroll: float -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownSourceViewStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: view: MarkdownView -> MarkdownSourceView
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownSubView =
|
||
|
abstract getScroll: unit -> float
|
||
|
abstract applyScroll: scroll: float -> unit
|
||
|
abstract get: unit -> string
|
||
|
abstract set: data: string * clear: bool -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownView =
|
||
|
inherit TextFileView
|
||
|
abstract editor: Editor with get, set
|
||
|
abstract previewMode: MarkdownPreviewView with get, set
|
||
|
abstract currentMode: MarkdownSubView with get, set
|
||
|
abstract getViewType: unit -> string
|
||
|
abstract getMode: unit -> MarkdownViewModeType
|
||
|
/// Gets the data from the editor. This will be called to save the editor contents to the file.
|
||
|
abstract getViewData: unit -> string
|
||
|
/// 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.
|
||
|
abstract clear: unit -> unit
|
||
|
/// 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 clear(), or implement a slightly more efficient
|
||
|
/// clearing mechanism given the new data to be set.
|
||
|
abstract setViewData: data: string * clear: bool -> unit
|
||
|
abstract showSearch: ?replace: bool -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] MarkdownViewStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: leaf: WorkspaceLeaf -> MarkdownView
|
||
|
|
||
|
type [<StringEnum>] [<RequireQualifiedAccess>] MarkdownViewModeType =
|
||
|
| Source
|
||
|
| Preview
|
||
|
|
||
|
type [<AllowNullLiteral>] Menu =
|
||
|
inherit Component
|
||
|
abstract setNoIcon: unit -> Menu
|
||
|
abstract addItem: cb: (MenuItem -> obj option) -> Menu
|
||
|
abstract addSeparator: unit -> Menu
|
||
|
abstract showAtMouseEvent: evt: MouseEvent -> Menu
|
||
|
abstract showAtPosition: position: Point -> Menu
|
||
|
abstract hide: unit -> Menu
|
||
|
abstract onHide: callback: (unit -> obj option) -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] MenuStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: app: App -> Menu
|
||
|
|
||
|
type [<AllowNullLiteral>] MenuItem =
|
||
|
abstract setTitle: title: U2<string, DocumentFragment> -> MenuItem
|
||
|
abstract setIcon: icon: string option * ?size: float -> MenuItem
|
||
|
abstract setActive: active: bool -> MenuItem
|
||
|
abstract setDisabled: disabled: bool -> MenuItem
|
||
|
abstract setIsLabel: isLabel: bool -> MenuItem
|
||
|
abstract onClick: callback: (U2<MouseEvent, KeyboardEvent> -> obj option) -> MenuItem
|
||
|
|
||
|
type [<AllowNullLiteral>] MenuItemStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: menu: Menu -> MenuItem
|
||
|
|
||
|
/// 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.
|
||
|
type [<AllowNullLiteral>] MetadataCache =
|
||
|
inherit Events
|
||
|
/// Get the best match for a linkpath.
|
||
|
abstract getFirstLinkpathDest: linkpath: string * sourcePath: string -> TFile option
|
||
|
abstract getFileCache: file: TFile -> CachedMetadata option
|
||
|
abstract getCache: path: string -> CachedMetadata
|
||
|
/// Generates a linktext for a file.
|
||
|
///
|
||
|
/// If file name is unique, use the filename.
|
||
|
/// If not unique, use full path.
|
||
|
abstract fileToLinktext: file: TFile * sourcePath: string * ?omitMdExtension: bool -> string
|
||
|
/// 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)`.
|
||
|
abstract resolvedLinks: obj with get, set
|
||
|
/// 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 `resolvedLinks`.
|
||
|
abstract unresolvedLinks: obj with get, set
|
||
|
/// Called when a file has been indexed, and its (updated) cache is now available.
|
||
|
[<Emit "$0.on('changed',$1,$2)">] abstract on_changed: callback: (TFile -> string -> CachedMetadata -> obj option) * ?ctx: obj -> 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.
|
||
|
[<Emit "$0.on('deleted',$1,$2)">] abstract on_deleted: callback: (TFile -> CachedMetadata option -> obj option) * ?ctx: obj -> EventRef
|
||
|
/// Called when a file has been resolved for `resolvedLinks` and `unresolvedLinks`.
|
||
|
/// This happens sometimes after a file has been indexed.
|
||
|
[<Emit "$0.on('resolve',$1,$2)">] abstract on_resolve: callback: (TFile -> obj option) * ?ctx: obj -> EventRef
|
||
|
/// Called when all files has been resolved. This will be fired each time files get modified after the initial load.
|
||
|
[<Emit "$0.on('resolved',$1,$2)">] abstract on_resolved: callback: (unit -> obj option) * ?ctx: obj -> EventRef
|
||
|
|
||
|
/// 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.
|
||
|
type [<AllowNullLiteral>] MetadataCacheStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: unit -> MetadataCache
|
||
|
|
||
|
type [<AllowNullLiteral>] Modal =
|
||
|
inherit CloseableComponent
|
||
|
abstract app: App with get, set
|
||
|
abstract scope: Scope with get, set
|
||
|
abstract containerEl: HTMLElement with get, set
|
||
|
abstract modalEl: HTMLElement with get, set
|
||
|
abstract titleEl: HTMLElement with get, set
|
||
|
abstract contentEl: HTMLElement with get, set
|
||
|
abstract shouldRestoreSelection: bool with get, set
|
||
|
abstract ``open``: unit -> unit
|
||
|
abstract close: unit -> unit
|
||
|
abstract onOpen: unit -> unit
|
||
|
abstract onClose: unit -> unit
|
||
|
|
||
|
type [<AllowNullLiteral>] ModalStatic =
|
||
|
[<Emit "new $0($1...)">] abstract Create: app: App -> Modal
|
||
|
|
||
|
type [<StringEnum>] [<RequireQualifiedAccess>] Modifier =
|
||
|
| [<CompiledName "Mod">] Mod
|
||
|
| [<CompiledName "Ctrl">] Ctrl
|
||
|
| [<CompiledName "Meta">] Meta
|
||
|
| [<CompiledName "Shift">] Shift
|
||
|
| [<CompiledName "Alt">] Alt
|
||
|
|
||
|
type [<AllowNullLiteral>] MomentFormatComponent =
|
||
|
inherit TextComponent
|
||
|
abstract sampleEl: HTMLElement with get, set
|
||
|
/// Sets the default format when input is cleared. Also used for placeholder.
|
||
|
abstract setDefaultFormat: defaultFormat: string -> MomentFormatComponent
|
||
|
abstract setSampleEl: sampleEl: HTMLElement -> MomentFormatComponent
|
||
|