Find: jump to a card or a project

What the board's find field (board #4048) offers as you type: the card a number names (4001 or #4001, in any project), the cards whose title holds every word you typed, then those whose body does, then those with only some of the words; and the projects whose name holds them. Open cards rank above closed ones, closed above archived, and newer above older within each. findHits reads only; the board turns each hit into a palette row, and choosing one goes there.

import { MemoryLog, VirtaStore, findHits } from 'tosijs-virta'

const store = new VirtaStore({ log: new MemoryLog(), identity: 'me' })
await store.load()
await store.create({ title: 'port the tests', tags: ['project:demo'] })
await store.create({ title: 'write the docs', body: 'after the tests' })
preview.textContent = [
  findHits(store, '#1').map((h) => h.title),
  findHits(store, 'tests').map((h) => h.title),
  findHits(store, 'dem').map((h) => `${h.kind} ${h.title}`),
].join('\n')
test('a number, words in a title then a body, a project name', () => {
  const [num, words, project] = preview.textContent.split('\n')
  expect(num).toBe('port the tests')
  expect(words).toBe('port the tests,write the docs')
  expect(project).toBe('project demo')
})