@code0123/opencode-android-arm64 1.1.55 → 1.1.57
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/bin/opencode +3 -1
- package/package.json +1 -77
- package/runtime/highlights-eq9cgrbb.scm +604 -0
- package/runtime/highlights-ghv9g403.scm +205 -0
- package/runtime/highlights-hk7bwhj4.scm +284 -0
- package/runtime/highlights-r812a2qc.scm +150 -0
- package/runtime/highlights-x6tmsnaa.scm +115 -0
- package/runtime/index.js +287124 -0
- package/runtime/injections-73j83es3.scm +27 -0
- package/runtime/parser.worker.js +4081 -0
- package/runtime/tree-sitter-3jzf13jk.wasm +0 -0
- package/runtime/tree-sitter-bash-hq5s6fxb.wasm +0 -0
- package/runtime/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
- package/runtime/tree-sitter-markdown-411r6y9b.wasm +0 -0
- package/runtime/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
- package/runtime/tree-sitter-typescript-zxjzwt75.wasm +0 -0
- package/runtime/tree-sitter-zig-e78zbjpm.wasm +0 -0
- package/runtime/worker.js +208338 -0
- package/parsers-config.ts +0 -253
- package/src/acp/README.md +0 -164
- package/src/acp/agent.ts +0 -1676
- package/src/acp/session.ts +0 -117
- package/src/acp/types.ts +0 -23
- package/src/agent/agent.ts +0 -338
- 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 -44
- package/src/auth/index.ts +0 -70
- package/src/bun/index.ts +0 -137
- package/src/bun/registry.ts +0 -48
- 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 -70
- package/src/cli/cmd/agent.ts +0 -257
- package/src/cli/cmd/auth.ts +0 -400
- package/src/cli/cmd/cmd.ts +0 -7
- package/src/cli/cmd/debug/agent.ts +0 -167
- package/src/cli/cmd/debug/config.ts +0 -16
- package/src/cli/cmd/debug/file.ts +0 -97
- package/src/cli/cmd/debug/index.ts +0 -48
- package/src/cli/cmd/debug/lsp.ts +0 -52
- package/src/cli/cmd/debug/ripgrep.ts +0 -87
- package/src/cli/cmd/debug/scrap.ts +0 -16
- package/src/cli/cmd/debug/skill.ts +0 -16
- package/src/cli/cmd/debug/snapshot.ts +0 -52
- package/src/cli/cmd/export.ts +0 -88
- package/src/cli/cmd/generate.ts +0 -38
- package/src/cli/cmd/github.ts +0 -1540
- package/src/cli/cmd/import.ts +0 -147
- package/src/cli/cmd/mcp.ts +0 -755
- package/src/cli/cmd/models.ts +0 -77
- package/src/cli/cmd/pr.ts +0 -112
- package/src/cli/cmd/run.ts +0 -598
- package/src/cli/cmd/serve.ts +0 -20
- package/src/cli/cmd/session.ts +0 -135
- package/src/cli/cmd/stats.ts +0 -426
- package/src/cli/cmd/tui/app.tsx +0 -801
- package/src/cli/cmd/tui/attach.ts +0 -52
- 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 -148
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-model.tsx +0 -234
- package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -266
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -108
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-skill.tsx +0 -36
- package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -87
- package/src/cli/cmd/tui/component/dialog-status.tsx +0 -177
- 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/logo.tsx +0 -85
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -666
- package/src/cli/cmd/tui/component/prompt/frecency.tsx +0 -89
- package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
- package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1132
- package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
- package/src/cli/cmd/tui/component/spinner.tsx +0 -24
- package/src/cli/cmd/tui/component/textarea-keybindings.ts +0 -73
- package/src/cli/cmd/tui/component/tips.tsx +0 -153
- package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
- package/src/cli/cmd/tui/context/args.tsx +0 -15
- package/src/cli/cmd/tui/context/directory.ts +0 -13
- package/src/cli/cmd/tui/context/exit.tsx +0 -52
- package/src/cli/cmd/tui/context/helper.tsx +0 -25
- package/src/cli/cmd/tui/context/keybind.tsx +0 -100
- package/src/cli/cmd/tui/context/kv.tsx +0 -52
- package/src/cli/cmd/tui/context/local.tsx +0 -409
- 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 -101
- package/src/cli/cmd/tui/context/sync.tsx +0 -470
- 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/carbonfox.json +0 -248
- 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/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 -242
- package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -237
- 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/opencode.json +0 -245
- package/src/cli/cmd/tui/context/theme/orng.json +0 -249
- 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 -1152
- package/src/cli/cmd/tui/event.ts +0 -48
- package/src/cli/cmd/tui/routes/home.tsx +0 -140
- 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 -91
- package/src/cli/cmd/tui/routes/session/header.tsx +0 -142
- package/src/cli/cmd/tui/routes/session/index.tsx +0 -2126
- package/src/cli/cmd/tui/routes/session/permission.tsx +0 -508
- package/src/cli/cmd/tui/routes/session/question.tsx +0 -466
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -313
- package/src/cli/cmd/tui/thread.ts +0 -175
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -68
- package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -93
- package/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -215
- package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -49
- package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -88
- package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -399
- package/src/cli/cmd/tui/ui/dialog.tsx +0 -167
- 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 -159
- 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 -152
- package/src/cli/cmd/uninstall.ts +0 -357
- package/src/cli/cmd/upgrade.ts +0 -73
- package/src/cli/cmd/web.ts +0 -81
- package/src/cli/error.ts +0 -57
- package/src/cli/logo.ts +0 -6
- package/src/cli/network.ts +0 -60
- package/src/cli/ui.ts +0 -113
- package/src/cli/upgrade.ts +0 -25
- package/src/command/index.ts +0 -150
- package/src/command/template/initialize.txt +0 -10
- package/src/command/template/review.txt +0 -99
- package/src/config/config.ts +0 -1477
- package/src/config/markdown.ts +0 -98
- package/src/env/index.ts +0 -28
- package/src/file/ignore.ts +0 -83
- package/src/file/index.ts +0 -583
- package/src/file/ripgrep.ts +0 -384
- package/src/file/time.ts +0 -69
- package/src/file/watcher.ts +0 -148
- package/src/flag/flag.ts +0 -93
- package/src/format/formatter.ts +0 -366
- package/src/format/index.ts +0 -137
- package/src/global/index.ts +0 -55
- package/src/id/id.ts +0 -83
- package/src/ide/index.ts +0 -76
- package/src/index.ts +0 -159
- package/src/installation/index.ts +0 -246
- 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 -2046
- package/src/mcp/auth.ts +0 -132
- package/src/mcp/index.ts +0 -934
- package/src/mcp/oauth-callback.ts +0 -200
- package/src/mcp/oauth-provider.ts +0 -154
- package/src/patch/index.ts +0 -680
- package/src/permission/arity.ts +0 -163
- package/src/permission/index.ts +0 -210
- package/src/permission/next.ts +0 -280
- package/src/plugin/codex.ts +0 -624
- package/src/plugin/copilot.ts +0 -327
- package/src/plugin/index.ts +0 -138
- package/src/project/bootstrap.ts +0 -35
- package/src/project/instance.ts +0 -114
- package/src/project/project.ts +0 -371
- package/src/project/state.ts +0 -70
- package/src/project/vcs.ts +0 -76
- package/src/provider/auth.ts +0 -147
- package/src/provider/models-snapshot.ts +0 -38414
- package/src/provider/models.ts +0 -133
- package/src/provider/provider.ts +0 -1262
- package/src/provider/sdk/copilot/README.md +0 -5
- package/src/provider/sdk/copilot/chat/convert-to-openai-compatible-chat-messages.ts +0 -164
- package/src/provider/sdk/copilot/chat/get-response-metadata.ts +0 -15
- package/src/provider/sdk/copilot/chat/map-openai-compatible-finish-reason.ts +0 -17
- package/src/provider/sdk/copilot/chat/openai-compatible-api-types.ts +0 -64
- package/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts +0 -780
- package/src/provider/sdk/copilot/chat/openai-compatible-chat-options.ts +0 -28
- package/src/provider/sdk/copilot/chat/openai-compatible-metadata-extractor.ts +0 -44
- package/src/provider/sdk/copilot/chat/openai-compatible-prepare-tools.ts +0 -87
- package/src/provider/sdk/copilot/copilot-provider.ts +0 -100
- package/src/provider/sdk/copilot/index.ts +0 -2
- package/src/provider/sdk/copilot/openai-compatible-error.ts +0 -27
- package/src/provider/sdk/copilot/responses/convert-to-openai-responses-input.ts +0 -303
- package/src/provider/sdk/copilot/responses/map-openai-responses-finish-reason.ts +0 -22
- package/src/provider/sdk/copilot/responses/openai-config.ts +0 -18
- package/src/provider/sdk/copilot/responses/openai-error.ts +0 -22
- package/src/provider/sdk/copilot/responses/openai-responses-api-types.ts +0 -207
- package/src/provider/sdk/copilot/responses/openai-responses-language-model.ts +0 -1732
- package/src/provider/sdk/copilot/responses/openai-responses-prepare-tools.ts +0 -177
- package/src/provider/sdk/copilot/responses/openai-responses-settings.ts +0 -1
- package/src/provider/sdk/copilot/responses/tool/code-interpreter.ts +0 -88
- package/src/provider/sdk/copilot/responses/tool/file-search.ts +0 -128
- package/src/provider/sdk/copilot/responses/tool/image-generation.ts +0 -115
- package/src/provider/sdk/copilot/responses/tool/local-shell.ts +0 -65
- package/src/provider/sdk/copilot/responses/tool/web-search-preview.ts +0 -104
- package/src/provider/sdk/copilot/responses/tool/web-search.ts +0 -103
- package/src/provider/transform.ts +0 -828
- package/src/pty/index.ts +0 -250
- package/src/question/index.ts +0 -171
- package/src/scheduler/index.ts +0 -61
- package/src/server/error.ts +0 -36
- package/src/server/event.ts +0 -7
- package/src/server/mdns.ts +0 -60
- package/src/server/routes/config.ts +0 -92
- package/src/server/routes/experimental.ts +0 -208
- package/src/server/routes/file.ts +0 -197
- package/src/server/routes/global.ts +0 -183
- package/src/server/routes/mcp.ts +0 -225
- package/src/server/routes/permission.ts +0 -68
- package/src/server/routes/project.ts +0 -82
- package/src/server/routes/provider.ts +0 -165
- package/src/server/routes/pty.ts +0 -169
- package/src/server/routes/question.ts +0 -98
- package/src/server/routes/session.ts +0 -939
- package/src/server/routes/tui.ts +0 -379
- package/src/server/server.ts +0 -613
- package/src/session/compaction.ts +0 -226
- package/src/session/index.ts +0 -517
- package/src/session/instruction.ts +0 -197
- package/src/session/llm.ts +0 -289
- package/src/session/message-v2.ts +0 -802
- package/src/session/message.ts +0 -189
- package/src/session/processor.ts +0 -407
- package/src/session/prompt/anthropic-20250930.txt +0 -166
- package/src/session/prompt/anthropic.txt +0 -105
- package/src/session/prompt/beast.txt +0 -147
- package/src/session/prompt/build-switch.txt +0 -5
- package/src/session/prompt/codex_header.txt +0 -79
- 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/trinity.txt +0 -97
- package/src/session/prompt.ts +0 -1866
- package/src/session/retry.ts +0 -97
- package/src/session/revert.ts +0 -121
- package/src/session/status.ts +0 -76
- package/src/session/summary.ts +0 -217
- package/src/session/system.ts +0 -54
- package/src/session/todo.ts +0 -37
- package/src/share/share-next.ts +0 -200
- package/src/share/share.ts +0 -92
- package/src/shell/shell.ts +0 -67
- package/src/skill/discovery.ts +0 -97
- package/src/skill/index.ts +0 -1
- package/src/skill/skill.ts +0 -188
- package/src/snapshot/index.ts +0 -255
- package/src/storage/storage.ts +0 -227
- package/src/tool/apply_patch.ts +0 -281
- package/src/tool/apply_patch.txt +0 -33
- package/src/tool/bash.ts +0 -269
- package/src/tool/bash.txt +0 -115
- 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/external-directory.ts +0 -32
- package/src/tool/glob.ts +0 -78
- package/src/tool/glob.txt +0 -6
- package/src/tool/grep.ts +0 -147
- package/src/tool/grep.txt +0 -8
- package/src/tool/invalid.ts +0 -17
- package/src/tool/ls.ts +0 -121
- package/src/tool/ls.txt +0 -1
- package/src/tool/lsp.ts +0 -96
- package/src/tool/lsp.txt +0 -19
- package/src/tool/multiedit.ts +0 -46
- package/src/tool/multiedit.txt +0 -41
- package/src/tool/plan-enter.txt +0 -14
- package/src/tool/plan-exit.txt +0 -13
- package/src/tool/plan.ts +0 -130
- package/src/tool/question.ts +0 -33
- package/src/tool/question.txt +0 -10
- package/src/tool/read.ts +0 -211
- package/src/tool/read.txt +0 -12
- package/src/tool/registry.ts +0 -160
- package/src/tool/skill.ts +0 -123
- package/src/tool/task.ts +0 -165
- 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 -89
- package/src/tool/truncation.ts +0 -106
- package/src/tool/webfetch.ts +0 -186
- package/src/tool/webfetch.txt +0 -13
- package/src/tool/websearch.ts +0 -150
- package/src/tool/websearch.txt +0 -14
- package/src/tool/write.ts +0 -85
- package/src/tool/write.txt +0 -8
- package/src/util/abort.ts +0 -35
- 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 -93
- package/src/util/fn.ts +0 -11
- package/src/util/format.ts +0 -20
- package/src/util/iife.ts +0 -3
- package/src/util/keybind.ts +0 -103
- 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/proxied.ts +0 -3
- package/src/util/queue.ts +0 -32
- package/src/util/rpc.ts +0 -66
- 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 -56
- package/src/worktree/index.ts +0 -574
- package/tsconfig.json +0 -10
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { InputRenderable, RGBA, ScrollBoxRenderable, TextAttributes } from "@opentui/core"
|
|
2
|
-
import { useTheme, selectedForeground } from "@tui/context/theme"
|
|
3
|
-
import { entries, filter, flatMap, groupBy, pipe, take } from "remeda"
|
|
4
|
-
import { batch, createEffect, createMemo, createSignal, For, Show, type JSX, on } from "solid-js"
|
|
5
|
-
import { createStore } from "solid-js/store"
|
|
6
|
-
import { useKeyboard, useTerminalDimensions } from "@opentui/solid"
|
|
7
|
-
import * as fuzzysort from "fuzzysort"
|
|
8
|
-
import { isDeepEqual } from "remeda"
|
|
9
|
-
import { useDialog, type DialogContext } from "@tui/ui/dialog"
|
|
10
|
-
import { useKeybind } from "@tui/context/keybind"
|
|
11
|
-
import { Keybind } from "@/util/keybind"
|
|
12
|
-
import { Locale } from "@/util/locale"
|
|
13
|
-
|
|
14
|
-
export interface DialogSelectProps<T> {
|
|
15
|
-
title: string
|
|
16
|
-
placeholder?: string
|
|
17
|
-
options: DialogSelectOption<T>[]
|
|
18
|
-
ref?: (ref: DialogSelectRef<T>) => void
|
|
19
|
-
onMove?: (option: DialogSelectOption<T>) => void
|
|
20
|
-
onFilter?: (query: string) => void
|
|
21
|
-
onSelect?: (option: DialogSelectOption<T>) => void
|
|
22
|
-
skipFilter?: boolean
|
|
23
|
-
keybind?: {
|
|
24
|
-
keybind?: Keybind.Info
|
|
25
|
-
title: string
|
|
26
|
-
disabled?: boolean
|
|
27
|
-
onTrigger: (option: DialogSelectOption<T>) => void
|
|
28
|
-
}[]
|
|
29
|
-
current?: T
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface DialogSelectOption<T = any> {
|
|
33
|
-
title: string
|
|
34
|
-
value: T
|
|
35
|
-
description?: string
|
|
36
|
-
footer?: JSX.Element | string
|
|
37
|
-
category?: string
|
|
38
|
-
disabled?: boolean
|
|
39
|
-
bg?: RGBA
|
|
40
|
-
gutter?: JSX.Element
|
|
41
|
-
onSelect?: (ctx: DialogContext) => void
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type DialogSelectRef<T> = {
|
|
45
|
-
filter: string
|
|
46
|
-
filtered: DialogSelectOption<T>[]
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function DialogSelect<T>(props: DialogSelectProps<T>) {
|
|
50
|
-
const dialog = useDialog()
|
|
51
|
-
const { theme } = useTheme()
|
|
52
|
-
const [hover, setHover] = createSignal(false)
|
|
53
|
-
const [store, setStore] = createStore({
|
|
54
|
-
selected: 0,
|
|
55
|
-
filter: "",
|
|
56
|
-
input: "keyboard" as "keyboard" | "mouse",
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
createEffect(
|
|
60
|
-
on(
|
|
61
|
-
() => props.current,
|
|
62
|
-
(current) => {
|
|
63
|
-
if (current) {
|
|
64
|
-
const currentIndex = flat().findIndex((opt) => isDeepEqual(opt.value, current))
|
|
65
|
-
if (currentIndex >= 0) {
|
|
66
|
-
setStore("selected", currentIndex)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
),
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
let input: InputRenderable
|
|
74
|
-
|
|
75
|
-
const filtered = createMemo(() => {
|
|
76
|
-
if (props.skipFilter) return props.options.filter((x) => x.disabled !== true)
|
|
77
|
-
const needle = store.filter.toLowerCase()
|
|
78
|
-
const options = pipe(
|
|
79
|
-
props.options,
|
|
80
|
-
filter((x) => x.disabled !== true),
|
|
81
|
-
)
|
|
82
|
-
if (!needle) return options
|
|
83
|
-
|
|
84
|
-
// prioritize title matches (weight: 2) over category matches (weight: 1).
|
|
85
|
-
// users typically search by the item name, and not its category.
|
|
86
|
-
const result = fuzzysort
|
|
87
|
-
.go(needle, options, {
|
|
88
|
-
keys: ["title", "category"],
|
|
89
|
-
scoreFn: (r) => r[0].score * 2 + r[1].score,
|
|
90
|
-
})
|
|
91
|
-
.map((x) => x.obj)
|
|
92
|
-
|
|
93
|
-
return result
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
// When the filter changes due to how TUI works, the mousemove might still be triggered
|
|
97
|
-
// via a synthetic event as the layout moves underneath the cursor. This is a workaround to make sure the input mode remains keyboard
|
|
98
|
-
// that the mouseover event doesn't trigger when filtering.
|
|
99
|
-
createEffect(() => {
|
|
100
|
-
filtered()
|
|
101
|
-
setStore("input", "keyboard")
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
const grouped = createMemo(() => {
|
|
105
|
-
const result = pipe(
|
|
106
|
-
filtered(),
|
|
107
|
-
groupBy((x) => x.category ?? ""),
|
|
108
|
-
// mapValues((x) => x.sort((a, b) => a.title.localeCompare(b.title))),
|
|
109
|
-
entries(),
|
|
110
|
-
)
|
|
111
|
-
return result
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
const flat = createMemo(() => {
|
|
115
|
-
return pipe(
|
|
116
|
-
grouped(),
|
|
117
|
-
flatMap(([_, options]) => options),
|
|
118
|
-
)
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
const dimensions = useTerminalDimensions()
|
|
122
|
-
const height = createMemo(() =>
|
|
123
|
-
Math.min(flat().length + grouped().length * 2 - 1, Math.floor(dimensions().height / 2) - 6),
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
const selected = createMemo(() => flat()[store.selected])
|
|
127
|
-
|
|
128
|
-
createEffect(
|
|
129
|
-
on([() => store.filter, () => props.current], ([filter, current]) => {
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
if (filter.length > 0) {
|
|
132
|
-
moveTo(0, true)
|
|
133
|
-
} else if (current) {
|
|
134
|
-
const currentIndex = flat().findIndex((opt) => isDeepEqual(opt.value, current))
|
|
135
|
-
if (currentIndex >= 0) {
|
|
136
|
-
moveTo(currentIndex, true)
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}, 0)
|
|
140
|
-
}),
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
function move(direction: number) {
|
|
144
|
-
if (flat().length === 0) return
|
|
145
|
-
let next = store.selected + direction
|
|
146
|
-
if (next < 0) next = flat().length - 1
|
|
147
|
-
if (next >= flat().length) next = 0
|
|
148
|
-
moveTo(next, true)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function moveTo(next: number, center = false) {
|
|
152
|
-
setStore("selected", next)
|
|
153
|
-
const option = selected()
|
|
154
|
-
if (option) props.onMove?.(option)
|
|
155
|
-
if (!scroll) return
|
|
156
|
-
const target = scroll.getChildren().find((child) => {
|
|
157
|
-
return child.id === JSON.stringify(selected()?.value)
|
|
158
|
-
})
|
|
159
|
-
if (!target) return
|
|
160
|
-
const y = target.y - scroll.y
|
|
161
|
-
if (center) {
|
|
162
|
-
const centerOffset = Math.floor(scroll.height / 2)
|
|
163
|
-
scroll.scrollBy(y - centerOffset)
|
|
164
|
-
} else {
|
|
165
|
-
if (y >= scroll.height) {
|
|
166
|
-
scroll.scrollBy(y - scroll.height + 1)
|
|
167
|
-
}
|
|
168
|
-
if (y < 0) {
|
|
169
|
-
scroll.scrollBy(y)
|
|
170
|
-
if (isDeepEqual(flat()[0].value, selected()?.value)) {
|
|
171
|
-
scroll.scrollTo(0)
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const keybind = useKeybind()
|
|
178
|
-
useKeyboard((evt) => {
|
|
179
|
-
setStore("input", "keyboard")
|
|
180
|
-
|
|
181
|
-
if (evt.name === "up" || (evt.ctrl && evt.name === "p")) move(-1)
|
|
182
|
-
if (evt.name === "down" || (evt.ctrl && evt.name === "n")) move(1)
|
|
183
|
-
if (evt.name === "pageup") move(-10)
|
|
184
|
-
if (evt.name === "pagedown") move(10)
|
|
185
|
-
if (evt.name === "home") moveTo(0)
|
|
186
|
-
if (evt.name === "end") moveTo(flat().length - 1)
|
|
187
|
-
|
|
188
|
-
if (evt.name === "return") {
|
|
189
|
-
const option = selected()
|
|
190
|
-
if (option) {
|
|
191
|
-
evt.preventDefault()
|
|
192
|
-
evt.stopPropagation()
|
|
193
|
-
if (option.onSelect) option.onSelect(dialog)
|
|
194
|
-
props.onSelect?.(option)
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
for (const item of props.keybind ?? []) {
|
|
199
|
-
if (item.disabled || !item.keybind) continue
|
|
200
|
-
if (Keybind.match(item.keybind, keybind.parse(evt))) {
|
|
201
|
-
const s = selected()
|
|
202
|
-
if (s) {
|
|
203
|
-
evt.preventDefault()
|
|
204
|
-
item.onTrigger(s)
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
let scroll: ScrollBoxRenderable | undefined
|
|
211
|
-
const ref: DialogSelectRef<T> = {
|
|
212
|
-
get filter() {
|
|
213
|
-
return store.filter
|
|
214
|
-
},
|
|
215
|
-
get filtered() {
|
|
216
|
-
return filtered()
|
|
217
|
-
},
|
|
218
|
-
}
|
|
219
|
-
props.ref?.(ref)
|
|
220
|
-
|
|
221
|
-
const keybinds = createMemo(() => props.keybind?.filter((x) => !x.disabled && x.keybind) ?? [])
|
|
222
|
-
|
|
223
|
-
return (
|
|
224
|
-
<box gap={1} paddingBottom={1}>
|
|
225
|
-
<box paddingLeft={4} paddingRight={4}>
|
|
226
|
-
<box flexDirection="row" justifyContent="space-between">
|
|
227
|
-
<text fg={theme.text} attributes={TextAttributes.BOLD}>
|
|
228
|
-
{props.title}
|
|
229
|
-
</text>
|
|
230
|
-
<box
|
|
231
|
-
paddingLeft={1}
|
|
232
|
-
paddingRight={1}
|
|
233
|
-
backgroundColor={hover() ? theme.primary : undefined}
|
|
234
|
-
onMouseOver={() => setHover(true)}
|
|
235
|
-
onMouseOut={() => setHover(false)}
|
|
236
|
-
onMouseUp={() => dialog.clear()}
|
|
237
|
-
>
|
|
238
|
-
<text fg={hover() ? theme.selectedListItemText : theme.textMuted}>esc</text>
|
|
239
|
-
</box>
|
|
240
|
-
</box>
|
|
241
|
-
<box paddingTop={1}>
|
|
242
|
-
<input
|
|
243
|
-
onInput={(e) => {
|
|
244
|
-
batch(() => {
|
|
245
|
-
setStore("filter", e)
|
|
246
|
-
props.onFilter?.(e)
|
|
247
|
-
})
|
|
248
|
-
}}
|
|
249
|
-
focusedBackgroundColor={theme.backgroundPanel}
|
|
250
|
-
cursorColor={theme.primary}
|
|
251
|
-
focusedTextColor={theme.textMuted}
|
|
252
|
-
ref={(r) => {
|
|
253
|
-
input = r
|
|
254
|
-
setTimeout(() => {
|
|
255
|
-
if (!input) return
|
|
256
|
-
if (input.isDestroyed) return
|
|
257
|
-
input.focus()
|
|
258
|
-
}, 1)
|
|
259
|
-
}}
|
|
260
|
-
placeholder={props.placeholder ?? "Search"}
|
|
261
|
-
/>
|
|
262
|
-
</box>
|
|
263
|
-
</box>
|
|
264
|
-
<Show
|
|
265
|
-
when={grouped().length > 0}
|
|
266
|
-
fallback={
|
|
267
|
-
<box paddingLeft={4} paddingRight={4} paddingTop={1}>
|
|
268
|
-
<text fg={theme.textMuted}>No results found</text>
|
|
269
|
-
</box>
|
|
270
|
-
}
|
|
271
|
-
>
|
|
272
|
-
<scrollbox
|
|
273
|
-
paddingLeft={1}
|
|
274
|
-
paddingRight={1}
|
|
275
|
-
scrollbarOptions={{ visible: false }}
|
|
276
|
-
ref={(r: ScrollBoxRenderable) => (scroll = r)}
|
|
277
|
-
maxHeight={height()}
|
|
278
|
-
>
|
|
279
|
-
<For each={grouped()}>
|
|
280
|
-
{([category, options], index) => (
|
|
281
|
-
<>
|
|
282
|
-
<Show when={category}>
|
|
283
|
-
<box paddingTop={index() > 0 ? 1 : 0} paddingLeft={3}>
|
|
284
|
-
<text fg={theme.accent} attributes={TextAttributes.BOLD}>
|
|
285
|
-
{category}
|
|
286
|
-
</text>
|
|
287
|
-
</box>
|
|
288
|
-
</Show>
|
|
289
|
-
<For each={options}>
|
|
290
|
-
{(option) => {
|
|
291
|
-
const active = createMemo(() => isDeepEqual(option.value, selected()?.value))
|
|
292
|
-
const current = createMemo(() => isDeepEqual(option.value, props.current))
|
|
293
|
-
return (
|
|
294
|
-
<box
|
|
295
|
-
id={JSON.stringify(option.value)}
|
|
296
|
-
flexDirection="row"
|
|
297
|
-
onMouseMove={() => {
|
|
298
|
-
setStore("input", "mouse")
|
|
299
|
-
}}
|
|
300
|
-
onMouseUp={() => {
|
|
301
|
-
option.onSelect?.(dialog)
|
|
302
|
-
props.onSelect?.(option)
|
|
303
|
-
}}
|
|
304
|
-
onMouseOver={() => {
|
|
305
|
-
if (store.input !== "mouse") return
|
|
306
|
-
const index = flat().findIndex((x) => isDeepEqual(x.value, option.value))
|
|
307
|
-
if (index === -1) return
|
|
308
|
-
moveTo(index)
|
|
309
|
-
}}
|
|
310
|
-
onMouseDown={() => {
|
|
311
|
-
const index = flat().findIndex((x) => isDeepEqual(x.value, option.value))
|
|
312
|
-
if (index === -1) return
|
|
313
|
-
moveTo(index)
|
|
314
|
-
}}
|
|
315
|
-
backgroundColor={active() ? (option.bg ?? theme.primary) : RGBA.fromInts(0, 0, 0, 0)}
|
|
316
|
-
paddingLeft={current() || option.gutter ? 1 : 3}
|
|
317
|
-
paddingRight={3}
|
|
318
|
-
gap={1}
|
|
319
|
-
>
|
|
320
|
-
<Option
|
|
321
|
-
title={option.title}
|
|
322
|
-
footer={option.footer}
|
|
323
|
-
description={option.description !== category ? option.description : undefined}
|
|
324
|
-
active={active()}
|
|
325
|
-
current={current()}
|
|
326
|
-
gutter={option.gutter}
|
|
327
|
-
/>
|
|
328
|
-
</box>
|
|
329
|
-
)
|
|
330
|
-
}}
|
|
331
|
-
</For>
|
|
332
|
-
</>
|
|
333
|
-
)}
|
|
334
|
-
</For>
|
|
335
|
-
</scrollbox>
|
|
336
|
-
</Show>
|
|
337
|
-
<Show when={keybinds().length} fallback={<box flexShrink={0} />}>
|
|
338
|
-
<box paddingRight={2} paddingLeft={4} flexDirection="row" gap={2} flexShrink={0} paddingTop={1}>
|
|
339
|
-
<For each={keybinds()}>
|
|
340
|
-
{(item) => (
|
|
341
|
-
<text>
|
|
342
|
-
<span style={{ fg: theme.text }}>
|
|
343
|
-
<b>{item.title}</b>{" "}
|
|
344
|
-
</span>
|
|
345
|
-
<span style={{ fg: theme.textMuted }}>{Keybind.toString(item.keybind)}</span>
|
|
346
|
-
</text>
|
|
347
|
-
)}
|
|
348
|
-
</For>
|
|
349
|
-
</box>
|
|
350
|
-
</Show>
|
|
351
|
-
</box>
|
|
352
|
-
)
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
function Option(props: {
|
|
356
|
-
title: string
|
|
357
|
-
description?: string
|
|
358
|
-
active?: boolean
|
|
359
|
-
current?: boolean
|
|
360
|
-
footer?: JSX.Element | string
|
|
361
|
-
gutter?: JSX.Element
|
|
362
|
-
onMouseOver?: () => void
|
|
363
|
-
}) {
|
|
364
|
-
const { theme } = useTheme()
|
|
365
|
-
const fg = selectedForeground(theme)
|
|
366
|
-
|
|
367
|
-
return (
|
|
368
|
-
<>
|
|
369
|
-
<Show when={props.current}>
|
|
370
|
-
<text flexShrink={0} fg={props.active ? fg : props.current ? theme.primary : theme.text} marginRight={0}>
|
|
371
|
-
●
|
|
372
|
-
</text>
|
|
373
|
-
</Show>
|
|
374
|
-
<Show when={!props.current && props.gutter}>
|
|
375
|
-
<box flexShrink={0} marginRight={0}>
|
|
376
|
-
{props.gutter}
|
|
377
|
-
</box>
|
|
378
|
-
</Show>
|
|
379
|
-
<text
|
|
380
|
-
flexGrow={1}
|
|
381
|
-
fg={props.active ? fg : props.current ? theme.primary : theme.text}
|
|
382
|
-
attributes={props.active ? TextAttributes.BOLD : undefined}
|
|
383
|
-
overflow="hidden"
|
|
384
|
-
wrapMode="none"
|
|
385
|
-
paddingLeft={3}
|
|
386
|
-
>
|
|
387
|
-
{Locale.truncate(props.title, 61)}
|
|
388
|
-
<Show when={props.description}>
|
|
389
|
-
<span style={{ fg: props.active ? fg : theme.textMuted }}> {props.description}</span>
|
|
390
|
-
</Show>
|
|
391
|
-
</text>
|
|
392
|
-
<Show when={props.footer}>
|
|
393
|
-
<box flexShrink={0}>
|
|
394
|
-
<text fg={props.active ? fg : theme.textMuted}>{props.footer}</text>
|
|
395
|
-
</box>
|
|
396
|
-
</Show>
|
|
397
|
-
</>
|
|
398
|
-
)
|
|
399
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { useKeyboard, useRenderer, useTerminalDimensions } from "@opentui/solid"
|
|
2
|
-
import { batch, createContext, Show, useContext, type JSX, type ParentProps } from "solid-js"
|
|
3
|
-
import { useTheme } from "@tui/context/theme"
|
|
4
|
-
import { Renderable, RGBA } from "@opentui/core"
|
|
5
|
-
import { createStore } from "solid-js/store"
|
|
6
|
-
import { Clipboard } from "@tui/util/clipboard"
|
|
7
|
-
import { useToast } from "./toast"
|
|
8
|
-
|
|
9
|
-
export function Dialog(
|
|
10
|
-
props: ParentProps<{
|
|
11
|
-
size?: "medium" | "large"
|
|
12
|
-
onClose: () => void
|
|
13
|
-
}>,
|
|
14
|
-
) {
|
|
15
|
-
const dimensions = useTerminalDimensions()
|
|
16
|
-
const { theme } = useTheme()
|
|
17
|
-
const renderer = useRenderer()
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<box
|
|
21
|
-
onMouseUp={async () => {
|
|
22
|
-
if (renderer.getSelection()) return
|
|
23
|
-
props.onClose?.()
|
|
24
|
-
}}
|
|
25
|
-
width={dimensions().width}
|
|
26
|
-
height={dimensions().height}
|
|
27
|
-
alignItems="center"
|
|
28
|
-
position="absolute"
|
|
29
|
-
paddingTop={dimensions().height / 4}
|
|
30
|
-
left={0}
|
|
31
|
-
top={0}
|
|
32
|
-
backgroundColor={RGBA.fromInts(0, 0, 0, 150)}
|
|
33
|
-
>
|
|
34
|
-
<box
|
|
35
|
-
onMouseUp={async (e) => {
|
|
36
|
-
if (renderer.getSelection()) return
|
|
37
|
-
e.stopPropagation()
|
|
38
|
-
}}
|
|
39
|
-
width={props.size === "large" ? 80 : 60}
|
|
40
|
-
maxWidth={dimensions().width - 2}
|
|
41
|
-
backgroundColor={theme.backgroundPanel}
|
|
42
|
-
paddingTop={1}
|
|
43
|
-
>
|
|
44
|
-
{props.children}
|
|
45
|
-
</box>
|
|
46
|
-
</box>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function init() {
|
|
51
|
-
const [store, setStore] = createStore({
|
|
52
|
-
stack: [] as {
|
|
53
|
-
element: JSX.Element
|
|
54
|
-
onClose?: () => void
|
|
55
|
-
}[],
|
|
56
|
-
size: "medium" as "medium" | "large",
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
useKeyboard((evt) => {
|
|
60
|
-
if (evt.name === "escape" && store.stack.length > 0) {
|
|
61
|
-
const current = store.stack.at(-1)!
|
|
62
|
-
current.onClose?.()
|
|
63
|
-
setStore("stack", store.stack.slice(0, -1))
|
|
64
|
-
evt.preventDefault()
|
|
65
|
-
evt.stopPropagation()
|
|
66
|
-
refocus()
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
const renderer = useRenderer()
|
|
71
|
-
let focus: Renderable | null
|
|
72
|
-
function refocus() {
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
if (!focus) return
|
|
75
|
-
if (focus.isDestroyed) return
|
|
76
|
-
function find(item: Renderable) {
|
|
77
|
-
for (const child of item.getChildren()) {
|
|
78
|
-
if (child === focus) return true
|
|
79
|
-
if (find(child)) return true
|
|
80
|
-
}
|
|
81
|
-
return false
|
|
82
|
-
}
|
|
83
|
-
const found = find(renderer.root)
|
|
84
|
-
if (!found) return
|
|
85
|
-
focus.focus()
|
|
86
|
-
}, 1)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
clear() {
|
|
91
|
-
for (const item of store.stack) {
|
|
92
|
-
if (item.onClose) item.onClose()
|
|
93
|
-
}
|
|
94
|
-
batch(() => {
|
|
95
|
-
setStore("size", "medium")
|
|
96
|
-
setStore("stack", [])
|
|
97
|
-
})
|
|
98
|
-
refocus()
|
|
99
|
-
},
|
|
100
|
-
replace(input: any, onClose?: () => void) {
|
|
101
|
-
if (store.stack.length === 0) {
|
|
102
|
-
focus = renderer.currentFocusedRenderable
|
|
103
|
-
focus?.blur()
|
|
104
|
-
}
|
|
105
|
-
for (const item of store.stack) {
|
|
106
|
-
if (item.onClose) item.onClose()
|
|
107
|
-
}
|
|
108
|
-
setStore("size", "medium")
|
|
109
|
-
setStore("stack", [
|
|
110
|
-
{
|
|
111
|
-
element: input,
|
|
112
|
-
onClose,
|
|
113
|
-
},
|
|
114
|
-
])
|
|
115
|
-
},
|
|
116
|
-
get stack() {
|
|
117
|
-
return store.stack
|
|
118
|
-
},
|
|
119
|
-
get size() {
|
|
120
|
-
return store.size
|
|
121
|
-
},
|
|
122
|
-
setSize(size: "medium" | "large") {
|
|
123
|
-
setStore("size", size)
|
|
124
|
-
},
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export type DialogContext = ReturnType<typeof init>
|
|
129
|
-
|
|
130
|
-
const ctx = createContext<DialogContext>()
|
|
131
|
-
|
|
132
|
-
export function DialogProvider(props: ParentProps) {
|
|
133
|
-
const value = init()
|
|
134
|
-
const renderer = useRenderer()
|
|
135
|
-
const toast = useToast()
|
|
136
|
-
return (
|
|
137
|
-
<ctx.Provider value={value}>
|
|
138
|
-
{props.children}
|
|
139
|
-
<box
|
|
140
|
-
position="absolute"
|
|
141
|
-
onMouseUp={async () => {
|
|
142
|
-
const text = renderer.getSelection()?.getSelectedText()
|
|
143
|
-
if (text && text.length > 0) {
|
|
144
|
-
await Clipboard.copy(text)
|
|
145
|
-
.then(() => toast.show({ message: "Copied to clipboard", variant: "info" }))
|
|
146
|
-
.catch(toast.error)
|
|
147
|
-
renderer.clearSelection()
|
|
148
|
-
}
|
|
149
|
-
}}
|
|
150
|
-
>
|
|
151
|
-
<Show when={value.stack.length}>
|
|
152
|
-
<Dialog onClose={() => value.clear()} size={value.size}>
|
|
153
|
-
{value.stack.at(-1)!.element}
|
|
154
|
-
</Dialog>
|
|
155
|
-
</Show>
|
|
156
|
-
</box>
|
|
157
|
-
</ctx.Provider>
|
|
158
|
-
)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export function useDialog() {
|
|
162
|
-
const value = useContext(ctx)
|
|
163
|
-
if (!value) {
|
|
164
|
-
throw new Error("useDialog must be used within a DialogProvider")
|
|
165
|
-
}
|
|
166
|
-
return value
|
|
167
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { JSX } from "solid-js"
|
|
2
|
-
import type { RGBA } from "@opentui/core"
|
|
3
|
-
import open from "open"
|
|
4
|
-
|
|
5
|
-
export interface LinkProps {
|
|
6
|
-
href: string
|
|
7
|
-
children?: JSX.Element | string
|
|
8
|
-
fg?: RGBA
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Link component that renders clickable hyperlinks.
|
|
13
|
-
* Clicking anywhere on the link text opens the URL in the default browser.
|
|
14
|
-
*/
|
|
15
|
-
export function Link(props: LinkProps) {
|
|
16
|
-
const displayText = props.children ?? props.href
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<text
|
|
20
|
-
fg={props.fg}
|
|
21
|
-
onMouseUp={() => {
|
|
22
|
-
open(props.href).catch(() => {})
|
|
23
|
-
}}
|
|
24
|
-
>
|
|
25
|
-
{displayText}
|
|
26
|
-
</text>
|
|
27
|
-
)
|
|
28
|
-
}
|