import { State } from "../state.js"; //#region src/field/get.d.ts declare namespace get { type Callback = (state: T, subject: State) => void | boolean | (() => void); } /** * Fetches upstream State from context with optional lifecycle callback. * Callback runs on mount and can return cleanup function for unmount. * * @param Type - Type of State to fetch. * @param callback - Optional lifecycle callback, receives (state, subject). Can return cleanup function. */ declare function get(Type: State.Extends, callback?: get.Callback): T; /** * Fetches and assigns the controller which spawned this host. * When parent assigns an instance via `use()` directive, it * will be made available to child upon this request. * * @param Type - Type of controller compatible with this class. * @param required - If false, property may be undefined. Otherwise will throw. */ declare function get(Type: State.Extends, required: false): T | undefined; /** * Collects downstream States, accumulating all instances of specified type * for which this is an ancestor. Returns an array that updates as States * are added or removed. Callback runs on each registration and can return * cleanup or false to prevent registration. * * @param Type - Type of State to collect. * @param downstream - Must be true to enable downstream mode. * @param callback - Optional lifecycle callback, receives (state, subject). May return false to prevent registration. */ declare function get(Type: State.Extends, downstream: true, callback?: get.Callback): T[]; /** * Fetches a single downstream State of specified type. * Updates when a matching child appears or is removed. * Throws if not found. * * @param Type - Type of State to fetch. * @param downstream - Must be true to enable downstream mode. * @param required - Throw if no match found. */ declare function get(Type: State.Extends, downstream: true, single: true): T; /** * Fetches a single downstream State of specified type. * Updates when a matching child appears or is removed. * Returns undefined if not found. * * @param Type - Type of State to fetch. * @param downstream - Must be true to enable downstream mode. * @param required - If false, returns undefined if no match found. */ declare function get(Type: State.Extends, downstream: true, required: false): T | undefined; //#endregion export { get }; //# sourceMappingURL=get.d.ts.map