import * as test from "@storybook/test"; import { PromiseQueue, createCapturer, untilNextFrame } from "./utils.svelte.js"; import { type Snippet } from "svelte"; export type PocketElements = Record; type Flush = (..._: any[]) => void; interface Setter { /** * Set the values of the test elements according to the items provided in the payload. * @param payload - The values to set the test elements to. */ (payload: Partial): void; /** * **_NOTE:_** This overload is intended only for use with **svelte runes**. * * Both sets the values of the test elements according to the object returned by the getter, * but also sets up a reactive dependency on `getter` such that when any of the reactive values it references change, * the test elements will be updated to the new values. * @example * ```ts * let value = $state(0); * set(() => ({ value })); * ``` * @example * ```ts * let value = $state(0); * const flush = set(() => ({ value })); * flush((value = 1)); * ``` * @param getter - A function that returns the values to set the test elements to. * Any reactive values referenced in the function body will be tracked as dependencies. * @returns A function that can be used to immediately flush reactive changes (e.g. internally calls `svelte.flushSync`). * For syntatic sugar purposes, it takes any abritrary number of arguments, * so you can update a rune and flush it's changes in a single line (see the second example above). */ (getter: () => Partial): Flush; } type TestHarness = { given: (...keys: (keyof T)[]) => Promise>; set: Setter; root: HTMLElement; preventRender: () => () => void; signal: AbortSignal; onAbort: (fn: () => void) => void; capture: ReturnType; untilNextFrame: typeof untilNextFrame; } & typeof test; type Mode = Required["Types"]["Task"]["mode"]; export type Props = { vest: Snippet<[pocket: T]>; body: (harness: TestHarness) => Promise; name?: string; id?: string; mode?: Mode; manual?: boolean; position?: "above" | "below" | "left" | "right" | "within"; }; type Abort = () => void; type Complete = () => void; type Begin = (abort: Abort) => Complete; export declare const reset: () => void; declare class __sveltets_Render { props(): Props & { begin: Begin; }; events(): {}; slots(): {}; bindings(): ""; exports(): {}; } interface $$IsomorphicComponent { new (options: import('svelte').ComponentConstructorOptions['props']>>): import('svelte').SvelteComponent['props']>, ReturnType<__sveltets_Render['events']>, ReturnType<__sveltets_Render['slots']>> & { $$bindings?: ReturnType<__sveltets_Render['bindings']>; } & ReturnType<__sveltets_Render['exports']>; (internal: unknown, props: ReturnType<__sveltets_Render['props']> & {}): ReturnType<__sveltets_Render['exports']>; z_$$bindings?: ReturnType<__sveltets_Render['bindings']>; } declare const Runner: $$IsomorphicComponent; type Runner = InstanceType>; export default Runner;