@aippy/runtime 0.2.5-dev.0 → 0.2.5-dev.1

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,5 @@
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";
1
+ import { A as v, E as d, c as u } from "../errors-CDEBaBxB.js";
2
+ import { A as m, C as _, R, a as g, p as I } from "../runtime-CmoG3v2m.js";
2
3
  const s = {
3
4
  mode: "development",
4
5
  debug: !1,
@@ -9,7 +10,7 @@ function o() {
9
10
  const e = {};
10
11
  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
12
  }
12
- function c(e) {
13
+ function p(e) {
13
14
  const n = o();
14
15
  return {
15
16
  ...s,
@@ -22,10 +23,10 @@ function c(e) {
22
23
  }
23
24
  };
24
25
  }
25
- const r = "0.2.5-dev.0", a = {
26
+ const r = "0.2.5-dev.1", a = {
26
27
  version: r
27
28
  }, i = a.version, t = "@aippy/runtime";
28
- function p() {
29
+ function c() {
29
30
  return {
30
31
  name: t,
31
32
  version: i,
@@ -33,18 +34,18 @@ function p() {
33
34
  };
34
35
  }
35
36
  export {
36
- d as AippyRuntime,
37
- f as AippyRuntimeError,
38
- u as Cancellable,
37
+ m as AippyRuntime,
38
+ v as AippyRuntimeError,
39
+ _ as Cancellable,
39
40
  s as DEFAULT_CONFIG,
40
- A as ERROR_CODES,
41
- _ as ReceiveChannel,
41
+ d as ERROR_CODES,
42
+ R as ReceiveChannel,
42
43
  t as SDK_NAME,
43
44
  i as VERSION,
44
- m as aippyRuntime,
45
- R as createError,
45
+ g as aippyRuntime,
46
+ u as createError,
46
47
  o as getConfigFromEnv,
47
- p as getVersionInfo,
48
- c as mergeConfig,
49
- g as processMotionData
48
+ c as getVersionInfo,
49
+ p as mergeConfig,
50
+ I as processMotionData
50
51
  };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Native Bridge Detection
3
+ * Shared utility for detecting iOS native bridge availability
4
+ */
5
+ /**
6
+ * Check if native bridge is available (iOS WebView)
7
+ * Used by both device and user modules
8
+ */
9
+ export declare function hasNativeBridge(): boolean;
@@ -1,10 +1,12 @@
1
- var L = Object.defineProperty;
2
- var T = (n, t, e) => t in n ? L(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var S = (n, t, e) => T(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { c, b as k } from "../runtime-DjBdOttl.js";
5
- class D {
1
+ var U = Object.defineProperty;
2
+ var D = (r, t, e) => t in r ? U(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var A = (r, t, e) => D(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { c } from "../errors-CDEBaBxB.js";
5
+ import { a as L } from "../runtime-CmoG3v2m.js";
6
+ import { h as N } from "../native-bridge-JAmH-zTN.js";
7
+ class T {
6
8
  constructor() {
7
- S(this, "stream", null);
9
+ A(this, "stream", null);
8
10
  }
9
11
  /**
10
12
  * Check if camera is supported
@@ -47,11 +49,11 @@ class D {
47
49
  if (!o)
48
50
  throw c("Failed to get canvas context", "UNKNOWN_ERROR");
49
51
  i.width = t.width || e.videoWidth, i.height = t.height || e.videoHeight, o.drawImage(e, 0, 0, i.width, i.height);
50
- const r = t.format || "jpeg", s = t.quality === "high" ? 0.9 : t.quality === "medium" ? 0.7 : 0.5, a = await new Promise((u, m) => {
52
+ const n = t.format || "jpeg", s = t.quality === "high" ? 0.9 : t.quality === "medium" ? 0.7 : 0.5, a = await new Promise((u, m) => {
51
53
  i.toBlob((l) => {
52
54
  l ? u(l) : m(new Error("Failed to create blob"));
53
- }, `image/${r}`, s);
54
- }), d = i.toDataURL(`image/${r}`, s);
55
+ }, `image/${n}`, s);
56
+ }), d = i.toDataURL(`image/${n}`, s);
55
57
  return {
56
58
  blob: a,
57
59
  dataUrl: d,
@@ -72,8 +74,8 @@ class D {
72
74
  this.stream && (this.stream.getTracks().forEach((t) => t.stop()), this.stream = null);
73
75
  }
74
76
  }
75
- const H = new D();
76
- class x {
77
+ const H = new T();
78
+ class k {
77
79
  /**
78
80
  * Check if geolocation is supported
79
81
  */
@@ -93,29 +95,29 @@ class x {
93
95
  maximumAge: t.maximumAge ?? 6e4
94
96
  };
95
97
  navigator.geolocation.getCurrentPosition(
96
- (r) => {
98
+ (n) => {
97
99
  const s = {
98
- latitude: r.coords.latitude,
99
- longitude: r.coords.longitude,
100
- accuracy: r.coords.accuracy,
101
- altitude: r.coords.altitude ?? void 0,
102
- altitudeAccuracy: r.coords.altitudeAccuracy ?? void 0,
103
- heading: r.coords.heading ?? void 0,
104
- speed: r.coords.speed ?? void 0,
105
- timestamp: r.timestamp
100
+ latitude: n.coords.latitude,
101
+ longitude: n.coords.longitude,
102
+ accuracy: n.coords.accuracy,
103
+ altitude: n.coords.altitude ?? void 0,
104
+ altitudeAccuracy: n.coords.altitudeAccuracy ?? void 0,
105
+ heading: n.coords.heading ?? void 0,
106
+ speed: n.coords.speed ?? void 0,
107
+ timestamp: n.timestamp
106
108
  };
107
109
  e(s);
108
110
  },
109
- (r) => {
111
+ (n) => {
110
112
  let s = "UNKNOWN_ERROR", a = "Unknown geolocation error";
111
- switch (r.code) {
112
- case r.PERMISSION_DENIED:
113
+ switch (n.code) {
114
+ case n.PERMISSION_DENIED:
113
115
  s = "PERMISSION_DENIED", a = "Geolocation permission denied";
114
116
  break;
115
- case r.POSITION_UNAVAILABLE:
117
+ case n.POSITION_UNAVAILABLE:
116
118
  a = "Position unavailable";
117
119
  break;
118
- case r.TIMEOUT:
120
+ case n.TIMEOUT:
119
121
  a = "Geolocation timeout";
120
122
  break;
121
123
  }
@@ -138,7 +140,7 @@ class x {
138
140
  };
139
141
  return navigator.geolocation.watchPosition(
140
142
  (o) => {
141
- const r = {
143
+ const n = {
142
144
  latitude: o.coords.latitude,
143
145
  longitude: o.coords.longitude,
144
146
  accuracy: o.coords.accuracy,
@@ -148,7 +150,7 @@ class x {
148
150
  speed: o.coords.speed ?? void 0,
149
151
  timestamp: o.timestamp
150
152
  };
151
- t(r);
153
+ t(n);
152
154
  },
153
155
  (o) => {
154
156
  console.error("Geolocation watch error:", o);
@@ -163,47 +165,37 @@ class x {
163
165
  navigator.geolocation.clearWatch(t);
164
166
  }
165
167
  }
166
- const C = new x();
168
+ const K = new k();
167
169
  function E() {
168
170
  return "DeviceMotionEvent" in window;
169
171
  }
170
- function N() {
171
- return "DeviceOrientationEvent" in window;
172
- }
173
172
  function R() {
174
- const n = typeof window < "u", t = n && !!window.webkit, e = t && !!window.webkit?.messageHandlers, i = e && !!window.webkit?.messageHandlers?.aippyListener;
175
- return console.log("🔍 [Aippy Sensors] hasNativeBridge check:", {
176
- hasWindow: n,
177
- hasWebkit: t,
178
- hasMessageHandlers: e,
179
- hasAippyListener: i,
180
- result: i
181
- }), i;
173
+ return "DeviceOrientationEvent" in window;
182
174
  }
183
175
  function I() {
184
176
  return typeof window < "u" && typeof window.orientation < "u" ? window.orientation : typeof window < "u" && window.screen?.orientation?.angle !== void 0 ? window.screen.orientation.angle : 0;
185
177
  }
186
- function P(n, t, e) {
178
+ function P(r, t, e) {
187
179
  switch (e) {
188
180
  case 0:
189
- return [n, -t];
181
+ return [r, -t];
190
182
  case 180:
191
- return [-n, t];
183
+ return [-r, t];
192
184
  case 90:
193
- return [-t, n];
185
+ return [-t, r];
194
186
  case -90:
195
- return [t, -n];
187
+ return [t, -r];
196
188
  default:
197
- return [n, -t];
189
+ return [r, -t];
198
190
  }
199
191
  }
200
192
  async function b() {
201
- if (console.log("🔐 [Aippy Sensors] requestMotionPermission called"), R())
193
+ if (console.log("🔐 [Aippy Sensors] requestMotionPermission called"), N())
202
194
  return console.log("✅ [Aippy Sensors] Native bridge available, skipping permission request"), !0;
203
195
  if (!E())
204
196
  return console.warn("❌ [Aippy Sensors] Device motion not supported"), !1;
205
- const n = typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function";
206
- if (console.log("🔍 [Aippy Sensors] Permission API available:", n), n)
197
+ const r = typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function";
198
+ if (console.log("🔍 [Aippy Sensors] Permission API available:", r), r)
207
199
  try {
208
200
  console.log("🙏 [Aippy Sensors] Requesting device motion permission...");
209
201
  const t = await DeviceMotionEvent.requestPermission();
@@ -213,25 +205,42 @@ async function b() {
213
205
  }
214
206
  return console.log("✅ [Aippy Sensors] No permission needed (granted by default)"), !0;
215
207
  }
216
- function F(n) {
208
+ function x(r) {
217
209
  console.log("🔧 [Aippy Sensors] watchMotionNative - Setting up native bridge listener");
218
- const t = k.addMotionListener((e) => {
219
- const i = I(), o = e.gravity?.x ?? 0, r = e.gravity?.y ?? 0, s = e.gravity?.z ?? 0, a = e.userAcceleration?.x ?? 0, d = e.userAcceleration?.y ?? 0, u = e.userAcceleration?.z ?? 0, [m, l] = P(o, r, i), [y, v] = P(a, d, i), g = e.attitude && typeof e.attitude.yaw == "number" && typeof e.attitude.pitch == "number" && typeof e.attitude.roll == "number";
210
+ const t = L.addMotionListener((e) => {
211
+ const i = I(), o = e.gravity?.x ?? 0, n = e.gravity?.y ?? 0, s = e.gravity?.z ?? 0, a = e.userAcceleration?.x ?? 0, d = e.userAcceleration?.y ?? 0, u = e.userAcceleration?.z ?? 0, [m, l] = P(o, n, i), [y, v] = P(a, d, i), g = e.attitude && typeof e.attitude.yaw == "number" && typeof e.attitude.pitch == "number" && typeof e.attitude.roll == "number";
220
212
  let w = 0;
221
213
  g && (w = e.attitude.yaw * (180 / Math.PI), w < 0 && (w += 360));
222
214
  const f = {
223
- gravity: { x: m, y: l, z: s },
224
- acceleration: { x: y, y: v, z: u },
215
+ gravity: {
216
+ x: m,
217
+ y: l,
218
+ z: s
219
+ // Z-axis not affected by screen rotation
220
+ },
221
+ acceleration: {
222
+ x: y,
223
+ y: v,
224
+ z: u
225
+ // Z-axis not affected by screen rotation
226
+ },
225
227
  accelerationIncludingGravity: {
226
228
  x: m + y,
227
229
  y: l + v,
228
230
  z: s + u
229
231
  },
232
+ // iOS native uses rotationRate.x/y/z (rad/s)
233
+ // Convert to rotation.alpha/beta/gamma (deg/s)
230
234
  rotation: {
235
+ // If attitude is available, use yaw for alpha (compass heading)
236
+ // Otherwise fallback to rotationRate.z (angular velocity)
231
237
  alpha: g ? w : (e.rotationRate?.z ?? 0) * (180 / Math.PI),
232
238
  beta: (e.rotationRate?.x ?? 0) * (180 / Math.PI),
239
+ // x -> beta (around X-axis)
233
240
  gamma: (e.rotationRate?.y ?? 0) * (180 / Math.PI)
241
+ // y -> gamma (around Y-axis)
234
242
  },
243
+ // Add attitude data for more precise orientation info
235
244
  attitude: g ? {
236
245
  yaw: w,
237
246
  pitch: e.attitude.pitch * (180 / Math.PI),
@@ -245,11 +254,11 @@ function F(n) {
245
254
  } : void 0,
246
255
  timestamp: Date.now()
247
256
  };
248
- n(f);
257
+ r(f);
249
258
  });
250
259
  return console.log("✅ [Aippy Sensors] watchMotionNative - Listener setup complete"), t;
251
260
  }
252
- function M(n, t = !0) {
261
+ function _(r, t = !0) {
253
262
  if (!E())
254
263
  throw c("Device motion API is not supported", "NOT_SUPPORTED");
255
264
  let e = !1, i = null;
@@ -264,12 +273,22 @@ function M(n, t = !0) {
264
273
  const p = a.accelerationIncludingGravity, h = 9.8;
265
274
  u = (p?.x ?? 0) / h, m = (p?.y ?? 0) / h, l = (p?.z ?? 0) / h;
266
275
  }
267
- const y = a.acceleration?.x ?? 0, v = a.acceleration?.y ?? 0, g = a.acceleration?.z ?? 0, [w, f] = P(u, m, d), [O, A] = P(y, v, d), U = {
268
- gravity: { x: w, y: f, z: l },
269
- acceleration: { x: O, y: A, z: g },
276
+ const y = a.acceleration?.x ?? 0, v = a.acceleration?.y ?? 0, g = a.acceleration?.z ?? 0, [w, f] = P(u, m, d), [O, S] = P(y, v, d), M = {
277
+ gravity: {
278
+ x: w,
279
+ y: f,
280
+ z: l
281
+ // Z-axis not affected by screen rotation
282
+ },
283
+ acceleration: {
284
+ x: O,
285
+ y: S,
286
+ z: g
287
+ // Z-axis not affected by screen rotation
288
+ },
270
289
  accelerationIncludingGravity: {
271
290
  x: w + O,
272
- y: f + A,
291
+ y: f + S,
273
292
  z: l + g
274
293
  },
275
294
  rotation: {
@@ -279,60 +298,60 @@ function M(n, t = !0) {
279
298
  },
280
299
  timestamp: Date.now()
281
300
  };
282
- n(U);
283
- }, r = async () => {
301
+ r(M);
302
+ }, n = async () => {
284
303
  t && !await b() || (e = !0, window.addEventListener("devicemotion", o));
285
304
  };
286
305
  return (async () => {
287
306
  if (typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function" && t) {
288
307
  const d = async () => {
289
- i = null, await r();
308
+ i = null, await n();
290
309
  };
291
310
  window.addEventListener("click", d, { once: !0 }), window.addEventListener("touchstart", d, { once: !0 }), i = () => {
292
311
  window.removeEventListener("click", d), window.removeEventListener("touchstart", d);
293
312
  };
294
313
  } else
295
- await r();
314
+ await n();
296
315
  })(), () => {
297
316
  e = !1, window.removeEventListener("devicemotion", o), i && (i(), i = null);
298
317
  };
299
318
  }
300
- function _(n, t, e = 500) {
301
- let i = !1, o = null;
302
- const r = F((a) => {
303
- i || (i = !0, clearTimeout(s)), n(a);
304
- }), s = setTimeout(() => {
305
- i || (console.warn("[Aippy Sensors] No native data, falling back to Web API"), r(), o = M(n, t));
306
- }, e);
307
- return () => {
308
- clearTimeout(s), r(), o?.();
309
- };
310
- }
311
- function K(n, t = !0) {
312
- return R() ? _(n, t) : M(n, t);
319
+ function X(r, t = !0) {
320
+ const e = N();
321
+ return console.log(`🎯 [Aippy Sensors] watchMotion - Using ${e ? "NATIVE BRIDGE" : "WEB API"} mode`), e ? (console.log("📱 [Aippy Sensors] Starting native bridge motion listener"), x(r)) : (console.log("🌐 [Aippy Sensors] Starting Web API motion listener (may require permission)"), _(r, t));
313
322
  }
314
- function X(n) {
315
- if (!N())
323
+ function Y(r) {
324
+ if (!R())
316
325
  throw c("Device orientation API is not supported", "NOT_SUPPORTED");
317
326
  const t = (e) => {
318
- n({
327
+ const i = {
319
328
  alpha: e.alpha ?? 0,
320
329
  beta: e.beta ?? 0,
321
330
  gamma: e.gamma ?? 0,
322
331
  timestamp: Date.now()
323
- });
332
+ };
333
+ r(i);
324
334
  };
325
335
  return window.addEventListener("deviceorientation", t), () => {
326
336
  window.removeEventListener("deviceorientation", t);
327
337
  };
328
338
  }
329
- class z {
339
+ class F {
340
+ /**
341
+ * Check if device orientation is supported
342
+ */
330
343
  isOrientationSupported() {
331
- return N();
344
+ return R();
332
345
  }
346
+ /**
347
+ * Check if device motion is supported
348
+ */
333
349
  isMotionSupported() {
334
350
  return E();
335
351
  }
352
+ /**
353
+ * Get device orientation data
354
+ */
336
355
  async getOrientation() {
337
356
  if (!this.isOrientationSupported())
338
357
  throw c("Device orientation API is not supported", "NOT_SUPPORTED");
@@ -350,7 +369,10 @@ class z {
350
369
  }, 5e3);
351
370
  });
352
371
  }
353
- /** @deprecated Use watchOrientation() instead */
372
+ /**
373
+ * Watch device orientation changes
374
+ * @deprecated Use watchOrientation() function instead
375
+ */
354
376
  watchOrientation(t) {
355
377
  if (!this.isOrientationSupported())
356
378
  throw c("Device orientation API is not supported", "NOT_SUPPORTED");
@@ -366,6 +388,9 @@ class z {
366
388
  window.removeEventListener("deviceorientation", e);
367
389
  };
368
390
  }
391
+ /**
392
+ * Get device motion data
393
+ */
369
394
  async getMotion() {
370
395
  if (!this.isMotionSupported())
371
396
  throw c("Device motion API is not supported", "NOT_SUPPORTED");
@@ -383,7 +408,10 @@ class z {
383
408
  }, 5e3);
384
409
  });
385
410
  }
386
- /** @deprecated Use watchMotion() instead */
411
+ /**
412
+ * Watch device motion changes
413
+ * @deprecated Use watchMotion() function instead
414
+ */
387
415
  watchMotion(t) {
388
416
  if (!this.isMotionSupported())
389
417
  throw c("Device motion API is not supported", "NOT_SUPPORTED");
@@ -399,12 +427,15 @@ class z {
399
427
  window.removeEventListener("devicemotion", e);
400
428
  };
401
429
  }
430
+ /**
431
+ * Request permission for motion sensors (iOS 13+)
432
+ */
402
433
  async requestPermission() {
403
434
  return b();
404
435
  }
405
436
  }
406
- const Y = new z();
407
- class G {
437
+ const B = new F();
438
+ class z {
408
439
  /**
409
440
  * Check if file system access is supported
410
441
  */
@@ -428,16 +459,16 @@ class G {
428
459
  types: t.accept ? [{
429
460
  description: "Files",
430
461
  accept: Object.fromEntries(
431
- t.accept.map((r) => [r, [r]])
462
+ t.accept.map((n) => [n, [n]])
432
463
  )
433
464
  }] : void 0,
434
465
  multiple: t.multiple ?? !1
435
466
  }, i = await window.showOpenFilePicker(e), o = await Promise.all(
436
- i.map(async (r) => r.getFile())
467
+ i.map(async (n) => n.getFile())
437
468
  );
438
469
  return {
439
470
  files: o,
440
- paths: o.map((r) => r.name)
471
+ paths: o.map((n) => n.name)
441
472
  };
442
473
  } catch (e) {
443
474
  throw e instanceof Error && e.name === "AbortError" ? c("File picker was cancelled", "PERMISSION_DENIED") : c(
@@ -454,8 +485,8 @@ class G {
454
485
  throw c("File input is not supported", "NOT_SUPPORTED");
455
486
  return new Promise((e, i) => {
456
487
  const o = document.createElement("input");
457
- o.type = "file", o.multiple = t.multiple ?? !1, o.accept = t.accept?.join(",") ?? "", o.onchange = (r) => {
458
- const s = r.target, a = Array.from(s.files || []);
488
+ o.type = "file", o.multiple = t.multiple ?? !1, o.accept = t.accept?.join(",") ?? "", o.onchange = (n) => {
489
+ const s = n.target, a = Array.from(s.files || []);
459
490
  e({
460
491
  files: a,
461
492
  paths: a.map((d) => d.name)
@@ -504,15 +535,15 @@ class G {
504
535
  });
505
536
  }
506
537
  }
507
- const j = new G();
508
- function $(n) {
538
+ const $ = new z();
539
+ function j(r) {
509
540
  return new Promise((t) => {
510
541
  if ("vibrate" in navigator)
511
- navigator.vibrate(n), t();
542
+ navigator.vibrate(r), t();
512
543
  else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.aippyListener) {
513
544
  const e = {
514
545
  command: "navigator.vibrate",
515
- parameters: n
546
+ parameters: r
516
547
  };
517
548
  window.webkit.messageHandlers.aippyListener.postMessage(e), t();
518
549
  } else
@@ -520,19 +551,19 @@ function $(n) {
520
551
  });
521
552
  }
522
553
  export {
523
- D as CameraAPI,
524
- G as FileSystemAPI,
525
- x as GeolocationAPI,
526
- z as SensorsAPI,
554
+ T as CameraAPI,
555
+ z as FileSystemAPI,
556
+ k as GeolocationAPI,
557
+ F as SensorsAPI,
527
558
  H as camera,
528
- j as fileSystem,
529
- C as geolocation,
530
- R as hasNativeBridge,
559
+ $ as fileSystem,
560
+ K as geolocation,
561
+ N as hasNativeBridge,
531
562
  E as isMotionSupported,
532
- N as isOrientationSupported,
563
+ R as isOrientationSupported,
533
564
  b as requestMotionPermission,
534
- Y as sensors,
535
- $ as vibrate,
536
- K as watchMotion,
537
- X as watchOrientation
565
+ B as sensors,
566
+ j as vibrate,
567
+ X as watchMotion,
568
+ Y as watchOrientation
538
569
  };
@@ -1,24 +1,72 @@
1
+ import { hasNativeBridge } from '../core/native-bridge';
1
2
  import { SensorData, MotionData, OrientationData } from './types';
3
+ export { hasNativeBridge };
4
+ /**
5
+ * Check if device motion is supported
6
+ */
2
7
  export declare function isMotionSupported(): boolean;
8
+ /**
9
+ * Check if device orientation is supported
10
+ */
3
11
  export declare function isOrientationSupported(): boolean;
4
- export declare function hasNativeBridge(): boolean;
5
- /** Request motion sensor permission (iOS 13+) */
12
+ /**
13
+ * Request permission for motion sensors (iOS 13+)
14
+ * @returns Promise<boolean> - true if permission granted
15
+ */
6
16
  export declare function requestMotionPermission(): Promise<boolean>;
7
- /** Watch device motion (auto selects native bridge or Web API) */
17
+ /**
18
+ * Watch device motion changes with full motion data
19
+ * Automatically uses native bridge if available, otherwise falls back to Web API
20
+ *
21
+ * @param callback - Function to call with motion data
22
+ * @param autoRequestPermission - Automatically request permission on iOS (default: true, only for Web API)
23
+ * @returns Cleanup function to stop watching
24
+ */
8
25
  export declare function watchMotion(callback: (data: MotionData) => void, autoRequestPermission?: boolean): () => void;
9
- /** Watch device orientation changes */
26
+ /**
27
+ * Watch device orientation changes
28
+ * @param callback - Function to call with orientation data
29
+ * @returns Cleanup function to stop watching
30
+ */
10
31
  export declare function watchOrientation(callback: (data: OrientationData) => void): () => void;
11
- /** @deprecated Use watchMotion() and watchOrientation() instead */
32
+ /**
33
+ * Legacy SensorsAPI class for backward compatibility
34
+ * @deprecated Use watchMotion() and watchOrientation() functions instead
35
+ */
12
36
  export declare class SensorsAPI {
37
+ /**
38
+ * Check if device orientation is supported
39
+ */
13
40
  isOrientationSupported(): boolean;
41
+ /**
42
+ * Check if device motion is supported
43
+ */
14
44
  isMotionSupported(): boolean;
45
+ /**
46
+ * Get device orientation data
47
+ */
15
48
  getOrientation(): Promise<SensorData>;
16
- /** @deprecated Use watchOrientation() instead */
49
+ /**
50
+ * Watch device orientation changes
51
+ * @deprecated Use watchOrientation() function instead
52
+ */
17
53
  watchOrientation(callback: (data: SensorData) => void): () => void;
54
+ /**
55
+ * Get device motion data
56
+ */
18
57
  getMotion(): Promise<SensorData>;
19
- /** @deprecated Use watchMotion() instead */
58
+ /**
59
+ * Watch device motion changes
60
+ * @deprecated Use watchMotion() function instead
61
+ */
20
62
  watchMotion(callback: (data: SensorData) => void): () => void;
63
+ /**
64
+ * Request permission for motion sensors (iOS 13+)
65
+ */
21
66
  requestPermission(): Promise<boolean>;
22
67
  }
23
- /** @deprecated Use watchMotion() and watchOrientation() instead */
68
+ /**
69
+ * Sensors API instance (for backward compatibility)
70
+ * @deprecated Use watchMotion() and watchOrientation() functions instead
71
+ */
24
72
  export declare const sensors: SensorsAPI;
@@ -0,0 +1,26 @@
1
+ var e = Object.defineProperty;
2
+ var o = (E, R, N) => R in E ? e(E, R, { enumerable: !0, configurable: !0, writable: !0, value: N }) : E[R] = N;
3
+ var O = (E, R, N) => o(E, typeof R != "symbol" ? R + "" : R, N);
4
+ class I extends Error {
5
+ constructor(N, r = "AIPPY_ERROR", t) {
6
+ super(N);
7
+ O(this, "code");
8
+ O(this, "context");
9
+ this.name = "AippyRuntimeError", this.code = r, this.context = t;
10
+ }
11
+ }
12
+ const _ = {
13
+ NOT_SUPPORTED: "NOT_SUPPORTED",
14
+ PERMISSION_DENIED: "PERMISSION_DENIED",
15
+ INVALID_CONFIG: "INVALID_CONFIG",
16
+ NETWORK_ERROR: "NETWORK_ERROR",
17
+ UNKNOWN_ERROR: "UNKNOWN_ERROR"
18
+ };
19
+ function s(E, R = "UNKNOWN_ERROR", N) {
20
+ return new I(E, _[R], N);
21
+ }
22
+ export {
23
+ I as A,
24
+ _ as E,
25
+ s as c
26
+ };