feat: improve completions loading and UI handling

Refactor the completions system to support both CLI mode (via
`/__COMPLETIONS.json`) and a client-side fallback scan for dev mode.

- Implement client-side scanning of the file index for dice and headings
- Add `ensureCompletions` to allow components to await data readiness
- Update `JournalInput` to handle "no results" states in the dropdown
- Improve keyboard navigation (Tab to accept, Enter to select)
- Update dice regex to support `:md-dice[...]` syntax
This commit is contained in:
2026-07-06 17:13:11 +08:00
parent 4c5add2414
commit e0d61cf91e
3 changed files with 327 additions and 127 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ export const diceSource: CompletionSource = {
scan(index) {
const items: DiceCompletion[] = [];
const tagRegex = /<md-dice[^>]*>\s*([\s\S]*?)\s*<\/md-dice>/gi;
const tagRegex = /:md-dice\[([^[]+)\]/gi;
for (const [path, content] of Object.entries(index)) {
if (!path.endsWith(".md")) continue;