spiegel-keyman/web
Joshua Horton 0726c50587
Merge pull request #12240 from keymanapp/fix/web/cherry-pick/doc-keyboard-spacebar-scaling
fix(web): fix documentation-keyboard spacebar-text scaling 🍒  🏠
2024-08-23 08:18:59 +07:00
..
src Merge pull request #12240 from keymanapp/fix/web/cherry-pick/doc-keyboard-spacebar-scaling 2024-08-23 08:18:59 +07:00
.build-builder chore(web): moves main web script to /web, adds .build-builder file as flag for CI 2022-10-18 13:59:19 +07:00
.c8rc.json chore(web): Add option to create test coverage report 2023-12-01 20:04:35 +01:00
.gitattributes
.gitignore change(web): unit_tests -> src/test/auto 2022-10-24 11:55:40 +07:00
.mocharc.json chore(web): sets up app/browser test suite, ensures Web TS test sets can be isolated 2024-01-22 13:12:40 +07:00
build.sh chore(web): drops redundant builder-dependency from early gesture dev 2024-04-22 11:28:55 +07:00
ci.sh Merge branch 'feature-gestures' into chore/merge-master-into-feature-gestures 2023-11-13 09:44:55 +11:00
common.inc.sh chore(web): suggestions from pr review 2024-01-23 10:44:55 +07:00
history.md chore: merge stable history 2020-04-29 06:33:31 +10:00
index.html refactor(web): Link to index.html in test pages 2023-11-07 09:38:15 +07:00
LICENSE
NOTICE
package.json fix(common): upgrade sentry-cli to 2.31.0 2024-04-03 10:48:35 +07:00
README.md docs(web): updates README, adds project-relationship diagram 2023-05-17 08:23:10 +07:00
test.sh Merge pull request #10250 from keymanapp/chore/web/attachmentTests 2023-12-15 08:13:50 +01:00
tsconfig.base.json chore(web): reduce strictness on ts 2023-10-05 15:32:43 +07:00

Keyman Engine for Web

The Original Code is (C) SIL International

Prerequisites

See build configuration for details on how to configure your build environment.


The following folders contain the distribution for Keyman Engine for Web:

src                        Source code
build/app/resources        OSK + UI resources for inclusion in all build types;
                           keymanweb-osk.ttf is maintained at https://github.com/silnrsi/font-keymanweb-osk

build/app/browser/release  Fully-compiled KeymanWeb modules for release
build/app/webview/release  Fully-compiled KMEA/KMEI modules for inclusion in mobile app builds
build/app/browser/debug    Fully-compiled but non-minified KeymanWeb modules
build/app/webview/debug    Fully-compiled but non-minified KMEA/KMEI modules

src/samples                Sample pages demonstrating ways to link with KeymanWeb
src/test/manual            Test-case web-pages for various aspects of KeymanWeb functionality
src/test/auto              A Node-driven test suite for automated testing of KeymanWeb

Usage

Open index.html or samples/index.html in your browser. Be sure to compile Keyman Engine for Web before viewing the pages.

Refer to the samples for usage details.

To view pages using compiled Keyman Engine for Web,

  1. cd to keyman/web/
  2. Run ./build.sh
    • Use ./build.sh --help for the script's documentation.

Unit Testing

Before running unit tests on Keyman Engine for Web, first run ./build.sh according to the instructions above.

Once the build is complete, running npm test will run the unit testing suite on your local machine in-browser. Alternatively, see test.sh, which the former command executes.

Debugging Unit Tests

  1. During development, to run a specific unit test, change the it to it.only. You can also run all tests under a specific group with describe.only.

  2. From this directory, run ./test.sh --debug. Alternatively, from web/ or any web/ subdirectory,

    npm run test -- --debug
    

    The -- part tells npm to funnel anything to the script as the script's command-line parameters. As long as it's run from somewhere within the web/ folder's hierarchy, that line will always run from web/, as that's where package.json is.

  3. When the browser halts, click the "Debug" button which opens a new debugging tab.

  4. In the Dev console, you can set a breakpoint in your test and refresh the page to debug

Approximate Overall Design

graph TD;
    OSK[web/src/engine/osk];
    KP["common/web/keyboard-processor"];
    IP["common/web/input-processor"];
    OSK-->KP;
    IP-->KP;
    Utils["common/web/utils"];
    KP---->Utils;
    Wordbreakers["common/models/wordbreakers"];
    Models["common/models/templates"];
    Models-->Utils;
    LMWorker["common/web/lm-worker"];
    LMWorker-->Models;
    LMWorker-->Wordbreakers;
    LMLayer["common/predictive-text"];
    LMLayer-->LMWorker;
    IP-->LMLayer;

    subgraph PredText["WebWorker + its interface"]
        LMLayer;
        LMWorker;
        Models;
        Wordbreakers;
    end

    subgraph Headless["Fully headless components"]
        direction LR
        KP;
        IP;
        Utils;
        PredText;
    end

    subgraph ClassicWeb["Previously unmodularized components"]
        Device[web/src/engine/device-detect];
        Device----->Utils;
        Elements[web/src/engine/element-wrappers];
        Elements-->KP;
        KeyboardCache[web/src/engine/package-cache];
        KeyboardCache-->IP;
        DomUtils[web/src/engine/dom-utils];
        DomUtils-->Utils;
        OSK-->DomUtils;
        OSK---->IP;
        Configuration[web/src/engine/paths];
        Configuration-->OSK;
        CommonEngine[web/src/engine/main];
        CommonEngine-->Configuration;
        CommonEngine-->Device;
        CommonEngine-->KeyboardCache;
        CommonEngine-->OSK;
        Attachment[web/src/engine/attachment];
        Attachment-->DomUtils;
        Attachment-->Elements;
    end

    subgraph WebEngine["Keyman Engine for Web (top-level libraries)"]
        Browser[web/src/app/browser];
        WebView[web/src/app/webview];

        WebView--->CommonEngine;

        Browser--->CommonEngine;
        Browser-->Attachment;
    end