import { __isKnytReference, OBSERVABLE_PROPERTY_NAME, type Observable, type ObservableInterop, type Reference, type Subscription } from "@knyt/artisan"; import type { EventHandler } from "@knyt/weaver"; import type { ReactiveController, ReactiveControllerHost } from "./ReactiveController.ts"; type InputStateOptions = { /** * A reference serving as the source of truth for the input state. * * @remarks * * This reference should be updated in response to the `observe` subscriber * is notified of a new value. */ origin: Reference.Readonly; /** * A subscriber that is notified of new values when the input state changes. */ subscriber: Observable.Subscriber | Reference.Readonly | undefined>; /** * A function that parses a string value from an input element * to a value compatible with the `value` reference. */ parse: (value: string) => T; /** * A function that serializes a value to a string * that can be used as the value of an input element. */ serialize: (value: T) => string; }; /** * A controller that manages the state of an input element. * * @alpha This is an experimental API and will change in the future. */ export declare class InputStateController implements ReactiveController, Reference { #private; readonly inputValue$: Reference.Readonly; constructor(host: ReactiveControllerHost, options: InputStateOptions); get value(): T; set value(nextValue: T); get inputValue(): string; subscribe(input: Observable.Subscriber): Subscription; get(): T; asReadonly(): Reference.Readonly; /** * Set the value of the input state. * * @remarks * * 1. Updates the origin reference * 2. Updates the input value state * 3. Notifies the observe subscriber of the new value */ set(nextValue: T): void; next(nextValue: T): void; /** * A handler that updates the input state when the element value changes. */ readonly handleChange: EventHandler.Change; /** * A handler that updates the input state when the end user * interacts with the input element. */ readonly handleInput: EventHandler.Input; hostConnected?: () => void; get [__isKnytReference](): true; asInterop(): ObservableInterop; [Symbol.observable](): ObservableInterop; [OBSERVABLE_PROPERTY_NAME](): ObservableInterop; } export declare namespace InputStateController { type Options = InputStateOptions; } export {}; //# sourceMappingURL=InputStateController.d.ts.map