@opentui/keymap 0.5.9 → 0.5.11

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.
package/src/index.js CHANGED
@@ -1,26 +1,25 @@
1
1
  // @bun
2
2
  import {
3
- KEYMAP_EXTENSION_CONTEXT,
4
- activeOptionsForCaptures,
5
- advanceSequenceCapture,
6
- buildSequenceTree,
7
- captureHasContinuations,
8
- captureIsExact,
9
- capturePriority,
10
- cloneKeySequence,
3
+ normalizeBindingTokenName,
11
4
  cloneKeyStroke,
12
- collectRootSequenceCaptures,
13
5
  createKeySequencePart,
6
+ cloneKeySequence,
7
+ resolveKeyMatch,
14
8
  createTextKeyMatch,
15
- getActiveLayersForFocused,
9
+ stringifyKeyStroke2,
10
+ stringifyKeySequence2,
16
11
  getFocusedTargetIfAvailable,
12
+ getActiveLayersForFocused,
17
13
  isLayerActiveForFocused,
18
- normalizeBindingTokenName,
19
- resolveKeyMatch,
20
- stringifyKeySequence,
21
- stringifyKeyStroke
22
- } from "../chunks/index-frk6sdcd.js";
23
- import"../chunks/index-p35cyhc4.js";
14
+ captureHasContinuations,
15
+ captureIsExact,
16
+ buildSequenceTree,
17
+ activeOptionsForCaptures,
18
+ capturePriority,
19
+ advanceSequenceCapture,
20
+ collectRootSequenceCaptures,
21
+ KEYMAP_EXTENSION_CONTEXT2
22
+ } from "../chunks/index-7g381cth.js";
24
23
 
25
24
  // src/lib/runtime-utils.ts
26
25
  function createRuntimeEmitter(onError) {
@@ -371,7 +370,7 @@ function collectSequencePartsFromPending(pending) {
371
370
  }
372
371
  }
373
372
  if (display === undefined || hasDisplayConflict) {
374
- display = stringifyKeyStroke(firstPart.stroke);
373
+ display = stringifyKeyStroke2(firstPart.stroke);
375
374
  }
376
375
  if (hasTokenConflict) {
377
376
  tokenName = undefined;
@@ -477,10 +476,10 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
477
476
  setPendingSequence({ captures: nextCaptures });
478
477
  return true;
479
478
  };
480
- const getActiveKeys = (options2) => {
481
- const includeBindings = options2?.includeBindings === true;
482
- const includeMetadata = options2?.includeMetadata === true;
483
- const cache = getActiveKeysCache(activeKeysCaches, options2);
479
+ const getActiveKeys = (options) => {
480
+ const includeBindings = options?.includeBindings === true;
481
+ const includeMetadata = options?.includeMetadata === true;
482
+ const cache = getActiveKeysCache(activeKeysCaches, options);
484
483
  if (cache.notifyVersion === state.derivedVersion) {
485
484
  return cache.value;
486
485
  }
@@ -513,16 +512,16 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
513
512
  }
514
513
  return activeKeys;
515
514
  };
