CancelledSwipe
export type CancelledSwipe = typeof Message.CancelledSwipe.Type;Effect-native UI toolkit
Interactive demosPublished API · 0.1.0-rc.1
Published foldkit-ui API declarations for toast.
@wsagency/wseffect-foldkit-ui · MIT · source · MIT license · WS-AGENCY-NOTICE · THIRD-PARTY-NOTICES
This entry point is published in @wsagency/wseffect-foldkit-ui@0.1.0-rc.1. Import it from the package subpath shown below; the signatures and documentation are read from the installed package declarations.
import * as Wseffect from '@wsagency/wseffect-foldkit-ui/toast'CancelledSwipeexport type CancelledSwipe = typeof Message.CancelledSwipe.Type;CompletedWaitBeforeDismissalexport type CompletedWaitBeforeDismissal = typeof Message.CompletedWaitBeforeDismissal.Type;CompletedWaitForSwipeSettledexport type CompletedWaitForSwipeSettled = typeof Message.CompletedWaitForSwipeSettled.Type;DEFAULT_SWIPE_DIRECTIONDefault direction in which a pointer can dismiss a Toast.
DEFAULT_SWIPE_DIRECTION: SwipeDirectionDEFAULT_SWIPE_THRESHOLDDefault distance in pixels a pointer must travel to dismiss a Toast.
DEFAULT_SWIPE_THRESHOLD = 40Dismissedexport type Dismissed = typeof Message.Dismissed.Type;DismissedAllexport type DismissedAll = typeof Message.DismissedAll.Type;DrainEntryInputexport type DrainEntryInput = Readonly<{
entryId: string;
version?: number;
}>;EntryHandlersHandlers passed to `entryToView`. Spread `dismiss` onto a close button's attributes to dispatch `Dismissed` for this entry.
export type EntryHandlers = Readonly<{
dismiss: ReadonlyArray<ChildAttribute>;
}>;GotAnimationMessageexport type GotAnimationMessage = typeof Message.GotAnimationMessage.Type;HoveredEntryexport type HoveredEntry = typeof Message.HoveredEntry.Type;InitConfigConfiguration for creating a toast container model. `defaultDuration` is applied to any `show()` call that doesn't provide its own `duration` or pass `sticky: true`. Accepts any Effect Duration input; a bare number is interpreted as milliseconds.
export type InitConfig = Readonly<{
id: string;
defaultDuration?: Duration.Input;
swipeToDismiss?: SwipeToDismissConfig;
}>;LeftEntryexport type LeftEntry = typeof Message.LeftEntry.Type;makeFactory that binds `Toast` to a user-provided payload schema. The returned module contains everything needed to wire a toast stack into an app: `Model`, `Message`, `Entry`, `Added`, `init`, `update`, `show` / `dismiss` / `dismissAll` helpers, and the headless `view`. The payload is whatever content shape the consumer supplies via Schema. The component never reads it. It flows through to `entryToView`. The component owns the entry's lifecycle, accessibility role, dismiss timer, hover state, and swipe state. Consume the bound module's exports everywhere. `Toast.Model` in your app Model, `Toast.Message` in your parent Message union, `Toast.show` / `Toast.dismiss` in your update, `Toast.view` in your view. The top-level exports provide payload-independent Schemas, constants, and Commands. Use the bound module for the payload-specific Model, Message, helpers, and view.
make: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
readonly Entry: Schema.Struct<{
readonly id: Schema.String;
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
readonly animation: Schema.Struct<{
readonly id: Schema.String;
readonly isShowing: Schema.Boolean;
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
readonly transitionGeneration: Schema.Number;
}>;
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
readonly pendingDismissVersion: Schema.Number;
readonly isHovered: Schema.Boolean;
readonly swipeState: import("@wsagency/wseffect-foldkit/schema").TaggedUnion<{
readonly Idle: {};
readonly Dragging: {
pointerId: Schema.Number;
startX: Schema.Number;
currentX: Schema.Number;
};
readonly Settling: {
offsetX: Schema.Number;
};
readonly Dismissing: {
offsetX: Schema.Number;
direction: Schema.Literals<readonly ["Left", "Right"]>;
};
}>;
readonly swipeVersion: Schema.Number;
readonly payload: Schema.Codec<A, I, never, never>;
}>;
readonly Model: Schema.Struct<{
readonly id: Schema.String;
readonly defaultDuration: Schema.DurationFromMillis;
readonly entries: Schema.$Array<Schema.Struct<{
readonly id: Schema.String;
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
readonly animation: Schema.Struct<{
readonly id: Schema.String;
readonly isShowing: Schema.Boolean;
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
readonly transitionGeneration: Schema.Number;
}>;
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
readonly pendingDismissVersion: Schema.Number;
readonly isHovered: Schema.Boolean;
readonly swipeState: import("@wsagency/wseffect-foldkit/schema").TaggedUnion<{
readonly Idle: {};
readonly Dragging: {
pointerId: Schema.Number;
startX: Schema.Number;
currentX: Schema.Number;
};
readonly Settling: {
offsetX: Schema.Number;
};
readonly Dismissing: {
offsetX: Schema.Number;
direction: Schema.Literals<readonly ["Left", "Right"]>;
};
}>;
readonly swipeVersion: Schema.Number;
readonly payload: Schema.Codec<A, I, never, never>;
}>>;
readonly nextEntryKey: Schema.Number;
readonly maybeSwipeConfig: Schema.Option<Schema.Struct<{
readonly direction: Schema.Literals<readonly ["Left", "Right"]>;
readonly threshold: Schema.Number;
}>>;
}>;
readonly Message: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
readonly Added: {
readonly entry: Schema.Struct<{
readonly id: Schema.String;
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
readonly animation: Schema.Struct<{
readonly id: Schema.String;
readonly isShowing: Schema.Boolean;
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
readonly transitionGeneration: Schema.Number;
}>;
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
readonly pendingDismissVersion: Schema.Number;
readonly isHovered: Schema.Boolean;
readonly swipeState: import("@wsagency/wseffect-foldkit/schema").TaggedUnion<{
readonly Idle: {};
readonly Dragging: {
pointerId: Schema.Number;
startX: Schema.Number;
currentX: Schema.Number;
};
readonly Settling: {
offsetX: Schema.Number;
};
readonly Dismissing: {
offsetX: Schema.Number;
direction: Schema.Literals<readonly ["Left", "Right"]>;
};
}>;
readonly swipeVersion: Schema.Number;
readonly payload: Schema.Codec<A, I, never, never>;
}>;
};
readonly Dismissed: {
entryId: Schema.String;
};
readonly DismissedAll: {};
readonly CompletedWaitBeforeDismissal: {
entryId: Schema.String;
version: Schema.Number;
};
readonly HoveredEntry: {
entryId: Schema.String;
};
readonly LeftEntry: {
entryId: Schema.String;
};
readonly GotAnimationMessage: {
entryId: Schema.String;
message: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
readonly Showed: {};
readonly Hid: {};
readonly CompletedWaitForPaint: {
generation: Schema.Number;
};
readonly EndedAnimation: {
generation: Schema.Number;
};
}>;
};
readonly PressedEntryPointer: {
entryId: Schema.String;
pointerId: Schema.Number;
clientX: Schema.Number;
};
readonly MovedSwipePointer: {
pointerId: Schema.Number;
clientX: Schema.Number;
};
readonly ReleasedSwipePointer: {
pointerId: Schema.Number;
clientX: Schema.Number;
};
readonly CancelledSwipe: {
pointerId: Schema.Number;
};
readonly PressedEscape: {};
readonly CompletedWaitForSwipeSettled: {
entryId: Schema.String;
version: Schema.Number;
};
}>;
readonly OutMessage: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
readonly DismissedToast: {
readonly payload: Schema.Codec<A, I, never, never>;
};
}>;
readonly Added: import("@wsagency/wseffect-foldkit/schema").CallableTaggedStruct<"Added", {
readonly entry: Schema.Struct<{
readonly id: Schema.String;
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
readonly animation: Schema.Struct<{
readonly id: Schema.String;
readonly isShowing: Schema.Boolean;
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
readonly transitionGeneration: Schema.Number;
}>;
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
readonly pendingDismissVersion: Schema.Number;
readonly isHovered: Schema.Boolean;
readonly swipeState: import("@wsagency/wseffect-foldkit/schema").TaggedUnion<{
readonly Idle: {};
readonly Dragging: {
pointerId: Schema.Number;
startX: Schema.Number;
currentX: Schema.Number;
};
readonly Settling: {
offsetX: Schema.Number;
};
readonly Dismissing: {
offsetX: Schema.Number;
direction: Schema.Literals<readonly ["Left", "Right"]>;
};
}>;
readonly swipeVersion: Schema.Number;
readonly payload: Schema.Codec<A, I, never, never>;
}>;
}>;
readonly DismissedToast: import("@wsagency/wseffect-foldkit/schema").CallableTaggedStruct<"DismissedToast", {
readonly payload: Schema.Codec<A, I, never, never>;
}>;
readonly init: (config: Readonly<{
id: string;
defaultDuration?: import("effect/Duration").Input;
swipeToDismiss?: import("./schema.js").SwipeToDismissConfig;
}>) => {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
};
readonly update: (model: {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
}, message: {
readonly _tag: "Added";
readonly entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
};
} | {
readonly _tag: "CancelledSwipe";
readonly pointerId: number;
} | {
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "Dismissed";
readonly entryId: string;
} | {
readonly _tag: "GotAnimationMessage";
readonly entryId: string;
readonly message: {
readonly _tag: "CompletedWaitForPaint";
readonly generation: number;
} | {
readonly _tag: "EndedAnimation";
readonly generation: number;
} | {
readonly _tag: "Hid";
} | {
readonly _tag: "Showed";
};
} | {
readonly _tag: "HoveredEntry";
readonly entryId: string;
} | {
readonly _tag: "LeftEntry";
readonly entryId: string;
} | {
readonly _tag: "MovedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEntryPointer";
readonly entryId: string;
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "ReleasedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "DismissedAll";
} | {
readonly _tag: "PressedEscape";
}) => Readonly<{
model: {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
};
commands?: import("@wsagency/wseffect-foldkit/update").Commands<{
readonly _tag: "Added";
readonly entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
};
} | {
readonly _tag: "CancelledSwipe";
readonly pointerId: number;
} | {
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "Dismissed";
readonly entryId: string;
} | {
readonly _tag: "GotAnimationMessage";
readonly entryId: string;
readonly message: {
readonly _tag: "CompletedWaitForPaint";
readonly generation: number;
} | {
readonly _tag: "EndedAnimation";
readonly generation: number;
} | {
readonly _tag: "Hid";
} | {
readonly _tag: "Showed";
};
} | {
readonly _tag: "HoveredEntry";
readonly entryId: string;
} | {
readonly _tag: "LeftEntry";
readonly entryId: string;
} | {
readonly _tag: "MovedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEntryPointer";
readonly entryId: string;
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "ReleasedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "DismissedAll";
} | {
readonly _tag: "PressedEscape";
}, never>;
outMessage?: {
readonly _tag: "DismissedToast";
readonly payload: A;
};
}>;
readonly show: (model: {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
}, input: Readonly<{
payload: A;
variant?: Variant;
duration?: import("effect/Duration").Input;
sticky?: boolean;
}>) => Readonly<{
model: {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
};
commands?: import("@wsagency/wseffect-foldkit/update").Commands<{
readonly _tag: "Added";
readonly entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
};
} | {
readonly _tag: "CancelledSwipe";
readonly pointerId: number;
} | {
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "Dismissed";
readonly entryId: string;
} | {
readonly _tag: "GotAnimationMessage";
readonly entryId: string;
readonly message: {
readonly _tag: "CompletedWaitForPaint";
readonly generation: number;
} | {
readonly _tag: "EndedAnimation";
readonly generation: number;
} | {
readonly _tag: "Hid";
} | {
readonly _tag: "Showed";
};
} | {
readonly _tag: "HoveredEntry";
readonly entryId: string;
} | {
readonly _tag: "LeftEntry";
readonly entryId: string;
} | {
readonly _tag: "MovedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEntryPointer";
readonly entryId: string;
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "ReleasedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "DismissedAll";
} | {
readonly _tag: "PressedEscape";
}, never>;
outMessage?: {
readonly _tag: "DismissedToast";
readonly payload: A;
};
}>;
readonly dismiss: (model: {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
}, entryId: string) => Readonly<{
model: {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
};
commands?: import("@wsagency/wseffect-foldkit/update").Commands<{
readonly _tag: "Added";
readonly entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
};
} | {
readonly _tag: "CancelledSwipe";
readonly pointerId: number;
} | {
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "Dismissed";
readonly entryId: string;
} | {
readonly _tag: "GotAnimationMessage";
readonly entryId: string;
readonly message: {
readonly _tag: "CompletedWaitForPaint";
readonly generation: number;
} | {
readonly _tag: "EndedAnimation";
readonly generation: number;
} | {
readonly _tag: "Hid";
} | {
readonly _tag: "Showed";
};
} | {
readonly _tag: "HoveredEntry";
readonly entryId: string;
} | {
readonly _tag: "LeftEntry";
readonly entryId: string;
} | {
readonly _tag: "MovedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEntryPointer";
readonly entryId: string;
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "ReleasedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "DismissedAll";
} | {
readonly _tag: "PressedEscape";
}, never>;
outMessage?: {
readonly _tag: "DismissedToast";
readonly payload: A;
};
}>;
readonly dismissAll: (model: {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
}) => Readonly<{
model: {
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
};
commands?: import("@wsagency/wseffect-foldkit/update").Commands<{
readonly _tag: "Added";
readonly entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
};
} | {
readonly _tag: "CancelledSwipe";
readonly pointerId: number;
} | {
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "Dismissed";
readonly entryId: string;
} | {
readonly _tag: "GotAnimationMessage";
readonly entryId: string;
readonly message: {
readonly _tag: "CompletedWaitForPaint";
readonly generation: number;
} | {
readonly _tag: "EndedAnimation";
readonly generation: number;
} | {
readonly _tag: "Hid";
} | {
readonly _tag: "Showed";
};
} | {
readonly _tag: "HoveredEntry";
readonly entryId: string;
} | {
readonly _tag: "LeftEntry";
readonly entryId: string;
} | {
readonly _tag: "MovedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEntryPointer";
readonly entryId: string;
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "ReleasedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "DismissedAll";
} | {
readonly _tag: "PressedEscape";
}, never>;
outMessage?: {
readonly _tag: "DismissedToast";
readonly payload: A;
};
}>;
readonly subscriptions: {
readonly swipePointer: import("@wsagency/wseffect-foldkit/subscription").EntryWithoutKeepAlive<{
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
}, {
readonly _tag: "Added";
readonly entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
};
} | {
readonly _tag: "CancelledSwipe";
readonly pointerId: number;
} | {
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "Dismissed";
readonly entryId: string;
} | {
readonly _tag: "GotAnimationMessage";
readonly entryId: string;
readonly message: {
readonly _tag: "CompletedWaitForPaint";
readonly generation: number;
} | {
readonly _tag: "EndedAnimation";
readonly generation: number;
} | {
readonly _tag: "Hid";
} | {
readonly _tag: "Showed";
};
} | {
readonly _tag: "HoveredEntry";
readonly entryId: string;
} | {
readonly _tag: "LeftEntry";
readonly entryId: string;
} | {
readonly _tag: "MovedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEntryPointer";
readonly entryId: string;
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "ReleasedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "DismissedAll";
} | {
readonly _tag: "PressedEscape";
}, {
readonly isSwipeEnabled: boolean;
readonly isAnyDragging: boolean;
}, never> & {
readonly __subscription: never;
};
readonly swipeEscape: import("@wsagency/wseffect-foldkit/subscription").EntryWithoutKeepAlive<{
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
}, {
readonly _tag: "Added";
readonly entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
};
} | {
readonly _tag: "CancelledSwipe";
readonly pointerId: number;
} | {
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "Dismissed";
readonly entryId: string;
} | {
readonly _tag: "GotAnimationMessage";
readonly entryId: string;
readonly message: {
readonly _tag: "CompletedWaitForPaint";
readonly generation: number;
} | {
readonly _tag: "EndedAnimation";
readonly generation: number;
} | {
readonly _tag: "Hid";
} | {
readonly _tag: "Showed";
};
} | {
readonly _tag: "HoveredEntry";
readonly entryId: string;
} | {
readonly _tag: "LeftEntry";
readonly entryId: string;
} | {
readonly _tag: "MovedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEntryPointer";
readonly entryId: string;
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "ReleasedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "DismissedAll";
} | {
readonly _tag: "PressedEscape";
}, {
readonly isSwipeEnabled: boolean;
readonly isAnyDragging: boolean;
}, never> & {
readonly __subscription: never;
};
};
readonly swipeOffset: typeof import("./update.js").swipeOffset;
readonly view: import("@wsagency/wseffect-foldkit/submodel").View<{
readonly id: string;
readonly defaultDuration: import("effect/Duration").Duration;
readonly entries: readonly {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}[];
readonly nextEntryKey: number;
readonly maybeSwipeConfig: Option.Option<{
readonly direction: "Left" | "Right";
readonly threshold: number;
}>;
}, {
readonly _tag: "Added";
readonly entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
};
} | {
readonly _tag: "CancelledSwipe";
readonly pointerId: number;
} | {
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
} | {
readonly _tag: "Dismissed";
readonly entryId: string;
} | {
readonly _tag: "DismissedAll";
} | {
readonly _tag: "GotAnimationMessage";
readonly entryId: string;
readonly message: {
readonly _tag: "CompletedWaitForPaint";
readonly generation: number;
} | {
readonly _tag: "EndedAnimation";
readonly generation: number;
} | {
readonly _tag: "Hid";
} | {
readonly _tag: "Showed";
};
} | {
readonly _tag: "HoveredEntry";
readonly entryId: string;
} | {
readonly _tag: "LeftEntry";
readonly entryId: string;
} | {
readonly _tag: "MovedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEntryPointer";
readonly entryId: string;
readonly pointerId: number;
readonly clientX: number;
} | {
readonly _tag: "PressedEscape";
} | {
readonly _tag: "ReleasedSwipePointer";
readonly pointerId: number;
readonly clientX: number;
}, Readonly<{
position: Position;
entryToView: (entry: {
readonly id: string;
readonly variant: "Error" | "Info" | "Success" | "Warning";
readonly animation: {
readonly id: string;
readonly isShowing: boolean;
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
readonly transitionGeneration: number;
};
readonly maybeDuration: Option.Option<import("effect/Duration").Duration>;
readonly pendingDismissVersion: number;
readonly isHovered: boolean;
readonly swipeState: {
readonly _tag: "Dismissing";
readonly offsetX: number;
readonly direction: "Left" | "Right";
} | {
readonly _tag: "Dragging";
readonly pointerId: number;
readonly startX: number;
readonly currentX: number;
} | {
readonly _tag: "Idle";
} | {
readonly _tag: "Settling";
readonly offsetX: number;
};
readonly swipeVersion: number;
readonly payload: A;
}, handlers: EntryHandlers) => Html;
ariaLabel?: string;
containerClassName?: string;
entryClassName?: string;
}>>;
}MessagePayload-independent Message variants shared by every bound Toast module.
Message: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
readonly Dismissed: {
entryId: Schema.String;
};
readonly DismissedAll: {};
readonly CompletedWaitBeforeDismissal: {
entryId: Schema.String;
version: Schema.Number;
};
readonly HoveredEntry: {
entryId: Schema.String;
};
readonly LeftEntry: {
entryId: Schema.String;
};
readonly GotAnimationMessage: {
entryId: Schema.String;
message: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
readonly Showed: {};
readonly Hid: {};
readonly CompletedWaitForPaint: {
generation: Schema.Number;
};
readonly EndedAnimation: {
generation: Schema.Number;
};
}>;
};
readonly PressedEntryPointer: {
entryId: Schema.String;
pointerId: Schema.Number;
clientX: Schema.Number;
};
readonly MovedSwipePointer: {
pointerId: Schema.Number;
clientX: Schema.Number;
};
readonly ReleasedSwipePointer: {
pointerId: Schema.Number;
clientX: Schema.Number;
};
readonly CancelledSwipe: {
pointerId: Schema.Number;
};
readonly PressedEscape: {};
readonly CompletedWaitForSwipeSettled: {
entryId: Schema.String;
version: Schema.Number;
};
}>MovedSwipePointerexport type MovedSwipePointer = typeof Message.MovedSwipePointer.Type;Positionexport type Position = typeof Position.Type;PositionWhere the toast viewport is anchored on the screen and how entries stack.
Position: Schema.Literals<readonly ["TopLeft", "TopCenter", "TopRight", "BottomLeft", "BottomCenter", "BottomRight"]>PressedEntryPointerexport type PressedEntryPointer = typeof Message.PressedEntryPointer.Type;PressedEscapeexport type PressedEscape = typeof Message.PressedEscape.Type;ReleasedSwipePointerexport type ReleasedSwipePointer = typeof Message.ReleasedSwipePointer.Type;ShowInputInput for `show()`. `payload` is the consumer-defined content shape for an entry. Omit `duration` to use the container's `defaultDuration`; pass `sticky: true` to skip auto-dismiss entirely.
export type ShowInput<A> = Readonly<{
payload: A;
variant?: Variant;
duration?: Duration.Input;
sticky?: boolean;
}>;SWIPE_SETTLE_DURATIONTime an entry remains in `Settling` after a short or cancelled swipe, allowing consumer CSS to animate it back to rest.
SWIPE_SETTLE_DURATION: Duration.DurationSwipeDirectionexport type SwipeDirection = typeof SwipeDirection.Type;SwipeDirectionDirection in which a pointer can drag an entry to dismiss it.
SwipeDirection: Schema.Literals<readonly ["Left", "Right"]>swipeOffsetHorizontal offset in pixels for an entry's swipe state. `Dragging` reports the distance travelled from the press point; `Dismissing` reports the offset the release left behind; `Idle` and `Settling` report zero.
swipeOffset: (swipeState: typeof SwipeState.Type) => numberSwipeStateexport type SwipeState = typeof SwipeState.Type;SwipeStatePer-entry swipe gesture state. `Dragging` retains the initiating `pointerId`, so move, release, and cancel Messages update only the entry that started the gesture and ignore unrelated touches. `Settling` returns a cancelled or short swipe to rest. `Dismissing` retains the release offset and direction while the leave animation carries the entry off-screen. The settle generation lives in the entry's `swipeVersion` so a stale settle timer cannot clear a later gesture.
SwipeState: import("@wsagency/wseffect-foldkit/schema").TaggedUnion<{
readonly Idle: {};
readonly Dragging: {
pointerId: Schema.Number;
startX: Schema.Number;
currentX: Schema.Number;
};
readonly Settling: {
offsetX: Schema.Number;
};
readonly Dismissing: {
offsetX: Schema.Number;
direction: Schema.Literals<readonly ["Left", "Right"]>;
};
}>SwipeToDismissConfigOpt-in configuration for swipe-to-dismiss. Without `swipeToDismiss`, the view attaches no pointer handler and swipe Messages do nothing. Pass `{}` for the default rightward swipe, `{ threshold }` to change the distance, or `{ direction: 'Left' }` to swipe left.
export type SwipeToDismissConfig = Readonly<{
threshold?: number;
direction?: SwipeDirection;
}>;testimport * as Story from '@wsagency/wseffect-foldkit/story';
/** Input for {@link drainEntry}. `entryId` selects the entry whose lifecycle
* to drain. `version` is the auto-dismiss timer version echoed back by
* `CompletedWaitBeforeDismissal`; it defaults to `0`, the version a freshly
* shown entry carries. */
export type DrainEntryInput = Readonly<{
entryId: string;
version?: number;
}>;
/** Builds a `Story.Command.resolveAll` step that drains a single toast
* entry's full animation and dismiss lifecycle. Resolving these Commands in
* order takes a freshly shown entry from its enter animation through
* auto-dismiss and its exit animation, ending with the entry removed from the
* stack and the `DismissedToast` OutMessage emitted.
*
* Showing a toast via `Toast.show` emits a multi-step lifecycle that a Story
* test must resolve in full or the story fails on leftover Commands. The
* steps are:
*
* - enter animation: `WaitForPaint` then `CompletedWaitForPaint`
* - enter settle: `WaitForAnimationSettled` then `EndedAnimation`
* - auto-dismiss: `WaitBeforeDismissal` then
* `CompletedWaitBeforeDismissal`
* - exit animation: `WaitForPaint` then `CompletedWaitForPaint`
* - exit settle: `WaitForAnimationSettled` then `EndedAnimation`
*
* The enter steps match animation transition generation `1`, which the
* entry's `Showed` starts, and the exit steps match generation `2`, which its
* `Hid` starts. Each step matches only its own generation, so the helper also
* an entry whose enter the test has already resolved. These versions are
* separate from the auto-dismiss timer `version`.
*
* Each step resolves with the child's raw result Message. `resolveAll` replays
* the matched Command's own recorded wrapping, so a parent that embeds the
* toast Submodel drains the same way without restating its `Got*` lift.
*
* @example
* ```ts
* Story.story(
* update,
* Story.given(model),
* Story.message(ClickedSave()),
* Toast.test.drainEntry({ entryId: 'toast-entry-0' }),
* )
* ```
*/
export declare const drainEntry: ({ entryId, version, }: DrainEntryInput) => <Model, Message, OutMessage = undefined>(simulation: Story.StorySimulation<Model, Message, OutMessage>) => Story.StorySimulation<Model, Message, OutMessage>;Variantexport type Variant = typeof Variant.Type;VariantSemantic category of a toast. Drives the default ARIA role: `status` for `Info` / `Success`, `alert` for `Warning` / `Error`. Also surfaced as `data-variant` on each entry for per-variant CSS. This is the only content-adjacent field the component owns. The rest of the entry's content lives in the user-provided payload.
Variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>WaitBeforeDismissalWaits for an entry's auto-dismiss duration, then emits a versioned `CompletedWaitBeforeDismissal` Message so update can ignore stale timers.
WaitBeforeDismissal: Command.CommandDefinitionWithArgs<"WaitBeforeDismissal", {
entryId: Schema.String;
version: Schema.Number;
duration: Schema.DurationFromMillis;
}, Effect.Effect<{
readonly _tag: "CompletedWaitBeforeDismissal";
readonly entryId: string;
readonly version: number;
}, never, never>>WaitForSwipeSettledWaits for a short or cancelled swipe to animate back, then emits `CompletedWaitForSwipeSettled` so update can clear `Settling`.
WaitForSwipeSettled: Command.CommandDefinitionWithArgs<"WaitForSwipeSettled", {
entryId: Schema.String;
version: Schema.Number;
}, Effect.Effect<{
readonly _tag: "CompletedWaitForSwipeSettled";
readonly entryId: string;
readonly version: number;
}, never, never>>