bits-ui
Version:
The headless components for Svelte.
91 lines (90 loc) • 3.59 kB
TypeScript
import { DOMContext, type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
import type { BitsFocusEvent, BitsPointerEvent, OnChangeFn, RefAttachment, WithRefOpts } from "../../internal/types.js";
interface LinkPreviewRootStateOpts extends WritableBoxedValues<{
open: boolean;
}>, ReadableBoxedValues<{
openDelay: number;
closeDelay: number;
onOpenChangeComplete: OnChangeFn<boolean>;
}> {
}
export declare class LinkPreviewRootState {
static create(opts: LinkPreviewRootStateOpts): LinkPreviewRootState;
readonly opts: LinkPreviewRootStateOpts;
hasSelection: boolean;
isPointerDownOnContent: boolean;
containsSelection: boolean;
timeout: number | null;
contentNode: HTMLElement | null;
contentMounted: boolean;
triggerNode: HTMLElement | null;
isOpening: boolean;
domContext: DOMContext;
constructor(opts: LinkPreviewRootStateOpts);
clearTimeout(): void;
handleOpen(): void;
immediateClose(): void;
handleClose(): void;
}
interface LinkPreviewTriggerStateOpts extends WithRefOpts {
}
export declare class LinkPreviewTriggerState {
static create(opts: LinkPreviewTriggerStateOpts): LinkPreviewTriggerState;
readonly opts: LinkPreviewTriggerStateOpts;
readonly root: LinkPreviewRootState;
readonly attachment: RefAttachment;
constructor(opts: LinkPreviewTriggerStateOpts, root: LinkPreviewRootState);
onpointerenter(e: BitsPointerEvent): void;
onpointerleave(e: BitsPointerEvent): void;
onfocus(e: BitsFocusEvent): void;
onblur(_: BitsFocusEvent): void;
readonly props: {
readonly id: string;
readonly "aria-haspopup": "dialog";
readonly "aria-expanded": "true" | "false";
readonly "data-state": "open" | "closed";
readonly "aria-controls": string | undefined;
readonly role: "button";
readonly onpointerenter: (e: BitsPointerEvent) => void;
readonly onfocus: (e: BitsFocusEvent) => void;
readonly onblur: (_: BitsFocusEvent) => void;
readonly onpointerleave: (e: BitsPointerEvent) => void;
};
}
interface LinkPreviewContentStateOpts extends WithRefOpts, ReadableBoxedValues<{
onInteractOutside: (e: PointerEvent) => void;
onEscapeKeydown: (e: KeyboardEvent) => void;
}> {
}
export declare class LinkPreviewContentState {
static create(opts: LinkPreviewContentStateOpts): LinkPreviewContentState;
readonly opts: LinkPreviewContentStateOpts;
readonly root: LinkPreviewRootState;
readonly attachment: RefAttachment;
constructor(opts: LinkPreviewContentStateOpts, root: LinkPreviewRootState);
onpointerdown(e: BitsPointerEvent): void;
onpointerenter(e: BitsPointerEvent): void;
onfocusout(e: BitsFocusEvent): void;
onInteractOutside: (e: PointerEvent) => void;
onEscapeKeydown: (e: KeyboardEvent) => void;
onOpenAutoFocus: (e: Event) => void;
onCloseAutoFocus: (e: Event) => void;
readonly snippetProps: {
open: boolean;
};
readonly props: {
readonly id: string;
readonly tabindex: -1;
readonly "data-state": "open" | "closed";
readonly onpointerdown: (e: BitsPointerEvent) => void;
readonly onpointerenter: (e: BitsPointerEvent) => void;
readonly onfocusout: (e: BitsFocusEvent) => void;
};
readonly popperProps: {
onInteractOutside: (e: PointerEvent) => void;
onEscapeKeydown: (e: KeyboardEvent) => void;
onOpenAutoFocus: (e: Event) => void;
onCloseAutoFocus: (e: Event) => void;
};
}
export {};