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.psuh("Ctrl"); } if (binding.altKey) { keys.push("Alt"); } keys.push(binding.key); keys = keys.map((name, i) => { return html` ${i > 0 ? "+" : null} ${name} `; }); return html`
${keys}
${binding.description}
`; }); if (!window.matchMedia("(pointer: none)").matches) { l.push(html`
Middle mouse click
Close buffer
`); } return html`
${l}
`; } function CommandsHelp() { let l = Object.keys(commands).map((name) => { let cmd = commands[name]; let usage = [html`/${name}`]; if (cmd.usage) { usage.push(" " + cmd.usage); } return html`
${usage}
${cmd.description}
`; }); return html`
${l}
`; } export default function Help() { return html`

Key bindings

<${KeyBindingsHelp}/>

Commands

<${CommandsHelp}/> `; }