@omnidotdev/rdk 0.7.0 → 0.9.0

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.
Files changed (45) hide show
  1. package/build/ImmersiveSession-BiX-Du0K.cjs +1 -0
  2. package/build/ImmersiveSession-CJRYdHjb.js +21 -0
  3. package/build/WorldAnchor-gszXX9H2.cjs +1 -0
  4. package/build/WorldAnchor-ur1RjMrN.js +167 -0
  5. package/build/fiducial.cjs +1 -0
  6. package/build/fiducial.d.ts +2 -0
  7. package/build/fiducial.js +7 -0
  8. package/build/fiducialBackend-Cr8mdwro.cjs +1 -0
  9. package/build/fiducialBackend-Vj5N1epW.js +180 -0
  10. package/build/geolocation/GeoLine.d.ts +36 -0
  11. package/build/geolocation/GeoLine.d.ts.map +1 -0
  12. package/build/geolocation/GeoPolygon.d.ts +35 -0
  13. package/build/geolocation/GeoPolygon.d.ts.map +1 -0
  14. package/build/geolocation/geolocationBackend.d.ts +2 -1
  15. package/build/geolocation/geolocationBackend.d.ts.map +1 -1
  16. package/build/geolocation/index.d.ts +4 -0
  17. package/build/geolocation/index.d.ts.map +1 -1
  18. package/build/geolocation.cjs +1 -0
  19. package/build/geolocation.d.ts +2 -0
  20. package/build/geolocation.js +9 -0
  21. package/build/geolocationBackend-BkS2-zqx.cjs +1 -0
  22. package/build/geolocationBackend-BxwE8Vcl.js +338 -0
  23. package/build/immersive.cjs +1 -0
  24. package/build/immersive.d.ts +2 -0
  25. package/build/immersive.js +4 -0
  26. package/build/index.cjs +1 -1
  27. package/build/index.d.ts +1 -0
  28. package/build/index.d.ts.map +1 -1
  29. package/build/index.js +31 -533
  30. package/build/lib/types/engine/backend/Backend.interface.d.ts +1 -0
  31. package/build/lib/types/engine/backend/Backend.interface.d.ts.map +1 -1
  32. package/build/magic/MagicSession.d.ts +14 -0
  33. package/build/magic/MagicSession.d.ts.map +1 -0
  34. package/build/magic/WorldAnchor.d.ts +21 -0
  35. package/build/magic/WorldAnchor.d.ts.map +1 -0
  36. package/build/magic/index.d.ts +7 -0
  37. package/build/magic/index.d.ts.map +1 -0
  38. package/build/magic/magicBackend.d.ts +57 -0
  39. package/build/magic/magicBackend.d.ts.map +1 -0
  40. package/build/magic.cjs +1 -0
  41. package/build/magic.d.ts +2 -0
  42. package/build/magic.js +6 -0
  43. package/build/useXRStore-eThHhTNv.js +149 -0
  44. package/build/useXRStore-emhiLtDT.cjs +1 -0
  45. package/package.json +24 -4
