@aippy/runtime 0.2.4-dev.3 → 0.2.4-dev.5

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,4 +1,4 @@
1
- import { a as d, A as f, C as u, E as A, R as _, b as m, c as R } from "../runtime-DOnodF_1.js";
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-DjBdOttl.js";
2
2
  const s = {
3
3
  mode: "development",
4
4
  debug: !1,
@@ -22,13 +22,13 @@ function c(e) {
22
22
  }
23
23
  };
24
24
  }
25
- const r = "0.2.4-dev.3", i = {
25
+ const r = "0.2.4-dev.5", a = {
26
26
  version: r
27
- }, a = i.version, t = "@aippy/runtime";
27
+ }, i = a.version, t = "@aippy/runtime";
28
28
  function p() {
29
29
  return {
30
30
  name: t,
31
- version: a,
31
+ version: i,
32
32
  buildTime: (/* @__PURE__ */ new Date()).toISOString()
33
33
  };
34
34
  }
@@ -40,10 +40,11 @@ export {
40
40
  A as ERROR_CODES,
41
41
  _ as ReceiveChannel,
42
42
  t as SDK_NAME,
43
- a as VERSION,
43
+ i as VERSION,
44
44
  m as aippyRuntime,
45
45
  R as createError,
46
46
  o as getConfigFromEnv,
47
47
  p as getVersionInfo,
48
- c as mergeConfig
48
+ c as mergeConfig,
49
+ g as processMotionData
49
50
  };
@@ -38,33 +38,56 @@ export declare class ReceiveChannel {
38
38
  export declare class AippyRuntime {
39
39
  receiveChannel: ReceiveChannel;
40
40
  private seq;
41
+ private motionListeners;
42
+ private noListenersWarned;
41
43
  /**
42
- * Receive message from native layer
44
+ * Unified native data receiver - Routes to specific handlers based on message type
43
45
  * Called by native code via: window.aippyRuntime.receiveMessage(message)
46
+ *
47
+ * Supports two message formats:
48
+ * 1. Motion: { command: "navigator.motion", endpoint: "0", data: { motion: {...} } }
49
+ * 2. Tweaks: { "tweakKey": { value: ..., type: ... }, ... }
44
50
  */
45
- receiveMessage(message: {
46
- endpoint: string;
47
- payload: any;
48
- }): Promise<void>;
51
+ receiveMessage(message: any): Promise<void>;
52
+ /**
53
+ * Check if message is Motion format
54
+ * Motion: { command: "navigator.motion", endpoint: string, data: object }
55
+ */
56
+ private isMotionMessage;
57
+ /**
58
+ * Check if message is Tweaks format
59
+ * Tweaks: { "key": { value: any, type?: string, ... }, ... }
60
+ */
61
+ private isTweaksMessage;
49
62
  /**
50
63
  * Create a subscription to native events
51
- * @param handler - WebKit message handler (e.g., deviceMotionHandler)
52
- * @param subscribePayload - Subscription parameters (e.g., { type: "motion" })
64
+ * @param handler - WebKit message handler (e.g., aippyListener)
65
+ * @param subscribePayload - Subscription parameters (e.g., { command: "navigator.motion", type: "motion" })
53
66
  * @param callback - Callback to handle received data
54
67
  * @returns Cancellable subscription
55
68
  */
56
69
  createSubscription(handler: any, subscribePayload: any, callback: (data: any) => void): Cancellable;
57
- /**
58
- * Make a subscription message with unique endpoint
59
- */
60
- private makeSubscriptionMessage;
61
70
  /**
62
71
  * Add motion listener (convenience method)
63
72
  * @param callback - Callback to handle motion data
64
73
  * @returns Cleanup function
65
74
  */
66
75
  addMotionListener(callback: (data: any) => void): () => void;
76
+ /**
77
+ * Broadcast motion data to all registered listeners
78
+ * Called by processMotionData when iOS sends data directly
79
+ * @param data - Motion data from iOS
80
+ */
81
+ broadcastMotionData(data: any): void;
67
82
  }
83
+ /**
84
+ * Process Motion data from iOS native layer
85
+ * Called by native code via: window.processMotionData(data)
86
+ *
87
+ * @param data - Motion data in simplified format
88
+ * Expected format: { motion: { gravity: {x, y, z}, acceleration: {...}, rotation: {...} } }
89
+ */
90
+ export declare function processMotionData(data: any): void;
68
91
  /**
69
92
  * Global runtime instance - Singleton pattern
70
93
  */