/** * Smallest shared contract for any form-associated custom element. * * Keep this intentionally tiny and platform-aligned. QTI-specific concerns * such as response identifiers, readonly handling, and validation * should be layered via separate capability interfaces below. */ interface FormAssociatedInteraction extends HTMLElement { disabled: boolean; readonly internals: ElementInternals; formResetCallback(): void; } /** QTI response identity capability. */ interface ResponseIdentifiedInteraction { responseIdentifier: string; } /** Optional readonly capability used by many QTI interactions. */ interface ReadonlyInteraction { readonly: boolean; } /** Optional reset capability beyond the platform form reset callback. */ interface ResettableInteraction { reset(): void; } /** Interaction that publishes and stores a response value. */ interface ResponseInteractionElement extends FormAssociatedInteraction { responseIdentifier: string; response: string | string[] | null; saveResponse(value: string | string[], state?: string | null): void; } /** Interaction that participates in validity reporting. */ interface ValidatableInteraction extends FormAssociatedInteraction { validate(): boolean; reportValidity(): boolean; } /** * Common contract expected by item containers when tracking registered interactions. */ interface RegisteredInteraction extends ResponseInteractionElement, ValidatableInteraction, ReadonlyInteraction, ResettableInteraction { } /** * @deprecated Prefer `RegisteredInteraction` for new code. */ type IInteraction = RegisteredInteraction; export type { FormAssociatedInteraction as F, IInteraction as I, ReadonlyInteraction as R, ValidatableInteraction as V, RegisteredInteraction as a, ResettableInteraction as b, ResponseIdentifiedInteraction as c, ResponseInteractionElement as d };