Commit graph

117 commits

Author SHA1 Message Date
Marc Durdin
b23df3fbc8 feat(web): &newLayer and &oldLayer
Fixes #6364.

Removes `&layerChanged` and adds `&newLayer` and `&oldLayer` system
stores with the additional nuances around values as described in #6364.
2022-03-13 08:29:15 +11:00
Marc Durdin
0023841ee4 chore(web): address review comments 2022-03-11 04:40:53 +11:00
Marc Durdin
f355722191 fix(web): back out caps lock and refix
The Caps Lock change I made in the previous commit broke
desktop Caps Lock handling. The fix was a little more
convoluted. Turns out that _UpdateVKShift is also pretty
crufty. I simplified it, removing dead code.
2022-03-10 13:31:06 +11:00
Marc Durdin
d879c1e3f6 fix(web): caps state tracking for touch
Selecting the new Caps Lock `caps` layer was not correctly setting the
layer state in the key event to `caps`, which caused Caps Lock rules
to fail to match.
2022-03-10 13:31:04 +11:00
Marc Durdin
cacbbee5cc fix(web): properly handle selection
Relates to #5853 and others.

Selection management was not working properly with the various
OutputTargets:

1. When there is a non-empty selection, rules have no context -- it's
   like new text.
2. Backspace over a selection deletes just the selection.
3. Typing a character replaces the selection, of course, and collapses
   the caret to the end of the new text.
4. `hasSelection` is a very strange name for `OutputTarget` descendants.
   It doesn't mean "has an active selection" but rather, kinda means
   "supports selection internally".
5. Added `isSelectionEmpty` which is used for some of the new selection
   rules above.

