@reactvision/react-viro 2.53.1 → 2.55.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 (153) hide show
  1. package/README.md +85 -46
  2. package/android/react_viro/react_viro-release.aar +0 -0
  3. package/android/viro_renderer/viro_renderer-release.aar +0 -0
  4. package/components/AR/ViroARCamera.tsx +5 -0
  5. package/components/AR/ViroARImageMarker.tsx +5 -0
  6. package/components/AR/ViroARObjectMarker.tsx +5 -0
  7. package/components/AR/ViroARPlane.tsx +5 -0
  8. package/components/AR/ViroARPlaneSelector.tsx +5 -0
  9. package/components/AR/ViroARScene.tsx +5 -0
  10. package/components/AR/ViroARSceneNavigator.tsx +84 -0
  11. package/components/AR/ViroCommonProps.ts +11 -0
  12. package/components/Material/ViroMaterials.ts +51 -0
  13. package/components/Studio/StudioARScene.tsx +368 -0
  14. package/components/Studio/StudioSceneNavigator.tsx +191 -0
  15. package/components/Studio/VRTStudioModule.ts +40 -0
  16. package/components/Studio/domain/animationRegistry.ts +86 -0
  17. package/components/Studio/domain/collisionBindingsRuntime.ts +93 -0
  18. package/components/Studio/domain/collisionPairKey.ts +15 -0
  19. package/components/Studio/domain/dragConfiguration.ts +48 -0
  20. package/components/Studio/domain/materialConfig.ts +276 -0
  21. package/components/Studio/domain/physicsConfig.ts +204 -0
  22. package/components/Studio/domain/sceneNavigationHandler.ts +150 -0
  23. package/components/Studio/domain/studioMaterials.ts +33 -0
  24. package/components/Studio/domain/triggerImageRegistry.ts +64 -0
  25. package/components/Studio/domain/useStudioShaderTimeUniforms.ts +51 -0
  26. package/components/Studio/domain/useStudioShaderViewportUniforms.ts +52 -0
  27. package/components/Studio/domain/viroNodeFactory.tsx +323 -0
  28. package/components/Studio/index.ts +18 -0
  29. package/components/Studio/types.ts +164 -0
  30. package/components/Types/ViroEvents.ts +53 -0
  31. package/components/Utilities/VRModuleOpenXR.ts +50 -0
  32. package/components/Utilities/VRQuestNavigatorBridge.ts +168 -0
  33. package/components/Utilities/ViroPlatform.ts +52 -0
  34. package/components/Utilities/ViroUtils.tsx +48 -0
  35. package/components/Utilities/ViroVersion.ts +1 -1
  36. package/components/Utilities/useAnySourceHover.ts +55 -0
  37. package/components/Utilities/useAnySourcePressed.ts +70 -0
  38. package/components/Viro360Image.tsx +7 -0
  39. package/components/ViroQuestEntryPoint.tsx +79 -0
  40. package/components/ViroVRSceneNavigator.tsx +44 -19
  41. package/components/ViroXRSceneNavigator.tsx +217 -0
  42. package/components/VisionOS/ViroVisionOSModule.ts +93 -0
  43. package/dist/components/AR/ViroARCamera.d.ts +1 -1
  44. package/dist/components/AR/ViroARCamera.js +5 -0
  45. package/dist/components/AR/ViroARImageMarker.d.ts +1 -1
  46. package/dist/components/AR/ViroARImageMarker.js +5 -0
  47. package/dist/components/AR/ViroARObjectMarker.d.ts +1 -1
  48. package/dist/components/AR/ViroARObjectMarker.js +5 -0
  49. package/dist/components/AR/ViroARPlane.d.ts +1 -1
  50. package/dist/components/AR/ViroARPlane.js +5 -0
  51. package/dist/components/AR/ViroARPlaneSelector.d.ts +1 -1
  52. package/dist/components/AR/ViroARPlaneSelector.js +5 -0
  53. package/dist/components/AR/ViroARScene.d.ts +1 -1
  54. package/dist/components/AR/ViroARScene.js +5 -0
  55. package/dist/components/AR/ViroARSceneNavigator.d.ts +36 -0
  56. package/dist/components/AR/ViroARSceneNavigator.js +41 -0
  57. package/dist/components/AR/ViroCommonProps.d.ts +11 -0
  58. package/dist/components/Material/ViroMaterials.d.ts +12 -0
  59. package/dist/components/Material/ViroMaterials.js +25 -0
  60. package/dist/components/ReactVisionClient.d.ts +25 -0
  61. package/dist/components/ReactVisionClient.js +11 -0
  62. package/dist/components/Studio/StudioARScene.d.ts +15 -0
  63. package/dist/components/Studio/StudioARScene.js +299 -0
  64. package/dist/components/Studio/StudioSceneNavigator.d.ts +31 -0
  65. package/dist/components/Studio/StudioSceneNavigator.js +174 -0
  66. package/dist/components/Studio/VRTStudioModule.d.ts +15 -0
  67. package/dist/components/Studio/VRTStudioModule.js +31 -0
  68. package/dist/components/Studio/domain/animationRegistry.d.ts +11 -0
  69. package/dist/components/Studio/domain/animationRegistry.js +67 -0
  70. package/dist/components/Studio/domain/collisionBindingsRuntime.d.ts +21 -0
  71. package/dist/components/Studio/domain/collisionBindingsRuntime.js +54 -0
  72. package/dist/components/Studio/domain/collisionPairKey.d.ts +8 -0
  73. package/dist/components/Studio/domain/collisionPairKey.js +15 -0
  74. package/dist/components/Studio/domain/dragConfiguration.d.ts +20 -0
  75. package/dist/components/Studio/domain/dragConfiguration.js +37 -0
  76. package/dist/components/Studio/domain/materialConfig.d.ts +56 -0
  77. package/dist/components/Studio/domain/materialConfig.js +239 -0
  78. package/dist/components/Studio/domain/physicsConfig.d.ts +69 -0
  79. package/dist/components/Studio/domain/physicsConfig.js +165 -0
  80. package/dist/components/Studio/domain/sceneNavigationHandler.d.ts +12 -0
  81. package/dist/components/Studio/domain/sceneNavigationHandler.js +112 -0
  82. package/dist/components/Studio/domain/studioMaterials.d.ts +6 -0
  83. package/dist/components/Studio/domain/studioMaterials.js +30 -0
  84. package/dist/components/Studio/domain/triggerImageRegistry.d.ts +13 -0
  85. package/dist/components/Studio/domain/triggerImageRegistry.js +47 -0
  86. package/dist/components/Studio/domain/useStudioShaderTimeUniforms.d.ts +6 -0
  87. package/dist/components/Studio/domain/useStudioShaderTimeUniforms.js +48 -0
  88. package/dist/components/Studio/domain/useStudioShaderViewportUniforms.d.ts +6 -0
  89. package/dist/components/Studio/domain/useStudioShaderViewportUniforms.js +48 -0
  90. package/dist/components/Studio/domain/viroNodeFactory.d.ts +28 -0
  91. package/dist/components/Studio/domain/viroNodeFactory.js +193 -0
  92. package/dist/components/Studio/index.d.ts +3 -0
  93. package/dist/components/Studio/index.js +7 -0
  94. package/dist/components/Studio/types.d.ts +149 -0
  95. package/dist/components/Studio/types.js +4 -0
  96. package/dist/components/Types/ViroEvents.d.ts +49 -1
  97. package/dist/components/Types/ViroEvents.js +1 -0
  98. package/dist/components/Utilities/VRModuleOpenXR.d.ts +32 -0
  99. package/dist/components/Utilities/VRModuleOpenXR.js +44 -0
  100. package/dist/components/Utilities/VRQuestNavigatorBridge.d.ts +85 -0
  101. package/dist/components/Utilities/VRQuestNavigatorBridge.js +124 -0
  102. package/dist/components/Utilities/ViroPlatform.d.ts +10 -0
  103. package/dist/components/Utilities/ViroPlatform.js +43 -0
  104. package/dist/components/Utilities/ViroUtils.d.ts +19 -0
  105. package/dist/components/Utilities/ViroUtils.js +34 -0
  106. package/dist/components/Utilities/ViroVersion.d.ts +1 -1
  107. package/dist/components/Utilities/ViroVersion.js +1 -1
  108. package/dist/components/Utilities/useAnySourceHover.d.ts +36 -0
  109. package/dist/components/Utilities/useAnySourceHover.js +48 -0
  110. package/dist/components/Utilities/useAnySourcePressed.d.ts +37 -0
  111. package/dist/components/Utilities/useAnySourcePressed.js +61 -0
  112. package/dist/components/Viro360Image.d.ts +7 -0
  113. package/dist/components/ViroQuestEntryPoint.d.ts +13 -0
  114. package/dist/components/ViroQuestEntryPoint.js +104 -0
  115. package/dist/components/ViroVRSceneNavigator.d.ts +24 -10
  116. package/dist/components/ViroVRSceneNavigator.js +21 -18
  117. package/dist/components/ViroXRSceneNavigator.d.ts +54 -0
  118. package/dist/components/ViroXRSceneNavigator.js +173 -0
  119. package/dist/components/VisionOS/ViroVisionOSModule.d.ts +65 -0
  120. package/dist/components/VisionOS/ViroVisionOSModule.js +91 -0
  121. package/dist/index.d.ts +16 -3
  122. package/dist/index.js +34 -2
  123. package/dist/plugins/withViro.d.ts +28 -1
  124. package/dist/plugins/withViroAndroid.js +312 -7
  125. package/dist/plugins/withViroIos.js +17 -8
  126. package/dist/plugins/withViroVisionOS.d.ts +24 -0
  127. package/dist/plugins/withViroVisionOS.js +265 -0
  128. package/index.ts +66 -0
  129. package/ios/ViroReact.podspec +15 -5
  130. package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreCoreMLSemanticsResources.bundle/Info.plist +0 -0
  131. package/ios/dist/ViroRenderer/ViroKit.framework/ARCoreResources.bundle/Info.plist +0 -0
  132. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSession.h +30 -1
  133. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROARSessioniOS.h +16 -0
  134. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROGLTFLoader.h +34 -0
  135. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputControllerBase.h +74 -0
  136. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROInputType.h +11 -3
  137. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMaterial.h +29 -0
  138. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROMorpher.h +4 -0
  139. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPlatformUtil.h +13 -0
  140. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROPortal.h +17 -0
  141. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderContext.h +41 -0
  142. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VRORenderer.h +23 -0
  143. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROSemantics.h +14 -0
  144. package/ios/dist/ViroRenderer/ViroKit.framework/Headers/VROViewAR.h +11 -0
  145. package/ios/dist/ViroRenderer/ViroKit.framework/Info.plist +0 -0
  146. package/ios/dist/ViroRenderer/ViroKit.framework/Shaders.dat +1 -1
  147. package/ios/dist/ViroRenderer/ViroKit.framework/ViroKit +0 -0
  148. package/ios/dist/ViroRenderer/ViroKit.podspec +5 -0
  149. package/ios/dist/include/VRT360Image.h +1 -0
  150. package/ios/dist/include/VRTARSceneNavigator.h +7 -0
  151. package/ios/dist/include/VRTStudioModule.h +6 -0
  152. package/ios/dist/lib/libViroReact.a +0 -0
  153. package/package.json +8 -8
