Skip to content

Commit

Permalink
chore(web): Merge branch 'change/web/build-bundler-replacement' into …
Browse files Browse the repository at this point in the history
…feat/web/es6-target-artifact
  • Loading branch information
jahorton committed Dec 22, 2023
2 parents 1513582 + d554a00 commit dc7bfc1
Show file tree
Hide file tree
Showing 108 changed files with 1,828 additions and 1,621 deletions.
51 changes: 51 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Keyman Version History

## 17.0.235 alpha 2023-12-21

* feat(developer): ldml: more improvement for key-not-found (#10236)

## 17.0.234 alpha 2023-12-20

* fix(mac): Improve detection of non-compliant apps (#10282)
* fix(web): default multitap logic for shift-layer shift multitaps (#10281)
* (#10284)

## 17.0.233 alpha 2023-12-19

* fix(web): unbreak some ts paths (#10279)
* fix(core): clear core context on invalidate cache (#10230)
* fix(oem/fv): Add fv_hulquminum_combine (#10269)

## 17.0.232 alpha 2023-12-18

* (#10270)

## 17.0.231 alpha 2023-12-15

* chore(web): Better match directory structure for headless engine tests (#10232)
* fix(web): Fix types that listInputs and isKMWInput accept (#10233)
* chore(web): Add unit tests for `pageContextAttachment` (#10250)

## 17.0.230 alpha 2023-12-14

* fix(core): ldml: fix bad usage of unique_ptr (#10252)
* chore(linux): docker: fix Node.js install, make customizable (#10251)
* fix(web): unit test for null-null keyboard switch event from #10245 (#10253)
* fix(web): fixes android-webview emulation Web test page (#10238)
* epic: new gesture engine (#7324)
* fix(mac): improve code signing robustness (#10243)
* chore(mac): use core actions struct (#10066)
* chore(common): Add entries from 16.0.144 HISTORY.md (#10260)
* chore(web): Remove dead code (#10231)

## 17.0.229 alpha 2023-12-13

* chore(ios): FV certificate key (#10228)
Expand Down Expand Up @@ -1389,6 +1427,19 @@
* chore: move to 17.0-alpha (#7577)
* chore: Move to 17.0 alpha

## 16.0.144 stable 2023-11-30

* chore(linux): Update debian changelog (#10046)
* fix(android/app) Disable in-app Browser (#10077)

## 16.0.143 stable 2023-11-22

* chore(android): Update targetSdkVersion from 31 to 33 (#9823)
* chore(linux): Exclude environment.sh from build (#9814)
* chore(mac): move from altool to notarytool (#9896)
* fix(web): fixes doc-kbd display of default layer when it's not defined first (#9892)
* fix(ios): fv: replace Zip framework to prevent crash on startup (#9958)

## 16.0.142 stable 2023-10-20

* chore(linux): Update debian changelog (#9326)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.0.230
17.0.236
1 change: 1 addition & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ KMEA/**/assets/keymanandroid.js
KMEA/**/assets/keyman.js.map
KMEA/**/assets/keymanweb-webview.js
KMEA/**/assets/keymanweb-webview.js.map
KMEA/**/assets/map-polyfill.js
KMEA/**/assets/sentry.min.js
KMEA/**/assets/keyman-sentry.js
KMEA/**/assets/es6-shim.min.js
Expand Down
1 change: 1 addition & 0 deletions android/KMEA/app/src/main/assets/keyboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-->
<script src="es6-shim.min.js"></script>
<script src="other-polyfills.js"></script>
<script src="map-polyfill.js"></script>
<script src="keymanweb-webview.js"></script>
<script src="sentry.min.js"></script>
<script src="keyman-sentry.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion android/KMEA/app/src/main/assets/other-polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ if(!Array.prototype.includes){
Array.prototype.includes = function(search){
return !!~this.indexOf(search);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public String toString() {
protected static final String KMFilename_Osk_Ttf_Font = "keymanweb-osk.ttf";
protected static final String KMFilename_JSPolyfill = "es6-shim.min.js";
protected static final String KMFilename_JSPolyfill2 = "other-polyfills.js";
protected static final String KMFilename_JSPolyfill3 = "map-polyfill.js";

// Deprecated by KeyboardController.KMFilename_Installed_KeyboardsList
public static final String KMFilename_KeyboardsList = "keyboards_list.dat";
Expand Down Expand Up @@ -866,6 +867,7 @@ private static void copyAssets(Context context) {
copyAsset(context, KMDefault_KeyboardFont, "", true);
copyAsset(context, KMFilename_JSPolyfill, "", true);
copyAsset(context, KMFilename_JSPolyfill2, "", true);
copyAsset(context, KMFilename_JSPolyfill3, "", true);

// Keyboard packages directory
File packagesDir = new File(getPackagesDir());
Expand Down
1 change: 1 addition & 0 deletions android/KMEA/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ if builder_start_action build:engine; then
echo "Copying Keyman Web artifacts"
cp "$KEYMAN_WEB_ROOT/build/app/webview/$CONFIG/keymanweb-webview.js" "$ENGINE_ASSETS/keymanweb-webview.js"
cp "$KEYMAN_WEB_ROOT/build/app/webview/$CONFIG/keymanweb-webview.js.map" "$ENGINE_ASSETS/keymanweb-webview.js.map"
cp "$KEYMAN_WEB_ROOT/build/app/webview/$CONFIG/map-polyfill.js" "$ENGINE_ASSETS/map-polyfill.js"
cp "$KEYMAN_WEB_ROOT/build/app/resources/osk/ajax-loader.gif" "$ENGINE_ASSETS/ajax-loader.gif"
cp "$KEYMAN_WEB_ROOT/build/app/resources/osk/kmwosk.css" "$ENGINE_ASSETS/kmwosk.css"
cp "$KEYMAN_WEB_ROOT/build/app/resources/osk/globe-hint.css" "$ENGINE_ASSETS/globe-hint.css"
Expand Down
7 changes: 7 additions & 0 deletions common/test/keyboards/baseline/baseline.kpj
Original file line number Diff line number Diff line change
Expand Up @@ -323,5 +323,12 @@
<FileVersion>1.0</FileVersion>
<FileType>.kmn</FileType>
</File>
<File>
<ID>id_k_049___enter_invalidates_context</ID>
<Filename>k_049___enter_invalidates_context.kmn</Filename>
<Filepath>k_049___enter_invalidates_context.kmn</Filepath>
<FileVersion>1.0</FileVersion>
<FileType>.kmn</FileType>
</File>
</Files>
</KeymanDeveloperProject>
5 changes: 3 additions & 2 deletions common/test/keyboards/baseline/k_000___null_keyboard.kmn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
store(&NAME) '000 - null keyboard'
c Description: Tests null keyboard
c Description: Tests null keyboard
c keys: [K_A][RALT K_B][SHIFT K_C]
c expected: aC
c context:
c expected context: C
c context:

store(&version) '6.0'

Expand Down
Binary file modified common/test/keyboards/baseline/k_000___null_keyboard.kmx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ store(&NAME) '008 - vkey input (ctrl alt 2)'
c Description: Tests basic vkey input with control and alt (Unicode)
c keys: [LCTRL LALT K_A][LCTRL LALT K_B][LCTRL LALT K_C]
c expected: \u0E01\u0E03
c context:
c expected context: \u0E03
c context:

store(&version) '6.0'

begin Unicode > use(Main)

group(Main) using keys

+ [CTRL ALT K_A] > U+0E01
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
store(&NAME) '049 - enter_invalidates_context'
c Description: Tests that core context is cleared when kb processor
c determines its invalid. eg Enter key See #10182.
c keys: [K_A][K_B][K_ENTER][K_C]
c expected: abc
c expected context: c
c context:

store(&version) '10.0'

begin Unicode > use(Main)

group(Main) using keys

c Test if context was not invalidated by [K_ENTER] context will be 'abd'

'a' 'b' + [K_C] > 'abd'

Binary file not shown.
14 changes: 13 additions & 1 deletion common/tools/hextobin/hextobin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,16 @@ function exitDueToUsageError(message: string): never {
return process.exit(64); // SysExits.EX_USAGE
}

hextobin(inputFilename, outputFilename, {silent: false});
hextobin(inputFilename, outputFilename, { silent: false })
.then((buffer) => {
if (buffer) {
process.exit(0); // OK
} else {
console.error(`${program._name}: Failed.`);
process.exit(1); // no buffer - some err.
}
}, (err) => {
console.error(err);
console.error(`${program._name}: Failed.`);
process.exit(1);
});
3 changes: 3 additions & 0 deletions common/web/es-bundling/src/common-bundle.mts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ if(process.argv.length > 2) {
}
}
}
} else {
// Not enough args; display help + abort.
doHelp(1);
}

function fileSpecError(type: 'input' | 'output', file?: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ export class PaddedZoneSource implements RecognitionZoneSource {
getBoundingClientRect(): DOMRect {
const rootZone = this.root.getBoundingClientRect();

// Chrome 35: x, y do not exist on the returned rect, but left & top do.
return new DOMRect(
/*x:*/ rootZone.x + this.edgePadding.x,
/*y:*/ rootZone.y + this.edgePadding.y,
/*x:*/ rootZone.left + this.edgePadding.x,
/*y:*/ rootZone.top + this.edgePadding.y,
/*width:*/ rootZone.width - this.edgePadding.w,
/*height:*/ rootZone.height - this.edgePadding.h
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,9 @@ export class GestureSourceSubview<
const baseClientRect = this.recognizerConfigStack[0].targetRoot.getBoundingClientRect();

return {
x: currentClientRect.x - baseClientRect.x,
y: currentClientRect.y - baseClientRect.y
// x, y not available in Chrome 35... but left and top are.
x: currentClientRect.left - baseClientRect.left,
y: currentClientRect.top - baseClientRect.top
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const mockedInitialConfig = {
targetRoot: {
getBoundingClientRect: () => {
return {
x: -2,
y: -2
left: -2,
top: -2
};
}
}
Expand All @@ -60,8 +60,8 @@ const mockedShiftedConfig = {
targetRoot: {
getBoundingClientRect: () => {
return {
x: 2,
y: 2
left: 2,
top: 2
};
}
}
Expand Down
50 changes: 29 additions & 21 deletions common/web/keyboard-processor/src/keyboards/activeLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,27 +315,6 @@ export class ActiveKeyBase {
hasMultitaps: false
}

// The default-layer shift key on mobile platforms should have a default multitap under
// select conditions.
//
// Note: whether or not any other key has multitaps doesn't matter here. Just THIS one.
if(key.id == 'K_SHIFT' && displayLayer == 'default' && layout.formFactor != 'desktop') {
/* Extra requirements:
*
* 1. The SHIFT key must not specify longpress keys or have already-specified multitaps.
*
* Note: touch layouts specified on desktop layouts often do specify longpress keys;
* utilized modifiers aside from 'shift' become longpress keys under K_SHIFT)
*
* 2. There exists a specified 'caps' layer. Otherwise, there's no destination for
* the default multitap.
*
*/
if(!key.sk && !key.multitap && !!layout.layer.find((entry) => entry.id == 'caps')) {
key.multitap = [Layouts.dfltShiftMultitap, Layouts.dfltShiftRotaDefault];
}
}

// Add class functions to the existing layout object, allowing it to act as an ActiveLayout.
let dummy = new ActiveKeyBase();
let proto = Object.getPrototypeOf(dummy);
Expand Down Expand Up @@ -871,6 +850,35 @@ export class ActiveLayout implements LayoutFormFactor{
layerMap[layers[n].id] = layers[n] as ActiveLayer;
}

// After all layers are preprocessed...

// The default-layer shift key & shift-layer shift key on mobile platforms should have a
// default multitap re: a 'caps' layer under select conditions.
//
// Note: whether or not any other keys have multitaps doesn't matter here. Just THESE.
if(formFactor != 'desktop' && !!layout.layer.find((entry) => entry.id == 'caps')) {
const defaultLayer = layout.layer.find((entry) => entry.id == 'default') as ActiveLayer;
const shiftLayer = layout.layer.find((entry) => entry.id == 'shift') as ActiveLayer;

const defaultShift = defaultLayer.getKey('K_SHIFT');
const shiftShift = shiftLayer ?.getKey('K_SHIFT');

// If BOTH default & shift layer SHIFT keys lack multitaps & longpresses, proceed.
if(defaultShift && shiftShift && // doesn't make much sense if there's no shift layer or SHIFT on either
!defaultShift.multitap && !shiftShift.multitap &&
!defaultShift.sk && !shiftShift.sk
) {
// May cause the layout to gain its first multitaps, which does matter for the next lines after the block.
analysisMetadata.hasMultitaps = true;

defaultShift.multitap = [{...Layouts.dfltShiftToCaps}, {...Layouts.dfltShiftToDefault}] as ActiveSubKey[];
shiftShift.multitap = [{...Layouts.dfltShiftToCaps}, {...Layouts.dfltShiftToShift}] as ActiveSubKey[];

defaultShift.multitap.forEach((sk) => ActiveSubKey.polyfill(sk, keyboard, aLayout, 'default'));
shiftShift .multitap.forEach((sk) => ActiveSubKey.polyfill(sk, keyboard, aLayout, 'shift'));
} // else no default shift -> caps multitaps.
}

aLayout.hasFlicks = analysisMetadata.hasFlicks;
aLayout.hasLongpresses = analysisMetadata.hasLongpresses;
aLayout.hasMultitaps = analysisMetadata.hasMultitaps;
Expand Down
13 changes: 10 additions & 3 deletions common/web/keyboard-processor/src/keyboards/defaultLayouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ export class Layouts {
return KLS;
}

static dfltShiftMultitap: LayoutSubKey = {
static dfltShiftToCaps: LayoutSubKey = {
// Needs to be something special and unique. Typing restricts us from
// using a reserved key-id prefix, though.
id: "T_*_MT_SHIFT_TO_CAPS",
Expand All @@ -535,15 +535,22 @@ export class Layouts {
nextlayer: 'caps'
}

static dfltShiftRotaDefault: LayoutSubKey = {
static dfltShiftToDefault: LayoutSubKey = {
// Needs to be something special and unique. Typing restricts us from
// using a reserved key-id prefix, though.
id: "T_*_MT_SHIFT_ROTA_TO_DEFAULT",
id: "T_*_MT_SHIFT_TO_DEFAULT",
text: '*Shift*',
sp: 1,
nextlayer: 'default'
}

static dfltShiftToShift: LayoutSubKey = {
id: "T_*_MT_SHIFT_TO_SHIFT",
text: '*Shift*',
sp: 1,
nextlayer: 'shift'
}

// Defines the default visual layout for a keyboard.
/* c8 ignore start */
static dfltLayout: LayoutSpec = {
Expand Down
3 changes: 3 additions & 0 deletions common/web/lm-worker/build-polyfiller.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ if(process.argv.length > 2) {
}
}
}
} else {
// Display help + abort.
doHelp(1);
}

if(!sourceFromArgs || sourceFromArgs.substring(sourceFromArgs.length - 3) != '.js') {
Expand Down
3 changes: 3 additions & 0 deletions common/web/lm-worker/build-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ if(process.argv.length > 2) {
}
}
}
} else {
// Display help + abort.
doHelp(1);
}

if(!sourceFromArgs || sourceFromArgs.substring(sourceFromArgs.length - 3) != '.js') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ export const PRIVATE_USE_IDS = [
* Private-use identifiers used by KeymanWeb for the default multitap-into-caps-layer key
* for keyboards with a caps layer while not defining multitaps on shift.
*/
'T_*_MT_SHIFT_TO_SHIFT',
'T_*_MT_SHIFT_TO_CAPS',
'T_*_MT_SHIFT_ROTA_TO_DEFAULT'
'T_*_MT_SHIFT_TO_DEFAULT'
] as const;

/* A map of key field names with values matching the `typeof` the corresponding property
Expand Down
2 changes: 1 addition & 1 deletion common/web/types/src/kmx/string-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OrderedStringList } from 'src/ldml-keyboard/pattern-parser.js';
import { OrderedStringList } from '../ldml-keyboard/pattern-parser.js';
import { DependencySections, StrsItem, StrsOptions } from './kmx-plus.js';

/**
Expand Down
4 changes: 2 additions & 2 deletions common/web/types/src/osk/osk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TouchLayoutFile, TouchLayoutFlick, TouchLayoutKey, TouchLayoutPlatform, TouchLayoutSubKey } from "src/keyman-touch-layout/keyman-touch-layout-file.js";
import { TouchLayoutFile, TouchLayoutFlick, TouchLayoutKey, TouchLayoutPlatform, TouchLayoutSubKey } from "../keyman-touch-layout/keyman-touch-layout-file.js";
import { VisualKeyboard } from "../kvk/visual-keyboard.js";
import SchemaValidators from "../schema-validators.js";

Expand Down Expand Up @@ -106,4 +106,4 @@ export function remapTouchLayout(source: TouchLayoutFile, map: PuaMap) {
scanPlatform(source.tablet);

return dirty;
}
}
Loading

0 comments on commit dc7bfc1

Please sign in to comment.