import { ContextTrinity } from "../createTrinity/index.mjs"; import { Plugin } from "../createPlugin/index.mjs"; import { PopoverAdapter, PopoverAdapterContext, PopoverAlign, PopoverPlacement, PopoverSide } from "./adapters/adapter.mjs"; import { V0PopoverAdapter } from "./adapters/v0.mjs"; import { toPlacement } from "./adapters/placement.mjs"; import "./adapters/index.mjs"; import "../index.mjs"; import { MaybeRefOrGetter, Ref } from "vue"; //#region src/composables/usePopover/index.d.ts interface PopoverOptions { /** Auto-generated if not provided */ id?: string; /** CSS position-area value @default 'bottom' */ positionArea?: MaybeRefOrGetter; /** CSS position-try-fallbacks value @default 'most-width bottom' */ positionTry?: MaybeRefOrGetter; /** External ref for bidirectional open state (e.g., from defineModel) */ isOpen?: Ref; /** Delay in ms before opening the popover. @default 0 */ openDelay?: MaybeRefOrGetter; /** Delay in ms before closing the popover. @default 0 */ closeDelay?: MaybeRefOrGetter; /** * Positioning engine. Resolution: per-instance `adapter`, then the * `createPopoverPlugin` adapter, then `new V0PopoverAdapter()` (CSS * anchor positioning, zero runtime dependency). */ adapter?: PopoverAdapter; } interface PopoverReturn { /** Whether the popover is open */ isOpen: Ref; /** Unique ID for the popover */ id: string; /** Open the popover (respects openDelay) */ open: () => void; /** Close the popover (respects closeDelay) */ close: () => void; /** Toggle open/close */ toggle: () => void; /** Cancel any pending open or close transition */ cancel: () => void; /** Styles to spread on the activator element (anchor-name) */ anchorStyles: Readonly>>; /** Attrs to spread on the content element (id, popover) */ contentAttrs: Readonly>; /** * Styles to spread on the content element. Owned by the active adapter — * CSS anchor declarations from `V0PopoverAdapter`, or whatever a custom * engine (e.g. Floating UI) returns. Not inherently CSS-anchor styles. */ contentStyles: Readonly>>; /** Placement intent. Writable so Content can override Root. @default `'bottom'` */ positionArea: Ref; /** Fallback positioning. Writable so Content can override Root. @default `'most-width bottom'` */ positionTry: Ref; /** Attach to a content element — wires show/hide watch + toggle event sync */ attach: (el: MaybeRefOrGetter) => void; /** Register the activator/reference element with the positioning adapter */ attachAnchor: (el: MaybeRefOrGetter) => void; } interface PopoverPluginContext { /** * App-wide positioning adapter. `undefined` means each `usePopover()` * call falls through to `V0PopoverAdapter`. * * @example * ```ts * import { createPopoverPlugin } from '@vuetify/v0' * import { FloatingUIPopoverAdapter } from '@vuetify/v0/popover/adapters/floating-ui' * * app.use(createPopoverPlugin({ adapter: new FloatingUIPopoverAdapter() })) * ``` */ adapter: PopoverAdapter | undefined; } interface PopoverPluginContextOptions { /** Positioning engine used when a per-instance `adapter` is not passed. */ adapter?: PopoverAdapter; namespace?: string; } interface PopoverPluginOptions extends PopoverPluginContextOptions {} /** * Synthesized fallback used when `usePopover()` is called without * `app.use(createPopoverPlugin())`. Returns `{ adapter: undefined }` so * resolution falls through to `V0PopoverAdapter`. * * @example * ```ts * import { createPopoverFallback } from '@vuetify/v0' * * const plugin = createPopoverFallback() * plugin.adapter // undefined * ``` */ declare function createPopoverFallback(): PopoverPluginContext; /** * Creates a scoped popover plugin context (the first member of the plugin trinity). * * @example * ```ts * import { createPopoverContext } from '@vuetify/v0' * import { FloatingUIPopoverAdapter } from '@vuetify/v0/popover/adapters/floating-ui' * * export const [useAppPopover, provideAppPopover, appPopover] = createPopoverContext({ * namespace: 'app:popover', * adapter: new FloatingUIPopoverAdapter(), * }) * ``` * * Plugin trinity for an app-wide popover positioning adapter. * * Namespace is `v0:popover`. Compound `Popover.Root` context lives at * `v0:popover:root` so the two do not collide. The generated consumer is * module-private; `usePopover()` consults it internally. Fallback is * `{ adapter: undefined }`, so zero-config matches today's `V0PopoverAdapter` * default. * * @example * ```ts * import { createPopoverPlugin } from '@vuetify/v0' * import { FloatingUIPopoverAdapter } from '@vuetify/v0/popover/adapters/floating-ui' * * app.use(createPopoverPlugin({ adapter: new FloatingUIPopoverAdapter() })) * ``` */ declare const createPopoverContext: <_E extends PopoverPluginContext = PopoverPluginContext>(_options?: PopoverPluginOptions | undefined) => ContextTrinity<_E>, createPopoverPlugin: (_options?: (PopoverPluginOptions & Pick<{ namespace?: string; persist?: boolean; devtools?: boolean; }, "devtools">) | undefined) => Plugin; declare function usePopover(options?: PopoverOptions): PopoverReturn; //#endregion export { PopoverAdapter, type PopoverAdapterContext, type PopoverAlign, PopoverOptions, type PopoverPlacement, PopoverPluginContext, PopoverPluginContextOptions, PopoverPluginOptions, PopoverReturn, type PopoverSide, V0PopoverAdapter, createPopoverContext, createPopoverFallback, createPopoverPlugin, toPlacement, usePopover };