keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
367 stars 102 forks source link

spec(web): Keyman Core integration for Web #11293

Open ermshiperete opened 1 week ago

ermshiperete commented 1 week ago

Introduction

Currently Keyman Core is only used on the desktop platforms (Windows, Mac, Linux). Keyman Core supports KMN as well as LDML keyboards.

Keyman Engine for Web has a separate implementation that only supports KMN based keyboards. This is also used by Keyman for Android and Keyman for iOS.

Keyman Engine for Web currently doesn't use the .kmx keyboard files but .js files that get generated by kmc as well.

Keyman Core doesn't deal with touch and OSK aspects of a keyboard.

LDML keyboards use an enhanced version of KMX (KMX+).

We would like to integrate Keyman Core in Keyman Engine for Web.

Architecture

Implementation

Refactorings/Cleanup in Keyman Engine for Web

Changes required to Keyman Engine for Web

KMX Loader

Keyman Engine for Web will load .kmx files instead of .js. The .kmx loader should detect at load time if first bytes are KXTS and treat it as kmx, otherwise eval() as a script reject it and it will be loaded by the existing .js loader.

Changes required to Core API

Related issues and discussions

mcdurdin commented 1 week ago

The .kmx loader should detect at load time if first bytes are KXTS and treat it as kmx, otherwise eval() as a script.

I don't think we want to do sniffing and eval as script. The pathway for loading a .js keyboard right now is injecting as a <script> element. The new pathway will take a blob from a source tbd and should just reject it if it doesn't start with the KMX magic bytes KXTS.