Skip to main content
On this pageConstants

Ui/Menu/test

Constants

AnchorMenu

constsource
/**
 * The anchor-positioning Mount this Menu renders on its panel. The panel is
 *  always anchored to the button via Floating UI and portaled to the document
 *  body, or into the enclosing `<dialog>` when there is one (opt out of
 *  portaling with `anchor.portal: false`), so it escapes ancestor stacking
 *  contexts and overflow clipping.
 * 
 *  It also carries the open-focus for the anchored panel. An anchored panel
 *  renders `visibility: hidden` until Floating UI resolves its first position,
 *  and `.focus()` does not land on a hidden element, so `FocusMenuItems` alone
 *  cannot focus it. `focusAfterPosition` focuses the panel as part of that
 *  first reveal. `FocusMenuItems` still focuses the panel when no anchor is
 *  configured, where the panel is visible as soon as the render commits.
 * 
 *  Exposed so Scene tests can call
 *  `Scene.Mount.resolve(AnchorMenu, Message.CompletedAnchorMenu())`.
 */
const AnchorMenu: LayeredMountDefinitionWithArgs<"Menu/AnchorMenu", {
  anchor: Struct<{
    gap: optional<Number>
    isPlacementLocked: optional<Boolean>
    offset: optional<Number>
    padding: optional<Union<readonly [
      Number,
      Struct<{
        bottom: optionalKey<unknown>
        left: optionalKey<unknown>
        right: optionalKey<unknown>
        top: optionalKey<unknown>
      }>
    ]>>
    placement: optional<Literals<readonly ["top", "right", "bottom", "left", "top-start", "top-end", "right-start", "right-end", "bottom-start", "bottom-end", "left-start", "left-end"]>>
    portal: optional<Boolean>
  }>
  buttonId: String
}, {
  _tag: "CompletedAnchorMenu"
}> & Readonly<{
  layer: Layer<Handler<"Menu/AnchorMenu", Readonly<{
    element: Element
    viewStateChanges: Stream<"Live" | "Paused">
  }> & {
    anchor: Anchor.AnchorConfig
    buttonId: string
  }, {
    _tag: "CompletedAnchorMenu"
  }>, never, never>
}>

ClickMenuItem

constsource
/** Programmatically clicks the active menu item's DOM element. */
const ClickMenuItem: LayeredCommandDefinitionWithArgs<"Menu/ClickMenuItem", {
  id: String
  index: Number
}, {
  _tag: "CompletedClickMenuItem"
}> | DefinitionWithArgsNameKeyed<"Menu/ClickMenuItem", {
  id: String
  index: Number
}, Effect<{
  _tag: "CompletedClickMenuItem"
}, never, Handler<"Menu/ClickMenuItem", {
  id: string
  index: number
}, {
  _tag: "CompletedClickMenuItem"
}>>> | DefinitionWithArgs<"Menu/ClickMenuItem", {
  id: String
  index: Number
}, Pick<{
  id: string
  index: number
}, "id" | "index">, Effect<{
  _tag: "CompletedClickMenuItem"
}, never, Handler<"Menu/ClickMenuItem", {
  id: string
  index: number
}, {
  _tag: "CompletedClickMenuItem"
}>>> & Readonly<{
  layer: Layer<Handler<"Menu/ClickMenuItem", {
    id: string
    index: number
  }, {
    _tag: "CompletedClickMenuItem"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/ClickMenuItem", {
    id: string
    index: number
  }, {
    _tag: "CompletedClickMenuItem"
  }>
}>

DelayClearMenuSearch

