DevactionUI.CommandPalette (devaction_ui v0.1.0)

Copy Markdown View Source

The ⌘K palette as a library piece: a dialog near the top with a large field, an optional row of scopes (all, pull requests, tasks...), the results in groups with their hints, an "ask the AI" action with the typed text and a footer that teaches the keys. ↑ ↓ move the active row, ↵ opens it, ⌘↵ asks the AI and Esc closes it.

The server owns the search, as in DevactionUI.Autocomplete (whose keyboard hook it shares and whose groups it takes). The LiveView decides when it is there (:if={@open}); it takes the focus in and keeps it inside.

Summary

Functions

palette(assigns)

Attributes

  • id (:string) (required)
  • label (:string) (required) - the name of the dialog, for assistive technology.
  • query (:string) - Defaults to "".
  • placeholder (:string) - Defaults to nil.
  • search_event (:string) (required) - sent with the text, debounced.
  • close_event (:string) (required)
  • groups (:list) - as in Autocomplete: %{label, items: [%{id, label, to, hint, tone}]}. Defaults to [].
  • empty (:string) (required)
  • ask_label (:string) - Defaults to nil.
  • ask_event (:string) - Defaults to nil.
  • scopes (:list) - %{value, label} each; none draws no row. Defaults to [].
  • scope (:string) - Defaults to nil.
  • scope_event (:string) - Defaults to nil.
  • scope_label (:string) - Defaults to nil.
  • keys (:list) - {keys, what} for the footer: {"↑↓", "move"}. Defaults to [].
  • Global attributes are accepted.

Slots

  • search_icon