/** * Opt-in shim for a downstream consumer's own Vitest+happy-dom test suite -- NOT used by this * package's own tests (which run against real browsers via `@web/test-runner`, where * `ElementInternals` already exists natively). happy-dom has no `ElementInternals` * implementation at all, and every form-associated `lr-*` component (`lr-switch`, * `lr-combobox`, `lr-select`, `lr-checkbox`, `lr-model-select`, `lr-time-range`, * `lr-tool-param-form`, plus anything built on the shared `FormAssociated` mixin) calls * `this.attachInternals()` unconditionally in its constructor, so instantiating any of them * under happy-dom throws immediately without this. The stub also implements `setValidity()` * as a no-op -- `AnchoredValidityController` (the shared validity-refresh controller every * form-associated component uses) calls `internals.setValidity()` on every update, which would * otherwise throw the moment any of those components' `value` changes, not just at construction. * `states` is a real `Set` -- several controls (e.g. `lr-input`) call * `internals.states.add('blank')`/`.delete('blank')` on every update to drive a custom-state * pseudo-class, which would otherwise throw on `add` of `undefined`. * * `attachInternals()` is specified on the `HTMLElement` interface (not `Element`), and every * `lr-*` component is an `HTMLElement` subclass (via `LitElement`), so this patches * `HTMLElement.prototype.attachInternals` -- the exact lookup `this.attachInternals()` resolves * through. * * Call `installHappyDomFormAssociatedShims()` once, in a Vitest `setupFiles` entry, before * importing any `lyra-ui` component. It is a no-op wherever `attachInternals` already exists * (any real browser, or an environment that already supports it) or where `HTMLElement` isn't * even a global (a plain Node test environment with no DOM at all) -- safe to call * unconditionally from a shared setup file used across multiple test environments/projects, * including ones that mix DOM and non-DOM test files under one `setupFiles` entry. */ interface StubValidityState{valid:boolean;}interface StubElementInternals{form:HTMLFormElement|null;labels:NodeList;states:Set;validity:StubValidityState;validationMessage:string;willValidate:boolean;setFormValue(value:string|File|FormData|null,state?:string|FormData|null):void;checkValidity():boolean;reportValidity():boolean;setValidity(flags?:Partial,message?:string,anchor?:HTMLElement):void;}export declare function installHappyDomFormAssociatedShims():void; /** Test-only: returns a fresh stub `ElementInternals`-shaped object, independent of whether * `attachInternals` already exists natively -- exists purely so this module's own test can * verify the stub's call-shape coverage without needing to run under happy-dom itself. */ export declare function installStubInternalsForTest(host:Element):StubElementInternals;export{};