All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.index.d.ts Maven / Gradle / Ivy

The newest version!
import * as _zag_js_anatomy from '@zag-js/anatomy';
import { RequiredBy, PropTypes, CommonProperties, DirectionProperty, NormalizeProps } from '@zag-js/types';
import * as _zag_js_core from '@zag-js/core';
import { Machine, StateMachine } from '@zag-js/core';

declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "image" | "fallback">;

type LoadStatus = "error" | "loaded";
interface StatusChangeDetails {
    status: LoadStatus;
}
type ElementIds = Partial<{
    root: string;
    image: string;
    fallback: string;
}>;
interface PublicContext extends CommonProperties, DirectionProperty {
    /**
     * Functional called when the image loading status changes.
     */
    onStatusChange?: ((details: StatusChangeDetails) => void) | undefined;
    /**
     * The ids of the elements in the avatar. Useful for composition.
     */
    ids?: ElementIds | undefined;
}
interface PrivateContext {
}
type ComputedContext = Readonly<{}>;
type UserDefinedContext = RequiredBy;
interface MachineContext extends PublicContext, PrivateContext, ComputedContext {
}
interface MachineState {
    value: "loading" | "error" | "loaded";
}
type State = StateMachine.State;
type Send = StateMachine.Send;
type Service = Machine;
interface MachineApi {
    /**
     * Whether the image is loaded.
     */
    loaded: boolean;
    /**
     * Function to set new src.
     */
    setSrc(src: string): void;
    /**
     * Function to set loaded state.
     */
    setLoaded(): void;
    /**
     * Function to set error state.
     */
    setError(): void;
    getRootProps(): T["element"];
    getImageProps(): T["img"];
    getFallbackProps(): T["element"];
}

declare function connect(state: State, send: Send, normalize: NormalizeProps): MachineApi;

declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine;

declare const props: ("dir" | "id" | "getRootNode" | "onStatusChange" | "ids")[];
declare const splitProps: >(props: Props) => [Partial, Omit];

export { type MachineApi as Api, type UserDefinedContext as Context, type ElementIds, type LoadStatus, type Service, type StatusChangeDetails, anatomy, connect, machine, props, splitProps };




© 2015 - 2025 Weber Informatics LLC | Privacy Policy