blob: d069bb982fc86a1bdc1c06177bc2ed37b484f074 (
plain) (
blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
import { html, Component } from "../lib/index.js";
import { keybindings } from "../keybindings.js";
import commands from "../commands.js";
function KeyBindingsHelp() {
let l = keybindings.map((binding) => {
let keys = [];
if (binding.ctrlKey) {
keys.push("Ctrl");
}
if (binding.altKey) {
keys.push("Alt");
}
keys.push(binding.key);
keys = keys.map((name, i) => {
return html`
${i > 0 ? "+" : null}
<kbd>${name}</kbd>
`;
});
return html`
<dt>${keys}</dt>
<dd>${binding.description}</dd>
`;
});
l.push(html`
<dt><kbd>Tab</kbd></dt>
<dd>Automatically complete nickname or channel</dd>
`);
if (!window.matchMedia("(pointer: none)").matches) {
l.push(html`
<dt><strong>Middle mouse click</strong></dt>
<dd>Close buffer</dd>
`);
}
return html`<dl>${l}</dl>`;
}
function CommandsHelp() {
let l = Object.keys(commands).map((name) => {
let cmd = commands[name];
let usage = [html`<strong>/${name}</strong>`];
if (cmd.usage) {
usage.push(" " + cmd.usage);
}
return html`
<dt><code>${usage}</code></dt>
<dd>${cmd.description}</dd>
`;
});
return html`<dl>${l}</dl>`;
}
export default function Help() {
return html`
<h3>Key bindings</h3>
<${KeyBindingsHelp}/>
<h3>Commands</h3>
<${CommandsHelp}/>
`;
}
|