@@ -0,0 +1,149 @@
1
+ export interface StudioSceneCreatedBy {
2
+ id: string;
3
+ first_name: string | null;
4
+ last_name: string | null;
5
+ }
6
+ export interface StudioSceneMeta {
7
+ id: string;
8
+ name: string | null;
9
+ belongs_to_project: string;
10
+ plane_detection: string | null;
11
+ plane_direction: string | null;
12
+ on_load_function: string | null;
13
+ physics_world_config: Record<string, unknown> | null;
14
+ created_at: string;
15
+ created_by: StudioSceneCreatedBy | null;
16
+ }
17
+ export interface StudioProjectMeta {
18
+ id: string;
19
+ occlusion_mode: "NONE" | "PEOPLEONLY" | "DEPTHBASED";
20
+ }
21
+ export interface StudioSceneFunction {
22
+ id: string;
23
+ scene: string;
24
+ function_type: "NAVIGATION" | "ALERT" | "ANIMATION";
25
+ navigation: string | null;
26
+ alert: string | null;
27
+ animation: string | null;
28
+ scene_navigation: {
29
+ id: string;
30
+ navigate_to: string;
31
+ } | null;
32
+ scene_alert: {
33
+ id: string;
34
+ alert_title: string | null;
35
+ alert_message: string | null;
36
+ } | null;
37
+ scene_animation: {
38
+ id: string;
39
+ animation_key: string;
40
+ duration_ms: number | null;
41
+ delay_ms: number | null;
42
+ properties: Record<string, unknown>;
43
+ } | null;
44
+ }
45
+ export interface StudioAsset {
46
+ id: string;
47
+ name: string | null;
48
+ description: string | null;
49
+ file_url: string | null;
50
+ file_size: number | null;
51
+ asset_type_name: "3D-MODEL" | "TEXT" | "IMAGE" | "VIDEO" | null;
52
+ position_x: number | null;
53
+ position_y: number | null;
54
+ position_z: number | null;
55
+ rotation_x: number | null;
56
+ rotation_y: number | null;
57
+ rotation_z: number | null;
58
+ scale: number | null;
59
+ latitude: number | null;
60
+ longitude: number | null;
61
+ is_draggable: boolean;
62
+ trigger_image_url: string | null;
63
+ trigger_image_orientation: "Up" | "Down" | "Left" | "Right" | null;
64
+ trigger_image_physical_width_m: number | null;
65
+ material_config: Record<string, unknown> | null;
66
+ physics_config: Record<string, unknown> | null;
67
+ on_click_function: string | null;
68
+ asset_id: string | null;
69
+ created_at: string;
70
+ updated_at: string;
71
+ scene_function: StudioSceneFunction | null;
72
+ }
73
+ export interface StudioCollisionBinding {
74
+ id: string;
75
+ scene_id: string;
76
+ function_id: string;
77
+ asset_x_id: string;
78
+ asset_y_id: string;
79
+ scene_function: StudioSceneFunction;
80
+ }
81
+ export interface StudioAnimation {
82
+ id: string;
83
+ scene_id: string;
84
+ target_asset_id: string;
85
+ animation_key: string;
86
+ properties: Record<string, unknown>;
87
+ duration_ms: number | null;
88
+ delay_ms: number | null;
89
+ easing: "Linear" | "EaseIn" | "EaseOut" | "EaseInEaseOut" | "Bounce" | null;
90
+ loop: boolean;
91
+ interruptible: boolean;
92
+ on_start_function: string | null;
93
+ on_finish_function: string | null;
94
+ }
95
+ export interface StudioProjectAsset {
96
+ id: string;
97
+ name: string | null;
98
+ url: string | null;
99
+ }
100
+ export interface StudioProjectSceneSummary {
101
+ id: string;
102
+ name: string | null;
103
+ created_at: string;
104
+ created_by: StudioSceneCreatedBy | null;
105
+ assets: StudioProjectAsset[];
106
+ }
107
+ export interface StudioProjectOpeningScene {
108
+ id: string;
109
+ name: string | null;
110
+ }
111
+ export interface StudioProjectOverview {
112
+ id: string;
113
+ name: string;
114
+ thumbnail: string | null;
115
+ occlusion_mode: "NONE" | "PEOPLEONLY" | "DEPTHBASED";
116
+ created_at: string;
117
+ created_by: StudioSceneCreatedBy | null;
118
+ opening_scene: StudioProjectOpeningScene | null;
119
+ scenes: StudioProjectSceneSummary[];
120
+ }
121
+ /** Top-level response from GET /functions/v1/projects/{project_id} (after JSON.parse) */
122
+ export interface StudioProjectApiResponse {
123
+ project: StudioProjectOverview;
124
+ meta: {
125
+ request_id: string;
126
+ };
127
+ }
128
+ /** Top-level response from GET /functions/v1/scenes/{scene_id} (after JSON.parse) */
129
+ export interface StudioSceneResponse {
130
+ scene: StudioSceneMeta;
131
+ project: StudioProjectMeta;
132
+ assets: StudioAsset[];
133
+ collision_bindings: StudioCollisionBinding[];
134
+ animations: StudioAnimation[];
135
+ functions: StudioSceneFunction[];
136
+ meta: {
137
+ request_id: string;
138
+ };
139
+ }
140
+ /** Viro animation prop shape passed to Viro components */
141
+ export type ViroAnimationProp = {
142
+ name: string;
143
+ run: boolean;
144
+ loop: boolean;
145
+ interruptible: boolean;
146
+ delay: number;
147
+ onStart?: () => void;
148
+ onFinish?: () => void;
149
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Types mirror the actual server response from GET /functions/v1/scenes/{scene_id}.
3
+ // Field names are snake_case as returned by the Supabase Edge Function / Postgres RPC.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -100,7 +100,8 @@ export type ViroPlatformInfo = {
100
100
  };