516
- const getActiveKeysForCaptures = (captures, options2) => {
517
- const includeBindings = options2?.includeBindings === true;
518
- const includeMetadata = options2?.includeMetadata === true;
515
+ const getActiveKeysForCaptures = (captures, options) => {
516
+ const includeBindings = options?.includeBindings === true;
517
+ const includeMetadata = options?.includeMetadata === true;
519
518
  const focused = getFocusedTarget();
520
519
  const activeView = catalog.getActiveCommandView(focused);
521
520
  return collectActiveKeysFromPending(captures, includeBindings, includeMetadata, focused, activeView);
522
521
  };
523
- const getActiveKeysForFocused = (focused, options2) => {
524
- const includeBindings = options2?.includeBindings === true;
525
- const includeMetadata = options2?.includeMetadata === true;
522
+ const getActiveKeysForFocused = (focused, options) => {
523
+ const includeBindings = options?.includeBindings === true;
524
+ const includeMetadata = options?.includeMetadata === true;
526
525
  const currentFocused = getFocusedTargetIfAvailable2();
527
526
  const pending = focused === currentFocused ? ensureValidPendingSequence() : undefined;
528
527
  const activeView = catalog.getActiveCommandView(focused);
@@ -585,7 +584,7 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
585
584
  }
586
585
  if (display === undefined || hasDisplayConflict) {
587
586
  const stroke = bindings[0]?.sequence[partIndex]?.stroke;
588
- display = stroke ? stringifyKeyStroke(stroke) : "";
587
+ display = stroke ? stringifyKeyStroke2(stroke) : "";
589
588
  }
590
589
  if (hasTokenConflict) {
591
590
  tokenName = undefined;
@@ -645,19 +644,19 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
645
644
  const selectActiveKeyNode = (node, includeBindings, focused, activeView) => {
646
645
  const continues = node.children.size > 0 || node.patternChildren.length > 0;
647
646
  if (!continues) {
648
- const selected2 = selectActiveBindings(nodeExactBindingsNeedPrefilter(node) ? collectMatchingBindings(node.bindings, focused, activeView) : node.bindings, focused, activeView);
649
- if (!selected2) {
647
+ const selected = selectActiveBindings(nodeExactBindingsNeedPrefilter(node) ? collectMatchingBindings(node.bindings, focused, activeView) : node.bindings, focused, activeView);
648
+ if (!selected) {
650
649
  return;
651
650
  }
652
- const presentation2 = getPartPresentation(selected2.bindings, node.depth - 1);
651
+ const presentation = getPartPresentation(selected.bindings, node.depth - 1);
653
652
  return {
654
- display: presentation2.display,
655
- tokenName: presentation2.tokenName,
653
+ display: presentation.display,
654
+ tokenName: presentation.tokenName,
656
655
  continues: false,
657
- firstBinding: selected2.bindings[0],
658
- commandBinding: selected2.commandBinding,
659
- bindings: includeBindings ? [...selected2.bindings] : undefined,
660
- stop: selected2.stop
656
+ firstBinding: selected.bindings[0],
657
+ commandBinding: selected.commandBinding,
658
+ bindings: includeBindings ? [...selected.bindings] : undefined,
659
+ stop: selected.stop
661
660
  };
662
661
  }
663
662
  const reachableBindings = collectMatchingBindings(node.reachableBindings, focused, activeView);
@@ -693,14 +692,14 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
693
692
  collectActiveKeyOptions(activeOptionsForCaptures(captures, state.patterns), activeKeys, stopped, includeBindings, focused, activeView);
694
693
  return materializeActiveKeys(activeKeys, includeBindings, includeMetadata, focused, activeView);
695
694
  };
696
- const collectActiveKeyOptions = (options2, activeKeys, stopped, includeBindings, focused, activeView) => {
695
+ const collectActiveKeyOptions = (options, activeKeys, stopped, includeBindings, focused, activeView) => {
697
696
  const seen = new Set;
698
- for (const option of options2) {
697
+ for (const option of options) {
699
698
  if (seen.has(option.part.match)) {
700
699
  continue;
701
700
  }
702
701
  seen.add(option.part.match);
703
- collectActiveKeyOption(option, options2, activeKeys, stopped, includeBindings, focused, activeView);
702
+ collectActiveKeyOption(option, options, activeKeys, stopped, includeBindings, focused, activeView);
704
703
  }
705
704
  };
706
705
  const collectActiveKeyOption = (option, siblingOptions, activeKeys, stopped, includeBindings, focused, activeView) => {
@@ -724,8 +723,8 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
724
723
  };
725
724
  const materializeActiveKeys = (activeKeys, includeBindings, includeMetadata, focused, activeView) => {
726
725
  const materialized = [];
727
- for (const state2 of activeKeys.values()) {
728
- const activeKey = materializeActiveKey(state2, includeBindings, includeMetadata, focused, activeView);
726
+ for (const state of activeKeys.values()) {
727
+ const activeKey = materializeActiveKey(state, includeBindings, includeMetadata, focused, activeView);
729
728
  if (activeKey) {
730
729
  materialized.push(activeKey);
731
730
  }
@@ -751,12 +750,12 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
751
750
  stop: continues || selected?.stop === true
752
751
  };
753
752
  };
754
- const getOptionPresentation = (options2) => {
753
+ const getOptionPresentation = (options) => {
755
754
  let display;
756
755
  let tokenName;
757
756
  let hasDisplayConflict = false;
758
757
  let hasTokenConflict = false;
759
- for (const option of options2) {
758
+ for (const option of options) {
760
759
  const part = option.part;
761
760
  if (display === undefined) {
762
761
  display = part.display;
@@ -770,9 +769,9 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
770
769
  hasTokenConflict = true;
771
770
  }
772
771
  }
773
- const firstPart = options2[0]?.part;
772
+ const firstPart = options[0]?.part;
774
773
  if (display === undefined || hasDisplayConflict) {
775
- display = firstPart ? stringifyKeyStroke(firstPart.stroke) : "";
774
+ display = firstPart ? stringifyKeyStroke2(firstPart.stroke) : "";
776
775
  }
777
776
  if (hasTokenConflict) {
778
777
  tokenName = undefined;
@@ -811,48 +810,48 @@ function createActivationService(state, host, hooks, notify, conditions, catalog
811
810
  bindings: includeBindings && selection.bindings ? [...selection.bindings] : undefined
812
811
  };
813
812
  };
814
- const updateActiveKeyState = (state2, selection, includeBindings) => {
815
- if (!state2.firstBinding && selection.firstBinding) {
816
- state2.firstBinding = selection.firstBinding;
813
+ const updateActiveKeyState = (state, selection, includeBindings) => {
814
+ if (!state.firstBinding && selection.firstBinding) {
815
+ state.firstBinding = selection.firstBinding;
817
816
  }
818
- if (!state2.commandBinding && selection.commandBinding) {
819
- state2.commandBinding = selection.commandBinding;
817
+ if (!state.commandBinding && selection.commandBinding) {
818
+ state.commandBinding = selection.commandBinding;
820
819
  }
821
820
  if (selection.continues) {
822
- state2.continues = true;
821
+ state.continues = true;
823
822
  }
824
823
  if (!includeBindings || !selection.bindings || selection.bindings.length === 0) {
825
824
  return;
826
825
  }
827
- if (!state2.bindings) {
828
- state2.bindings = [...selection.bindings];
826
+ if (!state.bindings) {
827
+ state.bindings = [...selection.bindings];
829
828
  return;
830
829
  }
831
- state2.bindings.push(...selection.bindings);
830
+ state.bindings.push(...selection.bindings);
832
831
  };
833
- const materializeActiveKey = (state2, includeBindings, includeMetadata, focused, activeView) => {
834
- if (!state2.commandBinding && !state2.continues) {
832
+ const materializeActiveKey = (state, includeBindings, includeMetadata, focused, activeView) => {
833
+ if (!state.commandBinding && !state.continues) {
835
834
  return;
836
835
  }
837
836
  const activeKey = {
838
- stroke: cloneKeyStroke(state2.stroke),
839
- display: state2.display,
840
- continues: state2.continues
837
+ stroke: cloneKeyStroke(state.stroke),
838
+ display: state.display,
839
+ continues: state.continues
841
840
  };
842
- if (state2.tokenName) {
843
- activeKey.tokenName = state2.tokenName;
841
+ if (state.tokenName) {
842
+ activeKey.tokenName = state.tokenName;
844
843
  }
845
- if (state2.commandBinding) {
846
- activeKey.command = state2.commandBinding.command;
844
+ if (state.commandBinding) {
845
+ activeKey.command = state.commandBinding.command;
847
846
  }
848
- if (includeBindings && state2.bindings && state2.bindings.length > 0) {
849
- activeKey.bindings = state2.bindings.length === 1 ? [toActiveBinding(state2.bindings[0], focused, activeView)] : collectActiveBindings(state2.bindings, focused, activeView);
847
+ if (includeBindings && state.bindings && state.bindings.length > 0) {
848
+ activeKey.bindings = state.bindings.length === 1 ? [toActiveBinding(state.bindings[0], focused, activeView)] : collectActiveBindings(state.bindings, focused, activeView);
850
849
  }
851
850
  if (includeMetadata) {
852
- if (state2.firstBinding?.attrs) {
853
- activeKey.bindingAttrs = state2.firstBinding.attrs;
851
+ if (state.firstBinding?.attrs) {
852
+ activeKey.bindingAttrs = state.firstBinding.attrs;
854
853
  }
855
- const commandAttrs = state2.commandBinding ? catalog.getBindingCommandAttrs(state2.commandBinding, focused, activeView) : undefined;
854
+ const commandAttrs = state.commandBinding ? catalog.getBindingCommandAttrs(state.commandBinding, focused, activeView) : undefined;
856
855
  if (commandAttrs) {
857
856
  activeKey.commandAttrs = commandAttrs;
858
857
  }
@@ -1136,11 +1135,11 @@ function createCommandCatalogService(state, host, notify, conditions, options) {
1136
1135
  const getResolvedCommandChain = (command, focused, execution) => {
1137
1136
  const view = getActiveCommandView2(focused);
1138
1137
  if (execution) {
1139
- const resolved2 = [];
1138
+ const resolved = [];
1140
1139
  const chain = view.chainsByName.get(command);
1141
1140
  if (chain) {
1142
1141
  for (const entry of chain) {
1143
- resolved2.push({
1142
+ resolved.push({
1144
1143
  target: entry.layer.target,
1145
1144
  command: entry.commandState.command,
1146
1145
  attrs: entry.commandState.attrs,
@@ -1148,11 +1147,11 @@ function createCommandCatalogService(state, host, notify, conditions, options) {
1148
1147
  });
1149
1148
  }
1150
1149
  }
1151
- const fallback2 = resolveCommandWithResolversForMode(command, focused, { mode: "active", execution });
1152
- if (fallback2.resolved) {
1153
- resolved2.push(fallback2.resolved);
1150
+ const fallback = resolveCommandWithResolversForMode(command, focused, { mode: "active", execution });
1151
+ if (fallback.resolved) {
1152
+ resolved.push(fallback.resolved);
1154
1153
  }
1155
- return { entries: resolved2.length > 0 ? resolved2 : undefined, hadError: fallback2.hadError };
1154
+ return { entries: resolved.length > 0 ? resolved : undefined, hadError: fallback.hadError };
1156
1155
  }
1157
1156
  const resolved = [];
1158
1157
  for (const entry of view.chainsByName.get(command) ?? []) {
@@ -1246,23 +1245,23 @@ function createCommandCatalogService(state, host, notify, conditions, options) {
1246
1245
  const activeCommandViewCanCache = () => {
1247
1246
  return state.activeCommandViewCacheBlockers === 0;
1248
1247
  };
1249
- const isBindingVisible = (binding, focused, activeView2) => {
1248
+ const isBindingVisible = (binding, focused, activeView) => {
1250
1249
  if (binding.command === undefined || binding.run) {
1251
1250
  return true;
1252
1251
  }
1253
1252
  if (typeof binding.command !== "string") {
1254
1253
  return false;
1255
1254
  }
1256
- if (activeView2.reachableByName.has(binding.command)) {
1255
+ if (activeView.reachableByName.has(binding.command)) {
1257
1256
  return true;
1258
1257
  }
1259
1258
  return getFallbackResolvedCommand(binding.command, focused, "active") !== undefined;
1260
1259
  };
1261
- const getBindingCommandAttrs = (binding, focused, activeView2) => {
1260
+ const getBindingCommandAttrs = (binding, focused, activeView) => {
1262
1261
  if (typeof binding.command !== "string") {
1263
1262
  return;
1264
1263
  }
1265
- const active = activeView2.reachableByName.get(binding.command);
1264
+ const active = activeView.reachableByName.get(binding.command);
1266
1265
  if (active) {
1267
1266
  return active.commandState.attrs;
1268
1267
  }
@@ -1270,7 +1269,7 @@ function createCommandCatalogService(state, host, notify, conditions, options) {
1270
1269
  return fallback?.attrs;
1271
1270
  };
1272
1271
  const getCommandResolutionStatus = (command, layerCommands) => {
1273
- if (layerCommands?.some((state2) => state2.command.name === command) || getCommandView().chainsByName.has(command)) {
1272
+ if (layerCommands?.some((state) => state.command.name === command) || getCommandView().chainsByName.has(command)) {
1274
1273
  return "resolved";
1275
1274
  }
1276
1275
  const lookup = resolveCommandWithResolversForMode(command, getFocusedTargetIfAvailable(host));
@@ -1297,8 +1296,8 @@ function createCommandCatalogService(state, host, notify, conditions, options) {
1297
1296
  });
1298
1297
  };
1299
1298
  const getTopResolvedCommand = (command, focused) => {
1300
- const activeView2 = getActiveCommandView2(focused);
1301
- const active = activeView2.reachableByName.get(command);
1299
+ const activeView = getActiveCommandView2(focused);
1300
+ const active = activeView.reachableByName.get(command);
1302
1301
  if (active) {
1303
1302
  return {
1304
1303
  target: active.layer.target,
@@ -1419,16 +1418,16 @@ function createCommandCatalogService(state, host, notify, conditions, options) {
1419
1418
  }
1420
1419
  return;
1421
1420
  }
1422
- const activeView2 = context.activeView;
1423
- if (!activeView2) {
1421
+ const activeView = context.activeView;
1422
+ if (!activeView) {
1424
1423
  return;
1425
1424
  }
1426
- for (const layer of activeView2.layers) {
1425
+ for (const layer of activeView.layers) {
1427
1426
  if (layer.bindings.length === 0 || !conditions.matchesConditions(layer)) {
1428
1427
  continue;
1429
1428
  }
1430
1429
  for (const binding of layer.bindings) {
1431
- if (conditions.matchesConditions(binding) && isBindingVisible(binding, context.focused, activeView2)) {
1430
+ if (conditions.matchesConditions(binding) && isBindingVisible(binding, context.focused, activeView)) {
1432
1431
  visit(binding);
1433
1432
  }
1434
1433
  }
@@ -1478,15 +1477,15 @@ function createCommandCatalogService(state, host, notify, conditions, options) {
1478
1477
  if (context.visibility === "registered") {
1479
1478
  return getCommandView().chainsByName.get(binding.command)?.[0]?.commandState.attrs;
1480
1479
  }
1481
- const activeView2 = context.activeView;
1482
- if (!activeView2) {
1480
+ const activeView = context.activeView;
1481
+ if (!activeView) {
1483
1482
  return;
1484
1483
  }
1485
- return getBindingCommandAttrs(binding, context.focused, activeView2);
1484
+ return getBindingCommandAttrs(binding, context.focused, activeView);
1486
1485
  };
1487
- const resolveCommandWithResolversForMode = (command, focused, options2) => {
1488
- const mode = options2?.mode ?? "active";
1489
- const execution = options2?.execution ?? { input: command };
1486
+ const resolveCommandWithResolversForMode = (command, focused, options) => {
1487
+ const mode = options?.mode ?? "active";
1488
+ const execution = options?.execution ?? { input: command };
1490
1489
  const lookup = resolveCommandWithResolvers(command, state.commandResolvers.values(), () => createCommandResolverContext(focused, mode, execution), (error) => {
1491
1490
  notify.emitError("command-resolver-error", error, `[Keymap] Error in command resolver for "${command}":`);
1492
1491
  });
@@ -2057,7 +2056,7 @@ function createCompilerService(state, notify, conditions, options) {
2057
2056
  tokens: state.tokens,
2058
2057
  patterns: state.patterns,
2059
2058
  layer: EMPTY_COMPILE_FIELDS,
2060
- parseObjectKey: (value, options2) => parseObjectKeyPart(value, options2)
2059
+ parseObjectKey: (value, options) => parseObjectKeyPart(value, options)
2061
2060
  });
2062
2061
  };
2063
2062
  const parseKeySequence = (key) => {
@@ -2068,7 +2067,7 @@ function createCompilerService(state, notify, conditions, options) {
2068
2067
  tokens: state.tokens,
2069
2068
  patterns: state.patterns,
2070
2069
  layer: EMPTY_COMPILE_FIELDS,
2071
- parseObjectKey: (value, options2) => parseObjectKeyPart(value, options2)
2070
+ parseObjectKey: (value, options) => parseObjectKeyPart(value, options)
2072
2071
  });
2073
2072
  for (const tokenName of parsed.unknownTokens) {
2074
2073
  options.warnUnknownToken(tokenName, key);
@@ -2078,8 +2077,8 @@ function createCompilerService(state, notify, conditions, options) {
2078
2077
  }
2079
2078
  return parsed.parts;
2080
2079
  };
2081
- const formatKey = (key, options2) => {
2082
- return stringifyKeySequence(parseKeySequence(key), options2);
2080
+ const formatKey = (key, options) => {
2081
+ return stringifyKeySequence2(parseKeySequence(key), options);
2083
2082
  };
2084
2083
  const compileBindings = (bindings, tokens, sourceTarget, sourceLayerOrder, compileFields) => {
2085
2084
  const bindingStates = [];
@@ -2108,7 +2107,7 @@ function createCompilerService(state, notify, conditions, options) {
2108
2107
  tokens,
2109
2108
  patterns: state.patterns,
2110
2109
  layer: compileFields,
2111
- parseObjectKey: (value, options2) => parseObjectKeyPart(value, options2)
2110
+ parseObjectKey: (value, options) => parseObjectKeyPart(value, options)
2112
2111
  }) : {
2113
2112
  parts: [parseObjectKeyPart(expandedKey)],
2114
2113
  usedTokens: [],
@@ -2209,8 +2208,8 @@ function createCompilerService(state, notify, conditions, options) {
2209
2208
  hasTokenBindings
2210
2209
  };
2211
2210
  };
2212
- const parseObjectKeyPart = (key, options2) => {
2213
- return createKeySequencePart(key, options2);
2211
+ const parseObjectKeyPart = (key, options) => {
2212
+ return createKeySequencePart(key, options);
2214
2213
  };
2215
2214
  const normalizeBindingEvent = (event) => {
2216
2215
  if (event === undefined || event === "press") {
@@ -2242,7 +2241,7 @@ function createCompilerService(state, notify, conditions, options) {
2242
2241
  tokens,
2243
2242
  patterns: state.patterns,
2244
2243
  layer,
2245
- parseObjectKey: (value, options2) => parseObjectKeyPart(value, options2)
2244
+ parseObjectKey: (value, options) => parseObjectKeyPart(value, options)
2246
2245
  });
2247
2246
  },
2248
2247
  add: (nextBinding) => {
@@ -2633,8 +2632,8 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2633
2632
  cancelPendingDisambiguation();
2634
2633
  }
2635
2634
  function handleRawSequence(sequence) {
2636
- const hooks2 = state.rawHooks.entries();
2637
- if (hooks2.length === 0) {
2635
+ const hooks = state.rawHooks.entries();
2636
+ if (hooks.length === 0) {
2638
2637
  return false;
2639
2638
  }
2640
2639
  let stopped = false;
@@ -2644,7 +2643,7 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2644
2643
  stopped = true;
2645
2644
  }
2646
2645
  };
2647
- for (const hook of hooks2) {
2646
+ for (const hook of hooks) {
2648
2647
  try {
2649
2648
  hook.listener(context);
2650
2649
  } catch (error) {
@@ -2714,10 +2713,10 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2714
2713
  });
2715
2714
  }
2716
2715
  function getKeyAfterHooks(release) {
2717
- const hooks2 = state.keyAfterHooks.entries();
2718
- for (const hook of hooks2) {
2716
+ const hooks = state.keyAfterHooks.entries();
2717
+ for (const hook of hooks) {
2719
2718
  if (hook.release === release) {
2720
- return hooks2;
2719
+ return hooks;
2721
2720
  }
2722
2721
  }
2723
2722
  return;
@@ -2751,7 +2750,7 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2751
2750
  }
2752
2751
  return current;
2753
2752
  }
2754
- function emitKeyAfter(hooks2, event, release, focused, outcome) {
2753
+ function emitKeyAfter(hooks, event, release, focused, outcome) {
2755
2754
  const context = {
2756
2755
  event,
2757
2756
  eventType: release ? "release" : "press",
@@ -2777,7 +2776,7 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2777
2776
  }
2778
2777
  }
2779
2778
  };
2780
- for (const hook of hooks2) {
2779
+ for (const hook of hooks) {
2781
2780
  if (hook.release !== release) {
2782
2781
  continue;
2783
2782
  }
@@ -2815,7 +2814,7 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2815
2814
  }
2816
2815
  const afterHooks = getKeyAfterHooks(release);
2817
2816
  const afterFocused = afterHooks ? activation.getFocusedTarget() : null;
2818
- const hooks2 = state.keyHooks.entries();
2817
+ const hooks = state.keyHooks.entries();
2819
2818
  const context = {
2820
2819
  event,
2821
2820
  setData: (name, value) => {
@@ -2835,7 +2834,7 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2835
2834
  }
2836
2835
  }
2837
2836
  };
2838
- for (const hook of hooks2) {
2837
+ for (const hook of hooks) {
2839
2838
  if (hook.release !== release) {
2840
2839
  continue;
2841
2840
  }
@@ -2856,9 +2855,9 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2856
2855
  }
2857
2856
  }
2858
2857
  if (release) {
2859
- const outcome2 = dispatchReleaseLayers(event);
2858
+ const outcome = dispatchReleaseLayers(event);
2860
2859
  if (afterHooks) {
2861
- emitKeyAfter(afterHooks, event, release, afterFocused, outcome2);
2860
+ emitKeyAfter(afterHooks, event, release, afterFocused, outcome);
2862
2861
  }
2863
2862
  return;
2864
2863
  }
@@ -2967,8 +2966,8 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
2967
2966
  if (hasHandledExact) {
2968
2967
  continue;
2969
2968
  }
2970
- const exactCaptures2 = collectExactCapturesForPrefix(advancedCaptures, capture);
2971
- const resolvedOutcome = tryResolvePendingAmbiguity(advancedCaptures, index, continuationCapturesForPrefix, exactCaptures2, event, focused, hasHandledExact);
2969
+ const exactCaptures = collectExactCapturesForPrefix(advancedCaptures, capture);
2970
+ const resolvedOutcome = tryResolvePendingAmbiguity(advancedCaptures, index, continuationCapturesForPrefix, exactCaptures, event, focused, hasHandledExact);
2972
2971
  if (resolvedOutcome) {
2973
2972
  return resolvedOutcome;
2974
2973
  }
@@ -3016,9 +3015,9 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
3016
3015
  }
3017
3016
  const layerContinuationCaptures = captures.filter((capture) => captureHasContinuations(capture, state.patterns, false));
3018
3017
  if (layerContinuationCaptures.length > 0) {
3019
- const exactCaptures2 = captures.filter((capture) => captureIsExact(capture, state.patterns));
3018
+ const exactCaptures = captures.filter((capture) => captureIsExact(capture, state.patterns));
3020
3019
  const continuationCaptures = collectPendingCapturesFromRoot(activeLayers, index, matchKeys, event, focused);
3021
- const resolvedOutcome = tryResolveRootAmbiguity(activeLayers, index, matchKeys, continuationCaptures, exactCaptures2, event, focused);
3020
+ const resolvedOutcome = tryResolveRootAmbiguity(activeLayers, index, matchKeys, continuationCaptures, exactCaptures, event, focused);
3022
3021
  if (resolvedOutcome) {
3023
3022
  return resolvedOutcome;
3024
3023
  }
@@ -3294,7 +3293,7 @@ function createDispatchService(state, notify, runtime, activation, conditions, e
3294
3293
  return pendingDisambiguation === pending;
3295
3294
  }
3296
3295
  function warnUnresolvedAmbiguity(sequence) {
3297
- const display = stringifyKeySequence(sequence, { preferDisplay: true });
3296
+ const display = stringifyKeySequence2(sequence, { preferDisplay: true });
3298
3297
  notify.warnOnce(`unresolved-disambiguation:${display}`, "unresolved-disambiguation", { sequence: display }, `[Keymap] Ambiguous exact/prefix sequence "${display}" fell back to prefix handling because no disambiguation resolver resolved it`);
3299
3298
  }
3300
3299
  function collectPendingCapturesFromRoot(activeLayers, startIndex, matchKeys, event, focused) {
@@ -3564,10 +3563,10 @@ function registerToken(state, notify, compiler, layers, token) {
3564
3563
  if (current !== registeredToken) {
3565
3564
  return;
3566
3565
  }
3567
- const nextTokens2 = new Map(state.tokens);
3568
- nextTokens2.delete(normalizedToken);
3566
+ const nextTokens = new Map(state.tokens);
3567
+ nextTokens.delete(normalizedToken);
3569
3568
  try {
3570
- layers.applyTokenState(nextTokens2);
3569
+ layers.applyTokenState(nextTokens);
3571
3570
  } catch (error) {
3572
3571
  notify.emitError("token-unregister-error", error, getErrorMessage(error, `Failed to unregister keymap token "${normalizedToken}"`));
3573
3572
  }
@@ -3807,7 +3806,7 @@ function createLayerService(state, notify, conditions, activation, options) {
3807
3806
  for (const transformer of transformers) {
3808
3807
  const next = transformer(current, {
3809
3808
  layer,
3810
- validateBindings: (bindings2) => validateBindings(bindings2)
3809
+ validateBindings: (bindings) => validateBindings(bindings)
3811
3810
  });
3812
3811
  if (!next) {
3813
3812
  continue;
@@ -4264,7 +4263,7 @@ class Keymap {
4264
4263
  }));
4265
4264
  }
4266
4265
  }
4267
- [KEYMAP_EXTENSION_CONTEXT]() {
4266
+ [KEYMAP_EXTENSION_CONTEXT2]() {
4268
4267
  return {
4269
4268
  state: this.#state,
4270
4269
  host: this.#host,
@@ -4497,11 +4496,11 @@ class Keymap {
4497
4496
  }
4498
4497
  }
4499
4498
  export {
4500
- stringifyKeyStroke,
4501
- stringifyKeySequence,
4499
+ KEYMAP_EXTENSION_CONTEXT2 as KEYMAP_EXTENSION_CONTEXT,
4502
4500
  Keymap,
4503
- KEYMAP_EXTENSION_CONTEXT
4501
+ stringifyKeySequence2 as stringifyKeySequence,
4502
+ stringifyKeyStroke2 as stringifyKeyStroke
4504
4503
  };
4505
4504
 
4506
- //# debugId=E1616C2DB5F874BD64756E2164756E21
4505
+ //# debugId=A921C8E17706FE5864756E2164756E21
4507
4506
  //# sourceMappingURL=index.js.map