@aippy/runtime 0.2.3 → 0.2.4-dev.4
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.
- package/dist/audio/index.d.ts +2 -1
- package/dist/audio/index.js +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +23 -18
- package/dist/core/runtime.d.ts +97 -0
- package/dist/device/index.js +316 -183
- package/dist/device/sensors.d.ts +39 -3
- package/dist/device/types.d.ts +38 -0
- package/dist/index/index.js +52 -41
- package/dist/runtime-Boz38wSz.js +227 -0
- package/dist/{useAudioContext-BKgy28A1.js → useAudioContext-CNQQSTab.js} +2 -2
- package/package.json +25 -26
- package/dist/errors-CDEBaBxB.js +0 -26
package/dist/audio/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { patchAudioContext } from './patchAudioContext';
|
|
10
10
|
export type { AudioContextPatchOptions, AutoPauseOptions, MediaElementType, PatchedAudioContext, } from './types';
|
|
11
|
-
export { createHiddenMediaElement, createHiddenVideoElement,
|
|
11
|
+
export { createHiddenMediaElement, createHiddenVideoElement, isMediaStreamAudioSupported, } from './utils';
|
|
12
12
|
export { useAudioContext } from './useAudioContext';
|
|
13
13
|
export type { UseAudioContextOptions, UseAudioContextReturn } from './useAudioContext';
|
|
14
|
+
export { isIOSDevice } from './utils';
|
package/dist/audio/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as i, a as t,
|
|
1
|
+
import { c as i, a as t, b as d, i as o, p as s, u as n } from "../useAudioContext-CNQQSTab.js";
|
|
2
2
|
export {
|
|
3
3
|
i as createHiddenMediaElement,
|
|
4
4
|
t as createHiddenVideoElement,
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { a as d, A as f, C as u, E as A, R as _, b as m, c as R, p as g } from "../runtime-Boz38wSz.js";
|
|
2
|
+
const s = {
|
|
3
3
|
mode: "development",
|
|
4
4
|
debug: !1,
|
|
5
5
|
apiBaseUrl: void 0,
|
|
6
6
|
headers: {}
|
|
7
7
|
};
|
|
8
|
-
function
|
|
8
|
+
function o() {
|
|
9
9
|
const e = {};
|
|
10
10
|
return typeof process < "u" && process.env && (process.env.NODE_ENV && (e.mode = process.env.NODE_ENV), process.env.AIPPY_DEBUG && (e.debug = process.env.AIPPY_DEBUG === "true"), process.env.AIPPY_API_BASE_URL && (e.apiBaseUrl = process.env.AIPPY_API_BASE_URL)), e;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const n =
|
|
12
|
+
function c(e) {
|
|
13
|
+
const n = o();
|
|
14
14
|
return {
|
|
15
|
-
...
|
|
15
|
+
...s,
|
|
16
16
|
...n,
|
|
17
17
|
...e,
|
|
18
18
|
headers: {
|
|
19
|
-
...
|
|
19
|
+
...s.headers,
|
|
20
20
|
...n.headers,
|
|
21
21
|
...e?.headers
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
version:
|
|
27
|
-
}, i =
|
|
25
|
+
const r = "0.2.4-dev.4", a = {
|
|
26
|
+
version: r
|
|
27
|
+
}, i = a.version, t = "@aippy/runtime";
|
|
28
28
|
function p() {
|
|
29
29
|
return {
|
|
30
|
-
name:
|
|
30
|
+
name: t,
|
|
31
31
|
version: i,
|
|
32
32
|
buildTime: (/* @__PURE__ */ new Date()).toISOString()
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
d as
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
d as AippyRuntime,
|
|
37
|
+
f as AippyRuntimeError,
|
|
38
|
+
u as Cancellable,
|
|
39
|
+
s as DEFAULT_CONFIG,
|
|
40
|
+
A as ERROR_CODES,
|
|
41
|
+
_ as ReceiveChannel,
|
|
42
|
+
t as SDK_NAME,
|
|
40
43
|
i as VERSION,
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
m as aippyRuntime,
|
|
45
|
+
R as createError,
|
|
46
|
+
o as getConfigFromEnv,
|
|
43
47
|
p as getVersionInfo,
|
|
44
|
-
|
|
48
|
+
c as mergeConfig,
|
|
49
|
+
g as processMotionData
|
|
45
50
|
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aippy Runtime - Unified runtime for native bridge communication
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Cancellable class - For managing subscriptions
|
|
6
|
+
*/
|
|
7
|
+
export declare class Cancellable {
|
|
8
|
+
private cancelFn?;
|
|
9
|
+
private cancelled;
|
|
10
|
+
constructor(cancelFn?: (() => void) | undefined);
|
|
11
|
+
cancel(): void;
|
|
12
|
+
get isCancelled(): boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* ReceiveChannel - Manages message receiving and subscription
|
|
16
|
+
*/
|
|
17
|
+
export declare class ReceiveChannel {
|
|
18
|
+
private emitter;
|
|
19
|
+
/**
|
|
20
|
+
* Emit a message to subscribers
|
|
21
|
+
*/
|
|
22
|
+
emit(message: {
|
|
23
|
+
endpoint: string;
|
|
24
|
+
payload: any;
|
|
25
|
+
}): void;
|
|
26
|
+
/**
|
|
27
|
+
* Subscribe to messages on a specific endpoint
|
|
28
|
+
*/
|
|
29
|
+
subscribe(endpoint: string, callback: (payload: any) => void): Cancellable;
|
|
30
|
+
/**
|
|
31
|
+
* Subscribe to a single message (auto-unsubscribe after first message)
|
|
32
|
+
*/
|
|
33
|
+
once(endpoint: string, callback: (payload: any) => void): Cancellable;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* AippyRuntime - Main runtime class for native bridge communication
|
|
37
|
+
*/
|
|
38
|
+
export declare class AippyRuntime {
|
|
39
|
+
receiveChannel: ReceiveChannel;
|
|
40
|
+
private seq;
|
|
41
|
+
private motionListeners;
|
|
42
|
+
/**
|
|
43
|
+
* Unified native data receiver - Routes to specific handlers based on message type
|
|
44
|
+
* Called by native code via: window.aippyRuntime.receiveMessage(message)
|
|
45
|
+
*
|
|
46
|
+
* Supports two message formats:
|
|
47
|
+
* 1. Motion: { endpoint: "0", payload: { motion: {...} } }
|
|
48
|
+
* 2. Tweaks: { "tweakKey": { value: ..., type: ... }, ... }
|
|
49
|
+
*/
|
|
50
|
+
receiveMessage(message: any): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Check if message is Motion format
|
|
53
|
+
* Motion: { endpoint: string, payload: object }
|
|
54
|
+
*/
|
|
55
|
+
private isMotionMessage;
|
|
56
|
+
/**
|
|
57
|
+
* Check if message is Tweaks format
|
|
58
|
+
* Tweaks: { "key": { value: any, type?: string, ... }, ... }
|
|
59
|
+
*/
|
|
60
|
+
private isTweaksMessage;
|
|
61
|
+
/**
|
|
62
|
+
* Create a subscription to native events
|
|
63
|
+
* @param handler - WebKit message handler (e.g., deviceMotionHandler)
|
|
64
|
+
* @param subscribePayload - Subscription parameters (e.g., { type: "motion" })
|
|
65
|
+
* @param callback - Callback to handle received data
|
|
66
|
+
* @returns Cancellable subscription
|
|
67
|
+
*/
|
|
68
|
+
createSubscription(handler: any, subscribePayload: any, callback: (data: any) => void): Cancellable;
|
|
69
|
+
/**
|
|
70
|
+
* Make a subscription message with unique endpoint
|
|
71
|
+
*/
|
|
72
|
+
private makeSubscriptionMessage;
|
|
73
|
+
/**
|
|
74
|
+
* Add motion listener (convenience method)
|
|
75
|
+
* @param callback - Callback to handle motion data
|
|
76
|
+
* @returns Cleanup function
|
|
77
|
+
*/
|
|
78
|
+
addMotionListener(callback: (data: any) => void): () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Broadcast motion data to all registered listeners
|
|
81
|
+
* Called by processMotionData when iOS sends data directly
|
|
82
|
+
* @param data - Motion data from iOS
|
|
83
|
+
*/
|
|
84
|
+
broadcastMotionData(data: any): void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Process Motion data from iOS native layer
|
|
88
|
+
* Called by native code via: window.processMotionData(data)
|
|
89
|
+
*
|
|
90
|
+
* @param data - Motion data in simplified format
|
|
91
|
+
* Expected format: { motion: { gravity: {x, y, z}, acceleration: {...}, rotation: {...} } }
|
|
92
|
+
*/
|
|
93
|
+
export declare function processMotionData(data: any): void;
|
|
94
|
+
/**
|
|
95
|
+
* Global runtime instance - Singleton pattern
|
|
96
|
+
*/
|
|
97
|
+
export declare const aippyRuntime: AippyRuntime;
|