Skip to content
Loamis build console Read only

palette

READ ONLY: generated from the specification

2 states, 7 events, 10 rules. Initial state: closed.

Transition graph

closedopen

Double outline: the initial state. Dashed line and ◆: the rule has a guard.

Transitions, as a list

  1. closed, on shortcut, to open, guarded: event.key == ctx.openKey and (event.meta == true or event.ctrl == true)
  2. open, on shortcut, to closed, guarded: event.key == ctx.openKey and (event.meta == true or event.ctrl == true)
  3. open, on type, to open, guarded: event.resultCount >= 0
  4. open, on next, to open, guarded: ctx.activeIndex + 1 < ctx.resultCount
  5. open, on next, to open, guarded: ctx.resultCount > 0
  6. open, on prev, to open, guarded: ctx.activeIndex > 0
  7. open, on prev, to open, guarded: ctx.resultCount > 0
  8. open, on activate, to closed, guarded: ctx.resultCount > 0
  9. open, on escape, to closed
  10. open, on blur, to closed

Live runner

Current state: closed

text; the machine samples "k", "j"

text; the machine samples "", "a"

a whole number; the machine samples 0, 1, 3, -1

text; the machine samples "x", "y"

Context

query
""
resultCount
0
activeIndex
0
openKey
"k"

View flags now

ariaExpanded
false
showPalette
false
inputEnabled
false
showResults
false
showEmpty
false
canActivate
false
canNext
false
canPrev
false
query
""
resultCount
0
activeIndex
0
defaultFocus
"origin"

Effects emitted

None.

Trace

No event sent yet.

States

closed

initial

View flags

ariaExpanded
false
showPalette
false
inputEnabled
false
showResults
false
showEmpty
false
canActivate
false
canNext
false
canPrev
false
query
""
resultCount
0
activeIndex
0
defaultFocus
"origin"

Rules that leave it

  1. shortcut to open when event.key == ctx.openKey and (event.meta == true or event.ctrl == true) ; sets query := "", resultCount := 0, activeIndex := 0 ; emits focusInput()

open

View flags

ariaExpanded
true
showPalette
true
inputEnabled
true
showResults
false
showEmpty
true
canActivate
false
canNext
false
canPrev
false
query
""
resultCount
0
activeIndex
0
defaultFocus
"input"

Rules that leave it

  1. shortcut to closed when event.key == ctx.openKey and (event.meta == true or event.ctrl == true) ; emits restoreFocus(), closed()
  2. type to open when event.resultCount >= 0 ; sets query := event.text, resultCount := event.resultCount, activeIndex := 0
  3. next to open when ctx.activeIndex + 1 < ctx.resultCount ; sets activeIndex += 1
  4. next to open when ctx.resultCount > 0 ; sets activeIndex := 0
  5. prev to open when ctx.activeIndex > 0 ; sets activeIndex -= 1
  6. prev to open when ctx.resultCount > 0 ; sets activeIndex := ctx.resultCount - 1
  7. activate to closed when ctx.resultCount > 0 ; emits navigate(event.to), closed()
  8. escape to closed ; emits restoreFocus(), closed()
  9. blur to closed ; emits closed()
All machines