import { Effect, Option, Schema as S } from 'effect'; import * as Command from 'foldkit/command'; import type { ChildAttribute, Html } from 'foldkit/html'; import * as Mount from 'foldkit/mount'; import { type View as SubmodelView } from 'foldkit/submodel'; import * as Update from 'foldkit/update'; import { AnchorConfig } from '../anchor/index.js'; import { groupContiguous } from '../group.js'; import { resolveTypeaheadMatch } from '../typeahead.js'; /** Schema for the activation trigger: whether the user interacted via mouse or keyboard. */ export declare const ActivationTrigger: S.Literals; export type ActivationTrigger = typeof ActivationTrigger.Type; /** Schema for the menu component's state, tracking open/closed status, active item, activation trigger, and typeahead search. */ export declare const Model: S.Struct<{ readonly id: S.String; readonly isOpen: S.Boolean; readonly isAnimated: S.Boolean; readonly isModal: S.Boolean; readonly animation: S.Struct<{ readonly id: S.String; readonly isShowing: S.Boolean; readonly transitionState: S.Literals; }>; readonly maybeActiveItemIndex: S.Option; readonly activationTrigger: S.Literals; readonly searchQuery: S.String; readonly searchVersion: S.Number; readonly maybeLastPointerPosition: S.Option>; readonly maybeLastButtonPointerType: S.Option; readonly maybePointerOrigin: S.Option>; }>; export type Model = typeof Model.Type; /** Union of all messages the menu component can produce. */ export declare const Message: import("foldkit/message").MessageUnion<{ readonly Opened: { readonly maybeActiveItemIndex: S.Option; }; readonly Closed: {}; readonly BlurredItems: {}; readonly ActivatedItem: { readonly index: S.Number; readonly activationTrigger: S.Literals; }; readonly DeactivatedItem: {}; readonly SelectedItem: { readonly index: S.Number; readonly item: S.String; }; readonly RequestedItemClick: { readonly index: S.Number; }; readonly Searched: { readonly key: S.String; readonly maybeTargetIndex: S.Option; }; readonly CompletedDelayClearSearch: { readonly version: S.Number; }; readonly MovedPointerOverItem: { readonly index: S.Number; readonly screenX: S.Number; readonly screenY: S.Number; }; readonly CompletedFocusItems: {}; readonly CompletedFocusButton: {}; readonly CompletedLockScroll: {}; readonly CompletedUnlockScroll: {}; readonly CompletedInertOthers: {}; readonly CompletedRestoreInert: {}; readonly CompletedScrollIntoView: {}; readonly CompletedClickItem: {}; readonly IgnoredMouseClick: {}; readonly SuppressedSpaceScroll: {}; readonly CompletedAnchorMenu: {}; readonly CompletedPortalMenuBackdrop: {}; readonly GotAnimationMessage: { readonly message: import("foldkit/message").MessageUnion<{ readonly Showed: {}; readonly Hid: {}; readonly CompletedWaitForPaint: {}; readonly EndedAnimation: {}; }>; }; readonly PressedPointerOnButton: { readonly pointerType: S.String; readonly button: S.Number; readonly screenX: S.Number; readonly screenY: S.Number; readonly timeStamp: S.Number; }; readonly ReleasedPointerOnItems: { readonly screenX: S.Number; readonly screenY: S.Number; readonly timeStamp: S.Number; }; }>; export type Message = typeof Message.Type; /** Union of OutMessages the menu component can produce. The parent's * `Update.foldChild` config handles them through `foldOutMessage`. */ export declare const OutMessage: import("foldkit/message").MessageUnion<{ readonly Selected: { readonly value: S.String; readonly index: S.Number; }; }>; export type Selected = Readonly<{ readonly _tag: 'Selected'; readonly value: Value; readonly index: number; }>; /** Generic over `Value extends string` so consumers using the typed * `Menu.create()` factory receive `value: MyUnion` in the * `Selected` OutMessage. Defaults to `string`. */ export type OutMessage = Selected; export type Opened = typeof Message.Opened.Type; export type Closed = typeof Message.Closed.Type; export type BlurredItems = typeof Message.BlurredItems.Type; export type ActivatedItem = typeof Message.ActivatedItem.Type; export type DeactivatedItem = typeof Message.DeactivatedItem.Type; export type SelectedItem = typeof Message.SelectedItem.Type; export type MovedPointerOverItem = typeof Message.MovedPointerOverItem.Type; export type RequestedItemClick = typeof Message.RequestedItemClick.Type; export type Searched = typeof Message.Searched.Type; export type CompletedDelayClearSearch = typeof Message.CompletedDelayClearSearch.Type; export type IgnoredMouseClick = typeof Message.IgnoredMouseClick.Type; export type SuppressedSpaceScroll = typeof Message.SuppressedSpaceScroll.Type; export type PressedPointerOnButton = typeof Message.PressedPointerOnButton.Type; export type ReleasedPointerOnItems = typeof Message.ReleasedPointerOnItems.Type; /** Configuration for creating a menu model with `init`. `isAnimated` enables animation coordination (default `false`). `isModal` locks page scroll and inerts other elements when open (default `false`). */ export type InitConfig = Readonly<{ id: string; isAnimated?: boolean; isModal?: boolean; }>; /** Creates an initial menu model from a config. Defaults to closed with no active item. */ export declare const init: (config: InitConfig) => Model; /** Returns the bare DOM id of the menu trigger button, derived from the * menu's base id. Use this to associate an external label with the trigger * via a native `