/** * The override layer for leaves inside a property's value: a string, number * or boolean in an object, array or `Map` the property holds. The leaf is * written in the live container, as a plain nested edit is, but the value it * replaced is kept, so switching the override off writes it back. * * There is no accessor to hear the app on a container's slot, so the layer * checks instead. Switching off writes the original back only while the slot * still holds the override; anything else there is the app's, and stays. An * override whose container the app replaced (the property, or an object on * the way down, now holds another one) no longer applies: it is dropped, its * old container handed its original back, and the drop is noted for the * panel (`override-drops.ts`). * * Shares the global switch with `prop-overrides.ts`: {@link reapplyLeaves} * follows it. */ import type { ValueSegment } from '../../../types/inspector.js'; type Leaf = string | number | boolean; /** One leaf override, for the panel's list. */ export interface LeafOverrideRecord { el: Element; name: string; keys: ValueSegment[]; value: Leaf; enabled: boolean; persist: boolean; } /** A leaf override as an expanded level describes it. */ export interface LeafOverrideState { value: Leaf; enabled: boolean; persist: boolean; /** The value the leaf holds, or would hold, without the override. */ intrinsic: unknown; } /** * Override the leaf at `keys` below property `name` with `value`, switched * on, and ask for a render. False when the path does not end in a slot that * takes a value of that type (see `writeInto`). */ export declare const setLeafOverride: (el: Element, name: string, keys: ValueSegment[], value: Leaf) => boolean; /** Turn a leaf override on or off, leaving it in the layer. */ export declare const toggleLeafOverride: (el: Element, name: string, keys: ValueSegment[], enabled: boolean) => boolean; /** Drop a leaf override, writing the original back if the slot still holds it. */ export declare const removeLeafOverride: (el: Element, name: string, keys: ValueSegment[]) => boolean; /** The override on the leaf at `keys` below `name`, if there is one. */ export declare const leafOverrideOf: (el: Element, name: string, keys: ValueSegment[]) => LeafOverrideState | undefined; /** Every leaf override in the page, after dropping those that went stale. */ export declare const listLeafOverrides: () => LeafOverrideRecord[]; /** Mark an existing leaf override to be kept across reloads, or not. */ export declare const persistLeafOverride: (el: Element, name: string, keys: ValueSegment[], persist: boolean) => boolean; /** Follow the global switch: write or withdraw every leaf override. */ export declare const reapplyLeaves: () => void; /** Remove every leaf override in the page. */ export declare const clearLeafOverrides: () => void; /** Whether `el` had leaf overrides that went stale, now dropped. */ export declare const sweepLeaves: (el: Element) => boolean; export {}; //# sourceMappingURL=leaf-overrides.d.ts.map