chad-code 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -6
- package/package.json +36 -98
- package/AGENTS.md +0 -27
- package/Dockerfile +0 -18
- package/README.npm.md +0 -64
- package/bunfig.toml +0 -7
- package/eslint.config.js +0 -29
- package/parsers-config.ts +0 -253
- package/script/build.ts +0 -167
- package/script/publish-registries.ts +0 -187
- package/script/publish.ts +0 -93
- package/script/schema.ts +0 -47
- package/src/acp/README.md +0 -164
- package/src/acp/agent.ts +0 -1086
- package/src/acp/session.ts +0 -101
- package/src/acp/types.ts +0 -22
- package/src/agent/agent.ts +0 -253
- package/src/agent/generate.txt +0 -75
- package/src/agent/prompt/compaction.txt +0 -12
- package/src/agent/prompt/explore.txt +0 -18
- package/src/agent/prompt/summary.txt +0 -11
- package/src/agent/prompt/title.txt +0 -36
- package/src/auth/index.ts +0 -70
- package/src/bun/index.ts +0 -130
- package/src/bus/bus-event.ts +0 -43
- package/src/bus/global.ts +0 -10
- package/src/bus/index.ts +0 -105
- package/src/cli/bootstrap.ts +0 -17
- package/src/cli/cmd/acp.ts +0 -69
- package/src/cli/cmd/agent.ts +0 -257
- package/src/cli/cmd/auth.ts +0 -132
- package/src/cli/cmd/cmd.ts +0 -7
- package/src/cli/cmd/debug/agent.ts +0 -28
- package/src/cli/cmd/debug/config.ts +0 -15
- package/src/cli/cmd/debug/file.ts +0 -91
- package/src/cli/cmd/debug/index.ts +0 -45
- package/src/cli/cmd/debug/lsp.ts +0 -48
- package/src/cli/cmd/debug/ripgrep.ts +0 -83
- package/src/cli/cmd/debug/scrap.ts +0 -15
- package/src/cli/cmd/debug/skill.ts +0 -15
- package/src/cli/cmd/debug/snapshot.ts +0 -48
- package/src/cli/cmd/export.ts +0 -88
- package/src/cli/cmd/generate.ts +0 -38
- package/src/cli/cmd/github.ts +0 -32
- package/src/cli/cmd/import.ts +0 -98
- package/src/cli/cmd/mcp.ts +0 -670
- package/src/cli/cmd/models.ts +0 -42
- package/src/cli/cmd/pr.ts +0 -112
- package/src/cli/cmd/run.ts +0 -374
- package/src/cli/cmd/serve.ts +0 -16
- package/src/cli/cmd/session.ts +0 -135
- package/src/cli/cmd/stats.ts +0 -402
- package/src/cli/cmd/tui/app.tsx +0 -705
- package/src/cli/cmd/tui/attach.ts +0 -32
- package/src/cli/cmd/tui/component/border.tsx +0 -21
- package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-command.tsx +0 -124
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-model.tsx +0 -232
- package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -228
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -115
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-status.tsx +0 -162
- package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
- package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
- package/src/cli/cmd/tui/component/did-you-know.tsx +0 -85
- package/src/cli/cmd/tui/component/logo.tsx +0 -43
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -654
- package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
- package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1078
- package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
- package/src/cli/cmd/tui/component/textarea-keybindings.ts +0 -73
- package/src/cli/cmd/tui/component/tips.ts +0 -92
- package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
- package/src/cli/cmd/tui/context/args.tsx +0 -14
- package/src/cli/cmd/tui/context/directory.ts +0 -13
- package/src/cli/cmd/tui/context/exit.tsx +0 -23
- package/src/cli/cmd/tui/context/helper.tsx +0 -25
- package/src/cli/cmd/tui/context/keybind.tsx +0 -101
- package/src/cli/cmd/tui/context/kv.tsx +0 -49
- package/src/cli/cmd/tui/context/local.tsx +0 -392
- package/src/cli/cmd/tui/context/prompt.tsx +0 -18
- package/src/cli/cmd/tui/context/route.tsx +0 -46
- package/src/cli/cmd/tui/context/sdk.tsx +0 -75
- package/src/cli/cmd/tui/context/sync.tsx +0 -384
- package/src/cli/cmd/tui/context/theme/aura.json +0 -69
- package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
- package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -233
- package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
- package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
- package/src/cli/cmd/tui/context/theme/chad.json +0 -245
- package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
- package/src/cli/cmd/tui/context/theme/cursor.json +0 -249
- package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
- package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
- package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
- package/src/cli/cmd/tui/context/theme/github.json +0 -233
- package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -95
- package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -227
- package/src/cli/cmd/tui/context/theme/material.json +0 -235
- package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
- package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
- package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
- package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
- package/src/cli/cmd/tui/context/theme/nord.json +0 -223
- package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
- package/src/cli/cmd/tui/context/theme/orng.json +0 -245
- package/src/cli/cmd/tui/context/theme/osaka-jade.json +0 -93
- package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
- package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
- package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
- package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
- package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
- package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
- package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
- package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
- package/src/cli/cmd/tui/context/theme.tsx +0 -1137
- package/src/cli/cmd/tui/event.ts +0 -46
- package/src/cli/cmd/tui/routes/home.tsx +0 -138
- package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -64
- package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -109
- package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
- package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
- package/src/cli/cmd/tui/routes/session/footer.tsx +0 -88
- package/src/cli/cmd/tui/routes/session/header.tsx +0 -125
- package/src/cli/cmd/tui/routes/session/index.tsx +0 -1814
- package/src/cli/cmd/tui/routes/session/permission.tsx +0 -416
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -318
- package/src/cli/cmd/tui/spawn.ts +0 -48
- package/src/cli/cmd/tui/thread.ts +0 -111
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -57
- package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -83
- package/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -204
- package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -38
- package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -77
- package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -345
- package/src/cli/cmd/tui/ui/dialog.tsx +0 -171
- package/src/cli/cmd/tui/ui/link.tsx +0 -28
- package/src/cli/cmd/tui/ui/spinner.ts +0 -368
- package/src/cli/cmd/tui/ui/toast.tsx +0 -100
- package/src/cli/cmd/tui/util/clipboard.ts +0 -127
- package/src/cli/cmd/tui/util/editor.ts +0 -32
- package/src/cli/cmd/tui/util/signal.ts +0 -7
- package/src/cli/cmd/tui/util/terminal.ts +0 -114
- package/src/cli/cmd/tui/util/transcript.ts +0 -98
- package/src/cli/cmd/tui/worker.ts +0 -68
- package/src/cli/cmd/uninstall.ts +0 -344
- package/src/cli/cmd/upgrade.ts +0 -67
- package/src/cli/cmd/web.ts +0 -73
- package/src/cli/error.ts +0 -56
- package/src/cli/network.ts +0 -53
- package/src/cli/ui.ts +0 -87
- package/src/cli/upgrade.ts +0 -25
- package/src/command/index.ts +0 -131
- package/src/command/template/initialize.txt +0 -10
- package/src/command/template/review.txt +0 -97
- package/src/config/config.ts +0 -1124
- package/src/config/markdown.ts +0 -41
- package/src/env/index.ts +0 -26
- package/src/file/ignore.ts +0 -83
- package/src/file/index.ts +0 -411
- package/src/file/ripgrep.ts +0 -402
- package/src/file/time.ts +0 -64
- package/src/file/watcher.ts +0 -117
- package/src/flag/flag.ts +0 -52
- package/src/format/formatter.ts +0 -359
- package/src/format/index.ts +0 -137
- package/src/global/index.ts +0 -55
- package/src/id/id.ts +0 -73
- package/src/ide/index.ts +0 -77
- package/src/index.ts +0 -159
- package/src/installation/index.ts +0 -198
- package/src/lsp/client.ts +0 -252
- package/src/lsp/index.ts +0 -485
- package/src/lsp/language.ts +0 -119
- package/src/lsp/server.ts +0 -2023
- package/src/mcp/auth.ts +0 -135
- package/src/mcp/index.ts +0 -874
- package/src/mcp/oauth-callback.ts +0 -200
- package/src/mcp/oauth-provider.ts +0 -154
- package/src/patch/index.ts +0 -622
- package/src/permission/arity.ts +0 -163
- package/src/permission/index.ts +0 -210
- package/src/permission/next.ts +0 -268
- package/src/plugin/index.ts +0 -106
- package/src/project/bootstrap.ts +0 -31
- package/src/project/instance.ts +0 -78
- package/src/project/project.ts +0 -263
- package/src/project/state.ts +0 -65
- package/src/project/vcs.ts +0 -76
- package/src/provider/auth.ts +0 -143
- package/src/provider/models-macro.ts +0 -4
- package/src/provider/models.ts +0 -77
- package/src/provider/provider.ts +0 -516
- package/src/provider/transform.ts +0 -114
- package/src/pty/index.ts +0 -212
- package/src/server/error.ts +0 -36
- package/src/server/mdns.ts +0 -57
- package/src/server/project.ts +0 -79
- package/src/server/server.ts +0 -2866
- package/src/server/tui.ts +0 -71
- package/src/session/compaction.ts +0 -225
- package/src/session/index.ts +0 -469
- package/src/session/llm.ts +0 -213
- package/src/session/message-v2.ts +0 -742
- package/src/session/message.ts +0 -189
- package/src/session/processor.ts +0 -402
- package/src/session/prompt/anthropic-20250930.txt +0 -166
- package/src/session/prompt/anthropic.txt +0 -105
- package/src/session/prompt/anthropic_spoof.txt +0 -1
- package/src/session/prompt/beast.txt +0 -147
- package/src/session/prompt/build-switch.txt +0 -5
- package/src/session/prompt/codex.txt +0 -318
- package/src/session/prompt/copilot-gpt-5.txt +0 -143
- package/src/session/prompt/gemini.txt +0 -155
- package/src/session/prompt/max-steps.txt +0 -16
- package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
- package/src/session/prompt/plan.txt +0 -26
- package/src/session/prompt/qwen.txt +0 -109
- package/src/session/prompt.ts +0 -1621
- package/src/session/retry.ts +0 -90
- package/src/session/revert.ts +0 -108
- package/src/session/status.ts +0 -76
- package/src/session/summary.ts +0 -194
- package/src/session/system.ts +0 -108
- package/src/session/todo.ts +0 -37
- package/src/share/share-next.ts +0 -194
- package/src/share/share.ts +0 -23
- package/src/shell/shell.ts +0 -67
- package/src/skill/index.ts +0 -1
- package/src/skill/skill.ts +0 -124
- package/src/snapshot/index.ts +0 -197
- package/src/storage/storage.ts +0 -226
- package/src/tool/bash.ts +0 -262
- package/src/tool/bash.txt +0 -116
- package/src/tool/batch.ts +0 -175
- package/src/tool/batch.txt +0 -24
- package/src/tool/codesearch.ts +0 -132
- package/src/tool/codesearch.txt +0 -12
- package/src/tool/edit.ts +0 -655
- package/src/tool/edit.txt +0 -10
- package/src/tool/glob.ts +0 -75
- package/src/tool/glob.txt +0 -6
- package/src/tool/grep.ts +0 -132
- package/src/tool/grep.txt +0 -8
- package/src/tool/invalid.ts +0 -17
- package/src/tool/ls.ts +0 -119
- package/src/tool/ls.txt +0 -1
- package/src/tool/lsp.ts +0 -94
- package/src/tool/lsp.txt +0 -19
- package/src/tool/multiedit.ts +0 -46
- package/src/tool/multiedit.txt +0 -41
- package/src/tool/patch.ts +0 -210
- package/src/tool/patch.txt +0 -1
- package/src/tool/read.ts +0 -191
- package/src/tool/read.txt +0 -12
- package/src/tool/registry.ts +0 -137
- package/src/tool/skill.ts +0 -77
- package/src/tool/task.ts +0 -167
- package/src/tool/task.txt +0 -60
- package/src/tool/todo.ts +0 -53
- package/src/tool/todoread.txt +0 -14
- package/src/tool/todowrite.txt +0 -167
- package/src/tool/tool.ts +0 -73
- package/src/tool/webfetch.ts +0 -182
- package/src/tool/webfetch.txt +0 -13
- package/src/tool/websearch.ts +0 -144
- package/src/tool/websearch.txt +0 -11
- package/src/tool/write.ts +0 -84
- package/src/tool/write.txt +0 -8
- package/src/util/archive.ts +0 -16
- package/src/util/color.ts +0 -19
- package/src/util/context.ts +0 -25
- package/src/util/defer.ts +0 -12
- package/src/util/eventloop.ts +0 -20
- package/src/util/filesystem.ts +0 -83
- package/src/util/fn.ts +0 -11
- package/src/util/iife.ts +0 -3
- package/src/util/keybind.ts +0 -102
- package/src/util/lazy.ts +0 -18
- package/src/util/locale.ts +0 -81
- package/src/util/lock.ts +0 -98
- package/src/util/log.ts +0 -180
- package/src/util/queue.ts +0 -32
- package/src/util/rpc.ts +0 -42
- package/src/util/scrap.ts +0 -10
- package/src/util/signal.ts +0 -12
- package/src/util/timeout.ts +0 -14
- package/src/util/token.ts +0 -7
- package/src/util/wildcard.ts +0 -54
- package/src/worktree/index.ts +0 -217
- package/sst-env.d.ts +0 -9
- package/test/agent/agent.test.ts +0 -448
- package/test/bun.test.ts +0 -53
- package/test/cli/github-action.test.ts +0 -129
- package/test/cli/github-remote.test.ts +0 -80
- package/test/cli/tui/transcript.test.ts +0 -297
- package/test/config/agent-color.test.ts +0 -66
- package/test/config/config.test.ts +0 -870
- package/test/config/markdown.test.ts +0 -89
- package/test/file/ignore.test.ts +0 -10
- package/test/file/path-traversal.test.ts +0 -115
- package/test/fixture/fixture.ts +0 -45
- package/test/fixture/lsp/fake-lsp-server.js +0 -77
- package/test/ide/ide.test.ts +0 -82
- package/test/keybind.test.ts +0 -421
- package/test/lsp/client.test.ts +0 -95
- package/test/mcp/headers.test.ts +0 -153
- package/test/patch/patch.test.ts +0 -348
- package/test/permission/arity.test.ts +0 -33
- package/test/permission/next.test.ts +0 -652
- package/test/preload.ts +0 -63
- package/test/project/project.test.ts +0 -120
- package/test/provider/amazon-bedrock.test.ts +0 -236
- package/test/provider/provider.test.ts +0 -2127
- package/test/provider/transform.test.ts +0 -980
- package/test/server/session-select.test.ts +0 -78
- package/test/session/compaction.test.ts +0 -251
- package/test/session/message-v2.test.ts +0 -570
- package/test/session/retry.test.ts +0 -131
- package/test/session/revert-compact.test.ts +0 -285
- package/test/session/session.test.ts +0 -71
- package/test/skill/skill.test.ts +0 -185
- package/test/snapshot/snapshot.test.ts +0 -939
- package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
- package/test/tool/bash.test.ts +0 -232
- package/test/tool/grep.test.ts +0 -109
- package/test/tool/patch.test.ts +0 -261
- package/test/tool/read.test.ts +0 -167
- package/test/util/iife.test.ts +0 -36
- package/test/util/lazy.test.ts +0 -50
- package/test/util/timeout.test.ts +0 -21
- package/test/util/wildcard.test.ts +0 -55
- package/tsconfig.json +0 -16
- /package/{script/postinstall.mjs → postinstall.mjs} +0 -0
|
@@ -1,654 +0,0 @@
|
|
|
1
|
-
import type { BoxRenderable, TextareaRenderable, KeyEvent, ScrollBoxRenderable } from "@opentui/core"
|
|
2
|
-
import fuzzysort from "fuzzysort"
|
|
3
|
-
import { firstBy } from "remeda"
|
|
4
|
-
import { createMemo, createResource, createEffect, onMount, onCleanup, For, Show, createSignal } from "solid-js"
|
|
5
|
-
import { createStore } from "solid-js/store"
|
|
6
|
-
import { useSDK } from "@tui/context/sdk"
|
|
7
|
-
import { useSync } from "@tui/context/sync"
|
|
8
|
-
import { useTheme, selectedForeground } from "@tui/context/theme"
|
|
9
|
-
import { SplitBorder } from "@tui/component/border"
|
|
10
|
-
import { useCommandDialog } from "@tui/component/dialog-command"
|
|
11
|
-
import { useTerminalDimensions } from "@opentui/solid"
|
|
12
|
-
import { Locale } from "@/util/locale"
|
|
13
|
-
import type { PromptInfo } from "./history"
|
|
14
|
-
|
|
15
|
-
function removeLineRange(input: string) {
|
|
16
|
-
const hashIndex = input.lastIndexOf("#")
|
|
17
|
-
return hashIndex !== -1 ? input.substring(0, hashIndex) : input
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function extractLineRange(input: string) {
|
|
21
|
-
const hashIndex = input.lastIndexOf("#")
|
|
22
|
-
if (hashIndex === -1) {
|
|
23
|
-
return { baseQuery: input }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const baseName = input.substring(0, hashIndex)
|
|
27
|
-
const linePart = input.substring(hashIndex + 1)
|
|
28
|
-
const lineMatch = linePart.match(/^(\d+)(?:-(\d*))?$/)
|
|
29
|
-
|
|
30
|
-
if (!lineMatch) {
|
|
31
|
-
return { baseQuery: baseName }
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const startLine = Number(lineMatch[1])
|
|
35
|
-
const endLine = lineMatch[2] && startLine < Number(lineMatch[2]) ? Number(lineMatch[2]) : undefined
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
lineRange: {
|
|
39
|
-
baseName,
|
|
40
|
-
startLine,
|
|
41
|
-
endLine,
|
|
42
|
-
},
|
|
43
|
-
baseQuery: baseName,
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type AutocompleteRef = {
|
|
48
|
-
onInput: (value: string) => void
|
|
49
|
-
onKeyDown: (e: KeyEvent) => void
|
|
50
|
-
visible: false | "@" | "/"
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type AutocompleteOption = {
|
|
54
|
-
display: string
|
|
55
|
-
aliases?: string[]
|
|
56
|
-
disabled?: boolean
|
|
57
|
-
description?: string
|
|
58
|
-
onSelect?: () => void
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function Autocomplete(props: {
|
|
62
|
-
value: string
|
|
63
|
-
sessionID?: string
|
|
64
|
-
setPrompt: (input: (prompt: PromptInfo) => void) => void
|
|
65
|
-
setExtmark: (partIndex: number, extmarkId: number) => void
|
|
66
|
-
anchor: () => BoxRenderable
|
|
67
|
-
input: () => TextareaRenderable
|
|
68
|
-
ref: (ref: AutocompleteRef) => void
|
|
69
|
-
fileStyleId: number
|
|
70
|
-
agentStyleId: number
|
|
71
|
-
promptPartTypeId: () => number
|
|
72
|
-
}) {
|
|
73
|
-
const sdk = useSDK()
|
|
74
|
-
const sync = useSync()
|
|
75
|
-
const command = useCommandDialog()
|
|
76
|
-
const { theme } = useTheme()
|
|
77
|
-
const dimensions = useTerminalDimensions()
|
|
78
|
-
|
|
79
|
-
const [store, setStore] = createStore({
|
|
80
|
-
index: 0,
|
|
81
|
-
selected: 0,
|
|
82
|
-
visible: false as AutocompleteRef["visible"],
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
const [positionTick, setPositionTick] = createSignal(0)
|
|
86
|
-
|
|
87
|
-
createEffect(() => {
|
|
88
|
-
if (store.visible) {
|
|
89
|
-
let lastPos = { x: 0, y: 0, width: 0 }
|
|
90
|
-
const interval = setInterval(() => {
|
|
91
|
-
const anchor = props.anchor()
|
|
92
|
-
if (anchor.x !== lastPos.x || anchor.y !== lastPos.y || anchor.width !== lastPos.width) {
|
|
93
|
-
lastPos = { x: anchor.x, y: anchor.y, width: anchor.width }
|
|
94
|
-
setPositionTick((t) => t + 1)
|
|
95
|
-
}
|
|
96
|
-
}, 50)
|
|
97
|
-
|
|
98
|
-
onCleanup(() => clearInterval(interval))
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
const position = createMemo(() => {
|
|
103
|
-
if (!store.visible) return { x: 0, y: 0, width: 0 }
|
|
104
|
-
const dims = dimensions()
|
|
105
|
-
positionTick()
|
|
106
|
-
const anchor = props.anchor()
|
|
107
|
-
const parent = anchor.parent
|
|
108
|
-
const parentX = parent?.x ?? 0
|
|
109
|
-
const parentY = parent?.y ?? 0
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
x: anchor.x - parentX,
|
|
113
|
-
y: anchor.y - parentY,
|
|
114
|
-
width: anchor.width,
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
const filter = createMemo(() => {
|
|
119
|
-
if (!store.visible) return
|
|
120
|
-
// Track props.value to make memo reactive to text changes
|
|
121
|
-
props.value // <- there surely is a better way to do this, like making .input() reactive
|
|
122
|
-
|
|
123
|
-
return props.input().getTextRange(store.index + 1, props.input().cursorOffset)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
function insertPart(text: string, part: PromptInfo["parts"][number]) {
|
|
127
|
-
const input = props.input()
|
|
128
|
-
const currentCursorOffset = input.cursorOffset
|
|
129
|
-
|
|
130
|
-
const charAfterCursor = props.value.at(currentCursorOffset)
|
|
131
|
-
const needsSpace = charAfterCursor !== " "
|
|
132
|
-
const append = "@" + text + (needsSpace ? " " : "")
|
|
133
|
-
|
|
134
|
-
input.cursorOffset = store.index
|
|
135
|
-
const startCursor = input.logicalCursor
|
|
136
|
-
input.cursorOffset = currentCursorOffset
|
|
137
|
-
const endCursor = input.logicalCursor
|
|
138
|
-
|
|
139
|
-
input.deleteRange(startCursor.row, startCursor.col, endCursor.row, endCursor.col)
|
|
140
|
-
input.insertText(append)
|
|
141
|
-
|
|
142
|
-
const virtualText = "@" + text
|
|
143
|
-
const extmarkStart = store.index
|
|
144
|
-
const extmarkEnd = extmarkStart + Bun.stringWidth(virtualText)
|
|
145
|
-
|
|
146
|
-
const styleId = part.type === "file" ? props.fileStyleId : part.type === "agent" ? props.agentStyleId : undefined
|
|
147
|
-
|
|
148
|
-
const extmarkId = input.extmarks.create({
|
|
149
|
-
start: extmarkStart,
|
|
150
|
-
end: extmarkEnd,
|
|
151
|
-
virtual: true,
|
|
152
|
-
styleId,
|
|
153
|
-
typeId: props.promptPartTypeId(),
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
props.setPrompt((draft) => {
|
|
157
|
-
if (part.type === "file" && part.source?.text) {
|
|
158
|
-
part.source.text.start = extmarkStart
|
|
159
|
-
part.source.text.end = extmarkEnd
|
|
160
|
-
part.source.text.value = virtualText
|
|
161
|
-
} else if (part.type === "agent" && part.source) {
|
|
162
|
-
part.source.start = extmarkStart
|
|
163
|
-
part.source.end = extmarkEnd
|
|
164
|
-
part.source.value = virtualText
|
|
165
|
-
}
|
|
166
|
-
const partIndex = draft.parts.length
|
|
167
|
-
draft.parts.push(part)
|
|
168
|
-
props.setExtmark(partIndex, extmarkId)
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const [files] = createResource(
|
|
173
|
-
() => filter(),
|
|
174
|
-
async (query) => {
|
|
175
|
-
if (!store.visible || store.visible === "/") return []
|
|
176
|
-
|
|
177
|
-
const { lineRange, baseQuery } = extractLineRange(query ?? "")
|
|
178
|
-
|
|
179
|
-
// Get files from SDK
|
|
180
|
-
const result = await sdk.client.find.files({
|
|
181
|
-
query: baseQuery,
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
const options: AutocompleteOption[] = []
|
|
185
|
-
|
|
186
|
-
// Add file options
|
|
187
|
-
if (!result.error && result.data) {
|
|
188
|
-
const width = props.anchor().width - 4
|
|
189
|
-
options.push(
|
|
190
|
-
...result.data.map((item): AutocompleteOption => {
|
|
191
|
-
let url = `file://${process.cwd()}/${item}`
|
|
192
|
-
let filename = item
|
|
193
|
-
if (lineRange && !item.endsWith("/")) {
|
|
194
|
-
filename = `${item}#${lineRange.startLine}${lineRange.endLine ? `-${lineRange.endLine}` : ""}`
|
|
195
|
-
const urlObj = new URL(url)
|
|
196
|
-
urlObj.searchParams.set("start", String(lineRange.startLine))
|
|
197
|
-
if (lineRange.endLine !== undefined) {
|
|
198
|
-
urlObj.searchParams.set("end", String(lineRange.endLine))
|
|
199
|
-
}
|
|
200
|
-
url = urlObj.toString()
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return {
|
|
204
|
-
display: Locale.truncateMiddle(filename, width),
|
|
205
|
-
onSelect: () => {
|
|
206
|
-
insertPart(filename, {
|
|
207
|
-
type: "file",
|
|
208
|
-
mime: "text/plain",
|
|
209
|
-
filename,
|
|
210
|
-
url,
|
|
211
|
-
source: {
|
|
212
|
-
type: "file",
|
|
213
|
-
text: {
|
|
214
|
-
start: 0,
|
|
215
|
-
end: 0,
|
|
216
|
-
value: "",
|
|
217
|
-
},
|
|
218
|
-
path: item,
|
|
219
|
-
},
|
|
220
|
-
})
|
|
221
|
-
},
|
|
222
|
-
}
|
|
223
|
-
}),
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return options
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
initialValue: [],
|
|
231
|
-
},
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
const mcpResources = createMemo(() => {
|
|
235
|
-
if (!store.visible || store.visible === "/") return []
|
|
236
|
-
|
|
237
|
-
const options: AutocompleteOption[] = []
|
|
238
|
-
const width = props.anchor().width - 4
|
|
239
|
-
|
|
240
|
-
for (const res of Object.values(sync.data.mcp_resource)) {
|
|
241
|
-
options.push({
|
|
242
|
-
display: Locale.truncateMiddle(`${res.name} (${res.uri})`, width),
|
|
243
|
-
description: res.description,
|
|
244
|
-
onSelect: () => {
|
|
245
|
-
insertPart(res.name, {
|
|
246
|
-
type: "file",
|
|
247
|
-
mime: res.mimeType ?? "text/plain",
|
|
248
|
-
filename: res.name,
|
|
249
|
-
url: res.uri,
|
|
250
|
-
source: {
|
|
251
|
-
type: "resource",
|
|
252
|
-
text: {
|
|
253
|
-
start: 0,
|
|
254
|
-
end: 0,
|
|
255
|
-
value: "",
|
|
256
|
-
},
|
|
257
|
-
clientName: res.client,
|
|
258
|
-
uri: res.uri,
|
|
259
|
-
},
|
|
260
|
-
})
|
|
261
|
-
},
|
|
262
|
-
})
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return options
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
const agents = createMemo(() => {
|
|
269
|
-
const agents = sync.data.agent
|
|
270
|
-
return agents
|
|
271
|
-
.filter((agent) => !agent.hidden && agent.mode !== "primary")
|
|
272
|
-
.map(
|
|
273
|
-
(agent): AutocompleteOption => ({
|
|
274
|
-
display: "@" + agent.name,
|
|
275
|
-
onSelect: () => {
|
|
276
|
-
insertPart(agent.name, {
|
|
277
|
-
type: "agent",
|
|
278
|
-
name: agent.name,
|
|
279
|
-
source: {
|
|
280
|
-
start: 0,
|
|
281
|
-
end: 0,
|
|
282
|
-
value: "",
|
|
283
|
-
},
|
|
284
|
-
})
|
|
285
|
-
},
|
|
286
|
-
}),
|
|
287
|
-
)
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
const session = createMemo(() => (props.sessionID ? sync.session.get(props.sessionID) : undefined))
|
|
291
|
-
const commands = createMemo((): AutocompleteOption[] => {
|
|
292
|
-
const results: AutocompleteOption[] = []
|
|
293
|
-
const s = session()
|
|
294
|
-
for (const command of sync.data.command) {
|
|
295
|
-
results.push({
|
|
296
|
-
display: "/" + command.name + (command.mcp ? " (MCP)" : ""),
|
|
297
|
-
description: command.description,
|
|
298
|
-
onSelect: () => {
|
|
299
|
-
const newText = "/" + command.name + " "
|
|
300
|
-
const cursor = props.input().logicalCursor
|
|
301
|
-
props.input().deleteRange(0, 0, cursor.row, cursor.col)
|
|
302
|
-
props.input().insertText(newText)
|
|
303
|
-
props.input().cursorOffset = Bun.stringWidth(newText)
|
|
304
|
-
},
|
|
305
|
-
})
|
|
306
|
-
}
|
|
307
|
-
if (s) {
|
|
308
|
-
results.push(
|
|
309
|
-
{
|
|
310
|
-
display: "/undo",
|
|
311
|
-
description: "undo the last message",
|
|
312
|
-
onSelect: () => {
|
|
313
|
-
command.trigger("session.undo")
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
display: "/redo",
|
|
318
|
-
description: "redo the last message",
|
|
319
|
-
onSelect: () => command.trigger("session.redo"),
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
display: "/compact",
|
|
323
|
-
aliases: ["/summarize"],
|
|
324
|
-
description: "compact the session",
|
|
325
|
-
onSelect: () => command.trigger("session.compact"),
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
display: "/unshare",
|
|
329
|
-
disabled: !s.share,
|
|
330
|
-
description: "unshare a session",
|
|
331
|
-
onSelect: () => command.trigger("session.unshare"),
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
display: "/rename",
|
|
335
|
-
description: "rename session",
|
|
336
|
-
onSelect: () => command.trigger("session.rename"),
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
display: "/copy",
|
|
340
|
-
description: "copy session transcript to clipboard",
|
|
341
|
-
onSelect: () => command.trigger("session.copy"),
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
display: "/export",
|
|
345
|
-
description: "export session transcript to file",
|
|
346
|
-
onSelect: () => command.trigger("session.export"),
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
display: "/timeline",
|
|
350
|
-
description: "jump to message",
|
|
351
|
-
onSelect: () => command.trigger("session.timeline"),
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
display: "/fork",
|
|
355
|
-
description: "fork from message",
|
|
356
|
-
onSelect: () => command.trigger("session.fork"),
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
display: "/thinking",
|
|
360
|
-
description: "toggle thinking visibility",
|
|
361
|
-
onSelect: () => command.trigger("session.toggle.thinking"),
|
|
362
|
-
},
|
|
363
|
-
)
|
|
364
|
-
if (sync.data.config.share !== "disabled") {
|
|
365
|
-
results.push({
|
|
366
|
-
display: "/share",
|
|
367
|
-
disabled: !!s.share?.url,
|
|
368
|
-
description: "share a session",
|
|
369
|
-
onSelect: () => command.trigger("session.share"),
|
|
370
|
-
})
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
results.push(
|
|
375
|
-
{
|
|
376
|
-
display: "/new",
|
|
377
|
-
aliases: ["/clear"],
|
|
378
|
-
description: "create a new session",
|
|
379
|
-
onSelect: () => command.trigger("session.new"),
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
display: "/models",
|
|
383
|
-
description: "list models",
|
|
384
|
-
onSelect: () => command.trigger("model.list"),
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
display: "/agents",
|
|
388
|
-
description: "list agents",
|
|
389
|
-
onSelect: () => command.trigger("agent.list"),
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
display: "/session",
|
|
393
|
-
aliases: ["/resume", "/continue"],
|
|
394
|
-
description: "list sessions",
|
|
395
|
-
onSelect: () => command.trigger("session.list"),
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
display: "/status",
|
|
399
|
-
description: "show status",
|
|
400
|
-
onSelect: () => command.trigger("opencode.status"),
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
display: "/mcp",
|
|
404
|
-
description: "toggle MCPs",
|
|
405
|
-
onSelect: () => command.trigger("mcp.list"),
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
display: "/theme",
|
|
409
|
-
description: "toggle theme",
|
|
410
|
-
onSelect: () => command.trigger("theme.switch"),
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
display: "/editor",
|
|
414
|
-
description: "open editor",
|
|
415
|
-
onSelect: () => command.trigger("prompt.editor", "prompt"),
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
display: "/connect",
|
|
419
|
-
description: "connect to a provider",
|
|
420
|
-
onSelect: () => command.trigger("provider.connect"),
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
display: "/help",
|
|
424
|
-
description: "show help",
|
|
425
|
-
onSelect: () => command.trigger("help.show"),
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
display: "/commands",
|
|
429
|
-
description: "show all commands",
|
|
430
|
-
onSelect: () => command.show(),
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
display: "/exit",
|
|
434
|
-
aliases: ["/quit", "/q"],
|
|
435
|
-
description: "exit the app",
|
|
436
|
-
onSelect: () => command.trigger("app.exit"),
|
|
437
|
-
},
|
|
438
|
-
)
|
|
439
|
-
const max = firstBy(results, [(x) => x.display.length, "desc"])?.display.length
|
|
440
|
-
if (!max) return results
|
|
441
|
-
return results.map((item) => ({
|
|
442
|
-
...item,
|
|
443
|
-
display: item.display.padEnd(max + 2),
|
|
444
|
-
}))
|
|
445
|
-
})
|
|
446
|
-
|
|
447
|
-
const options = createMemo((prev: AutocompleteOption[] | undefined) => {
|
|
448
|
-
const filesValue = files()
|
|
449
|
-
const agentsValue = agents()
|
|
450
|
-
const commandsValue = commands()
|
|
451
|
-
|
|
452
|
-
const mixed: AutocompleteOption[] = (
|
|
453
|
-
store.visible === "@" ? [...agentsValue, ...(filesValue || []), ...mcpResources()] : [...commandsValue]
|
|
454
|
-
).filter((x) => x.disabled !== true)
|
|
455
|
-
|
|
456
|
-
const currentFilter = filter()
|
|
457
|
-
|
|
458
|
-
if (!currentFilter) {
|
|
459
|
-
return mixed
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
if (files.loading && prev && prev.length > 0) {
|
|
463
|
-
return prev
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const result = fuzzysort.go(removeLineRange(currentFilter), mixed, {
|
|
467
|
-
keys: [(obj) => removeLineRange(obj.display.trimEnd()), "description", (obj) => obj.aliases?.join(" ") ?? ""],
|
|
468
|
-
limit: 10,
|
|
469
|
-
scoreFn: (objResults) => {
|
|
470
|
-
const displayResult = objResults[0]
|
|
471
|
-
if (displayResult && displayResult.target.startsWith(store.visible + currentFilter)) {
|
|
472
|
-
return objResults.score * 2
|
|
473
|
-
}
|
|
474
|
-
return objResults.score
|
|
475
|
-
},
|
|
476
|
-
})
|
|
477
|
-
|
|
478
|
-
return result.map((arr) => arr.obj)
|
|
479
|
-
})
|
|
480
|
-
|
|
481
|
-
createEffect(() => {
|
|
482
|
-
filter()
|
|
483
|
-
setStore("selected", 0)
|
|
484
|
-
})
|
|
485
|
-
|
|
486
|
-
function move(direction: -1 | 1) {
|
|
487
|
-
if (!store.visible) return
|
|
488
|
-
if (!options().length) return
|
|
489
|
-
let next = store.selected + direction
|
|
490
|
-
if (next < 0) next = options().length - 1
|
|
491
|
-
if (next >= options().length) next = 0
|
|
492
|
-
moveTo(next)
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
function moveTo(next: number) {
|
|
496
|
-
setStore("selected", next)
|
|
497
|
-
if (!scroll) return
|
|
498
|
-
const viewportHeight = Math.min(height(), options().length)
|
|
499
|
-
const scrollBottom = scroll.scrollTop + viewportHeight
|
|
500
|
-
if (next < scroll.scrollTop) {
|
|
501
|
-
scroll.scrollBy(next - scroll.scrollTop)
|
|
502
|
-
} else if (next + 1 > scrollBottom) {
|
|
503
|
-
scroll.scrollBy(next + 1 - scrollBottom)
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function select() {
|
|
508
|
-
const selected = options()[store.selected]
|
|
509
|
-
if (!selected) return
|
|
510
|
-
hide()
|
|
511
|
-
selected.onSelect?.()
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
function show(mode: "@" | "/") {
|
|
515
|
-
command.keybinds(false)
|
|
516
|
-
setStore({
|
|
517
|
-
visible: mode,
|
|
518
|
-
index: props.input().cursorOffset,
|
|
519
|
-
})
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
function hide() {
|
|
523
|
-
const text = props.input().plainText
|
|
524
|
-
if (store.visible === "/" && !text.endsWith(" ") && text.startsWith("/")) {
|
|
525
|
-
const cursor = props.input().logicalCursor
|
|
526
|
-
props.input().deleteRange(0, 0, cursor.row, cursor.col)
|
|
527
|
-
// Sync the prompt store immediately since onContentChange is async
|
|
528
|
-
props.setPrompt((draft) => {
|
|
529
|
-
draft.input = props.input().plainText
|
|
530
|
-
})
|
|
531
|
-
}
|
|
532
|
-
command.keybinds(true)
|
|
533
|
-
setStore("visible", false)
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
onMount(() => {
|
|
537
|
-
props.ref({
|
|
538
|
-
get visible() {
|
|
539
|
-
return store.visible
|
|
540
|
-
},
|
|
541
|
-
onInput(value) {
|
|
542
|
-
if (store.visible) {
|
|
543
|
-
if (
|
|
544
|
-
// Typed text before the trigger
|
|
545
|
-
props.input().cursorOffset <= store.index ||
|
|
546
|
-
// There is a space between the trigger and the cursor
|
|
547
|
-
props.input().getTextRange(store.index, props.input().cursorOffset).match(/\s/) ||
|
|
548
|
-
// "/<command>" is not the sole content
|
|
549
|
-
(store.visible === "/" && value.match(/^\S+\s+\S+\s*$/))
|
|
550
|
-
) {
|
|
551
|
-
hide()
|
|
552
|
-
return
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
},
|
|
556
|
-
onKeyDown(e: KeyEvent) {
|
|
557
|
-
if (store.visible) {
|
|
558
|
-
const name = e.name?.toLowerCase()
|
|
559
|
-
const ctrlOnly = e.ctrl && !e.meta && !e.shift
|
|
560
|
-
const isNavUp = name === "up" || (ctrlOnly && name === "p")
|
|
561
|
-
const isNavDown = name === "down" || (ctrlOnly && name === "n")
|
|
562
|
-
|
|
563
|
-
if (isNavUp) {
|
|
564
|
-
move(-1)
|
|
565
|
-
e.preventDefault()
|
|
566
|
-
return
|
|
567
|
-
}
|
|
568
|
-
if (isNavDown) {
|
|
569
|
-
move(1)
|
|
570
|
-
e.preventDefault()
|
|
571
|
-
return
|
|
572
|
-
}
|
|
573
|
-
if (name === "escape") {
|
|
574
|
-
hide()
|
|
575
|
-
e.preventDefault()
|
|
576
|
-
return
|
|
577
|
-
}
|
|
578
|
-
if (name === "return" || name === "tab") {
|
|
579
|
-
select()
|
|
580
|
-
e.preventDefault()
|
|
581
|
-
return
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
if (!store.visible) {
|
|
585
|
-
if (e.name === "@") {
|
|
586
|
-
const cursorOffset = props.input().cursorOffset
|
|
587
|
-
const charBeforeCursor =
|
|
588
|
-
cursorOffset === 0 ? undefined : props.input().getTextRange(cursorOffset - 1, cursorOffset)
|
|
589
|
-
const canTrigger = charBeforeCursor === undefined || charBeforeCursor === "" || /\s/.test(charBeforeCursor)
|
|
590
|
-
if (canTrigger) show("@")
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if (e.name === "/") {
|
|
594
|
-
if (props.input().cursorOffset === 0) show("/")
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
},
|
|
598
|
-
})
|
|
599
|
-
})
|
|
600
|
-
|
|
601
|
-
const height = createMemo(() => {
|
|
602
|
-
if (options().length) return Math.min(10, options().length)
|
|
603
|
-
return 1
|
|
604
|
-
})
|
|
605
|
-
|
|
606
|
-
let scroll: ScrollBoxRenderable
|
|
607
|
-
|
|
608
|
-
return (
|
|
609
|
-
<box
|
|
610
|
-
visible={store.visible !== false}
|
|
611
|
-
position="absolute"
|
|
612
|
-
top={position().y - height()}
|
|
613
|
-
left={position().x}
|
|
614
|
-
width={position().width}
|
|
615
|
-
zIndex={100}
|
|
616
|
-
{...SplitBorder}
|
|
617
|
-
borderColor={theme.border}
|
|
618
|
-
>
|
|
619
|
-
<scrollbox
|
|
620
|
-
ref={(r: ScrollBoxRenderable) => (scroll = r)}
|
|
621
|
-
backgroundColor={theme.backgroundMenu}
|
|
622
|
-
height={height()}
|
|
623
|
-
scrollbarOptions={{ visible: false }}
|
|
624
|
-
>
|
|
625
|
-
<For
|
|
626
|
-
each={options()}
|
|
627
|
-
fallback={
|
|
628
|
-
<box paddingLeft={1} paddingRight={1}>
|
|
629
|
-
<text fg={theme.textMuted}>No matching items</text>
|
|
630
|
-
</box>
|
|
631
|
-
}
|
|
632
|
-
>
|
|
633
|
-
{(option, index) => (
|
|
634
|
-
<box
|
|
635
|
-
paddingLeft={1}
|
|
636
|
-
paddingRight={1}
|
|
637
|
-
backgroundColor={index() === store.selected ? theme.primary : undefined}
|
|
638
|
-
flexDirection="row"
|
|
639
|
-
>
|
|
640
|
-
<text fg={index() === store.selected ? selectedForeground(theme) : theme.text} flexShrink={0}>
|
|
641
|
-
{option.display}
|
|
642
|
-
</text>
|
|
643
|
-
<Show when={option.description}>
|
|
644
|
-
<text fg={index() === store.selected ? selectedForeground(theme) : theme.textMuted} wrapMode="none">
|
|
645
|
-
{option.description}
|
|
646
|
-
</text>
|
|
647
|
-
</Show>
|
|
648
|
-
</box>
|
|
649
|
-
)}
|
|
650
|
-
</For>
|
|
651
|
-
</scrollbox>
|
|
652
|
-
</box>
|
|
653
|
-
)
|
|
654
|
-
}
|