@opentui/keymap 0.0.0-20260429-00ce2fef → 0.0.0-20260429-58efc031
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 +10 -0
- package/addons/index.js +24 -1
- package/addons/opentui/index.js +24 -1
- package/extras/index.js +5 -1
- package/html.js +24 -1
- package/index.js +24 -1
- package/opentui.js +24 -1
- package/package.json +4 -4
- package/src/extras/binding-sections.d.ts +11 -3
- package/src/extras/index.d.ts +1 -1
- package/src/keymap.d.ts +3 -1
- package/src/services/compiler.d.ts +3 -1
- package/src/types.d.ts +1 -0
package/README.md
CHANGED
|
@@ -43,6 +43,16 @@ They do not compile into public attrs.
|
|
|
43
43
|
Binding and command fields can compile metadata into attrs that later appear on
|
|
44
44
|
active bindings, active keys, and command query results.
|
|
45
45
|
|
|
46
|
+
## Formatting Keys
|
|
47
|
+
|
|
48
|
+
Use `keymap.formatKey` when formatting raw binding config. It parses string
|
|
49
|
+
bindings through the keymap's registered parsers and tokens before stringifying.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
keymap.formatKey("<leader>s", { separator: " " }) // "space s"
|
|
53
|
+
keymap.formatKey("<leader>s", { preferDisplay: true }) // "<leader>s"
|
|
54
|
+
```
|
|
55
|
+
|
|
46
56
|
## Re-entry
|
|
47
57
|
|
|
48
58
|
Runtime/data-style re-entry is supported during dispatch. For example, command
|
package/addons/index.js
CHANGED
|
@@ -144,7 +144,7 @@ function stringifyKeyStroke(input, options) {
|
|
|
144
144
|
return stringifyCanonicalStroke(normalizeKeyStroke(input));
|
|
145
145
|
}
|
|
146
146
|
function stringifyKeySequence(input, options) {
|
|
147
|
-
return input.map((part) => stringifyKeyStroke(part, options)).join("");
|
|
147
|
+
return input.map((part) => stringifyKeyStroke(part, options)).join(options?.separator ?? "");
|
|
148
148
|
}
|
|
149
149
|
function stringifyCanonicalStroke(stroke) {
|
|
150
150
|
const parts = [];
|
|
@@ -1961,6 +1961,23 @@ class CompilerService {
|
|
|
1961
1961
|
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1962
1962
|
});
|
|
1963
1963
|
}
|
|
1964
|
+
parseKeySequence(key) {
|
|
1965
|
+
if (typeof key !== "string") {
|
|
1966
|
+
return [this.parseObjectKeyPart(key)];
|
|
1967
|
+
}
|
|
1968
|
+
const parsed = parseBindingSequenceWithParsers(key, this.state.environment.bindingParsers.values(), {
|
|
1969
|
+
tokens: this.state.environment.tokens,
|
|
1970
|
+
layer: EMPTY_COMPILE_FIELDS,
|
|
1971
|
+
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1972
|
+
});
|
|
1973
|
+
for (const tokenName of parsed.unknownTokens) {
|
|
1974
|
+
this.options.warnUnknownToken(tokenName, key);
|
|
1975
|
+
}
|
|
1976
|
+
return parsed.parts;
|
|
1977
|
+
}
|
|
1978
|
+
formatKey(key, options) {
|
|
1979
|
+
return stringifyKeySequence(this.parseKeySequence(key), options);
|
|
1980
|
+
}
|
|
1964
1981
|
compileBindings(bindings, tokens, sourceTarget, sourceLayerOrder, compileFields) {
|
|
1965
1982
|
const root = createSequenceNode(null, null, null);
|
|
1966
1983
|
const compiledBindings = [];
|
|
@@ -4280,6 +4297,12 @@ class Keymap {
|
|
|
4280
4297
|
return getKeyMatchKey(input) === match;
|
|
4281
4298
|
};
|
|
4282
4299
|
}
|
|
4300
|
+
parseKeySequence(key) {
|
|
4301
|
+
return this.compiler.parseKeySequence(key);
|
|
4302
|
+
}
|
|
4303
|
+
formatKey(key, options) {
|
|
4304
|
+
return this.compiler.formatKey(key, options);
|
|
4305
|
+
}
|
|
4283
4306
|
clearPendingSequence() {
|
|
4284
4307
|
this.activation.setPendingSequence(null);
|
|
4285
4308
|
}
|
package/addons/opentui/index.js
CHANGED
|
@@ -144,7 +144,7 @@ function stringifyKeyStroke(input, options) {
|
|
|
144
144
|
return stringifyCanonicalStroke(normalizeKeyStroke(input));
|
|
145
145
|
}
|
|
146
146
|
function stringifyKeySequence(input, options) {
|
|
147
|
-
return input.map((part) => stringifyKeyStroke(part, options)).join("");
|
|
147
|
+
return input.map((part) => stringifyKeyStroke(part, options)).join(options?.separator ?? "");
|
|
148
148
|
}
|
|
149
149
|
function stringifyCanonicalStroke(stroke) {
|
|
150
150
|
const parts = [];
|
|
@@ -1961,6 +1961,23 @@ class CompilerService {
|
|
|
1961
1961
|
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1962
1962
|
});
|
|
1963
1963
|
}
|
|
1964
|
+
parseKeySequence(key) {
|
|
1965
|
+
if (typeof key !== "string") {
|
|
1966
|
+
return [this.parseObjectKeyPart(key)];
|
|
1967
|
+
}
|
|
1968
|
+
const parsed = parseBindingSequenceWithParsers(key, this.state.environment.bindingParsers.values(), {
|
|
1969
|
+
tokens: this.state.environment.tokens,
|
|
1970
|
+
layer: EMPTY_COMPILE_FIELDS,
|
|
1971
|
+
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1972
|
+
});
|
|
1973
|
+
for (const tokenName of parsed.unknownTokens) {
|
|
1974
|
+
this.options.warnUnknownToken(tokenName, key);
|
|
1975
|
+
}
|
|
1976
|
+
return parsed.parts;
|
|
1977
|
+
}
|
|
1978
|
+
formatKey(key, options) {
|
|
1979
|
+
return stringifyKeySequence(this.parseKeySequence(key), options);
|
|
1980
|
+
}
|
|
1964
1981
|
compileBindings(bindings, tokens, sourceTarget, sourceLayerOrder, compileFields) {
|
|
1965
1982
|
const root = createSequenceNode(null, null, null);
|
|
1966
1983
|
const compiledBindings = [];
|
|
@@ -4280,6 +4297,12 @@ class Keymap {
|
|
|
4280
4297
|
return getKeyMatchKey(input) === match;
|
|
4281
4298
|
};
|
|
4282
4299
|
}
|
|
4300
|
+
parseKeySequence(key) {
|
|
4301
|
+
return this.compiler.parseKeySequence(key);
|
|
4302
|
+
}
|
|
4303
|
+
formatKey(key, options) {
|
|
4304
|
+
return this.compiler.formatKey(key, options);
|
|
4305
|
+
}
|
|
4283
4306
|
clearPendingSequence() {
|
|
4284
4307
|
this.activation.setPendingSequence(null);
|
|
4285
4308
|
}
|
package/extras/index.js
CHANGED
|
@@ -49,9 +49,13 @@ function resolveBindingValue(section, command, value) {
|
|
|
49
49
|
}
|
|
50
50
|
return [resolveBindingItem(section, command, value)];
|
|
51
51
|
}
|
|
52
|
-
function resolveBindingSections(config) {
|
|
52
|
+
function resolveBindingSections(config, options) {
|
|
53
53
|
const sections = {};
|
|
54
54
|
const lookups = new Map;
|
|
55
|
+
for (const section of options?.sections ?? []) {
|
|
56
|
+
sections[section] = [];
|
|
57
|
+
lookups.set(section, new Map);
|
|
58
|
+
}
|
|
55
59
|
for (const [section, sectionConfig] of Object.entries(config)) {
|
|
56
60
|
if (!isObject(sectionConfig)) {
|
|
57
61
|
throw new Error(`Invalid binding section "${section}": expected an object`);
|
package/html.js
CHANGED
|
@@ -144,7 +144,7 @@ function stringifyKeyStroke(input, options) {
|
|
|
144
144
|
return stringifyCanonicalStroke(normalizeKeyStroke(input));
|
|
145
145
|
}
|
|
146
146
|
function stringifyKeySequence(input, options) {
|
|
147
|
-
return input.map((part) => stringifyKeyStroke(part, options)).join("");
|
|
147
|
+
return input.map((part) => stringifyKeyStroke(part, options)).join(options?.separator ?? "");
|
|
148
148
|
}
|
|
149
149
|
function stringifyCanonicalStroke(stroke) {
|
|
150
150
|
const parts = [];
|
|
@@ -1961,6 +1961,23 @@ class CompilerService {
|
|
|
1961
1961
|
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1962
1962
|
});
|
|
1963
1963
|
}
|
|
1964
|
+
parseKeySequence(key) {
|
|
1965
|
+
if (typeof key !== "string") {
|
|
1966
|
+
return [this.parseObjectKeyPart(key)];
|
|
1967
|
+
}
|
|
1968
|
+
const parsed = parseBindingSequenceWithParsers(key, this.state.environment.bindingParsers.values(), {
|
|
1969
|
+
tokens: this.state.environment.tokens,
|
|
1970
|
+
layer: EMPTY_COMPILE_FIELDS,
|
|
1971
|
+
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1972
|
+
});
|
|
1973
|
+
for (const tokenName of parsed.unknownTokens) {
|
|
1974
|
+
this.options.warnUnknownToken(tokenName, key);
|
|
1975
|
+
}
|
|
1976
|
+
return parsed.parts;
|
|
1977
|
+
}
|
|
1978
|
+
formatKey(key, options) {
|
|
1979
|
+
return stringifyKeySequence(this.parseKeySequence(key), options);
|
|
1980
|
+
}
|
|
1964
1981
|
compileBindings(bindings, tokens, sourceTarget, sourceLayerOrder, compileFields) {
|
|
1965
1982
|
const root = createSequenceNode(null, null, null);
|
|
1966
1983
|
const compiledBindings = [];
|
|
@@ -4280,6 +4297,12 @@ class Keymap {
|
|
|
4280
4297
|
return getKeyMatchKey(input) === match;
|
|
4281
4298
|
};
|
|
4282
4299
|
}
|
|
4300
|
+
parseKeySequence(key) {
|
|
4301
|
+
return this.compiler.parseKeySequence(key);
|
|
4302
|
+
}
|
|
4303
|
+
formatKey(key, options) {
|
|
4304
|
+
return this.compiler.formatKey(key, options);
|
|
4305
|
+
}
|
|
4283
4306
|
clearPendingSequence() {
|
|
4284
4307
|
this.activation.setPendingSequence(null);
|
|
4285
4308
|
}
|
package/index.js
CHANGED
|
@@ -144,7 +144,7 @@ function stringifyKeyStroke(input, options) {
|
|
|
144
144
|
return stringifyCanonicalStroke(normalizeKeyStroke(input));
|
|
145
145
|
}
|
|
146
146
|
function stringifyKeySequence(input, options) {
|
|
147
|
-
return input.map((part) => stringifyKeyStroke(part, options)).join("");
|
|
147
|
+
return input.map((part) => stringifyKeyStroke(part, options)).join(options?.separator ?? "");
|
|
148
148
|
}
|
|
149
149
|
function stringifyCanonicalStroke(stroke) {
|
|
150
150
|
const parts = [];
|
|
@@ -1961,6 +1961,23 @@ class CompilerService {
|
|
|
1961
1961
|
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1962
1962
|
});
|
|
1963
1963
|
}
|
|
1964
|
+
parseKeySequence(key) {
|
|
1965
|
+
if (typeof key !== "string") {
|
|
1966
|
+
return [this.parseObjectKeyPart(key)];
|
|
1967
|
+
}
|
|
1968
|
+
const parsed = parseBindingSequenceWithParsers(key, this.state.environment.bindingParsers.values(), {
|
|
1969
|
+
tokens: this.state.environment.tokens,
|
|
1970
|
+
layer: EMPTY_COMPILE_FIELDS,
|
|
1971
|
+
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1972
|
+
});
|
|
1973
|
+
for (const tokenName of parsed.unknownTokens) {
|
|
1974
|
+
this.options.warnUnknownToken(tokenName, key);
|
|
1975
|
+
}
|
|
1976
|
+
return parsed.parts;
|
|
1977
|
+
}
|
|
1978
|
+
formatKey(key, options) {
|
|
1979
|
+
return stringifyKeySequence(this.parseKeySequence(key), options);
|
|
1980
|
+
}
|
|
1964
1981
|
compileBindings(bindings, tokens, sourceTarget, sourceLayerOrder, compileFields) {
|
|
1965
1982
|
const root = createSequenceNode(null, null, null);
|
|
1966
1983
|
const compiledBindings = [];
|
|
@@ -4280,6 +4297,12 @@ class Keymap {
|
|
|
4280
4297
|
return getKeyMatchKey(input) === match;
|
|
4281
4298
|
};
|
|
4282
4299
|
}
|
|
4300
|
+
parseKeySequence(key) {
|
|
4301
|
+
return this.compiler.parseKeySequence(key);
|
|
4302
|
+
}
|
|
4303
|
+
formatKey(key, options) {
|
|
4304
|
+
return this.compiler.formatKey(key, options);
|
|
4305
|
+
}
|
|
4283
4306
|
clearPendingSequence() {
|
|
4284
4307
|
this.activation.setPendingSequence(null);
|
|
4285
4308
|
}
|
package/opentui.js
CHANGED
|
@@ -144,7 +144,7 @@ function stringifyKeyStroke(input, options) {
|
|
|
144
144
|
return stringifyCanonicalStroke(normalizeKeyStroke(input));
|
|
145
145
|
}
|
|
146
146
|
function stringifyKeySequence(input, options) {
|
|
147
|
-
return input.map((part) => stringifyKeyStroke(part, options)).join("");
|
|
147
|
+
return input.map((part) => stringifyKeyStroke(part, options)).join(options?.separator ?? "");
|
|
148
148
|
}
|
|
149
149
|
function stringifyCanonicalStroke(stroke) {
|
|
150
150
|
const parts = [];
|
|
@@ -1961,6 +1961,23 @@ class CompilerService {
|
|
|
1961
1961
|
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1962
1962
|
});
|
|
1963
1963
|
}
|
|
1964
|
+
parseKeySequence(key) {
|
|
1965
|
+
if (typeof key !== "string") {
|
|
1966
|
+
return [this.parseObjectKeyPart(key)];
|
|
1967
|
+
}
|
|
1968
|
+
const parsed = parseBindingSequenceWithParsers(key, this.state.environment.bindingParsers.values(), {
|
|
1969
|
+
tokens: this.state.environment.tokens,
|
|
1970
|
+
layer: EMPTY_COMPILE_FIELDS,
|
|
1971
|
+
parseObjectKey: (value, options) => this.parseObjectKeyPart(value, options)
|
|
1972
|
+
});
|
|
1973
|
+
for (const tokenName of parsed.unknownTokens) {
|
|
1974
|
+
this.options.warnUnknownToken(tokenName, key);
|
|
1975
|
+
}
|
|
1976
|
+
return parsed.parts;
|
|
1977
|
+
}
|
|
1978
|
+
formatKey(key, options) {
|
|
1979
|
+
return stringifyKeySequence(this.parseKeySequence(key), options);
|
|
1980
|
+
}
|
|
1964
1981
|
compileBindings(bindings, tokens, sourceTarget, sourceLayerOrder, compileFields) {
|
|
1965
1982
|
const root = createSequenceNode(null, null, null);
|
|
1966
1983
|
const compiledBindings = [];
|
|
@@ -4280,6 +4297,12 @@ class Keymap {
|
|
|
4280
4297
|
return getKeyMatchKey(input) === match;
|
|
4281
4298
|
};
|
|
4282
4299
|
}
|
|
4300
|
+
parseKeySequence(key) {
|
|
4301
|
+
return this.compiler.parseKeySequence(key);
|
|
4302
|
+
}
|
|
4303
|
+
formatKey(key, options) {
|
|
4304
|
+
return this.compiler.formatKey(key, options);
|
|
4305
|
+
}
|
|
4283
4306
|
clearPendingSequence() {
|
|
4284
4307
|
this.activation.setPendingSequence(null);
|
|
4285
4308
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.0.0-20260429-
|
|
7
|
+
"version": "0.0.0-20260429-58efc031",
|
|
8
8
|
"description": "Standalone keymap package for OpenTUI",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@opentui/core": "0.0.0-20260429-
|
|
58
|
+
"@opentui/core": "0.0.0-20260429-58efc031"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@opentui/react": "workspace:*",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"typescript": "^5"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@opentui/react": "0.0.0-20260429-
|
|
72
|
-
"@opentui/solid": "0.0.0-20260429-
|
|
71
|
+
"@opentui/react": "0.0.0-20260429-58efc031",
|
|
72
|
+
"@opentui/solid": "0.0.0-20260429-58efc031",
|
|
73
73
|
"react": ">=19.0.0",
|
|
74
74
|
"solid-js": "1.9.12"
|
|
75
75
|
},
|
|
@@ -3,8 +3,16 @@ export type BindingSectionItem<TTarget extends object = object, TEvent extends K
|
|
|
3
3
|
export type BindingValue<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent> = false | "none" | BindingSectionItem<TTarget, TEvent> | readonly BindingSectionItem<TTarget, TEvent>[];
|
|
4
4
|
export type BindingSectionConfig<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent> = Readonly<Record<string, BindingValue<TTarget, TEvent>>>;
|
|
5
5
|
export type BindingSectionsConfig<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent> = Readonly<Record<string, BindingSectionConfig<TTarget, TEvent>>>;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type LiteralStringKeys<T> = string extends Extract<keyof T, string> ? never : Extract<keyof T, string>;
|
|
7
|
+
export interface ResolvedBindingSections<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent, TSection extends string = string> {
|
|
8
|
+
sections: Record<TSection, BindingInput<TTarget, TEvent>[]>;
|
|
8
9
|
get(section: string, cmd: string): readonly BindingInput<TTarget, TEvent>[] | undefined;
|
|
9
10
|
}
|
|
10
|
-
export
|
|
11
|
+
export interface ResolveBindingSectionsOptions<TSection extends string = string> {
|
|
12
|
+
sections?: readonly TSection[];
|
|
13
|
+
}
|
|
14
|
+
export declare function resolveBindingSections<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent, const TConfig extends BindingSectionsConfig<TTarget, TEvent> = BindingSectionsConfig<TTarget, TEvent>, const TSection extends string = string>(config: TConfig, options: ResolveBindingSectionsOptions<TSection> & {
|
|
15
|
+
sections: readonly TSection[];
|
|
16
|
+
}): ResolvedBindingSections<TTarget, TEvent, TSection | LiteralStringKeys<TConfig>>;
|
|
17
|
+
export declare function resolveBindingSections<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent>(config: BindingSectionsConfig<TTarget, TEvent>, options?: ResolveBindingSectionsOptions): ResolvedBindingSections<TTarget, TEvent>;
|
|
18
|
+
export {};
|
package/src/extras/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { resolveBindingSections } from "./binding-sections.js";
|
|
2
2
|
export { commandBindings } from "./command-bindings.js";
|
|
3
|
-
export type { BindingSectionConfig, BindingSectionItem, BindingSectionsConfig, BindingValue, ResolvedBindingSections, } from "./binding-sections.js";
|
|
3
|
+
export type { BindingSectionConfig, BindingSectionItem, BindingSectionsConfig, BindingValue, ResolveBindingSectionsOptions, ResolvedBindingSections, } from "./binding-sections.js";
|
|
4
4
|
export type { CommandBindingMap, CommandBindingsOptions, CommandBindingsOverrideWarning, CommandBindingsError, } from "./command-bindings.js";
|
package/src/keymap.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActiveKey, ActiveKeyOptions, BindingExpander, BindingParser, BindingFieldCompiler, LayerBindingsTransformer, BindingTransformer, Events, CommandFieldCompiler, CommandEntry, CommandQuery, CommandRecord, KeymapEvent, KeymapHost, LayerAnalyzer, Listener, RunCommandOptions, RunCommandResult, CommandResolver, KeyInterceptOptions, KeyInputContext, Layer, LayerFieldCompiler, KeyDisambiguationResolver, RawInterceptOptions, RawInputContext, EventMatchResolver, KeyStringifyInput, KeyToken, KeyLike, KeySequencePart } from "./types.js";
|
|
1
|
+
import type { ActiveKey, ActiveKeyOptions, BindingExpander, BindingParser, BindingFieldCompiler, LayerBindingsTransformer, BindingTransformer, Events, CommandFieldCompiler, CommandEntry, CommandQuery, CommandRecord, KeymapEvent, KeymapHost, LayerAnalyzer, Listener, RunCommandOptions, RunCommandResult, CommandResolver, KeyInterceptOptions, KeyInputContext, Layer, LayerFieldCompiler, KeyDisambiguationResolver, RawInterceptOptions, RawInputContext, EventMatchResolver, KeyStringifyInput, KeyToken, KeyLike, KeySequencePart, StringifyOptions } from "./types.js";
|
|
2
2
|
export declare class Keymap<TTarget extends object, TEvent extends KeymapEvent = KeymapEvent> {
|
|
3
3
|
private readonly host;
|
|
4
4
|
private readonly state;
|
|
@@ -28,6 +28,8 @@ export declare class Keymap<TTarget extends object, TEvent extends KeymapEvent =
|
|
|
28
28
|
hasPendingSequence(): boolean;
|
|
29
29
|
getPendingSequence(): readonly KeySequencePart[];
|
|
30
30
|
createKeyMatcher(key: KeyLike): (input: KeyStringifyInput | null | undefined) => boolean;
|
|
31
|
+
parseKeySequence(key: KeyLike): readonly KeySequencePart[];
|
|
32
|
+
formatKey(key: KeyLike, options?: StringifyOptions): string;
|
|
31
33
|
clearPendingSequence(): void;
|
|
32
34
|
popPendingSequence(): boolean;
|
|
33
35
|
getActiveKeys(options?: ActiveKeyOptions): readonly ActiveKey<TTarget, TEvent>[];
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { BindingInput, CompiledBindingsResult, KeyLike, KeymapEvent, KeySequencePart, ResolvedKeyToken } from "../types.js";
|
|
4
|
+
import type { BindingInput, CompiledBindingsResult, 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;
|
|
@@ -13,6 +13,8 @@ export declare class CompilerService<TTarget extends object, TEvent extends Keym
|
|
|
13
13
|
private readonly options;
|
|
14
14
|
constructor(state: State<TTarget, TEvent>, notify: NotificationService<TTarget, TEvent>, conditions: ConditionService<TTarget, TEvent>, options: CompilerOptions);
|
|
15
15
|
parseTokenKey(key: KeyLike): KeySequencePart;
|
|
16
|
+
parseKeySequence(key: KeyLike): KeySequencePart[];
|
|
17
|
+
formatKey(key: KeyLike, options?: StringifyOptions): string;
|
|
16
18
|
compileBindings(bindings: readonly BindingInput<TTarget, TEvent>[], tokens: ReadonlyMap<string, ResolvedKeyToken>, sourceTarget: TTarget | undefined, sourceLayerOrder: number, compileFields?: Readonly<Record<string, unknown>>): CompiledBindingsResult<TTarget, TEvent>;
|
|
17
19
|
private parseObjectKeyPart;
|
|
18
20
|
private normalizeBindingEvent;
|
package/src/types.d.ts
CHANGED