@keymanapp/common-types 17.0.85-alpha → 17.0.87-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/package.json +5 -2
- package/build/tsconfig.tsbuildinfo +0 -1
- package/build.sh +0 -86
- package/src/consts/virtual-key-constants.ts +0 -257
- package/src/keyman-touch-layout/keyman-touch-layout-file-reader.ts +0 -81
- package/src/keyman-touch-layout/keyman-touch-layout-file-writer.ts +0 -84
- package/src/keyman-touch-layout/keyman-touch-layout-file.ts +0 -87
- package/src/kmx/element-string.ts +0 -79
- package/src/kmx/kmx-builder.ts +0 -287
- package/src/kmx/kmx-plus-builder/build-disp.ts +0 -46
- package/src/kmx/kmx-plus-builder/build-elem.ts +0 -103
- package/src/kmx/kmx-plus-builder/build-keys.ts +0 -175
- package/src/kmx/kmx-plus-builder/build-layr.ts +0 -154
- package/src/kmx/kmx-plus-builder/build-list.ts +0 -95
- package/src/kmx/kmx-plus-builder/build-loca.ts +0 -34
- package/src/kmx/kmx-plus-builder/build-meta.ts +0 -37
- package/src/kmx/kmx-plus-builder/build-name.ts +0 -37
- package/src/kmx/kmx-plus-builder/build-ordr.ts +0 -45
- package/src/kmx/kmx-plus-builder/build-sect.ts +0 -31
- package/src/kmx/kmx-plus-builder/build-strs.ts +0 -58
- package/src/kmx/kmx-plus-builder/build-tran.ts +0 -50
- package/src/kmx/kmx-plus-builder/build-vkey.ts +0 -43
- package/src/kmx/kmx-plus-builder/builder-section.ts +0 -6
- package/src/kmx/kmx-plus-builder/kmx-plus-builder.ts +0 -190
- package/src/kmx/kmx-plus.ts +0 -692
- package/src/kmx/kmx.ts +0 -360
- package/src/kmx/string-list.ts +0 -74
- package/src/kpj/keyman-developer-project.ts +0 -155
- package/src/kpj/kpj-file-reader.ts +0 -103
- package/src/kpj/kpj-file.ts +0 -52
- package/src/kvk/kvk-file-reader.ts +0 -34
- package/src/kvk/kvk-file-writer.ts +0 -72
- package/src/kvk/kvk-file.ts +0 -122
- package/src/kvk/kvks-file-reader.ts +0 -164
- package/src/kvk/kvks-file-writer.ts +0 -113
- package/src/kvk/kvks-file.ts +0 -53
- package/src/kvk/visual-keyboard.ts +0 -80
- package/src/ldml-keyboard/ldml-keyboard-testdata-xml.ts +0 -74
- package/src/ldml-keyboard/ldml-keyboard-xml-reader.ts +0 -387
- package/src/ldml-keyboard/ldml-keyboard-xml.ts +0 -177
- package/src/main.ts +0 -27
- package/src/restructure.d.ts +0 -2
- package/src/util/common-events.ts +0 -50
- package/src/util/compiler-interfaces.ts +0 -54
- package/src/util/util.ts +0 -68
- package/test/fixtures/import-minimal.xml +0 -8
- package/test/fixtures/import-minimal1.xml +0 -11
- package/test/fixtures/import-minimal2.xml +0 -11
- package/test/fixtures/import-symbols.xml +0 -13
- package/test/fixtures/invalid-conforms-to.xml +0 -19
- package/test/fixtures/invalid-import-base.xml +0 -16
- package/test/fixtures/invalid-import-path.xml +0 -16
- package/test/fixtures/invalid-import-readfail.xml +0 -16
- package/test/fixtures/invalid-import-wrongroot.xml +0 -16
- package/test/fixtures/invalid-structure-per-dtd.xml +0 -8
- package/test/fixtures/keyman-touch-layout/khmer_angkor.keyman-touch-layout +0 -1950
- package/test/fixtures/keyman-touch-layout/legacy.keyman-touch-layout +0 -36
- package/test/fixtures/kpj/khmer_angkor.kpj +0 -187
- package/test/fixtures/kvk/khmer_angkor.kvk +0 -0
- package/test/fixtures/kvk/khmer_angkor.kvks +0 -206
- package/test/fixtures/test-fr.xml +0 -22
- package/test/helpers/index.ts +0 -39
- package/test/helpers/reader-callback-test.ts +0 -199
- package/test/keyman-touch-layout/test-keyman-touch-layout-file-reader.ts +0 -71
- package/test/keyman-touch-layout/test-keyman-touch-layout-round-trip.ts +0 -35
- package/test/kpj/test-kpj-file-reader.ts +0 -123
- package/test/kvk/test-kvk-file.ts +0 -15
- package/test/kvk/test-kvk-round-trip.ts +0 -87
- package/test/kvk/test-kvk-utils.ts +0 -24
- package/test/kvk/test-kvks-file.ts +0 -45
- package/test/ldml-keyboard/test-ldml-keyboard-testdata-reader.ts +0 -51
- package/test/ldml-keyboard/test-ldml-keyboard-xml-reader.ts +0 -131
- package/test/tsconfig.json +0 -21
- package/test/util/test-unescape.ts +0 -38
- package/tsconfig.json +0 -17
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { LKKey } from './../../src/ldml-keyboard/ldml-keyboard-xml.js';
|
|
2
|
-
import 'mocha';
|
|
3
|
-
import {assert} from 'chai';
|
|
4
|
-
import { CommonTypesMessages } from '../../src/util/common-events.js';
|
|
5
|
-
import { testReaderCases } from '../helpers/reader-callback-test.js';
|
|
6
|
-
|
|
7
|
-
function pluckKeysFromKeybag(keys: LKKey[], ids: string[]) {
|
|
8
|
-
return keys.filter(({id}) => ids.indexOf(id) !== -1);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
describe('ldml keyboard xml reader tests', function () {
|
|
12
|
-
this.slow(500); // 0.5 sec -- json schema validation takes a while
|
|
13
|
-
|
|
14
|
-
testReaderCases([
|
|
15
|
-
{
|
|
16
|
-
subpath: 'invalid-structure-per-dtd.xml',
|
|
17
|
-
errors: [CommonTypesMessages.Error_SchemaValidationError({
|
|
18
|
-
instancePath: '/keyboard',
|
|
19
|
-
keyword: 'required',
|
|
20
|
-
message: `must have required property 'names'`,
|
|
21
|
-
params: 'missingProperty="names"',
|
|
22
|
-
})],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
subpath: 'invalid-conforms-to.xml',
|
|
26
|
-
errors: [CommonTypesMessages.Error_SchemaValidationError({
|
|
27
|
-
instancePath: '/keyboard/conformsTo',
|
|
28
|
-
keyword: 'enum',
|
|
29
|
-
message: `must be equal to one of the allowed values`,
|
|
30
|
-
params: 'allowedValues="techpreview"',
|
|
31
|
-
})],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
subpath: 'import-minimal.xml',
|
|
35
|
-
callback: (data, source, subpath, callbacks) => {
|
|
36
|
-
assert.ok(source?.keyboard?.keys);
|
|
37
|
-
const k = pluckKeysFromKeybag(source?.keyboard?.keys.key, ['a', 'b', 'c']);
|
|
38
|
-
assert.sameDeepOrderedMembers(k, [
|
|
39
|
-
{id: 'a', to: 'a'},
|
|
40
|
-
{id: 'b', to: 'b'},
|
|
41
|
-
{id: 'c', to: 'c'},
|
|
42
|
-
]);
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
subpath: 'import-minimal1.xml',
|
|
47
|
-
callback: (data, source, subpath, callbacks) => {
|
|
48
|
-
assert.ok(source?.keyboard?.keys);
|
|
49
|
-
const k = pluckKeysFromKeybag(source?.keyboard?.keys.key, ['a', 'b', 'c']);
|
|
50
|
-
assert.sameDeepOrderedMembers(k, [
|
|
51
|
-
{id: 'a', to: 'a'},
|
|
52
|
-
{id: 'b', to: 'b'},
|
|
53
|
-
{id: 'c', to: 'c'},
|
|
54
|
-
]);
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
subpath: 'import-minimal2.xml',
|
|
59
|
-
callback: (data, source, subpath, callbacks) => {
|
|
60
|
-
assert.ok(source?.keyboard?.keys);
|
|
61
|
-
const k = pluckKeysFromKeybag(source?.keyboard?.keys.key, ['a', 'b', 'c']);
|
|
62
|
-
assert.sameDeepOrderedMembers(k, [
|
|
63
|
-
{id: 'a', to: 'a'},
|
|
64
|
-
{id: 'b', to: 'b'},
|
|
65
|
-
{id: 'c', to: 'c'},
|
|
66
|
-
{id: 'a', to: 'å'}, // overridden
|
|
67
|
-
]);
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
subpath: 'import-symbols.xml',
|
|
72
|
-
callback: (data, source, subpath, callbacks) => {
|
|
73
|
-
assert.ok(source?.keyboard?.keys);
|
|
74
|
-
const k = pluckKeysFromKeybag(source?.keyboard?.keys.key, ['a', 'b', 'c', 'zz', 'hash', 'hyphen']);
|
|
75
|
-
assert.sameDeepOrderedMembers(k, [
|
|
76
|
-
{id: 'a', to: 'a'}, // implied
|
|
77
|
-
{id: 'b', to: 'b'},
|
|
78
|
-
{id: 'c', to: 'c'},
|
|
79
|
-
{id: 'hash', to: '#'}, // imported symbols
|
|
80
|
-
{id: 'hyphen', to: '-'},
|
|
81
|
-
{id: 'zz', to: 'zz'}, // new key
|
|
82
|
-
{id: 'hash', to: '##'}, // override
|
|
83
|
-
]);
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
subpath: 'invalid-import-base.xml',
|
|
88
|
-
loadfail: true,
|
|
89
|
-
errors: [
|
|
90
|
-
CommonTypesMessages.Error_ImportInvalidBase({
|
|
91
|
-
base: 'SOME_INVALID_BASE',
|
|
92
|
-
path: 'B',
|
|
93
|
-
subtag: 'C'
|
|
94
|
-
}),
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
subpath: 'invalid-import-path.xml',
|
|
99
|
-
loadfail: true,
|
|
100
|
-
errors: [
|
|
101
|
-
CommonTypesMessages.Error_ImportInvalidPath({
|
|
102
|
-
base: null,
|
|
103
|
-
path: 'techpreview/too/many/slashes/leading/to/nothing-Zxxx-does-not-exist.xml',
|
|
104
|
-
subtag: null,
|
|
105
|
-
}),
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
subpath: 'invalid-import-readfail.xml',
|
|
110
|
-
loadfail: true,
|
|
111
|
-
errors: [
|
|
112
|
-
CommonTypesMessages.Error_ImportReadFail({
|
|
113
|
-
base: null,
|
|
114
|
-
path: 'techpreview/none-Zxxx-does-not-exist.xml',
|
|
115
|
-
subtag: null,
|
|
116
|
-
}),
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
subpath: 'invalid-import-wrongroot.xml',
|
|
121
|
-
loadfail: true,
|
|
122
|
-
errors: [
|
|
123
|
-
CommonTypesMessages.Error_ImportWrongRoot({
|
|
124
|
-
base: null,
|
|
125
|
-
path: 'techpreview/keys-Zyyy-punctuation.xml',
|
|
126
|
-
subtag: 'names',
|
|
127
|
-
}),
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
]);
|
|
131
|
-
});
|
package/test/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.esm-base.json",
|
|
3
|
-
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"rootDir": ".",
|
|
6
|
-
"rootDirs": ["./", "../src/"],
|
|
7
|
-
"outDir": "../build/test",
|
|
8
|
-
"baseUrl": ".",
|
|
9
|
-
"strictNullChecks": false, // TODO: get rid of this as some point
|
|
10
|
-
"allowSyntheticDefaultImports": true // for ajv
|
|
11
|
-
},
|
|
12
|
-
"include": [
|
|
13
|
-
"**/test-*.ts",
|
|
14
|
-
"./helpers/*.ts",
|
|
15
|
-
],
|
|
16
|
-
"references": [
|
|
17
|
-
{ "path": "../../keyman-version/tsconfig.esm.json" },
|
|
18
|
-
{ "path": "../../../../core/include/ldml/"},
|
|
19
|
-
{ "path": "../" },
|
|
20
|
-
]
|
|
21
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import 'mocha';
|
|
2
|
-
import {assert} from 'chai';
|
|
3
|
-
import {unescapeString, UnescapeError} from '../../src/util/util.js';
|
|
4
|
-
|
|
5
|
-
describe('test unescapeString()', function() {
|
|
6
|
-
it("should correctly handle multi strings", function() {
|
|
7
|
-
assert.equal(unescapeString('Sa\\u{0127 0127}a'), 'Saħħa');
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it("should pass through falsy strings", function() {
|
|
11
|
-
assert.equal(unescapeString(''), '');
|
|
12
|
-
assert.equal(unescapeString(null), null);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should pass through non-escaped strings", function() {
|
|
16
|
-
assert.equal(unescapeString('abc'), 'abc');
|
|
17
|
-
assert.equal(unescapeString('\\u{abc'), '\\u{abc');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("should correctly unescape strings", function() {
|
|
21
|
-
assert.equal(unescapeString('\\u{0127}'), 'ħ');
|
|
22
|
-
assert.equal(unescapeString('\\u{0127}==\\u{0127}'), 'ħ==ħ');
|
|
23
|
-
assert.equal(unescapeString('Q\\u{0127}'), 'Qħ');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should correctly handle 1..6 char escapes", function() {
|
|
27
|
-
assert.equal(unescapeString('\\u{9}'), '\u{0009}'); // TAB
|
|
28
|
-
assert.equal(unescapeString('\\u{4a}'), '\u{004a}'); // J
|
|
29
|
-
assert.equal(unescapeString('\\u{3c8}'), '\u{03c8}'); // ψ
|
|
30
|
-
assert.equal(unescapeString('\\u{304B}'), '\u{304b}'); // か
|
|
31
|
-
assert.equal(unescapeString('\\u{1e109}'), '\u{1e109}'); // 𞄉
|
|
32
|
-
assert.equal(unescapeString('\\u{10fff0}'), '\u{10fff0}'); // Plane 16 Private Use
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("should throw UnescapeError on invalid escapes", function() {
|
|
36
|
-
assert.throws(() => unescapeString('\\u{110000}'), UnescapeError);
|
|
37
|
-
});
|
|
38
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.esm-base.json",
|
|
3
|
-
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "build/src/",
|
|
6
|
-
"rootDir": "src/",
|
|
7
|
-
"baseUrl": ".",
|
|
8
|
-
"allowSyntheticDefaultImports": true // for ajv
|
|
9
|
-
},
|
|
10
|
-
"include": [
|
|
11
|
-
"src/**/*.ts"
|
|
12
|
-
],
|
|
13
|
-
"references": [
|
|
14
|
-
{ "path": "../keyman-version/tsconfig.esm.json" },
|
|
15
|
-
{ "path": "../../../core/include/ldml/tsconfig.json"},
|
|
16
|
-
]
|
|
17
|
-
}
|