import { CancellationToken } from "../../../../../base/common/cancellation.js"; import { Event } from "../../../../../base/common/event.js"; import { IDisposable } from "../../../../../base/common/lifecycle.js"; /** * Attribute used to mark a DOM element as an onboarding spotlight target. * * Components opt in by tagging their *own* element with this attribute. Tours * reference the id; they never reach into another component's markup or CSS * classes to locate a target (see the sessions "DOM Traversal & Intent" rule). */ export declare const ONBOARDING_TARGET_ATTR = "data-onboarding-id"; export declare const ONBOARDING_TARGET_PULSE_CLASS = "onboarding-target-pulse"; /** The keyboard focus owner when the highlighted element is not itself focusable. */ export interface IOnboardingFocusTarget { readonly element: HTMLElement; focus(): void; } export interface IOnboardingTargetOptions { /** Opens or expands the target before its spotlight step is shown. */ readonly open?: () => Promise | void; readonly focusTarget?: IOnboardingFocusTarget; /** Whether this control already has a selected value, independent of asynchronous acceptance. */ readonly hasSelection?: () => boolean; /** Reports a user selection and resolves once it is accepted or rejected. */ readonly onDidSelect?: Event>; /** Reports mouse, keyboard, or touch activation through the owning control. */ readonly onDidActivate?: Event; /** Identifies the prepared UI instance that owns this target. */ readonly scope?: string | (() => string | undefined); } export interface IOnboardingTarget { readonly element: HTMLElement; /** Opens the target for its step. `token` is cancelled when the step ends. */ readonly open?: (token?: CancellationToken) => Promise | void; /** Closes what {@link open} opened. A spotlight tour calls it before it shows a step for another element, and when the tour ends. */ readonly close?: () => void; readonly focusTarget?: IOnboardingFocusTarget; /** Accepted selections supplied by a scoped adapter, without replacing the owner's DOM marker. */ readonly onDidSelect?: Event>; readonly onDidActivate?: Event; /** Other elements to highlight with {@link element}, such as a menu it opened. See the onboarding README. */ readonly additionalElements?: () => readonly HTMLElement[]; } /** Registers an adapter that resolves a control through its owning feature's API. */ export declare function registerOnboardingTargetProvider(id: string, provider: (scope: string | undefined) => IOnboardingTarget | undefined): IDisposable; export declare function resolveOnboardingTarget(targetWindow: Window, id: string, scope?: string): IOnboardingTarget | undefined; /** * Marks `element` as the onboarding target identified by `id`. * * @returns A disposable that removes the attribute again. */ export declare function markOnboardingTarget(element: HTMLElement, id: string, options?: IOnboardingTargetOptions): IDisposable; /** Opens or expands a target through the behavior registered by its owner. */ export declare function openOnboardingTarget(element: HTMLElement): Promise | void; /** Observes selections reported by the target's owner. */ export declare function onDidSelectOnboardingTarget(element: HTMLElement): Event>; /** Reads selection state from the target's owner, without depending on downstream session state. */ export declare function hasOnboardingTargetSelection(element: HTMLElement): boolean; /** * Applies the standard onboarding pulse treatment to `element`. * * @returns A disposable that removes the pulse again. */ export declare function pulseOnboardingTarget(element: HTMLElement): IDisposable; /** * Resolves the element marked with the given onboarding target id within the * provided window's document. Returns `undefined` if no such element exists * (e.g. the feature is not currently rendered). * * This is the *only* place onboarding queries the DOM, and it matches solely on * the onboarding attribute — never on foreign classes or structure. */ export declare function findOnboardingTarget(targetWindow: Window, id: string, scope?: string): HTMLElement | undefined;