import { CompilerCallbacks } from '@keymanapp/developer-utils'; /** * @public * Options for character analysis */ export interface AnalyzeOskCharacterUseOptions { /** * First character to use in PUA for remapping with &displayMap, defaults to * U+F100 */ puaBase?: number; /** * If true, strips U+25CC from the key cap before further analysis */ stripDottedCircle?: boolean; /** * If true, reports number of references to each character found in each * source file */ includeCounts?: boolean; /** * Filename of an existing mapping file to merge the results into */ mergeMapFile?: string; } /** * @public * Analyze the characters used in On Screen Keyboard files (.kvks, * .keyman-touch-layout) for use with `&displayMap`. */ export declare class AnalyzeOskCharacterUse { private callbacks; private _strings; private options; constructor(callbacks: CompilerCallbacks, options?: AnalyzeOskCharacterUseOptions); /** * Clears analysis data collected from previous calls to * {@link AnalyzeOskCharacterUse.analyze} */ clear(): void; /** * Analyzes a single source file for Unicode character usage. Can parse .kmn, * .kvks, .keyman-touch-layout file formats. Can be called multiple times to * collect results from more than one file. Use * {@link AnalyzeOskCharacterUse.getStrings} to retrieve results. * * Note: `analyze()` collects key cap data, so calling this for a .kmn file * will retrieve the key caps from the .kvks and .keyman-touch-layout files * that it references, rather than key cap data from the .kmn file itself. * * @param file - relative or absolute path to a Keyman source file * @returns true if the file is successfully loaded and parsed */ analyze(file: string): Promise; private analyzeKmnKeyboard; private addStrings; private cleanString; private scanVisualKeyboard; private scanTouchLayout; private prepareResults; /** * Returns the collected results from earlier calls to * {@link AnalyzeOskCharacterUse.analyze}. This generates a mapping from a key * cap (one or more characters) to a PUA code, for use with `&displayMap`. * * Three output formats are supported: * * - .txt: tab-separated string format, with three columns: PUA, Key Cap, and * plain string. The PUA and Key Cap columns are formatted as Unicode Scalar * Values, e.g. U+0061, and the plain string is the original key cap string. * * - .md: formatted for documentation purposes. Generates a Markdown table * (GFM) with PUA, Key Cap, and plain string. The PUA and Key Cap columns * are formatted as Unicode Scalar Values, e.g. U+0061, and the plain string * is the original key cap string. * * - .json: returns the final aggregated data as an array of strings, which * can be joined to form a JSON blob of an object with a single member, * `map`, which is an array of {@link Osk.StringResult} objects. * * @param format - file format to return - can be '.txt', '.md', or '.json' * @returns an array of strings, formatted according to the `format` * parameter. */ getStrings(format?: '.txt' | '.md' | '.json'): string[]; /** * Load a JSON-format result file to merge from * @param filename * @returns */ private loadPreviousMap; private static getStringsAsText; private static getStringsAsMarkdown; private static getStringsAsJson; private static stringToUnicodeSequence; } //# sourceMappingURL=index.d.ts.map