Merge pull request #13942 from keymanapp/refactor/web/cherry-pick/kmengine

Cherry-pick-of: #13404
This commit is contained in:
Eberhard Beilharz 2025-05-15 18:19:52 +02:00 • committed by GitHub
commit a5a97f0a22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 22 additions and 22 deletions

View file

@ -1,6 +1,6 @@
import { DomEventTracker } from 'keyman/engine/events';
import KeymanEngine from "../keymanEngine.js";
import { KeymanEngine } from "../keymanEngine.js";
import { FocusAssistant } from './focusAssistant.js';
import { RotationProcessor } from '../utils/rotationProcessor.js';

View file

@ -1,4 +1,4 @@
import KeymanEngine from './keymanEngine.js'
import { KeymanEngine } from './keymanEngine.js'
import { SourcemappedWorker } from '@keymanapp/lexical-model-layer/web'
/**

View file

@ -3,7 +3,7 @@ import { FloatingOSKView } from 'keyman/engine/osk';
import { KeyboardInterface as KeyboardInterfaceBase } from 'keyman/engine/main';
import ContextManager from './contextManager.js';
import KeymanEngine from './keymanEngine.js';
import { KeymanEngine } from './keymanEngine.js';
export default class KeyboardInterface extends KeyboardInterfaceBase<ContextManager> {
constructor(

View file

@ -1,5 +1,5 @@
import { KeymanWebKeyboard } from '@keymanapp/common-types';
import { KeymanEngine as KeymanEngineBase, DeviceDetector } from 'keyman/engine/main';
import { KeymanEngineBase, DeviceDetector } from 'keyman/engine/main';
import { getAbsoluteY } from 'keyman/engine/dom-utils';
import { OutputTarget } from 'keyman/engine/element-wrappers';
import {
@ -29,7 +29,7 @@ import { BeepHandler } from './beepHandler.js';
import KeyboardInterface from './keyboardInterface.js';
import { WorkerFactory } from '@keymanapp/lexical-model-layer/web';
export default class KeymanEngine extends KeymanEngineBase<BrowserConfiguration, ContextManager, HardwareEventKeyboard> {
export class KeymanEngine extends KeymanEngineBase<BrowserConfiguration, ContextManager, HardwareEventKeyboard> {
touchLanguageMenu?: LanguageMenu;
private pageIntegration: PageIntegrationHandlers;

View file

@ -2,7 +2,7 @@
import { getAbsoluteX, landscapeView } from "keyman/engine/dom-utils";
import { KeyboardStub } from "keyman/engine/keyboard-storage";
import KeymanEngine from "./keymanEngine.js";
import { KeymanEngine } from "./keymanEngine.js";
import * as util from "./utils/index.js";
interface KeyboardTag {

View file

@ -1,7 +1,7 @@
import { OSKView } from "keyman/engine/osk";
import { KEYMAN_VERSION } from "@keymanapp/keyman-version";
import ContextManager from "./contextManager.js";
import KeymanEngine from "./keymanEngine.js";
import { KeymanEngine } from "./keymanEngine.js";
import { LanguageMenu } from "./languageMenu.js";
export function setupOskListeners(engine: KeymanEngine, osk: OSKView, contextManager: ContextManager) {

View file

@ -1,4 +1,4 @@
import KeymanEngine from './keymanEngine.js'
import { KeymanEngine } from './keymanEngine.js'
import { Worker } from '@keymanapp/lexical-model-layer/web'
/**

View file

@ -2,6 +2,6 @@ export { BrowserConfiguration, BrowserInitOptionSpec } from './configuration.js'
export { default as ContextManager, KeyboardCookie } from "./contextManager.js";
export { preprocessKeyboardEvent, default as HardwareEventKeyboard } from './hardwareEventKeyboard.js';
export { default as KeymanEngine } from './keymanEngine.js';
export { KeymanEngine } from './keymanEngine.js';
export { default as KeyboardInterface } from './keyboardInterface.js';
export { UIModule } from './uiModuleInterface.js';

View file

@ -1,4 +1,4 @@
import KeymanEngine from "../keymanEngine.js";
import { KeymanEngine } from "../keymanEngine.js";
class RotationState {
innerWidth: number;

View file

@ -5,7 +5,7 @@ import {
FloatingOSKViewConfiguration,
InlinedOSKView
} from "keyman/engine/osk";
import KeymanEngine from "./keymanEngine.js";
import { KeymanEngine } from "./keymanEngine.js";
function buildBaseOskConfiguration(engine: KeymanEngine) {
return {

View file

@ -1,4 +1,4 @@
import KeymanEngine from './keymanEngine.js'
import { KeymanEngine } from './keymanEngine.js'
import { SourcemappedWorker } from '@keymanapp/lexical-model-layer/web'
/**

View file

@ -1,6 +1,6 @@
import { DeviceSpec, DefaultRules } from 'keyman/engine/keyboard';
import { RuleBehavior } from 'keyman/engine/js-processor';
import { KeymanEngine as KeymanEngineBase, KeyboardInterface } from 'keyman/engine/main';
import { KeymanEngineBase, KeyboardInterface } from 'keyman/engine/main';
import { AnchoredOSKView, ViewConfiguration, StaticActivator } from 'keyman/engine/osk';
import { getAbsoluteX, getAbsoluteY } from 'keyman/engine/dom-utils';
import { toPrefixedKeyboardId, toUnprefixedKeyboardId } from 'keyman/engine/keyboard-storage';
@ -11,7 +11,7 @@ import PassthroughKeyboard from './passthroughKeyboard.js';
import { buildEmbeddedGestureConfig, setupEmbeddedListeners } from './oskConfiguration.js';
import { WorkerFactory } from '@keymanapp/lexical-model-layer';
export default class KeymanEngine extends KeymanEngineBase<WebviewConfiguration, ContextManager, PassthroughKeyboard> {
export class KeymanEngine extends KeymanEngineBase<WebviewConfiguration, ContextManager, PassthroughKeyboard> {
// Ideally, we would be able to auto-detect `sourceUri`: https://stackoverflow.com/a/60244278.
// But it's too new of a feature to utilize... and also expects to be in a module, when this may
// be compiled down to an IIFE.

View file

@ -3,7 +3,7 @@ import { DeviceSpec } from "keyman/engine/keyboard";
import { type EmbeddedGestureConfig } from "keyman/engine/osk";
import { GlobeHint } from './osk/globeHint.js';
import type KeymanEngine from "./keymanEngine.js";
import { type KeymanEngine } from "./keymanEngine.js";
export function setupEmbeddedListeners(engine: KeymanEngine, osk: OSKView) {
osk.on('globekey', (key, on) => {

View file

@ -1,4 +1,4 @@
import KeymanEngine from './keymanEngine.js'
import { KeymanEngine } from './keymanEngine.js'
import { Worker } from '@keymanapp/lexical-model-layer/web'
/**

View file

@ -2,7 +2,7 @@ export { EngineConfiguration, InitOptionDefaults, InitOptionSpec } from './engin
export { ContextManagerBase, ContextManagerConfiguration } from './contextManagerBase.js';
export { HardKeyboardBase, processForMnemonicsAndLegacy } from './hardKeyboardBase.js';
export { default as KeyboardInterface } from './keyboardInterface.js';
export { default as KeymanEngine } from './keymanEngine.js';
export { KeymanEngineBase } from './keymanEngineBase.js';
export { LegacyAPIEvents } from './legacyAPIEvents.js';
export { VariableStoreCookieSerializer } from './variableStoreCookieSerializer.js';
export { LanguageProcessor } from './headless/languageProcessor.js';

View file

@ -6,16 +6,16 @@ import KeyboardObject = KeymanWebKeyboard.KeyboardObject;
import { ContextManagerBase } from './contextManagerBase.js';
import { VariableStoreCookieSerializer } from "./variableStoreCookieSerializer.js";
import KeymanEngine from "./keymanEngine.js";
import { KeymanEngineBase } from "./keymanEngineBase.js";
import { EngineConfiguration } from "./engineConfiguration.js";
export default class KeyboardInterface<ContextManagerType extends ContextManagerBase<any>> extends KeyboardInterfaceBase {
protected readonly engine: KeymanEngine<EngineConfiguration, ContextManagerType, any>;
protected readonly engine: KeymanEngineBase<EngineConfiguration, ContextManagerType, any>;
private stubNamespacer?: (stub: RawKeyboardStub) => void;
constructor(
_jsGlobal: any,
engine: KeymanEngine<any, ContextManagerType, any>,
engine: KeymanEngineBase<any, ContextManagerType, any>,
stubNamespacer?: (stub: RawKeyboardStub) => void
) {
super(_jsGlobal, engine, new VariableStoreCookieSerializer());

View file

@ -35,7 +35,7 @@ function determineBaseLayout(): string {
export type KeyEventFullResultCallback = (result: RuleBehavior, error?: Error) => void;
export type KeyEventFullHandler = (event: KeyEvent, callback?: KeyEventFullResultCallback) => void;
export default class KeymanEngine<
export class KeymanEngineBase<
Configuration extends EngineConfiguration,
ContextManager extends ContextManagerBase<any>,
HardKeyboard extends HardKeyboardBase
@ -117,7 +117,7 @@ export default class KeymanEngine<
workerFactory: WorkerFactory,
config: Configuration,
contextManager: ContextManager,
processorConfigInitializer: (engine: KeymanEngine<Configuration, ContextManager, HardKeyboard>) => ProcessorConfiguration
processorConfigInitializer: (engine: KeymanEngineBase<Configuration, ContextManager, HardKeyboard>) => ProcessorConfiguration
) {
this.config = config;
this.contextManager = contextManager;