import { InjectionKey } from 'vue';
import { FormEngine } from './form/formEngine';

export declare const FormContextKey: InjectionKey<FormEngine>;
/**
 * Resolve the parent Form's engine, CE-safely. Returns null when the FormItem is
 * used standalone (no parent Form) — callers must treat that as "no validation"
 * so standalone FormItem behaviour is unchanged (backward compatible).
 *
 *  1. SFC / plain-Vue: `inject(FormContextKey)` — authoritative when present.
 *  2. defineCustomElement: read `getCurrentInstance().ce` (the host, exactly what
 *     Vue's useHost() reads) → `host.closest('tvu-form')` → parent host's
 *     `_tvuFormEngine`. `.ce` is read directly (not via useHost()) to avoid the
 *     dev warning useHost() emits in every plain-Vue consumer (see useHasSlot.ts).
 *     [Stage 0 spike validated: closest + host property + subscribe cross the CE
 *     boundary in a real browser.]
 */
export declare function useFormEngine(): FormEngine | null;
/**
 * Resolve the parent Form's engine from a custom-element host via
 * `closest('tvu-form')`. Split out so a child can RETRY discovery in `onMounted`:
 * under `defineCustomElement` the parent Form's `setup` (which sets
 * `host._tvuFormEngine`) is NOT guaranteed to have run by the time the CHILD's
 * `setup` runs, so a setup-time read can miss the engine. By `onMounted` the
 * parent host property is reliably set (Stage 0 spike read it in onMounted). Pass
 * `getCurrentInstance().ce` (captured in setup) as `ce`.
 */
export declare function resolveHostFormEngine(ce: HTMLElement | null | undefined): FormEngine | null;
