@keymanapp/ldml-keyboard-constants 18.0.40-alpha → 18.0.45-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,482 +1,482 @@
1
- /*
2
- Copyright: Copyright (C) 2022 SIL International.
3
- Authors: srl295, mcdurdin
4
- This file provides constants for the KMX Plus (LDML support) binary format,
5
- to be shared between TypeScript and C++ via the generator (below)
6
- */
7
- // TODO-LDML: namespace com.keyman.core.ldml {
8
- /**
9
- * Constants for the KMXPlus data format
10
- * These are shared between the data access layer and the compiler.
11
- * Note that the section IDs (section_keys etc.) are 32 bit hex
12
- * values that are designed to appear as text when written in little endian
13
- * format, so 0x7379656b = 'keys'
14
- */
1
+ /*
2
+ Copyright: Copyright (C) 2022 SIL International.
3
+ Authors: srl295, mcdurdin
4
+ This file provides constants for the KMX Plus (LDML support) binary format,
5
+ to be shared between TypeScript and C++ via the generator (below)
6
+ */
7
+ // TODO-LDML: namespace com.keyman.core.ldml {
8
+ /**
9
+ * Constants for the KMXPlus data format
10
+ * These are shared between the data access layer and the compiler.
11
+ * Note that the section IDs (section_keys etc.) are 32 bit hex
12
+ * values that are designed to appear as text when written in little endian
13
+ * format, so 0x7379656b = 'keys'
14
+ */
15
15
 
