import { Duration, Effect, Option, Schema as S } from 'effect'; import * as Command from 'foldkit/command'; import * as Update from 'foldkit/update'; import { type InitConfig, type Variant } from './schema.js'; /** Input 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 = Readonly<{ payload: A; variant?: Variant; duration?: Duration.Input; sticky?: boolean; }>; /** Schedules an auto-dismiss timer for an entry. The result Message carries a * version so stale timers (from hover or manual dismiss) are discarded in * the update function. Static. The Command definition doesn't depend on * payload. */ export declare const WaitBeforeDismissal: Command.CommandDefinitionWithArgs<"WaitBeforeDismissal", { entryId: S.String; version: S.Number; duration: S.DurationFromMillis; }, Effect.Effect<{ readonly _tag: "CompletedWaitBeforeDismissal"; readonly entryId: string; readonly version: number; }, never, never>>; /** Factory that binds Toast's runtime (update fn, helpers, commands) to a * specific payload schema. Called by `make` in index.ts; inner helpers close * over the payload-specific Entry / Model / Added types so generics don't * have to propagate through every helper signature. * * @internal Consumers should use `Toast.make(PayloadSchema)`. This is * only exported so `index.ts` can wire the view into the bound runtime. */ export declare const makeRuntime: (payloadSchema: S.Codec) => { readonly Entry: S.Struct<{ readonly id: S.String; readonly variant: S.Literals; readonly animation: S.Struct<{ readonly id: S.String; readonly isShowing: S.Boolean; readonly transitionState: S.Literals; }>; readonly maybeDuration: S.Option; readonly pendingDismissVersion: S.Number; readonly isHovered: S.Boolean; readonly payload: S.Codec; }>; readonly Model: S.Struct<{ readonly id: S.String; readonly defaultDuration: S.DurationFromMillis; readonly entries: S.$Array; readonly animation: S.Struct<{ readonly id: S.String; readonly isShowing: S.Boolean; readonly transitionState: S.Literals; }>; readonly maybeDuration: S.Option; readonly pendingDismissVersion: S.Number; readonly isHovered: S.Boolean; readonly payload: S.Codec; }>>; readonly nextEntryKey: S.Number; }>; readonly Message: import("foldkit/message").MessageUnion<{ readonly Added: { readonly entry: S.Struct<{ readonly id: S.String; readonly variant: S.Literals; readonly animation: S.Struct<{ readonly id: S.String; readonly isShowing: S.Boolean; readonly transitionState: S.Literals; }>; readonly maybeDuration: S.Option; readonly pendingDismissVersion: S.Number; readonly isHovered: S.Boolean; readonly payload: S.Codec; }>; }; readonly Dismissed: { readonly entryId: S.String; }; readonly DismissedAll: {}; readonly CompletedWaitBeforeDismissal: { readonly entryId: S.String; readonly version: S.Number; }; readonly HoveredEntry: { readonly entryId: S.String; }; readonly LeftEntry: { readonly entryId: S.String; }; readonly GotAnimationMessage: { readonly entryId: S.String; readonly message: import("foldkit/message").MessageUnion<{ readonly Showed: {}; readonly Hid: {}; readonly CompletedWaitForPaint: {}; readonly EndedAnimation: {}; }>; }; }>; readonly OutMessage: import("foldkit/message").MessageUnion<{ readonly DismissedToast: { readonly payload: S.Codec; }; }>; readonly Added: import("foldkit/schema").CallableTaggedStruct<"Added", { readonly entry: S.Struct<{ readonly id: S.String; readonly variant: S.Literals; readonly animation: S.Struct<{ readonly id: S.String; readonly isShowing: S.Boolean; readonly transitionState: S.Literals; }>; readonly maybeDuration: S.Option; readonly pendingDismissVersion: S.Number; readonly isHovered: S.Boolean; readonly payload: S.Codec; }>; }>; readonly DismissedToast: import("foldkit/schema").CallableTaggedStruct<"DismissedToast", { readonly payload: S.Codec; }>; readonly init: (config: InitConfig) => { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }; readonly update: (model: { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }, message: { readonly _tag: "GotAnimationMessage"; readonly entryId: string; readonly message: { readonly _tag: "Showed"; } | { readonly _tag: "Hid"; } | { readonly _tag: "CompletedWaitForPaint"; } | { readonly _tag: "EndedAnimation"; }; } | { readonly _tag: "Dismissed"; readonly entryId: string; } | { readonly _tag: "DismissedAll"; } | { readonly _tag: "CompletedWaitBeforeDismissal"; readonly entryId: string; readonly version: number; } | { readonly _tag: "HoveredEntry"; readonly entryId: string; } | { readonly _tag: "LeftEntry"; readonly entryId: string; } | { readonly _tag: "Added"; readonly entry: { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }; }) => Readonly<{ model: { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }; commands?: Update.Commands<{ readonly _tag: "GotAnimationMessage"; readonly entryId: string; readonly message: { readonly _tag: "Showed"; } | { readonly _tag: "Hid"; } | { readonly _tag: "CompletedWaitForPaint"; } | { readonly _tag: "EndedAnimation"; }; } | { readonly _tag: "Dismissed"; readonly entryId: string; } | { readonly _tag: "DismissedAll"; } | { readonly _tag: "CompletedWaitBeforeDismissal"; readonly entryId: string; readonly version: number; } | { readonly _tag: "HoveredEntry"; readonly entryId: string; } | { readonly _tag: "LeftEntry"; readonly entryId: string; } | { readonly _tag: "Added"; readonly entry: { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }; }, never>; outMessage?: { readonly _tag: "DismissedToast"; readonly payload: A; }; }>; readonly show: (model: { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }, input: ShowInput) => Readonly<{ model: { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }; commands?: Update.Commands<{ readonly _tag: "GotAnimationMessage"; readonly entryId: string; readonly message: { readonly _tag: "Showed"; } | { readonly _tag: "Hid"; } | { readonly _tag: "CompletedWaitForPaint"; } | { readonly _tag: "EndedAnimation"; }; } | { readonly _tag: "Dismissed"; readonly entryId: string; } | { readonly _tag: "DismissedAll"; } | { readonly _tag: "CompletedWaitBeforeDismissal"; readonly entryId: string; readonly version: number; } | { readonly _tag: "HoveredEntry"; readonly entryId: string; } | { readonly _tag: "LeftEntry"; readonly entryId: string; } | { readonly _tag: "Added"; readonly entry: { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }; }, never>; outMessage?: { readonly _tag: "DismissedToast"; readonly payload: A; }; }>; readonly dismiss: (model: { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }, entryId: string) => Readonly<{ model: { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }; commands?: Update.Commands<{ readonly _tag: "GotAnimationMessage"; readonly entryId: string; readonly message: { readonly _tag: "Showed"; } | { readonly _tag: "Hid"; } | { readonly _tag: "CompletedWaitForPaint"; } | { readonly _tag: "EndedAnimation"; }; } | { readonly _tag: "Dismissed"; readonly entryId: string; } | { readonly _tag: "DismissedAll"; } | { readonly _tag: "CompletedWaitBeforeDismissal"; readonly entryId: string; readonly version: number; } | { readonly _tag: "HoveredEntry"; readonly entryId: string; } | { readonly _tag: "LeftEntry"; readonly entryId: string; } | { readonly _tag: "Added"; readonly entry: { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }; }, never>; outMessage?: { readonly _tag: "DismissedToast"; readonly payload: A; }; }>; readonly dismissAll: (model: { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }) => Readonly<{ model: { readonly id: string; readonly defaultDuration: Duration.Duration; readonly entries: readonly { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }[]; readonly nextEntryKey: number; }; commands?: Update.Commands<{ readonly _tag: "GotAnimationMessage"; readonly entryId: string; readonly message: { readonly _tag: "Showed"; } | { readonly _tag: "Hid"; } | { readonly _tag: "CompletedWaitForPaint"; } | { readonly _tag: "EndedAnimation"; }; } | { readonly _tag: "Dismissed"; readonly entryId: string; } | { readonly _tag: "DismissedAll"; } | { readonly _tag: "CompletedWaitBeforeDismissal"; readonly entryId: string; readonly version: number; } | { readonly _tag: "HoveredEntry"; readonly entryId: string; } | { readonly _tag: "LeftEntry"; readonly entryId: string; } | { readonly _tag: "Added"; readonly entry: { readonly id: string; readonly variant: "Error" | "Info" | "Success" | "Warning"; readonly animation: { readonly id: string; readonly isShowing: boolean; readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating"; }; readonly maybeDuration: Option.Option; readonly pendingDismissVersion: number; readonly isHovered: boolean; readonly payload: A; }; }, never>; outMessage?: { readonly _tag: "DismissedToast"; readonly payload: A; }; }>; }; //# sourceMappingURL=update.d.ts.map