@keymanapp/ldml-keyboard-constants 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.
@@ -0,0 +1,377 @@
1
+ /**
2
+ * Defines the section identifiers and ensures that we include each and every
3
+ * one of them in the `sections` block and gives us a type which we can iterate
4
+ * through.
5
+ */
6
+ export type SectionIdent = 'sect' | 'bksp' | 'disp' | 'elem' | 'finl' | 'keys' | 'layr' | 'list' | 'loca' | 'meta' | 'name' | 'ordr' | 'strs' | 'tran' | 'vkey';
7
+ type SectionMap = {
8
+ [id in SectionIdent]: SectionIdent;
9
+ };
10
+ /**
11
+ * Constants for the KMXPlus data format
12
+ * These are shared between the data access layer and the compiler.
13
+ * Note that the section IDs (section_keys etc.) are 32 bit hex
14
+ * values that are designed to appear as text when written in little endian
15
+ * format, so 0x7379656b = 'keys'
16
+ */
17
+ declare class Constants {
18
+ /**
19
+ * The version of the LDML processor
20
+ */
21
+ readonly version = "1.0";
22
+ /**
23
+ * The techpreview CLDR version
24
+ */
25
+ readonly cldr_version_techpreview = "techpreview";
26
+ /**
27
+ * The latest CLDR version
28
+ */
29
+ readonly cldr_version_latest = "techpreview";
30
+ /**
31
+ * import base
32
+ */
33
+ readonly cldr_import_base = "cldr";
34
+ /**
35
+ * implied keys file
36
+ */
37
+ readonly cldr_implied_keys_import: string;
38
+ /**
39
+ * Length of a raw section header, in bytes
40
+ */
41
+ readonly length_header = 8;
42
+ /**
43
+ * Minimum length of the 'sect' section, not including entries
44
+ */
45
+ readonly length_sect = 16;
46
+ /**
47
+ * Length of each item in the 'sect' section variable part
48
+ */
49
+ readonly length_sect_item = 8;
50
+ /**
51
+ * Minimum length of the 'bksp' section, not including entries
52
+ */
53
+ readonly length_bksp = 12;
54
+ /**
55
+ * Length of each item in the 'bksp' section variable part
56
+ */
57
+ readonly length_bksp_item = 16;
58
+ /**
59
+ * bitwise or value for error="fail" in transform
60
+ */
61
+ readonly bksp_flags_error = 1;
62
+ /**
63
+ * Minimum length of the 'disp' section, not including entries
64
+ */
65
+ readonly length_disp = 16;
66
+ /**
67
+ * Length of each entry in the 'disp' variable part
68
+ */
69
+ readonly length_disp_item = 8;
70
+ /**
71
+ * Minimum length of the 'elem' section, not including entries
72
+ */
73
+ readonly length_elem = 12;
74
+ /**
75
+ * Length of each elem string in the 'elem' section variable part
76
+ */
77
+ readonly length_elem_item = 8;
78
+ /**
79
+ * Length of each element in an elem string
80
+ */
81
+ readonly length_elem_item_element = 8;
82
+ /**
83
+ * bitwise or value for unicode_set in elem[elemstr][element].flags.
84
+ * If bit is 1, then 'element' is a UnicodeSet string.
85
+ * If bit is 0, then 'element' is a UTF-32LE codepoint
86
+ *
87
+ * `unicode_set = flags & elem_flags_unicode_set`
88
+ */
89
+ readonly elem_flags_unicode_set = 1;
90
+ /**
91
+ * bitwise or value for tertiary_base in elem[elemstr][element].flags.
92
+ * If bit is 1, then tertiary_base is true.
93
+ * If bit is 0, then tertiary_base is false.
94
+ *
95
+ * Used only for `ordr`-type element strings.
96
+ *
97
+ * `tertiary_base = flags & elem_flags_tertiary_base`
98
+ */
99
+ readonly elem_flags_tertiary_base = 2;
100
+ /**
101
+ * bitwise or value for tertiary_base in elem[elemstr][element].flags.
102
+ * If bit is 1, then prebase is true.
103
+ * If bit is 0, then prebase is false.
104
+ *
105
+ * Used only for `ordr`-type element strings.
106
+ *
107
+ * `prebase = flags & elem_flags_prebase`
108
+ */
109
+ readonly elem_flags_prebase = 4;
110
+ /**
111
+ * bitwise mask for order in elem[elemstr][element].flags.
112
+ *
113
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
114
+ *
115
+ * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift`
116
+ */
117
+ readonly elem_flags_order_mask = 16711680;
118
+ /**
119
+ * bit shift for order in elem[elemstr][element].flags.
120
+ *
121
+ * Used only for `ordr`-type element strings.
122
+ *
123
+ * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift`
124
+ */
125
+ readonly elem_flags_order_bitshift = 16;
126
+ /**
127
+ * bitwise mask for tertiary sort in elem[elemstr][element].flags.
128
+ *
129
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
130
+ *
131
+ * `tertiary = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift`
132
+ */
133
+ readonly elem_flags_tertiary_mask = 4278190080;
134
+ /**
135
+ * bit shift for tertiary sort in elem[elemstr][element].flags.
136
+ *
137
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
138
+ *
139
+ * `order = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift`
140
+ */
141
+ readonly elem_flags_tertiary_bitshift = 24;
142
+ /**
143
+ * Minimum length of the 'finl' section, not including entries
144
+ */
145
+ readonly length_finl = 8;
146
+ /**
147
+ * Length of each item in the 'finl' section variable part
148
+ */
149
+ readonly length_finl_item = 16;
150
+ /**
151
+ * bitwise or value for error="fail" in transform
152
+ */
153
+ readonly finl_flags_error = 1;
154
+ /**
155
+ * Constant for no modifiers
156
+ */
157
+ readonly keys_mod_none = 0;
158
+ /**
159
+ * bitmask for Left Alt modifier key
160
+ */
161
+ readonly keys_mod_altL = 4;
162
+ /**
163
+ * bitmask for Right Alt (AltGr) modifier key
164
+ */
165
+ readonly keys_mod_altR = 8;
166
+ /**
167
+ * bitmask for either Alt (Windows) or Option (Apple) modifier keys
168
+ */
169
+ readonly keys_mod_alt = 64;
170
+ /**
171
+ * bitmask for Caps modifier key
172
+ */
173
+ readonly keys_mod_caps = 256;
174
+ /**
175
+ * bitmask for Left control modifier key
176
+ */
177
+ readonly keys_mod_ctrlL = 1;
178
+ /**
179
+ * bitmask for Right control modifier key
180
+ */
181
+ readonly keys_mod_ctrlR = 2;
182
+ /**
183
+ * bitmask for either Control modifier key
184
+ */
185
+ readonly keys_mod_ctrl = 32;
186
+ /**
187
+ * bitmask for either shift.
188
+ */
189
+ readonly keys_mod_shift = 16;
190
+ /**
191
+ * Convenience map for modifiers
192
+ */
193
+ readonly keys_mod_map: Map<string, number>;
194
+ /**
195
+ * a mask combining all valid modifier bits
196
+ */
197
+ readonly keys_mod_all: number;
198
+ /**
199
+ * Minimum length of the 'keys' section not including variable parts
200
+ */
201
+ readonly length_keys = 24;
202
+ /**
203
+ * Length of each item in the 'keys' keys sub-table
204
+ */
205
+ readonly length_keys_key = 36;
206
+ /**
207
+ * Length of each item in the 'keys' flick lists sub-table
208
+ */
209
+ readonly length_keys_flick_list = 12;
210
+ /**
211
+ * Length of each item in the 'keys' flick elements sub-table
212
+ */
213
+ readonly length_keys_flick_element = 12;
214
+ /**
215
+ * Length of each item in the 'keys.kmap' key map subtable
216
+ */
217
+ readonly length_keys_kmap = 12;
218
+ /**
219
+ * 0 if to is a char, 1 if it is a string
220
+ */
221
+ readonly keys_key_flags_extend = 1;
222
+ /**
223
+ * 1 if the key is a gap
224
+ */
225
+ readonly keys_key_flags_gap = 2;
226
+ /**
227
+ * 1 if the key is transform=no
228
+ */
229
+ readonly keys_key_flags_notransform = 4;
230
+ /**
231
+ * 0 if to is a char, 1 if it is a string
232
+ */
233
+ readonly keys_flick_flags_extend = 1;
234
+ /**
235
+ * Minimum length of the 'layr' section not including variable parts
236
+ */
237
+ readonly length_layr = 24;
238
+ /**
239
+ * Length of each layer list in the 'layr' section variable part
240
+ */
241
+ readonly length_layr_list = 16;
242
+ /**
243
+ * for the 'hardware' field indicating a touch keyboard, non-hardware
244
+ */
245
+ readonly layr_list_hardware_touch = 0;
246
+ /**
247
+ * for the 'hardware' field indicating an abnt2 layout
248
+ */
249
+ readonly layr_list_hardware_abnt2 = 1;
250
+ /**
251
+ * for the 'hardware' field indicating an iso layout
252
+ */
253
+ readonly layr_list_hardware_iso = 2;
254
+ /**
255
+ * for the 'hardware' field indicating a jis layout
256
+ */
257
+ readonly layr_list_hardware_jis = 3;
258
+ /**
259
+ * for the 'hardware' field indicating a us layout
260
+ */
261
+ readonly layr_list_hardware_us = 4;
262
+ /**
263
+ * Convenience map of layr_list_hardware field values
264
+ */
265
+ readonly layr_list_hardware_map: Map<String, number>;
266
+ /**
267
+ * Length of each layer entry in the 'layr' section variable part
268
+ */
269
+ readonly length_layr_entry = 16;
270
+ /**
271
+ * Length of each row entry in the 'layr' section variable part
272
+ */
273
+ readonly length_layr_row = 8;
274
+ /**
275
+ * Length of each key entry in the 'layr' section variable part
276
+ */
277
+ readonly length_layr_key = 4;
278
+ /**
279
+ * Minimum length of the 'list' section not including variable parts
280
+ */
281
+ readonly length_list = 16;
282
+ /**
283
+ * Length of each list item in the 'list' list section variable part
284
+ */
285
+ readonly length_list_item = 8;
286
+ /**
287
+ * Length of each list item in the 'list' indices section variable part
288
+ */
289
+ readonly length_list_index = 4;
290
+ /**
291
+ * Minimum length of the 'loca' section not including variable parts
292
+ */
293
+ readonly length_loca = 12;
294
+ /**
295
+ * Length of each item in the 'loca' section variable part
296
+ */
297
+ readonly length_loca_item = 4;
298
+ /**
299
+ * length of the 'meta' section
300
+ */
301
+ readonly length_meta = 36;
302
+ /**
303
+ * bitwise or value for fallback=omit in meta.settings
304
+ */
305
+ readonly meta_settings_fallback_omit = 1;
306
+ /**
307
+ * bitwise or value for transformFailure=omit in meta.settings
308
+ */
309
+ readonly meta_settings_transformFailure_omit = 2;
310
+ /**
311
+ * bitwise or value for transformPartial=hide in meta.settings
312
+ */
313
+ readonly meta_settings_transformPartial_hide = 4;
314
+ /**
315
+ * Minimum length of the 'name' section not including variable parts
316
+ */
317
+ readonly length_name = 12;
318
+ /**
319
+ * Length of each item in the 'name' section variable part
320
+ */
321
+ readonly length_name_item = 4;
322
+ /**
323
+ * Minimum length of the 'ordr' section, not including entries
324
+ */
325
+ readonly length_ordr = 12;
326
+ /**
327
+ * Length of each item in the 'ordr' section variable part
328
+ */
329
+ readonly length_ordr_item = 8;
330
+ /**
331
+ * Minimum length of the 'strs' section not including variable parts
332
+ */
333
+ readonly length_strs = 12;
334
+ /**
335
+ * Length of each item in the 'strs' section variable part
336
+ */
337
+ readonly length_strs_item = 8;
338
+ /**
339
+ * Minimum length of the 'tran' section, not including entries
340
+ */
341
+ readonly length_tran = 12;
342
+ /**
343
+ * Length of each item in the 'tran' section variable part
344
+ */
345
+ readonly length_tran_item = 16;
346
+ /**
347
+ * bitwise or value for error="fail" in transform
348
+ */
349
+ readonly tran_flags_error = 1;
350
+ /**
351
+ * Minimum length of the 'vkey' section not including variable parts
352
+ */
353
+ readonly length_vkey = 12;
354
+ /**
355
+ * Length of each item in the 'vkey' section variable part
356
+ */
357
+ readonly length_vkey_item = 8;
358
+ /**
359
+ * All section IDs.
360
+ */
361
+ readonly section: SectionMap;
362
+ /**
363
+ * Use to convert 4-char string into hex
364
+ * @param id section id such as 'sect'
365
+ * @returns hex ID such as 0x74636573
366
+ */
367
+ hex_section_id(id: string): number;
368
+ /**
369
+ * Use to convert hex into 4-char string
370
+ * @param hex section ID such as 0x74636573
371
+ * @returns string such as 'sect'
372
+ */
373
+ str_section_id(hex: number): string;
374
+ }
375
+ export declare const constants: Constants;
376
+ export {};
377
+ //# sourceMappingURL=keyboardprocessor_ldml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboardprocessor_ldml.d.ts","sourceRoot":"","sources":["../keyboardprocessor_ldml.ts"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAEtB,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,CAAC;AAGT,KAAK,UAAU,GAAG;KACf,EAAE,IAAI,YAAY,GAAG,YAAY;CACnC,CAAA;AAGD;;;;;;GAMG;AACH,cAAM,SAAS;IACb;;OAEG;IACH,QAAQ,CAAC,OAAO,SAAS;IACzB;;OAEG;IACH,QAAQ,CAAC,wBAAwB,iBAAiB;IAClD;;OAEG;IACH,QAAQ,CAAC,mBAAmB,iBAAi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;AAED,eAAO,MAAM,SAAS,WAAkB,CAAC"}
@@ -0,0 +1,476 @@
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
+ var Constants = /** @class */ (function () {
16
+ function Constants() {
17
+ /**
18
+ * The version of the LDML processor
19
+ */
20
+ this.version = '1.0';
21
+ /**
22
+ * The techpreview CLDR version
23
+ */
24
+ this.cldr_version_techpreview = 'techpreview';
25
+ /**
26
+ * The latest CLDR version
27
+ */
28
+ this.cldr_version_latest = this.cldr_version_techpreview;
29
+ /**
30
+ * import base
31
+ */
32
+ this.cldr_import_base = 'cldr';
33
+ /**
34
+ * implied keys file
35
+ */
36
+ this.cldr_implied_keys_import = "".concat(this.cldr_version_techpreview, "/keys-Latn-implied.xml");
37
+ /**
38
+ * Length of a raw section header, in bytes
39
+ */
40
+ this.length_header = 8;
41
+ /* ------------------------------------------------------------------
42
+ * sect section
43
+ ------------------------------------------------------------------ */
44
+ /**
45
+ * Minimum length of the 'sect' section, not including entries
46
+ */
47
+ this.length_sect = 16;
48
+ /**
49
+ * Length of each item in the 'sect' section variable part
50
+ */
51
+ this.length_sect_item = 8;
52
+ /* ------------------------------------------------------------------
53
+ * bksp section
54
+ ------------------------------------------------------------------ */
55
+ /**
56
+ * Minimum length of the 'bksp' section, not including entries
57
+ */
58
+ this.length_bksp = 12;
59
+ /**
60
+ * Length of each item in the 'bksp' section variable part
61
+ */
62
+ this.length_bksp_item = 16;
63
+ /**
64
+ * bitwise or value for error="fail" in transform
65
+ */
66
+ this.bksp_flags_error = 0x0001;
67
+ /* ------------------------------------------------------------------
68
+ * disp section
69
+ ------------------------------------------------------------------ */
70
+ /**
71
+ * Minimum length of the 'disp' section, not including entries
72
+ */
73
+ this.length_disp = 16;
74
+ /**
75
+ * Length of each entry in the 'disp' variable part
76
+ */
77
+ this.length_disp_item = 8;
78
+ /* ------------------------------------------------------------------
79
+ * elem section
80
+ ------------------------------------------------------------------ */
81
+ /**
82
+ * Minimum length of the 'elem' section, not including entries
83
+ */
84
+ this.length_elem = 12;
85
+ /**
86
+ * Length of each elem string in the 'elem' section variable part
87
+ */
88
+ this.length_elem_item = 8;
89
+ /**
90
+ * Length of each element in an elem string
91
+ */
92
+ this.length_elem_item_element = 8;
93
+ /**
94
+ * bitwise or value for unicode_set in elem[elemstr][element].flags.
95
+ * If bit is 1, then 'element' is a UnicodeSet string.
96
+ * If bit is 0, then 'element' is a UTF-32LE codepoint
97
+ *
98
+ * `unicode_set = flags & elem_flags_unicode_set`
99
+ */
100
+ this.elem_flags_unicode_set = 0x00000001;
101
+ /**
102
+ * bitwise or value for tertiary_base in elem[elemstr][element].flags.
103
+ * If bit is 1, then tertiary_base is true.
104
+ * If bit is 0, then tertiary_base is false.
105
+ *
106
+ * Used only for `ordr`-type element strings.
107
+ *
108
+ * `tertiary_base = flags & elem_flags_tertiary_base`
109
+ */
110
+ this.elem_flags_tertiary_base = 0x00000002;
111
+ /**
112
+ * bitwise or value for tertiary_base in elem[elemstr][element].flags.
113
+ * If bit is 1, then prebase is true.
114
+ * If bit is 0, then prebase is false.
115
+ *
116
+ * Used only for `ordr`-type element strings.
117
+ *
118
+ * `prebase = flags & elem_flags_prebase`
119
+ */
120
+ this.elem_flags_prebase = 0x00000004;
121
+ /**
122
+ * bitwise mask for order in elem[elemstr][element].flags.
123
+ *
124
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
125
+ *
126
+ * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift`
127
+ */
128
+ this.elem_flags_order_mask = 0x00FF0000;
129
+ /**
130
+ * bit shift for order in elem[elemstr][element].flags.
131
+ *
132
+ * Used only for `ordr`-type element strings.
133
+ *
134
+ * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift`
135
+ */
136
+ this.elem_flags_order_bitshift = 16;
137
+ /**
138
+ * bitwise mask for tertiary sort in elem[elemstr][element].flags.
139
+ *
140
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
141
+ *
142
+ * `tertiary = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift`
143
+ */
144
+ this.elem_flags_tertiary_mask = 0xFF000000;
145
+ /**
146
+ * bit shift for tertiary sort in elem[elemstr][element].flags.
147
+ *
148
+ * Used only for `ordr`-type element strings. 1 byte signed integer.
149
+ *
150
+ * `order = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift`
151
+ */
152
+ this.elem_flags_tertiary_bitshift = 24;
153
+ /* ------------------------------------------------------------------
154
+ * finl section
155
+ ------------------------------------------------------------------ */
156
+ /**
157
+ * Minimum length of the 'finl' section, not including entries
158
+ */
159
+ this.length_finl = 8;
160
+ /**
161
+ * Length of each item in the 'finl' section variable part
162
+ */
163
+ this.length_finl_item = 16;
164
+ /**
165
+ * bitwise or value for error="fail" in transform
166
+ */
167
+ this.finl_flags_error = 0x0001;
168
+ /* ------------------------------------------------------------------
169
+ * keys section is now keys.kmap
170
+ ------------------------------------------------------------------ */
171
+ /**
172
+ * Constant for no modifiers
173
+ */
174
+ this.keys_mod_none = 0x0000;
175
+ /**
176
+ * bitmask for Left Alt modifier key
177
+ */
178
+ this.keys_mod_altL = 0x0004;
179
+ /**
180
+ * bitmask for Right Alt (AltGr) modifier key
181
+ */
182
+ this.keys_mod_altR = 0x0008;
183
+ /**
184
+ * bitmask for either Alt (Windows) or Option (Apple) modifier keys
185
+ */
186
+ this.keys_mod_alt = 0x0040;
187
+ /**
188
+ * bitmask for Caps modifier key
189
+ */
190
+ this.keys_mod_caps = 0x0100;
191
+ /**
192
+ * bitmask for Left control modifier key
193
+ */
194
+ this.keys_mod_ctrlL = 0x0001;
195
+ /**
196
+ * bitmask for Right control modifier key
197
+ */
198
+ this.keys_mod_ctrlR = 0x0002;
199
+ /**
200
+ * bitmask for either Control modifier key
201
+ */
202
+ this.keys_mod_ctrl = 0x0020;
203
+ /**
204
+ * bitmask for either shift.
205
+ */
206
+ this.keys_mod_shift = 0x0010;
207
+ /**
208
+ * Convenience map for modifiers
209
+ */
210
+ this.keys_mod_map = new Map([
211
+ ["none", this.keys_mod_none],
212
+ ["alt", this.keys_mod_alt],
213
+ ["altL", this.keys_mod_altL],
214
+ ["altR", this.keys_mod_altR],
215
+ ["caps", this.keys_mod_caps],
216
+ ["ctrl", this.keys_mod_ctrl],
217
+ ["ctrlL", this.keys_mod_ctrlL],
218
+ ["ctrlR", this.keys_mod_ctrlR],
219
+ ["shift", this.keys_mod_shift],
220
+ ]);
221
+ /**
222
+ * a mask combining all valid modifier bits
223
+ */
224
+ this.keys_mod_all = Array.from(this.keys_mod_map.values()).reduce(function (p, v) { return (p | v); }, this.keys_mod_none);
225
+ /* ------------------------------------------------------------------
226
+ * keys section
227
+ ------------------------------------------------------------------ */
228
+ /**
229
+ * Minimum length of the 'keys' section not including variable parts
230
+ */
231
+ this.length_keys = 24;
232
+ /**
233
+ * Length of each item in the 'keys' keys sub-table
234
+ */
235
+ this.length_keys_key = 36;
236
+ /**
237
+ * Length of each item in the 'keys' flick lists sub-table
238
+ */
239
+ this.length_keys_flick_list = 12;
240
+ /**
241
+ * Length of each item in the 'keys' flick elements sub-table
242
+ */
243
+ this.length_keys_flick_element = 12;
244
+ /**
245
+ * Length of each item in the 'keys.kmap' key map subtable
246
+ */
247
+ this.length_keys_kmap = 12;
248
+ /**
249
+ * 0 if to is a char, 1 if it is a string
250
+ */
251
+ this.keys_key_flags_extend = 0x00000001;
252
+ /**
253
+ * 1 if the key is a gap
254
+ */
255
+ this.keys_key_flags_gap = 0x00000002;
256
+ /**
257
+ * 1 if the key is transform=no
258
+ */
259
+ this.keys_key_flags_notransform = 0x00000004;
260
+ /**
261
+ * 0 if to is a char, 1 if it is a string
262
+ */
263
+ this.keys_flick_flags_extend = 0x00000001;
264
+ /* ------------------------------------------------------------------
265
+ * layr section
266
+ ------------------------------------------------------------------ */
267
+ /**
268
+ * Minimum length of the 'layr' section not including variable parts
269
+ */
270
+ this.length_layr = 24;
271
+ /**
272
+ * Length of each layer list in the 'layr' section variable part
273
+ */
274
+ this.length_layr_list = 16;
275
+ /**
276
+ * for the 'hardware' field indicating a touch keyboard, non-hardware
277
+ */
278
+ this.layr_list_hardware_touch = 0;
279
+ /**
280
+ * for the 'hardware' field indicating an abnt2 layout
281
+ */
282
+ this.layr_list_hardware_abnt2 = 1;
283
+ /**
284
+ * for the 'hardware' field indicating an iso layout
285
+ */
286
+ this.layr_list_hardware_iso = 2;
287
+ /**
288
+ * for the 'hardware' field indicating a jis layout
289
+ */
290
+ this.layr_list_hardware_jis = 3;
291
+ /**
292
+ * for the 'hardware' field indicating a us layout
293
+ */
294
+ this.layr_list_hardware_us = 4;
295
+ /**
296
+ * Convenience map of layr_list_hardware field values
297
+ */
298
+ this.layr_list_hardware_map = new Map([
299
+ ["touch", this.layr_list_hardware_touch],
300
+ ["abnt2", this.layr_list_hardware_abnt2],
301
+ ["iso", this.layr_list_hardware_iso],
302
+ ["jis", this.layr_list_hardware_jis],
303
+ ["us", this.layr_list_hardware_us],
304
+ ]);
305
+ /**
306
+ * Length of each layer entry in the 'layr' section variable part
307
+ */
308
+ this.length_layr_entry = 16;
309
+ /**
310
+ * Length of each row entry in the 'layr' section variable part
311
+ */
312
+ this.length_layr_row = 8;
313
+ /**
314
+ * Length of each key entry in the 'layr' section variable part
315
+ */
316
+ this.length_layr_key = 4;
317
+ /* ------------------------------------------------------------------
318
+ * list section
319
+ ------------------------------------------------------------------ */
320
+ /**
321
+ * Minimum length of the 'list' section not including variable parts
322
+ */
323
+ this.length_list = 16;
324
+ /**
325
+ * Length of each list item in the 'list' list section variable part
326
+ */
327
+ this.length_list_item = 8;
328
+ /**
329
+ * Length of each list item in the 'list' indices section variable part
330
+ */
331
+ this.length_list_index = 4;
332
+ /* ------------------------------------------------------------------
333
+ * loca section
334
+ ------------------------------------------------------------------ */
335
+ /**
336
+ * Minimum length of the 'loca' section not including variable parts
337
+ */
338
+ this.length_loca = 12;
339
+ /**
340
+ * Length of each item in the 'loca' section variable part
341
+ */
342
+ this.length_loca_item = 4;
343
+ /* ------------------------------------------------------------------
344
+ * meta section
345
+ ------------------------------------------------------------------ */
346
+ /**
347
+ * length of the 'meta' section
348
+ */
349
+ this.length_meta = 36;
350
+ /**
351
+ * bitwise or value for fallback=omit in meta.settings
352
+ */
353
+ this.meta_settings_fallback_omit = 1;
354
+ /**
355
+ * bitwise or value for transformFailure=omit in meta.settings
356
+ */
357
+ this.meta_settings_transformFailure_omit = 2;
358
+ /**
359
+ * bitwise or value for transformPartial=hide in meta.settings
360
+ */
361
+ this.meta_settings_transformPartial_hide = 4;
362
+ /* ------------------------------------------------------------------
363
+ * name section
364
+ ------------------------------------------------------------------ */
365
+ /**
366
+ * Minimum length of the 'name' section not including variable parts
367
+ */
368
+ this.length_name = 12;
369
+ /**
370
+ * Length of each item in the 'name' section variable part
371
+ */
372
+ this.length_name_item = 4;
373
+ /* ------------------------------------------------------------------
374
+ * ordr section
375
+ ------------------------------------------------------------------ */
376
+ /**
377
+ * Minimum length of the 'ordr' section, not including entries
378
+ */
379
+ this.length_ordr = 12;
380
+ /**
381
+ * Length of each item in the 'ordr' section variable part
382
+ */
383
+ this.length_ordr_item = 8;
384
+ /* ------------------------------------------------------------------
385
+ * strs section
386
+ ------------------------------------------------------------------ */
387
+ /**
388
+ * Minimum length of the 'strs' section not including variable parts
389
+ */
390
+ this.length_strs = 12;
391
+ /**
392
+ * Length of each item in the 'strs' section variable part
393
+ */
394
+ this.length_strs_item = 8;
395
+ /* ------------------------------------------------------------------
396
+ * tran section
397
+ ------------------------------------------------------------------ */
398
+ /**
399
+ * Minimum length of the 'tran' section, not including entries
400
+ */
401
+ this.length_tran = 12;
402
+ /**
403
+ * Length of each item in the 'tran' section variable part
404
+ */
405
+ this.length_tran_item = 16;
406
+ /**
407
+ * bitwise or value for error="fail" in transform
408
+ */
409
+ this.tran_flags_error = 0x0001;
410
+ /* ------------------------------------------------------------------
411
+ * vkey section
412
+ ------------------------------------------------------------------ */
413
+ /**
414
+ * Minimum length of the 'vkey' section not including variable parts
415
+ */
416
+ this.length_vkey = 12;
417
+ /**
418
+ * Length of each item in the 'vkey' section variable part
419
+ */
420
+ this.length_vkey_item = 8;
421
+ /**
422
+ * All section IDs.
423
+ */
424
+ this.section = {
425
+ // keep this sorted
426
+ bksp: 'bksp',
427
+ disp: 'disp',
428
+ elem: 'elem',
429
+ finl: 'finl',
430
+ keys: 'keys',
431
+ layr: 'layr',
432
+ list: 'list',
433
+ loca: 'loca',
434
+ meta: 'meta',
435
+ name: 'name',
436
+ ordr: 'ordr',
437
+ sect: 'sect',
438
+ strs: 'strs',
439
+ tran: 'tran',
440
+ vkey: 'vkey'
441
+ };
442
+ }
443
+ /**
444
+ * Use to convert 4-char string into hex
445
+ * @param id section id such as 'sect'
446
+ * @returns hex ID such as 0x74636573
447
+ */
448
+ Constants.prototype.hex_section_id = function (id) {
449
+ if (!id || typeof id !== 'string' || !id.match(/^[a-z0-9]{4}$/)) {
450
+ throw Error("hex_section_id(".concat(id, ") - need a 4-character alphanumeric lower-case string"));
451
+ }
452
+ var r = 0;
453
+ for (var i = 3; i >= 0; i--) {
454
+ r = (r << 8 | id.charCodeAt(i));
455
+ }
456
+ return r;
457
+ };
458
+ ;
459
+ /**
460
+ * Use to convert hex into 4-char string
461
+ * @param hex section ID such as 0x74636573
462
+ * @returns string such as 'sect'
463
+ */
464
+ Constants.prototype.str_section_id = function (hex) {
465
+ var chars = [];
466
+ for (var i = 3; i >= 0; i--) {
467
+ chars.push(String.fromCharCode(hex & 0xFF));
468
+ hex >>= 8;
469
+ }
470
+ return chars.join('');
471
+ };
472
+ return Constants;
473
+ }());
474
+ ;
475
+ export var constants = new Constants();
476
+ // }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@keymanapp/ldml-keyboard-constants",
3
+ "description": "Keyman LDML keyboard constants",
4
+ "keywords": [
5
+ "keyboard",
6
+ "keyman",
7
+ "ldml",
8
+ "unicode"
9
+ ],
10
+ "files": [
11
+ "/build/keyboardprocessor_ldml.*"
12
+ ],
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "main": "build/keyboardprocessor_ldml.js",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/keymanapp/keyman.git"
19
+ },
20
+ "version": "17.0.87-alpha"
21
+ }