@keymanapp/common-types 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/consts/virtual-key-constants.d.ts +191 -191
- package/build/src/consts/virtual-key-constants.js +221 -221
- package/build/src/consts/virtual-key-constants.js.map +1 -1
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-reader.d.ts +5 -5
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-reader.js +72 -72
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-reader.js.map +1 -1
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-writer.d.ts +28 -28
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-writer.js +120 -120
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-writer.js.map +1 -1
- package/build/src/keyman-touch-layout/keyman-touch-layout-file.d.ts +95 -95
- package/build/src/keyman-touch-layout/keyman-touch-layout-file.js +52 -52
- package/build/src/kmx/element-string.d.ts +23 -23
- package/build/src/kmx/element-string.js +125 -125
- package/build/src/kmx/element-string.js.map +1 -1
- package/build/src/kmx/keyman-targets.d.ts +20 -20
- package/build/src/kmx/keyman-targets.js +79 -79
- package/build/src/kmx/keyman-targets.js.map +1 -1
- package/build/src/kmx/kmx-builder.d.ts +32 -32
- package/build/src/kmx/kmx-builder.js +189 -189
- package/build/src/kmx/kmx-builder.js.map +1 -1
- package/build/src/kmx/kmx-file-reader.d.ts +13 -13
- package/build/src/kmx/kmx-file-reader.js +134 -134
- package/build/src/kmx/kmx-file-reader.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-disp.d.ts +18 -18
- package/build/src/kmx/kmx-plus-builder/build-disp.js +27 -27
- package/build/src/kmx/kmx-plus-builder/build-disp.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-elem.d.ts +28 -28
- package/build/src/kmx/kmx-plus-builder/build-elem.js +89 -89
- package/build/src/kmx/kmx-plus-builder/build-elem.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-keys.d.ts +56 -56
- package/build/src/kmx/kmx-plus-builder/build-keys.js +107 -107
- package/build/src/kmx/kmx-plus-builder/build-keys.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-layr.d.ts +53 -53
- package/build/src/kmx/kmx-plus-builder/build-layr.js +101 -101
- package/build/src/kmx/kmx-plus-builder/build-layr.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-list.d.ts +35 -35
- package/build/src/kmx/kmx-plus-builder/build-list.js +66 -66
- package/build/src/kmx/kmx-plus-builder/build-list.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-loca.d.ts +11 -11
- package/build/src/kmx/kmx-plus-builder/build-loca.js +21 -21
- package/build/src/kmx/kmx-plus-builder/build-loca.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-meta.d.ts +16 -16
- package/build/src/kmx/kmx-plus-builder/build-meta.js +20 -20
- package/build/src/kmx/kmx-plus-builder/build-sect.d.ts +15 -15
- package/build/src/kmx/kmx-plus-builder/build-sect.js +15 -15
- package/build/src/kmx/kmx-plus-builder/build-sect.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-strs.d.ts +22 -22
- package/build/src/kmx/kmx-plus-builder/build-strs.js +46 -46
- package/build/src/kmx/kmx-plus-builder/build-strs.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-tran.d.ts +32 -32
- package/build/src/kmx/kmx-plus-builder/build-tran.js +69 -69
- package/build/src/kmx/kmx-plus-builder/build-tran.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-uset.d.ts +30 -30
- package/build/src/kmx/kmx-plus-builder/build-uset.js +60 -60
- package/build/src/kmx/kmx-plus-builder/build-uset.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-vars.d.ts +21 -21
- package/build/src/kmx/kmx-plus-builder/build-vars.js +48 -48
- package/build/src/kmx/kmx-plus-builder/build-vars.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/builder-section.d.ts +9 -9
- package/build/src/kmx/kmx-plus-builder/builder-section.js +2 -2
- package/build/src/kmx/kmx-plus-builder/kmx-plus-builder.d.ts +42 -42
- package/build/src/kmx/kmx-plus-builder/kmx-plus-builder.js +137 -137
- package/build/src/kmx/kmx-plus-builder/kmx-plus-builder.js.map +1 -1
- package/build/src/kmx/kmx-plus.d.ts +322 -322
- package/build/src/kmx/kmx-plus.js +830 -830
- package/build/src/kmx/kmx-plus.js.map +1 -1
- package/build/src/kmx/kmx.d.ts +233 -233
- package/build/src/kmx/kmx.js +302 -302
- package/build/src/kmx/kmx.js.map +1 -1
- package/build/src/kmx/string-list.d.ts +35 -35
- package/build/src/kmx/string-list.js +88 -88
- package/build/src/kmx/string-list.js.map +1 -1
- package/build/src/kpj/keyman-developer-project.d.ts +78 -78
- package/build/src/kpj/keyman-developer-project.js +195 -195
- package/build/src/kpj/keyman-developer-project.js.map +1 -1
- package/build/src/kpj/kpj-file-reader.d.ts +18 -18
- package/build/src/kpj/kpj-file-reader.js +119 -119
- package/build/src/kpj/kpj-file-reader.js.map +1 -1
- package/build/src/kpj/kpj-file.d.ts +39 -39
- package/build/src/kpj/kpj-file.js +10 -10
- package/build/src/kvk/kvk-file-reader.d.ts +4 -4
- package/build/src/kvk/kvk-file-reader.js +37 -37
- package/build/src/kvk/kvk-file-reader.js.map +1 -1
- package/build/src/kvk/kvk-file-writer.d.ts +19 -19
- package/build/src/kvk/kvk-file-writer.js +77 -77
- package/build/src/kvk/kvk-file-writer.js.map +1 -1
- package/build/src/kvk/kvk-file.d.ts +66 -66
- package/build/src/kvk/kvk-file.d.ts.map +1 -1
- package/build/src/kvk/kvk-file.js +90 -90
- package/build/src/kvk/kvk-file.js.map +1 -1
- package/build/src/kvk/kvks-file-reader.d.ts +23 -23
- package/build/src/kvk/kvks-file-reader.js +175 -175
- package/build/src/kvk/kvks-file-reader.js.map +1 -1
- package/build/src/kvk/kvks-file-writer.d.ts +6 -6
- package/build/src/kvk/kvks-file-writer.js +106 -106
- package/build/src/kvk/kvks-file-writer.js.map +1 -1
- package/build/src/kvk/kvks-file.d.ts +43 -43
- package/build/src/kvk/kvks-file.js +9 -9
- package/build/src/kvk/visual-keyboard.d.ts +44 -44
- package/build/src/kvk/visual-keyboard.js +75 -75
- package/build/src/kvk/visual-keyboard.js.map +1 -1
- package/build/src/ldml-keyboard/ldml-keyboard-testdata-xml.d.ts +60 -60
- package/build/src/ldml-keyboard/ldml-keyboard-testdata-xml.js +19 -19
- package/build/src/ldml-keyboard/ldml-keyboard-xml-reader.d.ts +95 -95
- package/build/src/ldml-keyboard/ldml-keyboard-xml-reader.js +409 -409
- package/build/src/ldml-keyboard/ldml-keyboard-xml-reader.js.map +1 -1
- package/build/src/ldml-keyboard/ldml-keyboard-xml.d.ts +170 -170
- package/build/src/ldml-keyboard/ldml-keyboard-xml.js +55 -55
- package/build/src/ldml-keyboard/pattern-parser.d.ts +201 -201
- package/build/src/ldml-keyboard/pattern-parser.js +490 -490
- package/build/src/ldml-keyboard/pattern-parser.js.map +1 -1
- package/build/src/ldml-keyboard/unicodeset-parser-api.d.ts +37 -37
- package/build/src/ldml-keyboard/unicodeset-parser-api.js +27 -27
- package/build/src/main.d.ts +33 -33
- package/build/src/main.js +32 -32
- package/build/src/package/kmp-json-file.d.ts +115 -115
- package/build/src/package/kmp-json-file.js +1 -1
- package/build/src/package/kps-file.d.ts +175 -175
- package/build/src/package/kps-file.js +15 -15
- package/build/src/schema-validators.d.ts +13 -13
- package/build/src/schema-validators.js +25 -25
- package/build/src/schemas/displaymap.schema.d.ts +57 -57
- package/build/src/schemas/displaymap.schema.js +35 -35
- package/build/src/schemas/displaymap.schema.validator.d.mts +2 -2
- package/build/src/schemas/displaymap.schema.validator.mjs +266 -266
- package/build/src/schemas/displaymap.schema.validator.mjs.map +1 -1
- package/build/src/schemas/keyboard_info.schema.d.ts +209 -209
- package/build/src/schemas/keyboard_info.schema.js +98 -98
- package/build/src/schemas/keyboard_info.schema.validator.d.mts +2 -2
- package/build/src/schemas/keyboard_info.schema.validator.mjs +1160 -1160
- package/build/src/schemas/keyboard_info.schema.validator.mjs.map +1 -1
- package/build/src/schemas/keyman-touch-layout.clean.spec.d.ts +227 -227
- package/build/src/schemas/keyman-touch-layout.clean.spec.js +151 -151
- package/build/src/schemas/keyman-touch-layout.clean.spec.validator.d.mts +2 -2
- package/build/src/schemas/keyman-touch-layout.clean.spec.validator.mjs +1094 -1094
- package/build/src/schemas/keyman-touch-layout.clean.spec.validator.mjs.map +1 -1
- package/build/src/schemas/keyman-touch-layout.spec.d.ts +229 -229
- package/build/src/schemas/keyman-touch-layout.spec.js +140 -140
- package/build/src/schemas/keyman-touch-layout.spec.validator.d.mts +2 -2
- package/build/src/schemas/keyman-touch-layout.spec.validator.mjs +1436 -1436
- package/build/src/schemas/keyman-touch-layout.spec.validator.mjs.map +1 -1
- package/build/src/schemas/kmp.schema.d.ts +324 -324
- package/build/src/schemas/kmp.schema.js +353 -353
- package/build/src/schemas/kmp.schema.validator.d.mts +2 -2
- package/build/src/schemas/kmp.schema.validator.mjs +1627 -1627
- package/build/src/schemas/kmp.schema.validator.mjs.map +1 -1
- package/build/src/schemas/kpj-9.0.schema.d.ts +152 -152
- package/build/src/schemas/kpj-9.0.schema.js +131 -131
- package/build/src/schemas/kpj-9.0.schema.validator.d.mts +2 -2
- package/build/src/schemas/kpj-9.0.schema.validator.mjs +655 -655
- package/build/src/schemas/kpj-9.0.schema.validator.mjs.map +1 -1
- package/build/src/schemas/kpj.schema.d.ts +122 -122
- package/build/src/schemas/kpj.schema.js +129 -129
- package/build/src/schemas/kpj.schema.validator.d.mts +2 -2
- package/build/src/schemas/kpj.schema.validator.mjs +515 -515
- package/build/src/schemas/kpj.schema.validator.mjs.map +1 -1
- package/build/src/schemas/kvks.schema.d.ts +160 -160
- package/build/src/schemas/kvks.schema.js +182 -182
- package/build/src/schemas/kvks.schema.validator.d.mts +2 -2
- package/build/src/schemas/kvks.schema.validator.mjs +625 -625
- package/build/src/schemas/kvks.schema.validator.mjs.map +1 -1
- package/build/src/schemas/ldml-keyboard3.schema.d.ts +635 -635
- package/build/src/schemas/ldml-keyboard3.schema.js +696 -696
- package/build/src/schemas/ldml-keyboard3.schema.validator.d.mts +2 -2
- package/build/src/schemas/ldml-keyboard3.schema.validator.mjs +3117 -3117
- package/build/src/schemas/ldml-keyboard3.schema.validator.mjs.map +1 -1
- package/build/src/schemas/ldml-keyboardtest3.schema.d.ts +192 -192
- package/build/src/schemas/ldml-keyboardtest3.schema.js +225 -225
- package/build/src/schemas/ldml-keyboardtest3.schema.validator.d.mts +2 -2
- package/build/src/schemas/ldml-keyboardtest3.schema.validator.mjs +744 -744
- package/build/src/schemas/ldml-keyboardtest3.schema.validator.mjs.map +1 -1
- package/build/src/schemas.d.ts +2300 -2300
- package/build/src/schemas.js +23 -23
- package/build/src/util/common-events.d.ts +44 -44
- package/build/src/util/common-events.js +26 -26
- package/build/src/util/compiler-interfaces.d.ts +371 -371
- package/build/src/util/compiler-interfaces.d.ts.map +1 -1
- package/build/src/util/compiler-interfaces.js +380 -380
- package/build/src/util/compiler-interfaces.js.map +1 -1
- package/build/src/util/errors.d.ts +5 -5
- package/build/src/util/errors.js +5 -5
- package/build/src/util/file-types.d.ts +93 -93
- package/build/src/util/file-types.d.ts.map +1 -1
- package/build/src/util/file-types.js +142 -142
- package/build/src/util/file-types.js.map +1 -1
- package/build/src/util/util.d.ts +98 -98
- package/build/src/util/util.js +368 -368
- package/build/src/util/util.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,121 +1,121 @@
|
|
|
1
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]="
|
|
3
|
-
import * as xml2js from 'xml2js';
|
|
4
|
-
import { boxXmlArray } from '../util/util.js';
|
|
5
|
-
import { KeymanDeveloperProject, KeymanDeveloperProjectFile10, KeymanDeveloperProjectType } from './keyman-developer-project.js';
|
|
6
|
-
import SchemaValidators from '../schema-validators.js';
|
|
7
|
-
export class KPJFileReader {
|
|
8
|
-
callbacks;
|
|
9
|
-
constructor(callbacks) {
|
|
10
|
-
this.callbacks = callbacks;
|
|
11
|
-
}
|
|
12
|
-
read(file) {
|
|
13
|
-
let data;
|
|
14
|
-
const parser = new xml2js.Parser({
|
|
15
|
-
explicitArray: false,
|
|
16
|
-
mergeAttrs: false,
|
|
17
|
-
includeWhiteChars: false,
|
|
18
|
-
normalize: false,
|
|
19
|
-
emptyTag: ''
|
|
20
|
-
});
|
|
21
|
-
parser.parseString(file, (e, r) => {
|
|
22
|
-
if (e) {
|
|
23
|
-
throw e;
|
|
24
|
-
}
|
|
25
|
-
data = r;
|
|
26
|
-
});
|
|
27
|
-
data = this.boxArrays(data);
|
|
28
|
-
if (data.KeymanDeveloperProject?.Files?.File?.length) {
|
|
29
|
-
for (let file of data.KeymanDeveloperProject?.Files?.File) {
|
|
30
|
-
// xml2js imports <Details/> as '' so we will just delete the empty string
|
|
31
|
-
if (typeof file.Details == 'string') {
|
|
32
|
-
delete file.Details;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
validate(source) {
|
|
39
|
-
if (!SchemaValidators.kpj(source)) {
|
|
40
|
-
if (!SchemaValidators.kpj90(source)) {
|
|
41
|
-
// If the legacy schema also does not validate, then we will only report
|
|
42
|
-
// the errors against the modern schema
|
|
43
|
-
throw new Error(JSON.stringify(SchemaValidators.kpj.errors));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
boolFromString(value, def) {
|
|
48
|
-
value = (value || '').toLowerCase();
|
|
49
|
-
if (value === 'true')
|
|
50
|
-
return true;
|
|
51
|
-
if (value === 'false')
|
|
52
|
-
return false;
|
|
53
|
-
return def;
|
|
54
|
-
}
|
|
55
|
-
transform(projectFilename, source) {
|
|
56
|
-
// NOTE: at this point, the xml should have been validated
|
|
57
|
-
// and matched the schema result so we can assume the source
|
|
58
|
-
// is a valid shape
|
|
59
|
-
let project = source.KeymanDeveloperProject;
|
|
60
|
-
let result = new KeymanDeveloperProject(projectFilename, project.Options?.Version || "1.0", this.callbacks);
|
|
61
|
-
if (result.options.version == '2.0') {
|
|
62
|
-
result.options.buildPath = (project.Options?.BuildPath || result.options.buildPath).replace(/\\/g, '/');
|
|
63
|
-
result.options.sourcePath = (project.Options?.SourcePath || result.options.sourcePath).replace(/\\/g, '/');
|
|
64
|
-
result.options.skipMetadataFiles = this.boolFromString(project.Options?.SkipMetadataFiles, false);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
result.options.buildPath = (project.Options?.BuildPath || '').replace(/\\/g, '/');
|
|
68
|
-
result.options.skipMetadataFiles = this.boolFromString(project.Options?.SkipMetadataFiles, true);
|
|
69
|
-
}
|
|
70
|
-
result.options.checkFilenameConventions = this.boolFromString(project.Options?.CheckFilenameConventions, false);
|
|
71
|
-
result.options.compilerWarningsAsErrors = this.boolFromString(project.Options?.CompilerWarningsAsErrors, false);
|
|
72
|
-
result.options.warnDeprecatedCode = this.boolFromString(project.Options?.WarnDeprecatedCode, true);
|
|
73
|
-
result.options.projectType =
|
|
74
|
-
project.Options?.ProjectType == 'keyboard' ? KeymanDeveloperProjectType.Keyboard :
|
|
75
|
-
project.Options?.ProjectType == 'lexicalmodel' ? KeymanDeveloperProjectType.LexicalModel :
|
|
76
|
-
KeymanDeveloperProjectType.Keyboard; // Default is keyboard if missing
|
|
77
|
-
if (result.options.version == '1.0') {
|
|
78
|
-
this.transformFilesVersion10(project, result);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
result.populateFiles();
|
|
82
|
-
}
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
transformFilesVersion10(project, result) {
|
|
86
|
-
let ids = {};
|
|
87
|
-
for (let sourceFile of project.Files?.File) {
|
|
88
|
-
let file = new KeymanDeveloperProjectFile10(sourceFile.ID || '', (sourceFile.Filepath || '').replace(/\\/g, '/'), sourceFile.FileVersion || '', this.callbacks);
|
|
89
|
-
if (sourceFile.Details) {
|
|
90
|
-
file.details.copyright = sourceFile.Details.Copyright;
|
|
91
|
-
file.details.name = sourceFile.Details.Name;
|
|
92
|
-
file.details.message = sourceFile.Details.Message;
|
|
93
|
-
file.details.version = sourceFile.Details.Version;
|
|
94
|
-
}
|
|
95
|
-
if (sourceFile.ParentFileID && ids[sourceFile.ParentFileID]) {
|
|
96
|
-
ids[sourceFile.ParentFileID].childFiles.push(file);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
result.files.push(file);
|
|
100
|
-
ids[file.id] = file;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* xml2js will not place single-entry objects into arrays.
|
|
106
|
-
* Easiest way to fix this is to box them ourselves as needed
|
|
107
|
-
* @param source KVKSourceFile
|
|
108
|
-
*/
|
|
109
|
-
boxArrays(source) {
|
|
110
|
-
if (!source.KeymanDeveloperProject) {
|
|
111
|
-
return source;
|
|
112
|
-
}
|
|
113
|
-
if (!source.KeymanDeveloperProject.Files || typeof source.KeymanDeveloperProject.Files == 'string') {
|
|
114
|
-
source.KeymanDeveloperProject.Files = { File: [] };
|
|
115
|
-
}
|
|
116
|
-
boxXmlArray(source.KeymanDeveloperProject.Files, 'File');
|
|
117
|
-
return source;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
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]="1f1f7b7e-d70d-5354-b3c3-9f983dbd3c06")}catch(e){}}();
|
|
3
|
+
import * as xml2js from 'xml2js';
|
|
4
|
+
import { boxXmlArray } from '../util/util.js';
|
|
5
|
+
import { KeymanDeveloperProject, KeymanDeveloperProjectFile10, KeymanDeveloperProjectType } from './keyman-developer-project.js';
|
|
6
|
+
import SchemaValidators from '../schema-validators.js';
|
|
7
|
+
export class KPJFileReader {
|
|
8
|
+
callbacks;
|
|
9
|
+
constructor(callbacks) {
|
|
10
|
+
this.callbacks = callbacks;
|
|
11
|
+
}
|
|
12
|
+
read(file) {
|
|
13
|
+
let data;
|
|
14
|
+
const parser = new xml2js.Parser({
|
|
15
|
+
explicitArray: false,
|
|
16
|
+
mergeAttrs: false,
|
|
17
|
+
includeWhiteChars: false,
|
|
18
|
+
normalize: false,
|
|
19
|
+
emptyTag: ''
|
|
20
|
+
});
|
|
21
|
+
parser.parseString(file, (e, r) => {
|
|
22
|
+
if (e) {
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
|
25
|
+
data = r;
|
|
26
|
+
});
|
|
27
|
+
data = this.boxArrays(data);
|
|
28
|
+
if (data.KeymanDeveloperProject?.Files?.File?.length) {
|
|
29
|
+
for (let file of data.KeymanDeveloperProject?.Files?.File) {
|
|
30
|
+
// xml2js imports <Details/> as '' so we will just delete the empty string
|
|
31
|
+
if (typeof file.Details == 'string') {
|
|
32
|
+
delete file.Details;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
validate(source) {
|
|
39
|
+
if (!SchemaValidators.kpj(source)) {
|
|
40
|
+
if (!SchemaValidators.kpj90(source)) {
|
|
41
|
+
// If the legacy schema also does not validate, then we will only report
|
|
42
|
+
// the errors against the modern schema
|
|
43
|
+
throw new Error(JSON.stringify(SchemaValidators.kpj.errors));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
boolFromString(value, def) {
|
|
48
|
+
value = (value || '').toLowerCase();
|
|
49
|
+
if (value === 'true')
|
|
50
|
+
return true;
|
|
51
|
+
if (value === 'false')
|
|
52
|
+
return false;
|
|
53
|
+
return def;
|
|
54
|
+
}
|
|
55
|
+
transform(projectFilename, source) {
|
|
56
|
+
// NOTE: at this point, the xml should have been validated
|
|
57
|
+
// and matched the schema result so we can assume the source
|
|
58
|
+
// is a valid shape
|
|
59
|
+
let project = source.KeymanDeveloperProject;
|
|
60
|
+
let result = new KeymanDeveloperProject(projectFilename, project.Options?.Version || "1.0", this.callbacks);
|
|
61
|
+
if (result.options.version == '2.0') {
|
|
62
|
+
result.options.buildPath = (project.Options?.BuildPath || result.options.buildPath).replace(/\\/g, '/');
|
|
63
|
+
result.options.sourcePath = (project.Options?.SourcePath || result.options.sourcePath).replace(/\\/g, '/');
|
|
64
|
+
result.options.skipMetadataFiles = this.boolFromString(project.Options?.SkipMetadataFiles, false);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
result.options.buildPath = (project.Options?.BuildPath || '').replace(/\\/g, '/');
|
|
68
|
+
result.options.skipMetadataFiles = this.boolFromString(project.Options?.SkipMetadataFiles, true);
|
|
69
|
+
}
|
|
70
|
+
result.options.checkFilenameConventions = this.boolFromString(project.Options?.CheckFilenameConventions, false);
|
|
71
|
+
result.options.compilerWarningsAsErrors = this.boolFromString(project.Options?.CompilerWarningsAsErrors, false);
|
|
72
|
+
result.options.warnDeprecatedCode = this.boolFromString(project.Options?.WarnDeprecatedCode, true);
|
|
73
|
+
result.options.projectType =
|
|
74
|
+
project.Options?.ProjectType == 'keyboard' ? KeymanDeveloperProjectType.Keyboard :
|
|
75
|
+
project.Options?.ProjectType == 'lexicalmodel' ? KeymanDeveloperProjectType.LexicalModel :
|
|
76
|
+
KeymanDeveloperProjectType.Keyboard; // Default is keyboard if missing
|
|
77
|
+
if (result.options.version == '1.0') {
|
|
78
|
+
this.transformFilesVersion10(project, result);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
result.populateFiles();
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
transformFilesVersion10(project, result) {
|
|
86
|
+
let ids = {};
|
|
87
|
+
for (let sourceFile of project.Files?.File) {
|
|
88
|
+
let file = new KeymanDeveloperProjectFile10(sourceFile.ID || '', (sourceFile.Filepath || '').replace(/\\/g, '/'), sourceFile.FileVersion || '', this.callbacks);
|
|
89
|
+
if (sourceFile.Details) {
|
|
90
|
+
file.details.copyright = sourceFile.Details.Copyright;
|
|
91
|
+
file.details.name = sourceFile.Details.Name;
|
|
92
|
+
file.details.message = sourceFile.Details.Message;
|
|
93
|
+
file.details.version = sourceFile.Details.Version;
|
|
94
|
+
}
|
|
95
|
+
if (sourceFile.ParentFileID && ids[sourceFile.ParentFileID]) {
|
|
96
|
+
ids[sourceFile.ParentFileID].childFiles.push(file);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
result.files.push(file);
|
|
100
|
+
ids[file.id] = file;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* xml2js will not place single-entry objects into arrays.
|
|
106
|
+
* Easiest way to fix this is to box them ourselves as needed
|
|
107
|
+
* @param source KVKSourceFile
|
|
108
|
+
*/
|
|
109
|
+
boxArrays(source) {
|
|
110
|
+
if (!source.KeymanDeveloperProject) {
|
|
111
|
+
return source;
|
|
112
|
+
}
|
|
113
|
+
if (!source.KeymanDeveloperProject.Files || typeof source.KeymanDeveloperProject.Files == 'string') {
|
|
114
|
+
source.KeymanDeveloperProject.Files = { File: [] };
|
|
115
|
+
}
|
|
116
|
+
boxXmlArray(source.KeymanDeveloperProject.Files, 'File');
|
|
117
|
+
return source;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
120
|
//# sourceMappingURL=kpj-file-reader.js.map
|
|
121
|
-
//# debugId=
|
|
121
|
+
//# debugId=1f1f7b7e-d70d-5354-b3c3-9f983dbd3c06
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kpj-file-reader.js","sources":["../../../src/kpj/kpj-file-reader.ts"],"sourceRoot":"","names":[],"mappings":";;AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,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
|
-
KeymanDeveloperProject: KPJFileProject;
|
|
3
|
-
}
|
|
4
|
-
export interface KPJFileProject {
|
|
5
|
-
Options?: KPJFileOptions;
|
|
6
|
-
Files?: KPJFileFiles;
|
|
7
|
-
}
|
|
8
|
-
export interface KPJFileOptions {
|
|
9
|
-
BuildPath?: string;
|
|
10
|
-
SourcePath?: string;
|
|
11
|
-
CompilerWarningsAsErrors?: string;
|
|
12
|
-
WarnDeprecatedCode?: string;
|
|
13
|
-
SkipMetadataFiles?: string;
|
|
14
|
-
CheckFilenameConventions?: string;
|
|
15
|
-
ProjectType?: 'keyboard' | 'lexicalmodel';
|
|
16
|
-
Version?: '1.0' | '2.0';
|
|
17
|
-
}
|
|
18
|
-
export interface KPJFileFiles {
|
|
19
|
-
File?: KPJFileFile[];
|
|
20
|
-
}
|
|
21
|
-
export interface KPJFileFile {
|
|
22
|
-
ID?: string;
|
|
23
|
-
Filename?: string;
|
|
24
|
-
Filepath?: string;
|
|
25
|
-
FileVersion?: string;
|
|
26
|
-
FileType?: string;
|
|
27
|
-
Details?: KPJFileFileDetail_Kmn & KPJFileFileDetail_Kps;
|
|
28
|
-
ParentFileID?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface KPJFileFileDetail_Kmn {
|
|
31
|
-
Name?: string;
|
|
32
|
-
Copyright?: string;
|
|
33
|
-
Message?: string;
|
|
34
|
-
}
|
|
35
|
-
export interface KPJFileFileDetail_Kps {
|
|
36
|
-
Name?: string;
|
|
37
|
-
Copyright?: string;
|
|
38
|
-
Version?: string;
|
|
39
|
-
}
|
|
1
|
+
export interface KPJFile {
|
|
2
|
+
KeymanDeveloperProject: KPJFileProject;
|
|
3
|
+
}
|
|
4
|
+
export interface KPJFileProject {
|
|
5
|
+
Options?: KPJFileOptions;
|
|
6
|
+
Files?: KPJFileFiles;
|
|
7
|
+
}
|
|
8
|
+
export interface KPJFileOptions {
|
|
9
|
+
BuildPath?: string;
|
|
10
|
+
SourcePath?: string;
|
|
11
|
+
CompilerWarningsAsErrors?: string;
|
|
12
|
+
WarnDeprecatedCode?: string;
|
|
13
|
+
SkipMetadataFiles?: string;
|
|
14
|
+
CheckFilenameConventions?: string;
|
|
15
|
+
ProjectType?: 'keyboard' | 'lexicalmodel';
|
|
16
|
+
Version?: '1.0' | '2.0';
|
|
17
|
+
}
|
|
18
|
+
export interface KPJFileFiles {
|
|
19
|
+
File?: KPJFileFile[];
|
|
20
|
+
}
|
|
21
|
+
export interface KPJFileFile {
|
|
22
|
+
ID?: string;
|
|
23
|
+
Filename?: string;
|
|
24
|
+
Filepath?: string;
|
|
25
|
+
FileVersion?: string;
|
|
26
|
+
FileType?: string;
|
|
27
|
+
Details?: KPJFileFileDetail_Kmn & KPJFileFileDetail_Kps;
|
|
28
|
+
ParentFileID?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface KPJFileFileDetail_Kmn {
|
|
31
|
+
Name?: string;
|
|
32
|
+
Copyright?: string;
|
|
33
|
+
Message?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface KPJFileFileDetail_Kps {
|
|
36
|
+
Name?: string;
|
|
37
|
+
Copyright?: string;
|
|
38
|
+
Version?: string;
|
|
39
|
+
}
|
|
40
40
|
//# sourceMappingURL=kpj-file.d.ts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Keyman Developer Project File
|
|
3
|
-
*/
|
|
1
|
+
/*
|
|
2
|
+
* Keyman Developer Project File
|
|
3
|
+
*/
|
|
4
4
|
|
|
5
5
|
!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]="834d9296-d0ce-510c-8dae-d4720d3aea8d")}catch(e){}}();
|
|
6
|
-
;
|
|
7
|
-
;
|
|
8
|
-
;
|
|
9
|
-
;
|
|
10
|
-
;
|
|
11
|
-
;
|
|
12
|
-
export {};
|
|
6
|
+
;
|
|
7
|
+
;
|
|
8
|
+
;
|
|
9
|
+
;
|
|
10
|
+
;
|
|
11
|
+
;
|
|
12
|
+
export {};
|
|
13
13
|
//# sourceMappingURL=kpj-file.js.map
|
|
14
14
|
//# debugId=834d9296-d0ce-510c-8dae-d4720d3aea8d
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VisualKeyboard } from "./visual-keyboard.js";
|
|
2
|
-
export default class KvkFileReader {
|
|
3
|
-
read(source: Uint8Array): VisualKeyboard;
|
|
4
|
-
}
|
|
1
|
+
import { VisualKeyboard } from "./visual-keyboard.js";
|
|
2
|
+
export default class KvkFileReader {
|
|
3
|
+
read(source: Uint8Array): VisualKeyboard;
|
|
4
|
+
}
|
|
5
5
|
//# sourceMappingURL=kvk-file-reader.d.ts.map
|
|
@@ -1,39 +1,39 @@
|
|
|
1
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]="
|
|
3
|
-
import KVKFile, { BUILDER_KVK_HEADER_IDENTIFIER, BUILDER_KVK_HEADER_VERSION } from "./kvk-file.js";
|
|
4
|
-
import { VisualKeyboard } from "./visual-keyboard.js";
|
|
5
|
-
export default class KvkFileReader {
|
|
6
|
-
read(source) {
|
|
7
|
-
let binary;
|
|
8
|
-
let kvk = new KVKFile();
|
|
9
|
-
binary = kvk.KVK_FILE.fromBuffer(source);
|
|
10
|
-
if (binary.header.identifier != BUILDER_KVK_HEADER_IDENTIFIER ||
|
|
11
|
-
binary.header.version != BUILDER_KVK_HEADER_VERSION) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
let result = new VisualKeyboard();
|
|
15
|
-
result.header.version = binary.header.version;
|
|
16
|
-
result.header.flags = binary.header.flags;
|
|
17
|
-
result.header.associatedKeyboard = binary.header.associatedKeyboard.str;
|
|
18
|
-
result.header.ansiFont.name = binary.header.ansiFont.name.str;
|
|
19
|
-
result.header.ansiFont.size = binary.header.ansiFont.size;
|
|
20
|
-
result.header.unicodeFont.name = binary.header.unicodeFont.name.str;
|
|
21
|
-
result.header.unicodeFont.size = binary.header.unicodeFont.size;
|
|
22
|
-
for (let binaryKey of binary.keys) {
|
|
23
|
-
let key = {
|
|
24
|
-
flags: binaryKey.flags,
|
|
25
|
-
vkey: binaryKey.vkey,
|
|
26
|
-
shift: binaryKey.shift,
|
|
27
|
-
text: binaryKey.text.str
|
|
28
|
-
};
|
|
29
|
-
if (binaryKey.bitmapSize) {
|
|
30
|
-
key.bitmap = new Uint8Array(binaryKey.bitmapData);
|
|
31
|
-
}
|
|
32
|
-
result.keys.push(key);
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
;
|
|
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]="a6025f3e-714f-5262-9d8c-891e1bc17f16")}catch(e){}}();
|
|
3
|
+
import KVKFile, { BUILDER_KVK_HEADER_IDENTIFIER, BUILDER_KVK_HEADER_VERSION } from "./kvk-file.js";
|
|
4
|
+
import { VisualKeyboard } from "./visual-keyboard.js";
|
|
5
|
+
export default class KvkFileReader {
|
|
6
|
+
read(source) {
|
|
7
|
+
let binary;
|
|
8
|
+
let kvk = new KVKFile();
|
|
9
|
+
binary = kvk.KVK_FILE.fromBuffer(source);
|
|
10
|
+
if (binary.header.identifier != BUILDER_KVK_HEADER_IDENTIFIER ||
|
|
11
|
+
binary.header.version != BUILDER_KVK_HEADER_VERSION) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
let result = new VisualKeyboard();
|
|
15
|
+
result.header.version = binary.header.version;
|
|
16
|
+
result.header.flags = binary.header.flags;
|
|
17
|
+
result.header.associatedKeyboard = binary.header.associatedKeyboard.str;
|
|
18
|
+
result.header.ansiFont.name = binary.header.ansiFont.name.str;
|
|
19
|
+
result.header.ansiFont.size = binary.header.ansiFont.size;
|
|
20
|
+
result.header.unicodeFont.name = binary.header.unicodeFont.name.str;
|
|
21
|
+
result.header.unicodeFont.size = binary.header.unicodeFont.size;
|
|
22
|
+
for (let binaryKey of binary.keys) {
|
|
23
|
+
let key = {
|
|
24
|
+
flags: binaryKey.flags,
|
|
25
|
+
vkey: binaryKey.vkey,
|
|
26
|
+
shift: binaryKey.shift,
|
|
27
|
+
text: binaryKey.text.str
|
|
28
|
+
};
|
|
29
|
+
if (binaryKey.bitmapSize) {
|
|
30
|
+
key.bitmap = new Uint8Array(binaryKey.bitmapData);
|
|
31
|
+
}
|
|
32
|
+
result.keys.push(key);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
38
|
//# sourceMappingURL=kvk-file-reader.js.map
|
|
39
|
-
//# debugId=
|
|
39
|
+
//# debugId=a6025f3e-714f-5262-9d8c-891e1bc17f16
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kvk-file-reader.js","sources":["../../../src/kvk/kvk-file-reader.ts"],"sourceRoot":"","names":[],"mappings":";;AAAA,OAAO,OAAO,EAAE,EAAoB,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AACrH,OAAO,EAAE,cAAc,EAAqB,MAAM,sBAAsB,CAAC;AAEzE,MAAM,CAAC,OAAO,OAAO,aAAa;IACzB,IAAI,CAAC,MAAkB;QAC5B,IAAI,MAAwB,CAAC;QAC7B,IAAI,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzC,IAAG,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,6BAA6B;YACxD,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,0BAA0B,EAAE;
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E,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;QAChE,KAAI,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACjC,IAAI,GAAG,GAAsB;gBAC3B,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG;aACzB,CAAC;YACF,IAAG,SAAS,CAAC,UAAU,EAAE,CAAC;gBACxB,GAAG,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YACpD,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAAA,CAAC","debug_id":"a6025f3e-714f-5262-9d8c-891e1bc17f16"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { VisualKeyboard } from "./visual-keyboard.js";
|
|
2
|
-
export default class KvkFileWriter {
|
|
3
|
-
/**
|
|
4
|
-
* Writes the visual keyboard to a binary .kvk format byte array.
|
|
5
|
-
* @param source VisualKeyboard
|
|
6
|
-
* @returns Uint8Array, the .kvk file
|
|
7
|
-
*/
|
|
8
|
-
write(source: VisualKeyboard): Uint8Array;
|
|
9
|
-
private build;
|
|
10
|
-
/**
|
|
11
|
-
* Fills a kvk string from a source string. Note that the format includes both
|
|
12
|
-
* a length word and zero termination.
|
|
13
|
-
*
|
|
14
|
-
* @param str
|
|
15
|
-
* @param value
|
|
16
|
-
* @returns number
|
|
17
|
-
*/
|
|
18
|
-
private setString;
|
|
19
|
-
}
|
|
1
|
+
import { VisualKeyboard } from "./visual-keyboard.js";
|
|
2
|
+
export default class KvkFileWriter {
|
|
3
|
+
/**
|
|
4
|
+
* Writes the visual keyboard to a binary .kvk format byte array.
|
|
5
|
+
* @param source VisualKeyboard
|
|
6
|
+
* @returns Uint8Array, the .kvk file
|
|
7
|
+
*/
|
|
8
|
+
write(source: VisualKeyboard): Uint8Array;
|
|
9
|
+
private build;
|
|
10
|
+
/**
|
|
11
|
+
* Fills a kvk string from a source string. Note that the format includes both
|
|
12
|
+
* a length word and zero termination.
|
|
13
|
+
*
|
|
14
|
+
* @param str
|
|
15
|
+
* @param value
|
|
16
|
+
* @returns number
|
|
17
|
+
*/
|
|
18
|
+
private setString;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=kvk-file-writer.d.ts.map
|