@keymanapp/kmc-ldml 17.0.154-alpha → 17.0.156-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/compiler/compiler.d.ts +57 -55
- package/build/src/compiler/compiler.d.ts.map +1 -1
- package/build/src/compiler/compiler.js +198 -198
- package/build/src/compiler/compiler.js.map +1 -1
- package/build/src/compiler/disp.d.ts +14 -12
- package/build/src/compiler/disp.d.ts.map +1 -1
- package/build/src/compiler/disp.js +45 -43
- package/build/src/compiler/disp.js.map +1 -1
- package/build/src/compiler/empty-compiler.d.ts +39 -37
- package/build/src/compiler/empty-compiler.d.ts.map +1 -1
- package/build/src/compiler/empty-compiler.js +71 -69
- package/build/src/compiler/empty-compiler.js.map +1 -1
- package/build/src/compiler/keymanweb-compiler.d.ts +16 -16
- package/build/src/compiler/keymanweb-compiler.d.ts.map +1 -1
- package/build/src/compiler/keymanweb-compiler.js +97 -96
- package/build/src/compiler/keymanweb-compiler.js.map +1 -1
- package/build/src/compiler/keys.d.ts +30 -28
- package/build/src/compiler/keys.d.ts.map +1 -1
- package/build/src/compiler/keys.js +240 -238
- package/build/src/compiler/keys.js.map +1 -1
- package/build/src/compiler/layr.d.ts +12 -10
- package/build/src/compiler/layr.d.ts.map +1 -1
- package/build/src/compiler/layr.js +83 -81
- package/build/src/compiler/layr.js.map +1 -1
- package/build/src/compiler/ldml-compiler-options.d.ts +10 -0
- package/build/src/compiler/ldml-compiler-options.d.ts.map +1 -0
- package/build/src/compiler/ldml-compiler-options.js +5 -0
- package/build/src/compiler/ldml-compiler-options.js.map +1 -0
- package/build/src/compiler/loca.d.ts +18 -16
- package/build/src/compiler/loca.d.ts.map +1 -1
- package/build/src/compiler/loca.js +61 -59
- package/build/src/compiler/loca.js.map +1 -1
- package/build/src/compiler/marker-tracker.d.ts +36 -34
- package/build/src/compiler/marker-tracker.d.ts.map +1 -1
- package/build/src/compiler/marker-tracker.js +75 -73
- package/build/src/compiler/marker-tracker.js.map +1 -1
- package/build/src/compiler/messages.d.ts +135 -133
- package/build/src/compiler/messages.d.ts.map +1 -1
- package/build/src/compiler/messages.js +79 -77
- package/build/src/compiler/messages.js.map +1 -1
- package/build/src/compiler/meta.d.ts +14 -12
- package/build/src/compiler/meta.d.ts.map +1 -1
- package/build/src/compiler/meta.js +60 -58
- package/build/src/compiler/meta.js.map +1 -1
- package/build/src/compiler/metadata-compiler.d.ts +15 -13
- package/build/src/compiler/metadata-compiler.d.ts.map +1 -1
- package/build/src/compiler/metadata-compiler.js +49 -47
- package/build/src/compiler/metadata-compiler.js.map +1 -1
- package/build/src/compiler/name.d.ts +12 -10
- package/build/src/compiler/name.d.ts.map +1 -1
- package/build/src/compiler/name.js +22 -20
- package/build/src/compiler/name.js.map +1 -1
- package/build/src/compiler/section-compiler.d.ts +18 -16
- package/build/src/compiler/section-compiler.d.ts.map +1 -1
- package/build/src/compiler/section-compiler.js +36 -34
- package/build/src/compiler/section-compiler.js.map +1 -1
- package/build/src/compiler/touch-layout-compiler.d.ts +10 -8
- package/build/src/compiler/touch-layout-compiler.d.ts.map +1 -1
- package/build/src/compiler/touch-layout-compiler.js +89 -87
- package/build/src/compiler/touch-layout-compiler.js.map +1 -1
- package/build/src/compiler/tran.d.ts +39 -37
- package/build/src/compiler/tran.d.ts.map +1 -1
- package/build/src/compiler/tran.js +187 -185
- package/build/src/compiler/tran.js.map +1 -1
- package/build/src/compiler/vars.d.ts +23 -21
- package/build/src/compiler/vars.d.ts.map +1 -1
- package/build/src/compiler/vars.js +221 -219
- package/build/src/compiler/vars.js.map +1 -1
- package/build/src/compiler/visual-keyboard-compiler.d.ts +9 -7
- package/build/src/compiler/visual-keyboard-compiler.d.ts.map +1 -1
- package/build/src/compiler/visual-keyboard-compiler.js +52 -54
- package/build/src/compiler/visual-keyboard-compiler.js.map +1 -1
- package/build/src/compiler/vkey.d.ts +11 -9
- package/build/src/compiler/vkey.d.ts.map +1 -1
- package/build/src/compiler/vkey.js +61 -59
- package/build/src/compiler/vkey.js.map +1 -1
- package/build/src/main.d.ts +11 -9
- package/build/src/main.d.ts.map +1 -1
- package/build/src/main.js +10 -8
- package/build/src/main.js.map +1 -1
- package/build/src/util/util.d.ts +44 -42
- package/build/src/util/util.d.ts.map +1 -1
- package/build/src/util/util.js +122 -120
- package/build/src/util/util.js.map +1 -1
- package/package.json +8 -8
- package/build/src/compiler/compiler-options.d.ts +0 -16
- package/build/src/compiler/compiler-options.d.ts.map +0 -1
- package/build/src/compiler/compiler-options.js +0 -6
- package/build/src/compiler/compiler-options.js.map +0 -1
- package/build/src/kpj.schema.json +0 -127
- package/build/src/kvks.schema.json +0 -182
- package/build/src/ldml-keyboard.schema.json +0 -702
- package/build/src/ldml-keyboardtest.schema.json +0 -221
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"aafd005d-e09a-5615-9578-5487862c9dad","file":"layr.d.ts","mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,OAAO,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACvD,OAAO,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAK3B,qBAAa,YAAa,SAAQ,eAAe;IAE/C,IAAW,EAAE,8DAEZ;IAEM,QAAQ;IA0CR,OAAO,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;CA2BnD","names":[],"sourceRoot":"","sources":["../../../src/compiler/layr.ts"],"version":3}
|
|
@@ -1,81 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
let
|
|
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
|
-
sect
|
|
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
|
-
|
|
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]="e5a74d7d-3102-5041-86ec-caf7e1aa902a")}catch(e){}}();
|
|
2
|
+
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
|
3
|
+
import { KMXPlus } from '@keymanapp/common-types';
|
|
4
|
+
import { CompilerMessages } from './messages.js';
|
|
5
|
+
import { SectionCompiler } from "./section-compiler.js";
|
|
6
|
+
import { translateLayerAttrToModifier, validModifier } from '../util/util.js';
|
|
7
|
+
var Layr = KMXPlus.Layr;
|
|
8
|
+
export class LayrCompiler extends SectionCompiler {
|
|
9
|
+
get id() {
|
|
10
|
+
return constants.section.layr;
|
|
11
|
+
}
|
|
12
|
+
validate() {
|
|
13
|
+
let valid = true;
|
|
14
|
+
let totalLayerCount = 0;
|
|
15
|
+
let hardwareLayers = 0;
|
|
16
|
+
// let touchLayers = 0;
|
|
17
|
+
this.keyboard.layers?.forEach((layers) => {
|
|
18
|
+
const { form } = layers;
|
|
19
|
+
if (form === 'touch') {
|
|
20
|
+
// touchLayers++;
|
|
21
|
+
// multiple touch layers are OK
|
|
22
|
+
totalLayerCount += layers.layer?.length;
|
|
23
|
+
// TODO-LDML: check that widths are distinct
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// hardware
|
|
27
|
+
hardwareLayers++;
|
|
28
|
+
if (hardwareLayers > 1) {
|
|
29
|
+
valid = false;
|
|
30
|
+
this.callbacks.reportMessage(CompilerMessages.Error_ExcessHardware({ form }));
|
|
31
|
+
}
|
|
32
|
+
else if (!constants.layr_list_hardware_map.get(form)) {
|
|
33
|
+
/* c8 ignore next 4 */
|
|
34
|
+
// not reached due to XML validation
|
|
35
|
+
valid = false;
|
|
36
|
+
this.callbacks.reportMessage(CompilerMessages.Error_InvalidHardware({ form }));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
layers.layer.forEach((layer) => {
|
|
40
|
+
const { modifier, id } = layer;
|
|
41
|
+
totalLayerCount++;
|
|
42
|
+
if (!validModifier(modifier)) {
|
|
43
|
+
this.callbacks.reportMessage(CompilerMessages.Error_InvalidModifier({ modifier, layer: id }));
|
|
44
|
+
valid = false;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
if (totalLayerCount === 0) { // TODO-LDML: does not validate touch layers yet
|
|
49
|
+
// no layers seen anywhere
|
|
50
|
+
valid = false;
|
|
51
|
+
this.callbacks.reportMessage(CompilerMessages.Error_MustBeAtLeastOneLayerElement());
|
|
52
|
+
}
|
|
53
|
+
return valid;
|
|
54
|
+
}
|
|
55
|
+
compile(sections) {
|
|
56
|
+
const sect = new Layr();
|
|
57
|
+
sect.lists = this.keyboard.layers.map((layers) => {
|
|
58
|
+
const hardware = constants.layr_list_hardware_map.get(layers.form);
|
|
59
|
+
// Already validated in validate
|
|
60
|
+
const list = {
|
|
61
|
+
hardware,
|
|
62
|
+
minDeviceWidth: layers.minDeviceWidth || 0,
|
|
63
|
+
layers: layers.layer.map((layer) => {
|
|
64
|
+
const entry = {
|
|
65
|
+
id: sections.strs.allocString(layer.id),
|
|
66
|
+
mod: translateLayerAttrToModifier(layer),
|
|
67
|
+
rows: layer.row.map((row) => {
|
|
68
|
+
const erow = {
|
|
69
|
+
keys: row.keys.split(' ').map((id) => sections.strs.allocString(id)),
|
|
70
|
+
};
|
|
71
|
+
return erow;
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
return entry;
|
|
75
|
+
}),
|
|
76
|
+
};
|
|
77
|
+
return list;
|
|
78
|
+
});
|
|
79
|
+
return sect;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# debugId=e5a74d7d-3102-5041-86ec-caf7e1aa902a
|
|
83
|
+
//# sourceMappingURL=layr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"e5a74d7d-3102-5041-86ec-caf7e1aa902a","file":"layr.js","mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI9E,IAAO,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAK3B,MAAM,OAAO,YAAa,SAAQ,eAAe;IAE/C,IAAW,EAAE;QACX,OAAO,SAAS,CAAC,OAAO,CAAC,IA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O,IAAI,CAAC;wBACd,CAAC,CAAC;qBACH,CAAC;oBACF,OAAO,KAAK,CAAC;gBACf,CAAC,CAAC;aACH,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF","names":[],"sourceRoot":"","sources":["../../../src/compiler/layr.ts"],"version":3}
|
|
@@ -0,0 +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]="5997e503-3d44-5f75-822e-33295488ea3b")}catch(e){}}();
|
|
2
|
+
import { CompilerOptions, LDMLKeyboardXMLSourceFileReaderOptions } from "@keymanapp/common-types";
|
|
3
|
+
export interface LdmlCompilerOptions extends CompilerOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Paths and other options required for reading .xml files
|
|
6
|
+
*/
|
|
7
|
+
readerOptions: LDMLKeyboardXMLSourceFileReaderOptions;
|
|
8
|
+
}
|
|
9
|
+
//# debugId=5997e503-3d44-5f75-822e-33295488ea3b
|
|
10
|
+
//# sourceMappingURL=ldml-compiler-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"debug_id":"5997e503-3d44-5f75-822e-33295488ea3b","file":"ldml-compiler-options.d.ts","mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,sCAAsC,EAAE,MAAM,yBAAyB,CAAC;AAElG,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D;;OAEG;IACH,aAAa,EAAE,sCAAsC,CAAC;CACvD","names":[],"sourceRoot":"","sources":["../../../src/compiler/ldml-compiler-options.ts"],"version":3}
|
|
@@ -0,0 +1,5 @@
|
|
|
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]="0a6092ca-024c-5e1e-9727-20ffac5cc31f")}catch(e){}}();
|
|
2
|
+
;
|
|
3
|
+
export {};
|
|
4
|
+
//# debugId=0a6092ca-024c-5e1e-9727-20ffac5cc31f
|
|
5
|
+
//# sourceMappingURL=ldml-compiler-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"debug_id":"0a6092ca-024c-5e1e-9727-20ffac5cc31f","file":"ldml-compiler-options.js","mappings":";AAOC,CAAC","names":[],"sourceRoot":"","sources":["../../../src/compiler/ldml-compiler-options.ts"],"version":3}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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]="5258c12a-20a3-54e8-b1c2-fef6307e1cd7")}catch(e){}}();
|
|
2
|
+
import { KMXPlus } from '@keymanapp/common-types';
|
|
3
|
+
import { SectionCompiler } from "./section-compiler.js";
|
|
4
|
+
import DependencySections = KMXPlus.DependencySections;
|
|
5
|
+
import Loca = KMXPlus.Loca;
|
|
6
|
+
export declare class LocaCompiler extends SectionCompiler {
|
|
7
|
+
get id(): import("@keymanapp/ldml-keyboard-constants").SectionIdent;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param keyboard
|
|
11
|
+
* @returns list of BCP 47 tags in the keyboard xml, potentially with invalid or repeated entries
|
|
12
|
+
*/
|
|
13
|
+
private getLocales;
|
|
14
|
+
validate(): boolean;
|
|
15
|
+
compile(sections: DependencySections): Loca;
|
|
16
|
+
}
|
|
17
|
+
//# debugId=5258c12a-20a3-54e8-b1c2-fef6307e1cd7
|
|
18
|
+
//# sourceMappingURL=loca.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"5258c12a-20a3-54e8-b1c2-fef6307e1cd7","file":"loca.d.ts","mappings":";AACA,OAAO,EAAgB,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACvD,OAAO,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAG3B,qBAAa,YAAa,SAAQ,eAAe;IAE/C,IAAW,EAAE,8DAEZ;IAED;;;;OAIG;IACH,OAAO,CAAC,UAAU,CAE+F;IAE1G,QAAQ,IAAI,OAAO;IAmBnB,OAAO,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;CA0BnD","names":[],"sourceRoot":"","sources":["../../../src/compiler/loca.ts"],"version":3}
|
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
14
|
-
|
|
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
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
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]="bd202cd9-31e3-51dd-85cc-4b71a1326b27")}catch(e){}}();
|
|
2
|
+
import { constants } from "@keymanapp/ldml-keyboard-constants";
|
|
3
|
+
import { KMXPlus } from '@keymanapp/common-types';
|
|
4
|
+
import { SectionCompiler } from "./section-compiler.js";
|
|
5
|
+
import { CompilerMessages } from "./messages.js";
|
|
6
|
+
var Loca = KMXPlus.Loca;
|
|
7
|
+
export class LocaCompiler extends SectionCompiler {
|
|
8
|
+
get id() {
|
|
9
|
+
return constants.section.loca;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param keyboard
|
|
14
|
+
* @returns list of BCP 47 tags in the keyboard xml, potentially with invalid or repeated entries
|
|
15
|
+
*/
|
|
16
|
+
getLocales = (keyboard) => [keyboard.locale].concat(Array.isArray(keyboard.locales?.locale) ? keyboard.locales.locale.map(v => v.id) : []);
|
|
17
|
+
validate() {
|
|
18
|
+
let valid = true;
|
|
19
|
+
const locales = this.getLocales(this.keyboard);
|
|
20
|
+
for (let tag of locales) {
|
|
21
|
+
try {
|
|
22
|
+
new Intl.Locale(tag);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
if (e instanceof RangeError) {
|
|
26
|
+
this.callbacks.reportMessage(CompilerMessages.Error_InvalidLocale({ tag }));
|
|
27
|
+
valid = false;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
/* c8 ignore next 2 */
|
|
31
|
+
throw e;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return valid;
|
|
36
|
+
}
|
|
37
|
+
compile(sections) {
|
|
38
|
+
let result = new Loca();
|
|
39
|
+
// This also minimizes locales according to Remove Likely Subtags algorithm:
|
|
40
|
+
// https://www.unicode.org/reports/tr35/#Likely_Subtags
|
|
41
|
+
const sourceLocales = this.getLocales(this.keyboard);
|
|
42
|
+
const locales = sourceLocales.map((sourceLocale) => {
|
|
43
|
+
const locale = new Intl.Locale(sourceLocale).minimize().toString();
|
|
44
|
+
if (locale != sourceLocale) {
|
|
45
|
+
this.callbacks.reportMessage(CompilerMessages.Hint_LocaleIsNotMinimalAndClean({ sourceLocale, locale }));
|
|
46
|
+
}
|
|
47
|
+
return locale;
|
|
48
|
+
});
|
|
49
|
+
// TODO: remove `as any` cast: (Intl as any): ts lib version we have doesn't
|
|
50
|
+
// yet include `getCanonicalLocales` but node 16 does include it so we can
|
|
51
|
+
// safely use it. Also well supported in modern browsers.
|
|
52
|
+
const canonicalLocales = Intl.getCanonicalLocales(locales);
|
|
53
|
+
result.locales = canonicalLocales.map(locale => sections.strs.allocString(locale));
|
|
54
|
+
if (result.locales.length < locales.length) {
|
|
55
|
+
this.callbacks.reportMessage(CompilerMessages.Hint_OneOrMoreRepeatedLocales());
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# debugId=bd202cd9-31e3-51dd-85cc-4b71a1326b27
|
|
61
|
+
//# sourceMappingURL=loca.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"bd202cd9-31e3-51dd-85cc-4b71a1326b27","file":"loca.js","mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAgB,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAA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
23
|
-
|
|
24
|
-
all
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
* @param
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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]="1cf06b7d-729f-54c0-b378-657d8a6b36f8")}catch(e){}}();
|
|
2
|
+
/**
|
|
3
|
+
* Verb for MarkerTracker.add()
|
|
4
|
+
*/
|
|
5
|
+
export declare enum MarkerUse {
|
|
6
|
+
/** outputs this marker into context (e.g. transform to= or key to=) */
|
|
7
|
+
emit = 0,
|
|
8
|
+
/** consumes this marker out of the context (e.g. transform from=) */
|
|
9
|
+
consume = 1,
|
|
10
|
+
/** matches the marker, but doesn't consume (e.g. display to=) */
|
|
11
|
+
match = 2,
|
|
12
|
+
/** variable definition: might consume, emit, or match. */
|
|
13
|
+
variable = 3
|
|
14
|
+
}
|
|
15
|
+
type MarkerSet = Set<string>;
|
|
16
|
+
/** Tracks usage of markers */
|
|
17
|
+
export declare class MarkerTracker {
|
|
18
|
+
/** markers that were emitted */
|
|
19
|
+
emitted: MarkerSet;
|
|
20
|
+
/** markers that were consumed and removed from the context */
|
|
21
|
+
consumed: MarkerSet;
|
|
22
|
+
/** markers that were matched, but not necessarily consumed */
|
|
23
|
+
matched: MarkerSet;
|
|
24
|
+
/** all markers */
|
|
25
|
+
all: MarkerSet;
|
|
26
|
+
constructor();
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param verb what kind of use we are adding
|
|
30
|
+
* @param markers list of markers to add
|
|
31
|
+
*/
|
|
32
|
+
add(verb: MarkerUse, markers: string[]): void;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# debugId=1cf06b7d-729f-54c0-b378-657d8a6b36f8
|
|
36
|
+
//# sourceMappingURL=marker-tracker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"debug_id":"1cf06b7d-729f-54c0-b378-657d8a6b36f8","file":"marker-tracker.d.ts","mappings":";AAAA;;GAEG;AACH,oBAAY,SAAS;IACnB,uEAAuE;IACvE,IAAI,IAAA;IACJ,qEAAqE;IACrE,OAAO,IAAA;IACP,iEAAiE;IACjE,KAAK,IAAA;IACL,0DAA0D;IAC1D,QAAQ,IAAA;CACT;AAED,KAAK,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AAE7B,8BAA8B;AAC9B,qBAAa,aAAa;IACxB,gCAAgC;IAChC,OAAO,EAAE,SAAS,CAAC;IACnB,8DAA8D;IAC9D,QAAQ,EAAE,SAAS,CAAC;IACpB,8DAA8D;IAC9D,OAAO,EAAE,SAAS,CAAC;IACnB,kBAAkB;IAClB,GAAG,EAAE,SAAS,CAAC;;IASf;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE;CAgCvC","names":[],"sourceRoot":"","sources":["../../../src/compiler/marker-tracker.ts"],"version":3}
|