@keymanapp/kmc-generate 18.0.138-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.
- package/build/src/abstract-generator.d.ts +167 -0
- package/build/src/abstract-generator.d.ts.map +1 -0
- package/build/src/abstract-generator.js +137 -0
- package/build/src/abstract-generator.js.map +1 -0
- package/build/src/basic-generator.d.ts +34 -0
- package/build/src/basic-generator.d.ts.map +1 -0
- package/build/src/basic-generator.js +119 -0
- package/build/src/basic-generator.js.map +1 -0
- package/build/src/generator-messages.d.ts +33 -0
- package/build/src/generator-messages.d.ts.map +1 -0
- package/build/src/generator-messages.js +34 -0
- package/build/src/generator-messages.js.map +1 -0
- package/build/src/keyman-keyboard-generator.d.ts +32 -0
- package/build/src/keyman-keyboard-generator.d.ts.map +1 -0
- package/build/src/keyman-keyboard-generator.js +89 -0
- package/build/src/keyman-keyboard-generator.js.map +1 -0
- package/build/src/ldml-keyboard-generator.d.ts +25 -0
- package/build/src/ldml-keyboard-generator.d.ts.map +1 -0
- package/build/src/ldml-keyboard-generator.js +52 -0
- package/build/src/ldml-keyboard-generator.js.map +1 -0
- package/build/src/lexical-model-generator.d.ts +25 -0
- package/build/src/lexical-model-generator.d.ts.map +1 -0
- package/build/src/lexical-model-generator.js +50 -0
- package/build/src/lexical-model-generator.js.map +1 -0
- package/build/src/main.d.ts +6 -0
- package/build/src/main.d.ts.map +1 -0
- package/build/src/main.js +10 -0
- package/build/src/main.js.map +1 -0
- package/build/src/template/kmn-keyboard/HISTORY.md +6 -0
- package/build/src/template/kmn-keyboard/LICENSE.md +21 -0
- package/build/src/template/kmn-keyboard/README.md +18 -0
- package/build/src/template/kmn-keyboard/keyboard.kpj +8 -0
- package/build/src/template/kmn-keyboard/source/keyboard.keyman-touch-layout +655 -0
- package/build/src/template/kmn-keyboard/source/keyboard.kmn +14 -0
- package/build/src/template/kmn-keyboard/source/keyboard.kps +47 -0
- package/build/src/template/kmn-keyboard/source/keyboard.kvks +8 -0
- package/build/src/template/kmn-keyboard/source/readme.htm +24 -0
- package/build/src/template/kmn-keyboard/source/welcome.htm +26 -0
- package/build/src/template/ldml-keyboard/HISTORY.md +6 -0
- package/build/src/template/ldml-keyboard/LICENSE.md +21 -0
- package/build/src/template/ldml-keyboard/README.md +18 -0
- package/build/src/template/ldml-keyboard/keyboard.kpj +8 -0
- package/build/src/template/ldml-keyboard/source/keyboard.kps +44 -0
- package/build/src/template/ldml-keyboard/source/keyboard.xml +40 -0
- package/build/src/template/ldml-keyboard/source/readme.htm +24 -0
- package/build/src/template/ldml-keyboard/source/welcome.htm +26 -0
- package/build/src/template/wordlist-lexical-model/HISTORY.md +6 -0
- package/build/src/template/wordlist-lexical-model/LICENSE.md +21 -0
- package/build/src/template/wordlist-lexical-model/README.md +17 -0
- package/build/src/template/wordlist-lexical-model/model.kpj +10 -0
- package/build/src/template/wordlist-lexical-model/source/model.kps +42 -0
- package/build/src/template/wordlist-lexical-model/source/model.ts +14 -0
- package/build/src/template/wordlist-lexical-model/source/readme.htm +24 -0
- package/build/src/template/wordlist-lexical-model/source/welcome.htm +28 -0
- package/build/src/template/wordlist-lexical-model/source/wordlist.tsv +16 -0
- package/package.json +65 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Keyman is copyright (C) SIL International. MIT License.
|
|
3
|
+
*
|
|
4
|
+
* Generate a Keyman keyboard project (.kmn source)
|
|
5
|
+
*/
|
|
6
|
+
import { KeymanTargets } from '@keymanapp/common-types';
|
|
7
|
+
import { BasicGenerator } from './basic-generator.js';
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
* Generate a Keyman keyboard project. The generator does not read or write from
|
|
11
|
+
* filesystem or network directly, but relies on callbacks for all external IO.
|
|
12
|
+
*/
|
|
13
|
+
export class KeymanKeyboardGenerator extends BasicGenerator {
|
|
14
|
+
// Future: we probably want to have a more abstract implementation so that we
|
|
15
|
+
// can use this for both generate and clone keyboard?
|
|
16
|
+
//
|
|
17
|
+
// So we have a structure of an entire project passed into to a writer. Even if
|
|
18
|
+
// we can't cleanly reuse at least we can copy the code more easily and it will
|
|
19
|
+
// be more maintainable.
|
|
20
|
+
//
|
|
21
|
+
// But for now we are working with plain text approach
|
|
22
|
+
static SFile_Keyboard = 'keyboard';
|
|
23
|
+
static SFile_KeyboardKMN = `${this.SPath_Source}${this.SFile_Keyboard}${".kmn" /* KeymanFileTypes.Source.KeymanKeyboard */}`;
|
|
24
|
+
static SFile_KeyboardKPS = `${this.SPath_Source}${this.SFile_Keyboard}${".kps" /* KeymanFileTypes.Source.Package */}`;
|
|
25
|
+
static SFile_KeyboardKVKS = `${this.SPath_Source}${this.SFile_Keyboard}${".kvks" /* KeymanFileTypes.Source.VisualKeyboard */}`;
|
|
26
|
+
static SFile_TouchLayout = `${this.SPath_Source}${this.SFile_Keyboard}${".keyman-touch-layout" /* KeymanFileTypes.Source.TouchLayout */}`;
|
|
27
|
+
static SFile_Project = `${this.SFile_Keyboard}${".kpj" /* KeymanFileTypes.Source.Project */}`;
|
|
28
|
+
/**
|
|
29
|
+
* Generate a Keyman Keyboard project. Returns an object containing binary
|
|
30
|
+
* artifacts on success. The files are passed in by name, and the compiler
|
|
31
|
+
* will use callbacks as passed to the {@link AbstractGenerator.init}
|
|
32
|
+
* function to read any input files by disk.
|
|
33
|
+
* @returns Binary artifacts on success, null on failure.
|
|
34
|
+
*/
|
|
35
|
+
async run() {
|
|
36
|
+
this.preGenerate();
|
|
37
|
+
const artifacts = this.defaultArtifacts();
|
|
38
|
+
this.templatePath = 'kmn-keyboard';
|
|
39
|
+
this.filenameMap[KeymanKeyboardGenerator.SFile_Project] = this.options.id + ".kpj" /* KeymanFileTypes.Source.Project */;
|
|
40
|
+
if (this.hasKVKS()) {
|
|
41
|
+
this.includedPrefixes.push('KVKS');
|
|
42
|
+
this.filenameMap[KeymanKeyboardGenerator.SFile_KeyboardKVKS] =
|
|
43
|
+
KeymanKeyboardGenerator.SPath_Source + this.options.id + ".kvks" /* KeymanFileTypes.Source.VisualKeyboard */;
|
|
44
|
+
}
|
|
45
|
+
if (this.hasWeb()) {
|
|
46
|
+
this.includedPrefixes.push('Web');
|
|
47
|
+
}
|
|
48
|
+
if (this.hasTouchLayout()) {
|
|
49
|
+
this.includedPrefixes.push('TouchLayout');
|
|
50
|
+
this.filenameMap[KeymanKeyboardGenerator.SFile_TouchLayout] =
|
|
51
|
+
KeymanKeyboardGenerator.SPath_Source + this.options.id + ".keyman-touch-layout" /* KeymanFileTypes.Source.TouchLayout */;
|
|
52
|
+
}
|
|
53
|
+
if (this.hasIcon()) {
|
|
54
|
+
this.includedPrefixes.push('Icon');
|
|
55
|
+
}
|
|
56
|
+
if (this.hasKMX()) {
|
|
57
|
+
this.includedPrefixes.push('KMX');
|
|
58
|
+
}
|
|
59
|
+
this.filenameMap[KeymanKeyboardGenerator.SFile_KeyboardKMN] =
|
|
60
|
+
KeymanKeyboardGenerator.SPath_Source + this.options.id + ".kmn" /* KeymanFileTypes.Source.KeymanKeyboard */;
|
|
61
|
+
this.filenameMap[KeymanKeyboardGenerator.SFile_KeyboardKPS] =
|
|
62
|
+
KeymanKeyboardGenerator.SPath_Source + this.options.id + ".kps" /* KeymanFileTypes.Source.Package */;
|
|
63
|
+
if (!this.generate(artifacts)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
// Special case for creating icon, run after successful creation of other
|
|
67
|
+
// project bits and pieces
|
|
68
|
+
if (this.hasIcon()) {
|
|
69
|
+
this.writeIcon(artifacts);
|
|
70
|
+
}
|
|
71
|
+
return { artifacts };
|
|
72
|
+
}
|
|
73
|
+
targetIncludes = (targets) => {
|
|
74
|
+
return this.resolvedTargets.some(t => targets.includes(t));
|
|
75
|
+
};
|
|
76
|
+
hasKVKS = () => this.targetIncludes(KeymanTargets.KeymanTargetsUsingKVK);
|
|
77
|
+
hasWeb = () => this.targetIncludes(KeymanTargets.KMWKeymanTargets);
|
|
78
|
+
hasKMX = () => this.targetIncludes(KeymanTargets.KMXKeymanTargets);
|
|
79
|
+
hasTouchLayout = () => this.targetIncludes(KeymanTargets.TouchKeymanTargets);
|
|
80
|
+
// TODO-GENERATE, once writeIcon is implemented:
|
|
81
|
+
// hasIcon = () => this.options.icon && this.targetIncludes(KeymanTargets.KMXKeymanTargets);
|
|
82
|
+
hasIcon = () => false;
|
|
83
|
+
writeIcon(artifacts) {
|
|
84
|
+
// TODO-GENERATE: this will require some effort
|
|
85
|
+
// proposal: generate 16x16 icon with 2-3 letters. Following TKeyboardIconGenerator.GenerateIcon
|
|
86
|
+
// research for .ico writer in node
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=keyman-keyboard-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyman-keyboard-generator.js","sourceRoot":"","sources":["../../src/keyman-keyboard-generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAmB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,OAAO,uBAAwB,SAAQ,cAAc;IACzD,8EAA8E;IAC9E,sDAAsD;IACtD,EAAE;IACF,gFAAgF;IAChF,gFAAgF;IAChF,yBAAyB;IACzB,EAAE;IACF,uDAAuD;IAEvD,MAAM,CAAU,cAAc,GAAG,UAAU,CAAC;IAC5C,MAAM,CAAU,iBAAiB,GAAG,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,GAAG,kDAAqC,EAAE,CAAC;IACzH,MAAM,CAAU,iBAAiB,GAAG,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,GAAG,2CAA8B,EAAE,CAAC;IAClH,MAAM,CAAU,kBAAkB,GAAG,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,GAAG,mDAAqC,EAAE,CAAC;IAC1H,MAA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,CAAC,CAAC;IAE9F,gDAAgD;IAChD,4FAA4F;IAC3E,OAAO,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;IAE/B,SAAS,CAAC,SAA6B;QAC7C,+CAA+C;QAC/C,gGAAgG;QAChG,mCAAmC;IACrC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { KeymanCompiler } from '@keymanapp/developer-utils';
|
|
2
|
+
import { GeneratorResult } from './abstract-generator.js';
|
|
3
|
+
import { BasicGenerator } from './basic-generator.js';
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
* Generate a LDML keyboard project. The generator does not read or write from
|
|
7
|
+
* filesystem or network directly, but relies on callbacks for all external IO.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LdmlKeyboardGenerator extends BasicGenerator implements KeymanCompiler {
|
|
10
|
+
protected static readonly SFile_Keyboard = "keyboard";
|
|
11
|
+
static readonly SFile_KeyboardXML: string;
|
|
12
|
+
static readonly SFile_Package: string;
|
|
13
|
+
static readonly SFile_Project: string;
|
|
14
|
+
/**
|
|
15
|
+
* Generate a LDML Keyboard project. Returns an object containing binary
|
|
16
|
+
* artifacts on success. The files are passed in by name, and the compiler
|
|
17
|
+
* will use callbacks as passed to the {@link AbstractGenerator.init}
|
|
18
|
+
* function to read any input files by disk.
|
|
19
|
+
* @returns Binary artifacts on success, null on failure.
|
|
20
|
+
*/
|
|
21
|
+
run(): Promise<GeneratorResult>;
|
|
22
|
+
private readonly generateFirstLangTag;
|
|
23
|
+
private readonly generateAlternateLangTags;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ldml-keyboard-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ldml-keyboard-generator.d.ts","sourceRoot":"","sources":["../../src/ldml-keyboard-generator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAG,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAsB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,cAAe,YAAW,cAAc;IACjF,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,cAAc;IACtD,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAAsF;IACvH,MAAM,CAAC,QAAQ,CAAC,aAAa,SAAiF;IAC9G,MAAM,CAAC,QAAQ,CAAC,aAAa,SAA6D;IAE1F;;;;;;OAMG;IACG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;IAsBrC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAuD;IAC5F,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAWzC;CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Keyman is copyright (C) SIL International. MIT License.
|
|
3
|
+
*
|
|
4
|
+
* Generate a Keyman LDML keyboard project (.xml source)
|
|
5
|
+
*/
|
|
6
|
+
import { BasicGenerator } from './basic-generator.js';
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
* Generate a LDML keyboard project. The generator does not read or write from
|
|
10
|
+
* filesystem or network directly, but relies on callbacks for all external IO.
|
|
11
|
+
*/
|
|
12
|
+
export class LdmlKeyboardGenerator extends BasicGenerator {
|
|
13
|
+
static SFile_Keyboard = 'keyboard';
|
|
14
|
+
static SFile_KeyboardXML = `${this.SPath_Source}${this.SFile_Keyboard}${".xml" /* KeymanFileTypes.Source.LdmlKeyboard */}`;
|
|
15
|
+
static SFile_Package = `${this.SPath_Source}${this.SFile_Keyboard}${".kps" /* KeymanFileTypes.Source.Package */}`;
|
|
16
|
+
static SFile_Project = `${this.SFile_Keyboard}${".kpj" /* KeymanFileTypes.Source.Project */}`;
|
|
17
|
+
/**
|
|
18
|
+
* Generate a LDML Keyboard project. Returns an object containing binary
|
|
19
|
+
* artifacts on success. The files are passed in by name, and the compiler
|
|
20
|
+
* will use callbacks as passed to the {@link AbstractGenerator.init}
|
|
21
|
+
* function to read any input files by disk.
|
|
22
|
+
* @returns Binary artifacts on success, null on failure.
|
|
23
|
+
*/
|
|
24
|
+
async run() {
|
|
25
|
+
this.preGenerate();
|
|
26
|
+
const artifacts = this.defaultArtifacts();
|
|
27
|
+
this.templatePath = 'ldml-keyboard';
|
|
28
|
+
this.filenameMap[LdmlKeyboardGenerator.SFile_Project] =
|
|
29
|
+
this.options.id + ".kpj" /* KeymanFileTypes.Source.Project */;
|
|
30
|
+
this.filenameMap[LdmlKeyboardGenerator.SFile_KeyboardXML] =
|
|
31
|
+
LdmlKeyboardGenerator.SPath_Source + this.options.id + ".xml" /* KeymanFileTypes.Source.LdmlKeyboard */;
|
|
32
|
+
this.filenameMap[LdmlKeyboardGenerator.SFile_Package] =
|
|
33
|
+
LdmlKeyboardGenerator.SPath_Source + this.options.id + ".kps" /* KeymanFileTypes.Source.Package */;
|
|
34
|
+
this.tokenMap['$LANG_TAG'] = this.generateFirstLangTag();
|
|
35
|
+
this.tokenMap['$ADDITIONAL_LANG_TAGS'] = this.generateAlternateLangTags();
|
|
36
|
+
if (!this.generate(artifacts)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return { artifacts };
|
|
40
|
+
}
|
|
41
|
+
generateFirstLangTag = () => this.languageTags?.[0] ?? this.DEFAULT_LOCALE;
|
|
42
|
+
generateAlternateLangTags = () => {
|
|
43
|
+
if (this.languageTags.length < 2) {
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
const result = ` <locales>\n` +
|
|
47
|
+
this.languageTags.slice(1).map(tag => ` <locale id="${tag}" />`).join('\n') +
|
|
48
|
+
`\n </locales>`;
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ldml-keyboard-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ldml-keyboard-generator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CAAC;QAE1E,IAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,EAAC,SAAS,EAAC,CAAC;IACrB,CAAC;IAEgB,oBAAoB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC;IAC3E,yBAAyB,GAAG,GAAG,EAAE;QAChD,IAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,MAAM,GACV,eAAe;YACf,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC9E,gBAAgB,CAAC;QAEnB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { KeymanCompiler } from '@keymanapp/developer-utils';
|
|
2
|
+
import { GeneratorResult } from './abstract-generator.js';
|
|
3
|
+
import { BasicGenerator } from './basic-generator.js';
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
* Generate a Keyman lexical model project. The generator does not read or write
|
|
7
|
+
* from filesystem or network directly, but relies on callbacks for all external
|
|
8
|
+
* IO.
|
|
9
|
+
*/
|
|
10
|
+
export declare class LexicalModelGenerator extends BasicGenerator implements KeymanCompiler {
|
|
11
|
+
static readonly SFile_Model = "model";
|
|
12
|
+
static readonly SFile_ModelTs: string;
|
|
13
|
+
static readonly SFile_WordlistTsv: string;
|
|
14
|
+
static readonly SFile_Project: string;
|
|
15
|
+
static readonly SFile_Package: string;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a Lexical Model project. Returns an object containing binary
|
|
18
|
+
* artifacts on success. The files are passed in by name, and the compiler
|
|
19
|
+
* will use callbacks as passed to the {@link AbstractGenerator.init}
|
|
20
|
+
* function to read any input files by disk.
|
|
21
|
+
* @returns Binary artifacts on success, null on failure.
|
|
22
|
+
*/
|
|
23
|
+
run(): Promise<GeneratorResult>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=lexical-model-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexical-model-generator.d.ts","sourceRoot":"","sources":["../../src/lexical-model-generator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAA0B,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAsB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,cAAe,YAAW,cAAc;IACjF,MAAM,CAAC,QAAQ,CAAC,WAAW,WAAW;IACtC,MAAM,CAAC,QAAQ,CAAC,aAAa,SAAgD;IAC7E,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAAsC;IACvE,MAAM,CAAC,QAAQ,CAAC,aAAa,SAA0D;IACvF,MAAM,CAAC,QAAQ,CAAC,aAAa,SAA8E;IAE3G;;;;;;OAMG;IACG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;CA2BtC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Keyman is copyright (C) SIL International. MIT License.
|
|
3
|
+
*
|
|
4
|
+
* Generate a Keyman lexical model project
|
|
5
|
+
*/
|
|
6
|
+
import { SourceFilenamePatterns } from '@keymanapp/developer-utils';
|
|
7
|
+
import { BasicGenerator } from './basic-generator.js';
|
|
8
|
+
import { GeneratorMessages } from './generator-messages.js';
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
* Generate a Keyman lexical model project. The generator does not read or write
|
|
12
|
+
* from filesystem or network directly, but relies on callbacks for all external
|
|
13
|
+
* IO.
|
|
14
|
+
*/
|
|
15
|
+
export class LexicalModelGenerator extends BasicGenerator {
|
|
16
|
+
static SFile_Model = 'model';
|
|
17
|
+
static SFile_ModelTs = `${this.SPath_Source}${this.SFile_Model}.ts`;
|
|
18
|
+
static SFile_WordlistTsv = `${this.SPath_Source}wordlist.tsv`;
|
|
19
|
+
static SFile_Project = `${this.SFile_Model}${".kpj" /* KeymanFileTypes.Source.Project */}`;
|
|
20
|
+
static SFile_Package = `${this.SPath_Source}${this.SFile_Model}${".kps" /* KeymanFileTypes.Source.Package */}`;
|
|
21
|
+
/**
|
|
22
|
+
* Generate a Lexical Model project. Returns an object containing binary
|
|
23
|
+
* artifacts on success. The files are passed in by name, and the compiler
|
|
24
|
+
* will use callbacks as passed to the {@link AbstractGenerator.init}
|
|
25
|
+
* function to read any input files by disk.
|
|
26
|
+
* @returns Binary artifacts on success, null on failure.
|
|
27
|
+
*/
|
|
28
|
+
async run() {
|
|
29
|
+
this.preGenerate();
|
|
30
|
+
const artifacts = this.defaultArtifacts();
|
|
31
|
+
this.templatePath = 'wordlist-lexical-model';
|
|
32
|
+
this.filenameMap[LexicalModelGenerator.SFile_Project] =
|
|
33
|
+
this.options.id + ".kpj" /* KeymanFileTypes.Source.Project */;
|
|
34
|
+
this.filenameMap[LexicalModelGenerator.SFile_ModelTs] =
|
|
35
|
+
LexicalModelGenerator.SPath_Source + this.options.id + ".model.ts" /* KeymanFileTypes.Source.Model */;
|
|
36
|
+
this.filenameMap[LexicalModelGenerator.SFile_WordlistTsv] =
|
|
37
|
+
LexicalModelGenerator.SFile_WordlistTsv;
|
|
38
|
+
// Note: lexical models use .model.kps for package extension
|
|
39
|
+
const packageFilename = this.options.id + '.model' + ".kps" /* KeymanFileTypes.Source.Package */;
|
|
40
|
+
if (!SourceFilenamePatterns.MODEL_ID_PATTERN_PACKAGE.test(packageFilename)) {
|
|
41
|
+
this.callbacks.reportMessage(GeneratorMessages.Warn_ModelIdDoesNotFollowLexicalModelConventions({ id: this.options.id }));
|
|
42
|
+
}
|
|
43
|
+
this.filenameMap[LexicalModelGenerator.SFile_Package] = LexicalModelGenerator.SPath_Source + packageFilename;
|
|
44
|
+
if (!this.generate(artifacts)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return { artifacts };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=lexical-model-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexical-model-generator.js","sourceRoot":"","sources":["../../src/lexical-model-generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAkB,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACvD,MAAM,CAAU,WAAW,GAAG,OAAO,CAAC;IACtC,MAAM,CAAU,aAAa,GAAG,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,KAAK,CAAC;IAC7E,MAAM,CAAU,iBAAiB,GAAG,GAAG,IAAI,CAAC,YAAY,cAAc,CAAC;IACvE,MAAM,CAAU,aAAa,GAAG,GAAG,IAAI,CAAC,WAAW,GAAG,2CAA8B,EAAE,CAAC;IACvF,MAAM,CAAU,aAAa,GAAG,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,GAAG,2CAA8B,EAAE,CAAC;IAE3G;;;;;;OAMG;IACH,KAAK,CAAC,GAAG;QACP,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,MAAM,SAAS,GAAuB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAE9D,IAAI,CAAC,YAAY,GAAG,wBAAwB,CAAC;QAC7C,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,aAAa,CAAC;YACnD,IAAI,CAAC,OAAO,CAAC,EAAE,8CAA+B,CAAC;QACjD,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,aAAa,CAAC;YACnD,qBAAqB,CAAC,YAAY,GAAC,IAAI,CAAC,OAAO,CAAC,EAAE,iDAA6B,CAAC;QAClF,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,iBAAiB,CAAC;YACvD,qBAAqB,CAAC,iBAAiB,CAAC;QAE1C,4DAA4D;QAC5D,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,GAAC,QAAQ,8CAA+B,CAAC;QAChF,IAAG,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YAC1E,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,iBAAiB,CAAC,gDAAgD,CAAC,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAC,CAAC,CAAC,CAAC;QAC1H,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,aAAa,CAAC,GAAG,qBAAqB,CAAC,YAAY,GAAC,eAAe,CAAC;QAE3G,IAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,EAAC,SAAS,EAAC,CAAC;IACrB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AbstractGenerator, GeneratorOptions } from "./abstract-generator.js";
|
|
2
|
+
export { KeymanKeyboardGenerator } from "./keyman-keyboard-generator.js";
|
|
3
|
+
export { LexicalModelGenerator } from "./lexical-model-generator.js";
|
|
4
|
+
export { LdmlKeyboardGenerator } from "./ldml-keyboard-generator.js";
|
|
5
|
+
export { GeneratorMessages } from "./generator-messages.js";
|
|
6
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Keyman is copyright (C) SIL International. MIT License.
|
|
3
|
+
*/
|
|
4
|
+
/* c8 ignore start */
|
|
5
|
+
export { AbstractGenerator } from "./abstract-generator.js";
|
|
6
|
+
export { KeymanKeyboardGenerator } from "./keyman-keyboard-generator.js";
|
|
7
|
+
export { LexicalModelGenerator } from "./lexical-model-generator.js";
|
|
8
|
+
export { LdmlKeyboardGenerator } from "./ldml-keyboard-generator.js";
|
|
9
|
+
export { GeneratorMessages } from "./generator-messages.js";
|
|
10
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAqB;AACrB,OAAO,EAAE,iBAAiB,EAAoB,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
$FULLCOPYRIGHT
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
$NAME keyboard
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
Description
|
|
5
|
+
-----------
|
|
6
|
+
$DESCRIPTION
|
|
7
|
+
|
|
8
|
+
Links
|
|
9
|
+
-----
|
|
10
|
+
Keyboard Homepage: https://keyman.com/keyboards/$ID
|
|
11
|
+
|
|
12
|
+
Copyright
|
|
13
|
+
---------
|
|
14
|
+
See [LICENSE.md](LICENSE.md)
|
|
15
|
+
|
|
16
|
+
Supported Platforms
|
|
17
|
+
-------------------
|
|
18
|
+
$PLATFORMS_DOTLIST_README
|