@tooee/commands 0.10.0 → 0.10.2

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 +1 @@
1
- {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAkBhD,gFAAgF;AAChF,2EAA2E;AAC3E,oEAAoE;AACpE,oEAAoE;AAEpE;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,aAAa,CACjD,MAA2B,EAC3B,MAAoB;IAEpB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;YACzE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG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b,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC5C,CAAC;QACH,CAAC;QAED,iDAAiD;QACjD,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QAErD,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC/E,CAAC;IAED,eAAe,CAAC,OAAuB;QACrC,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,KAAK;QACH,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;IAEO,UAAU;QAChB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC3B,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAEO,UAAU;QAChB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;IACH,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
- import type { CommandHandler, CommandWhen } from "./types.js";
2
1
  import type { Mode } from "./mode.js";
2
+ import type { CommandHandler, CommandWhen } from "./types.js";
3
3
  export interface ActionDefinition {
4
4
  id: string;
5
5
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-actions.d.ts","sourceRoot":"","sources":["../src/use-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,UAAU,YAAgC,gBAAgB,EAAE,GAAG,SAAS,KAAG,IAyDvF,CAAC"}
1
+ {"version":3,"file":"use-actions.d.ts","sourceRoot":"","sources":["../src/use-actions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAW,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,O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AC,CAAC,CAAC;AACtB,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
- import type { CommandHandler, CommandWhen } from "./types.js";
2
1
  import type { Mode } from "./mode.js";
2
+ import type { CommandHandler, CommandWhen } from "./types.js";
3
3
  export interface UseCommandOptions {
4
4
  id: string;
5
5
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-command.d.ts","sourceRoot":"","sources":["../src/use-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,YAAgC,iBAAiB,KAAG,IAuD1E,CAAC"}
1
+ {"version":3,"file":"use-command.d.ts","sourceRoot":"","sources":["../src/use-command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAW,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IACh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C,CAAC;IACpC,CAAC,EAAE;QACD,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK;QACb,OAAO,CAAC,MAAM;QACd,QAAQ;QACR,OAAO,CAAC,QAAQ;QAChB,OAAO,CAAC,KAAK;QACb,OAAO,CAAC,IAAI;QACZ,OAAO,CAAC,MAAM;QACd,OAAO,CAAC,OAAO;QACf,QAAQ;KACT,CAAC,CAAC;AACL,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tooee/commands",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Vim-inspired modal command system for Tooee",
5
5
  "keywords": [
6
6
  "cli",
@@ -45,20 +45,20 @@
45
45
  "typecheck": "tsc --noEmit"
46
46
  },
47
47
  "dependencies": {
48
- "@xstate/store": "^4",
48
+ "@xstate/store": "^4.2.3",
49
49
  "@xstate/store-react": "^2"
50
50
  },
51
51
  "devDependencies": {
52
- "@opentui/core": "^0.5.1",
53
- "@opentui/react": "^0.5.1",
52
+ "@opentui/core": "^0.5.12",
53
+ "@opentui/react": "^0.5.12",
54
54
  "@tooee/test-support": "0.7.3",
55
- "@types/bun": "^1.3.10",
56
- "@types/react": "^19.2.14",
57
- "typescript": "^5.9.3"
55
+ "@types/bun": "^1.4.2",
56
+ "@types/react": "^19.3.0",
57
+ "typescript": "^7.0.2"
58
58
  },
59
59
  "peerDependencies": {
60
- "@opentui/core": "^0.5.1",
61
- "@opentui/react": "^0.5.1",
60
+ "@opentui/core": "^0.5.12",
61
+ "@opentui/react": "^0.5.12",
62
62
  "react": "^18.0.0 || ^19.0.0"
63
63
  }
64
64
  }
@@ -1,11 +1,11 @@
1
+ import type { ContextGetter } from "./command-store.js";
2
+ import type { Mode } from "./mode.js";
1
3
  import type {
2
4
  CommandCommands,
3
5
  CommandContext,
4
6
  CommandContextBase,
5
7
  CommandRegistry,
6
8
  } from "./types.js";
7
- import type { ContextGetter } from "./command-store.js";
8
- import type { Mode } from "./mode.js";
9
9
 
10
10
  export interface BuildCommandContextInput {
11
11
  commands: CommandCommands;
@@ -17,7 +17,7 @@ export interface BuildCommandContextInput {
17
17
 
18
18
  /** The `commands` slice of a context, backed by a live surface registry. */
19
19
  export const commandsFromRegistry = function commandsFromRegistry(
20
- registry: CommandRegistry,
20
+ registry: CommandRegistry
21
21
  ): CommandCommands {
22
22
  return {
23
23
  invoke: (id: string) => {
@@ -37,7 +37,7 @@ export const commandsFromRegistry = function commandsFromRegistry(
37
37
  * through context sources registered by their providers.
38
38
  */
39
39
  export const buildCommandContext = function buildCommandContext(
40
- input: BuildCommandContextInput,
40
+ input: BuildCommandContextInput
41
41
  ): CommandContext {
42
42
  const base: CommandContextBase = {
43
43
  commands: input.commands,
@@ -1,9 +1,10 @@
1
1
  import type { KeyEvent } from "@opentui/core";
2
- import type { Mode } from "./mode.js";
2
+
3
3
  import { ROOT_SURFACE_ID, createBaseStore, selectKeyboardOwnerSurface } from "./command-store.js";
4
4
  import type { CommandStoreInstance, SurfaceRecord } from "./command-store.js";
5
5
  import { createKeyDispatcher } from "./key-dispatch.js";
6
6
  import type { KeyDispatchConfig, KeyDispatchResult } from "./key-dispatch.js";
7
+ import type { Mode } from "./mode.js";
7
8
  import type { Command, CommandContext, CommandRegistry } from "./types.js";
8
9
 
9
10
  export type { KeyDispatchResult } from "./key-dispatch.js";
@@ -37,7 +38,7 @@ const reportCommandFailure = async function reportCommandFailure(result: Promise
37
38
  };
38
39
 
39
40
  export const createCommandStore = function createCommandStore(
40
- options: CreateCommandStoreOptions,
41
+ options: CreateCommandStoreOptions
41
42
  ): CommandStore {
42
43
  const rootRecord: SurfaceRecord = {
43
44
  buildCtx: options.root.buildCtx,
@@ -1,4 +1,6 @@
1
1
  import { createStore } from "@xstate/store";
2
+
3
+ import type { Mode } from "./mode.js";
2
4
  import type {
3
5
  Command,
4
6
  CommandContext,
@@ -7,7 +9,6 @@ import type {
7
9
  ParsedStep,
8
10
  RegisteredCommandGroup,
9
11
  } from "./types.js";
10
- import type { Mode } from "./mode.js";
11
12
 
12
13
  export const ROOT_SURFACE_ID = "__root";
13
14
 
@@ -67,7 +68,7 @@ export interface CommandStoreContext {
67
68
  * Passive surfaces and the root never win.
68
69
  */
69
70
  export const selectActiveModalSurface = function selectActiveModalSurface(
70
- ctx: CommandStoreContext,
71
+ ctx: CommandStoreContext
71
72
  ): SurfaceRecord | null {
72
73
  let best: SurfaceRecord | null = null;
73
74
  for (const record of ctx.surfaces) {
@@ -99,7 +100,7 @@ export const selectActiveModalSurface = function selectActiveModalSurface(
99
100
  * arbitration is a separate, earlier step (I-5).
100
101
  */
101
102
  export const selectActivePanelSurface = function selectActivePanelSurface(
102
- ctx: CommandStoreContext,
103
+ ctx: CommandStoreContext
103
104
  ): SurfaceRecord | null {
104
105
  let best: SurfaceRecord | null = null;
105
106
  for (const record of ctx.surfaces) {
@@ -127,7 +128,7 @@ export const selectActivePanelSurface = function selectActivePanelSurface(
127
128
  * across ownership changes and to back the surface-aware hooks.
128
129
  */
129
130
  export const selectKeyboardOwnerSurface = function selectKeyboardOwnerSurface(
130
- ctx: CommandStoreContext,
131
+ ctx: CommandStoreContext
131
132
  ): SurfaceRecord | null {
132
133
  return selectActiveModalSurface(ctx) ?? selectActivePanelSurface(ctx);
133
134
  };
@@ -138,7 +139,7 @@ export const selectKeyboardOwnerSurface = function selectKeyboardOwnerSurface(
138
139
  */
139
140
  export const selectSurfaceCommands = function selectSurfaceCommands(
140
141
  ctx: CommandStoreContext,
141
- surfaceId: string,
142
+ surfaceId: string
142
143
  ): readonly Command[] {
143
144
  const commands = ctx.commandsBySurface.get(surfaceId);
144
145
  return commands ? [...commands.values()] : [];
@@ -147,19 +148,19 @@ export const selectSurfaceCommands = function selectSurfaceCommands(
147
148
  /** Identity-stable per-surface command map (undefined when none registered). */
148
149
  export const selectSurfaceCommandMap = function selectSurfaceCommandMap(
149
150
  ctx: CommandStoreContext,
150
- surfaceId: string,
151
+ surfaceId: string
151
152
  ): ReadonlyMap<string, Command> | undefined {
152
153
  return ctx.commandsBySurface.get(surfaceId);
153
154
  };
154
155
 
155
156
  export const selectSequence = function selectSequence(
156
- ctx: CommandStoreContext,
157
+ ctx: CommandStoreContext
157
158
  ): CommandSequenceState | null {
158
159
  return ctx.sequence;
159
160
  };
160
161
 
161
162
  export const selectGroups = function selectGroups(
162
- ctx: CommandStoreContext,
163
+ ctx: CommandStoreContext
163
164
  ): ReadonlyMap<string, RegisteredCommandGroup> {
164
165
  return ctx.groups;
165
166
  };
@@ -206,7 +207,7 @@ export const stepsKey = function stepsKey(steps: readonly ParsedStep[]): string
206
207
  const sequenceAfterStackChange = function sequenceAfterStackChange(
207
208
  before: SurfaceRecord | null,
208
209
  after: SurfaceRecord | null,
209
- sequence: CommandSequenceState | null,
210
+ sequence: CommandSequenceState | null
210
211
  ): CommandSequenceState | null {
211
212
  return before === after ? sequence : null;
212
213
  };
@@ -217,7 +218,7 @@ export const createBaseStore = function createBaseStore(initialContext: CommandS
217
218
  on: {
218
219
  commandRegistered: (
219
220
  ctx: CommandStoreContext,
220
- event: { surfaceId: string; command: Command },
221
+ event: { surfaceId: string; command: Command }
221
222
  ): CommandStoreContext => {
222
223
  const existing = ctx.commandsBySurface.get(event.surfaceId);
223
224
  // Map construction replays entries in order, so a re-registered id keeps its
@@ -232,7 +233,7 @@ export const createBaseStore = function createBaseStore(initialContext: CommandS
232
233
  },
233
234
  commandUnregistered: (
234
235
  ctx: CommandStoreContext,
235
- event: { surfaceId: string; command: Command },
236
+ event: { surfaceId: string; command: Command }
236
237
  ): CommandStoreContext => {
237
238
  // Identity-guarded (R-05): with duplicate ids the map holds the last
238
239
  // writer, and the first registrant's unmount must not delete the
@@ -253,14 +254,14 @@ export const createBaseStore = function createBaseStore(initialContext: CommandS
253
254
  },
254
255
  contextSourceRegistered: (
255
256
  ctx: CommandStoreContext,
256
- event: { id: string; getter: ContextGetter },
257
+ event: { id: string; getter: ContextGetter }
257
258
  ): CommandStoreContext => {
258
259
  const contextSources = new Map([...ctx.contextSources, [event.id, event.getter] as const]);
259
260
  return { ...ctx, contextSources };
260
261
  },
261
262
  contextSourceUnregistered: (
262
263
  ctx: CommandStoreContext,
263
- event: { id: string },
264
+ event: { id: string }
264
265
  ): CommandStoreContext => {
265
266
  if (!ctx.contextSources.has(event.id)) {
266
267
  return ctx;
@@ -271,14 +272,14 @@ export const createBaseStore = function createBaseStore(initialContext: CommandS
271
272
  },
272
273
  groupRegistered: (
273
274
  ctx: CommandStoreContext,
274
- event: { group: RegisteredCommandGroup },
275
+ event: { group: RegisteredCommandGroup }
275
276
  ): CommandStoreContext => {
276
277
  const groups = new Map([...ctx.groups, [event.group.prefixKey, event.group] as const]);
277
278
  return { ...ctx, groups };
278
279
  },
279
280
  groupUnregistered: (
280
281
  ctx: CommandStoreContext,
281
- event: { group: RegisteredCommandGroup },
282
+ event: { group: RegisteredCommandGroup }
282
283
  ): CommandStoreContext => {
283
284
  // Identity-guarded, as for commands.
284
285
  if (ctx.groups.get(event.group.prefixKey) !== event.group) {
@@ -288,13 +289,16 @@ export const createBaseStore = function createBaseStore(initialContext: CommandS
288
289
  groups.delete(event.group.prefixKey);
289
290
  return { ...ctx, groups };
290
291
  },
291
- modeChanged: (ctx: CommandStoreContext, _event: { surfaceId: string }): CommandStoreContext =>
292
+ modeChanged: (
293
+ ctx: CommandStoreContext,
294
+ _event: { surfaceId: string }
295
+ ): CommandStoreContext =>
292
296
  // A mode change is a transition, not a post-render repair: any pending
293
297
  // chord is invalidated (F-08 — including surface-local mode changes).
294
298
  ctx.sequence === null ? ctx : { ...ctx, sequence: null },
295
299
  panelActivated: (
296
300
  ctx: CommandStoreContext,
297
- event: { groupId: string; panelId: string },
301
+ event: { groupId: string; panelId: string }
298
302
  ): CommandStoreContext => {
299
303
  if (ctx.activePanels.get(event.groupId) === event.panelId) {
300
304
  return ctx;
@@ -313,7 +317,7 @@ export const createBaseStore = function createBaseStore(initialContext: CommandS
313
317
  },
314
318
  panelGroupRemoved: (
315
319
  ctx: CommandStoreContext,
316
- event: { groupId: string },
320
+ event: { groupId: string }
317
321
  ): CommandStoreContext => {
318
322
  if (!ctx.activePanels.has(event.groupId)) {
319
323
  return ctx;
@@ -330,13 +334,13 @@ export const createBaseStore = function createBaseStore(initialContext: CommandS
330
334
  },
331
335
  sequencePending: (
332
336
  ctx: CommandStoreContext,
333
- event: { state: CommandSequenceState },
337
+ event: { state: CommandSequenceState }
334
338
  ): CommandStoreContext => ({ ...ctx, sequence: event.state }),
335
339
  sequenceReset: (ctx: CommandStoreContext): CommandStoreContext =>
336
340
  ctx.sequence === null ? ctx : { ...ctx, sequence: null },
337
341
  surfacePopped: (
338
342
  ctx: CommandStoreContext,
339
- event: { surface: SurfaceRecord },
343
+ event: { surface: SurfaceRecord }
340
344
  ): CommandStoreContext => {
341
345
  // Identity-based removal: only the exact pushed record is removed.
342
346
  const surfaces = ctx.surfaces.filter((record) => record !== event.surface);
@@ -353,7 +357,7 @@ export const createBaseStore = function createBaseStore(initialContext: CommandS
353
357
  },
354
358
  surfacePushed: (
355
359
  ctx: CommandStoreContext,
356
- event: { surface: SurfaceRecord },
360
+ event: { surface: SurfaceRecord }
357
361
  ): CommandStoreContext => {
358
362
  const before = selectKeyboardOwnerSurface(ctx);
359
363
  const surfaces = [...ctx.surfaces, event.surface];
package/src/context.tsx CHANGED
@@ -1,20 +1,11 @@
1
- import { createContext, useContext, useCallback, useEffect, useMemo } from "react";
2
- import type { ReactNode } from "react";
3
1
  import { useKeyboard } from "@opentui/react";
4
2
  import { useSelector } from "@xstate/store-react";
5
- import type {
6
- ActiveCommandSurface,
7
- Command,
8
- CommandContext,
9
- CommandGroup,
10
- CommandRegistry,
11
- CommandSequenceState,
12
- CommandSurfaceRole,
13
- RegisteredCommandGroup,
14
- } from "./types.js";
15
- import type { Mode } from "./mode.js";
16
- import { ModeProvider, useMode, useSetMode } from "./mode.js";
17
- import { parseHotkey } from "./parse.js";
3
+ import { createContext, useContext, useCallback, useEffect, useMemo } from "react";
4
+ import type { ReactNode } from "react";
5
+
6
+ import { buildCommandContext, commandsFromRegistry } from "./build-context.js";
7
+ import { createCommandStore } from "./command-store-wrapper.js";
8
+ import type { CommandStore } from "./command-store-wrapper.js";
18
9
  import {
19
10
  ROOT_SURFACE_ID,
20
11
  selectActivePanelSurface,
@@ -24,11 +15,21 @@ import {
24
15
  stepsKey,
25
16
  } from "./command-store.js";
26
17
  import type { ContextGetter, SurfaceRecord } from "./command-store.js";
27
- import { createCommandStore } from "./command-store-wrapper.js";
28
- import type { CommandStore } from "./command-store-wrapper.js";
29
- import { buildCommandContext, commandsFromRegistry } from "./build-context.js";
30
18
  import { useLatest } from "./hooks/use-latest.js";
31
19
  import { useLazyRef } from "./hooks/use-lazy-ref.js";
20
+ import type { Mode } from "./mode.js";
21
+ import { ModeProvider, useMode, useSetMode } from "./mode.js";
22
+ import { parseHotkey } from "./parse.js";
23
+ import type {
24
+ ActiveCommandSurface,
25
+ Command,
26
+ CommandContext,
27
+ CommandGroup,
28
+ CommandRegistry,
29
+ CommandSequenceState,
30
+ CommandSurfaceRole,
31
+ RegisteredCommandGroup,
32
+ } from "./types.js";
32
33
 
33
34
  interface CommandContextValue {
34
35
  registry: CommandRegistry;
@@ -45,7 +46,7 @@ interface CommandStoreContextValue {
45
46
  leaderKey?: string;
46
47
  }
47
48
 
48
- const CommandContext = createContext<CommandStoreContextValue | null>(null);
49
+ const CommandStoreReactContext = createContext<CommandStoreContextValue | null>(null);
49
50
  const CommandSequenceContext = createContext<CommandSequenceState | null>(null);
50
51
  /** Nesting depth of the nearest command surface (0 at the root app). */
51
52
  const CommandSurfaceDepthContext = createContext(0);
@@ -120,7 +121,7 @@ export const CommandProvider = function CommandProvider({
120
121
  getMode: () => rootAccessRef.current.getMode(),
121
122
  },
122
123
  sequenceTimeoutMs,
123
- }),
124
+ })
124
125
  );
125
126
  const commandStore = storeRef.current;
126
127
 
@@ -176,7 +177,7 @@ const CommandDispatcher = function CommandDispatcher({
176
177
  mode: modeRef.current,
177
178
  setMode,
178
179
  }),
179
- [commandStore, modeRef, setMode],
180
+ [commandStore, modeRef, setMode]
180
181
  );
181
182
 
182
183
  const buildCtxRef = useLatest(buildCtx);
@@ -204,7 +205,7 @@ const CommandDispatcher = function CommandDispatcher({
204
205
  () => () => {
205
206
  commandStore.dispose();
206
207
  },
207
- [commandStore],
208
+ [commandStore]
208
209
  );
209
210
 
210
211
  const sequenceState = useSelector(commandStore.store, (s) => selectSequence(s.context));
@@ -215,13 +216,13 @@ const CommandDispatcher = function CommandDispatcher({
215
216
  leaderKey: leader,
216
217
  surface: commandStore.rootRecord,
217
218
  }),
218
- [commandStore, leader],
219
+ [commandStore, leader]
219
220
  );
220
221
 
221
222
  return (
222
- <CommandContext.Provider value={ctxValue}>
223
+ <CommandStoreReactContext.Provider value={ctxValue}>
223
224
  <CommandSequenceContext value={sequenceState}>{children}</CommandSequenceContext>
224
- </CommandContext.Provider>
225
+ </CommandStoreReactContext.Provider>
225
226
  );
226
227
  };
227
228
 
@@ -256,7 +257,7 @@ export const CommandSurfaceProvider = function CommandSurfaceProvider({
256
257
  groupId,
257
258
  initialMode = "cursor",
258
259
  }: CommandSurfaceProviderProps): ReactNode {
259
- const parent = useContext(CommandContext);
260
+ const parent = useContext(CommandStoreReactContext);
260
261
  if (!parent) {
261
262
  throw new Error("CommandSurfaceProvider must be used within a CommandProvider");
262
263
  }
@@ -291,7 +292,7 @@ const CommandSurfaceInner = function CommandSurfaceInner({
291
292
  role: CommandSurfaceRole;
292
293
  groupId?: string;
293
294
  }): ReactNode {
294
- const parent = useContext(CommandContext);
295
+ const parent = useContext(CommandStoreReactContext);
295
296
  if (!parent) {
296
297
  throw new Error("CommandSurfaceProvider must be used within a CommandProvider");
297
298
  }
@@ -355,15 +356,15 @@ const CommandSurfaceInner = function CommandSurfaceInner({
355
356
  leaderKey: parent.leaderKey,
356
357
  surface: record,
357
358
  }),
358
- [commandStore, record, parent.leaderKey],
359
+ [commandStore, record, parent.leaderKey]
359
360
  );
360
361
 
361
362
  return (
362
- <CommandContext.Provider value={ctxValue}>
363
+ <CommandStoreReactContext.Provider value={ctxValue}>
363
364
  <CommandSurfaceDepthContext.Provider value={depth}>
364
365
  {children}
365
366
  </CommandSurfaceDepthContext.Provider>
366
- </CommandContext.Provider>
367
+ </CommandStoreReactContext.Provider>
367
368
  );
368
369
  };
369
370
 
@@ -371,7 +372,7 @@ export const useSurfaceInvoke = function useSurfaceInvoke(): {
371
372
  commands: Command[];
372
373
  invoke: (id: string) => void;
373
374
  } {
374
- const ctx = useContext(CommandContext);
375
+ const ctx = useContext(CommandStoreReactContext);
375
376
  if (!ctx) {
376
377
  throw new Error("useSurfaceInvoke must be used within a CommandProvider");
377
378
  }
@@ -380,7 +381,7 @@ export const useSurfaceInvoke = function useSurfaceInvoke(): {
380
381
  // Reactive: consumers re-render when a command registers or unregisters on
381
382
  // this surface (the per-surface map is identity-stable otherwise).
382
383
  const commandMap = useSelector(commandStore.store, (s) =>
383
- selectSurfaceCommandMap(s.context, surface.id),
384
+ selectSurfaceCommandMap(s.context, surface.id)
384
385
  );
385
386
  const registry = commandStore.registryFor(surface);
386
387
 
@@ -389,7 +390,7 @@ export const useSurfaceInvoke = function useSurfaceInvoke(): {
389
390
  commands: commandMap ? [...commandMap.values()] : [],
390
391
  invoke: registry.invoke,
391
392
  }),
392
- [commandMap, registry],
393
+ [commandMap, registry]
393
394
  );
394
395
  };
395
396
 
@@ -399,7 +400,7 @@ export const useSurfaceInvoke = function useSurfaceInvoke(): {
399
400
  * outside the dispatch path (e.g. a context-menu entry resolver).
400
401
  */
401
402
  export const useBuildCommandContext = function useBuildCommandContext(): () => CommandContext {
402
- const ctx = useContext(CommandContext);
403
+ const ctx = useContext(CommandStoreReactContext);
403
404
  if (!ctx) {
404
405
  throw new Error("useBuildCommandContext must be used within a CommandProvider");
405
406
  }
@@ -414,7 +415,7 @@ export const useBuildCommandContext = function useBuildCommandContext(): () => C
414
415
  * on unrelated group/context-source registrations.
415
416
  */
416
417
  export const useSurfaceRegistry = function useSurfaceRegistry(): CommandRegistry {
417
- const ctx = useContext(CommandContext);
418
+ const ctx = useContext(CommandStoreReactContext);
418
419
  if (!ctx) {
419
420
  throw new Error("useSurfaceRegistry must be used within a CommandProvider");
420
421
  }
@@ -422,7 +423,7 @@ export const useSurfaceRegistry = function useSurfaceRegistry(): CommandRegistry
422
423
  };
423
424
 
424
425
  export const useCommandRegistry = function useCommandRegistry(): CommandContextValue {
425
- const ctx = useContext(CommandContext);
426
+ const ctx = useContext(CommandStoreReactContext);
426
427
  if (!ctx) {
427
428
  throw new Error("useCommandRegistry must be used within a CommandProvider");
428
429
  }
@@ -441,7 +442,7 @@ export const useCommandRegistry = function useCommandRegistry(): CommandContextV
441
442
  leaderKey,
442
443
  registry,
443
444
  }),
444
- [registry, leaderKey, contextSources, groups],
445
+ [registry, leaderKey, contextSources, groups]
445
446
  );
446
447
  };
447
448
 
@@ -457,7 +458,7 @@ export const useCommandSequenceState =
457
458
  * modal surface currently owns keyboard input above this subtree.
458
459
  */
459
460
  export const useCommandSurfaceId = function useCommandSurfaceId(): string {
460
- const ctx = useContext(CommandContext);
461
+ const ctx = useContext(CommandStoreReactContext);
461
462
  if (!ctx) {
462
463
  throw new Error("useCommandSurfaceId must be used within a CommandProvider");
463
464
  }
@@ -473,7 +474,7 @@ export const useCommandSurfaceId = function useCommandSurfaceId(): string {
473
474
  */
474
475
  export const useActiveCommandSurface =
475
476
  function useActiveCommandSurface(): ActiveCommandSurface | null {
476
- const ctx = useContext(CommandContext);
477
+ const ctx = useContext(CommandStoreReactContext);
477
478
  const { store } = ctx?.commandStore ?? FALLBACK_COMMAND_STORE;
478
479
 
479
480
  const record = useSelector(store, (s) => selectKeyboardOwnerSurface(s.context));
@@ -503,9 +504,9 @@ export const useActiveCommandSurface =
503
504
  * when none is active.
504
505
  */
505
506
  export const useSurfaceCommands = function useSurfaceCommands(
506
- surfaceId?: string,
507
+ surfaceId?: string
507
508
  ): readonly Command[] {
508
- const ctx = useContext(CommandContext);
509
+ const ctx = useContext(CommandStoreReactContext);
509
510
  const { store } = ctx?.commandStore ?? FALLBACK_COMMAND_STORE;
510
511
 
511
512
  const commandMap = useSelector(store, (s) => {
@@ -535,7 +536,7 @@ export interface EffectiveCommands {
535
536
  * edge; dispatch itself shadows correctly via the store).
536
537
  */
537
538
  export const useEffectiveCommands = function useEffectiveCommands(): EffectiveCommands {
538
- const ctx = useContext(CommandContext);
539
+ const ctx = useContext(CommandStoreReactContext);
539
540
  if (!ctx) {
540
541
  throw new Error("useEffectiveCommands must be used within a CommandProvider");
541
542
  }
@@ -563,14 +564,14 @@ export const useEffectiveCommands = function useEffectiveCommands(): EffectiveCo
563
564
  const shadowed = new Set(
564
565
  panelCommands
565
566
  .map((command) => command.defaultHotkey)
566
- .filter((hotkey): hotkey is string => hotkey !== undefined && hotkey !== ""),
567
+ .filter((hotkey): hotkey is string => hotkey !== undefined && hotkey !== "")
567
568
  );
568
569
  const effectiveRoot = rootCommands
569
570
  .filter((command) => !panelIds.has(command.id))
570
571
  .map((command) =>
571
572
  command.defaultHotkey !== undefined && shadowed.has(command.defaultHotkey)
572
573
  ? { ...command, defaultHotkey: undefined }
573
- : command,
574
+ : command
574
575
  );
575
576
 
576
577
  const invoke = (id: string): void => {
@@ -594,7 +595,7 @@ export const useEffectiveCommands = function useEffectiveCommands(): EffectiveCo
594
595
  * (e.g. the shell's overlay-replacement sequence reset).
595
596
  */
596
597
  export const useCommandStore = function useCommandStore(): CommandStore {
597
- const ctx = useContext(CommandContext);
598
+ const ctx = useContext(CommandStoreReactContext);
598
599
  if (!ctx) {
599
600
  throw new Error("useCommandStore must be used within a CommandProvider");
600
601
  }
@@ -602,7 +603,7 @@ export const useCommandStore = function useCommandStore(): CommandStore {
602
603
  };
603
604
 
604
605
  export const useCommandGroup = function useCommandGroup(group: CommandGroup): void {
605
- const ctx = useContext(CommandContext);
606
+ const ctx = useContext(CommandStoreReactContext);
606
607
  if (!ctx) {
607
608
  throw new Error("useCommandGroup must be used within a CommandProvider");
608
609
  }
@@ -637,9 +638,9 @@ export const useCommandGroup = function useCommandGroup(group: CommandGroup): vo
637
638
  let nextContextSourceId = 0;
638
639
 
639
640
  export const useProvideCommandContext = function useProvideCommandContext(
640
- getter: () => Partial<CommandContext>,
641
+ getter: () => Partial<CommandContext>
641
642
  ): void {
642
- const ctx = useContext(CommandContext);
643
+ const ctx = useContext(CommandStoreReactContext);
643
644
  if (!ctx) {
644
645
  throw new Error("useProvideCommandContext must be used within a CommandProvider");
645
646
  }