16
- !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]="d5888b23-cf90-5cbf-99a9-f1b6dc4f3870")}catch(e){}}();
17
- class Constants {
18
- /**
19
- * The version of the LDML processor
20
- */
21
- version = '1.0';
22
- /**
23
- * The current CLDR version
24
- */
25
- cldr_version_latest = '45';
26
- /**
27
- * The version for testdata files
28
- */
29
- cldr_test_version_latest = 'techpreview';
30
- /**
31
- * import base
32
- */
33
- cldr_import_base = 'cldr';
34
- /**
35
- * implied keys file
36
- */
37
- cldr_implied_keys_import = `${this.cldr_version_latest}/keys-Latn-implied.xml`;
38
- /**
39
- * implied scancodes file
40
- */
41
- cldr_implied_forms_import = `${this.cldr_version_latest}/scanCodes-implied.xml`;
42
- /**
43
- * Length of a raw section header, in bytes
44
- */
45
- length_header = 8;
46
- /* ------------------------------------------------------------------
47
- * sect section
48
- ------------------------------------------------------------------ */
49
- /**
50
- * Minimum length of the 'sect' section, not including entries
51
- */
52
- length_sect = 16;
53
- /**
54
- * Length of each item in the 'sect' section variable part
55
- */
56
- length_sect_item = 8;
57
- /* ------------------------------------------------------------------
58
- * bksp section
59
- ------------------------------------------------------------------ */
60
- /**
61
- * Minimum length of the 'bksp' section, not including entries
62
- */
63
- length_bksp = 12;
64
- /**
65
- * Length of each item in the 'bksp' section variable part
66
- */
67
- length_bksp_item = 16;
68
- /**
69
- * bitwise or value for error="fail" in transform
70
- */
71
- bksp_flags_error = 0x0001;
72
- /* ------------------------------------------------------------------
73
- * disp section
74
- ------------------------------------------------------------------ */
75
- /**
76
- * Minimum length of the 'disp' section, not including entries
77
- */
78
- length_disp = 16;
79
- /**
80
- * Length of each entry in the 'disp' variable part
81
- */
82
- length_disp_item = 12;
83
- /* ------------------------------------------------------------------
84
- * elem section
85
- ------------------------------------------------------------------ */
86
- /**
87
- * Minimum length of the 'elem' section, not including entries
88
- */
89
- length_elem = 12;
90
- /**
91
- * Length of each elem string in the 'elem' section variable part
92
- */
93
- length_elem_item = 8;
94
- /**
95
- * Length of each element in an elem string
96
- */
97
- length_elem_item_element = 8;
98
- /**
99
- * bitwise or value for type in elem[elemstr][element].flags.
100
- * If bits are 00b, then 'element' is a UTF-32LE codepoint.
101
- * If bits are 01b, then 'element' is a string index.
102
- * If bits are 10b (2), then 'element' is a uset index.
103
- *
104
- * `type = flags & elem_flags_type`
105
- */
106
- elem_flags_type = 0x00000003;
107
- elem_flags_type_char = 0x00000000;
108
- elem_flags_type_str = 0x00000001;
109
- elem_flags_type_uset = 0x00000002;
110
- /**
111
- * bitwise or value for tertiary_base in elem[elemstr][element].flags.
112
- * If bit is 1, then tertiary_base is true.
113
- * If bit is 0, then tertiary_base is false.
114
- *
115
- * Used only for `ordr`-type element strings.
116
- *
117
- * `tertiary_base = flags & elem_flags_tertiary_base`
118
- */
119
- elem_flags_tertiary_base = 0x00000004;
120
- /**
121
- * bitwise or value for tertiary_base in elem[elemstr][element].flags.
122
- * If bit is 1, then prebase is true.
123
- * If bit is 0, then prebase is false.
124
- *
125
- * Used only for `ordr`-type element strings.
126
- *
127
- * `prebase = flags & elem_flags_prebase`
128
- */
129
- elem_flags_prebase = 0x00000008;
130
- /**
131
- * bitwise mask for order in elem[elemstr][element].flags.
132
- *
133
- * Used only for `ordr`-type element strings. 1 byte signed integer.
134
- *
135
- * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift`
136
- */
137
- elem_flags_order_mask = 0x00FF0000;
138
- /**
139
- * bit shift for order in elem[elemstr][element].flags.
140
- *
141
- * Used only for `ordr`-type element strings.
142
- *
143
- * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift`
144
- */
145
- elem_flags_order_bitshift = 16;
146
- /**
147
- * bitwise mask for tertiary sort in elem[elemstr][element].flags.
148
- *
149
- * Used only for `ordr`-type element strings. 1 byte signed integer.
150
- *
151
- * `tertiary = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift`
152
- */
153
- elem_flags_tertiary_mask = 0xFF000000;
154
- /**
155
- * bit shift for tertiary sort in elem[elemstr][element].flags.
156
- *
157
- * Used only for `ordr`-type element strings. 1 byte signed integer.
158
- *
159
- * `order = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift`
160
- */
161
- elem_flags_tertiary_bitshift = 24;
162
- /* ------------------------------------------------------------------
163
- * finl section
164
- ------------------------------------------------------------------ */
165
- /**
166
- * Minimum length of the 'finl' section, not including entries
167
- */
168
- length_finl = 8;
169
- /**
170
- * Length of each item in the 'finl' section variable part
171
- */
172
- length_finl_item = 16;
173
- /**
174
- * bitwise or value for error="fail" in transform
175
- */
176
- finl_flags_error = 0x0001;
177
- /* ------------------------------------------------------------------
178
- * keys section is now keys.kmap
179
- ------------------------------------------------------------------ */
180
- /**
181
- * Constant for no modifiers
182
- */
183
- keys_mod_none = 0x0000;
184
- /**
185
- * bitmask for Left Alt modifier key
186
- */
187
- keys_mod_altL = 0x0004;
188
- /**
189
- * bitmask for Right Alt (AltGr) modifier key
190
- */
191
- keys_mod_altR = 0x0008;
192
- /**
193
- * bitmask for either Alt (Windows) or Option (Apple) modifier keys
194
- */
195
- keys_mod_alt = 0x0040;
196
- /**
197
- * bitmask for Caps modifier key
198
- */
199
- keys_mod_caps = 0x0100;
200
- /**
201
- * bitmask for Left control modifier key
202
- */
203
- keys_mod_ctrlL = 0x0001;
204
- /**
205
- * bitmask for Right control modifier key
206
- */
207
- keys_mod_ctrlR = 0x0002;
208
- /**
209
- * bitmask for either Control modifier key
210
- */
211
- keys_mod_ctrl = 0x0020;
212
- /**
213
- * bitmask for either shift.
214
- */
215
- keys_mod_shift = 0x0010;
216
- /**
217
- * bitmask for 'other'.
218
- */
219
- keys_mod_other = 0x10000;
220
- /**
221
- * Convenience map for modifiers
222
- */
223
- keys_mod_map = new Map([
224
- ["none", this.keys_mod_none],
225
- ["alt", this.keys_mod_alt],
226
- ["altL", this.keys_mod_altL],
227
- ["altR", this.keys_mod_altR],
228
- ["caps", this.keys_mod_caps],
229
- ["ctrl", this.keys_mod_ctrl],
230
- ["ctrlL", this.keys_mod_ctrlL],
231
- ["ctrlR", this.keys_mod_ctrlR],
232
- ["shift", this.keys_mod_shift],
233
- ["other", this.keys_mod_other],
234
- ]);
235
- /**
236
- * a mask combining all valid modifier bits
237
- */
238
- keys_mod_all = Array.from(this.keys_mod_map.values()).reduce((p, v) => (p | v), this.keys_mod_none);
239
- /* ------------------------------------------------------------------
240
- * keys section
241
- ------------------------------------------------------------------ */
242
- /**
243
- * Minimum length of the 'keys' section not including variable parts
244
- */
245
- length_keys = 24;
246
- /**
247
- * Length of each item in the 'keys' keys sub-table
248
- */
249
- length_keys_key = 36;
250
- /**
251
- * Length of each item in the 'keys' flick lists sub-table
252
- */
253
- length_keys_flick_list = 12;
254
- /**
255
- * Length of each item in the 'keys' flick elements sub-table
256
- */
257
- length_keys_flick_element = 8;
258
- /**
259
- * Length of each item in the 'keys.kmap' key map subtable
260
- */
261
- length_keys_kmap = 12;
262
- /**
263
- * 0 if to is a char, 1 if it is a string
264
- */
265
- keys_key_flags_extend = 0x00000001;
266
- /**
267
- * 1 if the key is a gap
268
- */
269
- keys_key_flags_gap = 0x00000002;
270
- /* ------------------------------------------------------------------
271
- * layr section
272
- ------------------------------------------------------------------ */
273
- /**
274
- * Minimum length of the 'layr' section not including variable parts
275
- */
276
- length_layr = 24;
277
- /**
278
- * Length of each layer list in the 'layr' section variable part
279
- */
280
- length_layr_list = 16;
281
- /**
282
- * for the 'hardware' field indicating a touch keyboard, non-hardware
283
- */
284
- layr_list_hardware_touch = 'touch';
285
- /**
286
- * Length of each layer entry in the 'layr' section variable part
287
- */
288
- length_layr_entry = 16;
289
- /**
290
- * Length of each row entry in the 'layr' section variable part
291
- */
292
- length_layr_row = 8;
293
- /**
294
- * Length of each key entry in the 'layr' section variable part
295
- */
296
- length_layr_key = 4;
297
- /* ------------------------------------------------------------------
298
- * list section
299
- ------------------------------------------------------------------ */
300
- /**
301
- * Minimum length of the 'list' section not including variable parts
302
- */
303
- length_list = 16;
304
- /**
305
- * Length of each list item in the 'list' list section variable part
306
- */
307
- length_list_item = 8;
308
- /**
309
- * Length of each list item in the 'list' indices section variable part
310
- */
311
- length_list_index = 4;
312
- /* ------------------------------------------------------------------
313
- * loca section
314
- ------------------------------------------------------------------ */
315
- /**
316
- * Minimum length of the 'loca' section not including variable parts
317
- */
318
- length_loca = 12;
319
- /**
320
- * Length of each item in the 'loca' section variable part
321
- */
322
- length_loca_item = 4;
323
- /* ------------------------------------------------------------------
324
- * meta section
325
- ------------------------------------------------------------------ */
326
- /**
327
- * length of the 'meta' section
328
- */
329
- length_meta = 36;
330
- /**
331
- * bitwise or value for normalization=disabled in meta.settings
332
- */
333
- meta_settings_normalization_disabled = 1;
334
- /* ------------------------------------------------------------------
335
- * strs section
336
- ------------------------------------------------------------------ */
337
- /**
338
- * Minimum length of the 'strs' section not including variable parts
339
- */
340
- length_strs = 12;
341
- /**
342
- * Length of each item in the 'strs' section variable part
343
- */
344
- length_strs_item = 8;
345
- /* ------------------------------------------------------------------
346
- * tran section
347
- ------------------------------------------------------------------ */
348
- /**
349
- * Minimum length of the 'tran' section, not including entries
350
- */
351
- length_tran = 20;
352
- /**
353
- * Length of each transform group item
354
- */
355
- length_tran_group = 12;
356
- /**
357
- * Length of each transform item
358
- */
359
- length_tran_transform = 16;
360
- /**
361
- * Length of each reorder subtable item
362
- */
363
- length_tran_reorder = 8;
364
- /**
365
- * bitwise or value for error="fail" in transform
366
- */
367
- tran_flags_error = 0x0001;
368
- /**
369
- * this group is full of transform items
370
- */
371
- tran_group_type_transform = 0;
372
- /**
373
- * this group is full of reorder items
374
- */
375
- tran_group_type_reorder = 1;
376
- /* ------------------------------------------------------------------
377
- * vars section
378
- * ------------------------------------------------------------------ */
379
- /**
380
- * Minimum length of the 'vars' section not including variable parts
381
- */
382
- length_vars = 16;
383
- /**
384
- * Length of each item in the 'vars' section variable part
385
- */
386
- length_vars_item = 16;
387
- /**
388
- * String variable
389
- */
390
- vars_entry_type_string = 0;
391
- /**
392
- * Set variable
393
- */
394
- vars_entry_type_set = 1;
395
- /**
396
- * unicodeSet variable
397
- */
398
- vars_entry_type_unicodeSet = 2;
399
- /* ------------------------------------------------------------------
400
- * uset section
401
- * ------------------------------------------------------------------ */
402
- /*
403
- * Minimum length of the 'uset' section not including variable parts
404
- */
405
- length_uset = 16;
406
- /**
407
- * Length of each entry in the uset.usets subtable
408
- */
409
- length_uset_uset = 12;
410
- /**
411
- * Length of each entry in the uset.ranges subtable
412
- */
413
- length_uset_range = 8;
414
- /**
415
- * All section IDs.
416
- */
417
- section = {
418
- // keep this sorted
419
- bksp: 'bksp',
420
- disp: 'disp',
421
- elem: 'elem',
422
- keys: 'keys',
423
- layr: 'layr',
424
- list: 'list',
425
- loca: 'loca',
426
- meta: 'meta',
427
- sect: 'sect',
428
- strs: 'strs',
429
- tran: 'tran',
430
- uset: 'uset',
431
- vars: 'vars',
432
- };
433
- /**
434
- * Use to convert 4-char string into hex
435
- * @param id section id such as 'sect'
436
- * @returns hex ID such as 0x74636573
437
- */
438
- hex_section_id(id) {
439
- if (!id || typeof id !== 'string' || !id.match(/^[a-z0-9]{4}$/)) {
440
- throw Error(`hex_section_id(${id}) - need a 4-character alphanumeric lower-case string`);
441
- }
442
- let r = 0;
443
- for (let i = 3; i >= 0; i--) {
444
- r = (r << 8 | id.charCodeAt(i));
445
- }
446
- return r;
447
- }
448
- ;
449
- /**
450
- * Use to convert hex into 4-char string
451
- * @param hex section ID such as 0x74636573
452
- * @returns string such as 'sect'
453
- */
454
- str_section_id(hex) {
455
- const chars = [];
456
- for (let i = 3; i >= 0; i--) {
457
- chars.push(String.fromCharCode(hex & 0xFF));
458
- hex >>= 8;
459
- }
460
- return chars.join('');
461
- }
462
- // ---- marker stuff ----
463
- /** == kmx_file.UC_SENTINEL, always followed by `marker_code`, marker index 0x0001-0xfffe */
464
- uc_sentinel = 0xFFFF;
465
- /** == kmx_file.CODE_DEADKEY */
466
- marker_code = 0x0008;
467
- /** used to refer to no index */
468
- marker_no_index = 0x0000;
469
- /** minimum usable marker index */
470
- marker_min_index = 0x0001;
471
- /** index value referring to the 'any' marker match */
472
- marker_any_index = 0xD7FF;
473
- /** maximum marker index prior to the 'any' value */
474
- marker_max_index = this.marker_any_index - 1;
475
- /** maximum count of markers (not including 'any') */
476
- marker_max_count = this.marker_max_index - this.marker_min_index + 1;
477
- }
478
- ;
479
- export const constants = new Constants();
480
- // }
16
+ !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]="99598772-2d41-5cc5-aa32-286446d9dec8")}catch(e){}}();
17
+ class Constants {
18
+ /**
19
+ * The version of the LDML processor
20
+ */
21
+ version = '1.0';
22
+ /**
23
+ * The current CLDR version
24
+ */
25
+ cldr_version_latest = '45';
26
+ /**
27
+ * The version for testdata files
28
+ */
29
+ cldr_test_version_latest = 'techpreview';
30
+ /**
31
+ * import base
32
+ */
33
+ cldr_import_base = 'cldr';
34
+ /**
35
+ * implied keys file
36
+ */
37
+ cldr_implied_keys_import = `${this.cldr_version_latest}/keys-Latn-implied.xml`;
38
+ /**
39
+ * implied scancodes file
40
+ */
41
+ cldr_implied_forms_import = `${this.cldr_version_latest}/scanCodes-implied.xml`;
42
+ /**
43
+ * Length of a raw section header, in bytes
44
+ */
45
+ length_header = 8;
46
+ /* ------------------------------------------------------------------
47
+ * sect section
48
+ ------------------------------------------------------------------ */
49
+ /**
50
+ * Minimum length of the 'sect' section, not including entries
51
+ */
52
+ length_sect = 16;
53
+ /**
54
+ * Length of each item in the 'sect' section variable part
55
+ */
56
+ length_sect_item = 8;
57
+ /* ------------------------------------------------------------------
58
+ * bksp section
59
+ ------------------------------------------------------------------ */
60
+ /**
61
+ * Minimum length of the 'bksp' section, not including entries
62
+ */
63
+ length_bksp = 12;
64
+ /**
65
+ * Length of each item in the 'bksp' section variable part
66
+ */
67
+ length_bksp_item = 16;
68
+ /**
69
+ * bitwise or value for error="fail" in transform
70
+ */
71
+ bksp_flags_error = 0x0001;
72
+ /* ------------------------------------------------------------------
73
+ * disp section
74
+ ------------------------------------------------------------------ */
75
+ /**
76
+ * Minimum length of the 'disp' section, not including entries
77
+ */
78
+ length_disp = 16;
79
+ /**
80
+ * Length of each entry in the 'disp' variable part
81
+ */
82
+ length_disp_item = 12;
83
+ /* ------------------------------------------------------------------
84
+ * elem section
85
+ ------------------------------------------------------------------ */
86
+ /**
87
+ * Minimum length of the 'elem' section, not including entries
88
+ */
89
+ length_elem = 12;
90
+ /**
91
+ * Length of each elem string in the 'elem' section variable part
92
+ */
93
+ length_elem_item = 8;
94
+ /**
95
+ * Length of each element in an elem string
96
+ */
97
+ length_elem_item_element = 8;
98
+ /**
99
+ * bitwise or value for type in elem[elemstr][element].flags.
100
+ * If bits are 00b, then 'element' is a UTF-32LE codepoint.
101
+ * If bits are 01b, then 'element' is a string index.
102
+ * If bits are 10b (2), then 'element' is a uset index.
103
+ *
104
+ * `type = flags & elem_flags_type`
105
+ */
106
+ elem_flags_type = 0x00000003;
107
+ elem_flags_type_char = 0x00000000;
108
+ elem_flags_type_str = 0x00000001;
109
+ elem_flags_type_uset = 0x00000002;
110
+ /**
111
+ * bitwise or value for tertiary_base in elem[elemstr][element].flags.
112
+ * If bit is 1, then tertiary_base is true.
113
+ * If bit is 0, then tertiary_base is false.
114
+ *
115
+ * Used only for `ordr`-type element strings.
116
+ *
117
+ * `tertiary_base = flags & elem_flags_tertiary_base`
118
+ */
119
+ elem_flags_tertiary_base = 0x00000004;
120
+ /**
121
+ * bitwise or value for tertiary_base in elem[elemstr][element].flags.
122
+ * If bit is 1, then prebase is true.
123
+ * If bit is 0, then prebase is false.
124
+ *
125
+ * Used only for `ordr`-type element strings.
126
+ *
127
+ * `prebase = flags & elem_flags_prebase`
128
+ */
129
+ elem_flags_prebase = 0x00000008;
130
+ /**
131
+ * bitwise mask for order in elem[elemstr][element].flags.
132
+ *
133
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
134
+ *
135
+ * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift`
136
+ */
137
+ elem_flags_order_mask = 0x00FF0000;
138
+ /**
139
+ * bit shift for order in elem[elemstr][element].flags.
140
+ *
141
+ * Used only for `ordr`-type element strings.
142
+ *
143
+ * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift`
144
+ */
145
+ elem_flags_order_bitshift = 16;
146
+ /**
147
+ * bitwise mask for tertiary sort in elem[elemstr][element].flags.
148
+ *
149
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
150
+ *
151
+ * `tertiary = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift`
152
+ */
153
+ elem_flags_tertiary_mask = 0xFF000000;
154
+ /**
155
+ * bit shift for tertiary sort in elem[elemstr][element].flags.
156
+ *
157
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
158
+ *
159
+ * `order = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift`
160
+ */
161
+ elem_flags_tertiary_bitshift = 24;
162
+ /* ------------------------------------------------------------------
163
+ * finl section
164
+ ------------------------------------------------------------------ */
165
+ /**
166
+ * Minimum length of the 'finl' section, not including entries
167
+ */
168
+ length_finl = 8;
169
+ /**
170
+ * Length of each item in the 'finl' section variable part
171
+ */
172
+ length_finl_item = 16;
173
+ /**
174
+ * bitwise or value for error="fail" in transform
175
+ */
176
+ finl_flags_error = 0x0001;
177
+ /* ------------------------------------------------------------------
178
+ * keys section is now keys.kmap
179
+ ------------------------------------------------------------------ */
180
+ /**
181
+ * Constant for no modifiers
182
+ */
183
+ keys_mod_none = 0x0000;
184
+ /**
185
+ * bitmask for Left Alt modifier key
186
+ */
187
+ keys_mod_altL = 0x0004;
188
+ /**
189
+ * bitmask for Right Alt (AltGr) modifier key
190
+ */
191
+ keys_mod_altR = 0x0008;
192
+ /**
193
+ * bitmask for either Alt (Windows) or Option (Apple) modifier keys
194
+ */
195
+ keys_mod_alt = 0x0040;
196
+ /**
197
+ * bitmask for Caps modifier key
198
+ */
199
+ keys_mod_caps = 0x0100;
200
+ /**
201
+ * bitmask for Left control modifier key
202
+ */
203
+ keys_mod_ctrlL = 0x0001;
204
+ /**
205
+ * bitmask for Right control modifier key
206
+ */
207
+ keys_mod_ctrlR = 0x0002;
208
+ /**
209
+ * bitmask for either Control modifier key
210
+ */
211
+ keys_mod_ctrl = 0x0020;
212
+ /**
213
+ * bitmask for either shift.
214
+ */
215
+ keys_mod_shift = 0x0010;
216
+ /**
217
+ * bitmask for 'other'.
218
+ */
219
+ keys_mod_other = 0x10000;
220
+ /**
221
+ * Convenience map for modifiers
222
+ */
223
+ keys_mod_map = new Map([
224
+ ["none", this.keys_mod_none],
225
+ ["alt", this.keys_mod_alt],
226
+ ["altL", this.keys_mod_altL],
227
+ ["altR", this.keys_mod_altR],
228
+ ["caps", this.keys_mod_caps],
229
+ ["ctrl", this.keys_mod_ctrl],
230
+ ["ctrlL", this.keys_mod_ctrlL],
231
+ ["ctrlR", this.keys_mod_ctrlR],
232
+ ["shift", this.keys_mod_shift],
233
+ ["other", this.keys_mod_other],
234
+ ]);
235
+ /**
236
+ * a mask combining all valid modifier bits
237
+ */
238
+ keys_mod_all = Array.from(this.keys_mod_map.values()).reduce((p, v) => (p | v), this.keys_mod_none);
239
+ /* ------------------------------------------------------------------
240
+ * keys section
241
+ ------------------------------------------------------------------ */
242
+ /**
243
+ * Minimum length of the 'keys' section not including variable parts
244
+ */
245
+ length_keys = 24;
246
+ /**
247
+ * Length of each item in the 'keys' keys sub-table
248
+ */
249
+ length_keys_key = 36;
250
+ /**
251
+ * Length of each item in the 'keys' flick lists sub-table
252
+ */
253
+ length_keys_flick_list = 12;
254
+ /**
255
+ * Length of each item in the 'keys' flick elements sub-table
256
+ */
257
+ length_keys_flick_element = 8;
258
+ /**
259
+ * Length of each item in the 'keys.kmap' key map subtable
260
+ */
261
+ length_keys_kmap = 12;
262
+ /**
263
+ * 0 if to is a char, 1 if it is a string
264
+ */
265
+ keys_key_flags_extend = 0x00000001;
266
+ /**
267
+ * 1 if the key is a gap
268
+ */
269
+ keys_key_flags_gap = 0x00000002;
270
+ /* ------------------------------------------------------------------
271
+ * layr section
272
+ ------------------------------------------------------------------ */
273
+ /**
274
+ * Minimum length of the 'layr' section not including variable parts
275
+ */
276
+ length_layr = 24;
277
+ /**
278
+ * Length of each layer list in the 'layr' section variable part
279
+ */
280
+ length_layr_list = 16;
281
+ /**
282
+ * for the 'hardware' field indicating a touch keyboard, non-hardware
283
+ */
284
+ layr_list_hardware_touch = 'touch';
285
+ /**
286
+ * Length of each layer entry in the 'layr' section variable part
287
+ */
288
+ length_layr_entry = 16;
289
+ /**
290
+ * Length of each row entry in the 'layr' section variable part
291
+ */
292
+ length_layr_row = 8;
293
+ /**
294
+ * Length of each key entry in the 'layr' section variable part
295
+ */
296
+ length_layr_key = 4;
297
+ /* ------------------------------------------------------------------
298
+ * list section
299
+ ------------------------------------------------------------------ */
300
+ /**
301
+ * Minimum length of the 'list' section not including variable parts
302
+ */
303
+ length_list = 16;
304
+ /**
305
+ * Length of each list item in the 'list' list section variable part
306
+ */
307
+ length_list_item = 8;
308
+ /**
309
+ * Length of each list item in the 'list' indices section variable part
310
+ */
311
+ length_list_index = 4;
312
+ /* ------------------------------------------------------------------
313
+ * loca section
314
+ ------------------------------------------------------------------ */
315
+ /**
316
+ * Minimum length of the 'loca' section not including variable parts
317
+ */
318
+ length_loca = 12;
319
+ /**
320
+ * Length of each item in the 'loca' section variable part
321
+ */
322
+ length_loca_item = 4;
323
+ /* ------------------------------------------------------------------
324
+ * meta section
325
+ ------------------------------------------------------------------ */
326
+ /**
327
+ * length of the 'meta' section
328
+ */
329
+ length_meta = 36;
330
+ /**
331
+ * bitwise or value for normalization=disabled in meta.settings
332
+ */
333
+ meta_settings_normalization_disabled = 1;
334
+ /* ------------------------------------------------------------------
335
+ * strs section
336
+ ------------------------------------------------------------------ */
337
+ /**
338
+ * Minimum length of the 'strs' section not including variable parts
339
+ */
340
+ length_strs = 12;
341
+ /**
342
+ * Length of each item in the 'strs' section variable part
343
+ */
344
+ length_strs_item = 8;
345
+ /* ------------------------------------------------------------------
346
+ * tran section
347
+ ------------------------------------------------------------------ */
348
+ /**
349
+ * Minimum length of the 'tran' section, not including entries
350
+ */
351
+ length_tran = 20;
352
+ /**
353
+ * Length of each transform group item
354
+ */
355
+ length_tran_group = 12;
356
+ /**
357
+ * Length of each transform item
358
+ */
359
+ length_tran_transform = 16;
360
+ /**
361
+ * Length of each reorder subtable item
362
+ */
363
+ length_tran_reorder = 8;
364
+ /**
365
+ * bitwise or value for error="fail" in transform
366
+ */
367
+ tran_flags_error = 0x0001;
368
+ /**
369
+ * this group is full of transform items
370
+ */
371
+ tran_group_type_transform = 0;
372
+ /**
373
+ * this group is full of reorder items
374
+ */
375
+ tran_group_type_reorder = 1;
376
+ /* ------------------------------------------------------------------
377
+ * vars section
378
+ * ------------------------------------------------------------------ */
379
+ /**
380
+ * Minimum length of the 'vars' section not including variable parts
381
+ */
382
+ length_vars = 16;
383
+ /**
384
+ * Length of each item in the 'vars' section variable part
385
+ */
386
+ length_vars_item = 16;
387
+ /**
388
+ * String variable
389
+ */
390
+ vars_entry_type_string = 0;
391
+ /**
392
+ * Set variable
393
+ */
394
+ vars_entry_type_set = 1;
395
+ /**
396
+ * unicodeSet variable
397
+ */
398
+ vars_entry_type_unicodeSet = 2;
399
+ /* ------------------------------------------------------------------
400
+ * uset section
401
+ * ------------------------------------------------------------------ */
402
+ /*
403
+ * Minimum length of the 'uset' section not including variable parts
404
+ */
405
+ length_uset = 16;
406
+ /**
407
+ * Length of each entry in the uset.usets subtable
408
+ */
409
+ length_uset_uset = 12;
410
+ /**
411
+ * Length of each entry in the uset.ranges subtable
412
+ */
413
+ length_uset_range = 8;
414
+ /**
415
+ * All section IDs.
416
+ */
417
+ section = {
418
+ // keep this sorted
419
+ bksp: 'bksp',
420
+ disp: 'disp',
421
+ elem: 'elem',
422
+ keys: 'keys',
423
+ layr: 'layr',
424
+ list: 'list',
425
+ loca: 'loca',
426
+ meta: 'meta',
427
+ sect: 'sect',
428
+ strs: 'strs',
429
+ tran: 'tran',
430
+ uset: 'uset',
431
+ vars: 'vars',
432
+ };
433
+ /**
434
+ * Use to convert 4-char string into hex
435
+ * @param id section id such as 'sect'
436
+ * @returns hex ID such as 0x74636573
437
+ */
438
+ hex_section_id(id) {
439
+ if (!id || typeof id !== 'string' || !id.match(/^[a-z0-9]{4}$/)) {
440
+ throw Error(`hex_section_id(${id}) - need a 4-character alphanumeric lower-case string`);
441
+ }
442
+ let r = 0;
443
+ for (let i = 3; i >= 0; i--) {
444
+ r = (r << 8 | id.charCodeAt(i));
445
+ }
446
+ return r;
447
+ }
448
+ ;
449
+ /**
450
+ * Use to convert hex into 4-char string
451
+ * @param hex section ID such as 0x74636573
452
+ * @returns string such as 'sect'
453
+ */
454
+ str_section_id(hex) {
455
+ const chars = [];
456
+ for (let i = 3; i >= 0; i--) {
457
+ chars.push(String.fromCharCode(hex & 0xFF));
458
+ hex >>= 8;
459
+ }
460
+ return chars.join('');
461
+ }
462
+ // ---- marker stuff ----
463
+ /** == kmx_file.UC_SENTINEL, always followed by `marker_code`, marker index 0x0001-0xfffe */
464
+ uc_sentinel = 0xFFFF;
465
+ /** == kmx_file.CODE_DEADKEY */
466
+ marker_code = 0x0008;
467
+ /** used to refer to no index */
468
+ marker_no_index = 0x0000;
469
+ /** minimum usable marker index */
470
+ marker_min_index = 0x0001;
471
+ /** index value referring to the 'any' marker match */
472
+ marker_any_index = 0xD7FF;
473
+ /** maximum marker index prior to the 'any' value */
474
+ marker_max_index = this.marker_any_index - 1;
475
+ /** maximum count of markers (not including 'any') */
476
+ marker_max_count = this.marker_max_index - this.marker_min_index + 1;
477
+ }
478
+ ;
479
+ export const constants = new Constants();
480
+ // }
481
481
  //# sourceMappingURL=keyman_core_ldml.js.map
482
- //# debugId=d5888b23-cf90-5cbf-99a9-f1b6dc4f3870
482
+ //# debugId=99598772-2d41-5cc5-aa32-286446d9dec8