constsource
/** Waits for the typeahead search debounce period before clearing the query. */
const DelayClearMenuSearch: LayeredCommandDefinitionWithArgs<"Menu/DelayClearMenuSearch", {
  version: Number
}, {
  _tag: "CompletedDelayClearMenuSearch"
  version: number
}> | DefinitionWithArgsNameKeyed<"Menu/DelayClearMenuSearch", {
  version: Number
}, Effect<{
  _tag: "CompletedDelayClearMenuSearch"
  version: number
}, never, Handler<"Menu/DelayClearMenuSearch", {
  version: number
}, {
  _tag: "CompletedDelayClearMenuSearch"
  version: number
}>>> | DefinitionWithArgs<"Menu/DelayClearMenuSearch", {
  version: Number
}, Pick<{
  version: number
}, "version">, Effect<{
  _tag: "CompletedDelayClearMenuSearch"
  version: number
}, never, Handler<"Menu/DelayClearMenuSearch", {
  version: number
}, {
  _tag: "CompletedDelayClearMenuSearch"
  version: number
}>>> & Readonly<{
  layer: Layer<Handler<"Menu/DelayClearMenuSearch", {
    version: number
  }, {
    _tag: "CompletedDelayClearMenuSearch"
    version: number
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/DelayClearMenuSearch", {
    version: number
  }, {
    _tag: "CompletedDelayClearMenuSearch"
    version: number
  }>
}>

DetectMenuMovementOrAnimationEnd

constsource
/** Detects whether the menu button moved or the leave animation ended. Whichever comes first; both outcomes signal the Animation block that leave is complete. */
const DetectMenuMovementOrAnimationEnd: LayeredCommandDefinitionWithArgs<"Menu/DetectMenuMovementOrAnimationEnd", {
  generation: Number
  id: String
}, {
  _tag: "CompletedDetectMenuMovementOrAnimationEnd"
  generation: number
}> | DefinitionWithArgsNameKeyed<"Menu/DetectMenuMovementOrAnimationEnd", {
  generation: Number
  id: String
}, Effect<{
  _tag: "CompletedDetectMenuMovementOrAnimationEnd"
  generation: number
}, never, Handler<"Menu/DetectMenuMovementOrAnimationEnd", {
  generation: number
  id: string
}, {
  _tag: "CompletedDetectMenuMovementOrAnimationEnd"
  generation: number
}>>> | DefinitionWithArgs<"Menu/DetectMenuMovementOrAnimationEnd", {
  generation: Number
  id: String
}, Pick<{
  generation: number
  id: string
}, "id" | "generation">, Effect<{
  _tag: "CompletedDetectMenuMovementOrAnimationEnd"
  generation: number
}, never, Handler<"Menu/DetectMenuMovementOrAnimationEnd", {
  generation: number
  id: string
}, {
  _tag: "CompletedDetectMenuMovementOrAnimationEnd"
  generation: number
}>>> & Readonly<{
  layer: Layer<Handler<"Menu/DetectMenuMovementOrAnimationEnd", {
    generation: number
    id: string
  }, {
    _tag: "CompletedDetectMenuMovementOrAnimationEnd"
    generation: number
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/DetectMenuMovementOrAnimationEnd", {
    generation: number
    id: string
  }, {
    _tag: "CompletedDetectMenuMovementOrAnimationEnd"
    generation: number
  }>
}>

FocusMenuButton

constsource
/** Moves focus back to the menu button after closing. */
const FocusMenuButton: LayeredCommandDefinitionWithArgs<"Menu/FocusMenuButton", {
  id: String
}, {
  _tag: "CompletedFocusMenuButton"
}> | DefinitionWithArgsNameKeyed<"Menu/FocusMenuButton", {
  id: String
}, Effect<{
  _tag: "CompletedFocusMenuButton"
}, never, Handler<"Menu/FocusMenuButton", {
  id: string
}, {
  _tag: "CompletedFocusMenuButton"
}>>> | DefinitionWithArgs<"Menu/FocusMenuButton", {
  id: String
}, Pick<{
  id: string
}, "id">, Effect<{
  _tag: "CompletedFocusMenuButton"
}, never, Handler<"Menu/FocusMenuButton", {
  id: string
}, {
  _tag: "CompletedFocusMenuButton"
}>>> & Readonly<{
  layer: Layer<Handler<"Menu/FocusMenuButton", {
    id: string
  }, {
    _tag: "CompletedFocusMenuButton"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/FocusMenuButton", {
    id: string
  }, {
    _tag: "CompletedFocusMenuButton"
  }>
}>

