@keymanapp/kmc-analyze 17.0.276-beta → 17.0.278-beta
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 +11 -0
- package/build/src/index.d.ts +3 -2
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +4 -3
- package/build/src/index.js.map +1 -1
- package/build/src/messages.d.ts +16 -2
- package/build/src/messages.d.ts.map +1 -1
- package/build/src/messages.js +16 -2
- package/build/src/messages.js.map +1 -1
- package/build/src/osk-character-use/index.d.ts +61 -0
- package/build/src/osk-character-use/index.d.ts.map +1 -1
- package/build/src/osk-character-use/index.js +48 -2
- package/build/src/osk-character-use/index.js.map +1 -1
- package/build/src/osk-rewrite-pua/index.d.ts +27 -1
- package/build/src/osk-rewrite-pua/index.d.ts.map +1 -1
- package/build/src/osk-rewrite-pua/index.js +29 -3
- package/build/src/osk-rewrite-pua/index.js.map +1 -1
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Keyman Developer - kmc-analyze
|
|
2
|
+
|
|
3
|
+
This package provides Keyman keyboard analysis tools. It can be used from the
|
|
4
|
+
command line with [@keymanapp/kmc](https://npmjs.com/package/@keymanapp/kmc).
|
|
5
|
+
|
|
6
|
+
Currently, the primary function of this package is to work with Keyman's
|
|
7
|
+
[`&displayMap` store](https://help.keyman.com/developer/language/reference/displaymap) for
|
|
8
|
+
rewriting the On Screen Keyboard with PUA characters, for consistent display of
|
|
9
|
+
diacritics and combining marks across all platforms.
|
|
10
|
+
|
|
11
|
+
* [API Reference](https://help.keyman.com/developer/current-version/reference/api/kmc-analyze)
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* kmc-analyze - keyboard analysis classes, including tools for `&displayMap`.
|
|
3
4
|
*/
|
|
4
|
-
export { AnalyzeOskCharacterUse } from './osk-character-use/index.js';
|
|
5
|
+
export { AnalyzeOskCharacterUse, AnalyzeOskCharacterUseOptions } from './osk-character-use/index.js';
|
|
5
6
|
export { AnalyzeOskRewritePua } from './osk-rewrite-pua/index.js';
|
|
6
7
|
export { AnalyzerMessages } from './messages.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/build/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
package/build/src/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4c9393bf-f417-5abb-8feb-4d080e0b6401")}catch(e){}}();
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
* kmc-analyze - keyboard analysis classes, including tools for `&displayMap`.
|
|
4
5
|
*/
|
|
5
6
|
export { AnalyzeOskCharacterUse } from './osk-character-use/index.js';
|
|
6
7
|
export { AnalyzeOskRewritePua } from './osk-rewrite-pua/index.js';
|
|
7
8
|
export { AnalyzerMessages } from './messages.js';
|
|
8
|
-
//# debugId=
|
|
9
|
+
//# debugId=4c9393bf-f417-5abb-8feb-4d080e0b6401
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"debug_id":"
|
|
1
|
+
{"debug_id":"4c9393bf-f417-5abb-8feb-4d080e0b6401","file":"index.js","mappings":";AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAiC,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC","names":[],"sourceRoot":"","sources":["../../src/index.ts"],"version":3}
|
package/build/src/messages.d.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
* Compiler messages for `kmc analyze`
|
|
4
|
+
*/
|
|
1
5
|
export declare class AnalyzerMessages {
|
|
6
|
+
/** @internal */
|
|
2
7
|
static Fatal_UnexpectedException: (o: {
|
|
3
8
|
e: any;
|
|
4
9
|
}) => import("@keymanapp/common-types").CompilerEvent;
|
|
5
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Raised when the compiler experiences an internal error. These should be
|
|
12
|
+
* reported to the Keyman team for resolution via
|
|
13
|
+
* https://github.com/keymanapp/keyman/issues/new
|
|
14
|
+
*/
|
|
15
|
+
static readonly FATAL_UnexpectedException: number;
|
|
16
|
+
/** @internal */
|
|
6
17
|
static Info_ScanningFile: (o: {
|
|
7
18
|
type: string;
|
|
8
19
|
name: string;
|
|
9
20
|
}) => import("@keymanapp/common-types").CompilerEvent;
|
|
10
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Informative message reporting on the current file being scanned
|
|
23
|
+
*/
|
|
24
|
+
static readonly INFO_ScanningFile: number;
|
|
11
25
|
}
|
|
12
26
|
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AASA,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,yBAAyB,MAAM;QAAC,CAAC,EAAE,GAAG,CAAA;KAAC,qDAAqE;IACnH,MAAM,CAAC,yBAAyB,SAAqB;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,gBAAgB;IAChB,MAAM,CAAC,yBAAyB,MAAM;QAAC,CAAC,EAAE,GAAG,CAAA;KAAC,qDAAqE;IACnH;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,yBAAyB,SAAqB;IAE9D,gBAAgB;IAChB,MAAM,CAAC,iBAAiB,MAAM;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,MAAM,CAAA;KAAC,qDACnB;IACvC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAAoB;CACtD"}
|
package/build/src/messages.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d2a28798-52d0-53e1-bf68-0cfc415f770d")}catch(e){}}();
|
|
2
2
|
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m } from "@keymanapp/common-types";
|
|
3
3
|
const Namespace = CompilerErrorNamespace.Analyzer;
|
|
4
4
|
const SevInfo = CompilerErrorSeverity.Info | Namespace;
|
|
@@ -6,12 +6,26 @@ const SevInfo = CompilerErrorSeverity.Info | Namespace;
|
|
|
6
6
|
// const SevWarn = CompilerErrorSeverity.Warn | Namespace;
|
|
7
7
|
// const SevError = CompilerErrorSeverity.Error | Namespace;
|
|
8
8
|
const SevFatal = CompilerErrorSeverity.Fatal | Namespace;
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
* Compiler messages for `kmc analyze`
|
|
12
|
+
*/
|
|
9
13
|
export class AnalyzerMessages {
|
|
14
|
+
/** @internal */
|
|
10
15
|
static Fatal_UnexpectedException = (o) => m(this.FATAL_UnexpectedException, null, o.e ?? 'unknown error');
|
|
16
|
+
/**
|
|
17
|
+
* Raised when the compiler experiences an internal error. These should be
|
|
18
|
+
* reported to the Keyman team for resolution via
|
|
19
|
+
* https://github.com/keymanapp/keyman/issues/new
|
|
20
|
+
*/
|
|
11
21
|
static FATAL_UnexpectedException = SevFatal | 0x0001;
|
|
22
|
+
/** @internal */
|
|
12
23
|
static Info_ScanningFile = (o) => m(this.INFO_ScanningFile, `Scanning ${o.type} file ${o.name}`);
|
|
24
|
+
/**
|
|
25
|
+
* Informative message reporting on the current file being scanned
|
|
26
|
+
*/
|
|
13
27
|
static INFO_ScanningFile = SevInfo | 0x0002;
|
|
14
28
|
}
|
|
15
29
|
;
|
|
16
|
-
//# debugId=
|
|
30
|
+
//# debugId=d2a28798-52d0-53e1-bf68-0cfc415f770d
|
|
17
31
|
//# sourceMappingURL=messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"debug_id":"
|
|
1
|
+
{"debug_id":"d2a28798-52d0-53e1-bf68-0cfc415f770d","file":"messages.js","mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,mBAAmB,IAAI,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAElH,MAAM,SAAS,GAAG,sBAAsB,CAAC,QAAQ,CAAC;AAClD,MAAM,OAAO,GAAG,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC;AACvD,0DAA0D;AAC1D,0DAA0D;AAC1D,4DAA4D;AAC5D,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,GAAG,SAAS,CAAC;AAEzD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAC3B,gBAAgB;IAChB,MAAM,CAAC,yBAAyB,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC;IACnH;;;;OAIG;IACH,MAAM,CAAU,yBAAyB,GAAG,QAAQ,GAAG,MAAM,CAAC;IAE9D,gBAAgB;IAChB,MAAM,CAAC,iBAAiB,GAAG,CAAC,CAA8B,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EACrF,YAAY,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC;;OAEG;IACH,MAAM,CAAU,iBAAiB,GAAG,OAAO,GAAG,MAAM,CAAC;;AACtD,CAAC","names":[],"sourceRoot":"","sources":["../../src/messages.ts"],"version":3}
|
|
@@ -1,15 +1,52 @@
|
|
|
1
1
|
import { CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
* Options for character analysis
|
|
5
|
+
*/
|
|
2
6
|
export interface AnalyzeOskCharacterUseOptions {
|
|
7
|
+
/**
|
|
8
|
+
* First character to use in PUA for remapping with &displayMap, defaults to
|
|
9
|
+
* U+F100
|
|
10
|
+
*/
|
|
3
11
|
puaBase?: number;
|
|
12
|
+
/**
|
|
13
|
+
* If true, strips U+25CC from the key cap before further analysis
|
|
14
|
+
*/
|
|
4
15
|
stripDottedCircle?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* If true, reports number of references to each character found in each
|
|
18
|
+
* source file
|
|
19
|
+
*/
|
|
5
20
|
includeCounts?: boolean;
|
|
6
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
* Analyze the characters used in On Screen Keyboard files (.kvks,
|
|
25
|
+
* .keyman-touch-layout) for use with `&displayMap`.
|
|
26
|
+
*/
|
|
7
27
|
export declare class AnalyzeOskCharacterUse {
|
|
8
28
|
private callbacks;
|
|
9
29
|
private _strings;
|
|
10
30
|
private options;
|
|
11
31
|
constructor(callbacks: CompilerCallbacks, options?: AnalyzeOskCharacterUseOptions);
|
|
32
|
+
/**
|
|
33
|
+
* Clears analysis data collected from previous calls to
|
|
34
|
+
* {@link AnalyzeOskCharacterUse.analyze}
|
|
35
|
+
*/
|
|
12
36
|
clear(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Analyzes a single source file for Unicode character usage. Can parse .kmn,
|
|
39
|
+
* .kvks, .keyman-touch-layout file formats. Can be called multiple times to
|
|
40
|
+
* collect results from more than one file. Use
|
|
41
|
+
* {@link AnalyzeOskCharacterUse.getStrings} to retrieve results.
|
|
42
|
+
*
|
|
43
|
+
* Note: `analyze()` collects key cap data, so calling this for a .kmn file
|
|
44
|
+
* will retrieve the key caps from the .kvks and .keyman-touch-layout files
|
|
45
|
+
* that it references, rather than key cap data from the .kmn file itself.
|
|
46
|
+
*
|
|
47
|
+
* @param file - relative or absolute path to a Keyman source file
|
|
48
|
+
* @returns true if the file is successfully loaded and parsed
|
|
49
|
+
*/
|
|
13
50
|
analyze(file: string): Promise<boolean>;
|
|
14
51
|
private analyzeKmnKeyboard;
|
|
15
52
|
private addStrings;
|
|
@@ -17,6 +54,30 @@ export declare class AnalyzeOskCharacterUse {
|
|
|
17
54
|
private scanVisualKeyboard;
|
|
18
55
|
private scanTouchLayout;
|
|
19
56
|
private prepareResults;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the collected results from earlier calls to
|
|
59
|
+
* {@link AnalyzeOskCharacterUse.analyze}. This generates a mapping from a key
|
|
60
|
+
* cap (one or more characters) to a PUA code, for use with `&displayMap`.
|
|
61
|
+
*
|
|
62
|
+
* Three output formats are supported:
|
|
63
|
+
*
|
|
64
|
+
* - .txt: tab-separated string format, with three columns: PUA, Key Cap, and
|
|
65
|
+
* plain string. The PUA and Key Cap columns are formatted as Unicode Scalar
|
|
66
|
+
* Values, e.g. U+0061, and the plain string is the original key cap string.
|
|
67
|
+
*
|
|
68
|
+
* - .md: formatted for documentation purposes. Generates a Markdown table
|
|
69
|
+
* (GFM) with PUA, Key Cap, and plain string. The PUA and Key Cap columns
|
|
70
|
+
* are formatted as Unicode Scalar Values, e.g. U+0061, and the plain string
|
|
71
|
+
* is the original key cap string.
|
|
72
|
+
*
|
|
73
|
+
* - .json: returns the final aggregated data as an array of strings, which
|
|
74
|
+
* can be joined to form a JSON blob of an object with a single member,
|
|
75
|
+
* `map`, which is an array of {@link Osk.StringResult} objects.
|
|
76
|
+
*
|
|
77
|
+
* @param format - file format to return - can be '.txt', '.md', or '.json'
|
|
78
|
+
* @returns an array of strings, formatted according to the `format`
|
|
79
|
+
* parameter.
|
|
80
|
+
*/
|
|
20
81
|
getStrings(format?: '.txt' | '.md' | '.json'): string[];
|
|
21
82
|
private static getStringsAsText;
|
|
22
83
|
private static getStringsAsMarkdown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/osk-character-use/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/osk-character-use/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiF,MAAM,yBAAyB,CAAC;AAS3I;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAQD;;;;GAIG;AACH,qBAAa,sBAAsB;IAIrB,OAAO,CAAC,SAAS;IAH7B,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,OAAO,CAAgC;gBAE3B,SAAS,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,6BAA6B;IAIzF;;;OAGG;IACI,KAAK;IAQZ;;;;;;;;;;;;OAYG;IACU,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;YAwCtC,kBAAkB;IAuBhC,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,eAAe;IAiDvB,OAAO,CAAC,cAAc;IAetB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACI,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAC,KAAK,GAAC,OAAO,GAAG,MAAM,EAAE;IAc1D,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAU/B,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAYnC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAM/B,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAcjC,OAAO,CAAC,MAAM,CAAC,uBAAuB;CAUvC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="079ac534-3e48-5509-aa70-becc5eff4b5a")}catch(e){}}();
|
|
2
2
|
import { KeymanFileTypes, KvksFileReader, TouchLayoutFileReader } from "@keymanapp/common-types";
|
|
3
3
|
import { CompilerMessages } from '@keymanapp/kmc-kmn';
|
|
4
4
|
import { getOskFromKmnFile } from "../util/get-osk-from-kmn-file.js";
|
|
@@ -8,6 +8,11 @@ const defaultOptions = {
|
|
|
8
8
|
stripDottedCircle: false,
|
|
9
9
|
includeCounts: false,
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
* Analyze the characters used in On Screen Keyboard files (.kvks,
|
|
14
|
+
* .keyman-touch-layout) for use with `&displayMap`.
|
|
15
|
+
*/
|
|
11
16
|
export class AnalyzeOskCharacterUse {
|
|
12
17
|
callbacks;
|
|
13
18
|
_strings = {};
|
|
@@ -16,12 +21,29 @@ export class AnalyzeOskCharacterUse {
|
|
|
16
21
|
this.callbacks = callbacks;
|
|
17
22
|
this.options = { ...defaultOptions, ...options };
|
|
18
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Clears analysis data collected from previous calls to
|
|
26
|
+
* {@link AnalyzeOskCharacterUse.analyze}
|
|
27
|
+
*/
|
|
19
28
|
clear() {
|
|
20
29
|
this._strings = {};
|
|
21
30
|
}
|
|
22
31
|
//
|
|
23
32
|
// Analyze a single file
|
|
24
33
|
//
|
|
34
|
+
/**
|
|
35
|
+
* Analyzes a single source file for Unicode character usage. Can parse .kmn,
|
|
36
|
+
* .kvks, .keyman-touch-layout file formats. Can be called multiple times to
|
|
37
|
+
* collect results from more than one file. Use
|
|
38
|
+
* {@link AnalyzeOskCharacterUse.getStrings} to retrieve results.
|
|
39
|
+
*
|
|
40
|
+
* Note: `analyze()` collects key cap data, so calling this for a .kmn file
|
|
41
|
+
* will retrieve the key caps from the .kvks and .keyman-touch-layout files
|
|
42
|
+
* that it references, rather than key cap data from the .kmn file itself.
|
|
43
|
+
*
|
|
44
|
+
* @param file - relative or absolute path to a Keyman source file
|
|
45
|
+
* @returns true if the file is successfully loaded and parsed
|
|
46
|
+
*/
|
|
25
47
|
async analyze(file) {
|
|
26
48
|
switch (KeymanFileTypes.sourceTypeFromFilename(file)) {
|
|
27
49
|
case ".kvks" /* KeymanFileTypes.Source.VisualKeyboard */: {
|
|
@@ -184,6 +206,30 @@ export class AnalyzeOskCharacterUse {
|
|
|
184
206
|
}
|
|
185
207
|
return result;
|
|
186
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* Returns the collected results from earlier calls to
|
|
211
|
+
* {@link AnalyzeOskCharacterUse.analyze}. This generates a mapping from a key
|
|
212
|
+
* cap (one or more characters) to a PUA code, for use with `&displayMap`.
|
|
213
|
+
*
|
|
214
|
+
* Three output formats are supported:
|
|
215
|
+
*
|
|
216
|
+
* - .txt: tab-separated string format, with three columns: PUA, Key Cap, and
|
|
217
|
+
* plain string. The PUA and Key Cap columns are formatted as Unicode Scalar
|
|
218
|
+
* Values, e.g. U+0061, and the plain string is the original key cap string.
|
|
219
|
+
*
|
|
220
|
+
* - .md: formatted for documentation purposes. Generates a Markdown table
|
|
221
|
+
* (GFM) with PUA, Key Cap, and plain string. The PUA and Key Cap columns
|
|
222
|
+
* are formatted as Unicode Scalar Values, e.g. U+0061, and the plain string
|
|
223
|
+
* is the original key cap string.
|
|
224
|
+
*
|
|
225
|
+
* - .json: returns the final aggregated data as an array of strings, which
|
|
226
|
+
* can be joined to form a JSON blob of an object with a single member,
|
|
227
|
+
* `map`, which is an array of {@link Osk.StringResult} objects.
|
|
228
|
+
*
|
|
229
|
+
* @param format - file format to return - can be '.txt', '.md', or '.json'
|
|
230
|
+
* @returns an array of strings, formatted according to the `format`
|
|
231
|
+
* parameter.
|
|
232
|
+
*/
|
|
187
233
|
getStrings(format) {
|
|
188
234
|
const final = this.prepareResults(this._strings);
|
|
189
235
|
switch (format) {
|
|
@@ -245,5 +291,5 @@ export class AnalyzeOskCharacterUse {
|
|
|
245
291
|
return result.join(' ');
|
|
246
292
|
}
|
|
247
293
|
}
|
|
248
|
-
//# debugId=
|
|
294
|
+
//# debugId=079ac534-3e48-5509-aa70-becc5eff4b5a
|
|
249
295
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"debug_id":"
|
|
1
|
+
{"debug_id":"079ac534-3e48-5509-aa70-becc5eff4b5a","file":"index.js","mappings":";A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Callbacks } from "@keymanapp/common-types";
|
|
2
|
+
import { Osk } from '@keymanapp/developer-utils';
|
|
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
|
+
*/
|
|
2
9
|
export declare class AnalyzeOskRewritePua {
|
|
3
10
|
private callbacks;
|
|
4
11
|
private _data;
|
|
5
12
|
constructor(callbacks: CompilerCallbacks);
|
|
13
|
+
/**
|
|
14
|
+
* Clears data collected from previous calls to
|
|
15
|
+
* {@link AnalyzeOskRewritePua.analyze}
|
|
16
|
+
*/
|
|
6
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
|
+
*/
|
|
7
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
|
+
*/
|
|
8
34
|
get data(): {
|
|
9
35
|
[index: string]: Uint8Array;
|
|
10
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/osk-rewrite-pua/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/osk-rewrite-pua/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA2G,MAAM,yBAAyB,CAAC;AACrK,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAKjD;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGnB,OAAO,CAAC,SAAS;IAF7B,OAAO,CAAC,KAAK,CAAoC;gBAE7B,SAAS,EAAE,iBAAiB;IAGhD;;;OAGG;IACI,KAAK;IAQZ;;;;;;;;;;OAUG;IACU,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAgCjF;;;OAGG;IACH,IAAW,IAAI;;MAEd;YAEa,kBAAkB;IAqBhC,OAAO,CAAC,qBAAqB;IA6B7B,OAAO,CAAC,kBAAkB;CAe3B"}
|
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
-
import { KeymanFileTypes, KvksFileReader, KvksFileWriter,
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7d1eb705-f9fa-5bdd-b1a8-1d8c6b425ca0")}catch(e){}}();
|
|
2
|
+
import { KeymanFileTypes, KvksFileReader, KvksFileWriter, TouchLayoutFileReader, TouchLayoutFileWriter } from "@keymanapp/common-types";
|
|
3
|
+
import { Osk } from '@keymanapp/developer-utils';
|
|
3
4
|
import { CompilerMessages } from '@keymanapp/kmc-kmn';
|
|
4
5
|
import { getOskFromKmnFile } from "../util/get-osk-from-kmn-file.js";
|
|
5
6
|
import { AnalyzerMessages } from "../messages.js";
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
* Rewrite On Screen Keyboard files (.kvks, .keyman-touch-layout) with PUA
|
|
10
|
+
* codepoints, based on analysis provided by {@link AnalyzeOskCharacterUse}
|
|
11
|
+
* class.
|
|
12
|
+
*/
|
|
6
13
|
export class AnalyzeOskRewritePua {
|
|
7
14
|
callbacks;
|
|
8
15
|
_data = {};
|
|
9
16
|
constructor(callbacks) {
|
|
10
17
|
this.callbacks = callbacks;
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Clears data collected from previous calls to
|
|
21
|
+
* {@link AnalyzeOskRewritePua.analyze}
|
|
22
|
+
*/
|
|
12
23
|
clear() {
|
|
13
24
|
this._data = {};
|
|
14
25
|
}
|
|
15
26
|
//
|
|
16
27
|
// Analyze a single file
|
|
17
28
|
//
|
|
29
|
+
/**
|
|
30
|
+
* Analyze a keyboard file or files, and provide a remapped output. Accepts a
|
|
31
|
+
* .kmn, .kvks, .keyman-touch-layout file formats. For .kmn, will rewrite
|
|
32
|
+
* associated On Screen Keyboard file formats. Can be called multiple times to
|
|
33
|
+
* rewrite multiple files. Use the {@link AnalyzeOskRewritePua.data} property
|
|
34
|
+
* to retrieve the output file content for writing. This does not modify the
|
|
35
|
+
* source file.
|
|
36
|
+
* @param file - relative or absolute path to a Keyman source file
|
|
37
|
+
* @param mapping - OSK keycap map provided by {@link AnalyzeOskCharacterUse}
|
|
38
|
+
* @returns true if the file is successfully loaded and rewritten
|
|
39
|
+
*/
|
|
18
40
|
async analyze(file, mapping) {
|
|
19
41
|
let map = Osk.parseMapping(mapping);
|
|
20
42
|
switch (KeymanFileTypes.sourceTypeFromFilename(file)) {
|
|
@@ -45,6 +67,10 @@ export class AnalyzeOskRewritePua {
|
|
|
45
67
|
}
|
|
46
68
|
return true;
|
|
47
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns the file data for OSK files rewritten with PUA characters, for use
|
|
72
|
+
* with `&displayMap`.
|
|
73
|
+
*/
|
|
48
74
|
get data() {
|
|
49
75
|
return this._data;
|
|
50
76
|
}
|
|
@@ -102,5 +128,5 @@ export class AnalyzeOskRewritePua {
|
|
|
102
128
|
return data;
|
|
103
129
|
}
|
|
104
130
|
}
|
|
105
|
-
//# debugId=
|
|
131
|
+
//# debugId=7d1eb705-f9fa-5bdd-b1a8-1d8c6b425ca0
|
|
106
132
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"debug_id":"
|
|
1
|
+
{"debug_id":"7d1eb705-f9fa-5bdd-b1a8-1d8c6b425ca0","file":"index.js","mappings":";AAAA,OAAO,EAAqB,eAAe,EAAY,cAAc,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrK,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,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;YACnD;gBACE,IAAI,CAAC,KAAK,CAAC,IAAI,C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CAAC,CAAC;QAC9B,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;YACT,OAAO,IAAI,CAAC;SACb;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","names":[],"sourceRoot":"","sources":["../../../src/osk-rewrite-pua/index.ts"],"version":3}
|
package/package.json
CHANGED
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
"build/src/"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@keymanapp/common-types": "17.0.
|
|
27
|
-
"@keymanapp/
|
|
26
|
+
"@keymanapp/common-types": "17.0.278-beta",
|
|
27
|
+
"@keymanapp/developer-utils": "17.0.278-beta",
|
|
28
|
+
"@keymanapp/kmc-kmn": "17.0.278-beta"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@keymanapp/resources-gosh": "17.0.
|
|
31
|
+
"@keymanapp/resources-gosh": "17.0.278-beta",
|
|
31
32
|
"@types/chai": "^4.1.7",
|
|
32
33
|
"@types/mocha": "^5.2.7",
|
|
33
34
|
"@types/node": "^20.4.1",
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
"type": "git",
|
|
43
44
|
"url": "git+https://github.com/keymanapp/keyman.git"
|
|
44
45
|
},
|
|
45
|
-
"version": "17.0.
|
|
46
|
+
"version": "17.0.278-beta"
|
|
46
47
|
}
|