import { ReactiveController, ReactiveControllerHost } from "lit"; import { Seconds } from "../../models/unitConverters"; import { ReadonlySignal } from "@lit-labs/preact-signals"; export declare const enum LoadingState { /** There is no loading in progress */ Idle = 0, /** * Items are being loaded, but the time spent loading has not met the * "slow loading" threshold, meaning that a loading indicator should not be * shown. */ FastLoading = 1, /** * Items are being loaded, and the time spent loading has exceeded the * "slow loading" threshold, meaning that a loading indicator should be * shown. */ SlowLoading = 2, /** * The time spent loading has exceeded the maximum allowed duration, and * we should show a timeout error. */ Timeout = 3 } export interface LoadingControllerOptions { slowLoadThreshold: Seconds; timeoutThreshold: Seconds; } interface LoadingControllerHost extends ReactiveControllerHost { } export declare class LoadingController implements ReactiveController { private static readonly defaultOptions; private readonly state; private options; private timeout; constructor(host: LoadingControllerHost, options?: LoadingControllerOptions); get loadState(): ReadonlySignal; hostConnected(): void; updateOptions(newOptions: Partial): void; /** * @description * This method will not immediately enter a "loading" state, but will start a * timer for a short period of time (defined by the `slowLoadThreshold`) * before entering the loading state. */ start(): void; /** * Stop loading and enter the {@linkcode LoadingState.Idle} state. */ stop(): void; private enterIdle; private clearTimeouts; private enterFastLoad; private enterSlowLoad; private enterTimeout; } export {};