package/build/index.js CHANGED
@@ -1,536 +1,34 @@
1
- import y, { useRef as b, useEffect as k, useState as P, useMemo as F, useCallback as M } from "react";
2
- import { useFrame as R, useThree as v, createPortal as G } from "@react-three/fiber";
3
- import { jsx as C } from "react/jsx-runtime";
4
- import { ArMarkerControls as x, ArToolkitSource as B, ArToolkitContext as N } from "@ar-js-org/ar.js/three.js/build/ar-threex";
5
- import { Group as D } from "three";
6
- import { LocationBased as U, Webcam as X, DeviceOrientationControls as H } from "locar";
7
- import { createXRStore as W, XR as q } from "@react-three/xr";
8
- const p = {
9
- FIDUCIAL: "fiducial",
10
- GEOLOCATION: "geolocation",
11
- IMMERSIVE: "immersive"
12
- }, L = (n) => {
13
- let e;
14
- const t = /* @__PURE__ */ new Set(), r = (a, f) => {
15
- const l = typeof a == "function" ? a(e) : a;
16
- if (!Object.is(l, e)) {
17
- const o = e;
18
- e = f ?? (typeof l != "object" || l === null) ? l : Object.assign({}, e, l), t.forEach((d) => d(e, o));
19
- }
20
- }, c = () => e, s = { setState: r, getState: c, getInitialState: () => u, subscribe: (a) => (t.add(a), () => t.delete(a)) }, u = e = n(r, c, s);
21
- return s;
22
- }, K = ((n) => n ? L(n) : L), V = (n) => n;
23
- function Q(n, e = V) {
24
- const t = y.useSyncExternalStore(
25
- n.subscribe,
26
- y.useCallback(() => e(n.getState()), [n, e]),
27
- y.useCallback(() => e(n.getInitialState()), [n, e])
28
- );
29
- return y.useDebugValue(t), t;
30
- }
31
- const Y = (n) => {
32
- const e = K(n), t = (r) => Q(e, r);
33
- return Object.assign(t, e), t;
34
- }, _ = ((n) => Y), J = (n) => (e, t, r) => {
35
- const c = r.subscribe;
36
- return r.subscribe = ((A, s, u) => {
37
- let a = A;
38
- if (s) {
39
- const f = u?.equalityFn || Object.is;
40
- let l = A(r.getState());
41
- a = (o) => {
42
- const d = A(o);
43
- if (!f(l, d)) {
44
- const S = l;
45
- s(l = d, S);
46
- }
47
- }, u?.fireImmediately && s(l, l);
48
- }
49
- return c(a);
50
- }), n(e, t, r);
51
- }, $ = J, T = (n) => Symbol.iterator in n, j = (n) => (
52
- // HACK: avoid checking entries type
53
- "entries" in n
54
- ), z = (n, e) => {
55
- const t = n instanceof Map ? n : new Map(n.entries()), r = e instanceof Map ? e : new Map(e.entries());
56
- if (t.size !== r.size)
57
- return !1;
58
- for (const [c, i] of t)
59
- if (!r.has(c) || !Object.is(i, r.get(c)))
60
- return !1;
61
- return !0;
62
- }, Z = (n, e) => {
63
- const t = n[Symbol.iterator](), r = e[Symbol.iterator]();
64
- let c = t.next(), i = r.next();
65
- for (; !c.done && !i.done; ) {
66
- if (!Object.is(c.value, i.value))
67
- return !1;
68
- c = t.next(), i = r.next();
69
- }
70
- return !!c.done && !!i.done;
71
- };
72
- function ee(n, e) {
73
- return Object.is(n, e) ? !0 : typeof n != "object" || n === null || typeof e != "object" || e === null || Object.getPrototypeOf(n) !== Object.getPrototypeOf(e) ? !1 : T(n) && T(e) ? j(n) && j(e) ? z(n, e) : Z(n, e) : z(
74
- { entries: () => Object.entries(n) },
75
- { entries: () => Object.entries(e) }
76
- );
77
- }
78
- function te(n) {
79
- const e = y.useRef(void 0);
80
- return (t) => {
81
- const r = n(t);
82
- return ee(e.current, r) ? e.current : e.current = r;
83
- };
84
- }
85
- const O = _()(
86
- $((n, e) => ({
87
- // initial state
88
- video: null,
89
- backends: /* @__PURE__ */ new Map(),
90
- immersiveStore: null,
91
- // actions
92
- registerBackend: async (t, r) => {
93
- try {
94
- const c = e(), i = new Set(c.backends.keys()), A = i.has(p.FIDUCIAL) || t.type === p.FIDUCIAL, s = i.has(p.GEOLOCATION) || t.type === p.GEOLOCATION;
95
- if (A && s) {
96
- const u = "❌ [RDK] INCOMPATIBLE SESSIONS: fiducial and geolocation backends cannot be used together due to camera/video conflicts between AR.js and LocAR.js libraries. Use only one session type per app.";
97
- throw console.error(u), new Error(u);
98
- }
99
- await t.init({
100
- scene: r.scene,
101
- camera: r.camera,
102
- renderer: r.renderer
103
- }), n((u) => {
104
- const a = new Map(u.backends);
105
- return a.set(t.type, t), { backends: a };
106
- });
107
- } catch (c) {
108
- throw console.error("[XRStore] Failed to register backend:", c), c;
109
- }
110
- },
111
- unregisterBackend: (t) => {
112
- n((r) => {
113
- const c = new Map(r.backends);
114
- c.delete(t.type);
115
- try {
116
- t.dispose?.();
117
- } catch (i) {
118
- console.error("[XRStore] Error disposing backend:", i);
119
- }
120
- return { backends: c };
121
- });
122
- },
123
- setVideo: (t) => {
124
- n({ video: t });
125
- },
126
- updateBackends: (t) => {
127
- const { backends: r } = e();
128
- for (const c of r.values())
129
- try {
130
- c.update?.(t);
131
- } catch (i) {
132
- console.error("[XRStore] Backend update error:", i);
133
- }
134
- },
135
- setImmersiveStore: (t) => {
136
- n({ immersiveStore: t });
137
- }
138
- }))
139
- ), ne = () => O.getState(), be = O.subscribe, I = (n) => O(
140
- te((t) => {
141
- const r = {
142
- ...t,
143
- isImmersive: t.backends.has(p.IMMERSIVE),
144
- immersive: t.immersiveStore || null
145
- };
146
- return n ? n(r) : r;
147
- })
148
- ), ge = ({ children: n }) => {
149
- const { updateBackends: e } = I();
150
- return R((t, r) => {
151
- e(r);
152
- }), n;
153
- }, re = {
154
- isPending: !0,
155
- isSuccess: !1,
156
- arSource: null,
157
- arContext: null
158
- }, oe = () => {
159
- const e = I((t) => t.backends).get(p.FIDUCIAL);
160
- return e ? {
161
- ...e.getInternal(),
162
- isPending: !1,
163
- isSuccess: !0
164
- } : re;
165
- }, he = ({
166
- patternUrl: n,
167
- barcodeValue: e,
168
- params: t,
169
- onMarkerFound: r,
170
- onMarkerLost: c,
171
- children: i
172
- }) => {
173
- const A = b(null), s = oe(), u = b(!1), a = b(!1), f = b(null);
174
- return k(() => {
175
- if (!s.isSuccess) return;
176
- let l = !1;
177
- return (() => {
178
- try {
179
- const { arContext: d } = s, S = A.current;
180
- if (!d || !S || l) return;
181
- if (S.visible = !1, a.current = !1, !d.arController) {
182
- requestAnimationFrame(() => {
183
- if (!A.current || l || !s.arContext?.arController)
184
- return;
185
- const g = new x(
186
- s.arContext,
187
- A.current,
188
- {
189
- type: n ? "pattern" : e ? "barcode" : "unknown",
190
- patternUrl: n,
191
- barcodeValue: e,
192
- ...t
193
- }
194
- );
195
- f.current = g, a.current = !0;
196
- });
197
- return;
198
- }
199
- const h = new x(d, S, {
200
- type: n ? "pattern" : e ? "barcode" : "unknown",
201
- patternUrl: n,
202
- barcodeValue: e,
203
- ...t
204
- });
205
- f.current = h, a.current = !0;
206
- } catch (d) {
207
- console.error("Failed to initialize fiducial anchor:", d);
208
- }
209
- })(), () => {
210
- l = !0;
211
- const d = f.current;
212
- typeof d?.dispose == "function" && d.dispose(), a.current = !1;
213
- };
214
- }, [
215
- s.isSuccess,
216
- s.arContext,
217
- n,
218
- e,
219
- t,
220
- s
221
- ]), R(() => {
222
- const l = A.current;
223
- if (!l || !a.current) {
224
- l && (l.visible = !1);
225
- return;
226
- }
227
- const o = l.visible;
228
- o && !u.current ? (u.current = !0, r?.()) : !o && u.current && (u.current = !1, c?.());
229
- }), /* @__PURE__ */ C(
230
- "group",
231
- {
232
- ref: A,
233
- visible: !1,
234
- children: i
235
- }
236
- );
237
- }, we = ({ options: n = {}, children: e }) => {
238
- const { scene: t, camera: r, gl: c } = v(), { registerBackend: i, unregisterBackend: A } = I(), s = b(null), u = b(n);
239
- return u.current = n, k(() => {
240
- if (s.current) return;
241
- let a = !1;
242
- return (async () => {
243
- try {
244
- const l = se(u.current);
245
- if (a) return;
246
- await i(l, { scene: t, camera: r, renderer: c }), s.current = l;
247
- } catch (l) {
248
- console.error("[FiducialSession] Failed to initialize:", l);
249
- }
250
- })(), () => {
251
- a = !0, s.current && (A(s.current), s.current = null);
252
- };
253
- }, [t, r, c, i, A]), e;
254
- }, se = (n) => {
255
- let e = null, t = null, r = null, c;
256
- return {
257
- type: p.FIDUCIAL,
258
- async init({ camera: i, renderer: A }) {
259
- e = new B({
260
- sourceType: n?.sourceType ?? "webcam"
261
- }), await new Promise((a, f) => {
262
- const l = setTimeout(() => {
263
- f(new Error("AR source initialization timeout"));
264
- }, 1e4);
265
- e?.init(() => {
266
- clearTimeout(l);
267
- const o = e?.domElement;
268
- o && (o.style.position = "fixed", o.style.top = "0", o.style.left = "0", o.style.width = "100vw", o.style.height = "100vh", o.style.objectFit = "cover", o.style.zIndex = "-1", o.style.pointerEvents = "none"), a();
269
- });
270
- });
271
- const s = {
272
- cameraParametersUrl: n?.cameraParametersUrl ?? // default to internal camera parameters
273
- new URL("data:application/octet-stream;base64,AAACgAAAAeBAgwrsW6bUSwAAAAAAAAAAQHQ3KqAAAAAAAAAAAAAAAAAAAAAAAAAAQIL0K3dHyf9AbbNowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAAAAAAAAAAAAAAAA/uWNa4AAAAL+3lTLAAAAAv17YFWAAAAA/VYLXIAAAAECCe0YgAAAAQIJlMOAAAABAdDcqoAAAAEBts2jAAAAAP+8OmzqkDy4=", import.meta.url).toString(),
274
- detectionMode: n?.detectionMode ?? "mono",
275
- patternRatio: n?.patternRatio ?? 0.5,
276
- matrixCodeType: n?.matrixCodeType ?? "3x3"
277
- };
278
- t = new N(s), r = i;
279
- const u = () => {
280
- e?.onResizeElement();
281
- const a = window.innerWidth, f = window.innerHeight;
282
- A.setSize(a, f, !1), e?.copyElementSizeTo(A.domElement), t?.arController && e?.copyElementSizeTo(t.arController.canvas);
283
- };
284
- await new Promise((a, f) => {
285
- const l = setTimeout(() => {
286
- f(new Error("AR context initialization timeout"));
287
- }, 1e4);
288
- t?.init(() => {
289
- clearTimeout(l);
290
- try {
291
- const o = t?.getProjectionMatrix();
292
- o && i.projectionMatrix.copy(o), u(), a();
293
- } catch (o) {
294
- f(o);
295
- }
296
- });
297
- }), window.addEventListener("resize", u), c = u;
298
- },
299
- update() {
300
- if (!(!e || !t) && !(!e.ready || !e.domElement))
301
- try {
302
- t.update(e.domElement);
303
- const i = t.getProjectionMatrix?.();
304
- r && i && r.projectionMatrix.copy(i);
305
- } catch (i) {
306
- console.warn("AR.js update error:", i);
307
- }
308
- },
309
- dispose() {
310
- if (c && (window.removeEventListener("resize", c), c = void 0), t && typeof t.dispose == "function" && t.dispose(), e?.domElement) {
311
- const i = e.domElement.parentNode;
312
- i && i.removeChild(e.domElement);
313
- }
314
- e = null, t = null, r = null;
315
- },
316
- getInternal: () => ({
317
- arSource: e,
318
- arContext: t
319
- })
320
- };
321
- }, ce = {
322
- isPending: !0,
323
- isSuccess: !1,
324
- locar: null,
325
- webcam: null,
326
- deviceOrientation: null,
327
- scene: null,
328
- camera: null,
329
- lastPosition: null,
330
- registerAnchor: () => {
331
- },
332
- unregisterAnchor: () => {
333
- },
334
- getAnchor: () => {
335
- }
336
- }, ie = () => {
337
- const e = I((t) => t.backends).get(p.GEOLOCATION);
338
- return e ? {
339
- ...e.getInternal(),
340
- isPending: !1,
341
- isSuccess: !0
342
- } : ce;
343
- }, ye = ({
344
- latitude: n,
345
- longitude: e,
346
- altitude: t = 0,
347
- isBillboard: r = !0,
348
- onAttach: c,
349
- onGpsUpdate: i,
350
- children: A
351
- }) => {
352
- const s = ie(), { camera: u } = v(), [a] = P(() => new D()), f = F(() => Math.random().toString(36).slice(2, 11), []), l = M(() => {
353
- c?.();
354
- }, [c]), o = M(
355
- (d, S) => {
356
- i?.(d, S);
357
- },
358
- [i]
359
- );
360
- return k(() => {
361
- if (s.isSuccess)
362
- return s.registerAnchor(f, {
363
- anchor: a,
364
- isAttached: !1,
365
- latitude: n,
366
- longitude: e,
367
- altitude: t,
368
- onAttach: l,
369
- onGpsUpdate: o
370
- }), () => {
371
- s.unregisterAnchor(f);
372
- };
373
- }, [
374
- s.isSuccess,
375
- s.registerAnchor,
376
- s.unregisterAnchor,
377
- a,
378
- f,
379
- n,
380
- e,
381
- t,
382
- l,
383
- o
384
- ]), R(() => {
385
- !r || !u || !s.isSuccess || !s.getAnchor(f)?.isAttached || a.lookAt(u.position);
386
- }), G(/* @__PURE__ */ C("group", { children: A }), a);
387
- }, ke = ({
388
- options: n = {},
389
- children: e
390
- }) => {
391
- const { scene: t, camera: r, gl: c } = v(), { registerBackend: i, unregisterBackend: A } = I(), s = b(null), u = b(n);
392
- return u.current = n, k(() => {
393
- if (s.current) return;
394
- let a = !1;
395
- return (async () => {
396
- try {
397
- const l = ae(u.current);
398
- if (a) return;
399
- await i(l, { scene: t, camera: r, renderer: c }), s.current = l;
400
- } catch (l) {
401
- console.error("[GeolocationSession] Failed to initialize:", l);
402
- }
403
- })(), () => {
404
- a = !0, s.current && (A(s.current), s.current = null);
405
- };
406
- }, [t, r, c, i, A]), e;
407
- }, ae = (n) => {
408
- let e = null, t = null, r = null, c, i = null, A = null, s = null, u = null;
409
- const a = /* @__PURE__ */ new Map();
410
- let f = null;
411
- const l = (o) => {
412
- if (!(!e || o.isAttached))
413
- try {
414
- e.add(o.anchor, o.longitude, o.latitude, o.altitude), o.isAttached = !0, o.onAttach?.();
415
- } catch (d) {
416
- console.error("❌ Failed to attach anchor:", d);
417
- }
418
- };
419
- return {
420
- type: p.GEOLOCATION,
421
- async init(o) {
422
- const { camera: d, renderer: S, scene: h } = o;
423
- if (!h)
424
- throw new Error(
425
- "[geolocationBackend] A THREE.Scene is required for location-based AR"
426
- );
427
- A = d, s = S, u = h, e = new U(h, d), t = new X(
428
- n?.webcamConstraints ?? {
429
- video: { facingMode: "environment" }
430
- // TODO remove `as any` once fixed upstream (LocAR.js)
431
- }
432
- ), i = (m) => {
433
- f = m.position;
434
- for (const w of a.values())
435
- w.isAttached || l(w), w.onGpsUpdate?.(m.position, m.distMoved);
436
- n?.onGpsUpdate?.(m.position, m.distMoved);
437
- }, e.on("gpsupdate", i), t.on("webcamstarted", (m) => {
438
- h.background = m.texture;
439
- }), t.on("webcamerror", (m) => {
440
- console.error("[geolocationBackend] webcam error:", m);
441
- }), r = new H(d), r.on("deviceorientationgranted", (m) => {
442
- m.target?.connect?.();
443
- }), r.on("deviceorientationerror", (m) => {
444
- console.error("[geolocationBackend] Device orientation error:", m);
445
- }), r.init?.(), e.on("gpserror", (m) => {
446
- console.error("[geolocationBackend] gps error:", m);
447
- }), e.startGps(), typeof n?.fakeLat == "number" && typeof n?.fakeLon == "number" && e.fakeGps(n.fakeLon, n.fakeLat);
448
- const g = e.getLastKnownLocation();
449
- g !== null && (f = {
450
- coords: {
451
- longitude: g.longitude,
452
- latitude: g.latitude,
453
- accuracy: 0,
454
- altitude: null,
455
- altitudeAccuracy: null,
456
- heading: null,
457
- speed: null,
458
- toJSON: () => g
459
- },
460
- timestamp: Date.now(),
461
- toJSON: () => g
462
- });
463
- const E = () => {
464
- if (!s || !A) return;
465
- const m = window.innerWidth, w = window.innerHeight;
466
- s.setSize(m, w, !1), A.aspect = m / w, A.updateProjectionMatrix?.();
467
- };
468
- E(), window.addEventListener("resize", E), c = E;
469
- },
470
- update() {
471
- r?.update?.();
472
- },
473
- dispose() {
474
- e && i && e.off("gpsupdate", i), e?.stopGps?.(), t?.stop?.(), r?.dispose?.(), c && (window.removeEventListener("resize", c), c = void 0);
475
- for (const o of a.values())
476
- if (o.isAttached)
477
- try {
478
- o.anchor.removeFromParent();
479
- } catch (d) {
480
- console.error("⚠️ Error removing anchor:", d);
481
- }
482
- a.clear(), e = null, t = null, r = null, A = null, s = null, u = null, i = null, f = null;
483
- },
484
- getInternal: () => ({
485
- locar: e,
486
- webcam: t,
487
- deviceOrientation: r,
488
- scene: u,
489
- camera: A,
490
- lastPosition: f,
491
- registerAnchor: (o, d) => {
492
- a.set(o, d), f !== null && !d.isAttached && (l(d), d.onGpsUpdate?.(f, 0));
493
- },
494
- unregisterAnchor: (o) => {
495
- const d = a.get(o);
496
- if (d?.isAttached)
497
- try {
498
- d.anchor.removeFromParent();
499
- } catch (S) {
500
- console.error(`⚠️ Error removing anchor ${o}:`, S);
501
- }
502
- a.delete(o);
503
- },
504
- getAnchor: (o) => a.get(o)
505
- })
506
- };
507
- }, le = () => ({
508
- type: p.IMMERSIVE,
509
- init: () => {
510
- },
511
- getInternal: () => null
512
- }), Ie = ({ children: n }) => {
513
- const e = F(() => W(), []);
514
- return k(() => {
515
- const t = ne(), r = le();
516
- return t.backends.set(p.IMMERSIVE, r), t.setImmersiveStore(e), () => {
517
- t.backends.delete(p.IMMERSIVE), t.setImmersiveStore(null);
518
- };
519
- }, [e]), /* @__PURE__ */ C(q, { store: e, children: n });
1
+ import { u as s } from "./useXRStore-eThHhTNv.js";
2
+ import { B as m, g as l, s as p } from "./useXRStore-eThHhTNv.js";
3
+ import { useFrame as r } from "@react-three/fiber";
4
+ import { F as S, a as f, c as G, u as k } from "./fiducialBackend-Vj5N1epW.js";
5
+ import { G as F, c as g, a as A, b as R, d as X, u as b } from "./geolocationBackend-BxwE8Vcl.js";
6
+ import { I as M } from "./ImmersiveSession-CJRYdHjb.js";
7
+ import { M as I, W as P, c as T } from "./WorldAnchor-ur1RjMrN.js";
8
+ const n = ({ children: o }) => {
9
+ const { updateBackends: e } = s();
10
+ return r((c, a) => {
11
+ e(a);
12
+ }), o;
520
13
  };
521
14
  export {
522
- p as BACKEND_TYPES,
523
- he as FiducialAnchor,
524
- we as FiducialSession,
525
- ye as GeolocationAnchor,
526
- ke as GeolocationSession,
527
- Ie as ImmersiveSession,
528
- ge as XR,
529
- se as createFiducialBackend,
530
- ae as createGeolocationBackend,
531
- ne as getXRStore,
532
- be as subscribeToXRStore,
533
- oe as useFiducialBackend,
534
- ie as useGeolocationBackend,
535
- I as useXRStore
15
+ m as BACKEND_TYPES,
16
+ S as FiducialAnchor,
17
+ f as FiducialSession,
18
+ F as GeoLine,
19
+ g as GeoPolygon,
20
+ A as GeolocationAnchor,
21
+ R as GeolocationSession,
22
+ M as ImmersiveSession,
23
+ I as MagicSession,
24
+ P as WorldAnchor,
25
+ n as XR,
26
+ G as createFiducialBackend,
27
+ X as createGeolocationBackend,
28
+ T as createMagicBackend,
29
+ l as getXRStore,
30
+ p as subscribeToXRStore,
31
+ k as useFiducialBackend,
32
+ b as useGeolocationBackend,
33
+ s as useXRStore
536
34
  };
@@ -6,6 +6,7 @@ export declare const BACKEND_TYPES: {
6
6
  readonly FIDUCIAL: "fiducial";
7
7
  readonly GEOLOCATION: "geolocation";
8
8
  readonly IMMERSIVE: "immersive";
9
+ readonly MAGIC: "magic";
9
10
  };
10
11
  /**
11
12
  * Backend type discriminator.
@@ -1 +1 @@
1
- {"version":3,"file":"Backend.interface.d.ts","sourceRoot":"","sources":["../../../../../src/lib/types/engine/backend/Backend.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,GAAG,OAAO;IAClC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAClD;;;OAGG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB;;;OAGG;IACH,WAAW,IAAI,CAAC,CAAC;CAClB"}
1
+ {"version":3,"file":"Backend.interface.d.ts","sourceRoot":"","sources":["../../../../../src/lib/types/engine/backend/Backend.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,GAAG,OAAO;IAClC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAClD;;;OAGG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB;;;OAGG;IACH,WAAW,IAAI,CAAC,CAAC;CAClB"}
@@ -0,0 +1,14 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { MagicSessionOptions } from './magicBackend';
3
+ export interface MagicSessionProps extends PropsWithChildren {
4
+ /** Magic window session options. */
5
+ options?: MagicSessionOptions;
6
+ }
7
+ /**
8
+ * Manage the magic window AR backend.
9
+ * Registers with the XR session provider and provides device orientation
10
+ * tracking with camera passthrough capabilities.
11
+ */
12
+ declare const MagicSession: ({ options, children }: MagicSessionProps) => import('react').ReactNode;
13
+ export default MagicSession;
14
+ //# sourceMappingURL=MagicSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MagicSession.d.ts","sourceRoot":"","sources":["../../src/magic/MagicSession.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,oCAAoC;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED;;;;GAIG;AACH,QAAA,MAAM,YAAY,GAAI,uBAA4B,iBAAiB,8BA4ClE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export interface WorldAnchorProps extends PropsWithChildren {
3
+ /** Position offset relative to the initial orientation. */
4
+ position?: [number, number, number];
5
+ /** Rotation offset in radians. */
6
+ rotation?: [number, number, number];
7
+ /** Scale factor. */
8
+ scale?: number | [number, number, number];
9
+ /**
10
+ * Whether the anchor should face the camera every frame.
11
+ * @default false
12
+ */
13
+ isBillboard?: boolean;
14
+ }
15
+ /**
16
+ * World anchor that positions children relative to the device's initial orientation.
17
+ * Uses the magic window backend's orientation data for world-space positioning.
18
+ */
19
+ declare const WorldAnchor: ({ position, rotation, scale, isBillboard, children, }: WorldAnchorProps) => import("react/jsx-runtime").JSX.Element;
20
+ export default WorldAnchor;
21
+ //# sourceMappingURL=WorldAnchor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorldAnchor.d.ts","sourceRoot":"","sources":["../../src/magic/WorldAnchor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,GAAI,uDAMlB,gBAAgB,4CA0ClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { default as MagicSession } from './MagicSession';
2
+ export { default as createMagicBackend } from './magicBackend';
3
+ export { default as WorldAnchor } from './WorldAnchor';
4
+ export type { MagicSessionProps } from './MagicSession';
5
+ export type { MagicInternal, MagicSessionOptions, } from './magicBackend';
6
+ export type { WorldAnchorProps } from './WorldAnchor';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/magic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EACV,aAAa,EACb,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}