docs: cover addCommand/addShortcut/addTheme/notify, branding.links + accent, spoilers
This commit is contained in:
parent
572a9d9c5f
commit
f06cc502f0
3 changed files with 29 additions and 0 deletions
|
|
@ -88,6 +88,10 @@ instead. See **[Compiled plugins](https://orbit.tchatou.fr/docs/compiled-plugins
|
|||
| `orbit.addSettingsSection({label, icon?, render})` | add a whole Settings section |
|
||||
| `orbit.addMessageDecorator(m => …)` | inline UI after every message's text; `m` = `{id, nick, text, raw, kind, ts, mine}` (`text` is formatting-stripped, `raw` keeps mIRC codes) |
|
||||
| `orbit.addMessageAction(m => …)` | a button in every message's hover action toolbar (next to reply/react); same `m` |
|
||||
| `orbit.addCommand(name, {run, help?})` | register a `/slash` command — `run(args, rest)`; built-ins take priority |
|
||||
| `orbit.addShortcut(combo, run)` | register a keyboard shortcut, e.g. `"mod+shift+k"` (mod = Cmd/Ctrl) |
|
||||
| `orbit.addTheme(id, {name, vars, css?, icon?, color?})` | register a runtime theme; shows in Settings → Appearance |
|
||||
| `orbit.notify(title, body?)` | fire a brand-styled desktop notification (asks permission once) |
|
||||
| `orbit.h / orbit.html` | render helpers |
|
||||
| `log(…)` | namespaced console logger |
|
||||
|
||||
|
|
@ -114,6 +118,27 @@ to reply/react. Every contributed slot, action and decorator renders inside its
|
|||
own error boundary, so a crashing plugin renders nothing instead of taking down
|
||||
the app.
|
||||
|
||||
Commands, shortcuts and themes hang off the same api:
|
||||
|
||||
```js
|
||||
orbit.addCommand('roll', {
|
||||
help: 'Roll a die: /roll [sides]',
|
||||
run: (args) => orbit.irc.say('rolled ' + (1 + Math.floor(Math.random() * (+args[0] || 6)))),
|
||||
});
|
||||
|
||||
orbit.addShortcut('mod+shift+r', () => orbit.notify('Orbit', 'shortcut fired'));
|
||||
|
||||
orbit.addTheme('midnight', {
|
||||
name: 'Midnight',
|
||||
color: '#0b0f1a',
|
||||
vars: { '--bg': '#0b0f1a', '--accent': '#6ea8fe' },
|
||||
});
|
||||
```
|
||||
|
||||
A `/command` you register loses to a built-in of the same name. `mod` in a
|
||||
shortcut is Cmd on macOS and Ctrl elsewhere. `orbit.notify` fires even when the
|
||||
tab is focused and asks for permission the first time.
|
||||
|
||||
### Localization (i18n)
|
||||
|
||||
The UI ships in 10 languages — keep your plugin in step so it isn't stuck in one. Two ways:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue