@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
package/src/kmx/kmx-plus.ts
DELETED
|
@@ -1,692 +0,0 @@
|
|
|
1
|
-
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
|
2
|
-
import * as r from 'restructure';
|
|
3
|
-
import { ElementString } from './element-string.js';
|
|
4
|
-
import { ListItem } from './string-list.js';
|
|
5
|
-
import { unescapeString } from '../util/util.js';
|
|
6
|
-
import { KMXFile } from './kmx.js';
|
|
7
|
-
|
|
8
|
-
// Implementation of file structures from /core/src/ldml/C7043_ldml.md
|
|
9
|
-
// Writer in kmx-builder.ts
|
|
10
|
-
// Reader in kmx-loader.ts
|
|
11
|
-
|
|
12
|
-
export class Section {
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export class GlobalSections {
|
|
16
|
-
// These sections are used by other sections during compilation
|
|
17
|
-
strs: Strs;
|
|
18
|
-
elem: Elem;
|
|
19
|
-
list: List;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// 'sect'
|
|
23
|
-
|
|
24
|
-
export class Sect extends Section {};
|
|
25
|
-
|
|
26
|
-
// 'bksp' -- see 'tran'
|
|
27
|
-
|
|
28
|
-
// 'elem'
|
|
29
|
-
|
|
30
|
-
export class Elem extends Section {
|
|
31
|
-
strings: ElementString[] = [];
|
|
32
|
-
constructor(strs: Strs) {
|
|
33
|
-
super();
|
|
34
|
-
this.strings.push(new ElementString(strs, '')); // C7043: null element string
|
|
35
|
-
}
|
|
36
|
-
allocElementString(strs: Strs, source: string, order?: string, tertiary?: string, tertiary_base?: string, prebase?: string): ElementString {
|
|
37
|
-
let s = new ElementString(strs, source, order, tertiary, tertiary_base, prebase);
|
|
38
|
-
let result = this.strings.find(item => item.isEqual(s));
|
|
39
|
-
if(result === undefined) {
|
|
40
|
-
result = s;
|
|
41
|
-
this.strings.push(result);
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// 'finl' -- see 'tran'
|
|
48
|
-
|
|
49
|
-
// 'keys' is now `keys2.kmap`
|
|
50
|
-
|
|
51
|
-
// 'loca'
|
|
52
|
-
|
|
53
|
-
export class Loca extends Section {
|
|
54
|
-
locales: StrsItem[] = [];
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// 'meta'
|
|
58
|
-
|
|
59
|
-
export enum KeyboardSettings {
|
|
60
|
-
none = 0,
|
|
61
|
-
fallback = constants.meta_settings_fallback_omit,
|
|
62
|
-
transformFailure = constants.meta_settings_transformFailure_omit,
|
|
63
|
-
transformPartial = constants.meta_settings_transformPartial_hide,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export enum Meta_NormalizationForm { NFC='NFC', NFD='NFD', other='other' };
|
|
67
|
-
|
|
68
|
-
export class Meta extends Section {
|
|
69
|
-
author: StrsItem;
|
|
70
|
-
conform: StrsItem;
|
|
71
|
-
layout: StrsItem;
|
|
72
|
-
normalization: StrsItem;
|
|
73
|
-
indicator: StrsItem;
|
|
74
|
-
version: StrsItem; // semver version string, defaults to "0"
|
|
75
|
-
settings: KeyboardSettings;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// 'name'
|
|
79
|
-
|
|
80
|
-
export class Name extends Section {
|
|
81
|
-
names: StrsItem[] = [];
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// 'ordr'
|
|
85
|
-
|
|
86
|
-
export class OrdrItem {
|
|
87
|
-
elements: ElementString;
|
|
88
|
-
before: ElementString;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export class Ordr extends Section {
|
|
92
|
-
items: OrdrItem[] = [];
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// 'strs'
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* A string item in memory. This will be replaced with an index
|
|
99
|
-
* into the string table at finalization.
|
|
100
|
-
*/
|
|
101
|
-
export class StrsItem {
|
|
102
|
-
readonly value: string;
|
|
103
|
-
constructor(value: string) {
|
|
104
|
-
this.value = value;
|
|
105
|
-
}
|
|
106
|
-
compareTo(o: StrsItem): number {
|
|
107
|
-
return StrsItem.binaryStringCompare(this.value, o.value);
|
|
108
|
-
}
|
|
109
|
-
static binaryStringCompare(a: string, b: string): number {
|
|
110
|
-
// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-islessthan
|
|
111
|
-
if(typeof a != 'string' || typeof b != 'string') {
|
|
112
|
-
throw new Error('binaryStringCompare: inputs must be strings');
|
|
113
|
-
}
|
|
114
|
-
if(a < b) return -1;
|
|
115
|
-
if(a > b) return 1;
|
|
116
|
-
return 0;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export class Strs extends Section {
|
|
121
|
-
strings: StrsItem[] = [ new StrsItem('') ]; // C7043: The null string is always requierd
|
|
122
|
-
/**
|
|
123
|
-
* Allocate a StrsItem given the string, unescaping if necessary.
|
|
124
|
-
* @param s escaped string
|
|
125
|
-
* @returns
|
|
126
|
-
*/
|
|
127
|
-
allocAndUnescapeString(s?: string): StrsItem {
|
|
128
|
-
return this.allocString(unescapeString(s));
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Allocate a StrsItem given the string.
|
|
132
|
-
* @param s string
|
|
133
|
-
* @returns
|
|
134
|
-
*/
|
|
135
|
-
allocString(s?: string): StrsItem {
|
|
136
|
-
if(s === undefined || s === null) {
|
|
137
|
-
// undefined or null are always equivalent to empty string, see C7043
|
|
138
|
-
s = '';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if(typeof s !== 'string') {
|
|
142
|
-
throw new Error('alloc_string: s must be a string, undefined, or null.');
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
let result = this.strings.find(item => item.value === s);
|
|
146
|
-
if(result === undefined) {
|
|
147
|
-
result = new StrsItem(s);
|
|
148
|
-
this.strings.push(result);
|
|
149
|
-
}
|
|
150
|
-
return result;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// 'tran'
|
|
155
|
-
|
|
156
|
-
export enum TranItemFlags {
|
|
157
|
-
none = 0,
|
|
158
|
-
error = constants.tran_flags_error,
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export class TranItem extends Section {
|
|
162
|
-
from: ElementString;
|
|
163
|
-
to: StrsItem;
|
|
164
|
-
before: ElementString;
|
|
165
|
-
flags: TranItemFlags;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export class Tran extends Section {
|
|
169
|
-
items: TranItem[] = [];
|
|
170
|
-
get id() {
|
|
171
|
-
return constants.section.tran;
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
// alias types for 'bksp', 'finl'
|
|
176
|
-
|
|
177
|
-
export class Bksp extends Tran {
|
|
178
|
-
override get id() {
|
|
179
|
-
return constants.section.bksp;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
export class BkspItem extends TranItem {};
|
|
183
|
-
export type BkspItemFlags = TranItemFlags;
|
|
184
|
-
export const BkspItemFlags = TranItemFlags;
|
|
185
|
-
|
|
186
|
-
export class Finl extends Tran {
|
|
187
|
-
override get id() {
|
|
188
|
-
return constants.section.finl;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
export class FinlItem extends TranItem {};
|
|
192
|
-
export type FinlItemFlags = TranItemFlags;
|
|
193
|
-
export const FinlItemFlags = TranItemFlags;
|
|
194
|
-
|
|
195
|
-
// 'vkey'
|
|
196
|
-
|
|
197
|
-
export class VkeyItem {
|
|
198
|
-
vkey: number;
|
|
199
|
-
target: number;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export class Vkey extends Section {
|
|
203
|
-
vkeys: VkeyItem[] = [];
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
// 'disp'
|
|
207
|
-
export class DispItem {
|
|
208
|
-
to: StrsItem;
|
|
209
|
-
display: StrsItem;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export class Disp extends Section {
|
|
213
|
-
baseCharacter: StrsItem;
|
|
214
|
-
disps: DispItem[] = [];
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
// 'layr'
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* In-memory `<layers>`
|
|
221
|
-
*/
|
|
222
|
-
export class LayrList {
|
|
223
|
-
hardware: number;
|
|
224
|
-
layers: LayrEntry[] = [];
|
|
225
|
-
minDeviceWidth: number; // millimeters
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* In-memory `<layer>`
|
|
230
|
-
*/
|
|
231
|
-
export class LayrEntry {
|
|
232
|
-
id: StrsItem;
|
|
233
|
-
mod: number;
|
|
234
|
-
rows: LayrRow[] = [];
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* In-memory `<row>`
|
|
239
|
-
*/
|
|
240
|
-
export class LayrRow {
|
|
241
|
-
keys: StrsItem[] = [];
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
export class Layr extends Section {
|
|
245
|
-
lists: LayrList[] = [];
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export class KeysKeys {
|
|
249
|
-
flags: number;
|
|
250
|
-
flicks: string; // for in-memory only
|
|
251
|
-
id: StrsItem;
|
|
252
|
-
longPress: ListItem;
|
|
253
|
-
longPressDefault: StrsItem;
|
|
254
|
-
multiTap: ListItem;
|
|
255
|
-
switch: StrsItem;
|
|
256
|
-
to: StrsItem;
|
|
257
|
-
width: number;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
export class KeysKmap {
|
|
262
|
-
vkey: number;
|
|
263
|
-
mod: number;
|
|
264
|
-
key: string; // for in-memory only
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
export class KeysFlicks {
|
|
268
|
-
flicks: KeysFlick[] = [];
|
|
269
|
-
id: StrsItem;
|
|
270
|
-
compareTo(b: KeysFlicks): number {
|
|
271
|
-
return this.id.compareTo(b.id);
|
|
272
|
-
}
|
|
273
|
-
constructor(id: StrsItem) {
|
|
274
|
-
this.id = id;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export class KeysFlick {
|
|
279
|
-
directions: ListItem;
|
|
280
|
-
flags: number;
|
|
281
|
-
to: StrsItem;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
export class Keys extends Section {
|
|
285
|
-
keys: KeysKeys[] = [];
|
|
286
|
-
flicks: KeysFlicks[] = [];
|
|
287
|
-
kmap: KeysKmap[] = [];
|
|
288
|
-
constructor(strs: Strs) {
|
|
289
|
-
super();
|
|
290
|
-
let nullFlicks = new KeysFlicks(strs.allocString(''));
|
|
291
|
-
this.flicks.push(nullFlicks); // C7043: null element string
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export class List extends Section {
|
|
296
|
-
/**
|
|
297
|
-
* Allocate a list from a space-separated list of items.
|
|
298
|
-
* Note that passing undefined or null or `''` will
|
|
299
|
-
* end up being the same as the empty list `[]`
|
|
300
|
-
* @param strs Strs section for allocation
|
|
301
|
-
* @param s space-separated list of items
|
|
302
|
-
* @returns a List object
|
|
303
|
-
*/
|
|
304
|
-
allocListFromSpaces(strs: Strs, s?: string): ListItem {
|
|
305
|
-
s = s ?? '';
|
|
306
|
-
return this.allocList(strs, s.split(' '));
|
|
307
|
-
}
|
|
308
|
-
allocListFromEscapedSpaces(strs: Strs, s?: string): ListItem {
|
|
309
|
-
if(s === undefined || s === null) {
|
|
310
|
-
s = '';
|
|
311
|
-
}
|
|
312
|
-
return this.allocList(strs, s.split(' ').map(unescapeString));
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Return a List object referring to the string list.
|
|
316
|
-
* Note that a falsy list, or a list containing only an empty string
|
|
317
|
-
* `['']` will be stored as an empty list `[]`.
|
|
318
|
-
* @param strs Strs section for allocation
|
|
319
|
-
* @param s string list to allocate
|
|
320
|
-
* @returns
|
|
321
|
-
*/
|
|
322
|
-
allocList(strs: Strs, s?: string[]): ListItem {
|
|
323
|
-
// Special case the 'null' list for [] or ['']
|
|
324
|
-
if (!s || (s.length === 1 && s[0] === '')) {
|
|
325
|
-
return this.lists[0];
|
|
326
|
-
}
|
|
327
|
-
let result = this.lists.find(item => item.isEqual(s));
|
|
328
|
-
if(result === undefined) {
|
|
329
|
-
// allocate a new ListItem
|
|
330
|
-
result = new ListItem(strs, s);
|
|
331
|
-
this.lists.push(result);
|
|
332
|
-
}
|
|
333
|
-
return result;
|
|
334
|
-
}
|
|
335
|
-
constructor(strs: Strs) {
|
|
336
|
-
super();
|
|
337
|
-
this.lists.push(new ListItem(strs, [])); // C7043: null element string
|
|
338
|
-
}
|
|
339
|
-
lists: ListItem[] = [];
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
export { ListItem as ListItem };
|
|
343
|
-
|
|
344
|
-
export interface KMXPlusData {
|
|
345
|
-
sect?: Strs; // sect is ignored in-memory
|
|
346
|
-
bksp?: Bksp;
|
|
347
|
-
disp?: Disp;
|
|
348
|
-
elem?: Elem; // elem is ignored in-memory
|
|
349
|
-
finl?: Finl;
|
|
350
|
-
keys?: Keys;
|
|
351
|
-
layr?: Layr;
|
|
352
|
-
list?: List; // list is ignored in-memory
|
|
353
|
-
loca?: Loca;
|
|
354
|
-
meta?: Meta;
|
|
355
|
-
name?: Name;
|
|
356
|
-
ordr?: Ordr;
|
|
357
|
-
strs?: Strs; // strs is ignored in-memory
|
|
358
|
-
tran?: Tran;
|
|
359
|
-
vkey?: Vkey;
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
export class KMXPlusFile extends KMXFile {
|
|
363
|
-
|
|
364
|
-
/* KMXPlus file structures */
|
|
365
|
-
|
|
366
|
-
public readonly COMP_PLUS_SECT_ITEM: any;
|
|
367
|
-
public readonly COMP_PLUS_SECT: any;
|
|
368
|
-
|
|
369
|
-
// COMP_PLUS_BKSP == COMP_PLUS_TRAN
|
|
370
|
-
public readonly COMP_PLUS_BKSP_ITEM: any;
|
|
371
|
-
public readonly COMP_PLUS_BKSP: any;
|
|
372
|
-
|
|
373
|
-
public readonly COMP_PLUS_DISP_ITEM: any;
|
|
374
|
-
public readonly COMP_PLUS_DISP: any;
|
|
375
|
-
|
|
376
|
-
public readonly COMP_PLUS_ELEM_ELEMENT: any;
|
|
377
|
-
public readonly COMP_PLUS_ELEM_STRING: any;
|
|
378
|
-
public readonly COMP_PLUS_ELEM: any;
|
|
379
|
-
|
|
380
|
-
// COMP_PLUS_FINL == COMP_PLUS_TRAN
|
|
381
|
-
public readonly COMP_PLUS_FINL_ITEM: any;
|
|
382
|
-
public readonly COMP_PLUS_FINL: any;
|
|
383
|
-
|
|
384
|
-
// COMP_PLUS_KEYS is now COMP_PLUS_KEYS_KMAP
|
|
385
|
-
|
|
386
|
-
public readonly COMP_PLUS_LAYR_ENTRY: any;
|
|
387
|
-
public readonly COMP_PLUS_LAYR_KEY: any;
|
|
388
|
-
public readonly COMP_PLUS_LAYR_LIST: any;
|
|
389
|
-
public readonly COMP_PLUS_LAYR_ROW: any;
|
|
390
|
-
public readonly COMP_PLUS_LAYR: any;
|
|
391
|
-
|
|
392
|
-
public readonly COMP_PLUS_KEYS_FLICK: any;
|
|
393
|
-
public readonly COMP_PLUS_KEYS_FLICKS: any;
|
|
394
|
-
public readonly COMP_PLUS_KEYS_KEY: any;
|
|
395
|
-
public readonly COMP_PLUS_KEYS_KMAP: any;
|
|
396
|
-
public readonly COMP_PLUS_KEYS: any;
|
|
397
|
-
|
|
398
|
-
public readonly COMP_PLUS_LIST_LIST: any;
|
|
399
|
-
public readonly COMP_PLUS_LIST_INDEX: any;
|
|
400
|
-
public readonly COMP_PLUS_LIST: any;
|
|
401
|
-
|
|
402
|
-
public readonly COMP_PLUS_LOCA_ITEM: any;
|
|
403
|
-
public readonly COMP_PLUS_LOCA: any;
|
|
404
|
-
|
|
405
|
-
public readonly COMP_PLUS_META: any;
|
|
406
|
-
|
|
407
|
-
public readonly COMP_PLUS_NAME_ITEM: any;
|
|
408
|
-
public readonly COMP_PLUS_NAME: any;
|
|
409
|
-
|
|
410
|
-
public readonly COMP_PLUS_ORDR_ITEM: any;
|
|
411
|
-
public readonly COMP_PLUS_ORDR: any;
|
|
412
|
-
|
|
413
|
-
public readonly COMP_PLUS_STRS_ITEM: any;
|
|
414
|
-
public readonly COMP_PLUS_STRS: any;
|
|
415
|
-
|
|
416
|
-
public readonly COMP_PLUS_TRAN_ITEM: any;
|
|
417
|
-
public readonly COMP_PLUS_TRAN: any;
|
|
418
|
-
|
|
419
|
-
public readonly COMP_PLUS_VKEY_ITEM: any;
|
|
420
|
-
public readonly COMP_PLUS_VKEY: any;
|
|
421
|
-
|
|
422
|
-
/* File in-memory data */
|
|
423
|
-
|
|
424
|
-
public kmxplus: KMXPlusData = { };
|
|
425
|
-
|
|
426
|
-
constructor() {
|
|
427
|
-
super();
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
// Binary-correct structures matching kmx_plus.h
|
|
431
|
-
|
|
432
|
-
// 'sect'
|
|
433
|
-
|
|
434
|
-
this.COMP_PLUS_SECT_ITEM = new r.Struct({
|
|
435
|
-
sect: r.uint32le,
|
|
436
|
-
offset: r.uint32le //? new r.VoidPointer(r.uint32le, {type: 'global'})
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
this.COMP_PLUS_SECT = new r.Struct({
|
|
440
|
-
ident: r.uint32le,
|
|
441
|
-
size: r.uint32le,
|
|
442
|
-
total: r.uint32le,
|
|
443
|
-
count: r.uint32le,
|
|
444
|
-
items: new r.Array(this.COMP_PLUS_SECT_ITEM, 'count')
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
// 'bksp' - see 'tran'
|
|
448
|
-
|
|
449
|
-
// 'disp'
|
|
450
|
-
this.COMP_PLUS_DISP_ITEM = new r.Struct({
|
|
451
|
-
to: r.uint32le,
|
|
452
|
-
display: r.uint32le,
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
this.COMP_PLUS_DISP = new r.Struct({
|
|
456
|
-
ident: r.uint32le,
|
|
457
|
-
size: r.uint32le,
|
|
458
|
-
count: r.uint32le,
|
|
459
|
-
baseCharacter: r.uint32le,
|
|
460
|
-
items: new r.Array(this.COMP_PLUS_DISP_ITEM, 'count'),
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
// 'elem'
|
|
464
|
-
|
|
465
|
-
this.COMP_PLUS_ELEM_ELEMENT = new r.Struct({
|
|
466
|
-
element: r.uint32le,
|
|
467
|
-
flags: r.uint32le
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
this.COMP_PLUS_ELEM_STRING = new r.Struct({
|
|
471
|
-
offset: r.uint32le,
|
|
472
|
-
length: r.uint32le
|
|
473
|
-
});
|
|
474
|
-
|
|
475
|
-
this.COMP_PLUS_ELEM = new r.Struct({
|
|
476
|
-
ident: r.uint32le,
|
|
477
|
-
size: r.uint32le,
|
|
478
|
-
count: r.uint32le,
|
|
479
|
-
strings: new r.Array(this.COMP_PLUS_ELEM_STRING, 'count')
|
|
480
|
-
// + variable subtable: Element data (see KMXPlusBuilder.emitElements())
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
// 'finl' - see 'tran'
|
|
484
|
-
|
|
485
|
-
// 'keys' - see 'keys.kmap'
|
|
486
|
-
|
|
487
|
-
// 'layr'
|
|
488
|
-
|
|
489
|
-
this.COMP_PLUS_LAYR_ENTRY = new r.Struct({
|
|
490
|
-
id: r.uint32le, // str
|
|
491
|
-
mod: r.uint32le, // bitfield
|
|
492
|
-
row: r.uint32le, // index into rows
|
|
493
|
-
count: r.uint32le,
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
this.COMP_PLUS_LAYR_KEY = new r.Struct({
|
|
497
|
-
key: r.uint32le, // str: key id
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
this.COMP_PLUS_LAYR_LIST = new r.Struct({
|
|
501
|
-
hardware: r.uint32le, //enum
|
|
502
|
-
layer: r.uint32le, // index into layers
|
|
503
|
-
count: r.uint32le,
|
|
504
|
-
minDeviceWidth: r.uint32le, // integer: millimeters
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
this.COMP_PLUS_LAYR_ROW = new r.Struct({
|
|
508
|
-
key: r.uint32le,
|
|
509
|
-
count: r.uint32le,
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
this.COMP_PLUS_LAYR = new r.Struct({
|
|
513
|
-
ident: r.uint32le,
|
|
514
|
-
size: r.uint32le,
|
|
515
|
-
listCount: r.uint32le,
|
|
516
|
-
layerCount: r.uint32le,
|
|
517
|
-
rowCount: r.uint32le,
|
|
518
|
-
keyCount: r.uint32le,
|
|
519
|
-
lists: new r.Array(this.COMP_PLUS_LAYR_LIST, 'listCount'),
|
|
520
|
-
layers: new r.Array(this.COMP_PLUS_LAYR_ENTRY, 'layerCount'),
|
|
521
|
-
rows: new r.Array(this.COMP_PLUS_LAYR_ROW, 'rowCount'),
|
|
522
|
-
keys: new r.Array(this.COMP_PLUS_LAYR_KEY, 'keyCount'),
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
this.COMP_PLUS_KEYS_FLICK = new r.Struct({
|
|
526
|
-
directions: r.uint32le, // list
|
|
527
|
-
flags: r.uint32le,
|
|
528
|
-
to: r.uint32le, // str | codepoint
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
this.COMP_PLUS_KEYS_FLICKS = new r.Struct({
|
|
532
|
-
count: r.uint32le,
|
|
533
|
-
flick: r.uint32le,
|
|
534
|
-
id: r.uint32le, // str
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
this.COMP_PLUS_KEYS_KEY = new r.Struct({
|
|
538
|
-
to: r.uint32le, // str | codepoint
|
|
539
|
-
flags: r.uint32le,
|
|
540
|
-
id: r.uint32le, // str
|
|
541
|
-
switch: r.uint32le, // str
|
|
542
|
-
width: r.uint32le, // width*10 ( 1 = 0.1 keys)
|
|
543
|
-
longPress: r.uint32le, // list index
|
|
544
|
-
longPressDefault: r.uint32le, // str
|
|
545
|
-
multiTap: r.uint32le, // list index
|
|
546
|
-
flicks: r.uint32le, // index into flicks table
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
this.COMP_PLUS_KEYS_KMAP = new r.Struct({
|
|
550
|
-
vkey: r.uint32le,
|
|
551
|
-
mod: r.uint32le,
|
|
552
|
-
key: r.uint32le, // index into 'keys' subtable
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
this.COMP_PLUS_KEYS = new r.Struct({
|
|
556
|
-
ident: r.uint32le,
|
|
557
|
-
size: r.uint32le,
|
|
558
|
-
keyCount: r.uint32le,
|
|
559
|
-
flicksCount: r.uint32le,
|
|
560
|
-
flickCount: r.uint32le,
|
|
561
|
-
kmapCount: r.uint32le,
|
|
562
|
-
keys: new r.Array(this.COMP_PLUS_KEYS_KEY, 'keyCount'),
|
|
563
|
-
flicks: new r.Array(this.COMP_PLUS_KEYS_FLICKS, 'flicksCount'),
|
|
564
|
-
flick: new r.Array(this.COMP_PLUS_KEYS_FLICK, 'flickCount'),
|
|
565
|
-
kmap: new r.Array(this.COMP_PLUS_KEYS_KMAP, 'kmapCount'),
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
// 'list'
|
|
569
|
-
|
|
570
|
-
this.COMP_PLUS_LIST_LIST = new r.Struct({
|
|
571
|
-
index: r.uint32le,
|
|
572
|
-
count: r.uint32le,
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
this.COMP_PLUS_LIST_INDEX = new r.Struct({
|
|
576
|
-
str: r.uint32le, // str
|
|
577
|
-
});
|
|
578
|
-
|
|
579
|
-
this.COMP_PLUS_LIST = new r.Struct({
|
|
580
|
-
ident: r.uint32le,
|
|
581
|
-
size: r.uint32le,
|
|
582
|
-
listCount: r.uint32le,
|
|
583
|
-
indexCount: r.uint32le,
|
|
584
|
-
lists: new r.Array(this.COMP_PLUS_LIST_LIST, 'listCount'),
|
|
585
|
-
indices: new r.Array(this.COMP_PLUS_LIST_INDEX, 'indexCount'),
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
// 'loca'
|
|
589
|
-
|
|
590
|
-
this.COMP_PLUS_LOCA_ITEM = r.uint32le; //str
|
|
591
|
-
|
|
592
|
-
this.COMP_PLUS_LOCA = new r.Struct({
|
|
593
|
-
ident: r.uint32le,
|
|
594
|
-
size: r.uint32le,
|
|
595
|
-
count: r.uint32le,
|
|
596
|
-
items: new r.Array(this.COMP_PLUS_LOCA_ITEM, 'count')
|
|
597
|
-
});
|
|
598
|
-
|
|
599
|
-
// 'meta'
|
|
600
|
-
|
|
601
|
-
this.COMP_PLUS_META = new r.Struct({
|
|
602
|
-
ident: r.uint32le,
|
|
603
|
-
size: r.uint32le,
|
|
604
|
-
author: r.uint32le, //str
|
|
605
|
-
conform: r.uint32le, //str
|
|
606
|
-
layout: r.uint32le, //str
|
|
607
|
-
normalization: r.uint32le, //str
|
|
608
|
-
indicator: r.uint32le, //str
|
|
609
|
-
version: r.uint32le, //str
|
|
610
|
-
settings: r.uint32le, //new r.Bitfield(r.uint32le, ['fallback', 'transformFailure', 'transformPartial'])
|
|
611
|
-
});
|
|
612
|
-
|
|
613
|
-
// 'name'
|
|
614
|
-
|
|
615
|
-
this.COMP_PLUS_NAME_ITEM = r.uint32le; //str
|
|
616
|
-
|
|
617
|
-
this.COMP_PLUS_NAME = new r.Struct({
|
|
618
|
-
ident: r.uint32le,
|
|
619
|
-
size: r.uint32le,
|
|
620
|
-
count: r.uint32le,
|
|
621
|
-
items: new r.Array(this.COMP_PLUS_NAME_ITEM, 'count')
|
|
622
|
-
});
|
|
623
|
-
|
|
624
|
-
// 'ordr'
|
|
625
|
-
|
|
626
|
-
this.COMP_PLUS_ORDR_ITEM = new r.Struct({
|
|
627
|
-
elements: r.uint32le, //elem
|
|
628
|
-
before: r.uint32le //elem
|
|
629
|
-
});
|
|
630
|
-
|
|
631
|
-
this.COMP_PLUS_ORDR = new r.Struct({
|
|
632
|
-
ident: r.uint32le,
|
|
633
|
-
size: r.uint32le,
|
|
634
|
-
count: r.uint32le,
|
|
635
|
-
items: new r.Array(this.COMP_PLUS_ORDR_ITEM, 'count')
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
// 'strs'
|
|
639
|
-
|
|
640
|
-
this.COMP_PLUS_STRS_ITEM = new r.Struct({
|
|
641
|
-
// While we use length which is number of utf-16 code units excluding null terminator,
|
|
642
|
-
// we always write a null terminator, so we can get restructure to do that for us here
|
|
643
|
-
offset: r.uint32le, //? new r.Pointer(r.uint32le, new r.String(null, 'utf16le')),
|
|
644
|
-
length: r.uint32le
|
|
645
|
-
});
|
|
646
|
-
|
|
647
|
-
this.COMP_PLUS_STRS = new r.Struct({
|
|
648
|
-
ident: r.uint32le,
|
|
649
|
-
size: r.uint32le,
|
|
650
|
-
count: r.uint32le,
|
|
651
|
-
items: new r.Array(this.COMP_PLUS_STRS_ITEM, 'count')
|
|
652
|
-
// + variable subtable: String data (see KMXPlusBuilder.emitStrings())
|
|
653
|
-
});
|
|
654
|
-
|
|
655
|
-
// 'tran'
|
|
656
|
-
|
|
657
|
-
this.COMP_PLUS_TRAN_ITEM = new r.Struct({
|
|
658
|
-
from: r.uint32le, //elem
|
|
659
|
-
to: r.uint32le, //str
|
|
660
|
-
before: r.uint32le, //elem
|
|
661
|
-
flags: r.uint32le //bitfield
|
|
662
|
-
});
|
|
663
|
-
|
|
664
|
-
this.COMP_PLUS_TRAN = new r.Struct({
|
|
665
|
-
ident: r.uint32le,
|
|
666
|
-
size: r.uint32le,
|
|
667
|
-
count: r.uint32le,
|
|
668
|
-
items: new r.Array(this.COMP_PLUS_TRAN_ITEM, 'count')
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
// 'vkey'
|
|
672
|
-
|
|
673
|
-
this.COMP_PLUS_VKEY_ITEM = new r.Struct({
|
|
674
|
-
vkey: r.uint32le,
|
|
675
|
-
target: r.uint32le
|
|
676
|
-
});
|
|
677
|
-
|
|
678
|
-
this.COMP_PLUS_VKEY = new r.Struct({
|
|
679
|
-
ident: r.uint32le,
|
|
680
|
-
size: r.uint32le,
|
|
681
|
-
count: r.uint32le,
|
|
682
|
-
items: new r.Array(this.COMP_PLUS_VKEY_ITEM, 'count')
|
|
683
|
-
});
|
|
684
|
-
|
|
685
|
-
// Aliases
|
|
686
|
-
|
|
687
|
-
this.COMP_PLUS_BKSP_ITEM = this.COMP_PLUS_TRAN_ITEM;
|
|
688
|
-
this.COMP_PLUS_FINL_ITEM = this.COMP_PLUS_TRAN_ITEM;
|
|
689
|
-
this.COMP_PLUS_BKSP = this.COMP_PLUS_TRAN;
|
|
690
|
-
this.COMP_PLUS_FINL = this.COMP_PLUS_TRAN;
|
|
691
|
-
}
|
|
692
|
-
}
|