101
101
  export declare enum ViroPlatformTypes {
102
102
  GVR = "gvr",
103
- GEAR_VR = "ovr-mobile"
103
+ GEAR_VR = "ovr-mobile",
104
+ QUEST = "quest"
104
105
  }
105
106
  export declare enum ViroHeadsetTypes {
106
107
  CARDBOARD = "cardboard",
@@ -135,6 +136,53 @@ export type ViroExitViroEvent = {};
135
136
  export type ViroErrorEvent = {
136
137
  error: Error;
137
138
  };
139
+ /** ===========================================================================
140
+ * Quest / OpenXR Hand Tracking Types (M4)
141
+ * ============================================================================ */
142
+ export type ViroJoint = {
143
+ position: Viro3DPoint;
144
+ /** Sphere radius representing finger pad size (meters). */
145
+ radius: number;
146
+ };
147
+ export type ViroHandJoints = {
148
+ wrist: ViroJoint;
149
+ thumbMetacarpal: ViroJoint;
150
+ thumbProximal: ViroJoint;
151
+ thumbDistal: ViroJoint;
152
+ thumbTip: ViroJoint;
153
+ indexMetacarpal: ViroJoint;
154
+ indexProximal: ViroJoint;
155
+ indexIntermediate: ViroJoint;
156
+ indexDistal: ViroJoint;
157
+ indexTip: ViroJoint;
158
+ middleMetacarpal: ViroJoint;
159
+ middleProximal: ViroJoint;
160
+ middleIntermediate: ViroJoint;
161
+ middleDistal: ViroJoint;
162
+ middleTip: ViroJoint;
163
+ ringMetacarpal: ViroJoint;
164
+ ringProximal: ViroJoint;
165
+ ringIntermediate: ViroJoint;
166
+ ringDistal: ViroJoint;
167
+ ringTip: ViroJoint;
168
+ littleMetacarpal: ViroJoint;
169
+ littleProximal: ViroJoint;
170
+ littleIntermediate: ViroJoint;
171
+ littleDistal: ViroJoint;
172
+ littleTip: ViroJoint;
173
+ };
174
+ export type ViroHandPinchEvent = {
175
+ hand: "left" | "right";
176
+ /** World-space position of the pinch point (midpoint between thumb tip and index tip). */
177
+ position: Viro3DPoint;
178
+ /** Pinch strength [0..1] from XR_FB_hand_tracking_aim, or 1.0 on pinch-complete fallback. */
179
+ pinchStrength: number;
180
+ };
181
+ /** Per-frame skeletal hand data dispatched via onHandUpdate. null when hand is not tracked. */
182
+ export type ViroHandUpdateEvent = {
183
+ left: ViroHandJoints | null;
184
+ right: ViroHandJoints | null;
185
+ };
138
186
  /** ===========================================================================
139
187
  * Viro Animation Events
140
188
  * ============================================================================ */
@@ -35,6 +35,7 @@ var ViroPlatformTypes;
35
35
  (function (ViroPlatformTypes) {
36
36
  ViroPlatformTypes["GVR"] = "gvr";
37
37
  ViroPlatformTypes["GEAR_VR"] = "ovr-mobile";
38
+ ViroPlatformTypes["QUEST"] = "quest";
38
39
  })(ViroPlatformTypes || (exports.ViroPlatformTypes = ViroPlatformTypes = {}));
39
40
  var ViroHeadsetTypes;
40
41
  (function (ViroHeadsetTypes) {
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Finishes VRActivity and returns the user to the panel (MainActivity).
3
+ * Safe to call on any platform — no-op when VRLauncher is unavailable.
4
+ */
5
+ export declare function exitVRScene(): void;
6
+ export type VRModuleOpenXRType = {
7
+ recenterTracking?: (viewTag: number) => void;
8
+ setPassthroughEnabled?: (viewTag: number, enabled: boolean) => void;
9
+ };
10
+ /**
11
+ * Typed reference to the VRModuleOpenXR native module.
12
+ * undefined when not running on Meta Quest (no-op calls are safe via optional chaining).
13
+ */
14
+ export declare const VRModuleOpenXR: VRModuleOpenXRType | undefined;
15
+ /**
16
+ * Returns the live viewTag of the ViroVRSceneNavigator running in VRActivity,
17
+ * kept in sync via VRQuestNavigatorBridge. null until ViroQuestEntryPoint has
18
+ * mounted and published the tag.
19
+ *
20
+ * Use this inside VR scenes when you need to call VRModuleOpenXR methods:
21
+ *
22
+ * ```tsx
23
+ * function MyVRScene() {
24
+ * const viewTag = useVRViewTag();
25
+ * const recenter = () => {
26
+ * if (viewTag != null) VRModuleOpenXR?.recenterTracking?.(viewTag);
27
+ * };
28
+ * return <ViroScene>...</ViroScene>;
29
+ * }
30
+ * ```
31
+ */
32
+ export declare function useVRViewTag(): number | null;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VRModuleOpenXR = void 0;
4
+ exports.exitVRScene = exitVRScene;
5
+ exports.useVRViewTag = useVRViewTag;
6
+ const react_1 = require("react");
7
+ const react_native_1 = require("react-native");
8
+ const VRQuestNavigatorBridge_1 = require("./VRQuestNavigatorBridge");
9
+ /**
10
+ * Finishes VRActivity and returns the user to the panel (MainActivity).
11
+ * Safe to call on any platform — no-op when VRLauncher is unavailable.
12
+ */
13
+ function exitVRScene() {
14
+ VRQuestNavigatorBridge_1.VRQuestNavigatorBridge.setVRActive(false);
15
+ react_native_1.NativeModules.VRLauncher
16
+ ?.exitVRScene?.();
17
+ }
18
+ /**
19
+ * Typed reference to the VRModuleOpenXR native module.
20
+ * undefined when not running on Meta Quest (no-op calls are safe via optional chaining).
21
+ */
22
+ exports.VRModuleOpenXR = react_native_1.NativeModules.VRModuleOpenXR ?? undefined;
23
+ /**
24
+ * Returns the live viewTag of the ViroVRSceneNavigator running in VRActivity,
25
+ * kept in sync via VRQuestNavigatorBridge. null until ViroQuestEntryPoint has
26
+ * mounted and published the tag.
27
+ *
28
+ * Use this inside VR scenes when you need to call VRModuleOpenXR methods:
29
+ *
30
+ * ```tsx
31
+ * function MyVRScene() {
32
+ * const viewTag = useVRViewTag();
33
+ * const recenter = () => {
34
+ * if (viewTag != null) VRModuleOpenXR?.recenterTracking?.(viewTag);
35
+ * };
36
+ * return <ViroScene>...</ViroScene>;
37
+ * }
38
+ * ```
39
+ */
40
+ function useVRViewTag() {
41
+ const [tag, setTag] = (0, react_1.useState)(() => VRQuestNavigatorBridge_1.VRQuestNavigatorBridge.getViewTag());
42
+ (0, react_1.useEffect)(() => VRQuestNavigatorBridge_1.VRQuestNavigatorBridge.onViewTag(setTag), []);
43
+ return tag;
44
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * VRQuestNavigatorBridge
3
+ *
4
+ * Carries VR "intents" and navigator operations from panel-Activity component
5
+ * trees to VRActivity. Both activities run in the same process and share the
6
+ * same Hermes JS engine, so a module-level store is sufficient — no native
7
+ * round-trip needed.
8
+ *
9
+ * Flow:
10
+ * Panel (MainActivity)
11
+ * ViroXRSceneNavigator mounts
12
+ * → setIntent(scene, config) — stores intent, notifies ViroQuestEntryPoint
13
+ * → launchVRScene() — OS switches to VRActivity
14
+ * → ref.push(StudioScene) — dispatchOp() queues the op
15
+ *
16
+ * VRActivity mounts VRQuestScene → ViroQuestEntryPoint
17
+ * → onIntent cb fires — reads intentKey + initialScene + rendererConfig
18
+ * → renders ViroVRSceneNavigator key={intentKey} (fresh mount per intent)
19
+ * → ViroQuestEntryPoint captures viewTag → setViewTag()
20
+ * → subscribeOps() drains queued ops — push(StudioScene) arrives
21
+ *
22
+ * Each call to setIntent() generates a new intentKey. ViroQuestEntryPoint
23
+ * uses key={intentKey} on ViroVRSceneNavigator, guaranteeing a clean navigator
24
+ * stack whenever a different panel screen activates VR.
25
+ */
26
+ export type VRNavigatorOp = {
27
+ type: "push";
28
+ scene: any;
29
+ } | {
30
+ type: "pop";
31
+ } | {
32
+ type: "popN";
33
+ n: number;
34
+ } | {
35
+ type: "replace";
36
+ scene: any;
37
+ } | {
38
+ type: "jump";
39
+ scene: any;
40
+ };
41
+ /** Renderer flags forwarded from ViroXRSceneNavigator to ViroVRSceneNavigator. */
42
+ export type VRQuestRendererConfig = {
43
+ hdrEnabled?: boolean;
44
+ pbrEnabled?: boolean;
45
+ bloomEnabled?: boolean;
46
+ shadowsEnabled?: boolean;
47
+ multisamplingEnabled?: boolean;
48
+ vrModeEnabled?: boolean;
49
+ passthroughEnabled?: boolean;
50
+ handTrackingEnabled?: boolean;
51
+ debug?: boolean;
52
+ onExitViro?: () => void;
53
+ };
54
+ export type VRQuestIntent = {
55
+ intentKey: string;
56
+ initialScene: any;
57
+ rendererConfig?: VRQuestRendererConfig;
58
+ };
59
+ export declare const VRQuestNavigatorBridge: {
60
+ /**
61
+ * Record the scene and renderer config that VRActivity should use, and
62
+ * return a unique intent key. Call launchVRScene() after this.
63
+ */
64
+ setIntent(initialScene: any, rendererConfig?: VRQuestRendererConfig): string;
65
+ /** Current intent (may be null if VR has never been launched). */
66
+ getIntent(): VRQuestIntent | null;
67
+ /**
68
+ * Subscribe to intent changes. Fires immediately with the current intent if
69
+ * one exists so that ViroQuestEntryPoint can render even if it mounts after
70
+ * setIntent() was called.
71
+ */
72
+ onIntent(cb: (intent: VRQuestIntent) => void): () => void;
73
+ dispatchOp(op: VRNavigatorOp): void;
74
+ subscribeOps(cb: (op: VRNavigatorOp) => void): () => void;
75
+ setVRActive(active: boolean): void;
76
+ isVRActive(): boolean;
77
+ setViewTag(tag: number | null): void;
78
+ getViewTag(): number | null;
79
+ /**
80
+ * Subscribe to viewTag changes. Fires immediately with the current value.
81
+ * Use this inside VR scenes that need VRModuleOpenXR (recenterTracking,
82
+ * setPassthroughEnabled) without a direct ref to ViroVRSceneNavigator.
83
+ */
84
+ onViewTag(cb: (tag: number | null) => void): () => void;
85
+ };
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * VRQuestNavigatorBridge
4
+ *
5
+ * Carries VR "intents" and navigator operations from panel-Activity component
6
+ * trees to VRActivity. Both activities run in the same process and share the
7
+ * same Hermes JS engine, so a module-level store is sufficient — no native
8
+ * round-trip needed.
9
+ *
10
+ * Flow:
11
+ * Panel (MainActivity)
12
+ * ViroXRSceneNavigator mounts
13
+ * → setIntent(scene, config) — stores intent, notifies ViroQuestEntryPoint
14
+ * → launchVRScene() — OS switches to VRActivity
15
+ * → ref.push(StudioScene) — dispatchOp() queues the op
16
+ *
17
+ * VRActivity mounts VRQuestScene → ViroQuestEntryPoint
18
+ * → onIntent cb fires — reads intentKey + initialScene + rendererConfig
19
+ * → renders ViroVRSceneNavigator key={intentKey} (fresh mount per intent)
20
+ * → ViroQuestEntryPoint captures viewTag → setViewTag()
21
+ * → subscribeOps() drains queued ops — push(StudioScene) arrives
22
+ *
23
+ * Each call to setIntent() generates a new intentKey. ViroQuestEntryPoint
24
+ * uses key={intentKey} on ViroVRSceneNavigator, guaranteeing a clean navigator
25
+ * stack whenever a different panel screen activates VR.
26
+ */
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.VRQuestNavigatorBridge = void 0;
29
+ // ── Intent store ────────────────────────────────────────────────────────────
30
+ let _intent = null;
31
+ const _intentListeners = new Set();
32
+ // ── Op queue ─────────────────────────────────────────────────────────────────
33
+ const _opListeners = new Set();
34
+ const _opQueue = [];
35
+ let _opCounter = 0;
36
+ // ── VR active flag ────────────────────────────────────────────────────────────
37
+ // True while VRActivity is running. Set to true just before launchVRScene(),
38
+ // set to false by exitVRScene(). The AppState-based relaunch in
39
+ // ViroXRSceneNavigator checks this so it only fires for system-level
40
+ // backgrounding (Quest menu / home), not for explicit exits.
41
+ let _vrActive = false;
42
+ // ── ViewTag store ─────────────────────────────────────────────────────────────
43
+ // ViroQuestEntryPoint populates this after ViroVRSceneNavigator mounts.
44
+ // Panel-side code (e.g. VRModuleOpenXR.recenterTracking) reads it to target
45
+ // the live native view without needing a direct ref to ViroVRSceneNavigator.
46
+ let _viewTag = null;
47
+ const _viewTagListeners = new Set();
48
+ exports.VRQuestNavigatorBridge = {
49
+ // ── Called by ViroXRSceneNavigator when mounting on Quest ──────────────────
50
+ /**
51
+ * Record the scene and renderer config that VRActivity should use, and
52
+ * return a unique intent key. Call launchVRScene() after this.
53
+ */
54
+ setIntent(initialScene, rendererConfig) {
55
+ const intentKey = `vr-${Date.now()}-${++_opCounter}`;
56
+ _intent = { intentKey, initialScene, rendererConfig };
57
+ // Clear any stale ops from the previous intent.
58
+ _opQueue.length = 0;
59
+ _intentListeners.forEach((l) => l(_intent));
60
+ return intentKey;
61
+ },
62
+ /** Current intent (may be null if VR has never been launched). */
63
+ getIntent() {
64
+ return _intent;
65
+ },
66
+ /**
67
+ * Subscribe to intent changes. Fires immediately with the current intent if
68
+ * one exists so that ViroQuestEntryPoint can render even if it mounts after
69
+ * setIntent() was called.
70
+ */
71
+ onIntent(cb) {
72
+ _intentListeners.add(cb);
73
+ if (_intent)
74
+ cb(_intent);
75
+ return () => {
76
+ _intentListeners.delete(cb);
77
+ };
78
+ },
79
+ // ── Called by ViroXRSceneNavigator ref (push / pop / etc.) ────────────────
80
+ dispatchOp(op) {
81
+ if (_opListeners.size > 0) {
82
+ _opListeners.forEach((l) => l(op));
83
+ }
84
+ else {
85
+ _opQueue.push(op);
86
+ }
87
+ },
88
+ // ── Called by ViroQuestEntryPoint after ViroVRSceneNavigator mounts ────────
89
+ subscribeOps(cb) {
90
+ _opListeners.add(cb);
91
+ const pending = _opQueue.splice(0);
92
+ pending.forEach((op) => cb(op));
93
+ return () => {
94
+ _opListeners.delete(cb);
95
+ };
96
+ },
97
+ // ── VR active flag ────────────────────────────────────────────────────────
98
+ setVRActive(active) {
99
+ _vrActive = active;
100
+ },
101
+ isVRActive() {
102
+ return _vrActive;
103
+ },
104
+ // ── ViewTag — native node handle of the live ViroVRSceneNavigator ──────────
105
+ setViewTag(tag) {
106
+ _viewTag = tag;
107
+ _viewTagListeners.forEach((l) => l(tag));
108
+ },
109
+ getViewTag() {
110
+ return _viewTag;
111
+ },
112
+ /**
113
+ * Subscribe to viewTag changes. Fires immediately with the current value.
114
+ * Use this inside VR scenes that need VRModuleOpenXR (recenterTracking,
115
+ * setPassthroughEnabled) without a direct ref to ViroVRSceneNavigator.
116
+ */
117
+ onViewTag(cb) {
118
+ _viewTagListeners.add(cb);
119
+ cb(_viewTag);
120
+ return () => {
121
+ _viewTagListeners.delete(cb);
122
+ };
123
+ },
124
+ };
@@ -0,0 +1,10 @@
1
+ export declare const isQuest: boolean;
2
+ /**
3
+ * True when this app build includes the OpenXR VR native module (i.e. the
4
+ * Quest variant of react-viro is registered in `MainApplication`). Does NOT
5
+ * imply the current device is a Quest — for that, use `isQuest`.
6
+ *
7
+ * Useful when you need to decide whether `ViroVRSceneNavigator` *could* render
8
+ * if you forced VR mode (e.g., for in-app build diagnostics).
9
+ */
10
+ export declare const hasOpenXRSupport: boolean;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasOpenXRSupport = exports.isQuest = void 0;
4
+ const react_native_1 = require("react-native");
5
+ /**
6
+ * True only on actual Meta Quest hardware (Quest 1/2/Pro/3/3S).
7
+ *
8
+ * Detection is based on `Platform.constants` (Android `Build.MANUFACTURER`,
9
+ * `BRAND`, `MODEL`) — NOT on the presence of `NativeModules.VRModuleOpenXR`.
10
+ * The OpenXR module ships with any app built against the Quest variant of
11
+ * react-viro and is therefore present on regular Android phones too when the
12
+ * same APK targets both phone and Quest. Branding strings are the
13
+ * authoritative signal for "is the user wearing a Quest right now".
14
+ *
15
+ * Quest 1/2/Pro: Manufacturer="Oculus", Brand="oculus"
16
+ * Quest 3/3S: Manufacturer="Meta", Brand="meta"
17
+ */
18
+ function detectQuest() {
19
+ if (react_native_1.Platform.OS !== "android")
20
+ return false;
21
+ const c = (react_native_1.Platform.constants ?? {});
22
+ const manufacturer = (c.Manufacturer ?? "").toLowerCase();
23
+ const brand = (c.Brand ?? "").toLowerCase();
24
+ const model = (c.Model ?? "").toLowerCase();
25
+ if (manufacturer === "oculus" ||
26
+ manufacturer === "meta" ||
27
+ brand === "oculus" ||
28
+ brand === "meta") {
29
+ return true;
30
+ }
31
+ // Defensive: future hardware shipping under new manufacturer strings.
32
+ return /\bquest\b/.test(model);
33
+ }
34
+ exports.isQuest = detectQuest();
35
+ /**
36
+ * True when this app build includes the OpenXR VR native module (i.e. the
37
+ * Quest variant of react-viro is registered in `MainApplication`). Does NOT
38
+ * imply the current device is a Quest — for that, use `isQuest`.
39
+ *
40
+ * Useful when you need to decide whether `ViroVRSceneNavigator` *could* render
41
+ * if you forced VR mode (e.g., for in-app build diagnostics).
42
+ */
43
+ exports.hasOpenXRSupport = react_native_1.NativeModules.VRModuleOpenXR !== undefined;
@@ -49,6 +49,25 @@ export declare function latLngToMercator(lat: number, lng: number): [number, num
49
49
  * @returns [arX, arY, arZ] position in metres relative to the device
50
50
  */
51
51
  export declare function gpsToArWorld(devicePose: ViroGeospatialPose, anchorLat: number, anchorLng: number, anchorAlt: number): [number, number, number];
52
+ export type ViroPermission = "camera" | "microphone" | "storage" | "location";
53
+ export interface ViroPermissionsResult {
54
+ camera?: boolean;
55
+ microphone?: boolean;
56
+ storage?: boolean;
57
+ location?: boolean;
58
+ }
59
+ /**
60
+ * Request the specified permissions required for Viro AR to function.
61
+ * Omit `permissions` to request all four (camera, microphone, storage, location).
62
+ * Only the requested keys are present in the resolved result.
63
+ */
64
+ export declare function requestRequiredPermissions(permissions?: ViroPermission[]): Promise<ViroPermissionsResult>;
65
+ /**
66
+ * Check the current status of the specified permissions without prompting the user.
67
+ * Omit `permissions` to check all four (camera, microphone, storage, location).
68
+ * Only the requested keys are present in the resolved result.
69
+ */
70
+ export declare function checkPermissions(permissions?: ViroPermission[]): Promise<ViroPermissionsResult>;
52
71
  export interface ViroiOSArSupportResponse {
53
72
  isARSupported: boolean;
54
73
  }
@@ -14,6 +14,8 @@ exports.polarToCartesian = polarToCartesian;
14
14
  exports.polarToCartesianActual = polarToCartesianActual;
15
15
  exports.latLngToMercator = latLngToMercator;
16
16
  exports.gpsToArWorld = gpsToArWorld;
17
+ exports.requestRequiredPermissions = requestRequiredPermissions;
18
+ exports.checkPermissions = checkPermissions;
17
19
  exports.isARSupportedOnDevice = isARSupportedOnDevice;
18
20
  /**
19
21
  * Convert the given polar coords of the form [r, theta, phi] to cartesian
@@ -113,6 +115,38 @@ function gpsToArWorld(devicePose, anchorLat, anchorLng, anchorAlt) {
113
115
  -distance * Math.cos(relBearing), // arZ
114
116
  ];
115
117
  }
118
+ const ALL_PERMISSIONS = [
119
+ "camera",
120
+ "microphone",
121
+ "storage",
122
+ "location",
123
+ ];
124
+ /**
125
+ * Request the specified permissions required for Viro AR to function.
126
+ * Omit `permissions` to request all four (camera, microphone, storage, location).
127
+ * Only the requested keys are present in the resolved result.
128
+ */
129
+ function requestRequiredPermissions(permissions = ALL_PERMISSIONS) {
130
+ if (react_native_1.Platform.OS === "ios") {
131
+ return react_native_1.NativeModules.VRTARUtils.requestRequiredPermissions(permissions);
132
+ }
133
+ else {
134
+ return react_native_1.NativeModules.VRTARSceneNavigatorModule.requestRequiredPermissions(permissions);
135
+ }
136
+ }
137
+ /**
138
+ * Check the current status of the specified permissions without prompting the user.
139
+ * Omit `permissions` to check all four (camera, microphone, storage, location).
140
+ * Only the requested keys are present in the resolved result.
141
+ */
142
+ function checkPermissions(permissions = ALL_PERMISSIONS) {
143
+ if (react_native_1.Platform.OS === "ios") {
144
+ return react_native_1.NativeModules.VRTARUtils.checkPermissions(permissions);
145
+ }
146
+ else {
147
+ return react_native_1.NativeModules.VRTARSceneNavigatorModule.checkPermissions(permissions);
148
+ }
149
+ }
116
150
  function isARSupportedOnDevice() {
117
151
  return new Promise((resolve, reject) => {
118
152
  if (react_native_1.Platform.OS == "ios") {
@@ -1 +1 @@
1
- export declare const VIRO_VERSION = "2.53.1";
1
+ export declare const VIRO_VERSION = "2.55.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VIRO_VERSION = void 0;
4
- exports.VIRO_VERSION = "2.53.1";
4
+ exports.VIRO_VERSION = "2.55.0";