/** * ONE `ResizeObserver` and ONE `MutationObserver` for every scrolling box in the * document, rather than a pair per mount. Handlers register per target; the * shared observers observe an element the first time anyone asks and drop it once * nobody wants it. */ /** * The handlers waiting on each observed element. A SET, not a single handler: * one element can be both a box and another box's child — a `
` inside a
 * `ScrollRegion` is exactly that — and both owners must still hear its resize.
 */
type ResizeHandler = () => void;
/**
 * Registers `handler` for `target`'s resizes, observing the element only the
 * first time anyone asks for it: re-observing an element already under a
 * `ResizeObserver` re-arms its initial notification, which spends a forced
 * layout on a measurement nobody asked for.
 */
export declare function holdResizeTarget(target: Element, handler: ResizeHandler): void;
/** Stops observing `target` for `handler`, and entirely once nobody wants it. */
export declare function releaseResizeTarget(target: Element, handler: ResizeHandler): void;
type ContentHandler = () => void;
export declare function holdContentTarget(target: Element, handler: ContentHandler): void;
/**
 * Stops watching `target`'s content for `handler`.
 *
 * `MutationObserver` has no `unobserve`: the only way to drop one registration
 * is to disconnect the observer and re-observe everything else, which would cost
 * one registration per surviving box every time a box unmounts. A released box
 * is therefore dropped from the handler map at once — its records find no
 * handler and are ignored — and the observer is rebuilt only once the dead
 * registrations outnumber the live ones, which keeps the total registration work
 * proportional to the number of mounts. Records already queued survive the
 * rebuild: they are taken off the observer and delivered by hand.
 */
export declare function releaseContentTarget(target: Element, handler: ContentHandler): void;
export {};
//# sourceMappingURL=observer-registry.d.ts.map