UNPKG

@keymanapp/ldml-keyboard-constants

Version:

Keyman LDML keyboard constants

392 lines 11.6 kB
/** * Defines the section identifiers and ensures that we include each and every * one of them in the `sections` block and gives us a type which we can iterate * through. */ export type SectionIdent = 'sect' | 'bksp' | 'disp' | 'elem' | 'keys' | 'layr' | 'list' | 'loca' | 'meta' | 'strs' | 'tran' | 'uset' | 'vars'; type SectionMap = { [id in SectionIdent]: SectionIdent; }; /** * Constants for the KMXPlus data format * These are shared between the data access layer and the compiler. * Note that the section IDs (section_keys etc.) are 32 bit hex * values that are designed to appear as text when written in little endian * format, so 0x7379656b = 'keys' */ declare class Constants { /** * The version of the LDML processor */ readonly version = "1.0"; /** * The current CLDR version */ readonly cldr_version_latest = "46"; /** * The version for testdata files */ readonly cldr_test_version_latest = "techpreview"; /** * import base */ readonly cldr_import_base = "cldr"; /** * implied keys file */ readonly cldr_implied_keys_import: string; /** * implied scancodes file */ readonly cldr_implied_forms_import: string; /** * Length of a raw section header, in bytes */ readonly length_header = 8; /** * Minimum length of the 'sect' section, not including entries */ readonly length_sect = 16; /** * Length of each item in the 'sect' section variable part */ readonly length_sect_item = 8; /** * Minimum length of the 'bksp' section, not including entries */ readonly length_bksp = 12; /** * Length of each item in the 'bksp' section variable part */ readonly length_bksp_item = 16; /** * bitwise or value for error="fail" in transform */ readonly bksp_flags_error = 1; /** * Minimum length of the 'disp' section, not including entries */ readonly length_disp = 16; /** * Length of each entry in the 'disp' variable part */ readonly length_disp_item = 12; /** * Minimum length of the 'elem' section, not including entries */ readonly length_elem = 12; /** * Length of each elem string in the 'elem' section variable part */ readonly length_elem_item = 8; /** * Length of each element in an elem string */ readonly length_elem_item_element = 8; /** * bitwise or value for type in elem[elemstr][element].flags. * If bits are 00b, then 'element' is a UTF-32LE codepoint. * If bits are 01b, then 'element' is a string index. * If bits are 10b (2), then 'element' is a uset index. * * `type = flags & elem_flags_type` */ readonly elem_flags_type = 3; readonly elem_flags_type_char = 0; readonly elem_flags_type_str = 1; readonly elem_flags_type_uset = 2; /** * bitwise or value for tertiary_base in elem[elemstr][element].flags. * If bit is 1, then tertiary_base is true. * If bit is 0, then tertiary_base is false. * * Used only for `ordr`-type element strings. * * `tertiary_base = flags & elem_flags_tertiary_base` */ readonly elem_flags_tertiary_base = 4; /** * bitwise or value for tertiary_base in elem[elemstr][element].flags. * If bit is 1, then prebase is true. * If bit is 0, then prebase is false. * * Used only for `ordr`-type element strings. * * `prebase = flags & elem_flags_prebase` */ readonly elem_flags_prebase = 8; /** * bitwise mask for order in elem[elemstr][element].flags. * * Used only for `ordr`-type element strings. 1 byte signed integer. * * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift` */ readonly elem_flags_order_mask = 16711680; /** * bit shift for order in elem[elemstr][element].flags. * * Used only for `ordr`-type element strings. * * `order = (flags & elem_flags_order_mask) >> elem_flags_order_bitshift` */ readonly elem_flags_order_bitshift = 16; /** * bitwise mask for tertiary sort in elem[elemstr][element].flags. * * Used only for `ordr`-type element strings. 1 byte signed integer. * * `tertiary = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift` */ readonly elem_flags_tertiary_mask = 4278190080; /** * bit shift for tertiary sort in elem[elemstr][element].flags. * * Used only for `ordr`-type element strings. 1 byte signed integer. * * `order = (flags & elem_flags_tertiary_mask) >> elem_flags_tertiary_bitshift` */ readonly elem_flags_tertiary_bitshift = 24; /** * Minimum length of the 'finl' section, not including entries */ readonly length_finl = 8; /** * Length of each item in the 'finl' section variable part */ readonly length_finl_item = 16; /** * bitwise or value for error="fail" in transform */ readonly finl_flags_error = 1; /** * Constant for no modifiers */ readonly keys_mod_none = 0; /** * bitmask for Left Alt modifier key */ readonly keys_mod_altL = 4; /** * bitmask for Right Alt (AltGr) modifier key */ readonly keys_mod_altR = 8; /** * bitmask for either Alt (Windows) or Option (Apple) modifier keys */ readonly keys_mod_alt = 64; /** * bitmask for Caps modifier key */ readonly keys_mod_caps = 256; /** * bitmask for Left control modifier key */ readonly keys_mod_ctrlL = 1; /** * bitmask for Right control modifier key */ readonly keys_mod_ctrlR = 2; /** * bitmask for either Control modifier key */ readonly keys_mod_ctrl = 32; /** * bitmask for either shift. */ readonly keys_mod_shift = 16; /** * bitmask for 'other'. */ readonly keys_mod_other = 65536; /** * Convenience map for modifiers */ readonly keys_mod_map: Map<string, number>; /** * a mask combining all valid modifier bits */ readonly keys_mod_all: number; /** * Minimum length of the 'keys' section not including variable parts */ readonly length_keys = 24; /** * Length of each item in the 'keys' keys sub-table */ readonly length_keys_key = 36; /** * Length of each item in the 'keys' flick lists sub-table */ readonly length_keys_flick_list = 12; /** * Length of each item in the 'keys' flick elements sub-table */ readonly length_keys_flick_element = 8; /** * Length of each item in the 'keys.kmap' key map subtable */ readonly length_keys_kmap = 12; /** * 0 if to is a char, 1 if it is a string */ readonly keys_key_flags_extend = 1; /** * 1 if the key is a gap */ readonly keys_key_flags_gap = 2; /** * Minimum length of the 'layr' section not including variable parts */ readonly length_layr = 24; /** * Length of each layer list in the 'layr' section variable part */ readonly length_layr_list = 16; /** * for the 'hardware' field indicating a touch keyboard, non-hardware */ readonly layr_list_hardware_touch = "touch"; /** * Length of each layer entry in the 'layr' section variable part */ readonly length_layr_entry = 16; /** * Length of each row entry in the 'layr' section variable part */ readonly length_layr_row = 8; /** * Length of each key entry in the 'layr' section variable part */ readonly length_layr_key = 4; /** * Minimum length of the 'list' section not including variable parts */ readonly length_list = 16; /** * Length of each list item in the 'list' list section variable part */ readonly length_list_item = 8; /** * Length of each list item in the 'list' indices section variable part */ readonly length_list_index = 4; /** * Minimum length of the 'loca' section not including variable parts */ readonly length_loca = 12; /** * Length of each item in the 'loca' section variable part */ readonly length_loca_item = 4; /** * length of the 'meta' section */ readonly length_meta = 36; /** * bitwise or value for normalization=disabled in meta.settings */ readonly meta_settings_normalization_disabled = 1; /** * Minimum length of the 'strs' section not including variable parts */ readonly length_strs = 12; /** * Length of each item in the 'strs' section variable part */ readonly length_strs_item = 8; /** * Minimum length of the 'tran' section, not including entries */ readonly length_tran = 20; /** * Length of each transform group item */ readonly length_tran_group = 12; /** * Length of each transform item */ readonly length_tran_transform = 16; /** * Length of each reorder subtable item */ readonly length_tran_reorder = 8; /** * bitwise or value for error="fail" in transform */ readonly tran_flags_error = 1; /** * this group is full of transform items */ readonly tran_group_type_transform = 0; /** * this group is full of reorder items */ readonly tran_group_type_reorder = 1; /** * Minimum length of the 'vars' section not including variable parts */ readonly length_vars = 16; /** * Length of each item in the 'vars' section variable part */ readonly length_vars_item = 16; /** * String variable */ readonly vars_entry_type_string = 0; /** * Set variable */ readonly vars_entry_type_set = 1; /** * unicodeSet variable */ readonly vars_entry_type_unicodeSet = 2; readonly length_uset = 16; /** * Length of each entry in the uset.usets subtable */ readonly length_uset_uset = 12; /** * Length of each entry in the uset.ranges subtable */ readonly length_uset_range = 8; /** * All section IDs. */ readonly section: SectionMap; /** * Use to convert 4-char string into hex * @param id section id such as 'sect' * @returns hex ID such as 0x74636573 */ hex_section_id(id: string): number; /** * Use to convert hex into 4-char string * @param hex section ID such as 0x74636573 * @returns string such as 'sect' */ str_section_id(hex: number): string; /** == kmx_file.UC_SENTINEL, always followed by `marker_code`, marker index 0x0001-0xfffe */ readonly uc_sentinel = 65535; /** == kmx_file.CODE_DEADKEY */ readonly marker_code = 8; /** used to refer to no index */ readonly marker_no_index = 0; /** minimum usable marker index */ readonly marker_min_index = 1; /** index value referring to the 'any' marker match */ readonly marker_any_index = 55295; /** maximum marker index prior to the 'any' value */ readonly marker_max_index: number; /** maximum count of markers (not including 'any') */ readonly marker_max_count: number; /** * List of versions to treat as if they were the 'latest' version. */ treatAsLatest(version: string): boolean; } export declare const constants: Constants; export {}; //# sourceMappingURL=keyman_core_ldml.d.ts.map