Commit graph

300 commits

Author SHA1 Message Date
Joshua A. Horton
50cfdc7072 fix(web): model language ids now case-insensitive 2022-10-27 12:30:56 +07:00
Marc Durdin
4d94786852 chore(web): replace lerna with npm workspaces and ts projects
Fixes #6320.

Part 1 of moving from lerna to a simpler, maintained monorepo solution,
using TypeScript Projects and NPM Workspaces.

There is more work to be done here. At this point, KeymanWeb builds and
runs without errors, but the built file is substantially different,
mostly in include order.

Using TypeScript Projects, we move away from the need to run build
scripts in various locations for almost all the Typescript modules.

TODO: Embedded versions and tests have not been verified.

TODO: developer/server is not yet verified.

TODO: developer/js (needs a rename!) is not yet verified.

TODO: Currently, the predictive-text folder needs refactoring to move
the construction of the worker wrapper out of the Predictive Text build
and into the final assembly of keymanweb.js (as it should be valid to
run it as a separate .js anyway).

TODO: Most of the `<reference>` paths need to be re-verified. Ideally
there should be no references outside the current module for any given
.ts.

TODO: The embedded vs browser vs node (headless) builds should be tidied
up for consistency so that it's obvious what depends on what. This is
currently messiest in the predictive-text folder, where the output names
diverge from the filenames and the various files are mixed in the same
folder (as evidenced by the exclusions listed in each tsconfig.json).

