Mixins / foldkit-mixins-ui
CommandSlots
const · packages/mixins-ui/src/command/slots.ts:23
const CommandSlots: Slots.Contract<{ readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly search: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly crumbs: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly crumb: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly input: Slot.UnnamedSlot<Capability.Capability<"Focusable", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [Event.EventToken<"input">, Event.EventToken<"keydown">], readonly [Attr.AttrToken<"role">, Attr.AttrToken<"aria-expanded">], readonly Slot.RequirementName[], boolean>; readonly list: Slot.UnnamedSlot<Cap …;A command menu, shadcn's Command and Fluid Functionalism's CommandMenu: a
search field that keeps focus while the keys move through the rows and
points at the highlighted one through aria-activedescendant, over a list
of grouped rows. (A press on a row runs it; foldkit has no default-preventing
mousedown to keep the field focused through the press, so a menu that stays
open after a pressed row refocuses its field in the Command onRun starts.) ↑ and ↓
wrap through the enabled rows, Enter runs the highlighted one, a press
runs the one pressed, and the pointer moves the highlight. Rows never
re-sort as the query grows, so nothing moves under the pointer; whenever
the highlighted row is filtered away, the first enabled row takes it, so
Enter always has a target. The query, the highlighted value and the page
are the application's; filtered is what the view shows for a query.
Nested pages are the application's too: a row that opensPage steps in
when run (the application pushes the page and clears the query), and
Backspace in an empty field sends page.onBack. In a dialog, hotkey
opens it on ⌘K or Ctrl+K, and the Dialog component draws it: the field,
the first thing in the panel that takes focus, has it when it opens.