@keymanapp/kmc-analyze 18.0.41-alpha → 18.0.46-alpha
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/build/src/index.d.ts +7 -7
- package/build/src/index.js +8 -11
- package/build/src/index.js.map +1 -1
- package/build/src/messages.d.ts +15 -15
- package/build/src/messages.d.ts.map +1 -1
- package/build/src/messages.js +20 -23
- package/build/src/messages.js.map +1 -1
- package/build/src/osk-character-use/index.d.ts +86 -86
- package/build/src/osk-character-use/index.js +281 -284
- package/build/src/osk-character-use/index.js.map +1 -1
- package/build/src/osk-rewrite-pua/index.d.ts +40 -40
- package/build/src/osk-rewrite-pua/index.js +129 -132
- package/build/src/osk-rewrite-pua/index.js.map +1 -1
- package/build/src/util/get-osk-from-kmn-file.d.ts +5 -5
- package/build/src/util/get-osk-from-kmn-file.js +30 -33
- package/build/src/util/get-osk-from-kmn-file.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
-
import { Osk } from '@keymanapp/kmc-kmn';
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
* Rewrite On Screen Keyboard files (.kvks, .keyman-touch-layout) with PUA
|
|
6
|
-
* codepoints, based on analysis provided by {@link AnalyzeOskCharacterUse}
|
|
7
|
-
* class.
|
|
8
|
-
*/
|
|
9
|
-
export declare class AnalyzeOskRewritePua {
|
|
10
|
-
private callbacks;
|
|
11
|
-
private _data;
|
|
12
|
-
constructor(callbacks: CompilerCallbacks);
|
|
13
|
-
/**
|
|
14
|
-
* Clears data collected from previous calls to
|
|
15
|
-
* {@link AnalyzeOskRewritePua.analyze}
|
|
16
|
-
*/
|
|
17
|
-
clear(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Analyze a keyboard file or files, and provide a remapped output. Accepts a
|
|
20
|
-
* .kmn, .kvks, .keyman-touch-layout file formats. For .kmn, will rewrite
|
|
21
|
-
* associated On Screen Keyboard file formats. Can be called multiple times to
|
|
22
|
-
* rewrite multiple files. Use the {@link AnalyzeOskRewritePua.data} property
|
|
23
|
-
* to retrieve the output file content for writing. This does not modify the
|
|
24
|
-
* source file.
|
|
25
|
-
* @param file - relative or absolute path to a Keyman source file
|
|
26
|
-
* @param mapping - OSK keycap map provided by {@link AnalyzeOskCharacterUse}
|
|
27
|
-
* @returns true if the file is successfully loaded and rewritten
|
|
28
|
-
*/
|
|
29
|
-
analyze(file: string, mapping: Osk.StringResult[]): Promise<boolean>;
|
|
30
|
-
/**
|
|
31
|
-
* Returns the file data for OSK files rewritten with PUA characters, for use
|
|
32
|
-
* with `&displayMap`.
|
|
33
|
-
*/
|
|
34
|
-
get data(): {
|
|
35
|
-
[index: string]: Uint8Array;
|
|
36
|
-
};
|
|
37
|
-
private analyzeKmnKeyboard;
|
|
38
|
-
private analyzeVisualKeyboard;
|
|
39
|
-
private analyzeTouchLayout;
|
|
40
|
-
}
|
|
1
|
+
import { CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
+
import { Osk } from '@keymanapp/kmc-kmn';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* Rewrite On Screen Keyboard files (.kvks, .keyman-touch-layout) with PUA
|
|
6
|
+
* codepoints, based on analysis provided by {@link AnalyzeOskCharacterUse}
|
|
7
|
+
* class.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AnalyzeOskRewritePua {
|
|
10
|
+
private callbacks;
|
|
11
|
+
private _data;
|
|
12
|
+
constructor(callbacks: CompilerCallbacks);
|
|
13
|
+
/**
|
|
14
|
+
* Clears data collected from previous calls to
|
|
15
|
+
* {@link AnalyzeOskRewritePua.analyze}
|
|
16
|
+
*/
|
|
17
|
+
clear(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Analyze a keyboard file or files, and provide a remapped output. Accepts a
|
|
20
|
+
* .kmn, .kvks, .keyman-touch-layout file formats. For .kmn, will rewrite
|
|
21
|
+
* associated On Screen Keyboard file formats. Can be called multiple times to
|
|
22
|
+
* rewrite multiple files. Use the {@link AnalyzeOskRewritePua.data} property
|
|
23
|
+
* to retrieve the output file content for writing. This does not modify the
|
|
24
|
+
* source file.
|
|
25
|
+
* @param file - relative or absolute path to a Keyman source file
|
|
26
|
+
* @param mapping - OSK keycap map provided by {@link AnalyzeOskCharacterUse}
|
|
27
|
+
* @returns true if the file is successfully loaded and rewritten
|
|
28
|
+
*/
|
|
29
|
+
analyze(file: string, mapping: Osk.StringResult[]): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the file data for OSK files rewritten with PUA characters, for use
|
|
32
|
+
* with `&displayMap`.
|
|
33
|
+
*/
|
|
34
|
+
get data(): {
|
|
35
|
+
[index: string]: Uint8Array;
|
|
36
|
+
};
|
|
37
|
+
private analyzeKmnKeyboard;
|
|
38
|
+
private analyzeVisualKeyboard;
|
|
39
|
+
private analyzeTouchLayout;
|
|
40
|
+
}
|
|
41
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,132 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
callbacks
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.callbacks.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=index.js.map
|
|
132
|
-
//# debugId=afce4aa9-23fc-5726-a96d-3716c9c177a6
|
|
1
|
+
import { KeymanFileTypes, KvksFileReader, KvksFileWriter, TouchLayoutFileReader, TouchLayoutFileWriter } from "@keymanapp/common-types";
|
|
2
|
+
import { CompilerMessages, Osk } from '@keymanapp/kmc-kmn';
|
|
3
|
+
import { getOskFromKmnFile } from "../util/get-osk-from-kmn-file.js";
|
|
4
|
+
import { AnalyzerMessages } from "../messages.js";
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
* Rewrite On Screen Keyboard files (.kvks, .keyman-touch-layout) with PUA
|
|
8
|
+
* codepoints, based on analysis provided by {@link AnalyzeOskCharacterUse}
|
|
9
|
+
* class.
|
|
10
|
+
*/
|
|
11
|
+
export class AnalyzeOskRewritePua {
|
|
12
|
+
callbacks;
|
|
13
|
+
_data = {};
|
|
14
|
+
constructor(callbacks) {
|
|
15
|
+
this.callbacks = callbacks;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Clears data collected from previous calls to
|
|
19
|
+
* {@link AnalyzeOskRewritePua.analyze}
|
|
20
|
+
*/
|
|
21
|
+
clear() {
|
|
22
|
+
this._data = {};
|
|
23
|
+
}
|
|
24
|
+
//
|
|
25
|
+
// Analyze a single file
|
|
26
|
+
//
|
|
27
|
+
/**
|
|
28
|
+
* Analyze a keyboard file or files, and provide a remapped output. Accepts a
|
|
29
|
+
* .kmn, .kvks, .keyman-touch-layout file formats. For .kmn, will rewrite
|
|
30
|
+
* associated On Screen Keyboard file formats. Can be called multiple times to
|
|
31
|
+
* rewrite multiple files. Use the {@link AnalyzeOskRewritePua.data} property
|
|
32
|
+
* to retrieve the output file content for writing. This does not modify the
|
|
33
|
+
* source file.
|
|
34
|
+
* @param file - relative or absolute path to a Keyman source file
|
|
35
|
+
* @param mapping - OSK keycap map provided by {@link AnalyzeOskCharacterUse}
|
|
36
|
+
* @returns true if the file is successfully loaded and rewritten
|
|
37
|
+
*/
|
|
38
|
+
async analyze(file, mapping) {
|
|
39
|
+
let map = Osk.parseMapping(mapping);
|
|
40
|
+
switch (KeymanFileTypes.sourceTypeFromFilename(file)) {
|
|
41
|
+
case ".kvks" /* KeymanFileTypes.Source.VisualKeyboard */:
|
|
42
|
+
this._data[file] = this.analyzeVisualKeyboard(file, map);
|
|
43
|
+
break;
|
|
44
|
+
case ".keyman-touch-layout" /* KeymanFileTypes.Source.TouchLayout */:
|
|
45
|
+
this._data[file] = this.analyzeTouchLayout(file, map);
|
|
46
|
+
break;
|
|
47
|
+
case ".kpj" /* KeymanFileTypes.Source.Project */:
|
|
48
|
+
throw new Error('Passing a project to analyze is not permitted');
|
|
49
|
+
break;
|
|
50
|
+
case ".kmn" /* KeymanFileTypes.Source.KeymanKeyboard */:
|
|
51
|
+
// The cleanest way to do this is to compile the .kmn to find the .kvks
|
|
52
|
+
// and .keyman-touch-layout from the &VISUALKEYBOARD and &LAYOUTFILE
|
|
53
|
+
// system stores
|
|
54
|
+
if (!await this.analyzeKmnKeyboard(file, map)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
case ".xml" /* KeymanFileTypes.Source.LdmlKeyboard */:
|
|
59
|
+
// TODO: await this.analyzeLdmlKeyboard(file);
|
|
60
|
+
// note, will need to skip .xml files that are not ldml keyboards
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
// Ignore any other file types; this way we can analyze project files/folders
|
|
64
|
+
// easily also
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Returns the file data for OSK files rewritten with PUA characters, for use
|
|
70
|
+
* with `&displayMap`.
|
|
71
|
+
*/
|
|
72
|
+
get data() {
|
|
73
|
+
return this._data;
|
|
74
|
+
}
|
|
75
|
+
async analyzeKmnKeyboard(filename, map) {
|
|
76
|
+
this.callbacks.reportMessage(AnalyzerMessages.Info_ScanningFile({ type: 'keyboard source', name: filename }));
|
|
77
|
+
let osk = await getOskFromKmnFile(this.callbacks, filename);
|
|
78
|
+
if (osk.kvksFilename) {
|
|
79
|
+
this._data[osk.kvksFilename] = this.analyzeVisualKeyboard(osk.kvksFilename, map);
|
|
80
|
+
}
|
|
81
|
+
if (osk.touchLayoutFilename) {
|
|
82
|
+
this._data[osk.touchLayoutFilename] = this.analyzeTouchLayout(osk.touchLayoutFilename, map);
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
//
|
|
87
|
+
// On Screen Keyboard file scanning
|
|
88
|
+
//
|
|
89
|
+
analyzeVisualKeyboard(filename, map) {
|
|
90
|
+
this.callbacks.reportMessage(AnalyzerMessages.Info_ScanningFile({ type: 'visual keyboard', name: filename }));
|
|
91
|
+
const reader = new KvksFileReader();
|
|
92
|
+
let source;
|
|
93
|
+
try {
|
|
94
|
+
source = reader.read(this.callbacks.loadFile(filename));
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
this.callbacks.reportMessage(CompilerMessages.Error_InvalidKvksFile({ filename, e }));
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
let invalidKeys = [];
|
|
101
|
+
const vk = reader.transform(source, invalidKeys);
|
|
102
|
+
if (!vk) {
|
|
103
|
+
this.callbacks.reportMessage(CompilerMessages.Error_InvalidKvksFile({ filename, e: null }));
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const dirty = Osk.remapVisualKeyboard(vk, map);
|
|
107
|
+
if (!dirty) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
const writer = new KvksFileWriter();
|
|
111
|
+
const data = writer.write(vk);
|
|
112
|
+
// TODO: the encoder probably needs to go into KvksFileWRiter
|
|
113
|
+
const enc = new TextEncoder();
|
|
114
|
+
return enc.encode(data);
|
|
115
|
+
}
|
|
116
|
+
analyzeTouchLayout(filename, map) {
|
|
117
|
+
this.callbacks.reportMessage(AnalyzerMessages.Info_ScanningFile({ type: 'touch layout', name: filename }));
|
|
118
|
+
const reader = new TouchLayoutFileReader();
|
|
119
|
+
const source = reader.read(this.callbacks.loadFile(filename));
|
|
120
|
+
let dirty = Osk.remapTouchLayout(source, map);
|
|
121
|
+
if (!dirty) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const writer = new TouchLayoutFileWriter({ formatted: true });
|
|
125
|
+
const data = writer.write(source);
|
|
126
|
+
return data;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/osk-rewrite-pua/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/osk-rewrite-pua/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,eAAe,EAAY,cAAc,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrK,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAGX;IAFZ,KAAK,GAAiC,EAAE,CAAC;IAEjD,YAAoB,SAA4B;QAA5B,cAAS,GAAT,SAAS,CAAmB;IAChD,CAAC;IAED;;;OAGG;IACI,KAAK;QACV,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,EAAE;IACF,wBAAwB;IACxB,EAAE;IAEF;;;;;;;;;;OAUG;IACI,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,OAA2B;QAC5D,IAAI,GAAG,GAAe,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAEhD,QAAO,eAAe,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;YACpD;gBACE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBACzD,MAAM;YACR;gBACE,IAAI,CAAC,KAAK,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,6DAA6D;QAC7D,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAIO,kBAAkB,CAAC,QAAgB,EAAE,GAAe;QAC1D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAAC,IAAI,EAAC,cAAc,EAAE,IAAI,EAAC,QAAQ,EAAC,CAAC,CAAC,CAAC;QACvG,MAAM,MAAM,GAAG,IAAI,qBAAqB,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE9D,IAAI,KAAK,GAAG,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAE9C,IAAG,CAAC,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
-
export declare function getOskFromKmnFile(callbacks: CompilerCallbacks, filename: string): Promise<{
|
|
3
|
-
kvksFilename?: string;
|
|
4
|
-
touchLayoutFilename?: string;
|
|
5
|
-
}>;
|
|
1
|
+
import { CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
+
export declare function getOskFromKmnFile(callbacks: CompilerCallbacks, filename: string): Promise<{
|
|
3
|
+
kvksFilename?: string;
|
|
4
|
+
touchLayoutFilename?: string;
|
|
5
|
+
}>;
|
|
6
6
|
//# sourceMappingURL=get-osk-from-kmn-file.d.ts.map
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=get-osk-from-kmn-file.js.map
|
|
33
|
-
//# debugId=a10b6c66-188f-52d4-9055-0f3fbda8317c
|
|
1
|
+
import { KMX, KmxFileReader } from "@keymanapp/common-types";
|
|
2
|
+
import { KmnCompiler } from "@keymanapp/kmc-kmn";
|
|
3
|
+
export async function getOskFromKmnFile(callbacks, filename) {
|
|
4
|
+
let kvksFilename;
|
|
5
|
+
let touchLayoutFilename;
|
|
6
|
+
const kmnCompiler = new KmnCompiler();
|
|
7
|
+
if (!await kmnCompiler.init(callbacks, {
|
|
8
|
+
shouldAddCompilerVersion: false,
|
|
9
|
+
saveDebug: false,
|
|
10
|
+
})) {
|
|
11
|
+
// kmnCompiler will report errors
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
let result = await kmnCompiler.run(filename, null);
|
|
15
|
+
if (!result) {
|
|
16
|
+
// kmnCompiler will report any errors
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (result.extra.kvksFilename) {
|
|
20
|
+
kvksFilename = callbacks.resolveFilename(filename, result.extra.kvksFilename);
|
|
21
|
+
}
|
|
22
|
+
const reader = new KmxFileReader();
|
|
23
|
+
const keyboard = reader.read(result.artifacts.kmx.data);
|
|
24
|
+
const touchLayoutStore = keyboard.stores.find(store => store.dwSystemID == KMX.KMXFile.TSS_LAYOUTFILE);
|
|
25
|
+
if (touchLayoutStore) {
|
|
26
|
+
touchLayoutFilename = callbacks.resolveFilename(filename, touchLayoutStore.dpString);
|
|
27
|
+
}
|
|
28
|
+
return { kvksFilename, touchLayoutFilename };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=get-osk-from-kmn-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-osk-from-kmn-file.js","sources":["../../../src/util/get-osk-from-kmn-file.ts"],"
|
|
1
|
+
{"version":3,"file":"get-osk-from-kmn-file.js","sourceRoot":"","sources":["../../../src/util/get-osk-from-kmn-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,GAAG,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,SAA4B,EAAE,QAAgB;IAIpF,IAAI,YAAoB,CAAC;IACzB,IAAI,mBAA2B,CAAC;IAEhC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IACtC,IAAG,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE;QACpC,wBAAwB,EAAE,KAAK;QAC/B,SAAS,EAAE,KAAK;KACjB,CAAC,EAAE,CAAC;QACH,iCAAiC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAEnD,IAAG,CAAC,MAAM,EAAE,CAAC;QACX,qCAAqC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAG,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;QAC7B,YAAY,GAAG,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAChF,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAiB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtE,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,IAAI,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvG,IAAG,gBAAgB,EAAE,CAAC;QACpB,mBAAmB,GAAG,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACvF,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAA;AAC9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"build/src/"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@keymanapp/common-types": "18.0.
|
|
27
|
-
"@keymanapp/developer-utils": "18.0.
|
|
28
|
-
"@keymanapp/kmc-kmn": "18.0.
|
|
26
|
+
"@keymanapp/common-types": "18.0.46-alpha",
|
|
27
|
+
"@keymanapp/developer-utils": "18.0.46-alpha",
|
|
28
|
+
"@keymanapp/kmc-kmn": "18.0.46-alpha"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@keymanapp/resources-gosh": "18.0.
|
|
31
|
+
"@keymanapp/resources-gosh": "18.0.46-alpha",
|
|
32
32
|
"@types/mocha": "^5.2.7",
|
|
33
33
|
"@types/node": "^20.4.1",
|
|
34
34
|
"c8": "^7.12.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"type": "git",
|
|
42
42
|
"url": "git+https://github.com/keymanapp/keyman.git"
|
|
43
43
|
},
|
|
44
|
-
"version": "18.0.
|
|
44
|
+
"version": "18.0.46-alpha"
|
|
45
45
|
}
|