Skip to content

epic: web-core 🎼#12291

Draft
mcdurdin wants to merge 647 commits intomasterfrom
epic/web-core
Draft

epic: web-core 🎼#12291
mcdurdin wants to merge 647 commits intomasterfrom
epic/web-core

Conversation

@mcdurdin
Copy link
Copy Markdown
Member

@mcdurdin mcdurdin commented Aug 27, 2024

Adds support for Keyman Core (incl. LDML keyboards) to KeymanWeb, bringing LDML keyboards to Android, iOS, and web platforms.

Note: this branch includes epic/embed-osk-in-kmx, so be sure to check both TODO-WEB-CORE and TODO-EMBED-OSK-IN-KMX for outstanding work items.

References

Seed PR:

Build-bot: build
Test-bot: skip

@mcdurdin mcdurdin added this to the A18S9 milestone Aug 27, 2024
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot Bot commented Aug 27, 2024

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

  • Android
    • Keyman for Android apk - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Android apk - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Android apk (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • KeyboardHarness apk - build : all tests passed (no artifacts on BuildLevel "build")
    • Keyman for Android apk (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • KMSample1 apk - build : all tests passed (no artifacts on BuildLevel "build")
    • KMSample2 apk - build : all tests passed (no artifacts on BuildLevel "build")
  • iOS
    • Keyman for iOS (simulator image) - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for iOS (simulator image) - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for iOS (simulator image) (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • Keyman for iOS (simulator image) (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
  • macOS
    • Keyman for macOS - build : all tests passed (no artifacts on BuildLevel "build")
    • Keyman for macOS (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
  • Web
    • KeymanWeb Test Home - build : all tests passed (no artifacts on BuildLevel "build")
  • Windows
    • Keyman for Windows - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Windows - build : all tests passed (no artifacts on BuildLevel "build")
    • FirstVoices Keyboards for Windows (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • Keyman for Windows (old PRs) - build : all tests passed (no artifacts on BuildLevel "build")
    • Text Editor (ARM64) - build : all tests passed (no artifacts on BuildLevel "build")
    • Text Editor (x64) - build : all tests passed (no artifacts on BuildLevel "build")
    • Text Editor (x86) - build : all tests passed (no artifacts on BuildLevel "build")

@mcdurdin mcdurdin added web/ core/ Keyman Core epic A long lived branch, home for a new feature, usually will have child PRs based on it labels Aug 27, 2024
@mcdurdin mcdurdin changed the title epic: web-core epic: web-core 🎼 Aug 27, 2024
@srl295 srl295 self-requested a review August 30, 2024 17:28
@darcywong00 darcywong00 modified the milestones: A18S9, A18S10 Aug 31, 2024
Copy link
Copy Markdown
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

mcdurdin added a commit that referenced this pull request Sep 11, 2024
The visual keyboard compiler was never finished in 17.0. This rewrites
it to:

1. Use the kmxplus data rather than reading from xml directly
2. Fill in `visualkeyboard.header.kbdname`
3. Support modifiers
4. Handle encoded characters like `\u{1234}`
5. Handle string variables like `${one}`*

Additional unit tests have been added to verify the behavior of the
visual keyboard compiler in more detail.

TODO-LDML: string variables appear to have a secondary bug -- they seem
to be returning the string 'undefined'. I have disabled the related
tests and will examine this separately, and enable those tests once
fixed.

TODO-LDML: we should probably add a compiler warning + unit test for
`<layers formId="us"><layer id="base">`, because this pattern does not
make sense: when using non-touch forms, the `<layer>` element should use
`modifiers` attribute, and correspondingly, `modifiers` attribute should
_not_ be used when `formId` is `touch`.

Other fixes:

1. The LDML XML reader was relying on its input being a Node.js `Buffer`
   even though it was declared `Uint8Array`, as it implicitly used
   `Buffer.toString()` to do text conversion. (`Buffer` subclasses from
   `Uint8Array`). This breaks when using `Uint8Array` directly and means
   we had an implicit dependency on Node.js. See also #12331.
2. XML errors were not captured in the LDML XML reader. See also #12331.
3. The unused and unfinished touch-layout-compiler.ts and
   keymanweb-compiler.ts have been removed along with corresponding unit
   tests and fixtures. These are replaced by Core implementations; see
   #12291.

Fixes: #12395
mcdurdin added a commit that referenced this pull request Sep 12, 2024
The visual keyboard compiler was never finished in 17.0. This rewrites
it to:

1. Use the kmxplus data rather than reading from xml directly
2. Fill in `visualkeyboard.header.kbdname`
3. Support modifiers
4. Handle encoded characters like `\u{1234}`
5. Handle string variables like `${one}`*

Additional unit tests have been added to verify the behavior of the
visual keyboard compiler in more detail.

* String variable tests will be enabled in next commit (which is a
cherry-pick of #12404).

Other fixes:

1. The LDML XML reader was relying on its input being a Node.js `Buffer`
   even though it was declared `Uint8Array`, as it implicitly used
   `Buffer.toString()` to do text conversion. (`Buffer` subclasses from
   `Uint8Array`). This breaks when using `Uint8Array` directly and means
   we had an implicit dependency on Node.js. See also #12331.
2. XML errors were not captured in the LDML XML reader. See also #12331.
3. The unused and unfinished touch-layout-compiler.ts and
   keymanweb-compiler.ts have been removed along with corresponding unit
   tests and fixtures. These will be replaced by Core implementations;
   see #12291.

Fixes: #12395
Cherry-pick-of: #12402
@darcywong00 darcywong00 modified the milestones: A18S10, A18S11 Sep 14, 2024
@darcywong00 darcywong00 modified the milestones: A18S11, A18S12 Sep 28, 2024
@darcywong00 darcywong00 modified the milestones: A18S12, A18S13 Oct 11, 2024
@darcywong00 darcywong00 modified the milestones: A18S13, A18S14 Oct 26, 2024
@darcywong00 darcywong00 removed this from the A18S14 milestone Nov 9, 2024
ermshiperete and others added 30 commits April 23, 2026 17:43
docs(core): update generated files

This change updates the documentation files that get generated out of the the content in the source files. These files showed up as changed when building.
This implements `CoreKeyboardInterface.loadSerializedOptions` by getting
the list of all variable store names from Core and then trying to load
these.

Also change `VariableStoreSerializer.loadStore` signature so that it can
return `undefined`. This allows to return only those options from
`loadSerializedOptions` that have a non-default value, i.e. were
serialized before.

Build-bot: skip build:web
Test-bot: skip
…o-web-core

auto: A19S27 merge master into web-core 🎼
Having a file header that mentions an old version can be confusing, so
this change updates the file headers for the UI files with the current
header.

Build-bot: skip
Test-bot: skip
PR #15856 introduced the `KeyboardDetails` type but overlooked the use in
one file.

Follow-up-of: #15856
Follows: #15887
Build-bot: skip build:web
Test-bot: skip
Turns out that we can use `KeyboardStub` for both JS and KMX keyboards.

Follows: #15888
Build-bot: skip build:web
Test-bot: skip
`getKeyboardDetails` can return `null` if `stub` is falsy. This PR changes
the return type accordingly to improve type safety.

Follows: #15889
Build-bot: skip build:web
Test-bot: skip
Consolidate test frameworks and cleanup, including:
* all tests use Google Test
* reorganize folders, esp. kmnkbd -> api
* move all api tests into api folder
* replace references to test_assert or test_color with gtest equivalents
* leverage gtest patterns to remove boilerplate code
* dramatically simplify meson.build files and localize variables
* move shared helper code into helpers/ folder
* make test names unique and add gtest protocol for reporting back to
  teamcity

Fixes:
* CLDR test keyboards had invalid unicodeset escapes (needs to be raised
  upstream also) - was not failing tests because files were not loading
  but returning success

Test-bot: skip
feat(web): get list of store names from stores defined in core

This implements `CoreKeyboardInterface.loadSerializedOptions` by getting the list of all variable store names from Core and then trying to load these.

Also change `VariableStoreSerializer.loadStore` signature so that it can return `undefined`. This allows to return only those options from `loadSerializedOptions` that have a non-default value, i.e. were serialized before.

Follow-up-of: #15470
Co-authored-by: Marc Durdin <marc@durdin.net>
refactor(web): rename variables and parameter names in KeymanEngine 🧼 🎼
refactor(web): use `KeyboardDetails` type 🧼 🎼

PR #15856 introduced the `KeyboardDetails` type but overlooked the use in one file.

Follow-up-of: #15856
Follows: #15887
This change will ignore keyboards where `getKeyboardDetails` returns
`null` and will not push them to the `detailsForAllKeyboards` array.

Addresses a code review comment.
…class

This change moves code that was implemented in both `JSKeyboardProcessor`
and `CoreKeyboardProcessor` to the `AbstractKeyboardProcessor`. This got
renamed from `KeyboardProcessor` and is now a generic abstract class.

Also removed some of the band-aids in `CoreKeyboardInterface` and
`JSKeyboardInterface` that I put in before: Typescript allows
implementations to have a slightly different method signature and still
matches the interface as long as the used types are derived from the ones
specified in the interface.

Follows: #15870
Build-bot: skip build:web
Test-bot: skip
feat(web): implement getting keyboard details for KMX keyboards 🧼 🎼

Turns out that we can use `KeyboardStub` for both JS and KMX keyboards.

Follows: #15888
feat(web): clarify return type of `KeymanEngine.getKeyboardDetails` 🧼 🎼

`getKeyboardDetails` can return `null` if `stub` is falsy. This PR changes the return type accordingly to improve type safety.

Follows: #15889
The export of `test-index.ts` were intended to be used by tests only,
but over time they contained also exports that were consumed else where,
e.g. in UI classes like `kmwuibutton.ts`. This change removes unused
exports, moves test-only classes to a `unitTestEndPoints` container and
marks test-only types with `@internal`.

Build-bot: skip build:web
Test-bot: skip
The convention is to use the `.d.ts` extension for typescript types, and
that's what is used elsewhere in the `package.json` file. This change
fixes the two instances that had `.d.js`.
Build-bot: skip build:web
Test-bot: skip
refactor(web): move common code to abstract `KeyboardProcessor` base class

This change moves code that was implemented in both `JSKeyboardProcessor` and `CoreKeyboardProcessor` to the `AbstractKeyboardProcessor`. This got renamed from `KeyboardProcessor` and is now a generic abstract class.

Also removed some of the band-aids in `CoreKeyboardInterface` and `JSKeyboardInterface` that I put in before: Typescript allows implementations to have a slightly different method signature and still matches the interface as long as the used types are derived from the ones specified in the interface.

Follows: #15870
chore(web): cleanup `web/src/app/browser/src/test-index.ts` exports

The exports of `test-index.ts` were intended to be used by tests only, but over time they contained also exports that were consumed elsewhere, e.g. in UI classes like `kmwuibutton.ts`. This change removes unused exports, moves test-only classes to a `unitTestEndPoints` container and marks test-only types with `@internal`.

Fixes: #15894
refactor(web): move context tests to typescript
Test-bot: skip
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
refactor(core): clean up unit tests 🎼
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status
Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants