refactor(web): move some files around

- move `outputTarget.ts` → `js-processor`
- move `deadkeys.ts` → `js-processor`
- move `stringDivergence.ts` → `js-processor`
- split `Mock` into `mock.ts`
- create `keyboard/outputTarget.interface.ts`
This commit is contained in:
Eberhard Beilharz 2024-08-14 18:13:01 +02:00
parent 7459ab0bf8
commit 89abdbd64c
No known key found for this signature in database
GPG key ID: E9140597606020D3
43 changed files with 334 additions and 216 deletions

View file

@ -119,7 +119,7 @@ graph TD;
Device["/web/src/engine/device-detect"];
Device----->WebUtils;
Elements["/web/src/engine/element-wrappers"];
Elements-->KP;
Elements-->JSProc;
KeyboardCache["/web/src/engine/package-cache"];
KeyboardCache-->Interfaces;
DomUtils["/web/src/engine/dom-utils"];

View file

@ -1,8 +1,7 @@
import { EngineConfiguration, InitOptionSpec, InitOptionDefaults } from "keyman/engine/main";
import { OutputTarget as DOMOutputTarget } from 'keyman/engine/element-wrappers';
import { isEmptyTransform, OutputTarget } from 'keyman/engine/keyboard';
import { RuleBehavior } from 'keyman/engine/js-processor';
import { isEmptyTransform, OutputTarget, RuleBehavior } from 'keyman/engine/js-processor';
import { AlertHost } from "./utils/alertHost.js";
import { whenDocumentReady } from "./utils/documentReady.js";

View file

@ -2,9 +2,9 @@ import { ModifierKeyConstants } from '@keymanapp/common-types';
import {
Codes,
DefaultRules,
type KeyEvent,
type OutputTarget
type KeyEvent
} from 'keyman/engine/keyboard';
import { type OutputTarget } from 'keyman/engine/js-processor';
import ContextManager from './contextManager.js';

View file

@ -1,4 +1,5 @@
import { type Keyboard, Mock, OutputTarget, Transcription, findCommonSubstringEndIndex, isEmptyTransform, TextTransform } from 'keyman/engine/keyboard';
import { type Keyboard } from 'keyman/engine/keyboard';
import { Mock, OutputTarget, Transcription, findCommonSubstringEndIndex, isEmptyTransform, TextTransform } from 'keyman/engine/js-processor';
import { KeyboardStub } from 'keyman/engine/package-cache';
import { ContextManagerBase } from 'keyman/engine/main';
import { WebviewConfiguration } from './configuration.js';

View file

@ -13,7 +13,7 @@ SUBPROJECT_NAME=engine/element-wrappers
# ################################ Main script ################################
builder_describe "Builds DOM-based OutputTarget subclasses used by the Keyman Engine for Web (KMW)." \
"@/web/src/engine/keyboard" \
"@/web/src/engine/js-processor" \
"clean" \
"configure" \
"build" \

View file

@ -1,4 +1,4 @@
import { OutputTarget as OutputTargetBase } from "keyman/engine/keyboard";
import { OutputTarget as OutputTargetBase } from "keyman/engine/js-processor";
import { EventEmitter } from 'eventemitter3';
export default abstract class OutputTarget<EventMap extends EventEmitter.ValidEventTypes> extends OutputTargetBase {

View file

@ -1,7 +1,7 @@
///<reference types="@keymanapp/models-types" />
import { EventEmitter } from "eventemitter3";
import { OutputTarget } from "keyman/engine/keyboard";
import { OutputTarget } from "keyman/engine/js-processor";
export class ReadySuggestions {
suggestions: Suggestion[];

View file

@ -1,7 +1,6 @@
import { EventEmitter } from "eventemitter3";
import { type LanguageProcessorSpec , ReadySuggestions, type InvalidateSourceEnum, StateChangeHandler } from './languageProcessor.interface.js';
import { type OutputTarget } from "keyman/engine/keyboard";
import { type KeyboardProcessor } from 'keyman/engine/js-processor';
import { type KeyboardProcessor, type OutputTarget } from 'keyman/engine/js-processor';
interface PredictionContextEventMap {
update: (suggestions: Suggestion[]) => void;

View file

@ -4,3 +4,8 @@ export { default as RuleBehavior } from "./ruleBehavior.js";
export * from './kbdInterface.js';
export { default as KeyboardInterface } from "./kbdInterface.js";
export * from "./systemStores.js";
export * from "./deadkeys.js";
export { default as OutputTarget } from "./outputTarget.js";
export * from "./outputTarget.js";
export { Mock } from "./mock.js";
export * from "./stringDivergence.js";

View file

@ -7,7 +7,10 @@
import { type DeviceSpec } from "@keymanapp/web-utils";
import { ModifierKeyConstants } from '@keymanapp/common-types';
import { Codes, type KeyEvent, type Deadkey, KeyMapping, type OutputTarget, Mock, Keyboard, KeyboardHarness, KeyboardKeymanGlobal, VariableStoreDictionary } from "keyman/engine/keyboard";
import { Codes, type KeyEvent, KeyMapping, Keyboard, KeyboardHarness, KeyboardKeymanGlobal, VariableStoreDictionary } from "keyman/engine/keyboard";
import type OutputTarget from './outputTarget.js';
import { type Deadkey } from './deadkeys.js';
import { Mock } from "./mock.js";
import RuleBehavior from "./ruleBehavior.js";
import { ComplexKeyboardStore, type KeyboardStore, KeyboardStoreElement, SystemStoreIDs, SystemStore, MutableSystemStore, PlatformSystemStore, VariableStore, VariableStoreSerializer } from "./systemStores.js";

View file

@ -10,8 +10,10 @@ import { EventEmitter } from 'eventemitter3';
import { ModifierKeyConstants } from '@keymanapp/common-types';
import {
Codes, type Keyboard, MinimalKeymanGlobal, KeyEvent, Layouts,
type OutputTarget, Mock, DefaultRules, EmulationKeystrokes
DefaultRules, EmulationKeystrokes
} from "keyman/engine/keyboard";
import { Mock } from "./mock.js";
import type OutputTarget from "./outputTarget.js";
import RuleBehavior from "./ruleBehavior.js";
import KeyboardInterface from './kbdInterface.js';
import { DeviceSpec, globalObject } from "@keymanapp/web-utils";

View file

@ -0,0 +1,157 @@
import OutputTarget from './outputTarget.js';
// Due to some interesting requirements on compile ordering in TS,
// this needs to be in the same file as OutputTarget now.
export class Mock extends OutputTarget {
text: string;
selStart: number;
selEnd: number;
selForward: boolean = true;
constructor(text?: string, caretPos?: number);
constructor(text?: string, selStart?: number, selEnd?: number);
constructor(text?: string, selStart?: number, selEnd?: number) {
super();
this.text = text ? text : "";
var defaultLength = this.text._kmwLength();
// Ensures that `caretPos == 0` is handled correctly.
this.selStart = typeof selStart == "number" ? selStart : defaultLength;
// If no selection-end is set, selection length is implied to be 0.
this.selEnd = typeof selEnd == "number" ? selEnd : this.selStart;
this.selForward = this.selEnd >= this.selStart;
}
// Clones the state of an existing EditableElement, creating a Mock version of its state.
static from(outputTarget: OutputTarget, readonly?: boolean) {
let clone: Mock;
if (outputTarget instanceof Mock) {
// Avoids the need to run expensive kmwstring.ts / `_kmwLength()`
// calculations when deep-copying Mock instances.
let priorMock = outputTarget as Mock;
clone = new Mock(priorMock.text, priorMock.selStart, priorMock.selEnd);
} else {
const text = outputTarget.getText();
const textLen = text._kmwLength();
// If !hasSelection()
let selectionStart: number = textLen;
let selectionEnd: number = 0;
if (outputTarget.hasSelection()) {
let beforeText = outputTarget.getTextBeforeCaret();
let afterText = outputTarget.getTextAfterCaret();
selectionStart = beforeText._kmwLength();
selectionEnd = textLen - afterText._kmwLength();
}
// readonly group or not, the returned Mock remains the same.
// New-context events should act as if the caret were at the earlier-in-context
// side of the selection, same as standard keyboard rules.
clone = new Mock(text, selectionStart, selectionEnd);
}
// Also duplicate deadkey state! (Needed for fat-finger ops.)
clone.setDeadkeys(outputTarget.deadkeys());
return clone;
}
clearSelection(): void {
this.text = this.getTextBeforeCaret() + this.getTextAfterCaret();
this.selEnd = this.selStart;
this.selForward = true;
}
invalidateSelection(): void {
return;
}
isSelectionEmpty(): boolean {
return this.selStart == this.selEnd;
}
hasSelection(): boolean {
return true;
}
getDeadkeyCaret(): number {
return this.selStart;
}
setSelection(start: number, end?: number) {
this.selStart = start;
this.selEnd = typeof end == 'number' ? end : start;
this.selForward = end >= start;
if (!this.selForward) {
let temp = this.selStart;
this.selStart = this.selEnd;
this.selEnd = temp;
}
}
getTextBeforeCaret(): string {
return this.text.kmwSubstr(0, this.selStart);
}
getSelectedText(): string {
return this.text.kmwSubstr(this.selStart, this.selEnd - this.selStart);
}
getTextAfterCaret(): string {
return this.text.kmwSubstr(this.selEnd);
}
getText(): string {
return this.text;
}
deleteCharsBeforeCaret(dn: number): void {
if (dn >= 0) {
if (dn > this.selStart) {
dn = this.selStart;
}
this.adjustDeadkeys(-dn);
this.text = this.text.kmwSubstr(0, this.selStart - dn) + this.text.kmwSubstr(this.selStart);
this.selStart -= dn;
this.selEnd -= dn;
}
}
insertTextBeforeCaret(s: string): void {
this.adjustDeadkeys(s._kmwLength());
this.text = this.getTextBeforeCaret() + s + this.text.kmwSubstr(this.selStart);
this.selStart += s.kmwLength();
this.selEnd += s.kmwLength();
}
handleNewlineAtCaret(): void {
this.insertTextBeforeCaret('\n');
}
protected setTextAfterCaret(s: string): void {
this.text = this.getTextBeforeCaret() + s;
}
/**
* Indicates if this Mock represents an identical context to that of another Mock.
* @param other
* @returns
*/
isEqual(other: Mock) {
return this.text == other.text
&& this.selStart == other.selStart
&& this.selEnd == other.selEnd
&& this.deadkeys().equal(other.deadkeys());
}
doInputEvent() {
// Mock isn't backed by an element, so it won't have any event listeners.
}
}

View file

@ -2,11 +2,12 @@
import { extendString } from "@keymanapp/web-utils";
import { findCommonSubstringEndIndex } from "./stringDivergence.js";
import { Mock } from "./mock.js";
extendString();
// Defines deadkey management in a manner attachable to each element interface.
import type KeyEvent from "./keyEvent.js";
import { type KeyEvent } from 'keyman/engine/keyboard';
import { Deadkey, DeadkeyTracker } from "./deadkeys.js";
// Also relies on string-extensions provided by the web-utils package.
@ -307,159 +308,3 @@ export default abstract class OutputTarget {
*/
abstract doInputEvent(): void;
}
// Due to some interesting requirements on compile ordering in TS,
// this needs to be in the same file as OutputTarget now.
export class Mock extends OutputTarget {
text: string;
selStart: number;
selEnd: number;
selForward: boolean = true;
constructor(text?: string, caretPos?: number);
constructor(text?: string, selStart?: number, selEnd?: number);
constructor(text?: string, selStart?: number, selEnd?: number) {
super();
this.text = text ? text : "";
var defaultLength = this.text._kmwLength();
// Ensures that `caretPos == 0` is handled correctly.
this.selStart = typeof selStart == "number" ? selStart : defaultLength;
// If no selection-end is set, selection length is implied to be 0.
this.selEnd = typeof selEnd == "number" ? selEnd : this.selStart;
this.selForward = this.selEnd >= this.selStart;
}
// Clones the state of an existing EditableElement, creating a Mock version of its state.
static from(outputTarget: OutputTarget, readonly?: boolean) {
let clone: Mock;
if(outputTarget instanceof Mock) {
// Avoids the need to run expensive kmwstring.ts / `_kmwLength()`
// calculations when deep-copying Mock instances.
let priorMock = outputTarget as Mock;
clone = new Mock(priorMock.text, priorMock.selStart, priorMock.selEnd);
} else {
const text = outputTarget.getText();
const textLen = text._kmwLength();
// If !hasSelection()
let selectionStart: number = textLen;
let selectionEnd: number = 0;
if(outputTarget.hasSelection()) {
let beforeText = outputTarget.getTextBeforeCaret();
let afterText = outputTarget.getTextAfterCaret();
selectionStart = beforeText._kmwLength();
selectionEnd = textLen - afterText._kmwLength();
}
// readonly group or not, the returned Mock remains the same.
// New-context events should act as if the caret were at the earlier-in-context
// side of the selection, same as standard keyboard rules.
clone = new Mock(text, selectionStart, selectionEnd);
}
// Also duplicate deadkey state! (Needed for fat-finger ops.)
clone.setDeadkeys(outputTarget.deadkeys());
return clone;
}
clearSelection(): void {
this.text = this.getTextBeforeCaret() + this.getTextAfterCaret();
this.selEnd = this.selStart;
this.selForward = true;
}
invalidateSelection(): void {
return;
}
isSelectionEmpty(): boolean {
return this.selStart == this.selEnd;
}
hasSelection(): boolean {
return true;
}
getDeadkeyCaret(): number {
return this.selStart;
}
setSelection(start: number, end?: number) {
this.selStart = start;
this.selEnd = typeof end == 'number' ? end : start;
this.selForward = end >= start;
if(!this.selForward) {
let temp = this.selStart;
this.selStart = this.selEnd;
this.selEnd = temp;
}
}
getTextBeforeCaret(): string {
return this.text.kmwSubstr(0, this.selStart);
}
getSelectedText(): string {
return this.text.kmwSubstr(this.selStart, this.selEnd - this.selStart);
}
getTextAfterCaret(): string {
return this.text.kmwSubstr(this.selEnd);
}
getText(): string {
return this.text;
}
deleteCharsBeforeCaret(dn: number): void {
if(dn >= 0) {
if(dn > this.selStart) {
dn = this.selStart;
}
this.adjustDeadkeys(-dn);
this.text = this.text.kmwSubstr(0, this.selStart - dn) + this.text.kmwSubstr(this.selStart);
this.selStart -= dn;
this.selEnd -= dn;
}
}
insertTextBeforeCaret(s: string): void {
this.adjustDeadkeys(s._kmwLength());
this.text = this.getTextBeforeCaret() + s + this.text.kmwSubstr(this.selStart);
this.selStart += s.kmwLength();
this.selEnd += s.kmwLength();
}
handleNewlineAtCaret(): void {
this.insertTextBeforeCaret('\n');
}
protected setTextAfterCaret(s: string): void {
this.text = this.getTextBeforeCaret() + s;
}
/**
* Indicates if this Mock represents an identical context to that of another Mock.
* @param other
* @returns
*/
isEqual(other: Mock) {
return this.text == other.text
&& this.selStart == other.selStart
&& this.selEnd == other.selEnd
&& this.deadkeys().equal(other.deadkeys());
}
doInputEvent() {
// Mock isn't backed by an element, so it won't have any event listeners.
}
}

View file

@ -1,7 +1,9 @@
///<reference types="@keymanapp/models-types" />
import KeyboardProcessor from "./keyboardProcessor.js";
import { OutputTarget, Mock, type Transcription, VariableStoreDictionary } from "keyman/engine/keyboard";
import { VariableStoreDictionary } from "keyman/engine/keyboard";
import OutputTarget, { type Transcription } from './outputTarget.js';
import { Mock } from "./mock.js";
import { type VariableStore } from "./systemStores.js";
/**

View file

@ -7,7 +7,7 @@
import { ModifierKeyConstants } from '@keymanapp/common-types';
import Codes from './codes.js';
import type KeyEvent from './keyEvent.js';
import type OutputTarget from './outputTarget.js';
import { type OutputTarget } from './outputTarget.interface.js';
export enum EmulationKeystrokes {
Enter = '\n',

View file

@ -26,15 +26,11 @@ export { default as StateKeyMap } from "./keyboards/stateKeyMap.js";
export { default as Codes } from "./codes.js";
export * from "./codes.js";
export * from "./deadkeys.js";
export { default as DefaultRules } from "./defaultRules.js";
export * from "./defaultRules.js";
export { default as KeyEvent } from "./keyEvent.js";
export * from "./keyEvent.js";
export { default as KeyMapping } from "./keyMapping.js";
export { default as OutputTarget } from "./outputTarget.js";
export * from "./outputTarget.js";
export * from "./stringDivergence.js";
export * from "@keymanapp/web-utils";

View file

@ -2,7 +2,7 @@ import Codes from "../codes.js";
import { EncodedVisualKeyboard, LayoutSpec, Layouts } from "./defaultLayouts.js";
import { ActiveKey, ActiveLayout, ActiveSubKey } from "./activeLayout.js";
import KeyEvent from "../keyEvent.js";
import type OutputTarget from "../outputTarget.js";
import { type OutputTarget } from "../outputTarget.interface.js";
import { ModifierKeyConstants, TouchLayout } from "@keymanapp/common-types";
type TouchLayoutSpec = TouchLayout.TouchLayoutPlatform & { isDefault?: boolean};

View file

@ -0,0 +1,104 @@
export interface OutputTarget {
/**
* Signifies that this OutputTarget has no default key processing behaviors. This should be false
* for OutputTargets backed by web elements like HTMLInputElement or HTMLTextAreaElement.
*/
get isSynthetic(): boolean;
resetContext(): void;
hasDeadkeyMatch(n: number, d: number): boolean;
insertDeadkeyBeforeCaret(d: number): void;
/**
* Clears any selected text within the wrapper's element(s).
* Silently does nothing if no such text exists.
*/
clearSelection(): void;
/**
* Clears any cached selection-related state values.
*/
invalidateSelection(): void;
/**
* Indicates whether or not the underlying element has its own selection (input, textarea)
* or is part of (or possesses) the DOM's active selection. Don't confuse with isSelectionEmpty().
*
* TODO: rename to supportsOwnSelection
*/
hasSelection(): boolean;
/**
* Returns true if there is no current selection -- that is, the selection range is empty
*/
isSelectionEmpty(): boolean;
/**
* Returns an index corresponding to the caret's position for use with deadkeys.
*/
getDeadkeyCaret(): number;
/**
* Relative to the caret, gets the current context within the wrapper's element.
*/
getTextBeforeCaret(): string;
/**
* Gets the element's-currently selected text.
*/
getSelectedText(): string;
/**
* Relative to the caret (and/or active selection), gets the element's text after the caret,
* excluding any actively selected text that would be immediately replaced upon text entry.
*/
getTextAfterCaret(): string;
/**
* Gets the element's full text, including any text that is actively selected.
*/
getText(): string;
/**
* Performs context deletions (from the left of the caret) as needed by the KeymanWeb engine and
* corrects the location of any affected deadkeys.
*
* Does not delete deadkeys (b/c KMW 1 & 2 behavior maintenance).
* @param dn The number of characters to delete. If negative, context will be left unchanged.
*/
deleteCharsBeforeCaret(dn: number): void;
/**
* Inserts text immediately before the caret's current position, moving the caret after the
* newly inserted text in the process along with any affected deadkeys.
*
* @param s Text to insert before the caret's current position.
*/
insertTextBeforeCaret(s: string): void;
/**
* Allows element-specific handling for ENTER key inputs. Conceptually, this should usually
* correspond to `insertTextBeforeCaret('\n'), but actual implementation will vary greatly among
* elements.
*/
handleNewlineAtCaret(): void;
/**
* Saves element-specific state properties prone to mutation, enabling restoration after
* text-output operations.
*/
saveProperties(): void;
/**
* Restores previously-saved element-specific state properties. Designed for use after text-output
* ops to facilitate more-seamless web-dev and user interactions.
*/
restoreProperties(): void;
/**
* Generates a synthetic event on the underlying element, signalling that its value has changed.
*/
doInputEvent(): void;
}

View file

@ -1,6 +1,6 @@
import { EventEmitter } from 'eventemitter3';
import { ManagedPromise, type Keyboard, type OutputTarget } from 'keyman/engine/keyboard';
import { type KeyboardInterface } from 'keyman/engine/js-processor';
import { ManagedPromise, type Keyboard } from 'keyman/engine/keyboard';
import { type KeyboardInterface, type OutputTarget } from 'keyman/engine/js-processor';
import { StubAndKeyboardCache, type KeyboardStub } from 'keyman/engine/package-cache';
import { PredictionContext } from 'keyman/engine/interfaces';
import { EngineConfiguration } from './engineConfiguration.js';

View file

@ -1,7 +1,7 @@
import { EventEmitter } from "eventemitter3";
import { DeviceSpec, KeyboardProperties, ManagedPromise, OutputTarget, physicalKeyDeviceAlias, SpacebarText } from "keyman/engine/keyboard";
import { RuleBehavior } from 'keyman/engine/js-processor';
import { DeviceSpec, KeyboardProperties, ManagedPromise, physicalKeyDeviceAlias, SpacebarText } from "keyman/engine/keyboard";
import { OutputTarget, RuleBehavior } from 'keyman/engine/js-processor';
import { PathConfiguration, PathOptionDefaults, PathOptionSpec } from "keyman/engine/interfaces";
import { Device } from "keyman/engine/device-detect";
import { KeyboardStub } from "keyman/engine/package-cache";

View file

@ -1,4 +1,4 @@
import { Mock } from "keyman/engine/keyboard";
import { Mock } from "keyman/engine/js-processor";
export default class ContextWindow implements Context {
// Used to limit the range of context replicated for use of keyboard rules within

View file

@ -7,16 +7,18 @@ import { LanguageProcessor } from "./languageProcessor.js";
import type { ModelSpec } from "keyman/engine/interfaces";
import { globalObject, DeviceSpec } from "@keymanapp/web-utils";
import { Codes, type Keyboard, type KeyEvent } from "keyman/engine/keyboard";
import {
type Alternate,
Codes,
isEmptyTransform,
type Keyboard,
type KeyEvent,
KeyboardInterface,
KeyboardProcessor,
Mock,
type OutputTarget,
} from "keyman/engine/keyboard";
import { KeyboardInterface, KeyboardProcessor, RuleBehavior, type ProcessorInitOptions, SystemStoreIDs } from 'keyman/engine/js-processor';
RuleBehavior,
type ProcessorInitOptions,
SystemStoreIDs
} from 'keyman/engine/js-processor';
import { TranscriptionCache } from "./transcriptionCache.js";

View file

@ -1,6 +1,6 @@
import { EventEmitter } from "eventemitter3";
import { LMLayer } from "@keymanapp/lexical-model-layer/web";
import { OutputTarget, Transcription, Mock } from "keyman/engine/keyboard";
import { OutputTarget, Transcription, Mock } from "keyman/engine/js-processor";
import { LanguageProcessorEventMap, ModelSpec, StateChangeEnum, ReadySuggestions } from 'keyman/engine/interfaces';
import ContextWindow from "./contextWindow.js";
import { TranscriptionCache } from "./transcriptionCache.js";

View file

@ -1,4 +1,4 @@
import { Transcription } from "keyman/engine/keyboard";
import { Transcription } from "keyman/engine/js-processor";
const TRANSCRIPTION_BUFFER_SIZE = 10;

View file

@ -13,9 +13,9 @@ import {
StateKeyMap,
ActiveSubKey,
timedPromise,
ActiveKeyBase,
isEmptyTransform
ActiveKeyBase
} from 'keyman/engine/keyboard';
import { isEmptyTransform } from 'keyman/engine/js-processor';
import { buildCorrectiveLayout } from './correctionLayout.js';
import { distributionFromDistanceMaps, keyTouchDistances } from './corrections.js';

View file

@ -1,6 +1,7 @@
import { assert } from 'chai';
import { extendString, Mock } from 'keyman/engine/keyboard';
import { extendString } from 'keyman/engine/keyboard';
import { Mock } from 'keyman/engine/js-processor';
import * as wrappers from 'keyman/engine/element-wrappers';
import { DynamicElements } from '../../test_utils.js';

View file

@ -1,6 +1,7 @@
import { assert } from 'chai';
import { extendString, Mock } from 'keyman/engine/keyboard';
import { extendString } from 'keyman/engine/keyboard';
import { Mock } from 'keyman/engine/js-processor';
import { Input } from 'keyman/engine/element-wrappers';
import { DEFAULT_BROWSER_TIMEOUT } from '@keymanapp/common-test-resources/test-timeouts.mjs';

View file

@ -1,8 +1,8 @@
import { assert } from 'chai';
import { DOMKeyboardLoader } from 'keyman/engine/keyboard/dom-keyboard-loader';
import { extendString, KeyboardHarness, Keyboard, MinimalKeymanGlobal, Mock, DeviceSpec, KeyboardKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardInterface } from 'keyman/engine/js-processor';
import { extendString, KeyboardHarness, Keyboard, MinimalKeymanGlobal, DeviceSpec, KeyboardKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardInterface, Mock } from 'keyman/engine/js-processor';
declare let window: typeof globalThis;
// KeymanEngine from the web/ folder... when available.

View file

@ -4,8 +4,8 @@ import sinon from 'sinon';
import { LanguageProcessor, TranscriptionCache } from 'keyman/engine/main';
import { PredictionContext } from 'keyman/engine/interfaces';
import { Worker as LMWorker } from "@keymanapp/lexical-model-layer/node";
import { DeviceSpec, Mock } from 'keyman/engine/keyboard';
import { KeyboardProcessor } from 'keyman/engine/js-processor';
import { DeviceSpec } from 'keyman/engine/keyboard';
import { KeyboardProcessor, Mock } from 'keyman/engine/js-processor';
function compileDummyModel(suggestionSets) {
return `

View file

@ -3,8 +3,8 @@ import { assert } from 'chai';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { MinimalKeymanGlobal, Mock } from 'keyman/engine/keyboard';
import { KeyboardInterface, KeyboardProcessor } from 'keyman/engine/js-processor';
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardInterface, KeyboardProcessor, Mock } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader } from 'keyman/engine/keyboard/node-keyboard-loader';
import { NodeProctor, RecordedKeystrokeSequence } from '@keymanapp/recorder-core';

View file

@ -3,8 +3,8 @@ import { assert } from 'chai';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { MinimalKeymanGlobal, Mock } from 'keyman/engine/keyboard';
import { KeyboardInterface } from 'keyman/engine/js-processor';
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardInterface, Mock } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader } from 'keyman/engine/keyboard/node-keyboard-loader';
import { NodeProctor, RecordedKeystrokeSequence } from '@keymanapp/recorder-core';
import { extendString } from '@keymanapp/web-utils';

View file

@ -3,8 +3,8 @@ import { assert } from 'chai';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { MinimalKeymanGlobal, Mock } from 'keyman/engine/keyboard';
import { KeyboardInterface } from 'keyman/engine/js-processor';
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardInterface, Mock } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader } from 'keyman/engine/keyboard/node-keyboard-loader';
describe('Headless keyboard loading', function () {

View file

@ -1,5 +1,5 @@
import { assert } from 'chai';
import { Mock } from 'keyman/engine/keyboard';
import { Mock } from 'keyman/engine/js-processor';
describe('Mocks', function() {
describe('app|les', () => {

View file

@ -4,8 +4,8 @@ import { ModifierKeyConstants } from '@keymanapp/common-types';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { Codes, KeyEvent, MinimalKeymanGlobal, Mock } from 'keyman/engine/keyboard';
import { KeyboardInterface } from 'keyman/engine/js-processor';
import { Codes, KeyEvent, MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardInterface, Mock } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader } from 'keyman/engine/keyboard/node-keyboard-loader';
// Compare and contrast the unit tests here with those for app/browser key-event unit testing

View file

@ -4,8 +4,8 @@ import fs from 'fs';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { Codes, KeyEvent, MinimalKeymanGlobal, Mock } from 'keyman/engine/keyboard';
import { KeyboardInterface, KeyboardProcessor } from 'keyman/engine/js-processor';
import { Codes, KeyEvent, MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardInterface, KeyboardProcessor, Mock } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader } from 'keyman/engine/keyboard/node-keyboard-loader';
import { ModifierKeyConstants } from '@keymanapp/common-types';

View file

@ -1,6 +1,6 @@
import { assert } from 'chai';
import { Mock, findCommonSubstringEndIndex } from 'keyman/engine/keyboard';
import { Mock, findCommonSubstringEndIndex } from 'keyman/engine/js-processor';
import { extendString } from '@keymanapp/web-utils';
extendString(); // Ensure KMW's string-extension functionality is available.

View file

@ -3,8 +3,8 @@ import { assert } from 'chai';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { KeyboardHarness, MinimalKeymanGlobal, Mock } from 'keyman/engine/keyboard';
import { KeyboardInterface } from 'keyman/engine/js-processor';
import { KeyboardHarness, MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardInterface, Mock } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader } from 'keyman/engine/keyboard/node-keyboard-loader';
describe('Headless keyboard loading', function() {

View file

@ -1,5 +1,5 @@
import { type OutputTarget } from "keyman/engine/keyboard";
import { KeyDistribution, KeyEvent, Mock } from "keyman/engine/keyboard";
import { Mock, type OutputTarget } from "keyman/engine/js-processor";
import { KeyDistribution, KeyEvent } from "keyman/engine/keyboard";
import Proctor from "./proctor.js";

View file

@ -8,7 +8,8 @@ import {
RecordedSyntheticKeystroke
} from "./index.js";
import { KeyEvent, KeyEventSpec, Mock, type OutputTarget, KeyboardHarness } from "keyman/engine/keyboard";
import { KeyEvent, KeyEventSpec, KeyboardHarness } from "keyman/engine/keyboard";
import { Mock, type OutputTarget } from "keyman/engine/js-processor";
import { DeviceSpec } from "@keymanapp/web-utils";
import { KeyboardInterface, KeyboardProcessor } from 'keyman/engine/js-processor';

View file

@ -1,5 +1,5 @@
import { type DeviceSpec } from "@keymanapp/web-utils";
import { type OutputTarget } from "keyman/engine/keyboard";
import { type OutputTarget } from "keyman/engine/js-processor";
import type { KeyboardTest, TestSet, TestSequence } from "./index.js";

View file

@ -4,7 +4,7 @@
import { type DeviceSpec } from "@keymanapp/web-utils";
import { type OutputTarget } from "keyman/engine/keyboard";
import { type OutputTarget } from "keyman/engine/js-processor";
import { type KeymanEngine } from 'keyman/app/browser';