FocusMenuItems

constsource
/** Moves focus to the menu items container after opening. */
const FocusMenuItems: LayeredCommandDefinitionWithArgs<"Menu/FocusMenuItems", {
  id: String
}, {
  _tag: "CompletedFocusMenuItems"
}> | DefinitionWithArgsNameKeyed<"Menu/FocusMenuItems", {
  id: String
}, Effect<{
  _tag: "CompletedFocusMenuItems"
}, never, Handler<"Menu/FocusMenuItems", {
  id: string
}, {
  _tag: "CompletedFocusMenuItems"
}>>> | DefinitionWithArgs<"Menu/FocusMenuItems", {
  id: String
}, Pick<{
  id: string
}, "id">, Effect<{
  _tag: "CompletedFocusMenuItems"
}, never, Handler<"Menu/FocusMenuItems", {
  id: string
}, {
  _tag: "CompletedFocusMenuItems"
}>>> & Readonly<{
  layer: Layer<Handler<"Menu/FocusMenuItems", {
    id: string
  }, {
    _tag: "CompletedFocusMenuItems"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/FocusMenuItems", {
    id: string
  }, {
    _tag: "CompletedFocusMenuItems"
  }>
}>

InertMenuOthers

constsource
/** Marks all elements outside the menu as inert for modal behavior. */
const InertMenuOthers: LayeredCommandDefinitionWithArgs<"Menu/InertMenuOthers", {
  id: String
}, {
  _tag: "CompletedInertMenuOthers"
}> | DefinitionWithArgsNameKeyed<"Menu/InertMenuOthers", {
  id: String
}, Effect<{
  _tag: "CompletedInertMenuOthers"
}, never, Handler<"Menu/InertMenuOthers", {
  id: string
}, {
  _tag: "CompletedInertMenuOthers"
}>>> | DefinitionWithArgs<"Menu/InertMenuOthers", {
  id: String
}, Pick<{
  id: string
}, "id">, Effect<{
  _tag: "CompletedInertMenuOthers"
}, never, Handler<"Menu/InertMenuOthers", {
  id: string
}, {
  _tag: "CompletedInertMenuOthers"
}>>> & Readonly<{
  layer: Layer<Handler<"Menu/InertMenuOthers", {
    id: string
  }, {
    _tag: "CompletedInertMenuOthers"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/InertMenuOthers", {
    id: string
  }, {
    _tag: "CompletedInertMenuOthers"
  }>
}>

LockMenuScroll

constsource
/** Prevents page scrolling while the menu is open. */
const LockMenuScroll: LayeredCommandDefinitionNoArgs<"Menu/LockMenuScroll", {
  _tag: "CompletedLockMenuScroll"
}> | DefinitionNoArgs<"Menu/LockMenuScroll", Effect<{
  _tag: "CompletedLockMenuScroll"
}, never, Handler<"Menu/LockMenuScroll", void, {
  _tag: "CompletedLockMenuScroll"
}>>> & Readonly<{
  toLayer: ToLayer<"Menu/LockMenuScroll", void, {
    _tag: "CompletedLockMenuScroll"
  }>
}> & Readonly<{
  layer: Layer<Handler<"Menu/LockMenuScroll", void, {
    _tag: "CompletedLockMenuScroll"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/LockMenuScroll", void, {
    _tag: "CompletedLockMenuScroll"
  }>
}>

PortalMenuBackdrop

constsource
/**
 * The backdrop-portaling Mount this Menu renders. Exposed so Scene tests can
 *  call `Scene.Mount.resolve(PortalMenuBackdrop, Message.CompletedPortalMenuBackdrop())` to
 *  acknowledge the mount produced by the rendered backdrop.
 */
const PortalMenuBackdrop: LayeredMountDefinitionNoArgs<"Menu/PortalMenuBackdrop", {
  _tag: "CompletedPortalMenuBackdrop"
}> & Readonly<{
  layer: Layer<Handler<"Menu/PortalMenuBackdrop", Readonly<{
    element: Element
    viewStateChanges: Stream<"Live" | "Paused">
  }>, {
    _tag: "CompletedPortalMenuBackdrop"
  }>, never, never>
}>

