import { MaybeRefOrGetter, Ref, ShallowRef } from "vue"; //#region src/composables/useImage/index.d.ts type ImageStatus = 'idle' | 'loading' | 'loaded' | 'error'; interface UseImageOptions { /** * Image source URL. Changes trigger a reload. */ src: MaybeRefOrGetter; /** * Whether the image should load. When `false`, status stays `idle` and * `source` resolves to `undefined` so the browser does not start loading. * @default true */ eager?: MaybeRefOrGetter; } interface UseImageReturn { /** * Current loading state. */ readonly status: Readonly>; /** * Whether the image has not yet started loading (eager is false). */ readonly isIdle: Readonly>; /** * Whether the image is currently loading. */ readonly isLoading: Readonly>; /** * Whether the image has loaded successfully. */ readonly isLoaded: Readonly>; /** * Whether the image failed to load. */ readonly isError: Readonly>; /** * Gated source URL. Resolves to `undefined` while idle, otherwise the * current `src` value. Bind directly to the `` `src` attribute. */ readonly source: Readonly>; /** * Bind to the `` `load` event. */ onLoad: (e?: Event) => void; /** * Bind to the `` `error` event. */ onError: (e?: Event) => void; /** * Reset status back to `loading` so the browser re-attempts the source. */ retry: () => void; } /** * Tracks image loading state as a reactive state machine. * * @param options Configuration options * @returns Image context with state refs and event handlers * * @see https://0.vuetifyjs.com/composables/system/use-image * * @example * ```ts * import { toRef } from 'vue' * import { useImage } from '@vuetify/v0' * * const props = defineProps<{ src: string }>() * * const { source, isLoaded, onLoad, onError, retry } = useImage({ * src: toRef(() => props.src), * }) * ``` * * @example * Composed with `useIntersectionObserver` for lazy loading: * ```ts * const target = shallowRef() * const { isIntersecting } = useIntersectionObserver(target, () => {}, { * once: true, * rootMargin: '200px', * }) * * const { source, onLoad, onError } = useImage({ * src: toRef(() => props.src), * eager: isIntersecting, * }) * ``` */ declare function useImage(options: UseImageOptions): UseImageReturn; //#endregion export { ImageStatus, UseImageOptions, UseImageReturn, useImage };