TODO: `npm install` should be removed from most build scripts and
instead `npm ci` (#6196) should be run only once from the top-level
folder for any given build. I've had eliminated side-effects from the
`install` action for npm, which makes it easier to reason about state.

TODO: verify_npm_setup and related functions can probably be eliminated.

TODO: most of the build scripts should be largely eliminated for web.

TODO: several ts projects use inconsistent output folders.

TODO: it may be possible to generate a .d.ts for models/types so that
we can use a consistent reference for those as well.

TODO: build.sh, tsconfig.json should always be in the module's top-level
folder, not in a subfolder such as src (e.g. see input-processor/src,
keyboard-processor/src, web/source).

TODO: resources/web-environment should be in common/web.

TODO: other js node_modules imports should be wrapped like es6-shim.

TODO: fix up the publish code for npm modules

TODO: eliminate version numbers from package.json if possible?

Whew, that's most of the stuff I noticed!
2022-04-12 21:02:33 +10:00
Marc Durdin
909d833474 fix(web): improve keyboard switch performance
Summary of these changes:

Two targeted improvements; more optimization is possible but IMO this is
a significant enough improvement to go through test:

1. In oskView.ts, avoid calling `VisualKeyboard.refreshLayout` twice
   from `OSKView.refreshLayout`. This roughly halves the time spent in
   `VisualKeyboard.refreshLayout` for a keyboard switch.
2. In modelManager.ts, we avoid a very expensive `unloadModel` /
   `loadModel` sequence from `registerModel` by checking to see if the
   model spec we are passed is already registered. This avoids an
   expensive callback to Keyman for Android which causes the banner to
   'bounce'.

Longer notes:

So `VisualKeyboard.refreshLayout` is called 20+ times during a keyboard
switch. It is a very expensive call. It is the bulk of the time spent
when you press the globe key in Keyman for Android. This seems ripe for
optimization; see the following functions in keyboard.html:

* `setKeymanLanguage` -> `setActiveKeyboard` -> 6 calls
* `enableSuggestions` -> `registerModel` -> 8 calls
* `stateChange` -> 6+ calls

`OSKView.refreshLayout` always seems to call
`VisualKeyboard.refreshLayout` twice: first with `setSize`, and then
again itself.

Keyman for Android and KeymanWeb seem to fight over who is responsible
for selecting models (KMW first calls `loadModel`, then Keyman for
Android calls `unloadModel`, `loadModel`, through `enableSuggestions`).

The fix for rotation (`correctOSKTextSize()`), as called from
`stateChange()`, is expensive as well, because it rebuilds the entire
keyboard from scratch.

Along with that, we have the size of the webview changing as the model
is unloaded and reloaded and lots of back-and-forth between the
KeymanWeb and KMEA which seems unnecessary.

Shouldn't KeymanWeb be responsible for loading and unloading models,
once they are all registered? We should only need to register the models
once at page load time (when config changes, do we just reload the
page?).
2021-11-22 10:47:05 +11:00
jahorton
d687c9e1c3 fix(web): workaround for unwanted CJK pinning 2021-09-21 10:37:08 +07:00
jahorton
e8afd71491 refactor(web): _Show -> present(), presentAtPosition() 2021-09-01 09:44:34 +07:00
jahorton
f070df079d refactor(web): osk._Hide -> osk.startHide 2021-09-01 09:44:34 +07:00
jahorton
aebe4788a7 refactor(web): Anchored vs Floating OSKViews (pass 1) 2021-08-25 09:40:18 +07:00
Darcy Wong
20fa22dab6 fix(web): Move code to registerStub 2021-07-05 13:52:16 +07:00
Darcy Wong
d37e48c0cc fix(web): Start fixing registeruStub return 2021-07-02 16:53:23 +07:00
Darcy Wong
144125080b feat(web): Handle deferment of adding keyboards 2021-06-30 10:26:19 +07:00
jahorton
4a96254cbc fix(web): allows refresh of currently-loaded model 2021-03-19 11:40:58 +07:00
jahorton
5c709f9468 chore(web/engine): post-rebase cleanup 2020-04-24 14:35:52 +07:00
jahorton
add1e32b17 change(web/engine): splits off input-processor into own module 2020-04-24 14:35:48 +07:00
jahorton
1eed004296 change(web): package rename + patchup 2020-04-24 13:53:39 +07:00
jahorton
373196dded change(web/engine): splits off the core/web/keyboard-processor module 2020-04-24 13:45:04 +07:00
jahorton
1125c3ba3e refactor(web/engine): successful web-core compilation 2020-04-17 11:33:03 +07:00
Joshua Horton
9135c41a05
Merge pull request #2982 from keymanapp/refactor/web/engine/web-core-build-prep
refactor(web/engine): web-core build prep
2020-04-17 08:36:56 +07:00
jahorton
3347014e0f refactor(web/engine): removes no-longer-used static var 2020-04-17 08:30:29 +07:00
jahorton
7654c26c8c refactor(web/engine): InputProcessor polish, prep 2020-04-09 15:08:18 +07:00
jahorton
8c0f81f8ba refactor(web/engine): headless LanguageProcessor (aside from lmlayer) 2020-04-09 14:51:49 +07:00
jahorton
7ec426541c refactor(web/engine): a bit of extra headless-prep reorg, script start 2020-04-09 14:19:29 +07:00
jahorton
68dc9a7ddc feat(web/engine): LanguageProcessor events now EventEmitter-backed 2020-04-09 14:05:30 +07:00
jahorton
61e39ba3e8 change(web): starts dependency on npm's 'events' package 2020-04-09 13:31:47 +07:00
jahorton
e363542c9e refactor(web/engine): returns prediction Promise on RuleBehavior 2020-04-09 13:16:08 +07:00
jahorton
f9a9810ee3 refactor(web/engine): modelchange -> statechange event 2020-04-09 12:29:40 +07:00
jahorton
9f3ccffe2b refactor(web/engine): changes model load + mayPredict interactions 2020-04-09 12:14:27 +07:00
jahorton
6020ffee0c refactor(web/engine): LanguageProcessor.canEnable 2020-04-09 09:50:35 +07:00
jahorton
2f6e1e42af refactor(web/engine): initial ModelManager split 2020-04-09 09:22:35 +07:00
jahorton
9f9f2774cd refactor(web/engine): drops OSK pre-req for 'alternate' computation 2020-04-08 14:59:07 +07:00
jahorton
5140642005 change(web/engine): general cleanup 2020-04-08 14:37:55 +07:00
jahorton
d7870f07d9 refactor(web/engine): better KeyEvent preanalysis 2020-04-08 14:31:27 +07:00
jahorton
e447a5a1da refactor(web/engine): fully centralizes keyEvent generation on key spec 2020-04-07 17:28:36 +07:00
jahorton
6779cca412 chore(web/engine): Merge branch 'refactor/web/engine/processor-split' into refactor/web/engine/headless-inner-core 2020-04-06 13:21:24 +07:00
jahorton
7a04baa9a5 change(web/engine): kbdProcessor.core => core.keyboardProcessor 2020-04-06 13:17:32 +07:00
jahorton
09d38f81a5 refactor(web/engine): globalThis retrieval 2020-04-03 15:28:42 +07:00
jahorton
b1edfaf90f chore(web/engine): Merge branch 'refactor/web/engine/dom-functionality-split' into refactor/web/engine/processor-split 2020-04-03 11:15:49 +07:00
jahorton
7c81862c2d fix(web/engine): reverts temp edit that slipped through 2020-04-03 11:14:13 +07:00
jahorton
227062ba56 refactor(web/engine): InputProcessor/KeyboardProcessor split 2020-04-03 10:50:58 +07:00
jahorton
52e3f7e977 refactor(web): adds intermediate DOM-aware OutputTarget abstraction 2020-04-03 10:31:35 +07:00
jahorton
11c1ed5bf2 refactor(web/engine): embedded adjustments, defaultOutput split 2020-04-03 10:08:03 +07:00
Joshua Horton
b438291cb0
Merge branch 'master' into refactor/web/engine/keyboard-api-dom-split-start 2020-04-03 08:26:45 +07:00
Joshua Horton
8801779166
Merge pull request #2926 from keymanapp/refactor/web/engine/variable-store-storage-abstraction
refactor(web/engine): variable store storage abstraction
2020-04-03 08:16:31 +07:00
Joshua Horton
11dcd65864
Merge pull request #2925 from keymanapp/refactor/web/engine/processor-callbacks
refactor(web/engine):  RuleBehavior now headless
2020-04-03 08:16:05 +07:00
Joshua Horton
09847c6a7c
Merge pull request #2920 from keymanapp/refactor/web/engine/layer-system-store
refactor(web/engine): Processor now manages current layer; OSK listens via callback
2020-04-03 08:15:46 +07:00
Joshua Horton
887c308ad3
Merge pull request #2919 from keymanapp/refactor/web/engine/systemStores
refactor(web/engine): start of system store abstraction
2020-04-03 08:15:29 +07:00
jahorton
85c7ecf908 refactor(web/engine): headless layout retrieval for text prediction 2020-04-02 22:03:26 +07:00
Joshua A. Horton
f7ea6dbeb4 fix(web/engine): Fixes assignment reference 2020-04-01 10:39:02 +07:00
jahorton
0a2f09766e fix(web/engine): unit-test check for saveStore 2020-04-01 09:55:43 +07:00
jahorton
680db25eff fix(web/engine): null checks 2020-03-31 14:58:56 +07:00
jahorton
62b21a63a6 refactor(web/engine): disables fat-finger saveStore commands 2020-03-31 14:52:28 +07:00