Merge pull request #9066 from keymanapp/chore/web/gesture-source-reorg

chore(web): feature-gesture reorganization 🐵
This commit is contained in:
Joshua Horton 2023-06-30 11:57:40 +07:00 • committed by GitHub
commit 768a4e7cbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 82 additions and 57 deletions

View file

@ -0,0 +1,18 @@
{
"check-coverage": false,
"clean": true,
"exclude": [
"src/test/*",
"node_modules/*",
"src/tools/*"
],
"exclude-after-remap": true,
"include": [
"src/engine/headless/*"
],
"reporter": ["text", "text-summary"],
"reports-dir": "build/coverage",
"src": [
"src/engine/headless/*"
]
}

View file

@ -40,7 +40,6 @@ if builder_start_action configure; then
fi
if builder_start_action clean; then
npm run clean
rm -rf build/
builder_finish_action success clean
fi
@ -59,9 +58,9 @@ fi
if builder_start_action test:module; then
if builder_has_option --ci; then
npm test -- --ci
./test.sh --ci
else
npm test
./test.sh
fi
builder_finish_action success test:module
fi

View file

@ -27,12 +27,8 @@
"typescript": "^4.9.5"
},
"scripts": {
"build": "echo 'Building @keymanapp/gesture-recognizer' && tsc -b ./tsconfig.json",
"clean": "tsc -b --clean",
"karma": "karma",
"mocha": "mocha",
"test": "gosh ./src/test/test.sh",
"tsc": "tsc"
"build": "gosh ./build.sh",
"test": "gosh ./test.sh"
},
"dependencies": {
"eventemitter3": "^4.0.0"

View file

@ -1,6 +1,6 @@
import { GestureRecognizerConfiguration } from "./gestureRecognizerConfiguration.js";
import { InputSample } from "./inputSample.js";
import { Nonoptional } from "./nonoptional.js";
import { InputSample } from "../headless/inputSample.js";
import { Nonoptional } from "../nonoptional.js";
import { RecognitionZoneSource } from "./recognitionZoneSource.js";
export class ZoneBoundaryChecker {

View file

@ -1,9 +1,9 @@
import EventEmitter from "eventemitter3";
import { GestureRecognizerConfiguration } from "./gestureRecognizerConfiguration.js";
import { GestureRecognizerConfiguration } from "./configuration/gestureRecognizerConfiguration.js";
import { MouseEventEngine } from "./mouseEventEngine.js";
import { Mutable } from "./mutable.js";
import { Nonoptional } from "./nonoptional.js";
import { PaddedZoneSource } from "./paddedZoneSource.js";
import { PaddedZoneSource } from "./configuration/paddedZoneSource.js";
import { TouchEventEngine } from "./touchEventEngine.js";
import { TrackedInput } from "./trackedInput.js";
import { TrackedPoint } from "./trackedPoint.js";

View file

@ -1,7 +1,7 @@
import { SegmentClassifier } from "./segmentClassifier.js";
import { CumulativePathStats } from "./cumulativePathStats.js";
import { SegmentClassifier } from "../segmentClassifier.js";
import { CumulativePathStats } from "../cumulativePathStats.js";
import { SegmentationSplit, Subsegmentation } from "./pathSegmenter.js";
import { SegmentImplementation } from "./segment.js";
import { SegmentImplementation } from "../segment.js";
import { SubsegmentCompatibilityAnalyzer } from "./subsegmentCompatibilityAnalyzer.js";
/**

View file

@ -1,8 +1,8 @@
import { ConstructingSegment } from "./constructingSegment.js";
import { CumulativePathStats, PathCoordAxis, sigMinus } from "./cumulativePathStats.js";
import { InputSample } from "./inputSample.js";
import { Segment, SegmentImplementation } from "./segment.js";
import { SegmentClass, SegmentClassifier, SegmentClassifierConfig } from "./segmentClassifier.js";
import { CumulativePathStats, PathCoordAxis, sigMinus } from "../cumulativePathStats.js";
import { InputSample } from "../inputSample.js";
import { Segment, SegmentImplementation } from "../segment.js";
import { SegmentClass, SegmentClassifier, SegmentClassifierConfig } from "../segmentClassifier.js";
// Mostly used here to compare the sum-squared error components of segmented regressions
// to the sum-squared "modeled" components of their overall variance. Those are the two

View file

@ -1,5 +1,5 @@
import { SegmentationSplit } from "./pathSegmenter.js";
import { SegmentClass, SegmentClassifier } from "./segmentClassifier.js";
import { SegmentClass, SegmentClassifier } from "../segmentClassifier.js";
/**
* This class fulfills two roles:

View file

@ -1,6 +1,6 @@
import EventEmitter from "eventemitter3";
import { InputSample } from "./inputSample.js";
import { PathSegmenter } from "./pathSegmenter.js";
import { PathSegmenter } from "./subsegmentation/pathSegmenter.js";
import { Segment } from "./segment.js";
/**

View file

@ -0,0 +1,18 @@
export { ConstructingSegment } from './headless/subsegmentation/constructingSegment.js';
export { CumulativePathStats } from './headless/cumulativePathStats.js';
export { GestureRecognizer } from "./gestureRecognizer.js";
export { GestureRecognizerConfiguration } from "./configuration/gestureRecognizerConfiguration.js"
export { InputSample } from "./headless/inputSample.js";
export { JSONTrackedInput, TrackedInput } from "./trackedInput.js";
export { JSONTrackedPath, TrackedPath } from "./headless/trackedPath.js";
export { JSONTrackedPoint, TrackedPoint } from "./trackedPoint.js";
export { MouseEventEngine } from "./mouseEventEngine.js";
export { PathSegmenter, Subsegmentation } from "./headless/subsegmentation/pathSegmenter.js";
export { PaddedZoneSource } from './configuration/paddedZoneSource.js';
export { RecognitionZoneSource } from './configuration/recognitionZoneSource.js';
export { Segment } from "./headless/segment.js";
export { SegmentClassifier } from "./headless/segmentClassifier.js";
export { TouchEventEngine } from "./touchEventEngine.js";
export { ViewportZoneSource } from './configuration/viewportZoneSource.js';
// TODO: export other odds & ends.

View file

@ -1,6 +1,6 @@
import EventEmitter from "eventemitter3";
import { GestureRecognizerConfiguration } from "./gestureRecognizerConfiguration.js";
import { InputSample } from "./inputSample.js";
import { GestureRecognizerConfiguration } from "./configuration/gestureRecognizerConfiguration.js";
import { InputSample } from "./headless/inputSample.js";
import { Nonoptional } from "./nonoptional.js";
import { TrackedPoint } from "./trackedPoint.js";

View file

@ -1,8 +1,8 @@
import { GestureRecognizerConfiguration } from "./gestureRecognizerConfiguration.js";
import { GestureRecognizerConfiguration } from "./configuration/gestureRecognizerConfiguration.js";
import { InputEventEngine } from "./inputEventEngine.js";
import { InputSample } from "./inputSample.js";
import { InputSample } from "./headless/inputSample.js";
import { Nonoptional } from "./nonoptional.js";
import { ZoneBoundaryChecker } from "./zoneBoundaryChecker.js";
import { ZoneBoundaryChecker } from "./configuration/zoneBoundaryChecker.js";
export class MouseEventEngine extends InputEventEngine {
private readonly _mouseStart: typeof MouseEventEngine.prototype.onMouseStart;

View file

@ -1,8 +1,8 @@
import { GestureRecognizerConfiguration } from "./gestureRecognizerConfiguration.js";
import { GestureRecognizerConfiguration } from "./configuration/gestureRecognizerConfiguration.js";
import { InputEventEngine } from "./inputEventEngine.js";
import { InputSample } from "./inputSample.js";
import { InputSample } from "./headless/inputSample.js";
import { Nonoptional } from "./nonoptional.js";
import { ZoneBoundaryChecker } from "./zoneBoundaryChecker.js";
import { ZoneBoundaryChecker } from "./configuration/zoneBoundaryChecker.js";
export class TouchEventEngine extends InputEventEngine {
private readonly _touchStart: typeof TouchEventEngine.prototype.onTouchStart;

View file

@ -1,4 +1,4 @@
import { JSONTrackedPath, TrackedPath } from "./trackedPath.js";
import { JSONTrackedPath, TrackedPath } from "./headless/trackedPath.js";
/**
* Documents the expected typing of serialized versions of the `TrackedPoint` class.

View file

@ -1,15 +0,0 @@
export { ConstructingSegment } from './constructingSegment.js';
export { CumulativePathStats } from './cumulativePathStats.js';
export { GestureRecognizer } from "./gestureRecognizer.js";
export { GestureRecognizerConfiguration } from "./gestureRecognizerConfiguration.js"
export { InputSample } from "./inputSample.js";
export { JSONTrackedInput, TrackedInput } from "./trackedInput.js";
export { JSONTrackedPath, TrackedPath } from "./trackedPath.js";
export { JSONTrackedPoint, TrackedPoint } from "./trackedPoint.js";
export { MouseEventEngine } from "./mouseEventEngine.js";
export { PathSegmenter, Subsegmentation } from "./pathSegmenter.js";
export { Segment } from "./segment.js";
export { SegmentClassifier } from "./segmentClassifier.js";
export { TouchEventEngine } from "./touchEventEngine.js";
// TODO: export other odds & ends.

View file

@ -1,6 +1,8 @@
import { assert } from 'chai';
import sinon from 'sinon';
import fs from 'fs';
import path from 'path';
import url from 'url';
import * as PromiseStatusModule from 'promise-status-async';
const promiseStatus = PromiseStatusModule.promiseStatus;
@ -10,7 +12,10 @@ import { PathSegmenter } from '@keymanapp/gesture-recognizer';
import { HeadlessRecordingSimulator } from '../../../../build/tools/obj/index.js';
const SEGMENT_TEST_JSON_FOLDER = './resources/json/segmentation';
// Ensures that the resources are resolved relative to this script, not to the cwd when the test
// runner was launched.
const scriptFolder = path.dirname(url.fileURLToPath(import.meta.url));
const SEGMENT_TEST_JSON_FOLDER = path.resolve(`${scriptFolder}/../../resources/json/segmentation`);
import { assertSegmentSimilarity } from '../../resources/assertSegmentSimilarity.js';

View file

@ -1,13 +1,17 @@
import { assert } from 'chai'
import sinon from 'sinon';
import fs from 'fs';
import path from 'path';
import url from 'url';
import { TrackedPath } from '@keymanapp/gesture-recognizer';
import { HeadlessRecordingSimulator, timedPromise } from '../../../../build/tools/obj/index.js';
// For the integrated-style recording-based test.
const SEGMENT_TEST_JSON_FOLDER = './resources/json/segmentation';
// Ensures that the resources are resolved relative to this script, not to the cwd when the test
// runner was launched.
const scriptFolder = path.dirname(url.fileURLToPath(import.meta.url));
const SEGMENT_TEST_JSON_FOLDER = path.resolve(`${scriptFolder}/../../resources/json/segmentation`);
import { assertSegmentSimilarity } from '../../resources/assertSegmentSimilarity.js'
;

View file

@ -3,7 +3,7 @@
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
. "$(dirname "$THIS_SCRIPT")/../../../../../resources/build/build-utils.sh"
. "$(dirname "$THIS_SCRIPT")/../../../resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
. $KEYMAN_ROOT/resources/shellHelperFunctions.sh
@ -44,7 +44,7 @@ test-headless ( ) {
MOCHA_FLAGS="--reporter mocha-teamcity-reporter"
fi
mocha --recursive $MOCHA_FLAGS ./auto/headless/
c8 mocha --recursive $MOCHA_FLAGS ./src/test/auto/headless/
}
test-browser ( ) {
@ -58,7 +58,7 @@ test-browser ( ) {
KARMA_CONFIG="CI.conf.cjs"
fi
karma start auto/browser/$KARMA_CONFIG "$KARMA_FLAGS"
karma start src/test/auto/browser/$KARMA_CONFIG "$KARMA_FLAGS"
}
if builder_start_action test:headless; then

View file

@ -4,9 +4,9 @@
"baseUrl": "./",
"lib": [ "dom", "es6" ],
"outDir": "./build/obj/",
"rootDir": "./src",
"rootDir": "./src/engine",
"tsBuildInfoFile": "./build/obj/tsconfig.tsbuildinfo"
},
"include": ["./src/**/*.ts"],
"exclude": ["./src/tools/**/*.ts"]
"include": ["./src/engine/**/*.ts"],
"exclude": ["./src/test/**/*.ts", "./src/tools/**/*.ts"]
}

View file

@ -5,8 +5,6 @@
"files": [],
"include": [],
"references": [
{ "path": "./common/web/gesture-recognizer/tsconfig.json" },
{ "path": "./common/web/gesture-recognizer/src/tools/unit-test-resources/tsconfig.json" },
{ "path": "./common/predictive-text/testing/one-stage-embedded-webworker/tsconfig.json" },
{ "path": "./common/predictive-text/testing/two-stage-embedded-webworker/tsconfig.json" },
{ "path": "./common/predictive-text/testing/two-stage-embedded-webworker/worker/tsconfig.json" },

View file

@ -24,6 +24,8 @@
{ "path": "./common/web/keyman-version" },
{ "path": "./common/web/types/" },
{ "path": "./common/web/gesture-recognizer/tsconfig.json" },
{ "path": "./common/web/gesture-recognizer/src/tools/unit-test-resources/tsconfig.json" },
{ "path": "./common/web/input-processor/tsconfig.json" },
{ "path": "./common/web/keyboard-processor/tsconfig.json" },
{ "path": "./common/web/recorder/tsconfig.json" },