Note that the `touchAlias` OutputTarget class does not currently support
selection. I hope we can deprecate `touchAlias` with the use of
`inputMode` (#3030) in the future, rather than adding support for
selection.
2022-02-23 15:12:58 +11:00
Marc Durdin
addcad9f76 fix(web): further selection tweaks to mocks 2022-02-23 15:12:23 +11:00
Marc Durdin
ac2cc93f2a fix(web): add readonly mode for rule behavior finalization
Relates to #5853.

Two things happened here:

1. Construction of Mocks made an assumption that the selection should
   always be deleted (outputTarget.ts:363). However, for NewContext and
   PostKeystroke processes, we don't want to change anything.

2. Even if nothing is changed, the transcription would emit what is
   in theory a no-op ruleTransform (insert="", deleteLeft=0,
   deleteRight=0). But apps would treat this as deleting the selection.

This fix goes a little broader than I would have preferred, but adds a
readonly mode to the transcription and mock model, so that we can
control explicitly when changes are applied to the text store.
2022-02-22 10:42:20 +11:00
Marc Durdin
44ddf1e9aa
Merge branch 'master' into feat/web/3620-caps-layer 2022-01-17 12:26:32 +11:00
Marc Durdin
0c0bb420b5
Merge pull request #5963 from keymanapp/feat/web/3621-newcontext-group
feat(web): Start of Sentence support - part 1 🕊
2022-01-17 12:04:29 +11:00
Marc Durdin
9e5c30bca6 chore(web): fixup header comments per review 2021-12-02 07:26:41 +11:00
Marc Durdin
62796e3489 feat(web): Caps Layer and double-tap gesture
Fixes #3620.

Implements the Caps Lock layer support and the double-tap gesture on the
shift key to access it.

The double-tap gesture has been implemented with a view to extension to
support other multi-tap gestures in the future. However, for now, it is
limited to supporting the Shift key, if and only if the keyboard
includes a Caps layer.

The reason for this v15 limitation is that multi-tap on regular keys
would involve either rewinding the previous keystroke (the first tap),
or forcing keyboard developers to consider 'rota' style rules in their
keyboards to support the multi-tap gestures, as we need to make sure
that the first tap is accepted and processed for immediate feedback.
This needs more design, to avoid unnecessary complexity in the keyboards
and/or the rewinding of the keystroke (even though that is conceptually
supported in Keyman Engine for Web already). Basically, we don't want to
constrain the way that a keyboard author may use the multi-tap gesture
by hard-coding the rewind, but neither do we want to make all multi-tap
gestures needlessly complex to author.

The shift key (and other modifiers, potentially in future) needs special
support for multi-tap as the key that is being tapped changes with the
layer change. This is currently managed through recognising `K_SHIFT` in
the key id.

I have tried to follow the `PendingGesture` pattern for multi-tap, and
the gesture itself supports a series of taps, not just a double-tap. The
maximum time to complete the tap series is 125msec * number-of-taps, so
for a double-tap is 250msec.

The changes to support a Caps Lock layer itself were minimal; just
adding the `text.KeyboardProcessor.getStateFromLayer` function and
calling it during `KeyEvent` construction. The remaining changes relate
to the multi-tap gesture.

Minor changes:
* I moved `constructNullKeyEvent` to `KeyEvent` in order to make it
  more accessible to other classes.
* The multi-tap gesture does not have a promise to complete, so that is
  now an optional member of the `PendingGesture` interface.
2021-12-01 08:59:43 +11:00
Marc Durdin
f9b4be6883 chore(web): refactor constructNullKeyEvent 2021-11-29 10:54:28 +11:00
Marc Durdin
ce2aa9a166 feat(web): support for &layerChanged
Relates to #3621.

Add support for `&layerChanged` system store. This store is set to `1`
before a `begin postKeystroke`, if the keystroke it follows resulted in
a layer change, either programatically through a keyboard rule, or
through a `nextlayer` property of the touched key.
2021-11-24 06:45:20 +11:00
Marc Durdin
f5fc41712d feat(web): add support for begin postKeystroke
Relates to #3621.

This adds support for `begin postKeystroke` to KeymanWeb. This is now
close to final, apart from support for `&layerChanged`.
2021-11-23 16:56:16 +11:00
Marc Durdin
bbbf1afce7 feat(web): basic support for newContext
Relates to #3621.

Adds basic support for `begin newContext`.
2021-11-23 15:00:47 +11:00
Marc Durdin
9da4ffa77a fix(web): font size was not consistently set
Fixes #5779.
Fixes #5731 (I believe mitigation is sufficient to close this issue).

A variety of interrelated font and font size display issues resolved:
1. KVK font was not applied early enough for size calculations, which
   meant that we were calculating font scaling per key based on a
   default font when transforming from the KVK data for desktop devices
   (defaultLayout.ts)
2. Font scaling for non-default layers was calculated when elements were
   not visible and had no size information, giving incorrect values. To
   resolve this, font scaling is now calculated when a layer is made
   visible, which had performance impacts; resolved by reducing
   unnecessary `layer.refreshLayout()` calls; see performance point 1
   below (oskView.ts:layerChangeHandler())
3. `getViewportScale()` would return an incorrect scaled value when
   emulating touch devices on a desktop browser (kmwutils.ts)
4. After switching keyboards, the device-specific scaling factor was not
   maintained (oskView.ts:refreshLayout())

Related performance improvements:
1. Multiple calls to `layer.refreshLayout()` in `refreshLayout()` have
   been eliminated, and only the currently visible layer is now
   refreshed. This dramatically reduces the number of calls to
   `getIdealFontSize()` which was the primary concern of #5731.
   (visualKeyboards.ts)
2. Unnecessary use of `innerHTML` replaced with `innerText`
   (oskBaseKey.ts)

Minor Keyman Developer performance improvement:
1. The web debugger no longer recalculates the OSK twice (test.js)
2021-11-15 10:08:18 +11:00
Marc Durdin
66be206d96 feat(developer): support for U_xxxx_yyyy 2021-11-11 13:08:39 +11:00
Marc Durdin
2f280052ec chore(web): cleanup comment 2021-09-27 10:25:16 +10:00
Marc Durdin
a65b55e1b5 fix(web): support variable stores with predictive text
Fixes #2924.

When a keyboard includes variable stores, predictive text fat-fingering
tests will no longer affect the variable store values.
2021-09-27 06:54:24 +10:00
Joshua Horton
0e42a0b70d
Merge pull request #5641 from keymanapp/fix/web/osk-layer-reset
fix(common/core/web): layer reset on physical keystroke after OSK interaction
2021-09-17 12:42:30 +07:00
Darcy Wong
7c73840e58 fix(common/core/web): Revert check for length 0 2021-09-16 09:29:52 +07:00
Darcy Wong
7acd0b4ed5 fix(common/core/web): Remove empty rows in OSK 2021-09-15 14:20:52 +07:00
Darcy Wong
5188ced2b8 fix(common/core/web): Check for active keyboard in setNumericLayer 2021-09-01 09:23:07 +07:00
jahorton
62cec37142 fix(common/core/web): layer swaps from modifier keys did not update modifier state 2021-08-26 09:54:22 +07:00
Joshua Horton
fda5ea7370
Merge pull request #5553 from keymanapp/fix/web/final-match-group
fix(common/core/web): behavior with unmatched final group
2021-08-20 09:45:48 +07:00
jahorton
6afd56e10b chore(common/core/web): minor cleanup, robustness 2021-08-05 12:39:16 +07:00
jahorton
4a2fec2d8f refactor(web): roots out embedded-tab code from source branch 2021-08-05 12:13:03 +07:00
jahorton
3066c1f246 chore(web): Merge branch 'master' into fix/web/final-match-group 2021-08-05 11:02:24 +07:00
jahorton
ed490fcbef refactor(common/core/web): relocates empty-row fix to keyboard-processor module 2021-07-29 09:41:34 +07:00
jahorton
45cc61213a chore(web): Merge branch 'master' into refactor/web/vkbd-layout-encapsulation 2021-07-27 12:15:11 +07:00
Joshua Horton
a6c3e0a5fa
Merge pull request #5456 from keymanapp/fix/web/state-key-management
fix(common/core/web): OSK state-key management
2021-07-27 11:23:56 +07:00
jahorton
826ed88192 chore(web): Merge branch 'master' into refactor/web/vkbd-layout-encapsulation 2021-07-23 14:21:45 +07:00
jahorton
27096c8823 chore(web): addresses PR comments 2021-07-23 10:53:34 +07:00
jahorton
73ba8eb359 fix(common/core/web): mnemonic layer tracking with caps 2021-07-21 15:29:26 +07:00
Joshua Horton
1a8295e1a2
chore(web): applies PR suggestion
Co-authored-by: Marc Durdin <marc@durdin.net>
2021-07-12 05:29:37 +07:00
jahorton
d234f8332a fix(common/core/web): state-key toggle as part of key event 2021-07-09 15:24:11 +07:00
jahorton
0beca3b260 refactor(web): cntd integration of new types 2021-07-09 09:02:37 +07:00
jahorton
66d7648ecf refactor(web): OSKRow 2021-07-09 09:02:36 +07:00
jahorton
de82e8dab7 refactor(web): help-page desktop OSK + related docs 2021-07-06 10:55:55 +07:00
jahorton
50ee62a7e0 change(web): subkey lookup through base key 2021-06-24 12:03:27 +07:00
jahorton
946d6631cd feat(common/core/web): Mock-cloning optimization 2021-06-21 10:45:16 +07:00
Joshua Horton
aff97ac3ae
Merge pull request #5279 from keymanapp/refactor/web/vkbd-layout-calc-simplification
refactor(web): OSK layout calculations - simplification
2021-06-16 08:13:38 +07:00
jahorton
8fed389718 refactor(web): simplified calibration control flow 2021-06-14 10:36:41 +07:00
jahorton
73af555050 fix(common/core/web): buildTransformFrom now binary-searches prefix split 2021-06-09 15:45:53 +07:00
jahorton
b6424095ae docs(common/core/web): function docs improvement 2021-06-09 09:31:39 +07:00
jahorton
c91d2f3685 refactor(web): related adjustments for full KMW 2021-05-28 13:14:43 +07:00
jahorton
6c782705f2 refactor(web): removes Ltarg from KeyEvent, adjusts core to match 2021-05-28 12:44:03 +07:00
Joshua Horton
3ffa35c154
Merge pull request #4938 from keymanapp/fix/web/embedded-smp-after-kbd-swap
fix(web, ios): better SMP, emoji handling with frequent keyboard swaps
2021-04-22 14:27:17 +07:00
jahorton
c7310e0b86 fix(web): fixes subkey lookup for fat-finger processing 2021-04-22 11:00:07 +07:00
jahorton
00debdbb28 change(web): SMP enablement always on in embedded mode 2021-04-20 16:02:55 +07:00