@keymanapp/kmc-ldml 18.0.40-alpha → 18.0.45-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.
Files changed (58) hide show
  1. package/build/src/compiler/compiler.d.ts +123 -123
  2. package/build/src/compiler/compiler.js +307 -310
  3. package/build/src/compiler/compiler.js.map +1 -1
  4. package/build/src/compiler/disp.d.ts +11 -11
  5. package/build/src/compiler/disp.js +82 -85
  6. package/build/src/compiler/disp.js.map +1 -1
  7. package/build/src/compiler/empty-compiler.d.ts +37 -37
  8. package/build/src/compiler/empty-compiler.js +114 -117
  9. package/build/src/compiler/empty-compiler.js.map +1 -1
  10. package/build/src/compiler/keymanweb-compiler.d.ts +13 -13
  11. package/build/src/compiler/keymanweb-compiler.js +95 -98
  12. package/build/src/compiler/keymanweb-compiler.js.map +1 -1
  13. package/build/src/compiler/keys.d.ts +53 -53
  14. package/build/src/compiler/keys.js +417 -420
  15. package/build/src/compiler/keys.js.map +1 -1
  16. package/build/src/compiler/layr.d.ts +9 -9
  17. package/build/src/compiler/layr.js +81 -84
  18. package/build/src/compiler/layr.js.map +1 -1
  19. package/build/src/compiler/ldml-compiler-options.d.ts +11 -11
  20. package/build/src/compiler/ldml-compiler-options.js +3 -6
  21. package/build/src/compiler/ldml-compiler-options.js.map +1 -1
  22. package/build/src/compiler/loca.d.ts +15 -15
  23. package/build/src/compiler/loca.js +59 -62
  24. package/build/src/compiler/loca.js.map +1 -1
  25. package/build/src/compiler/messages.d.ts +186 -186
  26. package/build/src/compiler/messages.js +122 -125
  27. package/build/src/compiler/messages.js.map +1 -1
  28. package/build/src/compiler/meta.d.ts +13 -13
  29. package/build/src/compiler/meta.js +55 -58
  30. package/build/src/compiler/meta.js.map +1 -1
  31. package/build/src/compiler/metadata-compiler.d.ts +12 -12
  32. package/build/src/compiler/metadata-compiler.js +47 -50
  33. package/build/src/compiler/metadata-compiler.js.map +1 -1
  34. package/build/src/compiler/section-compiler.d.ts +35 -35
  35. package/build/src/compiler/section-compiler.js +40 -43
  36. package/build/src/compiler/section-compiler.js.map +1 -1
  37. package/build/src/compiler/substitution-tracker.d.ts +47 -47
  38. package/build/src/compiler/substitution-tracker.js +103 -106
  39. package/build/src/compiler/substitution-tracker.js.map +1 -1
  40. package/build/src/compiler/touch-layout-compiler.d.ts +7 -7
  41. package/build/src/compiler/touch-layout-compiler.js +91 -94
  42. package/build/src/compiler/touch-layout-compiler.js.map +1 -1
  43. package/build/src/compiler/tran.d.ts +57 -57
  44. package/build/src/compiler/tran.js +388 -391
  45. package/build/src/compiler/tran.js.map +1 -1
  46. package/build/src/compiler/vars.d.ts +21 -21
  47. package/build/src/compiler/vars.js +234 -237
  48. package/build/src/compiler/vars.js.map +1 -1
  49. package/build/src/compiler/visual-keyboard-compiler.d.ts +8 -8
  50. package/build/src/compiler/visual-keyboard-compiler.js +68 -71
  51. package/build/src/compiler/visual-keyboard-compiler.js.map +1 -1
  52. package/build/src/main.d.ts +3 -3
  53. package/build/src/main.js +3 -6
  54. package/build/src/main.js.map +1 -1
  55. package/build/src/util/util.d.ts +49 -49
  56. package/build/src/util/util.js +183 -186
  57. package/build/src/util/util.js.map +1 -1
  58. package/package.json +6 -6
