// Generated by dts-bundle-generator v9.5.1 import type { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, CharCategory, EditorSelection as CmEditorSelection, EditorState, EditorStateConfig, Extension, Facet, FacetReader, Line, Range as Range, RangeComparator, RangeCursor, RangeValue, SelectionRange, SpanIterator, StateEffect, StateEffectType, StateField, Text as Text, Transaction, TransactionSpec } from '@codemirror/state'; import type { EditorView, ViewUpdate, WidgetType } from '@codemirror/view'; import * as fs from 'node:fs'; import type { FSWatcher } from 'node:fs'; import * as fsPromises from 'node:fs/promises'; import * as path from 'node:path'; import type { AbstractTextComponent, App, BaseComponent, BasesConfigFileFilter, BasesEntry, BasesEntryGroup, BasesQueryResult, BasesViewConfig, BlockCache, BooleanValue, ButtonComponent, CacheItem, CachedMetadata, CapacitorAdapter, CliFlag, CliFlags, CliHandler, ColorComponent, Command, Component, DataAdapter, DateValue, Debouncer, DropdownComponent, DurationValue, EditableFileView, Editor, EditorPosition, EditorRange, EditorRangeOrCaret, EditorSelection, EditorSuggest, EmbedCache, EventRef, Events, ExtraButtonComponent, FileManager, FileStats, FileSystemAdapter, FileValue, FileView, FrontmatterLinkCache, FuzzySuggestModal, HTMLValue, HoverLinkSource, HoverParent, HoverPopover, IconName, IconValue, ImageValue, Instruction, ItemView, Keymap, KeymapInfo, LinkCache, LinkValue, ListValue, MarkdownEditView, MarkdownFileInfo, MarkdownPostProcessorContext, MarkdownPreviewRenderer, MarkdownPreviewView, MarkdownRenderChild, MarkdownRenderer, MarkdownView, Menu, MenuItem, MenuSeparator, MetadataCache, Modal, MomentFormatComponent, NotNullValue, Notice as Notice, NullValue, NumberValue, ObjectValue, PaneType, Plugin as Plugin, PluginManifest, PluginSettingTab, Point, PopoverSuggest, ProgressBarComponent, QueryController, Reference, ReferenceCache, RegExpValue, RelativeDateValue, RenderContext, Scope, SearchComponent, SearchResult, SecretComponent, SecretStorage, Setting, SettingGroup, SettingTab, SliderComponent, SplitDirection, StringValue, TAbstractFile, TFile, TFolder, TagValue, Tasks, TextAreaComponent, TextComponent, TextFileView, ToggleComponent, UrlValue, Value, ValueComponent, Vault, View, ViewCreator, ViewState, Workspace, WorkspaceContainer, WorkspaceFloating, WorkspaceItem, WorkspaceLeaf, WorkspaceMobileDrawer, WorkspaceParent, WorkspaceRibbon, WorkspaceRoot, WorkspaceSidedock, WorkspaceSplit, WorkspaceTabs, WorkspaceWindow, moment as momentInstance } from 'obsidian'; /** * Converts HTML to Markdown. * * @public * @unofficial */ declare class TurndownService { /** Current conversion options. */ options: TurndownServiceOptions; /** Collection of conversion rules. */ rules: TurndownServiceRules; /** * Create new instance of {@link TurndownService}. * * @param options - Options. */ constructor(options?: TurndownServiceOptions); /** * Add a conversion rule. * * @param key - Rule identifier. * @param rule - The rule definition. * @returns This instance for chaining. */ addRule(key: string, rule: TurndownServiceRule): this; /** * Escape a string for use in Markdown. * * @param str - The string to escape. * @returns The escaped string. */ escape(str: string): string; /** * Keep elements matching a filter (pass through as HTML). * * @param filter - The filter to match. * @returns This instance for chaining. */ keep(filter: TurndownServiceFilter): this; /** * Remove elements matching a filter from output. * * @param filter - The filter to match. * @returns This instance for chaining. */ remove(filter: TurndownServiceFilter): this; /** * Convert HTML to Markdown. * * @param html - HTML string or DOM node to convert. * @returns The Markdown string. */ turndown(html: string | TurndownServiceNode): string; /** * Register plugin(s). * * @param plugins - Plugin or array of plugins. * @returns This instance for chaining. */ use(plugins: TurndownServicePlugin | TurndownServicePlugin[]): this; } /** * Capacitor global instance. * * @public * @unofficial */ declare const Capacitor: CapacitorGlobal; /** * Capacitor platforms instance. * * @deprecated Deprecated. * @public * @unofficial */ declare const CapacitorPlatforms: CapacitorPlatformsGlobal; /** * Electron app instance for managing the application lifecycle. * * @public * @unofficial */ declare const app: ElectronApp; /** * Base class for all display objects. * * @public * @unofficial */ export declare abstract class DisplayObject { /** Alpha (opacity). */ alpha: number; /** Rotation angle in degrees. */ angle: number; /** Cursor style when hovering. */ cursor: null | string; /** Hit area shape. */ hitArea: IHitArea | null; /** Whether the object is interactive. */ interactive: boolean; /** Display name. */ name: null | string; /** Parent container. */ parent: Container; /** Whether the object is renderable. */ renderable: boolean; /** Rotation in radians. */ rotation: number; /** Transform data. */ transform: Transform; /** Whether the object is visible. */ visible: boolean; /** Alpha relative to the scene. */ worldAlpha: number; /** World transform matrix (read-only). */ readonly worldTransform: Matrix; /** Whether the object is visible in the scene (read-only). */ readonly worldVisible: boolean; /** X position. */ x: number; /** Y position. */ y: number; /** Z-index for sorting. */ zIndex: number; /** * Destroys this display object. * * @param options - Destroy options. */ destroy(options?: boolean | IDestroyOptions): void; /** * Emits an event. * * @param event - Event name. * @param args - Arguments. * @returns Whether any listeners were called. */ emit(event: string | symbol, ...args: unknown[]): boolean; /** * Returns the bounds of the object. * * @param skipUpdate - Whether to skip the update. * @param rect - Rectangle to store bounds in. * @returns The bounds rectangle. */ getBounds(skipUpdate?: boolean, rect?: PixiRectangle): PixiRectangle; /** * Returns the local bounds of the object. * * @param rect - Rectangle to store bounds in. * @returns The local bounds rectangle. */ getLocalBounds(rect?: PixiRectangle): PixiRectangle; /** * Removes an event listener. * * @param event - Event name. * @param fn - Callback function. * @param context - Callback context. * @returns This object for chaining. */ off(event: string | symbol, fn?: (...args: unknown[]) => void, context?: unknown): this; /** * Adds an event listener. * * @param event - Event name. * @param fn - Callback function. * @param context - Callback context. * @returns This object for chaining. */ on(event: string | symbol, fn: (...args: unknown[]) => void, context?: unknown): this; /** * Adds a one-time event listener. * * @param event - Event name. * @param fn - Callback function. * @param context - Callback context. * @returns This object for chaining. */ once(event: string | symbol, fn: (...args: unknown[]) => void, context?: unknown): this; /** Pivot point. */ get pivot(): ObservablePoint; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set pivot(value: IPointData); /** Position. */ get position(): ObservablePoint; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set position(value: IPointData); /** * Removes all listeners for the given event. * * @param event - Event name. * @returns This object for chaining. */ removeAllListeners(event?: string | symbol): this; /** Scale. */ get scale(): ObservablePoint; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set scale(value: IPointData); /** Skew. */ get skew(): ObservablePoint; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set skew(value: IPointData); /** * Converts a point to global (screen) coordinates. * * @param position - The point to convert. * @param point - Output point. * @param skipUpdate - Whether to skip the update. * @returns The global point. */ toGlobal

(position: IPointData, point?: P, skipUpdate?: boolean): P; /** * Converts a point to local coordinates. * * @param position - The point to convert. * @param from - The display object to convert from. * @param point - Output point. * @param skipUpdate - Whether to skip the update. * @returns The local point. */ toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P; } /** * Abstract base class for parsers. * * @public * @unofficial */ export declare abstract class Parser { /** * Start a parse for the given input. * * @param input - The document input. * @param fragments - Previously parsed fragments that can be reused. * @param ranges - The ranges of the document to parse. * @returns A partial parse that can be advanced. */ abstract createParse(input: Input, fragments: readonly LezerTreeFragment[], ranges: readonly LezerTreeRange[]): PartialParse; /** * Parse a document. * * @param input - The document input or string. * @param fragments - Previously parsed fragments that can be reused. * @param ranges - The ranges of the document to parse. * @returns The parsed tree. */ parse(input: Input | string, fragments?: readonly LezerTreeFragment[], ranges?: readonly LezerTreeRange[]): LezerTree; } /** * PixiJS application. * * @public * @unofficial */ export declare class Application { /** Renderer instance. */ renderer: IRenderer; /** Root container of the scene graph. */ stage: Container; /** * Creates a new application. * * @param options - Application options. */ constructor(options?: Partial); /** * Destroys the application. * * @param removeView - Whether to remove the view from the DOM. * @param stageOptions - Options for destroying the stage. */ destroy(removeView?: boolean, stageOptions?: boolean | IDestroyOptions): void; /** Renders the application. */ render(): void; /** Screen rectangle. */ get screen(): PixiRectangle; /** Canvas view. */ get view(): VIEW; } /** * Capacitor exception. * * @public * @unofficial */ export declare class CapacitorException extends Error { /** Exception code. */ readonly code?: string; /** Exception data. */ readonly data?: unknown; /** Exception message. */ readonly message: string; /** * Creates a new CapacitorException. * * @param message - Exception message. * @param code - Exception code. * @param data - Exception data. */ constructor(message: string, code?: string, data?: unknown); } /** * The document data type used in CodeMirror. * * @public * @unofficial */ export declare class CmText { /** An empty document. */ static empty: CmText; /** The length of the document. */ readonly length: number; /** The number of lines in the document. */ readonly lines: number; /** * Get the line at a given 1-based line number. * * @param n - The 1-based line number. * @returns The line. */ line(n: number): Line; /** * Get the line at the given position. * * @param pos - The position. * @returns The line containing the position. */ lineAt(pos: number): Line; /** * Create a text from an array of lines. * * @param text - The lines to create the text from. * @returns The created text. */ static of(text: readonly string[]): CmText; /** * Return the document as a string, using newline characters to separate lines. * * @param from - The start position. * @param to - The end position. * @param lineSep - The line separator to use. * @returns The string content. */ sliceString(from: number, to?: number, lineSep?: string): string; /** * Return the document as a string. * * @returns The string content. */ toString(): string; } /** * Container for display objects. * * @public * @unofficial */ export declare class Container extends DisplayObject { /** Children of this container (read-only). */ readonly children: T[]; /** Parent container. */ parent: Container; /** Whether children should be sorted by zIndex. */ sortableChildren: boolean; /** Whether the children need sorting. */ sortDirty: boolean; /** * Adds one or more children to the container. * * @param children - Children to add. * @returns The first child added. */ addChild(...children: U): U[0]; /** * Adds a child at a specific index. * * @param child - Child to add. * @param index - Index to insert at. * @returns The child added. */ addChildAt(child: U, index: number): U; /** * Destroys this container. * * @param options - Destroy options. */ destroy(options?: boolean | IDestroyOptions): void; /** * Returns the child at the given index. * * @param index - Index of the child. * @returns The child at the index. */ getChildAt(index: number): T; /** * Returns the index of a child. * * @param child - The child to find. * @returns The index of the child. */ getChildIndex(child: T): number; /** Height of the container. */ get height(): number; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set height(value: number); /** * Removes one or more children from the container. * * @param children - Children to remove. * @returns The first child removed. */ removeChild(...children: U): U[0]; /** * Removes the child at a specific index. * * @param index - Index of the child to remove. * @returns The removed child. */ removeChildAt(index: number): T; /** * Removes children from the container. * * @param beginIndex - Start index. * @param endIndex - End index. * @returns The removed children. */ removeChildren(beginIndex?: number, endIndex?: number): T[]; /** * Sets the index of a child. * * @param child - The child. * @param index - The new index. */ setChildIndex(child: T, index: number): void; /** Sorts the children by zIndex. */ sortChildren(): void; /** Width of the container. */ get width(): number; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set width(value: number); } /** * A dictionary that maps string keys to arrays of unique values, implementing {@link CustomArrayDict}. * * @public * @unofficial */ export declare class CustomArrayDictImpl implements CustomArrayDict { /** * Internal map storing key-to-array mappings. */ data: Map; /** * Add a value to the array associated with the given key. * * @param key - The key. * @param value - The value to add. */ add(key: string, value: T): void; /** * Remove all values for the given key. * * @param key - The key to clear. */ clear(key: string): void; /** * Remove all keys and their values. */ clearAll(): void; /** * Check whether the array for the given key contains the specified value. * * @param key - The key. * @param value - The value to check. * @returns Whether the value exists. */ contains(key: string, value: T): boolean; /** * Get the total number of values across all keys. * * @returns Total value count. */ count(): number; /** * Get the array of values for the given key, or `null` if not found. * * @param key - The key. * @returns Array of values, or `null`. */ get(key: string): null | T[]; /** * Get all keys in the dictionary. * * @returns Array of keys. */ keys(): string[]; /** * Remove a specific value from the array associated with the given key. * * @param key - The key. * @param value - The value to remove. */ remove(key: string, value: T): void; } /** * Electron BrowserView for embedding additional web content in a {@link ElectronBrowserWindow}. * * @public * @unofficial */ export declare class ElectronBrowserView { /** The web contents owned by this view. */ webContents: ElectronWebContents; /** * Create new instance of {@link ElectronBrowserView}. * * @param options - Options. */ constructor(options?: ElectronBrowserViewConstructorOptions); /** * Returns the bounds of this view. * * @returns The view bounds. */ getBounds(): ElectronRectangle; /** * Configures how the view auto-resizes with its window. * * @param options - The auto-resize options. */ setAutoResize(options: ElectronAutoResizeOptions): void; /** * Sets the background color of the view. * * @param color - The CSS color value. */ setBackgroundColor(color: string): void; /** * Resizes and moves the view to the supplied bounds relative to the window. * * @param bounds - The new bounds. */ setBounds(bounds: ElectronRectangle): void; } /** * Electron BrowserWindow for creating and managing application windows. * * @public * @unofficial */ export declare class ElectronBrowserWindow { /** * An alternative title provided only to accessibility tools such as screen readers. This string is not directly * visible to users. */ accessibleTitle: string; /** Whether the window menu bar should hide itself automatically. */ autoHideMenuBar: boolean; /** Whether the window can be manually closed by user. On Linux the setter is a no-op. */ closable: boolean; /** Whether the window's document has been edited (macOS only). */ documentEdited: boolean; /** Whether the window is excluded from the application's Windows menu (macOS only). */ excludedFromShownWindowsMenu: boolean; /** Whether the window is focusable (macOS and Windows). */ focusable: boolean; /** Whether the window is in fullscreen mode. */ fullScreen: boolean; /** Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window. */ fullScreenable: boolean; /** The unique identifier of the window, unique among all `BrowserWindow` instances of the entire application. */ readonly id: number; /** Whether the window is in kiosk mode. */ kiosk: boolean; /** Whether the window can be manually maximized by user. On Linux the setter is a no-op. */ maximizable: boolean; /** Whether the menu bar should be visible (Windows and Linux). */ menuBarVisible: boolean; /** Whether the window can be manually minimized by user. On Linux the setter is a no-op. */ minimizable: boolean; /** Whether the window can be moved by user. On Linux the setter is a no-op. */ movable: boolean; /** The pathname of the file the window represents (macOS only). */ representedFilename: string; /** Whether the window can be manually resized by user. */ resizable: boolean; /** Whether the window has a shadow. */ shadow: boolean; /** Whether the window is in simple (pre-Lion) fullscreen mode. */ simpleFullScreen: boolean; /** The title of the native window. */ title: string; /** Whether the window is visible on all workspaces. Always returns `false` on Windows. */ visibleOnAllWorkspaces: boolean; /** The web contents owned by this window. All web page related events and operations will be done via it. */ readonly webContents: ElectronWebContents; /** * Create new instance of {@link ElectronBrowserWindow}. * * @param options - Options. */ constructor(options?: BrowserWindowConstructorOptions); /** * Replacement API for `setBrowserView` supporting work with multi browser views. * * @param browserView - The view to add. */ addBrowserView(browserView: ElectronBrowserView): void; /** * Registers a listener for the given window event. * * @param event - The event name. * @param listener - The event handler. * @returns This BrowserWindow instance. */ addListener(event: "always-on-top-changed", listener: (event: ElectronEvent, isAlwaysOnTop: boolean) => void): this; /** */ addListener(event: "app-command", listener: (event: ElectronEvent, command: string) => void): this; /** */ addListener(event: "blur", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "close", listener: (event: ElectronEvent) => void): this; /** */ addListener(event: "closed", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "enter-full-screen", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "focus", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "hide", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "leave-full-screen", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "maximize", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "minimize", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "move", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "moved", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "new-window-for-tab", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this; /** */ addListener(event: "ready-to-show", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "resize", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "resized", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "responsive", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "restore", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "rotate-gesture", listener: (event: ElectronEvent, rotation: number) => void): this; /** */ addListener(event: "scroll-touch-begin", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "scroll-touch-edge", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "scroll-touch-end", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "session-end", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "sheet-begin", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "sheet-end", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "show", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "swipe", listener: (event: ElectronEvent, direction: string) => void): this; /** */ addListener(event: "system-context-menu", listener: (event: ElectronEvent, point: ElectronPoint) => void): this; /** */ addListener(event: "unmaximize", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "unresponsive", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "will-move", listener: (event: ElectronEvent, newBounds: ElectronRectangle) => void): this; /** */ addListener(event: "will-resize", listener: (event: ElectronEvent, newBounds: ElectronRectangle, details: ElectronWillResizeDetails) => void): this; /** * Adds a window as a tab on this window, after the tab for the window instance (macOS only). * * @param browserWindow - The window to add as a tab. */ addTabbedWindow(browserWindow: ElectronBrowserWindow): void; /** Removes focus from the window. */ blur(): void; /** Removes focus from the web view. */ blurWebView(): void; /** * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. * * @param rect - The bounds to capture. * @returns A promise that resolves with the captured image. */ capturePage(rect?: ElectronRectangle): Promise; /** Moves window to the center of the screen. */ center(): void; /** Tries to close the window. This has the same effect as a user manually clicking the close button. */ close(): void; /** Closes the currently open Quick Look panel (macOS only). */ closeFilePreview(): void; /** Force-closes the window; the `unload` and `beforeunload` events won't be emitted, but `closed` is guaranteed. */ destroy(): void; /** * Starts or stops flashing the window to attract user's attention. * * @param flag - Whether to flash the window. */ flashFrame(flag: boolean): void; /** Focuses on the window. */ focus(): void; /** Focuses on the web view. */ focusOnWebView(): void; /** * Returns the window that owns the given `browserView`. * * @param browserView - The view to look up. * @returns The owning BrowserWindow or `null` if the view is not attached to any window. */ static fromBrowserView(browserView: ElectronBrowserView): ElectronBrowserWindow | null; /** * Returns the window with the given `id`. * * @param id - The window id. * @returns The BrowserWindow or `null` if not found. */ static fromId(id: number): ElectronBrowserWindow | null; /** * Returns the window that owns the given `webContents`. * * @param webContents - The web contents to look up. * @returns The owning BrowserWindow or `null` if the contents are not owned by a window. */ static fromWebContents(webContents: ElectronWebContents): ElectronBrowserWindow | null; /** * Returns all opened browser windows. * * @returns An array of all BrowserWindow instances. */ static getAllWindows(): ElectronBrowserWindow[]; /** * Returns the background color of the window in Hex (`#RRGGBB`) format. * * @returns The background color. */ getBackgroundColor(): string; /** * Returns the bounds of the window. * * @returns The window bounds. */ getBounds(): ElectronRectangle; /** * Returns the `BrowserView` attached to this window. * * @returns The attached view or `null` if one is not attached. */ getBrowserView(): ElectronBrowserView | null; /** * Returns all views attached with `addBrowserView` or `setBrowserView`. * * @returns An array of attached views. */ getBrowserViews(): ElectronBrowserView[]; /** * Returns all child windows. * * @returns An array of child windows. */ getChildWindows(): ElectronBrowserWindow[]; /** * Returns the bounds of the window's client area. * * @returns The content bounds. */ getContentBounds(): ElectronRectangle; /** * Returns the window's client area's width and height. * * @returns A tuple of `[width, height]`. */ getContentSize(): number[]; /** * Returns the window that is focused in this application. * * @returns The focused BrowserWindow or `null` if none is focused. */ static getFocusedWindow(): ElectronBrowserWindow | null; /** * Returns the window's maximum width and height. * * @returns A tuple of `[width, height]`. */ getMaximumSize(): number[]; /** * Returns the window id in the format of DesktopCapturerSource's id. * * @returns The media source id. */ getMediaSourceId(): string; /** * Returns the window's minimum width and height. * * @returns A tuple of `[width, height]`. */ getMinimumSize(): number[]; /** * Returns the platform-specific handle of the window. * * @returns The native window handle buffer. */ getNativeWindowHandle(): Buffer; /** * Returns the window bounds of the normal state, regardless of the current window state. * * @returns The normal-state bounds. */ getNormalBounds(): ElectronRectangle; /** * Returns the opacity of the window, between `0.0` (fully transparent) and `1.0` (fully opaque). On Linux, always * returns `1`. * * @returns The window opacity. */ getOpacity(): number; /** * Returns the parent window. * * @returns The parent window or `null` if there is no parent. */ getParentWindow(): ElectronBrowserWindow | null; /** * Returns the window's current position. * * @returns A tuple of `[x, y]` coordinates. */ getPosition(): number[]; /** * Returns the pathname of the file the window represents (macOS only). * * @returns The represented filename. */ getRepresentedFilename(): string; /** * Returns the window's width and height. * * @returns A tuple of `[width, height]`. */ getSize(): number[]; /** * Returns the title of the native window. * * @returns The window title. */ getTitle(): string; /** * Returns the custom position for the traffic light buttons in a frameless window (macOS only). * * @returns The traffic light position. */ getTrafficLightPosition(): ElectronPoint; /** * Returns whether the window has a shadow. * * @returns Whether the window has a shadow. */ hasShadow(): boolean; /** Hides the window. */ hide(): void; /** * Hooks a windows message. The `callback` is called when the message is received in the WndProc (Windows only). * * @param message - The message identifier. * @param callback - The callback invoked when the message is received. */ hookWindowMessage(message: number, callback: (wParam: unknown, lParam: unknown) => void): void; /** * Returns whether the window is always on top of other windows. * * @returns Whether the window is always on top. */ isAlwaysOnTop(): boolean; /** * Returns whether the window can be manually closed by user. On Linux always returns `true` (macOS and Windows). * * @returns Whether the window is closable. */ isClosable(): boolean; /** * Returns whether the window has been destroyed. * * @returns Whether the window is destroyed. */ isDestroyed(): boolean; /** * Returns whether the window's document has been edited (macOS only). * * @returns Whether the document has been edited. */ isDocumentEdited(): boolean; /** * Returns whether the window is enabled. * * @returns Whether the window is enabled. */ isEnabled(): boolean; /** Returns whether the window can be focused (macOS and Windows). */ isFocusable(): void; /** * Returns whether the window is focused. * * @returns Whether the window is focused. */ isFocused(): boolean; /** * Returns whether the window is in fullscreen mode. * * @returns Whether the window is fullscreen. */ isFullScreen(): boolean; /** * Returns whether the maximize/zoom window button toggles fullscreen mode or maximizes the window. * * @returns Whether the window is fullscreenable. */ isFullScreenable(): boolean; /** * Returns whether the window is in kiosk mode. * * @returns Whether the window is in kiosk mode. */ isKiosk(): boolean; /** * Returns whether the window can be manually maximized by user. On Linux always returns `true` (macOS and Windows). * * @returns Whether the window is maximizable. */ isMaximizable(): boolean; /** * Returns whether the window is maximized. * * @returns Whether the window is maximized. */ isMaximized(): boolean; /** * Returns whether the menu bar automatically hides itself. * * @returns Whether the menu bar auto-hides. */ isMenuBarAutoHide(): boolean; /** * Returns whether the menu bar is visible. * * @returns Whether the menu bar is visible. */ isMenuBarVisible(): boolean; /** * Returns whether the window can be manually minimized by user. On Linux always returns `true` (macOS and Windows). * * @returns Whether the window is minimizable. */ isMinimizable(): boolean; /** * Returns whether the window is minimized. * * @returns Whether the window is minimized. */ isMinimized(): boolean; /** * Returns whether the current window is a modal window. * * @returns Whether the window is modal. */ isModal(): boolean; /** * Returns whether the window can be moved by user. On Linux always returns `true` (macOS and Windows). * * @returns Whether the window is movable. */ isMovable(): boolean; /** * Returns whether the window is in normal state (not maximized, not minimized, not in fullscreen mode). * * @returns Whether the window is in normal state. */ isNormal(): boolean; /** * Returns whether the window can be manually resized by user. * * @returns Whether the window is resizable. */ isResizable(): boolean; /** * Returns whether the window is in simple (pre-Lion) fullscreen mode (macOS only). * * @returns Whether the window is in simple fullscreen mode. */ isSimpleFullScreen(): boolean; /** * Returns whether the window is in Windows 10 tablet mode (Windows only). * * @returns Whether the window is in tablet mode. */ isTabletMode(): boolean; /** * Returns whether the window is visible to the user. * * @returns Whether the window is visible. */ isVisible(): boolean; /** * Returns whether the window is visible on all workspaces. Always returns `false` on Windows. * * @returns Whether the window is visible on all workspaces. */ isVisibleOnAllWorkspaces(): boolean; /** * Returns whether the message is hooked (Windows only). * * @param message - The message identifier. * @returns Whether the message is hooked. */ isWindowMessageHooked(message: number): boolean; /** * Loads a file into the window. Same as `webContents.loadFile`. * * @param filePath - The path to an HTML file relative to the root of the application. * @param options - Options for loading the file. * @returns A promise that resolves when the page has finished loading. */ loadFile(filePath: string, options?: ElectronBrowserWindowLoadFileOptions): Promise; /** * Loads a URL into the window. Same as `webContents.loadURL`. * * @param url - A remote address or a path to a local HTML file using the `file://` protocol. * @param options - Options for loading the URL. * @returns A promise that resolves when the page has finished loading. */ loadURL(url: string, options?: ElectronBrowserWindowLoadURLOptions): Promise; /** Maximizes the window. This will also show (but not focus) the window if it isn't being displayed already. */ maximize(): void; /** Merges all windows into one window with multiple tabs when native tabs are enabled (macOS only). */ mergeAllWindows(): void; /** Minimizes the window. On some platforms the minimized window will be shown in the Dock. */ minimize(): void; /** * Moves window above the source window in the sense of z-order. * * @param mediaSourceId - The media source id of the window to move above. */ moveAbove(mediaSourceId: string): void; /** Moves the current tab into a new window if native tabs are enabled and there is more than one tab (macOS only). */ moveTabToNewWindow(): void; /** Moves window to top (z-order) regardless of focus. */ moveTop(): void; /** * Registers a listener for the given window event. * * @param event - The event name. * @param listener - The event handler. * @returns This BrowserWindow instance. */ on(event: "always-on-top-changed", listener: (event: ElectronEvent, isAlwaysOnTop: boolean) => void): this; /** */ on(event: "app-command", listener: (event: ElectronEvent, command: string) => void): this; /** */ on(event: "blur", listener: (...args: unknown[]) => void): this; /** */ on(event: "close", listener: (event: ElectronEvent) => void): this; /** */ on(event: "closed", listener: (...args: unknown[]) => void): this; /** */ on(event: "enter-full-screen", listener: (...args: unknown[]) => void): this; /** */ on(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this; /** */ on(event: "focus", listener: (...args: unknown[]) => void): this; /** */ on(event: "hide", listener: (...args: unknown[]) => void): this; /** */ on(event: "leave-full-screen", listener: (...args: unknown[]) => void): this; /** */ on(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this; /** */ on(event: "maximize", listener: (...args: unknown[]) => void): this; /** */ on(event: "minimize", listener: (...args: unknown[]) => void): this; /** */ on(event: "move", listener: (...args: unknown[]) => void): this; /** */ on(event: "moved", listener: (...args: unknown[]) => void): this; /** */ on(event: "new-window-for-tab", listener: (...args: unknown[]) => void): this; /** */ on(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this; /** */ on(event: "ready-to-show", listener: (...args: unknown[]) => void): this; /** */ on(event: "resize", listener: (...args: unknown[]) => void): this; /** */ on(event: "resized", listener: (...args: unknown[]) => void): this; /** */ on(event: "responsive", listener: (...args: unknown[]) => void): this; /** */ on(event: "restore", listener: (...args: unknown[]) => void): this; /** */ on(event: "rotate-gesture", listener: (event: ElectronEvent, rotation: number) => void): this; /** */ on(event: "scroll-touch-begin", listener: (...args: unknown[]) => void): this; /** */ on(event: "scroll-touch-edge", listener: (...args: unknown[]) => void): this; /** */ on(event: "scroll-touch-end", listener: (...args: unknown[]) => void): this; /** */ on(event: "session-end", listener: (...args: unknown[]) => void): this; /** */ on(event: "sheet-begin", listener: (...args: unknown[]) => void): this; /** */ on(event: "sheet-end", listener: (...args: unknown[]) => void): this; /** */ on(event: "show", listener: (...args: unknown[]) => void): this; /** */ on(event: "swipe", listener: (event: ElectronEvent, direction: string) => void): this; /** */ on(event: "system-context-menu", listener: (event: ElectronEvent, point: ElectronPoint) => void): this; /** */ on(event: "unmaximize", listener: (...args: unknown[]) => void): this; /** */ on(event: "unresponsive", listener: (...args: unknown[]) => void): this; /** */ on(event: "will-move", listener: (event: ElectronEvent, newBounds: ElectronRectangle) => void): this; /** */ on(event: "will-resize", listener: (event: ElectronEvent, newBounds: ElectronRectangle, details: ElectronWillResizeDetails) => void): this; /** * Registers a one-time listener for the given window event. * * @param event - The event name. * @param listener - The event handler. * @returns This BrowserWindow instance. */ once(event: "always-on-top-changed", listener: (event: ElectronEvent, isAlwaysOnTop: boolean) => void): this; /** */ once(event: "app-command", listener: (event: ElectronEvent, command: string) => void): this; /** */ once(event: "blur", listener: (...args: unknown[]) => void): this; /** */ once(event: "close", listener: (event: ElectronEvent) => void): this; /** */ once(event: "closed", listener: (...args: unknown[]) => void): this; /** */ once(event: "enter-full-screen", listener: (...args: unknown[]) => void): this; /** */ once(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this; /** */ once(event: "focus", listener: (...args: unknown[]) => void): this; /** */ once(event: "hide", listener: (...args: unknown[]) => void): this; /** */ once(event: "leave-full-screen", listener: (...args: unknown[]) => void): this; /** */ once(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this; /** */ once(event: "maximize", listener: (...args: unknown[]) => void): this; /** */ once(event: "minimize", listener: (...args: unknown[]) => void): this; /** */ once(event: "move", listener: (...args: unknown[]) => void): this; /** */ once(event: "moved", listener: (...args: unknown[]) => void): this; /** */ once(event: "new-window-for-tab", listener: (...args: unknown[]) => void): this; /** */ once(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this; /** */ once(event: "ready-to-show", listener: (...args: unknown[]) => void): this; /** */ once(event: "resize", listener: (...args: unknown[]) => void): this; /** */ once(event: "resized", listener: (...args: unknown[]) => void): this; /** */ once(event: "responsive", listener: (...args: unknown[]) => void): this; /** */ once(event: "restore", listener: (...args: unknown[]) => void): this; /** */ once(event: "rotate-gesture", listener: (event: ElectronEvent, rotation: number) => void): this; /** */ once(event: "scroll-touch-begin", listener: (...args: unknown[]) => void): this; /** */ once(event: "scroll-touch-edge", listener: (...args: unknown[]) => void): this; /** */ once(event: "scroll-touch-end", listener: (...args: unknown[]) => void): this; /** */ once(event: "session-end", listener: (...args: unknown[]) => void): this; /** */ once(event: "sheet-begin", listener: (...args: unknown[]) => void): this; /** */ once(event: "sheet-end", listener: (...args: unknown[]) => void): this; /** */ once(event: "show", listener: (...args: unknown[]) => void): this; /** */ once(event: "swipe", listener: (event: ElectronEvent, direction: string) => void): this; /** */ once(event: "system-context-menu", listener: (event: ElectronEvent, point: ElectronPoint) => void): this; /** */ once(event: "unmaximize", listener: (...args: unknown[]) => void): this; /** */ once(event: "unresponsive", listener: (...args: unknown[]) => void): this; /** */ once(event: "will-move", listener: (event: ElectronEvent, newBounds: ElectronRectangle) => void): this; /** */ once(event: "will-resize", listener: (event: ElectronEvent, newBounds: ElectronRectangle, details: ElectronWillResizeDetails) => void): this; /** * Uses Quick Look to preview a file at a given path (macOS only). * * @param path - The path to the file to preview. * @param displayName - The name of the file to display in the Quick Look modal view. */ previewFile(path: string, displayName?: string): void; /** Reloads the current page. Same as `webContents.reload`. */ reload(): void; /** * Removes a view added with `addBrowserView` or `setBrowserView`. * * @param browserView - The view to remove. */ removeBrowserView(browserView: ElectronBrowserView): void; /** * Removes a listener for the given window event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This BrowserWindow instance. */ removeListener(event: "always-on-top-changed", listener: (event: ElectronEvent, isAlwaysOnTop: boolean) => void): this; /** */ removeListener(event: "app-command", listener: (event: ElectronEvent, command: string) => void): this; /** */ removeListener(event: "blur", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "close", listener: (event: ElectronEvent) => void): this; /** */ removeListener(event: "closed", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "enter-full-screen", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "focus", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "hide", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "leave-full-screen", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "maximize", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "minimize", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "move", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "moved", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "new-window-for-tab", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this; /** */ removeListener(event: "ready-to-show", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "resize", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "resized", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "responsive", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "restore", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "rotate-gesture", listener: (event: ElectronEvent, rotation: number) => void): this; /** */ removeListener(event: "scroll-touch-begin", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "scroll-touch-edge", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "scroll-touch-end", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "session-end", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "sheet-begin", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "sheet-end", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "show", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "swipe", listener: (event: ElectronEvent, direction: string) => void): this; /** */ removeListener(event: "system-context-menu", listener: (event: ElectronEvent, point: ElectronPoint) => void): this; /** */ removeListener(event: "unmaximize", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "unresponsive", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "will-move", listener: (event: ElectronEvent, newBounds: ElectronRectangle) => void): this; /** */ removeListener(event: "will-resize", listener: (event: ElectronEvent, newBounds: ElectronRectangle, details: ElectronWillResizeDetails) => void): this; /** Removes the window's menu bar (Linux and Windows). */ removeMenu(): void; /** Restores the window from minimized state to its previous state. */ restore(): void; /** Selects the next tab when native tabs are enabled and there are other tabs in the window (macOS only). */ selectNextTab(): void; /** Selects the previous tab when native tabs are enabled and there are other tabs in the window (macOS only). */ selectPreviousTab(): void; /** * Sets whether the window should show always on top of other windows. * * @param flag - Whether to set always on top. * @param level - The always-on-top level (macOS only). * @param relativeLevel - The number of layers higher to set this window relative to the given `level`. */ setAlwaysOnTop(flag: boolean, level?: "floating" | "main-menu" | "modal-panel" | "normal" | "pop-up-menu" | "screen-saver" | "status" | "torn-off-menu", relativeLevel?: number): void; /** * Sets the properties for the window's taskbar button (Windows only). * * @param options - The taskbar button properties. */ setAppDetails(options: ElectronAppDetailsOptions): void; /** * Makes the window maintain an aspect ratio. * * @param aspectRatio - The aspect ratio to maintain. * @param extraSize - Extra size not included within the aspect ratio calculations. */ setAspectRatio(aspectRatio: number, extraSize?: ElectronSize): void; /** * Controls whether to hide the cursor when typing (macOS only). * * @param autoHide - Whether to auto-hide the cursor. */ setAutoHideCursor(autoHide: boolean): void; /** * Sets whether the window menu bar should hide itself automatically. * * @param hide - Whether to auto-hide the menu bar. */ setAutoHideMenuBar(hide: boolean): void; /** * Sets the background color of the window. * * @param backgroundColor - The CSS color value. */ setBackgroundColor(backgroundColor: string): void; /** * Resizes and moves the window to the supplied bounds. Any properties not supplied default to their current values. * * @param bounds - The new bounds. * @param animate - Whether to animate the transition. */ setBounds(bounds: Partial, animate?: boolean): void; /** * Sets the view attached to the window. * * @param browserView - The view to attach, or `null` to detach. */ setBrowserView(browserView: ElectronBrowserView | null): void; /** * Sets whether the window can be manually closed by user. On Linux does nothing (macOS and Windows). * * @param closable - Whether the window is closable. */ setClosable(closable: boolean): void; /** * Resizes and moves the window's client area to the supplied bounds. * * @param bounds - The new content bounds. * @param animate - Whether to animate the transition. */ setContentBounds(bounds: ElectronRectangle, animate?: boolean): void; /** * Prevents the window contents from being captured by other apps (macOS and Windows). * * @param enable - Whether to enable content protection. */ setContentProtection(enable: boolean): void; /** * Resizes the window's client area to `width` and `height`. * * @param width - The new width. * @param height - The new height. * @param animate - Whether to animate the transition. */ setContentSize(width: number, height: number, animate?: boolean): void; /** * Specifies whether the window's document has been edited (macOS only). * * @param edited - Whether the document has been edited. */ setDocumentEdited(edited: boolean): void; /** * Disables or enables the window. * * @param enable - Whether to enable the window. */ setEnabled(enable: boolean): void; /** * Changes whether the window can be focused (macOS and Windows). * * @param focusable - Whether the window is focusable. */ setFocusable(focusable: boolean): void; /** * Sets whether the window should be in fullscreen mode. * * @param flag - Whether to enable fullscreen. */ setFullScreen(flag: boolean): void; /** * Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window. * * @param fullscreenable - Whether the window is fullscreenable. */ setFullScreenable(fullscreenable: boolean): void; /** * Sets whether the window should have a shadow. * * @param hasShadow - Whether the window should have a shadow. */ setHasShadow(hasShadow: boolean): void; /** * Changes the window icon (Linux and Windows). * * @param icon - The icon image or path. */ setIcon(icon: ElectronNativeImage | string): void; /** * Makes the window ignore all mouse events. * * @param ignore - Whether to ignore mouse events. * @param options - Additional options. */ setIgnoreMouseEvents(ignore: boolean, options?: ElectronIgnoreMouseEventsOptions): void; /** * Enters or leaves kiosk mode. * * @param flag - Whether to enable kiosk mode. */ setKiosk(flag: boolean): void; /** * Sets whether the window can be manually maximized by user. On Linux does nothing (macOS and Windows). * * @param maximizable - Whether the window is maximizable. */ setMaximizable(maximizable: boolean): void; /** * Sets the maximum size of the window. * * @param width - The maximum width. * @param height - The maximum height. */ setMaximumSize(width: number, height: number): void; /** * Sets the menu as the window's menu bar (Linux and Windows). * * @param menu - The menu to set, or `null` to remove it. */ setMenu(menu: ElectronMenu | null): void; /** * Sets whether the menu bar should be visible (Linux and Windows). * * @param visible - Whether the menu bar is visible. */ setMenuBarVisibility(visible: boolean): void; /** * Sets whether the window can be manually minimized by user. On Linux does nothing (macOS and Windows). * * @param minimizable - Whether the window is minimizable. */ setMinimizable(minimizable: boolean): void; /** * Sets the minimum size of the window. * * @param width - The minimum width. * @param height - The minimum height. */ setMinimumSize(width: number, height: number): void; /** * Sets whether the window can be moved by user. On Linux does nothing (macOS and Windows). * * @param movable - Whether the window is movable. */ setMovable(movable: boolean): void; /** * Sets the opacity of the window. On Linux, does nothing. Out of bound values are clamped to the `[0, 1]` range. * * @param opacity - The opacity value between `0.0` and `1.0`. */ setOpacity(opacity: number): void; /** * Sets a 16 x 16 pixel overlay onto the current taskbar icon (Windows only). * * @param overlay - The overlay image, or `null` to remove the overlay. * @param description - A description of the overlay for accessibility tools. */ setOverlayIcon(overlay: ElectronNativeImage | null, description: string): void; /** * Sets the parent window. Passing `null` will turn the current window into a top-level window. * * @param parent - The new parent window, or `null`. */ setParentWindow(parent: ElectronBrowserWindow | null): void; /** * Moves the window to `x` and `y`. * * @param x - The x coordinate. * @param y - The y coordinate. * @param animate - Whether to animate the transition. */ setPosition(x: number, y: number, animate?: boolean): void; /** * Sets the progress value in the progress bar. Valid range is `[0, 1.0]`. * * @param progress - The progress value. * @param options - Additional options. */ setProgressBar(progress: number, options?: ElectronProgressBarOptions): void; /** * Sets the pathname of the file the window represents (macOS only). * * @param filename - The represented filename. */ setRepresentedFilename(filename: string): void; /** * Sets whether the window can be manually resized by user. * * @param resizable - Whether the window is resizable. */ setResizable(resizable: boolean): void; /** * Sets a window shape determining the area within the window where drawing and user interaction are permitted * (Linux and Windows). * * @param rects - The rectangles defining the window shape. */ setShape(rects: ElectronRectangle[]): void; /** * Changes the attachment point for sheets on macOS (macOS only). * * @param offsetY - The vertical offset. * @param offsetX - The horizontal offset. */ setSheetOffset(offsetY: number, offsetX?: number): void; /** * Enters or leaves simple fullscreen mode (macOS only). * * @param flag - Whether to enable simple fullscreen mode. */ setSimpleFullScreen(flag: boolean): void; /** * Resizes the window to `width` and `height`. * * @param width - The new width. * @param height - The new height. * @param animate - Whether to animate the transition. */ setSize(width: number, height: number, animate?: boolean): void; /** * Makes the window not show in the taskbar. * * @param skip - Whether to skip the taskbar. */ setSkipTaskbar(skip: boolean): void; /** * Adds a thumbnail toolbar with a specified set of buttons to the thumbnail image of a window (Windows only). * * @param buttons - The buttons to add. * @returns Whether the buttons were added successfully. */ setThumbarButtons(buttons: ElectronThumbarButton[]): boolean; /** * Sets the region of the window to show as the thumbnail image displayed when hovering over the window in the * taskbar (Windows only). * * @param region - The region to show as the thumbnail. */ setThumbnailClip(region: ElectronRectangle): void; /** * Sets the tooltip displayed when hovering over the window thumbnail in the taskbar (Windows only). * * @param toolTip - The tooltip text. */ setThumbnailToolTip(toolTip: string): void; /** * Changes the title of the native window. * * @param title - The new title. */ setTitle(title: string): void; /** * On a window with Window Controls Overlay already enabled, updates the style of the title bar overlay * (Windows only). * * @param options - The title bar overlay style. */ setTitleBarOverlay(options: ElectronTitleBarOverlayOptions): void; /** * Raises `browserView` above other views attached to the window. * * @param browserView - The view to raise. */ setTopBrowserView(browserView: ElectronBrowserView): void; /** * Sets the touch bar layout for the current window. Specifying `null` or `undefined` clears the touch bar * (macOS only). * * @param touchBar - The touch bar, or `null` to clear it. */ setTouchBar(touchBar: ElectronTouchBar | null): void; /** * Sets a custom position for the traffic light buttons in a frameless window (macOS only). * * @param position - The traffic light position. */ setTrafficLightPosition(position: ElectronPoint): void; /** * Adds a vibrancy effect to the browser window. Passing `null` or an empty string removes the effect (macOS only). * * @param type - The vibrancy type, or `null` to remove the effect. */ setVibrancy(type: "appearance-based" | "content" | "dark" | "fullscreen-ui" | "header" | "hud" | "light" | "medium-light" | "menu" | "popover" | "selection" | "sheet" | "sidebar" | "titlebar" | "tooltip" | "ultra-dark" | "under-page" | "under-window" | "window" | null): void; /** * Sets whether the window should be visible on all workspaces. Does nothing on Windows. * * @param visible - Whether the window is visible on all workspaces. * @param options - Additional options. */ setVisibleOnAllWorkspaces(visible: boolean, options?: ElectronVisibleOnAllWorkspacesOptions): void; /** * Sets whether the window traffic light buttons should be visible (macOS only). * * @param visible - Whether the traffic light buttons are visible. */ setWindowButtonVisibility(visible: boolean): void; /** Shows and gives focus to the window. */ show(): void; /** Shows the definition for the selected word (macOS only). Same as `webContents.showDefinitionForSelection()`. */ showDefinitionForSelection(): void; /** Shows the window but doesn't focus on it. */ showInactive(): void; /** Toggles the visibility of the tab bar if native tabs are enabled and there is only one tab (macOS only). */ toggleTabBar(): void; /** Unhooks all of the window messages (Windows only). */ unhookAllWindowMessages(): void; /** * Unhooks the window message (Windows only). * * @param message - The message identifier. */ unhookWindowMessage(message: number): void; /** Unmaximizes the window. */ unmaximize(): void; } /** * An HTTP/HTTPS request issued through the `net` module. * * @public * @unofficial */ export declare class ElectronClientRequest { /** * A `boolean` specifying whether the request will use HTTP chunked transfer encoding or not. The property is * readable and writable, however it can be set only before the first write operation as the HTTP headers are not * yet put on the wire. Trying to set the `chunkedEncoding` property after the first write will throw an error. * * Using chunked encoding is strongly recommended if you need to send a large request body as data will be streamed * in small chunks instead of being internally buffered inside Electron process memory. * * @default `false` */ chunkedEncoding: boolean; /** * Create new instance of {@link ElectronClientRequest}. * * @param options - The request options, or the request URL as a string. */ constructor(options: ElectronClientRequestConstructorOptions | string); /** * Cancels an ongoing HTTP transaction. If the request has already emitted the `close` event, the abort operation * will have no effect. Otherwise an ongoing event will emit `abort` and `close` events. Additionally, if there is * an ongoing response object, it will emit the `aborted` event. */ abort(): void; /** * Registers a listener for the given request event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ClientRequest` instance. */ addListener(event: "abort", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "close", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "error", listener: (error: Error) => void): this; /** */ addListener(event: "finish", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** */ addListener(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record) => void): this; /** */ addListener(event: "response", listener: (response: ElectronIncomingMessage) => void): this; /** * Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. The `finish` * event is emitted just after the end operation. * * @param chunk - The final chunk of request body data. * @param encoding - The encoding of `chunk`. * @param callback - Invoked after the chunk content has been delivered to the Chromium networking layer. */ end(chunk?: Buffer | string, encoding?: string, callback?: () => void): void; /** * Continues any pending redirection. Can only be called during a `'redirect'` event. */ followRedirect(): void; /** * The value of a previously set extra header name. * * @param name - The header name. * @returns The header value. */ getHeader(name: string): string; /** * You can use this method in conjunction with `POST` requests to get the progress of a file upload or other data * transfer. * * @returns The current upload progress. */ getUploadProgress(): ElectronUploadProgress; /** * Registers a listener for the given request event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ClientRequest` instance. */ on(event: "abort", listener: (...args: unknown[]) => void): this; /** */ on(event: "close", listener: (...args: unknown[]) => void): this; /** */ on(event: "error", listener: (error: Error) => void): this; /** */ on(event: "finish", listener: (...args: unknown[]) => void): this; /** */ on(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** */ on(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record) => void): this; /** */ on(event: "response", listener: (response: ElectronIncomingMessage) => void): this; /** * Registers a one-time listener for the given request event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ClientRequest` instance. */ once(event: "abort", listener: (...args: unknown[]) => void): this; /** */ once(event: "close", listener: (...args: unknown[]) => void): this; /** */ once(event: "error", listener: (error: Error) => void): this; /** */ once(event: "finish", listener: (...args: unknown[]) => void): this; /** */ once(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** */ once(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record) => void): this; /** */ once(event: "response", listener: (response: ElectronIncomingMessage) => void): this; /** * Removes a previously set extra header name. This method can be called only before first write. Trying to call it * after the first write will throw an error. * * @param name - The header name to remove. */ removeHeader(name: string): void; /** * Removes the given listener for the given request event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ClientRequest` instance. */ removeListener(event: "abort", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "close", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "error", listener: (error: Error) => void): this; /** */ removeListener(event: "finish", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** */ removeListener(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record) => void): this; /** */ removeListener(event: "response", listener: (response: ElectronIncomingMessage) => void): this; /** * Adds an extra HTTP header. The header name will be issued as-is without lowercasing. It can be called only before * first write. Calling this method after the first write will throw an error. If the passed value is not a * `string`, its `toString()` method will be called to obtain the final value. * * @param name - The header name. * @param value - The header value. */ setHeader(name: string, value: string): void; /** * Adds a chunk of data to the request body. The first write operation may cause the request headers to be issued on * the wire. After the first write operation, it is not allowed to add or remove a custom header. * * @param chunk - A chunk of request body data. * @param encoding - The encoding of `chunk`. * @param callback - Invoked after the chunk content has been delivered to the Chromium networking layer. */ write(chunk: Buffer | string, encoding?: string, callback?: () => void): void; } /** * An HTTP response message returned by a `ClientRequest`. * * @public * @unofficial */ export declare class ElectronIncomingMessage { /** * A `Record` representing the HTTP response headers. The `headers` object is formatted * as follows: * * - All header names are lowercased. * - Duplicates of `age`, `authorization`, `content-length`, `content-type`, `etag`, `expires`, `from`, `host`, * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`, `max-forwards`, `proxy-authorization`, * `referer`, `retry-after`, `server`, or `user-agent` are discarded. * - `set-cookie` is always an array. Duplicates are added to the array. * - For duplicate `cookie` headers, the values are joined together with `'; '`. * - For all other headers, the values are joined together with `', '`. */ headers: Record; /** * A `string` indicating the HTTP protocol version number. Typical values are `'1.0'` or `'1.1'`. Additionally * `httpVersionMajor` and `httpVersionMinor` are two Integer-valued readable properties that return respectively the * HTTP major and minor version numbers. */ httpVersion: string; /** An `Integer` indicating the HTTP protocol major version number. */ httpVersionMajor: number; /** An `Integer` indicating the HTTP protocol minor version number. */ httpVersionMinor: number; /** * A `string[]` containing the raw HTTP response headers exactly as they were received. The keys and values are in * the same list. It is not a list of tuples. So, the even-numbered offsets are key values, and the odd-numbered * offsets are the associated values. Header names are not lowercased, and duplicates are not merged. */ rawHeaders: string[]; /** An `Integer` indicating the HTTP response status code. */ statusCode: number; /** A `string` representing the HTTP status message. */ statusMessage: string; /** * Registers a listener for the given response event. * * @param event - The event name. * @param listener - The event handler. * @returns This `IncomingMessage` instance. */ addListener(event: "aborted", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "data", listener: (chunk: Buffer) => void): this; /** */ addListener(event: "end", listener: (...args: unknown[]) => void): this; /** */ addListener(event: "error", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the given response event. * * @param event - The event name. * @param listener - The event handler. * @returns This `IncomingMessage` instance. */ on(event: "aborted", listener: (...args: unknown[]) => void): this; /** */ on(event: "data", listener: (chunk: Buffer) => void): this; /** */ on(event: "end", listener: (...args: unknown[]) => void): this; /** */ on(event: "error", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the given response event. * * @param event - The event name. * @param listener - The event handler. * @returns This `IncomingMessage` instance. */ once(event: "aborted", listener: (...args: unknown[]) => void): this; /** */ once(event: "data", listener: (chunk: Buffer) => void): this; /** */ once(event: "end", listener: (...args: unknown[]) => void): this; /** */ once(event: "error", listener: (...args: unknown[]) => void): this; /** * Removes the given listener for the given response event. * * @param event - The event name. * @param listener - The event handler. * @returns This `IncomingMessage` instance. */ removeListener(event: "aborted", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "data", listener: (chunk: Buffer) => void): this; /** */ removeListener(event: "end", listener: (...args: unknown[]) => void): this; /** */ removeListener(event: "error", listener: (...args: unknown[]) => void): this; } /** * Electron Menu for creating native application menus and context menus. * * @public * @unofficial */ export declare class ElectronMenu { /** * A `MenuItem[]` array containing the menu's items. * * Each menu consists of multiple menu items and each menu item can have a submenu. */ items: ElectronMenuItem[]; /** Create a new instance of {@link ElectronMenu}. */ constructor(); /** * Registers an event listener that is invoked when a popup is closed either manually or with {@link ElectronMenu.closePopup}. * * @param event - The event name. * @param listener - The event handler. * @returns This menu instance. */ addListener(event: "menu-will-close", listener: (event: ElectronEvent) => void): this; /** * Registers an event listener that is invoked when {@link ElectronMenu.popup} is called. * * @param event - The event name. * @param listener - The event handler. * @returns This menu instance. */ addListener(event: "menu-will-show", listener: (event: ElectronEvent) => void): this; /** * Appends the `menuItem` to the menu. * * @param menuItem - The menu item to append. */ append(menuItem: ElectronMenuItem): void; /** * Generally, the `template` is an array of options for constructing a menu item. * * You can also attach other fields to the elements of the `template` and they will become properties of the constructed menu items. * * @param template - The template describing the menu items. * @returns The constructed menu. */ static buildFromTemplate(template: Array): ElectronMenu; /** * Closes the context menu in the `browserWindow`. * * @param browserWindow - The window to close the popup in. */ closePopup(browserWindow?: ElectronBrowserWindow): void; /** * Returns the application menu, if set, or `null`, if not set. * * The returned menu instance doesn't support dynamic addition or removal of menu items. Instance properties can still be dynamically modified. * * @returns The application menu, or `null` if not set. */ static getApplicationMenu(): ElectronMenu | null; /** * Returns the item with the specified `id`. * * @param id - The id of the menu item. * @returns The matching menu item, or `null` if not found. */ getMenuItemById(id: string): ElectronMenuItem | null; /** * Inserts the `menuItem` to the `pos` position of the menu. * * @param pos - The position to insert at. * @param menuItem - The menu item to insert. */ insert(pos: number, menuItem: ElectronMenuItem): void; /** * Registers an event listener that is invoked when a popup is closed either manually or with {@link ElectronMenu.closePopup}. * * @param event - The event name. * @param listener - The event handler. * @returns This menu instance. */ on(event: "menu-will-close", listener: (event: ElectronEvent) => void): this; /** * Registers an event listener that is invoked when {@link ElectronMenu.popup} is called. * * @param event - The event name. * @param listener - The event handler. * @returns This menu instance. */ on(event: "menu-will-show", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time event listener that is invoked when a popup is closed either manually or with {@link ElectronMenu.closePopup}. * * @param event - The event name. * @param listener - The event handler. * @returns This menu instance. */ once(event: "menu-will-close", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time event listener that is invoked when {@link ElectronMenu.popup} is called. * * @param event - The event name. * @param listener - The event handler. * @returns This menu instance. */ once(event: "menu-will-show", listener: (event: ElectronEvent) => void): this; /** * Pops up this menu as a context menu in the `BrowserWindow`. * * @param options - Options for the popup including `window`, `x`, and `y`. */ popup(options?: ElectronMenuPopupOptions): void; /** * Removes the event listener for a menu popup being closed. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This menu instance. */ removeListener(event: "menu-will-close", listener: (event: ElectronEvent) => void): this; /** * Removes the event listener for a menu popup being shown. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This menu instance. */ removeListener(event: "menu-will-show", listener: (event: ElectronEvent) => void): this; /** * Sends the `action` to the first responder of application. This is used for emulating default macOS menu behaviors. Usually you would use the `role` property of a menu item. `darwin` only. * * @param action - The action to send to the first responder. */ static sendActionToFirstResponder(action: string): void; /** * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu` will be set as each window's top menu. * * Passing `null` will suppress the default menu. On Windows and Linux, this has the additional effect of removing the menu bar from the window. * * @param menu - The menu to set, or `null` to suppress the default menu. */ static setApplicationMenu(menu: ElectronMenu | null): void; } /** * Electron MenuItem for adding items to native application menus. * * @public * @unofficial */ export declare class ElectronMenuItem { /** The item's accelerator, if set. */ accelerator?: ElectronAccelerator; /** Whether the item is checked. This property can be dynamically changed. */ checked: boolean; /** An item's sequential unique id. */ commandId: number; /** Whether the item is enabled. This property can be dynamically changed. */ enabled: boolean; /** The item's icon, if set. */ icon?: ElectronNativeImage | string; /** The item's unique id. This property can be dynamically changed. */ id: string; /** The item's visible label. */ label: string; /** The menu that the item is a part of. */ menu: ElectronMenu; /** Whether the accelerator should be registered with the system or just displayed. This property can be dynamically changed. */ registerAccelerator: boolean; /** The item's role, if set. */ role?: "about" | "appMenu" | "clearRecentDocuments" | "close" | "copy" | "cut" | "delete" | "editMenu" | "fileMenu" | "forceReload" | "front" | "help" | "hide" | "hideOthers" | "mergeAllWindows" | "minimize" | "moveTabToNewWindow" | "paste" | "pasteAndMatchStyle" | "quit" | "recentDocuments" | "redo" | "reload" | "resetZoom" | "selectAll" | "selectNextTab" | "selectPreviousTab" | "services" | "shareMenu" | "startSpeaking" | "stopSpeaking" | "toggleDevTools" | "togglefullscreen" | "toggleSpellChecker" | "toggleTabBar" | "undo" | "unhide" | "viewMenu" | "window" | "windowMenu" | "zoom" | "zoomIn" | "zoomOut"; /** The item to share when the `role` is `shareMenu`. This property can be dynamically changed. `darwin` only. */ sharingItem: ElectronSharingItem; /** The item's sublabel. */ sublabel: string; /** The menu item's submenu, if present. */ submenu?: ElectronMenu; /** The item's hover text. `darwin` only. */ toolTip: string; /** The type of the item. */ type: "checkbox" | "normal" | "radio" | "separator" | "submenu"; /** The item's user-assigned accelerator for the menu item. Only initialized after the item has been added to a menu; accessing before initialization returns `null`. `darwin` only. */ readonly userAccelerator: ElectronAccelerator | null; /** Whether the item is visible. This property can be dynamically changed. */ visible: boolean; /** * Creates a new menu item. * * @param options - The menu item options. */ constructor(options: ElectronMenuItemConstructorOptions); /** * The click handler that is fired when the menu item receives a click event. * * @param menuItem - The menu item that was clicked. * @param browserWindow - The focused window, or `undefined` if none. * @param event - The keyboard event associated with the click. * @returns Nothing. */ click(menuItem: ElectronMenuItem, browserWindow: ElectronBrowserWindow | undefined, event: KeyboardEvent): void; } /** * A main-process channel that owns a pair of connected {@link ElectronMessagePortMain} ports. * * @public * @unofficial */ export declare class ElectronMessageChannelMain { /** One of the two connected `MessagePortMain` ports of this channel. */ port1: ElectronMessagePortMain; /** The other of the two connected `MessagePortMain` ports of this channel. */ port2: ElectronMessagePortMain; /** Create a new instance of {@link ElectronMessageChannelMain}. */ constructor(); } /** * Electron Notification for creating and showing native OS notifications. * * @public * @unofficial */ export declare class ElectronNotification { /** A `NotificationAction[]` property representing the actions of the notification. */ actions: ElectronNotificationAction[]; /** A `string` property representing the body of the notification. */ body: string; /** A `string` property representing the close button text of the notification. */ closeButtonText: string; /** A `boolean` property representing whether the notification has a reply action. */ hasReply: boolean; /** A `string` property representing the reply placeholder of the notification. */ replyPlaceholder: string; /** A `boolean` property representing whether the notification is silent. */ silent: boolean; /** A `string` property representing the sound of the notification. */ sound: string; /** A `string` property representing the subtitle of the notification. */ subtitle: string; /** * A `string` property representing the type of timeout duration for the notification. Can be `default` or `never`. * * If `timeoutType` is set to `never`, the notification never expires. It stays open until closed by the calling API or the user. `linux` and `win32` only. */ timeoutType: "default" | "never"; /** A `string` property representing the title of the notification. */ title: string; /** A `string` property representing the custom Toast XML of the notification. `win32` only. */ toastXml: string; /** * A `string` property representing the urgency level of the notification. Can be `normal`, `critical`, or `low`. * * Default is `low`. `linux` only. */ urgency: "critical" | "low" | "normal"; /** * Create a new instance of {@link ElectronNotification}. * * @param options - Options for constructing the notification. */ constructor(options?: ElectronNotificationConstructorOptions); /** * Registers an event listener that is invoked when one of the notification's actions is activated. * * @param event - The event name. * @param listener - The event handler receiving the event and the index of the activated action. * @returns This notification instance. */ addListener(event: "action", listener: (event: ElectronEvent, index: number) => void): this; /** * Registers an event listener that is invoked when the notification is clicked by the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ addListener(event: "click", listener: (event: ElectronEvent) => void): this; /** * Registers an event listener that is invoked when the notification is closed by manual intervention from the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ addListener(event: "close", listener: (event: ElectronEvent) => void): this; /** * Registers an event listener that is invoked when an error is encountered while creating and showing the native notification. `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the error encountered during execution of the `show()` method. * @returns This notification instance. */ addListener(event: "failed", listener: (event: ElectronEvent, error: string) => void): this; /** * Registers an event listener that is invoked when the user clicks the "Reply" button on a notification with `hasReply: true`. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the string the user entered into the inline reply field. * @returns This notification instance. */ addListener(event: "reply", listener: (event: ElectronEvent, reply: string) => void): this; /** * Registers an event listener that is invoked when the notification is shown to the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ addListener(event: "show", listener: (event: ElectronEvent) => void): this; /** Dismisses the notification. */ close(): void; /** * Whether or not desktop notifications are supported on the current system. * * @returns `true` if desktop notifications are supported. */ static isSupported(): boolean; /** * Registers an event listener that is invoked when one of the notification's actions is activated. * * @param event - The event name. * @param listener - The event handler receiving the event and the index of the activated action. * @returns This notification instance. */ on(event: "action", listener: (event: ElectronEvent, index: number) => void): this; /** * Registers an event listener that is invoked when the notification is clicked by the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ on(event: "click", listener: (event: ElectronEvent) => void): this; /** * Registers an event listener that is invoked when the notification is closed by manual intervention from the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ on(event: "close", listener: (event: ElectronEvent) => void): this; /** * Registers an event listener that is invoked when an error is encountered while creating and showing the native notification. `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the error encountered during execution of the `show()` method. * @returns This notification instance. */ on(event: "failed", listener: (event: ElectronEvent, error: string) => void): this; /** * Registers an event listener that is invoked when the user clicks the "Reply" button on a notification with `hasReply: true`. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the string the user entered into the inline reply field. * @returns This notification instance. */ on(event: "reply", listener: (event: ElectronEvent, reply: string) => void): this; /** * Registers an event listener that is invoked when the notification is shown to the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ on(event: "show", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time event listener that is invoked when one of the notification's actions is activated. * * @param event - The event name. * @param listener - The event handler receiving the event and the index of the activated action. * @returns This notification instance. */ once(event: "action", listener: (event: ElectronEvent, index: number) => void): this; /** * Registers a one-time event listener that is invoked when the notification is clicked by the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ once(event: "click", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time event listener that is invoked when the notification is closed by manual intervention from the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ once(event: "close", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time event listener that is invoked when an error is encountered while creating and showing the native notification. `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the error encountered during execution of the `show()` method. * @returns This notification instance. */ once(event: "failed", listener: (event: ElectronEvent, error: string) => void): this; /** * Registers a one-time event listener that is invoked when the user clicks the "Reply" button on a notification with `hasReply: true`. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the string the user entered into the inline reply field. * @returns This notification instance. */ once(event: "reply", listener: (event: ElectronEvent, reply: string) => void): this; /** * Registers a one-time event listener that is invoked when the notification is shown to the user. * * @param event - The event name. * @param listener - The event handler. * @returns This notification instance. */ once(event: "show", listener: (event: ElectronEvent) => void): this; /** * Removes the event listener for one of the notification's actions being activated. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This notification instance. */ removeListener(event: "action", listener: (event: ElectronEvent, index: number) => void): this; /** * Removes the event listener for the notification being clicked. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This notification instance. */ removeListener(event: "click", listener: (event: ElectronEvent) => void): this; /** * Removes the event listener for the notification being closed. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This notification instance. */ removeListener(event: "close", listener: (event: ElectronEvent) => void): this; /** * Removes the event listener for the notification failing to show. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This notification instance. */ removeListener(event: "failed", listener: (event: ElectronEvent, error: string) => void): this; /** * Removes the event listener for the notification's inline reply. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This notification instance. */ removeListener(event: "reply", listener: (event: ElectronEvent, reply: string) => void): this; /** * Removes the event listener for the notification being shown. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This notification instance. */ removeListener(event: "show", listener: (event: ElectronEvent) => void): this; /** * Immediately shows the notification to the user, please note this means unlike the HTML5 Notification implementation, instantiating a `new Notification` does not immediately show it to the user, you need to call this method before the OS will display it. * * If the notification has been shown before, this method will dismiss the previously shown notification and create a new one with identical properties. */ show(): void; } /** * Electron ShareMenu for presenting the native share sheet for a {@link ElectronSharingItem}. * * @public * @unofficial */ export declare class ElectronShareMenu { /** * Create a new instance of {@link ElectronShareMenu}. * * @param sharingItem - The item to share. */ constructor(sharingItem: ElectronSharingItem); /** * Closes the context menu in the `browserWindow`. * * @param browserWindow - The window to close the popup in. */ closePopup(browserWindow?: ElectronBrowserWindow): void; /** * Pops up this menu as a context menu in the `BrowserWindow`. * * @param options - Options for the popup including `window`, `x`, and `y`. */ popup(options?: ElectronMenuPopupOptions): void; } /** * Electron TouchBar for building a macOS Touch Bar layout. * * @public * @unofficial */ export declare class ElectronTouchBar { /** The item that replaces the "esc" button on the touch bar. Setting to `null` restores the default. */ escapeItem: ElectronTouchBarButton | ElectronTouchBarColorPicker | ElectronTouchBarGroup | ElectronTouchBarLabel | ElectronTouchBarPopover | ElectronTouchBarScrubber | ElectronTouchBarSegmentedControl | ElectronTouchBarSlider | ElectronTouchBarSpacer | null; /** Reference to the {@link ElectronTouchBarButton} class. */ static TouchBarButton: typeof ElectronTouchBarButton; /** Reference to the {@link ElectronTouchBarColorPicker} class. */ static TouchBarColorPicker: typeof ElectronTouchBarColorPicker; /** Reference to the {@link ElectronTouchBarGroup} class. */ static TouchBarGroup: typeof ElectronTouchBarGroup; /** Reference to the {@link ElectronTouchBarLabel} class. */ static TouchBarLabel: typeof ElectronTouchBarLabel; /** Reference to the {@link ElectronTouchBarOtherItemsProxy} class. */ static TouchBarOtherItemsProxy: typeof ElectronTouchBarOtherItemsProxy; /** Reference to the {@link ElectronTouchBarPopover} class. */ static TouchBarPopover: typeof ElectronTouchBarPopover; /** Reference to the {@link ElectronTouchBarScrubber} class. */ static TouchBarScrubber: typeof ElectronTouchBarScrubber; /** Reference to the {@link ElectronTouchBarSegmentedControl} class. */ static TouchBarSegmentedControl: typeof ElectronTouchBarSegmentedControl; /** Reference to the {@link ElectronTouchBarSlider} class. */ static TouchBarSlider: typeof ElectronTouchBarSlider; /** Reference to the {@link ElectronTouchBarSpacer} class. */ static TouchBarSpacer: typeof ElectronTouchBarSpacer; /** * Create new instance of {@link ElectronTouchBar}. * * @param options - Options. */ constructor(options: ElectronTouchBarConstructorOptions); } /** * A button item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarButton { /** Description of the button to be read by a screen reader. Read only if no label is set. */ accessibilityLabel: string; /** Hex code representing the button's current background color. */ backgroundColor: string; /** Whether the button is in an enabled state. */ enabled: boolean; /** The button's current icon. */ icon: ElectronNativeImage; /** The position of the icon. */ iconPosition: "left" | "overlay" | "right"; /** The button's current text. */ label: string; /** * Create new instance of {@link ElectronTouchBarButton}. * * @param options - Options. */ constructor(options: ElectronTouchBarButtonConstructorOptions); } /** * A color picker item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarColorPicker { /** The color picker's available colors to select. */ availableColors: string[]; /** Hex code representing the color picker's currently selected color. */ selectedColor: string; /** * Create new instance of {@link ElectronTouchBarColorPicker}. * * @param options - Options. */ constructor(options: ElectronTouchBarColorPickerConstructorOptions); } /** * A group item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarGroup { /** * Create new instance of {@link ElectronTouchBarGroup}. * * @param options - Options. */ constructor(options: ElectronTouchBarGroupConstructorOptions); } /** * A label item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarLabel { /** Description of the label to be read by a screen reader. */ accessibilityLabel: string; /** The label's current text. */ label: string; /** Hex code representing the label's current text color. */ textColor: string; /** * Create new instance of {@link ElectronTouchBarLabel}. * * @param options - Options. */ constructor(options: ElectronTouchBarLabelConstructorOptions); } /** * A proxy item that reserves space for system-provided items in a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarOtherItemsProxy { /** * Create new instance of {@link ElectronTouchBarOtherItemsProxy}. */ constructor(); } /** * A popover item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarPopover { /** The popover's current button icon. */ icon: ElectronNativeImage; /** The popover's current button text. */ label: string; /** * Create new instance of {@link ElectronTouchBarPopover}. * * @param options - Options. */ constructor(options: ElectronTouchBarPopoverConstructorOptions); } /** * A scrubber item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarScrubber { /** Whether this scrubber is continuous. */ continuous: boolean; /** The items in this scrubber. */ items: ElectronScrubberItem[]; /** The mode of this scrubber. */ mode: "fixed" | "free"; /** The style that selected items in the scrubber should have, overlaid on top of the item. */ overlayStyle: "background" | "none" | "outline"; /** The style that selected items in the scrubber should have. */ selectedStyle: "background" | "none" | "outline"; /** Whether to show the left / right selection arrows in this scrubber. */ showArrowButtons: boolean; /** * Create new instance of {@link ElectronTouchBarScrubber}. * * @param options - Options. */ constructor(options: ElectronTouchBarScrubberConstructorOptions); } /** * A segmented control item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarSegmentedControl { /** The current selection mode of the control. */ mode: "buttons" | "multiple" | "single"; /** The segments in this control. */ segments: ElectronSegmentedControlSegment[]; /** The control's current segment style. */ segmentStyle: string; /** The currently selected segment. */ selectedIndex: number; /** * Create new instance of {@link ElectronTouchBarSegmentedControl}. * * @param options - Options. */ constructor(options: ElectronTouchBarSegmentedControlConstructorOptions); } /** * A slider item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarSlider { /** The slider's current text. */ label: string; /** The slider's current maximum value. */ maxValue: number; /** The slider's current minimum value. */ minValue: number; /** The slider's current value. */ value: number; /** * Create new instance of {@link ElectronTouchBarSlider}. * * @param options - Options. */ constructor(options: ElectronTouchBarSliderConstructorOptions); } /** * A spacer item for a {@link ElectronTouchBar}. * * @public * @unofficial */ export declare class ElectronTouchBarSpacer { /** The size of the spacer. */ size: "flexible" | "large" | "small"; /** * Create new instance of {@link ElectronTouchBarSpacer}. * * @param options - Options. */ constructor(options: ElectronTouchBarSpacerConstructorOptions); } /** * Electron Tray for adding icons and context menus to the system's notification area. * * @public * @unofficial */ export declare class ElectronTray { /** * Create a new instance of {@link ElectronTray}. * * @param image - The image to use as the tray icon. * @param guid - Assigns a GUID to the tray icon. `win32` only. */ constructor(image: ElectronNativeImage | string, guid?: string); /** * Registers an event listener that is invoked when the tray balloon is clicked. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ addListener(event: "balloon-click", listener: () => void): this; /** * Registers an event listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ addListener(event: "balloon-closed", listener: () => void): this; /** * Registers an event listener that is invoked when the tray balloon shows. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ addListener(event: "balloon-show", listener: () => void): this; /** * Registers an event listener that is invoked when the tray icon is clicked. * * @param event - The event name. * @param listener - The event handler receiving the event, the bounds of the tray icon, and the position of the event. * @returns This tray instance. */ addListener(event: "click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): this; /** * Registers an event listener that is invoked when the tray icon is double clicked. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the bounds of the tray icon. * @returns This tray instance. */ addListener(event: "double-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this; /** * Registers an event listener that is invoked when a drag operation ends on the tray or ends at another location. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ addListener(event: "drag-end", listener: () => void): this; /** * Registers an event listener that is invoked when a drag operation enters the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ addListener(event: "drag-enter", listener: () => void): this; /** * Registers an event listener that is invoked when a drag operation exits the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ addListener(event: "drag-leave", listener: () => void): this; /** * Registers an event listener that is invoked when any dragged items are dropped on the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ addListener(event: "drop", listener: () => void): this; /** * Registers an event listener that is invoked when dragged files are dropped in the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the paths of the dropped files. * @returns This tray instance. */ addListener(event: "drop-files", listener: (event: ElectronEvent, files: string[]) => void): this; /** * Registers an event listener that is invoked when dragged text is dropped in the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the dropped text string. * @returns This tray instance. */ addListener(event: "drop-text", listener: (event: ElectronEvent, text: string) => void): this; /** * Registers an event listener that is invoked when the mouse clicks the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ addListener(event: "mouse-down", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers an event listener that is invoked when the mouse enters the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ addListener(event: "mouse-enter", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers an event listener that is invoked when the mouse exits the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ addListener(event: "mouse-leave", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers an event listener that is invoked when the mouse moves in the tray icon. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ addListener(event: "mouse-move", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers an event listener that is invoked when the mouse is released from clicking the tray icon. * * Note: This will not be emitted if you have set a context menu for your tray using {@link ElectronTray.setContextMenu}, as a result of macOS-level constraints. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ addListener(event: "mouse-up", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers an event listener that is invoked when the tray icon is right clicked. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the bounds of the tray icon. * @returns This tray instance. */ addListener(event: "right-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this; /** * Closes an open context menu, as set by {@link ElectronTray.setContextMenu}. `darwin` and `win32` only. */ closeContextMenu(): void; /** Destroys the tray icon immediately. */ destroy(): void; /** * Displays a tray balloon. `win32` only. * * @param options - Options describing the balloon to display. */ displayBalloon(options: ElectronDisplayBalloonOptions): void; /** * Returns focus to the taskbar notification area. Notification area icons should use this message when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, use `tray.focus()` to return focus to the notification area. `win32` only. */ focus(): void; /** * The `bounds` of this tray icon. `darwin` and `win32` only. * * @returns The bounds of this tray icon. */ getBounds(): ElectronRectangle; /** * Whether double click events will be ignored. `darwin` only. * * @returns `true` if double click events are ignored. */ getIgnoreDoubleClickEvents(): boolean; /** * The title displayed next to the tray icon in the status bar. `darwin` only. * * @returns The title displayed next to the tray icon. */ getTitle(): string; /** * Whether the tray icon is destroyed. * * @returns `true` if the tray icon is destroyed. */ isDestroyed(): boolean; /** * Registers a listener that is invoked when the tray balloon is clicked. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ on(event: "balloon-click", listener: () => void): this; /** * Registers a listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ on(event: "balloon-closed", listener: () => void): this; /** * Registers a listener that is invoked when the tray balloon shows. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ on(event: "balloon-show", listener: () => void): this; /** * Registers a listener that is invoked when the tray icon is clicked. * * @param event - The event name. * @param listener - The event handler receiving the event, the bounds of the tray icon, and the position of the event. * @returns This tray instance. */ on(event: "click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): this; /** * Registers a listener that is invoked when the tray icon is double clicked. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the bounds of the tray icon. * @returns This tray instance. */ on(event: "double-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this; /** * Registers a listener that is invoked when a drag operation ends on the tray or ends at another location. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ on(event: "drag-end", listener: () => void): this; /** * Registers a listener that is invoked when a drag operation enters the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ on(event: "drag-enter", listener: () => void): this; /** * Registers a listener that is invoked when a drag operation exits the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ on(event: "drag-leave", listener: () => void): this; /** * Registers a listener that is invoked when any dragged items are dropped on the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ on(event: "drop", listener: () => void): this; /** * Registers a listener that is invoked when dragged files are dropped in the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the paths of the dropped files. * @returns This tray instance. */ on(event: "drop-files", listener: (event: ElectronEvent, files: string[]) => void): this; /** * Registers a listener that is invoked when dragged text is dropped in the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the dropped text string. * @returns This tray instance. */ on(event: "drop-text", listener: (event: ElectronEvent, text: string) => void): this; /** * Registers a listener that is invoked when the mouse clicks the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ on(event: "mouse-down", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a listener that is invoked when the mouse enters the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ on(event: "mouse-enter", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a listener that is invoked when the mouse exits the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ on(event: "mouse-leave", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a listener that is invoked when the mouse moves in the tray icon. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ on(event: "mouse-move", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a listener that is invoked when the mouse is released from clicking the tray icon. * * Note: This will not be emitted if you have set a context menu for your tray using {@link ElectronTray.setContextMenu}, as a result of macOS-level constraints. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ on(event: "mouse-up", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a listener that is invoked when the tray icon is right clicked. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the bounds of the tray icon. * @returns This tray instance. */ on(event: "right-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this; /** * Registers a one-time listener that is invoked when the tray balloon is clicked. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ once(event: "balloon-click", listener: () => void): this; /** * Registers a one-time listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ once(event: "balloon-closed", listener: () => void): this; /** * Registers a one-time listener that is invoked when the tray balloon shows. `win32` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ once(event: "balloon-show", listener: () => void): this; /** * Registers a one-time listener that is invoked when the tray icon is clicked. * * @param event - The event name. * @param listener - The event handler receiving the event, the bounds of the tray icon, and the position of the event. * @returns This tray instance. */ once(event: "click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): this; /** * Registers a one-time listener that is invoked when the tray icon is double clicked. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the bounds of the tray icon. * @returns This tray instance. */ once(event: "double-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this; /** * Registers a one-time listener that is invoked when a drag operation ends on the tray or ends at another location. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ once(event: "drag-end", listener: () => void): this; /** * Registers a one-time listener that is invoked when a drag operation enters the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ once(event: "drag-enter", listener: () => void): this; /** * Registers a one-time listener that is invoked when a drag operation exits the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ once(event: "drag-leave", listener: () => void): this; /** * Registers a one-time listener that is invoked when any dragged items are dropped on the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler. * @returns This tray instance. */ once(event: "drop", listener: () => void): this; /** * Registers a one-time listener that is invoked when dragged files are dropped in the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the paths of the dropped files. * @returns This tray instance. */ once(event: "drop-files", listener: (event: ElectronEvent, files: string[]) => void): this; /** * Registers a one-time listener that is invoked when dragged text is dropped in the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the dropped text string. * @returns This tray instance. */ once(event: "drop-text", listener: (event: ElectronEvent, text: string) => void): this; /** * Registers a one-time listener that is invoked when the mouse clicks the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ once(event: "mouse-down", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a one-time listener that is invoked when the mouse enters the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ once(event: "mouse-enter", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a one-time listener that is invoked when the mouse exits the tray icon. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ once(event: "mouse-leave", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a one-time listener that is invoked when the mouse moves in the tray icon. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ once(event: "mouse-move", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a one-time listener that is invoked when the mouse is released from clicking the tray icon. * * Note: This will not be emitted if you have set a context menu for your tray using {@link ElectronTray.setContextMenu}, as a result of macOS-level constraints. `darwin` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the position of the event. * @returns This tray instance. */ once(event: "mouse-up", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Registers a one-time listener that is invoked when the tray icon is right clicked. `darwin` and `win32` only. * * @param event - The event name. * @param listener - The event handler receiving the event and the bounds of the tray icon. * @returns This tray instance. */ once(event: "right-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this; /** * Pops up the context menu of the tray icon. When `menu` is passed, the `menu` will be shown instead of the tray icon's context menu. * * The `position` is only available on Windows, and it is (0, 0) by default. `darwin` and `win32` only. * * @param menu - The menu to show instead of the tray icon's context menu. * @param position - The position at which to pop up the menu. */ popUpContextMenu(menu?: ElectronMenu, position?: ElectronPoint): void; /** * Removes a tray balloon. `win32` only. */ removeBalloon(): void; /** * Removes the event listener for the tray balloon being clicked. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "balloon-click", listener: () => void): this; /** * Removes the event listener for the tray balloon being closed. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "balloon-closed", listener: () => void): this; /** * Removes the event listener for the tray balloon being shown. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "balloon-show", listener: () => void): this; /** * Removes the event listener for the tray icon being clicked. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): this; /** * Removes the event listener for the tray icon being double clicked. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "double-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this; /** * Removes the event listener for a drag operation ending. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "drag-end", listener: () => void): this; /** * Removes the event listener for a drag operation entering the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "drag-enter", listener: () => void): this; /** * Removes the event listener for a drag operation exiting the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "drag-leave", listener: () => void): this; /** * Removes the event listener for dragged items being dropped on the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "drop", listener: () => void): this; /** * Removes the event listener for dragged files being dropped in the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "drop-files", listener: (event: ElectronEvent, files: string[]) => void): this; /** * Removes the event listener for dragged text being dropped in the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "drop-text", listener: (event: ElectronEvent, text: string) => void): this; /** * Removes the event listener for the mouse clicking the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "mouse-down", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Removes the event listener for the mouse entering the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "mouse-enter", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Removes the event listener for the mouse exiting the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "mouse-leave", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Removes the event listener for the mouse moving in the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "mouse-move", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Removes the event listener for the mouse being released from clicking the tray icon. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "mouse-up", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this; /** * Removes the event listener for the tray icon being right clicked. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This tray instance. */ removeListener(event: "right-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this; /** Sets the context menu for this icon. */ setContextMenu(menu: ElectronMenu | null): void; /** * Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon. `darwin` only. * * @param ignore - Whether to ignore double click events. */ setIgnoreDoubleClickEvents(ignore: boolean): void; /** * Sets the `image` associated with this tray icon. * * @param image - The image to use as the tray icon. */ setImage(image: ElectronNativeImage | string): void; /** * Sets the `image` associated with this tray icon when pressed on macOS. `darwin` only. * * @param image - The image to use as the pressed tray icon. */ setPressedImage(image: ElectronNativeImage | string): void; /** * Sets the title displayed next to the tray icon in the status bar (Support ANSI colors). `darwin` only. * * @param title - The title to display next to the tray icon. * @param options - Options describing how the title is displayed. */ setTitle(title: string, options?: ElectronTitleOptions): void; /** * Sets the hover text for this tray icon. * * @param toolTip - The hover text for this tray icon. */ setToolTip(toolTip: string): void; } /** * Graphics class for drawing shapes. * * @public * @unofficial */ export declare class Graphics extends Container { /** * Creates a new graphics object. * * @param geometry - The geometry to use. */ constructor(geometry?: GraphicsGeometry); /** * Draws an arc. * * @param cx - Center X. * @param cy - Center Y. * @param radius - Arc radius. * @param startAngle - Start angle in radians. * @param endAngle - End angle in radians. * @param anticlockwise - Whether to draw anticlockwise. * @returns This graphics for chaining. */ arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): this; /** * Draws an arc between two tangent lines. * * @param x1 - First point X. * @param y1 - First point Y. * @param x2 - Second point X. * @param y2 - Second point Y. * @param radius - Arc radius. * @returns This graphics for chaining. */ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this; /** * Begins filling a shape with color. * * @param color - Fill color. * @param alpha - Fill alpha. * @returns This graphics for chaining. */ beginFill(color?: ColorSource, alpha?: number): this; /** * Draws a cubic bezier curve. * * @param cpX - First control point X. * @param cpY - First control point Y. * @param cpX2 - Second control point X. * @param cpY2 - Second control point Y. * @param toX - End point X. * @param toY - End point Y. * @returns This graphics for chaining. */ bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): this; /** Clears all drawn graphics. */ clear(): this; /** Clones this graphics object. */ clone(): Graphics; /** Closes the current path. */ closePath(): this; /** * Destroys this graphics object. * * @param options - Destroy options. */ destroy(options?: boolean | IDestroyOptions): void; /** * Draws a circle. * * @param x - Center X. * @param y - Center Y. * @param radius - Circle radius. * @returns This graphics for chaining. */ drawCircle(x: number, y: number, radius: number): this; /** * Draws an ellipse. * * @param x - Center X. * @param y - Center Y. * @param width - Half width. * @param height - Half height. * @returns This graphics for chaining. */ drawEllipse(x: number, y: number, width: number, height: number): this; /** * Draws a rectangle. * * @param x - X position. * @param y - Y position. * @param width - Width. * @param height - Height. * @returns This graphics for chaining. */ drawRect(x: number, y: number, width: number, height: number): this; /** * Draws a rounded rectangle. * * @param x - X position. * @param y - Y position. * @param width - Width. * @param height - Height. * @param radius - Corner radius. * @returns This graphics for chaining. */ drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): this; /** Ends filling a shape. */ endFill(): this; /** * Sets the line style. * * @param width - Line width. * @param color - Line color. * @param alpha - Line alpha. * @param alignment - Line alignment. * @param native - Whether to use native line drawing. * @returns This graphics for chaining. */ lineStyle(width: number, color?: ColorSource, alpha?: number, alignment?: number, native?: boolean): this; /** * Draws a line to a point. * * @param x - X coordinate. * @param y - Y coordinate. * @returns This graphics for chaining. */ lineTo(x: number, y: number): this; /** * Moves the drawing cursor to a point. * * @param x - X coordinate. * @param y - Y coordinate. * @returns This graphics for chaining. */ moveTo(x: number, y: number): this; /** * Draws a quadratic bezier curve. * * @param cpX - Control point X. * @param cpY - Control point Y. * @param toX - End point X. * @param toY - End point Y. * @returns This graphics for chaining. */ quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this; /** Tint color. */ get tint(): ColorSource; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set tint(value: ColorSource); } /** * Graphics geometry. * * @public * @unofficial */ export declare class GraphicsGeometry { /** * Create new instance of {@link GraphicsGeometry}. * * @param options - Options. */ constructor(); } /** * Outline representing a PDF text highlight annotation. * * @public * @unofficial */ export declare class HighlightOutline extends Outline { /** * The last point of the highlight used for directional calculations. */ lastPoint: unknown; /** * Create a highlight outline from the given outlines, bounding box, and last point. */ constructor(outlines: unknown, box: unknown, lastPoint: unknown); /** * The bounding box of the highlight outline. * * @returns The bounding box, or `null`. */ get box(): null | object; /** * CSS class names applied when outlining this highlight. * * @returns The class names for outlining. */ 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>; } /** * Generates outlines around highlighted regions in a PDF document. * * @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, borderWidth?: number, innerMargin?: number, isLTR?: boolean); /** * Compute and return the highlight outlines for the given boxes. * * @returns The computed highlight outlines. */ getOutlines(): HighlightOutline; } /** * A parse tree representing the syntactic structure of a document. * * @public * @unofficial */ export declare class LezerTree { /** The child trees and buffers of this node. */ readonly children: readonly (LezerTree | LezerTreeBuffer)[]; /** An empty tree. */ static empty: LezerTree; /** The total length of the content covered by this tree. */ readonly length: number; /** The start positions of the children. */ readonly positions: readonly number[]; /** The type of the top node. */ readonly type: NodeType; /** * Create a new tree node. * * @param type - The node type. * @param children - The child trees and buffers. * @param positions - The start positions of the children. * @param length - The total length of content covered. * @param props - Optional node properties. */ constructor(type: NodeType, children: readonly (LezerTree | LezerTreeBuffer)[], positions: readonly number[], length: number, props?: readonly [ NodeProp | number, unknown ][]); /** * Create a cursor over this tree. * * @param mode - The iteration mode. * @returns A tree cursor. */ cursor(mode?: IterMode): LezerTreeCursor; /** * Create a cursor positioned at the given position. * * @param pos - The position to start at. * @param side - Which side of the position to prefer. * @param mode - The iteration mode. * @returns A tree cursor. */ cursorAt(pos: number, side?: -1 | 0 | 1, mode?: IterMode): LezerTreeCursor; /** * Get the value of a prop for the top node type. * * @param prop - The property to look up. * @returns The property value, or `undefined` if not set. */ prop(prop: NodeProp): T | undefined; /** * Resolve the node at the given position. * * @param pos - The position to resolve. * @param side - Which side of the position to prefer. * @returns The resolved syntax node. */ resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode; /** * Resolve the innermost node at the given position. * * @param pos - The position to resolve. * @param side - Which side of the position to prefer. * @returns The resolved syntax node. */ resolveInner(pos: number, side?: -1 | 0 | 1): SyntaxNode; /** The top node of this tree. */ get topNode(): SyntaxNode; } /** * A tree buffer represents a sequence of nodes in a compact flat array format. * * @public * @unofficial */ export declare class LezerTreeBuffer { /** The flat buffer of node data. */ readonly buffer: Uint16Array; /** The total length of the content covered by this buffer. */ readonly length: number; /** The node set that this buffer's node type ids refer to. */ readonly set: NodeSet; } /** * A cursor for walking through the syntax tree. * * @public * @unofficial */ export declare class LezerTreeCursor implements SyntaxNodeRef { /** The start position of the current node. */ readonly from: number; /** The name of the current node type. */ readonly name: string; /** The actual syntax node at the current position. */ readonly node: SyntaxNode; /** The end position of the current node. */ readonly to: number; /** The tree that the current node belongs to, if it is a top node. */ readonly tree: LezerTree | null; /** The type of the current node. */ readonly type: NodeType; /** * Move to the first child of the current node. * * @returns Whether a child was found. */ firstChild(): boolean; /** * Move to the last child of the current node. * * @returns Whether a child was found. */ lastChild(): boolean; /** * Move to the next node in tree order. * * @param enter - Whether to enter child nodes. * @returns Whether a next node was found. */ next(enter?: boolean): boolean; /** * Move to the next sibling of the current node. * * @returns Whether a sibling was found. */ nextSibling(): boolean; /** * Move to the parent of the current node. * * @returns Whether a parent was found. */ parent(): boolean; /** * Move to the previous node in tree order. * * @param enter - Whether to enter child nodes. * @returns Whether a previous node was found. */ prev(enter?: boolean): boolean; /** * Move to the previous sibling of the current node. * * @returns Whether a sibling was found. */ prevSibling(): boolean; } /** * Represents a fragment of a previously parsed tree that can be reused. * * @public * @unofficial */ export declare class LezerTreeFragment { /** The start position of this fragment in the original document. */ readonly from: number; /** The offset that positions in this fragment are shifted by. */ readonly offset: number; /** The end position of this fragment in the original document. */ readonly to: number; /** The tree for this fragment. */ readonly tree: LezerTree; } /** * 2D transformation matrix. * * @public * @unofficial */ export declare class Matrix { /** Scale X. */ a: number; /** Shear Y. */ b: number; /** Shear X. */ c: number; /** Scale Y. */ d: number; /** Translate X. */ tx: number; /** Translate Y. */ ty: number; } /** * Represents a tree mounted on a node via a node prop. * * @public * @unofficial */ export declare class MountedLezerTree { /** The regions of the host tree that this mounted tree covers, or `null` if it covers the entire node. */ readonly overlay: null | readonly LezerTreeRange[]; /** The parser that produced this tree. */ readonly parser: Parser; /** The mounted tree. */ readonly tree: LezerTree; } /** * A node prop is a value associated with node types. * * @public * @unofficial */ export declare class NodeProp { /** Prop for closed bracket names. */ static closedBy: NodeProp; /** Context hash prop, used to distinguish nodes that would otherwise look the same. */ static contextHash: NodeProp; /** A function to deserialize prop values from strings. */ readonly deserialize: (str: string) => T; /** Prop for node grouping. */ static group: NodeProp; /** Look-ahead prop, indicating how far the tokenizer looked ahead. */ static lookAhead: NodeProp; /** Prop used to mount additional trees on a node. */ static mounted: NodeProp; /** Prop for open bracket names. */ static openedBy: NodeProp; /** Whether this prop is stored per node rather than per type. */ readonly perNode: boolean; /** * Create a new node prop. * * @param config - Configuration for the prop. */ constructor(config?: NodePropConfig); /** * Create a prop source that adds this prop to matching node types. * * @param match - A mapping from selectors to values, or a function computing values. * @returns A prop source. */ add(match: ((type: NodeType) => T | undefined) | NodePropSelectorMap): NodePropSource; } /** * A set of node types, used to define the types available in a grammar. * * @public * @unofficial */ export declare class NodeSet { /** The node types in this set, indexed by their id. */ readonly types: readonly NodeType[]; } /** * Represents a type of syntax node in the tree. * * @public * @unofficial */ export declare class NodeType { /** The numeric id of this node type. */ readonly id: number; /** The name of this node type. */ readonly name: string; /** A dummy node type used when no actual type is available. */ static none: NodeType; /** * Retrieve the value of a given node prop for this type. * * @param prop - The property to look up. * @returns The property value, or `undefined` if not set. */ readonly prop: (prop: NodeProp) => T | undefined; } /** * Observable point that triggers a callback when changed. * * @public * @unofficial */ export declare class ObservablePoint implements IPointData { /** X coordinate. */ x: number; /** Y coordinate. */ y: number; /** * Copies x and y from the given point. * * @param p - The point to copy from. * @returns This point for chaining. */ copyFrom(p: IPointData): this; /** * Copies x and y into the given point. * * @param p - The point to copy into. * @returns The target point. */ copyTo(p: U): U; /** * Sets the point to a new x and y position. * * @param x - Position on the X axis. * @param y - Position on the Y axis. * @returns This point for chaining. */ set(x?: number, y?: number): this; } /** * Represents an SVG outline path for PDF annotations. * * @public * @unofficial */ export declare class Outline { /** * Number of decimal places used when rounding SVG coordinates. */ static PRECISION: number; /** * Normalize a point relative to the page with the given rotation. * * @returns The normalized point coordinates. */ static _normalizePagePoint(x: unknown, y: unknown, rotation: unknown): unknown[]; /** * Normalize a point relative to a parent element with the given dimensions and rotation. * * @returns The normalized point coordinates. */ static _normalizePoint(x: unknown, y: unknown, parentWidth: unknown, parentHeight: unknown, rotation: unknown): number[]; /** * Rescale coordinates by translation and scale factors. * * @returns The rescaled coordinates. */ static _rescale(src: unknown, tx: unknown, ty: unknown, sx: unknown, sy: unknown, dest: unknown): unknown; /** * Rescale and swap coordinates by translation and scale factors. * * @returns The rescaled and swapped coordinates. */ static _rescaleAndSwap(src: unknown, tx: unknown, ty: unknown, sx: unknown, sy: unknown, dest: unknown): unknown; /** * Translate coordinates by the given offsets. * * @returns The translated coordinates. */ static _translate(src: unknown, tx: unknown, ty: unknown, dest: unknown): unknown; /** * The bounding box of the outline. * * @returns The bounding box of the outline. */ get box(): null | object; /** * Create cubic bezier control points between two endpoints. * * @returns The bezier control point coordinates. */ static createBezierPoints(x1: unknown, y1: unknown, x2: unknown, y2: unknown, x3: unknown, y3: unknown): number[]; /** * Serialize the outline into the PDF page coordinate system. * * @param bbox - The bounding box as bottom-left and top-right coordinates. * @param rotation - The page rotation in degrees. */ serialize(bbox: [ blX: string, blY: string, trX: string, trY: string ], rotation: number): void; /** * Round a number to the configured SVG precision. * * @returns The rounded number. */ static svgRound(x: unknown): number; /** * Converts the outline to an SVG path. * * @returns The SVG path of the outline. */ toSVGPath(): string; } /** * PDF.js Web Worker wrapper. * * @public * @unofficial */ export declare class PDFWorker { /** The message handler for worker communication. */ readonly messageHandler: null | unknown; /** The worker port. */ readonly port: null | unknown; /** Promise that resolves when the worker is ready. */ readonly promise: Promise; /** Creates a new PDFWorker instance. */ constructor(params?: PDFWorkerParams); /** Destroys the worker. */ destroy(): void; /** * Creates a PDFWorker from an existing port. * * @param params - Parameters including the port. * @returns A new PDFWorker instance. */ static fromPort(params: PDFWorkerFromPortParams): PDFWorker; /** * Gets the URL of the worker source. * * @returns The worker source URL. */ static getWorkerSrc(): string; } /** * A parse context that can be used to track parsing progress. * * @public * @unofficial */ export declare class ParseContext { /** The editor state being parsed. */ readonly state: EditorState; /** The viewport range currently visible. */ readonly viewport: ParseContextRange; /** * Get the current parse context, if any. * * @returns The current parse context, or `null` if none is active. */ static get(): null | ParseContext; /** * Tell the parse context to skip parsing until the given range is in view. * * @param from - The start of the range. * @param to - The end of the range. */ skipUntilInView(from: number, to: number): void; } /** * Rectangle object. * * @public * @unofficial */ export declare class PixiRectangle { /** Height of the rectangle. */ height: number; /** Width of the rectangle. */ width: number; /** X coordinate of the upper-left corner. */ x: number; /** Y coordinate of the upper-left corner. */ y: number; /** * Creates a new rectangle. * * @param x - X coordinate of the upper-left corner. * @param y - Y coordinate of the upper-left corner. * @param width - Width of the rectangle. * @param height - Height of the rectangle. */ constructor(x?: number, y?: number, width?: number, height?: number); /** Bottom edge of the rectangle. */ get bottom(): number; /** * Checks whether the given point is inside the rectangle. * * @param x - X coordinate to test. * @param y - Y coordinate to test. * @returns Whether the point is contained. */ contains(x: number, y: number): boolean; /** An empty rectangle. */ static get EMPTY(): PixiRectangle; /** Left edge of the rectangle. */ get left(): number; /** Right edge of the rectangle. */ get right(): number; /** Top edge of the rectangle. */ get top(): number; } /** * PixiJS text display object. * * @public * @unofficial */ export declare class PixiText extends Sprite { /** * Creates a new text object. * * @param text - The text content. * @param style - The text style. * @param canvas - The canvas to render on. */ constructor(text?: number | string, style?: Partial | TextStyle, canvas?: ICanvas); /** * Destroys this text object. * * @param options - Destroy options. */ destroy(options?: boolean | IDestroyOptions): void; /** Height of the text. */ get height(): number; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set height(value: number); /** Text resolution. */ get resolution(): number; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set resolution(value: number); /** Text style. */ get style(): TextStyle; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set style(style: Partial | TextStyle); /** Text content. */ get text(): string; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set text(text: number | string); /** * Updates the text rendering. * * @param respectDirty - Whether to respect the dirty flag. */ updateText(respectDirty: boolean): void; /** Width of the text. */ get width(): number; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set width(value: number); } /** * Represents a parsed token produced by Prism's tokenizer. * * @public * @unofficial */ export declare class PrismToken { /** Alias name(s) for the token type. */ alias: string | string[]; /** The content of the token, either a string or nested tokens. */ content: PrismToken[] | string; /** Whether the token was matched greedily. */ greedy: boolean; /** The length of the matched string. */ length: number; /** The type of the token. */ type: string; /** * Creates a new PrismToken. * * @param type - The type of the token. * @param content - The content of the token. * @param alias - Optional alias(es) for the token. * @param matchedStr - The original matched string. */ constructor(type: string, content: PrismToken[] | string, alias?: string | string[], matchedStr?: string, greedy?: boolean); /** * Converts a token or token stream to an HTML string. * * @param o - The token or token stream to stringify. * @param language - The language identifier. * @returns The stringified HTML representation. */ static stringify(o: Array | PrismToken | string, language: string, parent?: Array): string; } /** * Represents a search query with its configuration and methods for searching. * * @public * @unofficial */ export declare class SearchQuery { /** Whether the search is case sensitive. */ readonly caseSensitive: boolean; /** Whether the search string is treated as a literal. */ readonly literal: boolean; /** Whether the search string is a regular expression. */ readonly regexp: boolean; /** The replacement string. */ readonly replace: string; /** The search string. */ readonly search: string; /** Whether the search query is valid. */ readonly valid: boolean; /** Whether the search matches whole words only. */ readonly wholeWord: boolean; /** * Create new instance of {@link SearchQuery} * * @param config - Configuration */ constructor(config: SearchQueryConfig); /** * Check whether this query is equal to another. * * @param other - The other search query to compare with. * @returns Whether the queries are equal. */ eq(other: SearchQuery): boolean; /** * Get a cursor for iterating over matches. * * @param state - The text or editor state to search in. * @param from - Optional start position. * @param to - Optional end position. * @returns An iterator over match ranges. */ getCursor(state: CmText | EditorState, from?: number, to?: number): Iterator; } /** * Sprite display object. * * @public * @unofficial */ export declare class Sprite extends Container { /** * Creates a new sprite. * * @param texture - The texture to use. */ constructor(texture?: Texture); /** Anchor point. */ get anchor(): ObservablePoint; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set anchor(value: IPointData); /** * Destroys this sprite. * * @param options - Destroy options. */ destroy(options?: boolean | IDestroyOptions): void; /** * Creates a sprite from the given source. * * @param source - The sprite source. * @returns The created sprite. */ static from(source: SpriteSource): Sprite; /** Height of the sprite. */ get height(): number; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set height(value: number); /** Texture of the sprite. */ get texture(): Texture; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set texture(value: Texture); /** Tint color. */ get tint(): ColorSource; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set tint(value: ColorSource); /** Width of the sprite. */ get width(): number; // eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor. set width(value: number); } /** * A CSS module that can be mounted into a document or shadow root. * * @public * @unofficial */ export declare class StyleModule { /** * Create new instance of {@link StyleModule}. * * @param spec - Specification. * @param options - Options. */ constructor(spec: StyleModuleSpec, options?: StyleModuleOptions); /** Get the generated CSS rules as a string. */ getRules(): string; /** * Mount style module(s) into a document or shadow root. * * @param root - The document or shadow root to mount into. * @param module - The style module(s) to mount. * @param options - Optional mount options. */ static mount(root: Document | DocumentOrShadowRoot | ShadowRoot, module: readonly StyleModule[] | StyleModule, options?: StyleModuleMountOptions): void; /** * Generate a new unique CSS class name. * * @returns A unique class name string. */ static newName(): string; } /** * Text style class. * * @public * @unofficial */ export declare class TextStyle implements ITextStyle { /** Text alignment. */ align: TextStyleAlign; /** Whether to break words. */ breakWords: boolean; /** Whether to show a drop shadow. */ dropShadow: boolean; /** Drop shadow alpha. */ dropShadowAlpha: number; /** Drop shadow angle in radians. */ dropShadowAngle: number; /** Drop shadow blur radius. */ dropShadowBlur: number; /** Drop shadow color. */ dropShadowColor: number | string; /** Drop shadow distance. */ dropShadowDistance: number; /** Fill style for the text. */ fill: TextStyleFill; /** Fill gradient stops. */ fillGradientStops: number[]; /** Fill gradient type. */ fillGradientType: TEXT_GRADIENT; /** Font family. */ fontFamily: string | string[]; /** Font size. */ fontSize: number | string; /** Font style. */ fontStyle: TextStyleFontStyle; /** Font variant. */ fontVariant: TextStyleFontVariant; /** Font weight. */ fontWeight: TextStyleFontWeight; /** Leading between lines. */ leading: number; /** Letter spacing. */ letterSpacing: number; /** Line height. */ lineHeight: number; /** Line join style. */ lineJoin: TextStyleLineJoin; /** Miter limit. */ miterLimit: number; /** Padding around the text. */ padding: number; /** Stroke color. */ stroke: number | string; /** Stroke thickness. */ strokeThickness: number; /** Style ID for change tracking. */ styleID: number; /** Text baseline. */ textBaseline: TextStyleTextBaseline; /** Whether to trim whitespace. */ trim: boolean; /** White space handling. */ whiteSpace: TextStyleWhiteSpace; /** Whether to word wrap. */ wordWrap: boolean; /** Word wrap width. */ wordWrapWidth: number; /** * Creates a new text style. * * @param style - The style parameters. */ constructor(style?: Partial); /** Clones this text style. */ clone(): TextStyle; /** Resets the text style to defaults. */ reset(): void; } /** * Texture resource. * * @public * @unofficial */ export declare class Texture { /** An empty texture. */ static EMPTY: Texture; /** A white texture. */ static WHITE: Texture; } /** * Transform that holds position, scale, pivot, skew, and rotation. * * @public * @unofficial */ export declare class Transform { /** Local transformation matrix. */ localTransform: Matrix; /** Pivot point. */ pivot: ObservablePoint; /** Position. */ position: ObservablePoint; /** Rotation in radians. */ rotation: number; /** Scale. */ scale: ObservablePoint; /** Skew. */ skew: ObservablePoint; /** World transformation matrix. */ worldTransform: Matrix; } /** * Constant mapping of file extension identifiers recognized and supported by Obsidian. * * @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"; }; /** * Global worker options for PDF.js. * * @public * @unofficial */ export declare const GlobalWorkerOptions: GlobalWorkerOptionsType; /** * Constant mapping of internal (core) plugin name identifiers bundled with Obsidian. * * @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"; }; /** * A constructor function for creating {@link Position} objects. * * @public * @unofficial */ export declare const Pos: (line: number, ch?: number, sticky?: string) => Position; /** * Constant mapping of view type identifiers used to open and manage different leaf views in Obsidian. * * @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"; }; /** * The build identifier of the PDF.js library. * * @public * @unofficial */ export declare const build: string; /** * Computes the end position of a change. * * @public * @unofficial */ export declare const changeEnd: (change: Cm5EditorChange) => Position; /** * Changes the active language. * * @public * @unofficial */ export declare const changeLanguage: I18n["changeLanguage"]; /** * Electron clipboard instance for accessing system clipboard. * * @public * @unofficial */ export declare const clipboard: ElectronClipboard; /** * A map of built-in CodeMirror 5 commands. * * @public * @unofficial */ export declare const commands: Record void>; /** * Creates a new i18next instance. * * @public * @unofficial */ export declare const createInstance: I18n["createInstance"]; /** * Default configuration options for CodeMirror 5 editors. * * @public * @unofficial */ export declare const defaults: Record; /** * Electron dialog instance for showing native system dialogs. * * @public * @unofficial */ export declare const dialog: ElectronDialog; /** * Returns the text direction for a language. * * @public * @unofficial */ export declare const dir: I18n["dir"]; /** * Controls tree iteration behavior. * * @public * @unofficial */ export declare const enum IterMode { ExcludeBuffers = 1, IgnoreMounts = 4, IgnoreOverlays = 8, IncludeAnonymous = 2 } /** * Checks whether a translation key exists. * * @public * @unofficial */ export declare const exists: I18n["exists"]; /** * Gets a translation function fixed to a language and namespace. * * @public * @unofficial */ export declare const getFixedT: I18n["getFixedT"]; /** * Checks whether a namespace has been loaded. * * @public * @unofficial */ export declare const hasLoadedNamespace: I18n["hasLoadedNamespace"]; /** * Prism hook system for extending highlighting behavior. * * @public * @unofficial */ export declare const hooks: PrismHooks; /** * Initializes the i18next instance. * * @public * @unofficial */ export declare const init: I18n["init"]; /** * Electron IPC renderer instance for the current renderer process. * * @public * @unofficial */ export declare const ipcRenderer: ElectronIpcRenderer; /** * A map of key map definitions for CodeMirror 5. * * @public * @unofficial */ export declare const keyMap: Record void) | string>>; /** * The Prism languages registry. * * @public * @unofficial */ export declare const languages: Languages; /** * Loads additional languages. * * @public * @unofficial */ export declare const loadLanguages: I18n["loadLanguages"]; /** * Loads additional namespaces. * * @public * @unofficial */ export declare const loadNamespaces: I18n["loadNamespaces"]; /** * Loads resources using the configured backend. * * @public * @unofficial */ export declare const loadResources: I18n["loadResources"]; /** * The version string of the PDF.js library. * * @public * @unofficial */ export declare const pdfJsVersion: string; /** * Registry of Prism plugins. * * @public * @unofficial */ export declare const plugins: Record; /** * Reloads resources for the given languages and namespaces. * * @public * @unofficial */ export declare const reloadResources: I18n["reloadResources"]; /** * Electron remote module instance for accessing main process modules. * * @public * @unofficial */ export declare const remote: ElectronRemote; /** * Sets the default namespace. * * @public * @unofficial */ export declare const setDefaultNamespace: I18n["setDefaultNamespace"]; /** * Electron shell instance for managing files and URLs. * * @public * @unofficial */ export declare const shell: ElectronShell; /** * Translates a key to a localized string. * * @public * @unofficial */ export declare const t: I18n["t"]; /** * Registers a plugin module. * * @public * @unofficial */ export declare const use: I18n["use"]; /** * Prism utility functions. * * @public * @unofficial */ export declare const util: PrismUtil; /** * The CodeMirror 5 version string. * * @public * @unofficial */ export declare const version: string; /** * Determines how position mapping works for a change. * * @public * @unofficial */ export declare enum MapMode { Simple = 0, TrackDel = 1, TrackBefore = 2, TrackAfter = 3 } /** * Creates and properly initializes the instance of {@link obsidian#TFile} even the underlying file does not exist. * This doesn't create the missing file on the file system. * * @param app - The Obsidian app instance. * @param path - The path to the file. * @returns The created {@link obsidian#TFile} instance. * * @public * @unofficial */ export declare function createTFileInstance(app: App, path: string): TFile; /** * Creates and properly initializes the instance of {@link obsidian#TFolder} even the underlying folder does not exist. * This doesn't create the missing folder on the file system. * * @param app - The Obsidian app instance. * @param path - The path to the folder. * @returns The created {@link obsidian#TFolder} instance. * * @public * @unofficial */ export declare function createTFolderInstance(app: App, path: string): TFolder; /** * Registers a new editor extension method. * * @param name - The extension name. * @param value - The extension implementation. * @public * @unofficial */ export declare function defineExtension(name: string, value: unknown): void; /** * Registers a function to be called when an editor is initialized. * * @param f - The initialization hook function. * @public * @unofficial */ export declare function defineInitHook(f: (cm: Cm5Editor) => void): void; /** * Registers a new editor mode. * * @param name - The mode name. * @param modeFactory - The factory function that creates the mode. * @public * @unofficial */ export declare function defineMode(name: string, modeFactory: Cm5ModeFactory): void; /** * Registers a new editor option. * * @param name - The option name. * @param defaultValue - The default value for the option. * @param onUpdate - The update handler called when the option changes. * @public * @unofficial */ export declare function defineOption(name: string, defaultValue: unknown, onUpdate: (editor: Cm5Editor, val: unknown, old: unknown) => void): void; /** * Evaluate a `.base` file in headless mode — with no leaf or open view — and return its entries. * * It renders the base off-screen via {@link getBasesControllerFromRender}, waits for the initial vault scan * to settle, then reads the controller's results. Everything is torn down before returning. * * @param app - The app instance. * @param content - The `.base` file content (the body of a `base` code block). * @param sourcePath - The path supplying the query's file context. * @returns The evaluated base entries. * * @public * @unofficial */ export declare function evaluateBaseHeadless(app: App, content: string, sourcePath: string): Promise; /** * Creates a CodeMirror 5 editor from a textarea element. * * @param host - The textarea element to replace. * @param options - Optional editor configuration. * @returns The created editor instance. * @public * @unofficial */ export declare function fromTextArea(host: HTMLTextAreaElement, options?: Cm5EditorConfiguration): Cm5Editor; /** * Get the {@link obsidian#AbstractTextComponent} constructor. * * @returns The {@link obsidian#AbstractTextComponent} constructor. * * @public * @unofficial */ export declare function getAbstractTextComponentConstructor(): ExtractConstructor>; /** * Get the {@link AllPropertiesView} constructor. * * @param app - The app. * @returns The {@link AllPropertiesView} constructor. * * @public * @unofficial */ export declare function getAllPropertiesViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#App} constructor. * * @returns The {@link obsidian#App} constructor. * * @public * @unofficial */ export declare function getAppConstructor(): ExtractConstructor; /** * Get the {@link AppMenuBarManager} constructor. * * @param app - The app instance. * @returns The {@link AppMenuBarManager} constructor. * * @public * @unofficial */ export declare function getAppMenuBarManagerConstructor(app: App): ExtractConstructor; /** * Get the {@link AppSetting} constructor. * * @param app - The app instance. * @returns The {@link AppSetting} constructor. * * @public * @unofficial */ export declare function getAppSettingConstructor(app: App): ExtractConstructor; /** * Get the {@link AudioView} constructor. * * @param app - The app. * @returns The {@link AudioView} constructor. * * @public * @unofficial */ export declare function getAudioViewConstructor(app: App): ExtractConstructor; /** * Get the {@link BacklinkView} constructor. * * @param app - The app. * @returns The {@link BacklinkView} constructor. * * @public * @unofficial */ export declare function getBacklinkViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#BaseComponent} constructor. * * @returns The {@link obsidian#BaseComponent} constructor. * * @public * @unofficial */ export declare function getBaseComponentConstructor(): ExtractConstructor; /** * Get the {@link BasesContext} constructor. * * @param app - The app instance. * @returns The {@link BasesContext} constructor. * * @public * @unofficial */ export declare function getBasesContextConstructor(app: App): ExtractConstructor; /** * Render a base into a detached, off-screen element and return the live {@link BasesController} that drives * it. This is the leaf-free route to headless base evaluation: it runs Obsidian's own base-embed processor * via the public {@link obsidian#MarkdownRenderer.render}, then locates the controller in the render's * component tree. * * The caller owns `component`'s lifecycle and MUST call `component.unload()` once done with the controller * (which also detaches the rendered element). * * @param app - The app instance. * @param content - The `.base` file content (the body of a `base` code block). * @param sourcePath - The path supplying the query's file context. * @param component - The component that owns the render; the caller unloads it. * @returns The live {@link BasesController} for the rendered base. * * @public * @unofficial */ export declare function getBasesControllerFromRender(app: App, content: string, sourcePath: string, component: Component): Promise; /** * Get the {@link obsidian#BasesEntry} constructor. * * @returns The {@link obsidian#BasesEntry} constructor. * * @public * @unofficial */ export declare function getBasesEntryConstructor(): ExtractConstructor; /** * Get the {@link obsidian#BasesEntryGroup} constructor. * * @returns The {@link obsidian#BasesEntryGroup} constructor. * * @public * @unofficial */ export declare function getBasesEntryGroupConstructor(): ExtractConstructor; /** * Get the {@link BasesQuery} constructor (the `.base` parser, exposing the static `fromString`). * * `BasesQuery` has no public `obsidian` export and no leaf-free factory, so the class is harvested at * runtime: a throwaway base is rendered off-screen (via {@link getBasesControllerFromRender}) and the * constructor is read off the resulting query. The throwaway render is torn down before returning. * * @param app - The app instance. * @returns The {@link BasesQuery} constructor. * * @public * @unofficial */ export declare function getBasesQueryConstructor(app: App): Promise; /** * Get the {@link obsidian#BasesQueryResult} constructor. * * @returns The {@link obsidian#BasesQueryResult} constructor. * * @public * @unofficial */ export declare function getBasesQueryResultConstructor(): ExtractConstructor; /** * Get the {@link obsidian#BasesViewConfig} constructor. * * @returns The {@link obsidian#BasesViewConfig} constructor. * * @public * @unofficial */ export declare function getBasesViewConfigConstructor(): ExtractConstructor; /** * Get the {@link BasesView} constructor. * * @param app - The app. * @returns The {@link BasesView} constructor. * * @public * @unofficial */ export declare function getBasesViewConstructor(app: App): ExtractConstructor; /** * Get the {@link BookmarksView} constructor. * * @param app - The app. * @returns The {@link BookmarksView} constructor. * * @public * @unofficial */ export declare function getBookmarksViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#BooleanValue} constructor. * * @returns The {@link obsidian#BooleanValue} constructor. * * @public * @unofficial */ export declare function getBooleanValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#ButtonComponent} constructor. * * @returns The {@link obsidian#ButtonComponent} constructor. * * @public * @unofficial */ export declare function getButtonComponentConstructor(): ExtractConstructor; /** * Get the {@link CanvasView} constructor. * * @param app - The app. * @returns The {@link CanvasView} constructor. * * @public * @unofficial */ export declare function getCanvasViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#CapacitorAdapter} constructor. * * @returns The {@link obsidian#CapacitorAdapter} constructor. * * @public * @unofficial */ export declare function getCapacitorAdapterConstructor(): ExtractConstructor; /** * Get the {@link Cli} constructor. * * @param app - The app instance. * @returns The {@link Cli} constructor. * * @public * @unofficial */ export declare function getCliConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#ColorComponent} constructor. * * @returns The {@link obsidian#ColorComponent} constructor. * * @public * @unofficial */ export declare function getColorComponentConstructor(): ExtractConstructor; /** * Get the {@link Commands} constructor. * * @param app - The app instance. * @returns The {@link Commands} constructor. * * @public * @unofficial */ export declare function getCommandsConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#Component} constructor. * * @returns The {@link obsidian#Component} constructor. * * @public * @unofficial */ export declare function getComponentConstructor(): ExtractConstructor; /** * Get the {@link CustomCSS} constructor. * * @param app - The app instance. * @returns The {@link CustomCSS} constructor. * * @public * @unofficial */ export declare function getCustomCSSConstructor(app: App): ExtractConstructor; /** * Get the instance of the current {@link DataAdapterEx}. * * @param app - The application instance. * @returns The data adapter extension. * * @public * @unofficial */ export declare function getDataAdapterEx(app: App): DataAdapterEx; /** * Get the {@link obsidian#DateValue} constructor. * * @returns The {@link obsidian#DateValue} constructor. * * @public * @unofficial */ export declare function getDateValueConstructor(): ExtractConstructor; /** * Loads a PDF document from the given source. * * @param src - The document source (URL, ArrayBuffer, DocumentInitParameters, string, or Uint8Array). * @returns The loading task for the document. * @public * @unofficial */ export declare function getDocument(src: ArrayBuffer | DocumentInitParameters | string | Uint8Array | URL): PDFDocumentLoadingTask; /** * Get the {@link DragManager} constructor. * * @param app - The app instance. * @returns The {@link DragManager} constructor. * * @public * @unofficial */ export declare function getDragManagerConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#DropdownComponent} constructor. * * @returns The {@link obsidian#DropdownComponent} constructor. * * @public * @unofficial */ export declare function getDropdownComponentConstructor(): ExtractConstructor; /** * Get the {@link obsidian#DurationValue} constructor. * * @returns The {@link obsidian#DurationValue} constructor. * * @public * @unofficial */ export declare function getDurationValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#EditableFileView} constructor. * * @returns The {@link obsidian#EditableFileView} constructor. * * @public * @unofficial */ export declare function getEditableFileViewConstructor(): ExtractConstructor; /** * Get the {@link obsidian#Editor} constructor. * * @returns The {@link obsidian#Editor} constructor. * * @public * @unofficial */ export declare function getEditorConstructor(): ExtractConstructor; /** * Get the {@link EditorSuggests} constructor. * * @param app - The app instance. * @returns The {@link EditorSuggests} constructor. * * @public * @unofficial */ export declare function getEditorSuggestsConstructor(app: App): ExtractConstructor; /** * Get the {@link EmbedRegistry} constructor. * * @param app - The app instance. * @returns The {@link EmbedRegistry} constructor. * * @public * @unofficial */ export declare function getEmbedRegistryConstructor(app: App): ExtractConstructor; /** * Get the {@link EmptyView} constructor. * * @param app - The app. * @returns The {@link EmptyView} constructor. * * @public * @unofficial */ export declare function getEmptyViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#Events} constructor. * * @returns The {@link obsidian#Events} constructor. * * @public * @unofficial */ export declare function getEventsConstructor(): ExtractConstructor; /** * Get the {@link obsidian#ExtraButtonComponent} constructor. * * @returns The {@link obsidian#ExtraButtonComponent} constructor. * * @public * @unofficial */ export declare function getExtraButtonComponentConstructor(): ExtractConstructor; /** * Get the {@link FileExplorerView} constructor. * * @param app - The app. * @returns The {@link FileExplorerView} constructor. * * @public * @unofficial */ export declare function getFileExplorerViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#FileManager} constructor. * * @returns The {@link obsidian#FileManager} constructor. * * @public * @unofficial */ export declare function getFileManagerConstructor(): ExtractConstructor; /** * Get the {@link FilePropertiesView} constructor. * * @param app - The app. * @returns The {@link FilePropertiesView} constructor. * * @public * @unofficial */ export declare function getFilePropertiesViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#FileSystemAdapter} constructor. * * @returns The {@link obsidian#FileSystemAdapter} constructor. * * @public * @unofficial */ export declare function getFileSystemAdapterConstructor(): ExtractConstructor; /** * Get the {@link obsidian#FileValue} constructor. * * @returns The {@link obsidian#FileValue} constructor. * * @public * @unofficial */ export declare function getFileValueConstructor(): ExtractConstructor; /** * Get the {@link FoldManager} constructor. * * @param app - The app instance. * @returns The {@link FoldManager} constructor. * * @public * @unofficial */ export declare function getFoldManagerConstructor(app: App): ExtractConstructor; /** * Get the {@link FrameDom} constructor. * * @returns The {@link FrameDom} constructor. * * @public * @unofficial */ export declare function getFrameDomConstructor(): ExtractConstructor; /** * Get the {@link obsidian#FuzzySuggestModal} constructor. * * @returns The {@link obsidian#FuzzySuggestModal} constructor. * * @public * @unofficial */ export declare function getFuzzySuggestModalConstructor(): ExtractConstructor>; /** * Get the {@link GraphView} constructor. * * @param app - The app. * @returns The {@link GraphView} constructor. * * @public * @unofficial */ export declare function getGraphViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#HTMLValue} constructor. * * @returns The {@link obsidian#HTMLValue} constructor. * * @public * @unofficial */ export declare function getHTMLValueConstructor(): ExtractConstructor; /** * Get the {@link HotkeyManager} constructor. * * @param app - The app instance. * @returns The {@link HotkeyManager} constructor. * * @public * @unofficial */ export declare function getHotkeyManagerConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#HoverPopover} constructor. * * @returns The {@link obsidian#HoverPopover} constructor. * * @public * @unofficial */ export declare function getHoverPopoverConstructor(): ExtractConstructor; /** * Get the {@link obsidian#IconValue} constructor. * * @returns The {@link obsidian#IconValue} constructor. * * @public * @unofficial */ export declare function getIconValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#ImageValue} constructor. * * @returns The {@link obsidian#ImageValue} constructor. * * @public * @unofficial */ export declare function getImageValueConstructor(): ExtractConstructor; /** * Get the {@link ImageView} constructor. * * @param app - The app. * @returns The {@link ImageView} constructor. * * @public * @unofficial */ export declare function getImageViewConstructor(app: App): ExtractConstructor; /** * Get the {@link InternalPlugin} constructor. * * @param app - The app instance. * @returns The {@link InternalPlugin} constructor. * * @public * @unofficial */ export declare function getInternalPluginConstructor(app: App): ExtractConstructor>; /** * Get the {@link InternalPlugins} constructor. * * @param app - The app instance. * @returns The {@link InternalPlugins} constructor. * * @public * @unofficial */ export declare function getInternalPluginsConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#Keymap} constructor. * * @returns The {@link obsidian#Keymap} constructor. * * @public * @unofficial */ export declare function getKeymapConstructor(): ExtractConstructor; /** * Get the {@link obsidian#LinkValue} constructor. * * @returns The {@link obsidian#LinkValue} constructor. * * @public * @unofficial */ export declare function getLinkValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#ListValue} constructor. * * @returns The {@link obsidian#ListValue} constructor. * * @public * @unofficial */ export declare function getListValueConstructor(): ExtractConstructor; /** * Get the {@link LocalGraphView} constructor. * * @param app - The app. * @returns The {@link LocalGraphView} constructor. * * @public * @unofficial */ export declare function getLocalGraphViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#MarkdownPreviewRenderer} constructor. * * @returns The {@link obsidian#MarkdownPreviewRenderer} constructor. * * @public * @unofficial */ export declare function getMarkdownPreviewRendererConstructor(): ExtractConstructor; /** * Get the {@link obsidian#MarkdownPreviewView} constructor. * * @returns The {@link obsidian#MarkdownPreviewView} constructor. * * @public * @unofficial */ export declare function getMarkdownPreviewViewConstructor(): ExtractConstructor; /** * Get the {@link obsidian#MarkdownRenderChild} constructor. * * @returns The {@link obsidian#MarkdownRenderChild} constructor. * * @public * @unofficial */ export declare function getMarkdownRenderChildConstructor(): ExtractConstructor; /** * Get the {@link obsidian#MarkdownRenderer} constructor. * * @returns The {@link obsidian#MarkdownRenderer} constructor. * * @public * @unofficial */ export declare function getMarkdownRendererConstructor(): ExtractConstructor; /** * Get the {@link obsidian#MarkdownView} constructor. * * @returns The {@link obsidian#MarkdownView} constructor. * * @public * @unofficial */ export declare function getMarkdownViewConstructor(): ExtractConstructor; /** * Get the {@link obsidian#Menu} constructor. * * @returns The {@link obsidian#Menu} constructor. * * @public * @unofficial */ export declare function getMenuConstructor(): ExtractConstructor; /** * Get the {@link obsidian#MenuItem} constructor. * * @returns The {@link obsidian#MenuItem} constructor. * * @public * @unofficial */ export declare function getMenuItemConstructor(): ExtractConstructor; /** * Get the {@link obsidian#MenuSeparator} constructor. * * @returns The {@link obsidian#MenuSeparator} constructor. * * @public * @unofficial */ export declare function getMenuSeparatorConstructor(): ExtractConstructor; /** * Get the {@link obsidian#MetadataCache} constructor. * * @returns The {@link obsidian#MetadataCache} constructor. * * @public * @unofficial */ export declare function getMetadataCacheConstructor(): ExtractConstructor; /** * Get the {@link MetadataTypeManager} constructor. * * @param app - The app instance. * @returns The {@link MetadataTypeManager} constructor. * * @public * @unofficial */ export declare function getMetadataTypeManagerConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#Modal} constructor. * * @returns The {@link obsidian#Modal} constructor. * * @public * @unofficial */ export declare function getModalConstructor(): ExtractConstructor; /** * Get the {@link obsidian#MomentFormatComponent} constructor. * * @returns The {@link obsidian#MomentFormatComponent} constructor. * * @public * @unofficial */ export declare function getMomentFormatComponentConstructor(): ExtractConstructor; /** * Get the {@link obsidian#NotNullValue} constructor. * * @returns The {@link obsidian#NotNullValue} constructor. * * @public * @unofficial */ export declare function getNotNullValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#Notice} constructor. * * @returns The {@link obsidian#Notice} constructor. * * @public * @unofficial */ export declare function getNoticeConstructor(): ExtractConstructor; /** * Get the {@link obsidian#NullValue} constructor. * * @returns The {@link obsidian#NullValue} constructor. * * @public * @unofficial */ export declare function getNullValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#NumberValue} constructor. * * @returns The {@link obsidian#NumberValue} constructor. * * @public * @unofficial */ export declare function getNumberValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#ObjectValue} constructor. * * @returns The {@link obsidian#ObjectValue} constructor. * * @public * @unofficial */ export declare function getObjectValueConstructor(): ExtractConstructor; /** * Get the {@link ObsidianDOM} constructor. * * @param app - The app instance. * @returns The {@link ObsidianDOM} constructor. * * @public * @unofficial */ export declare function getObsidianDOMConstructor(app: App): ExtractConstructor; /** * Get the {@link OutgoingLinkView} constructor. * * @param app - The app. * @returns The {@link OutgoingLinkView} constructor. * * @public * @unofficial */ export declare function getOutgoingLinkViewConstructor(app: App): ExtractConstructor; /** * Get the {@link OutlineView} constructor. * * @param app - The app. * @returns The {@link OutlineView} constructor. * * @public * @unofficial */ export declare function getOutlineViewConstructor(app: App): ExtractConstructor; /** * Get the {@link PdfView} constructor. * * @param app - The app. * @returns The {@link PdfView} constructor. * * @public * @unofficial */ export declare function getPdfViewConstructor(app: App): ExtractConstructor; /** * Get the {@link Plugins} constructor. * * @param app - The app instance. * @returns The {@link Plugins} constructor. * * @public * @unofficial */ export declare function getPluginsConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#ProgressBarComponent} constructor. * * @returns The {@link obsidian#ProgressBarComponent} constructor. * * @public * @unofficial */ export declare function getProgressBarComponentConstructor(): ExtractConstructor; /** * Get the {@link obsidian#QueryController} constructor. * * @returns The {@link obsidian#QueryController} constructor. * * @public * @unofficial */ export declare function getQueryControllerConstructor(): ExtractConstructor; /** * Get the {@link RecentFileTracker} constructor. * * @param app - The app instance. * @returns The {@link RecentFileTracker} constructor. * * @public * @unofficial */ export declare function getRecentFileTrackerConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#RegExpValue} constructor. * * @returns The {@link obsidian#RegExpValue} constructor. * * @public * @unofficial */ export declare function getRegExpValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#RelativeDateValue} constructor. * * @returns The {@link obsidian#RelativeDateValue} constructor. * * @public * @unofficial */ export declare function getRelativeDateValueConstructor(): ExtractConstructor; /** * Get the {@link ReleaseNotesView} constructor. * * @param app - The app. * @returns The {@link ReleaseNotesView} constructor. * * @public * @unofficial */ export declare function getReleaseNotesViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#RenderContext} constructor. * * @returns The {@link obsidian#RenderContext} constructor. * * @public * @unofficial */ export declare function getRenderContextConstructor(): ExtractConstructor; /** * Get the {@link obsidian#Scope} constructor. * * @returns The {@link obsidian#Scope} constructor. * * @public * @unofficial */ export declare function getScopeConstructor(): ExtractConstructor; /** * Get the {@link obsidian#SearchComponent} constructor. * * @returns The {@link obsidian#SearchComponent} constructor. * * @public * @unofficial */ export declare function getSearchComponentConstructor(): ExtractConstructor; /** * Get the {@link SearchView} constructor. * * @param app - The app. * @returns The {@link SearchView} constructor. * * @public * @unofficial */ export declare function getSearchViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#SecretComponent} constructor. * * @returns The {@link obsidian#SecretComponent} constructor. * * @public * @unofficial */ export declare function getSecretComponentConstructor(): ExtractConstructor; /** * Get the {@link obsidian#SecretStorage} constructor. * * @returns The {@link obsidian#SecretStorage} constructor. * * @public * @unofficial */ export declare function getSecretStorageConstructor(): ExtractConstructor; /** * Get the {@link obsidian#Setting} constructor. * * @returns The {@link obsidian#Setting} constructor. * * @public * @unofficial */ export declare function getSettingConstructor(): ExtractConstructor; /** * Get the {@link obsidian#SettingGroup} constructor. * * @returns The {@link obsidian#SettingGroup} constructor. * * @public * @unofficial */ export declare function getSettingGroupConstructor(): ExtractConstructor; /** * Get the {@link obsidian#SettingTab} constructor. * * @returns The {@link obsidian#SettingTab} constructor. * * @public * @unofficial */ export declare function getSettingTabConstructor(): ExtractConstructor; /** * Get the {@link ShareReceiver} constructor. * * @param app - The app instance. * @returns The {@link ShareReceiver} constructor. * * @public * @unofficial */ export declare function getShareReceiverConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#SliderComponent} constructor. * * @returns The {@link obsidian#SliderComponent} constructor. * * @public * @unofficial */ export declare function getSliderComponentConstructor(): ExtractConstructor; /** * Get the {@link StatusBar} constructor. * * @param app - The app instance. * @returns The {@link StatusBar} constructor. * * @public * @unofficial */ export declare function getStatusBarConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#StringValue} constructor. * * @returns The {@link obsidian#StringValue} constructor. * * @public * @unofficial */ export declare function getStringValueConstructor(): ExtractConstructor; /** * Get the {@link SyncView} constructor. * * @param app - The app. * @returns The {@link SyncView} constructor. * * @public * @unofficial */ export declare function getSyncViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#TAbstractFile} constructor. * * @returns The {@link obsidian#TAbstractFile} constructor. * * @public * @unofficial */ export declare function getTAbstractFileConstructor(): ExtractConstructor; /** * Get the {@link obsidian#TFile} constructor. * * @returns The {@link obsidian#TFile} constructor. * * @public * @unofficial */ export declare function getTFileConstructor(): ExtractConstructor; /** * Get the {@link obsidian#TFolder} constructor. * * @returns The {@link obsidian#TFolder} constructor. * * @public * @unofficial */ export declare function getTFolderConstructor(): ExtractConstructor; /** * Get the {@link TableView} constructor. * * @param app - The app. * @returns The {@link TableView} constructor. * * @public * @unofficial */ export declare function getTableViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#TagValue} constructor. * * @returns The {@link obsidian#TagValue} constructor. * * @public * @unofficial */ export declare function getTagValueConstructor(): ExtractConstructor; /** * Get the {@link TagView} constructor. * * @param app - The app. * @returns The {@link TagView} constructor. * * @public * @unofficial */ export declare function getTagViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#Tasks} constructor. * * @returns The {@link obsidian#Tasks} constructor. * @remark Constructor is `null`. See {@link https://forum.obsidian.md/t/api-bug-tasks-class/98993}. * * @public * @unofficial */ export declare function getTasksConstructor(): ConstructorBase<[ ], Tasks>; /** * Get the {@link obsidian#TextAreaComponent} constructor. * * @returns The {@link obsidian#TextAreaComponent} constructor. * * @public * @unofficial */ export declare function getTextAreaComponentConstructor(): ExtractConstructor; /** * Get the {@link obsidian#TextComponent} constructor. * * @returns The {@link obsidian#TextComponent} constructor. * * @public * @unofficial */ export declare function getTextComponentConstructor(): ExtractConstructor; /** * Get the {@link obsidian#ToggleComponent} constructor. * * @returns The {@link obsidian#ToggleComponent} constructor. * * @public * @unofficial */ export declare function getToggleComponentConstructor(): ExtractConstructor; /** * Get the {@link obsidian#UrlValue} constructor. * * @returns The {@link obsidian#UrlValue} constructor. * * @public * @unofficial */ export declare function getUrlValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#ValueComponent} constructor. * * @returns The {@link obsidian#ValueComponent} constructor. * * @public * @unofficial */ export declare function getValueComponentConstructor(): ExtractConstructor>; /** * Get the {@link obsidian#Value} constructor. * * @returns The {@link obsidian#Value} constructor. * * @public * @unofficial */ export declare function getValueConstructor(): ExtractConstructor; /** * Get the {@link obsidian#Vault} constructor. * * @returns The {@link obsidian#Vault} constructor. * * @public * @unofficial */ export declare function getVaultConstructor(): ExtractConstructor; /** * Get the {@link VideoView} constructor. * * @param app - The app. * @returns The {@link VideoView} constructor. * * @public * @unofficial */ export declare function getVideoViewConstructor(app: App): ExtractConstructor; /** * 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(app: App, viewType: TViewType): ExtractConstructor; /** * Get the {@link ViewRegistry} constructor. * * @param app - The app instance. * @returns The {@link ViewRegistry} constructor. * * @public * @unofficial */ export declare function getViewRegistryConstructor(app: App): ExtractConstructor; /** * Get the {@link WebviewerHistoryView} constructor. * * @param app - The app. * @returns The {@link WebviewerHistoryView} constructor. * * @public * @unofficial */ export declare function getWebviewerHistoryViewConstructor(app: App): ExtractConstructor; /** * Get the {@link WebviewerView} constructor. * * @param app - The app. * @returns The {@link WebviewerView} constructor. * * @public * @unofficial */ export declare function getWebviewerViewConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#Workspace} constructor. * * @returns The {@link obsidian#Workspace} constructor. * * @public * @unofficial */ export declare function getWorkspaceConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceContainer} constructor. * * @returns The {@link obsidian#WorkspaceContainer} constructor. * * @public * @unofficial */ export declare function getWorkspaceContainerConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceFloating} constructor. * * @returns The {@link obsidian#WorkspaceFloating} constructor. * * @public * @unofficial */ export declare function getWorkspaceFloatingConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceItem} constructor. * * @returns The {@link obsidian#WorkspaceItem} constructor. * * @public * @unofficial */ export declare function getWorkspaceItemConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceLeaf} constructor. * * @returns The {@link obsidian#WorkspaceLeaf} constructor. * * @public * @unofficial */ export declare function getWorkspaceLeafConstructor(): ExtractConstructor; /** * Get the {@link WorkspaceLeafHistory} constructor. * * @param app - The app instance. * @returns The {@link WorkspaceLeafHistory} constructor. * * @public * @unofficial */ export declare function getWorkspaceLeafHistoryConstructor(app: App): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceMobileDrawer} constructor. * * @returns The {@link obsidian#WorkspaceMobileDrawer} constructor. * @remark Constructor is `null`. See {@link https://forum.obsidian.md/t/api-bug-tasks-class/98993}. * * @public * @unofficial */ export declare function getWorkspaceMobileDrawerConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceParent} constructor. * * @returns The {@link obsidian#WorkspaceParent} constructor. * * @public * @unofficial */ export declare function getWorkspaceParentConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceRibbon} constructor. * * @returns The {@link obsidian#WorkspaceRibbon} constructor. * * @public * @unofficial */ export declare function getWorkspaceRibbonConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceRoot} constructor. * * @returns The {@link obsidian#WorkspaceRoot} constructor. * * @public * @unofficial */ export declare function getWorkspaceRootConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceSidedock} constructor. * * @returns The {@link obsidian#WorkspaceSidedock} constructor. * * @public * @unofficial */ export declare function getWorkspaceSidedockConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceSplit} constructor. * * @returns The {@link obsidian#WorkspaceSplit} constructor. * * @public * @unofficial */ export declare function getWorkspaceSplitConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceTabs} constructor. * * @returns The {@link obsidian#WorkspaceTabs} constructor. * * @public * @unofficial */ export declare function getWorkspaceTabsConstructor(): ExtractConstructor; /** * Get the {@link obsidian#WorkspaceWindow} constructor. * * @returns The {@link obsidian#WorkspaceWindow} constructor. * * @public * @unofficial */ export declare function getWorkspaceWindowConstructor(): ExtractConstructor; /** * Highlights a string of code using the given grammar. * * @param text - The code string to highlight. * @param grammar - The grammar to use for tokenization. * @param language - The language identifier. * @returns The highlighted HTML string. * @public * @unofficial */ export declare function highlight(text: string, grammar: Grammar, language: string): string; /** * Highlights all code elements on the page. * * @param async - Whether to use web workers for highlighting. * @param callback - Callback invoked after each element is highlighted. * @public * @unofficial */ export declare function highlightAll(async?: boolean, callback?: HighlightCallback): void; /** * Highlights all code elements under a given container. * * @param container - The parent node to search within. * @param async - Whether to use web workers for highlighting. * @param callback - Callback invoked after each element is highlighted. * @public * @unofficial */ export declare function highlightAllUnder(container: ParentNode, async?: boolean, callback?: HighlightCallback): void; /** * Highlights a single code element. * * @param element - The element to highlight. * @param async - Whether to use web workers for highlighting. * @param callback - Callback invoked after the element is highlighted. * @public * @unofficial */ export declare function highlightElement(element: Element, async?: boolean, callback?: HighlightCallback): void; /** * 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; /** * Checks whether a character is a word character. * * @param ch - The character to check. * @returns `true` if the character is a word character. * @public * @unofficial */ export declare function isWordChar(ch: string): boolean; /** * 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; /** * 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; /** * 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; /** * Normalizes a key map, expanding multi-stroke key bindings. * * @param keymap - The key map to normalize. * @returns The normalized key map. * @public * @unofficial */ export declare function normalizeKeyMap(keymap: Cm5KeyMap): Cm5KeyMap; /** * Removes an event handler from the given target. * * @param target - The target object. * @param type - The event type. * @param f - The event handler to remove. * @public * @unofficial */ export declare function off(target: unknown, type: string, f: (...args: unknown[]) => void): void; /** * Registers an event handler on the given target. * * @param target - The target object. * @param type - The event type. * @param f - The event handler. * @public * @unofficial */ export declare function on(target: unknown, type: string, f: (...args: unknown[]) => void): void; /** * 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; /** * Registers a global helper with a predicate. * * @param type - The helper type. * @param name - The helper name. * @param predicate - A predicate function to determine applicability. * @param value - The helper implementation. * @public * @unofficial */ export declare function registerGlobalHelper(type: string, name: string, predicate: (mode: Cm5Mode, cm: Cm5Editor) => boolean, value: unknown): void; /** * Registers a helper value for a specific type. * * @param type - The helper type. * @param name - The helper name. * @param value - The helper implementation. * @public * @unofficial */ export declare function registerHelper(type: string, name: string, value: unknown): void; /** * Derive a key using the scrypt key derivation function. * * @param password - The password to derive from. * @param salt - The salt value. * @param N - CPU/memory cost parameter. * @param r - Block size parameter. * @param p - Parallelization parameter. * @param dkLen - Desired key length in bytes. * @param callback - Optional progress callback. * @returns A promise that resolves to the derived key. * @public * @unofficial */ export declare function scrypt(password: ArrayLike, salt: ArrayLike, N: number, r: number, p: number, dkLen: number, callback?: ProgressCallback): Promise; /** * Fires a signal (event) on the given target. * * @param target - The target object. * @param name - The signal name. * @param args - Additional arguments to pass to handlers. * @public * @unofficial */ export declare function signal(target: unknown, name: string, ...args: unknown[]): void; /** * Tokenizes a string of code using the given grammar. * * @param text - The code string to tokenize. * @param grammar - The grammar to use for tokenization. * @returns An array of strings and tokens. * @public * @unofficial */ export declare function tokenize(text: string, grammar: Grammar): Array; /** * Whether to disable the default Prism worker message handler. * * @public * @unofficial */ // eslint-disable-next-line import-x/no-mutable-exports -- Prism configuration flag that is meant to be set by users. export declare let disableWorkerMessageHandler: boolean | undefined; /** * Whether Prism should skip automatic highlighting on page load. * * @public * @unofficial */ // eslint-disable-next-line import-x/no-mutable-exports -- Prism configuration flag that is meant to be set by users. export declare let manual: boolean | undefined; /** * Function `Abs`. * * @public * @unofficial */ export interface AbsFunction extends BasesFunction, HasGetDisplayName { } /** * Base interface for file and folder tree items in the file explorer. * * @typeParam T - The type of the abstract file. * @public * @unofficial */ export interface AbstractFileTreeItem extends TreeItem { /** * Associated file with this item. */ file: T; /** * {@link Tree} node metadata and layout information. */ info: TreeNodeInfo; /** * Parent tree item (folder or tree root). */ parent: FileTreeItemParent; /** * Whether this item has been rendered to the DOM. */ rendered: boolean; /** * Reference to the file explorer view containing this item. */ view: FileExplorerView; /** * Get the display title for this tree item. * * @returns The display title. */ getTitle(): string; /** * Whether the full timestamp is shown for this item. * * @returns Whether the full timestamp is shown. */ isFullTimeShown(): boolean; /** * Called when this item is rendered to the DOM. */ onRender(): void; /** * Begin inline renaming of this tree item. */ startRename(): void; /** * Cancel inline renaming of this tree item. */ stopRename(): void; /** * Refresh the displayed title of this tree item. */ updateTitle(): void; } /** * Base interface for search components providing find-and-replace UI. * * @public * @unofficial */ export interface AbstractSearchComponent { /** * Reference to the app. */ app: App; /** * The container element in which the search component exists (i.e. {@link obsidian#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. * * @returns The current search query string. */ getQuery(): string; /** * Switch to the next inputElement. * * @param event - The keyboard event that triggered the input switch. * @returns The result of switching to the next input. */ goToNextInput(event: KeyboardEvent): unknown; /** * Invokes findNextOrReplace. * * @param event - The keyboard event that triggered the action. * @returns The result of the enter action. */ onEnter(event: KeyboardEvent): unknown; /** * Invokes findPrevious. * * @param event - The keyboard event that triggered the action. * @returns The result of the shift-enter action. */ onShiftEnter(event: KeyboardEvent): unknown; } /** * Represents the user's Obsidian account information and license details. * * @public * @unofficial */ export interface Account { /** * The company associated with the activated commercial license. */ company: string; /** * The email address associated with the account. */ email: string; /** * Unix timestamp of the license expiry date. */ expiry: number; /** * License key string. */ key: string | undefined; /** * Validation status or hash for the license key. */ keyValidation: string; /** * The license available to the account. */ license: "" | "insider"; /** * Profile name. */ name: string; /** * Number of seats available on the commercial license. */ seats: number; /** * Authentication token for the account. */ token: string; } /** * Options for adding a search overlay to the editor. * * @public * @unofficial */ export interface AddOverlayOptions { /** * Regular expression pattern to highlight in the editor. */ query: RegExp; } /** * Options for adding a single resource entry. * * @public * @unofficial */ export interface AddResourceOptions { /** Custom key separator. */ keySeparator?: string; /** Whether to suppress events. */ silent?: boolean; } /** * 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. */ onFocus(): void; /** * Set the value of the property widget. * * @param value - The value to set. */ setValue(value: unknown): void; } /** * {@link obsidian#View} that displays all properties (frontmatter keys) across the vault. * * @public * @unofficial */ export interface AllPropertiesView extends ItemView { /** * Try to rename the file. * * @returns A promise that resolves when the rename is complete. */ acceptRename(): Promise; /** * Cancels the rename. */ cancelRename(): void; /** * Quits the rename. */ exitRename(): void; /** * Get the current view type. * * @returns The all properties view type. */ getViewType(): typeof ViewType.AllProperties; /** * Check whether the given object is a property item. * * @param e - The object to check. * @returns Whether the object is a property item. */ 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; /** * Set the visibility of the search filter. * * @param e - Whether to show the search filter. */ 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; /** * Begin inline renaming of a property. * * @param e - The property item to rename. * @returns The result of the rename operation. */ startRename(e: unknown): Promise; /** * Refresh the properties list. */ update(): void; /** * Updates the search. */ updateSearch(): void; } /** * Manager for the application menu bar (native desktop menu). * * @public * @unofficial */ export interface AppMenuBarManager { /** * Reference to the app. */ app: App; /** * Constructor reference for the menu bar manager. */ constructor: ExtractConstructor; /** * Debounced handler for file open events. */ onFileOpen: Debouncer<[ ], unknown>; /** * Debounced handler for window frame changes. */ onWindowFrameChange: Debouncer<[ ], unknown>; /** * Debounced function to re-render the menu bar. */ requestRender: Debouncer<[ ], unknown>; /** * Internal handler for file open events. */ _onFileOpen(): void; /** * Apply hotkey accelerators to menu items. * * @returns The result of applying hotkeys. * To get the constructor instance, use {@link getAppMenuBarManagerConstructor} from `obsidian-typings/implementations`. */ applyHotkeys(arg1: unknown): unknown; /** * Build the native menu bar structure. * * @returns The built menu structure. */ buildMenu(): unknown; /** * Constructor. * * To get the constructor instance, use {@link getAppMenuBarManagerConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App): this; /** * Convert a hotkey binding to a native accelerator string. * * @returns The native accelerator string. */ getAcceleratorFromHotkey(arg1: unknown): unknown; /** * Hide menu items for commands that are not registered. * * @returns The result of hiding unregistered commands. */ hideUnregisteredCommands(arg1: unknown): unknown; /** * Render the menu bar. * * @returns The result of the render operation. */ render(): unknown; /** * Update the share menu item state. */ updateShareMenuItem(): void; /** * Update the menu bar based on the current view state. * * @returns The result of updating the view state. */ updateViewState(): unknown; /** * Update the menu bar based on workspace changes. * * @returns The result of updating the workspace. */ updateWorkspace(): unknown; } /** * The settings modal for the application, managing core and plugin setting tabs. * * @public * @unofficial */ export interface AppSetting extends Modal { /** * Current active tab of the settings modal. */ activeTab: null | SettingTab; /** * 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; /** * Feedback banner element. */ feedbackBanner: unknown; /** * 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; /** * Constructor. * * To get the constructor instance, use {@link getAppSettingConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App): this; /** * Check whether tab is a plugin tab. * * @param tab - Tab to check. * @returns Whether the tab is a plugin setting tab. */ isPluginSettingTab(tab: SettingTab): boolean; /** * Open a specific tab by tab reference. * * @param tab - Tab to open. */ openTab(tab: SettingTab): void; /** * Open the hotkeys setting tab by ID. * * @param id - The hotkeys tab ID. * @returns The hotkeys setting tab. */ openTabById(id: "hotkeys"): HotkeysSettingTab; /** * Open a specific tab by ID. * * @param id - ID of the tab to open. * @returns The opened setting tab. */ 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; } /** * Vault-level configuration settings stored in the `.obsidian` config folder. * * @public * @unofficial */ export interface AppVaultConfig { /** * Appearance > Accent color. */ accentColor: "" | string; /** * Files & Links > Automatically update internal links. */ alwaysUpdateLinks?: boolean | false; /** * Files & Links > Attachment folder path. */ attachmentFolderPath?: "/" | string; /** * Editor > Auto convert HTML. */ autoConvertHtml?: boolean | true; /** * Editor > Auto pair brackets. */ autoPairBrackets?: boolean | true; /** * Editor > Auto pair Markdown syntax. */ autoPairMarkdown?: boolean | true; /** * Appearance > Font size. */ baseFontSize?: 16 | number; /** * Appearance > Quick font size adjustment. */ baseFontSizeAction?: boolean | true; /** * Community Plugins > Browse > Sort order. */ communityPluginSortOrder: "alphabetical" | "download" | "release" | "update"; /** * Themes > Browse > Sort order. */ communityThemeSortOrder: "alphabetical" | "download" | "release" | "update"; /** * Appearance > Theme. * * @remark is the default Obsidian theme. */ cssTheme?: "" | string; /** * Editor > Default view for new tabs. */ defaultViewMode?: "preview" | "source"; /** * Whether Emacs-style keybindings are enabled. */ emacsyKeys?: boolean | true; /** * Appearance > CSS snippets. */ enabledCssSnippets?: string[]; /** * Sort order for files in the file explorer. */ fileSortOrder?: "alphabetical"; /** * Editor > Always focus new tabs. */ focusNewTab?: boolean | true; /** * Editor > Fold heading. */ foldHeading?: boolean | true; /** * Editor > Fold indent. */ foldIndent?: boolean | true; /** * Hotkeys. * * @deprecated Likely not used anymore. */ hotkeys?: AppVaultConfigHotkeysRecord; /** * Appearance > Interface font. */ interfaceFontFamily?: "" | string; /** * Editor > Use legacy editor. */ legacyEditor?: boolean | false; /** * Whether live preview mode is enabled in the editor. */ livePreview?: boolean | true; /** * Mobile > Configure mobile Quick Action. */ mobilePullAction?: "command-palette:open" | string; /** * Command ID for the mobile quick ribbon action item. */ mobileQuickRibbonItem?: "" | string; /** * Mobile > Manage toolbar options. */ mobileToolbarCommands?: string[]; /** * Appearance > Monospace font. */ monospaceFontFamily?: "" | string; /** * Appearance > Native menus. */ nativeMenus?: boolean | null; /** * Files & Links > Default location for new notes | 'folder' > Folder to create new notes in. */ newFileFolderPath?: "/" | string; /** * Files & Links > Default location for new notes. */ newFileLocation?: "current" | "folder" | "root"; /** * Files & Links > New link format. */ newLinkFormat?: "absolute" | "relative" | "shortest"; /** * Saved on executing 'Export to PDF' command. */ pdfExportSettings?: PdfExportSettings; /** * Files & Links > Confirm line deletion. */ promptDelete?: boolean | true; /** * Editor > Properties in document. */ propertiesInDocument?: "hidden" | "source" | "visible"; /** * Editor > Readable line length. */ readableLineLength?: boolean | true; /** * Editor > Right-to-left (RTL). */ rightToLeft?: boolean | false; /** * Editor > Show indentation guides. */ showIndentGuide?: boolean | true; /** * Editor > Show inline title. */ showInlineTitle?: boolean | true; /** * Editor > Show line numbers. */ showLineNumber?: boolean | false; /** * Appearance > Show ribbon. */ showRibbon?: boolean | true; /** * Files & Links > Detect all file extensions. */ showUnsupportedFiles?: boolean | false; /** * Appearance > Show tab title bar. */ showViewHeader?: boolean | false; /** * Editor > Smart indent lists. */ smartIndentList?: boolean | true; /** * Editor > Spellcheck. */ spellcheck?: boolean | false; /** * Editor > Spellcheck languages. */ spellcheckLanguages?: null | string[]; /** * Editor > Strict line breaks. */ strictLineBreaks?: boolean | false; /** * 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?: boolean | false; /** * Files & Links > Deleted files. */ trashOption?: "local" | "none" | "system"; /** * Left-over storage for old properties types. * * @deprecated Probably left-over code from old properties type storage */ types: object; /** * Files & Links > Use [[Wikilinks]]. */ useMarkdownLinks?: boolean | false; /** * Files & Links > Excluded files. */ userIgnoreFilters?: null | string[]; /** * Editor > Indent using tabs. */ useTab?: boolean | true; /** * Editor > Vim key bindings. */ vimMode?: boolean | false; } /** * Record mapping hotkey identifiers to their string representations in vault config. * * @public * @unofficial */ export interface AppVaultConfigHotkeysRecord extends Record { } /** * Internal plugin registration for the audio recorder feature. * * @public * @unofficial */ export interface AudioRecorderPlugin extends InternalPlugin { } /** * Plugin instance for the audio recorder, providing methods to record and save audio clips. * * @public * @unofficial */ export interface AudioRecorderPluginInstance extends InternalPluginInstance { /** * Reference to the app. */ app: App; /** * File extension used for saved audio recordings. */ extension: string; /** * Reference to the audio recorder plugin registration. */ plugin: AudioRecorderPlugin; /** * Active MediaRecorder instance, or `null` when not recording. */ recorder: MediaRecorder | null; /** * Whether audio is currently being recorded. */ recording: boolean; /** * Check if the user has granted microphone permission. * * @returns Whether microphone permission is granted. */ checkPermission(): Promise; /** * Initiate the audio recording flow. * * @returns A promise that resolves when the recording flow completes. */ onRecordAudio(): Promise; /** * Start a new audio recording session. * * @returns A promise that resolves when recording has started. */ onStartRecording(): Promise; /** * Stop the current audio recording session. */ onStopRecording(): void; /** * Save the recorded audio buffer to a file in the vault. * * @param audioBuffer - The recorded audio data. * @returns A promise that resolves when the recording is saved. */ saveRecording(audioBuffer: ArrayBuffer): Promise; /** * Display a recording status message or error to the user. * * @param message - The message to display. * @param isError - Whether the message is an error. */ showRecordingMessage(message: string, isError: boolean): void; /** * Begin recording audio from the given media stream. * * @param stream - The media stream to record from. */ startRecording(stream: MediaStream): void; } /** * View for rendering and playing audio files. * * @public * @unofficial */ export interface AudioView extends EditableFileView { /** * Get the current view type. * * @returns The view type identifier. */ getViewType(): typeof ViewType.Audio; } /** * Axis-aligned bounding box. * * @public * @unofficial */ export interface BBox { /** * Maximum x coordinate (right edge). */ maxX: number; /** * Maximum y coordinate (bottom edge). */ maxY: number; /** * Minimum x coordinate (left edge). */ minX: number; /** * Minimum y coordinate (top edge). */ minY: number; } /** * Main UI component that renders backlinks and unlinked mentions for a file. * * @public * @unofficial */ export interface BacklinkComponent extends Component { /** * Reference to the app. */ app: App; /** * Whether the backlink section is collapsed. */ backlinkCollapsed: boolean; /** * Element displaying the count of backlinks. */ backlinkCountEl: HTMLSpanElement; /** * DOM tree rendering backlink search results. */ backlinkDom: ResultDom; /** * File for which backlinks are currently displayed. */ backlinkFile: null | TFile; /** * Header element for the backlinks section. */ backlinkHeaderEl: HTMLDivElement; /** * Queue of files to process for backlink computation. */ backlinkQueue: ItemQueue | null; /** * Whether all result items are collapsed. */ collapseAll: boolean; /** * Button element to toggle collapse all results. */ collapseAllButtonEl: HTMLDivElement; /** * Whether extra context lines are shown around matches. */ extraContext: boolean; /** * Button element to toggle extra context display. */ extraContextButtonEl: HTMLDivElement; /** * The file whose backlinks are being shown. */ file: null | TFile; /** * Header DOM for navigation buttons and sort controls. */ headerDom: HeaderDom; /** * Whether the search filter is currently visible. */ isShowingSearch: boolean; /** * Search input component for filtering results. */ searchComponent: SearchComponent; /** * Current search query string. */ searchQuery: null; /** * Button element to toggle the search filter visibility. */ showSearchButtonEl: HTMLDivElement; /** * Current sort order for results. */ sortOrder: string; /** * Placement direction for tooltips. */ tooltipPlacement: string; /** * Comma-separated aliases used for unlinked mention matching. */ unlinkedAliases: string; /** * Whether the unlinked mentions section is collapsed. */ unlinkedCollapsed: boolean; /** * Element displaying the count of unlinked mentions. */ unlinkedCountEl: HTMLSpanElement; /** * DOM tree rendering unlinked mention search results. */ unlinkedDom: ResultDom; /** * File for which unlinked mentions are being computed. */ unlinkedFile: null; /** * Header element for the unlinked mentions section. */ unlinkedHeaderEl: HTMLDivElement; /** * Queue of files to process for unlinked mention computation. */ unlinkedQueue: null; /** * Add a link from an unlinked mention to the target file. * * @returns The result of adding the link. */ addLinkFunction(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Get the current state of the backlink component. * * @returns The current state. */ getState(): unknown; /** * Handle a file content change event. * * @returns The handler result. */ onFileChanged(arg1: unknown): unknown; /** * Handle a file deletion event. * * @returns The handler result. */ onFileDeleted(arg1: unknown): unknown; /** * Handle a file rename event. * * @returns The handler result. */ onFileRename(arg1: unknown): unknown; /** * Lifecycle hook called when the component is loaded. * * @returns The load result. */ onload(): unknown; /** * Handle a metadata cache change event. * * @returns The handler result. */ onMetadataChanged(arg1: unknown): unknown; /** * Handle the component being resized. * * @returns The handler result. */ onResize(): unknown; /** * Handle the collapse all toggle button click. * * @returns The handler result. */ onToggleCollapseClick(): unknown; /** * Handle the extra context toggle button click. * * @returns The handler result. */ onToggleMoreContextClick(): unknown; /** * Handle the show search toggle button click. * * @returns The handler result. */ onToggleShowSearch(): unknown; /** * Check if a result passes the current search filter. * * @returns Whether the result passes the filter. */ passSearchFilter(arg1: unknown, arg2: unknown): unknown; /** * Recompute backlinks for the given file. * * @param backlinkFile - The file to recompute backlinks for, or `null`. */ recomputeBacklink(backlinkFile: null | TFile): void; /** * Recompute unlinked mentions for the current file. * * @returns The recomputation result. */ recomputeUnlinked(arg1: unknown): unknown; /** * Set whether the backlink section is collapsed. * * @returns The result of setting backlink collapsed state. */ setBacklinkCollapsed(arg1: unknown, arg2: unknown): Promise; /** * Set whether all results are collapsed. * * @returns The result of setting collapse state. */ setCollapseAll(arg1: unknown): unknown; /** * Set whether extra context lines are shown. * * @returns The result of setting extra context. */ setExtraContext(arg1: unknown): unknown; /** * Set the collapsed state of a specific section. * * @returns The result of setting the section collapsed state. */ setSectionCollapsed(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): Promise; /** * Set the visibility of the search filter. * * @returns The result of toggling search visibility. */ setShowSearch(arg1: unknown): unknown; /** * Set the sort order for results. * * @returns The result of setting sort order. */ setSortOrder(arg1: unknown): unknown; /** * Restore the component from a saved state. * * @returns The result of restoring the state. */ setState(arg1: unknown): Promise; /** * Set whether the unlinked mentions section is collapsed. * * @returns The result of setting unlinked collapsed state. */ setUnlinkedCollapsed(arg1: unknown, arg2: unknown): Promise; /** * Cancel the current backlink search computation. */ stopBacklinkSearch(): void; /** * Cancel the current unlinked mentions search computation. * * @returns The cancellation result. */ stopUnlinkedSearch(): unknown; /** * Toggle the collapsed state of the backlinks section. * * @returns The toggle result. */ toggleBacklinkCollapsed(): unknown; /** * Toggle the collapsed state of the unlinked mentions section. * * @returns The toggle result. */ toggleUnlinkedCollapsed(): unknown; /** * Refresh both backlink and unlinked mention results. * * @returns The update result. */ update(): unknown; /** * Update the tooltip text of a section header. * * @returns The result of updating the header tooltip. */ updateHeaderTooltip(arg1: unknown, arg2: unknown): unknown; /** * Refresh the search filter and recompute filtered results. * * @returns The update result. */ updateSearch(): unknown; } /** * Internal plugin registration for the backlinks feature. * * @public * @unofficial */ export interface BacklinkPlugin extends InternalPlugin { /** * View creators registered by the backlink plugin. */ views: BacklinkPluginViews; } /** * Plugin instance for backlinks, managing backlink view lifecycle and file event handling. * * @public * @unofficial */ export interface BacklinkPluginInstance extends InternalPluginInstance { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * The currently tracked file for backlinks. */ file?: null | TFile; /** * Configuration options for the backlink plugin. */ options: BacklinkPluginInstanceOptions; /** * Reference to the backlink plugin registration. */ plugin: BacklinkPlugin; /** * Initialize the backlink view leaf. */ initLeaf(): void; /** * Called when the plugin is enabled. * * @param app - The app instance. * @param plugin - The backlink plugin registration. * @returns A promise that resolves when the plugin is enabled. */ onEnable(app: App, plugin: BacklinkPlugin): Promise; /** * Handle external settings file changes and reload configuration. * * @returns A promise that resolves when the settings are reloaded. */ onExternalSettingsChange(): Promise; /** * Add backlink-related items to a file context menu. * * @param menu - The context menu to extend. * @param file - The target file or folder. * @param source - The source of the context menu event. * @param leaf - Optional workspace leaf context. */ onFileMenu(menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf): void; /** * Handle a file being opened and update backlink tracking. * * @param file - The opened file. */ onFileOpen(file: TAbstractFile): void; /** * Called when the user disables the plugin. * * @param app - The app instance. */ onUserDisable(app: App): void; /** * Called when the user enables the plugin. */ onUserEnable(): void; /** * Open the backlinks pane for the currently active file. * * @param skipSplit - Whether to skip splitting the pane. * @returns Whether the operation succeeded, or `undefined`. */ openBacklinksForActiveFile(skipSplit: boolean): boolean | undefined; /** * Toggle the inline backlinks display within the document view. * * @param skip - Whether to skip the toggle action. * @returns Whether the operation succeeded, or `undefined`. */ toggleBacklinksInDocument(skip: boolean): boolean | undefined; /** * Refresh the backlink results for the current file. */ updateBacklinks(): void; } /** * Configuration options for the backlink plugin instance. * * @public * @unofficial */ export interface BacklinkPluginInstanceOptions { /** * Whether to show backlinks inline within the document view. */ backlinkInDocument?: boolean; } /** * View creators registered by the backlink plugin. * * @public * @unofficial */ export interface BacklinkPluginViews extends Record { /** * Create a backlink view in the given workspace leaf. * * @param left - The workspace leaf to create the view in. * @returns The created backlink view. */ backlink(left: WorkspaceLeaf): BacklinkView; } /** * {@link obsidian#View} that displays backlinks to the current file. * * @public * @unofficial */ export interface BacklinkView extends InfoFileView { /** * The backlink component rendering linked and unlinked mentions. */ backlink: BacklinkComponent; /** * Get the current view type. * * @returns The backlink view type. */ getViewType(): typeof ViewType.Backlink; /** * Shows the search. */ showSearch(): void; /** * Refresh the backlink results. */ update(): void; } /** * {@link obsidian#BasesConfigFileFilter} `and` clause. * * @public * @unofficial */ export interface BasesConfigFileFilterAndClause { /** * All of the following filters must match. * * @example * ```ts * { * and: [ * '*.md', * '*.txt', * ], * } * ``` * @public * @since 1.10.0 */ and: BasesConfigFileFilter[]; } /** * {@link obsidian#BasesConfigFileFilter} `not` clause. * * @public * @unofficial */ export interface BasesConfigFileFilterNotClause { /** * None of the following filters should match. * * @example * ```ts * { * not: [ * '*.md', * '*.txt', * ], * } * ``` * @public * @since 1.10.0 */ not: BasesConfigFileFilter[]; } /** * {@link obsidian#BasesConfigFileFilter} `or` clause. * * @public * @unofficial */ export interface BasesConfigFileFilterOrClause { /** * Some of the following filters should match. * * @example * ```ts * { * or: [ * '*.md', * '*.txt', * ], * } * ``` * @public * @since 1.10.0 */ or: BasesConfigFileFilter[]; } /** * Configuration for grouping the results of a Bases config file view. * * @public * @unofficial */ export interface BasesConfigFileViewGroupBy { } /** * Bases context * * @public * @unofficial */ export interface BasesContext extends Component { /** * Local context. */ _local: BasesLocal; /** * Constructor. * * @param app - The app instance. * @param filter - The filters. * @param formulas - The formulas. * @param file - The file. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor2__?(app: App, filter: Record, formulas: Record, file: null | TFile): this; } /** * Bases control. * * @public * @unofficial */ export interface BasesControl { /** * Render to. * * @param containerEl - The container element. * @param renderContext - The render context. */ 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: null | TFile; /** * The current error. */ error: null | string; /** * The error element. */ errorEl: HTMLDivElement; /** * The errors. */ errors: Set; /** * 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; /** * The request to notify the view. */ requestNotifyView: Debouncer<[ ], void>; /** * The results. */ results: Map; /** * 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; /** * The view header element. */ viewHeaderEl: HTMLDivElement; /** * The view menu. */ viewMenu: BasesViewMenu; /** * The view name. */ viewName: string; /** * Adds a result to the results. * * @param result - The result to add. * @returns The add result. */ addResult(result: unknown, arg2: unknown): unknown; /** * Builds the bases context. * * @param filter - The filter to apply. * @returns The constructed bases context. */ buildBasesContext(filter: BasesFilter): BasesContext; /** * Clears the view controller. */ clear(): void; /** * Clears the error. */ clearError(): void; /** * Displays an error. * * @param error - The error message to display. */ displayError(error: string, arg2: unknown): void; /** * Evaluates the relevant properties. * * @param relevantProperties - The property names to evaluate. */ evaluateRelevantProperties(relevantProperties: string[]): void; /** * Gets the active bases view of a given type. * * @param viewType - The view type to search for. * @returns The active view of the given type, or `null`. */ getActiveBasesViewOfType(viewType: string): null | View; /** * Gets the current file. * * @returns The current file, or `null`. */ getCurrentFile(): null | TFile; /** * Gets the editor language support. * * @returns The editor language support instance. */ getEditorLanguageSupport(): EditorLanguageSupport; /** * Gets the mock value. * * @returns The mock value. */ getMockValue(arg1: unknown): unknown; /** * Gets the mock value for an ident. * * @returns The mock value for the identifier. */ getMockValueForIdent(arg1: unknown): unknown; /** * Gets the properties. * * @returns The list of properties. */ getProperties(): unknown[]; /** * Gets the query view names. * * @returns The list of query view names. */ getQueryViewNames(): string[]; /** * Gets the view config. * * @returns The view configuration. */ getViewConfig(): unknown; /** * Gets the widget for an ident. * * @param type - The identifier type. * @returns The widget type string. */ getWidgetForIdent(type: string): string; /** * Notifies the view. */ notifyView(): void; /** * On config changed. * * @param configKey - The changed configuration key. */ onConfigChanged(configKey: string): void; /** * On resize. */ onResize(): void; /** * Prompt for add view. */ promptForAddView(): void; /** * Removes a result. * * @returns The removal result. */ removeResult(arg1: unknown): unknown; /** * Runs a query. */ runQuery(arg1: unknown): void; /** * Selects a view. * * @param viewName - The name of the view to select. */ selectView(viewName: string): void; /** * Sets the query. * * @param queryOrError - The query or error to set. */ setQuery(queryOrError: BasesQuery | Error): void; /** * Sets the query and view. * * @param queryOrError - The query or error to set. * @param viewName - The name of the view to select. */ 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. * * @param file - The file to set as current. */ 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. * * @param args - The arguments to apply. * @returns The result of applying the function. */ apply(...args: unknown[]): unknown; /** * Serializes the function. * * @param args - The arguments to serialize. * @returns The serialized function string. */ serialize(...args: unknown[]): string; } /** * Bases function argument. * * @public * @unofficial */ export interface BasesFunctionArg { /** * Whether to include custom types. */ includeCustomTypes?: 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 { /** * The table view factory. */ table: ViewFactory; } /** * Bases link. * * @public * @unofficial */ export interface BasesLink extends BasesControl { /** * The link. */ link: string; /** * Constructor. * * @param app - The app instance. * @param linkText - The link text. * @param sourcePath - The source path. * @param displayText - The display text. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App, linkText: string, sourcePath: string, displayText: string): this; } /** * Bases link constructor. * * Extends {@link ExtractConstructor} with a static `parseFromString` method. * * @public * @unofficial */ export interface BasesLinkConstructor extends ExtractConstructor { /** * 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; /** * 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; /** * Get control. * * @param key - The key. * @returns The control. */ get(key: string): BasesControl; } /** * Bases plugin. * * @public * @unofficial */ export interface BasesPlugin extends InternalPlugin { } /** * Bases plugin instance. * * @public * @unofficial */ export interface BasesPluginInstance extends InternalPluginInstance { /** * 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. * * @param editor - The editor to embed the base into. * @returns A promise that resolves when the base is created and embedded. */ createAndEmbedBase(editor: Editor): Promise; /** * Creates a new bases file. * * @param location - Optional folder location for the new file. * @param filename - Optional filename for the new file. * @param contents - Optional initial contents. * @returns The created file. */ createNewBasesFile(location?: TFolder, filename?: string, contents?: string): Promise; /** * Deregisters a function. * * @param name - The name of the function to deregister. */ deregisterFunction(name: string): void; /** * Deregisters a view. * * @param type - The view type to deregister. */ deregisterView(type: string): void; /** * Gets a function. * * @param name - The name of the function to get. * @returns The function, or `null` if not found. */ getFunction(name: string): BasesFunction | null; /** * Gets the operator functions. * * @returns The list of operator functions. */ getOperatorFunctions(): BasesFunction[]; /** * Gets a view factory. * * @param type - The view type to get the factory for. * @returns The view factory, or `null` if not found. */ getViewFactory(type: string): null | ViewFactory; /** * Gets the view types. * * @returns The list of registered view type strings. */ getViewTypes(): string[]; /** * On file menu. * * @param menu - The context menu to extend. * @param file - The target file or folder. * @param source - The source of the context menu event. * @param leaf - Optional workspace leaf context. */ onFileMenu(menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf): void; /** * Registers a function. * * @param fn - The function to register. */ registerFunction(fn: BasesFunction): void; /** * Registers a view. * * @param type - The view type identifier. * @param viewFactory - The factory function to create the 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. * * @returns The display name. */ getDisplayName(): string; /** * Migrates the display name. * * @param getDisplayName - The display name to migrate. * @returns The migrated display name. */ migrateDisplayName(getDisplayName: string): string; /** * Serializes the property. * * @returns The serialized property data. */ serialize(): object; /** * Sets the display name. * * @param displayName - The display name to set. */ 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; /** * The properties. */ properties: Record; /** * The unrecognized data. */ unrecognizedData: object; /** * The views. */ views: BasesSubView[]; /** * Clones the query. * * @returns The cloned query. */ clone(): this; /** * Creates a new instance. * * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(): this; /** * Gets the property config. * * @param key - The property key. * @returns The property configuration. */ getPropertyConfig(key: string): unknown; /** * Gets the serializable data. * * @returns The serializable data object. */ getSerializable(): object; /** * Gets the view config. * * @param key - The view config key. * @returns The view configuration. */ getViewConfig(key: string): unknown; /** * Removes a formula. * * @param key - The formula key to remove. */ removeFormula(key: string): void; /** * Saves the query. */ save(): void; /** * Saves the query. * * @param query - The query instance to save. */ saveFn(query: this): void; /** * Sets the formulas. * * @param formulas - The formulas to set. */ setFormulas(formulas: Record): void; /** * Sets the global filters. * * @param filter - The global filter to set. */ setGlobalFilters(filter: BasesFilter): void; /** * Sets the view filters. * * @param key - The view key. * @param filters - The filters to set. */ setViewFilters(key: string, filters: BasesFilter): void; } /** * Bases query constructor. * * Extends {@link ExtractConstructor} with a static `fromString` parser (the `.base` parser). `BasesQuery` * is not part of the public `obsidian` module, so its constructor is modeled here rather than obtained from * `obsidian` directly. * * @public * @unofficial */ export interface BasesQueryConstructor extends ExtractConstructor { /** * Parse a `.base` file's content into a {@link BasesQuery}. * * @param content - The `.base` file content. * @returns The parsed query. */ fromString(content: string): BasesQuery; } /** * The file-change queue that streams vault files into a {@link obsidian#QueryController}'s query and keeps the * results in sync as files are created, modified, renamed, or deleted. * * @public * @unofficial */ export interface BasesQueryQueue extends Component { /** * The app instance. */ app: App; /** * The owning query controller, to which scan progress and removed results are reported. */ dom: QueryController; /** * The inner cancellable batch queue that drives the scan, or `null` when the queue is stopped. */ queue: unknown; /** * Re-queues a renamed file or a file whose metadata cache changed. * * @param file - The changed file. */ onFileChanged(file: TAbstractFile): void; /** * Removes a deleted file from the queue and from the results. * * @param file - The deleted file. */ onFileDeleted(file: TAbstractFile): void; /** * Queues a created or modified non-markdown file. * * @param file - The changed file. */ onNonMarkdownFileChanged(file: TAbstractFile): void; /** * Starts a new scan, enqueuing every file in the vault. * * @returns The inner cancellable batch queue driving the scan. */ start(): unknown; /** * Stops and cancels the current scan. */ stop(): void; } /** * Bases view controller results menu. * * @public * @unofficial */ export interface BasesResultsMenu { } /** * The search menu of a {@link obsidian#QueryController}'s toolbar, providing the in-view search bar that filters * results by a full-text query. * * @public * @unofficial */ export interface BasesSearchMenu extends Component { /** * Whether the search bar is currently open. */ _isOpen: boolean; /** * The app instance. */ app: App; /** * The toolbar button that toggles the search bar. */ button: unknown; /** * The element displaying the search result count. */ countEl: HTMLDivElement; /** * The search input element. */ inputEl: HTMLInputElement; /** * The owning query controller. */ queryController: QueryController; /** * The keyboard scope active while the search bar is open (registers `Escape` to close it). */ scope: Scope; /** * The search bar container element. */ searchBarEl: HTMLDivElement; /** * Debounced update that pushes the typed query to the controller via {@link obsidian#QueryController.updateSearchQuery}. */ update: Debouncer<[ string ], void>; /** * Closes the search bar. */ close(): void; /** * Opens the search bar, focuses the input, and pushes the keyboard scope. */ open(): void; /** * Toggles the search bar open or closed. */ toggle(): void; /** * Updates the displayed result count. * * @param entries - The filtered entries whose count to display. */ updateCount(entries: BasesEntry[]): void; } /** * 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. * * @param name - The name for the cloned sub view. * @returns The cloned sub view. */ clone(name: string): this; /** * Gets the sub view. * * @returns The sub view value. */ get(arg1: unknown): unknown; /** * Gets all the sub views. * * @returns All sub view entries. */ getAll(): unknown; /** * Gets the display name. * * @returns The display name. */ getDisplayName(arg1: unknown): unknown; /** * Gets the limit. * * @returns The current limit. */ getLimit(): unknown; /** * Gets the order. * * @returns The current sort order. */ getOrder(): unknown; /** * Gets the property config. * * @returns The property configuration. */ getPropertyConfig(arg1: unknown): unknown; /** * Gets the sort. * * @returns The current sort configuration. */ getSort(): unknown; /** * Gets the view name. * * @returns The view name. */ getViewName(): string; /** * Serializes the sub view. * * @returns The serialized sub view. */ serialize(): SerializedBasesSubView; /** * Sets the sub view. * * @returns The set result. */ set(arg1: unknown, arg2: unknown): unknown; /** * Sets the limit. * * @returns The set result. */ setLimit(arg1: unknown): unknown; /** * Sets the order. * * @returns The set result. */ setOrder(arg1: unknown): unknown; /** * Sets the sort property. * * @returns The set result. */ 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; /** * Constructor. * * @param leaf - The workspace leaf. * @param basesPluginInstance - The bases plugin instance. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor4__?(leaf: WorkspaceLeaf, basesPluginInstance: BasesPluginInstance): this; /** * Get view type. * * @returns The bases 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. * * @param fileView - The file view to receive the sync state from. */ receiveSyncState(fileView: FileView): void; /** * Saves the query. * * @param query - The query to save. */ saveQuery(query: BasesQuery): void; /** * Updates the current file. * * @param file - The file to update. */ updateCurrentFile(file: null | TFile): void; } /** * Bases view menu. * * @public * @unofficial */ export interface BasesViewMenu { } /** * {@link Bezier} curve used for rendering canvas edge connections. * * @public * @unofficial */ export interface Bezier { /** * First control point of the {@link Bezier} curve. */ cp1: Point; /** * Second control point of the {@link Bezier} curve. */ cp2: Point; /** * Start point of the {@link Bezier} curve. */ from: Point; /** * SVG path string representation of the {@link Bezier} curve. */ path: string; /** * End point of the {@link Bezier} curve. */ to: Point; } /** * A bookmark marking a specific position in the editor document that tracks changes. * * @public * @unofficial */ export interface Bookmark { /** * Association direction for the bookmark (-1 for left, 1 for right). */ assoc: number; /** * The CodeMirror editor instance this bookmark belongs to. */ cm: CodeMirrorEditor; /** * Unique identifier for this bookmark. */ id: number; /** * Character offset of the bookmark within its line. */ offset: number; /** * Remove this bookmark from the editor. */ clear(): void; /** * Find the current position of this bookmark, or null if cleared. * * @returns The current position, or null if the bookmark has been cleared. */ find(): EditorPosition | null; /** * Update the bookmark position in response to a document change. * * @param changeDesc - The change description to apply. */ 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" | "graph" | "group" | "search" | "url"; /** * The URL of the bookmark item. */ url?: string; } /** * Internal plugin registration for the bookmarks feature. * * @public * @unofficial */ export interface BookmarksPlugin extends InternalPlugin { /** * View creators registered by the bookmarks plugin. */ views: BookmarksPluginViews; } /** * Plugin instance for bookmarks, managing bookmarked files, folders, URLs, searches, and graphs. * * @public * @unofficial */ export interface BookmarksPluginInstance extends InternalPluginInstance, Events { /** * Reference to the app. */ app: App; /** * Weak map tracking bookmarked views and their indicator elements. */ bookmarkedViews: WeakMap; /** * Lookup table mapping paths to bookmark items. */ bookmarkLookup: Record; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Whether the bookmark data has been successfully loaded and validated. */ hasValidData: boolean; /** * List of all bookmark items. */ items: BookmarkItem[]; /** * Debounced handler triggered when bookmark items change. */ onItemsChanged: Debouncer<[ boolean ], void>; /** * Reference to the bookmarks plugin registration. */ plugin: BookmarksPlugin; /** * Lookup table mapping URLs to bookmark items. */ urlBookmarkLookup: Record; /** * Internal handler called when bookmark items change. * * @param shouldSave - Whether to persist changes to storage. */ _onItemsChanged(shouldSave: boolean): void; /** * Add a bookmark item, optionally to a specific parent instance. * * @param item - The bookmark item to add. * @param instance - Optional parent plugin instance for group placement. */ addItem(item: BookmarkItem, instance?: BookmarksPluginInstance): void; /** * Open the edit dialog for a bookmark item. * * @param item - The bookmark item to edit. */ editItem(item: BookmarkItem): void; /** * Find the bookmark item associated with a given file view. * * @param view - The file view to find the bookmark for. * @returns The matching bookmark item, or `null`/`undefined` if not found. */ findBookmarkByView(view: FileView): BookmarkItem | null | undefined; /** * Get a flat list of all bookmark items. * * @returns All bookmark items. */ getBookmarks(): BookmarkItem[]; /** * Get the display title for a bookmark item. * * @param item - The bookmark item. * @returns The display title. */ getItemTitle(item: BookmarkItem): string; /** * Initialize the bookmarks view leaf. */ initLeaf(): void; /** * Load bookmark data from storage. * * @returns Whether the data was loaded successfully. */ loadData(): Promise; /** * Move a bookmark item to a new position within the list. * * @param item - The bookmark item to move. * @param instance - The target parent plugin instance, or `undefined` for root. * @param index - The target index position. */ moveItem(item: BookmarkItem, instance: BookmarksPluginInstance | undefined, index: number): void; /** * Add bookmark-related items to the editor context menu. * * @param menu - The context menu to extend. * @param editor - The active editor. * @param info - The active markdown view or file info. */ onEditorMenu(menu: Menu, editor: Editor, info: MarkdownFileInfo | MarkdownView): void; /** * Called when the plugin is enabled. * * @param app - The app instance. * @param plugin - The bookmarks plugin registration. * @returns A promise that resolves when the plugin is enabled. */ onEnable(app: App, plugin: BookmarksPlugin): Promise; /** * Handle external settings file changes and reload configuration. * * @returns A promise that resolves when the settings are reloaded. */ onExternalSettingsChange(): Promise; /** * Add bookmark-related items to a file context menu. * * @param menu - The context menu to extend. * @param files - The files for the context menu. * @param source - The source of the context menu event. * @param leaf - Optional workspace leaf context. */ onFileMenu(menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): void; /** * Handle a file rename and update affected bookmarks. * * @param file - The renamed file. * @param oldPath - The previous file path. */ onFileRename(file: TFile, oldPath: string): void; /** * Add bookmark-related items to a multi-file context menu. * * @param menu - The context menu to extend. * @param files - The selected files. * @param source - The source of the context menu event. * @param leaf - Optional workspace leaf context. */ onFilesMenu(menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): void; /** * Add bookmark-related items to a workspace leaf context menu. * * @param menu - The context menu to extend. * @param leaf - The workspace leaf. */ onLeafMenu(menu: Menu, leaf: WorkspaceLeaf): void; /** * Add bookmark-related items to a search results context menu. * * @param menu - The context menu to extend. * @param search - The search view workspace leaf. */ onSearchResultsMenu(menu: Menu, search: TypedWorkspaceLeaf): void; /** * Add bookmark-related items to a tab group context menu. * * @param menu - The context menu to extend. * @param tabsLeaf - The workspace tabs container. */ onTabGroupMenu(menu: Menu, tabsLeaf: WorkspaceTabs): void; /** * Called when the user enables the plugin. */ onUserEnable(): void; /** * Open a bookmark item in a new or existing leaf. * * @param item - The bookmark item to open. * @param newLeaf - Where to open the bookmark. * @param newLeaf2 - Optional secondary pane type. * @returns A promise that resolves when the bookmark is opened. */ openBookmark(item: BookmarkItem, newLeaf: boolean | PaneType, newLeaf2?: boolean | PaneType): Promise; /** * Open a bookmark item in a specific workspace leaf. * * @param item - The bookmark item to open. * @param leaf - The target workspace leaf. * @param newLeaf - Optional pane type override. * @returns A promise that resolves when the bookmark is opened in the leaf. */ openBookmarkInLeaf(item: BookmarkItem, leaf: WorkspaceLeaf, newLeaf?: boolean | PaneType): Promise; /** * Open multiple bookmark items at once. * * @param items - The bookmark items to open. * @param newLeaf - Optional pane type for opening. * @returns A promise that resolves when all bookmarks are opened. */ openBookmarks(items: BookmarkItem[], newLeaf?: boolean | PaneType): Promise; /** * Rebuild the internal bookmark lookup caches. */ rebuildBookmarkCache(): void; /** * Remove a bookmark item from the list. * * @param item - The bookmark item to remove. */ removeItem(item: BookmarkItem): void; /** * Persist the current bookmark data to storage. */ saveData(): void; /** * Update bookmark indicator icons on tab headers. */ updateTabHeaders(): void; } /** * View creators registered by the bookmarks plugin. * * @public * @unofficial */ export interface BookmarksPluginViews extends Record { /** * Create a bookmarks view in the given workspace leaf. * * @param left - The workspace leaf to create the bookmarks view in. * @returns The created bookmarks view. */ bookmarks(left: WorkspaceLeaf): BookmarksView; } /** * {@link obsidian#View} that displays the bookmarks sidebar, showing all bookmarked items in a tree. * * @public * @unofficial */ export interface BookmarksView extends ItemView { /** * Copy the selected bookmarks to the clipboard. * * @param e - The copy event or context. * @param t - The target bookmark items. */ _copyToClipboard(e: unknown, t: unknown): void; /** * Get the currently active/selected bookmark items. * * @returns The active bookmark items. */ _getActiveBookmarks(): unknown[]; /** * Attaches the handleDrag of {@link DragManager}. * * @param e - The element to attach the drag handler to. */ attachDragHandler(e: unknown): void; /** * Attaches the handleDrop of {@link DragManager} to containerEl. */ attachDropHandler(): void; /** * Constructor. * * @param leaf - The workspace leaf. * @param bookmarksPluginInstance - The bookmarks plugin instance. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor3__?(leaf: WorkspaceLeaf, bookmarksPluginInstance: BookmarksPluginInstance): this; /** * Create a new bookmark group. * * @param e - The event or context for group creation. */ createNewGroup(e: unknown): void; /** * Initiate a drag operation for the selected bookmarks. * * @param e - The drag event. * @param t - The drag target information. * @returns The drag data, or `null`. */ dragSelectedBookmarks(e: unknown, t: unknown): null | unknown; /** * Get the DOM element for a bookmark item. * * @param e - The bookmark item. * @returns The DOM element for the item. */ getItemDom(e: unknown): unknown; /** * Get the unique node identifier for a bookmark item. * * @param e - The bookmark item. * @returns The node identifier string. */ getNodeId(e: unknown): string; /** * Get the current view type. * * @returns The bookmarks view type. */ getViewType(): typeof ViewType.Bookmarks; /** * Handle the collapse/expand all toggle action. * * @param e - Whether to collapse all. */ handleCollapseAll(e: unknown): void; /** * Check whether the given object is a bookmark item. * * @param item - The object to check. * @returns Whether the object is a bookmark item. */ isItem(item: unknown): boolean; /** * Handle the context menu event on a bookmark item. * * @param event - The context menu event. */ onContextMenu(event: unknown): void; /** * Called when delete is requested. * * @param event - The event triggered this function. * @returns The result of the delete operation. */ 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; /** * Handle a file being opened and highlight corresponding bookmark. * * @param file - The opened file. */ onFileOpen(file: TFile): void; /** * Called when the rename shortcut is pressed. * * @param event - The event triggered this function. */ onRenameKey(event: KeyboardEvent): void; /** * Refresh the bookmarks view. */ update(): void; } /** * Represents a bracket character found at a specific position in the editor. * * @public * @unofficial */ export interface Bracket { /** * The bracket character. */ ch: string; /** * Position of the bracket in the document. */ pos: EditorPosition; } /** * Options for creating a new BrowserWindow. * * @public * @unofficial */ export interface BrowserWindowConstructorOptions { /** * Whether clicking an inactive window will also click through to the web contents. This option is not * configurable on platforms other than macOS. * * @default `false` */ acceptFirstMouse?: boolean; /** * Whether the window should always stay on top of other windows. * * @default `false` */ alwaysOnTop?: boolean; /** * Auto hide the menu bar unless the `Alt` key is pressed. * * @default `false` */ autoHideMenuBar?: boolean; /** * The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in `#AARRGGBB` * format is supported if `transparent` is set to `true`. * * @default `#FFF` */ backgroundColor?: string; /** Show window in the center of the screen. */ center?: boolean; /** * Whether window is closable. This is not implemented on Linux. * * @default `true` */ closable?: boolean; /** * Forces using dark theme for the window, only works on some GTK+3 desktop environments. * * @default `false` */ darkTheme?: boolean; /** * Whether to hide cursor when typing. * * @default `false` */ disableAutoHideCursor?: boolean; /** * Enable the window to be resized larger than screen. Only relevant for macOS, as other OSes allow * larger-than-screen windows by default. * * @default `false` */ enableLargerThanScreen?: boolean; /** * Whether the window can be focused. On Windows setting `focusable: false` also implies setting * `skipTaskbar: true`. On Linux setting `focusable: false` makes the window stop interacting with wm. * * @default `true` */ focusable?: boolean; /** * Specify `false` to create a frameless window. * * @default `true` */ frame?: boolean; /** * Whether the window should show in fullscreen. When explicitly set to `false` the fullscreen button will be * hidden or disabled on macOS. * * @default `false` */ fullscreen?: boolean; /** * Whether the window can be put into fullscreen mode. On macOS, also whether the maximize/zoom button should * toggle full screen mode or maximize window. * * @default `true` */ fullscreenable?: boolean; /** * Shows the title in the title bar in full screen mode on macOS for `hiddenInset` titleBarStyle. * * @default `false` * @deprecated Deprecated by Electron. */ fullscreenWindowTitle?: boolean; /** * Whether window should have a shadow. * * @default `true` */ hasShadow?: boolean; /** * Window's height in pixels. * * @default `600` */ height?: number; /** * The window icon. On Windows it is recommended to use `ICO` icons to get best visual effects; it can also be * left undefined so the executable's icon will be used. */ icon?: ElectronNativeImage | string; /** * Whether the window is in kiosk mode. * * @default `false` */ kiosk?: boolean; /** Window's maximum height. Default is no limit. */ maxHeight?: number; /** * Whether window is maximizable. This is not implemented on Linux. * * @default `true` */ maximizable?: boolean; /** Window's maximum width. Default is no limit. */ maxWidth?: number; /** * Window's minimum height. * * @default `0` */ minHeight?: number; /** * Whether window is minimizable. This is not implemented on Linux. * * @default `true` */ minimizable?: boolean; /** * Window's minimum width. * * @default `0` */ minWidth?: number; /** * Whether this is a modal window. This only works when the window is a child window. * * @default `false` */ modal?: boolean; /** * Whether window is movable. This is not implemented on Linux. * * @default `true` */ movable?: boolean; /** * Set the initial opacity of the window, between `0.0` (fully transparent) and `1.0` (fully opaque). This is only * implemented on Windows and macOS. */ opacity?: number; /** * Whether the renderer should be active when `show` is `false` and it has just been created. In order for * `document.visibilityState` to work correctly on first load with `show: false` this should be set to `false`. * * @default `true` */ paintWhenInitiallyHidden?: boolean; /** * Specify parent window. * * @default `null` */ parent?: ElectronBrowserWindow; /** * Whether window is resizable. * * @default `true` */ resizable?: boolean; /** * Whether frameless window should have rounded corners on macOS. * * @default `true` */ roundedCorners?: boolean; /** * Whether window should be shown when created. * * @default `true` */ show?: boolean; /** * Use pre-Lion fullscreen on macOS. * * @default `false` */ simpleFullscreen?: boolean; /** * Whether to show the window in taskbar. * * @default `false` */ skipTaskbar?: boolean; /** * Tab group name, allows opening the window as a native tab on macOS 10.12+. Windows with the same tabbing * identifier will be grouped together. */ tabbingIdentifier?: string; /** * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard window frame. Setting it to * `false` will remove window shadow and window animations. * * @default `true` */ thickFrame?: boolean; /** * Default window title. If the HTML tag `` is defined in the HTML file loaded by `loadURL()`, this * property will be ignored. * * @default `Electron` */ title?: string; /** * When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a * `titleBarStyle` so that the standard window controls are visible, this property enables the Window Controls * Overlay JavaScript APIs and CSS Environment Variables. Specifying `true` will result in an overlay with default * system colors. * * @default `false` */ titleBarOverlay?: boolean | ElectronTitleBarOverlay; /** * The style of window title bar (macOS and Windows). * * @default `default` */ titleBarStyle?: "customButtonsOnHover" | "default" | "hidden" | "hiddenInset"; /** Set a custom position for the traffic light buttons in frameless windows. */ trafficLightPosition?: ElectronPoint; /** * Makes the window transparent. On Windows, does not work unless the window is frameless. * * @default `false` */ transparent?: boolean; /** The type of window, default is normal window. */ type?: string; /** * The `width` and `height` would be used as web page's size, which means the actual window's size will include * window frame's size and be slightly larger. * * @default `false` */ useContentSize?: boolean; /** * Add a type of vibrancy effect to the window, only on macOS. Note that `appearance-based`, `light`, `dark`, * `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15). */ vibrancy?: "appearance-based" | "content" | "dark" | "fullscreen-ui" | "header" | "hud" | "light" | "medium-light" | "menu" | "popover" | "selection" | "sheet" | "sidebar" | "titlebar" | "tooltip" | "ultra-dark" | "under-page" | "under-window" | "window"; /** Specify how the material appearance should reflect window activity state on macOS. Must be used with the `vibrancy` property. */ visualEffectState?: "active" | "followWindow" | "inactive"; /** Settings of web page's features. */ webPreferences?: WebPreferences; /** * Window's width in pixels. * * @default `800` */ width?: number; /** Window's left offset from screen (required if `y` is used). Default is to center the window. */ x?: number; /** Window's top offset from screen (required if `x` is used). Default is to center the window. */ y?: number; /** * Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking * the Window \> Zoom menu item. If `true`, the window will grow to the preferred width of the web page when * zoomed, `false` will cause it to zoom to the width of the screen. * * @default `false` */ zoomToPageWidth?: boolean; } /** * Interface for setting the birth time (creation time) of a file. * * @public * @unofficial */ export interface Btime { /** * Set the birth time (creation time) of a file at the given path. * * @param path - File path. * @param btime - Birth time in milliseconds. */ btime(path: string, btime: number): void; } /** * Represents a connection (edge) between two nodes on a canvas. * * @public * @unofficial */ export interface CanvasConnection { } /** * Manages saving, loading, and maintaining canvas local data on disk. * * @public * @unofficial */ export interface CanvasDataManager { /** * Reference to the Obsidian app instance. */ app: App; /** * Handle a file deletion event and remove associated canvas data. * * @returns The result of handling the deletion. */ handleDelete(arg1: unknown): unknown; /** * Handle a file rename event and update associated canvas data paths. * * @returns The result of handling the rename. */ handleRename(arg1: unknown, arg2: unknown): unknown; /** * Load canvas data for the specified file. * * @returns The loaded canvas data. */ load(arg1: unknown): unknown; /** * Remove stored canvas data for the specified file. * * @returns The result of removing the data. */ remove(arg1: unknown): unknown; /** * Save canvas data for the specified file. * * @returns The result of saving the data. */ save(arg1: unknown, arg2: unknown): unknown; } /** * Represents an embedded file reference within a canvas node. * * @public * @unofficial */ export interface CanvasEmbed { /** * Path to the embedded file. */ file: string; /** * Optional subpath within the file (e.g., heading or block reference). */ subpath?: string; } /** * Index that tracks and resolves links, embeds, and metadata across all canvas files. * * @public * @unofficial */ export interface CanvasIndex extends Component { /** * Reference to the Obsidian app instance. */ app: App; /** * Queue of files waiting to be processed by the indexer. */ fileQueue: unknown[]; /** * Current animation frame request, or `null` when idle. */ frame: null; /** * Index of canvas entries keyed by file path. */ index: Record<string, CanvasIndexEntry>; /** * Weak map tracking reference node IDs for canvas files. */ refNodeIds: WeakMap<object, unknown>; /** * Check whether a file can be processed by the canvas indexer. * * @returns Whether the file can be processed. */ canProcess(arg1: unknown): unknown; /** * Get the index entry for the specified file. * * @returns The index entry. */ get(arg1: unknown): unknown; /** * Get all index entries. * * @returns All index entries. */ getAll(): unknown; /** * Get the index entry for the specified file path. * * @returns The index entry. */ getForPath(arg1: unknown): unknown; /** * Handle a file creation event. * * @returns The result of handling the creation. */ onCreate(arg1: unknown): unknown; /** * Handle a file deletion event. * * @returns The result of handling the deletion. */ onDelete(arg1: unknown): unknown; /** * Initialize the index when the component loads. * * @returns The result of loading the index. */ onload(): unknown; /** * Handle a file modification event. * * @returns The result of handling the modification. */ onModify(arg1: unknown): unknown; /** * Handle a file rename event. * * @returns The result of handling the rename. */ onRename(arg1: unknown, arg2: unknown): unknown; /** * Clean up the index when the component unloads. * * @returns The result of unloading the index. */ onunload(): unknown; /** * Parse canvas text content and extract metadata. * * @returns The parsed metadata. */ parseText(arg1: unknown): Promise<unknown>; /** * Process a single canvas file and update the index. * * @returns The result of processing the file. */ process(arg1: unknown): Promise<unknown>; /** * Add a file to the processing queue. * * @returns The result of queuing the file. */ queue(arg1: unknown): unknown; /** * Request an animation frame to process queued files. * * @returns The result of requesting the frame. */ requestFrame(): unknown; /** * Run the indexer to process all queued files. * * @returns The result of running the indexer. */ run(): Promise<unknown>; } /** * Represents a single entry in the canvas index, containing cached metadata and embeds for a canvas file. * * @public * @unofficial */ export interface CanvasIndexEntry { /** * Cached metadata for each node in the canvas, keyed by node ID. */ caches: Record<string, CachedMetadata>; /** * List of embedded file references within the canvas. */ embeds: CanvasEmbed[]; } /** * Link updater for canvas files, handling link updates when files are renamed or moved. * * @public * @unofficial */ export interface CanvasLinkUpdater extends LinkUpdater { /** * Reference to the app. */ app: App; /** * Canvas plugin instance used to access canvas data. */ canvas: CanvasPluginInstance; } /** * Context menu and toolbar displayed on the canvas for node/edge actions. * * @public * @unofficial */ export interface CanvasMenu { /** * Reference to the parent canvas instance. */ canvas: CanvasViewCanvas; /** * Outer container element for the menu. */ containerEl: HTMLDivElement; /** * Element containing the menu buttons and controls. */ menuEl: HTMLDivElement; /** * Reference to the current canvas selection. */ selection: CanvasSelection; /** * Render the menu for the given selection or context. * * @returns The result of rendering the menu. */ render(arg1: unknown): unknown; /** * Update the menu's z-index to stay above the selected items. * * @returns The result of updating the z-index. */ updateZIndex(arg1: unknown): unknown; } /** * Represents a node (card) on a canvas. * * @public * @unofficial */ export interface CanvasNode { } /** * Internal plugin definition for the Canvas feature. * * @public * @unofficial */ export interface CanvasPlugin extends InternalPlugin<CanvasPluginInstance> { } /** * Plugin instance for the Canvas internal plugin, managing canvas indexing, data, and rename operations. * * @public * @unofficial */ export interface CanvasPluginInstance extends InternalPluginInstance<CanvasPlugin> { /** * Reference to the Obsidian app instance. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Index for resolving links and embeds within canvas files. */ index: CanvasIndex; /** * Manager for loading, saving, and handling canvas local data. */ localDataManager: CanvasDataManager; /** * User-configurable options for the canvas plugin. */ options: CanvasPluginInstanceOptions; /** * Reference to the parent canvas plugin. */ plugin: CanvasPlugin; /** * Queue for processing file rename operations sequentially. */ renameQueue: PromisedQueue; /** * Pending rename operations to be processed. */ renames: unknown[]; /** * Debounced function to process pending rename operations. */ requestProcessRename: Debouncer<[ ], unknown>; /** * Creates a new canvas file. * * @param location - The parent folder. Defaults to the configured new-file location. * @param filename - The file name (without extension). * @param contents - The initial file contents. * @returns A promise resolving to the created file. */ createNewCanvasFile(location?: TFolder, filename?: string, contents?: string): Promise<TFile>; /** * Gets the folder a new canvas file should be created in. * * @param sourcePath - The path of the current file. * @param newFilePath - The path of the file being created. * @returns The destination folder. */ getNewFileParent(sourcePath: string, newFilePath?: string): TFolder; /** * Handles deletion of a canvas file. * * @param file - The deleted file. */ onDelete(file: TAbstractFile): void; /** * Handles a settings change made externally (e.g. by Sync). * * @returns A promise that resolves when the change has been handled. */ onExternalSettingsChange(): Promise<void>; /** * Adds canvas-related items to the file context menu. * * @param menu - The menu to add to. * @param file - The file or folder the menu was opened on. * @param source - The source of the menu (e.g. `'file-explorer-context-menu'`). * @param leaf - The leaf the menu was opened from. */ onFileMenu(menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf): void; /** * Handles renaming of a canvas file. * * @param file - The renamed file. * @param oldPath - The previous path of the file. */ onRename(file: TAbstractFile, oldPath: string): void; /** * Re-renders all open canvas views. */ rerenderCanvases(): void; /** * Persists the plugin's options. */ saveOptions(): void; } /** * User-configurable options for the Canvas plugin. * * @public * @unofficial */ export interface CanvasPluginInstanceOptions { /** * When to display card labels: always, on hover, or never. */ cardLabelVisibility?: "always" | "hover" | "never"; /** * Default node type created when modifier-dragging onto the canvas. */ defaultModDragBehavior?: "card" | "group" | "media" | "menu" | "note" | "webpage"; /** * Default mouse wheel behavior: pan or zoom. */ defaultWheelBehavior?: "pan" | "zoom"; /** * Folder path for newly created files from the canvas. */ newFileFolderPath?: string; /** * Where to create new files: vault root, current folder, or a specified folder. */ newFileLocation?: "current" | "folder" | "root"; /** * Whether nodes snap to the grid when moved. */ snapToGrid?: boolean; /** * Whether nodes snap to other objects when moved. */ snapToObjects?: boolean; /** * Zoom level threshold for switching rendering detail levels. */ zoomBreakpoint?: number; } /** * Extended rectangle representation for the canvas, providing both min/max and position/size properties. * * @public * @unofficial */ export interface CanvasRectEx { /** * Center X coordinate of the rectangle. */ cx: number; /** * Center Y coordinate of the rectangle. */ cy: number; /** * Height of the rectangle. */ height: number; /** * Left edge X coordinate of the rectangle. */ left: number; /** * Maximum X coordinate (right edge). */ maxX: number; /** * Maximum Y coordinate (bottom edge). */ maxY: number; /** * Minimum X coordinate (left edge). */ minX: number; /** * Minimum Y coordinate (top edge). */ minY: number; /** * Top edge Y coordinate of the rectangle. */ top: number; /** * Width of the rectangle. */ width: number; } /** * Manages the visual selection state on the canvas, including selection bounds and resize handles. * * @public * @unofficial */ export interface CanvasSelection { /** * Bounding box encompassing all selected items. */ bbox: BBox; /** * Reference to the parent canvas instance. */ canvas: CanvasViewCanvas; /** * Array of resize handle elements around the selection. */ resizerEls: HTMLDivElement[]; /** * Element displaying the selection highlight rectangle. */ selectionEl: HTMLDivElement; /** * Hide the selection rectangle and handles. * * @returns The result of hiding the selection. */ hide(): unknown; /** * Handle pointer down on a resize handle to start resizing the selection. * * @returns The result of handling the resize pointer down. */ onResizePointerdown(arg1: unknown, arg2: unknown): unknown; /** * Update the selection rectangle to match the current selected items. * * @returns The result of updating the selection. */ update(arg1: unknown): unknown; } /** * View for displaying and editing canvas files, extending {@link obsidian#TextFileView}. * * @public * @unofficial */ export interface CanvasView extends TextFileView { /** * The canvas controller instance managing nodes, edges, and rendering. */ canvas: CanvasViewCanvas; /** * Hover popover associated with this view, or `null` if none is active. */ hoverPopover: HoverPopover | null; /** * Reference to the canvas plugin instance. */ plugin: CanvasPluginInstance; /** * Constructor. * * @param leaf - The workspace leaf. * @param canvasPluginInstance - The canvas plugin instance. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor4__?(leaf: WorkspaceLeaf, canvasPluginInstance: CanvasPluginInstance): this; /** * Loads the local data of the canvas. * * @returns The local canvas data. */ getLocalData(): unknown; /** * Get the current view type. * * @returns The view type. */ getViewType(): typeof ViewType.Canvas; /** * Saves the local data of the canvas. */ saveLocalData(): void; } /** * Main canvas controller that manages rendering, selection, drag, zoom, pan, nodes, and edges for the canvas view. * * @public * @unofficial */ export interface CanvasViewCanvas { /** * Reference to the Obsidian app instance. */ app: App; /** * SVG pattern element used for rendering the canvas background grid. */ backgroundPatternEl: SVGPatternElement; /** * Container element for canvas control buttons (zoom, undo/redo, etc.). */ canvasControlsEl: HTMLDivElement; /** * Main canvas container element. */ canvasEl: HTMLDivElement; /** * Extended rectangle representing the canvas bounds. */ canvasRect: CanvasRectEx; /** * Container element for the card creation menu. */ cardMenuEl: HTMLDivElement; /** * Configuration settings for the canvas view. */ config: CanvasViewConfig; /** * Serialized canvas data containing nodes and edges. */ data: CanvasViewData; /** * Set of items that have been modified and need saving. */ dirty: Set<unknown>; /** * SVG container element for edge lines. */ edgeContainerEl: SVGElement; /** * SVG container element for edge endpoint markers. */ edgeEndContainerEl: SVGElement; /** * Mapping of edges to their source nodes. */ edgeFrom: MapOfSets<CanvasViewCanvasEdge, CanvasViewCanvasNode>; /** * Spatial index (R-tree) for efficient edge hit-testing. */ edgeIndex: EdgeIndex; /** * Map of all edges on the canvas, keyed by edge ID. */ edges: Map<string, CanvasViewCanvasEdge>; /** * Mapping of edges to their target nodes. */ edgeTo: MapOfSets<CanvasViewCanvasEdge, CanvasViewCanvasNode>; /** * Whether to finish the current viewport animation on the next frame. */ finishViewportAnimation: boolean; /** * Current animation frame request ID. */ frame: number; /** * Animation frame window reference, null when not animating. */ frameWin: null; /** * Spacing between grid lines in pixels. */ gridSpacing: number; /** * Undo/redo history manager for canvas state. */ history: CanvasViewHistory; /** * Whether the user is currently dragging on the canvas. */ isDragging: boolean; /** * Whether the spacebar is currently held (for pan mode). */ isHoldingSpace: boolean; /** * Map of currently pressed keyboard keys. */ keys: object; /** * Set of edges that were visible in the viewport on the last render frame. */ lastEdgesInViewport: Set<CanvasViewCanvasEdge>; /** * Set of nodes that were visible in the viewport on the last render frame. */ lastNodesInViewport: Set<CanvasViewCanvasNode>; /** * Context menu and toolbar for the canvas. */ menu: CanvasMenu; /** * Set of items that have been moved and need re-indexing. */ moved: Set<unknown>; /** * Element used for dragging/moving the canvas viewport. */ moverEl: HTMLDivElement; /** * Spatial index (R-tree) for efficient node hit-testing. */ nodeIndex: EdgeIndex; /** * Layer handling user interactions with nodes (resize, connect, etc.). */ nodeInteractionLayer: NodeInteractionLayer; /** * Map of all nodes on the canvas, keyed by node ID. */ nodes: Map<string, CanvasViewCanvasNode>; /** * Optional configuration options for the canvas. */ options?: unknown; /** * Counter for pausing animation frames. */ pauseAnimation: number; /** * Current pointer position in canvas coordinates. */ pointer: Point; /** * Animation frame request ID for pointer tracking. */ pointerFrame: number; /** * Pointer frame window reference, null when not tracking. */ pointerFrameWin: null; /** * Button element for opening the quick settings menu. */ quickSettingsButton: HTMLDivElement; /** * Whether the canvas is in read-only mode. */ readonly: boolean; /** * Button element for the redo action. */ redoBtnEl: HTMLDivElement; /** * Debounced function to push the current state to history. */ requestPushHistory: Debouncer<[ ], unknown>; /** * Debounced function to update the file open state. */ requestUpdateFileOpen: Debouncer<[ ], unknown>; /** * Current zoom scale factor of the canvas viewport. */ scale: number; /** * Whether the canvas is currently being screenshotted. */ screenshotting: boolean; /** * Set of currently selected nodes and edges. */ selection: Set<Selection>; /** * Whether the selection has changed since the last update. */ selectionChanged: boolean; /** * Distance threshold for snapping behavior. */ snapDistance?: unknown; /** * Previously stale selection, null when selection is current. */ staleSelection: null; /** * Target X translation for viewport animation. */ tx: number; /** * Target Y translation for viewport animation. */ ty: number; /** * Target zoom level for viewport animation. */ tZoom: number; /** * Button element for the undo action. */ undoBtnEl: HTMLDivElement; /** * Reference to the parent {@link CanvasView}. */ view: CanvasView; /** * Whether the viewport has changed since the last render frame. */ viewportChanged: boolean; /** * Whether the canvas was animating on the previous frame. */ wasAnimating: boolean; /** * Outermost wrapper element for the canvas. */ wrapperEl: HTMLDivElement; /** * Current X offset of the viewport in canvas coordinates. */ x: number; /** * Current Y offset of the viewport in canvas coordinates. */ y: number; /** * Counter for assigning z-index values to nodes. */ zIndexCounter: number; /** * Current zoom level of the viewport. */ zoom: number; /** * Zoom level threshold for switching rendering detail levels. */ zoomBreakpoint?: unknown; /** * Center point for zoom operations, null when not zooming. */ zoomCenter: null; /** * Whether a zoom-to-fit operation is queued for the next frame. */ zoomToFitQueued: boolean; /** * Add an edge to the canvas. * * @returns The added edge. */ addEdge(arg1: unknown): unknown; /** * Add a node to the canvas. * * @returns The added node. */ addNode(arg1: unknown): unknown; /** * Apply a history state to restore the canvas to a previous state. * * @returns The result of applying the history state. */ applyHistory(arg1: unknown): unknown; /** * Cancel the current pending animation frame. * * @returns The result of canceling the frame. */ cancelFrame(): unknown; /** * Check whether snapping is currently possible for the given context. * * @returns Whether snapping is possible. */ canSnap(arg1: unknown): unknown; /** * Remove all nodes and edges from the canvas. * * @returns The result of clearing the canvas. */ clear(): unknown; /** * Clear all active snap point guides. * * @returns The result of clearing snap points. */ clearSnapPoints(): unknown; /** * Clone canvas data, creating duplicates of the specified items at the given offset. * * @returns The cloned canvas data. */ cloneData(arg1: unknown, arg2: unknown): unknown; /** * Create a new file-type node on the canvas. * * @returns The created file node. */ createFileNode(arg1: unknown): unknown; /** * Create multiple file-type nodes on the canvas. * * @returns The created file nodes. */ createFileNodes(arg1: unknown, arg2: unknown): unknown; /** * Create a new group node on the canvas. * * @returns The created group node. */ createGroupNode(arg1: unknown): unknown; /** * Create a new link/URL node on the canvas. * * @returns The created link node. */ createLinkNode(arg1: unknown): unknown; /** * Create a placeholder node for drag-and-drop operations. * * @returns The created placeholder node. */ createPlaceholder(): unknown; /** * Create a new text node on the canvas. * * @returns The created text node. */ createTextNode(arg1: unknown): unknown; /** * Delete all currently selected nodes and edges. * * @returns The result of deleting the selection. */ deleteSelection(): unknown; /** * Remove an item from the current selection. * * @returns The result of deselecting the item. */ deselect(arg1: unknown): unknown; /** * Clear the entire selection. * * @returns The result of clearing the selection. */ deselectAll(): unknown; /** * Convert a canvas position to DOM pixel coordinates. * * @returns The DOM pixel coordinates. */ domFromPos(arg1: unknown): unknown; /** * Convert client (screen) coordinates to DOM pixel coordinates. * * @returns The DOM pixel coordinates. */ domPosFromClient(arg1: unknown): unknown; /** * Convert a DOM event's position to DOM pixel coordinates. * * @returns The DOM pixel coordinates. */ domPosFromEvt(arg1: unknown): unknown; /** * Handle dragging a temporary node during creation. * * @returns The result of dragging the temporary node. */ dragTempNode(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Stop rendering snap point guide lines. * * @returns The result of ending snap point rendering. */ endSnapPointRendering(): unknown; /** * Generate a high-definition image of the canvas. * * @returns The generated HD image. */ generateHDImage(): Promise<unknown>; /** * Get all nodes that contain the specified bounding box or point. * * @returns The containing nodes. */ getContainingNodes(arg1: unknown): unknown; /** * Get the serialized canvas data. * * @returns The canvas data. */ getData(): unknown; /** * Get all edges connected to the specified node. * * @returns The edges connected to the node. */ getEdgesForNode(arg1: unknown): unknown; /** * Get all edges that intersect the specified bounding box. * * @returns The intersecting edges. */ getIntersectingEdges(arg1: unknown): unknown; /** * Get all nodes that intersect the specified bounding box. * * @returns The intersecting nodes. */ getIntersectingNodes(arg1: unknown): unknown; /** * Get serialized data for the current selection. * * @returns The selection data. */ getSelectionData(arg1: unknown): unknown; /** * Calculate snap alignment guides for the given position and dimensions. * * @returns The snap alignment data. */ getSnapping(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; /** * Get the current viewport state (position, zoom). * * @returns The viewport state. */ getState(): unknown; /** * Get the bounding box of the current viewport in canvas coordinates. * * @returns The viewport bounding box. */ getViewportBBox(): unknown; /** * Get all nodes currently visible within the viewport. * * @returns The viewport nodes. */ getViewportNodes(arg1: unknown): unknown; /** * Get the next available z-index value. * * @returns The next z-index value. */ getZIndex(): unknown; /** * Handle a copy event for the current selection. * * @returns The result of handling the copy event. */ handleCopy(arg1: unknown): unknown; /** * Handle a cut event for the current selection. * * @returns The result of handling the cut event. */ handleCut(arg1: unknown): unknown; /** * Handle drag-to-select (rubber band selection) interaction. * * @returns The result of handling the drag-to-select. */ handleDragToSelect(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Handle drag interaction with viewport panning. * * @returns The result of handling the drag with pan. */ handleDragWithPan(arg1: unknown, arg2: unknown): unknown; /** * Handle pointer down event on the mover element. * * @returns The result of handling the pointer down. */ handleMoverPointerdown(arg1: unknown): unknown; /** * Handle a paste event to add items to the canvas. * * @returns The result of handling the paste event. */ handlePaste(arg1: unknown): unknown; /** * Handle dragging the current selection. * * @returns The result of handling the selection drag. */ handleSelectionDrag(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Test whether a point hits a specific node. * * @returns Whether the point hits the node. */ hitTestNode(arg1: unknown, arg2: unknown): unknown; /** * Import canvas data from an external source. * * @returns The result of importing the data. */ importData(arg1: unknown, arg2: unknown): unknown; /** * Perform a hit test for interactive elements at the given position. * * @returns The hit interactive element, if any. */ interactionHitTest(arg1: unknown): unknown; /** * Load and initialize the canvas from saved data. * * @returns The result of loading the canvas. */ load(): unknown; /** * Mark an item as dirty (needing to be saved). * * @returns The result of marking the item as dirty. */ markDirty(arg1: unknown): unknown; /** * Mark an item as having been moved (needing re-indexing). * * @returns The result of marking the item as moved. */ markMoved(arg1: unknown): unknown; /** * Mark the viewport as changed, triggering a re-render. * * @returns The result of marking the viewport as changed. */ markViewportChanged(): unknown; /** * Nudge the current selection by the specified offset. * * @returns The result of nudging the selection. */ nudgeSelection(arg1: unknown, arg2: unknown): unknown; /** * Handle context menu event on the canvas background. * * @returns The result of handling the context menu event. */ onContextMenu(arg1: unknown): unknown; /** * Handle double-click event on the canvas. * * @returns The result of handling the double-click. */ onDoubleClick(arg1: unknown): unknown; /** * Handle global keydown events. * * @returns The result of handling the keydown event. */ onGlobalKeydown(arg1: unknown): unknown; /** * Handle global keyup events. * * @returns The result of handling the keyup event. */ onGlobalKeyup(arg1: unknown): unknown; /** * Handle keydown events on the canvas. * * @returns The result of handling the keydown event. */ onKeydown(arg1: unknown): unknown; /** * Handle pointer down events on the canvas. * * @returns The result of handling the pointer down event. */ onPointerdown(arg1: unknown): unknown; /** * Handle pointer move events on the canvas. * * @returns The result of handling the pointer move event. */ onPointermove(arg1: unknown): unknown; /** * Handle priority pointer down events (processed before other handlers). * * @returns The result of handling the priority pointer down event. */ onPriorityPointerdown(arg1: unknown): unknown; /** * Handle canvas container resize events. * * @returns The result of handling the resize event. */ onResize(): unknown; /** * Handle context menu event on the current selection. * * @returns The result of handling the selection context menu. */ onSelectionContextMenu(arg1: unknown): unknown; /** * Handle touch start events on the canvas. * * @returns The result of handling the touch event. */ onTouchdown(arg1: unknown): unknown; /** * Handle mouse wheel events for zooming or panning. * * @returns The result of handling the wheel event. */ onWheel(arg1: unknown): unknown; /** * Override the current history entry with the latest state. * * @returns The result of overriding the history. */ overrideHistory(): unknown; /** * Pan the viewport by the specified delta. * * @returns The result of panning the viewport. */ panBy(arg1: unknown, arg2: unknown): unknown; /** * Pan the viewport so the specified bounding box is visible. * * @returns The result of panning into view. */ panIntoView(arg1: unknown, arg2: unknown): unknown; /** * Pan the viewport to the specified position. * * @returns The result of panning the viewport. */ panTo(arg1: unknown, arg2: unknown): unknown; /** * Get the center position of the current viewport. * * @returns The center position of the viewport. */ posCenter(): unknown; /** * Convert client (screen) coordinates to canvas coordinates. * * @returns The canvas coordinates. */ posFromClient(arg1: unknown): unknown; /** * Convert DOM pixel coordinates to canvas coordinates. * * @returns The canvas coordinates. */ posFromDom(arg1: unknown): unknown; /** * Convert a DOM event's position to canvas coordinates. * * @returns The canvas coordinates. */ posFromEvt(arg1: unknown): unknown; /** * Check whether a position is within the current viewport. * * @returns Whether the position is in the viewport. */ posInViewport(arg1: unknown): unknown; /** * Push the current canvas state onto the undo history stack. * * @returns The result of pushing the history state. */ pushHistory(arg1: unknown): unknown; /** * Redo the last undone action. * * @returns The result of the redo operation. */ redo(): unknown; /** * Remove an edge from the canvas. * * @returns The result of removing the edge. */ removeEdge(arg1: unknown): unknown; /** * Remove a node from the canvas. * * @returns The result of removing the node. */ removeNode(arg1: unknown): unknown; /** * Render snap point guide lines for alignment. * * @returns The result of rendering snap points. */ renderSnapPoints(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; /** * Request an animation frame for rendering. * * @returns The animation frame request ID. */ requestFrame(arg1: unknown): unknown; /** * Request saving the canvas data to disk. * * @returns The result of requesting save. */ requestSave(arg1: unknown): unknown; /** * Force a re-render of all items in the viewport. * * @returns The result of re-rendering the viewport. */ rerenderViewport(): unknown; /** * Add an item to the current selection. * * @returns The result of selecting the item. */ select(arg1: unknown): unknown; /** * Select all nodes and edges on the canvas. * * @returns The result of selecting all items. */ selectAll(arg1: unknown): unknown; /** * Select only the specified item, deselecting everything else. * * @returns The result of selecting only the item. */ selectOnly(arg1: unknown): unknown; /** * Set the canvas data, replacing existing nodes and edges. * * @returns The result of setting the data. */ setData(arg1: unknown): unknown; /** * Set the dragging state of the canvas. * * @returns The result of setting the dragging state. */ setDragging(arg1: unknown): unknown; /** * Set the read-only state of the canvas. * * @returns The result of setting the read-only state. */ setReadonly(arg1: unknown): unknown; /** * Set the viewport state (position, zoom). * * @returns The result of setting the state. */ setState(arg1: unknown): unknown; /** * Set the viewport position and zoom level. * * @returns The result of setting the viewport. */ setViewport(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Show the node creation menu at the specified position. * * @returns The result of showing the creation menu. */ showCreationMenu(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Show the quick settings menu for canvas options. * * @returns The result of showing the quick settings menu. */ showQuickSettingsMenu(arg1: unknown): unknown; /** * Perform a smart zoom operation (toggle between zoom levels). * * @returns The result of the smart zoom. */ smartZoom(arg1: unknown): unknown; /** * Capture a screenshot of the canvas. * * @returns The captured screenshot. */ takeScreenshot(arg1: unknown, arg2: unknown): Promise<unknown>; /** * Toggle grid snapping on or off. * * @returns The result of toggling grid snapping. */ toggleGridSnapping(arg1: unknown): unknown; /** * Toggle object-to-object snapping on or off. * * @returns The result of toggling object snapping. */ toggleObjectSnapping(arg1: unknown): unknown; /** * Toggle the selection state of an item. * * @returns The result of toggling the selection. */ toggleSelect(arg1: unknown): unknown; /** * Undo the last action. * * @returns The result of the undo operation. */ undo(): unknown; /** * Unload and clean up the canvas resources. * * @returns The result of unloading the canvas. */ unload(): unknown; /** * Update the file open state for workspace tracking. * * @returns The result of updating the file open state. */ updateFileOpen(arg1: unknown): unknown; /** * Update the undo/redo button enabled states. * * @returns The result of updating the history UI. */ updateHistoryUI(): unknown; /** * Update the visual state of the current selection. * * @returns The result of updating the selection. */ updateSelection(arg1: unknown): unknown; /** * Virtualize off-screen nodes to improve performance. * * @returns The result of virtualizing nodes. */ virtualize(): unknown; /** * Zoom the viewport by a delta amount at the specified center point. * * @returns The result of zooming. */ zoomBy(arg1: unknown, arg2: unknown): unknown; /** * Zoom the viewport to fit the specified bounding box. * * @returns The result of zooming to the bounding box. */ zoomToBbox(arg1: unknown): unknown; /** * Zoom the viewport to fit all canvas content. * * @returns The result of zooming to fit. */ zoomToFit(): unknown; /** * Zoom the viewport to fit the current selection. * * @returns The result of zooming to the selection. */ zoomToSelection(): unknown; } /** * Represents a connection (edge) between two nodes on the canvas. * * @public * @unofficial */ export interface CanvasViewCanvasEdge { /** * Bounding box of the edge for spatial indexing. */ bbox: BBox; /** * {@link Bezier} curve data used for rendering the edge path. */ bezier: Bezier; /** * Reference to the parent canvas instance. */ canvas: CanvasViewCanvas; /** * Color of the edge line (CSS color string or preset name). */ color: string; /** * Link information for the source endpoint of the edge. */ from: CanvasViewCanvasEdgeLink; /** * Line end marker at the source endpoint, or `null` if none. */ fromLineEnd: CanvasViewCanvasEdgeLineEnd | null; /** * Unique identifier for this edge. */ id: string; /** * Whether the edge has been initialized. */ initialized: boolean; /** * Whether the edge is currently attached to the canvas DOM. */ isAttached?: unknown; /** * Text label displayed on the edge. */ label: string; /** * SVG group element containing the line end markers. */ lineEndGroupEl: SVGGElement; /** * SVG group element containing the edge line paths. */ lineGroupEl: SVGGElement; /** * SVG path elements for the edge (display and interaction). */ path: CanvasViewCanvasEdgePath; /** * Link information for the target endpoint of the edge. */ to: CanvasViewCanvasEdgeLink; /** * Line end marker at the target endpoint, or `null` if none. */ toLineEnd: CanvasViewCanvasEdgeLineEnd | null; /** * Additional data properties not covered by known fields. */ unknownData: object; /** * Attach the edge to the canvas DOM. * * @returns The result of attaching the edge. */ attach(): unknown; /** * Remove focus from the edge. * * @returns The result of removing focus. */ blur(): unknown; /** * Create a line end marker element for the specified end type. * * @returns The created edge end element. */ createEdgeEnd(arg1: unknown): unknown; /** * Deselect the edge. * * @returns The result of deselecting the edge. */ deselect(): unknown; /** * Destroy the edge and release its resources. * * @returns The result of destroying the edge. */ destroy(): unknown; /** * Detach the edge from the canvas DOM. * * @returns The result of detaching the edge. */ detach(): unknown; /** * Open an inline editor for the edge's label. * * @returns The result of opening the label editor. */ editLabel(): unknown; /** * Set focus on the edge. * * @returns The result of focusing the edge. */ focus(): unknown; /** * Get the bounding box of the edge. * * @returns The bounding box. */ getBBox(): unknown; /** * Get the center point of the edge path. * * @returns The center point. */ getCenter(): unknown; /** * Get the serialized data for this edge. * * @returns The edge data. */ getData(): unknown; /** * Initialize the edge after construction. * * @returns The result of initializing the edge. */ initialize(): unknown; /** * Handle click events on the edge. * * @returns The result of handling the click. */ onClick(arg1: unknown): unknown; /** * Handle pointer down on a connection point to start re-routing. * * @returns The result of handling the connection pointer down. */ onConnectionPointerdown(arg1: unknown): unknown; /** * Handle context menu events on the edge. * * @returns The result of handling the context menu. */ onContextMenu(arg1: unknown): unknown; /** * Render the edge to the canvas. * * @returns The result of rendering the edge. */ render(): unknown; /** * Mark the edge as selected. * * @returns The result of selecting the edge. */ select(): unknown; /** * Set the color of the edge. * * @returns The result of setting the color. */ setColor(arg1: unknown, arg2: unknown): unknown; /** * Set the serialized data for this edge. * * @returns The result of setting the data. */ setData(arg1: unknown): unknown; /** * Set the text label of the edge. * * @returns The result of setting the label. */ setLabel(arg1: unknown): unknown; /** * Show the context menu for this edge. * * @returns The result of showing the menu. */ showMenu(arg1: unknown, arg2: unknown): unknown; /** * Update the edge after its connected nodes have moved. * * @returns The result of updating the edge. */ update(arg1: unknown, arg2: unknown): unknown; /** * Recalculate and update the SVG path of the edge. * * @returns The result of updating the path. */ updatePath(): unknown; } /** * Represents the visual endpoint (arrow, dot, etc.) at one end of a canvas edge. * * @public * @unofficial */ export interface CanvasViewCanvasEdgeLineEnd { /** * SVG group element containing the line end marker. */ el: SVGGElement; /** * Type of the line end marker (e.g., 'arrow', 'none'). */ type: string; } /** * Represents one endpoint of a canvas edge, linking it to a specific side of a node. * * @public * @unofficial */ export interface CanvasViewCanvasEdgeLink { /** * Which end of the edge this link represents ('from' or 'to'). */ end: string; /** * The node this edge endpoint is connected to. */ node: CanvasViewCanvasNode; /** * The side of the node where this edge connects (e.g., 'top', 'bottom', 'left', 'right'). */ side: string; } /** * SVG path elements for rendering a canvas edge, with separate paths for display and interaction. * * @public * @unofficial */ export interface CanvasViewCanvasEdgePath { /** * SVG path element used for the visible edge rendering. */ display: SVGPathElement; /** * SVG path element used as a wider invisible hit area for interaction. */ interaction: SVGPathElement; } /** * Represents a node on the canvas with position, size, content, and connection capabilities. * * @public * @unofficial */ export interface CanvasViewCanvasNode extends CanvasViewCanvasNodeBase { /** * Whether this node should always remain loaded even when off-screen. */ alwaysKeepLoaded: boolean; /** * Reference to the Obsidian app instance. */ app: App; /** * Aspect ratio of the node (width / height). */ aspectRatio: number; /** * Bounding box of the node for spatial indexing. */ bbox: BBox; /** * Reference to the parent canvas instance. */ canvas: CanvasViewCanvas; /** * Child editor view for the node's content. */ child: WidgetEditorView; /** * Color of the node (CSS color string or preset name). */ color: string; /** * Outermost container element of the node. */ containerEl: HTMLDivElement; /** * Overlay element that blocks interaction with content when not editing. */ contentBlockerEl: HTMLDivElement; /** * Element containing the node's editable content. */ contentEl: HTMLDivElement; /** * Whether the node has been destroyed. */ destroyed: boolean; /** * Reference to the associated file, if this is a file node. */ file: TFile; /** * Path to the associated file, if this is a file node. */ filePath: string; /** * Height of the node in canvas units. */ height: number; /** * Unique identifier for this node. */ id: string; /** * Whether the node has been initialized. */ initialized: boolean; /** * Whether the node's content is currently mounted in the DOM. */ isContentMounted: boolean; /** * Whether the node is currently in editing mode. */ isEditing: boolean; /** * Main node element for rendering. */ nodeEl: HTMLDivElement; /** * Placeholder element shown while the node content is loading. */ placeholderEl: HTMLDivElement; /** * The last rendered z-index value. */ renderedZIndex: number; /** * Whether the node needs to recalculate its size. */ resizeDirty: boolean; /** * Subpath within the linked file (e.g., heading or block reference). */ subpath: string; /** * Additional data properties not covered by known fields. */ unknownData: CanvasViewCanvasNodeUnknownData; /** * Width of the node in canvas units. */ width: number; /** * X coordinate of the node's top-left corner in canvas space. */ x: number; /** * Y coordinate of the node's top-left corner in canvas space. */ y: number; /** * Z-index stacking order of the node. */ zIndex: number; /** * Remove focus from the node. * * @returns The result of removing focus. */ blur(): unknown; /** * Set focus on the node. * * @returns The result of focusing the node. */ focus(): unknown; /** * Get the serialized data for this node. * * @returns The node data. */ getData(): unknown; /** * Initialize the file association for a file-type node. * * @returns The result of initializing the file. */ initFile(): unknown; /** * Initialize the node after construction. * * @returns The result of initializing the node. */ initialize(): unknown; /** * Handle the node's file receiving focus. * * @returns The result of handling the file focus. */ onFileFocus(): unknown; /** * Handle click events on the node's label. * * @returns The result of handling the label click. */ onLabelClick(arg1: unknown): unknown; /** * Handle double-click events on the node's label. * * @returns The result of handling the label double-click. */ onLabelDblClick(arg1: unknown): unknown; /** * Handle pointer down events on the node. * * @returns The result of handling the pointer down. */ onPointerdown(arg1: unknown): unknown; /** * Render the node to the canvas. * * @returns The result of rendering the node. */ render(): unknown; /** * Set the serialized data for this node. * * @returns The result of setting the data. */ setData(arg1: unknown): unknown; /** * Set the file associated with this node. * * @returns The result of setting the file. */ setFile(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Set the file path for this node. * * @returns The result of setting the file path. */ setFilePath(arg1: unknown, arg2: unknown): unknown; /** * Show the context menu for this node. * * @returns The result of showing the menu. */ showMenu(arg1: unknown): unknown; /** * Update the rendering breakpoint based on the node's current size. * * @returns The result of updating the breakpoint. */ updateBreakpoint(arg1: unknown): unknown; /** * Update the displayed label text of the node. * * @returns The result of updating the node label. */ updateNodeLabel(arg1: unknown): unknown; } /** * Base interface for canvas nodes, providing core editing and interaction methods. * * @public * @unofficial */ export interface CanvasViewCanvasNodeBase extends CanvasViewCanvasNodeBaseBase { /** * Remove focus from the node. * * @returns The result of removing focus. */ blur(): unknown; /** * Destroy the node and release its resources. * * @returns The result of destroying the node. */ destroy(): unknown; /** * Set focus on the node. * * @returns The result of focusing the node. */ focus(): unknown; /** * Initialize the node after construction. * * @returns The result of initializing the node. */ initialize(): unknown; /** * Check whether this node supports editing. * * @returns Whether the node is editable. */ isEditable(): unknown; /** * Move and resize the node to the specified bounds. * * @returns The result of moving and resizing. */ moveAndResize(arg1: unknown): unknown; /** * Handle click events on the node. * * @returns The result of handling the click. */ onClick(arg1: unknown): unknown; /** * Handle double-click on a resize handle to auto-size the node. * * @returns The result of handling the resize double-click. */ onResizeDblclick(arg1: unknown, arg2: unknown): unknown; /** * Render the node to the canvas. * * @returns The result of rendering the node. */ render(): unknown; /** * Enter editing mode for the node's content. * * @returns The result of starting editing. */ startEditing(arg1?: unknown): unknown; /** * Unload the child editor view. * * @returns The result of unloading the child. */ unloadChild(): unknown; } /** * Intermediate base interface for canvas nodes, adding lifecycle and content mounting methods. * * @public * @unofficial */ export interface CanvasViewCanvasNodeBaseBase extends CanvasViewCanvasNodeBaseBaseBase { /** * Attach the node to the canvas DOM. * * @returns The result of attaching the node. */ attach(): unknown; /** * Detach the node from the canvas DOM. * * @returns The result of detaching the node. */ detach(): unknown; /** * Initialize the node after construction. * * @returns The result of initializing the node. */ initialize(): unknown; /** * Mount the node's content into the content container. * * @returns The result of mounting the content. */ mountContent(): unknown; /** * Perform cleanup before detaching the node. * * @returns The result of pre-detach cleanup. */ preDetach(): unknown; /** * Unmount the node's content from the content container. * * @returns The result of unmounting the content. */ unmountContent(): unknown; /** * Update the rendering breakpoint based on the node's current size. * * @returns The result of updating the breakpoint. */ updateBreakpoint(arg1: unknown): unknown; } /** * Lowest-level base interface for canvas nodes, providing core properties and interaction methods. * * @public * @unofficial */ export interface CanvasViewCanvasNodeBaseBaseBase { /** * Whether the node is currently attached to the canvas DOM. */ isAttached?: unknown; /** * Whether the node currently has focus. */ isFocused?: unknown; /** * Bounding rectangle of the node. */ rect: CanvasRect; /** * Attach the node to the canvas DOM. * * @returns The result of attaching the node. */ attach(): unknown; /** * Remove focus from the node. * * @returns The result of removing focus. */ blur(): unknown; /** * Deselect the node. * * @returns The result of deselecting the node. */ deselect(): unknown; /** * Destroy the node and release its resources. * * @returns The result of destroying the node. */ destroy(): unknown; /** * Detach the node from the canvas DOM. * * @returns The result of detaching the node. */ detach(): unknown; /** * Set focus on the node. * * @returns The result of focusing the node. */ focus(): unknown; /** * Get the bounding box of the node. * * @returns The bounding box. */ getBBox(): unknown; /** * Get all files connected to this node via edges. * * @returns The connected files. */ getConnectedFiles(): unknown; /** * Get the serialized data for this node. * * @returns The node data. */ getData(): unknown; /** * Initialize the node after construction. * * @returns The result of initializing the node. */ initialize(): unknown; /** * Check whether this node supports editing. * * @returns Whether the node is editable. */ isEditable(): unknown; /** * Move and resize the node to the specified bounds. * * @returns The result of moving and resizing. */ moveAndResize(arg1: unknown): unknown; /** * Move the node to the specified position. * * @returns The result of moving the node. */ moveTo(arg1: unknown): unknown; /** * Handle click events on the node. * * @returns The result of handling the click. */ onClick(arg1: unknown): unknown; /** * Handle pointer down on a connection handle to start edge creation. * * @returns The result of handling the connection pointer down. */ onConnectionPointerdown(arg1: unknown, arg2: unknown): unknown; /** * Handle context menu events on the node. * * @returns The result of handling the context menu. */ onContextMenu(arg1: unknown): unknown; /** * Handle pointer down events on the node. * * @returns The result of handling the pointer down. */ onPointerdown(arg1: unknown): unknown; /** * Handle double-click on a resize handle to auto-size the node. * * @returns The result of handling the resize double-click. */ onResizeDblclick(arg1: unknown, arg2: unknown): unknown; /** * Handle pointer down on a resize handle to start resizing. * * @returns The result of handling the resize pointer down. */ onResizePointerdown(arg1: unknown, arg2: unknown): unknown; /** * Perform cleanup before detaching the node. * * @returns The result of pre-detach cleanup. */ preDetach(): unknown; /** * Render the node to the canvas. * * @returns The result of rendering the node. */ render(): unknown; /** * Render the node's z-index CSS property. * * @returns The result of rendering the z-index. */ renderZIndex(): unknown; /** * Resize the node to the specified dimensions. * * @returns The result of resizing the node. */ resize(arg1: unknown): unknown; /** * Mark the node as selected. * * @returns The result of selecting the node. */ select(): unknown; /** * Set the color of the node. * * @returns The result of setting the color. */ setColor(arg1: unknown, arg2: unknown): unknown; /** * Set the serialized data for this node. * * @returns The result of setting the data. */ setData(arg1: unknown): unknown; /** * Set whether the node is in editing mode. * * @returns The result of setting the editing state. */ setIsEditing(arg1: unknown): unknown; /** * Show the context menu for this node. * * @returns The result of showing the menu. */ showMenu(arg1: unknown): unknown; /** * Enter editing mode for the node's content. * * @returns The result of starting editing. */ startEditing(): unknown; /** * Update the rendering breakpoint based on the node's current size. * * @returns The result of updating the breakpoint. */ updateBreakpoint(arg1: unknown): unknown; /** * Update the z-index of the node in the stacking order. * * @returns The result of updating the z-index. */ updateZIndex(): unknown; } /** * Base data shared by all canvas node types. * * @public * @unofficial */ export interface CanvasViewCanvasNodeUnknownData { /** * Path to the associated file. */ file: string; /** * Unique identifier of the node. */ id: string; /** * Type of the canvas node (e.g. "text", "file", "link", "group"). */ type: string; } /** * Configuration options for the canvas view. * * @public * @unofficial */ export interface CanvasViewConfig { /** * Default dimensions for newly created file nodes. */ defaultFileNodeDimensions: Dimensions; /** * Default dimensions for newly created text nodes. */ defaultTextNodeDimensions: Dimensions; /** * Minimum dimension (width or height) for container/group nodes. */ minContainerDimension: number; /** * Distance threshold in pixels for snapping objects to each other. */ objectSnapDistance: number; /** * Multiplier applied to zoom increments. */ zoomMultiplier: number; } /** * Serialized canvas data containing all nodes and edges. * * @public * @unofficial */ export interface CanvasViewData { /** * Array of serialized edge data for all connections in the canvas. */ edges: CanvasViewDataEdge[]; /** * Array of serialized node data for all nodes in the canvas. */ nodes: CanvasViewDataNode[]; } /** * Serialized data representation of an edge (connection) between two nodes in the canvas. * * @public * @unofficial */ export interface CanvasViewDataEdge { /** * ID of the source node. */ fromNode: string; /** * {@link obsidian#Side} of the source node where the edge originates (e.g., 'top', 'bottom', 'left', 'right'). */ fromSide: string; /** * Unique identifier for this edge. */ id: string; /** * ID of the target node. */ toNode: string; /** * {@link obsidian#Side} of the target node where the edge terminates (e.g., 'top', 'bottom', 'left', 'right'). */ toSide: string; } /** * Serialized data for a canvas node. * * @public * @unofficial */ export interface CanvasViewDataNode extends CanvasViewCanvasNodeUnknownData { /** * Height of the node in pixels. */ height: number; /** * Subpath within the file (e.g. heading or block reference). */ subpath?: unknown; /** * Width of the node in pixels. */ width: number; /** * X position of the node on the canvas. */ x: number; /** * Y position of the node on the canvas. */ y: number; } /** * Manages undo/redo history for canvas state changes. * * @public * @unofficial */ export interface CanvasViewHistory { /** * Index of the current state in the history stack. */ current: number; /** * Array of historical canvas states. */ data: CanvasViewData[]; /** * Maximum number of history entries to retain. */ max: number; /** * Check whether a redo operation is available. * * @returns Whether redo is available. */ canRedo(): unknown; /** * Check whether an undo operation is available. * * @returns Whether undo is available. */ canUndo(): unknown; /** * Clear all history entries. * * @returns The result of clearing the history. */ clear(): unknown; /** * Push a new state onto the history stack. * * @returns The result of pushing the state. */ push(arg1: unknown): unknown; /** * Redo the last undone action and return the restored state. * * @returns The restored state. */ redo(): unknown; /** * Replace the current history entry with a new state. * * @returns The result of replacing the history entry. */ replace(arg1: unknown): unknown; /** * Undo the last action and return the previous state. * * @returns The previous state. */ undo(): unknown; } /** * File system adapter for Capacitor (mobile) platform. * * @public * @unofficial */ export interface CapacitorAdapterFs { /** * Base directory path for the file system, or `null` if not initialized. */ dir: null | string; /** * Base URI for the file system. */ uri: string; /** * Append text data to a file. * * @param realPath - Real file system path. * @param data - Text data to append. * @returns A promise that resolves when the data is appended. * To extract the constructor type, use {@link ExtractConstructor | ExtractConstructor\<CapacitorAdapterFs\>}. */ append(realPath: string, data: string): Promise<void>; /** * Constructor. * * To extract the constructor type, use {@link ExtractConstructor | ExtractConstructor\<CapacitorAdapterFs\>}. * * @param dir - The dir. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(dir: string): this; /** * Copy a file to a new path. * * @param realPath - Source file path. * @param newRealPath - Destination file path. * @returns A promise that resolves when the file is copied. */ copy(realPath: string, newRealPath: string): Promise<void>; /** * Delete a file at the given path. * * @param realPath - File path to delete. * @returns A promise that resolves when the file is deleted. */ delete(realPath: string): Promise<void>; /** * Check whether a file exists at the given path. * * @param realPath - File path to check. * @returns Whether the file exists. */ exists(realPath: string): Promise<boolean>; /** * Get the native platform URI for a file path. * * @param realPath - File path. * @returns Native URI string. */ getNativeUri(realPath: string): string; /** * Get the URI for a file path. * * @param realPath - File path. * @returns URI string. */ getUri(realPath: string): string; /** * Initialize the file system adapter. * * @returns A promise that resolves when the adapter is initialized. */ init(): Promise<void>; /** * Create a directory at the given path. * * @param realPath - Directory path to create. * @returns A promise that resolves when the directory is created. */ mkdir(realPath: string): Promise<void>; /** * Open a file using the native platform handler. * * @param realPath - File path to open. * @returns A promise that resolves when the file is opened. */ open(realPath: string): Promise<void>; /** * Read a file as text. * * @param realPath - File path to read. * @returns Text content of the file. */ read(realPath: string): Promise<string>; /** * Read a file as binary data. * * @param realPath - File path to read. * @returns Binary content of the file. */ readBinary(realPath: string): Promise<ArrayBuffer>; /** * List entries in a directory. * * @param realPath - Directory path to list. * @returns Array of file entries in the directory. */ readdir(realPath: string): Promise<CapacitorFileEntry[]>; /** * Rename or move a file to a new path. * * @param realPath - Current file path. * @param newRealPath - New file path. * @returns A promise that resolves when the file is renamed. */ rename(realPath: string, newRealPath: string): Promise<void>; /** * Remove a directory. * * @param realPath - Directory path to remove. * @returns A promise that resolves when the directory is removed. */ rmdir(realPath: string): Promise<void>; /** * Set the creation and modification times for a file. * * @param realPath - File path. * @param ctime - Creation time in milliseconds. * @param mtime - Modification time in milliseconds. * @returns A promise that resolves when the times are set. */ setTimes(realPath: string, ctime: number, mtime: number): Promise<void>; /** * Get file statistics for the given path. * * @param realPath - File path to stat. * @returns File entry with statistics. */ stat(realPath: string): Promise<CapacitorFileEntry>; /** * Move a file to the system trash. * * @param realPath - File path to trash. * @returns A promise that resolves when the file is trashed. */ trash(realPath: string): Promise<void>; /** * Verify and download an iCloud file if it is not yet available locally. * * @param realPath - File path to verify. * @returns A promise that resolves when the iCloud file is verified. */ verifyIcloud(realPath: string): Promise<void>; /** * Start watching a path for file system changes. * * @param realPath - Path to watch. * @returns A promise that resolves when the watcher is started. */ watch(realPath: string): Promise<void>; /** * Watch a path and return stat information for all contained files. * * @param realPath - Path to watch and stat. * @returns Stat results for all files in the watched path. */ watchAndStatAll(realPath: string): Promise<WatchAndStatAllResult>; /** * Write text data to a file. * * @param realPath - File path to write to. * @param data - Text data to write. * @returns A promise that resolves when the file is written. */ write(realPath: string, data: string): Promise<void>; /** * Write binary data to a file. * * @param realPath - File path to write to. * @param data - Binary data to write. * @returns A promise that resolves when the file is written. */ writeBinary(realPath: string, data: ArrayBuffer): Promise<void>; /** * Write binary data to a file using the internal storage path. * * @param realPath - File path to write to. * @param data - Binary data to write. * @returns A promise that resolves when the file is written. */ writeBinaryInternal(realPath: string, data: ArrayBuffer): Promise<void>; } /** * File or directory entry from the Capacitor (mobile) file system. * * @public * @unofficial */ export interface CapacitorFileEntry extends Partial<FileStats> { /** * Name of the file or directory. */ name: string; /** * Whether this entry is a file or directory. */ type: "directory" | "file"; /** * URI of the file or directory. */ uri: string; } /** * Capacitor global instance. * * @public * @unofficial */ export interface CapacitorGlobal { /** Whether debug mode is enabled. */ DEBUG?: boolean; /** Capacitor exception class. */ Exception: typeof CapacitorException; /** Whether logging is enabled. */ isLoggingEnabled?: boolean; /** Whether the platform is native. `@deprecated` Deprecated. */ isNative?: boolean; /** Platform name. `@deprecated` Deprecated. */ platform?: string; /** Plugin registry. `@deprecated` Deprecated. */ Plugins: PluginRegistry; /** Plugin registration function. */ registerPlugin: RegisterPlugin; /** * Adds a listener for a plugin event. * * @param pluginName - Plugin name. * @param eventName - Event name. * @param callback - Event callback. * @returns Plugin listener handle. */ addListener?(pluginName: string, eventName: string, callback: PluginCallback): PluginListenerHandle; /** * Converts a file path to a source URL. * * @param filePath - File path. * @returns Source URL. */ convertFileSrc(filePath: string): string; /** * Gets the current platform name. * * @returns Platform name. */ getPlatform(): string; /** * Checks if the platform is native. * * @returns Whether the platform is native. */ isNativePlatform(): boolean; /** * Checks if a plugin is available. * * @param name - Plugin name. * @returns Whether the plugin is available. */ isPluginAvailable(name: string): boolean; /** * No-op for plugin methods. * * @param target - Target object. * @param key - Property key. * @param pluginName - Plugin name. * @returns Never-resolving promise. * @deprecated Deprecated. */ pluginMethodNoop(target: unknown, key: PropertyKey, pluginName: string): Promise<never>; /** * Removes a listener for a plugin event. * * @param pluginName - Plugin name. * @param callbackId - Callback ID. * @param eventName - Event name. * @param callback - Event callback. */ removeListener?(pluginName: string, callbackId: string, eventName: string, callback: PluginCallback): void; } /** * Capacitor platform. * * @public * @unofficial */ export interface CapacitorPlatform { /** Platform name. */ name: string; /** * Gets the platform name. * * @returns Platform name. */ getPlatform?(): string; /** * Gets a plugin header. * * @param pluginName - Plugin name. * @returns Plugin header or `undefined`. */ getPluginHeader?(pluginName: string): PluginHeader | undefined; /** * Checks if the platform is native. * * @returns Whether the platform is native. */ isNativePlatform?(): boolean; /** * Checks if a plugin is available. * * @param pluginName - Plugin name. * @returns Whether the plugin is available. */ isPluginAvailable?(pluginName: string): boolean; /** * Registers a plugin. * * @param pluginName - Plugin name. * @param jsImplementations - Plugin implementations. * @returns Registered plugin. */ registerPlugin?(pluginName: string, jsImplementations: PluginImplementations): unknown; } /** * Capacitor platforms global. * * @public * @unofficial */ export interface CapacitorPlatformsGlobal { /** Current platform. */ currentPlatform: CapacitorPlatform; /** Registered platforms. */ platforms: Map<string, CapacitorPlatform>; /** * Adds a platform. * * @param name - Platform name. * @param platform - Platform instance. */ addPlatform(name: string, platform: CapacitorPlatform): void; /** * Sets the current platform. * * @param name - Platform name. */ setPlatform(name: string): void; } /** * Function `Ceil`. * * @public * @unofficial */ export interface CeilFunction extends BasesFunction, HasGetDisplayName { } /** * Result returned by the callback passed to {@link @codemirror/state#EditorState.changeByRange}. * * @public * @unofficial */ export interface ChangeByRangeResult { /** The updated changes. */ changes?: ChangeSpec; /** The updated effects. */ effects?: readonly StateEffect<unknown>[] | StateEffect<unknown>; /** The updated range. */ range: SelectionRange; } /** * Result returned from {@link @codemirror/state#EditorState.changeByRange}. * * @public * @unofficial */ export interface ChangeByRangeReturn { /** The combined change set. */ changes: ChangeSet; /** The combined effects. */ effects: readonly StateEffect<unknown>[]; /** The updated selection. */ selection: CmEditorSelection; } /** * 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. */ onFocus(): void; /** * Set the value of the property widget. * * @param value - The value to set. */ setValue(value: unknown): void; } /** * Command-line interface handler for Obsidian. * * @public * @unofficial */ export interface Cli { /** * Reference to the app. */ app: App; /** * Registered CLI command handlers. */ handlers: Map<string, CliHandlerEntry>; /** * Constructor. * * To get the constructor instance, use {@link getCliConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App): this; /** * Format tree nodes as an ASCII tree. * * @param nodes - The tree nodes to format. * @param prefix - The indentation prefix for nested nodes. * @returns The formatted ASCII tree string. */ formatAsciiTree(nodes: CliTreeNode[], prefix?: string): string; /** * Format a root label and child nodes as an ASCII tree. * * @param root - The root label. * @param children - The child tree nodes. * @returns The formatted ASCII tree string with root. */ formatAsciiTreeWithRoot(root: string, children: CliTreeNode[]): string; /** * Format two strings as a unified diff. * * @param oldText - The original text. * @param newText - The modified text. * @param oldName - The label for the original text. * @param newName - The label for the modified text. * @returns The formatted diff string. */ formatDiff(oldText: string, newText: string, oldName: string, newName: string): string; /** * Format data as a table in JSON, CSV, or TSV format. * * @param headers - Column header names. * @param rows - Row data as arrays of strings. * @param format - Output format. * @returns The formatted table string. */ formatTable(headers: string[], rows: string[][], format: "csv" | "json" | "tsv"): string; /** * Initialize the CLI handler, registering the global `handleCli` function. */ init(): void; /** * Register a CLI command handler. * * @param id - The command identifier. * @param description - Description shown in help. * @param flags - Flags accepted by this command, or `null` for none. * @param handler - The handler function. */ registerHandler(id: string, description: string, flags: null | Record<string, CliFlag>, handler: (...args: unknown[]) => unknown): void; /** * Try to resolve a file from CLI input parameters. * * @param params - Parameters for trying to resolve a file. * @param requireFile - Whether a file is required (throws if not found when `true`). * @returns The resolved file. */ tryResolveFile(params: TryResolveFileParams, requireFile?: boolean): TFile; /** * Unregister a CLI command handler. * * @param id - The command identifier to unregister. * @param handler - Optional handler function to match before unregistering. */ unregisterHandler(id: string, handler?: (...args: unknown[]) => unknown): void; } /** * Entry stored in the CLI handlers map. * * @public * @unofficial */ export interface CliHandlerEntry { /** * Description shown in help. */ description: string; /** * Flags accepted by this handler. */ flags?: Record<string, CliFlag>; /** * The handler function. */ handler(...args: unknown[]): unknown; } /** * A node in a CLI ASCII tree. * * @public * @unofficial */ export interface CliTreeNode { /** * Child nodes. */ children?: CliTreeNode[]; /** * Label text for this tree node. */ label: string; } /** * Represents a clickable token in the editor (e.g. link, tag). * * @public * @unofficial */ export interface ClickableToken { /** * End position of the token in the editor. */ end: EditorPosition; /** * Start position of the token in the editor. */ start: EditorPosition; /** * Text content of the token. */ text: string; /** * Type of clickable token (e.g. "internal-link", "external-link", "tag"). */ type: string; } /** * Manager for clipboard operations in the markdown editor, handling paste, drag, and drop. * * @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. * * @returns Current editor view path. */ getPath(): string; /** * Process incoming data (image, text, url, html). * * @param data - The data transfer object. * @returns `null` or a promise for async HTML processing. * @remark When processing HTML, function will be async. */ handleDataTransfer(data: DataTransfer): null | Promise<void>; /** * Handle an incoming drag-over event. * * @param event - The drag event. */ handleDragOver(event: DragEvent): void; /** * Handle an incoming drag-drop event. * * @param event - The drag event. * @returns Whether the drop was handled. */ handleDrop(event: DragEvent): boolean; /** * Process a drop event into the editor. * * @param event - The drag event. * @returns The inserted text, or `null`. */ handleDropIntoEditor(event: DragEvent): null | string; /** * Handle an incoming paste event. * * @param event - The clipboard event. * @returns Whether the paste was handled. */ handlePaste(event: ClipboardEvent): boolean; /** * Insert single file as embed into the editor. * * @param file - File to embed. * @param replace - Whether to replace the current selection. * @returns A promise that resolves when the embed is inserted. */ insertAttachmentEmbed(file: TAbstractFile, replace: boolean): Promise<void>; /** * Insert files from drop-event into the editor. * * @param importedAttachments - Attachments to insert. * @returns A promise that resolves when all files are inserted. */ insertFiles(importedAttachments: ImportedAttachment[]): Promise<void>; /** * Save an attachment of specified name and extension to the vault. * * @param name - Attachment file name. * @param extension - File extension. * @param data - Binary data of the attachment. * @param replace - Whether to replace the current selection. * @returns A promise that resolves when the attachment is saved. * @remark Invokes insertAttachmentEmbed. */ saveAttachment(name: string, extension: string, data: ArrayBuffer, replace: boolean): Promise<void>; } /** * Parameters for cloning a page viewport with overrides. * * @public * @unofficial */ export interface CloneViewportParams { /** Whether to flip the viewport. */ dontFlip?: boolean; /** Horizontal offset. */ offsetX?: number; /** Vertical offset. */ offsetY?: number; /** Rotation angle in degrees. */ rotation?: number; /** Scale factor. */ scale?: number; } /** * A closeable component that can get dismissed via the Android 'back' button. * * @public * @unofficial */ export interface CloseableComponent { /** * Close the component. */ close(): void; } /** * Options for creating a bookmark in CodeMirror 5. * * @public * @unofficial */ export interface Cm5BookmarkOptions { /** Whether CodeMirror handles mouse events on the bookmark widget. */ handleMouseEvents?: boolean; /** Whether text typed at the bookmark position goes to the left of it. */ insertLeft?: boolean; /** Whether the bookmark appears in all linked documents. */ shared?: boolean; /** A DOM node to display at the bookmark position. */ widget?: HTMLElement; } /** * A CodeMirror 5 editor instance. * * @public * @unofficial */ export interface Cm5Editor extends Doc { /** The display object containing the wrapper element. */ display: Cm5EditorDisplay; /** The editor state object. */ state: Cm5EditorState; /** * Adds a key map to the editor. * * @param map - The key map to add. * @param bottom - Whether to add the map at the bottom of the stack. */ addKeyMap(map: Cm5KeyMap | string, bottom?: boolean): void; /** * Set a CSS class name for the given line. * * @param line - The line number or handle. * @param where - Which element to apply the class to ("text", "background", or "wrap"). * @param className - The CSS class name. * @returns The line handle. */ addLineClass(line: Cm5LineHandle | number, where: string, className: string): Cm5LineHandle; /** * Adds a line widget below the given line. * * @param line - The line number or handle. * @param node - The DOM node to display. * @param options - Optional widget configuration. * @returns The created line widget. */ addLineWidget(line: Cm5LineHandle | number, node: HTMLElement, options?: Cm5LineWidgetOptions): Cm5LineWidget; /** * Adds a mode overlay to the editor. * * @param mode - The mode or mode name. * @param options - Optional overlay options. */ addOverlay(mode: unknown, options?: Cm5OverlayOptions): void; /** * Adds a new selection to the existing set of selections. * * @param anchor - The anchor position. * @param head - The optional head position. */ addSelection(anchor: Position, head?: Position): void; /** * Puts an absolutely positioned DOM node into the editor. * * @param pos - The position to place the widget at. * @param node - The DOM node. * @param scrollIntoView - Whether to scroll the widget into view. */ addWidget(pos: Position, node: HTMLElement, scrollIntoView: boolean): void; /** * Returns the coordinates for a character position. * * @param pos - The character position. * @param mode - The coordinate system to use. * @returns An object with `left`, `right`, `top`, and `bottom` properties. */ charCoords(pos: Position, mode?: Cm5CoordsMode): Cm5EditorCharCoords; /** Remove all gutter markers in the gutter with the given ID. */ clearGutter(gutterID: string): void; /** * Returns the position corresponding to the given coordinates. * * @param coords - The coordinates with `left` and `top` properties. * @param mode - The coordinate system used. * @returns The corresponding position. */ coordsChar(coords: Cm5EditorCoordsCharInput, mode?: Cm5CoordsMode): Position; /** * Returns the coordinates of the cursor. * * @param where - Whether to return the start or end of the selection. * @param mode - The coordinate system to use. * @returns An object with `left`, `top`, and `bottom` properties. */ cursorCoords(where?: boolean | Position, mode?: Cm5CoordsMode): Cm5EditorCursorCoords; /** * Returns the default character width. * * @returns The default character width in pixels. */ defaultCharWidth(): number; /** * Returns the default text height. * * @returns The default text height in pixels. */ defaultTextHeight(): number; /** Ends a buffered operation started with startOperation. */ endOperation(): void; /** * Executes a named command. * * @param name - The command name. */ execCommand(name: string): void; /** * Moves the head of the selection while leaving the anchor in place. * * @param from - The position to extend from. * @param to - Optional end of region to select. * @param options - Optional selection options. */ extendSelection(from: Position, to?: Position, options?: Cm5SelectionOptions): void; /** * Like extendSelection, but acts on all selections at once. * * @param heads - The new head positions. * @param options - Optional selection options. */ extendSelections(heads: Position[], options?: Cm5SelectionOptions): void; /** * Applies a function to all selections and calls extendSelections on the result. * * @param f - The function to apply to each range. */ extendSelectionsBy(f: (range: Cm5Range) => Position): void; /** * Finds the target position for horizontal cursor motion. * * @param start - The starting position. * @param amount - The number of units to move (may be negative). * @param unit - The unit ("char", "column", or "word"). * @param visually - Whether motion should be visual rather than logical. * @returns The target position, with `hitSide` set if the edge was reached. */ findPosH(start: Position, amount: number, unit: string, visually: boolean): Cm5FindPosResult; /** * Finds the target position for vertical cursor motion. * * @param start - The starting position. * @param amount - The number of units to move. * @param unit - The unit ("line" or "page"). * @returns The target position, with `hitSide` set if the edge was reached. */ findPosV(start: Position, amount: number, unit: string): Cm5FindPosResult; /** * Returns the start and end of the word at the given position. * * @param pos - The position. * @returns The range of the word. */ findWordAt(pos: Position): Cm5Range; /** * Gives focus to the editor. */ focus(): void; /** * Gets the associated document. * * @returns The document instance. */ getDoc(): Doc; /** Get the value of the 'extending' flag. */ getExtending(): boolean; /** * Returns the gutter element. * * @returns The gutter DOM element. */ getGutterElement(): HTMLElement; /** * Returns the input field element. * * @returns The input field DOM element. */ getInputField(): HTMLDivElement | HTMLTextAreaElement; /** * Retrieves a list of all tokens on the given line. * * @param line - The line number. * @param precise - Whether to use a more precise (but slower) algorithm. * @returns An array of tokens. */ getLineTokens(line: number, precise?: boolean): Cm5Token[]; /** * Gets the inner mode at a given position. * * @param pos - The position. * @returns The mode at that position. */ getModeAt(pos: Position): Cm5Mode<unknown>; /** * Gets the value of an option. * * @param option - The option name. * @returns The option value. */ getOption(option: string): unknown; /** * Returns the scroller element. * * @returns The scroller DOM element. */ getScrollerElement(): HTMLElement; /** * Returns scroll position and dimensions. * * @returns The scroll info object. */ getScrollInfo(): Cm5ScrollInfo; /** * Returns the mode's parser state at the end of the given line number. * * @param line - The line number. * @returns The parser state. */ getStateAfter(line?: number): unknown; /** * Retrieves information about the token at the given position. * * @param pos - The position. * @param precise - Whether to use a more precise algorithm. * @returns The token information. */ getTokenAt(pos: Position, precise?: boolean): Cm5Token; /** * Returns the token type at the given position. * * @param pos - The position. * @returns The token type string, or `null` for unstyled tokens. */ getTokenTypeAt(pos: Position): string; /** * Returns the start and end of the currently rendered part of the document. * * @returns An object with `from` and `to` properties. */ getViewport(): Cm5Viewport; /** * Returns the wrapper element. * * @returns The wrapper DOM element. */ getWrapperElement(): HTMLElement; /** * Tells whether the editor currently has focus. * * @returns `true` if the editor has focus. */ hasFocus(): boolean; /** * Computes the height of the top of a line. * * @param line - The line number or handle. * @param mode - The coordinate system. * @param includeWidgets - Whether to include line widgets. * @returns The height in pixels. */ heightAtLine(line: Cm5LineHandle | number, mode?: Cm5CoordsMode, includeWidgets?: boolean): number; /** * Adjusts the indentation of the given line. * * @param line - The line number. * @param dir - The indentation direction or mode. * @param aggressive - Whether to aggressively indent. */ indentLine(line: number, dir?: null | string, aggressive?: boolean): void; /** Indents the current selection. */ indentSelection(how: string): void; /** Tells you whether the editor's content can be edited by the user. */ isReadOnly(): boolean; /** * Computes the line at the given pixel height. * * @param height - The pixel height. * @param mode - The coordinate system. * @returns The line number. */ lineAtHeight(height: number, mode?: Cm5CoordsMode): number; /** * Returns information about the given line. * * @param line - The line number or handle. * @returns An object with line info properties. */ lineInfo(line: Cm5LineHandle | number): Cm5LineInfo; /** * Retrieves a list of all current selections. * * @returns An array of selection ranges. */ listSelections(): Cm5Range[]; /** * Removes an event listener. * * @param eventName - The event name. * @param handler - The handler to remove. */ off(eventName: string, handler: (...args: unknown[]) => void): void; /** * Registers an event listener. * * @param eventName - The event name. * @param handler - The handler to register. */ on(eventName: string, handler: (...args: unknown[]) => void): void; /** * Buffers all changes inside the function and only updates after it returns. * * @param fn - The function to execute. * @returns The return value of the function. */ operation<T>(fn: () => T): T; /** * Translates a string through the phrases option for i18n. * * @param text - The text to translate. * @returns The translated text. */ phrase(text: string): unknown; /** * Refreshes the editor display. */ refresh(): void; /** * Removes a key map from the editor. * * @param map - The key map to remove. */ removeKeyMap(map: Cm5KeyMap | string): void; /** * Remove a CSS class from a line. * * @param line - The line number or handle. * @param where - Which element ("text", "background", or "wrap"). * @param className - The class to remove (omit to remove all). * @returns The line handle. */ removeLineClass(line: Cm5LineHandle | number, where: string, className?: string): Cm5LineHandle; /** * Removes a line widget. * * @param widget - The widget to remove. */ removeLineWidget(widget: Cm5LineWidget): void; /** * Removes a mode overlay from the editor. * * @param mode - The mode or mode name to remove. */ removeOverlay(mode: unknown): void; /** * Replaces the content of the selections with the given strings. * * @param replacements - The replacement strings. * @param collapse - How to collapse the selection after replacement. * @param origin - Optional origin string. */ replaceSelections(replacements: string[], collapse?: null | string, origin?: null | string): void; /** * Scrolls the editor to the given position. * * @param pos - The position or rectangle to scroll into view. * @param margin - Optional margin in pixels. */ scrollIntoView(pos: Cm5EditorScrollRect | null | Position, margin?: number): void; /** * Scrolls the editor to the given coordinates. * * @param x - The horizontal scroll position. * @param y - The vertical scroll position. */ scrollTo(x?: null | number, y?: null | number): void; /** * Sets or clears the 'extending' flag. * * @param value - Whether to enable extending. */ setExtending(value: boolean): void; /** * Sets the gutter marker for the given gutter. * * @param line - The line number or handle. * @param gutterID - The gutter's CSS class identifier. * @param value - The marker element, or `null` to clear. * @returns The line handle. */ setGutterMarker(line: Cm5LineHandle | number, gutterID: string, value: HTMLElement | null): Cm5LineHandle; /** * Sets the value of an option. * * @param option - The option name. * @param value - The new value. */ setOption(option: string, value: unknown): void; /** * Sets a new set of selections. * * @param ranges - The selection ranges. * @param primary - The index of the primary selection. * @param options - Optional selection options. */ setSelections(ranges: Cm5SelectionRange[], primary?: number, options?: Cm5SelectionOptions): void; /** * Sets the editor size. * * @param width - The width (pixels or CSS unit). * @param height - The height (pixels or CSS unit). */ setSize(width: null | number | string, height: null | number | string): void; /** Starts a buffered operation. */ startOperation(): void; /** * Attaches a new document to the editor. * * @param doc - The new document. * @returns The old document. */ swapDoc(doc: Doc): Doc; /** * Switches between overwrite and normal insert mode. * * @param value - If given, sets overwrite mode to this value. */ toggleOverwrite(value?: boolean): void; } /** * Represents a change made to a CodeMirror 5 document. * * @public * @unofficial */ export interface Cm5EditorChange { /** The start position of the change. */ from: Position; /** The origin of the change. */ origin?: string; /** The text that was removed by the change. */ removed?: string[]; /** The new text that was inserted. */ text: string[]; /** The end position of the change. */ to: Position; } /** * A cancellable editor change object in CodeMirror 5. * * @public * @unofficial */ export interface Cm5EditorChangeCancellable extends Cm5EditorChange { /** * Cancels the change. */ cancel(): void; /** * Modifies the change. All arguments are optional. * * @param from - New start position. * @param to - New end position. * @param text - New replacement text. */ update?(from?: Position, to?: Position, text?: string[]): void; } /** * Coordinates returned by charCoords. * * @public * @unofficial */ export interface Cm5EditorCharCoords { /** The bottom coordinate in pixels. */ bottom: number; /** The left coordinate in pixels. */ left: number; /** The right coordinate in pixels. */ right: number; /** The top coordinate in pixels. */ top: number; } /** * Configuration options for a CodeMirror 5 editor instance. * * @public * @unofficial */ export interface Cm5EditorConfiguration { /** Whether to add an extra CSS class indicating the inner mode to each token. */ addModeClass?: boolean; /** When set, only files whose MIME type is in this array can be dropped. */ allowDropFileTypes?: null | string[]; /** Whether to enable autocapitalize on the input. */ autocapitalize?: boolean; /** Whether to enable autocorrect on the input. */ autocorrect?: boolean; /** Whether to auto-focus on initialization. */ autofocus?: boolean; /** Whether the gutter will be covered when next to a scrollbar. */ coverGutterNextToScrollbar?: boolean; /** Half-period in milliseconds used for cursor blinking. */ cursorBlinkRate?: number; /** Determines the height of the cursor (0 to 1). */ cursorHeight?: number; /** Extra space above and below the cursor when approaching the visible edge. */ cursorScrollMargin?: number; /** Flips overall layout direction ("ltr" or "rtl"). */ direction?: "ltr" | "rtl"; /** Controls whether drag-and-drop is enabled. */ dragDrop?: boolean; /** Whether to re-indent when a character is typed that might change indentation. */ electricChars?: boolean; /** Can be used to specify extra keybindings for the editor. */ extraKeys?: Cm5KeyMap | null | string; /** At which number to start counting lines. */ firstLineNumber?: number; /** Whether the gutter stays fixed during horizontal scrolling. */ fixedGutter?: boolean; /** Whether to combine adjacent tokens with the same class into a single span. */ flattenSpans?: boolean; /** An array of CSS class names for gutters. */ gutters?: Array<Cm5GutterConfig | string>; /** The period of inactivity (ms) before a new history event is started. */ historyEventDelay?: number; /** The number of spaces a block should be indented. */ indentUnit?: number; /** Whether to indent with tabs. */ indentWithTabs?: boolean; /** Selects the input model ("textarea" or "contenteditable"). */ inputStyle?: Cm5InputStyle; /** Configures the keymap to use. */ keyMap?: string; /** Whether to show line numbers. */ lineNumbers?: boolean; /** Explicitly set the line separator for the editor. */ lineSeparator?: null | string; /** Whether to enable line-wise copy/cut when there is no selection. */ lineWiseCopyCut?: boolean; /** Whether to enable line wrapping. */ lineWrapping?: boolean; /** Position beyond which highlighting gives up. */ maxHighlightLength?: number; /** The mode specification. */ mode?: Cm5ModeSpec<unknown> | null | string; /** Whether to paste one line per selection when counts match. */ pasteLinesPerSelection?: boolean; /** An object mapping strings to translations for i18n. */ phrases?: Record<string, unknown>; /** How quickly (ms) CodeMirror should poll its input for changes. */ pollInterval?: number; /** Whether the editor is read-only. */ readOnly?: "nocursor" | boolean; /** Controls whether the context menu resets the selection. */ resetSelectionOnContextMenu?: boolean; /** Whether horizontal cursor movement through RTL text is visual. */ rtlMoveVisually?: boolean; /** A label read by screen readers when the editor is focused. */ screenReaderLabel?: string; /** Chooses a scrollbar implementation ("native" or "null"). */ scrollbarStyle?: string; /** Whether multiple selections are joined when they touch. */ selectionsMayTouch?: boolean; /** Whether the cursor should be drawn when a selection is active. */ showCursorWhenSelecting?: boolean; /** Whether to use context-sensitive indentation. */ smartIndent?: boolean; /** A regular expression for characters that should be replaced by a placeholder. */ specialChars?: RegExp; /** Whether to enable spellcheck on the input. */ spellcheck?: boolean; /** The tab index to assign to the editor. */ tabindex?: number; /** The tab size in spaces. */ tabSize?: number; /** The theme to style the editor with. */ theme?: string; /** The maximum number of undo levels stored. */ undoDepth?: number; /** The starting value of the editor. */ value?: Doc | string; /** Specifies the amount of lines rendered above and below the visible area. */ viewportMargin?: number; /** How long (ms) the highlighting thread works before sleeping. */ workDelay?: number; /** How long (ms) the highlighting thread sleeps between work periods. */ workTime?: number; /** Allows you to configure the behavior of mouse selection and dragging. */ configureMouse?(cm: Cm5Editor, repeat: "double" | "single" | "triple", event: Event): Cm5MouseSelectionConfiguration; /** A function to format line numbers. */ lineNumberFormatter?(line: number): string; /** Deprecated drag event handler. */ onDragEvent?(instance: Cm5Editor, event: DragEvent): boolean; /** Deprecated key event handler. */ onKeyEvent?(instance: Cm5Editor, event: KeyboardEvent): boolean; /** A function that produces a DOM node for special characters. */ specialCharPlaceholder?(char: string): HTMLElement; /** Additional configuration options. */ [key: string]: unknown; } /** * Coordinates used as input for coordsChar. * * @public * @unofficial */ export interface Cm5EditorCoordsCharInput { /** The left coordinate in pixels. */ left: number; /** The top coordinate in pixels. */ top: number; } /** * Coordinates returned by cursorCoords. * * @public * @unofficial */ export interface Cm5EditorCursorCoords { /** The bottom coordinate in pixels. */ bottom: number; /** The left coordinate in pixels. */ left: number; /** The top coordinate in pixels. */ top: number; } /** * The display state of a CM5 editor. * * @public * @unofficial */ export interface Cm5EditorDisplay { /** The wrapper HTML element. */ wrapper: HTMLElement; } /** * A rectangle used for scrolling into view. * * @public * @unofficial */ export interface Cm5EditorScrollRect { /** The bottom coordinate in pixels. */ bottom: number; /** The left coordinate in pixels. */ left: number; /** The right coordinate in pixels. */ right: number; /** The top coordinate in pixels. */ top: number; } /** * A selection change event object in CodeMirror 5. * * @public * @unofficial */ export interface Cm5EditorSelectionChange { /** The origin of the selection change. */ origin?: string; /** The new selection ranges. */ ranges: Cm5Range[]; /** * Modifies the ranges for this selection change. * * @param ranges - The new selection ranges. */ update(ranges: Cm5Range[]): void; } /** * The state of a CM5 editor. * * @public * @unofficial */ export interface Cm5EditorState { /** The Vim mode state, if Vim mode is enabled. */ vim?: unknown; } /** * Result of a cursor position search in CodeMirror 5. * * @public * @unofficial */ export interface Cm5FindPosResult { /** Character position within the line. */ ch: number; /** Whether the edge of the document was reached. */ hitSide?: boolean; /** Line number. */ line: number; } /** * Configuration for a gutter in CodeMirror 5. * * @public * @unofficial */ export interface Cm5GutterConfig { /** The CSS class name for the gutter. */ className: string; /** Optional inline CSS style. */ style?: string; } /** * Result of CodeMirror 5's innerMode function. * * @public * @unofficial */ export interface Cm5InnerModeResult { /** The inner mode. */ mode: Cm5Mode<unknown>; /** The inner mode's state. */ state: unknown; } /** * A CodeMirror 5 key map, mapping key names to actions. * * @public * @unofficial */ export interface Cm5KeyMap { /** The action to perform when the key is pressed. */ [keyName: string]: ((instance: Cm5Editor) => void) | false | string; } /** * A handle to a line in a CodeMirror 5 document. * * @public * @unofficial */ export interface Cm5LineHandle { /** The text content of the line. */ text: string; /** * Removes an event listener for the specified event. * * @param eventName - The event name. * @param handler - The handler to remove. */ off(eventName: "change", handler: (instance: Cm5LineHandle, changeObj: Cm5EditorChange) => void): void; /** Removes an event listener for the specified event. */ off(eventName: "delete", handler: () => void): void; /** * Registers an event listener for the specified event. * * @param eventName - The event name. * @param handler - The handler to register. */ on(eventName: "change", handler: (instance: Cm5LineHandle, changeObj: Cm5EditorChange) => void): void; /** Registers an event listener for the specified event. */ on(eventName: "delete", handler: () => void): void; } /** * Information about a line in a CodeMirror 5 editor. * * @public * @unofficial */ export interface Cm5LineInfo { /** The background CSS class. */ bgClass: string; /** Object mapping gutter IDs to marker elements. */ gutterMarkers: unknown; /** The line handle. */ handle: Cm5LineHandle; /** The line number. */ line: number; /** The text content of the line. */ text: string; /** The text CSS class. */ textClass: string; /** Array of line widgets attached to this line. */ widgets: unknown; /** The wrapper CSS class. */ wrapClass: string; } /** * A line widget in a CodeMirror 5 editor. * * @public * @unofficial */ export interface Cm5LineWidget { /** * Call this if you made some change to the widget's DOM node that might affect its height. */ changed(): void; /** * Removes the widget. */ clear(): void; /** * Removes an event listener. * * @param eventName - The event name. * @param handler - The handler to remove. */ off(eventName: "redraw", handler: () => void): void; /** * Registers an event listener. * * @param eventName - The event name. * @param handler - The handler to register. */ on(eventName: "redraw", handler: () => void): void; } /** * Options for creating a line widget in CodeMirror 5. * * @public * @unofficial */ export interface Cm5LineWidgetOptions { /** Causes the widget to be placed above instead of below the text of the line. */ above?: boolean; /** Add an extra CSS class name to the wrapper element. */ className?: string; /** Whether the widget should cover the gutter. */ coverGutter?: boolean; /** Whether the editor will capture mouse and drag events occurring in this widget. */ handleMouseEvents?: boolean; /** Position at which to insert the widget (zero for top, N for after Nth widget). */ insertAt?: number; /** Whether the widget should stay fixed in the face of horizontal scrolling. */ noHScroll?: boolean; /** When `true`, will cause the widget to be rendered even if the line is hidden. */ showIfHidden?: boolean; } /** * Options for creating a linked document in CodeMirror 5. * * @public * @unofficial */ export interface Cm5LinkedDocOptions { /** The start line of the subview. */ from?: number; /** A different mode for the linked document. */ mode?: Cm5ModeSpec<unknown> | string; /** Whether to share undo history with the original. */ sharedHist?: boolean; /** The end line of the subview. */ to?: number; } /** * A CodeMirror 5 mode definition for syntax highlighting. * * @typeParam T - The type of the mode's state object. * @public * @unofficial */ export interface Cm5Mode<T> { /** String that ends a block comment. */ blockCommentEnd?: string; /** String to put at the start of continued lines in a block comment. */ blockCommentLead?: string; /** String that starts a block comment. */ blockCommentStart?: string; /** Trigger a re-indent whenever one of the characters in the string is typed. */ electricChars?: string; /** Trigger a re-indent whenever the regex matches the part of the line before the cursor. */ electricInput?: RegExp; /** String that starts a line comment. */ lineComment?: string; /** The name of the mode. */ name?: string; /** * Called whenever a blank line is passed over, so that the parser state can be updated. * * @param state - The current parser state. */ blankLine?(state: T): void; /** * Given a state, returns a safe copy of that state. * * @param state - The state to copy. * @returns A copy of the state. */ copyState?(state: T): T; /** * Returns the number of spaces of indentation that should be used. * * @param state - The current parser state. * @param textAfter - The text after the current position. * @param line - The whole text of the line. * @returns The number of spaces to indent. */ indent?(state: T, textAfter: string, line: string): number; /** * Produces a state object to be used at the start of a document. * * @returns The initial state. */ startState?(): T; /** * Reads one token from the stream, optionally updates the state, and returns a style string. * * @param stream - The string stream to read from. * @param state - The current parser state. * @returns A style string, or `null` for unstyled tokens. */ token(stream: Cm5StringStream, state: T): null | string; } /** * A factory function that creates a {@link Cm5Mode} given an editor configuration. * * @typeParam T - The type of the mode's state object. * @public * @unofficial */ export interface Cm5ModeFactory<T> { (config: Cm5EditorConfiguration, modeOptions?: unknown): Cm5Mode<T>; } /** * Configuration for mouse selection behavior in CodeMirror 5. * * @public * @unofficial */ export interface Cm5MouseSelectionConfiguration { /** Whether to add a new range to the existing selection. */ addNew?: boolean; /** Whether to extend the existing selection range. */ extend?: boolean; /** Whether dragged content is moved (`true`) or copied (`false`). */ moveOnDrag?: boolean; /** The unit by which to select. */ unit?: "char" | "line" | "rectangle" | "word" | Cm5SelectionUnit; } /** * Options for adding a mode overlay in CodeMirror 5. * * @public * @unofficial */ export interface Cm5OverlayOptions { /** Whether the overlay styling overrides the base mode entirely. */ opaque?: boolean; /** The priority of the overlay. */ priority?: number; } /** * A sentinel value that can be returned from key handlers to indicate the key should be handled by the next handler. * * @public * @unofficial */ export interface Cm5Pass { /** Returns the string "CodeMirror.PASS". */ toString(): "CodeMirror.PASS"; } /** * A position range with from and to in CodeMirror 5. * * @public * @unofficial */ export interface Cm5PositionRange { /** The start position. */ from: Position; /** The end position. */ to: Position; } /** * A selection range in a CodeMirror 5 document. * * @public * @unofficial */ export interface Cm5Range { /** The fixed end of the selection. */ anchor: Position; /** The moving end of the selection. */ head: Position; /** * Returns `true` if the range is empty (anchor equals head). * * @returns Whether the range is empty. */ empty(): boolean; /** * Returns the earlier of anchor and head. * * @returns The start position of the range. */ from(): Position; /** * Returns the later of anchor and head. * * @returns The end position of the range. */ to(): Position; } /** * Scroll position information for a CodeMirror 5 editor. * * @public * @unofficial */ export interface Cm5ScrollInfo { /** The visible area height (minus scrollbars). */ clientHeight: number; /** The visible area width (minus scrollbars). */ clientWidth: number; /** Total scrollable height. */ height: number; /** Current horizontal scroll position. */ left: number; /** Current vertical scroll position. */ top: number; /** Total scrollable width. */ width: number; } /** * Options for selection operations in CodeMirror 5. * * @public * @unofficial */ export interface Cm5SelectionOptions { /** Direction into which selection endpoints should be adjusted (-1 backward, 1 forward). */ bias?: number; /** Determines whether the selection history event may be merged with the previous one. */ origin?: string; /** Determines whether the selection head should be scrolled into view. */ scroll?: boolean; } /** * A selection range input for CodeMirror 5 selection operations. * * @public * @unofficial */ export interface Cm5SelectionRange { /** The fixed end of the selection. */ anchor: Position; /** The moving end of the selection. */ head: Position; } /** * A custom selection unit function for CodeMirror 5 mouse selection. * * @public * @unofficial */ export interface Cm5SelectionUnit { (cm: Cm5Editor, pos: Position): Cm5PositionRange; } /** * A CodeMirror 5 StringStream instance for tokenizing text. * * @public * @unofficial */ export interface Cm5StringStream { /** Position in the string where the last column measurement was taken. */ lastColumnPos: number; /** Cached column value at {@link Cm5StringStream.lastColumnPos}. */ lastColumnValue: number; /** Start offset of the current line within the document. */ lineStart: number; /** Current position in the string. */ pos: number; /** Position where the current token started. */ start: number; /** The current line's content. */ string: string; /** Number of spaces per tab character. */ tabSize: number; /** * Backs up the stream n characters. * * @param n - The number of characters to back up. */ backUp(n: number): void; /** * Returns the column (taking into account tabs) at which the current token starts. * * @returns The column number. */ column(): number; /** * Gets the string between the start of the current token and the current stream position. * * @returns The current token string. */ current(): string; /** * If the next character in the stream matches the given argument, it is consumed and returned. * * @param match - A character, regular expression, or predicate function. * @returns The matched character, or empty string if no match. */ eat(match: ((char: string) => boolean) | RegExp | string): string; /** * Shortcut for eatWhile when matching white-space. * * @returns `true` if any whitespace was consumed. */ eatSpace(): boolean; /** * Repeatedly calls eat with the given argument, until it fails. * * @param match - A character, regular expression, or predicate function. * @returns `true` if any characters were consumed. */ eatWhile(match: ((char: string) => boolean) | RegExp | string): boolean; /** * Returns `true` only if the stream is at the end of the line. * * @returns Whether the stream is at end of line. */ eol(): boolean; /** * Tells you how far the current line has been indented, in spaces. * * @returns The indentation in spaces. */ indentation(): number; /** * Look ahead and return the character n characters ahead without advancing. * * @param n - The number of characters to look ahead. * @returns The character, or `undefined` if past end of line. */ lookAhead(n: number): string | undefined; /** * Matches against a string or regular expression pattern. * * @param pattern - The string pattern to match. * @param consume - Whether to advance the stream on match. * @param caseFold - Whether to match case-insensitively. * @returns `true` if the pattern matched. */ match(pattern: string, consume?: boolean, caseFold?: boolean): boolean; /** * Matches against a regular expression pattern. * * @param pattern - The regular expression to match. * @param consume - Whether to advance the stream on match. * @returns The match array, or `null` if no match. */ match(pattern: RegExp, consume?: boolean): null | string[]; /** * Returns the next character in the stream and advances it. * * @returns The next character, or `null` at end of line. */ next(): null | string; /** * Returns the next character in the stream without advancing it. * * @returns The next character, or `null` at end of line. */ peek(): null | string; /** * Skips to the next occurrence of the given character on the current line. * * @param ch - The character to skip to. * @returns `true` if the character was found. */ skipTo(ch: string): boolean; /** Moves the position to the end of the line. */ skipToEnd(): void; /** * Returns `true` only if the stream is at the start of the line. * * @returns Whether the stream is at start of line. */ sol(): boolean; } /** * Options for creating a text marker in CodeMirror 5. * * @public * @unofficial */ export interface Cm5TextMarkerOptions { /** When set to `true`, adding this marker will create an event in the undo history. */ addToHistory?: boolean; /** Atomic ranges act as a single unit when cursor movement is concerned. */ atomic?: boolean; /** When given, add the attributes to the elements created for the marked text. */ attributes?: Record<string, string>; /** Assigns a CSS class to the marked stretch of text. */ className?: string; /** When enabled, will cause the mark to clear itself whenever the cursor enters its range. */ clearOnEnter?: boolean; /** Determines whether the mark is automatically cleared when it becomes empty. */ clearWhenEmpty?: boolean; /** Collapsed ranges do not show up in the display. */ collapsed?: boolean; /** A string of CSS to be applied to the covered text. */ css?: string; /** Equivalent to startStyle, but for the rightmost span. */ endStyle?: string; /** Whether the editor will capture mouse and drag events occurring in this widget. */ handleMouseEvents?: boolean; /** Determines whether text inserted on the left of the marker will end up inside or outside of it. */ inclusiveLeft?: boolean; /** Like inclusiveLeft, but for the right side. */ inclusiveRight?: boolean; /** A read-only span cannot be modified except by calling setValue. */ readOnly?: boolean; /** Use a given node to display this range. Implies both collapsed and atomic. */ replacedWith?: HTMLElement; /** For atomic ranges, determines whether the cursor is allowed to be placed directly to the left. */ selectLeft?: boolean; /** Like selectLeft, but for the right side. */ selectRight?: boolean; /** When set to `true`, makes the marker appear in all linked documents. */ shared?: boolean; /** Can be used to specify an extra CSS class for the leftmost span of the marker. */ startStyle?: string; /** When given, will give the nodes a HTML title attribute with the given value. */ title?: string; } /** * A token returned by CodeMirror 5's tokenizer. * * @public * @unofficial */ export interface Cm5Token { /** The character at which the token ends. */ end: number; /** The character (on the given line) at which the token starts. */ start: number; /** The mode's state at the end of this token. */ state: unknown; /** The token's string. */ string: string; /** The token type the mode assigned to the token, such as "keyword" or "comment". */ type: null | string; } /** * The currently rendered viewport range in a CodeMirror 5 editor. * * @public * @unofficial */ export interface Cm5Viewport { /** The start line of the viewport (inclusive). */ from: number; /** The end line of the viewport (exclusive). */ to: number; } /** * A range associates a value with a range of positions. * * @public * @unofficial */ export interface CmRange<T extends RangeValue> { /** The start of the range. */ readonly from: number; /** The end of the range. */ readonly to: number; /** The value associated with this range. */ readonly value: T; } /** * Extended CodeMirror adapter providing CM5-compatible API over CM6. * * @public * @unofficial */ export interface CodeMirrorAdapterEx { /** * Construct a new CodeMirror editor instance from a Vim editor. * * @param cm6 - The Vim editor instance to wrap. * @returns The created CodeMirror editor. */ new (cm6: VimEditor): CodeMirrorEditor; /** * Built-in editor commands (undo, redo, indent, etc.). */ commands: CodeMirrorAdapterExCommands; /** * Whether the current platform is macOS. */ isMac: boolean; /** * Map of key binding names to their handlers. */ keyMap: Record<string, Cm5KeyMap>; /** * Map of key names to their handlers. */ keys: Cm5KeyMap; /** * Constructor for creating editor position objects. * * @param line - The line number. * @param ch - The character offset. * @returns The created editor position. */ Pos: new (line: number, ch: number) => EditorPosition; /** * StringStream class for tokenizing input. */ StringStream: ConstructorBase<[ text: string ], Cm5StringStream>; /** * The Vim API instance. */ Vim: VimApi; /** * Add a CSS class to an HTML element. * * @param element - The HTML element to add the class to. * @param className - The CSS class name to add. */ addClass(element: HTMLElement, className: string): void; /** * Define a new editor option with a default value and change handler. * * @param option - The name of the option. * @param defaultValue - The default value for the option. * @param handler - The handler invoked when the option changes. */ defineOption(option: string, defaultValue: unknown, handler: () => void): void; /** * Call preventDefault on the given event. * * @param event - The event to prevent default on. */ e_preventDefault(event: Event): void; /** * Stop propagation and prevent default on the given event. * * @param event - The event to stop. */ e_stop(event: Event): void; /** * Find the enclosing HTML/XML tag at the given position. * * @param doc - The CodeMirror adapter instance. * @param pos - The editor position to search from. * @returns The enclosing tag, or `undefined` if not found. */ findEnclosingTag(doc: CodeMirrorAdapterEx, pos: EditorPosition): EnclosingTag | undefined; /** * Find the matching HTML/XML tag at the given position. * * @param doc - The CodeMirror adapter instance. * @param pos - The editor position to search from. */ findMatchingTag(doc: CodeMirrorAdapterEx, pos: EditorPosition): void; /** * Check whether the given character is a word character. * * @param char - The character to check. * @returns Whether the character is a word character. */ isWordChar(char: string): boolean; /** * Get the key name string from a keyboard event. * * @param event - The keyboard event. * @returns The key name string. */ keyName(event: KeyboardEvent): string; /** * Look up a key binding and invoke the callback with the associated action. * * @param key - The key binding to look up. * @param context - The context for the key lookup. * @param callback - The callback invoked with the associated action. */ lookupKey(key: string, context: unknown, callback: (action: (codeMirrorAdapter: CodeMirrorAdapterEx) => boolean) => void): void; /** * Remove an event listener. * * @param event - The event name. * @param listener - The event listener to remove. */ off(event: string, listener: EventListenerOrEventListenerObject): void; /** * Add an event listener. * * @param event - The event name. * @param listener - The event listener to add. */ on(event: string, listener: EventListenerOrEventListenerObject): void; /** * Remove a CSS class from an HTML element. * * @param element - The HTML element to remove the class from. * @param className - The CSS class name to remove. */ rmClass(element: HTMLElement, className: string): void; /** * Emit a signal/event on the given target. * * @param target - The target to emit the signal on. * @param type - The signal/event type. * @param values - Additional values to pass to the signal handlers. */ signal(target: unknown, type: string, ...values: unknown[]): void; /** * Convert a keyboard event to its Vim key representation. * * @param event - The keyboard event. * @returns The Vim key representation string. */ vimKey(event: KeyboardEvent): string; } /** * Built-in editor commands available through the CodeMirror adapter. * * @public * @unofficial */ export interface CodeMirrorAdapterExCommands { /** * Move the cursor one character to the left. * * @param editor - The editor instance. */ cursorCharLeft(editor: CodeMirrorEditor): void; /** * Auto-indent the current line or selection. * * @param editor - The editor instance. */ indentAuto(editor: CodeMirrorEditor): void; /** * Insert a new line and auto-indent. * * @param editor - The editor instance. */ newlineAndIndent(editor: CodeMirrorEditor): void; /** * Insert a new line before the current line and auto-indent. * * @param editor - The editor instance. */ newlineAndIndentBefore(editor: CodeMirrorEditor): void; /** * Redo the last undone change. * * @param editor - The editor instance. */ redo(editor: CodeMirrorEditor): void; /** * Undo the last change. * * @param editor - The editor instance. */ undo(editor: CodeMirrorEditor): void; } /** * CM5-compatible editor interface wrapping a CodeMirror 6 editor view. * * @public * @unofficial */ export interface CodeMirrorEditor { /** * Pending line handle changes to be processed. */ $lineHandleChanges: LineHandleChange[] | undefined; /** * Add a search overlay to highlight matches in the editor. * * @param options - The overlay options containing the search pattern. * @returns The search query, or `undefined` if the overlay could not be added. */ addOverlay(options: AddOverlayOptions): SearchQuery | undefined; /** * Remove focus from the editor. */ blur(): void; /** * Get the pixel coordinates of a character position. * * @param pos - The editor position to get coordinates for. * @param mode - The coordinate system to use. * @returns The pixel coordinates of the position. */ charCoords(pos: EditorPosition, mode: "div" | "local" | "page" | "window"): Coords; /** * Clip a position to be within the document bounds. * * @param pos - The editor position to clip. * @returns The clipped position within document bounds. */ clipPos(pos: EditorPosition): EditorPosition; /** * Get the editor position corresponding to pixel coordinates. * * @param coords - The pixel coordinates to convert. * @param mode - The coordinate system of the input coordinates. * @returns The editor position at the given coordinates. */ coordsChar(coords: Coords, mode: "div" | "local" | "page" | "window"): EditorPosition; /** * Get the default height of a line of text in pixels. * * @returns The default text height in pixels. */ defaultTextHeight(): number; /** * Destroy and clean up resources. */ destroy(): void; /** * Execute a named editor command. * * @param command - The name of the command to execute. */ execCommand(command: string): void; /** * Find the matching bracket for the bracket at the given position. * * @param pos - The position of the bracket to match. * @returns The matching bracket result. */ findMatchingBracket(pos: EditorPosition): MatchingBracket; /** * Find a position vertically relative to the given start position. * * @param start - The starting editor position. * @param amount - The number of units to move. * @param unit - The unit of movement. * @param goalColumn - The desired column to maintain. * @returns The resulting editor position. */ findPosV(start: EditorPosition, amount: number, unit: "line" | "page", goalColumn: number): EditorPosition; /** * Get the line number of the first line in the document. * * @returns The first line number. */ firstLine(): number; /** * Focus the editor. */ focus(): void; /** * Fold the code block at the given line. * * @param line - The line number to fold at. */ foldCode(line: number): void; /** * Execute a function for each selection in a multi-selection. * * @param fn - The function to execute for each selection. */ forEachSelection(fn: () => void): void; /** * Get the cursor position, optionally specifying which end of the selection. * * @param type - Which end of the selection to return. * @returns The cursor position. */ getCursor(type?: "anchor" | "end" | "head" | "start"): EditorPosition; /** * Get the editor's input field element. * * @returns The input field HTML element. */ getInputField(): HTMLElement; /** * Get the position of the last edit. * * @returns The position of the last edit. */ getLastEditEnd(): EditorPosition; /** * Get the text content of the given line number. * * @param line - The line number to get text for. * @returns The text content of the line. */ getLine(line: number): string; /** * Get a handle for the given line number. * * @param line - The line number to get a handle for. * @returns The line handle. */ getLineHandle(line: number): LineHandle; /** * Get the line number from a line handle, or `null` if the handle is invalid. * * @param handle - The line handle to get the number for. * @returns The line number, or `null` if the handle is invalid. */ getLineNumber(handle: LineHandle): null | number; /** * Get the primary selection as anchor and head positions. * * @returns The primary editor selection. */ getMainSelection(): EditorSelection; /** * Get the current editor language mode. * * @returns The editor language mode. */ getMode(): CodeMirrorEditorMode; /** * Get the value of an editor option. * * @param option - The name of the option to get. * @returns The option value. */ getOption(option: string): unknown; /** * Get the text between two positions. * * @param from - The start position. * @param to - The end position. * @returns The text between the two positions. */ getRange(from: EditorPosition, to: EditorPosition): string; /** * Get information about the editor's scroll position and dimensions. * * @returns The scroll information. */ getScrollInfo(): ScrollInfo; /** * Get a search cursor for the given regular expression starting at the given position. * * @param query - The regular expression to search for. * @param pos - The position to start searching from. * @returns The search cursor. */ getSearchCursor(query: RegExp, pos: EditorPosition): CodeMirrorEditorSearchCursor; /** * Get the currently selected text. * * @returns The selected text. */ getSelection(): string; /** * Get all selections as an array of strings. * * @returns An array of selected text strings. */ getSelections(): string[]; /** * Get the token type at the given position. * * @param pos - The position to get the token type for. * @returns The token type string. */ getTokenTypeAt(pos: EditorPosition): string; /** * Get the full text content of the document. * * @returns The full document text. */ getValue(): string; /** * Get the outermost wrapper element of the editor. * * @returns The wrapper HTML element. */ getWrapperElement(): HTMLElement; /** * Hard-wrap text according to the given options. * * @param options - The hard wrap options. */ hardWrap(options: HardWrapOptions): void; /** * Decrease the indentation of the selection. */ indentLess(): void; /** * Indent the given line, optionally adding more indentation. * * @param line - The line number to indent. * @param more - Whether to add more indentation. */ indentLine(line: number, more?: boolean): void; /** * Increase the indentation of the selection. */ indentMore(): void; /** * Convert an editor position to a character index within the document. * * @param pos - The editor position to convert. * @returns The character index. */ indexFromPos(pos: EditorPosition): number; /** * Check whether the editor is in multi-selection mode. * * @returns Whether the editor is in multi-selection mode. */ isInMultiSelectMode(): boolean; /** * Get the line number of the last line in the document. * * @returns The last line number. */ lastLine(): number; /** * Get the total number of lines in the document. * * @returns The total number of lines. */ lineCount(): number; /** * Get all current selections as an array of anchor/head pairs. * * @returns An array of selections with anchor and head positions. */ listSelections(): Array<CodeMirrorEditorSelectionRange>; /** * Move a position by character in the given direction. * * @param pos - The starting position. * @param dir - The direction to move. * @param unit - The number of characters to move. * @returns The resulting editor position. */ moveByChar(pos: EditorPosition, dir: "left" | "right", unit: number): EditorPosition; /** * Move the cursor horizontally by the given number of units. * * @param dir - The direction and amount to move. * @param unit - The unit of movement. */ moveH(dir: number, unit: string): void; /** * Remove an event listener from the editor. * * @param event - The event name. * @param listener - The event listener to remove. */ off(event: string, listener: EventListenerOrEventListenerObject): void; /** * Add an event listener to the editor. * * @param event - The event name. * @param listener - The event listener to add. */ on(event: string, listener: EventListenerOrEventListenerObject): void; /** * Handle pre-operation-end cleanup. */ onBeforeEndOperation(): void; /** * Handle a line handle change event. * * @param lineHandleChange - The line handle change to process. */ onChange(lineHandleChange: LineHandleChange): void; /** * Handle a selection change event. */ onSelectionChange(): void; /** * Open an interactive dialog in the editor. * * @param template - The HTML template for the dialog. * @param keyValidator - The function to validate key input. * @param options - The dialog options. */ openDialog(template: string, keyValidator: (keyValue: string) => boolean, options?: Partial<OpenDialogOptions>): void; /** * Open a notification message in the editor. Returns a function to dismiss it. * * @param message - The notification message to display. * @param options - The notification options. * @returns A function to dismiss the notification. */ openNotification(message: string, options?: OpenNotificationOptions): () => void; /** * Execute a function as a single operation, batching view updates. * * @typeParam T - The return type of the function. * @param fn - The function to execute. * @returns The return value of the function. */ operation<T>(fn: () => T): T; /** * Overwrite the current selection with the given text. * * @param text - The text to overwrite the selection with. */ overWriteSelection(text: string): void; /** * Convert a character index to an editor position. * * @param index - The character index to convert. * @returns The editor position. */ posFromIndex(index: number): EditorPosition; /** * Refresh the editor display. */ refresh(): void; /** * Release all tracked line handles. */ releaseLineHandles(): void; /** * Remove a search overlay from the editor. * * @param overlay - The search query overlay to remove. */ removeOverlay(overlay?: SearchQuery): void; /** * Replace the text in the given range. * * @param text - The replacement text. * @param from - The start position of the range. * @param to - The end position of the range. */ replaceRange(text: string, from: EditorPosition, to?: EditorPosition): void; /** * Replace the current selection with the given text. * * @param text - The replacement text. */ replaceSelection(text: string): void; /** * Replace all selections with the corresponding texts. * * @param texts - The replacement texts for each selection. */ replaceSelections(texts: string[]): void; /** * Scan for a bracket from the given position in the specified direction. * * @param from - The position to start scanning from. * @param direction - The direction to scan (positive for forward, negative for backward). * @param style - The style filter for brackets. * @returns The found bracket, or `null` if none was found. */ scanForBracket(from: EditorPosition, direction: number, style?: string): Bracket | null; /** * Get information about the editor's scroll position and dimensions. * * @returns The scroll information. */ scrollInfo(): ScrollInfo; /** * Scroll the given position into view with an optional margin. * * @param pos - The position to scroll into view. * @param margin - The margin in pixels around the position. */ scrollIntoView(pos?: EditorPosition, margin?: number): void; /** * Scroll the editor to the given coordinates. * * @param x - The horizontal scroll position. * @param y - The vertical scroll position. */ scrollTo(x?: number, y?: number): void; /** * Set a bookmark at the given position. * * @param pos - The position to set the bookmark at. * @param options - The bookmark options. * @returns The created bookmark. */ setBookmark(pos: EditorPosition, options?: SetBookmarkOptions): Bookmark; /** * Set the cursor position to the given line and character. * * @param line - The line number. * @param ch - The character offset. */ setCursor(line: number, ch: number): void; /** * Set the value of an editor option. * * @param option - The name of the option to set. * @param value - The value to set. */ setOption(option: string, value: unknown): void; /** * Set the selection to the given anchor and head positions. * * @param anchor - The anchor position of the selection. * @param head - The head position of the selection. * @param options - The selection options. */ setSelection(anchor: EditorPosition, head: EditorPosition, options?: SetSelectionOptions): void; /** * Set multiple selections, optionally specifying the primary selection index. * * @param selections - The selections to set. * @param primaryIndex - The index of the primary selection. */ setSelections(selections: EditorSelection[], primaryIndex?: number): void; /** * Set the size of the editor in pixels. * * @param width - The width in pixels. * @param height - The height in pixels. */ setSize(width: number, height: number): void; /** * Set the full text content of the document. * * @param content - The text content to set. */ setValue(content: string): void; /** * Emit a signal/event on the editor. * * @param event - The event name to emit. * @param args - Additional arguments to pass to the event handlers. */ signal(event: string, ...args: unknown[]): void; /** * Check whether there is an active selection. * * @returns Whether there is an active selection. */ somethingSelected(): boolean; /** * Toggle overwrite mode on or off. * * @param overwrite - Whether to enable overwrite mode. */ toggleOverwrite(overwrite: boolean): void; /** * Check whether the editor is in virtual selection mode. * * @returns Whether the editor is in virtual selection mode. */ virtualSelectionMode(): boolean; } /** * Describes the active editor language mode. * * @public * @unofficial */ export interface CodeMirrorEditorMode { /** * Name of the active language mode. */ name: string; } /** * A cursor for iterating over search matches in the editor document. * * @public * @unofficial */ export interface CodeMirrorEditorSearchCursor { /** * Find the next or previous match. Returns true if a match was found. * * @param reverse - Whether to search in reverse direction. * @returns Whether a match was found. */ find(reverse?: boolean): boolean; /** * Find the next match. Returns true if a match was found. * * @returns Whether a match was found. */ findNext(): boolean; /** * Find the previous match. Returns true if a match was found. * * @returns Whether a match was found. */ findPrevious(): boolean; /** * Get the start position of the current match, or void if no match. * * @returns The start position of the current match. */ from(): EditorPosition | void; /** * Replace the current match with the given text. * * @param text - The replacement text. */ replace(text: string): void; /** * Get the end position of the current match, or void if no match. * * @returns The end position of the current match. */ to(): EditorPosition | void; } /** * A selection range with anchor and head positions for CodeMirror editor. * * @public * @unofficial */ export interface CodeMirrorEditorSelectionRange { /** The anchor position of the selection. */ anchor: EditorPosition; /** The head position of the selection. */ head: EditorPosition; } /** * The CodeMirror 5 library module type, representing the `window.CodeMirror` object. * * @public * @unofficial */ export interface CodeMirrorModule { /** Adds a CSS class to a node. */ addClass: unknown; /** A map of built-in CodeMirror 5 commands. */ commands: Record<string, (cm: Cm5Editor) => void>; /** Checks whether one node contains another. */ contains: unknown; /** Copies a mode state object. */ copyState: unknown; /** Default configuration options for CodeMirror 5 editors. */ defaults: Record<string, unknown>; /** The CodeMirror 5 `Doc` constructor. */ Doc: unknown; /** Prevents the default action of an event. */ e_preventDefault: unknown; /** Stops an event (prevents default and stops propagation). */ e_stop: unknown; /** Stops propagation of an event. */ e_stopPropagation: unknown; /** Finds the character offset for a given column. */ findColumn: unknown; /** Finds a mode spec by file extension. */ findModeByExtension: unknown; /** Finds a mode spec by file name. */ findModeByFileName: unknown; /** Finds a mode spec by MIME type. */ findModeByMIME: unknown; /** Finds a mode spec by name. */ findModeByName: unknown; /** The code-folding helper namespace. */ fold: unknown; /** Registered helper namespaces. */ helpers: unknown; /** Sentinel value passed as the "old value" on the first option update. */ Init: unknown; /** Registered input-style implementations. */ inputStyles: unknown; /** Checks whether a keyboard event is a modifier keypress. */ isModifierKey: unknown; /** A map of key map definitions for CodeMirror 5. */ keyMap: Record<string, Cm5KeyMap>; /** Gets the key name for a keyboard event. */ keyName: unknown; /** A map of key codes to key names. */ keyNames: unknown; /** The CodeMirror 5 `Line` constructor. */ Line: unknown; /** The CodeMirror 5 `LineWidget` constructor. */ LineWidget: unknown; /** Looks up a key binding in a keymap. */ lookupKey: unknown; /** Maps MIME types to mode specifications. */ mimeModes: Record<string, Cm5ModeSpec<unknown> | string>; /** Registered mode extensions. */ modeExtensions: unknown; /** The list of known mode descriptors. */ modeInfo: unknown; /** The mode map, mapping mode names to their factory constructors. */ modes: Record<string, Cm5ModeFactory<unknown>>; /** Creates a fold function for a given fold helper. */ newFoldFunction: unknown; /** Registered option handlers. */ optionHandlers: unknown; /** A sentinel value that key handlers can return to indicate the binding should fall through. */ Pass: Cm5Pass; /** Resolves a mode spec to a normalized form. */ resolveMode: unknown; /** Removes a CSS class from a node. */ rmClass: unknown; /** Registered scrollbar-model implementations. */ scrollbarModel: unknown; /** The CodeMirror 5 `SharedTextMarker` constructor. */ SharedTextMarker: unknown; /** The CodeMirror 5 `StringStream` constructor. */ StringStream: unknown; /** The CodeMirror 5 `TextMarker` constructor. */ TextMarker: unknown; /** The CodeMirror 5 version string. */ version: string; /** The CodeMirror 5 Vim-mode API. */ Vim: unknown; /** Computes pixel deltas for a wheel event. */ wheelEventPixels: unknown; /** Computes the end position of a change. */ changeEnd(change: Cm5EditorChange): Position; /** * Compares two positions. * * @param a - The first position. * @param b - The second position. * @returns A negative number if `a` is before `b`, positive if after, zero if equal. */ cmpPos(a: Position, b: Position): number; /** * Finds the column position at a given string index using a given tab size. * * @param line - The line string. * @param index - The string index (or `null` for end of line). * @param tabSize - The tab size. * @returns The column number. */ countColumn(line: string, index: null | number, tabSize: number): number; /** * Like defineExtension, but the method will be added to Doc objects instead. * * @param name - The extension name. * @param value - The extension implementation. */ defineDocExtension(name: string, value: unknown): void; /** * Registers a new editor extension method. * * @param name - The extension name. * @param value - The extension implementation. */ defineExtension(name: string, value: unknown): void; /** * Registers a function to be called when an editor is initialized. * * @param f - The initialization hook function. */ defineInitHook(f: (cm: Cm5Editor) => void): void; /** * Registers a MIME type with its associated mode specification. * * @param mime - The MIME type string. * @param modeSpec - The mode specification. */ defineMIME(mime: string, modeSpec: Cm5ModeSpec<unknown> | string): void; /** * Registers a new editor mode. * * @param name - The mode name. * @param modeFactory - The factory function that creates the mode. */ defineMode<T>(name: string, modeFactory: Cm5ModeFactory<T>): void; /** * Registers a new editor option. * * @param name - The option name. * @param defaultValue - The default value for the option. * @param onUpdate - The update handler. */ defineOption(name: string, defaultValue: unknown, onUpdate: (editor: Cm5Editor, val: unknown, old: unknown) => void): void; /** * Adds or overrides properties on mode objects produced for a specific mode. * * @param name - The mode name. * @param properties - The properties to add. */ extendMode(name: string, properties: Partial<Cm5Mode<unknown>>): void; /** * Creates a CodeMirror 5 editor from a textarea element. * * @param host - The textarea element to replace. * @param options - Optional editor configuration. * @returns The created editor instance. */ fromTextArea(host: HTMLTextAreaElement, options?: Cm5EditorConfiguration): Cm5Editor; /** * Creates a mode object for the given mode specification. * * @param config - The editor configuration. * @param modeSpec - The mode name or specification. * @returns The resolved mode object. */ getMode(config: Cm5EditorConfiguration, modeSpec: Cm5ModeSpec<unknown> | string): Cm5Mode<unknown>; /** * Returns the inner mode and its state for the current position. * * @param mode - The outer mode. * @param state - The mode state. * @returns An object with the inner mode and state. */ innerMode(mode: Cm5Mode<unknown>, state: unknown): Cm5InnerModeResult; /** * Checks whether a character is a word character. * * @param ch - The character to check. * @returns `true` if the character is a word character. */ isWordChar(ch: string): boolean; /** * Normalizes a key map, expanding multi-stroke key bindings. * * @param keymap - The key map to normalize. * @returns The normalized key map. */ normalizeKeyMap(keymap: Cm5KeyMap): Cm5KeyMap; /** * Removes an event handler from the given target. * * @param target - The target object. * @param type - The event type. * @param f - The event handler to remove. */ off(target: unknown, type: string, f: (...args: unknown[]) => void): void; /** * Registers an event handler on the given target. * * @param target - The target object. * @param type - The event type. * @param f - The event handler. */ on(target: unknown, type: string, f: (...args: unknown[]) => void): void; /** * Utility function to create an overlay mode combining two modes. * * @param base - The base mode. * @param overlay - The overlay mode. * @param combine - Whether to combine styles instead of letting overlay win. * @returns The combined mode. */ overlayMode(base: Cm5Mode<unknown>, overlay: Cm5Mode<unknown>, combine?: boolean): Cm5Mode<unknown>; /** * A constructor function for creating {@link Position} objects. * * @param line - The line number. * @param ch - The character position. * @param sticky - The sticky direction. * @returns The created position. */ Pos(line: number, ch?: number, sticky?: string): Position; /** * Registers a global helper with a predicate. * * @param type - The helper type. * @param name - The helper name. * @param predicate - A predicate function to determine applicability. * @param value - The helper implementation. */ registerGlobalHelper(type: string, name: string, predicate: (mode: Cm5Mode<unknown>, cm: Cm5Editor) => boolean, value: unknown): void; /** * Registers a helper value for a specific type. * * @param type - The helper type. * @param name - The helper name. * @param value - The helper implementation. */ registerHelper(type: string, name: string, value: unknown): void; /** * Fires a signal (event) on the given target. * * @param target - The target object. * @param name - The signal name. * @param args - Additional arguments to pass to handlers. */ signal(target: unknown, name: string, ...args: unknown[]): void; /** * Splits a string by newline characters. * * @param text - The text to split. * @returns An array of lines. */ splitLines(text: string): string[]; /** * Calls startState of the mode if available, otherwise returns `true`. * * @param mode - The mode. * @returns The initial state, or `true` if no startState method exists. */ startState<T>(mode: Cm5Mode<T>): boolean | T; } /** * Fuzzy suggest modal used by the command palette to search and execute commands. * * @public * @unofficial */ export interface CommandPaletteModal extends FuzzySuggestModal<Command> { /** * Cached list of available commands, or `null` if not yet populated. */ commands: Command[] | null; /** * Reference to the command palette plugin instance. */ plugin: CommandPalettePluginInstance; } /** * Configuration options for the command palette plugin. * * @public * @unofficial */ export interface CommandPaletteOptions { /** * List of pinned command IDs that appear at the top of the palette. */ pinned: string[]; } /** * Internal plugin registration for the command palette feature. * * @public * @unofficial */ export interface CommandPalettePlugin extends InternalPlugin<CommandPalettePluginInstance> { } /** * Plugin instance for the command palette, providing the fuzzy command search modal. * * @public * @unofficial */ export interface CommandPalettePluginInstance extends InternalPluginInstance<CommandPalettePlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * The command palette fuzzy suggest modal. */ modal: CommandPaletteModal; /** * Configuration options for the command palette. */ options: CommandPaletteOptions; /** * Reference to the command palette plugin registration. */ plugin: CommandPalettePlugin; /** * List of recently used command IDs. */ recentCommands: string[]; /** * Get the list of available commands for the palette. * * @returns The available commands. */ getCommands(): Command[]; /** * Handle external settings file changes and reload configuration. * * @returns A promise that resolves when the settings are reloaded. */ onExternalSettingsChange(): Promise<void>; /** * Called when the command palette is opened. * * @returns Whether the command palette was successfully opened. */ onOpen(): boolean; /** * Callback invoked to open the command palette. * * @returns Whether the callback was successfully executed. */ openCallback(): boolean; /** * Save the command palette settings. * * @param plugin - The command palette plugin to save settings for. */ saveSettings(plugin: CommandPalettePlugin): void; } /** * Manager for registering, finding, and executing commands. * * @public * @unofficial */ export interface Commands extends Events { /** * Reference to the {@link obsidian#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; /** * Constructor. * * To get the constructor instance, use {@link getCommandsConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor2__?(app: App): this; /** * Execute a command by reference. * * @param command - {@link obsidian#Command} to execute. * @returns Whether the command was successfully executed. */ executeCommand(command: Command, event?: Event): boolean; /** * Execute a command by ID. * * @param commandId - ID of command to execute. * @returns Whether the command was successfully executed. */ executeCommandById(commandId: string, event?: Event): boolean; /** * Find a command by ID. * * @param commandId - ID of command to find. * @returns The command, or `undefined` if not found. */ findCommand(commandId: string): Command | undefined; /** * Lists **all** commands, both with and without editor callback. * * @returns All registered commands. */ listCommands(): Command[]; /** * Remove a command from the command registry. * * @param commandId - ID of command to remove. */ removeCommand(commandId: string): void; } /** * Record mapping command IDs to {@link obsidian#Command} objects without editor callbacks. * * @public * @unofficial */ export interface CommandsCommandsRecord extends Record<string, Command> { } /** * Record mapping command IDs to {@link obsidian#Command} objects with editor callbacks. * * @public * @unofficial */ export interface CommandsEditorCommandsRecord extends Record<string, Command> { } /** * Function `Concat`. * * @public * @unofficial */ export interface ConcatFunction extends BasesFunction { } /** * Configuration options for DOMPurify sanitization. * * @public * @unofficial */ export interface Config { /** Additional attributes to allow. */ ADD_ATTR?: string[]; /** Additional data URI tags to allow. */ ADD_DATA_URI_TAGS?: string[]; /** Additional tags to allow. */ ADD_TAGS?: string[]; /** Additional URI-safe attributes to allow. */ ADD_URI_SAFE_ATTR?: string[]; /** Whether to allow ARIA attributes. */ ALLOW_ARIA_ATTR?: boolean; /** Whether to allow data attributes. */ ALLOW_DATA_ATTR?: boolean; /** Whether to allow unknown protocols in URLs. */ ALLOW_UNKNOWN_PROTOCOLS?: boolean; /** List of allowed attributes. */ ALLOWED_ATTR?: string[]; /** List of allowed namespaces. */ ALLOWED_NAMESPACES?: string[]; /** List of allowed tags. */ ALLOWED_TAGS?: string[]; /** Regular expression for allowed URI patterns. */ ALLOWED_URI_REGEXP?: RegExp; /** Custom element handling configuration. */ CUSTOM_ELEMENT_HANDLING?: CustomElementHandling; /** List of forbidden attributes. */ FORBID_ATTR?: string[]; /** List of forbidden content types. */ FORBID_CONTENTS?: string[]; /** List of forbidden tags. */ FORBID_TAGS?: string[]; /** Whether to force the use of the body element. */ FORCE_BODY?: boolean; /** Whether to sanitize in place. */ IN_PLACE?: boolean; /** Whether to keep content of removed elements. */ KEEP_CONTENT?: boolean; /** Namespace for the parsed document. */ NAMESPACE?: string; /** Media type for the parser. */ PARSER_MEDIA_TYPE?: string; /** Whether to return a DOM node instead of a string. */ RETURN_DOM?: boolean; /** Whether to return a DocumentFragment instead of a string. */ RETURN_DOM_FRAGMENT?: boolean; /** Whether to import the returned DOM node into the current document. */ RETURN_DOM_IMPORT?: boolean; /** Whether to return a Trusted Type object instead of a string. */ RETURN_TRUSTED_TYPE?: boolean; /** Whether to enable safe-for-templates mode. */ SAFE_FOR_TEMPLATES?: boolean; /** Whether to sanitize DOM clobbering attacks. */ SANITIZE_DOM?: boolean; /** Whether to sanitize named properties. */ SANITIZE_NAMED_PROPS?: boolean; /** Profiles to use for sanitization. */ USE_PROFILES?: ConfigUseProfiles | false; /** Whether to sanitize the whole document. */ WHOLE_DOCUMENT?: boolean; } /** * Configuration override to return a DOM node. * * @public * @unofficial */ export interface ConfigReturnDom { /** Whether to return a DOM node instead of a string. */ RETURN_DOM: true; } /** * Configuration override to return a DocumentFragment. * * @public * @unofficial */ export interface ConfigReturnDomFragment { /** Whether to return a DocumentFragment instead of a string. */ RETURN_DOM_FRAGMENT: true; } /** * Sanitization profile options for DOMPurify. * * @public * @unofficial */ export interface ConfigUseProfiles { /** Whether to allow HTML elements. */ html?: boolean; /** Whether to allow MathML elements. */ mathMl?: boolean; /** Whether to allow SVG elements. */ svg?: boolean; /** Whether to allow SVG filter elements. */ svgFilters?: boolean; } /** * Base type representing a constructor function that creates instances of the given type. * * @typeParam Args - The constructor argument types. * @typeParam Instance - The type of the constructed instance. * @public * @unofficial */ export interface ConstructorBase<Args extends unknown[], Instance> { /** * Construct a new instance with the given arguments. * * @param args - The constructor arguments. * @returns The constructed instance. */ new (...args: Args): Instance; /** * Prototype of the constructed instances. */ 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 { } /** * Represents a bounding rectangle with top, bottom, left, and right coordinates. * * @public * @unofficial */ export interface Coords { /** * Bottom edge coordinate. */ bottom: number; /** * Left edge coordinate. */ left: number; /** * Right edge coordinate. */ right: number; /** * Top edge coordinate. */ 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; } /** * A dictionary mapping string keys to arrays of values. * * @typeParam T - The type of the values. * @public * @unofficial */ export interface CustomArrayDict<T> { /** * Internal map storing key-to-array mappings. */ data: Map<string, T[]>; /** * Add a value to the array associated with the given key. * * @param key - The key. * @param value - The value to add. */ add(key: string, value: T): void; /** * Remove all values for the given key. * * @param key - The key to clear. */ clear(key: string): void; /** * Remove all keys and their values. */ clearAll(): void; /** * Check whether the array for the given key contains the specified value. * * @param key - The key. * @param value - The value to check. * @returns Whether the value exists. */ contains(key: string, value: T): boolean; /** * Get the total number of values across all keys. * * @returns Total value count. */ count(): number; /** * Get the array of values for the given key, or `null` if not found. * * @param key - The key. * @returns Array of values, or `null`. */ get(key: string): null | T[]; /** * Get all keys in the dictionary. * * @returns Array of keys. */ keys(): string[]; /** * Remove a specific value from the array associated with the given key. * * @param key - The key. * @param value - The value to remove. */ remove(key: string, value: T): void; } /** * Manager for custom CSS themes and snippets. * * @public * @unofficial */ export interface CustomCSS extends Component { /** * Reference to the {@link obsidian#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[]; /** * Queue for sequential CSS processing operations. */ queue: PromisedQueue; /** * Debounced function to reload CSS snippets. */ requestLoadSnippets: Debouncer<[ ], void>; /** * Debounced function to reload the active theme. */ requestLoadTheme: Debouncer<[ ], void>; /** * Debounced function to re-read available themes from disk. */ requestReadThemes: Debouncer<[ ], void>; /** * List of snippets detected by Obsidian, given by their filenames. */ snippets: string[]; /** * Main style element for the active theme. */ styleEl: HTMLStyleElement; /** * Currently active theme, given by its name. * * @remark is the default Obsidian theme. */ theme: "" | string; /** * Mapping of theme names to their manifest. */ themes: CustomCSSThemesRecord; /** * Record of available theme updates. */ updates: CustomCSSUpdatesRecord; /** * Bound callback for handling raw file change events for a theme. * * @param themeName - Name of the theme. */ 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; /** * Constructor. * * To get the constructor instance, use {@link getCustomCSSConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor2__?(app: App): this; /** * Disable translucency of application background. */ disableTranslucency(): void; /** * Fetch legacy theme CSS using the pre-v1.0.0 theme download pipeline. * * @param options - Options for downloading the legacy theme. * @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. * * @param repoUrl - Repository URL (e.g. `username/repo`). * @returns The theme manifest. * @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). * * @param snippetName - Name of the snippet. * @returns String `.obsidian/snippets/${snippetName}.css`. */ getSnippetPath(snippetName: string): string; /** * Returns the folder path where snippets are stored (relative to vault root). * * @returns Path to the snippets folder. */ getSnippetsFolder(): string; /** * Returns the folder path where themes are stored (relative to vault root). * * @returns Path to the themes folder. */ getThemeFolder(): string; /** * Convert theme name to its corresponding filepath (relative to vault root). * * @param themeName - Name of the theme. * @returns String `.obsidian/themes/${themeName}/theme.css`. */ getThemePath(themeName: string): string; /** * Returns whether there are themes that can be updated. * * @returns Whether any themes have available updates. */ 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. * * @param options - Options for installing the theme. * @returns A promise that resolves when the legacy theme is installed. * @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. * * @param options - Options for installing the theme. * @param version - Version to install. * @returns A promise that resolves when the theme is installed. */ installTheme(options: InstallThemeOptions, version: string): Promise<void>; /** * Check whether the current theme is dark mode. */ isDarkMode(): boolean; /** * Check whether a specific theme is installed by theme name. * * @param themeName - Name of the theme. * @returns Whether the theme is installed. */ isThemeInstalled(themeName: string): boolean; /** * Load and apply CSS from the given source. * * @returns The result of loading CSS. */ loadCss(arg1: unknown): Promise<unknown>; /** * Load stored {@link CustomCSS} configuration data. * * @returns The loaded configuration data. */ loadData(): unknown; /** * Load and apply all enabled CSS snippets. * * @returns The result of loading snippets. */ loadSnippets(): unknown; /** * Load and apply a specific theme. * * @returns The result of loading the theme. */ loadTheme(arg1: unknown): unknown; /** * Lifecycle hook called when the component is loaded. */ onload(): void; /** * Handle raw file system change events for a theme. * * @param themeName - Name of the theme that changed. */ onRaw(themeName: string): void; /** * Read available CSS snippets from the snippets folder. * * @param reload - Whether to reload snippets after reading. */ readSnippets(reload?: boolean): void; /** * Read available themes from the themes folder. * * @param reload - Whether to reload themes after reading. */ readThemes(reload?: boolean): void; /** * Reload the active theme CSS. */ reloadTheme(): void; /** * Remove a theme by theme name. * * @param themeName - Name of the theme to remove. * @returns A promise that resolves when the theme is removed. */ removeTheme(themeName: string): Promise<void>; /** * Set the activation status of a snippet by snippet name. * * @param snippetName - Name of the snippet. * @param enabled - Whether the snippet should be enabled. */ setCssEnabledStatus(snippetName: string, enabled: boolean): void; /** * Set the active theme by theme name. * * @param themeName - Name of the theme to activate. */ setTheme(themeName: string): void; /** * Set the translucency of application background. * * @param translucency - Whether translucency should be enabled. */ setTranslucency(translucency: boolean): void; } /** * Record mapping theme names to their manifest metadata. * * @public * @unofficial */ export interface CustomCSSThemesRecord extends Record<string, ThemeManifest> { } /** * Record mapping theme names to their available update information. * * @public * @unofficial */ export interface CustomCSSUpdatesRecord extends Record<string, unknown> { } /** * Configuration for custom element handling in DOMPurify. * * @public * @unofficial */ export interface CustomElementHandling { /** Whether to allow customized built-in elements. */ allowCustomizedBuiltInElements?: boolean; /** Check function or regex for allowed attribute names. */ attributeNameCheck?: ((attributeName: string) => boolean) | null | RegExp; /** Check function or regex for allowed tag names. */ tagNameCheck?: ((tagName: string) => boolean) | null | RegExp; } /** * DOMPurify instance interface providing HTML sanitization methods. * * @public * @unofficial */ export interface DOMPurifyI { /** Whether DOMPurify is supported in the current environment. */ isSupported: boolean; /** Array of removed elements and attributes from the last sanitization. */ removed: DOMPurifyRemovedItem[]; /** The version of DOMPurify. */ version: string; /** * Add a hook to DOMPurify. * * @param hook - The hook name. * @param cb - The callback to invoke. */ addHook(hook: HookName, cb: (currentNode: Element, data: HookEvent, config: Config) => void): void; /** Clear the current configuration. */ clearConfig(): void; /** * Check if an attribute is valid for a given tag. * * @param tag - The tag name. * @param attr - The attribute name. * @param value - The attribute value. * @returns Whether the attribute is valid. */ isValidAttribute(tag: string, attr: string, value: string): boolean; /** Remove all hooks. */ removeAllHooks(): void; /** * Remove a specific hook. * * @param entryPoint - The hook name. */ removeHook(entryPoint: HookName): void; /** * Remove all callbacks for a specific hook. * * @param entryPoint - The hook name. */ removeHooks(entryPoint: HookName): void; /** * Sanitize a string or DOM node. * * @param source - The input to sanitize. * @returns The sanitized string. */ sanitize(source: Node | string): string; /** * Sanitize a string or DOM node and return a DocumentFragment. * * @param source - The input to sanitize. * @param config - Configuration with RETURN_DOM_FRAGMENT enabled. * @returns The sanitized DocumentFragment. */ sanitize(source: Node | string, config: Config & ConfigReturnDomFragment): DocumentFragment; /** * Sanitize a string or DOM node and return an HTMLElement. * * @param source - The input to sanitize. * @param config - Configuration with RETURN_DOM enabled. * @returns The sanitized HTMLElement. */ sanitize(source: Node | string, config: Config & ConfigReturnDom): HTMLElement; /** * Sanitize a string or DOM node with custom configuration. * * @param source - The input to sanitize. * @param config - The sanitization configuration. * @returns The sanitized string. */ sanitize(source: Node | string, config: Config): string; /** * Set the configuration for DOMPurify. * * @param cfg - The configuration to set. */ setConfig(cfg: Config): void; } /** * An item removed by DOMPurify during sanitization. * * @public * @unofficial */ export interface DOMPurifyRemovedItem { /** The removed attribute, if applicable. */ attribute?: Attr; /** The removed element, if applicable. */ element?: Element; } /** * Configuration options for the daily notes plugin. * * @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. * * @see {@link https://momentjs.com/docs/#/displaying/format/}. */ format?: string; /** * Path to the file to use as a template. */ template?: string; } /** * Internal plugin registration for the daily notes feature. * * @public * @unofficial */ export interface DailyNotesPlugin extends InternalPlugin<DailyNotesPluginInstance> { } /** * Plugin instance for daily notes, providing date-based note creation and navigation. * * @public * @unofficial */ export interface DailyNotesPluginInstance extends InternalPluginInstance<DailyNotesPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Configuration options for daily notes. */ options: DailyNotesOptions; /** * Reference to the daily notes plugin registration. */ plugin: DailyNotesPlugin; /** * Get the date timestamp from the currently open file name, or `null` if not a daily note. * * @returns The date timestamp, or `null`. */ getCurrentFileDateTimestamp(): null | number; /** * Get or create the daily note for the given date. * * @param date - The moment date to get the daily note for. * @returns The daily note file, or `null`/`undefined`. */ getDailyNote(date: typeof momentInstance): Promise<null | TFile | undefined>; /** * Get the configured date format string for daily note filenames. * * @returns The date format string. */ getFormat(): string; /** * Navigate to the next existing daily note after the given timestamp. * * @param timestamp - The reference timestamp. * @returns A promise that resolves when navigation is complete. */ gotoNextExisting(timestamp: number): Promise<void>; /** * Navigate to the previous existing daily note before the given timestamp. * * @param timestamp - The reference timestamp. * @returns A promise that resolves when navigation is complete. */ gotoPreviousExisting(timestamp: number): Promise<void>; /** * Iterate over all daily notes in the vault, invoking the callback for each. * * @param callback - The callback to invoke for each daily note. */ iterateDailyNotes(callback: (file: TFile, timestamp: number) => void): void; /** * Handle external settings file changes and reload configuration. * * @returns A promise that resolves when the settings are reloaded. */ onExternalSettingsChange(): Promise<void>; /** * Handle the open daily note command event. * * @param evt - The triggering event. * @returns A promise that resolves when the daily note is opened. */ onOpenDailyNote(evt: Event): Promise<void>; } /** * Common members for {@link obsidian#CapacitorAdapter} and {@link obsidian#FileSystemAdapter}. * * @public * @unofficial */ export interface DataAdapterEx extends DataAdapter, PromisedQueue { /** * Base OS path for the vault (e.g. `/home/user/vault`, or `C:\Users\user\documents\vault`). */ basePath: string; /** * Mapping of file/folder path to vault entry, includes non-MD files. */ files: DataAdapterFilesRecord; /** * Handles vault events. */ handler: FileSystemWatchHandler | null; /** * Whether the file system is case-insensitive. */ insensitive: boolean; /** * Triggers handler for vault events. */ 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. */ _exists(fullPath: string, sensitive?: boolean): Promise<boolean>; /** * Get canonical full path of file. * * @param path - path to file. * @returns Full path to file. */ getFullPath(path: string): string; /** * Get canonical full path of file. * * @param normalizedPath - normalized path to file. * @returns String full path to file. */ getFullRealPath(normalizedPath: string): 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. */ getRealPath(path: string): string; /** * Generates `this.files` for specific directory of the vault * * @param normalizedPath - The path to list recursively. * @returns A promise that resolves when the recursive listing is complete. */ listRecursive(normalizedPath: string): Promise<void>; /** * Handle a file change event for the given path. * * @param normalizedPath - The path that changed. */ onFileChange(normalizedPath: null | string): void; /** * 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. */ reconcileDeletion(normalizedPath: string, normalizedNewPath: string, shouldSkipDeletionTimeout?: boolean): Promise<void>; /** * Reconcile a file. * * @param normalizedPath - normalized path to file. * @param normalizedNewPath - normalized new path to file. * @param shouldSkipDeletionTimeout - whether the deletion timeout should be skipped - applies only to {@link DataAdapterEx.reconcileDeletion}. * @returns A promise that resolves when the file is reconciled. */ reconcileFile(normalizedPath: string, normalizedNewPath: string, shouldSkipDeletionTimeout?: boolean): Promise<void>; /** * Reconcile a folder creation between old and new paths. * * @param normalizedPath - normalized original path. * @param normalizedNewPath - normalized new path. * @returns A promise that resolves when the folder creation is reconciled. */ reconcileFolderCreation(normalizedPath: string, normalizedNewPath: string): Promise<void>; /** * Reconcile changes to an internal (config) file. * * @param normalizedPath - normalized path to the internal file. * @returns A promise that resolves when the internal file is reconciled. */ reconcileInternalFile(normalizedPath: string): Promise<void>; /** * Reconcile a symbolic link creation between old and new paths. * * @param normalizedPath - The original path. * @param normalizedNewPath - normalized new path. * @returns A promise that resolves when the symbolic link creation is reconciled. */ reconcileSymbolicLinkCreation(normalizedPath: string, normalizedNewPath: string): Promise<void>; /** * Remove file from files listing and trigger deletion event. * * @param normalizedPath - normalized path of the file to remove. */ removeFile(normalizedPath: string): void; /** * Remove all listeners. */ stopWatch(): void; /** * Set whether OS is insensitive to case. * * @param normalizedPath - normalized path to update. * @returns A promise that resolves when the update is complete. */ update(normalizedPath: string): Promise<void>; /** * Add change watcher to path. * * @param handler - handler for file system changes. * @returns A promise that resolves when the watcher is registered. */ watch(handler: FileSystemWatchHandler): Promise<void>; } /** * Record mapping file paths to their file entry metadata in the data adapter. * * @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> { } /** * Entry for a file system watcher registered by the data adapter. * * @public * @unofficial */ export interface DataAdapterWatchersRecordEntry { /** * Resolved full path to the folder. */ resolvedPath: string; /** * Node.js file system watcher. */ watcher: FSWatcher; } /** * Represents a WebSQL database instance. * * @public * @unofficial */ export interface Database { /** * Current version string of the database schema. */ version: string; /** * Change the database version, optionally running a migration transaction. */ changeVersion(oldVersion: string, newVersion: string, callback?: (transaction: SQLTransaction) => void, errorCallback?: (error: SQLError) => void, successCallback?: () => void): void; /** * Execute a read-only transaction against the database. */ readTransaction(callback: (transaction: SQLTransaction) => void, errorCallback?: (error: SQLError) => void, successCallback?: () => void): void; /** * Execute a read-write transaction against the database. */ 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 { } /** * A record of HTML attribute names to values. * * @public * @unofficial */ export interface DecorationAttributes { /** An HTML attribute value. */ [key: string]: string; } /** * A lazily loaded view placeholder that defers initialization until the view is actually needed. * * @public * @unofficial */ export interface DeferredView extends View { } /** * Definition of a Mermaid diagram type. * * @public * @unofficial */ export interface DiagramDefinition { /** Database/data store for the diagram. */ db: unknown; /** Parser for the diagram syntax. */ parser: unknown; /** Renderer for the diagram. */ renderer: unknown; /** Styles for the diagram. */ styles?: unknown; } /** * Module containing a diagram definition. * * @public * @unofficial */ export interface DiagramDefinitionModule { /** The diagram definition. */ diagram: DiagramDefinition; } /** * Width and height dimensions. * * @public * @unofficial */ export interface Dimensions { /** * The height. */ height: number; /** * The width. */ width: number; } /** * A CodeMirror 5 document instance. * * @public * @unofficial */ export interface Doc { /** The mode specification for this document. */ modeOption: Cm5ModeSpec<unknown> | string; /** * Adds a line widget below the given line. * * @param line - The line number or handle. * @param node - The DOM node to display. * @param options - Optional widget configuration. * @returns The created line widget. */ addLineWidget(line: Cm5LineHandle | number, node: HTMLElement, options?: Cm5LineWidgetOptions): Cm5LineWidget; /** * Adds a new selection to the existing set of selections. * * @param anchor - The anchor position. * @param head - The optional head position. */ addSelection(anchor: Position, head?: Position): void; /** * Returns a number that can later be passed to isClean to test whether any edits were made. * * @param closeEvent - Whether to close the current history event. * @returns The generation number. */ changeGeneration(closeEvent?: boolean): number; /** * Clears the editor's undo history. */ clearHistory(): void; /** * Create an identical copy of this document. * * @param copyHistory - Whether to copy the history. * @returns The new document. */ copy(copyHistory: boolean): Doc; /** * Iterate over the whole document, calling f for each line. * * @param f - The function to call for each line. */ eachLine(f: (line: Cm5LineHandle) => void): void; /** * Iterate over a range of lines. * * @param start - The start line number. * @param end - The end line number (exclusive). * @param f - The function to call for each line. */ eachLine(start: number, end: number, f: (line: Cm5LineHandle) => void): void; /** * Moves the head of the selection while leaving the anchor in place. * * @param from - The position to extend from. * @param to - Optional end of region to select. * @param options - Optional selection options. */ extendSelection(from: Position, to?: Position, options?: Cm5SelectionOptions): void; /** * Like extendSelection, but acts on all selections at once. * * @param heads - The new head positions. * @param options - Optional selection options. */ extendSelections(heads: Position[], options?: Cm5SelectionOptions): void; /** * Applies a function to all selections and calls extendSelections on the result. * * @param f - The function to apply to each range. */ extendSelectionsBy(f: (range: Cm5Range) => Position): void; /** * Returns an array of all the bookmarks and marked ranges found between the given positions. * * @param from - The start position. * @param to - The end position. * @returns An array of text markers. */ findMarks(from: Position, to: Position): TextMarker[]; /** * Returns an array of all the bookmarks and marked ranges at the given position. * * @param pos - The position. * @returns An array of text markers. */ findMarksAt(pos: Position): TextMarker[]; /** * Get the first line of the editor. * * @returns The number of the first line (usually `0`). */ firstLine(): number; /** * Returns an array containing all marked ranges in the document. * * @returns An array of text markers. */ getAllMarks(): TextMarker[]; /** * Gets the cursor position. * * @param start - Optional string indicating which end of the selection to return. * @returns The cursor position. */ getCursor(start?: string): Position; /** * Retrieve the editor associated with this document. * * @returns The editor, or `null`. */ getEditor(): Cm5Editor | null; /** Get the value of the 'extending' flag. */ getExtending(): boolean; /** * Get a JSON-serializable representation of the undo history. * * @returns The history object. */ getHistory(): unknown; /** * Gets the content of the given line. * * @param n - The line number. * @returns The content of the line. */ getLine(n: number): string; /** * Fetches the line handle for the given line number. * * @param num - The line number. * @returns The line handle. */ getLineHandle(num: number): Cm5LineHandle; /** * Given a line handle, returns the current position of that line. * * @param handle - The line handle. * @returns The line number, or `null` if no longer in the document. */ getLineNumber(handle: Cm5LineHandle): null | number; /** * Gets the mode object for this document. * * @returns The mode object. */ getMode(): Cm5Mode<unknown>; /** * Gets the text between the given points. * * @param from - The start position. * @param to - The end position. * @param separator - Optional line separator. * @returns The text between the positions. */ getRange(from: Position, to: Position, separator?: string): string; /** * Gets the currently selected text. * * @param lineSep - Optional line separator. * @returns The selected text. */ getSelection(lineSep?: string): string; /** * Returns an array containing a string for each selection. * * @param lineSep - Optional line separator. * @returns The selected texts. */ getSelections(lineSep?: string): string[]; /** * Gets the editor content. * * @param separator - Optional line separator. * @returns The editor content. */ getValue(separator?: string): string; /** * Gets the number of undo/redo operations available. * * @returns An object with `undo` and `redo` counts. */ historySize(): DocHistorySize; /** * The reverse of posFromIndex. * * @param object - The position. * @returns The zero-based index. */ indexFromPos(object: Position): number; /** * Returns whether the document is currently clean. * * @param generation - Optional generation value from changeGeneration. * @returns Whether the document is clean. */ isClean(generation?: number): boolean; /** * Will call the given function for all documents linked to this document. * * @param fn - The function to call for each linked document. */ iterLinkedDocs(fn: (doc: Doc, sharedHist: boolean) => void): void; /** * Get the last line of the editor. * * @returns The number of the last line. */ lastLine(): number; /** * Gets the number of lines in the document. * * @returns The line count. */ lineCount(): number; /** * Returns the preferred line separator string for this document. * * @returns The line separator string. */ lineSeparator(): string; /** * Create a new document linked to this one. * * @param options - Link options. * @returns The linked document. */ linkedDoc(options: Cm5LinkedDocOptions): Doc; /** Set the editor content as 'clean'. */ markClean(): void; /** * Marks a range of text with a specific CSS class. * * @param from - The start position. * @param to - The end position. * @param options - Optional marker options. * @returns The created text marker. */ markText(from: Position, to: Position, options?: Cm5TextMarkerOptions): TextMarker; /** * Removes an event listener. * * @param eventName - The event name. * @param handler - The handler to remove. */ off(eventName: string, handler: (...args: unknown[]) => void): void; /** * Registers an event listener. * * @param eventName - The event name. * @param handler - The handler to register. */ on(eventName: string, handler: (...args: unknown[]) => void): void; /** * Calculates a position for a zero-based index. * * @param index - The zero-based index. * @returns The position. */ posFromIndex(index: number): Position; /** * Redoes the last undone edit. */ redo(): void; /** Redo one undone selection change. */ redoSelection(): void; /** * Remove the given line from the document. * * @param n - The line number. */ removeLine(n: number): void; /** * Removes a line widget. * * @param widget - The widget to remove. */ removeLineWidget(widget: Cm5LineWidget): void; /** * Replaces the range between the given points with the given string. * * @param replacement - The replacement text. * @param from - The start position. * @param to - The optional end position. * @param origin - Optional origin string. */ replaceRange(replacement: string, from: Position, to?: Position, origin?: string): void; /** * Replaces the current selection with the given string. * * @param replacement - The replacement text. * @param select - Optional selection behavior after replacement. */ replaceSelection(replacement: string, select?: "around" | "start"): void; /** * Replaces the content of the selections. * * @param replacements - The replacement strings. * @param collapse - How to collapse selections after replacement. * @param origin - Optional origin string. */ replaceSelections(replacements: string[], collapse?: null | string, origin?: null | string): void; /** * Inserts a bookmark at the given position. * * @param pos - The position of the bookmark. * @param options - Optional bookmark options. * @returns The created text marker. */ setBookmark(pos: Position, options?: Cm5BookmarkOptions): TextMarker; /** * Sets the cursor position. * * @param pos - The position or line number. * @param ch - Optional character position. * @param options - Optional cursor options. */ setCursor(pos: number | Position, ch?: number, options?: Cm5SelectionOptions): void; /** * Sets or clears the 'extending' flag. * * @param value - Whether to enable extending. */ setExtending(value: boolean): void; /** * Replace the editor's undo history. * * @param history - The history object. */ setHistory(history: unknown): void; /** * Set the content of a given line. * * @param n - The line number. * @param text - The new text. */ setLine(n: number, text: string): void; /** * Sets the selection range. * * @param anchor - The anchor position. * @param head - The optional head position. * @param options - Optional selection options. */ setSelection(anchor: Position, head?: Position, options?: Cm5SelectionOptions): void; /** * Sets a new set of selections. * * @param ranges - The selection ranges. * @param primary - The index of the primary selection. * @param options - Optional selection options. */ setSelections(ranges: Cm5SelectionRange[], primary?: number, options?: Cm5SelectionOptions): void; /** * Sets the editor content. * * @param content - The new content. */ setValue(content: string): void; /** * Tells whether the editor currently has a selection. * * @returns `true` if text is selected. */ somethingSelected(): boolean; /** * Undoes the last edit. */ undo(): void; /** Undo one selection change. */ undoSelection(): void; /** * Break the link between two documents. * * @param doc - The document to unlink. */ unlinkDoc(doc: Doc): void; } /** * The number of undo and redo operations available. * * @public * @unofficial */ export interface DocHistorySize { /** The number of redo operations available. */ redo: number; /** The number of undo operations available. */ undo: number; } /** * Parameters for initializing a PDF document. * * @public * @unofficial */ export interface DocumentInitParameters { /** Whether CMap files are packed. */ cMapPacked?: boolean; /** URL for CMap files. */ cMapUrl?: string; /** Document data as ArrayBuffer, string, or Uint8Array. */ data?: ArrayBuffer | string | Uint8Array; /** Whether to disable automatic data fetching. */ disableAutoFetch?: boolean; /** Whether to disable font face creation. */ disableFontFace?: boolean; /** Whether to disable range requests. */ disableRange?: boolean; /** Whether to disable streaming. */ disableStream?: boolean; /** HTTP headers to include in requests. */ httpHeaders?: Record<string, string>; /** Whether eval is supported in the environment. */ isEvalSupported?: boolean; /** Whether OffscreenCanvas is supported. */ isOffscreenCanvasSupported?: boolean; /** Password for encrypted documents. */ password?: string; /** URL for standard font data files. */ standardFontDataUrl?: string; /** Document URL. */ url?: string; /** Whether to use system fonts. */ useSystemFonts?: boolean; /** Verbosity level. */ verbosity?: number; /** Whether to include credentials in requests. */ withCredentials?: boolean; /** PDF.js worker instance. */ worker?: PDFWorker; } /** * The handlers for the DOM events. * * @public * @unofficial */ export interface DomEventsHandlers { /** * Constructor. * * To get the constructor instance, use `getDomEventsHandlersConstructor` from `obsidian-dev-utils/obsidian/constructors/getDomEventsHandlersConstructor`. * * @param info - The info. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(info: DomEventsHandlersInfo): this; /** * Handles the external link click event. * * @param evt - The mouse event. * @param targetEl - The target element. * @param linkText - The link text. * @returns The result of handling the click. */ 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. * @returns The result of handling the right click. */ 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. * @returns The result of handling the click. */ 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. * @returns The result of handling the drag. */ 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. * @returns The result of handling the mouseover. */ 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. * @returns The result of handling the right click. */ onInternalLinkRightClick(evt: MouseEvent, targetEl: HTMLElement, linkText: string): unknown; /** * Handles the tag click event. * * @param evt - The mouse event. * @param targetEl - The target element. * @param tag - The tag text. * @returns The result of handling the tag click. */ onTagClick(evt: MouseEvent, targetEl: HTMLElement, tag: string): unknown; } /** * 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; } /** * Options for downloading a pre-v1.0.0 legacy theme. * * @public * @unofficial */ export interface DownloadLegacyThemeOptions { /** * GitHub repository identifier (e.g. "username/repo"). */ repo: string; } /** * Manager for drag-and-drop operations throughout the application. * * @public * @unofficial */ export interface DragManager { /** * Element displaying the current drop action label. */ actionEl: HTMLElement | null; /** * Reference to the app. */ app: App; /** * Currently active draggable item. */ draggable: Draggable | null; /** * Information about the initial drag start event. */ dragStart: DragStartEvent | null; /** * Ghost element shown while dragging. */ ghostEl: HTMLElement | null; /** * CSS class currently applied to the hover target. */ hoverClass: string; /** * Element currently being hovered over during drag. */ hoverEl: HTMLElement | null; /** * Whether the drag-over event has been handled by a drop target. */ isDragOverHandled: boolean; /** * Overlay element shown during drag operations to indicate drop zones. */ overlayEl: HTMLElement; /** * Whether the overlay should be hidden on the next update. */ shouldHideOverlay: boolean; /** * CSS class applied to the source elements during drag. */ sourceClass: string; /** * Elements from which the drag originated. */ sourceEls: HTMLElement[] | null; /** * Constructor. * * To get the constructor instance, use {@link getDragManagerConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App): this; /** * Start a drag operation for a single file. * * @param event - The originating drag event. * @param file - File to drag. * @param source - Source component initiating the drag. * @returns The created draggable item. */ dragFile(event: DragEvent, file: TFile, source?: unknown): Draggable; /** * Start a drag operation for multiple files. * * @param event - The originating drag event. * @param files - Files to drag. * @param source - Source component initiating the drag. * @returns The created draggable item, or `null`. */ dragFiles(event: DragEvent, files: TAbstractFile[], source?: unknown): Draggable | null; /** * Start a drag operation for a folder. * * @param event - The originating drag event. * @param folder - Folder to drag. * @param source - Source component initiating the drag. * @returns The created draggable item. */ dragFolder(event: DragEvent, folder: TFolder, source?: unknown): Draggable; /** * Start a drag operation for a link. * * @param event - The originating drag event. * @param linkText - Link text to drag. * @param sourcePath - Path of the source file for link resolution. * @param title - Display title for the drag ghost. * @param source - Source component initiating the drag. * @returns The created draggable item. */ dragLink(event: DragEvent, linkText: string, sourcePath: string, title?: string, source?: unknown): Draggable; /** * Register an element as a drag source with a callback to produce a draggable. * * @param el - Element to register as drag source. * @param draggableGetter - Callback returning a draggable on drag start. */ handleDrag(el: HTMLElement, draggableGetter: (event: DragEvent) => Draggable | null): void; /** * Register an element as a drop target with a handler callback. * * @param el - Element to register as drop target. * @param dropHandler - Callback invoked on drop or drag-over. * @param draggable - Whether the element itself is also draggable. */ handleDrop(el: HTMLElement, dropHandler: (event: DragEvent, draggable: Draggable, isOver: boolean) => DropResult | null, draggable?: boolean): void; /** * Hide the drop zone overlay. */ hideOverlay(): void; /** * Handle the end of a drag operation, cleaning up state. */ onDragEnd(): void; /** * Handle the drag-leave event on a drop target. * * @param event - The drag-leave event. */ onDragLeave(event: DragEvent): void; /** * Handle the drag-over event to update hover state. * * @param event - The drag-over event. */ onDragOver(event: DragEvent): void; /** * Handle the first drag-over event when entering a drop zone. */ onDragOverFirst(): void; /** * Handle the start of a drag operation with a draggable item. * * @param event - The drag event. * @param draggable - The draggable item being dragged. */ onDragStart(event: DragEvent, draggable: Draggable): void; /** * Handle a global drag start event. * * @param event - The drag event. */ onDragStartGlobal(event: DragEvent): void; /** * Handle touch end event for mobile drag operations. * * @param event - The touch event. */ onTouchEnd(event: TouchEvent): void; /** * Remove the drop zone overlay element from the DOM. */ removeOverlay(): void; /** * Set the current drop action label. * * @param action - Action label text, or `null` to clear. */ setAction(action: null | string): void; /** * Show the drop zone overlay at the specified position. * * @param doc - Document in which to show the overlay. * @param rect - Rectangle defining the overlay position. */ showOverlay(doc: Document, rect: DOMRect): void; /** * Update the hover target element and its CSS class. * * @param hoverEl - Element to highlight as hover target, or `null`. * @param hoverClass - CSS class to apply to the hover element. */ updateHover(hoverEl: HTMLElement | null, hoverClass: string): void; /** * Update the drag source elements and their CSS class. * * @param sourceEls - Source elements, or `null`. * @param sourceClass - CSS class to apply to source elements. */ updateSource(sourceEls: HTMLElement[] | null, sourceClass: string): void; } /** * Information about the initial drag start event. * * @public * @unofficial */ export interface DragStartEvent { /** * The original drag event. */ evt: DragEvent; /** * Whether the dragged item has moved from its starting position. */ moved: boolean; } /** * Represents a draggable item in the drag-and-drop system. * * @public * @unofficial */ export interface Draggable { /** * Single file being dragged, if applicable. */ file?: TAbstractFile; /** * Multiple files being dragged, if applicable. */ files?: TAbstractFile[]; /** * Icon identifier for the drag ghost element. */ icon: string; /** * Link text for link-type drags. */ linktext?: string; /** * Source component that initiated the drag. */ source?: unknown; /** * Path of the source file for link resolution. */ sourcePath?: string; /** * Display title shown on the drag ghost element. */ title: string; /** * Type of draggable (e.g. "file", "folder", "link"). */ type: string; } /** * Result returned from a drop handler indicating the outcome of a drop operation. * * @public * @unofficial */ export interface DropResult { /** * Action identifier describing what happened on drop (e.g. "link", "move"). */ action: null | string; /** * The drop effect to apply to the drag event. */ dropEffect: "copy" | "link" | "move" | "none"; /** * CSS class to apply to the hover target element. */ hoverClass?: string; /** * Element to highlight as the current drop target. */ hoverEl?: HTMLElement | null; } /** * Spatial index (R-tree) for efficient hit-testing and spatial queries on canvas edges and nodes. * * @public * @unofficial */ export interface EdgeIndex extends EdgeIndexBase { /** * Maximum number of entries per R-tree node before splitting. */ _maxEntries: number; /** * Minimum number of entries per R-tree node before merging. */ _minEntries: number; /** * Root data node of the R-tree. */ data: EdgeIndexData; /** * Compare two items by their minimum X coordinate for sorting. * * @returns The comparison result. */ compareMinX(arg1: unknown, arg2: unknown): unknown; /** * Compare two items by their minimum Y coordinate for sorting. * * @returns The comparison result. */ compareMinY(arg1: unknown, arg2: unknown): unknown; } /** * Base interface for the spatial edge index, extending the R-tree with custom insert/remove behavior. * * @public * @unofficial */ export interface EdgeIndexBase extends EdgeIndexBaseBase { /** * Insert an item into the spatial index. * * @returns The updated index. */ insert(arg1: unknown): unknown; /** * Remove an item from the spatial index. * * @returns The updated index. */ remove(arg1: unknown): unknown; /** * Convert an item to its bounding box representation. * * @returns The bounding box. */ toBBox(arg1: unknown): unknown; } /** * R-tree spatial index base implementation for efficient spatial queries on canvas elements. * * @public * @unofficial */ export interface EdgeIndexBaseBase { /** * Adjust parent bounding boxes after an insertion or modification. * * @returns The result of adjusting parent bounding boxes. */ _adjustParentBBoxes(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Traverse all items in the tree, calling the callback for each. * * @returns The result of traversing all items. */ _all(arg1: unknown, arg2: unknown): unknown; /** * Calculate the distribution margin for all possible splits along an axis. * * @returns The distribution margin. */ _allDistMargin(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; /** * Build the R-tree from a set of items. * * @returns The built R-tree node. */ _build(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; /** * Choose the best axis for splitting an overflowing node. * * @returns The result of choosing the split axis. */ _chooseSplitAxis(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Choose the best split index along the chosen axis. * * @returns The best split index. */ _chooseSplitIndex(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Choose the best subtree for inserting a new item. * * @returns The chosen subtree. */ _chooseSubtree(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; /** * Condense the tree by removing empty branches after a deletion. * * @returns The result of condensing the tree. */ _condense(arg1: unknown): unknown; /** * Internal insert method that places an item at the specified tree level. * * @returns The result of inserting the item. */ _insert(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Split an overflowing tree node into two nodes. * * @returns The result of splitting the node. */ _split(arg1: unknown, arg2: unknown): unknown; /** * Split the root node when it overflows. * * @returns The result of splitting the root. */ _splitRoot(arg1: unknown, arg2: unknown): unknown; /** * Return all items stored in the index. * * @returns All items in the index. */ all(): unknown; /** * Remove all items from the index. * * @returns The cleared index. */ clear(): unknown; /** * Check whether any items in the index collide with the given bounding box. * * @returns Whether a collision was found. */ collides(arg1: unknown): unknown; /** * Compare two items by their minimum X coordinate for sorting. * * @returns The comparison result. */ compareMinX(arg1: unknown, arg2: unknown): unknown; /** * Compare two items by their minimum Y coordinate for sorting. * * @returns The comparison result. */ compareMinY(arg1: unknown, arg2: unknown): unknown; /** * Load the index state from a JSON representation. * * @returns The loaded index. */ fromJSON(arg1: unknown): unknown; /** * Insert an item into the spatial index. * * @returns The updated index. */ insert(arg1: unknown): unknown; /** * Bulk-load a set of items into the index. * * @returns The updated index. */ load(arg1: unknown): unknown; /** * Remove an item from the index, optionally using a custom equality function. * * @returns The updated index. */ remove(arg1: unknown, arg2: unknown): unknown; /** * Search for all items that intersect the given bounding box. * * @returns The matching items. */ search(arg1: unknown): unknown; /** * Convert an item to its bounding box representation. * * @returns The bounding box. */ toBBox(arg1: unknown): unknown; /** * Serialize the index state to a JSON representation. * * @returns The JSON representation. */ toJSON(): unknown; } /** * Node in the spatial index (R-tree) for canvas edges. * * @public * @unofficial */ export interface EdgeIndexData extends BBox { /** * Child edges contained in this index node. */ children: CanvasViewCanvasEdge[]; /** * Height of the subtree rooted at this node. */ height: number; /** * Whether this is a leaf node in the index. */ leaf: boolean; } /** * {@link obsidian#Editor} language support. * * @public * @unofficial */ export interface EditorLanguageSupport { } /** * An extended editor range with nullable start and end positions. * * @public * @unofficial */ export interface EditorRangeEx { /** * Start position of the range, or null if unset. */ from: EditorPosition | null; /** * End position of the range, or null if unset. */ to: EditorPosition | null; } /** * Search component embedded in the editor for find-and-replace functionality. * * @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. * * @param ranges - The editor ranges to highlight. * @remark Invokes editor.addHighlights. */ highlight(ranges: EditorRange[]): void; /** * Highlights all matches if search element focused. * * @param e - The keyboard event that triggered the action. */ onAltEnter(e?: KeyboardEvent): void; /** * Replace all search results with specified text if replace mode and replacement element is focused. * * @param e - The keyboard event that triggered the action. */ 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. * * @param replace - Whether to show the replace input. */ show(replace: boolean): void; } /** * A selection specified as an anchor position and optional head position. * * @public * @unofficial */ export interface EditorStateSelectionSpec { /** * The anchor position of the selection. */ anchor: number; /** The head position of the selection. */ head?: number; } /** * Internal plugin registration for the editor status bar feature. * * @public * @unofficial */ export interface EditorStatusPlugin extends InternalPlugin<EditorStatusPluginInstance> { } /** * Plugin instance for editor status, displaying editor information in the status bar. * * @public * @unofficial */ export interface EditorStatusPluginInstance extends InternalPluginInstance<EditorStatusPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Whether this plugin is hidden from the plugin list in settings. */ hiddenFromList: true; /** * Reference to the editor status plugin registration. */ plugin: EditorStatusPlugin; } /** * Extended editor suggest interface for managing editor suggestion providers. * * @public * @unofficial */ export interface EditorSuggestEx { /** * Currently active and rendered editor suggestion popup. */ currentSuggest?: EditorSuggest<unknown>; /** * Registered editor suggestion providers. */ suggests: EditorSuggest<unknown>[]; /** * Registers an editor suggestion provider. * * @param suggest - The provider to add. */ addSuggest(suggest: EditorSuggest<unknown>): void; /** * Closes the active suggestion provider. */ close(): void; /** * Checks whether a suggestion popup is currently shown. * * @returns Whether a suggestion is showing. */ isShowingSuggestion(): boolean; /** * Unregisters an editor suggestion provider. * * @param suggest - The provider to remove. */ removeSuggest(suggest: EditorSuggest<unknown>): void; /** * Repositions the active suggestion popup. */ reposition(): void; /** * Sets the active suggestion provider, closing the previous one. * * @param suggest - The provider to activate, or `null` to clear. */ setCurrentSuggest(suggest: EditorSuggest<unknown> | null): void; /** * Triggers the registered suggestion providers at the cursor. * * @param editor - The editor. * @param file - The file being edited. * @param force - Whether to force the suggestion popup open. */ trigger(editor: Editor, file: TFile, force: boolean): void; } /** * Manager for editor suggestion popups providing autocompletion in the editor. * * @public * @unofficial */ export interface EditorSuggests { /** * Currently active and rendered editor suggestion popup. */ currentSuggest: EditorSuggest<unknown> | null; /** * 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. * * @param suggest - Suggestion provider to add. */ addSuggest(suggest: EditorSuggest<unknown>): void; /** * Close the currently active editor suggestion popup. */ close(): void; /** * Constructor. * * To get the constructor instance, use {@link getEditorSuggestsConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App): this; /** * Whether there is a editor suggestion popup active and visible. * * @returns Whether a suggestion popup is visible. */ isShowingSuggestion(): boolean; /** * Remove a registered editor suggestion from the list of registered suggestion providers. * * @param suggest - Suggestion provider to remove. */ 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. * * @param suggest - Suggestion provider to activate. */ setCurrentSuggest(suggest: EditorSuggest<unknown>): void; /** * Run check on focused editor to see whether a suggestion should be triggered and rendered. * * @param editor - The editor view. * @param t - The file being edited. * @param n - Whether to force trigger. */ trigger(editor: MarkdownBaseView, t: TFile, n: boolean): void; } /** * Screen coordinates with x and y values. * * @public * @unofficial */ export interface EditorViewCoords { /** The x coordinate. */ x: number; /** The y coordinate. */ y: number; } /** * Padding above and below the document. * * @public * @unofficial */ export interface EditorViewDocumentPadding { /** The bottom padding in pixels. */ bottom: number; /** The top padding in pixels. */ top: number; } /** * A DOM position with a node and offset. * * @public * @unofficial */ export interface EditorViewDomPosition { /** The DOM node. */ node: Node; /** The offset within the node. */ offset: number; } /** * A range defined by from and to positions. * * @public * @unofficial */ export interface EditorViewRange { /** The start position. */ from: number; /** The end position. */ to: number; } /** * Options for the scroll handler facet. * * @public * @unofficial */ export interface EditorViewScrollHandlerOptions { /** Horizontal alignment. */ x: "center" | "end" | "nearest" | "start"; /** Horizontal margin in pixels. */ xMargin: number; /** Vertical alignment. */ y: "center" | "end" | "nearest" | "start"; /** Vertical margin in pixels. */ yMargin: number; } /** * Options for scrolling into view. * * @public * @unofficial */ export interface EditorViewScrollIntoViewOptions { /** Horizontal alignment. */ x?: "center" | "end" | "nearest" | "start"; /** Horizontal margin in pixels. */ xMargin?: number; /** Vertical alignment. */ y?: "center" | "end" | "nearest" | "start"; /** Vertical margin in pixels. */ yMargin?: number; } /** * Internal view state of the editor. * * @public * @unofficial */ export interface EditorViewState { /** * Whether the editor is currently in printing mode. */ printing: boolean; } /** * Options for creating a theme. * * @public * @unofficial */ export interface EditorViewThemeOptions { /** Whether this is a dark theme. */ dark?: boolean; } /** * A record of CSS selectors to style values for theme definitions. * * @public * @unofficial */ export interface EditorViewThemeSpec { /** A style value for a CSS selector. */ [selector: string]: unknown; } /** * Options for the application's about panel. * * @public * @unofficial */ export interface ElectronAboutPanelOptionsOptions { /** The app's name. */ applicationName?: string; /** The app's version. */ applicationVersion?: string; /** List of app authors. Linux only. */ authors?: string[]; /** Copyright information. */ copyright?: string; /** Credit information. macOS and Windows only. */ credits?: string; /** Path to the app's icon in a JPEG or PNG file format. Linux and Windows only. */ iconPath?: string; /** The app's build version number. macOS only. */ version?: string; /** The app's website. Linux only. */ website?: string; } /** * Options for `NativeImage.addRepresentation`. * * @public * @unofficial */ export interface ElectronAddRepresentationOptions { /** The buffer containing the raw image data. */ buffer?: Buffer; /** The data URL containing either a base 64 encoded PNG or JPEG image. */ dataURL?: string; /** * The height of the image representation. Required if a bitmap buffer is specified as `buffer`. * * @default `0` */ height?: number; /** The scale factor to add the image representation for. */ scaleFactor: number; /** * The width of the image representation. Required if a bitmap buffer is specified as `buffer`. * * @default `0` */ width?: number; } /** * Describes the system-wide animation settings. * * @public * @unofficial */ export interface ElectronAnimationSettings { /** Determines whether the user desires reduced motion based on platform APIs. */ prefersReducedMotion: boolean; /** Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled. */ scrollAnimationsEnabledBySystem: boolean; /** Returns `true` if rich animations should be rendered. Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations. */ shouldRenderRichAnimation: boolean; } /** * Electron App for controlling the application lifecycle. * * @public * @unofficial */ export interface ElectronApp { /** * Whether Chrome's accessibility support is enabled. Setting this to `true` manually enables * accessibility support. Must be set after the `ready` event is emitted. macOS and Windows only. */ accessibilitySupportEnabled: boolean; /** The application menu, or `null` if none has been set. */ applicationMenu: ElectronMenu | null; /** The badge count for the current app. Setting the count to `0` hides the badge. Linux and macOS only. */ badgeCount: number; /** Reads and manipulates the command line arguments that Chromium uses. */ readonly commandLine: ElectronCommandLine; /** Performs actions on the app icon in the user's dock. macOS only. */ readonly dock: ElectronDock; /** Whether the app is packaged. Can be used to distinguish development and production environments. */ readonly isPackaged: boolean; /** The current application's name, from the application's `package.json` file. */ name: string; /** Whether the app is currently running under an ARM64 translator (Rosetta or Windows WOW). macOS and Windows only. */ readonly runningUnderARM64Translation: boolean; /** * Whether the app is currently running under the Rosetta Translator Environment. macOS only. * * @deprecated Deprecated by Electron. */ readonly runningUnderRosettaTranslation: boolean; /** The user agent string Electron uses as a global fallback. */ userAgentFallback: string; /** * Adds a listener for the `accessibility-support-changed` event. * * Emitted when Chrome's accessibility support changes. macOS and Windows only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "accessibility-support-changed", listener: (event: ElectronEvent, accessibilitySupportEnabled: boolean) => void): this; /** * Adds a listener for the `activate` event. * * Emitted when the application is activated. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "activate", listener: (event: ElectronEvent, hasVisibleWindows: boolean) => void): this; /** * Adds a listener for the `activity-was-continued` event. * * Emitted during Handoff after an activity from this device was successfully resumed on another one. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "activity-was-continued", listener: (event: ElectronEvent, type: string, userInfo: unknown) => void): this; /** * Adds a listener for the `before-quit` event. * * Emitted before the application starts closing its windows. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "before-quit", listener: (event: ElectronEvent) => void): this; /** * Adds a listener for the `browser-window-blur` event. * * Emitted when a browserWindow gets blurred. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "browser-window-blur", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Adds a listener for the `browser-window-created` event. * * Emitted when a new browserWindow is created. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "browser-window-created", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Adds a listener for the `browser-window-focus` event. * * Emitted when a browserWindow gets focused. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "browser-window-focus", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Adds a listener for the `certificate-error` event. * * Emitted when failed to verify the certificate for a URL. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "certificate-error", listener: (event: ElectronEvent, webContents: ElectronWebContents, url: string, error: string, certificate: ElectronCertificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void): this; /** * Adds a listener for the `child-process-gone` event. * * Emitted when the child process unexpectedly disappears. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "child-process-gone", listener: (event: ElectronEvent, details: ElectronDetails) => void): this; /** * Adds a listener for the `continue-activity` event. * * Emitted during Handoff when an activity from a different device wants to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "continue-activity", listener: (event: ElectronEvent, type: string, userInfo: unknown, details: ElectronContinueActivityDetails) => void): this; /** * Adds a listener for the `continue-activity-error` event. * * Emitted during Handoff when an activity from a different device fails to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "continue-activity-error", listener: (event: ElectronEvent, type: string, error: string) => void): this; /** * Adds a listener for the `did-become-active` event. * * Emitted every time the app becomes active. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "did-become-active", listener: (event: ElectronEvent) => void): this; /** * Adds a listener for the `first-instance-ack` event. * * Emitted in the second instance during `requestSingleInstanceLock` when the first instance calls the `ackCallback`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "first-instance-ack", listener: (event: ElectronEvent, additionalData: unknown) => void): this; /** * Adds a listener for the `gpu-info-update` event. * * Emitted whenever there is a GPU info update. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "gpu-info-update", listener: (...args: unknown[]) => void): this; /** * Adds a listener for the `gpu-process-crashed` event. * * Emitted when the GPU process crashes or is killed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. * * @deprecated Deprecated by Electron. */ addListener(event: "gpu-process-crashed", listener: (event: ElectronEvent, killed: boolean) => void): this; /** * Adds a listener for the `login` event. * * Emitted when `webContents` wants to do basic auth. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "login", listener: (event: ElectronEvent, webContents: ElectronWebContents, authenticationResponseDetails: ElectronAuthenticationResponseDetails, authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** * Adds a listener for the `new-window-for-tab` event. * * Emitted when the user clicks the native macOS new tab button. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "new-window-for-tab", listener: (event: ElectronEvent) => void): this; /** * Adds a listener for the `open-file` event. * * Emitted when the user wants to open a file with the application. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "open-file", listener: (event: ElectronEvent, path: string) => void): this; /** * Adds a listener for the `open-url` event. * * Emitted when the user wants to open a URL with the application. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "open-url", listener: (event: ElectronEvent, url: string) => void): this; /** * Adds a listener for the `quit` event. * * Emitted when the application is quitting. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "quit", listener: (event: ElectronEvent, exitCode: number) => void): this; /** * Adds a listener for the `ready` event. * * Emitted once, when Electron has finished initializing. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "ready", listener: (event: ElectronEvent, launchInfo: ElectronNotificationResponse | Record<string, unknown>) => void): this; /** * Adds a listener for the `render-process-gone` event. * * Emitted when the renderer process unexpectedly disappears. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "render-process-gone", listener: (event: ElectronEvent, webContents: ElectronWebContents, details: ElectronRenderProcessGoneDetails) => void): this; /** * Adds a listener for the `renderer-process-crashed` event. * * Emitted when the renderer process of `webContents` crashes or is killed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. * * @deprecated Deprecated by Electron. */ addListener(event: "renderer-process-crashed", listener: (event: ElectronEvent, webContents: ElectronWebContents, killed: boolean) => void): this; /** * Adds a listener for the `second-instance` event. * * Emitted inside the primary instance when a second instance is executed and calls `requestSingleInstanceLock`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "second-instance", listener: (event: ElectronEvent, argv: string[], workingDirectory: string, additionalData: unknown, ackCallback: unknown) => void): this; /** * Adds a listener for the `select-client-certificate` event. * * Emitted when a client certificate is requested. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "select-client-certificate", listener: (event: ElectronEvent, webContents: ElectronWebContents, url: string, certificateList: ElectronCertificate[], callback: (certificate?: ElectronCertificate) => void) => void): this; /** * Adds a listener for the `session-created` event. * * Emitted when Electron has created a new `session`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "session-created", listener: (session: Session) => void): this; /** * Adds a listener for the `update-activity-state` event. * * Emitted when Handoff is about to be resumed on another device. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "update-activity-state", listener: (event: ElectronEvent, type: string, userInfo: unknown) => void): this; /** * Adds a listener for the `web-contents-created` event. * * Emitted when a new `webContents` is created. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "web-contents-created", listener: (event: ElectronEvent, webContents: ElectronWebContents) => void): this; /** * Adds a listener for the `will-continue-activity` event. * * Emitted during Handoff before an activity from a different device wants to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "will-continue-activity", listener: (event: ElectronEvent, type: string) => void): this; /** * Adds a listener for the `will-finish-launching` event. * * Emitted when the application has finished basic startup. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "will-finish-launching", listener: (...args: unknown[]) => void): this; /** * Adds a listener for the `will-quit` event. * * Emitted when all windows have been closed and the application will quit. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "will-quit", listener: (event: ElectronEvent) => void): this; /** * Adds a listener for the `window-all-closed` event. * * Emitted when all windows have been closed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ addListener(event: "window-all-closed", listener: (...args: unknown[]) => void): this; /** * Adds `path` to the recent documents list. macOS and Windows only. * * @param path - The path to add. */ addRecentDocument(path: string): void; /** Clears the recent documents list. macOS and Windows only. */ clearRecentDocuments(): void; /** * Configures host resolution (DNS and DNS-over-HTTPS). Must be called after the `ready` event. * * @param options - The host resolver options. */ configureHostResolver(options: ElectronConfigureHostResolverOptions): void; /** * Disables the per-domain blocking of 3D APIs after repeated GPU process crashes. Can only be * called before the app is ready. */ disableDomainBlockingFor3DAPIs(): void; /** Disables hardware acceleration for the current app. Can only be called before the app is ready. */ disableHardwareAcceleration(): void; /** Enables full sandbox mode on the app. Can only be called before the app is ready. */ enableSandbox(): void; /** * Exits immediately with `exitCode`. All windows are closed immediately without asking the user, * and the `before-quit` and `will-quit` events are not emitted. * * @param exitCode - The exit code. * @default `0` */ exit(exitCode?: number): void; /** * Focuses the app. On Linux, focuses the first visible window; on macOS, makes the app active; on * Windows, focuses the app's first window. * * @param options - The focus options. */ focus(options?: ElectronFocusOptions): void; /** * Returns the application name, icon and path of the default handler for the protocol of a URL. * macOS and Windows only. * * @param url - The URL whose protocol handler to look up. * @returns A promise resolved with the handler information. */ getApplicationInfoForProtocol(url: string): Promise<ElectronApplicationInfoForProtocolReturnValue>; /** * Returns the application name of the default handler for the protocol of a URL. * * @param url - The URL whose protocol handler to look up. * @returns The handler application name, or an empty string if there is no handler. */ getApplicationNameForProtocol(url: string): string; /** * Returns memory and CPU usage statistics of all the processes associated with the app. * * @returns The array of process metrics. */ getAppMetrics(): ElectronProcessMetric[]; /** * Returns the current application directory. * * @returns The application directory. */ getAppPath(): string; /** * Returns the current value displayed in the counter badge. Linux and macOS only. * * @returns The badge count. */ getBadgeCount(): number; /** * Returns the type of the currently running activity. macOS only. * * @returns The current activity type. */ getCurrentActivityType(): string; /** * Fetches a path's associated icon. * * @param path - The path whose icon to fetch. * @param options - Options controlling the icon size. * @returns A promise resolved with the icon. */ getFileIcon(path: string, options?: ElectronFileIconOptions): Promise<ElectronNativeImage>; /** * Returns the Graphics Feature Status from `chrome://gpu/`. Only usable after the * `gpu-info-update` event is emitted. * * @returns The GPU feature status. */ getGPUFeatureStatus(): ElectronGPUFeatureStatus; /** * Returns GPU information as in Chromium's GPUInfo object. * * @param infoType - The level of detail to return. * @returns A promise resolved with the GPU information. */ getGPUInfo(infoType: "basic" | "complete"): Promise<unknown>; /** * Returns the current settings of the Jump List. Windows only. * * @returns The Jump List settings. */ getJumpListSettings(): ElectronJumpListSettings; /** * Returns the current application locale, fetched using Chromium's `l10n_util` library. * * @returns The locale string. */ getLocale(): string; /** * Returns the operating system's locale two-letter ISO 3166 country code. * * @returns The country code, or an empty string when it cannot be detected. */ getLocaleCountryCode(): string; /** * Returns the app's login item settings. macOS and Windows only. * * @param options - Options used to compare against the current login item settings. * @returns The login item settings. */ getLoginItemSettings(options?: ElectronLoginItemSettingsOptions): ElectronLoginItemSettings; /** * Returns the current application's name, from the application's `package.json` file. * * @returns The application name. */ getName(): string; /** * Returns a path to a special directory or file associated with `name`. * * @param name - The name of the special path to retrieve. * @returns The full path. */ getPath(name: "appData" | "cache" | "crashDumps" | "desktop" | "documents" | "downloads" | "exe" | "home" | "logs" | "module" | "music" | "pictures" | "recent" | "temp" | "userData" | "videos"): string; /** * Returns the user's preferred system languages, most preferred first, as BCP 47 language tags. * * @returns The preferred system languages. */ getPreferredSystemLanguages(): string[]; /** * Returns the system's current locale as a BCP 47 language tag. * * @returns The system locale. */ getSystemLocale(): string; /** * Returns the version of the loaded application. * * @returns The version string. */ getVersion(): string; /** * Returns whether this instance of the app is currently holding the single instance lock. * * @returns Whether this instance holds the single instance lock. */ hasSingleInstanceLock(): boolean; /** Hides all application windows without minimizing them. macOS only. */ hide(): void; /** * Imports the certificate in pkcs12 format into the platform certificate store. Linux only. * * @param options - The certificate import options. * @param callback - Called with the result of the import operation (`0` indicates success). */ importCertificate(options: ElectronImportCertificateOptions, callback: (result: number) => void): void; /** Invalidates the current Handoff user activity. macOS only. */ invalidateCurrentActivity(): void; /** * Returns whether Chrome's accessibility support is enabled. macOS and Windows only. * * @returns Whether accessibility support is enabled. */ isAccessibilitySupportEnabled(): boolean; /** * Returns whether the current executable is the default handler for a protocol. * * @param protocol - The protocol name, without the `://`. * @param path - The executable path to compare against. * @param args - The arguments to compare against. * @returns Whether the current executable is the default handler. */ isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; /** * Returns whether the current OS version allows for native emoji pickers. * * @returns Whether native emoji pickers are supported. */ isEmojiPanelSupported(): boolean; /** * Returns whether the application is currently hidden. macOS only. * * @returns Whether the app is hidden. */ isHidden(): boolean; /** * Returns whether the application is currently running from the system's Application folder. macOS only. * * @returns Whether the app is in the Applications folder. */ isInApplicationsFolder(): boolean; /** * Returns whether Electron has finished initializing. * * @returns Whether the app is ready. */ isReady(): boolean; /** * Returns whether Secure Keyboard Entry is enabled. macOS only. * * @returns Whether Secure Keyboard Entry is enabled. */ isSecureKeyboardEntryEnabled(): boolean; /** * Returns whether the current desktop environment is the Unity launcher. Linux only. * * @returns Whether Unity is running. */ isUnityRunning(): boolean; /** * Moves the current app to the Applications folder. If successful, the app quits and relaunches. macOS only. * * @param options - Options including a conflict handler. * @returns Whether the move was successful. */ moveToApplicationsFolder(options?: ElectronMoveToApplicationsFolderOptions): boolean; /** * Registers a listener for the `accessibility-support-changed` event. * * Emitted when Chrome's accessibility support changes. macOS and Windows only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "accessibility-support-changed", listener: (event: ElectronEvent, accessibilitySupportEnabled: boolean) => void): this; /** * Registers a listener for the `activate` event. * * Emitted when the application is activated. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "activate", listener: (event: ElectronEvent, hasVisibleWindows: boolean) => void): this; /** * Registers a listener for the `activity-was-continued` event. * * Emitted during Handoff after an activity from this device was successfully resumed on another one. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "activity-was-continued", listener: (event: ElectronEvent, type: string, userInfo: unknown) => void): this; /** * Registers a listener for the `before-quit` event. * * Emitted before the application starts closing its windows. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "before-quit", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `browser-window-blur` event. * * Emitted when a browserWindow gets blurred. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "browser-window-blur", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Registers a listener for the `browser-window-created` event. * * Emitted when a new browserWindow is created. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "browser-window-created", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Registers a listener for the `browser-window-focus` event. * * Emitted when a browserWindow gets focused. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "browser-window-focus", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Registers a listener for the `certificate-error` event. * * Emitted when failed to verify the certificate for a URL. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "certificate-error", listener: (event: ElectronEvent, webContents: ElectronWebContents, url: string, error: string, certificate: ElectronCertificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void): this; /** * Registers a listener for the `child-process-gone` event. * * Emitted when the child process unexpectedly disappears. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "child-process-gone", listener: (event: ElectronEvent, details: ElectronDetails) => void): this; /** * Registers a listener for the `continue-activity` event. * * Emitted during Handoff when an activity from a different device wants to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "continue-activity", listener: (event: ElectronEvent, type: string, userInfo: unknown, details: ElectronContinueActivityDetails) => void): this; /** * Registers a listener for the `continue-activity-error` event. * * Emitted during Handoff when an activity from a different device fails to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "continue-activity-error", listener: (event: ElectronEvent, type: string, error: string) => void): this; /** * Registers a listener for the `did-become-active` event. * * Emitted every time the app becomes active. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "did-become-active", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `first-instance-ack` event. * * Emitted in the second instance during `requestSingleInstanceLock` when the first instance calls the `ackCallback`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "first-instance-ack", listener: (event: ElectronEvent, additionalData: unknown) => void): this; /** * Registers a listener for the `gpu-info-update` event. * * Emitted whenever there is a GPU info update. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "gpu-info-update", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `gpu-process-crashed` event. * * Emitted when the GPU process crashes or is killed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. * * @deprecated Deprecated by Electron. */ on(event: "gpu-process-crashed", listener: (event: ElectronEvent, killed: boolean) => void): this; /** * Registers a listener for the `login` event. * * Emitted when `webContents` wants to do basic auth. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "login", listener: (event: ElectronEvent, webContents: ElectronWebContents, authenticationResponseDetails: ElectronAuthenticationResponseDetails, authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** * Registers a listener for the `new-window-for-tab` event. * * Emitted when the user clicks the native macOS new tab button. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "new-window-for-tab", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `open-file` event. * * Emitted when the user wants to open a file with the application. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "open-file", listener: (event: ElectronEvent, path: string) => void): this; /** * Registers a listener for the `open-url` event. * * Emitted when the user wants to open a URL with the application. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "open-url", listener: (event: ElectronEvent, url: string) => void): this; /** * Registers a listener for the `quit` event. * * Emitted when the application is quitting. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "quit", listener: (event: ElectronEvent, exitCode: number) => void): this; /** * Registers a listener for the `ready` event. * * Emitted once, when Electron has finished initializing. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "ready", listener: (event: ElectronEvent, launchInfo: ElectronNotificationResponse | Record<string, unknown>) => void): this; /** * Registers a listener for the `render-process-gone` event. * * Emitted when the renderer process unexpectedly disappears. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "render-process-gone", listener: (event: ElectronEvent, webContents: ElectronWebContents, details: ElectronRenderProcessGoneDetails) => void): this; /** * Registers a listener for the `renderer-process-crashed` event. * * Emitted when the renderer process of `webContents` crashes or is killed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. * * @deprecated Deprecated by Electron. */ on(event: "renderer-process-crashed", listener: (event: ElectronEvent, webContents: ElectronWebContents, killed: boolean) => void): this; /** * Registers a listener for the `second-instance` event. * * Emitted inside the primary instance when a second instance is executed and calls `requestSingleInstanceLock`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "second-instance", listener: (event: ElectronEvent, argv: string[], workingDirectory: string, additionalData: unknown, ackCallback: unknown) => void): this; /** * Registers a listener for the `select-client-certificate` event. * * Emitted when a client certificate is requested. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "select-client-certificate", listener: (event: ElectronEvent, webContents: ElectronWebContents, url: string, certificateList: ElectronCertificate[], callback: (certificate?: ElectronCertificate) => void) => void): this; /** * Registers a listener for the `session-created` event. * * Emitted when Electron has created a new `session`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "session-created", listener: (session: Session) => void): this; /** * Registers a listener for the `update-activity-state` event. * * Emitted when Handoff is about to be resumed on another device. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "update-activity-state", listener: (event: ElectronEvent, type: string, userInfo: unknown) => void): this; /** * Registers a listener for the `web-contents-created` event. * * Emitted when a new `webContents` is created. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "web-contents-created", listener: (event: ElectronEvent, webContents: ElectronWebContents) => void): this; /** * Registers a listener for the `will-continue-activity` event. * * Emitted during Handoff before an activity from a different device wants to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "will-continue-activity", listener: (event: ElectronEvent, type: string) => void): this; /** * Registers a listener for the `will-finish-launching` event. * * Emitted when the application has finished basic startup. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "will-finish-launching", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `will-quit` event. * * Emitted when all windows have been closed and the application will quit. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "will-quit", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `window-all-closed` event. * * Emitted when all windows have been closed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ on(event: "window-all-closed", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `accessibility-support-changed` event. * * Emitted when Chrome's accessibility support changes. macOS and Windows only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "accessibility-support-changed", listener: (event: ElectronEvent, accessibilitySupportEnabled: boolean) => void): this; /** * Registers a one-time listener for the `activate` event. * * Emitted when the application is activated. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "activate", listener: (event: ElectronEvent, hasVisibleWindows: boolean) => void): this; /** * Registers a one-time listener for the `activity-was-continued` event. * * Emitted during Handoff after an activity from this device was successfully resumed on another one. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "activity-was-continued", listener: (event: ElectronEvent, type: string, userInfo: unknown) => void): this; /** * Registers a one-time listener for the `before-quit` event. * * Emitted before the application starts closing its windows. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "before-quit", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time listener for the `browser-window-blur` event. * * Emitted when a browserWindow gets blurred. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "browser-window-blur", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Registers a one-time listener for the `browser-window-created` event. * * Emitted when a new browserWindow is created. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "browser-window-created", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Registers a one-time listener for the `browser-window-focus` event. * * Emitted when a browserWindow gets focused. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "browser-window-focus", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Registers a one-time listener for the `certificate-error` event. * * Emitted when failed to verify the certificate for a URL. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "certificate-error", listener: (event: ElectronEvent, webContents: ElectronWebContents, url: string, error: string, certificate: ElectronCertificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void): this; /** * Registers a one-time listener for the `child-process-gone` event. * * Emitted when the child process unexpectedly disappears. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "child-process-gone", listener: (event: ElectronEvent, details: ElectronDetails) => void): this; /** * Registers a one-time listener for the `continue-activity` event. * * Emitted during Handoff when an activity from a different device wants to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "continue-activity", listener: (event: ElectronEvent, type: string, userInfo: unknown, details: ElectronContinueActivityDetails) => void): this; /** * Registers a one-time listener for the `continue-activity-error` event. * * Emitted during Handoff when an activity from a different device fails to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "continue-activity-error", listener: (event: ElectronEvent, type: string, error: string) => void): this; /** * Registers a one-time listener for the `did-become-active` event. * * Emitted every time the app becomes active. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "did-become-active", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time listener for the `first-instance-ack` event. * * Emitted in the second instance during `requestSingleInstanceLock` when the first instance calls the `ackCallback`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "first-instance-ack", listener: (event: ElectronEvent, additionalData: unknown) => void): this; /** * Registers a one-time listener for the `gpu-info-update` event. * * Emitted whenever there is a GPU info update. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "gpu-info-update", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `gpu-process-crashed` event. * * Emitted when the GPU process crashes or is killed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. * * @deprecated Deprecated by Electron. */ once(event: "gpu-process-crashed", listener: (event: ElectronEvent, killed: boolean) => void): this; /** * Registers a one-time listener for the `login` event. * * Emitted when `webContents` wants to do basic auth. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "login", listener: (event: ElectronEvent, webContents: ElectronWebContents, authenticationResponseDetails: ElectronAuthenticationResponseDetails, authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** * Registers a one-time listener for the `new-window-for-tab` event. * * Emitted when the user clicks the native macOS new tab button. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "new-window-for-tab", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time listener for the `open-file` event. * * Emitted when the user wants to open a file with the application. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "open-file", listener: (event: ElectronEvent, path: string) => void): this; /** * Registers a one-time listener for the `open-url` event. * * Emitted when the user wants to open a URL with the application. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "open-url", listener: (event: ElectronEvent, url: string) => void): this; /** * Registers a one-time listener for the `quit` event. * * Emitted when the application is quitting. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "quit", listener: (event: ElectronEvent, exitCode: number) => void): this; /** * Registers a one-time listener for the `ready` event. * * Emitted once, when Electron has finished initializing. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "ready", listener: (event: ElectronEvent, launchInfo: ElectronNotificationResponse | Record<string, unknown>) => void): this; /** * Registers a one-time listener for the `render-process-gone` event. * * Emitted when the renderer process unexpectedly disappears. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "render-process-gone", listener: (event: ElectronEvent, webContents: ElectronWebContents, details: ElectronRenderProcessGoneDetails) => void): this; /** * Registers a one-time listener for the `renderer-process-crashed` event. * * Emitted when the renderer process of `webContents` crashes or is killed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. * * @deprecated Deprecated by Electron. */ once(event: "renderer-process-crashed", listener: (event: ElectronEvent, webContents: ElectronWebContents, killed: boolean) => void): this; /** * Registers a one-time listener for the `second-instance` event. * * Emitted inside the primary instance when a second instance is executed and calls `requestSingleInstanceLock`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "second-instance", listener: (event: ElectronEvent, argv: string[], workingDirectory: string, additionalData: unknown, ackCallback: unknown) => void): this; /** * Registers a one-time listener for the `select-client-certificate` event. * * Emitted when a client certificate is requested. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "select-client-certificate", listener: (event: ElectronEvent, webContents: ElectronWebContents, url: string, certificateList: ElectronCertificate[], callback: (certificate?: ElectronCertificate) => void) => void): this; /** * Registers a one-time listener for the `session-created` event. * * Emitted when Electron has created a new `session`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "session-created", listener: (session: Session) => void): this; /** * Registers a one-time listener for the `update-activity-state` event. * * Emitted when Handoff is about to be resumed on another device. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "update-activity-state", listener: (event: ElectronEvent, type: string, userInfo: unknown) => void): this; /** * Registers a one-time listener for the `web-contents-created` event. * * Emitted when a new `webContents` is created. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "web-contents-created", listener: (event: ElectronEvent, webContents: ElectronWebContents) => void): this; /** * Registers a one-time listener for the `will-continue-activity` event. * * Emitted during Handoff before an activity from a different device wants to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "will-continue-activity", listener: (event: ElectronEvent, type: string) => void): this; /** * Registers a one-time listener for the `will-finish-launching` event. * * Emitted when the application has finished basic startup. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "will-finish-launching", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `will-quit` event. * * Emitted when all windows have been closed and the application will quit. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "will-quit", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time listener for the `window-all-closed` event. * * Emitted when all windows have been closed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ once(event: "window-all-closed", listener: (...args: unknown[]) => void): this; /** * Tries to close all windows. The `before-quit` event is emitted first; if all windows are * successfully closed, the `will-quit` event is emitted and by default the application terminates. */ quit(): void; /** * Relaunches the app when the current instance exits. * * @param options - Options controlling the relaunched instance. */ relaunch(options?: ElectronRelaunchOptions): void; /** Releases all locks that were created by `requestSingleInstanceLock`. */ releaseSingleInstanceLock(): void; /** * Removes the current executable as the default handler for a protocol. macOS and Windows only. * * @param protocol - The protocol name, without the `://`. * @param path - The executable path to compare against. * @param args - The arguments to compare against. * @returns Whether the call succeeded. */ removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; /** * Removes a previously added listener for the `accessibility-support-changed` event. * * Emitted when Chrome's accessibility support changes. macOS and Windows only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "accessibility-support-changed", listener: (event: ElectronEvent, accessibilitySupportEnabled: boolean) => void): this; /** * Removes a previously added listener for the `activate` event. * * Emitted when the application is activated. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "activate", listener: (event: ElectronEvent, hasVisibleWindows: boolean) => void): this; /** * Removes a previously added listener for the `activity-was-continued` event. * * Emitted during Handoff after an activity from this device was successfully resumed on another one. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "activity-was-continued", listener: (event: ElectronEvent, type: string, userInfo: unknown) => void): this; /** * Removes a previously added listener for the `before-quit` event. * * Emitted before the application starts closing its windows. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "before-quit", listener: (event: ElectronEvent) => void): this; /** * Removes a previously added listener for the `browser-window-blur` event. * * Emitted when a browserWindow gets blurred. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "browser-window-blur", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Removes a previously added listener for the `browser-window-created` event. * * Emitted when a new browserWindow is created. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "browser-window-created", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Removes a previously added listener for the `browser-window-focus` event. * * Emitted when a browserWindow gets focused. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "browser-window-focus", listener: (event: ElectronEvent, window: ElectronBrowserWindow) => void): this; /** * Removes a previously added listener for the `certificate-error` event. * * Emitted when failed to verify the certificate for a URL. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "certificate-error", listener: (event: ElectronEvent, webContents: ElectronWebContents, url: string, error: string, certificate: ElectronCertificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void): this; /** * Removes a previously added listener for the `child-process-gone` event. * * Emitted when the child process unexpectedly disappears. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "child-process-gone", listener: (event: ElectronEvent, details: ElectronDetails) => void): this; /** * Removes a previously added listener for the `continue-activity` event. * * Emitted during Handoff when an activity from a different device wants to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "continue-activity", listener: (event: ElectronEvent, type: string, userInfo: unknown, details: ElectronContinueActivityDetails) => void): this; /** * Removes a previously added listener for the `continue-activity-error` event. * * Emitted during Handoff when an activity from a different device fails to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "continue-activity-error", listener: (event: ElectronEvent, type: string, error: string) => void): this; /** * Removes a previously added listener for the `did-become-active` event. * * Emitted every time the app becomes active. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "did-become-active", listener: (event: ElectronEvent) => void): this; /** * Removes a previously added listener for the `first-instance-ack` event. * * Emitted in the second instance during `requestSingleInstanceLock` when the first instance calls the `ackCallback`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "first-instance-ack", listener: (event: ElectronEvent, additionalData: unknown) => void): this; /** * Removes a previously added listener for the `gpu-info-update` event. * * Emitted whenever there is a GPU info update. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "gpu-info-update", listener: (...args: unknown[]) => void): this; /** * Removes a previously added listener for the `gpu-process-crashed` event. * * Emitted when the GPU process crashes or is killed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. * * @deprecated Deprecated by Electron. */ removeListener(event: "gpu-process-crashed", listener: (event: ElectronEvent, killed: boolean) => void): this; /** * Removes a previously added listener for the `login` event. * * Emitted when `webContents` wants to do basic auth. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "login", listener: (event: ElectronEvent, webContents: ElectronWebContents, authenticationResponseDetails: ElectronAuthenticationResponseDetails, authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** * Removes a previously added listener for the `new-window-for-tab` event. * * Emitted when the user clicks the native macOS new tab button. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "new-window-for-tab", listener: (event: ElectronEvent) => void): this; /** * Removes a previously added listener for the `open-file` event. * * Emitted when the user wants to open a file with the application. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "open-file", listener: (event: ElectronEvent, path: string) => void): this; /** * Removes a previously added listener for the `open-url` event. * * Emitted when the user wants to open a URL with the application. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "open-url", listener: (event: ElectronEvent, url: string) => void): this; /** * Removes a previously added listener for the `quit` event. * * Emitted when the application is quitting. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "quit", listener: (event: ElectronEvent, exitCode: number) => void): this; /** * Removes a previously added listener for the `ready` event. * * Emitted once, when Electron has finished initializing. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "ready", listener: (event: ElectronEvent, launchInfo: ElectronNotificationResponse | Record<string, unknown>) => void): this; /** * Removes a previously added listener for the `render-process-gone` event. * * Emitted when the renderer process unexpectedly disappears. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "render-process-gone", listener: (event: ElectronEvent, webContents: ElectronWebContents, details: ElectronRenderProcessGoneDetails) => void): this; /** * Removes a previously added listener for the `renderer-process-crashed` event. * * Emitted when the renderer process of `webContents` crashes or is killed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. * * @deprecated Deprecated by Electron. */ removeListener(event: "renderer-process-crashed", listener: (event: ElectronEvent, webContents: ElectronWebContents, killed: boolean) => void): this; /** * Removes a previously added listener for the `second-instance` event. * * Emitted inside the primary instance when a second instance is executed and calls `requestSingleInstanceLock`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "second-instance", listener: (event: ElectronEvent, argv: string[], workingDirectory: string, additionalData: unknown, ackCallback: unknown) => void): this; /** * Removes a previously added listener for the `select-client-certificate` event. * * Emitted when a client certificate is requested. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "select-client-certificate", listener: (event: ElectronEvent, webContents: ElectronWebContents, url: string, certificateList: ElectronCertificate[], callback: (certificate?: ElectronCertificate) => void) => void): this; /** * Removes a previously added listener for the `session-created` event. * * Emitted when Electron has created a new `session`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "session-created", listener: (session: Session) => void): this; /** * Removes a previously added listener for the `update-activity-state` event. * * Emitted when Handoff is about to be resumed on another device. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "update-activity-state", listener: (event: ElectronEvent, type: string, userInfo: unknown) => void): this; /** * Removes a previously added listener for the `web-contents-created` event. * * Emitted when a new `webContents` is created. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "web-contents-created", listener: (event: ElectronEvent, webContents: ElectronWebContents) => void): this; /** * Removes a previously added listener for the `will-continue-activity` event. * * Emitted during Handoff before an activity from a different device wants to be resumed. macOS only. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "will-continue-activity", listener: (event: ElectronEvent, type: string) => void): this; /** * Removes a previously added listener for the `will-finish-launching` event. * * Emitted when the application has finished basic startup. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "will-finish-launching", listener: (...args: unknown[]) => void): this; /** * Removes a previously added listener for the `will-quit` event. * * Emitted when all windows have been closed and the application will quit. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "will-quit", listener: (event: ElectronEvent) => void): this; /** * Removes a previously added listener for the `window-all-closed` event. * * Emitted when all windows have been closed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronApp` instance. */ removeListener(event: "window-all-closed", listener: (...args: unknown[]) => void): this; /** * Requests the single instance lock. Returns whether this instance obtained the lock and should * continue loading. * * @param additionalData - A JSON object to send to the first instance. * @returns Whether this process is the primary instance. */ requestSingleInstanceLock(additionalData?: Record<string, unknown>): boolean; /** Marks the current Handoff user activity as inactive without invalidating it. macOS only. */ resignCurrentActivity(): void; /** * Sets the about panel options. * * @param options - The about panel options. */ setAboutPanelOptions(options: ElectronAboutPanelOptionsOptions): void; /** * Manually enables or disables Chrome's accessibility support. Must be called after the `ready` * event. macOS and Windows only. * * @param enabled - Whether to enable accessibility support. */ setAccessibilitySupportEnabled(enabled: boolean): void; /** * Sets the activation policy for the app. macOS only. * * @param policy - The activation policy. */ setActivationPolicy(policy: "accessory" | "prohibited" | "regular"): void; /** * Sets or creates a directory for the app's logs. * * @param path - The custom log directory path. */ setAppLogsPath(path?: string): void; /** * Changes the Application User Model ID to `id`. Windows only. * * @param id - The Application User Model ID. */ setAppUserModelId(id: string): void; /** * Sets the current executable as the default handler for a protocol. * * @param protocol - The protocol name, without the `://`. * @param path - The executable path. * @param args - The arguments. * @returns Whether the call succeeded. */ setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; /** * Sets the counter badge for the current app. Setting the count to `0` hides the badge. Linux and macOS only. * * @param count - The badge count. * @returns Whether the call succeeded. */ setBadgeCount(count?: number): boolean; /** * Sets or removes a custom Jump List for the application. Windows only. * * @param categories - The Jump List categories, or `null` to restore the standard Jump List. */ setJumpList(categories: ElectronJumpListCategory[] | null): void; /** * Sets the app's login item settings. macOS and Windows only. * * @param settings - The login item settings. */ setLoginItemSettings(settings: ElectronSettings): void; /** * Overrides the current application's name. * * @param name - The new application name. */ setName(name: string): void; /** * Overrides the path to a special directory or file associated with `name`. * * @param name - The name of the special path to override. * @param path - The new path. */ setPath(name: string, path: string): void; /** * Sets whether Secure Keyboard Entry is enabled in the application. macOS only. * * @param enabled - Whether to enable Secure Keyboard Entry. */ setSecureKeyboardEntryEnabled(enabled: boolean): void; /** * Creates an `NSUserActivity` and sets it as the current activity. macOS only. * * @param type - Uniquely identifies the activity. * @param userInfo - App-specific state to store for use by another device. * @param webpageURL - The webpage to load in a browser if no suitable app is installed on the resuming device. */ setUserActivity(type: string, userInfo: unknown, webpageURL?: string): void; /** * Adds `tasks` to the Tasks category of the Jump List. Windows only. * * @param tasks - The tasks to add. * @returns Whether the call succeeded. */ setUserTasks(tasks: ElectronTask[]): boolean; /** Shows application windows after they were hidden. Does not automatically focus them. macOS only. */ show(): void; /** Shows the app's about panel options. */ showAboutPanel(): void; /** Shows the platform's native emoji picker. macOS and Windows only. */ showEmojiPanel(): void; /** * Starts accessing a security scoped resource. Must be balanced by calling the returned function * once finished. macOS (MAS) only. * * @param bookmarkData - The base64-encoded security scoped bookmark data. * @returns A function that stops accessing the security scoped resource. */ startAccessingSecurityScopedResource(bookmarkData: string): () => void; /** * Updates the current activity if its type matches `type`, merging the entries from `userInfo`. macOS only. * * @param type - Uniquely identifies the activity. * @param userInfo - App-specific state to merge into the current activity. */ updateCurrentActivity(type: string, userInfo: unknown): void; /** * Returns a promise fulfilled when Electron is initialized. * * @returns A promise resolved when the app is ready. */ whenReady(): Promise<void>; } /** * Options for the window's taskbar button (Windows only). * * @public * @unofficial */ export interface ElectronAppDetailsOptions { /** * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set. * * @default `0` */ appIconIndex?: number; /** Window's Relaunch Icon. */ appIconPath?: string; /** Window's App User Model ID. It has to be set, otherwise the other options will have no effect. */ appId?: string; /** Window's Relaunch Command. */ relaunchCommand?: string; /** Window's Relaunch Display Name. */ relaunchDisplayName?: string; } /** * Information about the application handling a given protocol. * * @public * @unofficial */ export interface ElectronApplicationInfoForProtocolReturnValue { /** The display icon of the app handling the protocol. */ icon: ElectronNativeImage; /** Display name of the app handling the protocol. */ name: string; /** Installation path of the app handling the protocol. */ path: string; } /** * Information about an authentication challenge. * * @public * @unofficial */ export interface ElectronAuthInfo { /** The host requesting authentication. */ host: string; /** Whether the request is for a proxy. */ isProxy: boolean; /** The port requesting authentication. */ port: number; /** The authentication realm. */ realm: string; /** The authentication scheme. */ scheme: string; } /** * Details about an authentication request emitted with the `login` event. * * @public * @unofficial */ export interface ElectronAuthenticationResponseDetails { /** The URL of the request that triggered the authentication. */ url: string; } /** * Options controlling how a {@link ElectronBrowserView} auto-resizes with its window. * * @public * @unofficial */ export interface ElectronAutoResizeOptions { /** * If `true`, the view's height will grow and shrink together with the window. * * @default `false` */ height?: boolean; /** * If `true`, the view's x position and width will grow and shrink proportionally with the window. * * @default `false` */ horizontal?: boolean; /** * If `true`, the view's y position and height will grow and shrink proportionally with the window. * * @default `false` */ vertical?: boolean; /** * If `true`, the view's width will grow and shrink together with the window. * * @default `false` */ width?: boolean; } /** * Enables apps to automatically update themselves. * * @public * @unofficial */ export interface ElectronAutoUpdater extends NodeJS.EventEmitter { /** * Registers a listener for the given auto updater event. * * @param event - The event name. * @param listener - The event handler. * @returns This `AutoUpdater` instance. */ addListener(event: "before-quit-for-update", listener: (...args: unknown[]) => void): this; /** Registers a listener for the `checking-for-update` event. */ addListener(event: "checking-for-update", listener: (...args: unknown[]) => void): this; /** Registers a listener for the `error` event. */ addListener(event: "error", listener: (error: Error) => void): this; /** Registers a listener for the `update-available` event. */ addListener(event: "update-available", listener: (...args: unknown[]) => void): this; /** Registers a listener for the `update-downloaded` event. */ addListener(event: "update-downloaded", listener: (event: ElectronEvent, releaseNotes: string, releaseName: string, releaseDate: Date, updateURL: string) => void): this; /** Registers a listener for the `update-not-available` event. */ addListener(event: "update-not-available", listener: (...args: unknown[]) => void): this; /** * Asks the server whether there is an update. You must call `setFeedURL` before using this API. * * **Note:** If an update is available it will be downloaded automatically. Calling * `autoUpdater.checkForUpdates()` twice will download the update two times. */ checkForUpdates(): void; /** * The current update feed URL. * * @returns The current update feed URL. */ getFeedURL(): string; /** * Registers a listener for the given auto updater event. * * @param event - The event name. * @param listener - The event handler. * @returns This `AutoUpdater` instance. */ on(event: "before-quit-for-update", listener: (...args: unknown[]) => void): this; /** Registers a listener for the `checking-for-update` event. */ on(event: "checking-for-update", listener: (...args: unknown[]) => void): this; /** Registers a listener for the `error` event. */ on(event: "error", listener: (error: Error) => void): this; /** Registers a listener for the `update-available` event. */ on(event: "update-available", listener: (...args: unknown[]) => void): this; /** Registers a listener for the `update-downloaded` event. */ on(event: "update-downloaded", listener: (event: ElectronEvent, releaseNotes: string, releaseName: string, releaseDate: Date, updateURL: string) => void): this; /** Registers a listener for the `update-not-available` event. */ on(event: "update-not-available", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the given auto updater event. * * @param event - The event name. * @param listener - The event handler. * @returns This `AutoUpdater` instance. */ once(event: "before-quit-for-update", listener: (...args: unknown[]) => void): this; /** Registers a one-time listener for the `checking-for-update` event. */ once(event: "checking-for-update", listener: (...args: unknown[]) => void): this; /** Registers a one-time listener for the `error` event. */ once(event: "error", listener: (error: Error) => void): this; /** Registers a one-time listener for the `update-available` event. */ once(event: "update-available", listener: (...args: unknown[]) => void): this; /** Registers a one-time listener for the `update-downloaded` event. */ once(event: "update-downloaded", listener: (event: ElectronEvent, releaseNotes: string, releaseName: string, releaseDate: Date, updateURL: string) => void): this; /** Registers a one-time listener for the `update-not-available` event. */ once(event: "update-not-available", listener: (...args: unknown[]) => void): this; /** * Restarts the app and installs the update after it has been downloaded. It should only be called after * `update-downloaded` has been emitted. * * Under the hood calling `autoUpdater.quitAndInstall()` will close all application windows first, and * automatically call `app.quit()` after all windows have been closed. */ quitAndInstall(): void; /** * Removes the given listener for the given auto updater event. * * @param event - The event name. * @param listener - The event handler. * @returns This `AutoUpdater` instance. */ removeListener(event: "before-quit-for-update", listener: (...args: unknown[]) => void): this; /** Removes the listener for the `checking-for-update` event. */ removeListener(event: "checking-for-update", listener: (...args: unknown[]) => void): this; /** Removes the listener for the `error` event. */ removeListener(event: "error", listener: (error: Error) => void): this; /** Removes the listener for the `update-available` event. */ removeListener(event: "update-available", listener: (...args: unknown[]) => void): this; /** Removes the listener for the `update-downloaded` event. */ removeListener(event: "update-downloaded", listener: (event: ElectronEvent, releaseNotes: string, releaseName: string, releaseDate: Date, updateURL: string) => void): this; /** Removes the listener for the `update-not-available` event. */ removeListener(event: "update-not-available", listener: (...args: unknown[]) => void): this; /** * Sets the `url` and initialize the auto updater. * * @param options - The feed URL options. */ setFeedURL(options: ElectronFeedURLOptions): void; } /** * Response object returned by an `onBeforeSendHeaders` web-request listener callback. * * @public * @unofficial */ export interface ElectronBeforeSendResponse { /** Whether to cancel the request. */ cancel?: boolean; /** When provided, request will be made with these headers. */ requestHeaders?: Record<string, string | string[]>; } /** * A Bluetooth device available for selection. * * @public * @unofficial */ export interface ElectronBluetoothDevice { /** The unique identifier of the device. */ deviceId: string; /** The human-readable name of the device. */ deviceName: string; } /** * Details passed to the {@link Session.setBluetoothPairingHandler} handler describing a Bluetooth pairing * request. * * @public * @unofficial */ export interface ElectronBluetoothPairingHandlerHandlerDetails { /** The identifier of the device requesting pairing. */ deviceId: string; /** The frame that initiated the pairing request. */ frame: ElectronWebFrameMain; /** The type of pairing prompt being requested. */ pairingKind: "confirm" | "confirmPin" | "providePin"; /** The pin value to verify when `pairingKind` is `confirmPin`. */ pin?: string; } /** * Response returned to the {@link Session.setBluetoothPairingHandler} callback to resolve a Bluetooth * pairing request. * * @public * @unofficial */ export interface ElectronBluetoothPairingResponse { /** * Whether the pairing is confirmed. Pass `false` when the dialog is canceled; when `pairingKind` is * `providePin`, pass `true` when a value is provided. */ confirmed: boolean; /** When `pairingKind` is `providePin`, the required pin for the Bluetooth device. */ pin?: null | string; } /** * Options for creating an {@link ElectronBrowserView}. * * @public * @unofficial */ export interface ElectronBrowserViewConstructorOptions { /** Settings of web page's features. */ webPreferences?: WebPreferences; } /** * Options for {@link ElectronBrowserWindow.loadFile}. * * @public * @unofficial */ export interface ElectronBrowserWindowLoadFileOptions { /** Passed to `url.format()`. */ hash?: string; /** Passed to `url.format()`. */ query?: Record<string, string>; /** Passed to `url.format()`. */ search?: string; } /** * Options for {@link ElectronBrowserWindow.loadURL}. * * @public * @unofficial */ export interface ElectronBrowserWindowLoadURLOptions { /** * Base url (with trailing path separator) for files to be loaded by the data url. This is needed only if the * specified `url` is a data url and needs to load other files. */ baseURLForDataURL?: string; /** Extra headers separated by `\n`. */ extraHeaders?: string; /** An HTTP Referrer url. */ httpReferrer?: ElectronReferrer | string; /** The post data to send with the request. */ postData?: (ElectronUploadFile | ElectronUploadRawData)[]; /** A user agent originating the request. */ userAgent?: string; } /** * CPU usage statistics for a process. * * @public * @unofficial */ export interface ElectronCPUUsage { /** * The number of average idle CPU wakeups per second since the last call to `getCPUUsage`. First * call returns `0`. Always returns `0` on Windows. */ idleWakeupsPerSecond: number; /** Percentage of CPU used since the last call to `getCPUUsage`. First call returns `0`. */ percentCPUUsage: number; } /** * An Electron certificate. * * @public * @unofficial */ export interface ElectronCertificate { /** PEM encoded data. */ data: string; /** Fingerprint of the certificate. */ fingerprint: string; /** Issuer principal. */ issuer: ElectronCertificatePrincipal; /** Issuer certificate (if not self-signed). */ issuerCert: ElectronCertificate; /** Issuer's Common Name. */ issuerName: string; /** Hex value represented string. */ serialNumber: string; /** Subject principal. */ subject: ElectronCertificatePrincipal; /** Subject's Common Name. */ subjectName: string; /** End date of the certificate being valid in seconds. */ validExpiry: number; /** Start date of the certificate being valid in seconds. */ validStart: number; } /** * Principal (subject or issuer) of an Electron certificate. * * @public * @unofficial */ export interface ElectronCertificatePrincipal { /** Common Name. */ commonName: string; /** Country or region. */ country: string; /** Locality. */ locality: string; /** Organization names. */ organizations: string[]; /** Organization Unit names. */ organizationUnits: string[]; /** State or province. */ state: string; } /** * Options for Electron certificate trust dialog. * * @public * @unofficial */ export interface ElectronCertificateTrustDialogOptions { /** The certificate to trust/import. */ certificate: ElectronCertificate; /** The message to display to the user. */ message: string; } /** * Options controlling which code caches are cleared. * * @public * @unofficial */ export interface ElectronClearCodeCachesOptions { /** An array of URLs corresponding to the resources whose generated code cache needs to be removed. If empty, all entries are removed. */ urls?: string[]; } /** * Options controlling which storage data is cleared. * * @public * @unofficial */ export interface ElectronClearStorageDataOptions { /** Should follow `window.location.origin`'s representation `scheme://host:port`. */ origin?: string; /** The types of quotas to clear, can contain `persistent`, `syncable` or `temporary`. If not specified, clear all quotas. */ quotas?: string[]; /** The types of storages to clear. If not specified, clear all storage types. */ storages?: string[]; } /** * Options for constructing a `ClientRequest`. * * @public * @unofficial */ export interface ElectronClientRequestConstructorOptions { /** * Can be `include` or `omit`. Whether to send credentials with this request. If set to `include`, credentials from * the session associated with the request will be used. If set to `omit`, credentials will not be sent with the * request (and the `'login'` event will not be triggered in the event of a 401). This matches the behavior of the * fetch option of the same name. If this option is not specified, authentication data from the session will be * sent, and cookies will not be sent (unless `useSessionCookies` is set). */ credentials?: "include" | "omit"; /** The server host provided as a concatenation of the hostname and the port number `'hostname:port'`. */ host?: string; /** The server host name. */ hostname?: string; /** * The HTTP request method. * * @default `'GET'` */ method?: string; /** The origin URL of the request. */ origin?: string; /** * The name of the `partition` with which the request is associated. The `session` option supersedes `partition`. * Thus if a `session` is explicitly specified, `partition` is ignored. * * @default `''` */ partition?: string; /** The path part of the request URL. */ path?: string; /** The server's listening port number. */ port?: number; /** * Can be `http:` or `https:`. The protocol scheme in the form `'scheme:'`. * * @default `'http:'` */ protocol?: string; /** * Can be `follow`, `error` or `manual`. The redirect mode for this request. When mode is `error`, any redirection * will be aborted. When mode is `manual` the redirection will be cancelled unless `request.followRedirect` is * invoked synchronously during the `redirect` event. * * @default `'follow'` */ redirect?: "error" | "follow" | "manual"; /** The `Session` instance with which the request is associated. */ session?: Session; /** The request URL. Must be provided in the absolute form with the protocol scheme specified as http or https. */ url?: string; /** * Whether to send cookies with this request from the provided session. If `credentials` is specified, this option * has no effect. * * @default `false` */ useSessionCookies?: boolean; } /** * Electron Clipboard for reading and writing system clipboard data. * * @public * @unofficial */ export interface ElectronClipboard { /** * Returns the available clipboard formats. * * @param type - The clipboard type. * @returns An array of format strings. */ availableFormats(type?: "clipboard" | "selection"): string[]; /** * Clears the clipboard content. * * @param type - The clipboard type. */ clear(type?: "clipboard" | "selection"): void; /** * Returns whether the clipboard has the specified format. * * @param format - The format to check. * @param type - The clipboard type. * @returns Whether the format is available. */ has(format: string, type?: "clipboard" | "selection"): boolean; /** * Reads the clipboard content for the specified format. * * @param format - The format to read. * @returns The clipboard content. */ read(format: string): string; /** * Reads the bookmark from the clipboard. Only available on `darwin` and `win32`. * * @returns The bookmark title and URL. */ readBookmark(): ElectronClipboardBookmark; /** * Reads the clipboard content as a buffer. * * @param format - The format to read. * @returns The clipboard buffer. */ readBuffer(format: string): Buffer; /** * Reads the text on the find pasteboard. Only available on `darwin`. * * @returns The find pasteboard text. */ readFindText(): string; /** * Reads the clipboard content as HTML. * * @param type - The clipboard type. * @returns The HTML content. */ readHTML(type?: "clipboard" | "selection"): string; /** * Reads the clipboard content as a native image. * * @param type - The clipboard type. * @returns The clipboard image. */ readImage(type?: "clipboard" | "selection"): ElectronNativeImage; /** * Reads the clipboard content as RTF. * * @param type - The clipboard type. * @returns The RTF content. */ readRTF(type?: "clipboard" | "selection"): string; /** * Reads the clipboard content as plain text. * * @param type - The clipboard type. * @returns The text content. */ readText(type?: "clipboard" | "selection"): string; /** * Writes data to the clipboard. * * @param data - The data to write. * @param type - The clipboard type. */ write(data: ElectronData, type?: "clipboard" | "selection"): void; /** * Writes a bookmark to the clipboard. The `title` is only used on `darwin`. Only available on `darwin` and `win32`. * * @param title - The bookmark title. * @param url - The bookmark URL. * @param type - The clipboard type. */ writeBookmark(title: string, url: string, type?: "clipboard" | "selection"): void; /** * Writes a buffer to the clipboard as the specified format. * * @param format - The format to write. * @param buffer - The buffer to write. * @param type - The clipboard type. */ writeBuffer(format: string, buffer: Buffer, type?: "clipboard" | "selection"): void; /** * Writes text to the find pasteboard as plain text. Only available on `darwin`. * * @param text - The text to write. */ writeFindText(text: string): void; /** * Writes HTML content to the clipboard. * * @param markup - The HTML content. * @param type - The clipboard type. */ writeHTML(markup: string, type?: "clipboard" | "selection"): void; /** * Writes a native image to the clipboard. * * @param image - The image to write. * @param type - The clipboard type. */ writeImage(image: ElectronNativeImage, type?: "clipboard" | "selection"): void; /** * Writes text to the clipboard as RTF. * * @param text - The RTF content. * @param type - The clipboard type. */ writeRTF(text: string, type?: "clipboard" | "selection"): void; /** * Writes text to the clipboard. * * @param text - The text to write. * @param type - The clipboard type. */ writeText(text: string, type?: "clipboard" | "selection"): void; } /** * A bookmark read from the clipboard. * * @public * @unofficial */ export interface ElectronClipboardBookmark { /** The bookmark title. */ title: string; /** The bookmark URL. */ url: string; } /** * Reads and manipulates the command line arguments that Chromium uses. * * @public * @unofficial */ export interface ElectronCommandLine { /** * Appends an argument to Chromium's command line. The argument is quoted correctly. * * @param value - The argument to append. */ appendArgument(value: string): void; /** * Appends a switch (with optional value) to Chromium's command line. * * @param theSwitch - The switch to append. * @param value - The optional value for the switch. */ appendSwitch(theSwitch: string, value?: string): void; /** * Returns the value of the given command-line switch. * * @param theSwitch - The switch to read. * @returns The switch value, or an empty string when the switch is absent or has no value. */ getSwitchValue(theSwitch: string): string; /** * Returns whether the given command-line switch is present. * * @param theSwitch - The switch to check. * @returns Whether the command-line switch is present. */ hasSwitch(theSwitch: string): boolean; /** * Removes the specified switch from Chromium's command line. * * @param theSwitch - The switch to remove. */ removeSwitch(theSwitch: string): void; } /** * Proxy configuration for a session. * * @public * @unofficial */ export interface ElectronConfig { /** The proxy mode. If unspecified, it is determined automatically based on other options. */ mode?: "auto_detect" | "direct" | "fixed_servers" | "pac_script" | "system"; /** The URL associated with the PAC file. */ pacScript?: string; /** Rules indicating which URLs should bypass the proxy settings. */ proxyBypassRules?: string; /** Rules indicating which proxies to use. */ proxyRules?: string; } /** * Options for configuring host resolution (DNS and DNS-over-HTTPS). * * @public * @unofficial */ export interface ElectronConfigureHostResolverOptions { /** * Controls whether additional DNS query types (e.g. HTTPS, DNS type 65) are allowed besides the * traditional A and AAAA queries when a request is made via insecure DNS. * * @default `true` */ enableAdditionalDnsQueryTypes?: boolean; /** * Whether the built-in host resolver is used in preference to `getaddrinfo`. Enabled by default on * macOS, disabled by default on Windows and Linux. */ enableBuiltInResolver?: boolean; /** * Configures the DNS-over-HTTP mode. Can be `off`, `automatic` or `secure`. * * @default `'automatic'` */ secureDnsMode?: string; /** A list of DNS-over-HTTP server templates. */ secureDnsServers?: string[]; } /** * Collects tracing data from Chromium's content module for finding performance bottlenecks and slow operations. * * @public * @unofficial */ export interface ElectronContentTracing { /** * Get a set of category groups. The category groups can change as new code paths are reached. See also the list of * built-in tracing categories. * * @returns A promise that resolves with an array of category groups once all child processes have acknowledged the * `getCategories` request. */ getCategories(): Promise<string[]>; /** * Get the maximum usage across processes of the trace buffer as a percentage of the full state. * * @returns A promise that resolves with an object containing the `value` and `percentage` of the trace buffer maximum * usage. */ getTraceBufferUsage(): Promise<ElectronTraceBufferUsageReturnValue>; /** * Start recording on all processes. * * Recording begins immediately locally and asynchronously on child processes as soon as they receive the * `EnableRecording` request. If a recording is already running, the promise will be immediately resolved, as only one * trace operation can be in progress at a time. * * @param options - The trace configuration. * @returns A promise resolved once all child processes have acknowledged the `startRecording` request. */ startRecording(options: (ElectronTraceCategoriesAndOptions) | (ElectronTraceConfig)): Promise<void>; /** * Stop recording on all processes. * * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty or not provided, trace data will be * written to a temporary file, and the path will be returned in the promise. * * @param resultFilePath - The path to write the traced data to. * @returns A promise that resolves with a path to a file that contains the traced data once all child processes have * acknowledged the `stopRecording` request. */ stopRecording(resultFilePath?: string): Promise<string>; } /** * Electron ContextBridge for exposing APIs from an isolated preload script to the main world. * * @public * @unofficial */ export interface ElectronContextBridge { /** * Exposes an API to the main world under `window[apiKey]`. The `api` is proxied across the context bridge so that the main world cannot mutate the isolated world's objects. * * @param apiKey - The key on `window` the `api` is exposed under. * @param api - The API object to expose. Modeled as `unknown` (the upstream type is `any`). */ exposeInMainWorld(apiKey: string, api: unknown): void; } /** * Parameters describing the context in which a context menu was invoked. * * @public * @unofficial */ export interface ElectronContextMenuParams { /** Alt text of the selection that the context menu was invoked on. */ altText: string; /** Suggested words to replace the `misspelledWord`. Only available when there is a misspelled word and spellchecker is enabled. */ dictionarySuggestions: string[]; /** Flags indicating whether the renderer can perform the corresponding editing action. */ editFlags: ElectronEditFlags; /** Frame from which the context menu was invoked. */ frame: ElectronWebFrameMain; /** The character encoding of the frame on which the menu was invoked. */ frameCharset: string; /** URL of the subframe that the context menu was invoked on. */ frameURL: string; /** Whether the context menu was invoked on an image which has non-empty contents. */ hasImageContents: boolean; /** If the context menu was invoked on an input field, the type of that field. */ inputFieldType: string; /** Whether the context is editable. */ isEditable: boolean; /** Text associated with the link. May be an empty string if the contents of the link are an image. */ linkText: string; /** URL of the link that encloses the node the context menu was invoked on. */ linkURL: string; /** The flags for the media element the context menu was invoked on. */ mediaFlags: ElectronMediaFlags; /** Type of the node the context menu was invoked on. */ mediaType: "audio" | "canvas" | "file" | "image" | "none" | "plugin" | "video"; /** Input source that invoked the context menu. */ menuSourceType: "adjustSelection" | "adjustSelectionReset" | "keyboard" | "longPress" | "longTap" | "mouse" | "none" | "stylus" | "touch" | "touchHandle" | "touchMenu"; /** The misspelled word under the cursor, if any. */ misspelledWord: string; /** URL of the top level page that the context menu was invoked on. */ pageURL: string; /** The referrer policy of the frame on which the menu is invoked. */ referrerPolicy: ElectronReferrer; /** Rect representing the coordinates in the document space of the selection. */ selectionRect: ElectronRectangle; /** Start position of the selection text. */ selectionStartOffset: number; /** Text of the selection that the context menu was invoked on. */ selectionText: string; /** Whether spellchecking is enabled, if the context is editable. */ spellcheckEnabled: boolean; /** Source URL for the element that the context menu was invoked on. */ srcURL: string; /** Suggested filename to be used when saving the file through the 'Save Link As' context menu option. */ suggestedFilename: string; /** Title text of the selection that the context menu was invoked on. */ titleText: string; /** The x coordinate. */ x: number; /** The y coordinate. */ y: number; } /** * Details about a Handoff activity being continued from another device. * * @public * @unofficial */ export interface ElectronContinueActivityDetails { /** A string identifying the URL of the webpage accessed by the activity on another device, if available. */ webpageURL?: string; } /** * A cookie stored in an Electron session. * * @public * @unofficial */ export interface ElectronCookie { /** The domain of the cookie; normalized with a preceding dot so that it is also valid for subdomains. */ domain?: string; /** The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. */ expirationDate?: number; /** Whether the cookie is a host-only cookie; this will only be `true` if no domain was passed. */ hostOnly?: boolean; /** Whether the cookie is marked as HTTP only. */ httpOnly?: boolean; /** The name of the cookie. */ name: string; /** The path of the cookie. */ path?: string; /** The Same Site policy applied to this cookie. */ sameSite: "lax" | "no_restriction" | "strict" | "unspecified"; /** Whether the cookie is marked as secure. */ secure?: boolean; /** Whether the cookie is a session cookie or a persistent cookie with an expiration date. */ session?: boolean; /** The value of the cookie. */ value: string; } /** * Queries and modifies a session's cookies. * * @public * @unofficial */ export interface ElectronCookies { /** * Registers a listener for the `changed` event, emitted when a cookie is added, edited, removed, or expired. * * @param event - The event name. * @param listener - Called with the changed cookie, the cause of the change, and whether it was removed. * @returns This cookies instance. */ addListener(event: "changed", listener: (event: ElectronEvent, cookie: ElectronCookie, cause: "evicted" | "expired-overwrite" | "expired" | "explicit" | "overwrite", removed: boolean) => void): this; /** * Writes any unwritten cookies data to disk. * * @returns A promise which resolves when the cookie store has been flushed. */ flushStore(): Promise<void>; /** * Sends a request to get all cookies matching `filter`. * * @param filter - The filter to match cookies against. * @returns A promise which resolves to an array of cookie objects. */ get(filter: ElectronCookiesGetFilter): Promise<ElectronCookie[]>; /** * Registers a listener for the `changed` event, emitted when a cookie is added, edited, removed, or expired. * * @param event - The event name. * @param listener - Called with the changed cookie, the cause of the change, and whether it was removed. * @returns This cookies instance. */ on(event: "changed", listener: (event: ElectronEvent, cookie: ElectronCookie, cause: "evicted" | "expired-overwrite" | "expired" | "explicit" | "overwrite", removed: boolean) => void): this; /** * Registers a one-time listener for the `changed` event. * * @param event - The event name. * @param listener - Called with the changed cookie, the cause of the change, and whether it was removed. * @returns This cookies instance. */ once(event: "changed", listener: (event: ElectronEvent, cookie: ElectronCookie, cause: "evicted" | "expired-overwrite" | "expired" | "explicit" | "overwrite", removed: boolean) => void): this; /** * Removes the cookies matching `url` and `name`. * * @param url - The URL associated with the cookie. * @param name - The name of the cookie to remove. * @returns A promise which resolves when the cookie has been removed. */ remove(url: string, name: string): Promise<void>; /** * Removes the `changed` event listener. * * @param event - The event name. * @param listener - The previously registered listener to remove. * @returns This cookies instance. */ removeListener(event: "changed", listener: (event: ElectronEvent, cookie: ElectronCookie, cause: "evicted" | "expired-overwrite" | "expired" | "explicit" | "overwrite", removed: boolean) => void): this; /** * Sets a cookie with `details`. * * @param details - The details of the cookie to set. * @returns A promise which resolves when the cookie has been set. */ set(details: ElectronCookiesSetDetails): Promise<void>; } /** * Filter used to query cookies from an Electron session. * * @public * @unofficial */ export interface ElectronCookiesGetFilter { /** Retrieves cookies whose domains match or are subdomains of `domains`. */ domain?: string; /** Filters cookies by name. */ name?: string; /** Retrieves cookies whose path matches `path`. */ path?: string; /** Filters cookies by their Secure property. */ secure?: boolean; /** Filters out session or persistent cookies. */ session?: boolean; /** Retrieves cookies which are associated with `url`. Empty implies retrieving cookies of all URLs. */ url?: string; } /** * Details used to set a cookie on an Electron session. * * @public * @unofficial */ export interface ElectronCookiesSetDetails { /** The domain of the cookie; normalized with a preceding dot so that it is also valid for subdomains. Empty by default if omitted. */ domain?: string; /** The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted then the cookie becomes a session cookie and will not be retained between sessions. */ expirationDate?: number; /** Whether the cookie should be marked as HTTP only. */ httpOnly?: boolean; /** The name of the cookie. Empty by default if omitted. */ name?: string; /** The path of the cookie. Empty by default if omitted. */ path?: string; /** The Same Site policy to apply to this cookie. */ sameSite?: "lax" | "no_restriction" | "strict" | "unspecified"; /** Whether the cookie should be marked as Secure. */ secure?: boolean; /** The URL to associate the cookie with. The promise will be rejected if the URL is invalid. */ url: string; /** The value of the cookie. Empty by default if omitted. */ value?: string; } /** * The date and ID of a crash report. * * @public * @unofficial */ export interface ElectronCrashReport { /** The date the crash report was created. */ date: Date; /** The uploaded ID of the crash report. */ id: string; } /** * Electron CrashReporter for submitting crash reports to a remote server. * * @public * @unofficial */ export interface ElectronCrashReporter { /** * Sets an extra parameter to be sent with the crash report. The values specified here will be sent in addition to any values set via the `extra` option when `start` was called. Parameters added in this fashion are specific to the calling process. * * @param key - The parameter key. Must be no longer than 39 bytes. * @param value - The parameter value. Must be no longer than 20320 bytes. */ addExtraParameter(key: string, value: string): void; /** * Returns the date and ID of the last crash report. Only crash reports that have been uploaded will be returned; even if a crash report is present on disk it will not be returned until it is uploaded. * * @returns The last uploaded crash report, or `null` if there are no uploaded reports. */ getLastCrashReport(): ElectronCrashReport; /** * Returns the current `extra` parameters of the crash reporter. * * @returns The current `extra` parameters. */ getParameters(): Record<string, string>; /** * Returns all uploaded crash reports. Each report contains the date and uploaded ID. * * @returns The uploaded crash reports. */ getUploadedReports(): ElectronCrashReport[]; /** * Returns whether reports should be submitted to the server. Set through the `start` method or `setUploadToServer`. * * @returns Whether reports should be submitted to the server. */ getUploadToServer(): boolean; /** * Removes an extra parameter from the current set of parameters. Future crashes will not include this parameter. * * @param key - The parameter key to remove. */ removeExtraParameter(key: string): void; /** * Sets whether reports should be submitted to the server. This would normally be controlled by user preferences. This has no effect if called before `start` is called. * * @param uploadToServer - Whether reports should be submitted to the server. */ setUploadToServer(uploadToServer: boolean): void; /** * Initializes the crash reporter. This method must be called before using any other `crashReporter` APIs. Once initialized, the crashpad handler collects crashes from all subsequently created processes. * * @param options - The crash reporter options. */ start(options: ElectronCrashReporterStartOptions): void; } /** * Options for `crashReporter.start`. * * @public * @unofficial */ export interface ElectronCrashReporterStartOptions { /** * Deprecated alias for `{ globalExtra: { _companyName: ... } }`. * * @deprecated Deprecated by Electron. */ companyName?: string; /** * If `true`, crash reports will be compressed and uploaded with `Content-Encoding: gzip`. * * @default `true` */ compress?: boolean; /** * Extra string key/value annotations that will be sent along with crash reports that are generated in the main process. Only string values are supported. Crashes generated in child processes will not contain these extra parameters to crash reports generated from child processes, call `addExtraParameter` from the child process. */ extra?: Record<string, string>; /** * Extra string key/value annotations that will be sent along with any crash reports generated in any process. These annotations cannot be changed once the crash reporter has been started. If a key is present in both the global extra parameters and the process-specific extra parameters, then the global one will take precedence. By default, `productName` and the app version are included, as well as the Electron version. */ globalExtra?: Record<string, string>; /** * If `true`, crashes generated in the main process will not be forwarded to the system crash handler. * * @default `false` */ ignoreSystemCrashHandler?: boolean; /** * The name of the product, defaulting to `app.name`. */ productName?: string; /** * If `true`, limit the number of crashes uploaded to 1/hour. * * @default `false` */ rateLimit?: boolean; /** * URL that crash reports will be sent to as POST. Required unless `uploadToServer` is `false`. */ submitURL?: string; /** * Whether crash reports should be sent to the server. If `false`, crash reports will be collected and stored in the crashes directory, but not uploaded. * * @default `true` */ uploadToServer?: boolean; } /** * Options for `nativeImage.createFromBitmap`. * * @public * @unofficial */ export interface ElectronCreateFromBitmapOptions { /** The height of the bitmap, in pixels. */ height: number; /** * The scale factor of the bitmap. * * @default `1` */ scaleFactor?: number; /** The width of the bitmap, in pixels. */ width: number; } /** * Options for `nativeImage.createFromBuffer`. * * @public * @unofficial */ export interface ElectronCreateFromBufferOptions { /** Required for bitmap buffers. The height of the image, in pixels. */ height?: number; /** * The scale factor of the image. * * @default `1` */ scaleFactor?: number; /** Required for bitmap buffers. The width of the image, in pixels. */ width?: number; } /** * Options used to resume a cancelled or interrupted download from a previous session. * * @public * @unofficial */ export interface ElectronCreateInterruptedDownloadOptions { /** ETag header value. */ eTag?: string; /** Last-Modified header value. */ lastModified?: string; /** Total length of the download. */ length: number; /** The MIME type of the download. */ mimeType?: string; /** Start range for the download. */ offset: number; /** Absolute path of the download. */ path: string; /** Time when the download was started in number of seconds since the UNIX epoch. */ startTime?: number; /** Complete URL chain for the download. */ urlChain: string[]; } /** * A custom scheme to be registered with a protocol, along with its privileges. * * @public * @unofficial */ export interface ElectronCustomScheme { /** The privileges to grant to the scheme. */ privileges?: ElectronPrivileges; /** Custom scheme to be registered with options. */ scheme: string; } /** * Data to write to the clipboard. * * @public * @unofficial */ export interface ElectronData { /** The title of the URL at `text`. */ bookmark?: string; /** The HTML markup content. */ html?: string; /** The image content. */ image?: ElectronNativeImage; /** The RTF content. */ rtf?: string; /** The plain text content. */ text?: string; } /** * A debugger instance for a web contents, used to communicate with the Chrome DevTools Protocol. * * @public * @unofficial */ export interface ElectronDebugger { /** * Registers a listener for the `detach` event, emitted when the debugging session is terminated. * * @param event - The event name. * @param listener - Called with the event and the reason for detaching. * @returns This debugger instance. */ addListener(event: "detach", listener: (event: ElectronEvent, reason: string) => void): this; /** * Registers a listener for the `message` event, emitted when the debugging target issues an instrumentation event. * * @param event - The event name. * @param listener - Called with the event, method name, event parameters, and session id. * @returns This debugger instance. */ addListener(event: "message", listener: (event: ElectronEvent, method: string, params: unknown, sessionId: string) => void): this; /** * Attaches the debugger to the web contents. * * @param protocolVersion - The requested debugging protocol version. */ attach(protocolVersion?: string): void; /** Detaches the debugger from the web contents. */ detach(): void; /** * Returns whether a debugger is attached to the web contents. * * @returns Whether a debugger is attached. */ isAttached(): boolean; /** * Registers a listener for the `detach` event, emitted when the debugging session is terminated. * * @param event - The event name. * @param listener - Called with the event and the reason for detaching. * @returns This debugger instance. */ on(event: "detach", listener: (event: ElectronEvent, reason: string) => void): this; /** * Registers a listener for the `message` event, emitted when the debugging target issues an instrumentation event. * * @param event - The event name. * @param listener - Called with the event, method name, event parameters, and session id. * @returns This debugger instance. */ on(event: "message", listener: (event: ElectronEvent, method: string, params: unknown, sessionId: string) => void): this; /** * Registers a one-time listener for the `detach` event. * * @param event - The event name. * @param listener - Called with the event and the reason for detaching. * @returns This debugger instance. */ once(event: "detach", listener: (event: ElectronEvent, reason: string) => void): this; /** * Registers a one-time listener for the `message` event. * * @param event - The event name. * @param listener - Called with the event, method name, event parameters, and session id. * @returns This debugger instance. */ once(event: "message", listener: (event: ElectronEvent, method: string, params: unknown, sessionId: string) => void): this; /** * Removes a previously registered `detach` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This debugger instance. */ removeListener(event: "detach", listener: (event: ElectronEvent, reason: string) => void): this; /** * Removes a previously registered `message` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This debugger instance. */ removeListener(event: "message", listener: (event: ElectronEvent, method: string, params: unknown, sessionId: string) => void): this; /** * Sends a given command to the debugging target. * * @param method - The command method name. * @param commandParams - The parameters required by the command. * @param sessionId - The session id for the command. * @returns A promise resolving with the command response. */ sendCommand(method: string, commandParams?: unknown, sessionId?: string): Promise<unknown>; } /** * Default font families used by the renderer, keyed by generic family. * * @public * @unofficial */ export interface ElectronDefaultFontFamily { /** * The cursive font family. * * @default `Script` */ cursive?: string; /** * The fantasy font family. * * @default `Impact` */ fantasy?: string; /** * The monospace font family. * * @default `Courier New` */ monospace?: string; /** * The sans-serif font family. * * @default `Arial` */ sansSerif?: string; /** * The serif font family. * * @default `Times New Roman` */ serif?: string; /** * The standard font family. * * @default `Times New Roman` */ standard?: string; } /** * Electron desktop capturer for accessing information about media sources that can be used to capture audio * and video from the desktop using the `navigator.mediaDevices.getUserMedia` API. * * @public * @unofficial */ export interface ElectronDesktopCapturer { /** * Resolves with an array of `DesktopCapturerSource` objects, each representing a screen or an individual * window that can be captured. * * Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher, which can be * detected via `systemPreferences.getMediaAccessStatus`. * * @param options - Options describing which sources to capture. * @returns A promise resolving with the captured sources. */ getSources(options: ElectronSourcesOptions): Promise<ElectronDesktopCapturerSource[]>; } /** * A screen or individual window that can be captured, returned by `desktopCapturer.getSources`. * * @public * @unofficial */ export interface ElectronDesktopCapturerSource { /** * An icon image of the application that owns the window, or `null` if the source has a type screen. * The size of the icon is not known in advance and depends on what the application provides. */ appIcon: ElectronNativeImage; /** * A unique identifier that corresponds to the `id` of the matching display returned by the Screen API. * On some platforms, this is equivalent to the `XX` portion of the `id` field above and on others it differs. * It is an empty string if not available. */ display_id: string; /** * The identifier of a window or screen that can be used as a `chromeMediaSourceId` constraint when calling * `navigator.webkitGetUserMedia`. The format of the identifier is `window:XX:YY` or `screen:ZZ:0`. * `XX` is the windowID/handle, `YY` is `1` for the current process and `0` for all others, and `ZZ` is a * sequential number representing the screen. */ id: string; /** * A screen source is named either `Entire Screen` or `Screen <index>`, while the name of a window source * matches the window title. */ name: string; /** * A thumbnail image. There is no guarantee that the size of the thumbnail matches the `thumbnailSize` * specified in the `options` passed to `desktopCapturer.getSources`. The actual size depends on the scale * of the screen or window. */ thumbnail: ElectronNativeImage; } /** * Details about a child process that has gone (crashed or killed). * * @public * @unofficial */ export interface ElectronDetails { /** The exit code for the process. */ exitCode: number; /** The name of the process. */ name?: string; /** The reason the child process is gone. */ reason: "abnormal-exit" | "clean-exit" | "crashed" | "integrity-failure" | "killed" | "launch-failed" | "oom"; /** The non-localized name of the process. */ serviceName?: string; /** Process type. */ type: "GPU" | "Pepper Plugin" | "Pepper Plugin Broker" | "Sandbox helper" | "Unknown" | "Utility" | "Zygote"; } /** * Details passed to a device permission handler. * * @public * @unofficial */ export interface ElectronDevicePermissionHandlerHandlerDetails { /** The device that permission is being requested for. */ device: ElectronHIDDevice | ElectronSerialPort; /** The type of device that permission is being requested on. */ deviceType: "hid" | "serial"; /** The frame checking the device permission. */ frame: ElectronWebFrameMain; /** The origin URL of the device permission check. */ origin: string; } /** * Electron Dialog for showing native system dialogs. * * @public * @unofficial */ export interface ElectronDialog { /** * Shows a certificate trust dialog (macOS, Windows only). * * @param browserWindow - The parent window the dialog attaches to. * @param options - The certificate trust dialog options. * @returns A `Promise` that resolves when the certificate trust dialog is shown. */ showCertificateTrustDialog(browserWindow: ElectronBrowserWindow, options: ElectronCertificateTrustDialogOptions): Promise<void>; /** * Shows a certificate trust dialog (macOS, Windows only). * * @param options - The certificate trust dialog options. * @returns A `Promise` that resolves when the certificate trust dialog is shown. */ showCertificateTrustDialog(options: ElectronCertificateTrustDialogOptions): Promise<void>; /** * Shows an error message box. * * @param title - The dialog title. * @param content - The error message content. */ showErrorBox(title: string, content: string): void; /** * Shows a message box dialog. * * @param browserWindow - The parent window. * @param options - The message box options. * @returns The user's response. */ showMessageBox(browserWindow: ElectronBrowserWindow, options: ElectronMessageBoxOptions): Promise<ElectronMessageBoxReturnValue>; /** * Shows a message box dialog. * * @param options - The message box options. * @returns The user's response. */ showMessageBox(options: ElectronMessageBoxOptions): Promise<ElectronMessageBoxReturnValue>; /** * Shows a message box dialog, blocking the process until it is closed. * * @param browserWindow - The parent window. * @param options - The message box options. * @returns The index of the clicked button. */ showMessageBoxSync(browserWindow: ElectronBrowserWindow, options: ElectronMessageBoxSyncOptions): number; /** * Shows a message box dialog, blocking the process until it is closed. * * @param options - The message box options. * @returns The index of the clicked button. */ showMessageBoxSync(options: ElectronMessageBoxSyncOptions): number; /** * Shows an open file dialog. * * @param browserWindow - The parent window. * @param options - The open dialog options. * @returns The selected file paths. */ showOpenDialog(browserWindow: ElectronBrowserWindow, options: ElectronOpenDialogOptions): Promise<ElectronOpenDialogReturnValue>; /** * Shows an open file dialog. * * @param options - The open dialog options. * @returns The selected file paths. */ showOpenDialog(options: ElectronOpenDialogOptions): Promise<ElectronOpenDialogReturnValue>; /** * Shows an open file dialog, blocking the process until it is closed. * * @param browserWindow - The parent window. * @param options - The open dialog options. * @returns The file paths chosen by the user, or `undefined` if the dialog is cancelled. */ showOpenDialogSync(browserWindow: ElectronBrowserWindow, options: ElectronOpenDialogSyncOptions): string[] | undefined; /** * Shows an open file dialog, blocking the process until it is closed. * * @param options - The open dialog options. * @returns The file paths chosen by the user, or `undefined` if the dialog is cancelled. */ showOpenDialogSync(options: ElectronOpenDialogSyncOptions): string[] | undefined; /** * Shows a save file dialog. * * @param browserWindow - The parent window. * @param options - The save dialog options. * @returns The selected file path. */ showSaveDialog(browserWindow: ElectronBrowserWindow, options: ElectronSaveDialogOptions): Promise<ElectronSaveDialogReturnValue>; /** * Shows a save file dialog. * * @param options - The save dialog options. * @returns The selected file path. */ showSaveDialog(options: ElectronSaveDialogOptions): Promise<ElectronSaveDialogReturnValue>; /** * Shows a save file dialog, blocking the process until it is closed. * * @param browserWindow - The parent window. * @param options - The save dialog options. * @returns The path of the file chosen by the user, or `undefined` if the dialog is cancelled. */ showSaveDialogSync(browserWindow: ElectronBrowserWindow, options: ElectronSaveDialogSyncOptions): string | undefined; /** * Shows a save file dialog, blocking the process until it is closed. * * @param options - The save dialog options. * @returns The path of the file chosen by the user, or `undefined` if the dialog is cancelled. */ showSaveDialogSync(options: ElectronSaveDialogSyncOptions): string | undefined; } /** * Details about a window created via `window.open`. * * @public * @unofficial */ export interface ElectronDidCreateWindowDetails { /** The disposition used when creating the window. */ disposition: "background-tab" | "default" | "foreground-tab" | "new-window" | "other" | "save-to-disk"; /** Name given to the created window in the `window.open()` call. */ frameName: string; /** The options used to create the BrowserWindow. */ options: BrowserWindowConstructorOptions; /** The post data that will be sent to the new window, if any. */ postBody?: ElectronPostBody; /** The referrer that will be passed to the new window. */ referrer: ElectronReferrer; /** URL for the created window. */ url: string; } /** * Describes a display connected to the system. * * @public * @unofficial */ export interface ElectronDisplay { /** Whether the display supports accelerometer input. Can be `available`, `unavailable` or `unknown`. */ accelerometerSupport: "available" | "unavailable" | "unknown"; /** The bounds of the display in DIP points. */ bounds: ElectronRectangle; /** The number of bits per pixel. */ colorDepth: number; /** Represents a color space (three-dimensional object which contains all realizable color combinations) for the purpose of color conversions. */ colorSpace: string; /** The number of bits per color component. */ depthPerComponent: number; /** The display refresh rate. */ displayFrequency: number; /** Unique identifier associated with the display. */ id: number; /** `true` for an internal display and `false` for an external display. */ internal: boolean; /** Whether or not the display is a monochrome display. */ monochrome: boolean; /** Screen rotation in clock-wise degrees. Can be `0`, `90`, `180` or `270`. */ rotation: number; /** Output device's pixel scale factor. */ scaleFactor: number; /** The size of the display. */ size: ElectronSize; /** Whether the display supports touch input. Can be `available`, `unavailable` or `unknown`. */ touchSupport: "available" | "unavailable" | "unknown"; /** The work area of the display in DIP points. */ workArea: ElectronRectangle; /** The size of the work area of the display. */ workAreaSize: ElectronSize; } /** * Options for {@link ElectronTray.displayBalloon}. * * @public * @unofficial */ export interface ElectronDisplayBalloonOptions { /** The content of the balloon. */ content: string; /** Icon to use when `iconType` is `custom`. */ icon?: ElectronNativeImage | string; /** * Can be `none`, `info`, `warning`, `error` or `custom`. * * @default `custom` */ iconType?: "custom" | "error" | "info" | "none" | "warning"; /** * The large version of the icon should be used. Maps to `NIIF_LARGE_ICON`. * * @default `true` */ largeIcon?: boolean; /** * Do not play the associated sound. Maps to `NIIF_NOSOUND`. * * @default `false` */ noSound?: boolean; /** * Do not display the balloon notification if the current user is in "quiet time". Maps to `NIIF_RESPECT_QUIET_TIME`. * * @default `false` */ respectQuietTime?: boolean; /** The title of the balloon. */ title: string; } /** * Performs actions on the app icon in the user's dock on macOS. * * @public * @unofficial */ export interface ElectronDock { /** * Bounces the dock icon. When `critical` is passed, the icon bounces until the app becomes active * or the request is canceled; when `informational` is passed, it bounces for one second. macOS only. * * @param type - The bounce type. * @returns An ID representing the request. */ bounce(type?: "critical" | "informational"): number; /** * Cancels the bounce of the given request. macOS only. * * @param id - The bounce request ID. */ cancelBounce(id: number): void; /** * Bounces the Downloads stack if the file path is inside the Downloads folder. macOS only. * * @param filePath - The path of the finished download. */ downloadFinished(filePath: string): void; /** * Returns the badge string of the dock. macOS only. * * @returns The badge string. */ getBadge(): string; /** * Returns the application's dock menu. macOS only. * * @returns The dock menu, or `null` if none has been set. */ getMenu(): ElectronMenu | null; /** Hides the dock icon. macOS only. */ hide(): void; /** * Returns whether the dock icon is visible. macOS only. * * @returns Whether the dock icon is visible. */ isVisible(): boolean; /** * Sets the string to be displayed in the dock's badging area. macOS only. * * @param text - The badge text. */ setBadge(text: string): void; /** * Sets the image associated with this dock icon. macOS only. * * @param image - The image, or a path to it. */ setIcon(image: ElectronNativeImage | string): void; /** * Sets the application's dock menu. macOS only. * * @param menu - The menu to set. */ setMenu(menu: ElectronMenu): void; /** * Shows the dock icon. macOS only. * * @returns A promise resolved when the dock icon is shown. */ show(): Promise<void>; } /** * Controls and reports on a file download in a session. * * @public * @unofficial */ export interface ElectronDownloadItem { /** The save file path of the download item. Only settable in the session's `will-download` callback. */ savePath: string; /** * Registers a listener for the `done` event, emitted when the download reaches a terminal state. * * @param event - The event name. * @param listener - Called with the terminal state of the download. * @returns This download item instance. */ addListener(event: "done", listener: (event: ElectronEvent, state: "cancelled" | "completed" | "interrupted") => void): this; /** * Registers a listener for the `updated` event, emitted when the download has been updated and is not done. * * @param event - The event name. * @param listener - Called with the current state of the download. * @returns This download item instance. */ addListener(event: "updated", listener: (event: ElectronEvent, state: "interrupted" | "progressing") => void): this; /** Cancels the download operation. */ cancel(): void; /** * Returns whether the download can resume. * * @returns Whether the download can resume. */ canResume(): boolean; /** * Returns the `Content-Disposition` field from the response header. * * @returns The content disposition. */ getContentDisposition(): string; /** * Returns the `ETag` header value. * * @returns The ETag value. */ getETag(): string; /** * Returns the file name of the download item. * * @returns The file name. */ getFilename(): string; /** * Returns the `Last-Modified` header value. * * @returns The last modified time. */ getLastModifiedTime(): string; /** * Returns the file's MIME type. * * @returns The MIME type. */ getMimeType(): string; /** * Returns the received bytes of the download item. * * @returns The number of received bytes. */ getReceivedBytes(): number; /** * Returns the object previously set by `setSaveDialogOptions`. * * @returns The save dialog options. */ getSaveDialogOptions(): ElectronSaveDialogOptions; /** * Returns the save path of the download item. * * @returns The save path. */ getSavePath(): string; /** * Returns the number of seconds since the UNIX epoch when the download was started. * * @returns The start time in seconds. */ getStartTime(): number; /** * Returns the current state of the download. * * @returns The current state. */ getState(): "cancelled" | "completed" | "interrupted" | "progressing"; /** * Returns the total size in bytes of the download item. Returns 0 if the size is unknown. * * @returns The total number of bytes. */ getTotalBytes(): number; /** * Returns the origin URL where the item is downloaded from. * * @returns The origin URL. */ getURL(): string; /** * Returns the complete URL chain of the item including any redirects. * * @returns The URL chain. */ getURLChain(): string[]; /** * Returns whether the download has a user gesture. * * @returns Whether the download has a user gesture. */ hasUserGesture(): boolean; /** * Returns whether the download is paused. * * @returns Whether the download is paused. */ isPaused(): boolean; /** * Registers a listener for the `done` event, emitted when the download reaches a terminal state. * * @param event - The event name. * @param listener - Called with the terminal state of the download. * @returns This download item instance. */ on(event: "done", listener: (event: ElectronEvent, state: "cancelled" | "completed" | "interrupted") => void): this; /** * Registers a listener for the `updated` event, emitted when the download has been updated and is not done. * * @param event - The event name. * @param listener - Called with the current state of the download. * @returns This download item instance. */ on(event: "updated", listener: (event: ElectronEvent, state: "interrupted" | "progressing") => void): this; /** * Registers a one-time listener for the `done` event. * * @param event - The event name. * @param listener - Called with the terminal state of the download. * @returns This download item instance. */ once(event: "done", listener: (event: ElectronEvent, state: "cancelled" | "completed" | "interrupted") => void): this; /** * Registers a one-time listener for the `updated` event. * * @param event - The event name. * @param listener - Called with the current state of the download. * @returns This download item instance. */ once(event: "updated", listener: (event: ElectronEvent, state: "interrupted" | "progressing") => void): this; /** Pauses the download. */ pause(): void; /** * Removes a previously registered `done` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This download item instance. */ removeListener(event: "done", listener: (event: ElectronEvent, state: "cancelled" | "completed" | "interrupted") => void): this; /** * Removes a previously registered `updated` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This download item instance. */ removeListener(event: "updated", listener: (event: ElectronEvent, state: "interrupted" | "progressing") => void): this; /** Resumes the download that has been paused. */ resume(): void; /** * Sets custom options for the save dialog. Only available in the session's `will-download` callback. * * @param options - The save dialog options. */ setSaveDialogOptions(options: ElectronSaveDialogOptions): void; /** * Sets the save path of the download item. Only available in the session's `will-download` callback. * * @param path - The save path. */ setSavePath(path: string): void; } /** * Flags indicating which editing actions the renderer believes it can perform. * * @public * @unofficial */ export interface ElectronEditFlags { /** Whether the renderer believes it can copy. */ canCopy: boolean; /** Whether the renderer believes it can cut. */ canCut: boolean; /** Whether the renderer believes it can delete. */ canDelete: boolean; /** Whether the renderer believes it can edit text richly. */ canEditRichly: boolean; /** Whether the renderer believes it can paste. */ canPaste: boolean; /** Whether the renderer believes it can redo. */ canRedo: boolean; /** Whether the renderer believes it can select all. */ canSelectAll: boolean; /** Whether the renderer believes it can undo. */ canUndo: boolean; } /** * Options for emulating network conditions for a session. * * @public * @unofficial */ export interface ElectronEnableNetworkEmulationOptions { /** Download rate in Bps. `0` disables download throttling. */ downloadThroughput?: number; /** RTT in ms. `0` disables latency throttling. */ latency?: number; /** Whether to emulate network outage. */ offline?: boolean; /** Upload rate in Bps. `0` disables upload throttling. */ uploadThroughput?: number; } /** * Electron event object passed to event listeners, extending the DOM `Event`. * * @public * @unofficial */ export interface ElectronEvent extends Event { /** Prevents the default action associated with the event. */ preventDefault(): void; } /** * A loaded Chrome extension. * * @public * @unofficial */ export interface ElectronExtension { /** The extension id. */ id: string; /** Copy of the extension's manifest data. */ manifest: unknown; /** The extension name. */ name: string; /** The extension's file path. */ path: string; /** The extension's `chrome-extension://` URL. */ url: string; /** The extension version. */ version: string; } /** * Options for configuring the auto updater feed URL. * * @public * @unofficial */ export interface ElectronFeedURLOptions { /** * HTTP request headers (macOS only). */ headers?: Record<string, string>; /** * Can be `json` or `default`, see the Squirrel.Mac README for more information (macOS only). */ serverType?: "default" | "json"; /** The feed URL. */ url: string; } /** * File filter for Electron dialog file type selection. * * @public * @unofficial */ export interface ElectronFileFilter { /** The file extensions to filter (without dots). */ extensions: string[]; /** The display name of the filter. */ name: string; } /** * Options for fetching a file's associated icon. * * @public * @unofficial */ export interface ElectronFileIconOptions { /** The size of the icon to fetch. */ size: "large" | "normal" | "small"; } /** * Options for a find-in-page request. * * @public * @unofficial */ export interface ElectronFindInPageOptions { /** * Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. * * @default `false` */ findNext?: boolean; /** * Whether to search forward or backward. * * @default `true` */ forward?: boolean; /** * Whether the search should be case-sensitive. * * @default `false` */ matchCase?: boolean; } /** * Options for focusing the application. * * @public * @unofficial */ export interface ElectronFocusOptions { /** Make the receiver the active app even if another app is currently active. macOS only. */ steal: boolean; } /** * Details about a newly created frame. * * @public * @unofficial */ export interface ElectronFrameCreatedDetails { /** The frame that was created. */ frame: ElectronWebFrameMain; } /** * Options used when creating a session from a partition. * * @public * @unofficial */ export interface ElectronFromPartitionOptions { /** Whether to enable cache. */ cache: boolean; } /** * The Graphics Feature Status from `chrome://gpu/`. * * @public * @unofficial */ export interface ElectronGPUFeatureStatus { /** Canvas. */ "2d_canvas": string; /** Flash. */ "flash_3d": string; /** Flash Stage3D. */ "flash_stage3d": string; /** Flash Stage3D Baseline profile. */ "flash_stage3d_baseline": string; /** Compositing. */ "gpu_compositing": string; /** Multiple Raster Threads. */ "multiple_raster_threads": string; /** Native GpuMemoryBuffers. */ "native_gpu_memory_buffers": string; /** Rasterization. */ "rasterization": string; /** Video Decode. */ "video_decode": string; /** Video Encode. */ "video_encode": string; /** VPx Video Decode. */ "vpx_decode": string; /** WebGL. */ "webgl": string; /** WebGL2. */ "webgl2": string; } /** * Detects keyboard events when the application does not have keyboard focus. * * @public * @unofficial */ export interface ElectronGlobalShortcut { /** * Returns whether this application has registered `accelerator`. * * When the accelerator is already taken by other applications, this call will still return `false`. This behavior is * intended by operating systems, since they don't want applications to fight for global shortcuts. * * @param accelerator - The accelerator to check. * @returns Whether this application has registered `accelerator`. */ isRegistered(accelerator: ElectronAccelerator): boolean; /** * Registers a global shortcut of `accelerator`. The `callback` is called when the registered shortcut is pressed by * the user. * * When the accelerator is already taken by other applications, this call will silently fail. * * @param accelerator - The accelerator to register. * @param callback - Called when the registered shortcut is pressed. * @returns Whether or not the shortcut was registered successfully. */ register(accelerator: ElectronAccelerator, callback: () => void): boolean; /** * Registers a global shortcut of all `accelerator` items in `accelerators`. The `callback` is called when any of the * registered shortcuts are pressed by the user. * * When a given accelerator is already taken by other applications, this call will silently fail. * * @param accelerators - The accelerators to register. * @param callback - Called when any of the registered shortcuts is pressed. */ registerAll(accelerators: string[], callback: () => void): void; /** * Unregisters the global shortcut of `accelerator`. * * @param accelerator - The accelerator to unregister. */ unregister(accelerator: ElectronAccelerator): void; /** Unregisters all of the global shortcuts. */ unregisterAll(): void; } /** * A HID device available for selection via the Web HID API. * * @public * @unofficial */ export interface ElectronHIDDevice { /** Unique identifier for the device. */ deviceId: string; /** Unique identifier for the HID interface. A device may have multiple HID interfaces. */ guid?: string; /** Name of the device. */ name: string; /** The USB product ID. */ productId: number; /** The USB device serial number. */ serialNumber?: string; /** The USB vendor ID. */ vendorId: number; } /** * Details about a window open request handled by a window open handler. * * @public * @unofficial */ export interface ElectronHandlerDetails { /** The disposition requested for the new window. */ disposition: "background-tab" | "default" | "foreground-tab" | "new-window" | "other" | "save-to-disk"; /** Comma-separated list of window features provided to `window.open()`. */ features: string; /** Name of the window provided in `window.open()`. */ frameName: string; /** The post data that will be sent to the new window, if any. */ postBody?: ElectronPostBody; /** The referrer that will be passed to the new window. */ referrer: ElectronReferrer; /** The resolved version of the URL passed to `window.open()`. */ url: string; } /** * Response object returned by an `onHeadersReceived` web-request listener callback. * * @public * @unofficial */ export interface ElectronHeadersReceivedResponse { /** Whether to cancel the request. */ cancel?: boolean; /** When provided, the server is assumed to have responded with these headers. */ responseHeaders?: Record<string, string | string[]>; /** Should be provided when overriding `responseHeaders` to change header status otherwise original response header's status will be used. */ statusLine?: string; } /** * Details passed to the `hid-device-added` session event. * * @public * @unofficial */ export interface ElectronHidDeviceAddedDetails { /** The HID devices that became available. */ device: ElectronHIDDevice[]; /** The frame that requested the device. */ frame: ElectronWebFrameMain; } /** * Details passed to the `hid-device-removed` session event. * * @public * @unofficial */ export interface ElectronHidDeviceRemovedDetails { /** The HID devices that were removed. */ device: ElectronHIDDevice[]; /** The frame associated with the removed device. */ frame: ElectronWebFrameMain; } /** * Options for {@link ElectronBrowserWindow.setIgnoreMouseEvents}. * * @public * @unofficial */ export interface ElectronIgnoreMouseEventsOptions { /** * If `true`, forwards mouse move messages to Chromium, enabling mouse related events such as `mouseleave`. Only * used when `ignore` is `true`. If `ignore` is `false`, forwarding is always disabled regardless of this value. * * Available on macOS and Windows. */ forward?: boolean; } /** * Options for importing a certificate into the platform certificate store. * * @public * @unofficial */ export interface ElectronImportCertificateOptions { /** Path for the pkcs12 file. */ certificate: string; /** Passphrase for the certificate. */ password: string; } /** * In-app purchases on the Mac App Store. * * @public * @unofficial */ export interface ElectronInAppPurchase { /** * Adds a listener for the `transactions-updated` event. * * Emitted when one or more transactions have been updated. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronInAppPurchase` instance. */ addListener(event: "transactions-updated", listener: (event: ElectronEvent, transactions: ElectronTransaction[]) => void): this; /** * Returns whether a user can make a payment. * * @returns Whether a user can make a payment. */ canMakePayments(): boolean; /** Completes all pending transactions. */ finishAllTransactions(): void; /** * Completes the pending transactions corresponding to the date. * * @param date - The date of the transactions to finish. */ finishTransactionByDate(date: string): void; /** * Retrieves the product descriptions. * * @param productIDs - The identifiers of the products to retrieve. * @returns A promise that resolves with an array of `ElectronProduct` objects. */ getProducts(productIDs: string[]): Promise<ElectronProduct[]>; /** * Returns the path to the receipt. * * @returns The path to the receipt. */ getReceiptURL(): string; /** * Registers a listener for the `transactions-updated` event. * * Emitted when one or more transactions have been updated. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronInAppPurchase` instance. */ on(event: "transactions-updated", listener: (event: ElectronEvent, transactions: ElectronTransaction[]) => void): this; /** * Registers a one-time listener for the `transactions-updated` event. * * Emitted when one or more transactions have been updated. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronInAppPurchase` instance. */ once(event: "transactions-updated", listener: (event: ElectronEvent, transactions: ElectronTransaction[]) => void): this; /** * Adds the specified product to the payment queue. You should listen for the `transactions-updated` event as soon as * possible and certainly before you call `purchaseProduct`. * * @param productID - The identifier of the product to purchase. * @param quantity - The number of items the user wants to purchase. * @returns A promise that resolves with `true` if the product is valid and added to the payment queue. */ purchaseProduct(productID: string, quantity?: number): Promise<boolean>; /** * Removes a previously added listener for the `transactions-updated` event. * * Emitted when one or more transactions have been updated. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronInAppPurchase` instance. */ removeListener(event: "transactions-updated", listener: (event: ElectronEvent, transactions: ElectronTransaction[]) => void): this; /** * Restores finished transactions. This method can be called either to install purchases on additional devices, or to * restore purchases for an application that the user deleted and reinstalled. * * The payment queue delivers a new transaction for each previously completed transaction that can be restored. Each * transaction includes a copy of the original transaction. */ restoreCompletedTransactions(): void; } /** * Security origin, content security policy and name of an isolated world. * * @public * @unofficial */ export interface ElectronInfo { /** Content Security Policy for the isolated world. */ csp?: string; /** Name for isolated world. Useful in devtools. */ name?: string; /** Security origin for the isolated world. */ securityOrigin?: string; } /** * Input properties describing a keyboard event dispatched to the page. * * @public * @unofficial */ export interface ElectronInput { /** Equivalent to `KeyboardEvent.altKey`. */ alt: boolean; /** Equivalent to `KeyboardEvent.code`. */ code: string; /** Equivalent to `KeyboardEvent.controlKey`. */ control: boolean; /** Equivalent to `KeyboardEvent.repeat`. */ isAutoRepeat: boolean; /** Equivalent to `KeyboardEvent.isComposing`. */ isComposing: boolean; /** Equivalent to `KeyboardEvent.key`. */ key: string; /** Equivalent to `KeyboardEvent.location`. */ location: number; /** Equivalent to `KeyboardEvent.metaKey`. */ meta: boolean; /** The modifiers of the input event. */ modifiers: string[]; /** Equivalent to `KeyboardEvent.shiftKey`. */ shift: boolean; /** Either `keyUp` or `keyDown`. */ type: string; } /** * Base shape shared by every Electron input event passed to {@link ElectronWebContents.sendInputEvent}. * * @public * @unofficial */ export interface ElectronInputEvent { /** The modifier keys held during the event. */ modifiers?: Array<"alt" | "capsLock" | "cmd" | "command" | "control" | "ctrl" | "isAutoRepeat" | "isKeypad" | "left" | "leftButtonDown" | "meta" | "middleButtonDown" | "numLock" | "right" | "rightButtonDown" | "shift">; } /** * Options for inserting CSS into a web page. * * @public * @unofficial */ export interface ElectronInsertCSSOptions { /** * Sets the cascade origin of the inserted stylesheet. Can be either `user` or `author`. * * @default `'author'` */ cssOrigin?: string; } /** * Electron IPC main for communicating with renderer processes from the main process. * * @public * @unofficial */ export interface ElectronIpcMain extends NodeJS.EventEmitter { /** * Adds a handler for an `invoke`able IPC. This handler is called whenever a renderer calls * `ipcRenderer.invoke(channel, ...args)`. * * If `listener` returns a `Promise`, the eventual result of the promise is returned as a reply to the remote * caller. Otherwise, the return value of the listener is used as the value of the reply. * * The `event` passed as the first argument to the handler is the same as that passed to a regular event * listener. It includes information about which `WebContents` is the source of the invoke request. * * @param channel - The IPC channel name. * @param listener - Callback invoked to handle the message. */ handle(channel: string, listener: (event: ElectronIpcMainInvokeEvent, ...args: unknown[]) => unknown): void; /** * Handles a single `invoke`able IPC message, then removes the listener. See `ipcMain.handle(channel, listener)`. * * @param channel - The IPC channel name. * @param listener - Callback invoked to handle the message. */ handleOnce(channel: string, listener: (event: ElectronIpcMainInvokeEvent, ...args: unknown[]) => unknown): void; /** * Listens to `channel`; when a new message arrives `listener` is called with `listener(event, args...)`. * * @param channel - The IPC channel name. * @param listener - Callback invoked when a message is received. * @returns This `IpcMain` instance. */ on(channel: string, listener: (event: ElectronIpcMainEvent, ...args: unknown[]) => void): this; /** * Adds a one-time `listener` function for the event, invoked only the next time a message is sent to * `channel`, after which it is removed. * * @param channel - The IPC channel name. * @param listener - Callback invoked when a message is received. * @returns This `IpcMain` instance. */ once(channel: string, listener: (event: ElectronIpcMainEvent, ...args: unknown[]) => void): this; /** * Removes listeners of the specified `channel`. * * @param channel - The IPC channel name. * @returns This `IpcMain` instance. */ removeAllListeners(channel?: string): this; /** * Removes any handler for `channel`, if present. * * @param channel - The IPC channel name. */ removeHandler(channel: string): void; /** * Removes the specified `listener` from the listener array for the specified `channel`. * * @param channel - The IPC channel name. * @param listener - The listener to remove. * @returns This `IpcMain` instance. */ removeListener(channel: string, listener: (...args: unknown[]) => void): this; } /** * Event passed as the first argument to `ipcMain` `on`/`once` listeners. * * @public * @unofficial */ export interface ElectronIpcMainEvent { /** The ID of the renderer frame that sent this message. */ frameId: number; /** A list of message ports that were transferred with this message. */ ports: ElectronMessagePortMain[]; /** The internal ID of the renderer process that sent this message. */ processId: number; /** Set this to the value to be returned in a synchronous message. */ returnValue: unknown; /** The `webContents` that sent the message. */ sender: ElectronWebContents; /** The frame that sent this message. */ readonly senderFrame: ElectronWebFrameMain; /** * Sends an IPC message to the renderer frame that sent the original message that is currently being handled. * Use this method to "reply" to the sent message in order to guarantee the reply goes to the correct process and frame. * * @param channel - The IPC channel name. * @param args - Arguments to send back to the renderer frame. */ reply(channel: string, ...args: unknown[]): void; } /** * Event passed as the first argument to `ipcMain` `handle`/`handleOnce` handlers. * * @public * @unofficial */ export interface ElectronIpcMainInvokeEvent extends ElectronEvent { /** The ID of the renderer frame that sent this message. */ frameId: number; /** The internal ID of the renderer process that sent this message. */ processId: number; /** The `webContents` that sent the message. */ sender: ElectronWebContents; /** The frame that sent this message. */ readonly senderFrame: ElectronWebFrameMain; } /** * Electron IPC renderer for communicating with the main process. * * @public * @unofficial */ export interface ElectronIpcRenderer extends NodeJS.EventEmitter { /** * Sends a message to the main process via `channel` and expects a result asynchronously. * * The main process should listen for `channel` with `ipcMain.handle()`. Arguments are serialized * with the Structured Clone Algorithm, so prototype chains are not included and sending functions, * promises, symbols, weak maps, or weak sets throws an exception. * * @param channel - The IPC channel name. * @param args - Arguments to send. * @returns A promise resolving with the response from the main process. */ invoke(channel: string, ...args: unknown[]): Promise<unknown>; /** * Listens to `channel`; when a new message arrives `listener` is called with `listener(event, args...)`. * * @param channel - The IPC channel name. * @param listener - Callback invoked when a message is received. * @returns This `IpcRenderer` instance. */ on(channel: string, listener: (event: IpcRendererEvent, ...args: unknown[]) => void): this; /** * Adds a one-time `listener` function for the event, invoked only the next time a message is sent * to `channel`, after which it is removed. * * @param channel - The IPC channel name. * @param listener - Callback invoked when a message is received. * @returns This `IpcRenderer` instance. */ once(channel: string, listener: (event: IpcRendererEvent, ...args: unknown[]) => void): this; /** * Sends a message to the main process, optionally transferring ownership of zero or more * `MessagePort` objects. The transferred ports are available in the main process as * `MessagePortMain` objects via the `ports` property of the emitted event. * * @param channel - The IPC channel name. * @param message - The message to send. * @param transfer - Optional transferable `MessagePort` objects. */ postMessage(channel: string, message: unknown, transfer?: MessagePort[]): void; /** * Removes all listeners of the specified `channel`. * * @param channel - The IPC channel name. * @returns This `IpcRenderer` instance. */ removeAllListeners(channel: string): this; /** * Removes the specified `listener` from the listener array for the specified `channel`. * * @param channel - The IPC channel name. * @param listener - The listener to remove. * @returns This `IpcRenderer` instance. */ removeListener(channel: string, listener: (...args: unknown[]) => void): this; /** * Sends an asynchronous message to the main process via `channel`, along with arguments. * * The main process handles it by listening for `channel` with the `ipcMain` module. Arguments are * serialized with the Structured Clone Algorithm, so prototype chains are not included and sending * functions, promises, symbols, weak maps, or weak sets throws an exception. * * @param channel - The IPC channel name. * @param args - Arguments to send. */ send(channel: string, ...args: unknown[]): void; /** * Sends a message to the main process via `channel` and expects a result synchronously. * * The main process handles it by listening for `channel` with the `ipcMain` module and replies by * setting `event.returnValue`. Sending a synchronous message blocks the whole renderer process * until the reply is received, so use this only as a last resort. * * @param channel - The IPC channel name. * @param args - Arguments to send. * @returns The value sent back by the `ipcMain` handler. */ sendSync(channel: string, ...args: unknown[]): unknown; /** * Sends a message to a window with `webContentsId` via `channel`. * * @param webContentsId - The `webContents.id` of the target window. * @param channel - The IPC channel name. * @param args - Arguments to send. */ sendTo(webContentsId: number, channel: string, ...args: unknown[]): void; /** * Like `send`, but the event is sent to the `<webview>` element in the host page instead of the * main process. * * @param channel - The IPC channel name. * @param args - Arguments to send. */ sendToHost(channel: string, ...args: unknown[]): void; } /** * The item to drag during a drag-and-drop operation. * * @public * @unofficial */ export interface ElectronItem { /** The path to the file being dragged. */ file: string; /** The paths to the files being dragged. Overrides the `file` field. */ files?: string[]; /** The image shown under the cursor while dragging. Must be non-empty on macOS. */ icon: ElectronNativeImage | string; } /** * A category in a Windows Jump List. * * @public * @unofficial */ export interface ElectronJumpListCategory { /** Array of `ElectronJumpListItem` objects if `type` is `tasks` or `custom`, otherwise omitted. */ items?: ElectronJumpListItem[]; /** Must be set if `type` is `custom`, otherwise omitted. */ name?: string; /** The type of the category. */ type?: "custom" | "frequent" | "recent" | "tasks"; } /** * A single item in a Windows Jump List. * * @public * @unofficial */ export interface ElectronJumpListItem { /** The command line arguments when `program` is executed. Should only be set if `type` is `task`. */ args?: string; /** Description of the task (displayed in a tooltip). Should only be set if `type` is `task`. Maximum length 260 characters. */ description?: string; /** The zero-based index of the icon in the resource file. */ iconIndex?: number; /** The absolute path to an icon to be displayed in a Jump List. */ iconPath?: string; /** Path of the file to open. Should only be set if `type` is `file`. */ path?: string; /** Path of the program to execute. Should only be set if `type` is `task`. */ program?: string; /** The text to be displayed for the item in the Jump List. Should only be set if `type` is `task`. */ title?: string; /** The type of the Jump List item. */ type?: "file" | "separator" | "task"; /** The working directory. */ workingDirectory?: string; } /** * Current settings of the Windows Jump List. * * @public * @unofficial */ export interface ElectronJumpListSettings { /** The minimum number of items that will be shown in the Jump List. */ minItems: number; /** Array of `ElectronJumpListItem` objects the user has explicitly removed from custom categories in the Jump List. */ removedItems: ElectronJumpListItem[]; } /** * Modifier-key state describing how an accelerator-triggered event was activated. * * @public * @unofficial */ export interface ElectronKeyboardEvent { /** Whether an Alt key was used in an accelerator to trigger the event. */ altKey?: boolean; /** Whether the Control key was used in an accelerator to trigger the event. */ ctrlKey?: boolean; /** Whether a meta key was used in an accelerator to trigger the event. */ metaKey?: boolean; /** Whether a Shift key was used in an accelerator to trigger the event. */ shiftKey?: boolean; /** Whether an accelerator was used to trigger the event as opposed to another user gesture like a mouse click. */ triggeredByAccelerator?: boolean; } /** * Keyboard input event passed to {@link ElectronWebContents.sendInputEvent} to inject a trusted key * press. * * @public * @unofficial */ export interface ElectronKeyboardInputEvent extends ElectronInputEvent { /** The character sent as the keyboard event; use a valid Electron Accelerator key code. */ keyCode: string; /** The type of the keyboard event. */ type: "char" | "keyDown" | "keyUp"; } /** * A registry-backed login launch item on Windows. * * @public * @unofficial */ export interface ElectronLaunchItems { /** The command-line arguments to pass to the executable. Windows only. */ args: string[]; /** `true` if the app registry key is startup approved and therefore shows as enabled in Task Manager and Windows settings. Windows only. */ enabled: boolean; /** Name value of a registry entry. Windows only. */ name: string; /** The executable to an app that corresponds to a registry entry. Windows only. */ path: string; /** One of `user` or `machine`. Indicates whether the registry entry is under `HKEY_CURRENT_USER` or `HKEY_LOCAL_MACHINE`. Windows only. */ scope: string; } /** * Options controlling how an extension is loaded. * * @public * @unofficial */ export interface ElectronLoadExtensionOptions { /** Whether to allow the extension to read local files over the `file://` protocol and inject content scripts into `file://` pages. */ allowFileAccess: boolean; } /** * The app's login item settings. * * @public * @unofficial */ export interface ElectronLoginItemSettings { /** * `true` if app is set to open at login and its run key is not deactivated. Differs from * `openAtLogin` as it ignores the `args` option. Windows only. */ executableWillLaunchAtLogin: boolean; /** The list of registry-backed launch items. Windows only. */ launchItems: ElectronLaunchItems[]; /** `true` if the app is set to open as hidden at login. Not available on MAS builds. macOS only. */ openAsHidden: boolean; /** `true` if the app is set to open at login. */ openAtLogin: boolean; /** * `true` if the app was opened as a login item that should restore the state from the previous * session. Not available on MAS builds. macOS only. */ restoreState: boolean; /** `true` if the app was opened as a hidden login item. Not available on MAS builds. macOS only. */ wasOpenedAsHidden: boolean; /** `true` if the app was opened at login automatically. Not available on MAS builds. macOS only. */ wasOpenedAtLogin: boolean; } /** * Options for querying the app's login item settings. * * @public * @unofficial */ export interface ElectronLoginItemSettingsOptions { /** * The command-line arguments to compare against. Windows only. * * @default `[]` */ args?: string[]; /** The executable path to compare against. Windows only. */ path?: string; } /** * The margins of a printed web page. * * @public * @unofficial */ export interface ElectronMargins { /** The bottom margin of the printed web page, in pixels. */ bottom?: number; /** The left margin of the printed web page, in pixels. */ left?: number; /** * The margin type. If `custom` is chosen, `top`, `bottom`, `left`, and `right` must also be specified. */ marginType?: "custom" | "default" | "none" | "printableArea"; /** The right margin of the printed web page, in pixels. */ right?: number; /** The top margin of the printed web page, in pixels. */ top?: number; } /** * Flags describing the state of a media element under the context menu. * * @public * @unofficial */ export interface ElectronMediaFlags { /** Whether the media element can be looped. */ canLoop: boolean; /** Whether the media element can be printed. */ canPrint: boolean; /** Whether the media element can be rotated. */ canRotate: boolean; /** Whether the media element can be downloaded. */ canSave: boolean; /** Whether the media element can show picture-in-picture. */ canShowPictureInPicture: boolean; /** Whether the media element's controls are toggleable. */ canToggleControls: boolean; /** Whether the media element has audio. */ hasAudio: boolean; /** Whether the media element has crashed. */ inError: boolean; /** Whether the media element's controls are visible. */ isControlsVisible: boolean; /** Whether the media element is looping. */ isLooping: boolean; /** Whether the media element is muted. */ isMuted: boolean; /** Whether the media element is paused. */ isPaused: boolean; /** Whether the media element is currently showing picture-in-picture. */ isShowingPictureInPicture: boolean; } /** * Memory usage statistics for a process. * * @public * @unofficial */ export interface ElectronMemoryInfo { /** The maximum amount of memory that has ever been pinned to actual physical RAM. */ peakWorkingSetSize: number; /** The amount of memory not shared by other processes, such as JS heap or HTML content. Windows only. */ privateBytes?: number; /** The amount of memory currently pinned to actual physical RAM. */ workingSetSize: number; } /** * Usage information for one of Blink's internal memory caches. * * @public * @unofficial */ export interface ElectronMemoryUsageDetails { /** The number of objects in the cache. */ count: number; /** The size of the live objects in the cache, in bytes. */ liveSize: number; /** The total size of the cache, in bytes. */ size: number; } /** * Options for constructing an Electron {@link ElectronMenuItem}. * * @public * @unofficial */ export interface ElectronMenuItemConstructorOptions { /** The item's accelerator. */ accelerator?: ElectronAccelerator; /** * When `false`, prevents the accelerator from triggering the item if the item is not visible. `darwin` only. * * @default `true` */ acceleratorWorksWhenHidden?: boolean; /** Inserts this item after the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu. */ after?: string[]; /** Declares the placement of this item's containing group after the containing group of the item with the specified label. */ afterGroupContaining?: string[]; /** Inserts this item before the item with the specified label. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the item should be placed in the same group as the referenced item. */ before?: string[]; /** Declares the placement of this item's containing group before the containing group of the item with the specified label. */ beforeGroupContaining?: string[]; /** Should only be specified for `checkbox` or `radio` type menu items. */ checked?: boolean; /** If `false`, the menu item will be greyed out and unclickable. */ enabled?: boolean; /** The item's icon. */ icon?: ElectronNativeImage | string; /** Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute. */ id?: string; /** The item's visible label. */ label?: string; /** * If `false`, the accelerator won't be registered with the system, but it will still be displayed. `linux`/`win32` only. * * @default `true` */ registerAccelerator?: boolean; /** Defines the action of the menu item. When specified the `click` property will be ignored. */ role?: "about" | "appMenu" | "clearRecentDocuments" | "close" | "copy" | "cut" | "delete" | "editMenu" | "fileMenu" | "forceReload" | "front" | "help" | "hide" | "hideOthers" | "mergeAllWindows" | "minimize" | "moveTabToNewWindow" | "paste" | "pasteAndMatchStyle" | "quit" | "recentDocuments" | "redo" | "reload" | "resetZoom" | "selectAll" | "selectNextTab" | "selectPreviousTab" | "services" | "shareMenu" | "showSubstitutions" | "startSpeaking" | "stopSpeaking" | "toggleDevTools" | "togglefullscreen" | "toggleSmartDashes" | "toggleSmartQuotes" | "toggleSpellChecker" | "toggleTabBar" | "toggleTextReplacement" | "undo" | "unhide" | "viewMenu" | "window" | "windowMenu" | "zoom" | "zoomIn" | "zoomOut"; /** The item to share when the `role` is `shareMenu`. `darwin` only. */ sharingItem?: ElectronSharingItem; /** The item's sublabel. */ sublabel?: string; /** Should be specified for `submenu` type menu items. If `submenu` is specified, the `type: 'submenu'` can be omitted. If the value is not a menu then it will be automatically converted to one using `Menu.buildFromTemplate`. */ submenu?: ElectronMenu | ElectronMenuItemConstructorOptions[]; /** Hover text for this menu item. `darwin` only. */ toolTip?: string; /** The type of the item. */ type?: "checkbox" | "normal" | "radio" | "separator" | "submenu"; /** If `false`, the menu item will be entirely hidden. */ visible?: boolean; /** * Will be called when the menu item is clicked. * * @param menuItem - The menu item that was clicked. * @param browserWindow - The focused window, or `undefined` if none. * @param event - The keyboard event associated with the click. * @returns Nothing. */ click?(menuItem: ElectronMenuItem, browserWindow: ElectronBrowserWindow | undefined, event: KeyboardEvent): void; } /** * Options for popping up a context menu. * * @public * @unofficial */ export interface ElectronMenuPopupOptions { /** * The index of the menu item to be positioned under the mouse cursor at the specified coordinates. `darwin` only. * * @default `-1` */ positioningItem?: number; /** The window to show the popup in. When omitted, the focused window is used. */ window?: ElectronBrowserWindow; /** The x coordinate. Must be declared if `y` is declared. When omitted, the current mouse cursor position is used. */ x?: number; /** The y coordinate. Must be declared if `x` is declared. When omitted, the current mouse cursor position is used. */ y?: number; /** Called when the menu is closed. */ callback?(): void; } /** * Options for Electron message box dialog. * * @public * @unofficial */ export interface ElectronMessageBoxOptions { /** The array of button labels. On Windows, an empty array will result in one button labeled `OK`. */ buttons?: string[]; /** The index of the button to be used to cancel the dialog. */ cancelId?: number; /** * The initial checked state of the checkbox. * * @default `false` */ checkboxChecked?: boolean; /** The label for the checkbox. */ checkboxLabel?: string; /** The index of the button that is selected by default. */ defaultId?: number; /** Extra information about the message. */ detail?: string; /** The icon to display in the message box. */ icon?: ElectronNativeImage | string; /** The content of the message box. */ message: string; /** Whether to set the no link flag for the message box on Windows. */ noLink?: boolean; /** * Whether to normalize keyboard access keys across platforms. * * @default `false` */ normalizeAccessKeys?: boolean; /** An `AbortSignal` to optionally close the message box, behaving as if it was cancelled by the user. */ signal?: AbortSignal; /** Custom width of the text in the message box (macOS only). */ textWidth?: number; /** The title of the message box. */ title?: string; /** The type of the message box. */ type?: "error" | "info" | "none" | "question" | "warning"; } /** * Return value from an Electron message box dialog. * * @public * @unofficial */ export interface ElectronMessageBoxReturnValue { /** Whether the checkbox was checked. */ checkboxChecked: boolean; /** The index of the clicked button. */ response: number; } /** * Options for Electron synchronous message box dialog. * * @public * @unofficial */ export interface ElectronMessageBoxSyncOptions { /** The array of button labels. On Windows, an empty array will result in one button labeled `OK`. */ buttons?: string[]; /** The index of the button to be used to cancel the dialog. */ cancelId?: number; /** The index of the button that is selected by default. */ defaultId?: number; /** Extra information about the message. */ detail?: string; /** The icon to display in the message box. */ icon?: ElectronNativeImage | string; /** The content of the message box. */ message: string; /** Whether to set the no link flag for the message box on Windows. */ noLink?: boolean; /** * Whether to normalize keyboard access keys across platforms. * * @default `false` */ normalizeAccessKeys?: boolean; /** Custom width of the text in the message box (macOS only). */ textWidth?: number; /** The title of the message box. */ title?: string; /** The type of the message box. */ type?: "error" | "info" | "none" | "question" | "warning"; } /** * Details of a console message logged by a service worker. * * @public * @unofficial */ export interface ElectronMessageDetails { /** The log level, from 0 to 3, matching `verbose`, `info`, `warning` and `error`. */ level: number; /** The line number of the source that triggered this console message. */ lineNumber: number; /** The actual console message. */ message: string; /** The type of source for this message. */ source: "console-api" | "deprecation" | "intervention" | "javascript" | "network" | "other" | "recommendation" | "rendering" | "security" | "storage" | "violation" | "worker" | "xml"; /** The URL the message came from. */ sourceUrl: string; /** The version ID of the service worker that sent the log message. */ versionId: number; } /** * Event emitted when a `MessagePortMain` receives a message. * * @public * @unofficial */ export interface ElectronMessageEvent { /** The message payload. */ data: unknown; /** The message ports transferred with the message. */ ports: ElectronMessagePortMain[]; } /** * The main-process end of a MessagePort channel. * * @public * @unofficial */ export interface ElectronMessagePortMain { /** * Registers a listener for the `close` event, emitted when the remote end becomes disconnected. * * @param event - The event name. * @param listener - Called when the port closes. * @returns This message port instance. */ addListener(event: "close", listener: () => void): this; /** * Registers a listener for the `message` event, emitted when the port receives a message. * * @param event - The event name. * @param listener - Called with the received message event. * @returns This message port instance. */ addListener(event: "message", listener: (messageEvent: ElectronMessageEvent) => void): this; /** Disconnects the port, so it is no longer active. */ close(): void; /** * Registers a listener for the `close` event, emitted when the remote end becomes disconnected. * * @param event - The event name. * @param listener - Called when the port closes. * @returns This message port instance. */ on(event: "close", listener: () => void): this; /** * Registers a listener for the `message` event, emitted when the port receives a message. * * @param event - The event name. * @param listener - Called with the received message event. * @returns This message port instance. */ on(event: "message", listener: (messageEvent: ElectronMessageEvent) => void): this; /** * Registers a one-time listener for the `close` event. * * @param event - The event name. * @param listener - Called when the port closes. * @returns This message port instance. */ once(event: "close", listener: () => void): this; /** * Registers a one-time listener for the `message` event. * * @param event - The event name. * @param listener - Called with the received message event. * @returns This message port instance. */ once(event: "message", listener: (messageEvent: ElectronMessageEvent) => void): this; /** * Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts. * * @param message - The message to send. * @param transfer - Message ports whose ownership is transferred with the message. */ postMessage(message: unknown, transfer?: ElectronMessagePortMain[]): void; /** * Removes a previously registered `close` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This message port instance. */ removeListener(event: "close", listener: () => void): this; /** * Removes a previously registered `message` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This message port instance. */ removeListener(event: "message", listener: (messageEvent: ElectronMessageEvent) => void): this; /** Starts the sending of messages queued on the port. Messages will be queued until this method is called. */ start(): void; } /** * The Electron library module type, representing the `window.electron` object. * * @public * @unofficial */ export interface ElectronModule { /** Electron clipboard instance for accessing the system clipboard. */ clipboard: ElectronClipboard; /** Electron `contextBridge` module for exposing APIs across isolated worlds. */ contextBridge: ElectronContextBridge; /** Electron `crashReporter` module for submitting crash reports. */ crashReporter: ElectronCrashReporter; /** Electron IPC renderer instance for the current renderer process. */ ipcRenderer: ElectronIpcRenderer; /** Electron `nativeImage` module for creating images from files, buffers, and data URLs. */ nativeImage: ElectronNativeImageModule; /** Electron remote module instance for accessing main process modules. */ remote: ElectronRemote; /** Electron shell instance for managing files and URLs. */ shell: ElectronShell; /** Electron `webFrame` module for controlling the current renderer frame. */ webFrame: ElectronWebFrame; } /** * Mouse input event passed to {@link ElectronWebContents.sendInputEvent} to inject a trusted pointer * event. * * @public * @unofficial */ export interface ElectronMouseInputEvent extends ElectronInputEvent { /** The button pressed. */ button?: "left" | "middle" | "right"; /** The number of consecutive clicks. */ clickCount?: number; /** The x coordinate of the pointer relative to the screen. */ globalX?: number; /** The y coordinate of the pointer relative to the screen. */ globalY?: number; /** The x movement delta since the previous mouse event. */ movementX?: number; /** The y movement delta since the previous mouse event. */ movementY?: number; /** The type of the mouse event. */ type: "contextMenu" | "mouseDown" | "mouseEnter" | "mouseLeave" | "mouseMove" | "mouseUp" | "mouseWheel"; /** The x coordinate (web-contents DIP) of the pointer. */ x: number; /** The y coordinate (web-contents DIP) of the pointer. */ y: number; } /** * Mouse wheel input event passed to {@link ElectronWebContents.sendInputEvent} to inject a trusted * scroll. * * @public * @unofficial */ export interface ElectronMouseWheelInputEvent extends ElectronMouseInputEvent { /** The acceleration ratio along the x axis. */ accelerationRatioX?: number; /** The acceleration ratio along the y axis. */ accelerationRatioY?: number; /** Whether the wheel event can trigger scrolling. */ canScroll?: boolean; /** The scroll delta along the x axis. */ deltaX?: number; /** The scroll delta along the y axis. */ deltaY?: number; /** Whether the event carries precise scrolling deltas. */ hasPreciseScrollingDeltas?: boolean; /** The type of the mouse wheel event. */ type: "mouseWheel"; /** The number of wheel ticks along the x axis. */ wheelTicksX?: number; /** The number of wheel ticks along the y axis. */ wheelTicksY?: number; } /** * Options for moving the application into the Applications folder. * * @public * @unofficial */ export interface ElectronMoveToApplicationsFolderOptions { /** * A handler for potential conflict in move failure. * * @param conflictType - The type of conflict encountered. * @returns Whether the move should proceed with the default behavior. */ conflictHandler?(conflictType: "exists" | "existsAndRunning"): boolean; } /** * Electron NativeImage for handling tray, dock, and application images. * * @public * @unofficial */ export interface ElectronNativeImage { /** * A `boolean` property that determines whether the image is considered a template image. Only has an effect on macOS. */ isMacTemplateImage: boolean; /** * Adds an image representation for a specific scale factor. This can be used to explicitly add different scale factor representations to an image. This can be called on empty images. * * @param options - The image representation to add, including `scaleFactor` and either a `buffer` or `dataURL`. */ addRepresentation(options: ElectronAddRepresentationOptions): void; /** * Returns a cropped copy of the image. * * @param rect - The area of the image to crop. * @returns The cropped image. */ crop(rect: ElectronRectangle): ElectronNativeImage; /** * Returns the image's aspect ratio. If `scaleFactor` is passed, this returns the aspect ratio corresponding to the image representation most closely matching the passed value. * * @param scaleFactor - The scale factor to get the aspect ratio for. * @returns The image's aspect ratio. */ getAspectRatio(scaleFactor?: number): number; /** * Returns a buffer that contains the image's raw bitmap pixel data. The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does not copy the bitmap data, so the returned buffer must be used immediately in the current event loop tick; otherwise the data might be changed or destroyed. * * @param options - Options for the bitmap conversion including `scaleFactor`. * @returns The image's raw bitmap pixel data. */ getBitmap(options?: ElectronNativeImageScaleFactorOptions): Buffer; /** * Returns a buffer that stores the C pointer to the underlying native handle of the image. On macOS, a pointer to an `NSImage` instance is returned. The returned pointer is a weak pointer to the underlying native image, so the associated `nativeImage` instance must be kept around. Only available on macOS. * * @returns The native handle of the image. */ getNativeHandle(): Buffer; /** * Returns an array of all scale factors corresponding to representations for a given native image. */ getScaleFactors(): number[]; /** * Returns the size of the image. If `scaleFactor` is passed, this returns the size corresponding to the image representation most closely matching the passed value. * * @param scaleFactor - The scale factor to get the size for. * @returns The width and height of the image. */ getSize(scaleFactor?: number): ElectronNativeImageSize; /** * Returns whether the image is empty. * * @returns Whether the image is empty. */ isEmpty(): boolean; /** * Returns whether the image is a template image. * * @returns Whether the image is a template image. */ isTemplateImage(): boolean; /** * Returns a resized copy of the image. If only the `height` or the `width` is specified then the current aspect ratio is preserved in the resized image. * * @param options - Options for the resize including `width`, `height`, and `quality`. * @returns The resized image. */ resize(options: ElectronResizeOptions): ElectronNativeImage; /** * Marks the image as a template image. * * @param option - Whether the image should be marked as a template image. */ setTemplateImage(option: boolean): void; /** * Returns a buffer that contains a copy of the image's raw bitmap pixel data. * * @param options - Options for the bitmap conversion including `scaleFactor`. * @returns The bitmap buffer. */ toBitmap(options?: ElectronNativeImageScaleFactorOptions): Buffer; /** * Returns the data URL of the image. * * @param options - Options for the conversion including `scaleFactor`. * @returns The data URL string. */ toDataURL(options?: ElectronNativeImageScaleFactorOptions): string; /** * Returns a buffer that contains the image's `JPEG` encoded data. * * @param quality - The JPEG quality between `0` and `100`. * @returns The JPEG buffer. */ toJPEG(quality: number): Buffer; /** * Returns a buffer that contains the image's `PNG` encoded data. * * @param options - Options for the PNG conversion including `scaleFactor`. * @returns The PNG buffer. */ toPNG(options?: ElectronNativeImageScaleFactorOptions): Buffer; } /** * Electron nativeImage module for creating tray, dock, and application images from various sources. * * @public * @unofficial */ export interface ElectronNativeImageModule { /** * Creates an empty `NativeImage` instance. * * @returns An empty image. */ createEmpty(): ElectronNativeImage; /** * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap pixel data returned by `toBitmap()`. The specific format is platform-dependent. * * @param buffer - The raw bitmap pixel data. * @param options - Options describing the bitmap dimensions and scale factor. * @returns The created image. */ createFromBitmap(buffer: Buffer, options: ElectronCreateFromBitmapOptions): ElectronNativeImage; /** * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or JPEG first. * * @param buffer - The image data to decode. * @param options - Options describing the image dimensions and scale factor. * @returns The created image. */ createFromBuffer(buffer: Buffer, options?: ElectronCreateFromBufferOptions): ElectronNativeImage; /** * Creates a new `NativeImage` instance from `dataURL`. * * @param dataURL - The data URL to create the image from. * @returns The created image. */ createFromDataURL(dataURL: string): ElectronNativeImage; /** * Creates a new `NativeImage` instance from the `NSImage` that maps to the given image name. Only available on macOS. * * @param imageName - The name of the system image. * @param hslShift - An HSL shift applied to the image, as `[hue, saturation, lightness]`. * @returns The created image. */ createFromNamedImage(imageName: string, hslShift?: number[]): ElectronNativeImage; /** * Creates a new `NativeImage` instance from a file located at `path`. This method returns an empty image if the `path` does not exist, cannot be read, or is not a valid image. * * @param path - The path to the image file. * @returns The created image. */ createFromPath(path: string): ElectronNativeImage; /** * Creates a thumbnail preview image for the file at `path`. Only available on macOS and Windows. * * @param path - The path to the file to create a thumbnail for. * @param maxSize - The maximum size of the thumbnail. * @returns A promise that fulfills with the file's thumbnail preview image. */ createThumbnailFromPath(path: string, maxSize: ElectronSize): Promise<ElectronNativeImage>; } /** * Options for NativeImage scale factor operations. * * @public * @unofficial */ export interface ElectronNativeImageScaleFactorOptions { /** The scale factor. */ scaleFactor?: number; } /** * The size of a NativeImage. * * @public * @unofficial */ export interface ElectronNativeImageSize { /** The height of the image. */ height: number; /** The width of the image. */ width: number; } /** * Electron NativeTheme for reading and updating the system's theme preferences. * * @public * @unofficial */ export interface ElectronNativeTheme { /** * A `boolean` indicating whether Chromium is in forced colors mode, controlled by system accessibility settings. * Currently, Windows high contrast is the only system setting that triggers forced colors mode. * * Platform: `win32`. */ readonly inForcedColorsMode: boolean; /** * A `boolean` for if the OS / Chromium currently has a dark mode enabled or is being instructed to show a * dark-style UI. If you want to modify this value you should use `themeSource` below. */ readonly shouldUseDarkColors: boolean; /** * A `boolean` for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a * high-contrast UI. * * Platform: `darwin,win32`. */ readonly shouldUseHighContrastColors: boolean; /** * A `boolean` for if the OS / Chromium currently has an inverted color scheme or is being instructed to use an * inverted color scheme. * * Platform: `darwin,win32`. */ readonly shouldUseInvertedColorScheme: boolean; /** * A `string` property that can be `system`, `light` or `dark`. It is used to override and supersede the value that * Chromium has chosen to use internally. Setting this property to `system` will remove the override and everything * will be reset to the OS default. */ themeSource: "dark" | "light" | "system"; /** * Adds a listener for the `updated` event. * * Emitted when something in the underlying `NativeTheme` has changed. This normally means that either the value of * `shouldUseDarkColors`, `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You will have * to check them to determine which one has changed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronNativeTheme` instance. */ addListener(event: "updated", listener: () => void): this; /** * Registers a listener for the `updated` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronNativeTheme` instance. */ on(event: "updated", listener: () => void): this; /** * Registers a one-time listener for the `updated` event. The listener is removed after it is invoked once. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronNativeTheme` instance. */ once(event: "updated", listener: () => void): this; /** * Removes the specified listener for the `updated` event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This `ElectronNativeTheme` instance. */ removeListener(event: "updated", listener: () => void): this; } /** * Issues HTTP/HTTPS requests using Chromium's native networking library. * * @public * @unofficial */ export interface ElectronNet { /** * A `boolean` property. Whether there is currently internet connection. * * A return value of `false` is a pretty strong indicator that the user won't be able to connect to remote sites. * However, a return value of `true` is inconclusive; even if some link is up, it is uncertain whether a particular * connection attempt to a particular remote site will be successful. */ readonly online: boolean; /** * Whether there is currently internet connection. * * A return value of `false` is a pretty strong indicator that the user won't be able to connect to remote sites. * However, a return value of `true` is inconclusive; even if some link is up, it is uncertain whether a particular * connection attempt to a particular remote site will be successful. * * @returns Whether there is currently internet connection. */ isOnline(): boolean; /** * Creates a `ClientRequest` instance using the provided `options` which are directly forwarded to the * `ClientRequest` constructor. The `net.request` method would be used to issue both secure and insecure HTTP * requests according to the specified protocol scheme in the `options` object. * * @param options - The request options, or the request URL as a string. * @returns The created request. */ request(options: ElectronClientRequestConstructorOptions | string): ElectronClientRequest; } /** * Records network events for a session to a file for later analysis. * * @public * @unofficial */ export interface ElectronNetLog { /** Whether network logs are currently being recorded. */ readonly currentlyLogging: boolean; /** * Starts recording network events to `path`. * * @param path - The file path to write the log to. * @param options - Options controlling how events are captured. * @returns A promise that resolves when the net log has begun recording. */ startLogging(path: string, options?: ElectronStartLoggingOptions): Promise<void>; /** * Stops recording network events. If not called, net logging will automatically end when the app quits. * * @returns A promise that resolves when the net log has been flushed to disk. */ stopLogging(): Promise<void>; } /** * The event emitted for the deprecated `new-window` event. * * @public * @unofficial */ export interface ElectronNewWindowWebContentsEvent extends ElectronEvent { /** The new window instance that must be set when the default window creation is prevented. */ newGuest?: ElectronBrowserWindow; } /** * An action button shown on a native notification. * * @public * @unofficial */ export interface ElectronNotificationAction { /** The label for the given action. */ text?: string; /** The type of action, can be `button`. */ type: "button"; } /** * Options for constructing an {@link ElectronNotification}. * * @public * @unofficial */ export interface ElectronNotificationConstructorOptions { /** Actions to add to the notification. Please read the available actions and limitations in the {@link ElectronNotificationAction} documentation. `darwin` only. */ actions?: ElectronNotificationAction[]; /** The body text of the notification, which will be displayed below the title or subtitle. */ body?: string; /** A custom title for the close button of an alert. An empty string will cause the default localized text to be used. `darwin` only. */ closeButtonText?: string; /** Whether or not to add an inline reply option to the notification. `darwin` only. */ hasReply?: boolean; /** An icon to use in the notification. */ icon?: ElectronNativeImage | string; /** The placeholder to write in the inline reply input field. `darwin` only. */ replyPlaceholder?: string; /** Whether or not to emit an OS notification noise when showing the notification. */ silent?: boolean; /** The name of the sound file to play when the notification is shown. `darwin` only. */ sound?: string; /** A subtitle for the notification, which will be displayed below the title. `darwin` only. */ subtitle?: string; /** The timeout duration of the notification. Can be `default` or `never`. `linux` and `win32` only. */ timeoutType?: "default" | "never"; /** A title for the notification, which will be shown at the top of the notification window when it is shown. */ title?: string; /** A custom description of the notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification. `win32` only. */ toastXml?: string; /** The urgency level of the notification. Can be `normal`, `critical`, or `low`. `linux` only. */ urgency?: "critical" | "low" | "normal"; } /** * User's response to a native notification. * * @public * @unofficial */ export interface ElectronNotificationResponse { /** The identifier string of the action that the user selected. */ actionIdentifier: string; /** The delivery date of the notification. */ date: number; /** The unique identifier for this notification request. */ identifier: string; /** A dictionary of custom information associated with the notification. */ userInfo: Record<string, unknown>; /** The text entered or chosen by the user. */ userText?: string; } /** * Details passed to an `onBeforeRedirect` web-request listener. * * @public * @unofficial */ export interface ElectronOnBeforeRedirectListenerDetails { /** The frame that initiated the request. */ frame?: ElectronWebFrameMain; /** Whether the response was fetched from cache. */ fromCache: boolean; /** The request id. */ id: number; /** The server IP address that the request was actually sent to. */ ip?: string; /** The HTTP request method. */ method: string; /** The URL the request is redirected to. */ redirectURL: string; /** The referrer URL. */ referrer: string; /** The resource type of the request. */ resourceType: "cspReport" | "font" | "image" | "mainFrame" | "media" | "object" | "other" | "ping" | "script" | "stylesheet" | "subFrame" | "webSocket" | "xhr"; /** The response headers. */ responseHeaders?: Record<string, string[]>; /** The HTTP status code. */ statusCode: number; /** The HTTP status line. */ statusLine: string; /** The time the event occurred, in milliseconds since the epoch. */ timestamp: number; /** The request URL. */ url: string; /** The web contents that initiated the request. */ webContents?: ElectronWebContents; /** The id of the web contents that initiated the request. */ webContentsId?: number; } /** * Details passed to an `onBeforeRequest` web-request listener. * * @public * @unofficial */ export interface ElectronOnBeforeRequestListenerDetails { /** The frame that initiated the request. */ frame?: ElectronWebFrameMain; /** The request id. */ id: number; /** The HTTP request method. */ method: string; /** The referrer URL. */ referrer: string; /** The resource type of the request. */ resourceType: "cspReport" | "font" | "image" | "mainFrame" | "media" | "object" | "other" | "ping" | "script" | "stylesheet" | "subFrame" | "webSocket" | "xhr"; /** The time the event occurred, in milliseconds since the epoch. */ timestamp: number; /** The upload data for the request. */ uploadData: ElectronUploadData[]; /** The request URL. */ url: string; /** The web contents that initiated the request. */ webContents?: ElectronWebContents; /** The id of the web contents that initiated the request. */ webContentsId?: number; } /** * Details passed to an `onBeforeSendHeaders` web-request listener. * * @public * @unofficial */ export interface ElectronOnBeforeSendHeadersListenerDetails { /** The frame that initiated the request. */ frame?: ElectronWebFrameMain; /** The request id. */ id: number; /** The HTTP request method. */ method: string; /** The referrer URL. */ referrer: string; /** The request headers. */ requestHeaders: Record<string, string>; /** The resource type of the request. */ resourceType: "cspReport" | "font" | "image" | "mainFrame" | "media" | "object" | "other" | "ping" | "script" | "stylesheet" | "subFrame" | "webSocket" | "xhr"; /** The time the event occurred, in milliseconds since the epoch. */ timestamp: number; /** The upload data for the request. */ uploadData?: ElectronUploadData[]; /** The request URL. */ url: string; /** The web contents that initiated the request. */ webContents?: ElectronWebContents; /** The id of the web contents that initiated the request. */ webContentsId?: number; } /** * Details passed to an `onCompleted` web-request listener. * * @public * @unofficial */ export interface ElectronOnCompletedListenerDetails { /** The error description, if any. */ error: string; /** The frame that initiated the request. */ frame?: ElectronWebFrameMain; /** Whether the response was fetched from cache. */ fromCache: boolean; /** The request id. */ id: number; /** The HTTP request method. */ method: string; /** The referrer URL. */ referrer: string; /** The resource type of the request. */ resourceType: "cspReport" | "font" | "image" | "mainFrame" | "media" | "object" | "other" | "ping" | "script" | "stylesheet" | "subFrame" | "webSocket" | "xhr"; /** The response headers. */ responseHeaders?: Record<string, string[]>; /** The HTTP status code. */ statusCode: number; /** The HTTP status line. */ statusLine: string; /** The time the event occurred, in milliseconds since the epoch. */ timestamp: number; /** The request URL. */ url: string; /** The web contents that initiated the request. */ webContents?: ElectronWebContents; /** The id of the web contents that initiated the request. */ webContentsId?: number; } /** * Details passed to an `onErrorOccurred` web-request listener. * * @public * @unofficial */ export interface ElectronOnErrorOccurredListenerDetails { /** The error description. */ error: string; /** The frame that initiated the request. */ frame?: ElectronWebFrameMain; /** Whether the response was fetched from cache. */ fromCache: boolean; /** The request id. */ id: number; /** The HTTP request method. */ method: string; /** The referrer URL. */ referrer: string; /** The resource type of the request. */ resourceType: "cspReport" | "font" | "image" | "mainFrame" | "media" | "object" | "other" | "ping" | "script" | "stylesheet" | "subFrame" | "webSocket" | "xhr"; /** The time the event occurred, in milliseconds since the epoch. */ timestamp: number; /** The request URL. */ url: string; /** The web contents that initiated the request. */ webContents?: ElectronWebContents; /** The id of the web contents that initiated the request. */ webContentsId?: number; } /** * Details passed to an `onHeadersReceived` web-request listener. * * @public * @unofficial */ export interface ElectronOnHeadersReceivedListenerDetails { /** The frame that initiated the request. */ frame?: ElectronWebFrameMain; /** The request id. */ id: number; /** The HTTP request method. */ method: string; /** The referrer URL. */ referrer: string; /** The resource type of the request. */ resourceType: "cspReport" | "font" | "image" | "mainFrame" | "media" | "object" | "other" | "ping" | "script" | "stylesheet" | "subFrame" | "webSocket" | "xhr"; /** The response headers. */ responseHeaders?: Record<string, string[]>; /** The HTTP status code. */ statusCode: number; /** The HTTP status line. */ statusLine: string; /** The time the event occurred, in milliseconds since the epoch. */ timestamp: number; /** The request URL. */ url: string; /** The web contents that initiated the request. */ webContents?: ElectronWebContents; /** The id of the web contents that initiated the request. */ webContentsId?: number; } /** * Details passed to an `onResponseStarted` web-request listener. * * @public * @unofficial */ export interface ElectronOnResponseStartedListenerDetails { /** The frame that initiated the request. */ frame?: ElectronWebFrameMain; /** Whether the response was fetched from disk cache. */ fromCache: boolean; /** The request id. */ id: number; /** The HTTP request method. */ method: string; /** The referrer URL. */ referrer: string; /** The resource type of the request. */ resourceType: "cspReport" | "font" | "image" | "mainFrame" | "media" | "object" | "other" | "ping" | "script" | "stylesheet" | "subFrame" | "webSocket" | "xhr"; /** The response headers. */ responseHeaders?: Record<string, string[]>; /** The HTTP status code. */ statusCode: number; /** The HTTP status line. */ statusLine: string; /** The time the event occurred, in milliseconds since the epoch. */ timestamp: number; /** The request URL. */ url: string; /** The web contents that initiated the request. */ webContents?: ElectronWebContents; /** The id of the web contents that initiated the request. */ webContentsId?: number; } /** * Details passed to an `onSendHeaders` web-request listener. * * @public * @unofficial */ export interface ElectronOnSendHeadersListenerDetails { /** The frame that initiated the request. */ frame?: ElectronWebFrameMain; /** The request id. */ id: number; /** The HTTP request method. */ method: string; /** The referrer URL. */ referrer: string; /** The request headers. */ requestHeaders: Record<string, string>; /** The resource type of the request. */ resourceType: "cspReport" | "font" | "image" | "mainFrame" | "media" | "object" | "other" | "ping" | "script" | "stylesheet" | "subFrame" | "webSocket" | "xhr"; /** The time the event occurred, in milliseconds since the epoch. */ timestamp: number; /** The request URL. */ url: string; /** The web contents that initiated the request. */ webContents?: ElectronWebContents; /** The id of the web contents that initiated the request. */ webContentsId?: number; } /** * Options for Electron open file dialog. * * @public * @unofficial */ export interface ElectronOpenDialogOptions { /** The label for the confirmation button. */ buttonLabel?: string; /** The default path to open the dialog at. */ defaultPath?: string; /** The file filters to display. */ filters?: ElectronFileFilter[]; /** The message to display above the dialog on macOS. */ message?: string; /** The dialog behavior properties. */ properties?: Array<"createDirectory" | "dontAddToRecent" | "multiSelections" | "noResolveAliases" | "openDirectory" | "openFile" | "promptToCreate" | "showHiddenFiles" | "treatPackageAsDirectory">; /** Whether to create security scoped bookmarks when packaged for the Mac App Store (macOS, mas only). */ securityScopedBookmarks?: boolean; /** The dialog title. */ title?: string; } /** * Return value from an Electron open file dialog. * * @public * @unofficial */ export interface ElectronOpenDialogReturnValue { /** An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data (macOS, mas only). */ bookmarks?: string[]; /** Whether the dialog was canceled. */ canceled: boolean; /** The file paths chosen by the user. */ filePaths: string[]; } /** * Options for Electron synchronous open file dialog. * * @public * @unofficial */ export interface ElectronOpenDialogSyncOptions { /** The label for the confirmation button. */ buttonLabel?: string; /** The default path to open the dialog at. */ defaultPath?: string; /** The file filters to display. */ filters?: ElectronFileFilter[]; /** The message to display above the dialog on macOS. */ message?: string; /** The dialog behavior properties. */ properties?: Array<"createDirectory" | "dontAddToRecent" | "multiSelections" | "noResolveAliases" | "openDirectory" | "openFile" | "promptToCreate" | "showHiddenFiles" | "treatPackageAsDirectory">; /** Whether to create security scoped bookmarks when packaged for the Mac App Store (macOS, mas only). */ securityScopedBookmarks?: boolean; /** The dialog title. */ title?: string; } /** * A range of pages to print. * * @public * @unofficial */ export interface ElectronPageRanges { /** Index of the first page to print (`0`-based). */ from: number; /** Index of the last page to print (inclusive) (`0`-based). */ to: number; } /** * Parameters for device emulation. * * @public * @unofficial */ export interface ElectronParameters { /** * The device scale factor. If zero, defaults to the original device scale factor. * * @default `0` */ deviceScaleFactor: number; /** * Scale of the emulated view inside the available space (not in fit-to-view mode). * * @default `1` */ scale: number; /** The screen type to emulate. */ screenPosition: "desktop" | "mobile"; /** The emulated screen size, used when `screenPosition` is `mobile`. */ screenSize: ElectronSize; /** The position of the view on the screen, used when `screenPosition` is `mobile`. */ viewPosition: ElectronPoint; /** The emulated view size. An empty value means no override. */ viewSize: ElectronSize; } /** * A payment in the Mac App Store payment queue. * * @public * @unofficial */ export interface ElectronPayment { /** An opaque identifier for the user's account on your system. */ applicationUsername: string; /** The details of the discount offer to apply to the payment. */ paymentDiscount?: ElectronPaymentDiscount; /** The identifier of the purchased product. */ productIdentifier: string; /** The quantity purchased. */ quantity: number; } /** * Details of a discount offer to apply to a payment. * * @public * @unofficial */ export interface ElectronPaymentDiscount { /** A string used to uniquely identify a discount offer for a product. */ identifier: string; /** A string that identifies the key used to generate the signature. */ keyIdentifier: string; /** A universally unique ID (UUID) value that you define. */ nonce: string; /** A UTF-8 string representing the properties of a specific discount offer, cryptographically signed. */ signature: string; /** The date and time of the signature's creation in milliseconds, formatted in Unix epoch time. */ timestamp: number; } /** * Details passed to a permission check handler. * * @public * @unofficial */ export interface ElectronPermissionCheckHandlerHandlerDetails { /** The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames. */ embeddingOrigin?: string; /** Whether the frame making the request is the main frame. */ isMainFrame: boolean; /** The type of media access being requested. */ mediaType?: "audio" | "unknown" | "video"; /** The last URL the requesting frame loaded. Not provided for cross-origin sub frames. */ requestingUrl?: string; /** The security origin of the `media` check. */ securityOrigin?: string; } /** * Details passed to a permission request handler. * * @public * @unofficial */ export interface ElectronPermissionRequestHandlerHandlerDetails { /** The URL of the `openExternal` request. */ externalURL?: string; /** Whether the frame making the request is the main frame. */ isMainFrame: boolean; /** The types of media access being requested. */ mediaTypes?: Array<"audio" | "video">; /** The last URL the requesting frame loaded. */ requestingUrl: string; /** The security origin of the `media` request. */ securityOrigin?: string; } /** * Represents a point with x and y coordinates. * * @public * @unofficial */ export interface ElectronPoint { /** The x coordinate of the point. */ x: number; /** The y coordinate of the point. */ y: number; } /** * The post data sent to a new window. * * @public * @unofficial */ export interface ElectronPostBody { /** * The boundary used to separate multiple parts of the message. Only valid when `contentType` is `multipart/form-data`. */ boundary?: string; /** * The `content-type` header used for the data. One of `application/x-www-form-urlencoded` or `multipart/form-data`. */ contentType: string; /** The post data to be sent to the new window. */ data: (ElectronUploadFile | ElectronUploadRawData)[]; } /** * Electron `powerMonitor` module for monitoring power state changes. * * @public * @unofficial */ export interface ElectronPowerMonitor extends NodeJS.EventEmitter { /** * `true` if the system is on battery power. * * @see `isOnBatteryPower`. */ onBatteryPower: boolean; /** * Emitted when the system is about to lock the screen. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ addListener(event: "lock-screen", listener: () => void): this; /** * Emitted when the system changes to AC power. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ addListener(event: "on-ac", listener: () => void): this; /** * Emitted when the system changes to battery power. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ addListener(event: "on-battery", listener: () => void): this; /** * Emitted when the system is resuming. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. */ addListener(event: "resume", listener: () => void): this; /** * Emitted when the system is about to reboot or shut down. If the event handler invokes * `event.preventDefault()`, Electron will attempt to delay system shutdown in order for the app to * exit cleanly. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `linux,darwin`. */ addListener(event: "shutdown", listener: (event: ElectronEvent) => void): this; /** * Emitted when the system is suspending. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. */ addListener(event: "suspend", listener: () => void): this; /** * Emitted as soon as the system's screen is unlocked. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ addListener(event: "unlock-screen", listener: () => void): this; /** * Emitted when a login session is activated. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ addListener(event: "user-did-become-active", listener: () => void): this; /** * Emitted when a login session is deactivated. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ addListener(event: "user-did-resign-active", listener: () => void): this; /** * Calculate the system idle state. `idleThreshold` is the amount of time (in seconds) before * considered idle. `locked` is available on supported systems only. * * @param idleThreshold - The amount of time (in seconds) before the system is considered idle. * @returns The system's current state. */ getSystemIdleState(idleThreshold: number): "active" | "idle" | "locked" | "unknown"; /** * Calculate system idle time in seconds. * * @returns Idle time in seconds. */ getSystemIdleTime(): number; /** * Whether the system is on battery power. * * To monitor for changes in this property, use the `on-battery` and `on-ac` events. * * @returns `true` if the system is on battery power. */ isOnBatteryPower(): boolean; /** * Emitted when the system is about to lock the screen. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ on(event: "lock-screen", listener: () => void): this; /** * Emitted when the system changes to AC power. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ on(event: "on-ac", listener: () => void): this; /** * Emitted when the system changes to battery power. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ on(event: "on-battery", listener: () => void): this; /** * Emitted when the system is resuming. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. */ on(event: "resume", listener: () => void): this; /** * Emitted when the system is about to reboot or shut down. If the event handler invokes * `event.preventDefault()`, Electron will attempt to delay system shutdown in order for the app to * exit cleanly. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `linux,darwin`. */ on(event: "shutdown", listener: (event: ElectronEvent) => void): this; /** * Emitted when the system is suspending. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. */ on(event: "suspend", listener: () => void): this; /** * Emitted as soon as the system's screen is unlocked. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ on(event: "unlock-screen", listener: () => void): this; /** * Emitted when a login session is activated. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ on(event: "user-did-become-active", listener: () => void): this; /** * Emitted when a login session is deactivated. * * @param event - The event name. * @param listener - Callback invoked when the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ on(event: "user-did-resign-active", listener: () => void): this; /** * Adds a one-time listener for the `lock-screen` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ once(event: "lock-screen", listener: () => void): this; /** * Adds a one-time listener for the `on-ac` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ once(event: "on-ac", listener: () => void): this; /** * Adds a one-time listener for the `on-battery` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ once(event: "on-battery", listener: () => void): this; /** * Adds a one-time listener for the `resume` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. */ once(event: "resume", listener: () => void): this; /** * Adds a one-time listener for the `shutdown` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `linux,darwin`. */ once(event: "shutdown", listener: (event: ElectronEvent) => void): this; /** * Adds a one-time listener for the `suspend` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. */ once(event: "suspend", listener: () => void): this; /** * Adds a one-time listener for the `unlock-screen` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ once(event: "unlock-screen", listener: () => void): this; /** * Adds a one-time listener for the `user-did-become-active` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ once(event: "user-did-become-active", listener: () => void): this; /** * Adds a one-time listener for the `user-did-resign-active` event. * * @param event - The event name. * @param listener - Callback invoked the next time the event is emitted. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ once(event: "user-did-resign-active", listener: () => void): this; /** * Removes the specified `listener` from the `lock-screen` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ removeListener(event: "lock-screen", listener: () => void): this; /** * Removes the specified `listener` from the `on-ac` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ removeListener(event: "on-ac", listener: () => void): this; /** * Removes the specified `listener` from the `on-battery` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ removeListener(event: "on-battery", listener: () => void): this; /** * Removes the specified `listener` from the `resume` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. */ removeListener(event: "resume", listener: () => void): this; /** * Removes the specified `listener` from the `shutdown` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. * Platform: `linux,darwin`. */ removeListener(event: "shutdown", listener: (event: ElectronEvent) => void): this; /** * Removes the specified `listener` from the `suspend` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. */ removeListener(event: "suspend", listener: () => void): this; /** * Removes the specified `listener` from the `unlock-screen` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. * Platform: `darwin,win32`. */ removeListener(event: "unlock-screen", listener: () => void): this; /** * Removes the specified `listener` from the `user-did-become-active` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ removeListener(event: "user-did-become-active", listener: () => void): this; /** * Removes the specified `listener` from the `user-did-resign-active` event. * * @param event - The event name. * @param listener - The listener to remove. * @returns This `PowerMonitor` instance. * Platform: `darwin`. */ removeListener(event: "user-did-resign-active", listener: () => void): this; } /** * Electron `powerSaveBlocker` module for blocking the system from entering low-power (sleep) mode. * * @public * @unofficial */ export interface ElectronPowerSaveBlocker { /** * Whether the corresponding `powerSaveBlocker` has started. * * @param id - The power save blocker id returned by `start`. * @returns `true` if the power save blocker with the given `id` is currently active. */ isStarted(id: number): boolean; /** * Starts preventing the system from entering lower-power mode. Returns an integer identifying the * power save blocker. * * `prevent-display-sleep` has higher precedence over `prevent-app-suspension`. Only the highest * precedence type takes effect. In other words, `prevent-display-sleep` always takes precedence * over `prevent-app-suspension`. * * @param type - The kind of power save blocker to start. * @returns The blocker id assigned to this power save blocker. */ start(type: "prevent-app-suspension" | "prevent-display-sleep"): number; /** * Stops the specified power save blocker. * * @param id - The power save blocker id returned by `start`. */ stop(id: number): void; } /** * Options controlling how sockets are preconnected to an origin. * * @public * @unofficial */ export interface ElectronPreconnectOptions { /** Number of sockets to preconnect. Must be between 1 and 6. */ numSockets?: number; /** URL for preconnect. Only the origin is relevant for opening the socket. */ url: string; } /** * Options for printing a web page to PDF. * * @public * @unofficial */ export interface ElectronPrintToPDFOptions { /** The header and footer for the PDF. */ headerFooter?: Record<string, string>; /** `true` for landscape, `false` for portrait. */ landscape?: boolean; /** * Specifies the type of margins to use. Uses `0` for default margin, `1` for no margin, and `2` for minimum margin. */ marginsType?: number; /** The page range to print. On macOS, only the first range is honored. */ pageRanges?: Record<string, number>; /** * The page size of the generated PDF. Can be `A3`, `A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an object containing `height` and `width`. */ pageSize?: ElectronSize | string; /** Whether to print CSS backgrounds. */ printBackground?: boolean; /** Whether to print the selection only. */ printSelectionOnly?: boolean; /** The scale factor of the web page. Can range from `0` to `100`. */ scaleFactor?: number; } /** * Information about a system printer. * * @public * @unofficial */ export interface ElectronPrinterInfo { /** A longer description of the printer's type. */ description: string; /** The name of the printer as shown in Print Preview. */ displayName: string; /** Whether the printer is set as the default printer on the OS. */ isDefault: boolean; /** The name of the printer as understood by the OS. */ name: string; /** An object containing a variable number of platform-specific printer information. */ options: ElectronPrinterInfoOptions; /** The current status of the printer. */ status: number; } /** * An object containing a variable number of platform-specific printer information entries. * * @public * @unofficial */ export interface ElectronPrinterInfoOptions { /** Platform-specific printer information keyed by option name. */ [key: string]: string; } /** * Privileges granted to a custom scheme registered with a protocol. * * @public * @unofficial */ export interface ElectronPrivileges { /** Whether to allow registering ServiceWorkers for this scheme. */ allowServiceWorkers?: boolean; /** Whether to bypass the Content Security Policy for resources served by this scheme. */ bypassCSP?: boolean; /** Whether to enable CORS for this scheme. */ corsEnabled?: boolean; /** Whether to treat the scheme as secure. */ secure?: boolean; /** Whether to treat the scheme as a standard scheme (generic URI syntax). */ standard?: boolean; /** Whether the scheme should be treated as streaming for `<video>` and `<audio>` elements. */ stream?: boolean; /** Whether to support the fetch API for this scheme. */ supportFetchAPI?: boolean; } /** * Memory and CPU usage statistics for a process associated with the app. * * @public * @unofficial */ export interface ElectronProcessMetric { /** CPU usage of the process. */ cpu: ElectronCPUUsage; /** Creation time for this process, represented as number of milliseconds since epoch. */ creationTime: number; /** The security integrity level of the process. Windows only. */ integrityLevel?: "high" | "low" | "medium" | "unknown" | "untrusted"; /** Memory information for the process. */ memory: ElectronMemoryInfo; /** The name of the process. */ name?: string; /** Process id of the process. */ pid: number; /** Whether the process is sandboxed on OS level. macOS and Windows only. */ sandboxed?: boolean; /** The non-localized name of the process. */ serviceName?: string; /** Process type. */ type: "Browser" | "GPU" | "Pepper Plugin" | "Pepper Plugin Broker" | "Sandbox helper" | "Tab" | "Unknown" | "Utility" | "Zygote"; } /** * A product available for purchase from the Mac App Store. * * @public * @unofficial */ export interface ElectronProduct { /** The total size of the content, in bytes. */ contentLengths: number[]; /** A string that identifies the version of the content. */ contentVersion: string; /** 3 character code presenting a product's currency based on the ISO 4217 standard. */ currencyCode: string; /** An array of discount offers. */ discounts: ElectronProductDiscount[]; /** The total size of the content, in bytes. */ downloadContentLengths: number[]; /** A string that identifies the version of the content. */ downloadContentVersion: string; /** The locale formatted price of the product. */ formattedPrice: string; /** The object containing introductory price information for the product, available for the product. */ introductoryPrice?: ElectronProductDiscount; /** * A boolean value that indicates whether the App Store has downloadable content for this product. `true` if at least * one file has been associated with the product. */ isDownloadable: boolean; /** A description of the product. */ localizedDescription: string; /** The name of the product. */ localizedTitle: string; /** The cost of the product in the local currency. */ price: number; /** The string that identifies the product to the Apple App Store. */ productIdentifier: string; /** The identifier of the subscription group to which the subscription belongs. */ subscriptionGroupIdentifier: string; /** The period details for products that are subscriptions. */ subscriptionPeriod?: ElectronProductSubscriptionPeriod; } /** * A discount offer for a product in the Mac App Store. * * @public * @unofficial */ export interface ElectronProductDiscount { /** A string used to uniquely identify a discount offer for a product. */ identifier: string; /** An integer that indicates the number of periods the product discount is available. */ numberOfPeriods: number; /** The payment mode for this product discount. Can be `freeTrial`, `payAsYouGo` or `payUpFront`. */ paymentMode: "freeTrial" | "payAsYouGo" | "payUpFront"; /** The discount price of the product in the local currency. */ price: number; /** The locale used to format the discount price of the product. */ priceLocale: string; /** An object that defines the period for the product discount. */ subscriptionPeriod?: ElectronProductSubscriptionPeriod; /** The type of discount offer. */ type: number; } /** * The period details for products that are subscriptions. * * @public * @unofficial */ export interface ElectronProductSubscriptionPeriod { /** The number of units per subscription period. */ numberOfUnits: number; /** The increment of time that a subscription period is specified in. Can be `day`, `month`, `week` or `year`. */ unit: "day" | "month" | "week" | "year"; } /** * Options for {@link ElectronBrowserWindow.setProgressBar}. * * @public * @unofficial */ export interface ElectronProgressBarOptions { /** * Mode for the progress bar (Windows only). */ mode: "error" | "indeterminate" | "none" | "normal" | "paused"; } /** * Registers and intercepts custom protocol schemes for a session. * * @public * @unofficial */ export interface ElectronProtocol { /** * Intercepts `scheme` and uses `handler` as the new handler which sends a `Buffer` as a response. * * @param scheme - The scheme to intercept. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully intercepted. */ interceptBufferProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: Buffer | ElectronProtocolResponse) => void) => void): boolean; /** * Intercepts `scheme` and uses `handler` as the new handler which sends a file as a response. * * @param scheme - The scheme to intercept. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully intercepted. */ interceptFileProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: ElectronProtocolResponse | string) => void) => void): boolean; /** * Intercepts `scheme` and uses `handler` as the new handler which sends a new HTTP request as a response. * * @param scheme - The scheme to intercept. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully intercepted. */ interceptHttpProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: ElectronProtocolResponse) => void) => void): boolean; /** * Same as `registerStreamProtocol`, except that it replaces an existing protocol handler. * * @param scheme - The scheme to intercept. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully intercepted. */ interceptStreamProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: ElectronProtocolResponse | NodeJS.ReadableStream) => void) => void): boolean; /** * Intercepts `scheme` and uses `handler` as the new handler which sends a `string` as a response. * * @param scheme - The scheme to intercept. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully intercepted. */ interceptStringProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: ElectronProtocolResponse | string) => void) => void): boolean; /** * Returns whether `scheme` is already intercepted. * * @param scheme - The scheme to check. * @returns Whether the scheme is intercepted. */ isProtocolIntercepted(scheme: string): boolean; /** * Returns whether `scheme` is already registered. * * @param scheme - The scheme to check. * @returns Whether the scheme is registered. */ isProtocolRegistered(scheme: string): boolean; /** * Registers a protocol of `scheme` that will send a `Buffer` as a response. * * @param scheme - The scheme to register. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully registered. */ registerBufferProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: Buffer | ElectronProtocolResponse) => void) => void): boolean; /** * Registers a protocol of `scheme` that will send a file as the response. * * @param scheme - The scheme to register. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully registered. */ registerFileProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: ElectronProtocolResponse | string) => void) => void): boolean; /** * Registers a protocol of `scheme` that will send an HTTP request as a response. * * @param scheme - The scheme to register. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully registered. */ registerHttpProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: ElectronProtocolResponse) => void) => void): boolean; /** * Registers the given schemes as privileged. Can only be called before the `ready` event and only once. * * @param customSchemes - The schemes to register with their privileges. */ registerSchemesAsPrivileged(customSchemes: ElectronCustomScheme[]): void; /** * Registers a protocol of `scheme` that will send a stream as a response. * * @param scheme - The scheme to register. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully registered. */ registerStreamProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: ElectronProtocolResponse | NodeJS.ReadableStream) => void) => void): boolean; /** * Registers a protocol of `scheme` that will send a `string` as a response. * * @param scheme - The scheme to register. * @param handler - Called with the request and a callback to send the response. * @returns Whether the protocol was successfully registered. */ registerStringProtocol(scheme: string, handler: (request: ElectronProtocolRequest, callback: (response: ElectronProtocolResponse | string) => void) => void): boolean; /** * Removes the interceptor installed for `scheme` and restores its original handler. * * @param scheme - The scheme to unintercept. * @returns Whether the protocol was successfully unintercepted. */ uninterceptProtocol(scheme: string): boolean; /** * Unregisters the custom protocol of `scheme`. * * @param scheme - The scheme to unregister. * @returns Whether the protocol was successfully unregistered. */ unregisterProtocol(scheme: string): boolean; } /** * A request passed to a protocol handler. * * @public * @unofficial */ export interface ElectronProtocolRequest { /** The request headers. */ headers: Record<string, string>; /** The HTTP request method. */ method: string; /** The referrer URL. */ referrer: string; /** The upload data for the request. */ uploadData?: ElectronUploadData[]; /** The request URL. */ url: string; } /** * A response returned from a protocol handler callback. * * @public * @unofficial */ export interface ElectronProtocolResponse { /** The charset of the response body. */ charset?: string; /** The response body, as a `Buffer`, `string`, or readable stream depending on the response type. */ data?: Buffer | NodeJS.ReadableStream | string; /** When assigned, the request will fail with this error number. See the net error list. */ error?: number; /** An object containing the response headers. */ headers?: Record<string, string | string[]>; /** The HTTP method. Only used for file and URL responses. */ method?: string; /** The MIME type of the response body. */ mimeType?: string; /** Path to the file which would be sent as the response body. Only used for file responses. */ path?: string; /** The referrer URL. Only used for file and URL responses. */ referrer?: string; /** The session used for requesting the URL. Setting to `null` uses a random independent session. Only used for URL responses. */ session?: Session; /** The HTTP response code. */ statusCode?: number; /** The data used as upload data. Only used for URL responses when `method` is `POST`. */ uploadData?: ElectronProtocolResponseUploadData; /** Download the URL and pipe the result as the response body. Only used for URL responses. */ url?: string; } /** * Upload data used as the body of a protocol response for `POST` requests. * * @public * @unofficial */ export interface ElectronProtocolResponseUploadData { /** MIME type of the content. */ contentType: string; /** Content to be sent. */ data: Buffer | string; } /** * A spell check provider for input fields and text areas. * * @public * @unofficial */ export interface ElectronProvider { /** * Runs spell checking asynchronously on an array of individual words and reports the misspelt ones. * * @param words - The words to spell check. * @param callback - Called with the array of misspelt words when spell checking completes. */ spellCheck(words: string[], callback: (misspeltWords: string[]) => void): void; } /** * Represents a rectangle with position and dimensions. * * @public * @unofficial */ export interface ElectronRectangle { /** The height of the rectangle. */ height: number; /** The width of the rectangle. */ width: number; /** The x coordinate of the origin of the rectangle. */ x: number; /** The y coordinate of the origin of the rectangle. */ y: number; } /** * Represents an HTTP referrer and its policy. * * @public * @unofficial */ export interface ElectronReferrer { /** * The referrer policy. See the Referrer-Policy spec for more details on the meaning of these values. */ policy: "default" | "no-referrer-when-downgrade" | "no-referrer" | "origin" | "same-origin" | "strict-origin-when-cross-origin" | "strict-origin" | "unsafe-url"; /** HTTP Referrer URL. */ url: string; } /** * Details of a completed service worker registration. * * @public * @unofficial */ export interface ElectronRegistrationCompletedDetails { /** The base URL that a service worker is registered for. */ scope: string; } /** * Options for relaunching the application. * * @public * @unofficial */ export interface ElectronRelaunchOptions { /** The command line arguments to pass to the relaunched instance. */ args?: string[]; /** The executable to run for the relaunch instead of the current app. */ execPath?: string; } /** * Electron `@electron/remote` module for accessing main process modules from the renderer. * * @public * @unofficial */ export interface ElectronRemote { /** The main process app instance. */ app: ElectronApp; /** The main process `autoUpdater` module. */ autoUpdater: ElectronAutoUpdater; /** The `BrowserView` constructor. */ BrowserView: typeof ElectronBrowserView; /** The `BrowserWindow` constructor. */ BrowserWindow: typeof ElectronBrowserWindow; /** The main process `clipboard` module. */ clipboard: ElectronClipboard; /** The main process `contentTracing` module. */ contentTracing: ElectronContentTracing; /** The main process `crashReporter` module. */ crashReporter: ElectronCrashReporter; /** The main process `desktopCapturer` module. */ desktopCapturer: ElectronDesktopCapturer; /** The main process `dialog` module. */ dialog: ElectronDialog; /** The main process `globalShortcut` module. */ globalShortcut: ElectronGlobalShortcut; /** The main process `inAppPurchase` module. macOS only. */ inAppPurchase: ElectronInAppPurchase; /** The main process `ipcMain` module. */ ipcMain: ElectronIpcMain; /** The `Menu` constructor. */ Menu: typeof ElectronMenu; /** The `MenuItem` constructor. */ MenuItem: typeof ElectronMenuItem; /** The `MessageChannelMain` constructor. */ MessageChannelMain: typeof ElectronMessageChannelMain; /** The main process `nativeImage` module. */ nativeImage: ElectronNativeImageModule; /** The main process `nativeTheme` module. */ nativeTheme: ElectronNativeTheme; /** The main process `net` module. */ net: ElectronNet; /** The main process `netLog` module. */ netLog: ElectronNetLog; /** The `Notification` constructor. */ Notification: typeof ElectronNotification; /** The main process `powerMonitor` module. */ powerMonitor: ElectronPowerMonitor; /** The main process `powerSaveBlocker` module. */ powerSaveBlocker: ElectronPowerSaveBlocker; /** The main process `process` object. */ process: NodeJS.Process; /** The main process `protocol` module. */ protocol: ElectronProtocol; /** The main process `safeStorage` module. */ safeStorage: ElectronSafeStorage; /** The main process `screen` module. */ screen: ElectronScreen; /** The main process `session` module. */ session: ElectronSessionModule; /** The `ShareMenu` constructor. macOS only. */ ShareMenu: typeof ElectronShareMenu; /** The main process `shell` module. */ shell: ElectronShell; /** The main process `systemPreferences` module. */ systemPreferences: ElectronSystemPreferences; /** The `TouchBar` constructor. macOS only. */ TouchBar: typeof ElectronTouchBar; /** The `Tray` constructor. */ Tray: typeof ElectronTray; /** The main process `webContents` module. */ webContents: ElectronWebContentsModule; /** The main process `webFrameMain` module. */ webFrameMain: ElectronWebFrameMainModule; /** * Wraps a value in a function that returns it, for passing across the remote boundary. * * @param returnValue - The value the created function should return. * @returns A function returning `returnValue`. */ createFunctionWithReturnValue<T>(returnValue: T): () => T; /** * Returns the main process module built into Electron with the given name. * * @param name - The built-in module name. * @returns The requested built-in module. */ getBuiltin(name: string): unknown; /** * Returns the web contents of the current renderer process. * * @returns The current web contents. */ getCurrentWebContents(): ElectronWebContents; /** * Returns the BrowserWindow of the current renderer process. * * @returns The current BrowserWindow. */ getCurrentWindow(): ElectronBrowserWindow; /** * Returns the global variable of the given name from the main process. * * @param name - The global variable name. * @returns The requested global value. */ getGlobal(name: string): unknown; /** * Returns the module required from the main process by the given path. * * @param module - The module path to require. * @returns The required module. */ require(module: string): unknown; } /** * Details about a renderer process that has gone (crashed or killed). * * @public * @unofficial */ export interface ElectronRenderProcessGoneDetails { /** The exit code of the process, unless `reason` is `launch-failed`, in which case it is a platform-specific launch failure error code. */ exitCode: number; /** The reason the render process is gone. */ reason: "abnormal-exit" | "clean-exit" | "crashed" | "integrity-failure" | "killed" | "launch-failed" | "oom"; } /** * A certificate verification request passed to a certificate verify proc. * * @public * @unofficial */ export interface ElectronRequest { /** The certificate presented by the server. */ certificate: ElectronCertificate; /** The error code. */ errorCode: number; /** The host name being verified. */ hostname: string; /** Whether Chromium recognises the root CA as a standard root. */ isIssuedByKnownRoot: boolean; /** The certificate as validated by Chromium. */ validatedCertificate: ElectronCertificate; /** `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`. */ verificationResult: string; } /** * Options for `NativeImage.resize`. * * @public * @unofficial */ export interface ElectronResizeOptions { /** The desired height of the resized image. Defaults to the image's height. */ height?: number; /** * The desired quality of the resized image. Possible values are `best`, `better`, or `good`. These values express a desired quality/speed tradeoff that is translated into an algorithm-specific method depending on the capabilities (CPU, GPU) of the underlying platform. * * @default `'best'` */ quality?: string; /** The desired width of the resized image. Defaults to the image's width. */ width?: number; } /** * Usage information of Blink's internal memory caches. * * @public * @unofficial */ export interface ElectronResourceUsage { /** Usage details for the CSS style sheets cache. */ cssStyleSheets: ElectronMemoryUsageDetails; /** Usage details for the fonts cache. */ fonts: ElectronMemoryUsageDetails; /** Usage details for the images cache. */ images: ElectronMemoryUsageDetails; /** Usage details for other cached resources. */ other: ElectronMemoryUsageDetails; /** Usage details for the scripts cache. */ scripts: ElectronMemoryUsageDetails; /** Usage details for the XSL style sheets cache. */ xslStyleSheets: ElectronMemoryUsageDetails; } /** * Response object returned by an `onBeforeRequest` web-request listener callback. * * @public * @unofficial */ export interface ElectronResponse { /** Whether to cancel the request. */ cancel?: boolean; /** The original request is prevented from being sent or completed and is instead redirected to the given URL. */ redirectURL?: string; } /** * The result of a find-in-page request. * * @public * @unofficial */ export interface ElectronResult { /** Position of the active match. */ activeMatchOrdinal: number; /** Whether this is the final update for the request. */ finalUpdate: boolean; /** Number of matches. */ matches: number; /** The request id used for the request. */ requestId: number; /** Coordinates of the first match region. */ selectionArea: ElectronRectangle; } /** * SSL configuration for a session. * * @public * @unofficial */ export interface ElectronSSLConfigConfig { /** List of cipher suites which should be explicitly prevented from being used, in addition to those disabled by the net built-in policy. */ disabledCipherSuites?: number[]; /** The maximum SSL version to allow when connecting to remote servers. Can be `tls1.2` or `tls1.3`. */ maxVersion?: string; /** The minimum SSL version to allow when connecting to remote servers. Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. */ minVersion?: string; } /** * Electron `safeStorage` module for encrypting and decrypting strings using OS-level cryptography. * * @public * @unofficial */ export interface ElectronSafeStorage extends NodeJS.EventEmitter { /** * Decrypts the encrypted buffer obtained with `encryptString` back into a string. * * This function will throw an error if decryption fails. * * @param encrypted - The buffer produced by `encryptString`. * @returns The decrypted string. */ decryptString(encrypted: Buffer): string; /** * Encrypts a string using OS-level cryptography. * * This function will throw an error if encryption fails. * * @param plainText - The string to encrypt. * @returns A buffer of bytes representing the encrypted string. */ encryptString(plainText: string): Buffer; /** * Whether encryption is available. * * On Linux, returns `true` if the app has emitted the `ready` event and the secret key is * available. On macOS, returns `true` if Keychain is available. On Windows, returns `true` once * the app has emitted the `ready` event. * * @returns `true` if string encryption is available on the current platform. */ isEncryptionAvailable(): boolean; } /** * Options for Electron save file dialog. * * @public * @unofficial */ export interface ElectronSaveDialogOptions { /** The label for the confirmation button. */ buttonLabel?: string; /** The default path to open the dialog at. */ defaultPath?: string; /** The file filters to display. */ filters?: ElectronFileFilter[]; /** The message to display above the dialog on macOS. */ message?: string; /** The label for the file name text field on macOS. */ nameFieldLabel?: string; /** The dialog behavior properties. */ properties?: Array<"createDirectory" | "dontAddToRecent" | "showHiddenFiles" | "showOverwriteConfirmation" | "treatPackageAsDirectory">; /** Whether to create a security scoped bookmark when packaged for the Mac App Store (macOS, mas only). */ securityScopedBookmarks?: boolean; /** Whether to show the tags field on macOS. */ showsTagField?: boolean; /** The dialog title. */ title?: string; } /** * Return value from an Electron save file dialog. * * @public * @unofficial */ export interface ElectronSaveDialogReturnValue { /** Base64 encoded string which contains the security scoped bookmark data for the saved file (macOS, mas only). */ bookmark?: string; /** Whether the dialog was canceled. */ canceled: boolean; /** The file path chosen by the user. */ filePath?: string; } /** * Options for Electron synchronous save file dialog. * * @public * @unofficial */ export interface ElectronSaveDialogSyncOptions { /** The label for the confirmation button. */ buttonLabel?: string; /** The default path to open the dialog at. */ defaultPath?: string; /** The file filters to display. */ filters?: ElectronFileFilter[]; /** The message to display above the dialog on macOS. */ message?: string; /** The label for the file name text field on macOS. */ nameFieldLabel?: string; /** The dialog behavior properties. */ properties?: Array<"createDirectory" | "dontAddToRecent" | "showHiddenFiles" | "showOverwriteConfirmation" | "treatPackageAsDirectory">; /** Whether to create a security scoped bookmark when packaged for the Mac App Store (macOS, mas only). */ securityScopedBookmarks?: boolean; /** Whether to show the tags field on macOS. */ showsTagField?: boolean; /** The dialog title. */ title?: string; } /** * Electron Screen for retrieving information about screen size, displays, cursor position, and so on. * * @public * @unofficial */ export interface ElectronScreen { /** * Adds a listener for the `display-added` event. * * Emitted when `newDisplay` has been added. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ addListener(event: "display-added", listener: (event: ElectronEvent, newDisplay: ElectronDisplay) => void): this; /** * Adds a listener for the `display-metrics-changed` event. * * Emitted when one or more metrics change in a `display`. The `changedMetrics` is an array of strings that describe * the changes. Possible changes are `bounds`, `workArea`, `scaleFactor` and `rotation`. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ addListener(event: "display-metrics-changed", listener: (event: ElectronEvent, display: ElectronDisplay, changedMetrics: string[]) => void): this; /** * Adds a listener for the `display-removed` event. * * Emitted when `oldDisplay` has been removed. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ addListener(event: "display-removed", listener: (event: ElectronEvent, oldDisplay: ElectronDisplay) => void): this; /** * Converts a screen DIP point to a screen physical point. The DPI scale is performed relative to the display * containing the DIP point. * * @param point - The screen DIP point to convert. * @returns The corresponding screen physical point. * * Platform: `win32`. */ dipToScreenPoint(point: ElectronPoint): ElectronPoint; /** * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed relative to the display nearest * to `window`. If `window` is `null`, scaling will be performed to the display nearest to `rect`. * * @param window - The window used to determine the display, or `null`. * @param rect - The screen DIP rect to convert. * @returns The corresponding screen physical rect. * * Platform: `win32`. */ dipToScreenRect(window: ElectronBrowserWindow | null, rect: ElectronRectangle): ElectronRectangle; /** * Returns an array of displays that are currently available. * * @returns The available displays. */ getAllDisplays(): ElectronDisplay[]; /** * Returns the current absolute position of the mouse pointer. * * **Note:** The return value is a DIP point, not a screen physical point. * * @returns The current absolute position of the mouse pointer. */ getCursorScreenPoint(): ElectronPoint; /** * Returns the display that most closely intersects the provided bounds. * * @param rect - The bounds to match against. * @returns The display that most closely intersects the provided bounds. */ getDisplayMatching(rect: ElectronRectangle): ElectronDisplay; /** * Returns the display nearest the specified point. * * @param point - The point to find the nearest display for. * @returns The display nearest the specified point. */ getDisplayNearestPoint(point: ElectronPoint): ElectronDisplay; /** * Returns the primary display. * * @returns The primary display. */ getPrimaryDisplay(): ElectronDisplay; /** * Registers a listener for the `display-added` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ on(event: "display-added", listener: (event: ElectronEvent, newDisplay: ElectronDisplay) => void): this; /** * Registers a listener for the `display-metrics-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ on(event: "display-metrics-changed", listener: (event: ElectronEvent, display: ElectronDisplay, changedMetrics: string[]) => void): this; /** * Registers a listener for the `display-removed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ on(event: "display-removed", listener: (event: ElectronEvent, oldDisplay: ElectronDisplay) => void): this; /** * Registers a one-time listener for the `display-added` event. The listener is removed after it is invoked once. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ once(event: "display-added", listener: (event: ElectronEvent, newDisplay: ElectronDisplay) => void): this; /** * Registers a one-time listener for the `display-metrics-changed` event. The listener is removed after it is * invoked once. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ once(event: "display-metrics-changed", listener: (event: ElectronEvent, display: ElectronDisplay, changedMetrics: string[]) => void): this; /** * Registers a one-time listener for the `display-removed` event. The listener is removed after it is invoked once. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronScreen` instance. */ once(event: "display-removed", listener: (event: ElectronEvent, oldDisplay: ElectronDisplay) => void): this; /** * Removes the specified listener for the `display-added` event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This `ElectronScreen` instance. */ removeListener(event: "display-added", listener: (event: ElectronEvent, newDisplay: ElectronDisplay) => void): this; /** * Removes the specified listener for the `display-metrics-changed` event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This `ElectronScreen` instance. */ removeListener(event: "display-metrics-changed", listener: (event: ElectronEvent, display: ElectronDisplay, changedMetrics: string[]) => void): this; /** * Removes the specified listener for the `display-removed` event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This `ElectronScreen` instance. */ removeListener(event: "display-removed", listener: (event: ElectronEvent, oldDisplay: ElectronDisplay) => void): this; /** * Converts a screen physical point to a screen DIP point. The DPI scale is performed relative to the display * containing the physical point. * * @param point - The screen physical point to convert. * @returns The corresponding screen DIP point. * * Platform: `win32`. */ screenToDipPoint(point: ElectronPoint): ElectronPoint; /** * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed relative to the display nearest * to `window`. If `window` is `null`, scaling will be performed to the display nearest to `rect`. * * @param window - The window used to determine the display, or `null`. * @param rect - The screen physical rect to convert. * @returns The corresponding screen DIP rect. * * Platform: `win32`. */ screenToDipRect(window: ElectronBrowserWindow | null, rect: ElectronRectangle): ElectronRectangle; } /** * An item shown in a {@link ElectronTouchBarScrubber}. * * @public * @unofficial */ export interface ElectronScrubberItem { /** The image to appear in this item. */ icon?: ElectronNativeImage; /** The text to appear in this item. */ label?: string; } /** * A segment shown in a {@link ElectronTouchBarSegmentedControl}. * * @public * @unofficial */ export interface ElectronSegmentedControlSegment { /** * Whether this segment is selectable. * * @default `true` */ enabled?: boolean; /** The image to appear in this segment. */ icon?: ElectronNativeImage; /** The text to appear in this segment. */ label?: string; } /** * Details passed to the `select-hid-device` session event. * * @public * @unofficial */ export interface ElectronSelectHidDeviceDetails { /** The list of HID devices available for selection. */ deviceList: ElectronHIDDevice[]; /** The frame that requested a device. */ frame: ElectronWebFrameMain; } /** * A serial port available for selection via the Web Serial API. * * @public * @unofficial */ export interface ElectronSerialPort { /** A stable identifier on Windows that can be used for device permissions. */ deviceInstanceId?: string; /** A string suitable for display to the user for describing this device. */ displayName: string; /** Unique identifier for the port. */ portId: string; /** Name of the port. */ portName: string; /** Optional USB product ID. */ productId: string; /** The USB device serial number. */ serialNumber: string; /** Represents a single serial port on macOS that can be enumerated by multiple drivers. */ usbDriverName?: string; /** Optional USB vendor ID. */ vendorId: string; } /** * Information about a running service worker. * * @public * @unofficial */ export interface ElectronServiceWorkerInfo { /** The virtual ID of the process that this service worker is running in. Not an OS-level PID. */ renderProcessId: number; /** The base URL that this service worker is active for. */ scope: string; /** The full URL to the script that this service worker runs. */ scriptUrl: string; } /** * Provides access to the service workers registered within a session. * * @public * @unofficial */ export interface ElectronServiceWorkers { /** * Registers a listener for the `console-message` event, emitted when a service worker logs to the console. * * @param event - The event name. * @param listener - Called with the console message details. * @returns This service workers instance. */ addListener(event: "console-message", listener: (event: ElectronEvent, messageDetails: ElectronMessageDetails) => void): this; /** * Registers a listener for the `registration-completed` event, emitted when a service worker has been registered. * * @param event - The event name. * @param listener - Called with the registration details. * @returns This service workers instance. */ addListener(event: "registration-completed", listener: (event: ElectronEvent, details: ElectronRegistrationCompletedDetails) => void): this; /** * Returns all running service workers keyed by version ID. * * @returns A map whose keys are the service worker version IDs and whose values describe each service worker. */ getAllRunning(): Record<number, ElectronServiceWorkerInfo>; /** * Returns information about the service worker with the given version ID. * * @param versionId - The service worker version ID. * @returns Information about the service worker. */ getFromVersionID(versionId: number): ElectronServiceWorkerInfo; /** * Registers a listener for the `console-message` event, emitted when a service worker logs to the console. * * @param event - The event name. * @param listener - Called with the console message details. * @returns This service workers instance. */ on(event: "console-message", listener: (event: ElectronEvent, messageDetails: ElectronMessageDetails) => void): this; /** * Registers a listener for the `registration-completed` event, emitted when a service worker has been registered. * * @param event - The event name. * @param listener - Called with the registration details. * @returns This service workers instance. */ on(event: "registration-completed", listener: (event: ElectronEvent, details: ElectronRegistrationCompletedDetails) => void): this; /** * Registers a one-time listener for the `console-message` event. * * @param event - The event name. * @param listener - Called with the console message details. * @returns This service workers instance. */ once(event: "console-message", listener: (event: ElectronEvent, messageDetails: ElectronMessageDetails) => void): this; /** * Registers a one-time listener for the `registration-completed` event. * * @param event - The event name. * @param listener - Called with the registration details. * @returns This service workers instance. */ once(event: "registration-completed", listener: (event: ElectronEvent, details: ElectronRegistrationCompletedDetails) => void): this; /** * Removes a previously registered `console-message` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This service workers instance. */ removeListener(event: "console-message", listener: (event: ElectronEvent, messageDetails: ElectronMessageDetails) => void): this; /** * Removes a previously registered `registration-completed` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This service workers instance. */ removeListener(event: "registration-completed", listener: (event: ElectronEvent, details: ElectronRegistrationCompletedDetails) => void): this; } /** * The `session` module accessor exposed by Electron, providing the default session and a factory for partition-based sessions. * * @public * @unofficial */ export interface ElectronSessionModule { /** The default session object of the app. */ defaultSession: Session; /** * Returns a session instance from a `partition` string. When there is an existing `Session` with the same `partition`, it will be returned; otherwise a new `Session` instance will be created with `options`. * * If `partition` starts with `persist:`, the page will use a persistent session available to all pages in the app with the same `partition`. If there is no `persist:` prefix, the page will use an in-memory session. If the `partition` is empty then default session of the app will be returned. * * @param partition - The partition string identifying the session. * @param options - Options used when creating the session. * @returns The `Session` instance for the given partition. */ fromPartition(partition: string, options?: ElectronFromPartitionOptions): Session; } /** * Settings for the app's login item. * * @public * @unofficial */ export interface ElectronSettings { /** * The command-line arguments to pass to the executable. Windows only. * * @default `[]` */ args?: string[]; /** * `true` to change the startup approved registry key and enable/disable the app in Task Manager and * Windows settings. Windows only. * * @default `true` */ enabled?: boolean; /** Value name to write into registry. Defaults to the app's AppUserModelId. Windows only. */ name?: string; /** * `true` to open the app as hidden. Not available on MAS builds. macOS only. * * @default `false` */ openAsHidden?: boolean; /** * `true` to open the app at login, `false` to remove the app as a login item. * * @default `false` */ openAtLogin?: boolean; /** The executable to launch at login. Windows only. */ path?: string; } /** * Information about a shared worker. * * @public * @unofficial */ export interface ElectronSharedWorkerInfo { /** The unique id of the shared worker. */ id: string; /** The url of the shared worker. */ url: string; } /** * Electron SharingItem describing the content to share via the `shareMenu` role. * * @public * @unofficial */ export interface ElectronSharingItem { /** An array of files to share. */ filePaths?: string[]; /** An array of text to share. */ texts?: string[]; /** An array of URLs to share. */ urls?: string[]; } /** * Electron Shell for managing files and URLs using their default applications. * * @public * @unofficial */ export interface ElectronShell { /** Plays the system beep sound. */ beep(): void; /** * Opens the given external protocol URL in the desktop's default manner (for example, `mailto:` URLs in the user's default mail agent). * * @param url - The URL to open. * @param options - Options for opening the URL. * @returns A `Promise` that resolves when the URL has been opened. */ openExternal(url: string, options?: ElectronShellOpenExternalOptions): Promise<void>; /** * Opens the given file in the desktop's default manner. * * @param path - The path to open. * @returns A `Promise` that resolves with an error message if a failure occurred, otherwise an empty string. */ openPath(path: string): Promise<string>; /** * Resolves the shortcut link at `shortcutPath`. An exception is thrown when any error happens. Only available on Windows (`win32`). * * @param shortcutPath - The path to the shortcut link. * @returns The details of the shortcut link. */ readShortcutLink(shortcutPath: string): ElectronShortcutDetails; /** * Shows the given file in a file manager. If possible, selects the file. * * @param fullPath - The full path to the file. */ showItemInFolder(fullPath: string): void; /** * Moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin on Windows, and a desktop-environment-specific location on Linux). * * @param path - The path to the file. * @returns A `Promise` that resolves when the operation has completed and rejects if there was an error while deleting the requested item. */ trashItem(path: string): Promise<void>; /** * Creates or updates a shortcut link at `shortcutPath`. Only available on Windows (`win32`). * * @param shortcutPath - The path to the shortcut link. * @param operation - The operation to perform on the shortcut link. * @param options - The details of the shortcut link. * @returns Whether the shortcut was created successfully. */ writeShortcutLink(shortcutPath: string, operation: "create" | "replace" | "update", options: ElectronShortcutDetails): boolean; /** * Creates or updates a shortcut link at `shortcutPath`. Only available on Windows (`win32`). * * @param shortcutPath - The path to the shortcut link. * @param options - The details of the shortcut link. * @returns Whether the shortcut was created successfully. */ writeShortcutLink(shortcutPath: string, options: ElectronShortcutDetails): boolean; } /** * Options for opening an external URL. * * @public * @unofficial */ export interface ElectronShellOpenExternalOptions { /** Whether to activate the opened application. */ activate?: boolean; /** The working directory for the opened application. */ workingDirectory?: string; } /** * Details of a shortcut link used by `readShortcutLink` and `writeShortcutLink`. * * @public * @unofficial */ export interface ElectronShortcutDetails { /** * The Application User Model ID. * * @default `''` */ appUserModelId?: string; /** * The arguments to be applied to `target` when launching from this shortcut. * * @default `''` */ args?: string; /** * The working directory. * * @default `''` */ cwd?: string; /** * The description of the shortcut. * * @default `''` */ description?: string; /** * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set together. An empty value uses the target's icon. * * @default `''` */ icon?: string; /** * The resource ID of icon when `icon` is a DLL or EXE. * * @default `0` */ iconIndex?: number; /** The target to launch from this shortcut. */ target: string; /** The Application Toast Activator CLSID. Needed for participating in Action Center. */ toastActivatorClsid?: string; } /** * Represents dimensions with width and height. * * @public * @unofficial */ export interface ElectronSize { /** The height component. */ height: number; /** The width component. */ width: number; } /** * Options for `desktopCapturer.getSources`. * * @public * @unofficial */ export interface ElectronSourcesOptions { /** * Set to `true` to enable fetching window icons. When `false` the `appIcon` property of the sources returns * `null`, as it does if a source has the type screen. * * @default `false` */ fetchWindowIcons?: boolean; /** * The size that the media source thumbnail should be scaled to. Set width or height to `0` when thumbnails * are not needed, to save the processing time required for capturing the content of each window and screen. * * @default `{ width: 150, height: 150 }` */ thumbnailSize?: ElectronSize; /** * An array of strings listing the types of desktop sources to be captured. Available types are `screen` and `window`. */ types: string[]; } /** * Options controlling how network events are captured when logging starts. * * @public * @unofficial */ export interface ElectronStartLoggingOptions { /** What kinds of data should be captured. `includeSensitive` adds cookies and auth data; `everything` adds all bytes transferred on sockets. */ captureMode?: "default" | "everything" | "includeSensitive"; /** When the log grows beyond this size, logging will automatically stop. */ maxFileSize?: number; } /** * Electron SystemPreferences for reading and writing system-wide preferences. * * @public * @unofficial */ export interface ElectronSystemPreferences { /** * A `string` property that can be `dark`, `light` or `unknown`. It determines the macOS appearance setting for your * application. This maps to values in `NSApplication.appearance`. Setting this will override the system default as * well as the value of `getEffectiveAppearance`. * * Platform: `darwin`. */ appLevelAppearance: "dark" | "light" | "unknown"; /** * A `string` property that can be `dark`, `light` or `unknown`. Returns the macOS appearance setting that is * currently applied to your application, maps to `NSApplication.effectiveAppearance`. * * Platform: `darwin`. */ readonly effectiveAppearance: "dark" | "light" | "unknown"; /** * Adds a listener for the `accent-color-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. */ addListener(event: "accent-color-changed", listener: (event: ElectronEvent, newColor: string) => void): this; /** * Adds a listener for the `color-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. */ addListener(event: "color-changed", listener: (event: ElectronEvent) => void): this; /** * Adds a listener for the `high-contrast-color-scheme-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ addListener(event: "high-contrast-color-scheme-changed", listener: (event: ElectronEvent, highContrastColorScheme: boolean) => void): this; /** * Adds a listener for the `inverted-color-scheme-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ addListener(event: "inverted-color-scheme-changed", listener: (event: ElectronEvent, invertedColorScheme: boolean) => void): this; /** * Prompts the user for access to the given media type. Resolves with `true` if consent was granted and `false` if * it was denied. * * @param mediaType - The media type to request access to. * @returns A promise resolving to whether access was granted. * * Platform: `darwin`. */ askForMediaAccess(mediaType: "camera" | "microphone"): Promise<boolean>; /** * Returns whether or not this device has the ability to use Touch ID. * * @returns Whether this device can prompt for Touch ID. * * Platform: `darwin`. */ canPromptTouchID(): boolean; /** * Returns the user's current system wide accent color preference in RGBA hexadecimal form. * * @returns The accent color in RGBA hexadecimal form. * * Platform: `win32,darwin`. */ getAccentColor(): string; /** * Returns an object with the system animation settings. * * @returns The system animation settings. */ getAnimationSettings(): ElectronAnimationSettings; /** * Gets the macOS appearance setting that you have declared you want for your application, maps to * `NSApplication.appearance`. Can be `dark`, `light` or `unknown`. * * @returns The declared app-level appearance. * * @deprecated Deprecated by Electron. * Platform: `darwin`. */ getAppLevelAppearance(): "dark" | "light" | "unknown"; /** * Returns the system color setting in RGB hexadecimal form (`#ABCDEF`). * * @param color - The named system color to look up. * @returns The system color in RGB hexadecimal form. * * Platform: `win32,darwin`. */ getColor(color: "3d-dark-shadow" | "3d-face" | "3d-highlight" | "3d-light" | "3d-shadow" | "active-border" | "active-caption-gradient" | "active-caption" | "alternate-selected-control-text" | "app-workspace" | "button-text" | "caption-text" | "control-background" | "control-text" | "control" | "desktop" | "disabled-control-text" | "disabled-text" | "find-highlight" | "grid" | "header-text" | "highlight-text" | "highlight" | "hotlight" | "inactive-border" | "inactive-caption-gradient" | "inactive-caption-text" | "inactive-caption" | "info-background" | "info-text" | "keyboard-focus-indicator" | "label" | "link" | "menu-highlight" | "menu-text" | "menu" | "menubar" | "placeholder-text" | "quaternary-label" | "scrollbar" | "scrubber-textured-background" | "secondary-label" | "selected-content-background" | "selected-control-text" | "selected-control" | "selected-menu-item-text" | "selected-text-background" | "selected-text" | "separator" | "shadow" | "tertiary-label" | "text-background" | "text" | "under-page-background" | "unemphasized-selected-content-background" | "unemphasized-selected-text-background" | "unemphasized-selected-text" | "window-background" | "window-frame-text" | "window-frame" | "window-text" | "window"): string; /** * Gets the macOS appearance setting that is currently applied to your application, maps to * `NSApplication.effectiveAppearance`. Can be `dark`, `light` or `unknown`. * * @returns The effective appearance. * * Platform: `darwin`. */ getEffectiveAppearance(): "dark" | "light" | "unknown"; /** * Returns the access status for the given media type. Can be `not-determined`, `granted`, `denied`, `restricted` * or `unknown`. * * @param mediaType - The media type to query. * @returns The access status for the given media type. * * Platform: `win32,darwin`. */ getMediaAccessStatus(mediaType: "camera" | "microphone" | "screen"): "denied" | "granted" | "not-determined" | "restricted" | "unknown"; /** * Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility * settings. The standard system color is formatted as `#RRGGBBAA`. * * @param color - The named standard system color to look up. * @returns The standard system color formatted as `#RRGGBBAA`. * * Platform: `darwin`. */ getSystemColor(color: "blue" | "brown" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "yellow"): string; /** * Returns the value of `key` in `NSUserDefaults`. * * @param key - The `NSUserDefaults` key to read. * @param type - The type of the value stored under `key`. * @returns The value of `key` in `NSUserDefaults`. * * Platform: `darwin`. */ getUserDefault<Type extends keyof ElectronUserDefaultTypes>(key: string, type: Type): ElectronUserDefaultTypes[Type]; /** * Returns `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise. * * @returns Whether DWM composition is enabled. * * Platform: `win32`. */ isAeroGlassEnabled(): boolean; /** * Returns whether the system is in Dark Mode. * * @returns Whether the system is in Dark Mode. * * @deprecated Deprecated by Electron. * Platform: `darwin,win32`. */ isDarkMode(): boolean; /** * Returns `true` if a high contrast theme is active, `false` otherwise. * * @returns Whether a high contrast theme is active. * * @deprecated Deprecated by Electron. * Platform: `darwin,win32`. */ isHighContrastColorScheme(): boolean; /** * Returns `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) * is active, `false` otherwise. * * @returns Whether an inverted color scheme is active. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ isInvertedColorScheme(): boolean; /** * Returns whether the Swipe between pages setting is on. * * @returns Whether the Swipe between pages setting is on. * * Platform: `darwin`. */ isSwipeTrackingFromScrollEventsEnabled(): boolean; /** * Returns `true` if the current process is a trusted accessibility client and `false` if it is not. * * @param prompt - Whether to prompt the user with a system dialog if the process is not trusted. * @returns Whether the current process is a trusted accessibility client. * * Platform: `darwin`. */ isTrustedAccessibilityClient(prompt: boolean): boolean; /** * Registers a listener for the `accent-color-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. */ on(event: "accent-color-changed", listener: (event: ElectronEvent, newColor: string) => void): this; /** * Registers a listener for the `color-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. */ on(event: "color-changed", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `high-contrast-color-scheme-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ on(event: "high-contrast-color-scheme-changed", listener: (event: ElectronEvent, highContrastColorScheme: boolean) => void): this; /** * Registers a listener for the `inverted-color-scheme-changed` event. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ on(event: "inverted-color-scheme-changed", listener: (event: ElectronEvent, invertedColorScheme: boolean) => void): this; /** * Registers a one-time listener for the `accent-color-changed` event. The listener is removed after it is invoked * once. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. */ once(event: "accent-color-changed", listener: (event: ElectronEvent, newColor: string) => void): this; /** * Registers a one-time listener for the `color-changed` event. The listener is removed after it is invoked once. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. */ once(event: "color-changed", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time listener for the `high-contrast-color-scheme-changed` event. The listener is removed after * it is invoked once. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ once(event: "high-contrast-color-scheme-changed", listener: (event: ElectronEvent, highContrastColorScheme: boolean) => void): this; /** * Registers a one-time listener for the `inverted-color-scheme-changed` event. The listener is removed after it is * invoked once. * * @param event - The event name. * @param listener - The event handler. * @returns This `ElectronSystemPreferences` instance. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ once(event: "inverted-color-scheme-changed", listener: (event: ElectronEvent, invertedColorScheme: boolean) => void): this; /** * Posts `event` as native notifications of macOS. The `userInfo` is an object that contains the user information * dictionary sent along with the notification. * * @param event - The notification event name. * @param userInfo - The user information dictionary sent along with the notification. * * Platform: `darwin`. */ postLocalNotification(event: string, userInfo: Record<string, unknown>): void; /** * Posts `event` as native notifications of macOS. The `userInfo` is an object that contains the user information * dictionary sent along with the notification. * * @param event - The notification event name. * @param userInfo - The user information dictionary sent along with the notification. * @param deliverImmediately - Whether to deliver the notification immediately. * * Platform: `darwin`. */ postNotification(event: string, userInfo: Record<string, unknown>, deliverImmediately?: boolean): void; /** * Posts `event` as native notifications of macOS. The `userInfo` is an object that contains the user information * dictionary sent along with the notification. * * @param event - The notification event name. * @param userInfo - The user information dictionary sent along with the notification. * * Platform: `darwin`. */ postWorkspaceNotification(event: string, userInfo: Record<string, unknown>): void; /** * Prompts the user to authenticate with Touch ID. Resolves if the user has successfully authenticated with * Touch ID. * * @param reason - The reason presented to the user for the authentication request. * @returns A promise that resolves once the user has authenticated. * * Platform: `darwin`. */ promptTouchID(reason: string): Promise<void>; /** * Adds the specified defaults to your application's `NSUserDefaults`. * * @param defaults - The defaults to add. * * Platform: `darwin`. */ registerDefaults(defaults: Record<string, boolean | number | string>): void; /** * Removes the specified listener for the `accent-color-changed` event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This `ElectronSystemPreferences` instance. */ removeListener(event: "accent-color-changed", listener: (event: ElectronEvent, newColor: string) => void): this; /** * Removes the specified listener for the `color-changed` event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This `ElectronSystemPreferences` instance. */ removeListener(event: "color-changed", listener: (event: ElectronEvent) => void): this; /** * Removes the specified listener for the `high-contrast-color-scheme-changed` event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This `ElectronSystemPreferences` instance. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ removeListener(event: "high-contrast-color-scheme-changed", listener: (event: ElectronEvent, highContrastColorScheme: boolean) => void): this; /** * Removes the specified listener for the `inverted-color-scheme-changed` event. * * @param event - The event name. * @param listener - The event handler to remove. * @returns This `ElectronSystemPreferences` instance. * * @deprecated Deprecated by Electron. * Platform: `win32`. */ removeListener(event: "inverted-color-scheme-changed", listener: (event: ElectronEvent, invertedColorScheme: boolean) => void): this; /** * Removes the `key` in `NSUserDefaults`. This can be used to restore the default or global value of a `key` * previously set with `setUserDefault`. * * @param key - The `NSUserDefaults` key to remove. * * Platform: `darwin`. */ removeUserDefault(key: string): void; /** * Sets the appearance setting for your application, this should override the system default and override the value * of `getEffectiveAppearance`. * * @param appearance - The appearance to set, or `null` to reset. * * @deprecated Deprecated by Electron. * Platform: `darwin`. */ setAppLevelAppearance(appearance: "dark" | "light" | null): void; /** * Sets the value of `key` in `NSUserDefaults`. Note that `type` should match the actual type of `value`. An * exception is thrown if they don't. * * @param key - The `NSUserDefaults` key to write. * @param type - The type of the value being stored. * @param value - The value to store. * * Platform: `darwin`. */ setUserDefault<Type extends keyof ElectronUserDefaultTypes>(key: string, type: Type, value: ElectronUserDefaultTypes[Type]): void; /** * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local defaults. If `event` is `null`, the * `NSNotificationCenter` doesn't use it as criteria for delivery to the observer. * * @param event - The notification event name, or `null`. * @param callback - Called when the corresponding event happens. * @returns The ID of this subscription. * * Platform: `darwin`. */ subscribeLocalNotification(event: null | string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number; /** * Subscribes to native notifications of macOS, `callback` will be called with `callback(event, userInfo)` when the * corresponding `event` happens. If `event` is `null`, the `NSDistributedNotificationCenter` doesn't use it as * criteria for delivery to the observer. * * @param event - The notification event name, or `null`. * @param callback - Called when the corresponding event happens. * @returns The ID of this subscription. * * Platform: `darwin`. */ subscribeNotification(event: null | string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number; /** * Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`. If `event` is * `null`, the `NSWorkspaceNotificationCenter` doesn't use it as criteria for delivery to the observer. * * @param event - The notification event name, or `null`. * @param callback - Called when the corresponding event happens. * @returns The ID of this subscription. * * Platform: `darwin`. */ subscribeWorkspaceNotification(event: null | string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number; /** * Same as `unsubscribeNotification`, but removes the subscriber from `NSNotificationCenter`. * * @param id - The ID of the subscription to remove. * * Platform: `darwin`. */ unsubscribeLocalNotification(id: number): void; /** * Removes the subscriber with `id`. * * @param id - The ID of the subscription to remove. * * Platform: `darwin`. */ unsubscribeNotification(id: number): void; /** * Same as `unsubscribeNotification`, but removes the subscriber from * `NSWorkspace.sharedWorkspace.notificationCenter`. * * @param id - The ID of the subscription to remove. * * Platform: `darwin`. */ unsubscribeWorkspaceNotification(id: number): void; } /** * A task in the Tasks category of a Windows Jump List. * * @public * @unofficial */ export interface ElectronTask { /** The command line arguments when `program` is executed. */ arguments: string; /** Description of this task. */ description: string; /** The icon index in the icon file. If an icon file consists of one icon, this value is `0`. */ iconIndex: number; /** The absolute path to an icon to be displayed in a Jump List. */ iconPath: string; /** Path of the program to execute, usually `process.execPath`. */ program: string; /** The string to be displayed in a Jump List. */ title: string; /** The working directory. */ workingDirectory?: string; } /** * A button in a thumbnail toolbar (Windows only). * * @public * @unofficial */ export interface ElectronThumbarButton { /** * Control specific states and behaviors of the button. * * @default `['enabled']` */ flags?: string[]; /** The icon showing in the thumbnail toolbar. */ icon: ElectronNativeImage; /** The text of the button's tooltip. */ tooltip?: string; /** Callback invoked when the button is clicked. */ click(): void; } /** * Configuration for the Window Controls Overlay when creating a window. * * @public * @unofficial */ export interface ElectronTitleBarOverlay { /** * The CSS color of the Window Controls Overlay when enabled (Windows only). Default is the system color. */ color?: string; /** * The height of the title bar and Window Controls Overlay in pixels (macOS and Windows). Default is the system * height. */ height?: number; /** * The CSS color of the symbols on the Window Controls Overlay when enabled (Windows only). Default is the system * color. */ symbolColor?: string; } /** * Options for {@link ElectronBrowserWindow.setTitleBarOverlay}. * * @public * @unofficial */ export interface ElectronTitleBarOverlayOptions { /** The CSS color of the Window Controls Overlay when enabled (Windows only). */ color?: string; /** The height of the title bar and Window Controls Overlay in pixels (Windows only). */ height?: number; /** The CSS color of the symbols on the Window Controls Overlay when enabled (Windows only). */ symbolColor?: string; } /** * Options for {@link ElectronTray.setTitle}. * * @public * @unofficial */ export interface ElectronTitleOptions { /** * The font family variant to display, can be `monospaced` or `monospacedDigit`. `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in macOS 10.11+. When left blank, the title uses the default system font. */ fontType?: "monospaced" | "monospacedDigit"; } /** * Options for creating a {@link ElectronTouchBarButton}. * * @public * @unofficial */ export interface ElectronTouchBarButtonConstructorOptions { /** A short description of the button for use by screen readers like VoiceOver. */ accessibilityLabel?: string; /** Button background color in hex format, i.e `#ABCDEF`. */ backgroundColor?: string; /** * Whether the button is in an enabled state. * * @default `true` */ enabled?: boolean; /** Button icon. */ icon?: ElectronNativeImage | string; /** * Position of the icon. * * @default `overlay` */ iconPosition?: "left" | "overlay" | "right"; /** Button text. */ label?: string; /** Callback invoked when the button is clicked. */ click?(): void; } /** * Options for creating a {@link ElectronTouchBarColorPicker}. * * @public * @unofficial */ export interface ElectronTouchBarColorPickerConstructorOptions { /** Array of hex color strings to appear as possible colors to select. */ availableColors?: string[]; /** The selected hex color in the picker, i.e `#ABCDEF`. */ selectedColor?: string; /** Callback invoked when a color is selected. */ change?(color: string): void; } /** * Options for creating a {@link ElectronTouchBar}. * * @public * @unofficial */ export interface ElectronTouchBarConstructorOptions { /** The item that will replace the "esc" button on the touch bar when set. */ escapeItem?: ElectronTouchBarButton | ElectronTouchBarColorPicker | ElectronTouchBarGroup | ElectronTouchBarLabel | ElectronTouchBarPopover | ElectronTouchBarScrubber | ElectronTouchBarSegmentedControl | ElectronTouchBarSlider | ElectronTouchBarSpacer | null; /** The items to display in the touch bar. */ items?: (ElectronTouchBarButton | ElectronTouchBarColorPicker | ElectronTouchBarGroup | ElectronTouchBarLabel | ElectronTouchBarPopover | ElectronTouchBarScrubber | ElectronTouchBarSegmentedControl | ElectronTouchBarSlider | ElectronTouchBarSpacer)[]; } /** * Options for creating a {@link ElectronTouchBarGroup}. * * @public * @unofficial */ export interface ElectronTouchBarGroupConstructorOptions { /** Items to display as a group. */ items: ElectronTouchBar; } /** * Options for creating a {@link ElectronTouchBarLabel}. * * @public * @unofficial */ export interface ElectronTouchBarLabelConstructorOptions { /** A short description of the label for use by screen readers like VoiceOver. */ accessibilityLabel?: string; /** Text to display. */ label?: string; /** Hex color of text, i.e `#ABCDEF`. */ textColor?: string; } /** * Options for creating a {@link ElectronTouchBarPopover}. * * @public * @unofficial */ export interface ElectronTouchBarPopoverConstructorOptions { /** Popover button icon. */ icon?: ElectronNativeImage; /** Items to display in the popover. */ items: ElectronTouchBar; /** Popover button text. */ label?: string; /** * Whether to display a close button on the left of the popover. * * @default `true` */ showCloseButton?: boolean; } /** * Options for creating a {@link ElectronTouchBarScrubber}. * * @public * @unofficial */ export interface ElectronTouchBarScrubberConstructorOptions { /** * Whether this scrubber is continuous. * * @default `true` */ continuous?: boolean; /** An array of items to place in this scrubber. */ items: ElectronScrubberItem[]; /** * The mode of this scrubber. * * @default `free` */ mode?: "fixed" | "free"; /** * Selected overlay item style. * * @default `none` */ overlayStyle?: "background" | "none" | "outline"; /** * Selected item style. * * @default `none` */ selectedStyle?: "background" | "none" | "outline"; /** * Whether to show arrow buttons. Only shown if `items` is non-empty. * * @default `false` */ showArrowButtons?: boolean; /** Callback invoked when the user taps any item. */ highlight?(highlightedIndex: number): void; /** Callback invoked when the user taps an item that was not the last tapped item. */ select?(selectedIndex: number): void; } /** * Options for creating a {@link ElectronTouchBarSegmentedControl}. * * @public * @unofficial */ export interface ElectronTouchBarSegmentedControlConstructorOptions { /** The selection mode of the control. */ mode?: "buttons" | "multiple" | "single"; /** An array of segments to place in this control. */ segments: ElectronSegmentedControlSegment[]; /** Style of the segments. */ segmentStyle?: "automatic" | "capsule" | "round-rect" | "rounded" | "separated" | "small-square" | "textured-rounded" | "textured-square"; /** * The index of the currently selected segment, updated automatically with user interaction. When the mode is * `multiple` it will be the last selected item. */ selectedIndex?: number; /** Callback invoked when the user selects a new segment. */ change?(selectedIndex: number, isSelected: boolean): void; } /** * Options for creating a {@link ElectronTouchBarSlider}. * * @public * @unofficial */ export interface ElectronTouchBarSliderConstructorOptions { /** Label text. */ label?: string; /** Maximum value. */ maxValue?: number; /** Minimum value. */ minValue?: number; /** Selected value. */ value?: number; /** Callback invoked when the slider is changed. */ change?(newValue: number): void; } /** * Options for creating a {@link ElectronTouchBarSpacer}. * * @public * @unofficial */ export interface ElectronTouchBarSpacerConstructorOptions { /** Size of the spacer. */ size?: "flexible" | "large" | "small"; } /** * The maximum usage across processes of the trace buffer. * * @public * @unofficial */ export interface ElectronTraceBufferUsageReturnValue { /** The percentage of the trace buffer maximum usage. */ percentage: number; /** The value of the trace buffer maximum usage. */ value: number; } /** * Legacy trace configuration controlling which category groups are traced and how. * * @public * @unofficial */ export interface ElectronTraceCategoriesAndOptions { /** * A filter to control what category groups should be traced. A filter can have an optional `-` prefix to exclude * category groups that contain a matching category. Having both included and excluded category patterns in the same * list is not supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`, * `-excluded_category1,-excluded_category2`. */ categoryFilter: string; /** * Controls what kind of tracing is enabled. It is a comma-delimited sequence of the following strings: * `record-until-full`, `record-continuously`, `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g. * `'record-until-full,enable-sampling'`. The first 3 options are trace recording modes and hence mutually exclusive. * If more than one trace recording mode appears in the `traceOptions` string, the last one takes precedence. If none * of the trace recording modes are specified, recording mode is `record-until-full`. The trace option will first be * reset to the default option (`record_mode` set to `record-until-full`, `enable_sampling` and `enable_systrace` set * to `false`) before options parsed from `traceOptions` are applied on it. */ traceOptions: string; } /** * Trace configuration controlling which categories are traced and how the recording behaves. * * @public * @unofficial */ export interface ElectronTraceConfig { /** * If `true`, filter event data according to a specific list of events that have been manually vetted to not include * any PII. See the implementation in Chromium for specifics. */ enable_argument_filter?: boolean; /** * A list of tracing categories to exclude. Can include glob-like patterns using `*` at the end of the category name. * See tracing categories for the list of categories. */ excluded_categories?: string[]; /** A list of histogram names to report with the trace. */ histogram_names?: string[]; /** * A list of tracing categories to include. Can include glob-like patterns using `*` at the end of the category name. * See tracing categories for the list of categories. */ included_categories?: string[]; /** A list of process IDs to include in the trace. If not specified, trace all processes. */ included_process_ids?: number[]; /** * If the `disabled-by-default-memory-infra` category is enabled, this contains optional additional configuration for * data collection. See the Chromium memory-infra docs for more information. */ memory_dump_config?: Record<string, unknown>; /** * Can be `record-as-much-as-possible`, `record-continuously`, `record-until-full` or `trace-to-console`. * * @default `record-until-full` */ recording_mode?: "record-as-much-as-possible" | "record-continuously" | "record-until-full" | "trace-to-console"; /** Maximum size of the trace recording buffer in events. */ trace_buffer_size_in_events?: number; /** Maximum size of the trace recording buffer in kilobytes. Defaults to 100MB. */ trace_buffer_size_in_kb?: number; } /** * A transaction in the Mac App Store payment queue. * * @public * @unofficial */ export interface ElectronTransaction { /** The error code if an error occurred while processing the transaction. */ errorCode: number; /** The error message if an error occurred while processing the transaction. */ errorMessage: string; /** The identifier of the restored transaction by the App Store. */ originalTransactionIdentifier: string; /** The payment associated with the transaction. */ payment: ElectronPayment; /** The date the transaction was added to the App Store's payment queue. */ transactionDate: string; /** A string that uniquely identifies a successful payment transaction. */ transactionIdentifier: string; /** The transaction state. Can be `deferred`, `failed`, `purchased`, `purchasing` or `restored`. */ transactionState: "deferred" | "failed" | "purchased" | "purchasing" | "restored"; } /** * A chunk of upload data attached to a network request. * * @public * @unofficial */ export interface ElectronUploadData { /** UUID of blob data. Use `Session.getBlobData` to retrieve the data. */ blobUUID?: string; /** Content being sent. */ bytes: Buffer; /** Path of file being uploaded. */ file?: string; } /** * A file to be uploaded as part of a request body. * * @public * @unofficial */ export interface ElectronUploadFile { /** Path of file to be uploaded. */ filePath: string; /** * Number of bytes to read from `offset`. * * @default `0` */ length: number; /** Last modification time in number of seconds since the UNIX epoch. */ modificationTime: number; /** * Offset in bytes to start reading from. * * @default `0` */ offset: number; /** The upload data type discriminant. */ type: "file"; } /** * Progress information about the upload portion of a `ClientRequest`. * * @public * @unofficial */ export interface ElectronUploadProgress { /** Whether the request is currently active. If this is `false` no other properties will be set. */ active: boolean; /** The number of bytes that have been uploaded so far. */ current: number; /** Whether the upload has started. If this is `false` both `current` and `total` will be set to `0`. */ started: boolean; /** The number of bytes that will be uploaded this request. */ total: number; } /** * Raw data to be uploaded as part of a request body. * * @public * @unofficial */ export interface ElectronUploadRawData { /** Data to be uploaded. */ bytes: Buffer; /** The upload data type discriminant. */ type: "rawData"; } /** * Maps `NSUserDefaults` type names to their corresponding TypeScript types. * * @public * @unofficial */ export interface ElectronUserDefaultTypes { /** An array value. */ array: Array<unknown>; /** A boolean value. */ boolean: boolean; /** A dictionary value. */ dictionary: Record<string, unknown>; /** A double-precision floating-point value. */ double: number; /** A single-precision floating-point value. */ float: number; /** An integer value. */ integer: number; /** A string value. */ string: string; /** A URL value. */ url: string; } /** * Options for {@link ElectronBrowserWindow.setVisibleOnAllWorkspaces}. * * @public * @unofficial */ export interface ElectronVisibleOnAllWorkspacesOptions { /** * Calling `setVisibleOnAllWorkspaces` will by default transform the process type between `UIElementApplication` * and `ForegroundApplication` to ensure the correct behavior. However, this will hide the window and dock for a * short time every time it is called. If the window is already of type `UIElementApplication`, this * transformation can be bypassed by passing `true` (macOS only). */ skipTransformProcessType?: boolean; /** Sets whether the window should be visible above fullscreen windows (macOS only). */ visibleOnFullScreen?: boolean; } /** * Electron WebContents for rendering and controlling a web page. * * Note: the upstream static factories (`fromId`, `fromDevToolsTargetId`, `getAllWebContents`, * `getFocusedWebContents`) cannot be expressed on a plain interface and are therefore omitted here. * * @public * @unofficial */ export interface ElectronWebContents { /** Whether this page is muted. */ audioMuted: boolean; /** Whether this web contents throttles animations and timers when the page becomes backgrounded. */ backgroundThrottling: boolean; /** The debugger instance for this web contents. */ readonly debugger: ElectronDebugger; /** The DevTools web contents associated with this web contents, or `null` when DevTools is closed. */ readonly devToolsWebContents: ElectronWebContents | null; /** The frame rate of the web contents. Only applicable when offscreen rendering is enabled. */ frameRate: number; /** The web contents that might own this web contents. */ readonly hostWebContents: ElectronWebContents; /** The unique id of this web contents. */ readonly id: number; /** The top frame of the page's frame hierarchy. */ readonly mainFrame: ElectronWebFrameMain; /** The session used by this web contents. */ readonly session: Session; /** The user agent for this web page. */ userAgent: string; /** The zoom factor for this web contents. The zoom factor is the zoom percent divided by 100. */ zoomFactor: number; /** The zoom level for this web contents. */ zoomLevel: number; /** * Registers a listener for the `before-input-event` event. * * @param event - The event name. * @param listener - Called when the `before-input-event` event is emitted. * @returns This web contents instance. */ addListener(event: "before-input-event", listener: (event: ElectronEvent, input: ElectronInput) => void): this; /** * Registers a listener for the `blur` event. * * @param event - The event name. * @param listener - Called when the `blur` event is emitted. * @returns This web contents instance. */ addListener(event: "blur", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `certificate-error` event. * * @param event - The event name. * @param listener - Called when the `certificate-error` event is emitted. * @returns This web contents instance. */ addListener(event: "certificate-error", listener: (event: ElectronEvent, url: string, error: string, certificate: ElectronCertificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void): this; /** * Registers a listener for the `console-message` event. * * @param event - The event name. * @param listener - Called when the `console-message` event is emitted. * @returns This web contents instance. */ addListener(event: "console-message", listener: (event: ElectronEvent, level: number, message: string, line: number, sourceId: string) => void): this; /** * Registers a listener for the `context-menu` event. * * @param event - The event name. * @param listener - Called when the `context-menu` event is emitted. * @returns This web contents instance. */ addListener(event: "context-menu", listener: (event: ElectronEvent, params: ElectronContextMenuParams) => void): this; /** * Registers a listener for the `crashed` event. * * @param event - The event name. * @param listener - Called when the `crashed` event is emitted. * @returns This web contents instance. */ addListener(event: "crashed", listener: (event: ElectronEvent, killed: boolean) => void): this; /** * Registers a listener for the `cursor-changed` event. * * @param event - The event name. * @param listener - Called when the `cursor-changed` event is emitted. * @returns This web contents instance. */ addListener(event: "cursor-changed", listener: (event: ElectronEvent, type: string, image: ElectronNativeImage, scale: number, size: ElectronSize, hotspot: ElectronPoint) => void): this; /** * Registers a listener for the `destroyed` event. * * @param event - The event name. * @param listener - Called when the `destroyed` event is emitted. * @returns This web contents instance. */ addListener(event: "destroyed", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `devtools-closed` event. * * @param event - The event name. * @param listener - Called when the `devtools-closed` event is emitted. * @returns This web contents instance. */ addListener(event: "devtools-closed", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `devtools-focused` event. * * @param event - The event name. * @param listener - Called when the `devtools-focused` event is emitted. * @returns This web contents instance. */ addListener(event: "devtools-focused", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `devtools-opened` event. * * @param event - The event name. * @param listener - Called when the `devtools-opened` event is emitted. * @returns This web contents instance. */ addListener(event: "devtools-opened", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `devtools-reload-page` event. * * @param event - The event name. * @param listener - Called when the `devtools-reload-page` event is emitted. * @returns This web contents instance. */ addListener(event: "devtools-reload-page", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `did-attach-webview` event. * * @param event - The event name. * @param listener - Called when the `did-attach-webview` event is emitted. * @returns This web contents instance. */ addListener(event: "did-attach-webview", listener: (event: ElectronEvent, webContents: ElectronWebContents) => void): this; /** * Registers a listener for the `did-change-theme-color` event. * * @param event - The event name. * @param listener - Called when the `did-change-theme-color` event is emitted. * @returns This web contents instance. */ addListener(event: "did-change-theme-color", listener: (event: ElectronEvent, color: null | string) => void): this; /** * Registers a listener for the `did-create-window` event. * * @param event - The event name. * @param listener - Called when the `did-create-window` event is emitted. * @returns This web contents instance. */ addListener(event: "did-create-window", listener: (window: ElectronBrowserWindow, details: ElectronDidCreateWindowDetails) => void): this; /** * Registers a listener for the `did-fail-load` event. * * @param event - The event name. * @param listener - Called when the `did-fail-load` event is emitted. * @returns This web contents instance. */ addListener(event: "did-fail-load", listener: (event: ElectronEvent, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-fail-provisional-load` event. * * @param event - The event name. * @param listener - Called when the `did-fail-provisional-load` event is emitted. * @returns This web contents instance. */ addListener(event: "did-fail-provisional-load", listener: (event: ElectronEvent, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-finish-load` event. * * @param event - The event name. * @param listener - Called when the `did-finish-load` event is emitted. * @returns This web contents instance. */ addListener(event: "did-finish-load", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `did-frame-finish-load` event. * * @param event - The event name. * @param listener - Called when the `did-frame-finish-load` event is emitted. * @returns This web contents instance. */ addListener(event: "did-frame-finish-load", listener: (event: ElectronEvent, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-frame-navigate` event. * * @param event - The event name. * @param listener - Called when the `did-frame-navigate` event is emitted. * @returns This web contents instance. */ addListener(event: "did-frame-navigate", listener: (event: ElectronEvent, url: string, httpResponseCode: number, httpStatusText: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-navigate` event. * * @param event - The event name. * @param listener - Called when the `did-navigate` event is emitted. * @returns This web contents instance. */ addListener(event: "did-navigate", listener: (event: ElectronEvent, url: string, httpResponseCode: number, httpStatusText: string) => void): this; /** * Registers a listener for the `did-navigate-in-page` event. * * @param event - The event name. * @param listener - Called when the `did-navigate-in-page` event is emitted. * @returns This web contents instance. */ addListener(event: "did-navigate-in-page", listener: (event: ElectronEvent, url: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-redirect-navigation` event. * * @param event - The event name. * @param listener - Called when the `did-redirect-navigation` event is emitted. * @returns This web contents instance. */ addListener(event: "did-redirect-navigation", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-start-loading` event. * * @param event - The event name. * @param listener - Called when the `did-start-loading` event is emitted. * @returns This web contents instance. */ addListener(event: "did-start-loading", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `did-start-navigation` event. * * @param event - The event name. * @param listener - Called when the `did-start-navigation` event is emitted. * @returns This web contents instance. */ addListener(event: "did-start-navigation", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-stop-loading` event. * * @param event - The event name. * @param listener - Called when the `did-stop-loading` event is emitted. * @returns This web contents instance. */ addListener(event: "did-stop-loading", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `dom-ready` event. * * @param event - The event name. * @param listener - Called when the `dom-ready` event is emitted. * @returns This web contents instance. */ addListener(event: "dom-ready", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `enter-html-full-screen` event. * * @param event - The event name. * @param listener - Called when the `enter-html-full-screen` event is emitted. * @returns This web contents instance. */ addListener(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `focus` event. * * @param event - The event name. * @param listener - Called when the `focus` event is emitted. * @returns This web contents instance. */ addListener(event: "focus", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `found-in-page` event. * * @param event - The event name. * @param listener - Called when the `found-in-page` event is emitted. * @returns This web contents instance. */ addListener(event: "found-in-page", listener: (event: ElectronEvent, result: ElectronResult) => void): this; /** * Registers a listener for the `frame-created` event. * * @param event - The event name. * @param listener - Called when the `frame-created` event is emitted. * @returns This web contents instance. */ addListener(event: "frame-created", listener: (event: ElectronEvent, details: ElectronFrameCreatedDetails) => void): this; /** * Registers a listener for the `ipc-message` event. * * @param event - The event name. * @param listener - Called when the `ipc-message` event is emitted. * @returns This web contents instance. */ addListener(event: "ipc-message", listener: (event: ElectronEvent, channel: string, ...args: unknown[]) => void): this; /** * Registers a listener for the `ipc-message-sync` event. * * @param event - The event name. * @param listener - Called when the `ipc-message-sync` event is emitted. * @returns This web contents instance. */ addListener(event: "ipc-message-sync", listener: (event: ElectronEvent, channel: string, ...args: unknown[]) => void): this; /** * Registers a listener for the `leave-html-full-screen` event. * * @param event - The event name. * @param listener - Called when the `leave-html-full-screen` event is emitted. * @returns This web contents instance. */ addListener(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `login` event. * * @param event - The event name. * @param listener - Called when the `login` event is emitted. * @returns This web contents instance. */ addListener(event: "login", listener: (event: ElectronEvent, authenticationResponseDetails: ElectronAuthenticationResponseDetails, authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** * Registers a listener for the `media-paused` event. * * @param event - The event name. * @param listener - Called when the `media-paused` event is emitted. * @returns This web contents instance. */ addListener(event: "media-paused", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `media-started-playing` event. * * @param event - The event name. * @param listener - Called when the `media-started-playing` event is emitted. * @returns This web contents instance. */ addListener(event: "media-started-playing", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `new-window` event. * * @param event - The event name. * @param listener - Called when the `new-window` event is emitted. * @returns This web contents instance. */ addListener(event: "new-window", listener: (event: ElectronNewWindowWebContentsEvent, url: string, frameName: string, disposition: "background-tab" | "default" | "foreground-tab" | "new-window" | "other" | "save-to-disk", options: BrowserWindowConstructorOptions, additionalFeatures: string[], referrer: ElectronReferrer, postBody: ElectronPostBody) => void): this; /** * Registers a listener for the `page-favicon-updated` event. * * @param event - The event name. * @param listener - Called when the `page-favicon-updated` event is emitted. * @returns This web contents instance. */ addListener(event: "page-favicon-updated", listener: (event: ElectronEvent, favicons: string[]) => void): this; /** * Registers a listener for the `page-title-updated` event. * * @param event - The event name. * @param listener - Called when the `page-title-updated` event is emitted. * @returns This web contents instance. */ addListener(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this; /** * Registers a listener for the `paint` event. * * @param event - The event name. * @param listener - Called when the `paint` event is emitted. * @returns This web contents instance. */ addListener(event: "paint", listener: (event: ElectronEvent, dirtyRect: ElectronRectangle, image: ElectronNativeImage) => void): this; /** * Registers a listener for the `plugin-crashed` event. * * @param event - The event name. * @param listener - Called when the `plugin-crashed` event is emitted. * @returns This web contents instance. */ addListener(event: "plugin-crashed", listener: (event: ElectronEvent, name: string, version: string) => void): this; /** * Registers a listener for the `preferred-size-changed` event. * * @param event - The event name. * @param listener - Called when the `preferred-size-changed` event is emitted. * @returns This web contents instance. */ addListener(event: "preferred-size-changed", listener: (event: ElectronEvent, preferredSize: ElectronSize) => void): this; /** * Registers a listener for the `preload-error` event. * * @param event - The event name. * @param listener - Called when the `preload-error` event is emitted. * @returns This web contents instance. */ addListener(event: "preload-error", listener: (event: ElectronEvent, preloadPath: string, error: Error) => void): this; /** * Registers a listener for the `render-process-gone` event. * * @param event - The event name. * @param listener - Called when the `render-process-gone` event is emitted. * @returns This web contents instance. */ addListener(event: "render-process-gone", listener: (event: ElectronEvent, details: ElectronRenderProcessGoneDetails) => void): this; /** * Registers a listener for the `responsive` event. * * @param event - The event name. * @param listener - Called when the `responsive` event is emitted. * @returns This web contents instance. */ addListener(event: "responsive", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `select-bluetooth-device` event. * * @param event - The event name. * @param listener - Called when the `select-bluetooth-device` event is emitted. * @returns This web contents instance. */ addListener(event: "select-bluetooth-device", listener: (event: ElectronEvent, devices: ElectronBluetoothDevice[], callback: (deviceId: string) => void) => void): this; /** * Registers a listener for the `select-client-certificate` event. * * @param event - The event name. * @param listener - Called when the `select-client-certificate` event is emitted. * @returns This web contents instance. */ addListener(event: "select-client-certificate", listener: (event: ElectronEvent, url: string, certificateList: ElectronCertificate[], callback: (certificate: ElectronCertificate) => void) => void): this; /** * Registers a listener for the `unresponsive` event. * * @param event - The event name. * @param listener - Called when the `unresponsive` event is emitted. * @returns This web contents instance. */ addListener(event: "unresponsive", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `update-target-url` event. * * @param event - The event name. * @param listener - Called when the `update-target-url` event is emitted. * @returns This web contents instance. */ addListener(event: "update-target-url", listener: (event: ElectronEvent, url: string) => void): this; /** * Registers a listener for the `will-attach-webview` event. * * @param event - The event name. * @param listener - Called when the `will-attach-webview` event is emitted. * @returns This web contents instance. */ addListener(event: "will-attach-webview", listener: (event: ElectronEvent, webPreferences: WebPreferences, params: Record<string, string>) => void): this; /** * Registers a listener for the `will-navigate` event. * * @param event - The event name. * @param listener - Called when the `will-navigate` event is emitted. * @returns This web contents instance. */ addListener(event: "will-navigate", listener: (event: ElectronEvent, url: string) => void): this; /** * Registers a listener for the `will-prevent-unload` event. * * @param event - The event name. * @param listener - Called when the `will-prevent-unload` event is emitted. * @returns This web contents instance. */ addListener(event: "will-prevent-unload", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `will-redirect` event. * * @param event - The event name. * @param listener - Called when the `will-redirect` event is emitted. * @returns This web contents instance. */ addListener(event: "will-redirect", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `zoom-changed` event. * * @param event - The event name. * @param listener - Called when the `zoom-changed` event is emitted. * @returns This web contents instance. */ addListener(event: "zoom-changed", listener: (event: ElectronEvent, zoomDirection: "in" | "out") => void): this; /** * Adds the specified path to the DevTools workspace. * * @param path - The path to add. */ addWorkSpace(path: string): void; /** * Begins subscribing for presentation events and captured frames. * * @param onlyDirty - Whether the captured image should contain only the repainted area. * @param callback - Called with the captured frame image and the repainted rect. */ beginFrameSubscription(onlyDirty: boolean, callback: (image: ElectronNativeImage, dirtyRect: ElectronRectangle) => void): void; /** * Begins subscribing for presentation events and captured frames. * * @param callback - Called with the captured frame image and the repainted rect. */ beginFrameSubscription(callback: (image: ElectronNativeImage, dirtyRect: ElectronRectangle) => void): void; /** * Returns whether the browser can go back to the previous web page. * * @returns Whether the browser can go back. */ canGoBack(): boolean; /** * Returns whether the browser can go forward to the next web page. * * @returns Whether the browser can go forward. */ canGoForward(): boolean; /** * Returns whether the web page can go to the given offset. * * @param offset - The offset from the current entry. * @returns Whether the web page can go to the offset. */ canGoToOffset(offset: number): boolean; /** * Captures a snapshot of the page within `rect`. Omitting `rect` captures the whole visible page. * * @param rect - The area of the page to capture. * @returns A promise resolving with a native image. */ capturePage(rect?: ElectronRectangle): Promise<ElectronNativeImage>; /** Clears the navigation history. */ clearHistory(): void; /** Closes the developer tools. */ closeDevTools(): void; /** Executes the editing command `copy` in the web page. */ copy(): void; /** * Copies the image at the given position to the clipboard. * * @param x - The x coordinate. * @param y - The y coordinate. */ copyImageAt(x: number, y: number): void; /** Executes the editing command `cut` in the web page. */ cut(): void; /** * Decreases the capturer count by one. * * @param stayHidden - Whether to decrease the hidden capturer count instead. * @param stayAwake - Whether the page should stay awake. */ decrementCapturerCount(stayHidden?: boolean, stayAwake?: boolean): void; /** Executes the editing command `delete` in the web page. */ delete(): void; /** Disables device emulation enabled by `enableDeviceEmulation`. */ disableDeviceEmulation(): void; /** * Initiates a download of the resource at `url` without navigating. * * @param url - The URL of the resource to download. */ downloadURL(url: string): void; /** * Enables device emulation with the given parameters. * * @param parameters - The device emulation parameters. */ enableDeviceEmulation(parameters: ElectronParameters): void; /** Ends subscribing for frame presentation events. */ endFrameSubscription(): void; /** * Evaluates `code` in the page. * * @param code - The JavaScript code to execute. * @param userGesture - Whether the execution should be treated as a user gesture. * @returns A promise resolving with the result of the executed code. */ executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>; /** * Works like `executeJavaScript` but evaluates `scripts` in an isolated context. * * @param worldId - The id of the isolated world. * @param scripts - The scripts to evaluate. * @param userGesture - Whether the execution should be treated as a user gesture. * @returns A promise resolving with the result of the executed code. */ executeJavaScriptInIsolatedWorld(worldId: number, scripts: ElectronWebSource[], userGesture?: boolean): Promise<unknown>; /** * Starts a request to find all matches for `text` in the web page. * * @param text - The text to search for. * @param options - Options for the find request. * @returns The request id used for the request. */ findInPage(text: string, options?: ElectronFindInPageOptions): number; /** Focuses the web page. */ focus(): void; /** Forcefully terminates the renderer process currently hosting this web contents. */ forcefullyCrashRenderer(): void; /** * Returns information about all shared workers. * * @returns Information about all shared workers. */ getAllSharedWorkers(): ElectronSharedWorkerInfo[]; /** * Returns whether this web contents throttles animations and timers when backgrounded. * * @returns Whether background throttling is enabled. */ getBackgroundThrottling(): boolean; /** * Returns the current frame rate when offscreen rendering is enabled. * * @returns The current frame rate. */ getFrameRate(): number; /** * Returns the identifier of a web contents stream. * * @param requestWebContents - The web contents that would access the stream. * @returns The identifier of the web contents stream. */ getMediaSourceId(requestWebContents: ElectronWebContents): string; /** * Returns the operating system `pid` of the associated renderer process. * * @returns The operating system process id. */ getOSProcessId(): number; /** * Returns the system printer list. * * @returns The system printer list. */ getPrinters(): ElectronPrinterInfo[]; /** * Returns the system printer list. * * @returns A promise resolving with the system printer list. */ getPrintersAsync(): Promise<ElectronPrinterInfo[]>; /** * Returns the Chromium internal `pid` of the associated renderer. * * @returns The Chromium internal process id. */ getProcessId(): number; /** * Returns the title of the current web page. * * @returns The page title. */ getTitle(): string; /** * Returns the type of the web contents. * * @returns The type of the web contents. */ getType(): "backgroundPage" | "browserView" | "offscreen" | "remote" | "webview" | "window"; /** * Returns the URL of the current web page. * * @returns The current URL. */ getURL(): string; /** * Returns the user agent for this web page. * * @returns The user agent string. */ getUserAgent(): string; /** * Returns the WebRTC IP handling policy. * * @returns The WebRTC IP handling policy. */ getWebRTCIPHandlingPolicy(): string; /** * Returns the current zoom factor. * * @returns The current zoom factor. */ getZoomFactor(): number; /** * Returns the current zoom level. * * @returns The current zoom level. */ getZoomLevel(): number; /** Makes the browser go back a web page. */ goBack(): void; /** Makes the browser go forward a web page. */ goForward(): void; /** * Navigates the browser to the specified absolute web page index. * * @param index - The absolute web page index. */ goToIndex(index: number): void; /** * Navigates to the specified offset from the current entry. * * @param offset - The offset from the current entry. */ goToOffset(offset: number): void; /** * Increases the capturer count by one. * * @param size - The preferred size for the captured page. * @param stayHidden - Whether the page should stay hidden. * @param stayAwake - Whether the page should stay awake. */ incrementCapturerCount(size?: ElectronSize, stayHidden?: boolean, stayAwake?: boolean): void; /** * Injects CSS into the current web page and returns a unique key for the inserted stylesheet. * * @param css - The CSS to inject. * @param options - Options for inserting the CSS. * @returns A promise resolving with the key for the inserted CSS. */ insertCSS(css: string, options?: ElectronInsertCSSOptions): Promise<string>; /** * Inserts `text` into the focused element. * * @param text - The text to insert. * @returns A promise that resolves when the text is inserted. */ insertText(text: string): Promise<void>; /** * Starts inspecting the element at the given position. * * @param x - The x coordinate. * @param y - The y coordinate. */ inspectElement(x: number, y: number): void; /** Opens the developer tools for the service worker context. */ inspectServiceWorker(): void; /** Opens the developer tools for the shared worker context. */ inspectSharedWorker(): void; /** * Inspects the shared worker based on its id. * * @param workerId - The id of the shared worker. */ inspectSharedWorkerById(workerId: string): void; /** Schedules a full repaint of the window this web contents is in. */ invalidate(): void; /** * Returns whether this page has been muted. * * @returns Whether the page is muted. */ isAudioMuted(): boolean; /** * Returns whether this page is being captured. * * @returns Whether the page is being captured. */ isBeingCaptured(): boolean; /** * Returns whether the renderer process has crashed. * * @returns Whether the renderer process has crashed. */ isCrashed(): boolean; /** * Returns whether audio is currently playing. * * @returns Whether audio is currently playing. */ isCurrentlyAudible(): boolean; /** * Returns whether the web page is destroyed. * * @returns Whether the web page is destroyed. */ isDestroyed(): boolean; /** * Returns whether the DevTools view is focused. * * @returns Whether the DevTools view is focused. */ isDevToolsFocused(): boolean; /** * Returns whether the DevTools is opened. * * @returns Whether the DevTools is opened. */ isDevToolsOpened(): boolean; /** * Returns whether the web page is focused. * * @returns Whether the web page is focused. */ isFocused(): boolean; /** * Returns whether the web page is still loading resources. * * @returns Whether the page is loading. */ isLoading(): boolean; /** * Returns whether the main frame is still loading. * * @returns Whether the main frame is loading. */ isLoadingMainFrame(): boolean; /** * Returns whether offscreen rendering is enabled. * * @returns Whether offscreen rendering is enabled. */ isOffscreen(): boolean; /** * Returns whether it is currently painting when offscreen rendering is enabled. * * @returns Whether it is currently painting. */ isPainting(): boolean; /** * Returns whether the web page is waiting for a first response from the main resource. * * @returns Whether the page is waiting for a response. */ isWaitingForResponse(): boolean; /** * Loads the given file in the window. * * @param filePath - The path to the HTML file relative to the root of the application. * @param options - Options for loading the file. * @returns A promise that resolves when the page has finished loading. */ loadFile(filePath: string, options?: ElectronBrowserWindowLoadFileOptions): Promise<void>; /** * Loads the `url` in the window. * * @param url - The URL to load. Must contain the protocol prefix. * @param options - Options for loading the URL. * @returns A promise that resolves when the page has finished loading. */ loadURL(url: string, options?: ElectronBrowserWindowLoadURLOptions): Promise<void>; /** * Registers a listener for the `before-input-event` event. * * @param event - The event name. * @param listener - Called when the `before-input-event` event is emitted. * @returns This web contents instance. */ on(event: "before-input-event", listener: (event: ElectronEvent, input: ElectronInput) => void): this; /** * Registers a listener for the `blur` event. * * @param event - The event name. * @param listener - Called when the `blur` event is emitted. * @returns This web contents instance. */ on(event: "blur", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `certificate-error` event. * * @param event - The event name. * @param listener - Called when the `certificate-error` event is emitted. * @returns This web contents instance. */ on(event: "certificate-error", listener: (event: ElectronEvent, url: string, error: string, certificate: ElectronCertificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void): this; /** * Registers a listener for the `console-message` event. * * @param event - The event name. * @param listener - Called when the `console-message` event is emitted. * @returns This web contents instance. */ on(event: "console-message", listener: (event: ElectronEvent, level: number, message: string, line: number, sourceId: string) => void): this; /** * Registers a listener for the `context-menu` event. * * @param event - The event name. * @param listener - Called when the `context-menu` event is emitted. * @returns This web contents instance. */ on(event: "context-menu", listener: (event: ElectronEvent, params: ElectronContextMenuParams) => void): this; /** * Registers a listener for the `crashed` event. * * @param event - The event name. * @param listener - Called when the `crashed` event is emitted. * @returns This web contents instance. */ on(event: "crashed", listener: (event: ElectronEvent, killed: boolean) => void): this; /** * Registers a listener for the `cursor-changed` event. * * @param event - The event name. * @param listener - Called when the `cursor-changed` event is emitted. * @returns This web contents instance. */ on(event: "cursor-changed", listener: (event: ElectronEvent, type: string, image: ElectronNativeImage, scale: number, size: ElectronSize, hotspot: ElectronPoint) => void): this; /** * Registers a listener for the `destroyed` event. * * @param event - The event name. * @param listener - Called when the `destroyed` event is emitted. * @returns This web contents instance. */ on(event: "destroyed", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `devtools-closed` event. * * @param event - The event name. * @param listener - Called when the `devtools-closed` event is emitted. * @returns This web contents instance. */ on(event: "devtools-closed", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `devtools-focused` event. * * @param event - The event name. * @param listener - Called when the `devtools-focused` event is emitted. * @returns This web contents instance. */ on(event: "devtools-focused", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `devtools-opened` event. * * @param event - The event name. * @param listener - Called when the `devtools-opened` event is emitted. * @returns This web contents instance. */ on(event: "devtools-opened", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `devtools-reload-page` event. * * @param event - The event name. * @param listener - Called when the `devtools-reload-page` event is emitted. * @returns This web contents instance. */ on(event: "devtools-reload-page", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `did-attach-webview` event. * * @param event - The event name. * @param listener - Called when the `did-attach-webview` event is emitted. * @returns This web contents instance. */ on(event: "did-attach-webview", listener: (event: ElectronEvent, webContents: ElectronWebContents) => void): this; /** * Registers a listener for the `did-change-theme-color` event. * * @param event - The event name. * @param listener - Called when the `did-change-theme-color` event is emitted. * @returns This web contents instance. */ on(event: "did-change-theme-color", listener: (event: ElectronEvent, color: null | string) => void): this; /** * Registers a listener for the `did-create-window` event. * * @param event - The event name. * @param listener - Called when the `did-create-window` event is emitted. * @returns This web contents instance. */ on(event: "did-create-window", listener: (window: ElectronBrowserWindow, details: ElectronDidCreateWindowDetails) => void): this; /** * Registers a listener for the `did-fail-load` event. * * @param event - The event name. * @param listener - Called when the `did-fail-load` event is emitted. * @returns This web contents instance. */ on(event: "did-fail-load", listener: (event: ElectronEvent, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-fail-provisional-load` event. * * @param event - The event name. * @param listener - Called when the `did-fail-provisional-load` event is emitted. * @returns This web contents instance. */ on(event: "did-fail-provisional-load", listener: (event: ElectronEvent, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-finish-load` event. * * @param event - The event name. * @param listener - Called when the `did-finish-load` event is emitted. * @returns This web contents instance. */ on(event: "did-finish-load", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `did-frame-finish-load` event. * * @param event - The event name. * @param listener - Called when the `did-frame-finish-load` event is emitted. * @returns This web contents instance. */ on(event: "did-frame-finish-load", listener: (event: ElectronEvent, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-frame-navigate` event. * * @param event - The event name. * @param listener - Called when the `did-frame-navigate` event is emitted. * @returns This web contents instance. */ on(event: "did-frame-navigate", listener: (event: ElectronEvent, url: string, httpResponseCode: number, httpStatusText: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-navigate` event. * * @param event - The event name. * @param listener - Called when the `did-navigate` event is emitted. * @returns This web contents instance. */ on(event: "did-navigate", listener: (event: ElectronEvent, url: string, httpResponseCode: number, httpStatusText: string) => void): this; /** * Registers a listener for the `did-navigate-in-page` event. * * @param event - The event name. * @param listener - Called when the `did-navigate-in-page` event is emitted. * @returns This web contents instance. */ on(event: "did-navigate-in-page", listener: (event: ElectronEvent, url: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-redirect-navigation` event. * * @param event - The event name. * @param listener - Called when the `did-redirect-navigation` event is emitted. * @returns This web contents instance. */ on(event: "did-redirect-navigation", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-start-loading` event. * * @param event - The event name. * @param listener - Called when the `did-start-loading` event is emitted. * @returns This web contents instance. */ on(event: "did-start-loading", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `did-start-navigation` event. * * @param event - The event name. * @param listener - Called when the `did-start-navigation` event is emitted. * @returns This web contents instance. */ on(event: "did-start-navigation", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `did-stop-loading` event. * * @param event - The event name. * @param listener - Called when the `did-stop-loading` event is emitted. * @returns This web contents instance. */ on(event: "did-stop-loading", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `dom-ready` event. * * @param event - The event name. * @param listener - Called when the `dom-ready` event is emitted. * @returns This web contents instance. */ on(event: "dom-ready", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `enter-html-full-screen` event. * * @param event - The event name. * @param listener - Called when the `enter-html-full-screen` event is emitted. * @returns This web contents instance. */ on(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `focus` event. * * @param event - The event name. * @param listener - Called when the `focus` event is emitted. * @returns This web contents instance. */ on(event: "focus", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `found-in-page` event. * * @param event - The event name. * @param listener - Called when the `found-in-page` event is emitted. * @returns This web contents instance. */ on(event: "found-in-page", listener: (event: ElectronEvent, result: ElectronResult) => void): this; /** * Registers a listener for the `frame-created` event. * * @param event - The event name. * @param listener - Called when the `frame-created` event is emitted. * @returns This web contents instance. */ on(event: "frame-created", listener: (event: ElectronEvent, details: ElectronFrameCreatedDetails) => void): this; /** * Registers a listener for the `ipc-message` event. * * @param event - The event name. * @param listener - Called when the `ipc-message` event is emitted. * @returns This web contents instance. */ on(event: "ipc-message", listener: (event: ElectronEvent, channel: string, ...args: unknown[]) => void): this; /** * Registers a listener for the `ipc-message-sync` event. * * @param event - The event name. * @param listener - Called when the `ipc-message-sync` event is emitted. * @returns This web contents instance. */ on(event: "ipc-message-sync", listener: (event: ElectronEvent, channel: string, ...args: unknown[]) => void): this; /** * Registers a listener for the `leave-html-full-screen` event. * * @param event - The event name. * @param listener - Called when the `leave-html-full-screen` event is emitted. * @returns This web contents instance. */ on(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `login` event. * * @param event - The event name. * @param listener - Called when the `login` event is emitted. * @returns This web contents instance. */ on(event: "login", listener: (event: ElectronEvent, authenticationResponseDetails: ElectronAuthenticationResponseDetails, authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** * Registers a listener for the `media-paused` event. * * @param event - The event name. * @param listener - Called when the `media-paused` event is emitted. * @returns This web contents instance. */ on(event: "media-paused", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `media-started-playing` event. * * @param event - The event name. * @param listener - Called when the `media-started-playing` event is emitted. * @returns This web contents instance. */ on(event: "media-started-playing", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `new-window` event. * * @param event - The event name. * @param listener - Called when the `new-window` event is emitted. * @returns This web contents instance. */ on(event: "new-window", listener: (event: ElectronNewWindowWebContentsEvent, url: string, frameName: string, disposition: "background-tab" | "default" | "foreground-tab" | "new-window" | "other" | "save-to-disk", options: BrowserWindowConstructorOptions, additionalFeatures: string[], referrer: ElectronReferrer, postBody: ElectronPostBody) => void): this; /** * Registers a listener for the `page-favicon-updated` event. * * @param event - The event name. * @param listener - Called when the `page-favicon-updated` event is emitted. * @returns This web contents instance. */ on(event: "page-favicon-updated", listener: (event: ElectronEvent, favicons: string[]) => void): this; /** * Registers a listener for the `page-title-updated` event. * * @param event - The event name. * @param listener - Called when the `page-title-updated` event is emitted. * @returns This web contents instance. */ on(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this; /** * Registers a listener for the `paint` event. * * @param event - The event name. * @param listener - Called when the `paint` event is emitted. * @returns This web contents instance. */ on(event: "paint", listener: (event: ElectronEvent, dirtyRect: ElectronRectangle, image: ElectronNativeImage) => void): this; /** * Registers a listener for the `plugin-crashed` event. * * @param event - The event name. * @param listener - Called when the `plugin-crashed` event is emitted. * @returns This web contents instance. */ on(event: "plugin-crashed", listener: (event: ElectronEvent, name: string, version: string) => void): this; /** * Registers a listener for the `preferred-size-changed` event. * * @param event - The event name. * @param listener - Called when the `preferred-size-changed` event is emitted. * @returns This web contents instance. */ on(event: "preferred-size-changed", listener: (event: ElectronEvent, preferredSize: ElectronSize) => void): this; /** * Registers a listener for the `preload-error` event. * * @param event - The event name. * @param listener - Called when the `preload-error` event is emitted. * @returns This web contents instance. */ on(event: "preload-error", listener: (event: ElectronEvent, preloadPath: string, error: Error) => void): this; /** * Registers a listener for the `render-process-gone` event. * * @param event - The event name. * @param listener - Called when the `render-process-gone` event is emitted. * @returns This web contents instance. */ on(event: "render-process-gone", listener: (event: ElectronEvent, details: ElectronRenderProcessGoneDetails) => void): this; /** * Registers a listener for the `responsive` event. * * @param event - The event name. * @param listener - Called when the `responsive` event is emitted. * @returns This web contents instance. */ on(event: "responsive", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `select-bluetooth-device` event. * * @param event - The event name. * @param listener - Called when the `select-bluetooth-device` event is emitted. * @returns This web contents instance. */ on(event: "select-bluetooth-device", listener: (event: ElectronEvent, devices: ElectronBluetoothDevice[], callback: (deviceId: string) => void) => void): this; /** * Registers a listener for the `select-client-certificate` event. * * @param event - The event name. * @param listener - Called when the `select-client-certificate` event is emitted. * @returns This web contents instance. */ on(event: "select-client-certificate", listener: (event: ElectronEvent, url: string, certificateList: ElectronCertificate[], callback: (certificate: ElectronCertificate) => void) => void): this; /** * Registers a listener for the `unresponsive` event. * * @param event - The event name. * @param listener - Called when the `unresponsive` event is emitted. * @returns This web contents instance. */ on(event: "unresponsive", listener: (...args: unknown[]) => void): this; /** * Registers a listener for the `update-target-url` event. * * @param event - The event name. * @param listener - Called when the `update-target-url` event is emitted. * @returns This web contents instance. */ on(event: "update-target-url", listener: (event: ElectronEvent, url: string) => void): this; /** * Registers a listener for the `will-attach-webview` event. * * @param event - The event name. * @param listener - Called when the `will-attach-webview` event is emitted. * @returns This web contents instance. */ on(event: "will-attach-webview", listener: (event: ElectronEvent, webPreferences: WebPreferences, params: Record<string, string>) => void): this; /** * Registers a listener for the `will-navigate` event. * * @param event - The event name. * @param listener - Called when the `will-navigate` event is emitted. * @returns This web contents instance. */ on(event: "will-navigate", listener: (event: ElectronEvent, url: string) => void): this; /** * Registers a listener for the `will-prevent-unload` event. * * @param event - The event name. * @param listener - Called when the `will-prevent-unload` event is emitted. * @returns This web contents instance. */ on(event: "will-prevent-unload", listener: (event: ElectronEvent) => void): this; /** * Registers a listener for the `will-redirect` event. * * @param event - The event name. * @param listener - Called when the `will-redirect` event is emitted. * @returns This web contents instance. */ on(event: "will-redirect", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a listener for the `zoom-changed` event. * * @param event - The event name. * @param listener - Called when the `zoom-changed` event is emitted. * @returns This web contents instance. */ on(event: "zoom-changed", listener: (event: ElectronEvent, zoomDirection: "in" | "out") => void): this; /** * Registers a one-time listener for the `before-input-event` event. * * @param event - The event name. * @param listener - Called when the `before-input-event` event is emitted. * @returns This web contents instance. */ once(event: "before-input-event", listener: (event: ElectronEvent, input: ElectronInput) => void): this; /** * Registers a one-time listener for the `blur` event. * * @param event - The event name. * @param listener - Called when the `blur` event is emitted. * @returns This web contents instance. */ once(event: "blur", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `certificate-error` event. * * @param event - The event name. * @param listener - Called when the `certificate-error` event is emitted. * @returns This web contents instance. */ once(event: "certificate-error", listener: (event: ElectronEvent, url: string, error: string, certificate: ElectronCertificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void): this; /** * Registers a one-time listener for the `console-message` event. * * @param event - The event name. * @param listener - Called when the `console-message` event is emitted. * @returns This web contents instance. */ once(event: "console-message", listener: (event: ElectronEvent, level: number, message: string, line: number, sourceId: string) => void): this; /** * Registers a one-time listener for the `context-menu` event. * * @param event - The event name. * @param listener - Called when the `context-menu` event is emitted. * @returns This web contents instance. */ once(event: "context-menu", listener: (event: ElectronEvent, params: ElectronContextMenuParams) => void): this; /** * Registers a one-time listener for the `crashed` event. * * @param event - The event name. * @param listener - Called when the `crashed` event is emitted. * @returns This web contents instance. */ once(event: "crashed", listener: (event: ElectronEvent, killed: boolean) => void): this; /** * Registers a one-time listener for the `cursor-changed` event. * * @param event - The event name. * @param listener - Called when the `cursor-changed` event is emitted. * @returns This web contents instance. */ once(event: "cursor-changed", listener: (event: ElectronEvent, type: string, image: ElectronNativeImage, scale: number, size: ElectronSize, hotspot: ElectronPoint) => void): this; /** * Registers a one-time listener for the `destroyed` event. * * @param event - The event name. * @param listener - Called when the `destroyed` event is emitted. * @returns This web contents instance. */ once(event: "destroyed", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `devtools-closed` event. * * @param event - The event name. * @param listener - Called when the `devtools-closed` event is emitted. * @returns This web contents instance. */ once(event: "devtools-closed", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `devtools-focused` event. * * @param event - The event name. * @param listener - Called when the `devtools-focused` event is emitted. * @returns This web contents instance. */ once(event: "devtools-focused", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `devtools-opened` event. * * @param event - The event name. * @param listener - Called when the `devtools-opened` event is emitted. * @returns This web contents instance. */ once(event: "devtools-opened", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `devtools-reload-page` event. * * @param event - The event name. * @param listener - Called when the `devtools-reload-page` event is emitted. * @returns This web contents instance. */ once(event: "devtools-reload-page", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `did-attach-webview` event. * * @param event - The event name. * @param listener - Called when the `did-attach-webview` event is emitted. * @returns This web contents instance. */ once(event: "did-attach-webview", listener: (event: ElectronEvent, webContents: ElectronWebContents) => void): this; /** * Registers a one-time listener for the `did-change-theme-color` event. * * @param event - The event name. * @param listener - Called when the `did-change-theme-color` event is emitted. * @returns This web contents instance. */ once(event: "did-change-theme-color", listener: (event: ElectronEvent, color: null | string) => void): this; /** * Registers a one-time listener for the `did-create-window` event. * * @param event - The event name. * @param listener - Called when the `did-create-window` event is emitted. * @returns This web contents instance. */ once(event: "did-create-window", listener: (window: ElectronBrowserWindow, details: ElectronDidCreateWindowDetails) => void): this; /** * Registers a one-time listener for the `did-fail-load` event. * * @param event - The event name. * @param listener - Called when the `did-fail-load` event is emitted. * @returns This web contents instance. */ once(event: "did-fail-load", listener: (event: ElectronEvent, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a one-time listener for the `did-fail-provisional-load` event. * * @param event - The event name. * @param listener - Called when the `did-fail-provisional-load` event is emitted. * @returns This web contents instance. */ once(event: "did-fail-provisional-load", listener: (event: ElectronEvent, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a one-time listener for the `did-finish-load` event. * * @param event - The event name. * @param listener - Called when the `did-finish-load` event is emitted. * @returns This web contents instance. */ once(event: "did-finish-load", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `did-frame-finish-load` event. * * @param event - The event name. * @param listener - Called when the `did-frame-finish-load` event is emitted. * @returns This web contents instance. */ once(event: "did-frame-finish-load", listener: (event: ElectronEvent, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a one-time listener for the `did-frame-navigate` event. * * @param event - The event name. * @param listener - Called when the `did-frame-navigate` event is emitted. * @returns This web contents instance. */ once(event: "did-frame-navigate", listener: (event: ElectronEvent, url: string, httpResponseCode: number, httpStatusText: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a one-time listener for the `did-navigate` event. * * @param event - The event name. * @param listener - Called when the `did-navigate` event is emitted. * @returns This web contents instance. */ once(event: "did-navigate", listener: (event: ElectronEvent, url: string, httpResponseCode: number, httpStatusText: string) => void): this; /** * Registers a one-time listener for the `did-navigate-in-page` event. * * @param event - The event name. * @param listener - Called when the `did-navigate-in-page` event is emitted. * @returns This web contents instance. */ once(event: "did-navigate-in-page", listener: (event: ElectronEvent, url: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a one-time listener for the `did-redirect-navigation` event. * * @param event - The event name. * @param listener - Called when the `did-redirect-navigation` event is emitted. * @returns This web contents instance. */ once(event: "did-redirect-navigation", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a one-time listener for the `did-start-loading` event. * * @param event - The event name. * @param listener - Called when the `did-start-loading` event is emitted. * @returns This web contents instance. */ once(event: "did-start-loading", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `did-start-navigation` event. * * @param event - The event name. * @param listener - Called when the `did-start-navigation` event is emitted. * @returns This web contents instance. */ once(event: "did-start-navigation", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a one-time listener for the `did-stop-loading` event. * * @param event - The event name. * @param listener - Called when the `did-stop-loading` event is emitted. * @returns This web contents instance. */ once(event: "did-stop-loading", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `dom-ready` event. * * @param event - The event name. * @param listener - Called when the `dom-ready` event is emitted. * @returns This web contents instance. */ once(event: "dom-ready", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time listener for the `enter-html-full-screen` event. * * @param event - The event name. * @param listener - Called when the `enter-html-full-screen` event is emitted. * @returns This web contents instance. */ once(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `focus` event. * * @param event - The event name. * @param listener - Called when the `focus` event is emitted. * @returns This web contents instance. */ once(event: "focus", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `found-in-page` event. * * @param event - The event name. * @param listener - Called when the `found-in-page` event is emitted. * @returns This web contents instance. */ once(event: "found-in-page", listener: (event: ElectronEvent, result: ElectronResult) => void): this; /** * Registers a one-time listener for the `frame-created` event. * * @param event - The event name. * @param listener - Called when the `frame-created` event is emitted. * @returns This web contents instance. */ once(event: "frame-created", listener: (event: ElectronEvent, details: ElectronFrameCreatedDetails) => void): this; /** * Registers a one-time listener for the `ipc-message` event. * * @param event - The event name. * @param listener - Called when the `ipc-message` event is emitted. * @returns This web contents instance. */ once(event: "ipc-message", listener: (event: ElectronEvent, channel: string, ...args: unknown[]) => void): this; /** * Registers a one-time listener for the `ipc-message-sync` event. * * @param event - The event name. * @param listener - Called when the `ipc-message-sync` event is emitted. * @returns This web contents instance. */ once(event: "ipc-message-sync", listener: (event: ElectronEvent, channel: string, ...args: unknown[]) => void): this; /** * Registers a one-time listener for the `leave-html-full-screen` event. * * @param event - The event name. * @param listener - Called when the `leave-html-full-screen` event is emitted. * @returns This web contents instance. */ once(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `login` event. * * @param event - The event name. * @param listener - Called when the `login` event is emitted. * @returns This web contents instance. */ once(event: "login", listener: (event: ElectronEvent, authenticationResponseDetails: ElectronAuthenticationResponseDetails, authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** * Registers a one-time listener for the `media-paused` event. * * @param event - The event name. * @param listener - Called when the `media-paused` event is emitted. * @returns This web contents instance. */ once(event: "media-paused", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `media-started-playing` event. * * @param event - The event name. * @param listener - Called when the `media-started-playing` event is emitted. * @returns This web contents instance. */ once(event: "media-started-playing", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `new-window` event. * * @param event - The event name. * @param listener - Called when the `new-window` event is emitted. * @returns This web contents instance. */ once(event: "new-window", listener: (event: ElectronNewWindowWebContentsEvent, url: string, frameName: string, disposition: "background-tab" | "default" | "foreground-tab" | "new-window" | "other" | "save-to-disk", options: BrowserWindowConstructorOptions, additionalFeatures: string[], referrer: ElectronReferrer, postBody: ElectronPostBody) => void): this; /** * Registers a one-time listener for the `page-favicon-updated` event. * * @param event - The event name. * @param listener - Called when the `page-favicon-updated` event is emitted. * @returns This web contents instance. */ once(event: "page-favicon-updated", listener: (event: ElectronEvent, favicons: string[]) => void): this; /** * Registers a one-time listener for the `page-title-updated` event. * * @param event - The event name. * @param listener - Called when the `page-title-updated` event is emitted. * @returns This web contents instance. */ once(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this; /** * Registers a one-time listener for the `paint` event. * * @param event - The event name. * @param listener - Called when the `paint` event is emitted. * @returns This web contents instance. */ once(event: "paint", listener: (event: ElectronEvent, dirtyRect: ElectronRectangle, image: ElectronNativeImage) => void): this; /** * Registers a one-time listener for the `plugin-crashed` event. * * @param event - The event name. * @param listener - Called when the `plugin-crashed` event is emitted. * @returns This web contents instance. */ once(event: "plugin-crashed", listener: (event: ElectronEvent, name: string, version: string) => void): this; /** * Registers a one-time listener for the `preferred-size-changed` event. * * @param event - The event name. * @param listener - Called when the `preferred-size-changed` event is emitted. * @returns This web contents instance. */ once(event: "preferred-size-changed", listener: (event: ElectronEvent, preferredSize: ElectronSize) => void): this; /** * Registers a one-time listener for the `preload-error` event. * * @param event - The event name. * @param listener - Called when the `preload-error` event is emitted. * @returns This web contents instance. */ once(event: "preload-error", listener: (event: ElectronEvent, preloadPath: string, error: Error) => void): this; /** * Registers a one-time listener for the `render-process-gone` event. * * @param event - The event name. * @param listener - Called when the `render-process-gone` event is emitted. * @returns This web contents instance. */ once(event: "render-process-gone", listener: (event: ElectronEvent, details: ElectronRenderProcessGoneDetails) => void): this; /** * Registers a one-time listener for the `responsive` event. * * @param event - The event name. * @param listener - Called when the `responsive` event is emitted. * @returns This web contents instance. */ once(event: "responsive", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `select-bluetooth-device` event. * * @param event - The event name. * @param listener - Called when the `select-bluetooth-device` event is emitted. * @returns This web contents instance. */ once(event: "select-bluetooth-device", listener: (event: ElectronEvent, devices: ElectronBluetoothDevice[], callback: (deviceId: string) => void) => void): this; /** * Registers a one-time listener for the `select-client-certificate` event. * * @param event - The event name. * @param listener - Called when the `select-client-certificate` event is emitted. * @returns This web contents instance. */ once(event: "select-client-certificate", listener: (event: ElectronEvent, url: string, certificateList: ElectronCertificate[], callback: (certificate: ElectronCertificate) => void) => void): this; /** * Registers a one-time listener for the `unresponsive` event. * * @param event - The event name. * @param listener - Called when the `unresponsive` event is emitted. * @returns This web contents instance. */ once(event: "unresponsive", listener: (...args: unknown[]) => void): this; /** * Registers a one-time listener for the `update-target-url` event. * * @param event - The event name. * @param listener - Called when the `update-target-url` event is emitted. * @returns This web contents instance. */ once(event: "update-target-url", listener: (event: ElectronEvent, url: string) => void): this; /** * Registers a one-time listener for the `will-attach-webview` event. * * @param event - The event name. * @param listener - Called when the `will-attach-webview` event is emitted. * @returns This web contents instance. */ once(event: "will-attach-webview", listener: (event: ElectronEvent, webPreferences: WebPreferences, params: Record<string, string>) => void): this; /** * Registers a one-time listener for the `will-navigate` event. * * @param event - The event name. * @param listener - Called when the `will-navigate` event is emitted. * @returns This web contents instance. */ once(event: "will-navigate", listener: (event: ElectronEvent, url: string) => void): this; /** * Registers a one-time listener for the `will-prevent-unload` event. * * @param event - The event name. * @param listener - Called when the `will-prevent-unload` event is emitted. * @returns This web contents instance. */ once(event: "will-prevent-unload", listener: (event: ElectronEvent) => void): this; /** * Registers a one-time listener for the `will-redirect` event. * * @param event - The event name. * @param listener - Called when the `will-redirect` event is emitted. * @returns This web contents instance. */ once(event: "will-redirect", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Registers a one-time listener for the `zoom-changed` event. * * @param event - The event name. * @param listener - Called when the `zoom-changed` event is emitted. * @returns This web contents instance. */ once(event: "zoom-changed", listener: (event: ElectronEvent, zoomDirection: "in" | "out") => void): this; /** * Opens the developer tools. * * @param options - Options for the developer tools including `mode`. */ openDevTools(options?: ElectronWebContentsDevToolsOptions): void; /** Executes the editing command `paste` in the web page. */ paste(): void; /** Executes the editing command `pasteAndMatchStyle` in the web page. */ pasteAndMatchStyle(): void; /** * Sends a message to the renderer process, optionally transferring ownership of message ports. * * @param channel - The channel name. * @param message - The message to send. * @param transfer - Message ports whose ownership is transferred with the message. */ postMessage(channel: string, message: unknown, transfer?: ElectronMessagePortMain[]): void; /** * Prints the window's web page. * * @param options - Options for printing. * @param callback - Called with whether printing succeeded and any failure reason. */ print(options?: ElectronWebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void; /** * Prints the window's web page as PDF. * * @param options - Options for printing to PDF. * @returns A promise resolving with the generated PDF data. */ printToPDF(options: ElectronPrintToPDFOptions): Promise<Buffer>; /** Executes the editing command `redo` in the web page. */ redo(): void; /** Reloads the current web page. */ reload(): void; /** Reloads the current page and ignores the cache. */ reloadIgnoringCache(): void; /** * Removes the inserted CSS from the current web page identified by its key. * * @param key - The key returned from `insertCSS`. * @returns A promise that resolves if the removal was successful. */ removeInsertedCSS(key: string): Promise<void>; /** * Removes a previously registered `before-input-event` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "before-input-event", listener: (event: ElectronEvent, input: ElectronInput) => void): this; /** * Removes a previously registered `blur` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "blur", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `certificate-error` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "certificate-error", listener: (event: ElectronEvent, url: string, error: string, certificate: ElectronCertificate, callback: (isTrusted: boolean) => void, isMainFrame: boolean) => void): this; /** * Removes a previously registered `console-message` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "console-message", listener: (event: ElectronEvent, level: number, message: string, line: number, sourceId: string) => void): this; /** * Removes a previously registered `context-menu` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "context-menu", listener: (event: ElectronEvent, params: ElectronContextMenuParams) => void): this; /** * Removes a previously registered `crashed` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "crashed", listener: (event: ElectronEvent, killed: boolean) => void): this; /** * Removes a previously registered `cursor-changed` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "cursor-changed", listener: (event: ElectronEvent, type: string, image: ElectronNativeImage, scale: number, size: ElectronSize, hotspot: ElectronPoint) => void): this; /** * Removes a previously registered `destroyed` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "destroyed", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `devtools-closed` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "devtools-closed", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `devtools-focused` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "devtools-focused", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `devtools-opened` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "devtools-opened", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `devtools-reload-page` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "devtools-reload-page", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `did-attach-webview` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-attach-webview", listener: (event: ElectronEvent, webContents: ElectronWebContents) => void): this; /** * Removes a previously registered `did-change-theme-color` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-change-theme-color", listener: (event: ElectronEvent, color: null | string) => void): this; /** * Removes a previously registered `did-create-window` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-create-window", listener: (window: ElectronBrowserWindow, details: ElectronDidCreateWindowDetails) => void): this; /** * Removes a previously registered `did-fail-load` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-fail-load", listener: (event: ElectronEvent, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Removes a previously registered `did-fail-provisional-load` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-fail-provisional-load", listener: (event: ElectronEvent, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Removes a previously registered `did-finish-load` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-finish-load", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `did-frame-finish-load` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-frame-finish-load", listener: (event: ElectronEvent, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Removes a previously registered `did-frame-navigate` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-frame-navigate", listener: (event: ElectronEvent, url: string, httpResponseCode: number, httpStatusText: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Removes a previously registered `did-navigate` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-navigate", listener: (event: ElectronEvent, url: string, httpResponseCode: number, httpStatusText: string) => void): this; /** * Removes a previously registered `did-navigate-in-page` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-navigate-in-page", listener: (event: ElectronEvent, url: string, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Removes a previously registered `did-redirect-navigation` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-redirect-navigation", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Removes a previously registered `did-start-loading` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-start-loading", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `did-start-navigation` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-start-navigation", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Removes a previously registered `did-stop-loading` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "did-stop-loading", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `dom-ready` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "dom-ready", listener: (event: ElectronEvent) => void): this; /** * Removes a previously registered `enter-html-full-screen` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `focus` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "focus", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `found-in-page` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "found-in-page", listener: (event: ElectronEvent, result: ElectronResult) => void): this; /** * Removes a previously registered `frame-created` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "frame-created", listener: (event: ElectronEvent, details: ElectronFrameCreatedDetails) => void): this; /** * Removes a previously registered `ipc-message` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "ipc-message", listener: (event: ElectronEvent, channel: string, ...args: unknown[]) => void): this; /** * Removes a previously registered `ipc-message-sync` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "ipc-message-sync", listener: (event: ElectronEvent, channel: string, ...args: unknown[]) => void): this; /** * Removes a previously registered `leave-html-full-screen` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `login` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "login", listener: (event: ElectronEvent, authenticationResponseDetails: ElectronAuthenticationResponseDetails, authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this; /** * Removes a previously registered `media-paused` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "media-paused", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `media-started-playing` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "media-started-playing", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `new-window` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "new-window", listener: (event: ElectronNewWindowWebContentsEvent, url: string, frameName: string, disposition: "background-tab" | "default" | "foreground-tab" | "new-window" | "other" | "save-to-disk", options: BrowserWindowConstructorOptions, additionalFeatures: string[], referrer: ElectronReferrer, postBody: ElectronPostBody) => void): this; /** * Removes a previously registered `page-favicon-updated` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "page-favicon-updated", listener: (event: ElectronEvent, favicons: string[]) => void): this; /** * Removes a previously registered `page-title-updated` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this; /** * Removes a previously registered `paint` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "paint", listener: (event: ElectronEvent, dirtyRect: ElectronRectangle, image: ElectronNativeImage) => void): this; /** * Removes a previously registered `plugin-crashed` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "plugin-crashed", listener: (event: ElectronEvent, name: string, version: string) => void): this; /** * Removes a previously registered `preferred-size-changed` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "preferred-size-changed", listener: (event: ElectronEvent, preferredSize: ElectronSize) => void): this; /** * Removes a previously registered `preload-error` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "preload-error", listener: (event: ElectronEvent, preloadPath: string, error: Error) => void): this; /** * Removes a previously registered `render-process-gone` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "render-process-gone", listener: (event: ElectronEvent, details: ElectronRenderProcessGoneDetails) => void): this; /** * Removes a previously registered `responsive` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "responsive", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `select-bluetooth-device` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "select-bluetooth-device", listener: (event: ElectronEvent, devices: ElectronBluetoothDevice[], callback: (deviceId: string) => void) => void): this; /** * Removes a previously registered `select-client-certificate` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "select-client-certificate", listener: (event: ElectronEvent, url: string, certificateList: ElectronCertificate[], callback: (certificate: ElectronCertificate) => void) => void): this; /** * Removes a previously registered `unresponsive` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "unresponsive", listener: (...args: unknown[]) => void): this; /** * Removes a previously registered `update-target-url` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "update-target-url", listener: (event: ElectronEvent, url: string) => void): this; /** * Removes a previously registered `will-attach-webview` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "will-attach-webview", listener: (event: ElectronEvent, webPreferences: WebPreferences, params: Record<string, string>) => void): this; /** * Removes a previously registered `will-navigate` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "will-navigate", listener: (event: ElectronEvent, url: string) => void): this; /** * Removes a previously registered `will-prevent-unload` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "will-prevent-unload", listener: (event: ElectronEvent) => void): this; /** * Removes a previously registered `will-redirect` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "will-redirect", listener: (event: ElectronEvent, url: string, isInPlace: boolean, isMainFrame: boolean, frameProcessId: number, frameRoutingId: number) => void): this; /** * Removes a previously registered `zoom-changed` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This web contents instance. */ removeListener(event: "zoom-changed", listener: (event: ElectronEvent, zoomDirection: "in" | "out") => void): this; /** * Removes the specified path from the DevTools workspace. * * @param path - The path to remove. */ removeWorkSpace(path: string): void; /** * Executes the editing command `replace` in the web page. * * @param text - The replacement text. */ replace(text: string): void; /** * Executes the editing command `replaceMisspelling` in the web page. * * @param text - The replacement text. */ replaceMisspelling(text: string): void; /** * Saves the current web page to the given path. * * @param fullPath - The absolute path to save the page to. * @param saveType - The save type. * @returns A promise that resolves if the page is saved. */ savePage(fullPath: string, saveType: "HTMLComplete" | "HTMLOnly" | "MHTML"): Promise<void>; /** Executes the editing command `selectAll` in the web page. */ selectAll(): void; /** * Sends an asynchronous message to the renderer process via `channel`, along with arguments. * * @param channel - The channel name. * @param args - Arguments to serialize and send. */ send(channel: string, ...args: unknown[]): void; /** * Injects a trusted input event into the page, driving the same input pipeline a real user produces * (unlike untrusted `dispatchEvent`, which CodeMirror and the CSS `:hover` engine ignore). * * @param inputEvent - The keyboard, mouse, or mouse wheel event to inject. */ sendInputEvent(inputEvent: ElectronKeyboardInputEvent | ElectronMouseInputEvent | ElectronMouseWheelInputEvent): void; /** * Sends an asynchronous message to a specific frame in a renderer process via `channel`. * * @param frameId - The frame id, or a `[processId, frameId]` pair. * @param channel - The channel name. * @param args - Arguments to serialize and send. */ sendToFrame(frameId: [ number, number ] | number, channel: string, ...args: unknown[]): void; /** * Mutes or unmutes the audio on the current web page. * * @param muted - Whether the audio should be muted. */ setAudioMuted(muted: boolean): void; /** * Controls whether this web contents throttles animations and timers when backgrounded. * * @param allowed - Whether background throttling is allowed. */ setBackgroundThrottling(allowed: boolean): void; /** * Uses the given web contents as the target to show DevTools. * * @param devToolsWebContents - The web contents to show DevTools in. */ setDevToolsWebContents(devToolsWebContents: ElectronWebContents): void; /** * Sets the frame rate when offscreen rendering is enabled. Only values between 1 and 240 are accepted. * * @param fps - The frame rate in frames per second. */ setFrameRate(fps: number): void; /** * Ignores application menu shortcuts while this web contents is focused. * * @param ignore - Whether to ignore menu shortcuts. */ setIgnoreMenuShortcuts(ignore: boolean): void; /** * Sets the image animation policy for this web contents. * * @param policy - The image animation policy. */ setImageAnimationPolicy(policy: "animate" | "animateOnce" | "noAnimation"): void; /** * Overrides the user agent for this web page. * * @param userAgent - The user agent to set. */ setUserAgent(userAgent: string): void; /** * Sets the maximum and minimum pinch-to-zoom level. * * @param minimumLevel - The minimum zoom level. * @param maximumLevel - The maximum zoom level. * @returns A promise that resolves when the limits are set. */ setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>; /** * Sets the WebRTC IP handling policy. * * @param policy - The WebRTC IP handling policy. */ setWebRTCIPHandlingPolicy(policy: "default_public_and_private_interfaces" | "default_public_interface_only" | "default" | "disable_non_proxied_udp"): void; /** * Sets a handler called before a new window is requested by the renderer. * * @param handler - The handler that decides whether to allow or deny the new window. */ setWindowOpenHandler(handler: (details: ElectronHandlerDetails) => ElectronWindowOpenHandlerResponse): void; /** * Changes the zoom factor to the specified factor. * * @param factor - The zoom factor. Must be greater than `0.0`. */ setZoomFactor(factor: number): void; /** * Changes the zoom level to the specified level. * * @param level - The zoom level. */ setZoomLevel(level: number): void; /** * Shows a pop-up dictionary that searches the selected word on the page. Only available on macOS. */ showDefinitionForSelection(): void; /** * Sets the `item` as the dragging item for the current drag-drop operation. * * @param item - The item to drag. */ startDrag(item: ElectronItem): void; /** Starts painting when offscreen rendering is enabled and not painting. */ startPainting(): void; /** Stops any pending navigation. */ stop(): void; /** * Stops any `findInPage` request for the web contents with the provided action. * * @param action - The action to take when stopping the find request. */ stopFindInPage(action: "activateSelection" | "clearSelection" | "keepSelection"): void; /** Stops painting when offscreen rendering is enabled and painting. */ stopPainting(): void; /** * Takes a V8 heap snapshot and saves it to `filePath`. * * @param filePath - The path to save the heap snapshot to. * @returns A promise resolving when the snapshot has been created. */ takeHeapSnapshot(filePath: string): Promise<void>; /** Toggles the developer tools. */ toggleDevTools(): void; /** Executes the editing command `undo` in the web page. */ undo(): void; /** Executes the editing command `unselect` in the web page. */ unselect(): void; } /** * Options for opening developer tools. * * @public * @unofficial */ export interface ElectronWebContentsDevToolsOptions { /** * Whether to bring the opened DevTools window to the foreground. * * @default `true` */ activate?: boolean; /** The mode to open DevTools in. Defaults to the last used dock state. */ mode: "bottom" | "detach" | "left" | "right" | "undocked"; } /** * The `webContents` module accessor exposed by Electron, providing static factory and lookup methods for `WebContents` instances. * * @public * @unofficial */ export interface ElectronWebContentsModule { /** * Looks up a `WebContents` instance based on its assigned Chrome DevTools Protocol TargetID. * * @param targetId - The Chrome DevTools Protocol TargetID to look up. * @returns A `WebContents` instance with the given TargetID, or `undefined` if there is no `WebContents` associated with the given TargetID. */ fromDevToolsTargetId(targetId: string): ElectronWebContents | undefined; /** * Looks up a `WebContents` instance based on a `WebFrameMain`. * * @param frame - The `WebFrameMain` to look up. * @returns A `WebContents` instance with the given `WebFrameMain`, or `undefined` if there is no `WebContents` associated with the given `WebFrameMain`. */ fromFrame(frame: ElectronWebFrameMain): ElectronWebContents | undefined; /** * Looks up a `WebContents` instance based on its ID. * * @param id - The ID to look up. * @returns A `WebContents` instance with the given ID, or `undefined` if there is no `WebContents` associated with the given ID. */ fromId(id: number): ElectronWebContents | undefined; /** * Returns an array of all `WebContents` instances. This will contain web contents for all windows, webviews, opened devtools, and devtools extension background pages. * * @returns An array of all `WebContents` instances. */ getAllWebContents(): ElectronWebContents[]; /** * Returns the web contents that is focused in this application, otherwise returns `null`. * * @returns The focused `WebContents`, or `null` if none is focused. */ getFocusedWebContents(): ElectronWebContents | null; } /** * Options for printing a web page. * * @public * @unofficial */ export interface ElectronWebContentsPrintOptions { /** * Whether the web page should be collated. */ collate?: boolean; /** * Whether the printed web page will be in color or grayscale. * * @default `true` */ color?: boolean; /** The number of copies of the web page to print. */ copies?: number; /** * Set the printer device name to use. Must be the system-defined name and not the 'friendly' name. */ deviceName?: string; /** The DPI of the printed web page keyed by axis. */ dpi?: Record<string, number>; /** Set the duplex mode of the printed web page. */ duplexMode?: "longEdge" | "shortEdge" | "simplex"; /** String to be printed as page footer. */ footer?: string; /** String to be printed as page header. */ header?: string; /** * Whether the web page should be printed in landscape mode. * * @default `false` */ landscape?: boolean; /** The margins of the printed web page. */ margins?: ElectronMargins; /** The page range to print. On macOS, only one range is honored. */ pageRanges?: ElectronPageRanges[]; /** * The page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an object containing `height` and `width`. */ pageSize?: ElectronSize | string; /** The number of pages to print per page sheet. */ pagesPerSheet?: number; /** * Prints the background color and image of the web page. * * @default `false` */ printBackground?: boolean; /** The scale factor of the web page. */ scaleFactor?: number; /** * Don't ask the user for print settings. * * @default `false` */ silent?: boolean; } /** * Electron WebFrame for customizing the rendering of the current web page in the renderer process. * * @public * @unofficial */ export interface ElectronWebFrame { /** The first child frame of `webFrame`, or `null` if `webFrame` has no children or if the first child is not in the current renderer process. */ readonly firstChild: ElectronWebFrame | null; /** The next sibling frame, or `null` if `webFrame` is the last frame in its parent or if the next sibling is not in the current renderer process. */ readonly nextSibling: ElectronWebFrame | null; /** The frame which opened `webFrame`, or `null` if there is no opener or the opener is not in the current renderer process. */ readonly opener: ElectronWebFrame | null; /** The parent frame of `webFrame`, or `null` if `webFrame` is top or the parent is not in the current renderer process. */ readonly parent: ElectronWebFrame | null; /** The unique frame id in the current renderer process. Distinct `WebFrame` instances that refer to the same underlying frame will have the same `routingId`. */ readonly routingId: number; /** The top frame in the frame hierarchy to which `webFrame` belongs, or `null` if the top frame is not in the current renderer process. */ readonly top: ElectronWebFrame | null; /** * Attempts to free memory that is no longer being used (like images from a previous navigation). */ clearCache(): void; /** * Evaluates `code` in the page. In the browser window some HTML APIs like `requestFullScreen` can only be invoked by a gesture from the user. Setting `userGesture` to `true` will remove this limitation. * * @param code - The code to evaluate. * @param userGesture - Whether to treat the evaluation as being triggered by a user gesture. * @param callback - Called with the result of the executed code. Modeled with `unknown` (the upstream `result` type is `any`). * @returns A promise that resolves with the result of the executed code, or is rejected if execution throws or results in a rejected promise. Modeled with `unknown` (the upstream type is `any`). */ executeJavaScript(code: string, userGesture?: boolean, callback?: (result: unknown, error: Error) => void): Promise<unknown>; /** * Works like `executeJavaScript` but evaluates `scripts` in an isolated context. When the execution of a script fails, the returned promise will not reject and the `result` would be `undefined`. * * @param worldId - The id of the isolated world to run the scripts in. * @param scripts - The scripts to evaluate. * @param userGesture - Whether to treat the evaluation as being triggered by a user gesture. * @param callback - Called with the result of the executed code. Modeled with `unknown` (the upstream `result` type is `any`). * @returns A promise that resolves with the result of the executed code, or is rejected if execution could not start. Modeled with `unknown` (the upstream type is `any`). */ executeJavaScriptInIsolatedWorld(worldId: number, scripts: ElectronWebSource[], userGesture?: boolean, callback?: (result: unknown, error: Error) => void): Promise<unknown>; /** * Returns a child of `webFrame` with the supplied `name`. * * @param name - The name of the child frame to find. * @returns The child frame, or `null` if there is no such frame or if the frame is not in the current renderer process. */ findFrameByName(name: string): ElectronWebFrame; /** * Returns the frame that has the supplied `routingId`. * * @param routingId - The routing id of the frame to find. * @returns The frame, or `null` if not found. */ findFrameByRoutingId(routingId: number): ElectronWebFrame; /** * Returns the frame element in `webFrame`'s document selected by `selector`. * * @param selector - The CSS selector for the frame element. * @returns The selected frame, or `null` if `selector` does not select a frame or if the frame is not in the current renderer process. */ getFrameForSelector(selector: string): ElectronWebFrame; /** * Returns an object describing usage information of Blink's internal memory caches. * * @returns The resource usage information. */ getResourceUsage(): ElectronResourceUsage; /** * Returns a list of suggested words for a given word. * * @param word - The word to get suggestions for. * @returns The suggested words. Empty if the word is spelled correctly. */ getWordSuggestions(word: string): string[]; /** * Returns the current zoom factor. * * @returns The current zoom factor. */ getZoomFactor(): number; /** * Returns the current zoom level. * * @returns The current zoom level. */ getZoomLevel(): number; /** * Injects CSS into the current web page and returns a unique key for the inserted stylesheet. * * @param css - The CSS to insert. * @param options - Options for inserting the CSS. * @returns A key for the inserted CSS that can later be used to remove the CSS via `removeInsertedCSS(key)`. */ insertCSS(css: string, options?: ElectronInsertCSSOptions): string; /** * Inserts `text` into the focused element. * * @param text - The text to insert. */ insertText(text: string): void; /** * Returns whether the word is misspelled according to the built in spellchecker. If no dictionary is loaded, always returns `false`. * * @param word - The word to check. * @returns Whether the word is misspelled. */ isWordMisspelled(word: string): boolean; /** * Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from `insertCSS(css)`. * * @param key - The key of the inserted CSS to remove. */ removeInsertedCSS(key: string): void; /** * Sets the security origin, content security policy and name of the isolated world. If the `csp` is specified, then the `securityOrigin` also has to be specified. * * @param worldId - The id of the isolated world to configure. * @param info - The isolated world info. */ setIsolatedWorldInfo(worldId: number, info: ElectronInfo): void; /** * Sets a provider for spell checking in input fields and text areas. If you want to use this method you must disable the builtin spellchecker when you construct the window. * * @param language - The language to spell check. * @param provider - The spell check provider. */ setSpellCheckProvider(language: string, provider: ElectronProvider): void; /** * Sets the maximum and minimum pinch-to-zoom level. Visual zoom is disabled by default in Electron. * * @param minimumLevel - The minimum pinch-to-zoom level. * @param maximumLevel - The maximum pinch-to-zoom level. */ setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; /** * Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = `3.0`. The factor must be greater than `0.0`. * * @param factor - The zoom factor to set. */ setZoomFactor(factor: number): void; /** * Changes the zoom level to the specified level. The original size is `0` and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. * * @param level - The zoom level to set. */ setZoomLevel(level: number): void; } /** * A frame in the main process, representing a renderer frame. * * Note: The upstream `static fromId(processId, routingId)` factory cannot be expressed on a plain * interface and is therefore omitted here. * * @public * @unofficial */ export interface ElectronWebFrameMain { /** A collection containing the direct descendents of this frame. */ readonly frames: ElectronWebFrameMain[]; /** A collection containing every frame in the subtree of this frame, including itself. */ readonly framesInSubtree: ElectronWebFrameMain[]; /** The id of the frame's internal FrameTreeNode instance. Browser-global and uniquely identifies a frame that hosts content. */ readonly frameTreeNodeId: number; /** The frame name. */ readonly name: string; /** The operating system `pid` of the process which owns this frame. */ readonly osProcessId: number; /** The parent frame, or `null` if this is the top frame in the frame hierarchy. */ readonly parent: ElectronWebFrameMain | null; /** The Chromium internal `pid` of the process which owns this frame. */ readonly processId: number; /** The unique frame id in the current renderer process. */ readonly routingId: number; /** The top frame in the frame hierarchy to which this frame belongs, or `null`. */ readonly top: ElectronWebFrameMain | null; /** The current URL of the frame. */ readonly url: string; /** The visibility state of the frame. */ readonly visibilityState: string; /** * Registers a listener for the `dom-ready` event, emitted when the document is loaded. * * @param event - The event name. * @param listener - Called when the document is loaded. * @returns This frame instance. */ addListener(event: "dom-ready", listener: () => void): this; /** * Evaluates `code` in the page. * * @param code - The JavaScript code to execute. * @param userGesture - Whether the execution should be treated as a user gesture. * @returns A promise resolving with the result of the executed code. */ executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>; /** * Registers a listener for the `dom-ready` event, emitted when the document is loaded. * * @param event - The event name. * @param listener - Called when the document is loaded. * @returns This frame instance. */ on(event: "dom-ready", listener: () => void): this; /** * Registers a one-time listener for the `dom-ready` event. * * @param event - The event name. * @param listener - Called when the document is loaded. * @returns This frame instance. */ once(event: "dom-ready", listener: () => void): this; /** * Sends a message to the renderer process, optionally transferring ownership of `MessagePortMain` objects. * * @param channel - The channel name. * @param message - The message to send. * @param transfer - Message ports whose ownership is transferred with the message. */ postMessage(channel: string, message: unknown, transfer?: ElectronMessagePortMain[]): void; /** * Reloads the frame. * * @returns Whether the reload was initiated successfully. Only `false` when the frame has no history. */ reload(): boolean; /** * Removes a previously registered `dom-ready` event listener. * * @param event - The event name. * @param listener - The listener to remove. * @returns This frame instance. */ removeListener(event: "dom-ready", listener: () => void): this; /** * Sends an asynchronous message to the renderer process via `channel`, along with arguments. * * @param channel - The channel name. * @param args - Arguments to serialize and send. */ send(channel: string, ...args: unknown[]): void; } /** * The `webFrameMain` module accessor exposed on {@link ElectronRemote}, distinct from the * {@link ElectronWebFrameMain} class it returns. * * @public * @unofficial */ export interface ElectronWebFrameMainModule { /** * Returns the frame with the given process and routing ids, or `undefined` if none is found. * * @param processId - The process id. * @param routingId - The routing id. * @returns The matching frame, or `undefined`. */ fromId(processId: number, routingId: number): ElectronWebFrameMain | undefined; } /** * Intercepts and observes a session's network requests at various life-cycle stages. * * @public * @unofficial */ export interface ElectronWebRequest { /** * Registers a listener called when a server initiated redirect is about to occur, filtered by `filter`. * * @param filter - The filter narrowing which requests are observed. * @param listener - Called with the request details, or `null` to remove the listener. */ onBeforeRedirect(filter: ElectronWebRequestFilter, listener: ((details: ElectronOnBeforeRedirectListenerDetails) => void) | null): void; /** * Registers a listener called when a server initiated redirect is about to occur. * * @param listener - Called with the request details, or `null` to remove the listener. */ onBeforeRedirect(listener: ((details: ElectronOnBeforeRedirectListenerDetails) => void) | null): void; /** * Registers a listener called when a request is about to occur, filtered by `filter`. * * @param filter - The filter narrowing which requests are observed. * @param listener - Called with the request details and a response callback, or `null` to remove the listener. */ onBeforeRequest(filter: ElectronWebRequestFilter, listener: ((details: ElectronOnBeforeRequestListenerDetails, callback: (response: ElectronResponse) => void) => void) | null): void; /** * Registers a listener called when a request is about to occur. * * @param listener - Called with the request details and a response callback, or `null` to remove the listener. */ onBeforeRequest(listener: ((details: ElectronOnBeforeRequestListenerDetails, callback: (response: ElectronResponse) => void) => void) | null): void; /** * Registers a listener called before sending an HTTP request, once the request headers are available, filtered by `filter`. * * @param filter - The filter narrowing which requests are observed. * @param listener - Called with the request details and a response callback, or `null` to remove the listener. */ onBeforeSendHeaders(filter: ElectronWebRequestFilter, listener: ((details: ElectronOnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: ElectronBeforeSendResponse) => void) => void) | null): void; /** * Registers a listener called before sending an HTTP request, once the request headers are available. * * @param listener - Called with the request details and a response callback, or `null` to remove the listener. */ onBeforeSendHeaders(listener: ((details: ElectronOnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: ElectronBeforeSendResponse) => void) => void) | null): void; /** * Registers a listener called when a request is completed, filtered by `filter`. * * @param filter - The filter narrowing which requests are observed. * @param listener - Called with the request details, or `null` to remove the listener. */ onCompleted(filter: ElectronWebRequestFilter, listener: ((details: ElectronOnCompletedListenerDetails) => void) | null): void; /** * Registers a listener called when a request is completed. * * @param listener - Called with the request details, or `null` to remove the listener. */ onCompleted(listener: ((details: ElectronOnCompletedListenerDetails) => void) | null): void; /** * Registers a listener called when an error occurs, filtered by `filter`. * * @param filter - The filter narrowing which requests are observed. * @param listener - Called with the request details, or `null` to remove the listener. */ onErrorOccurred(filter: ElectronWebRequestFilter, listener: ((details: ElectronOnErrorOccurredListenerDetails) => void) | null): void; /** * Registers a listener called when an error occurs. * * @param listener - Called with the request details, or `null` to remove the listener. */ onErrorOccurred(listener: ((details: ElectronOnErrorOccurredListenerDetails) => void) | null): void; /** * Registers a listener called when HTTP response headers of a request have been received, filtered by `filter`. * * @param filter - The filter narrowing which requests are observed. * @param listener - Called with the request details and a response callback, or `null` to remove the listener. */ onHeadersReceived(filter: ElectronWebRequestFilter, listener: ((details: ElectronOnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: ElectronHeadersReceivedResponse) => void) => void) | null): void; /** * Registers a listener called when HTTP response headers of a request have been received. * * @param listener - Called with the request details and a response callback, or `null` to remove the listener. */ onHeadersReceived(listener: ((details: ElectronOnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: ElectronHeadersReceivedResponse) => void) => void) | null): void; /** * Registers a listener called when the first byte of the response body is received, filtered by `filter`. * * @param filter - The filter narrowing which requests are observed. * @param listener - Called with the request details, or `null` to remove the listener. */ onResponseStarted(filter: ElectronWebRequestFilter, listener: ((details: ElectronOnResponseStartedListenerDetails) => void) | null): void; /** * Registers a listener called when the first byte of the response body is received. * * @param listener - Called with the request details, or `null` to remove the listener. */ onResponseStarted(listener: ((details: ElectronOnResponseStartedListenerDetails) => void) | null): void; /** * Registers a listener called just before a request is going to be sent to the server, filtered by `filter`. * * @param filter - The filter narrowing which requests are observed. * @param listener - Called with the request details, or `null` to remove the listener. */ onSendHeaders(filter: ElectronWebRequestFilter, listener: ((details: ElectronOnSendHeadersListenerDetails) => void) | null): void; /** * Registers a listener called just before a request is going to be sent to the server. * * @param listener - Called with the request details, or `null` to remove the listener. */ onSendHeaders(listener: ((details: ElectronOnSendHeadersListenerDetails) => void) | null): void; } /** * Filter used to narrow which requests a web-request listener receives. * * @public * @unofficial */ export interface ElectronWebRequestFilter { /** Array of URL patterns that will be used to filter out the requests that do not match the URL patterns. */ urls: string[]; } /** * A script source to evaluate in an isolated world. * * @public * @unofficial */ export interface ElectronWebSource { /** The JavaScript code to evaluate. */ code: string; /** The URL associated with the code. */ url?: string; } /** * Electron WebviewTag for embedding external web content in the application. * * @public * @unofficial */ export interface ElectronWebviewTag extends HTMLElement { /** Whether to allow popups. */ allowpopups: boolean; /** The Blink features to disable. */ disableblinkfeatures: string; /** Whether to disable web security. */ disablewebsecurity: boolean; /** The Blink features to enable. */ enableblinkfeatures: string; /** The HTTP referrer URL. */ httpreferrer: string; /** Whether to enable Node.js integration. */ nodeintegration: boolean; /** Whether to enable Node.js integration in sub-frames. */ nodeintegrationinsubframes: boolean; /** The session partition string. */ partition: string; /** Whether to enable plugins. */ plugins: boolean; /** The path to the preload script. */ preload: string; /** The URL to load. */ src: string; /** The user agent string. */ useragent: string; /** The web preferences string. */ webpreferences: string; /** * Registers an event listener. * * @param type - The event type. * @param listener - The event handler. * @param options - Listener options. */ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void; /** * Returns whether the webview can navigate back. * * @returns Whether the webview can go back. */ canGoBack(): boolean; /** * Returns whether the webview can navigate forward. * * @returns Whether the webview can go forward. */ canGoForward(): boolean; /** * Returns whether the webview can navigate to the given offset. * * @param offset - The history offset. * @returns Whether the webview can go to the offset. */ canGoToOffset(offset: number): boolean; /** * Captures a snapshot of the page. * * @param rect - The area to capture. Omitting it captures the whole visible page. * @returns The captured image. */ capturePage(rect?: ElectronRectangle): Promise<ElectronNativeImage>; /** Clears the navigation history. */ clearHistory(): void; /** Closes the developer tools. */ closeDevTools(): void; /** Copies the selected text to the clipboard. */ copy(): void; /** Cuts the selected text to the clipboard. */ cut(): void; /** Deletes the selected text. */ delete(): void; /** * Initiates a download of the resource at the given URL without navigating. * * @param url - The URL to download. */ downloadURL(url: string): void; /** * Evaluates JavaScript code in the context of the page. * * @param code - The JavaScript code to execute. * @param userGesture - Whether the execution should be treated as a user gesture. * @returns The result of the evaluated code. */ executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>; /** * Starts finding text in the page. * * @param text - The text to find. * @param options - Find options including `forward`, `findNext`, and `matchCase`. * @returns The request id. */ findInPage(text: string, options?: ElectronWebviewTagFindInPageOptions): number; /** * Returns the title of the page. * * @returns The page title. */ getTitle(): string; /** * Returns the URL of the current page. * * @returns The current URL. */ getURL(): string; /** * Returns the user agent string. * * @returns The user agent. */ getUserAgent(): string; /** * Returns the web contents id. * * @returns The web contents id. */ getWebContentsId(): number; /** * Returns the current zoom factor. * * @returns The zoom factor. */ getZoomFactor(): number; /** * Returns the current zoom level. * * @returns The zoom level. */ getZoomLevel(): number; /** Navigates back. */ goBack(): void; /** Navigates forward. */ goForward(): void; /** * Navigates to the specified history index. * * @param index - The history index. */ goToIndex(index: number): void; /** * Navigates to the specified history offset. * * @param offset - The history offset. */ goToOffset(offset: number): void; /** * Injects CSS into the page. * * @param css - The CSS string to inject. * @returns A key that can be used to remove the CSS. */ insertCSS(css: string): Promise<string>; /** * Inserts text at the current cursor position. * * @param text - The text to insert. */ insertText(text: string): Promise<void>; /** * Inspects the element at the given position. * * @param x - The x coordinate. * @param y - The y coordinate. */ inspectElement(x: number, y: number): void; /** Opens the developer tools for the service worker context present in the guest page. */ inspectServiceWorker(): void; /** Opens the developer tools for the shared worker context present in the guest page. */ inspectSharedWorker(): void; /** * Returns whether the page audio is muted. * * @returns Whether audio is muted. */ isAudioMuted(): boolean; /** * Returns whether the page renderer process has crashed. * * @returns Whether the page has crashed. */ isCrashed(): boolean; /** * Returns whether the page is currently producing audio. * * @returns Whether the page is audible. */ isCurrentlyAudible(): boolean; /** * Returns whether the developer tools are focused. * * @returns Whether DevTools are focused. */ isDevToolsFocused(): boolean; /** * Returns whether the developer tools are opened. * * @returns Whether DevTools are opened. */ isDevToolsOpened(): boolean; /** * Returns whether the page is loading resources. * * @returns Whether the page is loading. */ isLoading(): boolean; /** * Returns whether the main frame of the page is loading. * * @returns Whether the main frame is loading. */ isLoadingMainFrame(): boolean; /** * Returns whether the page is waiting for a first response. * * @returns Whether the page is waiting for a response. */ isWaitingForResponse(): boolean; /** * Loads the given URL. * * @param url - The URL to load. Must contain the protocol prefix, e.g. `http://` or `file://`. * @param options - Options for loading the URL including `httpReferrer`, `userAgent`, and `extraHeaders`. */ loadURL(url: string, options?: ElectronBrowserWindowLoadURLOptions): Promise<void>; /** Opens the developer tools. */ openDevTools(): void; /** Pastes from the clipboard. */ paste(): void; /** Pastes and matches the style of the current text. */ pasteAndMatchStyle(): void; /** * Prints the page. * * @param options - Print options including `silent`, `printBackground`, and `deviceName`. */ print(options?: ElectronWebviewTagPrintOptions): Promise<void>; /** * Prints the page as a PDF. * * @param options - The PDF print options. * @returns The generated PDF data. */ printToPDF(options: ElectronPrintToPDFOptions): Promise<Uint8Array>; /** Redoes the last undone action. */ redo(): void; /** Reloads the page. */ reload(): void; /** Reloads the page ignoring the cache. */ reloadIgnoringCache(): void; /** * Removes an event listener. * * @param type - The event type. * @param listener - The event handler. * @param options - Listener options. */ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; /** * Removes previously injected CSS. * * @param key - The key of the CSS to remove. */ removeInsertedCSS(key: string): Promise<void>; /** * Replaces the current text with the given text. * * @param text - The replacement text. */ replace(text: string): void; /** * Replaces the misspelled word with the given text. * * @param text - The replacement text. */ replaceMisspelling(text: string): void; /** Selects all text on the page. */ selectAll(): void; /** * Sends an asynchronous message to the renderer process. * * @param channel - The IPC channel name. * @param args - Arguments to send. */ send(channel: string, ...args: unknown[]): Promise<void>; /** * Sends an input event to the page. * * @param inputEvent - The keyboard, mouse, or mouse wheel event to inject. */ sendInputEvent(inputEvent: ElectronKeyboardInputEvent | ElectronMouseInputEvent | ElectronMouseWheelInputEvent): Promise<void>; /** * Sends a message to a specific frame in the renderer process. * * @param frameId - The frame identifier tuple. * @param channel - The IPC channel name. * @param args - Arguments to send. */ sendToFrame(frameId: [ number, number ], channel: string, ...args: unknown[]): Promise<void>; /** * Sets whether the page audio is muted. * * @param muted - Whether to mute audio. */ setAudioMuted(muted: boolean): void; /** * Sets the user agent string. * * @param userAgent - The user agent to set. */ setUserAgent(userAgent: string): void; /** * Sets the maximum and minimum pinch-to-zoom level. * * @param minimumLevel - The minimum zoom level. * @param maximumLevel - The maximum zoom level. */ setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>; /** * Sets the zoom factor of the page. * * @param factor - The zoom factor. */ setZoomFactor(factor: number): void; /** * Sets the zoom level of the page. * * @param level - The zoom level. */ setZoomLevel(level: number): void; /** * Shows a pop-up dictionary that searches the selected word on the page. * * @remarks Only available on macOS (`darwin`). */ showDefinitionForSelection(): void; /** Stops loading the page. */ stop(): void; /** * Stops the find in page request. * * @param action - The action to take when stopping. */ stopFindInPage(action: "activateSelection" | "clearSelection" | "keepSelection"): void; /** Undoes the last action. */ undo(): void; /** Clears the current selection. */ unselect(): void; } /** * Options for finding text in a webview page. * * @public * @unofficial */ export interface ElectronWebviewTagFindInPageOptions { /** * Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. * * @default `false` */ findNext?: boolean; /** * Whether to search forward or backward. * * @default `true` */ forward?: boolean; /** * Whether the search should be case-sensitive. * * @default `false` */ matchCase?: boolean; } /** * Options for printing a webview page. * * @public * @unofficial */ export interface ElectronWebviewTagPrintOptions { /** Whether the web page should be collated. */ collate?: boolean; /** * Whether the printed web page will be in color or grayscale. * * @default `true` */ color?: boolean; /** The number of copies of the web page to print. */ copies?: number; /** * The name of the printer device to use. Must be the system-defined name and not the 'friendly' name, e.g. `Brother_QL_820NWB` and not `Brother QL-820NWB`. */ deviceName?: string; /** The DPI settings of the printed web page, keyed by axis. */ dpi?: Record<string, number>; /** The duplex mode of the printed web page. */ duplexMode?: "longEdge" | "shortEdge" | "simplex"; /** The string to be printed as the page footer. */ footer?: string; /** The string to be printed as the page header. */ header?: string; /** * Whether the web page should be printed in landscape mode. * * @default `false` */ landscape?: boolean; /** The margins of the printed web page. */ margins?: ElectronMargins; /** The page range to print. */ pageRanges?: ElectronPageRanges[]; /** * The page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an object containing `height` and `width`. */ pageSize?: ElectronSize | string; /** The number of pages to print per page sheet. */ pagesPerSheet?: number; /** * Whether to print the background color and image of the web page. * * @default `false` */ printBackground?: boolean; /** The scale factor of the web page. */ scaleFactor?: number; /** * Whether to print silently without asking the user for print settings. * * @default `false` */ silent?: boolean; } /** * Details about a pending window resize, emitted with the `will-resize` event. * * @public * @unofficial */ export interface ElectronWillResizeDetails { /** The edge of the window being dragged for resizing. */ edge: "bottom-left" | "bottom-right" | "bottom" | "left" | "right" | "top-left" | "top-right"; } /** * Extended Electron BrowserWindow with internal properties. * * @public * @unofficial */ export interface ElectronWindow extends ElectronBrowserWindow { /** * Internal browser views attached to the window. */ _browserViews: unknown; /** * Internal event handlers map. */ _events: unknown; /** * Number of registered event handlers. */ _eventsCount: unknown; /** * Web contents for the developer tools panel. */ devToolsWebContents: unknown; } /** * Response returned by the {@link ElectronWebContents.setWindowOpenHandler} handler, deciding whether a * requested new window is allowed or denied. * * @public * @unofficial */ export interface ElectronWindowOpenHandlerResponse { /** Whether to allow or deny creating the new window. */ action: "allow" | "deny"; /** Overrides passed to the created {@link ElectronBrowserWindow}. Only used when `action` is `'allow'`. */ overrideBrowserWindowOptions?: BrowserWindowConstructorOptions; } /** * 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; /** * Serialized state to restore for the embed. */ 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; /** * Constructor. * * To get the constructor instance, use {@link getEmbedRegistryConstructor} from `obsidian-typings/implementations`. * * @deprecated - Added only for typing purposes. */ constructor__?(): this; /** * Get the embed constructor for a specific file type. * * @param file - File to get the embed creator for. * @returns The embed creator, or `null` if none registered. */ getEmbedCreator(file: TFile): EmbedCreator | null; /** * Check whether a file extension has a registered embed constructor. * * @param extension - File extension to check. * @returns Whether the extension is registered. */ isExtensionRegistered(extension: string): boolean; /** * Register an embed constructor for a specific file extension. * * @param extension - File extension to register. * @param embedCreator - Embed creator function. */ registerExtension(extension: string, embedCreator: EmbedCreator): void; /** * Register an embed constructor for a list of file extensions. * * @param extensions - File extensions to register. * @param embedCreator - Embed creator function. */ registerExtensions(extensions: string[], embedCreator: EmbedCreator): void; /** * Unregister an embed constructor for a specific file extension. * * @param extension - File extension to unregister. */ unregisterExtension(extension: string): void; /** * Unregister an embed constructor for a list of file extensions. * * @param extensions - File extensions to unregister. */ 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 { } /** * View for an embedded markdown editor, supporting preview and edit modes. * * @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: HoverPopover | null; /** * 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; /** * Destroy edit component editor and save contents if specified. * * @param save - Whether to save before destroying. */ destroyEditor(save?: boolean): void; /** * Get the preview editor, if exists. * * @returns The iframed markdown editor, or `null`. */ get editor(): IFramedMarkdownEditor | null; /** * Gets currently active mode (editMode returns 'source'). * * @returns The current view mode. */ getMode(): "preview" | "source"; /** * 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; /** * Get the path to the file, if any file registered. * * @returns The file path. */ get path(): string; /** * Debounced save of contents. */ requestSave(): void; /** * Debounced save of editor folds. */ requestSaveFolds(): void; /** * Set file contents. * * @param data - Content to save. * @param save - Whether to persist to disk. */ save(data: string, save?: boolean): void; /** * Get the scroll of the file renderer component. * * @returns The scroll position. */ get scroll(): unknown; /** * Set the state of the editor. * * @param data - Document content to set. * @param clear - Whether to clear existing state. */ 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. * * @param save - Whether to save before switching to preview. */ showPreview(save?: boolean): void; /** * Reveal search component in file renderer component. * * @param replace - Whether to show the replace input. */ showSearch(replace?: boolean): void; /** * Toggle between edit and preview mode. */ toggleMode(): void; } /** * Function `Empty`. * * @public * @unofficial */ export interface EmptyFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType { } /** * View displayed when a workspace leaf has no content or file open. * * @public * @unofficial */ export interface EmptyView extends ItemView { /** * Get the current view type. * * @returns The view type identifier. */ getViewType(): typeof ViewType.Empty; } /** * Represents an enclosing HTML/XML tag pair with open and close ranges. * * @public * @unofficial */ export interface EnclosingTag { /** * Range of the closing tag. */ close: EditorRangeEx; /** * Range of the opening tag. */ open: EditorRangeEx; } /** * Options for ensuring a side leaf exists in the workspace. * * @public * @unofficial */ export interface EnsureSideLeafOptions { /** * Whether the leaf should be set as active. */ active?: boolean; /** * Whether the leaf should be revealed. */ reveal?: boolean; /** * Whether to create a new split for the leaf. */ split?: boolean; /** * The state to set on the leaf. */ state?: unknown; } /** * Environment object passed to Prism hooks and used during highlighting. * * @public * @unofficial */ export interface Environment { /** Additional attributes for the wrapping element. */ attributes?: Record<string, string>; /** CSS classes applied to the token. */ classes?: string[]; /** The source code to highlight. */ code?: string; /** The content of a token. */ content?: string; /** The target element being highlighted. */ element?: Element; /** The grammar used for tokenization. */ grammar?: Grammar; /** The highlighted HTML code. */ highlightedCode?: string; /** The language identifier. */ language?: string; /** The parent token array. */ parent?: Array<PrismToken | string>; /** CSS selector used to find code elements. */ selector?: string; /** The HTML tag name for the token. */ tag?: string; /** The token sequence. */ tokenSequence?: Array<PrismToken | string>; /** The type of the token. */ type?: string; } /** * Function `Equal`. * * @public * @unofficial */ export interface EqualFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType { } /** * An entry representing a registered event handler. * * @public * @unofficial */ export interface EventsEntry { /** * Context (`this` value) for the event handler callback. */ ctx: unknown; /** * Events object this handler is registered on. */ e: Events; /** * Event name this handler listens for. */ name: string; /** * Event handler callback function. * * @param data - The event data arguments. * @returns The result of the event handler. */ fn(...data: unknown[]): unknown; } /** * Font metrics used by MathJax for scaling and positioning math output. * * @public * @unofficial */ export interface ExtendedMetrics { /** * Width of the container element in pixels. */ containerWidth: number; /** * Size of 1em in pixels for the current font. */ em: number; /** * Size of 1ex in pixels for the current font. */ ex: number; /** * CSS font family string. */ family: string; /** * Available line width for the math output in pixels. */ lineWidth: number; /** * Scale factor for the math output relative to the surrounding text. */ scale: number; } /** * Definition for registering an external Mermaid diagram type. * * @public * @unofficial */ export interface ExternalDiagramDefinition { /** Unique identifier for the diagram type. */ id: string; /** * Detect whether the given text matches this diagram type. * * @param text - The diagram text to check. * @returns Whether the text matches this diagram type. */ detector(text: string): boolean; /** * Lazily load the diagram definition. * * @returns A promise resolving to the diagram definition. */ loader(): Promise<DiagramDefinitionModule>; } /** * Configuration for defining a facet. * * @public * @unofficial */ export interface FacetConfig<Input, Output> { /** Extensions or a function producing extensions to enable when this facet is provided. */ enables?: ((self: Facet<Input, Output>) => Extension) | Extension; /** Whether this facet's value is static (cannot be changed by transactions). */ static?: boolean; /** * Combine the input values into a single output value. * * @param values - The input values. * @returns The combined output. */ combine?(values: readonly Input[]): Output; /** * Compare two output values. * * @param a - The first value. * @param b - The second value. * @returns Whether the values are equal. */ compare?(a: Output, b: Output): boolean; /** * Compare two input values. * * @param a - The first value. * @param b - The second value. * @returns Whether the values are equal. */ compareInput?(a: Input, b: Input): boolean; } /** * {@link Bookmark} item representing a bookmarked file. * * @public * @unofficial */ export interface FileBookmarkItem extends BookmarkItem { /** * Vault-relative path to the bookmarked file. */ path: string; /** * Subpath within the file (e.g. heading or block reference). */ subpath: string; /** * Discriminator indicating this is a file bookmark. */ type: "file"; } /** * Cache entry storing file hash, modification time, and size. * * @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; } /** * Represents a file or folder entry in the data adapter's file listing. * * @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; } /** * Internal plugin registration for the file explorer sidebar. * * @public * @unofficial */ export interface FileExplorerPlugin extends InternalPlugin<FileExplorerPluginInstance> { /** * Registers a CLI handler for the file explorer. * * @param command - The command ID. * @param description - The help/autocomplete description. * @param flags - The CLI flags, or `null`. * @param handler - The handler callback. */ registerCliHandler(command: string, description: string, flags: CliFlags | null, handler: CliHandler): void; /** * Reveals a file or folder in the file explorer view, opens the view if it is not already. * open/visible. * * @param item - The file or folder to reveal. */ revealInFolder(item: TAbstractFile): void; } /** * Plugin instance for the file explorer, managing the file tree sidebar view. * * @public * @unofficial */ export interface FileExplorerPluginInstance extends InternalPluginInstance<FileExplorerPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Reference to the file explorer plugin registration. */ plugin: FileExplorerPlugin; /** * Ensures the file explorer leaf exists in the left sidebar. */ initLeaf(): void; /** * Adds file-explorer items to the file context menu. * * @param menu - The menu to add to. * @param file - The file or folder the menu was opened on. * @param source - The source of the menu (e.g. `'file-explorer-context-menu'`). */ onFileMenu(menu: Menu, file: TAbstractFile, source: string): void; /** * Reveals a file or folder in the file explorer view, opens the view if it is not already. * open/visible. * * @param item - The file or folder to reveal. */ revealInFolder(item: TAbstractFile): void; } /** * {@link obsidian#View} that renders the file explorer tree sidebar for navigating vault files and folders. * * @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; /** * Timeout ID for expanding a folder on mouseover during drag, or `null`. */ mouseoverExpandTimeout: null | number; /** * 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; /** * {@link Tree} view of files. */ tree: Tree<FileTreeItem | FolderTreeItem>; /** * Try to rename the file. * * @returns A promise that resolves when the rename is accepted. */ 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. * @returns A promise that resolves when the file is opened and/or rename is started. */ afterCreate(file: TFile, newLeaf: boolean | PaneType): 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; /** * Attach file-related event listeners to an element. * * @param e - The element to attach events to. */ 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. * @returns A promise that resolves when the file or folder is created. */ createAbstractFile(type: "file" | "folder", location: TFolder, newLeaf: boolean | PaneType): Promise<void>; /** * Create a tree item DOM element for the given folder. * * @param folder - The folder to create a tree item for. * @returns The created folder tree item. */ createFolderDom(folder: TFolder): unknown; /** * Create a tree item DOM element for the given file. * * @param file - The file to create a tree item for. * @returns The created file tree item. */ createItemDom(file: TFile): unknown; /** * Display an error message on a file tree item. * * @param message - The error message to display. * @param fileItem - The file tree item to display the error on. */ displayError(message: string, fileItem: unknown): void; /** * Handle dragging files from the file explorer. * * @param event - The drag event. * @param t - The drag target information. * @returns The drag result. */ dragFiles(event: DragEvent, t: unknown): unknown; /** * Quits the rename. */ exitRename(): void; /** * Get the unique node identifier for a tree item. * * @param e - The tree item. * @returns The node identifier. */ getNodeId(e: unknown): unknown; /** * Get a sorted list of the tree items for a specific folder). * * @param folder - The folder to get sorted items for. * @returns The sorted file tree items. */ getSortedFolderItems(folder: TFolder): FileTreeItem[]; /** * Get the current view type. * * @returns The file explorer view type. */ getViewType(): typeof ViewType.FileExplorer; /** * Check whether the given object is a file tree item. * * @param item - The object to check. * @returns Whether the object is a file tree item. */ 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. * @returns A promise that resolves when the folder is created. */ 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. * @returns A promise that resolves when the note is created. */ 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. * @returns The result of the delete operation. */ 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; /** * Handle input events in the file rename text field. * * @param e - The input event. */ 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. * * @param file - The file or folder to reveal. */ revealInFolder(file: TAbstractFile): void; /** * Set whether all folders are collapsed. * * @param e - Whether to collapse all folders. */ 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; /** * Begin inline renaming of a file tree item. * * @param e - The file tree item to rename. * @returns The rename result. */ startRenameFile(e: unknown): unknown; /** * Reloads the config from vault and update all items. */ updateConfig(): void; } /** * Record mapping file paths to their corresponding file or folder tree items. * * @public * @unofficial */ export interface FileExplorerViewFileItemsRecord extends Record<string, FileTreeItem | FolderTreeItem> { } /** * {@link obsidian#View} that displays frontmatter properties for the current file. * * @public * @unofficial */ export interface FilePropertiesView extends InfoFileView { /** * The file whose frontmatter the view is currently editing, or `null` when no supported file is loaded. */ modifyingFile: null | TFile; /** * Constructor. * * @param leaf - The workspace leaf. * @param propertiesPluginInstance - The properties plugin instance. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor3__?(leaf: WorkspaceLeaf, propertiesPluginInstance: PropertiesPluginInstance): this; /** * Returns the file. * * @returns The current file. */ getFile(): TFile; /** * Get the current view type. * * @returns The file properties view type. */ getViewType(): typeof ViewType.FileProperties; /** * Checks the file is an markdown file. * * @param file - The file to check. * @returns Whether the file is a supported markdown file. */ isSupportedFile(file: TFile): boolean; /** * Handle a file content change and refresh properties. * * @param file - The changed file. * @returns Resolves when the properties are refreshed. */ onFileChange(file: TFile): Promise<unknown>; /** * Handle a quick preview update for the file. * * @param file - The file being previewed. * @param t - The preview data. */ onQuickPreview(file: TFile, t: unknown): void; /** * Reads the file if it is supported. * * @param file - The file to read. * @returns A promise that resolves with the file contents. */ readSupportedFile(file: TFile): Promise<unknown>; /** * Save the modified frontmatter data to the file. * * @param e - The frontmatter data to save. */ saveFrontmatter(e: unknown): void; /** * Move focus to the next property field. */ shiftFocusAfter(): void; /** * Move focus to the previous property field. */ shiftFocusBefore(): void; /** * Refresh the file properties view. */ update(): void; /** * Update the empty state display when no properties exist. */ updateEmptyState(): void; /** * Update the frontmatter of a file with new property data. * * @param file - The file to update. * @param t - The new property data. * @returns The update result. */ updateFrontmatter(file: TFile, t: unknown): unknown; } /** * 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. */ onFocus(): void; /** * Set the value of the property widget. * * @param value - The value to set. */ setValue(value: unknown): void; } /** * Internal plugin registration for the file recovery/snapshots feature. * * @public * @unofficial */ export interface FileRecoveryPlugin extends InternalPlugin<FileRecoveryPluginInstance> { } /** * Plugin instance for file recovery, managing file snapshots for restoration. * * @public * @unofficial */ export interface FileRecoveryPluginInstance extends InternalPluginInstance<FileRecoveryPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; } /** * Editor suggestion provider for file and link autocompletion. * * @typeParam T - The type of the suggestion items. * @public * @unofficial */ export interface FileSuggest<T> extends EditorSuggest<T> { /** * Manages fetching of suggestions from metadatacache. */ suggestManager: FileSuggestManager; } /** * File suggest manager. * * @public * @unofficial */ export interface FileSuggestManager { /** * Reference to the app. */ app: App; /** * Selection of files and their paths that can be matched to. */ fileSuggestions: FileSuggestion[] | null; /** * Whether search should be vault-wide rather than scoped to current file. */ global: boolean; /** * Type of suggestions that should be provided. */ mode: "block" | "display" | "file" | "heading" | string; /** * Executor of the search. */ runnable: null | Runnable; /** * Get suggestions for block query. * * @param runner - {@link Runnable} controlling the search lifecycle. * @param file - File to search within. * @param text - Search query text. * @returns Matching block suggestions. */ getBlockSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>; /** * Get suggestions for display alias query. * * @param runner - {@link Runnable} controlling the search lifecycle. * @param linkpath - Link path to resolve. * @param subpath - Subpath within the file. * @param alias - Alias text to search. * @returns Matching display suggestions. */ getDisplaySuggestions(runner: Runnable, linkpath: string, subpath: string, alias: string): Promise<SearchResult[]>; /** * Get suggestions for file query. * * @param runner - {@link Runnable} controlling the search lifecycle. * @param text - Search query text. * @returns Matching file suggestions. */ getFileSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>; /** * Get suggestions for global block query. * * @param runner - {@link Runnable} controlling the search lifecycle. * @param text - Search query text. * @returns Matching global block suggestions. */ getGlobalBlockSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>; /** * Get suggestions for global heading query. * * @param runner - {@link Runnable} controlling the search lifecycle. * @param text - Search query text. * @returns Matching global heading suggestions. */ getGlobalHeadingSuggestions(runner: Runnable, text: string): Promise<SearchResult[]>; /** * Get suggestions for file heading query. * * @param runner - {@link Runnable} controlling the search lifecycle. * @param file - File to search within. * @param text - Search query text. * @returns Matching heading suggestions. */ getHeadingSuggestions(runner: Runnable, file: TFile, text: string): Promise<SearchResult[]>; /** * Generate instructions for specific actions in suggestion manager (e.g. accept, select, ...). * * @returns Array of instructions. */ getInstructions(): [ Instruction ]; /** * Determine the source path of current context. * * @returns Source path string, or `null`. */ getSourcePath(): null | string; /** * Get suggestions for current input text. * * @param runner - {@link Runnable} controlling the search lifecycle. * @param text - Search query text. * @returns Matching suggestions. * @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. * * @param path - Path of the file. * @param file - File containing the block. * @param block - Block cache entry to match against. * @param sourcePath - Source path for link resolution. * @param content - Content of the block. * @param textParts - Search fragments to match. * @returns Search result if matched, or `null`. */ matchBlock(path: string, file: TFile, block: BlockCache, sourcePath: null | string, content: string, textParts: string[]): null | SearchResult; } /** * File suggestion. * * @public * @unofficial */ export interface FileSuggestion { /** * The file. */ file: null | TFile; /** * The path. */ path: string; } /** * Callback interface for handling file system watch events. * * @public * @unofficial */ export interface FileSystemWatchHandler { /** * Handle raw, folder-created, folder-removed, or file-removed events. */ (eventType: "file-removed" | "folder-created" | "folder-removed" | "raw", path: string): void; /** * Handle modified or file-created events with file stats. */ (eventType: "file-created" | "modified", path: string, oldPath: undefined, stats: FileStats): void; /** * Handle file rename events with old and new paths. */ (eventType: "renamed", path: string, oldPath: string): void; /** * Handle watcher closed events. */ (eventType: "closed"): void; } /** * {@link Tree} item representing a file in the file explorer. * * @public * @unofficial */ export interface FileTreeItem extends AbstractFileTreeItem<TFile> { /** * Element that indicates associated file extension, * if it wasn't a Markdown file. */ tagEl: HTMLElement | null; /** * Check whether the file type is supported for opening. * * @returns Whether the file type is supported. */ isSupported(): boolean; } /** * Function `Flat`. * * @public * @unofficial */ export interface FlatFunction extends BasesFunction { } /** * Function `Floor`. * * @public * @unofficial */ export interface FloorFunction extends BasesFunction, HasGetDisplayName { } /** * Options for focusing a specific property or heading in the metadata editor. * * @public * @unofficial */ export interface FocusMetadataOptions { /** * Whether to focus the metadata heading element. */ focusHeading: boolean; /** * Index of the property to focus on. */ propertyIdx?: number; /** * Key of the property to focus on. */ propertyKey?: string; } /** * Represents a folded range in the editor. * * @public * @unofficial */ export interface Fold { /** * Start line of the fold. */ from: number; /** * End line of the fold. */ to: number; } /** * Information about all folds in a document. * * @public * @unofficial */ export interface FoldInfo { /** * Array of folded ranges. */ folds: Fold[]; /** * Total number of lines in the document. */ lines: number; } /** * Manager for persisting and restoring editor fold states. * * @public * @unofficial */ export interface FoldManager { /** * Reference to the app. */ app: App; /** * Remove stale fold data from the cache. * * @returns The result of the cleanup operation. * To get the constructor instance, use {@link getFoldManagerConstructor} from `obsidian-typings/implementations`. */ cleanup(): unknown; /** * Constructor. * * To get the constructor instance, use {@link getFoldManagerConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App): this; /** * Load fold state for the given file or view. * * @returns The loaded fold state. */ load(arg1: unknown): unknown; /** * Load fold state from a specific path. * * @returns The loaded fold state. */ loadPath(arg1: unknown): unknown; /** * Save fold state for the given file or view. * * @returns The result of the save operation. */ save(arg1: unknown, arg2: unknown): unknown; /** * Save fold state to a specific path. * * @returns The result of the save operation. */ savePath(arg1: unknown, arg2: unknown): unknown; } /** * {@link Bookmark} item representing a bookmarked folder. * * @public * @unofficial */ export interface FolderBookmarkItem extends BookmarkItem { /** * Vault-relative path to the bookmarked folder. */ path: string; /** * Discriminator indicating this is a folder bookmark. */ 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. */ onFocus(): void; /** * Set the value of the property widget. * * @param value - The value to set. */ setValue(value: unknown): void; } /** * {@link Tree} item representing a folder in the file explorer, supporting collapse and child items. * * @public * @unofficial */ export interface FolderTreeItem extends AbstractFileTreeItem<TFile>, TreeCollapsibleItem { /** * Spacer element used for indentation in the tree. */ pusherEl: HTMLElement; /** * Virtual children container managing child file and folder tree items. */ vChildren: TreeNodeVChildren<FileTreeItem | FolderTreeItem, FolderTreeItem>; /** * Sort file items inside by current sort order. */ sort(): void; } /** * Internal plugin registration for the footnotes feature. * * @public * @unofficial */ export interface FootnotesPlugin extends InternalPlugin<FootnotesPluginInstance> { } /** * Plugin instance for footnotes, providing footnote creation and navigation. * * @public * @unofficial */ export interface FootnotesPluginInstance extends InternalPluginInstance<FootnotesPlugin> { /** * Initialize the footnotes view leaf. */ initLeaf(): void; } /** * DOM elements for the custom window frame (title bar) on desktop. * * @public * @unofficial */ export interface FrameDom { /** * Reference to the Electron browser window. */ eWin: ElectronBrowserWindow; /** * Whether the current platform is macOS. */ isMac: boolean; /** * Container for window control buttons on the left side. */ leftButtonContainerEl: HTMLDivElement; /** * Debounced request to update the window status indicators in the title bar. */ requestUpdateStatus: Debouncer<[ ], void>; /** * The title bar element. */ titleBarEl: HTMLDivElement; /** * Inner container of the title bar. */ titleBarInnerEl: HTMLDivElement; /** * Element displaying the title bar text. */ titleBarTextEl: HTMLDivElement; /** * Reference to the window object. */ win: Window; /** * Constructor. * * To get the constructor instance, use {@link getFrameDomConstructor} from `obsidian-typings/implementations`. * * @param electronWindow - The electronWindow. * @param win - The win. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(electronWindow: ElectronBrowserWindow, win: Window): this; /** * Update the window status indicators in the title bar. */ updateStatus(): void; /** * Update the displayed title in the title bar. */ updateTitle(): void; } /** * Parameters for getting page annotations. * * @public * @unofficial */ export interface GetAnnotationsParams { /** The rendering intent. */ intent?: string; } /** * 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; } /** * Options for getting a single resource value. * * @public * @unofficial */ export interface GetResourceOptions { /** Custom key separator. */ keySeparator?: string; } /** * Parameters for getting page text content. * * @public * @unofficial */ export interface GetTextContentParams { /** Whether to disable text normalization. */ disableNormalization?: boolean; /** Whether to include marked content. */ includeMarkedContent?: boolean; } /** * Parameters for computing a page viewport. * * @public * @unofficial */ export interface GetViewportParams { /** Whether to flip the viewport. */ dontFlip?: boolean; /** Horizontal offset. */ offsetX?: number; /** Vertical offset. */ offsetY?: number; /** Rotation angle in degrees. */ rotation?: number; /** Scale factor. */ scale: number; } /** * Internal plugin registration for the global search feature. * * @public * @unofficial */ export interface GlobalSearchPlugin extends InternalPlugin<GlobalSearchPluginInstance> { } /** * Plugin instance for global search, providing vault-wide text search functionality. * * @public * @unofficial */ export interface GlobalSearchPluginInstance extends InternalPluginInstance<GlobalSearchPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * The plugin's options. */ options: unknown; /** * Reference to the global search plugin registration. */ plugin: GlobalSearchPlugin; /** * Gets the current global-search query string. * * @returns The current query, or an empty string when the search view is not open. */ getGlobalSearchQuery(): string; /** * Ensures the global-search leaf exists in the left sidebar. */ initLeaf(): void; /** * Adds a "Search in selection" item to the editor context menu. * * @param menu - The menu to add to. * @param editor - The editor the menu was opened in. */ onEditorMenu(menu: Menu, editor: Editor): void; /** * Handles a settings change made externally (e.g. by Sync). * * @returns A promise that resolves when the change has been handled. */ onExternalSettingsChange(): Promise<void>; /** * Adds a "Search in folder" item to the file context menu. * * @param menu - The menu to add to. * @param file - The file or folder the menu was opened on. * @param source - The source of the menu (e.g. `'file-explorer-context-menu'`). */ onFileMenu(menu: Menu, file: TAbstractFile, source: string): void; /** * Opens the global search with the given query. * * @param query - The search query. * @param active - Whether to focus the search view. Defaults to `true`. */ openGlobalSearch(query: string, active?: boolean): void; } /** * Type for the global worker options object. * * @public * @unofficial */ export interface GlobalWorkerOptionsType { /** The worker port. */ workerPort: null | unknown; /** URL of the worker source file. */ workerSrc: string; } /** * Common grammar token names with optional rest grammar reference. * * @public * @unofficial */ export interface GrammarRest { /** ATRule grammar value. */ "atrule"?: GrammarValue; /** Boolean grammar value. */ "boolean"?: GrammarValue; /** Class name grammar value. */ "class-name"?: GrammarValue; /** Comment grammar value. */ "comment"?: GrammarValue; /** Function grammar value. */ "function"?: GrammarValue; /** Important grammar value. */ "important"?: GrammarValue; /** Keyword grammar value. */ "keyword"?: GrammarValue; /** Number grammar value. */ "number"?: GrammarValue; /** Operator grammar value. */ "operator"?: GrammarValue; /** Property grammar value. */ "property"?: GrammarValue; /** Punctuation grammar value. */ "punctuation"?: GrammarValue; /** Nested rest grammar. */ "rest"?: Grammar; /** Selector grammar value. */ "selector"?: GrammarValue; /** String grammar value. */ "string"?: GrammarValue; /** Style grammar value. */ "style"?: GrammarValue; /** URL grammar value. */ "url"?: GrammarValue; } /** * {@link Bookmark} item representing a saved graph view configuration. * * @public * @unofficial */ export interface GraphBookmarkItem extends BookmarkItem { /** * Graph view options saved with this bookmark. */ options: GraphPluginInstanceOptions; /** * Display title of this graph bookmark. */ title: string; /** * Discriminator indicating this is a graph bookmark. */ 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; } /** * Options section for managing color groups that visually categorize graph nodes. * * @public * @unofficial */ export interface GraphColorGroupOptions extends GraphOptions { /** * List of UI groups, each representing a user-defined color group entry. */ groups: GraphColorGroupOptionsGroup[]; } /** * UI components for a single color group entry in the graph settings panel. * * @public * @unofficial */ export interface GraphColorGroupOptionsGroup { /** * Color picker component for selecting the group color. */ color: ColorComponent; /** * Container element for this color group entry. */ el: HTMLDivElement; /** * Text input component for the search query that defines this group. */ 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; } /** * Options section for graph display settings such as node size, line thickness, and arrows. * * @public * @unofficial */ export interface GraphDisplayOptions extends GraphOptions { } /** * Engine of a graph view. * * @public * @unofficial */ export interface GraphEngine { /** * Reference to the Obsidian app instance. */ app: App; /** * UI controls for configuring color group options. */ colorGroupOptions: GraphColorGroupOptions; /** * Container element for the graph settings controls panel. */ controlsEl: HTMLDivElement; /** * Path of the currently focused file in the local graph. */ currentFocusFile: string; /** * UI controls for configuring display options. */ displayOptions: GraphDisplayOptions; /** * Filter determining which files are included in the graph. */ fileFilter: GraphFileFilter; /** * UI controls for configuring filter options. */ filterOptions: GraphFilterOptions; /** * UI controls for configuring force simulation options. */ forceOptions: GraphForceOptions; /** * Whether any search filter is currently active. */ hasFilter: boolean; /** * Hover popover displayed when hovering over a node. */ hoverPopover: unknown; /** * Last link that was hovered over. */ lastHoverLink: unknown; /** * Current graph plugin options applied to this engine. */ options: GraphPluginInstanceOptions; /** * Current animation progression value for graph transitions. */ progression: number; /** * Speed of the animation progression. */ progressionSpeed: number; /** * Renderer responsible for drawing the graph. */ renderer: GraphRenderer; /** * Active color group search queries for node coloring. */ searchQueries: GraphColorGroup[]; /** * The view (local or global) that owns this engine. */ view: GraphView | LocalGraphView; /** * Gets the engine options. * * @returns The current graph plugin instance 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; } /** * Filter map determining which files appear in the graph, keyed by file path with color or visibility values. * * @public * @unofficial */ export interface GraphFileFilter extends Record<string, boolean | GraphColorAttributes> { } /** * Options section for graph filter settings controlling which files appear in the graph. * * @public * @unofficial */ export interface GraphFilterOptions extends GraphOptions { /** * Search input component for filtering graph nodes by query. */ search: SearchComponent; /** * {@link obsidian#Setting} element containing the search input. */ searchSetting: Setting; } /** * Options section for graph force simulation parameters such as repel, link, and center forces. * * @public * @unofficial */ export interface GraphForceOptions extends GraphOptions { } /** * Graph forces. * * @public * @unofficial */ export interface GraphForces { /** * Strength of the force pulling nodes toward the center of the graph. */ centerStrength?: number; /** * Ideal distance between linked nodes. */ linkDistance?: number; /** * Strength of the attractive force between linked nodes. */ linkStrength?: number; /** * Strength of the repulsive force pushing nodes apart. */ repelStrength?: number; } /** * Represents a link in a graph view. * * @public * @unofficial */ export interface GraphLink { /** * PixiJS element for the arrow, child of {@link GraphRenderer.hanger}. */ arrow: Graphics | null; /** * PixiJS element for the line. */ line: null | Sprite; /** * Parent of {@link GraphLink.line}, child of {@link GraphRenderer.hanger}. */ px: Container | null; /** * Whether the link graphics have been rendered. */ rendered: boolean; /** * {@link 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 {@link GraphRenderer.hanger}. */ circle: Graphics | null; /** * Computed color for the node. */ color: GraphColorAttributes; /** * Current fade alpha value controlling the node's transparency during transitions. */ 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: null | number; /** * Forced y position when the node is dragged. */ fy: null | number; /** * Colored circle added if the node is highlighted, child of {@link 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; /** * Whether the node graphics have been rendered. */ rendered: boolean; /** * {@link 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 {@link GraphNode.circle}. */ text: null | PixiText; /** * 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 * * @param e - The mouse event. */ 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; } /** * Base interface for a collapsible graph options section in the settings panel. * * @public * @unofficial */ export interface GraphOptions extends TreeCollapsibleItem { /** * Get the current values of this options section. * * @param e - The options context. * @returns The current option values. */ getOptions(e: unknown): unknown; /** * Apply new values to this options section. * * @param e - The options to apply. * @returns The applied option values. */ setOptions(e: unknown): unknown; } /** * Internal plugin that provides graph view functionality. * * @public * @unofficial */ export interface GraphPlugin extends InternalPlugin<GraphPluginInstance> { } /** * Instance of the graph internal plugin, managing graph views and options. * * @public * @unofficial */ export interface GraphPluginInstance extends InternalPluginInstance<GraphPlugin> { /** * Reference to the Obsidian app instance. */ app: App; /** * Whether the graph plugin is enabled by default. */ defaultOn: true; /** * User-configurable options for the graph plugin. */ options: GraphPluginInstanceOptions; /** * Reference to the parent graph plugin. */ plugin: GraphPlugin; /** * Reload options when settings are changed externally. * * @returns A promise that resolves when the settings are reloaded. */ onExternalSettingsChange(): Promise<void>; /** * Add graph-related items to the file context menu. * * @param menu - The context menu to add items to. * @param file - The file associated with the menu. * @param source - The source of the menu event. * @param leaf - The workspace leaf, if available. */ onFileMenu(menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf): void; /** * Open the global graph view. * * @param newLeaf - Whether to open the graph in a new leaf. */ openGraphView(newLeaf: boolean): void; /** * Open the local graph view for the current file. * * @param checking - Whether to only check if the command can be executed. * @returns `true` if the command can be executed, or `undefined`. */ openLocalGraph(checking: boolean): true | undefined; /** * Saves the options in graph.json. */ saveOptions(): void; } /** * User-configurable options for the graph plugin, persisted in graph.json. * * @public * @unofficial */ export interface GraphPluginInstanceOptions { /** * Strength of the centering force pulling nodes toward the graph center. */ "centerStrength"?: number; /** * Whether the graph settings panel is closed. */ "close"?: boolean; /** * Whether the color groups section is collapsed in the settings panel. */ "collapse-color-groups"?: boolean; /** * Whether the display section is collapsed in the settings panel. */ "collapse-display"?: boolean; /** * Whether the filter section is collapsed in the settings panel. */ "collapse-filter"?: boolean; /** * Whether the forces section is collapsed in the settings panel. */ "collapse-forces"?: boolean; /** * User-defined color groups for visually grouping nodes by search query. */ "colorGroups"?: GraphColorGroup[]; /** * Whether to hide unresolved (non-existing) linked notes from the graph. */ "hideUnresolved"?: boolean; /** * Multiplier for the thickness of link lines. */ "lineSizeMultiplier"?: number; /** * Ideal distance between linked nodes in the force simulation. */ "linkDistance"?: number; /** * Strength of the attractive force between linked nodes. */ "linkStrength"?: number; /** * Whether to show backlinks in the local graph. */ "localBacklinks"?: boolean; /** * Whether to show forward links in the local graph. */ "localForelinks"?: boolean; /** * Whether to show links between neighbor nodes in the local graph. */ "localInterlinks"?: boolean; /** * Number of link hops to traverse from the current note in the local graph. */ "localJumps"?: number; /** * Multiplier for the size of nodes. */ "nodeSizeMultiplier"?: number; /** * Strength of the repulsive force pushing nodes apart. */ "repelStrength"?: number; /** * Zoom scale level of the graph view. */ "scale"?: number; /** * Search query used to filter which files appear in the graph. */ "search"?: string; /** * Whether to display directional arrows on links. */ "showArrow"?: boolean; /** * Whether to display attachment files in the graph. */ "showAttachments"?: boolean; /** * Whether to display orphan notes (notes with no links) in the graph. */ "showOrphans"?: boolean; /** * Whether to display tags as nodes in the graph. */ "showTags"?: boolean; /** * Multiplier controlling the distance at which node labels begin to fade. */ "textFadeMultiplier"?: number; } /** * Renderer for the graph view, managing PixiJS rendering, user interactions, and layout. * * @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; /** * Whether to hide the power tag indicator in the graph view. */ 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 {@link GraphRenderer.px} to capture events. */ interactiveEl: HTMLCanvasElement; /** * Keyboard action bindings for graph interaction. */ keyboardActions: KeyboardActions; /** * List of links currently rendered. */ links: GraphLink[]; /** * Mouse x coordinate in the graph view. */ mouseX: null | number; /** * Mouse y coordinate in the graph view. */ mouseY: null | number; /** * Record of the nodes currently rendered, with {@link 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; /** * Whether the user is currently panning the graph view. */ panning: boolean; /** * Current pan velocity along the x axis. */ panvX: number; /** * Current pan velocity along the y axis. */ panvY: number; /** * Current pan offset along the x axis. */ panX: number; /** * Current pan offset along the y axis. */ panY: number; /** * Power tag configuration for the graph view. */ 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 {@link GraphRenderer.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; /** * Current visible viewport bounds of the graph view. */ viewport: Coords; /** * Width of the graph view, in pixel. */ width: number; /** * Web Worker thread running the graph simulation. */ worker: Worker; /** * Results received from the graph simulation worker. */ 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; /** * Destroy the renderer and release all resources. */ destroy(): void; /** * Destroy all the graphics of the graph. */ destroyGraphics(): void; /** * Capture a screenshot of the graph with the background included. * * @returns The canvas element containing the screenshot. */ getBackgroundScreenshot(): HTMLCanvasElement; /** * Returns the currently highlighted node, if any. * * @returns The highlighted node, or `null` if none. */ getHighlightNode(): GraphNode | null; /** * Capture a screenshot of the graph with a transparent background. * * @returns The canvas containing the screenshot. */ getTransparentScreenshot(): ICanvas; /** * Initialize all the graphics of the graph. */ initGraphics(): void; /** * Called when the graph iframe finishes loading. */ onIframeLoad(): void; /** * Called when the graph iframe is unloaded. */ onIframeUnload(): void; /** * Handle mouse movement over the graph view. * * @param evt - The mouse event. */ onMouseMove(evt: MouseEvent): void; /** * Handle a click on a graph node. * * @param evt - The mouse event. * @param id - The identifier of the clicked node. * @param type - The type of the clicked node. */ onNodeClick(evt: MouseEvent, id: string, type: string): void; /** * Handle hover over a graph node. * * @param evt - The mouse event. * @param id - The identifier of the hovered node. * @param type - The type of the hovered node. */ onNodeHover(evt: MouseEvent, id: string, type: string): void; /** * Handle a right-click on a graph node. * * @param evt - The mouse event. * @param id - The identifier of the right-clicked node. * @param type - The type of the right-clicked node. */ onNodeRightClick(evt: MouseEvent, id: string, type: string): void; /** * Handle the pointer leaving a graph node. */ onNodeUnhover(): void; /** * Handle a pointer down event on the graph. * * @param renderer - The graph renderer instance. * @param evt - The pointer event. */ onPointerDown(renderer: GraphRenderer, evt: PointerEvent): void; /** * Handle the pointer leaving the graph view. */ onPointerOut(): void; /** * Handle the pointer entering the graph view. * * @param renderer - The graph renderer instance. * @param evt - The pointer event. */ onPointerOver(renderer: GraphRenderer, evt: PointerEvent): void; /** * Handle a resize of the graph container. */ onResize(): void; /** * Handle a wheel (scroll/zoom) event on the graph view. * * @param evt - The wheel event. */ onWheel(evt: WheelEvent): void; /** * Queue a render frame to be executed on the next animation frame. */ queueRender(): void; /** * Callback invoked on each render frame. */ renderCallback(): void; /** * Reset the pan offset to the origin. */ resetPan(): void; /** * Set the graph data (nodes and links) to render. * * @param data - The graph data containing nodes and links. */ setData(data: GraphData): void; /** * Set the force simulation parameters. * * @param forces - The force simulation parameters. */ setForces(forces: GraphForces): void; /** * Set the pan offset to the given coordinates. * * @param panX - The pan offset along the x axis. * @param panY - The pan offset along the y axis. */ setPan(panX: number, panY: number): void; /** * Set the rendering options for the graph view. * * @param options - The graph plugin instance options. */ setRenderOptions(options: GraphPluginInstanceOptions): void; /** * Set the zoom scale of the graph view. * * @param scale - The zoom scale level. */ setScale(scale: number): void; /** * Re-read CSS variables and update the graph colors accordingly. */ testCSS(): void; /** * Interpolate the current zoom level towards the target scale. */ updateZoom(): void; /** * Zoom the graph view to the given scale, centered on the given point. * * @param scale - The target zoom scale. * @param pointer - The point to center the zoom on. */ zoomTo(scale: number, pointer: Point): void; } /** * Obsidian view for a global graph. * * @public * @unofficial */ export interface GraphView extends ItemView { /** * Graph engine powering the global graph simulation. */ dataEngine: GraphEngine; /** * Renderer responsible for drawing the global graph. */ renderer: GraphRenderer; /** * Get the current view type. * * @returns The graph view type. */ getViewType(): typeof ViewType.Graph; /** * Updates the options from the plugin when changed in view. */ onOptionsChange(): void; /** * Renders the graph. */ update(): void; } /** * Function `Greater`. * * @public * @unofficial */ export interface GreaterFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType { } /** * Function `GreaterOrEqual`. * * @public * @unofficial */ export interface GreaterOrEqualFunction extends BasesFunction, HasGetDisplayName, HasCompare, HasGetRHSWidgetType { } /** * {@link Bookmark} item representing a group that contains other bookmark items. * * @public * @unofficial */ export interface GroupBookmarkItem extends BookmarkItem { /** * Child bookmark items contained in this group. */ items: BookmarkItem[]; /** * Display title of this bookmark group. */ title: string; /** * Discriminator indicating this is a group bookmark. */ type: "group"; } /** * Options for hard-wrapping text in the editor. * * @public * @unofficial */ export interface HardWrapOptions { /** * Whether to allow merging short lines together. */ allowMerge?: boolean; /** * The column number at which to wrap lines. */ column?: number; /** * Starting line number to begin wrapping from. */ from?: number; /** * Ending line number to stop wrapping at. */ to?: number; } /** * Has compare. * * @public * @unofficial */ export interface HasCompare { /** * Compares two values. * * @param a - The first value to compare. * @param b - The second value to compare. * @returns Whether the comparison is satisfied. */ compare(a: unknown, b: unknown): boolean; } /** * Has extract. * * @public * @unofficial */ export interface HasExtract { /** * Extracts a date. * * @param date - The date to extract from. * @returns The extracted numeric value. */ extract(date: Date): number; } /** * Has get display name. * * @public * @unofficial */ export interface HasGetDisplayName { /** * Gets the display name. * * @param type - The type to get the display name for. * @returns The display name. */ getDisplayName(type: string): string; } /** * Has get RHS widget type. * * @public * @unofficial */ export interface HasGetRHSWidgetType { /** * Gets the RHS widget type. * * @param type - The type to get the RHS widget type for. * @returns The RHS widget type. */ getRHSWidgetType(type: string): string; } /** * Options for checking whether a namespace has been loaded. * * @public * @unofficial */ export interface HasLoadedNamespaceOptions { /** Language code to check. */ lng?: string; } /** * Renders navigation buttons and sort controls for a section header in the backlink view. * * @public * @unofficial */ export interface HeaderDom { /** * Reference to the app. */ app: App; /** * Container element for navigation buttons. */ navButtonsEl: HTMLDivElement; /** * Container element for the navigation header. */ navHeaderEl: HTMLDivElement; /** * Add a navigation button to the header. * * @returns The created navigation button element. */ addNavButton(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; /** * Add a sort button to the header. * * @returns The created sort button element. */ addSortButton(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; } /** * Information about a heading section in a note, including its text and position range. * * @public * @unofficial */ export interface HeadingInfo { /** * End position of the heading section in the editor. */ end: EditorPosition; /** * The heading text content. */ heading: string; /** * Start position of the heading section in the editor. */ start: EditorPosition; } /** * Event data passed to DOMPurify hooks during sanitization. * * @public * @unofficial */ export interface HookEvent { /** Record of currently allowed tags. */ allowedTags: Record<string, boolean>; /** The tag name of the current element being processed. */ tagName: string; } /** * Manager for keyboard shortcut registration, storage, and triggering. * * @public * @unofficial */ export interface HotkeyManager { /** * Reference to the {@link obsidian#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; /** * Debounced handler for hotkey config file changes on disk. */ onConfigFileChange: Debouncer<[ ], Promise<void>>; /** * Add a hotkey to the default hotkeys. * * @param command - {@link obsidian#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; /** * Constructor. * * To get the constructor instance, use {@link getHotkeyManagerConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App): this; /** * Get hotkey associated with command ID. * * @param command - {@link obsidian#Command} ID to get hotkey for. * @returns The default hotkeys for the command. */ getDefaultHotkeys(command: string): KeymapInfo[]; /** * Get hotkey associated with command ID. * * @param command - {@link obsidian#Command} ID to get hotkey for. * @returns The hotkeys for the command. */ getHotkeys(command: string): KeymapInfo[]; /** * Load hotkeys from storage. */ load(): void; /** * Handle raw file system change events for the hotkey config. * * @param e - The file system change event. */ onRaw(e: unknown): void; /** * Trigger a command by keyboard event. * * @param event - Keyboard event to trigger command with. * @param keypress - Pressed key information. * @returns Whether a command was triggered. */ onTrigger(event: KeyboardEvent, keypress: KeymapInfo): boolean; /** * Pretty-print hotkey of a command. * * @param commandId - {@link obsidian#Command} ID to print hotkey for. * @returns The formatted hotkey string. */ printHotkeyForCommand(commandId: string): string; /** * Register event listeners for hotkey config file changes. */ registerListeners(): void; /** * Remove a hotkey from the default hotkeys. * * @param command - {@link obsidian#Command} ID to remove hotkey from. */ removeDefaultHotkeys(command: string): void; /** * Remove a hotkey from the custom hotkeys. * * @param command - {@link obsidian#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 - {@link obsidian#Command} ID to add hotkey to. * @param keys - Hotkeys to add. */ setHotkeys(command: string, keys: KeymapInfo[]): void; } /** * Record mapping command IDs to their user-customized hotkey bindings. * * @public * @unofficial */ export interface HotkeyManagerCustomKeysRecord extends Record<string, KeymapInfo[]> { } /** * Record mapping command IDs to their default hotkey bindings. * * @public * @unofficial */ export interface HotkeyManagerDefaultKeysRecord extends Record<string, KeymapInfo[]> { } /** * Setting tab for viewing and editing keyboard hotkeys. * * @public * @unofficial */ export interface HotkeysSettingTab extends SettingTab { /** * Search component for filtering hotkeys by name. */ searchComponent: SearchComponent; /** * Update visibility of hotkey entries based on the current search filter. */ 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: "editor" | "file-explorer" | "graph" | "hover-link" | "preview" | "properties" | "search"; /** * The source path. */ sourcePath?: string; /** * The state of the event. */ state?: HoverLinkEventState; /** * The target element. */ targetEl: HTMLElement | null; } /** * State passed with hover link events. * * @public * @unofficial */ export interface HoverLinkEventState { /** * Scroll position at the time of the hover event. */ scroll: unknown; } /** * Main i18next instance interface. * * @public * @unofficial */ export interface I18n { /** Whether the instance has been initialized. */ isInitialized: boolean; /** Whether the instance is currently initializing. */ isInitializing: boolean; /** The language a change is currently in progress to, if any. */ isLanguageChangingTo?: string; /** The active language code. */ language: string; /** The list of languages in fallback order. */ languages: readonly string[]; /** The i18next logger instance. */ logger: unknown; /** Loaded plugin modules. */ modules: I18nModules; /** The registered event observers. */ observers: unknown; /** The resolved initialization options. */ options: InitOptions; /** The resolved language, if available. */ resolvedLanguage?: string; /** The services container. */ services: Services; /** The resource store. */ store: ResourceStore; /** The translation function. */ t: TFunction; /** The i18next translator instance. */ translator: unknown; /** * Adds a single resource entry. * * @param lng - Language code. * @param ns - Namespace. * @param key - Resource key. * @param value - Resource value. * @param options - Additional options including `keySeparator` and `silent`. * @returns The i18n instance. */ addResource(lng: string, ns: string, key: string, value: string, options?: AddResourceOptions): I18n; /** * Adds a resource bundle. * * @param lng - Language code. * @param ns - Namespace. * @param resources - Bundle of resources. * @param deep - Whether to deep merge. * @param overwrite - Whether to overwrite existing keys. * @returns The i18n instance. */ addResourceBundle(lng: string, ns: string, resources: Record<string, unknown>, deep?: boolean, overwrite?: boolean): I18n; /** * Adds multiple resource entries. * * @param lng - Language code. * @param ns - Namespace. * @param resources - Resource entries. * @returns The i18n instance. */ addResources(lng: string, ns: string, resources: Record<string, string>): I18n; /** * Changes the active language. * * @param lng - Language code. * @param callback - Optional callback. * @returns A promise resolving to the translation function. */ changeLanguage(lng?: string, callback?: Callback): Promise<TFunction>; /** * Creates a new i18next instance. * * @param options - Initialization options. * @param callback - Optional callback. * @returns A new i18n instance. */ cloneInstance(options?: InitOptions, callback?: Callback): I18n; /** * Creates a new i18next instance. * * @param options - Initialization options. * @param callback - Optional callback. * @returns A new i18n instance. */ createInstance(options?: InitOptions, callback?: Callback): I18n; /** * Returns the text direction for a language. * * @param lng - Language code. * @returns The text direction. */ dir(lng?: string): "ltr" | "rtl"; /** * Emits an event. * * @param event - Event name. * @param args - Event arguments. */ emit(event: string, ...args: unknown[]): void; /** * Checks whether a translation key exists. * * @param key - Translation key. * @param options - Additional options. * @returns Whether the key exists. */ exists(key: string | string[], options?: Record<string, unknown>): boolean; /** * Formats a value. * * @param value - The value to format. * @param format - The format string. * @param lng - Language code. * @param options - Additional options. * @returns The formatted string. */ format(value: unknown, format?: string, lng?: string, options?: Record<string, unknown>): string; /** * Gets all resource data for a language. * * @param lng - Language code. * @returns The resource data or `undefined`. */ getDataByLanguage(lng: string): Record<string, Record<string, string>> | undefined; /** * Gets a translation function fixed to a language and namespace. * * @param lng - Language code or codes. * @param ns - Namespace or namespaces. * @returns A fixed translation function. */ getFixedT(lng: string | string[], ns?: string | string[]): TFunction; /** * Gets a single resource value. * * @param lng - Language code. * @param ns - Namespace. * @param key - Resource key. * @param options - Additional options including `keySeparator`. * @returns The resource value. */ getResource(lng: string, ns: string, key: string, options?: GetResourceOptions): unknown; /** * Gets a resource bundle for a language and namespace. * * @param lng - Language code. * @param ns - Namespace. * @returns The resource bundle. */ getResourceBundle(lng: string, ns: string): Record<string, unknown>; /** * Checks whether a namespace has been loaded. * * @param ns - Namespace or namespaces. * @param options - Additional options including `lng`. * @returns Whether the namespace has been loaded. */ hasLoadedNamespace(ns: string | string[], options?: HasLoadedNamespaceOptions): boolean; /** * Checks whether a resource bundle exists. * * @param lng - Language code. * @param ns - Namespace. * @returns Whether the bundle exists. */ hasResourceBundle(lng: string, ns: string): boolean; /** * Initializes the i18next instance. * * @param options - Initialization options. * @param callback - Optional callback. * @returns A promise resolving to the translation function. */ init(options?: InitOptions, callback?: Callback): Promise<TFunction>; /** * Loads additional languages. * * @param lngs - Language code or codes. * @param callback - Optional callback. * @returns A promise that resolves when loading is complete. */ loadLanguages(lngs: string | string[], callback?: Callback): Promise<void>; /** * Loads additional namespaces. * * @param ns - Namespace or namespaces. * @param callback - Optional callback. * @returns A promise that resolves when loading is complete. */ loadNamespaces(ns: string | string[], callback?: Callback): Promise<void>; /** * Loads resources using the configured backend. * * @param callback - Optional callback. */ loadResources(callback?: () => void): void; /** * Removes a listener for an event. * * @param event - Event name. * @param listener - Listener function. */ off(event: string, listener?: (...args: unknown[]) => void): void; /** * Registers a listener for an event. * * @param event - Event name. * @param listener - Listener function. */ on(event: string, listener: (...args: unknown[]) => void): void; /** * Reloads resources for the given languages and namespaces. * * @param lngs - Language codes, or `null` for all. * @param ns - Namespaces, or `null` for all. * @param callback - Optional callback. * @returns A promise that resolves when reloading is complete. */ reloadResources(lngs?: null | string[], ns?: null | string[], callback?: () => void): Promise<void>; /** * Removes a resource bundle. * * @param lng - Language code. * @param ns - Namespace. * @returns The i18n instance. */ removeResourceBundle(lng: string, ns: string): I18n; /** * Sets the default namespace. * * @param ns - Namespace. */ setDefaultNamespace(ns: string): void; /** * Registers a plugin module. * * @param module - The module, its constructor, or a factory function. * @returns The i18n instance. */ use<T extends Module>(module: ((instance: I18n) => void) | ModuleConstructor<T> | T): this; } /** * Container for loaded i18next plugin modules. * * @public * @unofficial */ export interface I18nModules { /** External plugin modules. */ external: Module[]; } /** * Application options. * * @public * @unofficial */ export interface IApplicationOptions { /** Whether the renderer should use antialiasing. */ antialias?: boolean; /** Whether to automatically adjust for device pixel ratio. */ autoDensity?: boolean; /** Whether to automatically start the render loop. */ autoStart?: boolean; /** Background alpha. */ backgroundAlpha?: number; /** Background color. */ backgroundColor?: ColorSource; /** Whether to clear before each render. */ clearBeforeRender?: boolean; /** Whether to force the canvas renderer. */ forceCanvas?: boolean; /** Height of the renderer. */ height?: number; /** Power preference for the WebGL context. */ powerPreference?: WebGLPowerPreference; /** Whether to preserve the drawing buffer. */ preserveDrawingBuffer?: boolean; /** Element to resize the renderer to. */ resizeTo?: HTMLElement | Window; /** Renderer resolution. */ resolution?: number; /** Whether to use a shared loader. */ sharedLoader?: boolean; /** Whether to use a shared ticker. */ sharedTicker?: boolean; /** Whether the renderer background is transparent. */ transparent?: boolean; /** Canvas view to use. */ view?: ICanvas; /** Width of the renderer. */ width?: number; } /** * Canvas interface for PixiJS rendering. * * @public * @unofficial */ export interface ICanvas extends Partial<EventTarget> { /** Canvas height. */ height: number; /** Canvas width. */ width: number; /** * Returns a 2D rendering context. * * @param contextId - Context identifier. * @param options - Context attributes. * @returns The 2D rendering context, or `null`. */ getContext(contextId: "2d", options?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D | null; /** * Returns a WebGL rendering context. * * @param contextId - Context identifier. * @param options - Context attributes. * @returns The WebGL rendering context, or `null`. */ getContext(contextId: "experimental-webgl" | "webgl", options?: WebGLContextAttributes): null | WebGLRenderingContext; /** * Returns a WebGL2 rendering context. * * @param contextId - Context identifier. * @param options - Context attributes. * @returns The WebGL2 rendering context, or `null`. */ getContext(contextId: "experimental-webgl2" | "webgl2", options?: WebGLContextAttributes): null | WebGL2RenderingContext; /** * Converts the canvas to a blob. * * @param callback - Callback receiving the blob. * @param type - Image MIME type. * @param quality - Image quality. */ toBlob?(callback: (blob: Blob | null) => void, type?: string, quality?: number): void; /** * Converts the canvas to a data URL. * * @param type - Image MIME type. * @param quality - Image quality. * @returns The data URL string. */ toDataURL?(type?: string, quality?: number): string; } /** * Options for destroying a display object. * * @public * @unofficial */ export interface IDestroyOptions { /** Whether to destroy the base texture. */ baseTexture?: boolean; /** Whether to destroy children. */ children?: boolean; /** Whether to destroy the texture. */ texture?: boolean; } /** * A markdown editor that runs inside an iframe, used for embedded editable views. * * @public * @unofficial */ export interface IFramedMarkdownEditor extends MarkdownScrollableEditView { /** * Function that cleans up the iframe and listeners. */ cleanup: (() => void) | null; /** * Element where the editor is embedded into. */ iframeEl: HTMLIFrameElement | null; /** * Executes cleanup function if exists. */ cleanupIframe(): void; /** * Constructs extensions for the editor based on user settings. * * @returns Array of dynamic CodeMirror extensions. * @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. * * @param update - The CodeMirror view update. * @param changed - Whether the document content changed. */ onUpdate(update: ViewUpdate, changed: boolean): void; } /** * Hit area interface. * * @public * @unofficial */ export interface IHitArea { /** * Checks whether the point is inside the hit area. * * @param x - X coordinate. * @param y - Y coordinate. * @returns Whether the point is contained. */ contains(x: number, y: number): boolean; } /** * Point data. * * @public * @unofficial */ export interface IPointData { /** X coordinate. */ x: number; /** Y coordinate. */ y: number; } /** * Renderer interface. * * @public * @unofficial */ export interface IRenderer<VIEW extends ICanvas = ICanvas> { /** Renderer resolution (read-only). */ readonly resolution: number; /** Screen rectangle (read-only). */ readonly screen: PixiRectangle; /** Canvas view (read-only). */ readonly view: VIEW; /** * Destroys the renderer. * * @param removeView - Whether to remove the view from the DOM. */ destroy(removeView?: boolean): void; /** * Renders a display object. * * @param displayObject - The display object to render. */ render(displayObject: DisplayObject): void; /** * Resizes the renderer. * * @param desiredScreenWidth - New width. * @param desiredScreenHeight - New height. */ resize(desiredScreenWidth: number, desiredScreenHeight: number): void; } /** * Text style interface. * * @public * @unofficial */ export interface ITextStyle { /** Text alignment. */ align: TextStyleAlign; /** Whether to break words. */ breakWords: boolean; /** Whether to show a drop shadow. */ dropShadow: boolean; /** Drop shadow alpha. */ dropShadowAlpha: number; /** Drop shadow angle in radians. */ dropShadowAngle: number; /** Drop shadow blur radius. */ dropShadowBlur: number; /** Drop shadow color. */ dropShadowColor: number | string; /** Drop shadow distance. */ dropShadowDistance: number; /** Fill style for the text. */ fill: TextStyleFill; /** Fill gradient stops. */ fillGradientStops: number[]; /** Fill gradient type. */ fillGradientType: TEXT_GRADIENT; /** Font family. */ fontFamily: string | string[]; /** Font size. */ fontSize: number | string; /** Font style. */ fontStyle: TextStyleFontStyle; /** Font variant. */ fontVariant: TextStyleFontVariant; /** Font weight. */ fontWeight: TextStyleFontWeight; /** Leading between lines. */ leading: number; /** Letter spacing. */ letterSpacing: number; /** Line height. */ lineHeight: number; /** Line join style. */ lineJoin: TextStyleLineJoin; /** Miter limit. */ miterLimit: number; /** Padding around the text. */ padding: number; /** Stroke color. */ stroke: number | string; /** Stroke thickness. */ strokeThickness: number; /** Text baseline. */ textBaseline: TextStyleTextBaseline; /** Whether to trim whitespace. */ trim: boolean; /** White space handling. */ whiteSpace: TextStyleWhiteSpace; /** Whether to word wrap. */ wordWrap: boolean; /** Word wrap width. */ wordWrapWidth: number; } /** * Function `If`. * * @public * @unofficial */ export interface IfFunction extends BasesFunction { } /** * View for displaying image files. * * @public * @unofficial */ export interface ImageView extends EditableFileView { /** * Get the current view type. * * @returns The view type identifier. */ getViewType(): typeof ViewType.Image; } /** * 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 { } /** * Virtual scrolling component that renders only visible items in large lists for performance. * * @public * @unofficial */ export interface InfinityScroll { /** * Current visible height of the scroll container. */ height: number; /** * Last recorded scroll position. */ lastScroll: number; /** * Queued computation task, or `null` if none is pending. */ queued: null | unknown; /** * Number of items to render per block. */ renderBlockSize: number; /** * Root element of the virtual scroll container. */ rootEl: unknown; /** * Scrollable element that handles scroll events. */ scrollEl: HTMLElement; /** * Whether the width should be explicitly set on items. */ setWidth: boolean; /** * Current visible width of the scroll container. */ width: number; /** * Internal method to perform layout calculations. * * @param x - First layout parameter. * @param y - Second layout parameter. * @returns The layout calculation result. */ _layout(x: unknown, y: unknown): unknown; /** * Internal method to measure element dimensions. * * @param x - The element to measure. * @returns The measured dimensions. */ _measure(x: unknown): unknown; /** * Internal method to precompute layout information. * * @param x - The input data to precompute. * @returns The precomputed layout data. */ _precompute(x: unknown): unknown; /** * Compute visible items and update the virtual display. * * @param x - The computation input. * @returns The computation result. */ compute(x: unknown): unknown; /** * Find the top position of an element within the scroll container. * * @param x - The element to find. * @param y - Second parameter. * @param z - Third parameter. * @returns The top position of the element. */ findElementTop(x: unknown, y: unknown, z: unknown): unknown; /** * Get the top offset of the root element. * * @returns The top offset of the root element. */ getRootTop(): unknown; /** * Invalidate the cached layout for specific items. * * @param x - First invalidation parameter. * @param y - Second invalidation parameter. * @returns The invalidation result. */ invalidate(x: unknown, y: unknown): unknown; /** * Invalidate all cached layout information. * * @returns The invalidation result. */ invalidateAll(): unknown; /** * Measure dimensions for the given elements. * * @param x - First measurement parameter. * @param y - Second measurement parameter. * @returns The measurement result. */ measure(x: unknown, y: unknown): unknown; /** * Handle resize events and recalculate layout. * * @returns The resize handling result. */ onResize(): unknown; /** * Handle scroll events and update the virtual display. * * @returns The scroll handling result. */ onScroll(): unknown; /** * Queue a deferred computation of visible items. * * @returns The queued computation result. */ queueCompute(): unknown; /** * Scroll the container to bring the specified element into view. * * @param x - The element to scroll into view. * @param y - Scroll options. * @returns The scroll result. */ scrollIntoView(x: unknown, y: unknown): unknown; /** * Update the virtual scroll state with new parameters. * * @param x - First update parameter. * @param y - Second update parameter. * @param z - Third update parameter. * @param u - Fourth update parameter. * @param v - Fifth update parameter. * @param w - Sixth update parameter. * @returns The update result. */ update(x: unknown, y: unknown, z: unknown, u: unknown, v: unknown, w: unknown): unknown; /** * Update the virtual display to reflect current scroll position. * * @param x - The display update input. * @returns The display update result. */ 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; } /** * Configuration options for initializing i18next. * * @public * @unofficial */ export interface InitOptions { /** Whether to enable debug mode. */ debug?: boolean; /** Default namespace to use. */ defaultNS?: false | string; /** Fallback language or languages when translation is not found. */ fallbackLng?: false | string | string[]; /** Fallback namespace or namespaces. */ fallbackNS?: false | string | string[]; /** Interpolation options. */ interpolation?: InterpolationOptions; /** Active language code. */ lng?: string; /** Namespace or namespaces to load. */ ns?: string | string[]; /** Pre-loaded translation resources. */ resources?: Record<string, Record<string, Record<string, string>>>; /** List of supported language codes, or `false` to allow all. */ supportedLngs?: false | string[]; /** Additional options. */ [key: string]: unknown; } /** * Represents a document input for the parser. * * @public * @unofficial */ export interface Input { /** The total length of the input. */ readonly length: number; /** Whether the input is divided into line-sized chunks. */ readonly lineChunks: boolean; /** * Get a chunk of input starting at the given position. * * @param from - The start position. * @returns The chunk string. */ chunk(from: number): string; /** * Read a range of input. * * @param from - The start position. * @param to - The end position. * @returns The string content. */ read(from: number, to: number): string; } /** * Options for installing a theme from a repository. * * @public * @unofficial */ export interface InstallThemeOptions { /** * Author of the theme. */ author: string; /** * Display name of the theme. */ name: string; /** * GitHub repository identifier (e.g. "username/repo"). */ repo: string; } /** * Base interface for an internal plugin registration, managing lifecycle, commands, and views. * * @typeParam InternalPluginInstance - The type of the plugin instance. * @public * @unofficial */ export interface InternalPlugin<InternalPluginInstance> extends Component { /** * Button elements added by this plugin. */ addedButtonEls: HTMLDivElement[]; /** * Reference to the app. */ app: App; /** * {@link Commands} registered by this plugin. */ commands: Command[]; /** * Whether this plugin is currently enabled. */ enabled: boolean; /** * Whether this plugin has a status bar item. */ hasStatusBarItem: boolean; /** * The plugin instance containing the actual logic. */ instance: InternalPluginInstance; /** * Timestamp of the last settings save. */ lastSave: number; /** * Reference to the internal plugins manager. */ manager: InternalPlugins; /** * Mobile file info renderers registered by this plugin. */ mobileFileInfo: MobileFileInfo[]; /** * Debounced handler for config file changes. */ onConfigFileChange: Debouncer<[ ], Promise<void>>; /** * Ribbon items registered by this plugin. */ ribbonItems: RibbonItem[]; /** * Status bar element for this plugin, or `null` if none. */ statusBarEl: HTMLDivElement | null; /** * View creators registered by this plugin, keyed by view type. */ views: Record<string, ViewCreator>; /** * Add a settings tab for this plugin. * * @param settingTab - The settings tab to add. */ addSettingTab(settingTab: PluginSettingTab): void; /** * Constructor. * * To get the constructor instance, use {@link getInternalPluginConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @param instance - The instance. * @param internalPlugins - The internalPlugins. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor2__?(app: App, instance: InternalPluginInstance, internalPlugins: InternalPlugins): this; /** * Delete persisted data for this plugin. * * @returns A promise that resolves when the data is deleted. */ deleteData(): Promise<void>; /** * Disable this plugin. * * @param isDisabledByUser - Whether the user manually disabled the plugin. */ disable(isDisabledByUser?: boolean): void; /** * Enable this plugin. * * @param isEnabledByUser - Whether the user manually enabled the plugin. * @returns A promise that resolves when the plugin is enabled. */ enable(isEnabledByUser?: boolean): Promise<void>; /** * Get the last modified time of the plugin config file. * * @returns The modification timestamp, or `undefined`. */ getModifiedTime(): Promise<number | undefined>; /** * Handle changes to the plugin config file. * * @returns A promise that resolves when the config change is processed. */ handleConfigFileChange(): Promise<void>; /** * Initialize this plugin. */ init(): void; /** * Load persisted data for this plugin. * * @returns The loaded data, or `null` if none exists. */ loadData(): Promise<null | object>; /** * Register a global command for this plugin. * * @param command - The command to register. */ registerGlobalCommand(command: Command): void; /** * Register a mobile file info renderer callback. * * @param renderCallback - The callback to render file info into an element. */ registerMobileFileInfo(renderCallback: (el: HTMLElement) => void): void; /** * Register a ribbon item button for this plugin. * * @param title - The tooltip title for the ribbon item. * @param icon - The icon name to display. * @param callback - The callback invoked when clicked. */ registerRibbonItem(title: string, icon: IconName, callback: () => Promise<void>): void; /** * Register a status bar item for this plugin. */ registerStatusBarItem(): void; /** * Register a view type with its creator function. * * @param type - The view type identifier. * @param creator - The factory function to create the view. */ registerViewType(type: string, creator: ViewCreator): void; /** * Save data for this plugin. * * @param data - The data object to persist. * @returns A promise that resolves when the data is saved. */ saveData(data: object): Promise<void>; } /** * Base interface for an internal plugin instance, providing lifecycle hooks and metadata. * * @typeParam InternalPlugin - The type of the internal plugin. * @public * @unofficial */ export interface InternalPluginInstance<InternalPlugin> { /** * Human-readable description of this plugin. */ description: string; /** * Unique identifier for this plugin. */ id: string; /** * Human-readable display name of this plugin. */ name: string; /** * Initialize the plugin instance with app and plugin references. * * @param app - The app instance. * @param plugin - The internal plugin registration. */ init(app: App, plugin: InternalPlugin): void; /** * Called when the plugin is disabled. * * @param app - The app instance. * @param plugin - The internal plugin registration. */ onDisable?(app: App, plugin: InternalPlugin): void; /** * Called when the plugin is enabled. * * @param app - The app instance. * @param plugin - The internal plugin registration. */ onEnable?(app: App, plugin: InternalPlugin): Promise<void>; /** * Called when the user manually disables the plugin. * * @param app - The app instance. */ onUserDisable?(app: App): void; /** * Called when the user manually enables the plugin. * * @param app - The app instance. */ onUserEnable?(app: App): void; } /** * Manager for all internal (core) plugins, handling registration, enabling, and configuration. * * @public * @unofficial */ export interface InternalPlugins extends Events { /** * Reference to the {@link obsidian#App}. */ app: App; /** * Mapping of whether an internal plugin is enabled. */ config: InternalPluginsConfigRecord; /** * {@link obsidian#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>>; /** * Constructor. * * To get the constructor instance, use {@link getInternalPluginsConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor2__?(app: App): this; /** * Load plugin configs and enable plugins. * * @returns A promise that resolves when all plugins are enabled. */ enable(): Promise<void>; /** * Get an enabled internal plugin by ID. * * @param id - ID of the plugin to get. * @returns The plugin instance, or `null` if not enabled. */ getEnabledPluginById<ID extends InternalPluginNameType>(id: ID): InternalPluginNameInstancesMapping[ID] | null; /** * Get all enabled internal plugins. * * @returns The list of enabled internal plugins. */ getEnabledPlugins(): InternalPlugin<unknown>[]; /** * Get an internal plugin by ID. * * @param id - ID of the plugin to get. * @returns The internal plugin, or `null` if not found. */ getPluginById<ID extends InternalPluginNameType>(id: ID): InternalPluginNamePluginsMapping[ID] | null; /** * Load and register an internal plugin instance. * * @param internalPluginInstance - The plugin instance to load. * @returns The loaded plugin instance. */ loadPlugin<Instance extends InternalPluginInstance<unknown>>(internalPluginInstance: Instance): Instance; /** * Handle raw file change events for the config path. * * @param configPath - The path of the changed config file. */ onRaw(configPath: string): void; /** * Save current plugin configs. * * @returns A promise that resolves when the config is saved. */ saveConfig(): Promise<void>; } /** * Record mapping internal plugin names to their enabled/disabled state. * * @public * @unofficial */ export interface InternalPluginsConfigRecord extends Record<InternalPluginNameType, boolean> { } /** * Options for configuring i18next string interpolation. * * @public * @unofficial */ export interface InterpolationOptions { /** Whether to escape interpolated values. */ escapeValue?: boolean; /** Prefix for interpolation expressions. */ prefix?: string; /** Suffix for interpolation expressions. */ suffix?: string; /** Additional interpolation options. */ [key: string]: unknown; } /** * Event object passed to IPC renderer event listeners. * * @public * @unofficial */ export interface IpcRendererEvent extends ElectronEvent { /** A list of `MessagePort`s that were transferred with this message. */ ports: MessagePort[]; /** The `IpcRenderer` instance that emitted the event originally. */ sender: ElectronIpcRenderer; /** * The `webContents.id` that sent the message. Call `event.sender.sendTo(event.senderId, ...)` to * reply to the message; this only applies to messages sent from a different renderer. Messages * sent directly from the main process set `senderId` to `0`. */ senderId: number; } /** * An async item queue that supports generator-based consumption. * * @typeParam T - The type of the items. * @public * @unofficial */ export interface ItemQueue<T> { /** * Backing storage for the queue items. */ items: ItemQueueItems<T>; /** * Promise resolvers for awaiting the next item. */ promise: null | PromiseWithResolvers<T>; /** * {@link Runnable} controlling the queue's start/stop lifecycle. */ runnable: Runnable; /** * Add a single item to the queue. * * @param item - Item to add. */ add(item: T): void; /** * Add multiple items to the queue. * * @param items - Items to add. */ addList(items: T[]): void; /** * Cancel the queue and stop processing. */ cancel(): void; /** * Remove all items from the queue. */ clear(): void; /** * Return an async generator that yields items as they are enqueued. * * @returns Async generator of items. */ generator(): AsyncGenerator<T>; /** * Notify the queue that a new item is available for consumption. */ notify(): void; /** * Remove a specific item from the queue. * * @param item - Item to remove. */ remove(item: T): void; } /** * Backing storage for an {@link ItemQueue}, providing queue operations on an array. * * @typeParam T - The type of the items. * @public * @unofficial */ export interface ItemQueueItems<T> { /** * Number of items in the queue. */ length: number; /** * Index offset for the next dequeue operation. */ offset: number; /** * Internal array holding queued items. */ queue: T[]; /** * Remove all items from the queue. */ clear(): void; /** * Remove and return the next item from the front of the queue. * * @returns The dequeued item, or `undefined` if empty. */ dequeue(): T | undefined; /** * Add an item to the end of the queue. * * @param item - Item to enqueue. */ enqueue(item: T): void; /** * Add multiple items to the end of the queue. * * @param items - Items to enqueue. */ enqueueArray(items: T[]): void; /** * Get all items currently in the queue. * * @returns Array of all queued items. */ get(): T[]; /** * Whether the queue has no items. * * @returns Whether the queue is empty. */ isEmpty(): boolean; /** * Return the next item without removing it. * * @returns The next item, or `undefined` if empty. */ peek(): T | undefined; /** * Remove a specific item from the queue. * * @param item - Item to remove. */ remove(item: T): void; } /** * Function `Join`. * * @public * @unofficial */ export interface JoinFunction extends BasesFunction { } /** * A registered keyboard shortcut interceptor within a scope. * * @public * @unofficial */ export interface KeyScope { /** * Key to match. */ key: null | string; /** * Modifiers to match. */ modifiers: null | string; /** * {@link obsidian#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 { /** * Whether the down arrow key is currently pressed. */ down?: boolean; /** * Whether the left arrow key is currently pressed. */ left?: boolean; /** * Whether the right arrow key is currently pressed. */ right?: boolean; /** * Whether the shift key is currently pressed. */ shift?: boolean; /** * Whether the up arrow key is currently pressed. */ up?: boolean; /** * Whether the zoom-in key is currently pressed. */ zoomin?: boolean; /** * Whether the zoom-out key is currently pressed. */ zoomout?: boolean; } /** * Protocol for extending and modifying Prism language definitions. * * @public * @unofficial */ export interface LanguageMapProtocol { /** * Creates a new grammar by extending an existing language definition. * * @param id - The language identifier to extend. * @param redef - Token definitions to add or override. * @returns The new grammar. */ extend(id: string, redef: Record<string, GrammarValue>): Grammar; /** * Inserts tokens before an existing token in a grammar. * * @param inside - The language identifier. * @param before - The token name to insert before. * @param insert - The tokens to insert. * @param root - Optional root language map. * @returns The modified grammar. */ insertBefore(inside: string, before: string, insert: Record<string, GrammarValue>, root?: LanguageMap): Grammar; } /** * Internal state for a language's parser, tracking the parse tree and context. * * @see {@link https://github.com/codemirror/language/blob/main/src/language.ts} * @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; /** * Apply a transaction to produce an updated language state. * * @param tr - The transaction to apply. * @returns The updated language state. */ apply(tr: Transaction): LanguageState; } /** * Definition for registering a Mermaid layout loader. * * @public * @unofficial */ export interface LayoutLoaderDefinition { /** Name of the layout. */ name: string; /** * Lazily load the layout implementation. * * @returns A promise resolving to the layout implementation. */ loader(): Promise<unknown>; } /** * Serialized representation of a workspace leaf or split for layout persistence. * * @public * @unofficial */ export interface LeafEntry { /** * Child leaf entries if this is a split container. */ children?: LeafEntry[]; /** * Split direction if this is a split container. */ direction?: SplitDirection; /** * Unique identifier for the leaf. */ id: string; /** * View state of the leaf. */ state?: ViewState; /** * Type of the leaf entry (e.g. "leaf", "split", "tabs"). */ type: string; /** * Width of the leaf in pixels, if applicable. */ 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 { } /** * A range within a Lezer tree defined by start and end positions. * * @public * @unofficial */ export interface LezerTreeRange { /** The start position. */ from: number; /** The end position. */ to: number; } /** * Specification for a line decoration that styles an entire line. * * @public * @unofficial */ export interface LineDecorationSpec { /** HTML attributes to add to the line element. */ attributes?: DecorationAttributes; /** CSS class to add to the line element. */ class?: string; } /** * Handle referencing a specific line in the editor document. * * @public * @unofficial */ export interface LineHandle { /** * Index of the line in the document. */ index: number; /** * Row number of the line. */ row: number; } /** * Describes a change applied to a line handle. * * @public * @unofficial */ export interface LineHandleChange { /** * The change description associated with this line handle update. */ changes: ChangeDesc; } /** * Describes a single link change to apply when a file is renamed or moved. * * @public * @unofficial */ export interface LinkChangeUpdate { /** * New link text to replace the old reference with. */ change: string; /** * The cached reference that needs to be updated. */ reference: ReferenceCache; /** * Path of the file containing the link to update. */ sourcePath: string; } /** * @public * @unofficial * Suggestion for a link to a file. */ export interface LinkSuggestion extends FileSuggestion { /** * Resolved link note alias. */ alias?: string; } /** * Represents a link that needs to be updated due to a file rename or move. * * @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; } /** * Handler for updating links within a specific file type when files are renamed or moved. * * @public * @unofficial */ export interface LinkUpdater { /** * Apply a batch of link change updates to the given file. * * @param file - File to update. * @param updates - Link change updates to apply. * @returns A promise that resolves when the updates have been applied. */ applyUpdates(file: TFile, updates: LinkChangeUpdate[]): Promise<void>; /** * Iterate over all references managed by this updater. * * @param callback - Callback invoked for each reference. */ iterateReferences(callback: (path: string, reference: ReferenceCache) => void): void; /** * Iterate over all references managed by this updater for a specific file. * * @param path - Path of the file to iterate references for. * @param callback - Callback invoked for each reference. */ iterateReferencesForFile(path: string, callback: (reference: ReferenceCache) => void): void; /** * Rename a subpath reference (e.g. heading or block) within a file. * * @param file - File containing the subpath. * @param oldSubpath - Previous subpath. * @param newSubpath - New subpath. * @returns A promise that resolves when the subpath has been renamed. */ renameSubpath(file: TFile, oldSubpath: string, newSubpath: string): Promise<void>; } /** * Record of link updaters keyed by file type, used to update links when files are renamed or moved. * * @public * @unofficial */ export interface LinkUpdaters extends Record<string, LinkUpdater | undefined> { /** * Link updater for canvas files. */ canvas?: CanvasLinkUpdater; } /** * Function `LinksTo`. * * @public * @unofficial */ export interface LinksToFunction extends BasesFunction, HasGetDisplayName, HasGetRHSWidgetType { } /** * Represents a loading progress indicator. * * @public * @unofficial */ export interface LoadProgress { } /** * Obsidian view for a local graph. * * @public * @unofficial */ export interface LocalGraphView extends InfoFileView { /** * Graph engine powering the local graph simulation. */ engine: GraphEngine; /** * Renderer responsible for drawing the local graph. */ renderer: GraphRenderer; /** * Get the current view type. * * @returns The local graph 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; } /** * Nested dictionary of localization strings for internationalization. * * @public * @unofficial */ export interface Localization { /** * Localized string value, or nested localization group. */ [key: string]: Localization | string; } /** * A map where each key is associated with a set of values. * * @typeParam Key - The key type. * @typeParam Value - The value type. * @public * @unofficial */ export interface MapOfSets<Key, Value> { /** * Internal map storing key-to-set mappings. */ data: Map<Key, Set<Value>>; /** * Add a value to the set associated with the given key. * * @param key - The key. * @param value - The value to add. */ add(key: Key, value: Value): void; /** * Remove a value from the set associated with the given key. * * @param key - The key. * @param value - The value to remove. */ delete(key: Key, value: Value): void; /** * Get the set of values for the given key, or `null` if not found. * * @param key - The key. * @returns Set of values, or `null`. */ get(key: Key): null | Set<Value>; /** * Get the values for the given key as an array. * * @param key - The key. * @returns Array of values. */ getArray(key: Key): Value[]; } /** * Specification for a mark decoration that styles a range of text. * * @public * @unofficial */ export interface MarkDecorationSpec { /** HTML attributes to add to the wrapping element. */ attributes?: DecorationAttributes; /** CSS class to add to the wrapping element. */ class?: string; /** Whether both sides of the decoration are inclusive. */ inclusive?: boolean; /** Whether the end of the decoration is inclusive. */ inclusiveEnd?: boolean; /** Whether the start of the decoration is inclusive. */ inclusiveStart?: boolean; /** The HTML tag to wrap the text in. */ tagName?: string; } /** * Base interface for markdown editor views, providing CodeMirror integration and editing capabilities. * * @public * @unofficial */ export interface MarkdownBaseView extends Component { /** * Reference to the app. */ app: App; /** * Callback to clear all elements. */ cleanupLivePreview: (() => void) | null; /** * 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). * * @returns The active CodeMirror editor view. */ get activeCM(): EditorView; /** * Apply fold history to editor. * * @param info - Fold information to apply. */ applyFoldInfo(info: FoldInfo): void; /** * Constructs local (always active) extensions for the editor. * * @returns Array of CodeMirror extensions. * @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. * * @param cell - Table cell editor to destroy. */ destroyTableCell(cell?: TableCellEditor): void; /** * Edit a specified table cell, creating a table cell editor. * * @param cell - Table editor owning the cell. * @param newCell - Table cell to edit. * @returns The created table cell editor. */ editTableCell(cell: TableEditor, newCell: TableCell): TableCellEditor; /** * Returns attached file of the owner instance. * * @returns The attached file, or `null`. */ get file(): null | TFile; /** * Get the current editor document as a string. * * @returns The editor document content. */ get(): string; /** * Constructs extensions for the editor based on user settings. * * @returns Array of dynamic CodeMirror extensions. * @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. * * @returns Current fold information, or `null`. */ getFoldInfo(): FoldInfo | null; /** * Builds all local extensions and assigns to `this.localExtensions`. * * @returns The local extensions. * @remark Will build extensions if they were not already built. */ getLocalExtensions(): unknown; /** * Creates menu on right mouse click. * * @param event - The pointer event. * @param x - Whether the context menu was triggered by keyboard. * @returns A promise that resolves when the context menu is handled. */ onContextMenu(event: PointerEvent, x: boolean): Promise<void>; /** * Execute click functionality on token on mouse click. * * @param event - The mouse event. * @param element - The clicked element. */ onEditorClick(event: MouseEvent, element?: HTMLElement): void; /** * Execute drag functionality on drag start. * * @param event - The drag event. * @remark Interfaces with dragManager. */ onEditorDragStart(event: DragEvent): void; /** * Execute hover functionality on mouse over event. * * @param event - The mouse event. * @param target - The hovered element. */ onEditorLinkMouseover(event: MouseEvent, target: HTMLElement): void; /** * Execute context menu functionality on right mouse click. * * @param event - The mouse event. * @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. * * @param update - The CodeMirror view update. * @param changed - Whether the document content changed. */ onUpdate(update: ViewUpdate, changed: boolean): void; /** * Returns path of the attached file. * * @returns The file path. */ get path(): string; /** * Reinitialize the editor inside new container. */ reinit(): void; /** * Move the editor into the new container. * * @param newContainer - New container element for the editor. */ reparent(newContainer: 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. * * @param data - Document content to set. * @param clear - Whether to clear existing state. */ 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, ...). * * @param token - The clickable token. * @param newLeaf - Whether to open in a new leaf. */ triggerClickableToken(token: Token, newLeaf: boolean): void; /** * Callback for onUpdate functionality added as an extension. * * @returns A callback function that handles view updates. */ 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; } /** * Ephemeral state for the markdown edit view, storing cursor position. * * @public * @unofficial */ export interface MarkdownEditViewEphemeralState { /** * Current cursor selection range in the editor. */ cursor: EditorRange; } /** * Internal plugin registration for the Markdown importer feature. * * @public * @unofficial */ export interface MarkdownImporterPlugin extends InternalPlugin<MarkdownImporterPluginInstance> { } /** * Plugin instance for the Markdown importer, providing conversion from other formats to Markdown. * * @public * @unofficial */ export interface MarkdownImporterPluginInstance extends InternalPluginInstance<MarkdownImporterPlugin> { /** * Reference to the app. */ app: App; } /** * Extended markdown editor view with scrolling, search, and CSS class management. * * @public * @unofficial */ export interface MarkdownScrollableEditView extends MarkdownBaseView { /** * List of CSS classes applied to the editor. */ cssClasses: [ ]; /** * Whether the editor is currently scrolling. */ isScrolling: boolean; /** * {@link obsidian#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. * * @param scroll - Scroll position to apply. */ applyScroll(scroll: number): void; /** * Constructs local (always active) extensions for the editor. * * @returns Array of CodeMirror extensions. * @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. * * @returns Array of dynamic CodeMirror extensions. * @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. * * @returns Current scroll position. */ 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. * * @param update - The CodeMirror view update. * @param changed - Whether the document content changed. */ onUpdate(update: ViewUpdate, changed: boolean): void; /** * Close editor suggest and removes highlights on click. * * @param event - The mouse event. */ onViewClick(event?: MouseEvent): void; /** * Add classes to the editor, functions as a toggle. * * @param classes - CSS classes to apply. */ setCssClass(classes: string[]): void; /** * Reveal the editor (sets display: block). */ show(): void; /** * Reveal the search (and replace) component. * * @param replace - Whether to show the replace input. */ showSearch(replace: boolean): void; /** * Update the bottom padding of the CodeMirror contentdom. * * @param height - Height of the bottom padding in pixels. */ updateBottomPadding(height: number): void; } /** * Ephemeral state for a markdown view, storing scroll position. * * @public * @unofficial */ export interface MarkdownViewEphemeralState extends Record<string, unknown> { /** * Scroll position in the view. */ scroll: number; } /** * Available view modes for a markdown view. * * @public * @unofficial */ export interface MarkdownViewModes { /** * Reading/preview mode renderer. */ preview: MarkdownPreviewView; /** * Source/edit mode renderer. */ source: MarkdownEditView; } /** * Source mode configuration for a markdown view. * * @public * @unofficial */ export interface MarkdownViewSourceMode { /** * The CodeMirror editor instance used in source mode. */ cmEditor: unknown; } /** * Result of a matching bracket search. * * @public * @unofficial */ export interface MatchingBracket { /** * Position of the matching bracket, if found. */ to?: EditorPosition; } /** * MathJax library interface for rendering LaTeX math expressions. * * @public * @unofficial */ export interface MathJaxEx { /** * MathJax configuration object. */ config: unknown; /** * MathJax component loader. */ loader: unknown; /** * MathJax runtime options. */ options: unknown; /** * MathJax library version string. */ version: string; /** * Get the CHTML stylesheet element for MathJax-rendered content. * * @returns The stylesheet element. */ chtmlStylesheet(): HTMLStyleElement; /** * Get font metrics for a given DOM node, used for scaling math output. * * @param node - DOM node to get metrics for. * @param display - Whether display mode is enabled. * @returns Font metrics for the node. */ getMetricsFor(node: HTMLElement, display?: boolean): ExtendedMetrics; /** * Convert a TeX string to a CHTML (HTML) element synchronously. * * @param math - TeX string to convert. * @param options - Optional rendering options. * @returns The rendered HTML element. */ tex2chtml(math: string, options?: Record<string, unknown>): HTMLElement; /** * Convert a TeX string to a CHTML (HTML) element asynchronously. * * @param math - TeX string to convert. * @param options - Optional rendering options. * @returns The rendered HTML element. */ tex2chtmlPromise(math: string, options?: Record<string, unknown>): Promise<HTMLElement>; /** * Convert a TeX string to MathML markup synchronously. * * @param math - TeX string to convert. * @param options - Optional rendering options. * @returns The MathML markup string. */ tex2mml(math: string, options?: Record<string, unknown>): string; /** * Convert a TeX string to MathML markup asynchronously. * * @param math - TeX string to convert. * @param options - Optional rendering options. * @returns The MathML markup string. */ tex2mmlPromise(math: string, options?: Record<string, unknown>): Promise<string>; /** * Reset the TeX input jax, clearing equation numbering and labels. */ texReset(): void; /** * Typeset math expressions in the given elements synchronously. * * @param elements - The elements to typeset. */ typeset(elements?: null | unknown[]): void; /** * Clear typeset math from the given elements. * * @param elements - The elements to clear. */ typesetClear(elements?: null | unknown[]): void; /** * Typeset math expressions in the given elements asynchronously. * * @param elements - The elements to typeset. * @returns A promise that resolves when typesetting is complete. */ typesetPromise(elements?: null | unknown[]): Promise<void>; } /** * A request for a layout measurement on the editor view. * * @public * @unofficial */ export interface MeasureRequest<T> { /** An optional key used to deduplicate requests. */ key?: unknown; /** * Read a value from the editor's DOM layout. * * @param view - The editor view. * @returns The measured value. */ read(view: EditorView): T; /** * Write layout changes based on the measured value. * * @param measure - The measured value. * @param view - The editor view. */ write?(measure: T, view: EditorView): void; } /** * {@link obsidian#Menu} submenu configuration record. * * @public * @unofficial */ export interface MenuSubmenuConfigRecord extends Record<string, Submenu> { } /** * Mermaid library instance for rendering diagrams and charts. * * @public * @unofficial */ export interface Mermaid { /** Whether to start rendering on page load. */ startOnLoad: boolean; /** Trigger content loaded event. */ contentLoaded(): void; /** * Detect the type of a Mermaid diagram from its text. * * @param text - The diagram text. * @returns The detected diagram type. */ detectType(text: string): string; /** * Initialize Mermaid with the given configuration. * * @param config - The configuration options. */ initialize(config: MermaidConfig): void; /** * Parse a Mermaid diagram definition. * * @param text - The diagram text to parse. * @param parseOptions - Options for parsing. * @returns A promise resolving to the parse result, or `false` if parsing failed. */ parse(text: string, parseOptions?: ParseOptions): Promise<false | ParseResult>; /** Error handler for parse errors. */ parseError?(err: string, hash: unknown): void; /** * Register external diagram definitions. * * @param diagrams - The external diagram definitions to register. * @param opts - Registration options including `lazyLoad`. * @returns A promise that resolves when registration is complete. */ registerExternalDiagrams(diagrams: ExternalDiagramDefinition[], opts?: RegisterExternalDiagramsOptions): Promise<void>; /** * Register icon packs. * * @param iconLoaders - The icon loader functions to register. */ registerIconPacks(iconLoaders: IconLoader[]): void; /** * Register layout loaders. * * @param loaders - The layout loader definitions to register. */ registerLayoutLoaders(loaders: LayoutLoaderDefinition[]): void; /** * Render a Mermaid diagram. * * @param id - The ID for the rendered diagram. * @param text - The diagram text to render. * @param container - Optional container element. * @returns A promise resolving to the render result. */ render(id: string, text: string, container?: Element): Promise<RenderResult>; /** * Run Mermaid rendering on DOM elements. * * @param options - Options for the run. * @returns A promise that resolves when rendering is complete. */ run(options?: RunOptions): Promise<void>; /** * Set a custom parse error handler. * * @param parseErrorHandler - The error handler function. */ setParseErrorHandler(parseErrorHandler: (err: unknown, hash: unknown) => void): void; } /** * Configuration options for Mermaid diagram rendering. * * @public * @unofficial */ export interface MermaidConfig { /** Architecture diagram configuration. */ architecture?: Record<string, unknown>; /** Whether to use absolute arrow markers. */ arrowMarkerAbsolute?: boolean; /** Block diagram configuration. */ block?: Record<string, unknown>; /** C4 diagram configuration. */ c4?: Record<string, unknown>; /** Class diagram configuration. */ class?: Record<string, unknown>; /** Whether to use deterministic IDs. */ deterministicIds?: boolean; /** Seed for deterministic ID generation. */ deterministicIDSeed?: string; /** Entity relationship diagram configuration. */ er?: Record<string, unknown>; /** Flowchart diagram configuration. */ flowchart?: Record<string, unknown>; /** Font family for the diagrams. */ fontFamily?: string; /** Font size for the diagrams. */ fontSize?: number; /** Gantt chart configuration. */ gantt?: Record<string, unknown>; /** Git graph configuration. */ gitGraph?: Record<string, unknown>; /** Journey diagram configuration. */ journey?: Record<string, unknown>; /** Kanban board configuration. */ kanban?: Record<string, unknown>; /** Log level for Mermaid. */ logLevel?: number | string; /** Maximum number of edges allowed. */ maxEdges?: number; /** Maximum text size allowed. */ maxTextSize?: number; /** Mindmap diagram configuration. */ mindmap?: Record<string, unknown>; /** Packet diagram configuration. */ packet?: Record<string, unknown>; /** Pie chart configuration. */ pie?: Record<string, unknown>; /** Quadrant chart configuration. */ quadrantChart?: Record<string, unknown>; /** Requirement diagram configuration. */ requirement?: Record<string, unknown>; /** Sankey diagram configuration. */ sankey?: Record<string, unknown>; /** List of secure keys. */ secure?: string[]; /** Security level for rendering. */ securityLevel?: "antiscript" | "loose" | "sandbox" | "strict"; /** Sequence diagram configuration. */ sequence?: Record<string, unknown>; /** Whether to start rendering on page load. */ startOnLoad?: boolean; /** State diagram configuration. */ state?: Record<string, unknown>; /** Whether to suppress error rendering. */ suppressErrorRendering?: boolean; /** Custom theme name. */ theme?: string; /** Custom theme CSS. */ themeCSS?: string; /** Custom theme variables. */ themeVariables?: Record<string, string>; /** Timeline diagram configuration. */ timeline?: Record<string, unknown>; /** Whether to enable text wrapping. */ wrap?: boolean; /** XY chart configuration. */ xy?: Record<string, unknown>; /** Additional configuration options. */ [key: string]: unknown; } /** * Record mapping file paths to their file cache entries (hash, mtime, size). * * @public * @unofficial */ export interface MetadataCacheFileCacheRecord extends Record<string, FileCacheEntry> { } /** * Record mapping file paths to their parsed cached metadata. * * @public * @unofficial */ export interface MetadataCacheMetadataCacheRecord extends Record<string, CachedMetadata> { } /** * Message received from the metadata cache web worker. * * @public * @unofficial */ export interface MetadataCacheWorkerMessage { /** * Parsed cached metadata returned by the worker. */ data: CachedMetadata; } /** * Editor component for managing frontmatter property fields in a markdown view. * * @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: MetadataEditorProperty | null; /** * 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: HoverPopover | null; /** * 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. * * @param event - The clipboard event. * @param properties - Properties to copy. */ _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. * * @param key - Property key to focus. */ focusKey(key: string): void; /** * Focus on property. * * @param property - Property to focus. */ focusProperty(property: MetadataEditorProperty): void; /** * Focus on property at specified index. * * @param index - Index of the property to focus. */ focusPropertyAtIndex(index: number): void; /** * Focus on property with value. * * @param value - Value to focus. * @param mode - Focus mode. */ focusValue(value: string, mode: FocusMode): void; /** * Handle copy event on selection and serialize properties. * * @param event - The clipboard event. */ handleCopy(event: ClipboardEvent): void; /** * Handle cut event and serialize and remove properties. * * @param event - The clipboard event. */ handleCut(event: ClipboardEvent): void; /** * Handle selection of item for drag handling. * * @param event - The pointer event. * @param property - Property being selected. * @returns Whether the selection was handled. */ handleItemSelection(event: PointerEvent, property: MetadataEditorProperty): boolean; /** * Handle key press event for controlling selection or movement of property up/down. * * @param event - The keyboard event. */ handleKeypress(event: KeyboardEvent): void; /** * Handle paste event of properties into metadata editor. * * @param event - The clipboard event. */ handlePaste(event: ClipboardEvent): void; /** * Whether the editor has focus. * * @returns Whether the editor has focus. */ hasFocus(): boolean; /** * Whether there is a property that is focused. * * @returns Whether a property is focused. */ hasPropertyFocused(): boolean; /** * Add new properties to the metadata editor and save. * * @param properties - Properties to insert. */ insertProperties(properties: Record<string, unknown>): void; /** * On loading of the metadata editor, register on metadata type change event. */ onload(): void; /** * On vault metadata update, update property render. * * @param property - Property that changed. */ onMetadataTypeChange(property: MetadataEditorProperty): void; /** * Remove specified properties from the metadata editor and save, and reset focus if specified. * * @param properties - Properties to remove. * @param resetFocus - Whether to reset focus after removal. * @returns The result of the removal operation. */ removeProperties(properties: MetadataEditorProperty[], resetFocus?: boolean): unknown; /** * Reorder the entry to specified index position and save. * * @param entry - Property entry to reorder. * @param index - Target index position. * @returns The result of the reorder operation. */ 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. * * @param property - Property to select. * @param select - Whether to select or deselect. */ selectProperty(property: MetadataEditorProperty | undefined, select: boolean): void; /** * Convert properties to a serialized object. * * @returns Serialized properties object. */ serialize(): Record<string, unknown>; /** * Sets frontmatter as collapsed or uncollapsed. * * @param collapsed - Whether to collapse. * @param x - Whether to animate the transition. */ setCollapse(collapsed: boolean, x: boolean): void; /** * On context menu event on header element, show property menu. * * @param event - The mouse event. */ showPropertiesMenu(event: MouseEvent): void; /** * Synchronize data with given properties and re-render them. * * @param data - Properties data to synchronize with. */ synchronize(data: Record<string, unknown>): void; /** * Toggle collapsed state of the metadata editor. */ toggleCollapse(): void; } /** * Component representing a single property field in the metadata editor. * * @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: TypeInfo; /** * 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. * * @param mode - Focus mode. */ focusValue(mode?: FocusMode): void; /** * Reveal the property menu on click event. * * @param event - The mouse event. */ handleItemClick(event: MouseEvent): void; /** * Focus on property on blur event. */ handlePropertyBlur(): void; /** * Update key of property and saves, returns `false` if error. * * @param key - New key value. * @returns Whether the update succeeded. */ handleUpdateKey(key: string): boolean; /** * Update value of property and saves. * * @param value - New value. */ handleUpdateValue(value: unknown): void; /** * Loads as draggable property element. */ onload(): void; /** * Render property widget based on type. * * @param entry - Property entry data. * @param checkErrors - Whether to check for errors. * @param useExpectedType - Whether to use the expected type. */ renderProperty(entry: PropertyEntryData<unknown>, checkErrors?: boolean, useExpectedType?: boolean): void; /** * Set the selected class of property. * * @param selected - Whether to select or deselect. */ setSelected(selected: boolean): void; /** * Reveal property selection menu at mouse event. * * @param event - The mouse event. */ showPropertyMenu(event: MouseEvent): void; } /** * Manager for frontmatter property types, handling registration and assignment of property widgets. * * @public * @unofficial */ export interface MetadataTypeManager extends Events { /** * Whether the component is currently loaded (from the {@link obsidian#Component} lifecycle). */ _loaded: boolean; /** * Reference to the {@link obsidian#App}. */ app: App; /** * Associated widget types for each property. */ assignedWidgets: MetadataTypeManagerTypesRecord; /** * Unix timestamp of the last save */ lastSave: number; /** * Debounced handler for property type config file changes on disk. */ onConfigFileChange: Debouncer<[ ], Promise<void>>; /** * Registered properties of the vault. */ properties: MetadataTypeManagerPropertiesRecord; /** * Registered type widgets. */ registeredTypeWidgets: MetadataTypeManagerRegisteredTypeWidgetsRecord; /** * Constructor. * * To get the constructor instance, use {@link getMetadataTypeManagerConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor2__?(app: App): this; /** * Get all registered properties of the vault. * * @returns Record of property names to their info. */ getAllProperties(): Record<string, PropertyInfo>; /** * Get assigned widget type for property. * * @param property - Property name. * @returns The assigned widget type, or `null`. */ getAssignedWidget(property: string): null | PropertyWidgetType; /** * Get info for property. * * @param property - Property name. * @returns Information about the property. */ getPropertyInfo(property: string): PropertyInfo; /** * Get expected widget type for property and the one inferred from the property value. * * @param property - Property name. * @param value - Property value. * @returns Type information for the property. */ getTypeInfo(property: string, value: unknown): TypeInfo; /** * Get property widget. * * @param type - Widget type name. * @returns The property widget. */ getWidget(type: string): PropertyWidget; /** * Load metadata type configuration. */ load(): Promise<void>; /** * Load property types from config. * * @returns A promise that resolves when the property types are loaded. */ loadData(): Promise<void>; /** * Handle raw file system change events for the property type config. * * @param e - The raw file system change event. */ onRaw(e: unknown): void; /** * Register event listeners for property type config file changes. */ registerListeners(): void; /** * Save property types to config. * * @returns A promise that resolves when the property types are saved. */ save(): Promise<void>; /** * Set widget type for property. * * @param property - Property name. * @param type - Widget type to assign. * @returns A promise that resolves when the widget type is set. */ setType(property: string, type: PropertyWidgetType): Promise<void>; /** * Unset widget type for property. * * @param property - Property name. * @returns A promise that resolves when the widget type is unset. */ unsetType(property: string): Promise<void>; /** * Updates `this.properties` to match the {@link obsidian#MetadataCache} */ updatePropertyInfoCache(): void; } /** * Record mapping property names to their metadata information across the vault. * * @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>; } /** * Record mapping property names to their assigned widget entries. * * @public * @unofficial */ export interface MetadataTypeManagerTypesRecord extends Record<string, PropertyWidgetEntry> { } /** * Base interface for metadata property widgets that render value inputs. * * @public * @unofficial */ export interface MetadataWidget { } /** * Function `Min`. * * @public * @unofficial */ export interface MinFunction extends BasesFunction { } /** * Function `Minute`. * * @public * @unofficial */ export interface MinuteFunction extends BasesFunction, HasExtract { } /** * Interface for rendering file information on mobile. * * @public * @unofficial */ export interface MobileFileInfo { /** * Callback to render file info into the given element. * * @param el - The element to render file info into. */ renderCallback(el: HTMLElement): void; } /** * Navigation bar component for the mobile interface. * * @public * @unofficial */ export interface MobileNavbar { } /** * Tab switcher component for navigating between open tabs on mobile. * * @public * @unofficial */ export interface MobileTabSwitcher { /** * Reference to the app. */ app: App; /** * Directory path for cached tab previews. */ cacheDir: string; /** * Container element for the tab switcher. */ containerEl: HTMLDivElement; /** * Inner scrollable element containing tab previews. */ innerScrollEl: HTMLDivElement; /** * Whether the tab switcher is currently visible. */ isVisible: boolean; /** * Debounced function to re-render the tab switcher. */ requestRender: Debouncer<[ ], void>; /** * Scroll container element. */ scrollEl: HTMLDivElement; /** * Weak map caching tab preview images by leaf reference. */ tabPreviewLookup: WeakMap<object, unknown>; /** * Close the currently selected tab. */ close(): void; /** * Hide the tab switcher UI. */ hide(): void; /** * Handle workspace layout changes by updating the tab list. */ onLayoutChange(): void; /** * Render the tab switcher content. */ render(): void; /** * Set up the directory for caching tab preview images. * * @returns A promise that resolves when the cache directory has been set up. */ setupCacheDir(): Promise<void>; /** * Show the tab switcher UI. * * @returns A promise that resolves when the tab switcher is shown. */ show(): Promise<void>; /** * Display the tab management context menu. * * @param e - The mouse event. */ showTabManagementMenu(e: MouseEvent): void; } /** * Toolbar component displayed above the keyboard on mobile. * * @public * @unofficial */ export interface MobileToolbar { } /** * An i18next plugin module. * * @public * @unofficial */ export interface Module { /** The type of the module. */ type: "3rdParty" | "backend" | "formatter" | "i18nFormat" | "languageDetector" | "logger" | "postProcessor"; } /** * Constructor for an i18next module. * * @public * @unofficial */ export interface ModuleConstructor<T extends Module> { /** Creates a new module instance. */ new (): T; } /** * Function `Month`. * * @public * @unofficial */ export interface MonthFunction extends BasesFunction, HasExtract { } /** * {@link 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): null | string; /** * Create a new input element for the multiselect. * * @returns The created input element. */ _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. * @param shouldFocus - Whether to focus the next element after removal. */ 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: null | string[]): this; /** * Trigger the change event of the multiselect. */ triggerChange(): void; } /** * {@link 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. */ onFocus(): void; /** * Set the value of the property widget. * * @param value - The value to set. */ setValue(value: unknown): void; } /** * Layer that handles user interactions with canvas nodes, such as resizing and connecting. * * @public * @unofficial */ export interface NodeInteractionLayer { /** * Reference to the parent canvas instance. */ canvas: CanvasViewCanvas; /** * HTML element used for rendering interaction handles. */ interactionEl: HTMLDivElement; /** * Currently targeted node for interaction, or `null` if none. */ target: null; /** * Render the interaction handles for the current target node. * * @returns The result of rendering the interaction handles. */ render(): unknown; /** * Set the target node for interaction. * * @returns The result of setting the target. */ setTarget(arg1: unknown): unknown; } /** * Configuration for creating a node prop. * * @public * @unofficial */ export interface NodePropConfig<T> { /** Whether this prop is stored per node rather than per type. */ perNode?: boolean; /** A function to deserialize the prop value from a string. */ deserialize?(str: string): T; } /** * A mapping from selectors to prop values. * * @public * @unofficial */ export interface NodePropSelectorMap<T> { /** A selector mapped to its prop value. */ [selector: string]: T; } /** * A function that computes a node prop value for a given node type. * * @public * @unofficial */ export interface NodePropSource { (type: NodeType): [ NodeProp<unknown>, unknown ] | undefined; } /** * 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 { } /** * Internal plugin registration for the note composer (merge/split) feature. * * @public * @unofficial */ export interface NoteComposerPlugin extends InternalPlugin<NoteComposerPluginInstance> { } /** * Plugin instance for note composer, providing note merging and splitting functionality. * * @public * @unofficial */ export interface NoteComposerPluginInstance extends InternalPluginInstance<NoteComposerPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Configuration options for the note composer. */ options: NoteComposerPluginOptions; /** * Reference to the note composer plugin registration. */ pluginInstance: NoteComposerPlugin; /** * Apply a template to content, substituting title placeholders. * * @param content - The template content. * @param fromTitle - The original note title. * @param newTitle - The new note title. * @returns The processed content with substitutions applied. */ applyTemplate(content: string, fromTitle: string, newTitle: string): Promise<string>; /** * Extract the content under a heading into a new note. * * @param file - The source file. * @param editor - The active editor. */ extractHeading(file: TFile, editor: Editor): void; /** * Get the text selection range under a heading at the given line. * * @param file - The source file. * @param editor - The active editor. * @param line - The line number of the heading. * @returns The heading info, or `null` if no heading found. */ getSelectionUnderHeading(file: TFile, editor: Editor, line: number): HeadingInfo | null; /** * Add note composer items to the editor context menu. * * @param menu - The context menu to extend. * @param editor - The active editor. * @param info - The active markdown view or file info. */ onEditorMenu(menu: Menu, editor: Editor, info: MarkdownFileInfo | MarkdownView): void; /** * Called when the plugin is enabled. */ onEnable(app: App, plugin: NoteComposerPlugin): Promise<void>; /** * Handle external settings file changes and reload configuration. * * @returns A promise that resolves when the settings are reloaded. */ onExternalSettingsChange(): Promise<void>; /** * Add note composer items to a file context menu. * * @param menu - The context menu to extend. * @param file - The target file. * @param source - The source of the context menu event. */ onFileMenu(menu: Menu, file: TFile, source: string): void; } /** * Configuration options for the note composer plugin. * * @public * @unofficial */ export interface NoteComposerPluginOptions { /** * Whether to prompt for confirmation before merging notes. */ askBeforeMerging?: boolean; /** * What to leave in place of extracted content: a link, an embed, or nothing. */ replacementText?: "embed" | "link" | "none"; /** * Path to the template file used when extracting content into a new note. */ 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"; /** * Handle focus event. */ onFocus(): void; /** * Set the value of the property widget. * * @param value - The value to set. */ setValue(value: unknown): void; /** * Show the error message. */ showError(): void; } /** * Core DOM elements of the Obsidian application layout. * * @public * @unofficial */ export interface ObsidianDOM { /** * Root element of the application. */ appContainerEl: HTMLElement; /** * Child of {@link ObsidianDOM.appContainerEl} containing the main content of the application. */ horizontalMainContainerEl: HTMLElement; /** * Status bar element containing word count among other things. */ statusBarEl: HTMLElement; /** * Child of {@link ObsidianDOM.horizontalMainContainerEl} containing the workspace DOM. */ workspaceEl: HTMLElement; /** * Constructor. * * To get the constructor instance, use {@link getObsidianDOMConstructor} from `obsidian-typings/implementations`. * * @param containerEl - The containerEl. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(containerEl: HTMLElement): this; } /** * Represents a touch event processed by Obsidian's gesture system. * * @public * @unofficial */ export interface ObsidianTouchEvent { /** * Primary axis of the touch gesture. */ direction: "x" | "y"; /** * The underlying browser touch event. */ evt: TouchEvent; /** * Number of touch points in the gesture. */ points: number; /** * Callbacks for managing the touch gesture lifecycle. */ registerCallback: ObsidianTouchEventRegisterCallback; /** * Starting X coordinate of the touch. */ startX: number; /** * Starting Y coordinate of the touch. */ startY: number; /** * Element that the touch event targets. */ targetEl: HTMLElement; /** * The primary Touch object from the event. */ touch: Touch; /** * Current X coordinate of the touch. */ x: number; /** * Current Y coordinate of the touch. */ y: number; } /** * Callbacks for controlling a touch gesture's lifecycle. * * @public * @unofficial */ export interface ObsidianTouchEventRegisterCallback { /** * Cancel the current touch gesture. */ cancel(): void; /** * Complete the touch gesture with the final coordinates and velocity. * * @param x - The final X coordinate. * @param y - The final Y coordinate. * @param z - The velocity of the gesture. */ finish(x: number, y: number, z: number): void; /** * Update the gesture with the current position during movement. * * @param x - The current X coordinate. */ move(x: number): void; } /** * Parameters for document loading progress callbacks. * * @public * @unofficial */ export interface OnProgressParameters { /** Number of bytes loaded so far. */ loaded: number; /** Total number of bytes to load. */ total: number; } /** * Options for opening an interactive dialog in the editor (e.g., Vim command line). * * @public * @unofficial */ export interface OpenDialogOptions { /** * Whether to display the dialog at the bottom of the editor. */ bottom: number; /** * Whether to close the dialog when it loses focus. */ closeOnBlur: boolean; /** * Whether to close the dialog when the Enter key is pressed. */ closeOnEnter: boolean; /** * Whether to select the input value when the dialog opens. */ selectValueOnOpen: boolean; /** * Initial value for the dialog input. */ value: string; /** * Callback invoked when the dialog is closed. * * @param div - The dialog container element. */ onClose(div: HTMLDivElement): void; /** * Callback invoked when the dialog input value changes. * * @param e - The keyboard event. * @param value - The current input value. * @param callback - The callback to invoke with the result. */ onInput(e: KeyboardEvent, value: string, callback: (value: unknown) => void): void; /** * Callback invoked when a key is pressed down in the dialog. * * @param e - The keyboard event. * @param value - The current input value. * @param callback - The callback to invoke with the result. */ onKeyDown(e: KeyboardEvent, value: string, callback: (value: unknown) => void): void; /** * Callback invoked when a key is released in the dialog. * * @param e - The keyboard event. * @param value - The current input value. * @param callback - The callback to invoke with the result. */ onKeyUp(e: KeyboardEvent, value: string, callback: (value: unknown) => void): void; } /** * Options for opening a notification in the editor. * * @public * @unofficial */ export interface OpenNotificationOptions { /** * Whether to display the notification at the bottom of the editor. */ bottom?: boolean; /** * Duration in milliseconds before the notification is automatically dismissed. */ duration?: number; } /** * Internal plugin registration for the outgoing links feature. * * @public * @unofficial */ export interface OutgoingLinkPlugin extends InternalPlugin<OutgoingLinkPluginInstance> { } /** * Plugin instance for outgoing links, displaying links from the current file. * * @public * @unofficial */ export interface OutgoingLinkPluginInstance extends InternalPluginInstance<OutgoingLinkPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Reference to the outgoing link plugin registration. */ plugin: OutgoingLinkPlugin; } /** * {@link obsidian#View} that displays outgoing links from the current file. * * @public * @unofficial */ export interface OutgoingLinkView extends InfoFileView { /** * Get the current view type. * * @returns The outgoing link view type. */ getViewType(): typeof ViewType.OutgoingLink; /** * Refresh the outgoing links list. */ update(): void; } /** * Internal plugin registration for the document outline (table of contents) feature. * * @public * @unofficial */ export interface OutlinePlugin extends InternalPlugin<OutlinePluginInstance> { } /** * Plugin instance for the outline, displaying headings for the current file. * * @public * @unofficial */ export interface OutlinePluginInstance extends InternalPluginInstance<OutlinePlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Reference to the outline plugin registration. */ plugin: OutlinePlugin; } /** * {@link obsidian#View} that displays the headings outline for the current file. * * @public * @unofficial */ export interface OutlineView extends InfoFileView { /** * Constructor. * * @param leaf - The workspace leaf. * @param outlinePluginInstance - The outline plugin instance. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor3__?(leaf: WorkspaceLeaf, outlinePluginInstance: OutlinePluginInstance): this; /** * Create a DOM element for an outline heading item. * * @param e - The heading data. * @returns The created DOM element. */ createItemDom(e: unknown): unknown; /** * Filter the outline items based on the current search query. */ filterSearchResults(): void; /** * Find the heading that corresponds to the current cursor position. * * @param e - The cursor position or context. * @returns The active heading, or `undefined` if none found. */ findActiveHeading(e: unknown): undefined | unknown; /** * Finds the active leaf. * * @returns The corresponding workspace leaf, or `null`. */ findCorrespondingLeaf(): null | WorkspaceLeaf; /** * Returns the headings of the active file. * * @returns The list of heading strings. */ getHeadings(): string[]; /** * Finds the view to the active leaf. * * @returns The owner view, or `null`. */ getOwner(): null | View; /** * Get the current view type. * * @returns The outline view type. */ getViewType(): typeof ViewType.Outline; /** * Handle the collapse/expand all toggle action. * * @param e - Whether to collapse all. */ handleCollapseAll(e: unknown): void; /** * Handle editor selection changes and highlight the active heading. */ handleSelectionChange(): void; /** * Handle a file content change and refresh the outline. * * @param file - The changed file. */ onFileChanged(file: TFile): void; /** * Handle scroll events in the markdown editor and sync outline highlight. * * @param e - The scroll event. */ onMarkdownScroll(e: unknown): void; /** * Toggles the visibility of the search. */ onToggleShowSearch(): void; /** * Set which outline item is highlighted as active. * * @param e - The item to highlight. */ setHighlightedItem(e: unknown): void; /** * Set the visibility of the search filter. * * @param e - Whether to show the search filter. */ setShowSearch(e: unknown): void; /** * Shows the search. */ showSearch(): void; /** * Refresh the outline view with current headings. */ update(): void; /** * Updates the search. */ updateSearch(): void; } /** * A task representing an ongoing PDF document loading operation. * * @public * @unofficial */ export interface PDFDocumentLoadingTask { /** Promise that resolves when the document is loaded. */ promise: Promise<PDFDocumentProxy>; /** Destroys the loading task. */ destroy(): void; /** Callback for password-protected documents. */ onPassword?(updateCallback: (password: string) => void, reason: number): void; /** Callback for loading progress updates. */ onProgress?(progressData: OnProgressParameters): void; } /** * Proxy for an opened PDF document. * * @public * @unofficial */ export interface PDFDocumentProxy { /** Document fingerprints. */ fingerprints: [ string, null | string ]; /** Whether the document is a pure XFA form. */ isPureXfa: boolean; /** Loading parameters used for the document. */ loadingParams: PDFLoadingParams; /** Total number of pages. */ numPages: number; /** * Cleans up resources held by the document. * * @param manuallyTriggered - Whether cleanup was manually triggered. * @returns A promise that resolves when cleanup is complete. */ cleanup(manuallyTriggered?: boolean): Promise<void>; /** * Destroys the document and releases resources. * * @returns A promise that resolves when destruction is complete. */ destroy(): Promise<void>; /** * Gets the attachments of the document. * * @returns A promise resolving to the attachments. */ getAttachments(): Promise<null | Record<string, unknown>>; /** * Gets the raw document data. * * @returns A promise resolving to the document bytes. */ getData(): Promise<Uint8Array>; /** * Gets a named destination. * * @param id - The destination identifier. * @returns A promise resolving to the destination, or `null` if not found. */ getDestination(id: string): Promise<null | unknown[]>; /** * Gets all named destinations. * * @returns A promise resolving to all destinations. */ getDestinations(): Promise<Record<string, unknown[]>>; /** * Gets download information for the document. * * @returns A promise resolving to download info. */ getDownloadInfo(): Promise<PDFDownloadInfo>; /** * Gets the mark information for the document. * * @returns A promise resolving to the mark info, or `null` if not available. */ getMarkInfo(): Promise<null | PDFMarkInfo>; /** * Gets the document metadata. * * @returns A promise resolving to the metadata. */ getMetadata(): Promise<PDFMetadata>; /** * Gets the open action for the document. * * @returns A promise resolving to the open action, or `null` if not defined. */ getOpenAction(): Promise<null | object>; /** * Gets a page by its 1-based page number. * * @param pageNumber - The 1-based page number. * @returns A promise resolving to the page proxy. */ getPage(pageNumber: number): Promise<PDFPageProxy>; /** * Gets the page index for a reference object. * * @param ref - The reference object. * @returns A promise resolving to the page index. */ getPageIndex(ref: object): Promise<number>; /** * Gets the page labels. * * @returns A promise resolving to the labels, or `null` if not defined. */ getPageLabels(): Promise<null | string[]>; /** * Gets the page layout. * * @returns A promise resolving to the layout name. */ getPageLayout(): Promise<string>; /** * Gets the page mode. * * @returns A promise resolving to the mode name. */ getPageMode(): Promise<string>; /** * Gets the viewer preferences. * * @returns A promise resolving to viewer preferences, or `null` if not defined. */ getViewerPreferences(): Promise<null | Record<string, unknown>>; /** * Saves the document. * * @returns A promise resolving to the saved document bytes. */ saveDocument(): Promise<Uint8Array>; } /** * Download information for a PDF document. * * @public * @unofficial */ export interface PDFDownloadInfo { /** The length of the document in bytes. */ length: number; } /** * Loading parameters used for a PDF document. * * @public * @unofficial */ export interface PDFLoadingParams { /** Whether auto fetch is disabled. */ disableAutoFetch: boolean; /** Whether streaming is disabled. */ disableStream: boolean; } /** * Mark information for a PDF document. * * @public * @unofficial */ export interface PDFMarkInfo { /** Whether the document is marked. */ Marked: boolean; /** Whether the document has suspects. */ Suspects: boolean; /** Whether the document has user properties. */ UserProperties: boolean; } /** * Metadata for a PDF document. * * @public * @unofficial */ export interface PDFMetadata { /** The content disposition filename, if available. */ contentDispositionFilename: null | string; /** The content length, if available. */ contentLength: null | number; /** Document information dictionary. */ info: Record<string, unknown>; /** The document metadata, if available. */ metadata: null | unknown; } /** * Proxy for a single PDF page. * * @public * @unofficial */ export interface PDFPageProxy { /** Page number (1-based). */ pageNumber: number; /** Reference object for the page, if available. */ ref: null | object; /** Page rotation angle in degrees. */ rotate: number; /** User unit size. */ userUnit: number; /** The page view box coordinates. */ view: number[]; /** * Cleans up resources held by the page. * * @param resetStats - Whether to reset statistics. * @returns Whether cleanup was performed. */ cleanup(resetStats?: boolean): boolean; /** * Gets the annotations for the page. * * @param params - Optional parameters including `intent` (the rendering intent). * @returns A promise resolving to the annotations. */ getAnnotations(params?: GetAnnotationsParams): Promise<unknown[]>; /** * Gets the operator list for the page. * * @returns A promise resolving to the operator list. */ getOperatorList(): Promise<unknown>; /** * Gets the text content of the page. * * @param params - Optional parameters including `includeMarkedContent` and `disableNormalization`. * @returns A promise resolving to the text content. */ getTextContent(params?: GetTextContentParams): Promise<TextContent>; /** * Gets the viewport for the page. * * @param params - Viewport parameters including `scale`, `rotation`, `offsetX`, `offsetY`, and `dontFlip`. * @returns The computed viewport. */ getViewport(params: GetViewportParams): PageViewport; /** Height of the page. */ get height(): number; /** * Renders the page to a canvas context. * * @param params - Render parameters. * @returns The render task. */ render(params: RenderParameters): RenderTask; /** * Streams the text content of the page. * * @param params - Optional parameters including `includeMarkedContent` and `disableNormalization`. * @returns A readable stream of text content. */ streamTextContent(params?: GetTextContentParams): ReadableStream; /** Width of the page. */ get width(): number; } /** * Parameters for creating a PDFWorker from an existing port. * * @public * @unofficial */ export interface PDFWorkerFromPortParams { /** The worker port. */ port: unknown; /** Verbosity level. */ verbosity?: number; } /** * Parameters for creating a PDFWorker instance. * * @public * @unofficial */ export interface PDFWorkerParams { /** Worker name. */ name?: string; /** The worker port. */ port?: unknown; /** Verbosity level. */ verbosity?: number; } /** * Internal plugin registration for the page preview (hover preview) feature. * * @public * @unofficial */ export interface PagePreviewPlugin extends InternalPlugin<PagePreviewPluginInstance> { } /** * Plugin instance for page preview, showing hover previews of linked notes. * * @public * @unofficial */ export interface PagePreviewPluginInstance extends InternalPluginInstance<PagePreviewPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; } /** * Represents a viewport for a PDF page. * * @public * @unofficial */ export interface PageViewport { /** Height of the viewport. */ height: number; /** Horizontal offset. */ offsetX: number; /** Vertical offset. */ offsetY: number; /** Rotation angle in degrees. */ rotation: number; /** Scale factor. */ scale: number; /** Transformation matrix. */ transform: number[]; /** The view box coordinates. */ viewBox: number[]; /** Width of the viewport. */ width: number; /** * Clones the viewport with optional parameter overrides. * * @param params - Optional parameters to override including `scale`, `rotation`, `offsetX`, `offsetY`, and `dontFlip`. * @returns A new PageViewport instance. */ clone(params?: CloneViewportParams): PageViewport; /** * Converts viewport coordinates to PDF coordinates. * * @param x - The x coordinate in viewport space. * @param y - The y coordinate in viewport space. * @returns The PDF coordinates as a tuple. */ convertToPdfPoint(x: number, y: number): [ number, number ]; /** * Converts PDF coordinates to viewport coordinates. * * @param x - The x coordinate in PDF space. * @param y - The y coordinate in PDF space. * @returns The viewport coordinates as a tuple. */ convertToViewportPoint(x: number, y: number): [ number, number ]; } /** * A range with start and end positions. * * @public * @unofficial */ export interface ParseContextRange { /** The start position. */ from: number; /** The end position. */ to: number; } /** * Options for parsing Mermaid diagrams. * * @public * @unofficial */ export interface ParseOptions { /** Whether to suppress parse errors. */ suppressErrors?: boolean; } /** * Result of parsing a Mermaid diagram. * * @public * @unofficial */ export interface ParseResult { /** The type of diagram that was parsed. */ diagramType: string; } /** * Parsed link text result. * * @public * @unofficial */ export interface ParsedLinktext { /** * The path. */ path: string; /** * The subpath. */ subpath: string; } /** * An in-progress parse operation that can be advanced incrementally. * * @public * @unofficial */ export interface PartialParse { /** The position up to which the document has been parsed. */ readonly parsedPos: number; /** The position at which the parse was stopped, or `null` if not stopped. */ readonly stoppedAt: null | number; /** * Advance the parse by some amount. * * @returns The finished tree, or `null` if more work is needed. */ advance(): LezerTree | null; /** * Tell the parse to stop at a given position. * * @param pos - The position to stop at. */ stopAt(pos: number): void; } /** * Settings for PDF export configuration. * * @public * @unofficial */ export interface PdfExportSettings { /** * The scale percentage applied to the exported PDF. * * @default `100` */ downscalePercent: number; /** * Whether the PDF is exported in landscape orientation. * * @default `false` */ landscape: boolean; /** * The page margin setting. * * @default `'0'` */ margin: string; /** * The page size setting. * * @default `'letter'` */ pageSize: string; } /** * The PDF.js library module type, representing the `window.pdfjsLib` object. * * @public * @unofficial */ export interface PdfJsModule { /** The build identifier of the PDF.js library. */ build: string; /** Global worker options for PDF.js. */ GlobalWorkerOptions: GlobalWorkerOptionsType; /** The version string of the PDF.js library. */ version: string; /** * Loads a PDF document from the given source. * * @param src - The document source. * @returns The loading task for the document. */ getDocument(src: ArrayBuffer | DocumentInitParameters | string | Uint8Array | URL): PDFDocumentLoadingTask; } /** * Utility interface exposing PDF.js testing helpers. * * @public * @unofficial */ export interface PdfJsTestingUtils { /** * Constructor for creating highlight outliners for PDF annotations. */ HighlightOutliner: HighlightOutliner; } /** * Style information for a text item in a PDF page. * * @public * @unofficial */ export interface PdfTextStyle { /** Ascent of the font. */ ascent: number; /** Descent of the font. */ descent: number; /** Font family name. */ fontFamily: string; /** Whether the text is vertical. */ vertical: boolean; } /** * View for rendering and interacting with PDF files. * * @public * @unofficial */ export interface PdfView extends EditableFileView { /** * The PDF viewer component used to render the document. */ viewer: unknown; /** * Get the current view type. * * @returns The view type identifier. */ 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; } /** * The PixiJS library module type, representing the `window.PIXI` object. * * @public * @unofficial */ export interface PixiModule { /** PixiJS application constructor. */ Application: typeof Application; /** Container constructor. */ Container: typeof Container; /** Display object constructor. */ DisplayObject: typeof DisplayObject; /** Graphics constructor. */ Graphics: typeof Graphics; /** Graphics geometry constructor. */ GraphicsGeometry: typeof GraphicsGeometry; /** 2D transformation matrix constructor. */ Matrix: typeof Matrix; /** Observable point constructor. */ ObservablePoint: typeof ObservablePoint; /** Rectangle constructor. */ Rectangle: typeof PixiRectangle; /** Sprite constructor. */ Sprite: typeof Sprite; /** PixiJS text display object constructor. */ Text: typeof PixiText; /** Text style constructor. */ TextStyle: typeof TextStyle; /** Texture resource. */ Texture: typeof Texture; /** Transform constructor. */ Transform: typeof Transform; } /** * Due to limitations of TypeScript, we cannot extend the {@link obsidian#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); * ``` * * @public * @unofficial */ export interface PlatformEx { /** * Whether the platform supports displaying the sidebar ribbon. */ canDisplayRibbon: boolean; /** * Whether the platform supports exporting to PDF. */ canExportPdf: boolean; /** * Whether the platform supports popping out windows. */ canPopoutWindow: boolean; /** * Whether the platform supports splitting panes. */ canSplit: boolean; /** * Whether the platform supports stacking tabs. */ canStackTabs: boolean; /** * We're running the `Android` app. */ isAndroidApp: boolean; /** * The UI is in desktop mode. */ isDesktop: boolean; /** * We're running the `Electron`-based desktop app. */ isDesktopApp: boolean; /** * We're running the `iOS` app. */ isIosApp: boolean; /** * We're on a Linux device. */ 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. */ isMacOS: boolean; /** * The UI is in mobile mode. */ isMobile: boolean; /** * We're running the `Capacitor` mobile app. */ isMobileApp: boolean; /** * We're in a mobile app that has very limited screen space. */ isPhone: boolean; /** * We're running in Safari. * Typically used to provide workarounds for Safari bugs. */ isSafari: boolean; /** * We're in a mobile app that has sufficiently large screen space. */ isTablet: boolean; /** * We're on a Windows device. */ isWin: boolean; /** * Height of the mobile device screen in pixels. */ mobileDeviceHeight: number; /** * Height of the software keyboard in pixels on mobile. */ mobileKeyboardHeight: number; /** * Whether the software keyboard is currently visible on mobile. */ 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/`). */ resourcePathPrefix: string; } /** * Plugin header. * * @public * @unofficial */ export interface PluginHeader { /** Plugin methods. */ methods: PluginMethodHeader[]; /** Plugin name. */ name: string; } /** * Plugin implementations map. * * @public * @unofficial */ export interface PluginImplementations { /** Plugin implementation for the given platform. */ [platform: string]: (() => Promise<ConstructorBase<[ ], unknown>>) | ConstructorBase<[ ], unknown>; } /** * Plugin listener handle. * * @public * @unofficial */ export interface PluginListenerHandle { /** * Removes the listener. * * @returns Promise that resolves when the listener is removed. */ remove(): Promise<void>; } /** * Plugin method header. * * @public * @unofficial */ export interface PluginMethodHeader { /** Method name. */ name: string; /** Return type. */ rtype?: string; } /** * Information about an available plugin update. * * @public * @unofficial */ export interface PluginUpdateManifest { /** * Manifest of the plugin. */ manifest: PluginManifest; /** * Repository of the plugin. */ repo: string; /** * New version of the plugin. */ version: string; } /** * Manager for community plugins, handling installation, enabling, and lifecycle. * * @public * @unofficial */ export interface Plugins extends Events { /** * Reference to the {@link obsidian#App}. */ app: App; /** * Whether automatic update checking is enabled. */ autoCheckForUpdates: boolean; /** * 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>; /** * Timestamp of the last update check. */ lastUpdateCheck: number; /** * {@link obsidian#Plugin} ID that is currently being enabled. */ loadingPluginId: null | string; /** * 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; /** * Debounced function to save the plugin configuration. */ requestSaveConfig: Debouncer<[ ], Promise<void>>; /** * Mapping of plugin ID to available updates. */ updates: Map<string, PluginUpdateManifest>; /** * Check online list for deprecated plugins to automatically disable. * * @returns A promise that resolves when the deprecation check is complete. * To get the constructor instance, use {@link getPluginsConstructor} from `obsidian-typings/implementations`. */ checkForDeprecations(): Promise<void>; /** * Check for plugin updates. * * @returns A promise that resolves when the update check is complete. */ checkForUpdates(showNotice?: boolean): Promise<void>; /** * Constructor. * * To get the constructor instance, use {@link getPluginsConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor2__?(app: App): this; /** * Unload a plugin by ID. * * @param id - {@link obsidian#Plugin} ID. * @returns A promise that resolves when the plugin is disabled. */ disablePlugin(id: string): Promise<void>; /** * Unload a plugin by ID and save config for persistence. * * @param id - {@link obsidian#Plugin} ID. * @returns A promise that resolves when the plugin is disabled and the config is saved. */ disablePluginAndSave(id: string): Promise<void>; /** * Enable a plugin by ID. * * @param id - {@link obsidian#Plugin} ID. * @returns A promise that resolves when the plugin is enabled. */ enablePlugin(id: string): Promise<void>; /** * Enable a plugin by ID and save config for persistence. * * @param id - {@link obsidian#Plugin} ID. * @returns A promise that resolves when the plugin is enabled and the config is saved. */ enablePluginAndSave(id: string): Promise<void>; /** * Get a plugin by ID. * * @param id - {@link obsidian#Plugin} ID. * @returns The plugin instance or `null` if not found. */ getPlugin(id: string): null | Plugin; /** * Get the folder where plugins are stored. * * @returns Path to the plugins folder. */ getPluginFolder(): string; /** * Load plugin manifests and enable plugins from config. * * @returns A promise that resolves when initialization is complete. */ initialize(): Promise<void>; /** * Install a plugin from a given URL. * * @param repo - Repository identifier. * @param version - Version to install. * @param manifest - {@link obsidian#Plugin} manifest data. * @returns A promise that resolves when the plugin is installed. */ installPlugin(repo: string, version: string, manifest: PluginManifest): Promise<void>; /** * Check whether a plugin is deprecated. * * @param id - {@link obsidian#Plugin} ID. * @returns Whether the plugin is deprecated. */ isDeprecated(id: string): boolean; /** * Check whether community plugins are enabled. * * @returns Whether community plugins are enabled. */ isEnabled(): boolean; /** * Load a specific plugin's manifest by its folder path. * * @param path - Folder path containing the manifest. * @returns A promise that resolves when the manifest is loaded. */ loadManifest(path: string): Promise<void>; /** * Load all plugin manifests from plugin folder. * * @returns A promise that resolves when all manifests are loaded. */ loadManifests(): Promise<void>; /** * Load a plugin by its ID. * * @param id - {@link obsidian#Plugin} ID. * @param isUserEnabled - Whether the plugin was enabled by the user. * @returns The loaded plugin instance. */ loadPlugin(id: string, isUserEnabled?: boolean): Promise<Plugin>; /** * Handle raw file system change events for plugin config files. * * @param e - The raw file system change event. */ onRaw(e: unknown): void; /** * Save current plugin configs. * * @returns A promise that resolves when the config is saved. */ saveConfig(): Promise<void>; /** * Set whether automatic update checking is enabled. */ setAutomaticUpdateCheck(enabled: boolean): void; /** * Toggle whether community plugins are enabled. * * @param enabled - Whether to enable community plugins. * @returns A promise that resolves when the setting is applied. */ setEnable(enabled: boolean): Promise<void>; /** * Uninstall a plugin by ID. * * @param id - {@link obsidian#Plugin} ID. * @returns A promise that resolves when the plugin is uninstalled. */ uninstallPlugin(id: string): Promise<void>; /** * Unload a plugin by ID. * * @param id - {@link obsidian#Plugin} ID. * @param isUserDisabled - Whether the plugin was disabled by the user. * @returns A promise that resolves when the plugin is unloaded. */ unloadPlugin(id: string, isUserDisabled?: boolean): Promise<void>; } /** * Record mapping plugin IDs to their manifest metadata. * * @public * @unofficial */ export interface PluginsManifestsRecord extends Record<string, PluginManifest> { } /** * Record mapping plugin IDs to their active plugin instances. * * @public * @unofficial */ export interface PluginsPluginsRecord extends Record<string, Plugin> { } /** * A position in a CodeMirror 5 document. * * @public * @unofficial */ export interface Position { /** Character position within the line. */ ch: number; /** Line number (zero-based). */ line: number; /** The sticky direction for cursor placement. */ sticky?: string; } /** * A reference with position information in the source file. * * @public * @unofficial */ export interface PositionedReference extends Reference, CacheItem { } /** * Power tag. * * @public * @unofficial */ export interface PowerTag { /** * Whether the power tag graphics have been rendered. */ rendered: boolean; /** * Graph renderer managing this power tag. */ renderer: GraphRenderer; /** * PixiJS text element displaying the tag label. */ text: PixiText; /** * Destroy the power tag graphics and remove them from the scene. */ clearGraphics(): void; /** * Get the text style used for rendering the power tag label. * * @returns The text style of the power tag. */ getTextStyle(): TextStyle; /** * Initialize the power tag graphics and add them to the scene. */ initGraphics(): void; /** * Render the power tag. */ render(): void; } /** * Prism hook system for extending highlighting behavior. * * @public * @unofficial */ export interface PrismHooks { /** All registered hooks. */ all: HookTypes; /** * Registers a callback for a hook. * * @param name - The hook name. * @param callback - The callback to register. */ add(name: string, callback: HookCallback): void; /** * Runs all callbacks registered for a hook. * * @param name - The hook name. * @param env - The environment object. */ run(name: string, env: Environment): void; } /** * The Prism.js library module type, representing the `window.Prism` object. * * @public * @unofficial */ export interface PrismModule { /** Whether to disable the default Prism worker message handler. */ disableWorkerMessageHandler: boolean | undefined; /** The hooks registry. */ hooks: PrismHooks; /** The languages registry. */ languages: Languages; /** Whether Prism should skip automatic highlighting on page load. */ manual: boolean | undefined; /** Loaded plugins. */ plugins: Record<string, unknown>; /** Utility functions. */ util: PrismUtil; /** * Highlights text using a grammar. * * @param text - The text to highlight. * @param grammar - The grammar to use. * @param language - The language name. * @returns The highlighted HTML string. */ highlight(text: string, grammar: Grammar, language: string): string; /** * Highlights all code elements on the page. * * @param async - Whether to use web workers. * @param callback - Callback invoked after each element is highlighted. */ highlightAll(async?: boolean, callback?: HighlightCallback): void; /** * Highlights all code elements under a container. * * @param container - The container element. * @param async - Whether to use web workers. * @param callback - Callback invoked after each element is highlighted. */ highlightAllUnder(container: ParentNode, async?: boolean, callback?: HighlightCallback): void; /** * Highlights a single element. * * @param element - The element to highlight. * @param async - Whether to use web workers. * @param callback - Callback invoked after the element is highlighted. */ highlightElement(element: Element, async?: boolean, callback?: HighlightCallback): void; /** * Tokenizes text using a grammar. * * @param text - The text to tokenize. * @param grammar - The grammar to use. * @returns The token stream. */ tokenize(text: string, grammar: Grammar): Array<PrismToken | string>; } /** * Describes a token pattern for Prism grammar definitions. * * @public * @unofficial */ export interface PrismTokenObject { /** Alias name(s) for the token type. */ alias?: string | string[]; /** Whether this token is greedy. */ greedy?: boolean; /** Nested grammar applied inside the matched token. */ inside?: Grammar; /** Whether to apply lookbehind to the pattern. */ lookbehind?: boolean; /** The regex pattern to match. */ pattern: RegExp; } /** * Prism utility functions. * * @public * @unofficial */ export interface PrismUtil { /** * Deep clones an object. * * @param o - The object to clone. * @returns A deep clone of the object. */ clone<T>(o: T): T; /** * Encodes tokens by replacing special HTML characters. * * @param tokens - The token stream to encode. * @returns The encoded token stream. */ encode(tokens: PrismTokenStream): PrismTokenStream; /** * Returns a unique identifier for the given object. * * @param obj - The object to identify. * @returns The unique numeric identifier. */ objId(obj: unknown): number; /** * Returns the type of the given value as a string. * * @param o - The value to check. * @returns The type string. */ type(o: unknown): string; } /** * A promise bundled with its `resolve` and `reject` callbacks, as returned by `Promise.withResolvers()`. * * Mirrors the ES2024 `PromiseWithResolvers` global so the typings stay consumable when the consumer's `lib` only targets ES2022 (e.g. the minimum supported Obsidian installer, which runs on Node 16). * * @typeParam T - The type the promise resolves to. * @public * @unofficial */ export interface PromiseWithResolvers<T> { /** * The pending promise. */ promise: Promise<T>; /** * Rejects {@link PromiseWithResolvers.promise}. * * @param reason - The rejection reason. */ reject(reason?: unknown): void; /** * Resolves {@link PromiseWithResolvers.promise}. * * @param value - The resolution value. */ resolve(value: PromiseLike<T> | T): void; } /** * A sequential promise queue that ensures functions execute one at a time. * * @public * @unofficial */ export interface PromisedQueue { /** * The current promise in the queue chain. */ promise: Promise<unknown>; /** * Add a function to the queue and return a promise for its result. * * @param fn - The function to enqueue. * @returns A promise that resolves with the function's result. */ queue<T>(fn: () => Promise<T> | T): Promise<T>; } /** * Internal plugin registration for the properties (frontmatter metadata) feature. * * @public * @unofficial */ export interface PropertiesPlugin extends InternalPlugin<PropertiesPluginInstance> { } /** * Plugin instance for properties, managing frontmatter metadata views. * * @public * @unofficial */ export interface PropertiesPluginInstance extends InternalPluginInstance<PropertiesPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: false; /** * Reference to the properties plugin registration. */ plugin: PropertiesPlugin; } /** * Data for a single frontmatter property entry. * * @typeParam T - The type of the property value. * @public * @unofficial */ export interface PropertyEntryData<T> { /** * Property key. */ key: string; /** * Property widget type. */ type: string; /** * Property value. */ value: T; } /** * Information about a frontmatter property across the vault. * * @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. */ 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: null | PropertyPropertyWidgetComponentComboBoxItem; /** * Callback for {@link PropertyPropertyWidgetComponentComboBox.onClose}. */ _onClose?(): void; /** * Callback for {@link PropertyPropertyWidgetComponentComboBox.onOpen}. */ _onOpen?(): void; /** * Attach the DOM of the combobox. */ attachDom(): void; /** * Detach the DOM of the combobox. * * @returns A promise that resolves when the DOM is detached. */ detachDom(): Promise<void>; /** * Focus the combobox. */ focus(): void; /** * Get the items of the combobox. * * @returns The combobox items. */ getItems(): PropertyPropertyWidgetComponentComboBoxItem[]; /** * Callback for {@link PropertyPropertyWidgetComponentComboBox.getSuggestions}. * * @param query - The search query string. * @returns The matching search results. */ 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 {@link PropertyPropertyWidgetComponentComboBox.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. * * @returns The result of toggling 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; } /** * Context provided to property widgets for rendering and interaction. * * @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. * * @param value - The new property value. */ onChange(value: unknown): void; } /** * Property widget. * * @typeParam ComponentType - The type of the component. * @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. * * @returns The localized name of the widget. */ name(): string; /** * Render function for the widget on field container given context and data. * * @param containerEl - The container element to render the widget into. * @param data - The property data to render. * @param context - The rendering context for the property. * @returns The rendered widget component. */ render(containerEl: HTMLElement, data: unknown, context: PropertyRenderContext): ComponentType; /** * Validate whether the input value to the widget is correct. * * @param value - The value to validate. * @returns Whether the value is valid. */ 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; } /** * Entry associating a display name with a property widget type. * * @public * @unofficial */ export interface PropertyWidgetEntry { /** * Display name of the property widget. */ name: string; /** * The property widget type. */ widget: PropertyWidgetType; } /** * Internal plugin registration for the Obsidian Publish feature. * * @public * @unofficial */ export interface PublishPlugin extends InternalPlugin<PublishPluginInstance> { } /** * Plugin instance for Obsidian Publish, managing cloud publishing of vault content. * * @public * @unofficial */ export interface PublishPluginInstance extends InternalPluginInstance<PublishPlugin> { /** * Reference to the app. */ app: App; /** * Reference to the publish plugin registration. */ 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[]; } /** * Internal plugin registration for the random note feature. * * @public * @unofficial */ export interface RandomNotePlugin extends InternalPlugin<RandomNotePluginInstance> { } /** * Plugin instance for opening a random note from the vault. * * @public * @unofficial */ export interface RandomNotePluginInstance extends InternalPluginInstance<RandomNotePlugin> { /** * Reference to the app. */ app: App; } /** * Configuration passed to {@link @codemirror/state#RangeSet.update}. * * @public * @unofficial */ export interface RangeSetUpdate<T extends RangeValue> { /** An array of ranges to add. */ add?: readonly CmRange<T>[]; /** The start of the range to filter. */ filterFrom?: number; /** The end of the range to filter. */ filterTo?: number; /** Whether to sort the ranges. */ sort?: boolean; /** * A filter function that determines which existing ranges to keep. * * @param from - The start of the range. * @param to - The end of the range. * @param value - The range value. * @returns Whether to keep the range. */ filter?(from: number, to: number, value: T): boolean; } /** * Renderer for the reading/preview view, managing section-based markdown rendering. * * @public * @unofficial */ export interface ReadViewRenderer { /** * Whether to add bottom padding to the preview. */ addBottomPadding: boolean; /** * Sections that are being rendered asynchronously. */ asyncSections: unknown[]; /** * Timestamp of the last render operation. */ lastRender: number; /** * Last recorded scroll position. */ lastScroll: number; /** * Text content from the last render. */ lastText: string; /** * Container element for the rendered preview. */ previewEl: HTMLElement; /** * Element used to push content for scroll height calculation. */ pusherEl: HTMLElement; /** * Pool of recycled section elements for reuse. */ recycledSections: unknown[]; /** * Currently rendered section data. */ rendered: unknown[]; /** * All sections in the rendered document. */ sections: RendererSection[]; /** * Current text content being rendered. */ text: string; /** * Clear all rendered sections and reset the renderer. */ clear(): void; /** * Parse the text content asynchronously into sections. */ parseAsync(): void; /** * Parse the text content synchronously into sections. */ parseSync(): void; /** * Queue a render update for the next animation frame. */ queueRender(): void; /** * Set the text content and trigger a re-render. * * @param text - The text content to render. */ set(text: string): void; } /** * Tracks recently opened files for quick access and navigation. * * @public * @unofficial */ export interface RecentFileTracker { /** * List of last opened file paths, limited to 50. */ lastOpenFiles: string[]; /** * Reference to the {@link obsidian#Vault}. */ vault: Vault; /** * Reference to the {@link obsidian#Workspace}. */ workspace: Workspace; /** * Add a file to the recent files list, if the workspace layout is ready. * * @param file - The file to add. */ addRecentFile(file: TFile): void; /** * Add a file to the recent files list. * * @param file - File to add. */ collect(file: TFile): void; /** * Constructor. * * To get the constructor instance, use {@link getRecentFileTrackerConstructor} from `obsidian-typings/implementations`. * * @param workspace - The workspace. * @param vault - The vault. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(workspace: Workspace, vault: Vault): this; /** * Returns the last 10 opened files. * * @returns Array of file paths. */ getLastOpenFiles(): string[]; /** * Get last n files of type (defaults to 10). * * @param options - Options for filtering recent files. * @returns Array of file paths. */ getRecentFiles(options?: GetRecentFilesOptions): string[]; /** * Set the last opened files. * * @param savedFiles - Array of file paths to load. */ load(savedFiles: string[]): void; /** * On file create, save file to last opened files. * * @param file - The created file. */ onFileCreated(file: TFile): void; /** * On file open, save file to last opened files. * * @param prevFile - Previously opened file. * @param file - Newly opened file. */ onFileOpen(prevFile: TFile, file: TFile): void; /** * On file rename, update file path in last opened files. * * @param file - The renamed file. * @param oldPath - Previous file path. */ onRename(file: TFile, oldPath: string): void; /** * Get last opened files. * * @returns Array of file paths. */ serialize(): string[]; } /** * Options for registering external diagram definitions. * * @public * @unofficial */ export interface RegisterExternalDiagramsOptions { /** Whether to lazily load the diagram definitions. */ lazyLoad?: boolean; } /** * View for displaying Obsidian release notes. * * @public * @unofficial */ export interface ReleaseNotesView extends ItemView { /** * Get the release notes from GitHub. * * @param version - The version of the release notes. * @returns The fetched release notes. */ fetchReleaseNotes(version: string): Promise<unknown>; /** * Get the current view type. * * @returns The view type identifier. */ getViewType(): typeof ViewType.ReleaseNotes; /** * Renders the release notes. * * @returns The result of the rendering operation. */ render(): Promise<unknown>; /** * Display the patch notes for a specific version. * * @param e - The event or trigger. * @param version - The version to display patch notes for. * @returns The result of rendering the patch notes. */ showPatchNotes(e: unknown, version: string): Promise<unknown>; } /** * Parameters for rendering a PDF page. * * @public * @unofficial */ export interface RenderParameters { /** Background color for the canvas. */ background?: string; /** The 2D canvas rendering context to draw on. */ canvasContext: CanvasRenderingContext2D; /** Rendering intent. */ intent?: string; /** Additional transform matrix. */ transform?: number[]; /** The viewport to use for rendering. */ viewport: PageViewport; } /** * Result of rendering a Mermaid diagram. * * @public * @unofficial */ export interface RenderResult { /** The rendered SVG string. */ svg: string; /** * Bind interactive functions to the rendered element. * * @param element - The rendered SVG element. */ bindFunctions?(element: Element): void; } /** * A task representing an ongoing page render operation. * * @public * @unofficial */ export interface RenderTask { /** Promise that resolves when rendering is complete. */ promise: Promise<void>; /** * Cancels the render task. * * @param extraDelay - Optional extra delay before cancellation. */ cancel(extraDelay?: number): void; /** Callback invoked to allow continuation of rendering. */ onContinue?(cont: () => void): void; } /** * A section of the read view renderer representing a block of rendered content. * * @public * @unofficial */ export interface RendererSection { /** * DOM element for this section. */ el: HTMLElement; /** * Raw HTML content for this section. */ html: string; /** * Whether this section has been rendered to the DOM. */ rendered: boolean; } /** * Specification for a replace decoration that replaces a range of text. * * @public * @unofficial */ export interface ReplaceDecorationSpec { /** Whether this is a block replacement. */ block?: boolean; /** Whether both sides of the replacement are inclusive. */ inclusive?: boolean; /** Whether the end of the replacement is inclusive. */ inclusiveEnd?: boolean; /** Whether the start of the replacement is inclusive. */ inclusiveStart?: boolean; /** Optional widget to display in place of the replaced text. */ widget?: WidgetType; } /** * Store for managing i18next translation resources. * * @public * @unofficial */ export interface ResourceStore { /** The underlying resource data. */ data: Record<string, Record<string, Record<string, string>>>; /** The registered event observers. */ observers: unknown; /** The options used by this resource store. */ options: InitOptions; /** * Adds namespaces to the store's options. * * @param ns - Namespace or namespaces to add. */ addNamespaces(ns: string | string[]): void; /** * Adds a single resource entry. * * @param lng - Language code. * @param ns - Namespace. * @param key - Resource key. * @param value - Resource value. * @param options - Additional options including `keySeparator` and `silent`. * @returns The resource store instance. */ addResource(lng: string, ns: string, key: string, value: string, options?: AddResourceOptions): ResourceStore; /** * Adds a resource bundle to the store. * * @param lng - Language code. * @param ns - Namespace. * @param resources - Bundle of resources. * @param deep - Whether to deep merge. * @param overwrite - Whether to overwrite existing keys. * @returns The resource store instance. */ addResourceBundle(lng: string, ns: string, resources: Record<string, unknown>, deep?: boolean, overwrite?: boolean): ResourceStore; /** * Adds multiple resource entries. * * @param lng - Language code. * @param ns - Namespace. * @param resources - Resource entries. * @returns The resource store instance. */ addResources(lng: string, ns: string, resources: Record<string, string>): ResourceStore; /** * Gets all resource data for a language. * * @param lng - Language code. * @returns The resource data or `undefined`. */ getDataByLanguage(lng: string): Record<string, Record<string, string>> | undefined; /** * Gets a single resource value. * * @param lng - Language code. * @param ns - Namespace. * @param key - Resource key. * @param options - Additional options including `keySeparator`. * @returns The resource value. */ getResource(lng: string, ns: string, key: string, options?: GetResourceOptions): unknown; /** * Gets a resource bundle for a language and namespace. * * @param lng - Language code. * @param ns - Namespace. * @returns The resource bundle. */ getResourceBundle(lng: string, ns: string): Record<string, unknown>; /** * Checks whether a resource bundle exists. * * @param lng - Language code. * @param ns - Namespace. * @returns Whether the bundle exists. */ hasResourceBundle(lng: string, ns: string): boolean; /** * Removes a listener for an event. * * @param event - Event name. * @param listener - Listener function. */ off(event: string, listener?: (...args: unknown[]) => void): void; /** * Registers a listener for an event. * * @param event - Event name. * @param listener - Listener function. */ on(event: string, listener: (...args: unknown[]) => void): void; /** * Removes namespaces from the store's options. * * @param ns - Namespace or namespaces to remove. */ removeNamespaces(ns: string | string[]): void; /** * Removes a resource bundle. * * @param lng - Language code. * @param ns - Namespace. * @returns The resource store instance. */ removeResourceBundle(lng: string, ns: string): ResourceStore; /** * Serializes the store's resource data. * * @returns The underlying resource data. */ toJSON(): Record<string, Record<string, Record<string, string>>>; } /** * Container for search result DOM elements, managing the display of file search results. * * @public * @unofficial */ export interface ResultDom { /** * Reference to the {@link obsidian#App} instance. */ app: App; /** * Debounced callback triggered when results change. */ changed: Debouncer<[ ], unknown>; /** * Container element for child result items. */ childrenEl: HTMLDivElement; /** * Whether all result items are collapsed. */ collapseAll: boolean; /** * Root element of the result DOM. */ el: HTMLDivElement; /** * Element displayed when there are no search results. */ emptyStateEl: HTMLDivElement; /** * Whether extra surrounding context is shown around matches. */ extraContext: boolean; /** * Currently focused result item, or `null` if none. */ focusedItem: null; /** * Virtual scrolling component for rendering visible results. */ infinityScroll: InfinityScroll; /** * Layout information used by virtual scrolling. */ info: TreeNodeInfo; /** * Spacer element used to maintain correct scroll height. */ pusherEl: HTMLDivElement; /** * Lookup map from file to its corresponding result DOM item. */ resultDomLookup: Map<TFile, ResultDomItem>; /** * Whether the empty state placeholder is currently displayed. */ showingEmptyState: boolean; /** * Current sort order for search results. */ sortOrder: string; /** * Virtual children manager for result items. */ vChildren: TreeNodeVChildren<ResultDomItem, ResultDom>; /** * Whether a search operation is currently in progress. */ working: boolean; /** * Add a search result for a file to the result DOM. * * @param file - The file to add a result for. * @param result - The search result data. * @param content - The text content of the file. * @param shouldShowTitle - Whether to show the file title. * @returns The created result DOM item. */ addResult(file: TFile, result: ResultDomResult, content: string, shouldShowTitle?: boolean): ResultDomItem; /** * Change which result item has focus. * * @returns The result of changing the focused item. */ changeFocusedItem(arg1: unknown): unknown; /** * Clear all search results from the DOM. * * @returns The result of clearing. */ emptyResults(): unknown; /** * Get the list of files with search results. * * @returns The list of files with results. */ getFiles(): unknown; /** * Get the total number of matches across all results. * * @returns The total match count. */ getMatchCount(): number; /** * Get the result DOM item for a specific file. * * @returns The result DOM item. */ getResult(arg1: unknown): unknown; /** * Callback invoked when the result set changes. * * @returns The result of the change handler. */ onChange(): unknown; /** * Handle resize events and recalculate layout. * * @returns The result of the resize handler. */ onResize(): unknown; /** * Remove a search result from the DOM. * * @returns The result of the removal. */ removeResult(arg1: unknown): unknown; /** * Set whether all result items should be collapsed. * * @returns The result of setting collapse state. */ setCollapseAll(arg1: unknown): unknown; /** * Set whether extra context is shown around matches. * * @returns The result of setting extra context. */ setExtraContext(arg1: unknown): unknown; /** * Set the focused result item. * * @returns The result of setting the focused item. */ setFocusedItem(arg1: unknown): unknown; /** * Show a loading indicator while search is in progress. * * @returns The result of starting the loader. */ startLoader(): unknown; /** * Hide the loading indicator when search completes. * * @returns The result of stopping the loader. */ stopLoader(): unknown; /** * Toggle the collapsed state of a result item. * * @returns The result of toggling the collapse state. */ toggle(arg1: unknown, arg2: unknown): Promise<unknown>; } /** * Represents a single file's search result in the result DOM tree. * * @public * @unofficial */ export interface ResultDomItem extends TreeNode { /** * Reference to the {@link obsidian#App} instance. */ app: App; /** * Container element for child match items. */ childrenEl: HTMLDivElement; /** * Whether this result item is currently collapsed. */ collapsed: boolean; /** * Element for the collapse/expand toggle. */ collapseEl: HTMLDivElement; /** * Whether this result item can be collapsed. */ collapsible: boolean; /** * Outer container element for this result item. */ containerEl: HTMLDivElement; /** * Text content of the file associated with this result. */ content: string; /** * Whether extra surrounding context is shown around matches. */ extraContext: boolean; /** * The file associated with this search result. */ file: TFile; /** * Layout information used by virtual scrolling. */ info: TreeNodeInfo; /** * Callback for custom match rendering, or `null` if not set. */ onMatchRender: null; /** * Parent result DOM container. */ parent: ResultDom; /** * Reference to the parent result DOM container. */ parentDom: ResultDom; /** * Spacer element used to maintain correct scroll height. */ pusherEl: HTMLDivElement; /** * Search result data containing match positions. */ result: ResultDomResult; /** * Whether matches are displayed as separate items. */ separateMatches: boolean; /** * Whether the file title is shown above matches. */ showTitle: boolean; /** * Virtual children manager for match child items. */ vChildren: TreeNodeVChildren<ResultDomItem, ResultDomItemChild>; /** * Get additional context positions surrounding a match. * * @returns The extra context positions. */ getMatchExtraPositions(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Mark this result item as needing re-render. * * @returns The result of the invalidation. */ invalidate(): unknown; /** * Handle click on the collapse toggle. * * @returns The result of the click handler. */ onCollapseClick(arg1: unknown): unknown; /** * Handle click on a search result to navigate to it. * * @returns The result of the click handler. */ onResultClick(arg1: unknown): unknown; /** * Handle right-click context menu on a search result. * * @returns The result of the context menu handler. */ onResultContextMenu(arg1: unknown): unknown; /** * Handle mouseover on a search result for preview. * * @returns The result of the mouseover handler. */ onResultMouseover(arg1: unknown, arg2: unknown, arg3: unknown): unknown; /** * Render the content matches for this result item. */ renderContentMatches(): void; /** * Set the collapsed state of this result item. * * @returns Resolves when the collapse state has been applied. */ setCollapse(arg1: unknown, arg2: unknown): Promise<unknown>; /** * Set whether this result item can be collapsed. * * @returns The result of setting the collapsible state. */ setCollapsible(arg1: unknown): unknown; /** * Set whether extra context is shown around matches. * * @returns The result of setting extra context. */ setExtraContext(arg1: unknown): unknown; } /** * Represents an individual match segment within a search result item. * * @public * @unofficial */ export interface ResultDomItemChild extends TreeNode { /** * Cached metadata for the file containing this match. */ cache: CachedMetadata; /** * Text content of the matched region. */ content: string; /** * End offset of the match context within the document. */ end: number; /** * Layout information used by virtual scrolling. */ info: TreeNodeInfo; /** * Array of match positions within the content. */ matches: ContentPosition[]; /** * Callback to mutate the editor state when navigating to this match. */ mutateEState: unknown; /** * Callback for custom rendering of match highlights. */ onMatchRender: unknown; /** * Parent result item containing this match child. */ parent: ResultDomItem; /** * Reference to the parent result item. */ parentDom: ResultDomItem; /** * Element for the "show more context after" button. */ showMoreAfterEl: HTMLElement; /** * Element for the "show more context before" button. */ showMoreBeforeEl: HTMLElement; /** * Start offset of the match context within the document. */ start: number; /** * Get the position of the next match. * * @returns The next match position. */ getNextPos(arg1: unknown): number; /** * Get the position of the previous match. * * @returns The previous match position. */ getPrevPos(arg1: unknown): number; /** * Handle focus entering this match item. * * @param event - The UI event that triggered focus. */ onFocusEnter(event?: UIEvent): void; /** * Handle focus leaving this match item. * * @param event - The UI event that triggered focus exit. */ onFocusExit(event?: UIEvent): void; /** * Handle click on this match to navigate to it. * * @param event - The UI event that triggered the click. */ onResultClick(event: UIEvent): void; /** * Render this match with optional surrounding text indicators. * * @param hasTextBefore - Whether there is text before this match. * @param hasTextAfter - Whether there is text after this match. */ render(hasTextBefore: boolean, hasTextAfter: boolean): void; /** * Expand the context to show more text after the match. */ showMoreAfter(): void; /** * Expand the context to show more text before the match. */ showMoreBefore(): void; /** * Toggle visibility of the "show more context" buttons. */ toggleShowMoreContextButtons(): void; } /** * Search result data containing matched content positions and property matches. * * @public * @unofficial */ export interface ResultDomResult { /** * Array of content match positions within the document. */ content: ContentPosition[]; /** * Array of matched property results. */ properties: ResultProperty[]; } /** * Represents a matched property within a search result. * * @public * @unofficial */ export interface ResultProperty { /** * Property key name that was matched. */ key: string; /** * {@link Position} of the match within the content. */ pos: ContentPosition; /** * Path of sub-keys for nested property matches. */ subkey: (number | string)[]; } /** * Represents a button item in the sidebar ribbon. * * @public * @unofficial */ export interface RibbonItem { /** * Whether this ribbon item is hidden. */ hidden: boolean; /** * Icon name displayed for this ribbon item. */ icon: IconName; /** * Unique identifier for this ribbon item. */ id: string; /** * Tooltip title displayed on hover. */ title: string; /** * Callback invoked when this ribbon item is clicked. * * @returns A promise that resolves when the callback completes. */ callback(): Promise<void>; } /** * Function `Round`. * * @public * @unofficial */ export interface RoundFunction extends BasesFunction, HasGetDisplayName { } /** * Options for running Mermaid rendering on existing DOM elements. * * @public * @unofficial */ export interface RunOptions { /** DOM nodes to render. */ nodes?: ArrayLike<HTMLElement>; /** CSS selector for elements to render. */ querySelector?: string; /** Whether to suppress rendering errors. */ suppressErrors?: boolean; /** * Callback invoked after each diagram is rendered. * * @param id - The ID of the rendered diagram. * @returns The callback result. */ postRenderCallback?(id: string): unknown; } /** * A controllable task with start, stop, and cancel lifecycle. * * @public * @unofficial */ export interface Runnable { /** * Whether the runnable has been cancelled. */ cancelled: boolean; /** * Callback invoked when the runnable is cancelled. */ onCancel: (() => void) | null; /** * Callback invoked when the runnable starts. */ onStart: (() => void) | null; /** * Callback invoked when the runnable stops. */ onStop: (() => void) | null; /** * Whether the runnable is currently running. */ running: boolean; /** * Cancel the runnable. */ cancel(): void; /** * Check whether the runnable has been cancelled. * * @returns Whether the runnable has been cancelled. */ isCancelled(): boolean; /** * Check whether the runnable is currently running. * * @returns Whether the runnable is currently running. */ isRunning(): boolean; /** * Start the runnable. */ start(): void; /** * Stop the runnable. */ stop(): void; } /** * Represents an error returned from a WebSQL database operation. * * @public * @unofficial */ export interface SQLError { /** * Numeric error code identifying the type of error. */ code: number; /** * Human-readable error message. */ message: string; } /** * Result set returned from a WebSQL query execution. * * @public * @unofficial */ export interface SQLResultSet { /** * Row ID of the last inserted row, if applicable. */ insertId: number; /** * List of rows returned by the query. */ rows: SQLResultSetRowList; /** * Number of rows affected by the query. */ rowsAffected: number; } /** * List of rows returned from a WebSQL query result. * * @public * @unofficial */ export interface SQLResultSetRowList { /** * Number of rows in the result set. */ length: number; /** * Get a row by its index in the result set. * * @param index - The index of the row to retrieve. * @returns The row at the specified index. */ item(index: number): unknown; } /** * Represents a SQL transaction for executing queries against a WebSQL database. * * @public * @unofficial */ export interface SQLTransaction { /** * Execute a SQL statement within this transaction. */ executeSql(sqlStatement: string, arguments?: unknown[], callback?: (transaction: SQLTransaction, resultSet: SQLResultSet) => void, errorCallback?: (transaction: SQLTransaction, error: SQLError) => boolean): void; } /** * Information about the editor's scroll position and dimensions. * * @public * @unofficial */ export interface ScrollInfo { /** * Visible height of the scrollable area (viewport height). */ clientHeight: number; /** * Visible width of the scrollable area (viewport width). */ clientWidth: number; /** * Total scrollable height of the content. */ height: number; /** * Horizontal scroll offset. */ left: number; /** * Vertical scroll offset. */ top: number; /** * Total scrollable width of the content. */ width: number; } /** * {@link Bookmark} item representing a saved search query. * * @public * @unofficial */ export interface SearchBookmarkItem extends BookmarkItem { /** * The saved search query string. */ query: string; /** * Discriminator indicating this is a search bookmark. */ type: "search"; } /** * Cursor for navigating through search results in the editor. * * @public * @unofficial */ export interface SearchCursor { /** * Current editor search position. * * @returns The current search position range. */ current(): EditorRange; /** * All search results. * * @returns Array of all matching ranges. */ findAll(): EditorRange[]; /** * Next editor search position. * * @returns The next search position range. */ findNext(): EditorRange; /** * Previous editor search position. * * @returns The previous search position range. */ findPrevious(): EditorRange; /** * Replace current search result with specified text. * * @param replacement - The text to replace with. * @param origin - The origin identifier for the change. * @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. * * @param replacement - The text to replace with. * @param origin - The origin identifier for the change. */ replaceAll(replacement: string, origin: string): void; } /** * Configuration for creating a search query. * * @public * @unofficial */ export interface SearchQueryConfig { /** Whether the search is case sensitive. */ caseSensitive?: boolean; /** Whether the search string is treated as a literal. */ literal?: boolean; /** Whether the search string is a regular expression. */ regexp?: boolean; /** The replacement string. */ replace?: string; /** The search string. */ search: string; /** Whether the search matches whole words only. */ wholeWord?: boolean; } /** * A match result from a search query cursor. * * @public * @unofficial */ export interface SearchQueryMatch { /** The start position of the match. */ from: number; /** The end position of the match. */ to: number; } /** * {@link obsidian#View} that displays the global search results pane. * * @public * @unofficial */ export interface SearchView extends View { /** * Returns the value of the search element. * * @returns The current search query string. */ getQuery(): string; /** * Get the current view type. * * @returns The search view type. */ getViewType(): typeof ViewType.Search; /** * Handle the copy search results button click. * * @param event - The mouse click event. */ onCopyResultsClick(event: MouseEvent): void; /** * Handle the down arrow key when a search result is focused. * * @param event - The keyboard event. */ onKeyArrowDownInFocus(event: KeyboardEvent): void; /** * Handle the left arrow key when a search result is focused. * * @param event - The keyboard event. */ onKeyArrowLeftInFocus(event: KeyboardEvent): void; /** * Handle the right arrow key when a search result is focused. * * @param event - The keyboard event. */ onKeyArrowRightInFocus(event: KeyboardEvent): void; /** * Handle the up arrow key when a search result is focused. * * @param event - The keyboard event. */ onKeyArrowUpInFocus(event: KeyboardEvent): void; /** * Handle the enter key when a search result is focused. * * @param event - The keyboard event. */ onKeyEnterInFocus(event: KeyboardEvent): void; /** * Show more context lines after a match. * * @param e - The keyboard event. */ onKeyShowMoreAfter(e: unknown): void; /** * Show more context lines before a match. * * @param e - The keyboard event. */ onKeyShowMoreBefore(e: unknown): void; /** * Called when the tap header is clicked. Brings this tab to the front. */ onTabHeaderClick(): void; /** * Render search metadata information into the given parent element. * * @param e - The search metadata to render. * @param parentEl - The parent element to render into. */ renderSearchInfo(e: unknown, parentEl: HTMLElement): void; /** * Saves the current search string to the recent searches in Local Storage. */ saveSearch(): void; /** * Set whether all search results are collapsed. * * @param e - Whether to collapse all results. */ setCollapseAll(e: unknown): void; /** * Toggle the search query explanation display. * * @param e - Whether to show the query explanation. */ setExplainSearch(e: unknown): void; /** * Set whether extra context lines are shown around matches. * * @param e - Whether to show extra context. */ setExtraContext(e: unknown): void; /** * Set whether the search is case-sensitive. * * @param e - Whether to match case. */ setMatchingCase(e: unknown): void; /** * Sets the value of the search element. * * @param value - The search string. */ setQuery(value: string): void; /** * Set the sort order for search results. * * @param sortOrder - The sort order to apply. */ 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; } /** * 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; } /** * Serialized representation of the full workspace layout and state. * * @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; } /** * Serialized representation of a single workspace item (leaf, split, or tab group). * * @public * @unofficial */ export interface SerializedWorkspaceItem { /** * Size dimension of the workspace item (width or height depending on split direction). */ dimension?: number; /** * Unique identifier of the workspace item. */ id: string; /** * Type of the workspace item (e.g., 'split', 'tabs', 'leaf'). */ type: string; } /** * Serialized form of a workspace leaf's navigation history for persistence. * * @public * @unofficial */ export interface SerializedWorkspaceLeafHistory { /** * List of previous navigation states. */ backHistory: WorkspaceLeafHistoryState[]; /** * List of forward navigation states (after going back). */ forwardHistory: WorkspaceLeafHistoryState[]; } /** * Serialized representation of the left ribbon bar state. * * @public * @unofficial */ export interface SerializedWorkspaceLeftRibbon { /** * Record of ribbon items and whether they are hidden. */ hiddenItems: SerializedWorkspaceLeftRibbonHiddenItemsRecord; } /** * Record mapping ribbon item identifiers to their hidden state. * * @public * @unofficial */ export interface SerializedWorkspaceLeftRibbonHiddenItemsRecord extends Record<string, boolean> { } /** * Serialized representation of a workspace sidedock (left or right sidebar). * * @public * @unofficial */ export interface SerializedWorkspaceSidedock extends SerializedWorkspaceItem { /** * Whether the sidedock is collapsed. */ collapsed: boolean; /** * Width of the sidedock in pixels. */ width: number; } /** * Container for i18next service instances. * * @public * @unofficial */ export interface Services { /** The resource store service. */ resourceStore: ResourceStore; /** Additional services. */ [key: string]: unknown; } /** * Electron session for managing browser sessions, cookies, cache, network, and extensions. * * Note: The upstream `static fromPartition(...)` and `static defaultSession` members cannot be * expressed as statics on a plain interface, so they are modelled here as instance members. * * @public * @unofficial */ export interface Session { /** A list of all the known available spell checker languages. */ readonly availableSpellCheckerLanguages: string[]; /** A `Cookies` object for this session. */ readonly cookies: ElectronCookies; /** The default session object of the app. */ defaultSession: Session; /** A `NetLog` object for this session. */ readonly netLog: ElectronNetLog; /** A `Protocol` object for this session. */ readonly protocol: ElectronProtocol; /** A `ServiceWorkers` object for this session. */ readonly serviceWorkers: ElectronServiceWorkers; /** Whether the builtin spell checker is enabled. */ spellCheckerEnabled: boolean; /** The absolute file system path where data for this session is persisted on disk, or `null` for in-memory sessions. */ readonly storagePath: null | string; /** A `WebRequest` object for this session. */ readonly webRequest: ElectronWebRequest; /** Emitted after an extension is loaded. */ addListener(event: "extension-loaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted after an extension is loaded and all necessary browser state is initialized. */ addListener(event: "extension-ready", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted after an extension is unloaded. */ addListener(event: "extension-unloaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted when a new HID device becomes available. */ addListener(event: "hid-device-added", listener: (event: ElectronEvent, details: ElectronHidDeviceAddedDetails) => void): this; /** Emitted when a HID device has been removed. */ addListener(event: "hid-device-removed", listener: (event: ElectronEvent, details: ElectronHidDeviceRemovedDetails) => void): this; /** Emitted when a render process requests preconnection to a URL. */ addListener(event: "preconnect", listener: (event: ElectronEvent, preconnectUrl: string, allowCredentials: boolean) => void): this; /** Emitted when a HID device needs to be selected. */ addListener(event: "select-hid-device", listener: (event: ElectronEvent, details: ElectronSelectHidDeviceDetails, callback: (deviceId?: null | string) => void) => void): this; /** Emitted when a serial port needs to be selected. */ addListener(event: "select-serial-port", listener: (event: ElectronEvent, portList: ElectronSerialPort[], webContents: ElectronWebContents, callback: (portId: string) => void) => void): this; /** Emitted after a new serial port becomes available. */ addListener(event: "serial-port-added", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this; /** Emitted after a serial port has been removed. */ addListener(event: "serial-port-removed", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this; /** Emitted when a hunspell dictionary file starts downloading. */ addListener(event: "spellcheck-dictionary-download-begin", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file download fails. */ addListener(event: "spellcheck-dictionary-download-failure", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file has been successfully downloaded. */ addListener(event: "spellcheck-dictionary-download-success", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file has been successfully initialized. */ addListener(event: "spellcheck-dictionary-initialized", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when Electron is about to download `item` in `webContents`. */ addListener(event: "will-download", listener: (event: ElectronEvent, item: ElectronDownloadItem, webContents: ElectronWebContents) => void): this; /** * Writes the word to the custom dictionary. Does not work on non-persistent (in-memory) sessions. * * @param word - The word to add. * @returns Whether the word was successfully written to the custom dictionary. */ addWordToSpellCheckerDictionary(word: string): boolean; /** * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate authentication. * * @param domains - A comma-separated list of servers for which integrated authentication is enabled. */ allowNTLMCredentialsForDomains(domains: string): void; /** * Clears the session's HTTP authentication cache. * * @returns A promise that resolves when the HTTP authentication cache has been cleared. */ clearAuthCache(): Promise<void>; /** * Clears the session's HTTP cache. * * @returns A promise that resolves when the cache clear operation is complete. */ clearCache(): Promise<void>; /** * Clears the session's generated JS code caches. * * @param options - Options controlling which code caches are cleared. * @returns A promise that resolves when the code cache clear operation is complete. */ clearCodeCaches(options: ElectronClearCodeCachesOptions): Promise<void>; /** * Clears the host resolver cache. * * @returns A promise that resolves when the operation is complete. */ clearHostResolverCache(): Promise<void>; /** * Clears the storage data for the current session. * * @param options - Options controlling which storage data is cleared. * @returns A promise that resolves when the storage data has been cleared. */ clearStorageData(options?: ElectronClearStorageDataOptions): Promise<void>; /** * Closes all connections, terminating any requests currently in flight. * * @returns A promise that resolves when all connections are closed. */ closeAllConnections(): Promise<void>; /** * Allows resuming a cancelled or interrupted download from a previous session. * * @param options - Options describing the interrupted download to resume. */ createInterruptedDownload(options: ElectronCreateInterruptedDownloadOptions): void; /** Disables any network emulation already active for the session. */ disableNetworkEmulation(): void; /** * Initiates a download of the resource at `url`. * * @param url - The URL of the resource to download. */ downloadURL(url: string): void; /** * Emulates network with the given configuration for the session. * * @param options - The network emulation configuration. */ enableNetworkEmulation(options: ElectronEnableNetworkEmulationOptions): void; /** Writes any unwritten DOMStorage data to disk. */ flushStorageData(): void; /** * Resets all internal states of the proxy service and reapplies the latest proxy configuration. * * @returns A promise that resolves when the proxy configuration is reapplied. */ forceReloadProxyConfig(): Promise<void>; /** * Returns a session instance from the `partition` string, creating one with `options` if none exists. * * @param partition - The partition string. * @param options - Options used when creating a new session. * @returns The session for the given partition. */ fromPartition(partition: string, options?: ElectronFromPartitionOptions): Session; /** * Returns a list of all loaded extensions. * * @returns The loaded extensions. */ getAllExtensions(): ElectronExtension[]; /** * Returns the blob data associated with the given identifier. * * @param identifier - The blob UUID. * @returns A promise that resolves with the blob data. */ getBlobData(identifier: string): Promise<Buffer>; /** * Returns the session's current cache size, in bytes. * * @returns A promise that resolves with the cache size in bytes. */ getCacheSize(): Promise<number>; /** * Returns the loaded extension with the given ID. * * @param extensionId - The extension ID. * @returns The loaded extension. */ getExtension(extensionId: string): ElectronExtension; /** * Returns an array of paths to preload scripts that have been registered. * * @returns The registered preload script paths. */ getPreloads(): string[]; /** * Returns an array of language codes the spellchecker is enabled for. * * @returns The enabled spell checker language codes. */ getSpellCheckerLanguages(): string[]; /** Returns the absolute file system path where data for this session is persisted on disk. */ getStoragePath(): void; /** * Returns the user agent for this session. * * @returns The user agent. */ getUserAgent(): string; /** * Returns whether or not this session is a persistent one. * * @returns Whether the session is persistent. */ isPersistent(): boolean; /** * Returns whether the builtin spell checker is enabled. * * @returns Whether the spell checker is enabled. */ isSpellCheckerEnabled(): boolean; /** * Returns all words in the app's custom dictionary. * * @returns A promise that resolves with all words in the custom dictionary. */ listWordsInSpellCheckerDictionary(): Promise<string[]>; /** * Loads a Chrome extension from `path`. * * @param path - The path to the unpacked extension. * @param options - Options controlling how the extension is loaded. * @returns A promise that resolves with the loaded extension. */ loadExtension(path: string, options?: ElectronLoadExtensionOptions): Promise<ElectronExtension>; /** Emitted after an extension is loaded. */ on(event: "extension-loaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted after an extension is loaded and all necessary browser state is initialized. */ on(event: "extension-ready", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted after an extension is unloaded. */ on(event: "extension-unloaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted when a new HID device becomes available. */ on(event: "hid-device-added", listener: (event: ElectronEvent, details: ElectronHidDeviceAddedDetails) => void): this; /** Emitted when a HID device has been removed. */ on(event: "hid-device-removed", listener: (event: ElectronEvent, details: ElectronHidDeviceRemovedDetails) => void): this; /** Emitted when a render process requests preconnection to a URL. */ on(event: "preconnect", listener: (event: ElectronEvent, preconnectUrl: string, allowCredentials: boolean) => void): this; /** Emitted when a HID device needs to be selected. */ on(event: "select-hid-device", listener: (event: ElectronEvent, details: ElectronSelectHidDeviceDetails, callback: (deviceId?: null | string) => void) => void): this; /** Emitted when a serial port needs to be selected. */ on(event: "select-serial-port", listener: (event: ElectronEvent, portList: ElectronSerialPort[], webContents: ElectronWebContents, callback: (portId: string) => void) => void): this; /** Emitted after a new serial port becomes available. */ on(event: "serial-port-added", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this; /** Emitted after a serial port has been removed. */ on(event: "serial-port-removed", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this; /** Emitted when a hunspell dictionary file starts downloading. */ on(event: "spellcheck-dictionary-download-begin", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file download fails. */ on(event: "spellcheck-dictionary-download-failure", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file has been successfully downloaded. */ on(event: "spellcheck-dictionary-download-success", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file has been successfully initialized. */ on(event: "spellcheck-dictionary-initialized", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when Electron is about to download `item` in `webContents`. */ on(event: "will-download", listener: (event: ElectronEvent, item: ElectronDownloadItem, webContents: ElectronWebContents) => void): this; /** Emitted after an extension is loaded. */ once(event: "extension-loaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted after an extension is loaded and all necessary browser state is initialized. */ once(event: "extension-ready", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted after an extension is unloaded. */ once(event: "extension-unloaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Emitted when a new HID device becomes available. */ once(event: "hid-device-added", listener: (event: ElectronEvent, details: ElectronHidDeviceAddedDetails) => void): this; /** Emitted when a HID device has been removed. */ once(event: "hid-device-removed", listener: (event: ElectronEvent, details: ElectronHidDeviceRemovedDetails) => void): this; /** Emitted when a render process requests preconnection to a URL. */ once(event: "preconnect", listener: (event: ElectronEvent, preconnectUrl: string, allowCredentials: boolean) => void): this; /** Emitted when a HID device needs to be selected. */ once(event: "select-hid-device", listener: (event: ElectronEvent, details: ElectronSelectHidDeviceDetails, callback: (deviceId?: null | string) => void) => void): this; /** Emitted when a serial port needs to be selected. */ once(event: "select-serial-port", listener: (event: ElectronEvent, portList: ElectronSerialPort[], webContents: ElectronWebContents, callback: (portId: string) => void) => void): this; /** Emitted after a new serial port becomes available. */ once(event: "serial-port-added", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this; /** Emitted after a serial port has been removed. */ once(event: "serial-port-removed", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this; /** Emitted when a hunspell dictionary file starts downloading. */ once(event: "spellcheck-dictionary-download-begin", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file download fails. */ once(event: "spellcheck-dictionary-download-failure", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file has been successfully downloaded. */ once(event: "spellcheck-dictionary-download-success", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when a hunspell dictionary file has been successfully initialized. */ once(event: "spellcheck-dictionary-initialized", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Emitted when Electron is about to download `item` in `webContents`. */ once(event: "will-download", listener: (event: ElectronEvent, item: ElectronDownloadItem, webContents: ElectronWebContents) => void): this; /** * Preconnects the given number of sockets to an origin. * * @param options - Options describing the origin and number of sockets. */ preconnect(options: ElectronPreconnectOptions): void; /** * Unloads an extension. * * @param extensionId - The extension ID. */ removeExtension(extensionId: string): void; /** Removes a previously registered `extension-loaded` event listener. */ removeListener(event: "extension-loaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Removes a previously registered `extension-ready` event listener. */ removeListener(event: "extension-ready", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Removes a previously registered `extension-unloaded` event listener. */ removeListener(event: "extension-unloaded", listener: (event: ElectronEvent, extension: ElectronExtension) => void): this; /** Removes a previously registered `hid-device-added` event listener. */ removeListener(event: "hid-device-added", listener: (event: ElectronEvent, details: ElectronHidDeviceAddedDetails) => void): this; /** Removes a previously registered `hid-device-removed` event listener. */ removeListener(event: "hid-device-removed", listener: (event: ElectronEvent, details: ElectronHidDeviceRemovedDetails) => void): this; /** Removes a previously registered `preconnect` event listener. */ removeListener(event: "preconnect", listener: (event: ElectronEvent, preconnectUrl: string, allowCredentials: boolean) => void): this; /** Removes a previously registered `select-hid-device` event listener. */ removeListener(event: "select-hid-device", listener: (event: ElectronEvent, details: ElectronSelectHidDeviceDetails, callback: (deviceId?: null | string) => void) => void): this; /** Removes a previously registered `select-serial-port` event listener. */ removeListener(event: "select-serial-port", listener: (event: ElectronEvent, portList: ElectronSerialPort[], webContents: ElectronWebContents, callback: (portId: string) => void) => void): this; /** Removes a previously registered `serial-port-added` event listener. */ removeListener(event: "serial-port-added", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this; /** Removes a previously registered `serial-port-removed` event listener. */ removeListener(event: "serial-port-removed", listener: (event: ElectronEvent, port: ElectronSerialPort, webContents: ElectronWebContents) => void): this; /** Removes a previously registered `spellcheck-dictionary-download-begin` event listener. */ removeListener(event: "spellcheck-dictionary-download-begin", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Removes a previously registered `spellcheck-dictionary-download-failure` event listener. */ removeListener(event: "spellcheck-dictionary-download-failure", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Removes a previously registered `spellcheck-dictionary-download-success` event listener. */ removeListener(event: "spellcheck-dictionary-download-success", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Removes a previously registered `spellcheck-dictionary-initialized` event listener. */ removeListener(event: "spellcheck-dictionary-initialized", listener: (event: ElectronEvent, languageCode: string) => void): this; /** Removes a previously registered `will-download` event listener. */ removeListener(event: "will-download", listener: (event: ElectronEvent, item: ElectronDownloadItem, webContents: ElectronWebContents) => void): this; /** * Removes the word from the custom dictionary. Does not work on non-persistent (in-memory) sessions. * * @param word - The word to remove. * @returns Whether the word was successfully removed from the custom dictionary. */ removeWordFromSpellCheckerDictionary(word: string): boolean; /** * Resolves the proxy information for `url`. * * @param url - The URL to resolve the proxy for. * @returns A promise that resolves with the proxy information. */ resolveProxy(url: string): Promise<string>; /** * Sets a handler to respond to Bluetooth pairing requests. * * @param handler - The pairing handler, or `null` to remove it. */ setBluetoothPairingHandler(handler: ((details: ElectronBluetoothPairingHandlerHandlerDetails, callback: (response: ElectronBluetoothPairingResponse) => void) => void) | null): void; /** * Sets the certificate verify proc for the session. * * @param proc - The verification procedure, or `null` to revert to the default. */ setCertificateVerifyProc(proc: ((request: ElectronRequest, callback: (verificationResult: number) => void) => void) | null): void; /** * Sets the directory to store the generated JS code cache for this session. * * @param path - The directory to store the code cache in. */ setCodeCachePath(path: string): void; /** * Sets the handler used to respond to device permission checks for the session. * * @param handler - The handler returning whether the device is permitted, or `null` to clear it. */ setDevicePermissionHandler(handler: ((details: ElectronDevicePermissionHandlerHandlerDetails) => boolean) | null): void; /** * Sets the download saving directory. * * @param path - The directory to save downloads to. */ setDownloadPath(path: string): void; /** * Sets the handler used to respond to permission checks for the session. * * @param handler - The handler returning whether the permission is allowed, or `null` to clear it. */ setPermissionCheckHandler(handler: ((webContents: ElectronWebContents | null, permission: string, requestingOrigin: string, details: ElectronPermissionCheckHandlerHandlerDetails) => boolean) | null): void; /** * Sets the handler used to respond to permission requests for the session. * * @param handler - The handler invoking the callback to allow or reject the permission, or `null` to clear it. */ setPermissionRequestHandler(handler: ((webContents: ElectronWebContents, permission: "clipboard-read" | "display-capture" | "fullscreen" | "geolocation" | "media" | "mediaKeySystem" | "midi" | "midiSysex" | "notifications" | "openExternal" | "pointerLock" | "unknown", callback: (permissionGranted: boolean) => void, details: ElectronPermissionRequestHandlerHandlerDetails) => void) | null): void; /** * Adds scripts that will be executed on all web contents associated with this session just before normal preload scripts run. * * @param preloads - The paths to the preload scripts. */ setPreloads(preloads: string[]): void; /** * Sets the proxy settings. * * @param config - The proxy configuration. * @returns A promise that resolves when the proxy setting process is complete. */ setProxy(config: ElectronConfig): Promise<void>; /** * Overrides the URL used to download hunspell dictionaries. * * @param url - The base URL to download dictionaries from, with a trailing slash. */ setSpellCheckerDictionaryDownloadURL(url: string): void; /** * Sets whether to enable the builtin spell checker. * * @param enable - Whether to enable the spell checker. */ setSpellCheckerEnabled(enable: boolean): void; /** * Sets the languages the spell checker should check. * * @param languages - An array of language codes. */ setSpellCheckerLanguages(languages: string[]): void; /** * Sets the SSL configuration for the session. * * @param config - The SSL configuration. */ setSSLConfig(config: ElectronSSLConfigConfig): void; /** * Overrides the user agent and accept languages for this session. * * @param userAgent - The user agent string. * @param acceptLanguages - A comma-separated ordered list of language codes. */ setUserAgent(userAgent: string, acceptLanguages?: string): void; } /** * Parameters for setting the active leaf. * * @public * @unofficial */ export interface SetActiveLeafParams { /** * Whether to focus the leaf. */ focus?: boolean; } /** * Options for setting a bookmark in the editor. * * @public * @unofficial */ export interface SetBookmarkOptions { /** * Whether the bookmark should be inserted to the left of the character at the position. */ insertLeft?: boolean; } /** * Parameters for setting a highlight match in the editor. * * @public * @unofficial */ export interface SetHighlightMatch { /** * End character offset of the highlight. */ endLoc?: number; /** * Whether to focus the editor on the highlighted match. */ focus: boolean; /** * Line number of the highlight. */ line?: number; /** * The match data associated with this highlight. */ match?: unknown; /** * Start character offset of the highlight. */ startLoc?: number; } /** * Options for setting a selection in the editor. * * @public * @unofficial */ export interface SetSelectionOptions { /** * The origin identifier for the selection change (e.g., user action or programmatic). */ origin?: string; } /** * Handler for receiving shared files and text from other apps on mobile. * * @public * @unofficial */ export interface ShareReceiver { /** * Reference to the app. */ app: App; /** * Constructor. * * To get the constructor instance, use {@link getShareReceiverConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App): this; /** * Handles shared files. * * @param files - Shared files. * @returns A promise that resolves when the shared files are handled. */ handleShareFiles(files: SharedFile[]): Promise<void>; /** * Handles shared text. * * @param text - Shared text. * @returns A promise that resolves when the shared text is handled. */ handleShareText(text: string): Promise<void>; /** * Imports shared files. * * @param files - Shared files. * @returns A promise that resolves when the files are imported. */ 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; } /** * Represents a file shared to Obsidian from another app on mobile. * * @public * @unofficial */ export interface SharedFile { /** * Name of the shared file. */ name: string; /** * URI of the shared file. */ uri: string; } /** * Internal plugin registration for the slash command suggestions feature. * * @public * @unofficial */ export interface SlashCommandPlugin extends InternalPlugin<SlashCommandPluginInstance> { } /** * Plugin instance for slash commands, providing inline command suggestions when typing "/". * * @public * @unofficial */ export interface SlashCommandPluginInstance extends InternalPluginInstance<SlashCommandPlugin> { /** * Whether this plugin is enabled by default. */ defaultOn: false; } /** * Function `Slice`. * * @public * @unofficial */ export interface SliceFunction extends BasesFunction { } /** * Internal plugin registration for the slides (presentation mode) feature. * * @public * @unofficial */ export interface SlidesPlugin extends InternalPlugin<SlidesPluginInstance> { } /** * Plugin instance for slides, providing presentation mode for Markdown files. * * @public * @unofficial */ export interface SlidesPluginInstance extends InternalPluginInstance<SlidesPlugin> { /** * Reference to the app. */ app: App; } /** * Configuration for defining a state effect type. * * @public * @unofficial */ export interface StateEffectDefineSpec<Value> { /** * A function to map the effect value through position changes. * * @param value - The effect value. * @param mapping - The change description. * @returns The mapped value, or `undefined`. */ map?(value: Value, mapping: ChangeDesc): undefined | Value; } /** * Configuration for defining a state field. * * @public * @unofficial */ export interface StateFieldSpec<Value> { /** * Compare two values of this field. * * @param a - The first value. * @param b - The second value. * @returns Whether the values are equal. */ compare?(a: Value, b: Value): boolean; /** * Create the initial value for this field. * * @param state - The editor state. * @returns The initial value. */ create(state: EditorState): Value; /** * Provide extensions based on this field. * * @param field - The state field. * @returns The extension. */ provide?(field: StateField<Value>): Extension; /** * Compute a new value from the field's previous value and a transaction. * * @param value - The previous value. * @param transaction - The transaction. * @returns The updated value. */ update(value: Value, transaction: Transaction): Value; } /** * Captured state of a workspace leaf for history navigation. * * @public * @unofficial */ export interface StateHistory { /** * Ephemeral cursor state within {@link obsidian#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; } /** * Ephemeral editor state stored in the state history (cursor and scroll position). * * @public * @unofficial */ export interface StateHistoryEphemeralState { /** * Cursor selection range in the editor. */ cursor: EditorRange; /** * Scroll position in the editor. */ scroll: number; } /** * Back and forward history stacks for a workspace leaf. * * @public * @unofficial */ export interface StateHistoryLeafHistory { /** * Stack of previous leaf states for back navigation. */ backHistory: StateHistory[]; /** * Stack of forward leaf states for forward navigation. */ forwardHistory: StateHistory[]; } /** * The status bar displayed at the bottom of the application window. * * @public * @unofficial */ export interface StatusBar { /** * Reference to the app. */ app: App; /** * Container element for the status bar. */ containerEl: HTMLElement; /** * Constructor. * * To get the constructor instance, use {@link getStatusBarConstructor} from `obsidian-typings/implementations`. * * @param app - The app. * @param containerEl - The containerEl. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(app: App, containerEl: HTMLElement): this; /** * Register a new status bar item element. * * @returns The newly created status bar item element. */ registerStatusBarItem(): HTMLElement; } /** * Options for mounting a style module. * * @public * @unofficial */ export interface StyleModuleMountOptions { /** A Content Security Policy nonce for the generated style elements. */ nonce?: string; } /** * Options for creating a style module. * * @public * @unofficial */ export interface StyleModuleOptions { /** A function to post-process generated selectors. */ finish?(sel: string): string; } /** * A mapping of CSS selectors to style specifications. * * @public * @unofficial */ export interface StyleModuleSpec { /** A CSS selector mapped to its style specification. */ [selector: string]: StyleSpec; } /** * Represents a submenu entry in a context menu. * * @public * @unofficial */ export interface Submenu { /** * Icon identifier for the submenu item. */ icon: string; /** * Display title for the submenu item. */ title: string; } /** * Chooser component for a suggest modal, managing suggestion selection and navigation. * * @typeParam T - The type of the suggestion items. * @typeParam TModal - The type of the modal. * @public * @unofficial */ export interface SuggestModalChooser<T, TModal> { /** * Reference to the owning modal. */ chooser: TModal; /** * Container element for the suggestion list. */ containerEl: HTMLDivElement; /** * Number of suggestions visible at once. */ numVisibleItems: number; /** * Height of each suggestion row in pixels. */ rowHeight: number; /** * Index of the currently selected suggestion. */ selectedItem: number; /** * DOM elements for each suggestion row. */ suggestions: HTMLDivElement[]; /** * Current suggestion values, or `null` if none. */ values: null | T[]; /** * Display a message in the suggestion list. * * @param text - Message text or document fragment to display. */ addMessage(text: DocumentFragment | string): void; /** * Add a suggestion value to the list. * * @param value - Suggestion value to add. */ addSuggestion(value: T): void; /** * Set the selected item by index, forcing scroll into view. * * @param index - Index of the item to select. * @param evt - The triggering event. */ forceSetSelectedItem(index: number, evt: KeyboardEvent | MouseEvent): void; /** * Move selection to the next suggestion. * * @param evt - The keyboard event. * @returns False if already at the end, void otherwise. */ moveDown(evt: KeyboardEvent): false | void; /** * Move selection to the previous suggestion. * * @param evt - The keyboard event. * @returns False if already at the start, void otherwise. */ moveUp(evt: KeyboardEvent): false | void; /** * Handle click on a suggestion element. * * @param evt - The mouse event. * @param suggestion - The clicked suggestion element. */ onSuggestionClick(evt: MouseEvent, suggestion: HTMLDivElement): void; /** * Handle mouseover on a suggestion element. * * @param evt - The mouse event. * @param suggestion - The hovered suggestion element. */ onSuggestionMouseover(evt: MouseEvent, suggestion: HTMLDivElement): void; /** * Move selection down by one page of visible items. * * @param evt - The keyboard event. * @returns False if already at the end, void otherwise. */ pageDown(evt: KeyboardEvent): false | void; /** * Move selection up by one page of visible items. * * @param evt - The keyboard event. * @returns False if already at the start, void otherwise. */ pageUp(evt: KeyboardEvent): false | void; /** * Set the selected item by index. * * @param index - Index of the item to select. * @param evt - The triggering event. */ setSelectedItem(index: number, evt: KeyboardEvent | MouseEvent): void; /** * Replace all suggestions with new values. * * @param values - Suggestion values to display, or `null`. */ setSuggestions(values: null | T[]): void; /** * Accept the currently selected suggestion. * * @param evt - The triggering event. */ useSelectedItem(evt: KeyboardEvent | MouseEvent): void; } /** * Container for displaying and navigating editor suggestion items. * * @typeParam T - The type of the suggestion items. * @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[]; /** * Add an empty message with provided text. * * @param text - Message text to display. * @returns The created message element. */ addMessage(text: string): HTMLElement; /** * Add suggestion to container. * * @param suggestion - Suggestion to add. */ addSuggestion(suggestion: SearchResult): void; /** * Set selected item to one specified by index, if keyboard navigation, force scroll into view. * * @param index - Index of the item to select. * @param event - The triggering event. * @remark Prefer setSelectedItem, which clamps the index to within suggestions array. */ forceSetSelectedItem(index: number, event: Event): void; /** * Get the DOM element of the currently selected suggestion. * * @returns The selected element, or `null`. */ getSelectedElement(): HTMLElement | null; /** * Get the data value of the currently selected suggestion. * * @returns The selected suggestion data, or `null`. */ getSelectedValue(): null | SearchResult; /** * Move selected item to next suggestion. * * @param event - The keyboard event. * @returns Whether the move was handled. */ moveDown(event: KeyboardEvent): boolean; /** * Move selected item to previous suggestion. * * @param event - The keyboard event. * @returns Whether the move was handled. */ moveUp(event: KeyboardEvent): boolean; /** * Amount of suggestions that can be displayed at once within containerEl. * * @returns The number of visible items. */ get numVisibleItems(): number; /** * Process click on suggestion item. * * @param event - The mouse event. * @param element - The clicked suggestion element. */ onSuggestionClick(event: MouseEvent, element: HTMLElement): void; /** * Process hover on suggestion item. * * @param event - The mouse event. * @param element - The hovered suggestion element. * @returns The result of handling the mouseover. */ onSuggestionMouseover(event: MouseEvent, element: HTMLElement): unknown; /** * Move selected item to the one in the next 'page' (next visible block). * * @param event - The keyboard event. * @returns Whether the page-down was handled. */ pageDown(event: KeyboardEvent): boolean; /** * Move selected item to the one in the previous 'page' (previous visible block). * * @param event - The keyboard event. * @returns Whether the page-up was handled. */ pageUp(event: KeyboardEvent): boolean; /** * Height in pixels of the selected item. * * @returns The row height in pixels. */ get rowHeight(): number; /** * Set selected item to one specified by index, invokes forceSetSelectedItem. * * @param index - Index of the item to select. * @param event - The triggering event. */ setSelectedItem(index: number, event: Event): void; /** * Empties original container and adds multiple suggestions. * * @param suggestions - Suggestions to display. */ setSuggestions(suggestions: SearchResult[]): void; /** * Use currently selected suggestion as the accepted one. * * @param event - The triggering event. * @returns Whether a suggestion was accepted. */ useSelectedItem(event: Event): boolean; } /** * Internal plugin registration for the quick switcher feature. * * @public * @unofficial */ export interface SwitcherPlugin extends InternalPlugin<SwitcherPluginInstance> { } /** * Plugin instance for the quick switcher, providing fuzzy file search and navigation. * * @public * @unofficial */ export interface SwitcherPluginInstance extends InternalPluginInstance<SwitcherPlugin> { /** * The currently open quick-switcher modal, or `null` if none is open. */ activeModal: Modal | null; /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * The plugin's options. */ options: unknown; /** * Reference to the switcher plugin registration. */ plugin: SwitcherPlugin; /** * The quick-switcher modal constructor. */ QuickSwitcherModal: unknown; /** * Handles a settings change made externally (e.g. by Sync). * * @returns A promise that resolves when the change has been handled. */ onExternalSettingsChange(): Promise<void>; /** * Opens the quick switcher. * * @returns A promise that resolves when the switcher is open. */ onOpen(): Promise<void>; } /** * Internal plugin registration for the Obsidian Sync cloud sync feature. * * @public * @unofficial */ export interface SyncPlugin extends InternalPlugin<SyncPluginInstance> { } /** * Plugin instance for Obsidian Sync, managing cloud synchronization of vault data. * * @public * @unofficial */ export interface SyncPluginInstance extends InternalPluginInstance<SyncPlugin> { /** * Reference to the app. */ app: App; /** * Reference to the sync plugin registration. */ plugin: SyncPlugin; } /** * {@link obsidian#View} that displays the Obsidian Sync status and settings. * * @public * @unofficial */ export interface SyncView extends View { /** * Constructor. * * @param leaf - The workspace leaf. * @param syncPluginInstance - The sync plugin instance. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor3__?(leaf: WorkspaceLeaf, syncPluginInstance: SyncPluginInstance): this; /** * Get the current view type. * * @returns The sync view type. */ getViewType(): typeof ViewType.Sync; } /** * Represents a node in the syntax tree. * * @public * @unofficial */ export interface SyntaxNode { /** The first child node. */ firstChild: null | SyntaxNode; /** The start position of this node. */ from: number; /** The last child node. */ lastChild: null | SyntaxNode; /** The name of the node type. */ name: string; /** The next sibling node. */ nextSibling: null | SyntaxNode; /** The parent node. */ parent: null | SyntaxNode; /** The previous sibling node. */ prevSibling: null | SyntaxNode; /** The end position of this node. */ to: number; /** The tree that this node belongs to, if it is a top node. */ tree: LezerTree | null; /** The type of this node. */ type: NodeType; /** * Create a tree cursor starting at this node. * * @param mode - The iteration mode. * @returns A tree cursor. */ cursor(mode?: IterMode): LezerTreeCursor; /** * Resolve the node at the given position. * * @param pos - The position to resolve. * @param side - Which side of the position to prefer. * @returns The resolved syntax node. */ resolve(pos: number, side?: -1 | 0 | 1): SyntaxNode; } /** * A reference to a syntax node, providing its position and type information. * * @public * @unofficial */ export interface SyntaxNodeRef { /** The start position of the node. */ readonly from: number; /** The name of the node type. */ readonly name: string; /** The actual syntax node. */ readonly node: SyntaxNode; /** The end position of the node. */ readonly to: number; /** The tree that this node belongs to, if it is a top node. */ readonly tree: LezerTree | null; /** The type of this node. */ readonly type: NodeType; } /** * Represents a single cell in a markdown table. * * @public * @unofficial */ export interface TableCell { /** * Column index of the cell. */ col: number; /** * Element containing the cell's content. */ contentEl: HTMLElement; /** * Whether the cell has been modified since the last save. */ dirty: boolean; /** * DOM element for the cell. */ el: HTMLElement; /** * End offset of the cell content in the document. */ end: number; /** * Trailing padding characters in the cell. */ padEnd: number; /** * Leading padding characters in the cell. */ padStart: number; /** * Row index of the cell. */ row: number; /** * Start offset of the cell content in the document. */ start: number; /** * Table cell editor that manages this cell. */ table: TableCellEditor; /** * Text content of the cell. */ text: string; } /** * {@link obsidian#Editor} for a single table cell, combining markdown editing with cell properties. * * @public * @unofficial */ export interface TableCellEditor extends MarkdownBaseView, TableCell { } /** * {@link obsidian#Editor} for managing markdown tables. * * @public * @unofficial */ export interface TableEditor { } /** * Table view. * * @public * @unofficial */ export interface TableView extends View { /** * Get view type. * * @returns The table view type. */ getViewType(): typeof ViewType.Table; } /** * Internal plugin registration for the tag browser sidebar feature. * * @public * @unofficial */ export interface TagPanePlugin extends InternalPlugin<TagPanePluginInstance> { } /** * Plugin instance for the tag pane, displaying a browseable list of tags in the sidebar. * * @public * @unofficial */ export interface TagPanePluginInstance extends InternalPluginInstance<TagPanePlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Reference to the tag pane plugin registration. */ plugin: TagPanePlugin; } /** * View for browsing and navigating tags in the vault. * * @public * @unofficial */ export interface TagView extends View { /** * Get the identifier of a tag tree node. * * @param e - The tag tree node. * @returns The node identifier. */ getNodeId(e: unknown): unknown; /** * Get the current view type. * * @returns The view type identifier. */ getViewType(): typeof ViewType.Tag; /** * Check whether the given item is a valid tag view item. * * @param item - The item to check. * @returns Whether the item is a valid tag view item. */ isItem(item: unknown): boolean; /** * Handle pressing Enter on the currently focused tag item. * * @param event - The keyboard event. */ onKeyEnterInFocus(event: KeyboardEvent): void; /** * Set whether all tag groups are collapsed. * * @param e - Whether all groups should be collapsed. */ setIsAllCollapsed(e: unknown): void; /** * Set whether tags should be displayed in a nested hierarchy. * * @param e - Whether to use hierarchy. */ setUseHierarchy(e: unknown): void; /** * Reloads all tags from vault, update all items and sort those. */ updateTags(): void; } /** * 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. */ onFocus(): void; /** * Set the value of the property widget. * * @param value - The value to set. */ setValue(value: unknown): void; } /** * Internal plugin registration for the templates feature. * * @public * @unofficial */ export interface TemplatesPlugin extends InternalPlugin<TemplatesPluginInstance> { } /** * Plugin instance for templates, providing template file insertion into notes. * * @public * @unofficial */ export interface TemplatesPluginInstance extends InternalPluginInstance<TemplatesPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Reference to the templates plugin registration. */ plugin: TemplatesPlugin; } /** * Text content extracted from a PDF page. * * @public * @unofficial */ export interface TextContent { /** Text items in the content. */ items: TextItem[]; /** Style definitions referenced by text items. */ styles: Record<string, PdfTextStyle>; } /** * A single text item extracted from a PDF page. * * @public * @unofficial */ export interface TextItem { /** Text direction. */ dir: string; /** Font name reference. */ fontName: string; /** Whether this item has an end-of-line marker. */ hasEOL: boolean; /** Height of the text item. */ height: number; /** The text string. */ str: string; /** Transformation matrix for the text item. */ transform: number[]; /** Width of the text item. */ width: number; } /** * A text marker in a CodeMirror 5 document. * * @public * @unofficial */ export interface TextMarker { /** * Fired when the marked range changes. */ changed(): void; /** * Clears the marker. */ clear(): void; /** * Finds the current position of the marker. * * @returns The marker's range, or `undefined` if the marker has been cleared. */ find(): TextMarkerRange | undefined; /** * Removes an event listener. * * @param eventName - The event name. * @param handler - The handler to remove. */ off(eventName: string, handler: (...args: unknown[]) => void): void; /** * Registers an event listener. * * @param eventName - The event name. * @param handler - The handler to register. */ on(eventName: string, handler: (...args: unknown[]) => void): void; } /** * The range of a text marker. * * @public * @unofficial */ export interface TextMarkerRange { /** The start position of the marker. */ from: Position; /** The end position of the marker. */ to: Position; } /** * 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 hover popover for the property widget. */ hoverPopover: null; /** * The input element for the property widget. */ inputEl: HTMLInputElement; /** * The type of the property widget. */ type: "text"; /** * The value of the property widget. */ value: string; /** * Handle focus event. * * @param mode - The focus mode. */ onFocus(mode?: FocusMode): void; /** * Render the property widget. */ render(): void; /** * Set the value of the property widget. * * @param value - The value to set. */ setValue(value: unknown): void; } /** * Manifest metadata for an installed theme. * * @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. * * @default `'0.0.0'` * @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 { } /** * A clickable token in the editor with position, text, and type information. * * @public * @unofficial */ export interface Token extends EditorRange { /** * Text content of the token. */ text: string; /** * Type of the token. */ type: "external-link" | "internal-link" | "tag"; } /** * Hierarchical tree view UI component used for file explorers, search results, and similar views. * * @typeParam T - The type of tree item managed by this tree. * @public * @unofficial */ export interface Tree<T extends TreeItem> { /** * Currently active item in tree view. */ activeDom: null | T; /** * Reference to the {@link obsidian#App}. */ app: App; /** * Container element of the tree view. */ containerEl: HTMLElement; /** * Currently focused item in tree view. */ focusedItem: null | T; /** * 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; /** * 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; /** * Change the focused item to the next item in specified direction. * * @param direction - The direction to move focus. */ changeFocusedItem(direction: "backwards" | "forwards"): void; /** * Unselect all selected items in the tree view. */ clearSelectedDoms(): void; /** * Mark tree item as deselected. * * @param node - The tree item to deselect. */ deselectItem(node: T): void; /** * Get the local storage key for the saved tree view folds. * * @returns The local storage key string. */ getFoldKey(): string; /** * Gets the ID of a tree item given its Node. * * @param node - The tree item to get the ID for. * @returns The node ID, or `undefined` if not found. */ getNodeId(node: T): string | undefined; /** * Handle collapsing of all nodes. */ handleCollapseAll(): void; /** * Handle deletion of selected nodes. * * @param event - The keyboard event that triggered the deletion. * @returns A promise that resolves when the selected items are deleted. */ handleDeleteSelectedItems(event: KeyboardEvent): Promise<void>; /** * Handle selection of tree item via keyboard event. * * @param event - The mouse event that triggered the selection. * @param node - The tree item being selected. */ handleItemSelection(event: MouseEvent, node: T): void; /** * Handle renaming of focused item. * * @param event - The keyboard event that triggered the rename. */ handleRenameFocusedItem(event: KeyboardEvent): void; /** * Registers all keyboard actions to the tree view keyscope. */ initializeKeyboardNav(): void; /** * Check whether item is a valid tree item. * * @param node - The item to check. * @returns Whether the 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. * * @param event - The keyboard event. */ onKeyArrowDown(event: KeyboardEvent): void; /** * Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding). * * @param event - The keyboard event. */ onKeyArrowLeft(event: KeyboardEvent): void; /** * Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding). * * @param event - The keyboard event. */ onKeyArrowRight(event: KeyboardEvent): void; /** * Handle keyboard event for moving/selecting tree item above. * * @param event - The keyboard event. */ onKeyArrowUp(event: KeyboardEvent): void; /** * Handle keyboard event for opening tree item. * * @param event - The keyboard event. */ onKeyOpen(event: KeyboardEvent): void; /** * Update scroll representation on resize. */ onResize(): void; /** * Request saving of the current fold states. */ requestSaveFolds(): void; /** * Root item of the tree view. * * @returns The root tree item. */ get root(): TreeRoot<T>; /** * Save the current fold states of the tree view to local storage. */ saveFolds(): void; /** * Mark tree item as selected. * * @param node - The tree item to select. */ selectItem(node: T): void; /** * Set all items in the tree view to be collapsed or expanded. * * @param collapse - Whether to collapse all items. */ setCollapseAll(collapse: boolean): void; /** * Set the focused item in the tree view. * * @param node - The tree item to focus. * @param scrollIntoView - Whether to scroll the item into view. */ setFocusedItem(node: T, scrollIntoView?: boolean): void; /** * (Un)Collapse all items in the tree view. */ toggleCollapseAll(): void; } /** * A tree item that can be collapsed to hide its children. * * @public * @unofficial */ export interface TreeCollapsibleItem extends TreeItem { /** * Container element for the child items of this collapsible node. */ childrenEl: HTMLElement; /** * Current collapsed state of tree item. */ collapsed: boolean; /** * Element for the collapse/expand toggle indicator, or `null` if not rendered. */ collapseEl: HTMLElement | null; /** * Whether tree item is able to be collapsed or not. */ collapsible: boolean; /** * Execute collapse functionality on mouse click. * * @param event - The mouse click event. */ onCollapseClick(event: MouseEvent): void; /** * Set collapsed state of tree item. * * @param value - Whether the item should be collapsed. * @param animate - If set to `true`, will animate on collapse. * @returns Resolves when the collapse state has been applied. */ setCollapsed(value: boolean, animate?: boolean): Promise<undefined>; /** * Set collapsible state of tree item. * * @param value - Whether the item should be collapsible. */ setCollapsible(value: boolean): void; /** * Toggle collapsed state of tree item. * * @param animate - If set to `true`, will animate on collapse. * @returns Resolves when the collapse state has been toggled. */ toggleCollapsed(animate?: boolean): Promise<undefined>; /** * Update the tree item's cover element. * * @param animate - If set to `true`, will animate on collapse. * @returns Resolves when the cover element has been updated. */ updateCollapsed(animate?: boolean): Promise<undefined>; } /** * Represents a single interactive item within a tree view UI component. * * @public * @unofficial */ export interface TreeItem extends TreeNode { /** * Overlay element covering the tree item, used for visual effects. */ coverEl: HTMLElement; /** * Inner container element holding the tree item content. */ innerEl: HTMLElement; /** * The main element representing this tree item in the DOM. */ selfEl: HTMLElement; /** * Execute item functionality on clicking tree item. * * @param event - The mouse click event. */ onSelfClick(event: MouseEvent): void; /** * Set clickable state of tree item. * * @param value - Whether the item should be clickable. */ setClickable(value: boolean): void; } /** * {@link Tree} node. * * @public * @unofficial */ export interface TreeNode { /** * The element of the tree node. */ el: HTMLElement; } /** * Layout information for a tree node used by the virtual scrolling system. * * @public * @unofficial */ export interface TreeNodeInfo { /** * Left offset of child elements in pixels. */ childLeft: number; /** * Left padding applied to child elements in pixels. */ childLeftPadding: number; /** * Top offset of child elements in pixels. */ childTop: number; /** * Whether layout dimensions have been computed. */ computed: boolean; /** * Computed height of the node in pixels. */ height: number; /** * Whether the node is currently hidden from view. */ hidden: boolean; /** * Whether there is a next sibling node. */ next: boolean; /** * Whether a layout recomputation is queued. */ queued: boolean; /** * Computed width of the node in pixels. */ width: number; } /** * Manages the virtual children of a tree node for use with virtual scrolling. * * @typeParam Item - The type of the child items. * @typeParam Owner - The type of the owner node. * @public * @unofficial */ export interface TreeNodeVChildren<Item extends TreeNode, Owner extends TreeNode> { /** * Internal array of child items. */ _children: Item[]; /** * The tree node that owns these children. */ owner: Owner; /** * Add a child item to this node. * * @param item - The child item to add. */ addChild(item: Item): void; /** * Get the array of child items. * * @returns The child items. */ get children(): Item[]; /** * Remove all children from this node. */ clear(): void; /** * Get the first child item, or `undefined` if there are no children. * * @returns The first child item, or `undefined`. */ first(): Item | undefined; /** * Check whether this node has any children. * * @returns Whether the node has children. */ hasChildren(): boolean; /** * Get the last child item, or `undefined` if there are no children. * * @returns The last child item, or `undefined`. */ last(): Item | undefined; /** * Remove a specific child item from this node. * * @param item - The child item to remove. */ removeChild(item: Item): void; /** * Replace all children with the given array. * * @param children - The new array of child items. */ setChildren(children: Item[]): void; /** * Get the number of children. * * @returns The number of child items. */ size(): number; /** * Sort the children using the provided comparison function. * * @param compareFn - The comparison function for sorting. */ sort(compareFn: (a: Item, b: Item) => number): void; } /** * Root node of a tree view that contains all top-level tree items. * * @typeParam Item - The type of the tree items. * @public * @unofficial */ export interface TreeRoot<Item extends TreeItem> extends TreeNode { /** * Container element for the root's child items. */ childrenEl: HTMLElement; /** * Layout information for the root node used by virtual scrolling. */ info: TreeNodeInfo; /** * Spacer element used to maintain correct scroll height for virtual scrolling. */ pusherEl: HTMLElement; /** * Virtual children manager for the root's child items. */ vChildren: TreeNodeVChildren<Item, TreeRoot<Item>>; } /** * Function `Trim`. * * @public * @unofficial */ export interface TrimFunction extends BasesFunction { } /** * Parameters for trying to resolve a file. * * @public * @unofficial */ export interface TryResolveFileParams { /** * The file to resolve. */ file?: string; /** * The path to the file. */ path?: string; } /** * Configuration options for TurndownService. * * @public * @unofficial */ export interface TurndownServiceOptions { /** Custom replacement function for blank nodes. */ blankReplacement?: TurndownServiceReplacementFunction; /** Line break replacement string. */ br?: string; /** Bullet list marker character. */ bulletListMarker?: "-" | "*" | "+"; /** Code block style. */ codeBlockStyle?: "fenced" | "indented"; /** Custom default replacement function. */ defaultReplacement?: TurndownServiceReplacementFunction; /** Emphasis delimiter character. */ emDelimiter?: "_" | "*"; /** Fence delimiter string. */ fence?: "```" | "~~~"; /** Heading style. */ headingStyle?: "atx" | "setext"; /** Horizontal rule replacement string. */ hr?: string; /** Custom replacement function for kept elements. */ keepReplacement?: TurndownServiceReplacementFunction; /** Link reference style. */ linkReferenceStyle?: "collapsed" | "full" | "shortcut"; /** Link style. */ linkStyle?: "inlined" | "referenced"; /** Whether to use preformatted code blocks. */ preformattedCode?: boolean; /** Strong delimiter string. */ strongDelimiter?: "__" | "**"; } /** * A rule that defines how to convert specific HTML elements to Markdown. * * @public * @unofficial */ export interface TurndownServiceRule { /** Filter to match HTML elements. */ filter: TurndownServiceFilter; /** Function that converts the matched element to Markdown. */ replacement?: TurndownServiceReplacementFunction; } /** * Collection of rules used by TurndownService for HTML-to-Markdown conversion. * * @public * @unofficial */ export interface TurndownServiceRules { /** Array of registered rules. */ array: TurndownServiceRule[]; /** Replacement function for blank nodes. */ blankRule: TurndownServiceReplacementFunction; /** Default replacement function when no rule matches. */ defaultRule: TurndownServiceReplacementFunction; /** Replacement function for kept elements. */ keepReplacement: TurndownServiceReplacementFunction; /** Current rule options. */ options: TurndownServiceOptions; /** * Add a rule. * * @param key - Rule identifier. * @param rule - The rule to add. */ add(key: string, rule: TurndownServiceRule): void; /** * Iterate over all rules. * * @param callback - Called for each rule. */ forEach(callback: (rule: TurndownServiceRule, index: number) => void): void; /** * Find the matching rule for a node. * * @param node - The HTML element to match. * @returns The matching rule. */ forNode(node: HTMLElement): TurndownServiceRule; /** * Keep elements matching a filter (pass through as HTML). * * @param filter - The filter to match. */ keep(filter: TurndownServiceFilter): void; /** * Remove elements matching a filter from output. * * @param filter - The filter to match. */ remove(filter: TurndownServiceFilter): void; } /** * Information about a property's expected and inferred widget types. * * @public * @unofficial */ export interface TypeInfo { /** * The explicitly assigned property widget type. */ expected: PropertyWidget; /** * The property widget type inferred from the value. */ inferred: PropertyWidget; } /** * A workspace leaf with a strongly typed view. * * @typeParam TView - The type of the view. * @public * @unofficial */ export interface TypedWorkspaceLeaf<TView extends View> extends WorkspaceLeaf { /** * The typed view attached to this leaf. */ 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 {@link UnknownView}. * * @remark This is probably not the right term. * @public * @unofficial */ export interface UnknownView extends EmptyView { } /** * {@link Bookmark} item representing a bookmarked URL. * * @public * @unofficial */ export interface UrlBookmarkItem extends BookmarkItem { /** * Display title of this URL bookmark. */ title: string; /** * Discriminator indicating this is a URL bookmark. */ type: "url"; /** * The bookmarked URL. */ url: string; } /** * Record mapping file paths to their {@link obsidian#TAbstractFile} instances in the vault. * * @public * @unofficial */ export interface VaultFileMapRecord extends Record<string, TAbstractFile> { } /** * View for rendering and playing video files. * * @public * @unofficial */ export interface VideoView extends EditableFileView { /** * Get the current view type. * * @returns The view type identifier. */ getViewType(): typeof ViewType.Video; } /** * Ephemeral state for a view, storing cursor position and focus information. * * @public * @unofficial */ export interface ViewEphemeralState { /** * Cursor position or selection range in the editor. */ cursor?: EditorRangeOrCaret; /** * Whether the view should receive focus. */ focus: boolean; /** * Whether the view should receive focus on mobile (may show keyboard). */ focusOnMobile: boolean; } /** * Registry that maps view types to their constructors and file extensions to view types. * * @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; /** * Constructor. * * To get the constructor instance, use {@link getViewRegistryConstructor} from `obsidian-typings/implementations`. * * @deprecated - Added only for typing purposes. */ constructor__?(): this; /** * Get the view type associated with a file extension. * * @param extension - File extension. * @returns The view type string, or `undefined` if not registered. */ getTypeByExtension(extension: string): string | undefined; /** * Get the view creator function associated with a view type. * * @param type - The view type identifier. * @returns The view creator function, or `undefined` if not registered. */ getViewCreatorByType(type: string): undefined | ViewCreator; /** * Get the view constructor associated with a view type. * * @param type - The view type identifier. * @returns The typed view creator function, or `undefined` if not registered. */ getViewCreatorByType<TViewType extends ViewTypeType>(type: TViewType): TypedViewCreator<ViewTypeViewMapping[TViewType]> | undefined; /** * Check whether a view type is registered. * * @param extension - The file extension to check. * @returns Whether the extension is registered. */ isExtensionRegistered(extension: string): boolean; /** * Called when the file extensions mapping has been updated. * * @param name - The event name. * @param callback - The callback to invoke. * @returns The event reference. */ on(name: "extensions-updated", callback: () => void): EventRef; /** * Called when a view of type has been registered into the registry. * * @param name - The event name. * @param callback - The callback to invoke with the registered view type. * @returns The event reference. */ on(name: "view-registered", callback: (viewType: string) => void): EventRef; /** * Called when a view of type has been unregistered from the registry. * * @param name - The event name. * @param callback - The callback to invoke with the unregistered view type. * @returns The event reference. */ on(name: "view-unregistered", callback: (viewType: string) => void): EventRef; /** * Register a view type for file extensions. * * @param extensions - File extensions. * @param viewType - View type. * @remark Prefer registering the extensions via the Plugin class. */ registerExtensions(extensions: string[], viewType: string): void; /** * Register a view constructor for a view type. * * @param type - The view type identifier. * @param viewCreator - The view creator function. */ registerView(type: string, viewCreator: ViewCreator): void; /** * Register a view and its associated file extensions. * * @param extensions - The file extensions to register. * @param type - The view type identifier. * @param viewCreator - The view creator function. */ registerViewWithExtensions(extensions: string[], type: string, viewCreator: ViewCreator): void; /** * Unregister extensions for a view type. * * @param extensions - The file extensions to unregister. */ unregisterExtensions(extensions: string[]): void; /** * Unregister a view type. * * @param type - The view type identifier to unregister. */ unregisterView(type: string): void; } /** * Record mapping file extensions to their default view types. * * @public * @unofficial */ export interface ViewRegistryTypeByExtensionRecord extends Record<string, string> { /** * Maps .3gp files to the audio view. */ [FileExtension._3gp]: typeof ViewType.Audio; /** * Maps .avif files to the image view. */ [FileExtension.avif]: typeof ViewType.Image; /** * Maps .bmp files to the image view. */ [FileExtension.bmp]: typeof ViewType.Image; /** * Maps .canvas files to the canvas view. */ [FileExtension.canvas]: typeof ViewType.Canvas; /** * Maps .flac files to the audio view. */ [FileExtension.flac]: typeof ViewType.Audio; /** * Maps .gif files to the image view. */ [FileExtension.gif]: typeof ViewType.Image; /** * Maps .jpeg files to the image view. */ [FileExtension.jpeg]: typeof ViewType.Image; /** * Maps .jpg files to the image view. */ [FileExtension.jpg]: typeof ViewType.Image; /** * Maps .m4a files to the audio view. */ [FileExtension.m4a]: typeof ViewType.Audio; /** * Maps .md files to the markdown view. */ [FileExtension.md]: typeof ViewType.Markdown; /** * Maps .mkv files to the video view. */ [FileExtension.mkv]: typeof ViewType.Video; /** * Maps .mov files to the video view. */ [FileExtension.mov]: typeof ViewType.Video; /** * Maps .mp3 files to the audio view. */ [FileExtension.mp3]: typeof ViewType.Audio; /** * Maps .mp4 files to the video view. */ [FileExtension.mp4]: typeof ViewType.Video; /** * Maps .oga files to the audio view. */ [FileExtension.oga]: typeof ViewType.Audio; /** * Maps .ogg files to the audio view. */ [FileExtension.ogg]: typeof ViewType.Audio; /** * Maps .ogv files to the video view. */ [FileExtension.ogv]: typeof ViewType.Video; /** * Maps .opus files to the audio view. */ [FileExtension.opus]: typeof ViewType.Audio; /** * Maps .pdf files to the PDF view. */ [FileExtension.pdf]: typeof ViewType.Pdf; /** * Maps .png files to the image view. */ [FileExtension.png]: typeof ViewType.Image; /** * Maps .svg files to the image view. */ [FileExtension.svg]: typeof ViewType.Image; /** * Maps .wav files to the audio view. */ [FileExtension.wav]: typeof ViewType.Audio; /** * Maps .webm files to the video view. */ [FileExtension.webm]: typeof ViewType.Video; /** * Maps .webp files to the image view. */ [FileExtension.webp]: typeof ViewType.Image; } /** * Record mapping view type strings to their corresponding view creator functions. * * @public * @unofficial */ export interface ViewRegistryViewByTypeRecord extends Record<string, ViewCreator>, ViewRegistryViewByTypeMapping { } /** * Public API for interacting with the Vim emulation layer. * * @public * @unofficial */ export interface VimApi { /** * Whether to suppress error logging from the Vim layer. */ suppressErrorLogging: boolean; /** * Register an internal key mapping command. * * @param command - The command to register. */ _mapCommand(command: object): void; /** * Build the key map from the current configuration. */ buildKeyMap(): void; /** * Define a new Vim action with the given name and handler function. * * @param name - The name of the action. * @param fn - The handler function for the action. */ defineAction(name: string, fn: (cm: VimEditor, actionArgs: object, vim: VimState["vim"]) => void): void; /** * Define a new Ex command with the given name and prefix. * * @param name - The name of the Ex command. * @param prefix - The prefix for the Ex command. * @param func - The function to execute for the Ex command. */ defineEx(name: string, prefix: string, func: (cm: VimEditor, params: object) => void): void; /** * Define a new Vim motion with the given name and handler. * * @param name - The name of the motion. * @param fn - The handler function for the motion. */ defineMotion(name: string, fn: (cm: VimEditor, head: object, motionArgs: object, vim: VimState["vim"]) => object): void; /** * Define a new Vim operator with the given name and handler. * * @param name - The name of the operator. * @param fn - The handler function for the operator. */ defineOperator(name: string, fn: (cm: VimEditor, operatorArgs: object, ranges: object[], oldAnchor: object, newHead: object) => void): void; /** * Define a new Vim option with default value, type, aliases, and change callback. * * @param name - The name of the option. * @param defaultValue - The default value for the option. * @param type - The type of the option. * @param aliases - The aliases for the option. * @param callback - The callback invoked when the option changes. */ defineOption(name: string, defaultValue: unknown, type: string, aliases?: string[], callback?: (value: unknown, cm?: VimEditor) => void): void; /** * Define a new named register. * * @param name - The name of the register. * @param register - The register object. */ defineRegister(name: string, register: object): void; /** * Enter insert mode in the given editor. * * @param cm - The editor instance. */ enterInsertMode(cm: VimEditor): void; /** * Enter Vim mode in the given editor. * * @param cm - The editor instance. */ enterVimMode(cm: VimEditor): void; /** * Exit insert mode, optionally keeping the cursor position. * * @param cm - The editor instance. * @param keepCursor - Whether to keep the cursor position. */ exitInsertMode(cm: VimEditor, keepCursor?: boolean): void; /** * Exit visual mode, optionally moving the head of the selection. * * @param cm - The editor instance. * @param moveHead - Whether to move the head of the selection. */ exitVisualMode(cm: VimEditor, moveHead?: boolean): void; /** * Look up a key binding in the given editor and origin context. * * @param cm - The editor instance. * @param key - The key to look up. * @param origin - The origin context for the lookup. * @returns Whether a binding was found and handled. */ findKey(cm: VimEditor, key: string, origin?: string): boolean; /** * Get the value of a Vim option. * * @param name - The name of the option. * @param cm - The editor instance. * @param cfg - The configuration object. * @returns The option value. */ getOption(name: string, cm?: VimEditor, cfg?: object): unknown; /** * Get the register controller managing all registers. * * @returns The register controller. */ getRegisterController(): object; /** * Get the global Vim state object. * * @returns The global Vim state. */ getVimGlobalState_(): object; /** * Handle an Ex command input string. * * @param cm - The editor instance. * @param input - The Ex command input string. */ handleEx(cm: VimEditor, input: string): void; /** * Handle a key press in the given editor with the specified origin. * * @param cm - The editor instance. * @param key - The key that was pressed. * @param origin - The origin of the key press. * @returns Whether the key was handled. */ handleKey(cm: VimEditor, key: string, origin?: string): boolean; /** * Create an insert mode key binding for the given key name. * * @param keyName - The key name to bind. */ InsertModeKey(keyName: string): void; /** * Leave Vim mode in the given editor. * * @param cm - The editor instance. */ leaveVimMode(cm: VimEditor): void; /** * Create a recursive key mapping from lhs to rhs in the given context. * * @param lhs - The left-hand side key sequence. * @param rhs - The right-hand side key sequence or command. * @param ctx - The mapping context. */ map(lhs: string, rhs: string, ctx?: string): void; /** * Clear all key mappings in the given context. * * @param ctx - The mapping context to clear. */ mapclear(ctx?: string): void; /** * Map a key sequence to a command type, name, args, and extra options. * * @param keys - The key sequence to map. * @param type - The command type. * @param name - The command name. * @param args - The command arguments. * @param extra - The extra options. */ mapCommand(keys: string, type: string, name: string, args?: object, extra?: object): void; /** * Initialize the Vim state for the given editor if not already initialized. * * @param cm - The editor instance. * @returns The Vim state. */ maybeInitVimState_(cm: VimEditor): VimState; /** * Handle a key press in multi-select mode. * * @param cm - The editor instance. * @param key - The key that was pressed. * @param origin - The origin of the key press. * @returns Whether the key was handled. */ multiSelectHandleKey(cm: VimEditor, key: string, origin?: string): boolean; /** * Create a non-recursive key mapping from lhs to rhs in the given context. * * @param lhs - The left-hand side key sequence. * @param rhs - The right-hand side key sequence or command. * @param ctx - The mapping context. */ noremap(lhs: string, rhs: string, ctx?: string): void; /** * Reset the global Vim state to defaults. */ resetVimGlobalState_(): void; /** * Set the value of a Vim option. * * @param name - The name of the option. * @param value - The value to set. * @param cm - The editor instance. * @param cfg - The configuration object. */ setOption(name: string, value: unknown, cm?: VimEditor, cfg?: object): void; /** * Remove a key mapping for lhs in the given context. * * @param lhs - The left-hand side key sequence to unmap. * @param ctx - The mapping context. */ unmap(lhs: string, ctx?: string): void; } /** * Wrapper around an editor instance providing access to Vim state. * * @public * @unofficial */ export interface VimEditor { /** * The Vim state associated with this editor. */ state: VimState; } /** * Top-level Vim state container for the editor. * * @public * @unofficial */ export interface VimState { /** * Core Vim mode and command state. */ vim: VimStateVim; /** * Vim plugin state for tracking key events. */ vimPlugin: VimStateVimPlugin; } /** * Core Vim state holding mode, input state, and edit history. * * @public * @unofficial */ export interface VimStateVim { /** * Current input state of the Vim command parser. */ inputState: VimStateVimInputState; /** * Whether the editor is currently in insert mode. */ insertMode: false; /** * Repeat count for the current insert mode session. */ insertModeRepeat: undefined; /** * The last edit action command that was executed. */ lastEditActionCommand: undefined; /** * Input state snapshot of the last edit action. */ lastEditInputState: undefined; /** * Last horizontal cursor position (column). */ lastHPos: number; /** * Last horizontal cursor screen position. */ lastHSPos: number; /** * The last motion that was executed. */ lastMotion: VimStateVimLastMotion; /** * The last text that was pasted. */ lastPastedText: null; /** * The last visual selection range. */ lastSelection: null; } /** * Tracks the current input state of the Vim command parser. * * @public * @unofficial */ export interface VimStateVimInputState { /** * Queue of pending changes to apply. */ changeQueue: null; /** * Buffer of keys pressed for the current command sequence. */ keyBuffer: [ ]; /** * Current pending motion command. */ motion: null; /** * Arguments for the current pending motion. */ motionArgs: null; /** * Repeat count for the current motion. */ motionRepeat: [ ]; /** * Current pending operator command. */ operator: null; /** * Arguments for the current pending operator. */ operatorArgs: null; /** * Prefix repeat count for the current command. */ prefixRepeat: [ ]; /** * Name of the currently specified register. */ registerName: null; } /** * Represents the last motion executed in Vim mode. * * @public * @unofficial */ export interface VimStateVimLastMotion { /** * Name of the last executed motion. */ name?: string; } /** * Vim plugin state tracking the last keydown event. * * @public * @unofficial */ export interface VimStateVimPlugin { /** * The last keydown event key string. */ lastKeydown: string; } /** * Result from watching and stating all files in a directory on Capacitor. * * @public * @unofficial */ export interface WatchAndStatAllResult { /** * File entries found in the watched directory. */ children: CapacitorFileEntry[]; } /** * Wrapper around a WeakMap providing the same interface with an inner map reference. * * @typeParam K - The key type. * @typeParam V - The value type. * @public * @unofficial */ export interface WeakMapWrapper<K extends object, V> extends WeakMap<K, V> { /** * The underlying WeakMap instance. */ map: WeakMap<K, V>; } /** * Web preferences for configuring Electron web content behavior. * * @public * @unofficial */ export interface WebPreferences { /** * An alternative title string provided only to accessibility tools such as screen readers. This string is not * directly visible to users. */ accessibleTitle?: string; /** * A list of strings that will be appended to `process.argv` in the renderer process of this app. Useful for * passing small bits of data down to renderer process preload scripts. */ additionalArguments?: string[]; /** * Allow an https page to run JavaScript, CSS or plugins from http URLs. * * @default `false` */ allowRunningInsecureContent?: boolean; /** * Autoplay policy to apply to content in the window. * * @default `no-user-gesture-required` */ autoplayPolicy?: "document-user-activation-required" | "no-user-gesture-required" | "user-gesture-required"; /** * Whether to throttle animations and timers when the page becomes background. This also affects the Page * Visibility API. * * @default `true` */ backgroundThrottling?: boolean; /** * Whether to run Electron APIs and the specified `preload` script in a separate JavaScript context. * * @default `true` */ contextIsolation?: boolean; /** * The default text encoding. * * @default `ISO-8859-1` */ defaultEncoding?: string; /** Sets the default font for the font-family. */ defaultFontFamily?: ElectronDefaultFontFamily; /** * The default font size in pixels. * * @default `16` */ defaultFontSize?: number; /** * The default monospace font size in pixels. * * @default `13` */ defaultMonospaceFontSize?: number; /** * Whether to enable DevTools. If it is set to `false`, `BrowserWindow.webContents.openDevTools()` cannot be used * to open DevTools. * * @default `true` */ devTools?: boolean; /** * A list of feature strings separated by `,` to disable. The full list of supported feature strings can be found * in the RuntimeEnabledFeatures.json5 file. */ disableBlinkFeatures?: string; /** * Whether to disable dialogs completely. Overrides `safeDialogs`. * * @default `false` */ disableDialogs?: boolean; /** * Whether to prevent the window from resizing when entering HTML Fullscreen. * * @default `false` */ disableHtmlFullscreenWindowResize?: boolean; /** * A list of feature strings separated by `,` to enable. The full list of supported feature strings can be found * in the RuntimeEnabledFeatures.json5 file. */ enableBlinkFeatures?: string; /** * Whether to enable preferred size mode. Enabling this causes the `preferred-size-changed` event to be emitted on * the `WebContents` when the preferred size changes. * * @default `false` */ enablePreferredSizeMode?: boolean; /** * Whether to enable the WebSQL api. * * @default `true` */ enableWebSQL?: boolean; /** * Enables Chromium's experimental features. * * @default `false` */ experimentalFeatures?: boolean; /** * Specifies how to run image animations (e.g. GIFs). * * @default `animate` */ imageAnimationPolicy?: "animate" | "animateOnce" | "noAnimation"; /** * Enables image support. * * @default `true` */ images?: boolean; /** * Enables JavaScript support. * * @default `true` */ javascript?: boolean; /** * The minimum font size in pixels. * * @default `0` */ minimumFontSize?: number; /** * Whether dragging and dropping a file or link onto the page causes a navigation. * * @default `false` */ navigateOnDragDrop?: boolean; /** * Whether node integration is enabled. * * @default `false` */ nodeIntegration?: boolean; /** * Experimental option for enabling Node.js support in sub-frames such as iframes and child windows. All preloads * will load for every iframe; `process.isMainFrame` can be used to determine if in the main frame or not. */ nodeIntegrationInSubFrames?: boolean; /** * Whether node integration is enabled in web workers. * * @default `false` */ nodeIntegrationInWorker?: boolean; /** * Whether to enable offscreen rendering for the browser window. * * @default `false` */ offscreen?: boolean; /** * Sets the session used by the page according to the session's partition string. If `partition` starts with * `persist:`, the page will use a persistent session available to all pages in the app with the same `partition`. * If there is no `persist:` prefix, the page will use an in-memory session. */ partition?: string; /** * Whether plugins should be enabled. * * @default `false` */ plugins?: boolean; /** * Specifies a script that will be loaded before other scripts run in the page. The value should be the absolute * file path to the script. */ preload?: string; /** * Whether to enable browser style consecutive dialog protection. * * @default `false` */ safeDialogs?: boolean; /** * The message to display when consecutive dialog protection is triggered. If not defined the default message * would be used. */ safeDialogsMessage?: string; /** * If set, this will sandbox the renderer associated with the window, making it compatible with the Chromium * OS-level sandbox and disabling the Node.js engine. */ sandbox?: boolean; /** * Enables scroll bounce (rubber banding) effect on macOS. * * @default `false` */ scrollBounce?: boolean; /** * Sets the session used by the page. When both `session` and `partition` are provided, `session` will be * preferred. */ session?: Session; /** * Whether to enable the builtin spellchecker. * * @default `true` */ spellcheck?: boolean; /** * Make TextArea elements resizable. * * @default `true` */ textAreasAreResizable?: boolean; /** Enforces the v8 code caching policy used by blink. */ v8CacheOptions?: "bypassHeatCheck" | "bypassHeatCheckAndEagerCompile" | "code" | "none"; /** * Enables WebGL support. * * @default `true` */ webgl?: boolean; /** * When `false`, it will disable the same-origin policy, and set `allowRunningInsecureContent` to `true` if this * option has not been set by the user. * * @default `true` */ webSecurity?: boolean; /** * Whether to enable the `<webview>` tag. * * @default `false` */ webviewTag?: boolean; /** * The default zoom factor of the page, `3.0` represents `300%`. * * @default `1.0` */ zoomFactor?: number; } /** * Stores and manages all history items and cached fav icons. * * @public * @unofficial */ export interface WebviewerDBStore { /** * Reference to the {@link obsidian#App}. */ app: App; /** * Underlying database used to store history items and fav icons via IndexedDB. * * @remark Use methods such as {@link WebviewerDBStore.addHistoryItem} etc. to interact with the stored history. */ db: IDBDatabase; /** * Add a history item to the database. * * @param url - The URL of the history item. * @param title - Optional title for the history item. * @returns A promise that resolves when the history item is added. */ addHistoryItem(url: string, title?: string): Promise<void>; /** * Clear all history items. * * @returns A promise that resolves when all history items are cleared. */ clearHistoryItems(): Promise<void>; /** * Open and initialize the IndexedDB connection. * * @returns A promise that resolves when the connection is established. */ connect(): Promise<void>; /** * Get all history items. * * @returns All stored 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<null | string>; /** * Remove specific history item based on its {@link WebviewerHistoryItem.id | id}. * * @param item - The history item to remove. * @returns A promise that resolves when the history item is removed. */ removeHistoryItem(item: WebviewerHistoryItem): Promise<void>; /** * Add a fav icon to the element. * * @param el - The element to add the icon to. * @param url - The URL to get the icon for. * @param source - Optional source URL for the icon. * @returns A promise that resolves when the icon is set on 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<null | string>; } /** * 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; } /** * {@link obsidian#View} that displays the web browser browsing history. * * @public * @unofficial */ export interface WebviewerHistoryView extends ItemView { /** * Constructor. * * @param leaf - The workspace leaf. * @param browserPluginInstance - The webviewer plugin instance. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor3__?(leaf: WorkspaceLeaf, browserPluginInstance: WebviewerPluginInstance): this; /** * Get the current view type. * * @returns The webviewer history view type. */ getViewType(): typeof ViewType.WebviewerHistory; /** * Refresh the browsing history list. * * @returns The result of refreshing the history. */ update(): Promise<unknown>; } /** * Webviewer open URL event detail. * * @public * @unofficial */ export interface WebviewerOpenUrlEventDetail { /** * Whether the URL is active. */ active?: boolean; /** * The new leaf. */ newLeaf?: boolean | PaneType; /** * The URL. */ url: string; } /** * Internal plugin registration for the embedded web browser feature. * * @public * @unofficial */ export interface WebviewerPlugin extends InternalPlugin<WebviewerPluginInstance> { } /** * Plugin instance for the web viewer, providing an embedded web browser within Obsidian. * * @public * @unofficial */ export interface WebviewerPluginInstance extends InternalPluginInstance<WebviewerPlugin> { /** * Stored history items and cached fav icons. */ db: WebviewerDBStore; /** * Whether this plugin is enabled by default. */ defaultOn: false; /** * URLs that are pending to be added to the ignore list. */ pendingIgnoredURLs: string[]; /** * Build a search engine URL for the given search query. * * @param searchQuery - The search query to build a URL for. * @returns The search engine URL. */ getSearchEngineUrl(searchQuery: string): string; /** * Handle a custom open URL event from the webview. * * @param event - The custom event containing the URL details. */ handleOpenUrl(event: CustomEvent<WebviewerOpenUrlEventDetail>): void; /** * Open a URL in the web viewer. * * @param url - The URL to open. * @param newLeaf - The pane type or whether to open in a new leaf. * @param active - Whether to make the new leaf active. */ openUrl(url: string, newLeaf?: boolean | PaneType, active?: boolean): void; /** * Open a URL in the system default browser. * * @param url - The URL to open externally. */ openUrlExternally(url: string): void; /** * Update the current browsing session state. */ updateSession(): void; } /** * {@link obsidian#View} that renders an embedded web browser for browsing web pages within Obsidian. * * @public * @unofficial */ export interface WebviewerView extends ItemView { /** * Close the in-page search bar. */ closeSearch(): void; /** * Finalize and commit the current page load. * * @returns The commit result. */ commitPageLoad(): unknown; /** * Configure the web contents settings for the webview. */ configureWebContents(): void; /** * Constructor. * * @param leaf - The workspace leaf. * @param browserPluginInstance - The webviewer plugin instance. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor3__?(leaf: WorkspaceLeaf, browserPluginInstance: WebviewerPluginInstance): this; /** * Build context menu items for an image element. * * @param e - The image element context. * @returns The context menu items. */ contextMenuItemsForImg(e: unknown): unknown; /** * Build context menu items for a link element. * * @param e - The link element context. * @param t - The link target information. * @returns The context menu items. */ contextMenuItemsForLink(e: unknown, t: unknown): unknown; /** * Build context menu items for selected text. * * @param e - The selection context. * @param t - The selection target information. * @returns The context menu items. */ contextMenuItemsForSelection(e: unknown, t: unknown): unknown; /** * Display a blank page in the webview. */ displayBlank(): void; /** * Display a context menu at the given position. * * @param e - The context menu event data. */ displayContextMenu(e: unknown): void; /** * Shows the error view. */ displayErrorView(): void; /** * Display the page content in reader mode. * * @returns Resolves when the reader view is displayed. */ displayReaderView(): Promise<unknown>; /** * Shows the webview. */ displayWebView(): void; /** * Get the parsed content for reader mode. * * @returns The parsed reader mode content. */ getReaderModeContent(): Promise<unknown>; /** * Get the current view type. * * @returns The webviewer view type. */ getViewType(): typeof ViewType.Webviewer; /** * Hide all view content (webview, reader, error). */ hideAll(): void; /** * Setup the webview. */ instantiateWebView(): void; /** * Navigate the webview to a URL. * * @param e - The URL or navigation target. * @param t - Navigation options. * @returns The navigation result. */ navigate(e: unknown, t: unknown): unknown; /** * Handle a checkbox click in reader mode. * * @param e - The click event. * @param t - The checkbox element. * @param n - The checkbox state information. */ onCheckboxClick(e: unknown, t: unknown, n: unknown): void; /** * Handle a click on an external link. * * @param e - The click event. * @param t - The link element. * @param n - The link target information. */ onExternalLinkClick(e: unknown, t: unknown, n: unknown): void; /** * Handle a right-click on an external link. * * @param e - The right-click event. * @param t - The link element. * @param n - The link target information. */ onExternalLinkRightClick(e: unknown, t: unknown, n: unknown): void; /** * Handle a fold/collapse state change in reader mode. */ onFoldChange(): void; /** * Handle a click on an internal (vault) link. * * @param e - The click event. * @param t - The link element. * @param n - The link target information. */ onInternalLinkClick(e: unknown, t: unknown, n: unknown): void; /** * Handle dragging an internal link. * * @param e - The drag event. * @param t - The link element. * @param n - The link target information. */ onInternalLinkDrag(e: unknown, t: unknown, n: unknown): void; /** * Handle mouseover on an internal link for preview. * * @param e - The mouseover event. * @param t - The link element. * @param n - The link target information. */ onInternalLinkMouseover(e: unknown, t: unknown, n: unknown): void; /** * Handle a right-click on an internal link. * * @param e - The right-click event. * @param t - The link element. * @param n - The link target information. */ onInternalLinkRightClick(e: unknown, t: unknown, n: unknown): void; /** * Handle a context menu event in reader mode. * * @param e - The context menu event. */ onReaderModeContextMenu(e: unknown): void; /** * Called when the reader mode rendering is complete. */ onRenderComplete(): void; /** * Handle scroll events in the webview. */ onScroll(): void; /** * Handle a click on a tag in reader mode. * * @param e - The click event. * @param t - The tag element. * @param n - The tag information. */ onTagClick(e: unknown, t: unknown, n: unknown): void; /** * Post-process rendered content in reader mode. * * @param e - The rendered content element. * @param t - The processing context. * @param n - Additional processing options. */ postProcess(e: unknown, t: unknown, n: unknown): void; /** * Push the current page to the view navigation history stack. * * @param e - The history entry to push. */ pushViewStackHistory(e: unknown): void; /** * Report a page load event to the history database. * * @param url - The URL of the loaded page. * @param title - The title of the loaded page. * @param navigate - Navigation metadata. */ reportPageLoad(url: string, title: string, navigate: unknown): void; /** * Save the current page content as a Markdown file. * * @returns Resolves when the file has been saved. */ saveAsMarkdown(): Promise<unknown>; /** * Select the appropriate favicon for the current page. * * @param e - The favicon candidates. * @returns The selected favicon. */ selectFavicon(e: unknown): unknown; /** * Set the favicon for the current page. * * @param e - The favicon data. * @returns The result of setting the favicon. */ setFavicon(e: unknown): unknown; /** * Show the in-page search bar. */ showSearch(): void; /** * Stores the title of the current webview. * * @returns Resolves when the title has been stored. */ 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; } /** * Specification for a widget decoration that inserts a widget at a position. * * @public * @unofficial */ export interface WidgetDecorationSpec { /** Whether this is a block widget. */ block?: boolean; /** Which side of the position the widget is on. */ side?: number; /** The widget to display. */ widget: WidgetType; } /** * Editable widget view for embedded file sections (headings, blocks) within the editor. * * @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. * * @param scope - {@link obsidian#Scope} to apply. */ applyScope(scope: Scope): void; /** * Get the current folds of the editor. * * @returns Current fold information, or `null`. */ getFoldInfo(): FoldInfo | null; /** * Splice incoming data at according to subpath for correct reference, then update heading and render. * * @param data - File contents. * @param cache - Cached metadata for the file. */ loadContents(data: string, cache: CachedMetadata): void; /** * Load file from cache based on stored path. * * @returns A promise that resolves when the file has been loaded. */ loadFile(): Promise<void>; /** * Load file and check if data is different from last saved data, then loads contents. * * @param data - File contents. * @param cache - Cached metadata for the file. */ loadFileInternal(data: string, cache?: CachedMetadata): void; /** * Update representation on file finished updating. * * @param file - The changed file. * @param data - New file contents. * @param cache - Updated cached metadata. */ onFileChanged(file: TFile, data: string, cache: CachedMetadata): void; /** * Update representation on file rename. * * @param file - The renamed file. * @param oldPath - Previous file path. */ 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. * * @param element - The title element. */ onTitleChange(element: HTMLElement): void; /** * On keypress on editor title element. * * @param event - The keyboard event. */ onTitleKeydown(event: KeyboardEvent): void; /** * On pasting on editor title element. * * @param element - The title element. * @param event - The clipboard event. */ onTitlePaste(element: HTMLElement, event: ClipboardEvent): void; /** * On unloading widget, unload component and remove scope. */ onunload(): void; /** * Save changes made in editable widget. * * @param data - Data to save. * @param delayed - Whether to delay the save. * @returns A promise that resolves when the data has been saved. */ save(data: string, delayed?: boolean): Promise<void>; /** * On blur widget, save title. * * @param element - The title element. */ saveTitle(element: HTMLElement): void; /** * Show preview of widget. * * @param show - Whether to show or hide the preview. */ showPreview(show?: boolean): void; } /** * Represents a captured text selection within a window. * * @public * @unofficial */ export interface WindowSelection { /** * Element that has focus within the selection. */ focusEl: HTMLElement; /** * The selected DOM range. */ range: globalThis.Range; /** * Window in which the selection exists. */ win: Window; } /** * Internal plugin registration for the word/character count status bar feature. * * @public * @unofficial */ export interface WordCountPlugin extends InternalPlugin<WordCountPluginInstance> { } /** * Plugin instance for word count, displaying word and character counts in the status bar. * * @public * @unofficial */ export interface WordCountPluginInstance extends InternalPluginInstance<WordCountPlugin> { /** * Reference to the app. */ app: App; /** * Whether this plugin is enabled by default. */ defaultOn: true; /** * Reference to the word count plugin registration. */ plugin: WordCountPlugin; } /** * Worker results. * * @public * @unofficial */ export interface WorkerResults { /** * Shared buffer containing node position data from the simulation worker. */ buffer: SharedArrayBuffer; /** * Array of node identifiers corresponding to entries in the buffer. */ id: number[]; /** * Version counter for tracking simulation updates. */ v?: number; } /** * Record mapping source identifiers to their hover link source configurations. * * @public * @unofficial */ export interface WorkspaceHoverLinkSourcesRecord extends Record<string, HoverLinkSource> { } /** * Navigation history for a workspace leaf, supporting back/forward navigation. * * @public * @unofficial */ export interface WorkspaceLeafHistory { /** * List of previous navigation states. */ backHistory: WorkspaceLeafHistoryState[]; /** * List of forward navigation states (after going back). */ forwardHistory: WorkspaceLeafHistoryState[]; /** * The workspace leaf that owns this history. */ owner: WorkspaceLeaf; /** * Navigate back to the previous state. * * @returns A promise that resolves when navigation is complete. * To get the constructor instance, use {@link getWorkspaceLeafHistoryConstructor} from `obsidian-typings/implementations`. */ back(): Promise<void>; /** * Constructor. * * To get the constructor instance, use {@link getWorkspaceLeafHistoryConstructor} from `obsidian-typings/implementations`. * * @param owner - The owner. * @returns The new instance. * @deprecated - Added only for typing purposes. */ constructor__?(owner: WorkspaceLeaf): this; /** * Restore history from a serialized representation. * * @param e - The serialized history data. */ deserialize(e: SerializedWorkspaceLeafHistory): void; /** * Navigate forward to the next state. * * @returns A promise that resolves when navigation is complete. */ forward(): Promise<void>; /** * Navigate by the given number of steps (negative for back, positive for forward). * * @param step - The number of steps to navigate. * @returns A promise that resolves when navigation is complete. */ go(step: number): Promise<void>; /** * Push a new state onto the back history stack. * * @param state - The history state to push. */ pushState(state: WorkspaceLeafHistoryState): void; /** * Serialize the history for persistence. * * @returns The serialized history data. */ serialize(): SerializedWorkspaceLeafHistory; /** * Update the current state in the history. * * @param state - The history state to update with. * @returns A promise that resolves when the state is updated. */ updateState(state: WorkspaceLeafHistoryState): Promise<void>; } /** * A single state entry in a workspace leaf's navigation history. * * @public * @unofficial */ export interface WorkspaceLeafHistoryState { /** * Ephemeral editor state (cursor position, scroll, etc.). */ eState: unknown; /** * Icon associated with this history entry. */ icon: IconName; /** * View state data for this history entry. */ state: unknown; /** * Display title for this history entry. */ title: string; } /** * Internal plugin registration for the workspaces (layout saving/loading) feature. * * @public * @unofficial */ export interface WorkspacesPlugin extends InternalPlugin<WorkspacesPluginInstance> { } /** * Plugin instance for workspaces, managing saving and loading of workspace layouts. * * @public * @unofficial */ export interface WorkspacesPluginInstance extends InternalPluginInstance<WorkspacesPlugin> { /** * Reference to the app. */ app: App; /** * Reference to the workspaces plugin registration. */ plugin: WorkspacesPlugin; } /** * Function `Year`. * * @public * @unofficial */ export interface YearFunction extends BasesFunction, HasExtract { } /** * Internal plugin registration for the Zettelkasten ID prefixer feature. * * @public * @unofficial */ export interface ZkPrefixerPlugin extends InternalPlugin<ZkPrefixerPluginInstance> { } /** * Plugin instance for the Zettelkasten prefixer, prepending unique IDs to new note filenames. * * @public * @unofficial */ export interface ZkPrefixerPluginInstance extends InternalPluginInstance<ZkPrefixerPlugin> { /** * Reference to the app. */ app: App; /** * Reference to the Zettelkasten prefixer plugin registration. */ plugin: ZkPrefixerPlugin; } /** * Blend modes supported by PixiJS. * * @public * @unofficial */ export type BLEND_MODES = number; /** * Callback type for i18next operations. * * @public * @unofficial */ export type Callback = (error: unknown, t: TFunction) => void; /** * Coordinate system mode for CodeMirror 5 position calculations. * * @public * @unofficial */ export type Cm5CoordsMode = "div" | "local" | "page" | "window"; /** * Input style for CodeMirror 5 editors. * * @public * @unofficial */ export type Cm5InputStyle = "contenteditable" | "textarea"; /** * A mode specification for CodeMirror 5 with a required name and additional options. * * @public * @unofficial */ export type Cm5ModeSpec<T> = { [P in keyof T]: T[P]; } & { name: string; }; /** * Handler function for post processing a code block. * * @public * @unofficial */ export type CodeBlockPostProcessorHandler = (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise<void> | void; /** * Color source type. * * @public * @unofficial */ export type ColorSource = { r: number; g: number; b: number; a?: number; } | Float32Array | number | number[] | string; /** * Union type of all valid configuration item keys in the vault config. * * @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" | "userIgnoreFilters" | "useTab" | "vimMode"; /** * Represents a content position as a start and end offset pair within a document. * * @public * @unofficial */ export type ContentPosition = [ startOffset: number, endOffset: number ]; /** * DOMPurify library type, callable to create a new instance scoped to a window. * * @public * @unofficial */ export type DOMPurify = { (window?: Window): DOMPurifyI; } & DOMPurifyI; /** * Electron Accelerator, a string representing a keyboard shortcut. * * @public * @unofficial */ export type ElectronAccelerator = string; /** * 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; /** * Extracts a constructor type from an interface that defines a `constructor__`, `constructor2__`, * `constructor3__`, `constructor4__`, or `constructor5__` method. * * Prefers higher-numbered variants over lower-numbered ones when multiple are present, * since higher-numbered variants represent deeper subclass constructors when ancestor classes * already define lower-numbered ones. * * The `constructor[N]__` helpers are declared optional (`constructor[N]__?`), so matching is done via * `'constructor[N]__' extends keyof T` (which sees optional keys) combined with `NonNullable` (which * strips the `| undefined` an optional member carries), rather than * `T extends { constructor[N]__(): … }` (which no longer matches an optional method). The final branch * still accepts a function type passed directly (e.g. `ExtractConstructor<App['constructor__']>`), * `NonNullable` likewise tolerating its optional `| undefined`. * * @typeParam T - An interface with a `constructor[N]__` method, or a function type directly. * * @example * ```ts * // From an interface: * type AppCtor = ExtractConstructor<App>; * * // From a constructor__ method type directly: * type AppCtor = ExtractConstructor<App['constructor__']>; * ``` * * @public * @unofficial */ export type ExtractConstructor<T> = "constructor5__" extends keyof T ? NonNullable<T["constructor5__"]> extends (...args: infer Args) => infer Instance ? ConstructorBase<Args, Instance> : never : "constructor4__" extends keyof T ? NonNullable<T["constructor4__"]> extends (...args: infer Args) => infer Instance ? ConstructorBase<Args, Instance> : never : "constructor3__" extends keyof T ? NonNullable<T["constructor3__"]> extends (...args: infer Args) => infer Instance ? ConstructorBase<Args, Instance> : never : "constructor2__" extends keyof T ? NonNullable<T["constructor2__"]> extends (...args: infer Args) => infer Instance ? ConstructorBase<Args, Instance> : never : "constructor__" extends keyof T ? NonNullable<T["constructor__"]> extends (...args: infer Args) => infer Instance ? ConstructorBase<Args, Instance> : never : NonNullable<T> extends (...args: infer Args) => infer Instance ? ConstructorBase<Args, Instance> : never; /** * Available sort orders for the file explorer view. * * @public * @unofficial */ export type FileExplorerViewSortOrder = "alphabetical" | "alphabeticalReverse" | "byCreatedTime" | "byCreatedTimeReverse" | "byModifiedTime" | "byModifiedTimeReverse"; /** * Parent type for file tree items: either a folder or the tree root. * * @public * @unofficial */ export type FileTreeItemParent = FolderTreeItem | TreeRoot<FileTreeItem | FolderTreeItem>; /** * Specifies which part of an input to focus: start, end, or select both. * * @public * @unofficial */ export type FocusMode = "both" | "end" | "start"; /** * A Prism grammar definition, combining common token names with arbitrary additional tokens. * * @public * @unofficial */ export type Grammar = GrammarRest & Record<string, GrammarValue>; /** * A grammar value: a single regex, a token object, or an array of either. * * @public * @unofficial */ export type GrammarValue = Array<PrismTokenObject | RegExp> | PrismTokenObject | RegExp; /** * Available color types. * * @public * @unofficial */ export type GraphColor = "arrow" | "circle" | "fill" | "fillAttachment" | "fillFocused" | "fillHighlight" | "fillTag" | "fillUnresolved" | "line" | "lineHighlight" | "text"; /** * Callback invoked after an element is highlighted. * * @public * @unofficial */ export type HighlightCallback = (element: Element) => void; /** * Callback function invoked by a Prism hook. * * @public * @unofficial */ export type HookCallback = (env: Environment) => void; /** * Names of hooks available in DOMPurify's sanitization lifecycle. * * @public * @unofficial */ export type HookName = "afterSanitizeAttributes" | "afterSanitizeElements" | "afterSanitizeShadowDOM" | "beforeSanitizeAttributes" | "beforeSanitizeElements" | "beforeSanitizeShadowDOM" | "uponSanitizeAttribute" | "uponSanitizeElement" | "uponSanitizeShadowNode"; /** * Map of hook names to their registered callback arrays. * * @public * @unofficial */ export type HookTypes = Record<string, HookCallback[]>; /** * Loader function for Mermaid icon packs. * * @public * @unofficial */ export type IconLoader = () => Promise<unknown>; /** * Mapping from internal plugin name to its corresponding plugin instance type. * * @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; }; /** * Mapping from internal plugin name to its corresponding plugin registration type. * * @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; }; /** * Union type of all internal plugin name string literals. * * @public * @unofficial */ export type InternalPluginNameType = (typeof InternalPluginName)[keyof typeof InternalPluginName]; /** * Map of language identifiers to their grammar definitions. * * @public * @unofficial */ export type LanguageMap = Record<string, Grammar>; /** * The Prism languages registry, combining the language map with protocol methods. * * @public * @unofficial */ export type Languages = LanguageMap & LanguageMapProtocol; /** * Callback that processes a batch of link updates when files are renamed or moved. * * @public * @unofficial */ export type LinkUpdatesHandler = (linkUpdates: LinkUpdate[]) => Promise<void>; /** * A string-literal type `T` that still accepts any other `string`. * * The `& Record<never, never>` on the `string` arm keeps the literal members of `T` visible for editor * autocomplete (they are not collapsed into `string`), while the whole union stays assignable-compatible * with `string`. This lets a member typed as `LiteralStringUnion<T>` be overridden by a subclass that * returns a plain `string` — a bare `T` (e.g. `'markdown'`) could not, since `string` is not assignable to * a narrower literal. * * @typeParam T - The string-literal type to keep visible. * * @example * ```ts * // Accepts `'markdown'` (with autocomplete) or any other string: * type ViewTypeName = LiteralStringUnion<'markdown'>; * ``` * * @public * @unofficial */ export type LiteralStringUnion<T extends string> = (Record<never, never> & string) | T; /** * Union type representing a view that may be either fully loaded or a deferred placeholder. * * @typeParam TView - The type of the view. * @public * @unofficial */ export type MaybeDeferredView<TView extends View> = DeferredView | TView; /** * Node constructor. * * @public * @unofficial */ export type NodeConstructor<T> = ConstructorBase<[ ], T>; /** * Plugin callback function. * * @public * @unofficial */ export type PluginCallback = (data: unknown) => void; /** * Plugin registry. * * @public * @unofficial */ export type PluginRegistry = Record<string, unknown>; /** * A token stream: a string, a single token, or an array of strings and tokens. * * @public * @unofficial */ export type PrismTokenStream = Array<PrismToken | string> | PrismToken | string; /** * Callback function invoked during scrypt key derivation to report progress. * * @public * @unofficial */ export type ProgressCallback = (progress: number) => boolean | void; /** * Property widget type. * * @public * @unofficial */ export type PropertyWidgetType = "aliases" | "checkbox" | "date" | "datetime" | "multitext" | "number" | "tags" | "text" | string; /** * Plugin registration function. * * @public * @unofficial */ export type RegisterPlugin = <T>(pluginName: string, implementations?: Readonly<PluginImplementations>) => T; /** * Source for creating a sprite. * * @public * @unofficial */ export type SpriteSource = string | Texture; /** * A CSS style specification object where keys are CSS properties or nested selectors. * * @public * @unofficial */ export type StyleSpec = { [propOrSelector: string]: null | number | string | StyleSpec; }; /** * Text gradient type constants. * * @public * @unofficial */ export type TEXT_GRADIENT = number; /** * Translation function type for i18next. * * @public * @unofficial */ export type TFunction = (key: string | string[], options?: Record<string, unknown>) => string; /** * The direction of the text. * * @public * @unofficial */ export type TextDirection = "auto" | "ltr" | "rtl"; /** * Text alignment options. * * @public * @unofficial */ export type TextStyleAlign = "center" | "justify" | "left" | "right"; /** * Text fill style type. * * @public * @unofficial */ export type TextStyleFill = CanvasGradient | CanvasPattern | number | number[] | string | string[]; /** * Font style options. * * @public * @unofficial */ export type TextStyleFontStyle = "italic" | "normal" | "oblique"; /** * Font variant options. * * @public * @unofficial */ export type TextStyleFontVariant = "normal" | "small-caps"; /** * Font weight options. * * @public * @unofficial */ export type TextStyleFontWeight = "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | "bold" | "bolder" | "lighter" | "normal"; /** * Line join options. * * @public * @unofficial */ export type TextStyleLineJoin = "bevel" | "miter" | "round"; /** * Text baseline options. * * @public * @unofficial */ export type TextStyleTextBaseline = "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top"; /** * White space handling options. * * @public * @unofficial */ export type TextStyleWhiteSpace = "normal" | "pre-line" | "pre"; /** * A filter that matches HTML elements by tag name(s) or a custom function. * * @public * @unofficial */ export type TurndownServiceFilter = TurndownServiceFilterFunction | TurndownServiceTagName | TurndownServiceTagName[]; /** * Function that tests whether a node matches a filter. * * @public * @unofficial */ export type TurndownServiceFilterFunction = (node: HTMLElement, options: TurndownServiceOptions) => boolean; /** * Input node type accepted by TurndownService.turndown(). * * @public * @unofficial */ export type TurndownServiceNode = Document | DocumentFragment | HTMLElement; /** * A plugin function that extends TurndownService. * * @public * @unofficial */ export type TurndownServicePlugin = (service: TurndownService) => void; /** * Function that converts an HTML element's content to Markdown. * * @public * @unofficial */ export type TurndownServiceReplacementFunction = (content: string, node: HTMLElement, options: TurndownServiceOptions) => string; /** * Tag name filter. * * @public * @unofficial */ export type TurndownServiceTagName = string; /** * Factory function type that creates a typed view instance for a given workspace leaf. * * @typeParam TView - The type of the view. * @public * @unofficial */ export type TypedViewCreator<TView extends View> = (leaf: WorkspaceLeaf) => TView; /** * UIEvent constructor. * * @public * @unofficial */ export type UIEventConstructor<T> = ConstructorBase<unknown[], T>; /** * {@link obsidian#View} factory. * * @typeParam TView - The type of the view. * @public * @unofficial */ export type ViewFactory<TView extends View = View> = (containerEl: HTMLElement) => TView; /** * Internal mapping of view types to their typed view creator functions. * * @public * @unofficial */ export type ViewRegistryViewByTypeMapping = { [TViewType in ViewTypeType]: TypedViewCreator<ViewTypeViewMapping[TViewType]>; }; /** * Union type of all built-in view type string identifiers. * * @public * @unofficial */ export type ViewTypeType = (typeof ViewType)[keyof typeof ViewType]; /** * Mapping from view type identifiers to their corresponding view instance types. * * @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 { Capacitor as Capacitor, CapacitorPlatforms as CapacitorPlatforms, TurndownService as TurndownService, app as app, }; export {};