import { Actions, Context as ContextHandle, Model, Props } from '../types/index.js'; /** * Returns a stable, typed controller handle up-front — before a * model is declared via `context.useActions(...)`. Use this when an * external imperative library (form, animation, third-party SDK) needs a * dispatch callback at construction time, while the value that library * returns must flow back into the controller's data callback. * * The handle exposes `dispatch(action, payload?)`, a `useActions(...)` * method that materialises the component-local model and reactive data * — the M and D pair of `useContext` — and * returns the `[model, actions, data]` tuple with `useAction`, `dispatch`, * `inspect`, and `stream` attached, plus `with` — a bag of handler * factories (`update`/`invert`/`always`) typed against the declared model * and accepting lodash-style dotted paths and array indices. The first * invocation of `context.actions.dispatch(...)` must come from an event * handler — not synchronously during render — because the * underlying dispatch target is wired up when `context.useActions(...)` * runs in the same render pass. * * @template M The model type representing the component's state. * @template AC The actions class containing action definitions. * @template D The data type for reactive external values. * * @example * ```ts * const context = useContext(); * * const form = useForm({ * onSubmit: () => void context.actions.dispatch(Actions.Submit), * }); * * const actions = context.useActions( * { user: resource.user.get() }, * () => ({ form }), * ); * ``` * * @internal */ export declare function useContext(): ContextHandle;