plugin-api/CommandRegistry#
baseCommandId()#
The id without its per-plot suffix: nuclei.peaks.copy-table@plot-3 is nuclei.peaks.copy-table.
Parameters#
| Parameter | Type |
|---|---|
id |
string |
Returns#
string
keyScopesOverlap()#
Whether two key scopes can be live at the same moment, so one chord in both is ambiguous.
Parameters#
| Parameter | Type |
|---|---|
a |
KeyScope | undefined |
b |
KeyScope | undefined |
Returns#
boolean
normalizeKeybinding()#
Normalise a stored binding so equal chords compare equal.
Args:
binding: Mod+Shift+K, mod+[, ?, Esc and so on. ? is read as shift+/.
Returns: Modifiers sorted, the key folded to its canonical token, all lowercase.
Parameters#
| Parameter | Type |
|---|---|
binding |
string |
Returns#
string
resolveCommandLabel()#
The enforced display name: "{scope}: {command}".
Parameters#
| Parameter | Type |
|---|---|
def |
CommandDef |
Returns#
string
resolveCommandScope()#
The qualifier alone.
Parameters#
| Parameter | Type |
|---|---|
def |
CommandDef |
Returns#
string
resolveCommandTitle()#
The command part alone, with any accidental scope prefix removed. Titles given as functions are re-evaluated on every read.
Parameters#
| Parameter | Type |
|---|---|
def |
CommandDef |
Returns#
string
useCommands()#
React hook returning the currently-visible commands, re-rendering on any
registry change. Live subscription matters: plugins load sequentially and
late (after the backend handshake), so commands can register while the
palette is already open. With active false (a closed palette) it returns
nothing and does not subscribe: every undoable edit bumps the registry.
Parameters#
| Parameter | Type |
|---|---|
hasCapability? |
(capability) => boolean |
active? |
boolean |
Returns#
commandsRegistry#
CommandDef#
Properties#
blockedInText?#
Not while the user is typing in a field (page navigation chords, which the field may use).
capability?#
Device capability gate, mirroring TuneOperationDef.
capture?#
Dispatch in the capture phase, for chords an editor would otherwise consume (mod+k).
category?#
extraKeybindings?#
More chords for the same command (mod+y beside mod+shift+z for redo).
icon?#
id#
nuclei.<area>.<verb> for core, plugin:<shortId>.<verb> for plugins.
isEnabled?#
Display-time predicate — shown greyed out and not invocable.
Returns#
boolean
isVisible?#
Display-time predicate — hidden rows are not listed and cannot be run by key.
Returns#
boolean
keybinding?#
e.g. mod+shift+r, or a bare key such as f. Dispatched from one listener so conflicts are detectable.
keyScope?#
Where the keybinding is live. Required for a bare key. NOT scope, which is the display
qualifier of the title.
keywords?#
order?#
plotHostId?#
For a per-plot command: the plot host it belongs to, so only the active plot's runs.
run#
Returns#
void | Promise<void>
scope#
The qualifier in "{scope}: {command}" — the localized page title for
page-bound built-ins, the plugin's display name for plugin commands
(injected by the bundle loader's proxy, so a plugin cannot spoof another
plugin's scope), or one explicit word for genuinely global commands.
Resolved at DISPLAY time, hence the thunk: page titles are localized and plugin translations can land after the command registers.
title#
The command part ONLY — "Save as…", never "Reports: Save as…".
The "{scope}: {command}" display name is composed by the registry, so
authors cannot get the format wrong and cannot skip the scope.
Lazy thunk or plain string. A thunk is required whenever the title comes
from i18n: plugin translations register into plugin:${shortId} and can
land after the command does, and core titles must re-resolve on a
language change. Same pattern as TuneOperationDef.label.
KeybindingConflict#
Properties#
commandIds#
keybinding#
KeybindingOverrides#
The user's chord for a command id: a chord, or null for "unbound".
KeyScope#
Where a keybinding is live.
undefined: the app, outside a dialog. Modified chords also work while typing.'global': also inside a dialog.'plot','plot1d','plot2d': only while that plot is the active surface (it, or its sidebar, has focus, or the pointer is over it with nothing focused).'tool:<id>': only while plot tool<id>is active on the active plot.'editor:<id>': only while that editor has the keyboard; it suspends plot scope.