refactor(web): rename JS Keyboard class to JSKeyboard

This commit is contained in:
Eberhard Beilharz 2024-12-05 18:05:58 +01:00
parent a13981ebc9
commit d82fa81ef6
No known key found for this signature in database
GPG key ID: E9140597606020D3
36 changed files with 153 additions and 153 deletions

View file

@ -1,4 +1,4 @@
import { type Keyboard, KeyboardScriptError } from 'keyman/engine/keyboard';
import { type JSKeyboard, KeyboardScriptError } from 'keyman/engine/keyboard';
import { type KeyboardStub } from 'keyman/engine/keyboard-storage';
import { CookieSerializer } from 'keyman/engine/dom-utils';
import { eventOutputTarget, outputTargetForElement, PageContextAttachment } from 'keyman/engine/attachment';
@ -25,7 +25,7 @@ export interface KeyboardCookie {
*
* @param {Object} Ptarg Target element
*/
function _SetTargDir(Ptarg: HTMLElement, activeKeyboard: Keyboard) {
function _SetTargDir(Ptarg: HTMLElement, activeKeyboard: JSKeyboard) {
const elDir = activeKeyboard?.isRTL ? 'rtl' : 'ltr';
if(Ptarg) {
@ -41,14 +41,14 @@ function _SetTargDir(Ptarg: HTMLElement, activeKeyboard: Keyboard) {
}
export default class ContextManager extends ContextManagerBase<BrowserConfiguration> {
private _activeKeyboard: {keyboard: Keyboard, metadata: KeyboardStub};
private _activeKeyboard: {keyboard: JSKeyboard, metadata: KeyboardStub};
private cookieManager = new CookieSerializer<KeyboardCookie>('KeymanWeb_Keyboard');
readonly focusAssistant = new FocusAssistant(() => this.activeTarget?.isForcingScroll());
readonly page: PageContextAttachment;
private mostRecentTarget: OutputTarget<any>;
private currentTarget: OutputTarget<any>;
private globalKeyboard: {keyboard: Keyboard, metadata: KeyboardStub};
private globalKeyboard: {keyboard: JSKeyboard, metadata: KeyboardStub};
private _eventsObj: () => LegacyEventEmitter<LegacyAPIEvents>;
private domEventTracker = new DomEventTracker();
@ -385,7 +385,7 @@ export default class ContextManager extends ContextManagerBase<BrowserConfigurat
}
// Note: is part of the keyboard activation process. Not to be called directly by published API.
activateKeyboardForTarget(kbd: {keyboard: Keyboard, metadata: KeyboardStub}, target: OutputTarget<any>) {
activateKeyboardForTarget(kbd: {keyboard: JSKeyboard, metadata: KeyboardStub}, target: OutputTarget<any>) {
let attachment = target?.getElement()._kmwAttachment;
if(!attachment) {

View file

@ -1,4 +1,4 @@
import { Codes, DeviceSpec, KeyEvent, KeyMapping, Keyboard } from 'keyman/engine/keyboard';
import { Codes, DeviceSpec, KeyEvent, KeyMapping, JSKeyboard } from 'keyman/engine/keyboard';
import { KeyboardProcessor } from 'keyman/engine/js-processor';
import { ModifierKeyConstants } from '@keymanapp/common-types';
@ -10,7 +10,7 @@ import { eventOutputTarget, outputTargetForElement } from 'keyman/engine/attachm
import ContextManager from './contextManager.js';
type KeyboardState = {
activeKeyboard: Keyboard,
activeKeyboard: JSKeyboard,
modStateFlags: number,
baseLayout: string
}

View file

@ -7,7 +7,7 @@ import {
VisualKeyboard
} from 'keyman/engine/osk';
import { ErrorStub, KeyboardStub, CloudQueryResult, toPrefixedKeyboardId as prefixed } from 'keyman/engine/keyboard-storage';
import { DeviceSpec, Keyboard } from "keyman/engine/keyboard";
import { DeviceSpec, JSKeyboard } from "keyman/engine/keyboard";
import KeyboardObject = KeymanWebKeyboard.KeyboardObject;
import * as views from './viewsAnchorpoint.js';
@ -271,7 +271,7 @@ export default class KeymanEngine extends KeymanEngineBase<BrowserConfiguration,
* Function setKeyboardForControl
* Scope Public
* @param {Element} Pelem Control element
* @param {string|null=} Pkbd Keyboard (Clears the set keyboard if set to null.)
* @param {string|null=} Pkbd JSKeyboard (Clears the set keyboard if set to null.)
* @param {string|null=} Plc Language Code
* Description Set default keyboard for the control
*
@ -385,12 +385,12 @@ export default class KeymanEngine extends KeymanEngineBase<BrowserConfiguration,
* This is a public API function documented at
* https://help.keyman.com/developer/engine/web/current-version/reference/core/getKeyboard.
*
* @param {Object} Lstub Keyboard stub object
* @param {Object} Lkbd Keyboard script object
* @param {Object} Lstub JSKeyboard stub object
* @param {Object} Lkbd JSKeyboard script object
* @return {Object} Copy of keyboard identification strings
*
*/
private _GetKeyboardDetail = function(Lstub: KeyboardStub, Lkbd: Keyboard) { // I2078 - Full keyboard detail
private _GetKeyboardDetail = function(Lstub: KeyboardStub, Lkbd: JSKeyboard) { // I2078 - Full keyboard detail
let Lr = {
Name: Lstub.KN,
InternalName: Lstub.KI,
@ -425,13 +425,13 @@ export default class KeymanEngine extends KeymanEngineBase<BrowserConfiguration,
* See https://help.keyman.com/developer/engine/web/current-version/reference/core/isCJK
*/
public isCJK(k0?: KeyboardObject | ReturnType<KeymanEngine['_GetKeyboardDetail']> /* [b/c Toolbar UI]*/) {
let kbd: Keyboard;
let kbd: JSKeyboard;
if(k0) {
let kbdDetail = k0 as ReturnType<KeymanEngine['_GetKeyboardDetail']>;
if(kbdDetail.KeyboardID){
kbd = this.keyboardRequisitioner.cache.getKeyboard(kbdDetail.KeyboardID);
} else {
kbd = new Keyboard(k0);
kbd = new JSKeyboard(k0);
}
} else {
kbd = this.core.activeKeyboard;
@ -669,7 +669,7 @@ export default class KeymanEngine extends KeymanEngineBase<BrowserConfiguration,
argFormFactor?: DeviceSpec.FormFactor,
argLayerId?: string
): HTMLElement {
let PKbd: Keyboard = null;
let PKbd: JSKeyboard = null;
if(PInternalName != null) {
PKbd = this.keyboardRequisitioner.cache.getKeyboard(PInternalName);

View file

@ -1,4 +1,4 @@
import { type Keyboard } from 'keyman/engine/keyboard';
import { type JSKeyboard } from 'keyman/engine/keyboard';
import { Mock, OutputTarget, Transcription, findCommonSubstringEndIndex, isEmptyTransform, TextTransform } from 'keyman/engine/js-processor';
import { KeyboardStub } from 'keyman/engine/keyboard-storage';
import { ContextManagerBase } from 'keyman/engine/main';
@ -116,7 +116,7 @@ export default class ContextManager extends ContextManagerBase<WebviewConfigurat
// yet to be modularized at this time, though.)
private _rawContext: ContextHost;
private _activeKeyboard: {keyboard: Keyboard, metadata: KeyboardStub};
private _activeKeyboard: {keyboard: JSKeyboard, metadata: KeyboardStub};
constructor(engineConfig: WebviewConfiguration) {
super(engineConfig);
@ -136,7 +136,7 @@ export default class ContextManager extends ContextManagerBase<WebviewConfigurat
return this._activeKeyboard;
}
activateKeyboardForTarget(kbd: {keyboard: Keyboard, metadata: KeyboardStub}, target: OutputTarget) {
activateKeyboardForTarget(kbd: {keyboard: JSKeyboard, metadata: KeyboardStub}, target: OutputTarget) {
// `target` is irrelevant for `app/webview`, as it'll only ever use 'global' keyboard settings.
// Clone the object to prevent accidental by-reference changes.
@ -192,7 +192,7 @@ export default class ContextManager extends ContextManagerBase<WebviewConfigurat
protected prepareKeyboardForActivation(
keyboardId: string,
languageCode?: string
): {keyboard: Promise<Keyboard>, metadata: KeyboardStub} {
): {keyboard: Promise<JSKeyboard>, metadata: KeyboardStub} {
const originalKeyboard = this.activeKeyboard;
const activatingKeyboard = super.prepareKeyboardForActivation(keyboardId, languageCode);

View file

@ -1,10 +1,10 @@
import { DeviceSpec, Keyboard, KeyEvent, ManagedPromise } from 'keyman/engine/keyboard';
import { DeviceSpec, JSKeyboard, KeyEvent, ManagedPromise } from 'keyman/engine/keyboard';
import { HardKeyboard, processForMnemonicsAndLegacy } from 'keyman/engine/main';
export default class PassthroughKeyboard extends HardKeyboard {
readonly baseDevice: DeviceSpec;
public activeKeyboard: Keyboard;
public activeKeyboard: JSKeyboard;
constructor(baseDevice: DeviceSpec) {
super();

View file

@ -7,7 +7,7 @@
import { type DeviceSpec } from "@keymanapp/web-utils";
import { ModifierKeyConstants } from '@keymanapp/common-types';
import { Codes, type KeyEvent, KeyMapping, Keyboard, KeyboardHarness, KeyboardKeymanGlobal, VariableStoreDictionary } from "keyman/engine/keyboard";
import { Codes, type KeyEvent, KeyMapping, JSKeyboard, KeyboardHarness, KeyboardKeymanGlobal, VariableStoreDictionary } from "keyman/engine/keyboard";
import type OutputTarget from './outputTarget.js';
import { type Deadkey } from './deadkeys.js';
import { Mock } from "./mock.js";
@ -180,7 +180,7 @@ export default class KeyboardInterface extends KeyboardHarness {
_AnyIndices: number[] = []; // AnyIndex - array of any/index match indices
// Must be accessible to some of the keyboard API methods.
activeKeyboard: Keyboard;
activeKeyboard: JSKeyboard;
activeDevice: DeviceSpec;
variableStoreSerializer?: VariableStoreSerializer;
@ -222,7 +222,7 @@ export default class KeyboardInterface extends KeyboardHarness {
/**
* Function registerKeyboard KR
* Scope Public
* @param {Object} Pk Keyboard object
* @param {Object} Pk JSKeyboard object
* Description Registers a keyboard with KeymanWeb once its script has fully loaded.
*
* In web-core, this also activates the keyboard; in other modules, this method
@ -231,7 +231,7 @@ export default class KeyboardInterface extends KeyboardHarness {
registerKeyboard(Pk: any): void {
// NOTE: This implementation is web-core specific and is intentionally replaced, whole-sale,
// by DOM-aware code.
let keyboard = new Keyboard(Pk);
let keyboard = new JSKeyboard(Pk);
this.loadedKeyboard = keyboard;
}

View file

@ -9,7 +9,7 @@
import { EventEmitter } from 'eventemitter3';
import { ModifierKeyConstants } from '@keymanapp/common-types';
import {
Codes, type Keyboard, MinimalKeymanGlobal, KeyEvent, Layouts,
Codes, type JSKeyboard, MinimalKeymanGlobal, KeyEvent, Layouts,
DefaultRules, EmulationKeystrokes
} from "keyman/engine/keyboard";
import { Mock } from "./mock.js";
@ -87,11 +87,11 @@ export default class KeyboardProcessor extends EventEmitter<EventMap> {
this.defaultRules = options.defaultOutputRules || KeyboardProcessor.DEFAULT_OPTIONS.defaultOutputRules;
}
public get activeKeyboard(): Keyboard {
public get activeKeyboard(): JSKeyboard {
return this.keyboardInterface.activeKeyboard;
}
public set activeKeyboard(keyboard: Keyboard) {
public set activeKeyboard(keyboard: JSKeyboard) {
this.keyboardInterface.activeKeyboard = keyboard;
// All old deadkeys and keyboard-specific cache should immediately be invalidated

View file

@ -1,4 +1,4 @@
import { Keyboard, KeyboardLoaderBase as KeyboardLoader } from "keyman/engine/keyboard";
import { JSKeyboard, KeyboardLoaderBase as KeyboardLoader } from "keyman/engine/keyboard";
import { EventEmitter } from "eventemitter3";
import KeyboardStub from "./keyboardStub.js";
@ -38,12 +38,12 @@ interface EventMap {
/**
* Indicates that the specified Keyboard has just been added to the cache.
*/
keyboardadded: (keyboard: Keyboard) => void;
keyboardadded: (keyboard: JSKeyboard) => void;
}
export default class StubAndKeyboardCache extends EventEmitter<EventMap> {
private stubSetTable: Record<string, Record<string, KeyboardStub>> = {};
private keyboardTable: Record<string, Keyboard | Promise<Keyboard>> = {};
private keyboardTable: Record<string, JSKeyboard | Promise<JSKeyboard>> = {};
private readonly keyboardLoader: KeyboardLoader;
@ -52,11 +52,11 @@ export default class StubAndKeyboardCache extends EventEmitter<EventMap> {
this.keyboardLoader = keyboardLoader;
}
getKeyboardForStub(stub: KeyboardStub): Keyboard {
getKeyboardForStub(stub: KeyboardStub): JSKeyboard {
return stub ? this.getKeyboard(stub.KI) : null;
}
getKeyboard(keyboardID: string): Keyboard {
getKeyboard(keyboardID: string): JSKeyboard {
if(!keyboardID) {
return null;
}
@ -112,14 +112,14 @@ export default class StubAndKeyboardCache extends EventEmitter<EventMap> {
}
}
addKeyboard(keyboard: Keyboard) {
addKeyboard(keyboard: JSKeyboard) {
const keyboardID = prefixed(keyboard.id);
this.keyboardTable[keyboardID] = keyboard;
this.emit('keyboardadded', keyboard);
}
fetchKeyboardForStub(stub: KeyboardStub) : Promise<Keyboard> {
fetchKeyboardForStub(stub: KeyboardStub) : Promise<JSKeyboard> {
return this.fetchKeyboard(stub.KI);
}
@ -134,7 +134,7 @@ export default class StubAndKeyboardCache extends EventEmitter<EventMap> {
return cachedEntry instanceof Promise;
}
fetchKeyboard(keyboardID: string): Promise<Keyboard> {
fetchKeyboard(keyboardID: string): Promise<JSKeyboard> {
if(!keyboardID) {
throw new Error("Keyboard ID must be specified");
}
@ -146,7 +146,7 @@ export default class StubAndKeyboardCache extends EventEmitter<EventMap> {
keyboardID = prefixed(keyboardID);
const cachedEntry = this.keyboardTable[keyboardID];
if(cachedEntry instanceof Keyboard) {
if(cachedEntry instanceof JSKeyboard) {
return Promise.resolve(cachedEntry);
} else if(cachedEntry instanceof Promise) {
return cachedEntry;
@ -189,12 +189,12 @@ export default class StubAndKeyboardCache extends EventEmitter<EventMap> {
}
getStub(keyboardID: string, languageID: string): KeyboardStub;
getStub(keyboard: Keyboard, languageID?: string): KeyboardStub;
getStub(arg0: string | Keyboard, arg1?: string): KeyboardStub {
getStub(keyboard: JSKeyboard, languageID?: string): KeyboardStub;
getStub(arg0: string | JSKeyboard, arg1?: string): KeyboardStub {
let keyboardID: string;
let languageID = arg1 || '---';
if(arg0 instanceof Keyboard) {
if(arg0 instanceof JSKeyboard) {
keyboardID = arg0.id;
} else {
keyboardID = arg0;
@ -221,12 +221,12 @@ export default class StubAndKeyboardCache extends EventEmitter<EventMap> {
/**
* Removes all metadata (stubs) associated with a specific keyboard from the cache, optionally
* removing the cached keyboard as well.
* @param keyboard Either the keyboard ID or `Keyboard` instance
* @param purge If `true`, will also purge the `Keyboard` instance itself from the cache.
* @param keyboard Either the keyboard ID or `JSKeyboard` instance
* @param purge If `true`, will also purge the `JSKeyboard` instance itself from the cache.
* If `false`, only forgets the metadata (stubs).
*/
forgetKeyboard(keyboard: string | Keyboard, purge: boolean = false) {
let id: string = (keyboard instanceof Keyboard) ? keyboard.id : prefixed(keyboard);
forgetKeyboard(keyboard: string | JSKeyboard, purge: boolean = false) {
let id: string = (keyboard instanceof JSKeyboard) ? keyboard.id : prefixed(keyboard);
if(this.stubSetTable[id]) {
delete this.stubSetTable[id];

View file

@ -1,6 +1,6 @@
export * from "./keyboards/activeLayout.js";
export * from "./keyboards/defaultLayouts.js";
export { default as Keyboard } from "./keyboards/keyboard.js";
export { default as JSKeyboard } from "./keyboards/keyboard.js";
export * from "./keyboards/keyboard.js";
export { KeyboardHarness, KeyboardKeymanGlobal, MinimalCodesInterface, MinimalKeymanGlobal } from "./keyboards/keyboardHarness.js";
export { KeyboardLoaderBase } from "./keyboards/keyboardLoaderBase.js";

View file

@ -6,7 +6,7 @@
// a key event. The most straightforward way to integrate Web OSK events on other platforms is to have
// other platforms recognize and utilize this type.
import type Keyboard from "./keyboards/keyboard.js";
import type JSKeyboard from "./keyboards/keyboard.js";
import { type DeviceSpec } from "@keymanapp/web-utils";
import Codes from './codes.js';
@ -44,7 +44,7 @@ export interface KeyEventSpec {
* guarantee that the keyboard instance known to the handler has not changed during JS execution
* since the user's interaction that raised the event.
*/
srcKeyboard?: Keyboard;
srcKeyboard?: JSKeyboard;
// Holds a generated fat-finger distribution (when appropriate)
keyDistribution?: KeyDistribution;
@ -85,7 +85,7 @@ export default class KeyEvent implements KeyEventSpec {
* guarantee that the keyboard instance known to the handler has not changed during JS execution
* since the user's interaction that raised the event.
*/
srcKeyboard?: Keyboard;
srcKeyboard?: JSKeyboard;
// Holds relevant event properties leading to construction of this KeyEvent.
source?: any; // Technically, KeyEvent|MouseEvent|Touch - but those are DOM types that must be kept out of headless mode.

View file

@ -3,7 +3,7 @@ import KeyEvent, { KeyEventSpec } from "../keyEvent.js";
import KeyMapping from "../keyMapping.js";
import { ButtonClasses, Layouts } from "./defaultLayouts.js";
import type { LayoutKey, LayoutSubKey, LayoutRow, LayoutLayer, LayoutFormFactor, ButtonClass } from "./defaultLayouts.js";
import type Keyboard from "./keyboard.js";
import type JSKeyboard from "./keyboard.js";
import { TouchLayout } from "@keymanapp/common-types";
import TouchLayoutDefaultHint = TouchLayout.TouchLayoutDefaultHint;
@ -776,7 +776,7 @@ export class ActiveLayout implements LayoutFormFactor{
font: string;
keyLabels: boolean;
isDefault?: boolean;
keyboard: Keyboard;
keyboard: JSKeyboard;
formFactor: DeviceSpec.FormFactor;
defaultHint: TouchLayoutDefaultHint;
displayUnderlying?: boolean;
@ -851,7 +851,7 @@ export class ActiveLayout implements LayoutFormFactor{
* @param layout
* @param formFactor
*/
static polyfill(layout: TouchLayoutSpec, keyboard: Keyboard, formFactor: DeviceSpec.FormFactor): ActiveLayout {
static polyfill(layout: TouchLayoutSpec, keyboard: JSKeyboard, formFactor: DeviceSpec.FormFactor): ActiveLayout {
/* c8 ignore start */
if(layout == null) {
throw new Error("Cannot build an ActiveLayout for a null specification.");

View file

@ -20,7 +20,7 @@ import ButtonClasses = TouchLayout.TouchLayoutKeySp;
export { ButtonClasses };
import Codes from "../codes.js";
import type Keyboard from "./keyboard.js";
import type JSKeyboard from "./keyboard.js";
// The following types provide type definitions for the full JSON format we use for visual keyboard definitions.
export type ButtonClass = 0 | 1 | 2 | 3 | 4 | /*5 | 6 | 7 |*/ 8 | 9 | 10;
@ -87,11 +87,11 @@ export class Layouts {
* Build a default layout for keyboards with no explicit layout
*
* @param {Object} PVK raw specifications
* @param {Keyboard} keyboard keyboard object (as loaded)
* @param {JSKeyboard} keyboard keyboard object (as loaded)
* @param {string} formFactor (really utils.FormFactor)
* @return {LayoutFormFactor}
*/
static buildDefaultLayout(PVK: EncodedVisualKeyboard, keyboard: Keyboard, formFactor: string): LayoutFormFactor {
static buildDefaultLayout(PVK: EncodedVisualKeyboard, keyboard: JSKeyboard, formFactor: string): LayoutFormFactor {
// Build a layout using the default for the device
let layoutType = formFactor as keyof TouchLayout.TouchLayoutFile;

View file

@ -52,7 +52,7 @@ type KmwKeyboardObject = KeyboardObject & {
* and keyboard-centered functionality in an object-oriented way without modifying the
* wrapped keyboard itself.
*/
export default class Keyboard {
export default class JSKeyboard {
public static DEFAULT_SCRIPT_OBJECT: KmwKeyboardObject = {
'gs': function(outputTarget: OutputTarget, keystroke: KeyEvent) { return false; }, // no matching rules; rely on defaultRuleOutput entirely
'KI': '', // The currently-existing default keyboard ID; we already have checks that focus against this.
@ -74,7 +74,7 @@ export default class Keyboard {
if(keyboardScript) {
this.scriptObject = keyboardScript;
} else {
this.scriptObject = Keyboard.DEFAULT_SCRIPT_OBJECT;
this.scriptObject = JSKeyboard.DEFAULT_SCRIPT_OBJECT;
}
this.layoutStates = {};
}
@ -101,7 +101,7 @@ export default class Keyboard {
}
get isHollow(): boolean {
return this.scriptObject == Keyboard.DEFAULT_SCRIPT_OBJECT;
return this.scriptObject == JSKeyboard.DEFAULT_SCRIPT_OBJECT;
}
get id(): string {

View file

@ -1,4 +1,4 @@
import Keyboard from "./keyboard.js";
import JSKeyboard from "./keyboard.js";
import Codes from "../codes.js";
import { DeviceSpec } from '@keymanapp/web-utils';
@ -64,7 +64,7 @@ export class KeyboardHarness {
/**
* This field serves as the receptacle for a successfully-loaded Keyboard.
*/
public loadedKeyboard: Keyboard = null;
public loadedKeyboard: JSKeyboard = null;
/**
* Keyman keyboards register themselves into the Keyman Engine for Web by directly
@ -84,7 +84,7 @@ export class KeyboardHarness {
if(this.loadedKeyboard) {
throw new Error("Unexpected state: the most-recently loaded keyboard field was not properly reset.");
}
this.loadedKeyboard = new Keyboard(scriptObject);
this.loadedKeyboard = new JSKeyboard(scriptObject);
}
// Is evaluated on script-load for some keyboards using variable stores.

View file

@ -1,4 +1,4 @@
import Keyboard from "./keyboard.js";
import JSKeyboard from "./keyboard.js";
import { KeyboardHarness } from "./keyboardHarness.js";
import KeyboardProperties from "./keyboardProperties.js";
import { KeyboardLoadErrorBuilder, StubBasedErrorBuilder, UriBasedErrorBuilder } from './keyboardLoadError.js';
@ -22,7 +22,7 @@ export abstract class KeyboardLoaderBase {
* @param uri The URI of the keyboard to load.
* @returns A Promise that resolves to the loaded keyboard.
*/
public loadKeyboardFromPath(uri: string): Promise<Keyboard> {
public loadKeyboardFromPath(uri: string): Promise<JSKeyboard> {
this.harness.install();
return this.loadKeyboardInternal(uri, new UriBasedErrorBuilder(uri));
}
@ -33,12 +33,12 @@ export abstract class KeyboardLoaderBase {
* @param stub The stub of the keyboard to load.
* @returns A Promise that resolves to the loaded keyboard.
*/
public async loadKeyboardFromStub(stub: KeyboardStub): Promise<Keyboard> {
public async loadKeyboardFromStub(stub: KeyboardStub): Promise<JSKeyboard> {
this.harness.install();
return this.loadKeyboardInternal(stub.filename, new StubBasedErrorBuilder(stub));
}
private async loadKeyboardInternal(uri: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<Keyboard> {
private async loadKeyboardInternal(uri: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<JSKeyboard> {
const byteArray = await this.loadKeyboardBlob(uri, errorBuilder);
if (byteArray.slice(0, 4) == Uint8Array.from([0x4b, 0x58, 0x54, 0x53])) { // 'KXTS'
@ -60,5 +60,5 @@ export abstract class KeyboardLoaderBase {
protected abstract loadKeyboardBlob(uri: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<Uint8Array>;
protected abstract loadKeyboardFromScript(scriptSrc: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<Keyboard>;
protected abstract loadKeyboardFromScript(scriptSrc: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<JSKeyboard>;
}

View file

@ -2,7 +2,7 @@
///<reference lib="dom" />
import { default as Keyboard } from '../keyboard.js';
import { default as JSKeyboard } from '../keyboard.js';
import { KeyboardHarness, MinimalKeymanGlobal } from '../keyboardHarness.js';
import { KeyboardLoaderBase } from '../keyboardLoaderBase.js';
import { KeyboardLoadErrorBuilder } from '../keyboardLoadError.js';
@ -54,7 +54,7 @@ export class DOMKeyboardLoader extends KeyboardLoaderBase {
return new Uint8Array(buffer);
}
protected async loadKeyboardFromScript(script: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<Keyboard> {
protected async loadKeyboardFromScript(script: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<JSKeyboard> {
try {
this.evalScriptInContext(script, this.harness._jsGlobal);
} catch (e) {

View file

@ -3,7 +3,7 @@ import { readFile } from 'node:fs/promises';
import { globalObject } from '@keymanapp/web-utils';
import { default as Keyboard } from '../keyboard.js';
import { default as JSKeyboard } from '../keyboard.js';
import { KeyboardHarness, MinimalKeymanGlobal } from '../keyboardHarness.js';
import { KeyboardLoaderBase } from '../keyboardLoaderBase.js';
import { KeyboardLoadErrorBuilder } from '../keyboardLoadError.js';
@ -41,7 +41,7 @@ export class NodeKeyboardLoader extends KeyboardLoaderBase {
return Uint8Array.from(buffer);
}
protected async loadKeyboardFromScript(scriptSrc: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<Keyboard> {
protected async loadKeyboardFromScript(scriptSrc: string, errorBuilder: KeyboardLoadErrorBuilder): Promise<JSKeyboard> {
let script;
try {
script = new vm.Script(scriptSrc);

View file

@ -1,5 +1,5 @@
import { EventEmitter } from 'eventemitter3';
import { ManagedPromise, type Keyboard } from 'keyman/engine/keyboard';
import { ManagedPromise, type JSKeyboard } from 'keyman/engine/keyboard';
import { type KeyboardInterface, type OutputTarget } from 'keyman/engine/js-processor';
import { StubAndKeyboardCache, type KeyboardStub } from 'keyman/engine/keyboard-storage';
import { PredictionContext } from 'keyman/engine/interfaces';
@ -37,7 +37,7 @@ interface EventMap {
* @param kbd
* @returns
*/
'keyboardchange': (kbd: {keyboard: Keyboard, metadata: KeyboardStub}) => void;
'keyboardchange': (kbd: {keyboard: JSKeyboard, metadata: KeyboardStub}) => void;
}
export interface ContextManagerConfiguration {
@ -65,7 +65,7 @@ export interface ContextManagerConfiguration {
interface PendingActivation {
target: OutputTarget,
keyboard: Promise<Keyboard>,
keyboard: Promise<JSKeyboard>,
stub: KeyboardStub;
}
@ -124,7 +124,7 @@ export abstract class ContextManagerBase<MainConfig extends EngineConfiguration>
this.predictionContext.resetContext();
}
abstract get activeKeyboard(): {keyboard: Keyboard, metadata: KeyboardStub};
abstract get activeKeyboard(): {keyboard: JSKeyboard, metadata: KeyboardStub};
/**
* Determines the 'target' currently used to determine which keyboard should be active.
@ -143,7 +143,7 @@ export abstract class ContextManagerBase<MainConfig extends EngineConfiguration>
* @param kbd
* @param target
*/
protected abstract activateKeyboardForTarget(kbd: {keyboard: Keyboard, metadata: KeyboardStub}, target: OutputTarget): void;
protected abstract activateKeyboardForTarget(kbd: {keyboard: JSKeyboard, metadata: KeyboardStub}, target: OutputTarget): void;
/**
* Checks the pending keyboard-activation array for an entry corresponding to the specified
@ -178,7 +178,7 @@ export abstract class ContextManagerBase<MainConfig extends EngineConfiguration>
* @returns
*/
protected async deferredKeyboardActivation(
kbdPromise: Promise<Keyboard>,
kbdPromise: Promise<JSKeyboard>,
metadata: KeyboardStub,
target: OutputTarget
): Promise<PendingActivation> {
@ -263,7 +263,7 @@ export abstract class ContextManagerBase<MainConfig extends EngineConfiguration>
this.emit('beforekeyboardchange', activatingKeyboard.metadata);
}
let kbdStubPair: { keyboard: Keyboard, metadata: KeyboardStub } = null;
let kbdStubPair: { keyboard: JSKeyboard, metadata: KeyboardStub } = null;
if(keyboard) {
kbdStubPair = {
keyboard: keyboard,
@ -298,7 +298,7 @@ export abstract class ContextManagerBase<MainConfig extends EngineConfiguration>
protected prepareKeyboardForActivation(
keyboardId: string,
languageCode?: string
): {keyboard: Promise<Keyboard>, metadata: KeyboardStub} {
): {keyboard: Promise<JSKeyboard>, metadata: KeyboardStub} {
// Set default language code
languageCode ||= '';
@ -333,7 +333,7 @@ export abstract class ContextManagerBase<MainConfig extends EngineConfiguration>
}
// Determine if the keyboard was previously loaded but is not active; use the cached, pre-loaded version if so.
let keyboard: Keyboard;
let keyboard: JSKeyboard;
if(keyboard = this.keyboardCache.getKeyboardForStub(requestedStub)) {
return {
keyboard: Promise.resolve(keyboard),
@ -351,7 +351,7 @@ export abstract class ContextManagerBase<MainConfig extends EngineConfiguration>
this.emit('keyboardasyncload', requestedStub, completionPromise.corePromise);
let keyboardPromise = this.keyboardCache.fetchKeyboardForStub(requestedStub);
let timeoutPromise = new Promise<Keyboard>((resolve, reject) => {
let timeoutPromise = new Promise<JSKeyboard>((resolve, reject) => {
const timeoutMsg = `Sorry, the ${requestedStub.name} keyboard for ${requestedStub.langName} is not currently available.`;
window.setTimeout(() => reject(new Error(timeoutMsg)), ContextManagerBase.TIMEOUT_THRESHOLD);
});

View file

@ -1,5 +1,5 @@
import { EventEmitter } from "eventemitter3";
import { Keyboard, KeyMapping, KeyEvent, Codes } from "keyman/engine/keyboard";
import { JSKeyboard, KeyMapping, KeyEvent, Codes } from "keyman/engine/keyboard";
import { type RuleBehavior } from 'keyman/engine/js-processor';
import { KeyEventSourceInterface } from 'keyman/engine/osk';
import { ModifierKeyConstants } from '@keymanapp/common-types';
@ -13,7 +13,7 @@ interface EventMap {
export default class HardKeyboard extends EventEmitter<EventMap> implements KeyEventSourceInterface<EventMap> { }
export function processForMnemonicsAndLegacy(s: KeyEvent, activeKeyboard: Keyboard, baseLayout: string): KeyEvent {
export function processForMnemonicsAndLegacy(s: KeyEvent, activeKeyboard: JSKeyboard, baseLayout: string): KeyEvent {
// Mnemonic handling.
if(activeKeyboard && activeKeyboard.isMnemonic) {
// The following will never set a code corresponding to a modifier key, so it's fine to do this,

View file

@ -7,7 +7,7 @@ import { globalObject, DeviceSpec } from "@keymanapp/web-utils";
import { CoreFactory, MainModule as KmCoreModule } from 'keyman/engine/core-processor';
import { Codes, type Keyboard, type KeyEvent } from "keyman/engine/keyboard";
import { Codes, type JSKeyboard, type KeyEvent } from "keyman/engine/keyboard";
import {
type Alternate,
isEmptyTransform,
@ -74,11 +74,11 @@ export class InputProcessor {
return this.km_core;
}
public get activeKeyboard(): Keyboard {
public get activeKeyboard(): JSKeyboard {
return this.keyboardInterface.activeKeyboard;
}
public set activeKeyboard(keyboard: Keyboard) {
public set activeKeyboard(keyboard: JSKeyboard) {
this.keyboardInterface.activeKeyboard = keyboard;
// All old deadkeys and keyboard-specific cache should immediately be invalidated

View file

@ -1,4 +1,4 @@
import { type KeyEvent, type Keyboard, KeyboardKeymanGlobal } from "keyman/engine/keyboard";
import { type KeyEvent, type JSKeyboard, KeyboardKeymanGlobal } from "keyman/engine/keyboard";
import { OutputTarget, ProcessorInitOptions, RuleBehavior } from 'keyman/engine/js-processor';
import { DOMKeyboardLoader as KeyboardLoader } from "keyman/engine/keyboard/dom-keyboard-loader";
import { InputProcessor } from './headless/inputProcessor.js';
@ -554,8 +554,8 @@ export default class KeymanEngine<
*
* See https://help.keyman.com/developer/engine/web/current-version/reference/core/isChiral
*/
public isChiral(k0?: string | Keyboard) {
let kbd: Keyboard;
public isChiral(k0?: string | JSKeyboard) {
let kbd: JSKeyboard;
if(k0) {
if(typeof k0 == 'string') {
const kbdObj = this.keyboardRequisitioner.cache.getKeyboard(k0);

View file

@ -1,4 +1,4 @@
import { Keyboard, KeyboardProperties } from 'keyman/engine/keyboard';
import { JSKeyboard, KeyboardProperties } from 'keyman/engine/keyboard';
import { createUnselectableElement } from 'keyman/engine/dom-utils';
// Base class for a banner above the keyboard in the OSK
@ -98,7 +98,7 @@ export abstract class Banner {
* @param keyboard
* @param keyboardProperties
*/
public configureForKeyboard(keyboard: Keyboard, keyboardProperties: KeyboardProperties) { }
public configureForKeyboard(keyboard: JSKeyboard, keyboardProperties: KeyboardProperties) { }
public readonly refreshLayout?: () => void;

View file

@ -6,7 +6,7 @@ import { BannerView } from './bannerView.js';
import { Banner } from './banner.js';
import { BlankBanner } from './blankBanner.js';
import { HTMLBanner } from './htmlBanner.js';
import { Keyboard, KeyboardProperties } from 'keyman/engine/keyboard';
import { JSKeyboard, KeyboardProperties } from 'keyman/engine/keyboard';
export class BannerController {
private container: BannerView;
@ -17,7 +17,7 @@ export class BannerController {
private _inactiveBanner: Banner;
private keyboard: Keyboard;
private keyboard: JSKeyboard;
private keyboardStub: KeyboardProperties;
/**
@ -105,7 +105,7 @@ export class BannerController {
* @param keyboard
* @param keyboardProperties
*/
public configureForKeyboard(keyboard: Keyboard, keyboardProperties: KeyboardProperties) {
public configureForKeyboard(keyboard: JSKeyboard, keyboardProperties: KeyboardProperties) {
this.keyboard = keyboard;
this.keyboardStub = keyboardProperties;

View file

@ -13,7 +13,7 @@ import {
import { BANNER_GESTURE_SET } from './bannerGestureSet.js';
import { DeviceSpec, Keyboard, KeyboardProperties, timedPromise } from 'keyman/engine/keyboard';
import { DeviceSpec, JSKeyboard, KeyboardProperties, timedPromise } from 'keyman/engine/keyboard';
import { Banner } from './banner.js';
import { ParsedLengthStyle } from '../lengthStyle.js';
import { getFontSizeStyle } from '../fontSizeUtils.js';
@ -675,7 +675,7 @@ export class SuggestionBanner extends Banner {
return result;
}
public configureForKeyboard(keyboard: Keyboard, keyboardProperties: KeyboardProperties) {
public configureForKeyboard(keyboard: JSKeyboard, keyboardProperties: KeyboardProperties) {
const rtl = keyboard.isRTL;
// Removes all previous children. (.replaceChildren requires Chrome for Android 86.)

View file

@ -1,15 +1,15 @@
import { Keyboard } from 'keyman/engine/keyboard';
import { JSKeyboard } from 'keyman/engine/keyboard';
import KeyboardView from './keyboardView.interface.js';
import { ParsedLengthStyle } from "../lengthStyle.js";
export default class HelpPageView implements KeyboardView {
private readonly kbd: Keyboard;
private readonly kbd: JSKeyboard;
public readonly element: HTMLDivElement;
private static readonly ID = 'kmw-osk-help-page';
constructor(keyboard: Keyboard) {
constructor(keyboard: JSKeyboard) {
this.kbd = keyboard;
var Ldiv = this.element = document.createElement('div');

View file

@ -1,6 +1,6 @@
import { EventEmitter } from 'eventemitter3';
import { Keyboard } from 'keyman/engine/keyboard';
import { JSKeyboard } from 'keyman/engine/keyboard';
import OSKViewComponent from './oskViewComponent.interface.js';
import { ParsedLengthStyle } from '../lengthStyle.js';
@ -102,7 +102,7 @@ export default class TitleBar extends EventEmitter<EventMap, TitleBar> implement
this._caption.innerHTML = str;
}
public setTitleFromKeyboard(keyboard: Keyboard) {
public setTitleFromKeyboard(keyboard: JSKeyboard) {
let title = "<span style='font-weight:bold'>" + keyboard?.name + '</span>'; // I1972 // I2186
this._caption.innerHTML = title;
}

View file

@ -1,4 +1,4 @@
export { Codes, DeviceSpec, Keyboard, KeyboardProperties, SpacebarText } from 'keyman/engine/keyboard';
export { Codes, DeviceSpec, JSKeyboard, KeyboardProperties, SpacebarText } from 'keyman/engine/keyboard';
export { default as OSKView } from './views/oskView.js';
export { default as FloatingOSKView, FloatingOSKViewConfiguration } from './views/floatingOskView.js';

View file

@ -1,4 +1,4 @@
import { type DeviceSpec, Keyboard, ActiveLayout, ButtonClasses } from 'keyman/engine/keyboard';
import { type DeviceSpec, JSKeyboard, ActiveLayout, ButtonClasses } from 'keyman/engine/keyboard';
import { InputSample } from '@keymanapp/gesture-recognizer';
@ -24,7 +24,7 @@ export default class OSKLayerGroup {
private _activeLayerId: string = 'default';
private _heightPadding: number;
public constructor(vkbd: VisualKeyboard, keyboard: Keyboard, formFactor: DeviceSpec.FormFactor) {
public constructor(vkbd: VisualKeyboard, keyboard: JSKeyboard, formFactor: DeviceSpec.FormFactor) {
const layout = keyboard.layout(formFactor);
this.spec = layout;
this.vkbd = vkbd;

View file

@ -13,7 +13,7 @@ import { type KeyElement } from '../keyElement.js';
import {
Codes,
DeviceSpec,
Keyboard,
JSKeyboard,
KeyboardProperties,
ManagedPromise,
type MinimalCodesInterface
@ -169,7 +169,7 @@ export default abstract class OSKView
private _boxBaseTouchEventCancel: (e: TouchEvent) => boolean;
private keyboardData: {
keyboard: Keyboard,
keyboard: JSKeyboard,
metadata: KeyboardProperties
};
@ -533,14 +533,14 @@ export default abstract class OSKView
}
public get activeKeyboard(): {
keyboard: Keyboard,
keyboard: JSKeyboard,
metadata: KeyboardProperties
} {
return this.keyboardData;
}
public set activeKeyboard(keyboardData: {
keyboard: Keyboard,
keyboard: JSKeyboard,
metadata: KeyboardProperties
}) {
this.keyboardData = keyboardData;
@ -782,7 +782,7 @@ export default abstract class OSKView
this.postKeyboardLoad();
}
private _GenerateKeyboardView(keyboard: Keyboard, keyboardMetadata: KeyboardProperties): KeyboardView {
private _GenerateKeyboardView(keyboard: JSKeyboard, keyboardMetadata: KeyboardProperties): KeyboardView {
let device = this.targetDevice;
this._Box.className = "";
@ -815,7 +815,7 @@ export default abstract class OSKView
* @param {Object} keyboard The keyboard to visualize
* Description Generates the visual keyboard element and attaches it to KMW
*/
private _GenerateVisualKeyboard(keyboard: Keyboard, keyboardMetadata: KeyboardProperties): VisualKeyboard {
private _GenerateVisualKeyboard(keyboard: JSKeyboard, keyboardMetadata: KeyboardProperties): VisualKeyboard {
let device = this.targetDevice;
const resourcePath = getResourcePath(this.config);

View file

@ -5,7 +5,7 @@ import {
ActiveLayout,
DeviceSpec,
type InternalKeyboardFont,
Keyboard,
JSKeyboard,
KeyboardProperties,
KeyDistribution,
KeyEvent,
@ -87,7 +87,7 @@ export interface VisualKeyboardConfiguration extends CommonConfiguration {
/**
* The Keyman keyboard on which to base the on-screen keyboard being represented.
*/
keyboard: Keyboard,
keyboard: JSKeyboard,
/**
* Metadata about the keyboard, such as relevant fonts, display name, and language code.
@ -242,7 +242,7 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
public deferLayout: boolean;
// The keyboard object corresponding to this VisualKeyboard.
public readonly layoutKeyboard: Keyboard;
public readonly layoutKeyboard: JSKeyboard;
public readonly layoutKeyboardProperties: KeyboardProperties;
get layerId(): string {
@ -349,7 +349,7 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
if (!this.layoutKeyboard) {
// May occasionally be null in embedded contexts; have seen this when iOS engine sets
// keyboard height during change of keyboards.
this.layoutKeyboard = new Keyboard(null);
this.layoutKeyboard = new JSKeyboard(null);
}
this.layerGroup = new OSKLayerGroup(this, this.layoutKeyboard, formFactor);
@ -1424,7 +1424,7 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
* Create copy of the OSK that can be used for embedding in documentation or help
* The currently active keyboard will be returned if PInternalName is null
*
* @param {Keyboard} PKbd the keyboard object to be displayed
* @param {JSKeyboard} PKbd the keyboard object to be displayed
* @param {KeyboardProperties} kbdProperties the metadata stub for the keyboard
* @param {Object} pathConfig an OSK path-configuration instance
* @param {string=} argFormFactor layout form factor, defaulting to 'desktop'
@ -1434,7 +1434,7 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
* @return {Object} DIV object with filled keyboard layer content
*/
static buildDocumentationKeyboard(
PKbd: Keyboard,
PKbd: JSKeyboard,
kbdProperties: KeyboardProperties,
pathConfig: OSKResourcePathConfiguration,
argFormFactor: DeviceSpec.FormFactor,

View file

@ -1,7 +1,7 @@
import { assert } from 'chai';
import { DOMKeyboardLoader } from 'keyman/engine/keyboard/dom-keyboard-loader';
import { extendString, KeyboardHarness, Keyboard, MinimalKeymanGlobal, DeviceSpec, KeyboardKeymanGlobal, KeyboardDownloadError, KeyboardScriptError } from 'keyman/engine/keyboard';
import { extendString, KeyboardHarness, JSKeyboard, MinimalKeymanGlobal, DeviceSpec, KeyboardKeymanGlobal, KeyboardDownloadError, KeyboardScriptError } from 'keyman/engine/keyboard';
import { KeyboardInterface, Mock } from 'keyman/engine/js-processor';
import { assertThrowsAsync } from 'keyman/tools/testing/test-utils';
@ -49,7 +49,7 @@ describe('Keyboard loading in DOM', function() {
it('`window`, disabled rule processing', async () => {
const harness = new KeyboardHarness(window, MinimalKeymanGlobal);
let keyboardLoader = new DOMKeyboardLoader(harness);
let keyboard: Keyboard = await keyboardLoader.loadKeyboardFromPath('/common/test/resources/keyboards/khmer_angkor.js');
let keyboard: JSKeyboard = await keyboardLoader.loadKeyboardFromPath('/common/test/resources/keyboards/khmer_angkor.js');
assert.isOk(keyboard);
assert.equal(keyboard.id, 'Keyboard_khmer_angkor');
@ -67,7 +67,7 @@ describe('Keyboard loading in DOM', function() {
it('`window`, enabled rule processing', async () => {
const harness = new KeyboardInterface(window, MinimalKeymanGlobal);
const keyboardLoader = new DOMKeyboardLoader(harness);
const keyboard: Keyboard = await keyboardLoader.loadKeyboardFromPath('/common/test/resources/keyboards/khmer_angkor.js');
const keyboard: JSKeyboard = await keyboardLoader.loadKeyboardFromPath('/common/test/resources/keyboards/khmer_angkor.js');
harness.activeKeyboard = keyboard;
assert.isOk(keyboard);
@ -99,7 +99,7 @@ describe('Keyboard loading in DOM', function() {
let keyboardLoader = new DOMKeyboardLoader(harness);
// Preload a keyboard and make it active.
const test_kbd: Keyboard = await keyboardLoader.loadKeyboardFromPath('/common/test/resources/keyboards/test_917.js');
const test_kbd: JSKeyboard = await keyboardLoader.loadKeyboardFromPath('/common/test/resources/keyboards/test_917.js');
harness.activeKeyboard = test_kbd;
assert.isNotOk(harness.loadedKeyboard);

View file

@ -3,7 +3,7 @@ import {
} from 'keyman/engine/keyboard/dom-keyboard-loader';
import {
Keyboard,
JSKeyboard,
KeyboardProperties,
MinimalKeymanGlobal
} from 'keyman/engine/keyboard';
@ -21,11 +21,11 @@ export function loadKeyboardsFromStubs(apiStubs: any, baseDir: string) {
baseDir = baseDir || './';
const keyboards: {
[key: string]: {
keyboard: Keyboard,
keyboard: JSKeyboard,
metadata: KeyboardStub
}
} = {};
let priorPromise: Promise<void | Keyboard> = Promise.resolve();
let priorPromise: Promise<void | JSKeyboard> = Promise.resolve();
for(const stub of apiStubs) {
// We are keeping this strictly sequential because we don't have sandboxed
// loading yet; lack of sandboxing means that all loading keyboards compete

View file

@ -4,7 +4,7 @@ import { preprocessKeyboardEvent } from 'keyman/app/browser';
import { processForMnemonicsAndLegacy } from 'keyman/engine/main';
import { PhysicalInputEventSpec } from '@keymanapp/recorder-core';
import { DeviceSpec } from '@keymanapp/web-utils';
import { Codes, Keyboard, KeyEvent } from 'keyman/engine/keyboard';
import { Codes, JSKeyboard, KeyEvent } from 'keyman/engine/keyboard';
const ModifierCodes = Codes.modifierCodes;
const KeyCodes = Codes.keyCodes;
@ -24,7 +24,7 @@ describe("app/browser: hardware event processing", () => {
modifierSet: PhysicalInputEventSpec.modifierCodes.Shift,
location: 1
}) as any as KeyboardEvent, {
activeKeyboard: new Keyboard({ KM: 0 }),
activeKeyboard: new JSKeyboard({ KM: 0 }),
modStateFlags: 0,
baseLayout: 'us'
},
@ -46,7 +46,7 @@ describe("app/browser: hardware event processing", () => {
keyCode: KeyCodes.K_A,
modifierSet: 0
}) as any as KeyboardEvent, {
activeKeyboard: new Keyboard({ KM: 0 }),
activeKeyboard: new JSKeyboard({ KM: 0 }),
modStateFlags: 0,
baseLayout: 'us'
},
@ -66,7 +66,7 @@ describe("app/browser: hardware event processing", () => {
location: 1
}) as any as KeyboardEvent, {
// KMBM: Keyman Modifier BitMask
activeKeyboard: new Keyboard({KM: 0}),
activeKeyboard: new JSKeyboard({KM: 0}),
modStateFlags: 0,
baseLayout: 'us'
},
@ -86,7 +86,7 @@ describe("app/browser: hardware event processing", () => {
location: 1
}) as any as KeyboardEvent, {
// KMBM: Keyman Modifier BitMask
activeKeyboard: new Keyboard({KM: 0}),
activeKeyboard: new JSKeyboard({KM: 0}),
modStateFlags: ModifierCodes.ALT,
baseLayout: 'us'
},
@ -108,7 +108,7 @@ describe("app/browser: hardware event processing", () => {
location: 1
}) as any as KeyboardEvent, {
// KMBM: Keyman Modifier BitMask
activeKeyboard: new Keyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
activeKeyboard: new JSKeyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
modStateFlags: 0,
baseLayout: 'us'
},
@ -127,7 +127,7 @@ describe("app/browser: hardware event processing", () => {
modifierSet: 0
}) as any as KeyboardEvent, {
// KMBM: Keyman Modifier BitMask
activeKeyboard: new Keyboard({KM: 0, KMBM: Codes.modifierBitmasks.CHIRAL}),
activeKeyboard: new JSKeyboard({KM: 0, KMBM: Codes.modifierBitmasks.CHIRAL}),
modStateFlags: 0,
baseLayout: 'us'
},
@ -147,7 +147,7 @@ describe("app/browser: hardware event processing", () => {
location: 1
}) as any as KeyboardEvent, {
// KMBM: Keyman Modifier BitMask
activeKeyboard: new Keyboard({KM: 0, KMBM: Codes.modifierBitmasks.CHIRAL}),
activeKeyboard: new JSKeyboard({KM: 0, KMBM: Codes.modifierBitmasks.CHIRAL}),
modStateFlags: 0,
baseLayout: 'us'
},
@ -167,7 +167,7 @@ describe("app/browser: hardware event processing", () => {
location: 1
}) as any as KeyboardEvent, {
// KMBM: Keyman Modifier BitMask
activeKeyboard: new Keyboard({KM: 0, KMBM: Codes.modifierBitmasks.CHIRAL}),
activeKeyboard: new JSKeyboard({KM: 0, KMBM: Codes.modifierBitmasks.CHIRAL}),
modStateFlags: ModifierCodes.LALT,
baseLayout: 'us'
},
@ -188,7 +188,7 @@ describe("app/browser: hardware event processing", () => {
modifierSet: PhysicalInputEventSpec.modifierCodes.Shift,
location: 1
}) as any as KeyboardEvent, {
activeKeyboard: new Keyboard({ KM: 1 }),
activeKeyboard: new JSKeyboard({ KM: 1 }),
modStateFlags: 0,
baseLayout: 'us'
},
@ -206,7 +206,7 @@ describe("app/browser: hardware event processing", () => {
keyCode: KeyCodes.K_A,
modifierSet: 0
}) as any as KeyboardEvent, {
activeKeyboard: new Keyboard({ KM: 1 }),
activeKeyboard: new JSKeyboard({ KM: 1 }),
modStateFlags: 0,
baseLayout: 'us'
},
@ -227,7 +227,7 @@ describe("app/browser: hardware event processing", () => {
modifierSet: PhysicalInputEventSpec.modifierCodes.Shift,
location: 1
}) as any as KeyboardEvent, {
activeKeyboard: new Keyboard({ KM: undefined }),
activeKeyboard: new JSKeyboard({ KM: undefined }),
modStateFlags: 0,
baseLayout: 'us'
},
@ -245,7 +245,7 @@ describe("app/browser: hardware event processing", () => {
keyCode: KeyCodes.K_A,
modifierSet: 0
}) as any as KeyboardEvent, {
activeKeyboard: new Keyboard({ KM: undefined }),
activeKeyboard: new JSKeyboard({ KM: undefined }),
modStateFlags: 0,
baseLayout: 'us'
},
@ -264,7 +264,7 @@ describe("app/browser: hardware event processing", () => {
modifierSet: PhysicalInputEventSpec.modifierCodes.Alt,
location: 0
}) as any as KeyboardEvent, {
activeKeyboard: new Keyboard({ KM: undefined }),
activeKeyboard: new JSKeyboard({ KM: undefined }),
// Internally assumes that the ALT-press event was previously handled, with this as
// the resulting modifier state at the time of key-press.
modStateFlags: ModifierCodes.LALT,
@ -298,7 +298,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM: 0}),
new JSKeyboard({KM: 0}),
'us'
);
@ -317,7 +317,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM: 0}),
new JSKeyboard({KM: 0}),
'us'
);
@ -336,7 +336,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM: 0}),
new JSKeyboard({KM: 0}),
'us'
);
@ -355,7 +355,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM: 0}),
new JSKeyboard({KM: 0}),
'us'
);
@ -376,7 +376,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
new JSKeyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
'us'
);
@ -395,7 +395,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
new JSKeyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
'us'
);
@ -414,7 +414,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
new JSKeyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
'us'
);
@ -433,7 +433,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
new JSKeyboard({KM:0, KMBM: Codes.modifierBitmasks.CHIRAL}),
'us'
);
@ -454,7 +454,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:1}),
new JSKeyboard({KM:1}),
'us'
);
@ -477,7 +477,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:1}),
new JSKeyboard({KM:1}),
'us'
);
@ -503,7 +503,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:undefined}),
new JSKeyboard({KM:undefined}),
'us'
);
@ -527,7 +527,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:undefined}),
new JSKeyboard({KM:undefined}),
'us'
);
@ -551,7 +551,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:undefined}),
new JSKeyboard({KM:undefined}),
'us'
);
@ -578,7 +578,7 @@ describe("app/browser: hardware event processing", () => {
const finalKeyEvent = processForMnemonicsAndLegacy(
baseKeyEvent,
new Keyboard({KM:undefined}),
new JSKeyboard({KM:undefined}),
'us'
);

View file

@ -46,7 +46,7 @@ describe('Bundled ES Module for js-processor', function() {
describe('Bundled ES Module for keyboard', function () {
describe('Keyboard', function () {
it('should initialize without errors', function () {
let kp = new Package2.Keyboard();
let kp = new Package2.JSKeyboard();
assert.isNotNull(kp);
});
});

View file

@ -1,6 +1,6 @@
import { assert } from 'chai';
import { Keyboard } from 'keyman/engine/keyboard';
import { JSKeyboard } from 'keyman/engine/keyboard';
import { KeyboardProcessor } from 'keyman/engine/js-processor';
import { extendString } from '@keymanapp/web-utils';
@ -24,7 +24,7 @@ describe('Engine - Stores', function() {
let processor = new KeyboardProcessor(device);
// A 'hollow' Keyboard that only follows default rules. That said, we need a Keyboard
// instance to host cache data for our exploded store tests.
processor.activeKeyboard = new Keyboard();
processor.activeKeyboard = new JSKeyboard();
// Function defined at top of file; creates supplementary pairs for extended Unicode codepoints.
var u = toSupplementaryPairString;

View file

@ -62,7 +62,7 @@ describe('StubAndKeyboardCache', function () {
assert.strictEqual(cache.defaultStub, galaxie_stub);
});
it('loads & caches `Keyboard`s, `Keyboard` promise pending resolution', async () => {
it('loads & caches `JSKeyboard`s, `JSKeyboard` promise pending resolution', async () => {
let keyboardLoader = new NodeKeyboardLoader(new KeyboardHarness({}, MinimalKeymanGlobal));
const cache = new StubAndKeyboardCache(keyboardLoader);