All files / src/types/kps kps-file.ts

100% Statements 213/213
100% Branches 0/0
100% Functions 0/0
100% Lines 213/213

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 2141x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/*
 * Keyman is copyright (C) SIL Global. MIT License.
 */
 
//
// The interfaces in this file are designed with reference to the mapped
// structures produced by fast-xml-parser when passed a .kps file.
//
// A few notes:
//
// * Arrays are buried a layer too deep (e.g. <Files><File/><File/></Files>
//   leads to KpsFiles.KpsFile[]. These are boxed automatically by
//   KpsFileReader.
// * Properties such as used in Info Items use `_` and `$` and must be
//   extracted.
// * Strings element is not yet checked to be correct
//
 
export interface KpsPackage {
  /**
   * <Package> -- the root element.
   */
  Package: KpsFile;
}
 
export interface KpsFile {
  System: KpsFileSystem;
  Options: KpsFileOptions;
  Info?: KpsFileInfo;
  Files?: KpsFileContentFiles;
  Keyboards?: KpsFileKeyboards;
  LexicalModels?: KpsFileLexicalModels;
  StartMenu?: KpsFileStartMenu;
  Strings?: KpsFileStrings;
  RelatedPackages?: KpsFileRelatedPackages;
}
 
export interface KpsFileSystem {
  KeymanDeveloperVersion: string;
  FileVersion: string;
}
 
export interface KpsFileOptions {
  FollowKeyboardVersion?: string;
  ReadMeFile?: string;
  GraphicFile?: string;
  LicenseFile?: string;
  WelcomeFile?: string;
  ExecuteProgram?: string;
  MSIFileName?: string;
  MSIOptions?: string;
}
 
export interface KpsFileInfo {
  Name?: KpsFileInfoItem;
  Copyright?: KpsFileInfoItem;
  Author?: KpsFileInfoItem;
  WebSite?: KpsFileInfoItem;
  Version?: KpsFileInfoItem;
  Description?: KpsFileInfoItem;
}
 
export interface KpsFileInfoItem {
  _: string;
  $: { URL: string };
}
 
export interface KpsFileContentFiles {
  File: KpsFileContentFile[];
}
 
export interface KpsFileContentFile {
  Name: string;
  /** @deprecated */
  Description?: string;
  /** @deprecated */
  CopyLocation?: string;
  /** @deprecated */
  FileType?: string;
}
 
export interface KpsFileLexicalModel {
  Name: string;
  ID: string;
  Languages: KpsFileLanguages;
}
 
export interface KpsFileLexicalModels {
  LexicalModel: KpsFileLexicalModel[];
}
 
export interface KpsFileLanguages {
  Language: KpsFileLanguage[];
}
 
export interface KpsFileLanguage {
  _: string;
  $: { ID: string }
}
 
export interface KpsFileRelatedPackages {
  RelatedPackage: KpsFileRelatedPackage[];
}
 
export interface KpsFileRelatedPackage {
  $: {
    ID: string;
    /**
     * relationship between this package and the related package, "related" is default if not specified
     */
    Relationship?: "deprecates";
  }
}
 
export interface KpsFileKeyboard {
  Name: string;     /// the descriptive name of the keyboard
  ID: string;       /// the keyboard identifier, equal to the basename of the keyboard file sans extension
  Version: string;
  OSKFont?: string;
  DisplayFont?: string;
  RTL?: string;
  Languages?: KpsFileLanguages;
  Examples?: KpsFileLanguageExamples;
  /**
   * array of web font alternatives for OSK. should be same font data as oskFont
   */
  WebOSKFonts?: KpsFileFonts;
  /**
   * array of web font alternatives for display. should be same font data as displayFont
   */
  WebDisplayFonts?: KpsFileFonts;
}
 
export interface KpsFileFonts {
  Font: KpsFileFont[];
}
 
export interface KpsFileFont {
  $: {
    Filename: string;
  }
}
 
export interface KpsFileKeyboards {
  Keyboard: KpsFileKeyboard[];
}
 
export interface KpsFileStartMenu {
  Folder?: string;
  AddUninstallEntry?: string;
  Items?: KpsFileStartMenuItems;
}
 
export interface KpsFileStartMenuItem {
  Name: string;
  FileName: string;
  Arguments?: string;
  Icon?: string;
  Location?: string;
}
 
export interface KpsFileStartMenuItems {
  Item: KpsFileStartMenuItem[];
}
 
export interface KpsFileStrings {
  String: KpsFileString[];
}
 
export interface KpsFileString {
  $: {
    Name: string;
    Value: string;
  }
}
 
export interface KpsFileLanguageExamples {
  Example: KpsFileLanguageExample[];
}
 
/**
 * An example key sequence intended to demonstrate how the keyboard works
 */
export interface KpsFileLanguageExample {
  $: {
    /**
     * BCP 47 identifier for the example
     */
    ID: string;
    /**
     * A space-separated list of keys.
     * - modifiers indicated with "+"
     * - spacebar is "space"
     * - plus key is "shift+=" or "plus" on US English (all other punctuation as per key cap).
     * - Hardware modifiers are: "shift", "ctrl", "alt", "left-ctrl",
     *   "right-ctrl", "left-alt", "right-alt"
     * - Key caps should generally be their character for desktop (Latin script
     *   case insensitive), or the actual key cap for touch
     * - Caps Lock should be indicated with "caps-on", "caps-off"
     *
     * e.g. "shift+a b right-alt+c space plus z z z" represents something like: "Ab{AltGr+C} +zzz"
     */
    Keys: string;
    /**
     * The text that would be generated by typing those keys
     */
    Text?: string;
    /**
     * A short description of what the text means or represents
     */
    Note?: string;
  }
}