Skip to content

A stenography library that anyone can use and contribute to! Took 4 days to complete first version. Made By CrazyH2.

License

Notifications You must be signed in to change notification settings

CrazyH2/Kestrel.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE

This is just a steno engine library and it does NOT work on its own. Please use something else such as Plover or wait for my full steno engine. Huge thanks to the openstenoproject for all their amazing work!

A stenography library that anyone can use and contribute to! It's only 7KB as of writing and took 4 days to complete first version.
Made By CrazyH2

Take a look at plover as this wouldn't be possible without them!
Plover | Ploverpad

Docs

Go to the auto generated docs.. Ask if you're confused as the docs are very basic!

Installation

  • Download src code from the repo or go to Releases tab for all the versions.
  • Install packages and dependencies.
npm install
  • Reference in your code and Kestrel.js will do all the steno engine stuff for you.

Production Bundling

Just run the code below after installation:

npm run build

The code should appear in /dist when bundled!

Usage

NODE:

const { GlobalKeyboardListener } = require("node-global-key-listener");

const { Kestrel } = require("../lib/engine");
const Dictionary = require("../assets/dict.json");

(async () => {
    const app = await Kestrel();

    var gkl = new GlobalKeyboardListener();
    gkl.addListener((e, down) => {
        if(!e.name.includes("MOUSE")) app.input.fromQwerty(e.state == 'DOWN', e.name);
    });

    await app.output.onData((data) => {
        console.log(data);
    });

    await app.dictionaries.load(Dictionary);
})();

WEB:

<script type="module">
  import { Kestrel } from "../dist/kestrel.js";

  const app = await Kestrel();

  document.addEventListener("keydown", (ev) => {
    app.input.fromQwerty(true, ev.name);
  });

  document.addEventListener("keyup", (ev) => {
    app.input.fromQwerty(false, ev.name);
  });

  await app.output.onData((data) => {
    console.log(data);
    document.querySelector("#content").innerHTML = data;
  });

  var dict = await (await fetch("../assets/dict.json")).json();

  await app.dictionaries.load(dict);
</script>

Contributing

All contributions will be looked at and most likely accepted when I have time to look at them. Please make sure what you contribute actually applies to the project, and if not see if it would work elsewhere. For example Plover.

Dictionaries

We support most dictionaries that will work with Plover and other steno engines, so just import one you used to or learn one. Just make sure the file is in the format JSON otherwise the dictionary won't work with Kestrel.js. I personally recommend lapwing thory which you can learn online for free.

Making Addons

Ask for help or look at the source code when your stuck!

Example:

class AddonExample {
    constructor(convert) {
        this.isAddon = true;
        this.convert = convert;
    };

    onLoad() {

    };

    onUnload() {

    };

    onKeyDown(key) {

    };

    onKeyUp(key) {

    };

    async onChord(chord, output, next) {
        return next(); // Skip this addon
    };
};

module.exports = { AddonExample };

Macros

Just ask if the code confuses you!

Example:

const MacroExample = {
  name: "base",

  "CAPS-LOCK:ON": () => {
    return "Hello, world!"
  }
}

module.exports = { MacroExample };

License

Distributed under a Custom License. See `LICENSE` for more information.

Credits

- Huge thanks to Openstenoproject an the steno community for allowing this project to exist.
- Ploverpad was a huge help in parsing CTE/RTF for steno! - Main Dev: CrazyH2