/** * Renders declarative setting definitions the way Obsidian 1.13 does. * * Mirrors the shipped renderer (Obsidian 1.13.x `app.js`), function for function: * * - `evaluatePredicate` — `z2`: absent yields the default, a non-function yields itself, a function is * called inside a `try`/`catch` that logs and falls back to the default. * - `isRenderable` — `Y2`: an item with nothing to show is dropped before rendering. * - `renderSettingDefinitions` — `Q2`: empties the container and wraps every run of loose rows in an * implicit headless group, so a row always lives inside a group. * - `renderGroup` / `renderRow` — `$2` / `Z2` / `n6`: the group owns a `SettingGroup`, each row a * `Setting` created in the group's `listEl`. * - `applyDomState` — `U2` / `_2`: rows are ALWAYS rendered; `visible` toggles the rendered element and * `disabled` is applied only when the definition declares it. * * Deliberately NOT modeled (a consumer that needs one of these gets a loud failure or a documented no-op, * never a silently wrong render): * * - `control` rows throw — neither the components nor the `getControlValue` / `setControlValue` binding * is modeled. * - Keyed reconciliation (`Wy` diffing): every render rebuilds from scratch. * - Group search inputs, and the `list` add / delete / reorder affordances — a `list` renders as a group. * - Page navigation: a `page` renders as its own row, and its `items` render only when passed in explicitly. */ import type { SettingDefinitionGroup as SettingDefinitionGroupOriginal, SettingDefinitionItem as SettingDefinitionItemOriginal, SettingGroupItem as SettingGroupItemOriginal } from 'obsidian'; import { Setting } from '../obsidian/Setting.cjs'; import { SettingGroup } from '../obsidian/SettingGroup.cjs'; export interface RenderedSettingGroup { children: RenderedSettingRow[]; definition: SettingDefinitionGroupOriginal; groupEl: HTMLElement; settingGroup: SettingGroup; } export interface RenderedSettingRow { cleanup: (() => void) | null; definition: SettingGroupItemOriginal; isVisible: boolean; setting: Setting; settingEl: HTMLElement; } /** * Re-evaluates every `visible` / `disabled` predicate and applies the result to the rendered DOM (`U2`). * * @param groups - The rendered groups. */ export declare function applyDomState(groups: RenderedSettingGroup[]): void; /** * Resolves a declarative predicate that may be a value, a function, or absent (`z2`). * * @param predicate - The predicate. * @param defaultValue - The value to use when the predicate is absent or throws. * @returns The resolved value. */ export declare function evaluatePredicate(predicate: (() => T) | T | undefined, defaultValue: T): T; /** * Renders the declarative setting definitions into the container and applies the initial DOM state, * exactly as Obsidian does when a settings tab is shown (`V2`). * * @param items - The setting definitions. * @param containerEl - The container to render into. * @returns The rendered groups. */ export declare function renderSettingDefinitions(items: SettingDefinitionItemOriginal[], containerEl: HTMLElement): RenderedSettingGroup[];