-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtui.ts
More file actions
39 lines (33 loc) · 906 Bytes
/
Copy pathtui.ts
File metadata and controls
39 lines (33 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const VISUALIZER_URL = "http://localhost:5173"
interface ToastApi {
show(input: { message: string; variant: "success" | "error" | "info" | "warning" }): void
}
interface KeymapBinding {
description: string
handler: () => void | Promise<void>
}
interface KeymapApi {
registerLayer(input: { id: string; bindings: Record<string, KeymapBinding> }): () => void
}
interface PluginApi {
ui: { toast: ToastApi }
keymap: KeymapApi
}
const TuiVisualizerPlugin = async (api: PluginApi) => {
api.keymap.registerLayer({
id: "ocv-commands",
bindings: {
"/visualizer": {
description: "Show the session visualizer URL",
handler: () => {
api.ui.toast.show({
message: `Visualizer: ${VISUALIZER_URL}`,
variant: "info",
})
},
},
},
})
}
export { TuiVisualizerPlugin }
export default { tui: TuiVisualizerPlugin }