@aippy/runtime 0.2.4-dev.8 → 0.2.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/core/index.js +4 -4
- package/dist/device/index.js +179 -143
- package/dist/device/types.d.ts +20 -1
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as v, A as d, 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,7 +22,7 @@ function c(e) {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
const r = "0.2.4
|
|
25
|
+
const r = "0.2.4", a = {
|
|
26
26
|
version: r
|
|
27
27
|
}, i = a.version, t = "@aippy/runtime";
|
|
28
28
|
function p() {
|
|
@@ -33,8 +33,8 @@ function p() {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
v as AippyRuntime,
|
|
37
|
+
d as AippyRuntimeError,
|
|
38
38
|
u as Cancellable,
|
|
39
39
|
s as DEFAULT_CONFIG,
|
|
40
40
|
A as ERROR_CODES,
|
package/dist/device/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { c as s, b as
|
|
5
|
-
class
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var L = (n, t, e) => t in n ? U(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var S = (n, t, e) => L(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { c as s, b as D } from "../runtime-DjBdOttl.js";
|
|
5
|
+
class k {
|
|
6
6
|
constructor() {
|
|
7
|
-
|
|
7
|
+
S(this, "stream", null);
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Check if camera is supported
|
|
@@ -47,14 +47,14 @@ class P {
|
|
|
47
47
|
if (!o)
|
|
48
48
|
throw s("Failed to get canvas context", "UNKNOWN_ERROR");
|
|
49
49
|
i.width = t.width || e.videoWidth, i.height = t.height || e.videoHeight, o.drawImage(e, 0, 0, i.width, i.height);
|
|
50
|
-
const
|
|
51
|
-
i.toBlob((
|
|
52
|
-
|
|
53
|
-
}, `image/${
|
|
54
|
-
}),
|
|
50
|
+
const r = t.format || "jpeg", c = t.quality === "high" ? 0.9 : t.quality === "medium" ? 0.7 : 0.5, a = await new Promise((u, m) => {
|
|
51
|
+
i.toBlob((l) => {
|
|
52
|
+
l ? u(l) : m(new Error("Failed to create blob"));
|
|
53
|
+
}, `image/${r}`, c);
|
|
54
|
+
}), d = i.toDataURL(`image/${r}`, c);
|
|
55
55
|
return {
|
|
56
|
-
blob:
|
|
57
|
-
dataUrl:
|
|
56
|
+
blob: a,
|
|
57
|
+
dataUrl: d,
|
|
58
58
|
width: i.width,
|
|
59
59
|
height: i.height
|
|
60
60
|
};
|
|
@@ -72,8 +72,8 @@ class P {
|
|
|
72
72
|
this.stream && (this.stream.getTracks().forEach((t) => t.stop()), this.stream = null);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
class
|
|
75
|
+
const W = new k();
|
|
76
|
+
class T {
|
|
77
77
|
/**
|
|
78
78
|
* Check if geolocation is supported
|
|
79
79
|
*/
|
|
@@ -93,33 +93,33 @@ class O {
|
|
|
93
93
|
maximumAge: t.maximumAge ?? 6e4
|
|
94
94
|
};
|
|
95
95
|
navigator.geolocation.getCurrentPosition(
|
|
96
|
-
(
|
|
97
|
-
const
|
|
98
|
-
latitude:
|
|
99
|
-
longitude:
|
|
100
|
-
accuracy:
|
|
101
|
-
altitude:
|
|
102
|
-
altitudeAccuracy:
|
|
103
|
-
heading:
|
|
104
|
-
speed:
|
|
105
|
-
timestamp:
|
|
96
|
+
(r) => {
|
|
97
|
+
const c = {
|
|
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
|
|
106
106
|
};
|
|
107
|
-
e(
|
|
107
|
+
e(c);
|
|
108
108
|
},
|
|
109
|
-
(
|
|
110
|
-
let
|
|
111
|
-
switch (
|
|
112
|
-
case
|
|
113
|
-
|
|
109
|
+
(r) => {
|
|
110
|
+
let c = "UNKNOWN_ERROR", a = "Unknown geolocation error";
|
|
111
|
+
switch (r.code) {
|
|
112
|
+
case r.PERMISSION_DENIED:
|
|
113
|
+
c = "PERMISSION_DENIED", a = "Geolocation permission denied";
|
|
114
114
|
break;
|
|
115
|
-
case
|
|
116
|
-
|
|
115
|
+
case r.POSITION_UNAVAILABLE:
|
|
116
|
+
a = "Position unavailable";
|
|
117
117
|
break;
|
|
118
|
-
case
|
|
119
|
-
|
|
118
|
+
case r.TIMEOUT:
|
|
119
|
+
a = "Geolocation timeout";
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
|
-
i(s(
|
|
122
|
+
i(s(a, c));
|
|
123
123
|
},
|
|
124
124
|
o
|
|
125
125
|
);
|
|
@@ -138,7 +138,7 @@ class O {
|
|
|
138
138
|
};
|
|
139
139
|
return navigator.geolocation.watchPosition(
|
|
140
140
|
(o) => {
|
|
141
|
-
const
|
|
141
|
+
const r = {
|
|
142
142
|
latitude: o.coords.latitude,
|
|
143
143
|
longitude: o.coords.longitude,
|
|
144
144
|
accuracy: o.coords.accuracy,
|
|
@@ -148,7 +148,7 @@ class O {
|
|
|
148
148
|
speed: o.coords.speed ?? void 0,
|
|
149
149
|
timestamp: o.timestamp
|
|
150
150
|
};
|
|
151
|
-
t(
|
|
151
|
+
t(r);
|
|
152
152
|
},
|
|
153
153
|
(o) => {
|
|
154
154
|
console.error("Geolocation watch error:", o);
|
|
@@ -163,137 +163,173 @@ class O {
|
|
|
163
163
|
navigator.geolocation.clearWatch(t);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
166
|
+
const H = new T();
|
|
167
|
+
function E() {
|
|
168
168
|
return "DeviceMotionEvent" in window;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function N() {
|
|
171
171
|
return "DeviceOrientationEvent" in window;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
const
|
|
173
|
+
function R() {
|
|
174
|
+
const n = typeof window < "u", t = n && !!window.webkit, e = t && !!window.webkit?.messageHandlers, i = e && !!window.webkit?.messageHandlers?.aippyListener;
|
|
175
175
|
return console.log("🔍 [Aippy Sensors] hasNativeBridge check:", {
|
|
176
|
-
hasWindow:
|
|
176
|
+
hasWindow: n,
|
|
177
177
|
hasWebkit: t,
|
|
178
178
|
hasMessageHandlers: e,
|
|
179
179
|
hasAippyListener: i,
|
|
180
180
|
result: i
|
|
181
181
|
}), i;
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
function I() {
|
|
184
|
+
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
|
+
}
|
|
186
|
+
function P(n, t, e) {
|
|
187
|
+
switch (e) {
|
|
188
|
+
case 0:
|
|
189
|
+
return [n, -t];
|
|
190
|
+
case 180:
|
|
191
|
+
return [-n, t];
|
|
192
|
+
case 90:
|
|
193
|
+
return [-t, n];
|
|
194
|
+
case -90:
|
|
195
|
+
return [t, -n];
|
|
196
|
+
default:
|
|
197
|
+
return [n, -t];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async function b() {
|
|
201
|
+
if (console.log("🔐 [Aippy Sensors] requestMotionPermission called"), R())
|
|
185
202
|
return console.log("✅ [Aippy Sensors] Native bridge available, skipping permission request"), !0;
|
|
186
|
-
if (!
|
|
203
|
+
if (!E())
|
|
187
204
|
return console.warn("❌ [Aippy Sensors] Device motion not supported"), !1;
|
|
188
|
-
const
|
|
189
|
-
if (console.log("🔍 [Aippy Sensors] Permission API available:",
|
|
205
|
+
const n = typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function";
|
|
206
|
+
if (console.log("🔍 [Aippy Sensors] Permission API available:", n), n)
|
|
190
207
|
try {
|
|
191
208
|
console.log("🙏 [Aippy Sensors] Requesting device motion permission...");
|
|
192
209
|
const t = await DeviceMotionEvent.requestPermission();
|
|
193
210
|
return console.log("📋 [Aippy Sensors] Permission result:", t), t === "granted";
|
|
194
211
|
} catch (t) {
|
|
195
|
-
return console.
|
|
212
|
+
return console.warn("❌ [Aippy Sensors] Permission request failed:", t), !1;
|
|
196
213
|
}
|
|
197
214
|
return console.log("✅ [Aippy Sensors] No permission needed (granted by default)"), !0;
|
|
198
215
|
}
|
|
199
|
-
function
|
|
216
|
+
function x(n) {
|
|
200
217
|
console.log("🔧 [Aippy Sensors] watchMotionNative - Setting up native bridge listener");
|
|
201
|
-
const t =
|
|
202
|
-
const i =
|
|
218
|
+
const t = D.addMotionListener((e) => {
|
|
219
|
+
const i = I(), o = e.gravity?.x ?? 0, r = e.gravity?.y ?? 0, c = 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";
|
|
220
|
+
let w = 0;
|
|
221
|
+
g && (w = e.attitude.yaw * (180 / Math.PI), w < 0 && (w += 360));
|
|
222
|
+
const f = {
|
|
203
223
|
gravity: {
|
|
204
|
-
x:
|
|
205
|
-
y:
|
|
206
|
-
z:
|
|
224
|
+
x: m,
|
|
225
|
+
y: l,
|
|
226
|
+
z: c
|
|
227
|
+
// Z-axis not affected by screen rotation
|
|
207
228
|
},
|
|
208
229
|
acceleration: {
|
|
209
|
-
x:
|
|
210
|
-
y:
|
|
211
|
-
z:
|
|
230
|
+
x: y,
|
|
231
|
+
y: v,
|
|
232
|
+
z: u
|
|
233
|
+
// Z-axis not affected by screen rotation
|
|
212
234
|
},
|
|
213
235
|
accelerationIncludingGravity: {
|
|
214
|
-
x:
|
|
215
|
-
y:
|
|
216
|
-
z:
|
|
236
|
+
x: m + y,
|
|
237
|
+
y: l + v,
|
|
238
|
+
z: c + u
|
|
217
239
|
},
|
|
240
|
+
// iOS native uses rotationRate.x/y/z (rad/s)
|
|
241
|
+
// Convert to rotation.alpha/beta/gamma (deg/s)
|
|
218
242
|
rotation: {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
243
|
+
// If attitude is available, use yaw for alpha (compass heading)
|
|
244
|
+
// Otherwise fallback to rotationRate.z (angular velocity)
|
|
245
|
+
alpha: g ? w : (e.rotationRate?.z ?? 0) * (180 / Math.PI),
|
|
246
|
+
beta: (e.rotationRate?.x ?? 0) * (180 / Math.PI),
|
|
247
|
+
// x -> beta (around X-axis)
|
|
248
|
+
gamma: (e.rotationRate?.y ?? 0) * (180 / Math.PI)
|
|
249
|
+
// y -> gamma (around Y-axis)
|
|
222
250
|
},
|
|
251
|
+
// Add attitude data for more precise orientation info
|
|
252
|
+
attitude: g ? {
|
|
253
|
+
yaw: w,
|
|
254
|
+
pitch: e.attitude.pitch * (180 / Math.PI),
|
|
255
|
+
roll: e.attitude.roll * (180 / Math.PI),
|
|
256
|
+
quaternion: e.attitude.quaternion ? {
|
|
257
|
+
x: e.attitude.quaternion.x,
|
|
258
|
+
y: e.attitude.quaternion.y,
|
|
259
|
+
z: e.attitude.quaternion.z,
|
|
260
|
+
w: e.attitude.quaternion.w
|
|
261
|
+
} : void 0
|
|
262
|
+
} : void 0,
|
|
223
263
|
timestamp: Date.now()
|
|
224
264
|
};
|
|
225
|
-
|
|
265
|
+
n(f);
|
|
226
266
|
});
|
|
227
267
|
return console.log("✅ [Aippy Sensors] watchMotionNative - Listener setup complete"), t;
|
|
228
268
|
}
|
|
229
|
-
function
|
|
230
|
-
if (!
|
|
269
|
+
function _(n, t = !0) {
|
|
270
|
+
if (!E())
|
|
231
271
|
throw s("Device motion API is not supported", "NOT_SUPPORTED");
|
|
232
272
|
let e = !1, i = null;
|
|
233
|
-
const o = (
|
|
273
|
+
const o = (a) => {
|
|
234
274
|
if (!e) return;
|
|
235
|
-
const
|
|
275
|
+
const d = I();
|
|
276
|
+
let u, m, l;
|
|
277
|
+
if (a.acceleration) {
|
|
278
|
+
const p = a.accelerationIncludingGravity, h = a.acceleration;
|
|
279
|
+
u = (p?.x ?? 0) - (h?.x ?? 0), m = (p?.y ?? 0) - (h?.y ?? 0), l = (p?.z ?? 0) - (h?.z ?? 0);
|
|
280
|
+
} else {
|
|
281
|
+
const p = a.accelerationIncludingGravity, h = 9.8;
|
|
282
|
+
u = (p?.x ?? 0) / h, m = (p?.y ?? 0) / h, l = (p?.z ?? 0) / h;
|
|
283
|
+
}
|
|
284
|
+
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), M = {
|
|
236
285
|
gravity: {
|
|
237
|
-
x:
|
|
238
|
-
y:
|
|
239
|
-
z:
|
|
286
|
+
x: w,
|
|
287
|
+
y: f,
|
|
288
|
+
z: l
|
|
289
|
+
// Z-axis not affected by screen rotation
|
|
240
290
|
},
|
|
241
291
|
acceleration: {
|
|
242
|
-
x:
|
|
243
|
-
y:
|
|
244
|
-
z:
|
|
292
|
+
x: O,
|
|
293
|
+
y: A,
|
|
294
|
+
z: g
|
|
295
|
+
// Z-axis not affected by screen rotation
|
|
245
296
|
},
|
|
246
297
|
accelerationIncludingGravity: {
|
|
247
|
-
x:
|
|
248
|
-
y:
|
|
249
|
-
z:
|
|
298
|
+
x: w + O,
|
|
299
|
+
y: f + A,
|
|
300
|
+
z: l + g
|
|
250
301
|
},
|
|
251
302
|
rotation: {
|
|
252
|
-
alpha:
|
|
253
|
-
beta:
|
|
254
|
-
gamma:
|
|
303
|
+
alpha: a.rotationRate?.alpha ?? 0,
|
|
304
|
+
beta: a.rotationRate?.beta ?? 0,
|
|
305
|
+
gamma: a.rotationRate?.gamma ?? 0
|
|
255
306
|
},
|
|
256
307
|
timestamp: Date.now()
|
|
257
308
|
};
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
x: (l?.x ?? 0) - (u?.x ?? 0),
|
|
262
|
-
y: (l?.y ?? 0) - (u?.y ?? 0),
|
|
263
|
-
z: (l?.z ?? 0) - (u?.z ?? 0)
|
|
264
|
-
};
|
|
265
|
-
} else {
|
|
266
|
-
const l = r.accelerationIncludingGravity, u = 9.8;
|
|
267
|
-
c.gravity = {
|
|
268
|
-
x: (l?.x ?? 0) / u,
|
|
269
|
-
y: (l?.y ?? 0) / u,
|
|
270
|
-
z: (l?.z ?? 0) / u
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
a(c);
|
|
274
|
-
}, n = async () => {
|
|
275
|
-
t && !await y() || (e = !0, window.addEventListener("devicemotion", o));
|
|
309
|
+
n(M);
|
|
310
|
+
}, r = async () => {
|
|
311
|
+
t && !await b() || (e = !0, window.addEventListener("devicemotion", o));
|
|
276
312
|
};
|
|
277
313
|
return (async () => {
|
|
278
314
|
if (typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function" && t) {
|
|
279
|
-
const
|
|
280
|
-
i = null, await
|
|
315
|
+
const d = async () => {
|
|
316
|
+
i = null, await r();
|
|
281
317
|
};
|
|
282
|
-
window.addEventListener("click",
|
|
283
|
-
window.removeEventListener("click",
|
|
318
|
+
window.addEventListener("click", d, { once: !0 }), window.addEventListener("touchstart", d, { once: !0 }), i = () => {
|
|
319
|
+
window.removeEventListener("click", d), window.removeEventListener("touchstart", d);
|
|
284
320
|
};
|
|
285
321
|
} else
|
|
286
|
-
await
|
|
322
|
+
await r();
|
|
287
323
|
})(), () => {
|
|
288
324
|
e = !1, window.removeEventListener("devicemotion", o), i && (i(), i = null);
|
|
289
325
|
};
|
|
290
326
|
}
|
|
291
|
-
function
|
|
292
|
-
const e =
|
|
293
|
-
return console.log(`🎯 [Aippy Sensors] watchMotion - Using ${e ? "NATIVE BRIDGE" : "WEB API"} mode`), e ? (console.log("📱 [Aippy Sensors] Starting native bridge motion listener"),
|
|
327
|
+
function C(n, t = !0) {
|
|
328
|
+
const e = R();
|
|
329
|
+
return console.log(`🎯 [Aippy Sensors] watchMotion - Using ${e ? "NATIVE BRIDGE" : "WEB API"} mode`), e ? (console.log("📱 [Aippy Sensors] Starting native bridge motion listener"), x(n)) : (console.log("🌐 [Aippy Sensors] Starting Web API motion listener (may require permission)"), _(n, t));
|
|
294
330
|
}
|
|
295
|
-
function
|
|
296
|
-
if (!
|
|
331
|
+
function B(n) {
|
|
332
|
+
if (!N())
|
|
297
333
|
throw s("Device orientation API is not supported", "NOT_SUPPORTED");
|
|
298
334
|
const t = (e) => {
|
|
299
335
|
const i = {
|
|
@@ -302,24 +338,24 @@ function L(a) {
|
|
|
302
338
|
gamma: e.gamma ?? 0,
|
|
303
339
|
timestamp: Date.now()
|
|
304
340
|
};
|
|
305
|
-
|
|
341
|
+
n(i);
|
|
306
342
|
};
|
|
307
343
|
return window.addEventListener("deviceorientation", t), () => {
|
|
308
344
|
window.removeEventListener("deviceorientation", t);
|
|
309
345
|
};
|
|
310
346
|
}
|
|
311
|
-
class
|
|
347
|
+
class F {
|
|
312
348
|
/**
|
|
313
349
|
* Check if device orientation is supported
|
|
314
350
|
*/
|
|
315
351
|
isOrientationSupported() {
|
|
316
|
-
return
|
|
352
|
+
return N();
|
|
317
353
|
}
|
|
318
354
|
/**
|
|
319
355
|
* Check if device motion is supported
|
|
320
356
|
*/
|
|
321
357
|
isMotionSupported() {
|
|
322
|
-
return
|
|
358
|
+
return E();
|
|
323
359
|
}
|
|
324
360
|
/**
|
|
325
361
|
* Get device orientation data
|
|
@@ -403,11 +439,11 @@ class A {
|
|
|
403
439
|
* Request permission for motion sensors (iOS 13+)
|
|
404
440
|
*/
|
|
405
441
|
async requestPermission() {
|
|
406
|
-
return
|
|
442
|
+
return b();
|
|
407
443
|
}
|
|
408
444
|
}
|
|
409
|
-
const
|
|
410
|
-
class
|
|
445
|
+
const K = new F();
|
|
446
|
+
class z {
|
|
411
447
|
/**
|
|
412
448
|
* Check if file system access is supported
|
|
413
449
|
*/
|
|
@@ -431,16 +467,16 @@ class R {
|
|
|
431
467
|
types: t.accept ? [{
|
|
432
468
|
description: "Files",
|
|
433
469
|
accept: Object.fromEntries(
|
|
434
|
-
t.accept.map((
|
|
470
|
+
t.accept.map((r) => [r, [r]])
|
|
435
471
|
)
|
|
436
472
|
}] : void 0,
|
|
437
473
|
multiple: t.multiple ?? !1
|
|
438
474
|
}, i = await window.showOpenFilePicker(e), o = await Promise.all(
|
|
439
|
-
i.map(async (
|
|
475
|
+
i.map(async (r) => r.getFile())
|
|
440
476
|
);
|
|
441
477
|
return {
|
|
442
478
|
files: o,
|
|
443
|
-
paths: o.map((
|
|
479
|
+
paths: o.map((r) => r.name)
|
|
444
480
|
};
|
|
445
481
|
} catch (e) {
|
|
446
482
|
throw e instanceof Error && e.name === "AbortError" ? s("File picker was cancelled", "PERMISSION_DENIED") : s(
|
|
@@ -457,11 +493,11 @@ class R {
|
|
|
457
493
|
throw s("File input is not supported", "NOT_SUPPORTED");
|
|
458
494
|
return new Promise((e, i) => {
|
|
459
495
|
const o = document.createElement("input");
|
|
460
|
-
o.type = "file", o.multiple = t.multiple ?? !1, o.accept = t.accept?.join(",") ?? "", o.onchange = (
|
|
461
|
-
const
|
|
496
|
+
o.type = "file", o.multiple = t.multiple ?? !1, o.accept = t.accept?.join(",") ?? "", o.onchange = (r) => {
|
|
497
|
+
const c = r.target, a = Array.from(c.files || []);
|
|
462
498
|
e({
|
|
463
|
-
files:
|
|
464
|
-
paths:
|
|
499
|
+
files: a,
|
|
500
|
+
paths: a.map((d) => d.name)
|
|
465
501
|
});
|
|
466
502
|
}, o.oncancel = () => {
|
|
467
503
|
i(s("File picker was cancelled", "PERMISSION_DENIED"));
|
|
@@ -507,15 +543,15 @@ class R {
|
|
|
507
543
|
});
|
|
508
544
|
}
|
|
509
545
|
}
|
|
510
|
-
const
|
|
511
|
-
function
|
|
546
|
+
const X = new z();
|
|
547
|
+
function Y(n) {
|
|
512
548
|
return new Promise((t) => {
|
|
513
549
|
if ("vibrate" in navigator)
|
|
514
|
-
navigator.vibrate(
|
|
550
|
+
navigator.vibrate(n), t();
|
|
515
551
|
else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.aippyListener) {
|
|
516
552
|
const e = {
|
|
517
553
|
command: "navigator.vibrate",
|
|
518
|
-
parameters:
|
|
554
|
+
parameters: n
|
|
519
555
|
};
|
|
520
556
|
window.webkit.messageHandlers.aippyListener.postMessage(e), t();
|
|
521
557
|
} else
|
|
@@ -523,19 +559,19 @@ function T(a) {
|
|
|
523
559
|
});
|
|
524
560
|
}
|
|
525
561
|
export {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
562
|
+
k as CameraAPI,
|
|
563
|
+
z as FileSystemAPI,
|
|
564
|
+
T as GeolocationAPI,
|
|
565
|
+
F as SensorsAPI,
|
|
566
|
+
W as camera,
|
|
567
|
+
X as fileSystem,
|
|
568
|
+
H as geolocation,
|
|
569
|
+
R as hasNativeBridge,
|
|
570
|
+
E as isMotionSupported,
|
|
571
|
+
N as isOrientationSupported,
|
|
572
|
+
b as requestMotionPermission,
|
|
573
|
+
K as sensors,
|
|
574
|
+
Y as vibrate,
|
|
575
|
+
C as watchMotion,
|
|
576
|
+
B as watchOrientation
|
|
541
577
|
};
|
package/dist/device/types.d.ts
CHANGED
|
@@ -77,12 +77,31 @@ export interface MotionData {
|
|
|
77
77
|
y: number;
|
|
78
78
|
z: number;
|
|
79
79
|
};
|
|
80
|
-
/** Rotation rate (deg/s) */
|
|
80
|
+
/** Rotation rate (deg/s) - Angular velocity */
|
|
81
81
|
rotation: {
|
|
82
82
|
alpha: number;
|
|
83
83
|
beta: number;
|
|
84
84
|
gamma: number;
|
|
85
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Device attitude/orientation (degrees) - Absolute orientation
|
|
88
|
+
* Available when iOS native bridge provides CMDeviceMotion.attitude data
|
|
89
|
+
*/
|
|
90
|
+
attitude?: {
|
|
91
|
+
/** Rotation around Z axis (0-360°) - Compass heading */
|
|
92
|
+
yaw: number;
|
|
93
|
+
/** Rotation around X axis - Forward/backward tilt */
|
|
94
|
+
pitch: number;
|
|
95
|
+
/** Rotation around Y axis - Left/right tilt */
|
|
96
|
+
roll: number;
|
|
97
|
+
/** Quaternion representation (optional) */
|
|
98
|
+
quaternion?: {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
z: number;
|
|
102
|
+
w: number;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
86
105
|
/** Timestamp */
|
|
87
106
|
timestamp: number;
|
|
88
107
|
}
|