spiegel-keyman/web
Joshua Horton 8a165d24b4 change(web): remove duplicate correction-search path filtering
Upon investigation into the code being removed, this mostly triggered whenever an empty transform appeared in the input - during a context reset, at initialization, or when a deadkey is typed.  (Deadkeys aren't sent to the pred-text engine.)  This is generally not a common case within the engine, and there exists other filtering that helps prevent duplicating search results.

Suppose a token that begins tagged with an empty transform.  When the search performs an 'insertion' to better lookup words down a lexical path, the 'insertion' is identical whether before or after an empty transform.  Similarly, insertions after a deletion appear no different than substitutions (or the same insertion before the deletion, then the deletion itself).

The code likely didn't gain us much, as it likely carried some performance overhead - it built a large object that required memory and lookup time that involved constructing and processing strings for hashing.

Build-bot: skip build:web
Test-bot: skip
2026-01-09 10:59:38 -06:00
..
docs Merge pull request #14646 from keymanapp/refactor/common/13205_UnifyWhatsNew 2025-09-05 09:44:02 +02:00
src change(web): remove duplicate correction-search path filtering 2026-01-09 10:59:38 -06: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): fix coverage-reporting artifact 2025-02-12 15:56:54 +07:00
.gitattributes Patches up the /samples pages. 2018-01-08 09:51:19 +07:00
.gitignore change(web): unit_tests -> src/test/auto 2022-10-24 11:55:40 +07:00
.mocharc.json chore(web): allow to run unit tests in vscode test explorer 2024-09-11 19:28:33 +02:00
build.sh Merge branch 'epic/autocorrect' into feat/web/punctuation-whitespace-reversion 2025-09-03 12:20:57 -05:00
ci.sh maint(web): skip unnecessary steps for build buildLevel 2025-08-13 09:10:07 +02:00
common.inc.sh maint(resources): nest unit tests under parent block 2025-10-06 16:09:47 +02: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 Move KeymanWeb project to web/ 2017-05-26 11:00:34 +07:00
NOTICE Move KeymanWeb project to web/ 2017-05-26 11:00:34 +07:00
package.json maint: update mocha 2025-05-13 14:02:02 +07:00
README.md chore: seed epic/autocorrect 2025-01-15 08:30:55 +07:00
test.sh maint(common): move build-utils-ci.inc.sh to ci/ci-publish.inc.sh 2025-08-05 12:54:56 +10:00
tsconfig.base.json change(web): remove support for es5 2024-07-04 20:49:30 +02:00

Keyman Engine for Web

The Original Code is (C) SIL Global

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

---
title: Dependency Graph
---
%% For rendering, use e.g. https://mermaid.live
%%{init: {"flowchart": {"htmlLabels": false}} }%%
graph TD;
    OSK["/web/src/engine/osk"];
    KeyboardSpec["/web/src/engine/keyboard"];
    JSProc["/web/src/engine/js-processor"];
    OSK-->KeyboardSpec;
    WebUtils["@keymanapp/web-utils<br>(/web/src/engine/common/web-utils)"];
    KeyboardSpec---->WebUtils;
    Wordbreakers["@keymanapp/models-wordbreakers<br>(/web/src/engine/predictive-text/wordbreakers)"];
    Models["@keymanapp/models-templates<br>(/web/src/engine/predictive-text/templates/)"];
    Models-->WebUtils;
    LMWorker["@keymanapp/lm-worker<br>(/web/src/engine/predictive-text/worker-thread)"];
    LMWorker-->Models;
    LMWorker-->Wordbreakers;
    LMLayer["@keymanapp/lexical-model-layer<br>(/web/src/engine/predictive-text/worker-main)"];
    LMLayer-->LMWorker;
    Gestures["@keymanapp/gesture-recognizer<br>(/web/src/engine/osk/gesture-recognizer)"];
    Gestures-->WebUtils;

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

    subgraph Headless["`**Headless**
    Fully headless components`"]
        direction LR
        KeyboardSpec;
        JSProc-->KeyboardSpec;
        WebUtils;
        PredText;
        Gestures;
    end

    subgraph ClassicWeb["`**ClassicWeb**
    Intermediate-level engine modules`"]
        Elements["/web/src/engine/element-wrappers"];
        Elements-->JSProc;
        KeyboardStorage["/web/src/engine/keyboard-storage"];
        KeyboardStorage-->Interfaces;
        DomUtils["/web/src/engine/dom-utils"];
        DomUtils-->WebUtils;
        DomUtils-->KeyboardSpec;
        OSK-->DomUtils;
        OSK-->Gestures;
        Interfaces["/web/src/engine/interfaces"];
        Interfaces-->KeyboardSpec;
        OSK-->Interfaces;
        CommonEngine["/web/src/engine/main"];
        CommonEngine-->Device;
        CommonEngine-->KeyboardStorage;
        CommonEngine-->OSK;
        Attachment["/web/src/engine/attachment"];
        Attachment-->DomUtils;
        Attachment-->Elements;
    end

    subgraph WebEngine["`**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