import { ID } from "../../types/index.mjs"; import { ContextTrinity } from "../createTrinity/index.mjs"; import { RegistryTicket, RegistryTicketInput } from "../createRegistry/index.mjs"; import { Plugin } from "../createPlugin/index.mjs"; import { PopoverAdapter } from "../usePopover/adapters/adapter.mjs"; import "../usePopover/index.mjs"; import "../index.mjs"; import { MaybeRefOrGetter, Ref } from "vue"; //#region src/composables/useTooltip/index.d.ts /** * Options accepted by the tooltip factory. * * @example * ```ts * import { createTooltipPlugin } from '@vuetify/v0' * * app.use(createTooltipPlugin({ openDelay: 500, closeDelay: 100 })) * ``` */ interface TooltipOptions { /** Default open delay in ms. @default 700 */ openDelay?: MaybeRefOrGetter; /** Default close delay in ms. @default 150 */ closeDelay?: MaybeRefOrGetter; /** Window in ms after a tooltip closes during which the next open is instant. @default 300 */ skipDelay?: MaybeRefOrGetter; /** Disable all tooltips in this region. @default false */ disabled?: MaybeRefOrGetter; /** * Positioning adapter for tooltip surfaces in this region. Tooltip-only — * Popover / Select / Combobox never see this value. Per-instance `adapter` * on `Tooltip.Root` still wins. */ adapter?: PopoverAdapter; } interface TooltipContext { /** * Reactive open delay in ms. * * @example * ```ts * const tooltip = useTooltip() * console.log(tooltip.openDelay.value) * ``` */ openDelay: Readonly>; /** * Reactive close delay in ms. * * @example * ```ts * const tooltip = useTooltip() * console.log(tooltip.closeDelay.value) * ``` */ closeDelay: Readonly>; /** * Reactive skip-window length in ms. * * @example * ```ts * const tooltip = useTooltip() * console.log(tooltip.skipDelay.value) * ``` */ skipDelay: Readonly>; /** * Reactive disabled flag for the region. * * @example * ```ts * const tooltip = useTooltip() * if (tooltip.disabled.value) return * ``` */ disabled: Readonly>; /** * True when at least one tooltip is currently open in this region. * * @example * ```ts * const tooltip = useTooltip() * watch(tooltip.isAnyOpen, open => console.log(open)) * ``` */ isAnyOpen: Readonly>; /** * Returns true when the next opening tooltip should skip its open delay. * * @remarks * The skip rule is two-pronged: skip when another tooltip is already open * in the region, or skip when the previous tooltip closed within the * `skipDelay` window. * * @example * ```ts * const tooltip = useTooltip() * const delay = tooltip.shouldSkipOpenDelay() ? 0 : tooltip.openDelay.value * ``` */ shouldSkipOpenDelay: () => boolean; /** * Register an open tooltip with the region. * * @example * ```ts * const tooltip = useTooltip() * const ticket = tooltip.register({ id: 'tooltip:1' }) * ``` */ register: (input?: Partial) => RegistryTicket; /** * Unregister a tooltip and stamp the close timestamp. * * @example * ```ts * const tooltip = useTooltip() * tooltip.unregister(ticket.id) * ``` */ unregister: (id: ID) => void; /** * Region positioning adapter, or `undefined` to fall through to the * popover plugin / `V0PopoverAdapter`. * * @example * ```ts * const tooltip = useTooltip() * tooltip.adapter * ``` */ adapter: PopoverAdapter | undefined; } interface TooltipContextOptions extends TooltipOptions { namespace?: string; } interface TooltipPluginOptions extends TooltipContextOptions {} /** * Synthesized fallback used when `useTooltip()` is called without * `app.use(createTooltipPlugin())`. Returns a fresh context with the * documented defaults — `` keeps working but warmup * coordination is per-instance instead of region-wide. * * @example * ```ts * import { createTooltipFallback } from '@vuetify/v0' * * const tooltip = createTooltipFallback() * console.log(tooltip.openDelay.value) // 700 * ``` */ declare function createTooltipFallback(): TooltipContext; declare const createTooltipContext: <_E extends TooltipContext = TooltipContext>(_options?: TooltipPluginOptions | undefined) => ContextTrinity<_E>, createTooltipPlugin: (_options?: (TooltipPluginOptions & Pick<{ namespace?: string; persist?: boolean; devtools?: boolean; }, "devtools">) | undefined) => Plugin, useTooltip: <_E extends TooltipContext = TooltipContext>(namespace?: string) => _E; //#endregion export { TooltipContext, TooltipContextOptions, TooltipOptions, TooltipPluginOptions, createTooltipContext, createTooltipFallback, createTooltipPlugin, useTooltip };