@opentui/keymap 0.2.2 → 0.2.4
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/README.md +56 -32
- package/chunks/index-frk6sdcd.js +409 -0
- package/chunks/index-frk6sdcd.js.map +14 -0
- package/package.json +17 -7
- package/src/addons/index.js +511 -4870
- package/src/addons/index.js.map +25 -0
- package/src/addons/opentui/edit-buffer-bindings.d.ts +6 -2
- package/src/addons/opentui/index.d.ts +2 -2
- package/src/addons/opentui/index.js +101 -5515
- package/src/addons/opentui/index.js.map +12 -0
- package/src/addons/universal/dead-bindings.d.ts +1 -1
- package/src/addons/universal/default-parser.d.ts +2 -2
- package/src/addons/universal/ex-commands.d.ts +11 -8
- package/src/addons/universal/index.d.ts +2 -1
- package/src/addons/universal/leader.d.ts +1 -1
- package/src/addons/universal/metadata.d.ts +2 -2
- package/src/addons/universal/mod-bindings.d.ts +6 -0
- package/src/addons/universal/unresolved-commands.d.ts +1 -1
- package/src/extras/binding-sections.d.ts +16 -7
- package/src/extras/command-bindings.d.ts +2 -2
- package/src/extras/formatting.d.ts +3 -0
- package/src/extras/graph.d.ts +9 -0
- package/src/extras/graph.js +373 -0
- package/src/extras/graph.js.map +11 -0
- package/src/extras/index.js +57 -4
- package/src/extras/index.js.map +12 -0
- package/src/extras/lib/graph-snapshot.d.ts +14 -0
- package/src/extras/lib/graph-types.d.ts +83 -0
- package/src/html.d.ts +3 -3
- package/src/html.js +47 -4992
- package/src/html.js.map +10 -0
- package/src/index.d.ts +3 -1
- package/src/index.js +2688 -2807
- package/src/index.js.map +34 -0
- package/src/keymap.d.ts +17 -33
- package/src/lib/emitter.d.ts +1 -2
- package/src/lib/registry.d.ts +2 -2
- package/src/lib/runtime-utils.d.ts +34 -0
- package/src/opentui.d.ts +1 -3
- package/src/opentui.js +40 -4994
- package/src/opentui.js.map +10 -0
- package/src/react/index.d.ts +5 -19
- package/src/react/index.js +3 -0
- package/src/react/index.js.map +10 -0
- package/src/runtime-modules.d.ts +2 -0
- package/src/runtime-modules.js +5 -0
- package/src/runtime-modules.js.map +10 -0
- package/src/services/activation.d.ts +7 -33
- package/src/services/active-key-cache.d.ts +29 -0
- package/src/services/command-catalog.d.ts +27 -52
- package/src/services/command-executor.d.ts +6 -12
- package/src/services/compiler.d.ts +4 -12
- package/src/services/conditions.d.ts +4 -16
- package/src/services/dispatch-decisions.d.ts +21 -0
- package/src/services/dispatch-patterns.d.ts +5 -0
- package/src/services/dispatch.d.ts +6 -42
- package/src/services/environment.d.ts +6 -24
- package/src/services/extension-context.d.ts +16 -0
- package/src/services/layer-diagnostics.d.ts +10 -0
- package/src/services/layers.d.ts +15 -24
- package/src/services/notify.d.ts +6 -8
- package/src/services/pending-sequence.d.ts +4 -0
- package/src/services/primitives/active-layers.d.ts +2 -3
- package/src/services/primitives/bindings.d.ts +4 -0
- package/src/services/primitives/field-invariants.d.ts +16 -1
- package/src/services/primitives/pending-captures.d.ts +5 -0
- package/src/services/runtime-view.d.ts +5 -0
- package/src/services/runtime.d.ts +2 -7
- package/src/services/sequence-index.d.ts +24 -0
- package/src/services/state.d.ts +46 -92
- package/src/solid/index.d.ts +5 -19
- package/src/solid/index.js +3 -0
- package/src/solid/index.js.map +10 -0
- package/src/testing/index.d.ts +90 -0
- package/src/testing/index.js +276 -0
- package/src/testing/index.js.map +10 -0
- package/src/types.d.ts +180 -128
- package/src/services/primitives/binding-inputs.d.ts +0 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/opentui.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { CliRenderEvents, KeyEvent, RenderableEvents, type CliRenderer, type Renderable } from \"@opentui/core\"\nimport { Keymap, type HostMetadata, type HostPlatform, type KeymapHost } from \"@opentui/keymap\"\nimport { registerDefaultKeys, registerEnabledFields, registerMetadataFields } from \"@opentui/keymap/addons\"\n\nfunction createSyntheticCommandEvent(): KeyEvent {\n return new KeyEvent({\n name: \"command\",\n ctrl: false,\n meta: false,\n shift: false,\n option: false,\n sequence: \"\",\n number: false,\n raw: \"\",\n eventType: \"press\",\n source: \"raw\",\n })\n}\n\nfunction normalizeRuntimePlatform(platform: NodeJS.Platform | string | undefined): HostPlatform {\n if (platform === \"darwin\") {\n return \"macos\"\n }\n\n if (platform === \"win32\") {\n return \"windows\"\n }\n\n if (platform === \"linux\") {\n return \"linux\"\n }\n\n return \"unknown\"\n}\n\nfunction createOpenTuiHostMetadata(renderer: CliRenderer): HostMetadata {\n const platform = normalizeRuntimePlatform(process.platform)\n const hasKittyKeyboard = renderer.capabilities?.kitty_keyboard === true\n\n return {\n platform,\n primaryModifier: platform === \"macos\" ? \"super\" : platform === \"unknown\" ? \"unknown\" : \"ctrl\",\n modifiers: {\n ctrl: \"supported\",\n shift: \"supported\",\n meta: \"supported\",\n super: hasKittyKeyboard ? \"supported\" : \"unknown\",\n hyper: hasKittyKeyboard ? \"supported\" : \"unknown\",\n },\n }\n}\n\nexport function createOpenTuiKeymapHost(renderer: CliRenderer): KeymapHost<Renderable, KeyEvent> {\n return {\n get metadata() {\n return createOpenTuiHostMetadata(renderer)\n },\n rootTarget: renderer.root,\n get isDestroyed() {\n return renderer.isDestroyed\n },\n getFocusedTarget() {\n const focused = renderer.currentFocusedRenderable\n if (!focused || focused.isDestroyed || !focused.focused) {\n return null\n }\n\n return focused\n },\n getParentTarget(target) {\n return target.parent\n },\n isTargetDestroyed(target) {\n return target.isDestroyed\n },\n onKeyPress(listener) {\n renderer.keyInput.prependListener(\"keypress\", listener)\n return () => {\n renderer.keyInput.off(\"keypress\", listener)\n }\n },\n onKeyRelease(listener) {\n renderer.keyInput.prependListener(\"keyrelease\", listener)\n return () => {\n renderer.keyInput.off(\"keyrelease\", listener)\n }\n },\n onFocusChange(listener) {\n renderer.on(CliRenderEvents.FOCUSED_RENDERABLE, listener)\n return () => {\n renderer.off(CliRenderEvents.FOCUSED_RENDERABLE, listener)\n }\n },\n onDestroy(listener) {\n renderer.once(CliRenderEvents.DESTROY, listener)\n return () => {\n renderer.off(CliRenderEvents.DESTROY, listener)\n }\n },\n onTargetDestroy(target, listener) {\n target.once(RenderableEvents.DESTROYED, listener)\n return () => {\n target.off(RenderableEvents.DESTROYED, listener)\n }\n },\n onRawInput(listener) {\n renderer.prependInputHandler(listener)\n return () => {\n renderer.removeInputHandler(listener)\n }\n },\n createCommandEvent() {\n return createSyntheticCommandEvent()\n },\n }\n}\n\nexport function createOpenTuiKeymap(renderer: CliRenderer): Keymap<Renderable, KeyEvent> {\n if (renderer.isDestroyed) {\n throw new Error(\"Cannot create a keymap for a destroyed renderer\")\n }\n\n return new Keymap(createOpenTuiKeymapHost(renderer))\n}\n\nexport function createDefaultOpenTuiKeymap(renderer: CliRenderer): Keymap<Renderable, KeyEvent> {\n if (renderer.isDestroyed) {\n throw new Error(\"Cannot create a keymap for a destroyed renderer\")\n }\n\n const keymap = new Keymap(createOpenTuiKeymapHost(renderer))\n registerDefaultKeys(keymap)\n registerEnabledFields(keymap)\n registerMetadataFields(keymap)\n return keymap\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAAA;AACA;AACA;AAEA,SAAS,2BAA2B,GAAa;AAAA,EAC/C,OAAO,IAAI,SAAS;AAAA,IAClB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,WAAW;AAAA,IACX,QAAQ;AAAA,EACV,CAAC;AAAA;AAGH,SAAS,wBAAwB,CAAC,UAA8D;AAAA,EAC9F,IAAI,aAAa,UAAU;AAAA,IACzB,OAAO;AAAA,EACT;AAAA,EAEA,IAAI,aAAa,SAAS;AAAA,IACxB,OAAO;AAAA,EACT;AAAA,EAEA,IAAI,aAAa,SAAS;AAAA,IACxB,OAAO;AAAA,EACT;AAAA,EAEA,OAAO;AA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|
1
1
|
import type { KeyEvent, Renderable } from "@opentui/core";
|
|
2
|
-
import { type ActiveKey, type ActiveKeyOptions, type
|
|
2
|
+
import { type ActiveKey, type ActiveKeyOptions, type Layer, type Keymap, type ReactiveMatcher, type KeySequencePart, type TargetMode } from "../index.js";
|
|
3
3
|
import { type DependencyList, type ReactNode } from "react";
|
|
4
4
|
type OpenTuiKeymap = Keymap<Renderable, KeyEvent>;
|
|
5
5
|
export interface KeymapProviderProps {
|
|
@@ -10,28 +10,14 @@ export declare function KeymapProvider({ keymap, children }: KeymapProviderProps
|
|
|
10
10
|
export interface UseBindingsTargetRef<TRenderable extends Renderable = Renderable> {
|
|
11
11
|
current: TRenderable | null;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export interface UseBindingsLayer<TRenderable extends Renderable = Renderable> extends Omit<Layer<Renderable, KeyEvent>, "target" | "targetMode"> {
|
|
14
|
+
targetRef?: UseBindingsTargetRef<TRenderable>;
|
|
15
|
+
targetMode?: TargetMode;
|
|
16
16
|
}
|
|
17
|
-
export interface UseFocusBindingsLayer<TRenderable extends Renderable = Renderable> extends UseBindingsLayerBase {
|
|
18
|
-
targetMode: "focus";
|
|
19
|
-
targetRef: UseBindingsTargetRef<TRenderable>;
|
|
20
|
-
}
|
|
21
|
-
export interface UseFocusWithinBindingsLayer<TRenderable extends Renderable = Renderable> extends UseBindingsLayerBase {
|
|
22
|
-
targetMode?: "focus-within";
|
|
23
|
-
targetRef: UseBindingsTargetRef<TRenderable>;
|
|
24
|
-
}
|
|
25
|
-
export interface UseInferredFocusWithinBindingsLayer<TRenderable extends Renderable = Renderable> extends UseBindingsLayerBase {
|
|
26
|
-
targetRef: UseBindingsTargetRef<TRenderable>;
|
|
27
|
-
}
|
|
28
|
-
export type UseTargetBindingsLayer<TRenderable extends Renderable = Renderable> = UseFocusBindingsLayer<TRenderable> | UseFocusWithinBindingsLayer<TRenderable> | UseInferredFocusWithinBindingsLayer<TRenderable>;
|
|
29
|
-
export type UseBindingsLayer<TRenderable extends Renderable = Renderable> = UseGlobalBindingsLayer | UseTargetBindingsLayer<TRenderable>;
|
|
30
17
|
export declare const useKeymap: () => OpenTuiKeymap;
|
|
31
18
|
export declare const useActiveKeys: (options?: ActiveKeyOptions) => readonly ActiveKey[];
|
|
32
19
|
export declare const usePendingSequence: () => readonly KeySequencePart[];
|
|
33
|
-
export declare function useBindings<TRenderable extends Renderable = Renderable>(createLayer: () =>
|
|
34
|
-
export declare function useBindings<TRenderable extends Renderable = Renderable>(createLayer: () => UseTargetBindingsLayer<TRenderable>, deps?: DependencyList): void;
|
|
20
|
+
export declare function useBindings<TRenderable extends Renderable = Renderable>(createLayer: () => UseBindingsLayer<TRenderable>, deps?: DependencyList): void;
|
|
35
21
|
/**
|
|
36
22
|
* Adapts any `subscribe` + `getSnapshot` store to
|
|
37
23
|
* `ReactiveMatcher`. Pass `predicate` when the snapshot value is not
|
package/src/react/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/react/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { KeyEvent, Renderable } from \"@opentui/core\"\nimport {\n type ActiveKey,\n type ActiveKeyOptions,\n type Layer,\n type Keymap,\n type ReactiveMatcher,\n type KeySequencePart,\n type TargetMode,\n} from \"../index.js\"\nimport {\n createElement,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useReducer,\n useRef,\n type DependencyList,\n type ReactNode,\n} from \"react\"\n\ntype OpenTuiKeymap = Keymap<Renderable, KeyEvent>\n\nconst KeymapContext = createContext<OpenTuiKeymap | null>(null)\n\nexport interface KeymapProviderProps {\n keymap: OpenTuiKeymap\n children?: ReactNode\n}\n\nexport function KeymapProvider({ keymap, children }: KeymapProviderProps) {\n return createElement(KeymapContext.Provider, { value: keymap }, children)\n}\n\nexport interface UseBindingsTargetRef<TRenderable extends Renderable = Renderable> {\n current: TRenderable | null\n}\n\nexport interface UseBindingsLayer<TRenderable extends Renderable = Renderable> extends Omit<\n Layer<Renderable, KeyEvent>,\n \"target\" | \"targetMode\"\n> {\n targetRef?: UseBindingsTargetRef<TRenderable>\n targetMode?: TargetMode\n}\n\nfunction resolveBindingsTarget(targetRef: UseBindingsTargetRef | undefined): Renderable | undefined {\n return targetRef?.current ?? undefined\n}\n\nexport const useKeymap = (): OpenTuiKeymap => {\n const keymap = useContext(KeymapContext)\n\n if (!keymap) {\n throw new Error(\"Keymap not found. Wrap the tree in <KeymapProvider>.\")\n }\n\n return keymap\n}\n\n// Use the batched `state` event for derived reads. Pending-sequence changes\n// already flow through `state`, so subscribing to both would duplicate work.\nfunction useKeymapStateVersion(keymap: OpenTuiKeymap): number {\n const [version, bumpVersion] = useReducer((value: number) => value + 1, 0)\n\n useLayoutEffect(() => {\n const dispose = keymap.on(\"state\", () => {\n bumpVersion()\n })\n\n return () => {\n dispose()\n }\n }, [keymap])\n\n return version\n}\n\nexport const useActiveKeys = (options?: ActiveKeyOptions): readonly ActiveKey[] => {\n const keymap = useKeymap()\n const version = useKeymapStateVersion(keymap)\n\n return useMemo(() => {\n void version\n return keymap.getActiveKeys(options)\n }, [keymap, options, version])\n}\n\nexport const usePendingSequence = (): readonly KeySequencePart[] => {\n const keymap = useKeymap()\n const version = useKeymapStateVersion(keymap)\n\n return useMemo(() => {\n void version\n return keymap.getPendingSequence()\n }, [keymap, version])\n}\n\nexport function useBindings<TRenderable extends Renderable = Renderable>(\n createLayer: () => UseBindingsLayer<TRenderable>,\n deps: DependencyList = [],\n): void {\n const keymap = useKeymap()\n const layer = useMemo(createLayer, deps)\n const layerRef = useRef(layer)\n const disposeRef = useRef<(() => void) | undefined>(undefined)\n const registeredLayerRef = useRef<UseBindingsLayer<TRenderable> | undefined>(undefined)\n const registeredTargetModeRef = useRef<TargetMode | undefined>(undefined)\n const registeredTargetRef = useRef<Renderable | undefined>(undefined)\n\n layerRef.current = layer\n\n const unregister = useCallback(() => {\n disposeRef.current?.()\n disposeRef.current = undefined\n registeredLayerRef.current = undefined\n registeredTargetModeRef.current = undefined\n registeredTargetRef.current = undefined\n }, [])\n\n useEffect(() => {\n const currentLayer = layerRef.current\n const hasExplicitTarget = currentLayer.targetRef !== undefined\n const explicitTarget = resolveBindingsTarget(currentLayer.targetRef)\n const nextTargetMode = currentLayer.targetMode ?? (hasExplicitTarget ? \"focus-within\" : undefined)\n const nextTarget = nextTargetMode ? explicitTarget : undefined\n\n if (!hasExplicitTarget && nextTargetMode) {\n throw new Error(\"useBindings local bindings need a targetRef\")\n }\n\n if (\n registeredLayerRef.current === currentLayer &&\n registeredTargetModeRef.current === nextTargetMode &&\n registeredTargetRef.current === nextTarget\n ) {\n return\n }\n\n unregister()\n\n if (!nextTarget && nextTargetMode) {\n registeredLayerRef.current = currentLayer\n registeredTargetModeRef.current = nextTargetMode\n registeredTargetRef.current = undefined\n return\n }\n\n const { targetRef: _targetRef, targetMode: _targetMode, ...baseLayer } = currentLayer\n disposeRef.current = keymap.registerLayer(\n !nextTargetMode\n ? {\n ...baseLayer,\n }\n : {\n ...baseLayer,\n target: nextTarget!,\n targetMode: nextTargetMode,\n },\n )\n registeredLayerRef.current = currentLayer\n registeredTargetModeRef.current = nextTargetMode\n registeredTargetRef.current = nextTarget\n })\n\n useEffect(() => {\n return () => {\n unregister()\n }\n }, [unregister])\n}\n\n/**\n * Adapts any `subscribe` + `getSnapshot` store to\n * `ReactiveMatcher`. Pass `predicate` when the snapshot value is not\n * already boolean.\n */\nexport function reactiveMatcherFromStore<T>(\n subscribe: (onStoreChange: () => void) => () => void,\n getSnapshot: () => T,\n predicate?: (value: T) => boolean,\n): ReactiveMatcher {\n return {\n get() {\n return predicate ? predicate(getSnapshot()) : Boolean(getSnapshot())\n },\n subscribe(onChange) {\n return subscribe(onChange)\n },\n }\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAUA;AAAA;AAAA;AAAA;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AY;AAAA,IACd,CACN;AAAA,IACA,mBAAmB,UAAU;AAAA,IAC7B,wBAAwB,UAAU;AAAA,IAClC,oBAAoB,UAAU;AAAA,GAC/B;AAAA,EAED,UAAU,MAAM;AAAA,IACd,OAAO,MAAM;AAAA,MACX,WAAW;AAAA;AAAA,KAEZ,CAAC,UAAU,CAAC;AAAA;AAQV,SAAS,wBAA2B,CACzC,WACA,aACA,WACiB;AAAA,EACjB,OAAO;AAAA,IACL,GAAG,GAAG;AAAA,MACJ,OAAO,YAAY,UAAU,YAAY,CAAC,IAAI,QAAQ,YAAY,CAAC;AAAA;AAAA,IAErE,SAAS,CAAC,UAAU;AAAA,MAClB,OAAO,UAAU,QAAQ;AAAA;AAAA,EAE7B;AAAA;",
|
|
8
|
+
"debugId": "88193D455507349A64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/src/runtime-modules.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as keymap from "@opentui/keymap";
|
|
2
2
|
import * as keymapExtras from "@opentui/keymap/extras";
|
|
3
|
+
import * as keymapGraphExtra from "@opentui/keymap/extras/graph";
|
|
3
4
|
import * as keymapAddons from "@opentui/keymap/addons";
|
|
4
5
|
import * as keymapOpenTuiAddons from "@opentui/keymap/addons/opentui";
|
|
5
6
|
import * as keymapHtml from "@opentui/keymap/html";
|
|
@@ -9,6 +10,7 @@ import * as keymapSolid from "@opentui/keymap/solid";
|
|
|
9
10
|
export declare const runtimeModules: {
|
|
10
11
|
"@opentui/keymap": typeof keymap;
|
|
11
12
|
"@opentui/keymap/extras": typeof keymapExtras;
|
|
13
|
+
"@opentui/keymap/extras/graph": typeof keymapGraphExtra;
|
|
12
14
|
"@opentui/keymap/addons": typeof keymapAddons;
|
|
13
15
|
"@opentui/keymap/addons/opentui": typeof keymapOpenTuiAddons;
|
|
14
16
|
"@opentui/keymap/html": typeof keymapHtml;
|
package/src/runtime-modules.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// src/runtime-modules.ts
|
|
3
3
|
import * as keymap from "@opentui/keymap";
|
|
4
4
|
import * as keymapExtras from "@opentui/keymap/extras";
|
|
5
|
+
import * as keymapGraphExtra from "@opentui/keymap/extras/graph";
|
|
5
6
|
import * as keymapAddons from "@opentui/keymap/addons";
|
|
6
7
|
import * as keymapOpenTuiAddons from "@opentui/keymap/addons/opentui";
|
|
7
8
|
import * as keymapHtml from "@opentui/keymap/html";
|
|
@@ -11,6 +12,7 @@ import * as keymapSolid from "@opentui/keymap/solid";
|
|
|
11
12
|
var runtimeModules = {
|
|
12
13
|
"@opentui/keymap": keymap,
|
|
13
14
|
"@opentui/keymap/extras": keymapExtras,
|
|
15
|
+
"@opentui/keymap/extras/graph": keymapGraphExtra,
|
|
14
16
|
"@opentui/keymap/addons": keymapAddons,
|
|
15
17
|
"@opentui/keymap/addons/opentui": keymapOpenTuiAddons,
|
|
16
18
|
"@opentui/keymap/html": keymapHtml,
|
|
@@ -21,3 +23,6 @@ var runtimeModules = {
|
|
|
21
23
|
export {
|
|
22
24
|
runtimeModules
|
|
23
25
|
};
|
|
26
|
+
|
|
27
|
+
//# debugId=0BF94D448A4CF4C764756E2164756E21
|
|
28
|
+
//# sourceMappingURL=runtime-modules.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/runtime-modules.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { RuntimeModuleEntry } from \"@opentui/core/runtime-plugin\"\nimport * as keymap from \"@opentui/keymap\"\nimport * as keymapExtras from \"@opentui/keymap/extras\"\nimport * as keymapGraphExtra from \"@opentui/keymap/extras/graph\"\nimport * as keymapAddons from \"@opentui/keymap/addons\"\nimport * as keymapOpenTuiAddons from \"@opentui/keymap/addons/opentui\"\nimport * as keymapHtml from \"@opentui/keymap/html\"\nimport * as keymapOpenTui from \"@opentui/keymap/opentui\"\nimport * as keymapReact from \"@opentui/keymap/react\"\nimport * as keymapSolid from \"@opentui/keymap/solid\"\n\nexport const runtimeModules = {\n \"@opentui/keymap\": keymap,\n \"@opentui/keymap/extras\": keymapExtras,\n \"@opentui/keymap/extras/graph\": keymapGraphExtra,\n \"@opentui/keymap/addons\": keymapAddons,\n \"@opentui/keymap/addons/opentui\": keymapOpenTuiAddons,\n \"@opentui/keymap/html\": keymapHtml,\n \"@opentui/keymap/opentui\": keymapOpenTui,\n \"@opentui/keymap/react\": keymapReact,\n \"@opentui/keymap/solid\": keymapSolid,\n} satisfies Record<string, RuntimeModuleEntry>\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,IAAM,iBAAiB;AAAA,EAC5B,mBAAmB;AAAA,EACnB,0BAA0B;AAAA,EAC1B,gCAAgC;AAAA,EAChC,0BAA0B;AAAA,EAC1B,kCAAkC;AAAA,EAClC,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,yBAAyB;AAAA,EACzB,yBAAyB;AAC3B;",
|
|
8
|
+
"debugId": "0BF94D448A4CF4C764756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ActiveBinding, ActiveKey, ActiveKeyOptions,
|
|
1
|
+
import type { RuntimeEmitter } from "../lib/runtime-utils.js";
|
|
2
|
+
import type { ActiveBinding, ActiveKey, ActiveKeyOptions, BindingState, Hooks, KeymapEvent, KeymapHost, PendingSequenceCapture, KeySequencePart, PendingSequenceState, RegisteredLayer } from "../types.js";
|
|
3
3
|
import type { CommandCatalogService } from "./command-catalog.js";
|
|
4
4
|
import type { ConditionService } from "./conditions.js";
|
|
5
5
|
import type { NotificationService } from "./notify.js";
|
|
@@ -7,15 +7,7 @@ import type { ActiveCommandView, State } from "./state.js";
|
|
|
7
7
|
interface ActivationOptions<TTarget extends object, TEvent extends KeymapEvent> {
|
|
8
8
|
onPendingSequenceChanged?: (previous: PendingSequenceState<TTarget, TEvent> | null, next: PendingSequenceState<TTarget, TEvent> | null) => void;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
private readonly state;
|
|
12
|
-
private readonly host;
|
|
13
|
-
private readonly hooks;
|
|
14
|
-
private readonly notify;
|
|
15
|
-
private readonly conditions;
|
|
16
|
-
private readonly catalog;
|
|
17
|
-
private readonly options;
|
|
18
|
-
constructor(state: State<TTarget, TEvent>, host: KeymapHost<TTarget, TEvent>, hooks: Emitter<Hooks<TTarget, TEvent>>, notify: NotificationService<TTarget, TEvent>, conditions: ConditionService<TTarget, TEvent>, catalog: CommandCatalogService<TTarget, TEvent>, options?: ActivationOptions<TTarget, TEvent>);
|
|
10
|
+
export interface ActivationService<TTarget extends object, TEvent extends KeymapEvent> {
|
|
19
11
|
getFocusedTarget(): TTarget | null;
|
|
20
12
|
getFocusedTargetIfAvailable(): TTarget | null;
|
|
21
13
|
setPendingSequence(next: PendingSequenceState<TTarget, TEvent> | null): void;
|
|
@@ -26,30 +18,12 @@ export declare class ActivationService<TTarget extends object, TEvent extends Ke
|
|
|
26
18
|
popPendingSequence(): boolean;
|
|
27
19
|
getActiveKeys(options?: ActiveKeyOptions): readonly ActiveKey<TTarget, TEvent>[];
|
|
28
20
|
getActiveKeysForCaptures(captures: readonly PendingSequenceCapture<TTarget, TEvent>[], options?: ActiveKeyOptions): readonly ActiveKey<TTarget, TEvent>[];
|
|
29
|
-
|
|
21
|
+
getActiveKeysForFocused(focused: TTarget | null, options?: ActiveKeyOptions): readonly ActiveKey<TTarget, TEvent>[];
|
|
30
22
|
getActiveLayers(focused: TTarget | null): RegisteredLayer<TTarget, TEvent>[];
|
|
31
|
-
refreshActiveLayers(focused?: TTarget | null): void;
|
|
32
|
-
invalidateActiveLayers(): void;
|
|
33
23
|
isLayerActiveForFocused(layer: RegisteredLayer<TTarget, TEvent>, focused: TTarget | null): boolean;
|
|
34
|
-
layerCanCacheActiveKeys(layer: RegisteredLayer<TTarget, TEvent>): boolean;
|
|
35
|
-
activeLayersCanCacheActiveKeys(activeLayers: readonly RegisteredLayer<TTarget, TEvent>[]): boolean;
|
|
36
|
-
private collectNodesFromNode;
|
|
37
24
|
collectSequencePartsFromPending(pending: PendingSequenceState<TTarget, TEvent>): KeySequencePart[];
|
|
38
|
-
collectMatchingBindings(bindings: readonly
|
|
39
|
-
|
|
40
|
-
private getNodePresentation;
|
|
41
|
-
private toActiveBinding;
|
|
42
|
-
collectActiveBindings(bindings: readonly CompiledBinding<TTarget, TEvent>[], focused: TTarget | null, activeView: ActiveCommandView<TTarget, TEvent>): ActiveBinding<TTarget, TEvent>[];
|
|
43
|
-
private collectActiveKeysAtRoot;
|
|
44
|
-
private collectActiveKeysFromPending;
|
|
45
|
-
private selectActiveKey;
|
|
46
|
-
private selectPrefixActiveKey;
|
|
47
|
-
private selectExactActiveKey;
|
|
48
|
-
private selectActiveBindings;
|
|
49
|
-
private createActiveKeyState;
|
|
50
|
-
private updateActiveKeyState;
|
|
51
|
-
private materializeActiveKey;
|
|
52
|
-
private invalidateCaches;
|
|
53
|
-
private notifyPendingSequenceChange;
|
|
25
|
+
collectMatchingBindings(bindings: readonly BindingState<TTarget, TEvent>[], focused: TTarget | null, activeView: ActiveCommandView<TTarget, TEvent>): BindingState<TTarget, TEvent>[];
|
|
26
|
+
collectActiveBindings(bindings: readonly BindingState<TTarget, TEvent>[], focused: TTarget | null, activeView: ActiveCommandView<TTarget, TEvent>): ActiveBinding<TTarget, TEvent>[];
|
|
54
27
|
}
|
|
28
|
+
export declare function createActivationService<TTarget extends object, TEvent extends KeymapEvent>(state: State<TTarget, TEvent>, host: KeymapHost<TTarget, TEvent>, hooks: RuntimeEmitter<Hooks<TTarget, TEvent>>, notify: NotificationService<TTarget, TEvent>, conditions: ConditionService<TTarget, TEvent>, catalog: CommandCatalogService<TTarget, TEvent>, options?: ActivationOptions<TTarget, TEvent>): ActivationService<TTarget, TEvent>;
|
|
55
29
|
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ActiveKey, ActiveKeyOptions, KeymapEvent } from "../types.js";
|
|
2
|
+
export interface ActiveKeysCache<TTarget extends object, TEvent extends KeymapEvent> {
|
|
3
|
+
version: number;
|
|
4
|
+
notifyVersion: number;
|
|
5
|
+
focused: TTarget | null | undefined;
|
|
6
|
+
value: readonly ActiveKey<TTarget, TEvent>[];
|
|
7
|
+
targets: WeakMap<TTarget, {
|
|
8
|
+
version: number;
|
|
9
|
+
value: readonly ActiveKey<TTarget, TEvent>[];
|
|
10
|
+
}>;
|
|
11
|
+
nullTarget?: {
|
|
12
|
+
version: number;
|
|
13
|
+
value: readonly ActiveKey<TTarget, TEvent>[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface ActiveKeysCaches<TTarget extends object, TEvent extends KeymapEvent> {
|
|
17
|
+
plain: ActiveKeysCache<TTarget, TEvent>;
|
|
18
|
+
bindings: ActiveKeysCache<TTarget, TEvent>;
|
|
19
|
+
metadata: ActiveKeysCache<TTarget, TEvent>;
|
|
20
|
+
bindingsAndMetadata: ActiveKeysCache<TTarget, TEvent>;
|
|
21
|
+
}
|
|
22
|
+
export declare function createActiveKeysCache<TTarget extends object, TEvent extends KeymapEvent>(): ActiveKeysCache<TTarget, TEvent>;
|
|
23
|
+
export declare function createActiveKeysCaches<TTarget extends object, TEvent extends KeymapEvent>(): ActiveKeysCaches<TTarget, TEvent>;
|
|
24
|
+
export declare function getActiveKeysCache<TTarget extends object, TEvent extends KeymapEvent>(caches: ActiveKeysCaches<TTarget, TEvent>, options?: ActiveKeyOptions): ActiveKeysCache<TTarget, TEvent>;
|
|
25
|
+
export declare function getFocusedActiveKeysCache<TTarget extends object, TEvent extends KeymapEvent>(cache: ActiveKeysCache<TTarget, TEvent>, cacheVersion: number, focused: TTarget | null): {
|
|
26
|
+
version: number;
|
|
27
|
+
value: readonly ActiveKey<TTarget, TEvent>[];
|
|
28
|
+
} | undefined;
|
|
29
|
+
export declare function setFocusedActiveKeysCache<TTarget extends object, TEvent extends KeymapEvent>(cache: ActiveKeysCache<TTarget, TEvent>, cacheVersion: number, focused: TTarget | null, value: readonly ActiveKey<TTarget, TEvent>[]): void;
|
|
@@ -1,69 +1,44 @@
|
|
|
1
|
-
import type { ActiveBinding, Attributes,
|
|
1
|
+
import type { ActiveBinding, Attributes, Command, CommandEntry, CommandBindingsQuery, CommandResolutionStatus, CommandQuery, CommandResolver, BindingState, KeymapEvent, KeymapHost, CommandState } from "../types.js";
|
|
2
2
|
import type { ConditionService } from "./conditions.js";
|
|
3
3
|
import type { NotificationService } from "./notify.js";
|
|
4
|
-
import type { ActiveCommandView,
|
|
4
|
+
import type { ActiveCommandView, ResolvedCommandEntry, State } from "./state.js";
|
|
5
5
|
interface CommandCatalogOptions {
|
|
6
6
|
onCommandResolversChanged(): void;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
interface ResolvedCommandLookup<TTarget extends object, TEvent extends KeymapEvent> {
|
|
9
|
+
resolved?: ResolvedCommandEntry<TTarget, TEvent>;
|
|
10
|
+
hadError: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface CommandExecutionFields {
|
|
13
|
+
input: string;
|
|
14
|
+
payload?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface CommandCatalogService<TTarget extends object, TEvent extends KeymapEvent> {
|
|
17
|
+
normalizeCommands(commands: readonly Command<TTarget, TEvent>[]): CommandState<TTarget, TEvent>[];
|
|
16
18
|
prependCommandResolver(resolver: CommandResolver<TTarget, TEvent>): () => void;
|
|
17
19
|
appendCommandResolver(resolver: CommandResolver<TTarget, TEvent>): () => void;
|
|
18
20
|
clearCommandResolvers(): void;
|
|
19
|
-
getCommands(query?: CommandQuery<TTarget>): readonly
|
|
20
|
-
getCommandEntries(query?: CommandQuery<TTarget>): readonly CommandEntry<TTarget, TEvent>[];
|
|
21
|
+
getCommands(query?: CommandQuery<TTarget, TEvent>): readonly Command<TTarget, TEvent>[];
|
|
22
|
+
getCommandEntries(query?: CommandQuery<TTarget, TEvent>): readonly CommandEntry<TTarget, TEvent>[];
|
|
21
23
|
getCommandBindings(query: CommandBindingsQuery<TTarget>): ReadonlyMap<string, readonly ActiveBinding<TTarget, TEvent>[]>;
|
|
22
|
-
getResolvedCommandChain(command: string, focused: TTarget | null,
|
|
24
|
+
getResolvedCommandChain(command: string, focused: TTarget | null, execution?: CommandExecutionFields): {
|
|
23
25
|
entries?: readonly ResolvedCommandEntry<TTarget, TEvent>[];
|
|
24
26
|
hadError: boolean;
|
|
25
27
|
};
|
|
26
|
-
getRegisteredResolvedEntries(command: string
|
|
27
|
-
getActiveRegisteredResolvedEntries(command: string, focused: TTarget | null
|
|
28
|
-
resolveRegisteredResolverFallback(command: string,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
resolveActiveResolverFallback(command: string, focused: TTarget | null, includeRecord: boolean): {
|
|
33
|
-
resolved?: ResolvedBindingCommand<TTarget, TEvent>;
|
|
34
|
-
hadError: boolean;
|
|
35
|
-
};
|
|
36
|
-
getCommandAttrs(command: string, focused: TTarget | null): Readonly<Attributes> | undefined;
|
|
37
|
-
getTopCommandRecord(command: string, focused: TTarget | null): CommandRecord | undefined;
|
|
38
|
-
getTopRegisteredCommandRecord(command: string): CommandRecord | undefined;
|
|
39
|
-
getDispatchUnavailableCommandState(command: string, focused: TTarget | null, includeRecord: boolean): {
|
|
28
|
+
getRegisteredResolvedEntries(command: string): readonly ResolvedCommandEntry<TTarget, TEvent>[] | undefined;
|
|
29
|
+
getActiveRegisteredResolvedEntries(command: string, focused: TTarget | null): readonly ResolvedCommandEntry<TTarget, TEvent>[] | undefined;
|
|
30
|
+
resolveRegisteredResolverFallback(command: string, execution?: CommandExecutionFields): ResolvedCommandLookup<TTarget, TEvent>;
|
|
31
|
+
resolveActiveResolverFallback(command: string, focused: TTarget | null, execution?: CommandExecutionFields): ResolvedCommandLookup<TTarget, TEvent>;
|
|
32
|
+
getTopCommand(command: string, focused: TTarget | null): Command<TTarget, TEvent> | undefined;
|
|
33
|
+
getDispatchUnavailableCommandState(command: string, focused: TTarget | null, includeCommand: boolean): {
|
|
40
34
|
reason: "inactive" | "disabled";
|
|
41
|
-
command?:
|
|
35
|
+
command?: Command<TTarget, TEvent>;
|
|
42
36
|
} | undefined;
|
|
43
37
|
getActiveCommandView(focused: TTarget | null): ActiveCommandView<TTarget, TEvent>;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
getCommandResolutionStatus(command: string, layerCommands?: ReadonlyMap<string, RegisteredCommand<TTarget, TEvent>>): CommandResolutionStatus;
|
|
48
|
-
private mutateCommandResolvers;
|
|
49
|
-
private getTopResolvedCommand;
|
|
50
|
-
private getTopRegisteredCommand;
|
|
51
|
-
private getFallbackResolvedCommand;
|
|
52
|
-
private getResolvedCommandChainFromView;
|
|
53
|
-
private getRegisteredLayerCommandEntries;
|
|
54
|
-
private getCommandQueryContext;
|
|
55
|
-
private getFilteredCommandEntries;
|
|
56
|
-
private collectCommandEntryBindings;
|
|
57
|
-
private collectCommandBindings;
|
|
58
|
-
private collectBindingForCommandEntries;
|
|
59
|
-
private collectBindingForCommandBindings;
|
|
60
|
-
private createActiveBinding;
|
|
61
|
-
private getCommandBindingAttrs;
|
|
62
|
-
private resolveCommandWithResolvers;
|
|
63
|
-
private createCommandResolverContext;
|
|
38
|
+
isBindingVisible(binding: BindingState<TTarget, TEvent>, focused: TTarget | null, activeView: ActiveCommandView<TTarget, TEvent>): boolean;
|
|
39
|
+
getBindingCommandAttrs(binding: BindingState<TTarget, TEvent>, focused: TTarget | null, activeView: ActiveCommandView<TTarget, TEvent>): Readonly<Attributes> | undefined;
|
|
40
|
+
getCommandResolutionStatus(command: string, layerCommands?: readonly CommandState<TTarget, TEvent>[]): CommandResolutionStatus;
|
|
64
41
|
}
|
|
65
|
-
export declare function
|
|
66
|
-
export declare function
|
|
67
|
-
includeRecord?: boolean;
|
|
68
|
-
}): ResolvedBindingCommand<TTarget, TEvent>;
|
|
42
|
+
export declare function createCommandCatalogService<TTarget extends object, TEvent extends KeymapEvent>(state: State<TTarget, TEvent>, host: KeymapHost<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, conditions: ConditionService<TTarget, TEvent>, options: CommandCatalogOptions): CommandCatalogService<TTarget, TEvent>;
|
|
43
|
+
export declare function getCommand<TTarget extends object, TEvent extends KeymapEvent>(state: CommandState<TTarget, TEvent>): Command<TTarget, TEvent>;
|
|
69
44
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Keymap } from "../keymap.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { BindingState, KeymapEvent, RegisteredLayer, RunCommandOptions, RunCommandResult } from "../types.js";
|
|
3
3
|
import type { CommandCatalogService } from "./command-catalog.js";
|
|
4
4
|
import type { ActivationService } from "./activation.js";
|
|
5
5
|
import type { NotificationService } from "./notify.js";
|
|
@@ -8,16 +8,10 @@ interface CommandExecutorOptions<TTarget extends object, TEvent extends KeymapEv
|
|
|
8
8
|
keymap: Keymap<TTarget, TEvent>;
|
|
9
9
|
createCommandEvent: () => TEvent;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
private readonly catalog;
|
|
16
|
-
private readonly options;
|
|
17
|
-
constructor(notify: NotificationService<TTarget, TEvent>, runtime: RuntimeService<TTarget, TEvent>, activation: ActivationService<TTarget, TEvent>, catalog: CommandCatalogService<TTarget, TEvent>, options: CommandExecutorOptions<TTarget, TEvent>);
|
|
18
|
-
runCommand(cmd: string, options?: RunCommandOptions<TTarget, TEvent>): RunCommandResult;
|
|
19
|
-
dispatchCommand(cmd: string, options?: RunCommandOptions<TTarget, TEvent>): RunCommandResult;
|
|
20
|
-
runBinding(bindingLayer: RegisteredLayer<TTarget, TEvent>, binding: CompiledBinding<TTarget, TEvent>, event: TEvent, focused: TTarget | null): boolean;
|
|
21
|
-
private executeResolvedCommand;
|
|
11
|
+
export interface CommandExecutorService<TTarget extends object, TEvent extends KeymapEvent> {
|
|
12
|
+
runCommand(cmd: string, options?: RunCommandOptions<TTarget, TEvent>): RunCommandResult<TTarget, TEvent>;
|
|
13
|
+
dispatchCommand(cmd: string, options?: RunCommandOptions<TTarget, TEvent>): RunCommandResult<TTarget, TEvent>;
|
|
14
|
+
runBinding(bindingLayer: RegisteredLayer<TTarget, TEvent>, binding: BindingState<TTarget, TEvent>, event: TEvent, focused: TTarget | null, payload?: unknown): boolean;
|
|
22
15
|
}
|
|
16
|
+
export declare function createCommandExecutorService<TTarget extends object, TEvent extends KeymapEvent>(notify: NotificationService<TTarget, TEvent>, runtime: RuntimeService<TTarget, TEvent>, activation: ActivationService<TTarget, TEvent>, catalog: CommandCatalogService<TTarget, TEvent>, options: CommandExecutorOptions<TTarget, TEvent>): CommandExecutorService<TTarget, TEvent>;
|
|
23
17
|
export {};
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import type { ConditionService } from "./conditions.js";
|
|
2
2
|
import type { State } from "./state.js";
|
|
3
3
|
import type { NotificationService } from "./notify.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Binding, BindingCompilationResult, KeyLike, KeymapEvent, KeySequencePart, ResolvedKeyToken, StringifyOptions } from "../types.js";
|
|
5
5
|
export interface CompilerOptions {
|
|
6
6
|
warnUnknownField: (kind: "binding" | "layer", fieldName: string) => void;
|
|
7
7
|
warnUnknownToken: (token: string, sequence: string) => void;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
10
|
-
private readonly state;
|
|
11
|
-
private readonly notify;
|
|
12
|
-
private readonly conditions;
|
|
13
|
-
private readonly options;
|
|
14
|
-
constructor(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, conditions: ConditionService<TTarget, TEvent>, options: CompilerOptions);
|
|
9
|
+
export interface CompilerService<TTarget extends object, TEvent extends KeymapEvent> {
|
|
15
10
|
parseTokenKey(key: KeyLike): KeySequencePart;
|
|
16
11
|
parseKeySequence(key: KeyLike): KeySequencePart[];
|
|
17
12
|
formatKey(key: KeyLike, options?: StringifyOptions): string;
|
|
18
|
-
compileBindings(bindings: readonly
|
|
19
|
-
private parseObjectKeyPart;
|
|
20
|
-
private normalizeBindingEvent;
|
|
21
|
-
private applyBindingTransformers;
|
|
22
|
-
private insertBinding;
|
|
13
|
+
compileBindings(bindings: readonly Binding<TTarget, TEvent>[], tokens: ReadonlyMap<string, ResolvedKeyToken>, sourceTarget: TTarget | undefined, sourceLayerOrder: number, fields?: Readonly<Record<string, unknown>>): BindingCompilationResult<TTarget, TEvent>;
|
|
23
14
|
}
|
|
15
|
+
export declare function createCompilerService<TTarget extends object, TEvent extends KeymapEvent>(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, conditions: ConditionService<TTarget, TEvent>, options: CompilerOptions): CompilerService<TTarget, TEvent>;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import type { NotificationService } from "./notify.js";
|
|
2
1
|
import type { State } from "./state.js";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
private readonly notify;
|
|
7
|
-
constructor(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>);
|
|
2
|
+
import type { NotificationService } from "./notify.js";
|
|
3
|
+
import type { KeymapEvent, ReactiveMatcher, RuntimeMatchable, RuntimeMatcher } from "../types.js";
|
|
4
|
+
export interface ConditionService<TTarget extends object, TEvent extends KeymapEvent> {
|
|
8
5
|
buildRuntimeMatcher(matcher: (() => boolean) | ReactiveMatcher, source: string): RuntimeMatcher;
|
|
9
|
-
hasNoConditions(target: RuntimeMatchable): boolean;
|
|
10
|
-
indexRuntimeMatchable(target: RuntimeMatchable): void;
|
|
11
|
-
unindexRuntimeMatchable(target: RuntimeMatchable): void;
|
|
12
|
-
invalidateRuntimeConditionKey(name: string): void;
|
|
13
6
|
matchesConditions(target: RuntimeMatchable): boolean;
|
|
14
|
-
layerMatchesRuntimeState(layer: RegisteredLayer<TTarget, TEvent>): boolean;
|
|
15
|
-
private matchRequirements;
|
|
16
|
-
private hasFreshConditionCache;
|
|
17
|
-
private updateConditionCache;
|
|
18
|
-
private matchesRuntimeMatcher;
|
|
19
|
-
private matchesRuntimeMatchers;
|
|
20
7
|
}
|
|
8
|
+
export declare function createConditionService<TTarget extends object, TEvent extends KeymapEvent>(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>): ConditionService<TTarget, TEvent>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { KeyDeferredDisambiguationDecision, KeyDeferredDisambiguationHandler, KeyDisambiguationDecision, KeymapEvent, PendingSequenceCapture } from "../types.js";
|
|
2
|
+
export type SyncDecisionAction = "run-exact" | "continue-sequence" | "clear" | "defer";
|
|
3
|
+
export type DeferredDecisionAction = "run-exact" | "continue-sequence" | "clear";
|
|
4
|
+
export interface InternalDisambiguationDecision extends KeyDisambiguationDecision {
|
|
5
|
+
readonly action: SyncDecisionAction;
|
|
6
|
+
readonly handler?: KeyDeferredDisambiguationHandler<any, any>;
|
|
7
|
+
}
|
|
8
|
+
export interface InternalDeferredDisambiguationDecision extends KeyDeferredDisambiguationDecision {
|
|
9
|
+
readonly action: DeferredDecisionAction;
|
|
10
|
+
}
|
|
11
|
+
export interface PendingDisambiguation<TTarget extends object, TEvent extends KeymapEvent> {
|
|
12
|
+
id: number;
|
|
13
|
+
controller: AbortController;
|
|
14
|
+
captures: readonly PendingSequenceCapture<TTarget, TEvent>[];
|
|
15
|
+
apply: (decision: InternalDeferredDisambiguationDecision | void) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function createSyncDecision(action: SyncDecisionAction, handler?: KeyDeferredDisambiguationHandler<any, any>): InternalDisambiguationDecision;
|
|
18
|
+
export declare function createDeferredDecision(action: DeferredDecisionAction): InternalDeferredDisambiguationDecision;
|
|
19
|
+
export declare function isSyncDecision(value: unknown): value is InternalDisambiguationDecision;
|
|
20
|
+
export declare function isDeferredDecision(value: unknown): value is InternalDeferredDisambiguationDecision;
|
|
21
|
+
export declare function sleepWithSignal(ms: number, signal: AbortSignal): Promise<boolean>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { KeymapEvent, KeySequencePart, PendingSequenceCapture, ResolvedSequencePattern, SequencePatternMatch } from "../types.js";
|
|
2
|
+
import type { NotificationService } from "./notify.js";
|
|
3
|
+
export declare function matchSequencePattern<TTarget extends object, TEvent extends KeymapEvent>(patterns: ReadonlyMap<string, ResolvedSequencePattern<TEvent>>, notify: NotificationService<TTarget, TEvent>, patternName: string, event: TEvent): SequencePatternMatch | undefined;
|
|
4
|
+
export declare function createPatternEventPart<TEvent extends KeymapEvent>(patterns: ReadonlyMap<string, ResolvedSequencePattern<TEvent>>, event: TEvent, patternName: string, match: SequencePatternMatch): KeySequencePart;
|
|
5
|
+
export declare function createSequencePayload<TTarget extends object, TEvent extends KeymapEvent>(patterns: ReadonlyMap<string, ResolvedSequencePattern<TEvent>>, notify: NotificationService<TTarget, TEvent>, capture?: PendingSequenceCapture<TTarget, TEvent>): unknown;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CompilerService } from "./compiler.js";
|
|
2
|
+
import type { RuntimeEmitter } from "../lib/runtime-utils.js";
|
|
2
3
|
import type { ActivationService } from "./activation.js";
|
|
3
4
|
import type { CommandExecutorService } from "./command-executor.js";
|
|
4
5
|
import type { CommandCatalogService } from "./command-catalog.js";
|
|
@@ -7,22 +8,10 @@ import type { LayerService } from "./layers.js";
|
|
|
7
8
|
import type { NotificationService } from "./notify.js";
|
|
8
9
|
import type { RuntimeService } from "./runtime.js";
|
|
9
10
|
import type { State } from "./state.js";
|
|
10
|
-
import { type EventMatchResolver, type KeyDisambiguationResolver, type KeyInterceptOptions, type KeyInputContext, type KeymapEvent, type PendingSequenceState, type RawInterceptOptions, type RawInputContext } from "../types.js";
|
|
11
|
-
export
|
|
12
|
-
private readonly state;
|
|
13
|
-
private readonly notify;
|
|
14
|
-
private readonly runtime;
|
|
15
|
-
private readonly activation;
|
|
16
|
-
private readonly conditions;
|
|
17
|
-
private readonly executor;
|
|
18
|
-
private readonly compiler;
|
|
19
|
-
private readonly catalog;
|
|
20
|
-
private readonly layers;
|
|
21
|
-
private readonly eventMatchResolverContext;
|
|
22
|
-
private pendingDisambiguation;
|
|
23
|
-
private nextPendingDisambiguationId;
|
|
24
|
-
constructor(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, runtime: RuntimeService<TTarget, TEvent>, activation: ActivationService<TTarget, TEvent>, conditions: ConditionService<TTarget, TEvent>, executor: CommandExecutorService<TTarget, TEvent>, compiler: CompilerService<TTarget, TEvent>, catalog: CommandCatalogService<TTarget, TEvent>, layers: LayerService<TTarget, TEvent>);
|
|
11
|
+
import { type EventMatchResolver, type KeyDisambiguationResolver, type KeyInterceptOptions, type KeyAfterInputContext, type KeyInputContext, type KeymapEvent, type PendingSequenceState, type RawInterceptOptions, type RawInputContext, type Hooks } from "../types.js";
|
|
12
|
+
export interface DispatchService<TTarget extends object, TEvent extends KeymapEvent> {
|
|
25
13
|
intercept(name: "key", fn: (ctx: KeyInputContext<TEvent>) => void, options?: KeyInterceptOptions): () => void;
|
|
14
|
+
intercept(name: "key:after", fn: (ctx: KeyAfterInputContext<TTarget, TEvent>) => void, options?: KeyInterceptOptions): () => void;
|
|
26
15
|
intercept(name: "raw", fn: (ctx: RawInputContext) => void, options?: RawInterceptOptions): () => void;
|
|
27
16
|
prependEventMatchResolver(resolver: EventMatchResolver<TEvent>): () => void;
|
|
28
17
|
appendEventMatchResolver(resolver: EventMatchResolver<TEvent>): () => void;
|
|
@@ -30,33 +19,8 @@ export declare class DispatchService<TTarget extends object, TEvent extends Keym
|
|
|
30
19
|
prependDisambiguationResolver(resolver: KeyDisambiguationResolver<TTarget, TEvent>): () => void;
|
|
31
20
|
appendDisambiguationResolver(resolver: KeyDisambiguationResolver<TTarget, TEvent>): () => void;
|
|
32
21
|
clearDisambiguationResolvers(): void;
|
|
33
|
-
handlePendingSequenceChange(
|
|
22
|
+
handlePendingSequenceChange(previous: PendingSequenceState<TTarget, TEvent> | null, next: PendingSequenceState<TTarget, TEvent> | null): void;
|
|
34
23
|
handleRawSequence(sequence: string): boolean;
|
|
35
24
|
handleKeyEvent(event: TEvent, release: boolean): void;
|
|
36
|
-
private mutateDisambiguationResolvers;
|
|
37
|
-
private dispatchReleaseLayers;
|
|
38
|
-
private dispatchLayers;
|
|
39
|
-
private dispatchPendingSequence;
|
|
40
|
-
private dispatchPendingCapturesFromIndex;
|
|
41
|
-
private dispatchFromRoot;
|
|
42
|
-
private dispatchFromRootAtIndex;
|
|
43
|
-
private tryResolveRootAmbiguity;
|
|
44
|
-
private tryResolvePendingAmbiguity;
|
|
45
|
-
private tryResolveAmbiguity;
|
|
46
|
-
private applySyncDecision;
|
|
47
|
-
private resolveDisambiguation;
|
|
48
|
-
private scheduleDeferredDisambiguation;
|
|
49
|
-
private executeDeferredDisambiguation;
|
|
50
|
-
private applyDeferredDisambiguationResult;
|
|
51
|
-
private finishPendingDisambiguation;
|
|
52
|
-
private cancelPendingDisambiguation;
|
|
53
|
-
private isPendingDisambiguationCurrent;
|
|
54
|
-
private sleepWithSignal;
|
|
55
|
-
private warnUnresolvedAmbiguity;
|
|
56
|
-
private collectPendingCapturesFromRoot;
|
|
57
|
-
private collectPendingCapturesFromAdvanced;
|
|
58
|
-
private resolveEventMatchKeys;
|
|
59
|
-
private runReleaseBindings;
|
|
60
|
-
private getReachableChild;
|
|
61
|
-
private runBindings;
|
|
62
25
|
}
|
|
26
|
+
export declare function createDispatchService<TTarget extends object, TEvent extends KeymapEvent>(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, runtime: RuntimeService<TTarget, TEvent>, activation: ActivationService<TTarget, TEvent>, conditions: ConditionService<TTarget, TEvent>, executor: CommandExecutorService<TTarget, TEvent>, compiler: CompilerService<TTarget, TEvent>, catalog: CommandCatalogService<TTarget, TEvent>, layers: LayerService<TTarget, TEvent>, hooks: RuntimeEmitter<Hooks<TTarget, TEvent>>): DispatchService<TTarget, TEvent>;
|
|
@@ -2,27 +2,9 @@ import type { CompilerService } from "./compiler.js";
|
|
|
2
2
|
import type { LayerService } from "./layers.js";
|
|
3
3
|
import type { NotificationService } from "./notify.js";
|
|
4
4
|
import type { State } from "./state.js";
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
constructor(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, compiler: CompilerService<TTarget, TEvent>, layers: LayerService<TTarget, TEvent>);
|
|
12
|
-
prependBindingTransformer(transformer: BindingTransformer<TTarget, TEvent>): () => void;
|
|
13
|
-
prependLayerBindingsTransformer(transformer: LayerBindingsTransformer<TTarget, TEvent>): () => void;
|
|
14
|
-
appendLayerBindingsTransformer(transformer: LayerBindingsTransformer<TTarget, TEvent>): () => void;
|
|
15
|
-
clearLayerBindingsTransformers(): void;
|
|
16
|
-
appendBindingTransformer(transformer: BindingTransformer<TTarget, TEvent>): () => void;
|
|
17
|
-
clearBindingTransformers(): void;
|
|
18
|
-
prependBindingParser(parser: BindingParser): () => void;
|
|
19
|
-
appendBindingParser(parser: BindingParser): () => void;
|
|
20
|
-
clearBindingParsers(): void;
|
|
21
|
-
registerToken(token: KeyToken): () => void;
|
|
22
|
-
prependBindingExpander(expander: BindingExpander): () => void;
|
|
23
|
-
appendBindingExpander(expander: BindingExpander): () => void;
|
|
24
|
-
clearBindingExpanders(): void;
|
|
25
|
-
registerLayerFields(fields: Record<string, LayerFieldCompiler>): () => void;
|
|
26
|
-
registerBindingFields(fields: Record<string, BindingFieldCompiler>): () => void;
|
|
27
|
-
registerCommandFields(fields: Record<string, CommandFieldCompiler>): () => void;
|
|
28
|
-
}
|
|
5
|
+
import type { KeyToken, KeymapEvent, SequencePattern } from "../types.js";
|
|
6
|
+
type FieldKind = "layer" | "binding" | "command";
|
|
7
|
+
export declare function registerToken<TTarget extends object, TEvent extends KeymapEvent>(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, compiler: CompilerService<TTarget, TEvent>, layers: LayerService<TTarget, TEvent>, token: KeyToken): () => void;
|
|
8
|
+
export declare function registerSequencePattern<TTarget extends object, TEvent extends KeymapEvent>(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, layers: LayerService<TTarget, TEvent>, pattern: SequencePattern<TEvent>): () => void;
|
|
9
|
+
export declare function registerFields<TTarget extends object, TEvent extends KeymapEvent, T>(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, kind: FieldKind, fields: Record<string, T>): () => void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ActivationService } from "./activation.js";
|
|
2
|
+
import type { CommandCatalogService } from "./command-catalog.js";
|
|
3
|
+
import type { ConditionService } from "./conditions.js";
|
|
4
|
+
import type { State } from "./state.js";
|
|
5
|
+
import type { KeymapEvent, KeymapHost } from "../types.js";
|
|
6
|
+
export declare const KEYMAP_EXTENSION_CONTEXT: unique symbol;
|
|
7
|
+
export interface KeymapExtensionContext<TTarget extends object, TEvent extends KeymapEvent> {
|
|
8
|
+
state: State<TTarget, TEvent>;
|
|
9
|
+
host: KeymapHost<TTarget, TEvent>;
|
|
10
|
+
conditions: ConditionService<TTarget, TEvent>;
|
|
11
|
+
catalog: CommandCatalogService<TTarget, TEvent>;
|
|
12
|
+
activation: ActivationService<TTarget, TEvent>;
|
|
13
|
+
}
|
|
14
|
+
export interface KeymapExtensionProvider<TTarget extends object, TEvent extends KeymapEvent> {
|
|
15
|
+
[KEYMAP_EXTENSION_CONTEXT](): KeymapExtensionContext<TTarget, TEvent>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandCatalogService } from "./command-catalog.js";
|
|
2
|
+
import type { LayerDiagnostics } from "./layers.js";
|
|
3
|
+
import type { NotificationService } from "./notify.js";
|
|
4
|
+
import type { KeymapEvent, LayerAnalyzer } from "../types.js";
|
|
5
|
+
export interface LayerDiagnosticsCore<TTarget extends object, TEvent extends KeymapEvent> extends LayerDiagnostics<TTarget, TEvent> {
|
|
6
|
+
prependLayerAnalyzer(analyzer: LayerAnalyzer<TTarget, TEvent>): () => void;
|
|
7
|
+
appendLayerAnalyzer(analyzer: LayerAnalyzer<TTarget, TEvent>): () => void;
|
|
8
|
+
clearLayerAnalyzers(): void;
|
|
9
|
+
}
|
|
10
|
+
export declare function createLayerDiagnostics<TTarget extends object, TEvent extends KeymapEvent>(notify: NotificationService<TTarget, TEvent>, commands: CommandCatalogService<TTarget, TEvent>): LayerDiagnosticsCore<TTarget, TEvent>;
|