@inklu/keys 2.0.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,426 +0,0 @@
1
- import { FormatDisplayOptions, Hotkey as Hotkey$1, HotkeySequence } from "@tanstack/hotkeys";
2
- //#region src/types.d.ts
3
- /** A single hotkey chord, e.g. `"Mod+K"`. */
4
- type Chord = Hotkey$1;
5
- /** A sequence of chords pressed in order, e.g. `G` then `I`. */
6
- interface SequenceBinding {
7
- readonly sequence: HotkeySequence;
8
- }
9
- /** A hotkey chord or sequence that triggers a command. */
10
- type Binding = Chord | SequenceBinding;
11
- /** One binding or an array of alternative bindings. */
12
- type BindingInput = Binding | ReadonlyArray<Binding>;
13
- /** JSON-serializable form of a binding. */
14
- type SerializedBinding = string | Array<string>;
15
- /** An arbitrary JSON-compatible value, e.g. from `JSON.parse` or persisted storage. */
16
- type Json = string | number | boolean | null | ReadonlyArray<Json> | {
17
- readonly [key: string]: Json;
18
- };
19
- /** Trigger source for a command. */
20
- type CommandSource = "keyboard" | "api" | "dom";
21
- /** Context passed to a command's `run` handler. */
22
- interface CommandContext<Id extends string = string> {
23
- /** ID of the command being run. */
24
- readonly id: Id;
25
- /** How the command was triggered. */
26
- readonly source: CommandSource;
27
- /** Originating DOM event, if triggered by user interaction. */
28
- readonly event?: Event;
29
- /** Specific binding that triggered the command. */
30
- readonly binding?: Binding;
31
- /**
32
- * The commands registry instance.
33
- *
34
- * @example
35
- * ```ts
36
- * run: ({ commands }) => {
37
- * commands.setEnabled("doc.publish", false);
38
- * commands.run("doc.save");
39
- * }
40
- * ```
41
- */
42
- readonly commands: Commands<Id>;
43
- }
44
- /**
45
- * Definition of a command and its default configuration.
46
- *
47
- * `Id` is the registry's id union. `createCommands` fills it in, so
48
- * `commands.run(...)` inside a handler is checked against the registry's own
49
- * ids; a definition written on its own defaults to plain `string`.
50
- */
51
- interface CommandDefinition<Id extends string = string> {
52
- /** Human-readable title. */
53
- title: string;
54
- /** Longer explanation, such as a palette's secondary line or a tooltip. */
55
- description?: string;
56
- /** Heading to list the command under in a palette or shortcut sheet, e.g. `"Navigate"`. */
57
- group?: string;
58
- /** Extra search terms `matchCommands` checks besides the title, e.g. `["find", "search"]`. */
59
- keywords?: ReadonlyArray<string>;
60
- /**
61
- * Leave the command out of `matchCommands` — for commands that only make
62
- * sense from their key, like a palette's own Close. It still runs and
63
- * still appears in `list()`. Defaults to `false`.
64
- */
65
- hidden?: boolean;
66
- /** Default key binding(s). */
67
- keys?: BindingInput;
68
- /** Scope required for this command to fire. Omit for global, or `"*"` to bypass exclusive scopes. */
69
- scope?: string;
70
- /** Guard function evaluated before running. */
71
- when?: () => boolean;
72
- /** Whether the command is enabled. Defaults to `true`. */
73
- enabled?: boolean;
74
- /**
75
- * Prevent default event behavior when run. Defaults to `true`. For a
76
- * sequence this also covers each step as it matches, so a first step such
77
- * as `Mod+K` does not trigger the browser's own shortcut on the way.
78
- */
79
- preventDefault?: boolean;
80
- /**
81
- * Whether to ignore key events from text inputs, textareas and
82
- * contenteditable elements. When omitted, TanStack Hotkeys decides per
83
- * binding: chords holding Control or Meta (so `Mod+…`) and bare `Escape`
84
- * still fire inside inputs, while everything else — bare keys, Shift/Alt
85
- * chords, and sequences starting with one — is ignored there, so typing is
86
- * never hijacked.
87
- */
88
- ignoreInputs?: boolean;
89
- /** Require key release before firing again (prevents auto-repeat). Defaults to `false`. */
90
- requireReset?: boolean;
91
- /** Timeout in milliseconds between sequence steps. Defaults to `1000`. */
92
- sequenceTimeout?: number;
93
- /** Handler executed when the command runs. */
94
- run: (context: CommandContext<Id>) => void | Promise<void>;
95
- }
96
- /** Resolved command snapshot including effective bindings, display tokens, and reachability. */
97
- interface Command<Id extends string = string> {
98
- readonly id: Id;
99
- readonly title: string;
100
- readonly description?: string;
101
- readonly group?: string;
102
- /** Extra search terms; empty when the definition gave none. */
103
- readonly keywords: ReadonlyArray<string>;
104
- /** Whether `matchCommands` leaves the command out. */
105
- readonly hidden: boolean;
106
- readonly scope?: string;
107
- /** Active bindings after user overrides. */
108
- readonly bindings: ReadonlyArray<Binding>;
109
- /** Formatted display strings for active bindings. */
110
- readonly display: ReadonlyArray<string>;
111
- /** Formatted tokens per binding for rendering `<kbd>` elements. */
112
- readonly tokens: ReadonlyArray<ReadonlyArray<string>>;
113
- /**
114
- * Value for the `aria-keyshortcuts` attribute. Only chords appear here: the
115
- * attribute separates alternatives with spaces, so it cannot express a
116
- * sequence. Use `spoken` to announce those.
117
- */
118
- readonly aria: string;
119
- /**
120
- * Every binding phrased for a screen reader, alternatives joined by
121
- * `" or "` — e.g. `"Control+K"` or `"G then I"`. Suited to visually hidden
122
- * text or `aria-description`, and the only accessible form of a sequence.
123
- */
124
- readonly spoken: string;
125
- /** Whether the command is enabled. */
126
- readonly enabled: boolean;
127
- /** Whether the command is enabled and in an active scope. */
128
- readonly reachable: boolean;
129
- /** Whether the command has a user keymap override. */
130
- readonly overridden: boolean;
131
- }
132
- /** Supported platforms for hotkey resolution and display formatting. */
133
- type Platform = "mac" | "windows" | "linux";
134
- /** Storage interface for persisting keymap overrides. */
135
- interface KeymapStorage {
136
- getItem: (key: string) => string | null;
137
- setItem: (key: string, value: string) => void;
138
- removeItem: (key: string) => void;
139
- }
140
- /** Configuration for persisting keymap overrides. */
141
- interface KeymapPersistence {
142
- /** Storage key name. Defaults to `"inklu.keys"`. */
143
- key?: string;
144
- /** Getter returning the storage implementation lazily. */
145
- storage: () => KeymapStorage | null;
146
- }
147
- /**
148
- * How two bindings collide: `"exact"` when they are the same keys, `"prefix"`
149
- * when one is the start of the other — chord `G` against `G then I` — so the
150
- * shorter one fires on the way to the longer one.
151
- */
152
- type ConflictKind = "exact" | "prefix";
153
- /** Details of a conflict between commands whose bindings collide in overlapping scopes. */
154
- interface Conflict<Id extends string = string> {
155
- /** ID of the conflicting command. */
156
- readonly id: Id;
157
- /** The conflicting command's binding. */
158
- readonly binding: Binding;
159
- /** Whether the bindings are identical or one is a prefix of the other. */
160
- readonly kind: ConflictKind;
161
- /** Formatted display representation of the binding. */
162
- readonly display: string;
163
- /** Overlapping scope where conflict occurs, if any. */
164
- readonly scope?: string;
165
- }
166
- /** Options for activating a scope. */
167
- interface ScopeOptions {
168
- /** Shadow commands in lower scopes, including global commands. */
169
- exclusive?: boolean;
170
- /**
171
- * Also shadow `"*"` commands, which otherwise survive every barrier.
172
- * Implies `exclusive`. Meant for surfaces that must own the whole keyboard,
173
- * such as recording a new shortcut.
174
- */
175
- strict?: boolean;
176
- }
177
- //#endregion
178
- //#region src/display.d.ts
179
- /** Display options for formatting hotkeys. */
180
- type DisplayOptions = Omit<FormatDisplayOptions, "parts">;
181
- /** Formats a binding for display on the target platform (e.g. `⌘K` or `Ctrl+K`). */
182
- declare function formatBinding(binding: Binding, options?: DisplayOptions): string;
183
- /** Splits a binding into display tokens for rendering `<kbd>` elements. */
184
- declare function bindingTokens(binding: Binding, options?: DisplayOptions): Array<string>;
185
- /**
186
- * Phrases a binding for a screen reader: `"Control+K"` for a chord,
187
- * `"G then I"` for a sequence. `aria-keyshortcuts` cannot express a sequence
188
- * (a space there means "or"), so this is how a sequence gets announced — put it
189
- * in visually hidden text or `aria-description`.
190
- */
191
- declare function spokenBinding(binding: Binding, platform?: Platform): string;
192
- /** Generates an `aria-keyshortcuts` attribute string for a binding. */
193
- declare function ariaKeyShortcuts(binding: Binding, platform?: Platform): string;
194
- //#endregion
195
- //#region src/keymap.d.ts
196
- /** One command's stored override: an array replaces the default, `{ add }` extends it. */
197
- type SerializedOverride = Array<SerializedBinding> | {
198
- add: Array<SerializedBinding>;
199
- };
200
- /** Persisted user overrides, keyed by command id. */
201
- interface SerializedKeymap {
202
- /** Format version, so a release can skip a format it does not know instead of misreading it. */
203
- version: 1;
204
- overrides: Record<string, SerializedOverride>;
205
- }
206
- /** Keymap interface for querying, modifying, and persisting keybindings. */
207
- interface CommandKeymap<Id extends string = string> {
208
- /** Active bindings in effect: the default, with any user override applied. */
209
- get(id: Id | (string & {})): ReadonlyArray<Binding>;
210
- /**
211
- * Replaces a command's bindings. Passing `null` unbinds it without
212
- * restoring the default; passing exactly the default forgets the override,
213
- * so the command follows the default again if the app changes it.
214
- */
215
- set(id: Id | (string & {}), input: BindingInput | null): void;
216
- /**
217
- * Appends an additional binding. On a command the user has not replaced,
218
- * it is stored on top of the default rather than as a copy of it, so a
219
- * default the app changes later still applies alongside the added keys.
220
- */
221
- add(id: Id | (string & {}), input: BindingInput): void;
222
- /** Resets user overrides back to defaults for a specific command or all commands. */
223
- reset(id?: Id | (string & {})): void;
224
- /** Exports user overrides as JSON-serializable data. */
225
- export(): SerializedKeymap;
226
- /**
227
- * Imports user overrides, replacing current overrides and saving to
228
- * storage. Accepts `export()` output from this and earlier releases.
229
- */
230
- import(data: Json): void;
231
- }
232
- //#endregion
233
- //#region src/registry.d.ts
234
- /** Configuration options for a commands registry. */
235
- interface CommandsOptions<Id extends string = string> {
236
- /**
237
- * Replaces the default `keys` a command was defined with, keyed by command
238
- * id. Lets an app rebind commands it did not define — a package ships the
239
- * behaviour, the app decides which key reaches it — and an unknown id is a
240
- * compile error rather than a silent no-op. `null` ships the command with
241
- * no default binding at all.
242
- *
243
- * These are defaults, applied before persisted overrides load, so a user's
244
- * own rebinding still wins.
245
- *
246
- * @example
247
- * ```ts
248
- * createCommands(commands, {
249
- * bindings: { "palette.open": "Mod+P", "doc.publish": null },
250
- * });
251
- * ```
252
- */
253
- bindings?: Partial<Record<Id, BindingInput | null>>;
254
- /** Platform for modifier resolution and display formatting. Defaults to auto-detection. */
255
- platform?: Platform;
256
- /** Target element for key events. Defaults to `document`. */
257
- target?: HTMLElement | Document | Window | null;
258
- /**
259
- * Persistence configuration for user keymap overrides. Overrides are read
260
- * on the first `mount()` rather than at creation, so the server render and
261
- * the client's first render agree and hydration never mismatches; the
262
- * registry notifies subscribers once they load.
263
- */
264
- persist?: KeymapPersistence;
265
- /**
266
- * Whether single-key shortcuts — bindings where every step is a printable
267
- * character with no Control, Alt or Meta, such as `?` or `G then I` — are
268
- * active. Defaults to `true`. WCAG 2.1.4 requires a way to turn these off
269
- * for speech-input and motor-impaired users; wire a setting to
270
- * `commands.setSingleKeyShortcuts()`.
271
- */
272
- singleKeyShortcuts?: boolean;
273
- /** Display options for rendering shortcuts. */
274
- display?: DisplayOptions;
275
- /**
276
- * Callback fired whenever a command runs.
277
- *
278
- * @example
279
- * ```ts
280
- * createCommands(definitions, {
281
- * onRun: ({ id }) => logRun(id),
282
- * });
283
- * ```
284
- */
285
- onRun?: (context: CommandContext<Id>) => void;
286
- /**
287
- * Error handler called when a command, its `when()` guard, or `onRun`
288
- * throws. Defaults to `console.error`.
289
- */
290
- onError?: (error: Error, context: CommandContext<Id>) => void;
291
- }
292
- /** Options passed when manually running a command. */
293
- interface RunOptions {
294
- /** Trigger source. Defaults to `"api"`. */
295
- source?: CommandSource;
296
- /** Originating DOM event. */
297
- event?: Event;
298
- }
299
- /** Options for conflict detection. */
300
- interface ConflictOptions<Id extends string = string> {
301
- /** Command ID to ignore during conflict checking. */
302
- ignore?: Id;
303
- /** Scope to evaluate conflicts in. Defaults to global. */
304
- scope?: string;
305
- }
306
- /** Reason why a command cannot run. */
307
- type RunBlockReason = "unknown" | "disabled" | "out-of-scope" | "guarded";
308
- /** Represents a partially completed key sequence. */
309
- interface PendingSequence<Id extends string = string> {
310
- /** Command ID. */
311
- readonly id: Id;
312
- /** Sequence binding being typed. */
313
- readonly binding: SequenceBinding;
314
- /** Number of steps matched so far. */
315
- readonly matched: number;
316
- /** Total steps in the sequence. */
317
- readonly total: number;
318
- /** Formatted remaining steps. */
319
- readonly remaining: ReadonlyArray<string>;
320
- }
321
- /** Handle for a dynamically registered runtime command. */
322
- interface CommandHandle {
323
- /** Runs the command. Returns `true` if executed. */
324
- run: (options?: RunOptions) => boolean;
325
- /** Disposes and unregisters the command. */
326
- dispose: () => void;
327
- }
328
- /** Public interface for the commands registry. */
329
- interface Commands<Id extends string = string> {
330
- /** Keymap holding default and user bindings. */
331
- readonly keymap: CommandKeymap<Id>;
332
- /** Retrieves a command's snapshot, or `undefined` if unregistered. */
333
- get(id: Id | (string & {})): Command<Id> | undefined;
334
- /** Returns all registered commands in definition order. */
335
- list(): ReadonlyArray<Command<Id>>;
336
- /**
337
- * The command list as the server renders it: the commands passed to
338
- * `createCommands` with their default bindings (after `options.bindings`),
339
- * formatted for the server platform — no runtime `add()`, scope, user
340
- * override or `setEnabled` applied. Referentially stable. This is the
341
- * `getServerSnapshot` the React hooks hand `useSyncExternalStore`, so a
342
- * subtree that hydrates after the client state moved on still matches the
343
- * server's HTML.
344
- */
345
- serverList(): ReadonlyArray<Command<Id>>;
346
- /** Runs a command by ID. Returns `true` if executed. */
347
- run(id: Id, options?: RunOptions): boolean;
348
- /** Checks whether a command can run currently. */
349
- canRun(id: Id | (string & {})): boolean;
350
- /** Returns why a command cannot run, or `null` if executable. */
351
- whyNotRun(id: Id | (string & {})): RunBlockReason | null;
352
- /** Enables or disables a command. */
353
- setEnabled(id: Id | (string & {}), enabled: boolean): void;
354
- /** Registers a command at runtime. */
355
- add(id: Id | (string & {}), definition: CommandDefinition<Id>): CommandHandle;
356
- /** Removes a command registration. */
357
- remove(id: Id | (string & {})): void;
358
- /** Activates a scope until the returned disposal function is called. */
359
- pushScope(name: string, options?: ScopeOptions): () => void;
360
- /**
361
- * Finds commands in overlapping scopes whose bindings collide with the given
362
- * one — the same keys (`kind: "exact"`), or one a prefix of the other, like
363
- * chord `G` against `G then I` (`kind: "prefix"`).
364
- */
365
- conflicts(binding: BindingInput, options?: ConflictOptions<Id>): Array<Conflict<Id>>;
366
- /** Formats a command's primary binding for display. */
367
- display(id: Id | (string & {})): string;
368
- /** Splits a command's primary binding into `<kbd>` tokens. */
369
- tokens(id: Id | (string & {})): Array<string>;
370
- /** Returns currently active partially-typed sequences. */
371
- pending(): ReadonlyArray<PendingSequence<Id>>;
372
- /** Subscribes to sequence progress changes. */
373
- subscribePending(listener: () => void): () => void;
374
- /** Starts listening for key events. Returns an unmount function. */
375
- mount(): () => void;
376
- /** Subscribes to registry changes. Returns an unsubscribe function. */
377
- subscribe(listener: () => void): () => void;
378
- /** Whether single-key shortcuts are active. See `CommandsOptions.singleKeyShortcuts`. */
379
- readonly singleKeyShortcuts: boolean;
380
- /** Turns single-key shortcuts on or off for every command (WCAG 2.1.4). */
381
- setSingleKeyShortcuts(enabled: boolean): void;
382
- /** Tears down listeners and clears all command registrations. */
383
- destroy(): void;
384
- }
385
- /**
386
- * Creates a command registry.
387
- *
388
- * @example
389
- * ```ts
390
- * export const commands = createCommands({
391
- * "palette.open": {
392
- * title: "Open command palette",
393
- * keys: "Mod+K",
394
- * run: () => setPaletteOpen(true),
395
- * },
396
- * "nav.inbox": {
397
- * title: "Go to inbox",
398
- * keys: seq("G", "I"),
399
- * run: () => navigate("/inbox"),
400
- * },
401
- * });
402
- * ```
403
- */
404
- declare function createCommands<Id extends string>(definitions: { [K in Id]: CommandDefinition<Id>; }, options?: CommandsOptions<NoInfer<Id>>): Commands<Id>;
405
- /**
406
- * Extracts command ID union from a Commands registry type.
407
- *
408
- * @example
409
- * ```ts
410
- * export const commands = createCommands({ … });
411
- * export type AppCommandId = CommandId<typeof commands>;
412
- * ```
413
- */
414
- type CommandId<C> = C extends Commands<infer Id> ? Id : never;
415
- //#endregion
416
- //#region src/attributes.d.ts
417
- interface ObserveOptions {
418
- /** Root document or element to delegate from. Defaults to `document`. */
419
- root?: Document | Element;
420
- }
421
- /**
422
- * Wires a commands registry to DOM data attributes. Returns a cleanup function.
423
- */
424
- declare function observe<Id extends string>(registry: Commands<Id>, options?: ObserveOptions): () => void;
425
- //#endregion
426
- export { HotkeySequence as A, Command as C, Conflict as D, CommandSource as E, SequenceBinding as F, SerializedBinding as I, KeymapStorage as M, Platform as N, ConflictKind as O, ScopeOptions as P, Chord as S, CommandDefinition as T, bindingTokens as _, Commands as a, Binding as b, PendingSequence as c, createCommands as d, CommandKeymap as f, ariaKeyShortcuts as g, DisplayOptions as h, CommandId as i, KeymapPersistence as j, Hotkey$1 as k, RunBlockReason as l, SerializedOverride as m, observe as n, CommandsOptions as o, SerializedKeymap as p, CommandHandle as r, ConflictOptions as s, ObserveOptions as t, RunOptions as u, formatBinding as v, CommandContext as w, BindingInput as x, spokenBinding as y };
@@ -1,116 +0,0 @@
1
- import { C as Command, D as Conflict, F as SequenceBinding, N as Platform, S as Chord, a as Commands, b as Binding } from "./attributes-DotLr2MW.mjs";
2
- import { Hotkey } from "@tanstack/hotkeys";
3
- //#region src/bindings.d.ts
4
- /**
5
- * Creates a sequence binding from ordered hotkey steps.
6
- *
7
- * @example
8
- * ```ts
9
- * keys: seq("G", "I")
10
- * ```
11
- */
12
- declare function seq(...steps: Array<Hotkey>): SequenceBinding;
13
- /**
14
- * Whether every step of a binding is a single printable character with no
15
- * Control, Alt or Meta — the "character key shortcuts" WCAG 2.1.4 lets users
16
- * turn off, since speech input and stray keypresses trigger them by accident.
17
- * Shift does not count as a modifier here: `Shift+A` still types a character.
18
- */
19
- declare function isSingleKeyBinding(binding: Binding, platform?: Platform): boolean;
20
- /** Validation result for a hotkey binding. */
21
- interface BindingValidation {
22
- readonly valid: boolean;
23
- readonly errors: ReadonlyArray<string>;
24
- readonly warnings: ReadonlyArray<string>;
25
- }
26
- /** Validates a binding's syntax without logging warnings or errors. */
27
- declare function validateBinding(binding: Binding): BindingValidation;
28
- //#endregion
29
- //#region src/rebind.d.ts
30
- /** Hotkey capture mode: single `"chord"` or multi-step `"sequence"`. */
31
- type RebindMode = "chord" | "sequence";
32
- /** Current state of a rebinding session. */
33
- interface RebindState<Id extends string = string> {
34
- /** Whether keys are actively being recorded. */
35
- readonly recording: boolean;
36
- /** Most recently captured binding. */
37
- readonly binding: Binding | null;
38
- /** Captured steps in the current sequence session. */
39
- readonly steps: ReadonlyArray<Chord>;
40
- /** Conflicting commands for the captured binding. */
41
- readonly conflicts: ReadonlyArray<Conflict<Id>>;
42
- }
43
- /** Options for creating a rebinder. */
44
- interface RebindOptions<Id extends string = string> {
45
- /** Capture mode. Defaults to `"chord"`. */
46
- mode?: RebindMode;
47
- /** Whether to write the recorded (or cleared) binding into the keymap. Defaults to `true`. */
48
- apply?: boolean;
49
- /** Whether to append rather than replace existing bindings. Defaults to `false`. */
50
- add?: boolean;
51
- /** Prevent applying bindings that conflict with other commands. Defaults to `false`. */
52
- rejectConflicts?: boolean;
53
- /** Ignore key events from inputs while recording. Defaults to `true`. */
54
- ignoreInputs?: boolean;
55
- /** Inactivity timeout in milliseconds before a sequence commits. */
56
- idleTimeout?: number;
57
- /** Callback fired when a binding is recorded. */
58
- onRecord?: (binding: Binding, conflicts: ReadonlyArray<Conflict<Id>>) => void;
59
- /** Callback fired when recording is cancelled. */
60
- onCancel?: () => void;
61
- /** Callback fired when Backspace or Delete clears the binding while recording. */
62
- onClear?: () => void;
63
- }
64
- /** Controller instance for managing a rebinding session. */
65
- interface Rebinder<Id extends string = string> {
66
- /** Begins capturing keys. */
67
- start: () => void;
68
- /** Stops capturing keys without recording. */
69
- stop: () => void;
70
- /** Stops capturing keys and reports cancellation. */
71
- cancel: () => void;
72
- /** Commits the currently captured sequence steps. */
73
- commit: () => void;
74
- /** Current rebinder state. */
75
- readonly state: RebindState<Id>;
76
- /** Subscribes to rebinder state changes. Returns an unsubscribe function. */
77
- subscribe: (listener: () => void) => () => void;
78
- /** Destroys the rebinder and cleans up listeners. */
79
- destroy: () => void;
80
- }
81
- /**
82
- * Creates a rebinder instance for capturing and remapping a command's keys.
83
- *
84
- * @example
85
- * ```ts
86
- * const rebinder = createRebinder(commands, "palette.open", {
87
- * onRecord: (binding, conflicts) => {
88
- * if (conflicts.length) console.warn("Conflict with", conflicts[0].id);
89
- * },
90
- * });
91
- * rebinder.start();
92
- * ```
93
- */
94
- declare function createRebinder<Id extends string>(registry: Commands<Id>, id: Id, options?: RebindOptions<Id>): Rebinder<Id>;
95
- //#endregion
96
- //#region src/scopes.d.ts
97
- /** Wildcard scope identifier for commands that remain active across exclusive scopes. */
98
- declare const ALWAYS_SCOPE = "*";
99
- //#endregion
100
- //#region src/search.d.ts
101
- /**
102
- * Filters commands for a search query, as a command palette does, leaving
103
- * out `hidden` ones. Every word of the query must appear somewhere in the
104
- * command — title, description, group, keywords, id or displayed shortcut —
105
- * in any order. Title matches come first: titles starting with the query,
106
- * then titles containing every word, then the rest; each tier keeps the
107
- * list's own order. An empty query returns every visible command.
108
- *
109
- * @example
110
- * ```ts
111
- * const results = matchCommands(commands.list(), "go inbox");
112
- * ```
113
- */
114
- declare function matchCommands<Id extends string>(commands: ReadonlyArray<Command<Id>>, query: string): Array<Command<Id>>;
115
- //#endregion
116
- export { RebindState as a, BindingValidation as c, validateBinding as d, RebindOptions as i, isSingleKeyBinding as l, ALWAYS_SCOPE as n, Rebinder as o, RebindMode as r, createRebinder as s, matchCommands as t, seq as u };