/** * @file * * Mock of Obsidian's `WorkspaceParent`, the abstract base of workspace items that contain other items. */ import type { WorkspaceParent as WorkspaceParentOriginal } from 'obsidian'; import type { SerializedWorkspaceItem } from '../internal/types.mjs'; import type { Workspace } from './Workspace.mjs'; import { WorkspaceItem } from './WorkspaceItem.mjs'; /** * Mock of Obsidian's `WorkspaceParent`, the base of splits, tabs, drawers and the other container nodes of the * layout tree. * * The children are tracked in memory and adopted and released the way Obsidian does it. Nothing is rendered, and child * dimensions are not kept. */ export declare abstract class WorkspaceParent extends WorkspaceItem { /** * Whether the parent may keep a single child. When it may not, removing its second-to-last child replaces it in its * own parent with the child that is left. `false` by default, as for a plain split. */ allowSingleChild: boolean; /** * The child items, in layout order. */ children: WorkspaceItem[]; /** * Creates a parent item. * * @param workspace - The workspace the item belongs to. * @param id - The item id. */ protected constructor(workspace?: Workspace, id?: string); /** * Mock-only: views a value typed as Obsidian's `WorkspaceParent` as this mock. The numbered subclass variant of * `fromOriginalType__`. * * @param value - The value typed as the original `WorkspaceParent`. * @returns The same object, typed as the mock. */ static fromOriginalType3__(value: WorkspaceParentOriginal): WorkspaceParent; /** * Mock-only: views this mock as Obsidian's `WorkspaceParent` type. The numbered subclass variant of * `asOriginalType__`. * * @returns The same object, typed as the original `WorkspaceParent`. */ asOriginalType3__(): WorkspaceParentOriginal; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(WorkspaceParent.prototype, 'constructor3__')`. * * @param _workspace - The workspace the item was created with. * @param _id - The item id the item was created with. */ constructor3__(_workspace?: Workspace, _id?: string): void; /** * Inserts a child at an index and makes this item its parent. * * @param index - The position to insert at; a negative or out-of-range index appends. * @param child - The child to insert. */ insertChild(index: number, child: WorkspaceItem): void; /** * Re-derives the children's shares from their dimensions. A no-op here, as in Obsidian: only a split has shares to * recompute. */ recomputeChildrenDimensions(): void; /** * Removes a child and leaves it without a parent. As in Obsidian, a parent left empty then removes itself from its * own parent, and one left with a single child it may not keep is replaced there by that child, inheriting the * dimension the parent had. * * @param child - The child to remove. */ removeChild(child: WorkspaceItem): void; /** * Replaces the child at an index, leaving the old child without a parent and making this item the new child's * parent. * * @param index - The position of the child to replace; it is clamped to the children's range. * @param child - The new child. */ replaceChild(index: number, child: WorkspaceItem): void; /** * Serializes the parent, as Obsidian does: the item's own keys and each child's serialized form, in order. * * @returns The serialized parent. */ serialize(): SerializedWorkspaceItem; private onLayoutChange; }