RestoreMenuInert

constsource
/** Removes the inert attribute from elements outside the Menu. */
const RestoreMenuInert: LayeredCommandDefinitionWithArgs<"Menu/RestoreMenuInert", {
  id: String
}, {
  _tag: "CompletedRestoreMenuInert"
}> | DefinitionWithArgsNameKeyed<"Menu/RestoreMenuInert", {
  id: String
}, Effect<{
  _tag: "CompletedRestoreMenuInert"
}, never, Handler<"Menu/RestoreMenuInert", {
  id: string
}, {
  _tag: "CompletedRestoreMenuInert"
}>>> | DefinitionWithArgs<"Menu/RestoreMenuInert", {
  id: String
}, Pick<{
  id: string
}, "id">, Effect<{
  _tag: "CompletedRestoreMenuInert"
}, never, Handler<"Menu/RestoreMenuInert", {
  id: string
}, {
  _tag: "CompletedRestoreMenuInert"
}>>> & Readonly<{
  layer: Layer<Handler<"Menu/RestoreMenuInert", {
    id: string
  }, {
    _tag: "CompletedRestoreMenuInert"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/RestoreMenuInert", {
    id: string
  }, {
    _tag: "CompletedRestoreMenuInert"
  }>
}>

ScrollMenuItemIntoView

constsource
/** Scrolls the active menu item into view after keyboard navigation. */
const ScrollMenuItemIntoView: LayeredCommandDefinitionWithArgs<"Menu/ScrollMenuItemIntoView", {
  id: String
  index: Number
}, {
  _tag: "CompletedScrollMenuItemIntoView"
}> | DefinitionWithArgsNameKeyed<"Menu/ScrollMenuItemIntoView", {
  id: String
  index: Number
}, Effect<{
  _tag: "CompletedScrollMenuItemIntoView"
}, never, Handler<"Menu/ScrollMenuItemIntoView", {
  id: string
  index: number
}, {
  _tag: "CompletedScrollMenuItemIntoView"
}>>> | DefinitionWithArgs<"Menu/ScrollMenuItemIntoView", {
  id: String
  index: Number
}, Pick<{
  id: string
  index: number
}, "id" | "index">, Effect<{
  _tag: "CompletedScrollMenuItemIntoView"
}, never, Handler<"Menu/ScrollMenuItemIntoView", {
  id: string
  index: number
}, {
  _tag: "CompletedScrollMenuItemIntoView"
}>>> & Readonly<{
  layer: Layer<Handler<"Menu/ScrollMenuItemIntoView", {
    id: string
    index: number
  }, {
    _tag: "CompletedScrollMenuItemIntoView"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/ScrollMenuItemIntoView", {
    id: string
    index: number
  }, {
    _tag: "CompletedScrollMenuItemIntoView"
  }>
}>

UnlockMenuScroll

constsource
/** Re-enables page scrolling after the menu closes. */
const UnlockMenuScroll: LayeredCommandDefinitionNoArgs<"Menu/UnlockMenuScroll", {
  _tag: "CompletedUnlockMenuScroll"
}> | DefinitionNoArgs<"Menu/UnlockMenuScroll", Effect<{
  _tag: "CompletedUnlockMenuScroll"
}, never, Handler<"Menu/UnlockMenuScroll", void, {
  _tag: "CompletedUnlockMenuScroll"
}>>> & Readonly<{
  toLayer: ToLayer<"Menu/UnlockMenuScroll", void, {
    _tag: "CompletedUnlockMenuScroll"
  }>
}> & Readonly<{
  layer: Layer<Handler<"Menu/UnlockMenuScroll", void, {
    _tag: "CompletedUnlockMenuScroll"
  }>, never, never>
}> & Readonly<{
  toLayer: ToLayer<"Menu/UnlockMenuScroll", void, {
    _tag: "CompletedUnlockMenuScroll"
  }>
}>