import { type WorkflowDefinition, type WorkflowStepDraft } from "../definition"; import type { StartOptions, StepAction, StepContext, StepHookAction, StepParameters, TargetEventHandler, WaitUntilOptions } from "../types"; declare const STEP_BUILDER_INTERNAL: unique symbol; /** Standard DOM event names supported by HTML elements. */ export type EventName = keyof HTMLElementEventMap; type EventForName = HTMLElementEventMap[TEventName]; /** Predicate polled by `.waitUntil()` until it returns `true` or the wait times out. */ type WaitUntilPredicate = (context: StepContext) => Promise | boolean; /** Builder for constructing a tour workflow step-by-step. */ export declare class WorkflowBuilder { readonly name: string; private readonly options; private readonly steps; private currentStep; private definition; /** * Creates a new workflow builder. * @param name The name of the workflow. * @param options Tour start options (lifecycle hooks, display options, behavior). */ constructor(name: string, options?: StartOptions); /** * Add a new step to the workflow. * @param options Step configuration. * @returns A WorkflowStepBuilder for chaining additional configuration. */ step(options: StepParameters): WorkflowStepBuilder; /** * Append another workflow's steps to this workflow. * @param workflow The workflow to append. * @returns A WorkflowStepBuilder for the last appended step. */ append(workflow: WorkflowDefinition): WorkflowStepBuilder; /** * Build and return the workflow definition. Can be called multiple times. * @returns A frozen workflow definition ready to run. */ build(): WorkflowDefinition; private assertBuilding; private commitCurrentStep; } /** Builder for configuring a single tour step with actions and event handlers. */ export declare class WorkflowStepBuilder { private readonly owner; private readonly draft; private active; /** * Creates a step builder for the given workflow. * @param owner The parent WorkflowBuilder. * @param draft The step definition being built. */ constructor(owner: WorkflowBuilder, draft: WorkflowStepDraft); /** * Add another step to the workflow after this one. * @param options The new step configuration. * @returns The new WorkflowStepBuilder. */ step(options: StepParameters): WorkflowStepBuilder; /** * Append another workflow's steps after this step. * @param workflow The workflow to append. * @returns The WorkflowStepBuilder for the last appended step. */ append(workflow: WorkflowDefinition): WorkflowStepBuilder; /** * Build and return the workflow definition. * @returns A frozen workflow definition ready to run. */ build(): WorkflowDefinition; /** * Add an action that clicks the target element when the step is entered. * @returns This builder for chaining. */ clickTarget(): this; /** * Add an action that focuses the target element when the step is entered. * @returns This builder for chaining. */ focusTarget(): this; /** * Add a delay action. * @param timeMs The delay duration in milliseconds. * @returns This builder for chaining. */ wait(timeMs: number): this; /** * Add an action that waits for a condition before continuing. * @param predicate Function that returns true when the condition is met. * @param options Timeout and polling interval options. * @returns This builder for chaining. */ waitUntil(predicate: WaitUntilPredicate, options?: WaitUntilOptions): this; /** * Add an action that waits for an element to appear in the DOM. * @param selector CSS selector for the element to wait for. * @param options Timeout and polling interval options. * @returns This builder for chaining. */ waitUntilElement(selector: string, options?: WaitUntilOptions): this; /** * Add a custom action callback to run when the step is entered. * @param callback The action callback. * @returns This builder for chaining. */ do(callback: StepAction): this; /** * Add a callback that runs each time this step is entered, after its target is resolved and * before the step is shown. Props set here are the first ones displayed, which makes it the place * to reset them: `beforeEnter(({ props, initialProps }) => props.set(initialProps))`. Call * `context.abort()` to stay on the current step instead of showing this one. * @param callback The hook callback; `context.direction` is the direction of the navigation in progress. * @returns This builder for chaining. */ beforeEnter(callback: StepHookAction): this; /** * Add a callback that runs before navigating away from this step: advance, previous, `goTo`, * or finishing the tour. It does not run on cancel; use the workflow `onCancel` option instead. * Call `context.abort()` to stay on this step. * @param callback The hook callback; `context.direction` is the direction of the navigation in progress. * @returns This builder for chaining. */ beforeLeave(callback: StepHookAction): this; /** * Add an event listener to the target element for a specific event name. * @param event The event name. * @param callback The handler function. * @returns This builder for chaining. */ onTargetEvent(event: TEventName, callback: TargetEventHandler>["callback"]): this; /** * Add an event listener to the target element for multiple event names. * @param events Array of event names. * @param callback The handler function. * @returns This builder for chaining. */ onTargetEvent(events: TEventNames, callback: TargetEventHandler>["callback"]): this; /** * Add an event listener to the target element for a custom event. * @param event The event name. * @param callback The handler function. * @returns This builder for chaining. */ onTargetEvent(event: string, callback: TargetEventHandler["callback"]): this; [STEP_BUILDER_INTERNAL](): WorkflowStepDraft; private assertActive; } export {};