@@ -1,94 +1,91 @@
1
-
2
- !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]="69297fc7-3014-5509-98ca-7d49188be130")}catch(e){}}();
3
- export class TouchLayoutCompiler {
4
- compileToJavascript(source) {
5
- let result = {};
6
- // start with desktop to mimic vk emit
7
- result.desktop = {
8
- defaultHint: "none",
9
- layer: []
10
- };
11
- for (let layers of source.keyboard3.layers) {
12
- for (let layer of layers.layer) {
13
- const resultLayer = this.compileHardwareLayer(source, result, layer);
14
- result.desktop.layer.push(resultLayer);
15
- }
16
- }
17
- return result;
18
- }
19
- compileHardwareLayer(source, file, layer) {
20
- // TODO-LDML: consider consolidation with keys.ts?
21
- let fileLayer = {
22
- id: this.translateLayerIdToTouchLayoutLayerId(layer.id, layer.modifiers),
23
- row: []
24
- };
25
- let y = -1;
26
- for (let row of layer.row) {
27
- y++;
28
- let fileRow = { id: y, key: [] };
29
- fileLayer.row.push(fileRow);
30
- const keys = row.keys.split(' ');
31
- for (let key of keys) {
32
- const keydef = source.keyboard3.keys?.key?.find(x => x.id == key);
33
- if (keydef) {
34
- const fileKey = {
35
- id: this.translateKeyIdentifierToTouch(keydef.id),
36
- text: keydef.output || '',
37
- // TODO-LDML: additional properties
38
- };
39
- fileRow.key.push(fileKey);
40
- }
41
- else {
42
- // TODO-LDML: consider logging missing keys
43
- }
44
- }
45
- }
46
- return fileLayer;
47
- }
48
- translateLayerIdToTouchLayoutLayerId(id, modifier) {
49
- // Touch layout layers have a set of reserved names that correspond to
50
- // hardware modifiers. We want to map these identifiers first before falling
51
- // back to the layer ids
52
- // The set of recognized layer identifiers is:
53
- //
54
- // touch | LDML
55
- // ---------------+-------------
56
- // default | none
57
- // shift | shift
58
- // caps | caps
59
- // rightalt | altR
60
- // rightalt-shift | altR shift
61
- //
62
- const map = {
63
- none: 'default',
64
- shift: 'shift',
65
- caps: 'caps',
66
- altR: 'rightalt',
67
- "altR shift": 'rightalt-shift'
68
- };
69
- // canonicalize modifier string, alphabetical
70
- // TODO-LDML: need to support multiple here
71
- if (modifier && modifier.indexOf(',') !== -1) {
72
- throw Error(`Internal error: TODO-LDML: multiple modifiers ${modifier} not yet supported.`);
73
- }
74
- modifier = (modifier || '').split(/\b/).sort().join(' ').trim();
75
- if (Object.hasOwn(map, modifier)) {
76
- return map[modifier];
77
- }
78
- // TODO-LDML: Other layer names will be used unmodified, is this sufficient?
79
- return id;
80
- }
81
- translateKeyIdentifierToTouch(id) {
82
- // Note: keys identifiers in kmx were traditionally case-insensitive, but we
83
- // are going to use them as case-insensitive for LDML keyboards. The set of
84
- // standard key identifiers a-z, A-Z, 0-9 will be used, where possible, and
85
- // all other keys will be mapped to `T_key`.
86
- if (id.match(/^[0-9a-zA-Z]$/)) {
87
- return 'K_' + id;
88
- }
89
- // Not a standard key
90
- return 'T_' + id;
91
- }
92
- }
93
- //# sourceMappingURL=touch-layout-compiler.js.map
94
- //# debugId=69297fc7-3014-5509-98ca-7d49188be130
1
+ export class TouchLayoutCompiler {
2
+ compileToJavascript(source) {
3
+ let result = {};
4
+ // start with desktop to mimic vk emit
5
+ result.desktop = {
6
+ defaultHint: "none", // TODO-LDML this should be optional
7
+ layer: []
8
+ };
9
+ for (let layers of source.keyboard3.layers) {
10
+ for (let layer of layers.layer) {
11
+ const resultLayer = this.compileHardwareLayer(source, result, layer);
12
+ result.desktop.layer.push(resultLayer);
13
+ }
14
+ }
15
+ return result;
16
+ }
17
+ compileHardwareLayer(source, file, layer) {
18
+ // TODO-LDML: consider consolidation with keys.ts?
19
+ let fileLayer = {
20
+ id: this.translateLayerIdToTouchLayoutLayerId(layer.id, layer.modifiers),
21
+ row: []
22
+ };
23
+ let y = -1;
24
+ for (let row of layer.row) {
25
+ y++;
26
+ let fileRow = { id: y, key: [] };
27
+ fileLayer.row.push(fileRow);
28
+ const keys = row.keys.split(' ');
29
+ for (let key of keys) {
30
+ const keydef = source.keyboard3.keys?.key?.find(x => x.id == key);
31
+ if (keydef) {
32
+ const fileKey = {
33
+ id: this.translateKeyIdentifierToTouch(keydef.id),
34
+ text: keydef.output || '',
35
+ // TODO-LDML: additional properties
36
+ };
37
+ fileRow.key.push(fileKey);
38
+ }
39
+ else {
40
+ // TODO-LDML: consider logging missing keys
41
+ }
42
+ }
43
+ }
44
+ return fileLayer;
45
+ }
46
+ translateLayerIdToTouchLayoutLayerId(id, modifier) {
47
+ // Touch layout layers have a set of reserved names that correspond to
48
+ // hardware modifiers. We want to map these identifiers first before falling
49
+ // back to the layer ids
50
+ // The set of recognized layer identifiers is:
51
+ //
52
+ // touch | LDML
53
+ // ---------------+-------------
54
+ // default | none
55
+ // shift | shift
56
+ // caps | caps
57
+ // rightalt | altR
58
+ // rightalt-shift | altR shift
59
+ //
60
+ const map = {
61
+ none: 'default',
62
+ shift: 'shift',
63
+ caps: 'caps',
64
+ altR: 'rightalt',
65
+ "altR shift": 'rightalt-shift'
66
+ };
67
+ // canonicalize modifier string, alphabetical
68
+ // TODO-LDML: need to support multiple here
69
+ if (modifier && modifier.indexOf(',') !== -1) {
70
+ throw Error(`Internal error: TODO-LDML: multiple modifiers ${modifier} not yet supported.`);
71
+ }
72
+ modifier = (modifier || '').split(/\b/).sort().join(' ').trim();
73
+ if (Object.hasOwn(map, modifier)) {
74
+ return map[modifier];
75
+ }
76
+ // TODO-LDML: Other layer names will be used unmodified, is this sufficient?
77
+ return id;
78
+ }
79
+ translateKeyIdentifierToTouch(id) {
80
+ // Note: keys identifiers in kmx were traditionally case-insensitive, but we
81
+ // are going to use them as case-insensitive for LDML keyboards. The set of
82
+ // standard key identifiers a-z, A-Z, 0-9 will be used, where possible, and
83
+ // all other keys will be mapped to `T_key`.
84
+ if (id.match(/^[0-9a-zA-Z]$/)) {
85
+ return 'K_' + id;
86
+ }
87
+ // Not a standard key
88
+ return 'T_' + id;
89
+ }
90
+ }
91
+ //# sourceMappingURL=touch-layout-compiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"touch-layout-compiler.js","sources":["../../../src/compiler/touch-layout-compiler.ts"],"sourceRoot":"","names":[],"mappings":";;AAEA,MAAM,OAAO,mBAAmB;IACvB,mBAAmB,CAAC,MAA8C;QACvE,IAAI,MAAM,GAAgC,EAAE,CAAC;QAE7C,sCAAsC;QACtC,MAAM,CAAC,OAAO,GAAG;YACf,WAAW,EAAE,MAAM;YACnB,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,KAAI,IAAI,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE;YACzC,KAAI,IAAI,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE;gBAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAo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AC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAE9D,IAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC;YAChC,OAAQ,GAAW,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;QAED,4EAA4E;QAC5E,OAAO,EAAE,CAAC;IACZ,CAAC;IAEO,6BAA6B,CAAC,EAAU;QAC9C,4EAA4E;QAC5E,2EAA2E;QAC3E,2EAA2E;QAC3E,4CAA4C;QAE5C,IAAG,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,GAAC,EAAE,CAAC;QACjB,CAAC;QAED,qBAAqB;QACrB,OAAO,IAAI,GAAC,EAAE,CAAC;IACjB,CAAC;CACF"}
@@ -1,58 +1,58 @@
1
- import { SectionIdent } from "@keymanapp/ldml-keyboard-constants";
2
- import { KMXPlus, LDMLKeyboard, CompilerCallbacks } from '@keymanapp/common-types';
3
- import { SectionCompiler } from "./section-compiler.js";
4
- import Bksp = KMXPlus.Bksp;
5
- import DependencySections = KMXPlus.DependencySections;
6
- import Tran = KMXPlus.Tran;
7
- import LDMLKeyboardXMLSourceFile = LDMLKeyboard.LDMLKeyboardXMLSourceFile;
8
- import { Substitutions } from "./substitution-tracker.js";
9
- type TransformCompilerType = 'simple' | 'backspace';
10
- export declare abstract class TransformCompiler<T extends TransformCompilerType, TranBase extends Tran> extends SectionCompiler {
11
- static validateSubstitutions(keyboard: LDMLKeyboard.LKKeyboard, st: Substitutions): boolean;
12
- protected type: T;
13
- constructor(source: LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks);
14
- validate(): boolean;
15
- /** allocate a new TranBase subclass */
16
- protected newTran(): TranBase;
17
- private compileTransforms;
18
- private compileTransformGroup;
19
- private compileTransformTranGroup;
20
- private compileTransform;
21
- /**
22
- * Validate the final regex
23
- * @param cookedFrom the regex to use, missing the trailing '$'
24
- * @param from the original from - for error reporting
25
- * @returns true if OK
26
- */
27
- private isValidRegex;
28
- private compileReorderTranGroup;
29
- private compileReorder;
30
- compile(sections: DependencySections): TranBase;
31
- get dependencies(): Set<SectionIdent>;
32
- /**
33
- * Analyze reorders and regexes for \uXXXX escapes.
34
- * The LDML spec requires \u{XXXX} format.
35
- * @param cookedFrom the original string
36
- * @returns the original string, or null if an error was reported
37
- */
38
- private checkEscapes;
39
- /**
40
- * Analyze character classes such as '[a-z]' for denormalized characters.
41
- * Escapes non-NFD characters as hex escapes.
42
- * @param cookedFrom input regex string
43
- * @returns updated 'from' string
44
- */
45
- private checkRanges;
46
- }
47
- export declare class TranCompiler extends TransformCompiler<'simple', Tran> {
48
- constructor(source: LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks);
49
- protected newTran(): Tran;
50
- get id(): SectionIdent;
51
- }
52
- export declare class BkspCompiler extends TransformCompiler<'backspace', Bksp> {
53
- constructor(source: LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks);
54
- protected newTran(): Bksp;
55
- get id(): SectionIdent;
56
- }
57
- export {};
1
+ import { SectionIdent } from "@keymanapp/ldml-keyboard-constants";
2
+ import { KMXPlus, LDMLKeyboard, CompilerCallbacks } from '@keymanapp/common-types';
3
+ import { SectionCompiler } from "./section-compiler.js";
4
+ import Bksp = KMXPlus.Bksp;
5
+ import DependencySections = KMXPlus.DependencySections;
6
+ import Tran = KMXPlus.Tran;
7
+ import LDMLKeyboardXMLSourceFile = LDMLKeyboard.LDMLKeyboardXMLSourceFile;
8
+ import { Substitutions } from "./substitution-tracker.js";
9
+ type TransformCompilerType = 'simple' | 'backspace';
10
+ export declare abstract class TransformCompiler<T extends TransformCompilerType, TranBase extends Tran> extends SectionCompiler {
11
+ static validateSubstitutions(keyboard: LDMLKeyboard.LKKeyboard, st: Substitutions): boolean;
12
+ protected type: T;
13
+ constructor(source: LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks);
14
+ validate(): boolean;
15
+ /** allocate a new TranBase subclass */
16
+ protected newTran(): TranBase;
17
+ private compileTransforms;
18
+ private compileTransformGroup;
19
+ private compileTransformTranGroup;
20
+ private compileTransform;
21
+ /**
22
+ * Validate the final regex
23
+ * @param cookedFrom the regex to use, missing the trailing '$'
24
+ * @param from the original from - for error reporting
25
+ * @returns true if OK
26
+ */
27
+ private isValidRegex;
28
+ private compileReorderTranGroup;
29
+ private compileReorder;
30
+ compile(sections: DependencySections): TranBase;
31
+ get dependencies(): Set<SectionIdent>;
32
+ /**
33
+ * Analyze reorders and regexes for \uXXXX escapes.
34
+ * The LDML spec requires \u{XXXX} format.
35
+ * @param cookedFrom the original string
36
+ * @returns the original string, or null if an error was reported
37
+ */
38
+ private checkEscapes;
39
+ /**
40
+ * Analyze character classes such as '[a-z]' for denormalized characters.
41
+ * Escapes non-NFD characters as hex escapes.
42
+ * @param cookedFrom input regex string
43
+ * @returns updated 'from' string
44
+ */
45
+ private checkRanges;
46
+ }
47
+ export declare class TranCompiler extends TransformCompiler<'simple', Tran> {
48
+ constructor(source: LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks);
49
+ protected newTran(): Tran;
50
+ get id(): SectionIdent;
51
+ }
52
+ export declare class BkspCompiler extends TransformCompiler<'backspace', Bksp> {
53
+ constructor(source: LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks);
54
+ protected newTran(): Bksp;
55
+ get id(): SectionIdent;
56
+ }
57
+ export {};
58
58
  //# sourceMappingURL=tran.d.ts.map