mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 16:35:33 +00:00
Use a new flag `--npm-publish` in conjunction with `publish` action, so that the default will always be to `npm pack` if the new flag is not specified. This flag is also guarded in the actual npm publish code to ensure that it can only run in the appropriate CI alpha/beta/stable environment, and not in local or test. This then also removes the separate `pack` action. Also removes legacy boilerplate from a number of build scripts. |
||
|---|---|---|
| .. | ||
| .build-builder | ||
| .gitignore | ||
| build.sh | ||
| index.d.ts | ||
| package.json | ||
| README.md | ||
| test.ts | ||
| tsconfig.json | ||
@keymanapp/models-types
Declares TypeScript types and interfaces required to define Lexical Models, Word breaking functions, and all things in between.
Install
(see below if you are working in the keymanapp/keyman repo!)
npm install --save-dev @keymanapp/models-types
Usage
Say you are creating a custom lexical model. Then import this module in your lexical model file!
// my-nifty-model.ts
import "@keymanapp/models-types";
export class MyNiftyClass implements LexicalModel {
configure(capabilities: Capabilities): Configuration {
// TODO: implement me!
throw new Error("Method not implemented.");
}
predict(transform: Transform, context: Context): ProbabilityMass<Suggestion>[] {
// TODO: implement me!
throw new Error("Method not implemented.");
}
wordbreak(context: Context): string {
// TODO: implement me!
throw new Error("Method not implemented.");
}
punctuation?: LexicalModelPunctuation;
}
If your are creating a custom word breaker, you would do the same:
import "@keymanapp/models-types";
export let myShinyWordBreaker: WordBreakingFunction;
myShinyWordBreaker = function (phrase: string): Span[] {
// TODO: implement me!
throw new Error("Function not implemented")
}
Look at index.d.ts for documentation on each and every type!
Usage within keymanapp/keyman repo
To use it in other subprojects within keymanapp/keyman, ensure that this package
is linked using "*". Add this dependency to your subproject like so:
"dependencies": {
"@keymanapp/models-types": "*",
}