/** * @file * * Mock of Obsidian's `WorkspaceSidedock`, the collapsible left or right sidebar split. */ import type { SplitDirection as SplitDirectionOriginal, WorkspaceSidedock as WorkspaceSidedockOriginal } from 'obsidian'; import type { SerializedWorkspaceItem } from '../internal/types.mjs'; import type { Workspace } from './Workspace.mjs'; import { WorkspaceSplit } from './WorkspaceSplit.mjs'; /** * Mock of Obsidian's `WorkspaceSidedock`. Nothing is resized on screen: expanding and collapsing only update * {@link WorkspaceSidedock.collapsed}. */ export declare class WorkspaceSidedock extends WorkspaceSplit { /** * Whether the sidebar is collapsed. Starts `false` in the mock. */ collapsed: boolean; /** * Which side the sidedock is on, `left` or `right`, as given at construction. */ side: string; /** * The sidedock's width in pixels; Obsidian starts every sidedock at 300. The mock renders nothing, so it only keeps * the value, which {@link WorkspaceSidedock.serialize} records as `width`. */ size: number; /** * Creates a sidebar split. Obsidian does not construct it publicly; use {@link WorkspaceSidedock.create3__}. * * @param workspace - The workspace the sidebar belongs to. * @param direction - The split direction. * @param side - The side of the window the sidebar is on. * @param id - The item id. */ protected constructor(workspace: Workspace, direction: SplitDirectionOriginal, side: string, id?: string); /** * Mock-only factory: creates a sidebar split, spyable via `vi.spyOn(WorkspaceSidedock, 'create3__')`. The * numbered subclass variant of `create__`. * * @param workspace - The workspace the sidebar belongs to. * @param direction - The split direction. * @param side - The side of the window the sidebar is on. * @param id - The item id. * @returns The new sidebar split. */ static create3__(workspace: Workspace, direction: SplitDirectionOriginal, side: string, id?: string): WorkspaceSidedock; /** * Mock-only: views a value typed as Obsidian's `WorkspaceSidedock` as this mock. The numbered subclass variant of * `fromOriginalType__`. * * @param value - The value typed as the original `WorkspaceSidedock`. * @returns The same object, typed as the mock. */ static fromOriginalType5__(value: WorkspaceSidedockOriginal): WorkspaceSidedock; /** * Mock-only: views this mock as Obsidian's `WorkspaceSidedock` type. The numbered subclass variant of * `asOriginalType__`. * * @returns The same object, typed as the original `WorkspaceSidedock`. */ asOriginalType5__(): WorkspaceSidedockOriginal; /** * Collapses the sidebar. The mock sets {@link WorkspaceSidedock.collapsed} to `true`. */ collapse(): void; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(WorkspaceSidedock.prototype, 'constructor5__')`. * * @param _workspace - The workspace the sidebar was created with. * @param _direction - The split direction the sidebar was created with. * @param _side - The side the sidebar was created with. * @param _id - The item id the sidebar was created with. */ constructor5__(_workspace: Workspace, _direction: SplitDirectionOriginal, _side: string, _id?: string): void; /** * Expands the sidebar. The mock sets {@link WorkspaceSidedock.collapsed} to `false`. */ expand(): void; /** * Serializes the sidedock, as Obsidian does: the split's keys, its width, and `collapsed` when it is collapsed. * * @returns The serialized sidedock. */ serialize(): SerializedWorkspaceItem; /** * Sets the sidedock's width. Obsidian also writes it to the element's style; the mock only keeps the value. * * @param size - The width in pixels. */ setSize(size: number): void; /** * Flips the sidebar between collapsed and expanded. */ toggle(): void; }