(item: T | undefined)
| 56 | const keyFor = (item: T) => (local.value ? local.value(item) : (item as string)) |
| 57 | |
| 58 | const move = (item: T | undefined) => { |
| 59 | if (!local.onHighlight) return |
| 60 | if (!item) { |
| 61 | stop() |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | const key = keyFor(item) |
| 66 | if (state.key === key) return |
| 67 | state.cleanup?.() |
| 68 | state.cleanup = local.onHighlight(item) |
| 69 | state.key = key |
| 70 | } |
| 71 | |
| 72 | onCleanup(stop) |
| 73 |