@g9tm/app-diagnostic-lynx 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,70 +1,70 @@
1
- // Generated by @lynx-js/autolink-codegen. Do not edit.
2
-
3
- const ADDON_NAME = "G9AppDiagnosticModule";
4
-
5
- export interface G9AppDiagnosticModuleSpec {
6
- capabilities(callback: (reply: Record<string, unknown>) => void): void;
7
- state(callback: (reply: Record<string, unknown>) => void): void;
8
- startScreen(dir: string, maxFps: number, callback: (reply: Record<string, unknown>) => void): void;
9
- stopScreen(callback: (reply: Record<string, unknown>) => void): void;
10
- startVoice(dir: string, callback: (reply: Record<string, unknown>) => void): void;
11
- stopVoice(callback: (reply: Record<string, unknown>) => void): void;
12
- watchTouches(taps: boolean, touches: boolean, consume: boolean, excludeSurfaces: boolean, callback: (reply: Record<string, unknown>) => void): void;
13
- screenshot(dir: string, maxEdge: number, quality: number, callback: (reply: Record<string, unknown>) => void): void;
14
- sendRange(requestJson: string, callback: (reply: Record<string, unknown>) => void): void;
15
- touch(kind: string, x: number, y: number, toX: number, toY: number, durationMs: number, callback: (reply: Record<string, unknown>) => void): void;
16
- }
17
-
18
- type AddonExports = Record<string, unknown>;
19
-
20
- declare let NativeModules: Record<string, unknown>;
21
-
22
- declare global {
23
- interface LynxNapiLoader {
24
- load(moduleName: string): AddonExports | null | undefined;
25
- }
26
-
27
- // eslint-disable-next-line no-var
28
- var __lynxNapiLoader: LynxNapiLoader | undefined;
29
-
30
- function getNapiLoader(): LynxNapiLoader | undefined;
31
- }
32
-
33
- declare const lynx: {
34
- getModuleLoader?(): LynxNapiLoader | undefined;
35
- };
36
-
37
- function getNativeModules(): Record<string, unknown> | undefined {
38
- const globalObject = globalThis as unknown as {
39
- NativeModules?: Record<string, unknown>;
40
- };
41
- return typeof NativeModules !== 'undefined'
42
- ? NativeModules
43
- : globalObject.NativeModules;
44
- }
45
-
46
- function installG9AppDiagnosticModuleShim(): void {
47
-
48
- }
49
-
50
- export function requireG9AppDiagnosticModule(): G9AppDiagnosticModuleSpec {
51
- const nativeModules = getNativeModules();
52
- const existingModule = nativeModules?.[ADDON_NAME];
53
- if (existingModule !== undefined && existingModule !== null) {
54
- return existingModule as G9AppDiagnosticModuleSpec;
55
- }
56
-
57
-
58
-
59
- throw new Error(`Native module "${ADDON_NAME}" is unavailable.`);
60
- }
61
-
62
- export const G9AppDiagnosticModule = new Proxy({}, {
63
- get(_target, property) {
64
- return requireG9AppDiagnosticModule()[property as keyof G9AppDiagnosticModuleSpec];
65
- },
66
- }) as G9AppDiagnosticModuleSpec;
67
-
68
- installG9AppDiagnosticModuleShim();
69
-
70
- export default G9AppDiagnosticModule;
1
+ // Generated by @lynx-js/autolink-codegen. Do not edit.
2
+
3
+ const ADDON_NAME = "G9AppDiagnosticModule";
4
+
5
+ export interface G9AppDiagnosticModuleSpec {
6
+ capabilities(callback: (reply: Record<string, unknown>) => void): void;
7
+ state(callback: (reply: Record<string, unknown>) => void): void;
8
+ startScreen(dir: string, maxFps: number, callback: (reply: Record<string, unknown>) => void): void;
9
+ stopScreen(callback: (reply: Record<string, unknown>) => void): void;
10
+ startVoice(dir: string, callback: (reply: Record<string, unknown>) => void): void;
11
+ stopVoice(callback: (reply: Record<string, unknown>) => void): void;
12
+ watchTouches(taps: boolean, touches: boolean, consume: boolean, excludeSurfaces: boolean, callback: (reply: Record<string, unknown>) => void): void;
13
+ screenshot(dir: string, maxEdge: number, quality: number, callback: (reply: Record<string, unknown>) => void): void;
14
+ sendRange(requestJson: string, callback: (reply: Record<string, unknown>) => void): void;
15
+ touch(kind: string, x: number, y: number, toX: number, toY: number, durationMs: number, callback: (reply: Record<string, unknown>) => void): void;
16
+ }
17
+
18
+ type AddonExports = Record<string, unknown>;
19
+
20
+ declare let NativeModules: Record<string, unknown>;
21
+
22
+ declare global {
23
+ interface LynxNapiLoader {
24
+ load(moduleName: string): AddonExports | null | undefined;
25
+ }
26
+
27
+ // eslint-disable-next-line no-var
28
+ var __lynxNapiLoader: LynxNapiLoader | undefined;
29
+
30
+ function getNapiLoader(): LynxNapiLoader | undefined;
31
+ }
32
+
33
+ declare const lynx: {
34
+ getModuleLoader?(): LynxNapiLoader | undefined;
35
+ };
36
+
37
+ function getNativeModules(): Record<string, unknown> | undefined {
38
+ const globalObject = globalThis as unknown as {
39
+ NativeModules?: Record<string, unknown>;
40
+ };
41
+ return typeof NativeModules !== 'undefined'
42
+ ? NativeModules
43
+ : globalObject.NativeModules;
44
+ }
45
+
46
+ function installG9AppDiagnosticModuleShim(): void {
47
+
48
+ }
49
+
50
+ export function requireG9AppDiagnosticModule(): G9AppDiagnosticModuleSpec {
51
+ const nativeModules = getNativeModules();
52
+ const existingModule = nativeModules?.[ADDON_NAME];
53
+ if (existingModule !== undefined && existingModule !== null) {
54
+ return existingModule as G9AppDiagnosticModuleSpec;
55
+ }
56
+
57
+
58
+
59
+ throw new Error(`Native module "${ADDON_NAME}" is unavailable.`);
60
+ }
61
+
62
+ export const G9AppDiagnosticModule = new Proxy({}, {
63
+ get(_target, property) {
64
+ return requireG9AppDiagnosticModule()[property as keyof G9AppDiagnosticModuleSpec];
65
+ },
66
+ }) as G9AppDiagnosticModuleSpec;
67
+
68
+ installG9AppDiagnosticModuleShim();
69
+
70
+ export default G9AppDiagnosticModule;
package/lynx.lib.json CHANGED
@@ -1,12 +1,12 @@
1
- {
2
- "platforms": {
3
- "android": {
4
- "packageName": "com.g9tm.appdiagnostic",
5
- "sourceDir": "android"
6
- },
7
- "ios": {
8
- "sourceDir": "ios",
9
- "podspecPath": "ios/g9tm-app-diagnostic-lynx.podspec"
10
- }
11
- }
12
- }
1
+ {
2
+ "platforms": {
3
+ "android": {
4
+ "packageName": "com.g9tm.appdiagnostic",
5
+ "sourceDir": "android"
6
+ },
7
+ "ios": {
8
+ "sourceDir": "ios",
9
+ "podspecPath": "ios/g9tm-app-diagnostic-lynx.podspec"
10
+ }
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "name": "@g9tm/app-diagnostic-lynx",
3
- "version": "0.2.0",
4
- "description": "Lynx native half of @g9tm/app-diagnostic: the app's own window as an MP4, a spoken note, the window screenshot, a file range sent natively, and the tester gesture (observed or consumed). No product names: the host configures everything.",
5
- "type": "module",
6
- "main": "src/index.ts",
7
- "types": "src/index.ts",
8
- "exports": {
9
- ".": {
10
- "source": "./src/index.ts",
11
- "types": "./src/index.ts",
12
- "default": "./src/index.ts"
13
- },
14
- "./package.json": "./package.json"
15
- },
16
- "files": [
17
- "src",
18
- "generated",
19
- "types",
20
- "android/build.gradle.kts",
21
- "android/consumer-rules.pro",
22
- "android/src/main",
23
- "ios/g9tm-app-diagnostic-lynx.podspec",
24
- "ios/src",
25
- "lynx.lib.json",
26
- "README.md",
27
- "Native-Validation-Pending.md"
28
- ],
29
- "scripts": {
30
- "test": "node --test test/*.test.ts",
31
- "test:android-jvm": "node scripts/run-gradle.mjs -p jvm test",
32
- "check:android-module": "node scripts/run-gradle.mjs -p android-check build"
33
- },
34
- "peerDependencies": {
35
- "@g9tm/app-diagnostic": "^0.2.0"
36
- },
37
- "license": "UNLICENSED",
38
- "engines": { "node": ">=22.6" }
39
- }
1
+ {
2
+ "name": "@g9tm/app-diagnostic-lynx",
3
+ "version": "0.2.2",
4
+ "description": "Lynx native half of @g9tm/app-diagnostic: the app's own window as an MP4, a spoken note, the window screenshot, a file range sent natively, and the tester gesture (observed or consumed). No product names: the host configures everything.",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "exports": {
9
+ ".": {
10
+ "source": "./src/index.ts",
11
+ "types": "./src/index.ts",
12
+ "default": "./src/index.ts"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "src",
18
+ "generated",
19
+ "types",
20
+ "android/build.gradle.kts",
21
+ "android/consumer-rules.pro",
22
+ "android/src/main",
23
+ "ios/g9tm-app-diagnostic-lynx.podspec",
24
+ "ios/src",
25
+ "lynx.lib.json",
26
+ "README.md",
27
+ "Native-Validation-Pending.md"
28
+ ],
29
+ "scripts": {
30
+ "test": "node --test test/*.test.ts",
31
+ "test:android-jvm": "node scripts/run-gradle.mjs -p jvm test",
32
+ "check:android-module": "node scripts/run-gradle.mjs -p android-check build"
33
+ },
34
+ "peerDependencies": {
35
+ "@g9tm/app-diagnostic": "^0.2.2"
36
+ },
37
+ "license": "MIT",
38
+ "engines": { "node": ">=22.6" }
39
+ }
package/src/index.ts CHANGED
@@ -50,14 +50,23 @@ export interface DiagnosticRecording {
50
50
  readonly capped?: boolean;
51
51
  }
52
52
 
53
- /** One touch the watcher reports (x, y: fractions of the window). */
53
+ /**
54
+ * One touch the watcher reports (fractions of the window). `tap`: a completed multi-finger tap; `down`: a first finger
55
+ * down; `seq` (only while `touches` is on): the trace of a touch that could have been a tap — why it was or was not one.
56
+ */
54
57
  export interface DiagnosticTouchEvent {
55
- readonly type: 'tap' | 'down';
58
+ readonly type: 'tap' | 'down' | 'seq';
56
59
  readonly fingers: number;
60
+ /** The first finger. */
57
61
  readonly x: number;
58
62
  readonly y: number;
63
+ /** The fingers' midpoint at the most fingers (a tap, a trace); the first finger otherwise. */
64
+ readonly cx: number;
65
+ readonly cy: number;
59
66
  /** On a surface the host excludes (its map). */
60
67
  readonly excluded: boolean;
68
+ /** A `seq` trace's facts (ms, secondMs, firstUpMs, movePx, slopPx, held, why, …). */
69
+ readonly info?: Readonly<Record<string, unknown>>;
61
70
  }
62
71
 
63
72
  /** One remote touch: points in dp from the window's top-left. */
@@ -145,8 +154,17 @@ export function onDiagnosticTouch(events: GlobalEvents, listener: (event: Diagno
145
154
  const raw = args[0];
146
155
  try {
147
156
  const e = (typeof raw === 'string' ? JSON.parse(raw) : raw) as Partial<DiagnosticTouchEvent>;
148
- if ((e.type === 'tap' || e.type === 'down') && typeof e.fingers === 'number' && typeof e.x === 'number' && typeof e.y === 'number') {
149
- listener({ type: e.type, fingers: e.fingers, x: e.x, y: e.y, excluded: e.excluded === true });
157
+ if ((e.type === 'tap' || e.type === 'down' || e.type === 'seq') && typeof e.fingers === 'number' && typeof e.x === 'number' && typeof e.y === 'number') {
158
+ listener({
159
+ type: e.type,
160
+ fingers: e.fingers,
161
+ x: e.x,
162
+ y: e.y,
163
+ cx: typeof e.cx === 'number' ? e.cx : e.x,
164
+ cy: typeof e.cy === 'number' ? e.cy : e.y,
165
+ excluded: e.excluded === true,
166
+ ...(e.info && typeof e.info === 'object' ? { info: e.info } : {}),
167
+ });
150
168
  }
151
169
  } catch {
152
170
  // not ours
@@ -14,7 +14,10 @@
14
14
  //
15
15
  // Events (global, JSON text): `g9:diagnostic-touch` — {type: 'tap', fingers, x, y, excluded} for a completed multi-finger
16
16
  // tap, {type: 'down', fingers: 1, x, y, excluded: false} for a first finger down (only while `touches` is on). x, y are
17
- // fractions of the window; `excluded` = the first finger landed on a surface the host excludes (a map).
17
+ // fractions of the window; `excluded` = the first finger landed on a surface the host excludes (a map). A tap also
18
+ // carries `cx`, `cy`: the fingers' midpoint at the most fingers. While `touches` is on, every touch that could have been a
19
+ // tap ends with {type: 'seq', fingers, x, y, cx, cy, excluded, info: {ms, secondMs, firstUpMs, movePx, slopPx, held,
20
+ // oldRuleMoved, why}} — why: tap | moved | too-long | one-finger | cancelled | not-watching.
18
21
 
19
22
  /** @lynxmodule */
20
23
  export declare class G9AppDiagnosticModule {