Documentation navigation

Published API · 0.1.0-rc.1

foldkit-ui · hoverIntent

Published foldkit-ui API declarations for hoverIntent.

./hoverIntent

@wsagency/wseffect-foldkit-ui · MIT · source · MIT license · WS-AGENCY-NOTICE · THIRD-PARTY-NOTICES

This entry point is published in @wsagency/wseffect-foldkit-ui@0.1.0-rc.1. Import it from the package subpath shown below; the signatures and documentation are read from the installed package declarations.

import * as Wseffect from '@wsagency/wseffect-foldkit-ui/hoverIntent'

Exported declarations

BlurredPanel

export type BlurredPanel = typeof Message.BlurredPanel.Type;

BlurredTrigger

export type BlurredTrigger = typeof Message.BlurredTrigger.Type;

close

Programmatically closes HoverIntent immediately, invalidating pending transitions and suppressing reopening until the trigger disengages.

close: (model: Model) => UpdateReturn

Closed

export type Closed = typeof OutMessage.Closed.Type;

CompletedWaitBeforeClosing

export type CompletedWaitBeforeClosing = typeof Message.CompletedWaitBeforeClosing.Type;

CompletedWaitBeforeOpening

export type CompletedWaitBeforeOpening = typeof Message.CompletedWaitBeforeOpening.Type;

EnteredPanel

export type EnteredPanel = typeof Message.EnteredPanel.Type;

EnteredTrigger

export type EnteredTrigger = typeof Message.EnteredTrigger.Type;

FocusedPanel

export type FocusedPanel = typeof Message.FocusedPanel.Type;

FocusedTrigger

export type FocusedTrigger = typeof Message.FocusedTrigger.Type;

init

Creates a HoverIntent Model. Pointer entry opens after 200 milliseconds and pointer departure closes after a 300-millisecond grace period by default. Focus entry opens immediately, and focus departure closes without that pointer grace period.

init: (config?: InitConfig) => Model

InitConfig

Configuration for creating a HoverIntent Model.

export type InitConfig = Readonly<{
    openDelay?: Duration.Input;
    closeDelay?: Duration.Input;
}>;

LeftPanel

export type LeftPanel = typeof Message.LeftPanel.Type;

LeftTrigger

export type LeftTrigger = typeof Message.LeftTrigger.Type;

Message

export type Message = typeof Message.Type;

Message

Union of all Messages the HoverIntent component can produce.

Message: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
    readonly EnteredTrigger: {};
    readonly LeftTrigger: {};
    readonly EnteredPanel: {};
    readonly LeftPanel: {};
    readonly FocusedTrigger: {};
    readonly BlurredTrigger: {};
    readonly FocusedPanel: {};
    readonly BlurredPanel: {};
    readonly PressedEscape: {
        source: Schema.Literals<readonly ["Trigger", "Panel"]>;
    };
    readonly CompletedWaitBeforeOpening: {
        version: Schema.Number;
    };
    readonly CompletedWaitBeforeClosing: {
        version: Schema.Number;
    };
}>

Model

export type Model = typeof Model.Type;

Model

Schema for HoverIntent state. It tracks pointer and focus engagement over a trigger and its panel, visibility, delay timers, and Escape dismissal.

Model: Schema.Struct<{
    readonly isOpen: Schema.Boolean;
    readonly isTriggerHovered: Schema.Boolean;
    readonly isPanelHovered: Schema.Boolean;
    readonly maybeFocusLocation: Schema.Option<Schema.Literals<readonly ["Trigger", "Panel"]>>;
    readonly isDismissed: Schema.Boolean;
    readonly openDelay: Schema.DurationFromMillis;
    readonly closeDelay: Schema.DurationFromMillis;
    readonly pendingOpenVersion: Schema.Number;
    readonly pendingCloseVersion: Schema.Number;
}>

Opened

export type Opened = typeof OutMessage.Opened.Type;

OutMessage

export type OutMessage = typeof OutMessage.Type;

OutMessage

Union of visibility-transition OutMessages emitted by HoverIntent.

OutMessage: import("@wsagency/wseffect-foldkit/message").MessageUnion<{
    readonly Opened: {};
    readonly Closed: {};
}>

PressedEscape

export type PressedEscape = typeof Message.PressedEscape.Type;

RenderInfo

Render-time payload published to the consumer's `toView`. - `trigger`: event attributes for the element that starts intent. - `panel`: event attributes for the element that remains open while hovered or focused. - `isVisible`: whether the consumer should render its panel.

export type RenderInfo = Readonly<{
    trigger: ReadonlyArray<ChildAttribute>;
    panel: ReadonlyArray<ChildAttribute>;
    isVisible: boolean;
}>;

update

Processes a HoverIntent Message and returns the next Model, optional Commands, and an optional OutMessage.

update: (model: Model, message: Message) => UpdateReturn

view

Renders headless HoverIntent event bundles. It owns no markup, ARIA semantics, positioning, or styling.

view: import("@wsagency/wseffect-foldkit/submodel").View<{
    readonly isOpen: boolean;
    readonly isTriggerHovered: boolean;
    readonly isPanelHovered: boolean;
    readonly maybeFocusLocation: Option.Option<"Panel" | "Trigger">;
    readonly isDismissed: boolean;
    readonly openDelay: Duration.Duration;
    readonly closeDelay: Duration.Duration;
    readonly pendingOpenVersion: number;
    readonly pendingCloseVersion: number;
}, {
    readonly _tag: "CompletedWaitBeforeOpening";
    readonly version: number;
} | {
    readonly _tag: "CompletedWaitBeforeClosing";
    readonly version: number;
} | {
    readonly _tag: "BlurredPanel";
} | {
    readonly _tag: "BlurredTrigger";
} | {
    readonly _tag: "EnteredPanel";
} | {
    readonly _tag: "EnteredTrigger";
} | {
    readonly _tag: "FocusedPanel";
} | {
    readonly _tag: "FocusedTrigger";
} | {
    readonly _tag: "LeftPanel";
} | {
    readonly _tag: "LeftTrigger";
} | {
    readonly _tag: "PressedEscape";
    readonly source: "Panel" | "Trigger";
}, Readonly<{
    /** Selector for the trigger to focus before Escape removes panel content. If it does not resolve to a focusable element, HoverIntent leaves fallback focus behavior to the browser. */
    focusTriggerSelector?: string;
    toView: (render: RenderInfo) => Html;
}>>

ViewInputs

Per-render view inputs passed to `view` via `h.submodel`'s `viewInputs` field.

export type ViewInputs = Readonly<{
    /** Selector for the trigger to focus before Escape removes panel content. If it does not resolve to a focusable element, HoverIntent leaves fallback focus behavior to the browser. */
    focusTriggerSelector?: string;
    toView: (render: RenderInfo) => Html;
}>;

WaitBeforeClosing

Waits before closing, then emits the version that scheduled the wait.

WaitBeforeClosing: Command.CommandDefinitionWithArgs<"WaitBeforeClosing", {
    delay: Schema.DurationFromMillis;
    version: Schema.Number;
}, Effect.Effect<{
    readonly _tag: "CompletedWaitBeforeClosing";
    readonly version: number;
}, never, never>>

WaitBeforeOpening

Waits before opening, then emits the version that scheduled the wait.

WaitBeforeOpening: Command.CommandDefinitionWithArgs<"WaitBeforeOpening", {
    delay: Schema.DurationFromMillis;
    version: Schema.Number;
}, Effect.Effect<{
    readonly _tag: "CompletedWaitBeforeOpening";
    readonly version: number;
}, never, never>>