@vincentt-xr/sdk 2.0.0-alpha.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 (159) hide show
  1. package/GROUNDING.md +537 -0
  2. package/LICENSE +7 -0
  3. package/README.md +85 -0
  4. package/dist/DebuggerUI-CEfdddkZ.cjs +1 -0
  5. package/dist/DebuggerUI-Dgop6Q6o.js +269 -0
  6. package/dist/audio/AudioEngine.d.ts +98 -0
  7. package/dist/audio/index.d.ts +34 -0
  8. package/dist/components/AspectRatioContainer/index.d.ts +10 -0
  9. package/dist/components/BodyTracker/index.d.ts +15 -0
  10. package/dist/components/Debugger/DebuggerProvider.d.ts +22 -0
  11. package/dist/components/Debugger/DebuggerUI.d.ts +13 -0
  12. package/dist/components/Debugger/index.d.ts +38 -0
  13. package/dist/components/Debugger/styles.d.ts +19 -0
  14. package/dist/components/FaceMesh/FaceMesh.d.ts +26 -0
  15. package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +34 -0
  16. package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +16 -0
  17. package/dist/components/FaceMesh/canonical/useCanonicalFaceMesh.d.ts +15 -0
  18. package/dist/components/FaceMesh/deform.d.ts +36 -0
  19. package/dist/components/FaceMesh/index.d.ts +6 -0
  20. package/dist/components/FaceMesh/indices.d.ts +1 -0
  21. package/dist/components/FaceMesh/material/blendModes.d.ts +2 -0
  22. package/dist/components/FaceMesh/material/defaults.d.ts +3 -0
  23. package/dist/components/FaceMesh/material/index.d.ts +5 -0
  24. package/dist/components/FaceMesh/material/options.d.ts +25 -0
  25. package/dist/components/FaceMesh/material/support.d.ts +3 -0
  26. package/dist/components/FaceMesh/material/types.d.ts +23 -0
  27. package/dist/components/FaceMesh/uv.d.ts +1 -0
  28. package/dist/components/FaceRetouch/Background.d.ts +16 -0
  29. package/dist/components/FaceRetouch/index.d.ts +6 -0
  30. package/dist/components/FaceRetouch/landmarkMask.d.ts +23 -0
  31. package/dist/components/FaceRetouch/retouchRegions.d.ts +23 -0
  32. package/dist/components/FaceRetouch/useFaceRetouchMask.d.ts +14 -0
  33. package/dist/components/FaceRetouch/useFaceRetouchRegions.d.ts +12 -0
  34. package/dist/components/FaceTracker/BoundingBoxOverlay.d.ts +20 -0
  35. package/dist/components/FaceTracker/index.d.ts +54 -0
  36. package/dist/components/GestureTracker/index.d.ts +31 -0
  37. package/dist/components/GestureTrigger/index.d.ts +3 -0
  38. package/dist/components/HandTracker/index.d.ts +24 -0
  39. package/dist/components/HeadBinding/index.d.ts +31 -0
  40. package/dist/components/HeadBindingOccluder/index.d.ts +36 -0
  41. package/dist/components/HeadOccluder/index.d.ts +13 -0
  42. package/dist/components/Panel/index.d.ts +71 -0
  43. package/dist/components/PerspectiveCamera/index.d.ts +14 -0
  44. package/dist/components/ScreenSpaceUI/ScreenTransform.d.ts +54 -0
  45. package/dist/components/ScreenSpaceUI/context.d.ts +29 -0
  46. package/dist/components/ScreenSpaceUI/index.d.ts +40 -0
  47. package/dist/components/Segmentation/index.d.ts +44 -0
  48. package/dist/components/SpriteAnimation/index.d.ts +52 -0
  49. package/dist/components/TextLabel/index.d.ts +62 -0
  50. package/dist/components/TrackingAnchor/index.d.ts +74 -0
  51. package/dist/components/VideoBackground/index.d.ts +38 -0
  52. package/dist/components/XRCompositor/index.d.ts +5 -0
  53. package/dist/components/XRDebugView/index.d.ts +6 -0
  54. package/dist/components/XRLayer/index.d.ts +6 -0
  55. package/dist/components/XRMediaSurface/index.d.ts +27 -0
  56. package/dist/components/XRProvider/index.d.ts +13 -0
  57. package/dist/components/XRScene/defaults.d.ts +4 -0
  58. package/dist/components/XRScene/index.d.ts +15 -0
  59. package/dist/components/XRViewport/index.d.ts +101 -0
  60. package/dist/components/index.d.ts +26 -0
  61. package/dist/config/index.d.ts +8 -0
  62. package/dist/constants/index.d.ts +25 -0
  63. package/dist/constants/renderLayers.d.ts +25 -0
  64. package/dist/entries/all.d.ts +15 -0
  65. package/dist/entries/core.d.ts +21 -0
  66. package/dist/entries/face-effects.d.ts +19 -0
  67. package/dist/entries/internal.d.ts +16 -0
  68. package/dist/entries/low-level.d.ts +30 -0
  69. package/dist/entries/tracking.d.ts +15 -0
  70. package/dist/face-effects.cjs +252 -0
  71. package/dist/face-effects.js +3542 -0
  72. package/dist/hasFullUnitUVBounds-BGvcFsQM.js +26 -0
  73. package/dist/hasFullUnitUVBounds-p1Dl0ejX.cjs +1 -0
  74. package/dist/hooks/faceResults.d.ts +39 -0
  75. package/dist/hooks/selectors.d.ts +33 -0
  76. package/dist/hooks/useCalibrationFaceTracker.d.ts +23 -0
  77. package/dist/hooks/useDebugger/index.d.ts +25 -0
  78. package/dist/hooks/useDebugger/types.d.ts +20 -0
  79. package/dist/hooks/useFaceBoundingBox.d.ts +11 -0
  80. package/dist/hooks/useFaceResults.d.ts +31 -0
  81. package/dist/hooks/useGestureEdge.d.ts +53 -0
  82. package/dist/hooks/useMediaRecorder.d.ts +40 -0
  83. package/dist/hooks/useTrackerContext.d.ts +35 -0
  84. package/dist/hooks/useXRModel.d.ts +15 -0
  85. package/dist/hooks/useXRSession/constants.d.ts +4 -0
  86. package/dist/hooks/useXRSession/facade.d.ts +39 -0
  87. package/dist/hooks/useXRSession/fns.d.ts +5 -0
  88. package/dist/hooks/useXRSession/index.d.ts +4 -0
  89. package/dist/hooks/useXRSession/registry.d.ts +52 -0
  90. package/dist/hooks/useXRSession/store.d.ts +40 -0
  91. package/dist/index-B5J4gzn2.cjs +1 -0
  92. package/dist/index-BD-JWMjE.js +1991 -0
  93. package/dist/index-BVBVg96G.cjs +1 -0
  94. package/dist/index-CYMj26Ej.js +1331 -0
  95. package/dist/index-DtwHElmG.js +157 -0
  96. package/dist/index-PtFmD6B8.cjs +1 -0
  97. package/dist/internal-DH5d1Xnq.cjs +1 -0
  98. package/dist/internal-KOKJDxCG.js +519 -0
  99. package/dist/internal.cjs +1 -0
  100. package/dist/internal.js +14 -0
  101. package/dist/low-level.cjs +1 -0
  102. package/dist/low-level.js +941 -0
  103. package/dist/main.cjs +1 -0
  104. package/dist/main.js +612 -0
  105. package/dist/models/Base/index.d.ts +25 -0
  106. package/dist/models/Body/index.d.ts +22 -0
  107. package/dist/models/Face/constants.d.ts +2 -0
  108. package/dist/models/Face/index.d.ts +45 -0
  109. package/dist/models/Face/landmarksData.d.ts +2 -0
  110. package/dist/models/Hand/GestureTracking.d.ts +21 -0
  111. package/dist/models/Hand/HandTracking.d.ts +21 -0
  112. package/dist/models/Segmentation/index.d.ts +75 -0
  113. package/dist/models/index.d.ts +5 -0
  114. package/dist/modules/XRClient/index.d.ts +9 -0
  115. package/dist/modules/index.d.ts +1 -0
  116. package/dist/selectors-BHO6TnoC.js +59 -0
  117. package/dist/selectors-Bub0o3qy.cjs +1 -0
  118. package/dist/services/ApiService.d.ts +12 -0
  119. package/dist/services/MetricsCollector/CameraFPSTracker.d.ts +25 -0
  120. package/dist/services/MetricsCollector/MemoryTracker.d.ts +43 -0
  121. package/dist/services/MetricsCollector/RenderTimeTracker.d.ts +10 -0
  122. package/dist/services/MetricsCollector/ResolutionTracker.d.ts +26 -0
  123. package/dist/services/MetricsCollector/index.d.ts +59 -0
  124. package/dist/services/MetricsCollector/types.d.ts +47 -0
  125. package/dist/services/MetricsCollector/utils.d.ts +65 -0
  126. package/dist/texture/computeContainScale.d.ts +25 -0
  127. package/dist/texture/hasFullUnitUVBounds.d.ts +37 -0
  128. package/dist/texture/types.d.ts +20 -0
  129. package/dist/tracking.cjs +1 -0
  130. package/dist/tracking.js +344 -0
  131. package/dist/types/body.d.ts +3 -0
  132. package/dist/types/client.d.ts +3 -0
  133. package/dist/types/common.d.ts +9 -0
  134. package/dist/types/compositor.d.ts +23 -0
  135. package/dist/types/debugger.d.ts +83 -0
  136. package/dist/types/face.d.ts +67 -0
  137. package/dist/types/gesture-tracking.d.ts +15 -0
  138. package/dist/types/hand-tracking.d.ts +5 -0
  139. package/dist/types/headBinding.d.ts +67 -0
  140. package/dist/types/index.d.ts +12 -0
  141. package/dist/types/logger.d.ts +4 -0
  142. package/dist/types/model.d.ts +46 -0
  143. package/dist/types/nodes.d.ts +35 -0
  144. package/dist/types/segmentation.d.ts +31 -0
  145. package/dist/types/session.d.ts +102 -0
  146. package/dist/types/tracking.d.ts +30 -0
  147. package/dist/types/util-types.d.ts +1 -0
  148. package/dist/useFaceResults-cpsSmKKc.js +81 -0
  149. package/dist/useFaceResults-hVUJYSEY.cjs +1 -0
  150. package/dist/utils/calibrationDebug.d.ts +9 -0
  151. package/dist/utils/dataURL.d.ts +6 -0
  152. package/dist/utils/drawMediaCover.d.ts +18 -0
  153. package/dist/utils/errors.d.ts +3 -0
  154. package/dist/utils/fns.d.ts +48 -0
  155. package/dist/utils/headBinding.d.ts +85 -0
  156. package/dist/utils/integrity.d.ts +43 -0
  157. package/dist/utils/landmarkBounds.d.ts +11 -0
  158. package/dist/utils/logger.d.ts +7 -0
  159. package/package.json +113 -0
@@ -0,0 +1,2 @@
1
+ import { FaceMeshBlendMode } from './types';
2
+ export declare const blendModeIndices: Record<FaceMeshBlendMode, number>;
@@ -0,0 +1,3 @@
1
+ import { FaceMeshAppearance, FaceMeshMasking } from './types';
2
+ export declare const DEFAULT_APPEARANCE: FaceMeshAppearance;
3
+ export declare const DEFAULT_MASKING: FaceMeshMasking;
@@ -0,0 +1,5 @@
1
+ export * from './types';
2
+ export * from './blendModes';
3
+ export * from './defaults';
4
+ export * from './options';
5
+ export * from './support';
@@ -0,0 +1,25 @@
1
+ import { FaceMeshAlphaMap, FaceMeshBlendMode, FaceMeshMaterialType, FaceMeshShaderPreset, FaceMeshSide, FaceMeshTextureMap } from './types';
2
+ export declare const materialTypeOptions: Array<{
3
+ label: string;
4
+ value: FaceMeshMaterialType;
5
+ }>;
6
+ export declare const shaderPresetOptions: Array<{
7
+ label: string;
8
+ value: FaceMeshShaderPreset;
9
+ }>;
10
+ export declare const sideOptions: Array<{
11
+ label: string;
12
+ value: FaceMeshSide;
13
+ }>;
14
+ export declare const textureMapOptions: Array<{
15
+ label: string;
16
+ value: FaceMeshTextureMap;
17
+ }>;
18
+ export declare const alphaMapOptions: Array<{
19
+ label: string;
20
+ value: FaceMeshAlphaMap;
21
+ }>;
22
+ export declare const blendModeOptions: Array<{
23
+ label: string;
24
+ value: FaceMeshBlendMode;
25
+ }>;
@@ -0,0 +1,3 @@
1
+ import { FaceMeshMaterialType, FaceMeshShaderPreset } from './types';
2
+ export declare const supportsTexturePanel: (materialType: FaceMeshMaterialType, shaderPreset: FaceMeshShaderPreset) => boolean;
3
+ export declare const supportsBlendMode: (materialType: FaceMeshMaterialType, shaderPreset: FaceMeshShaderPreset) => boolean;
@@ -0,0 +1,23 @@
1
+ export type FaceMeshMaterialType = "basic" | "standard" | "physical" | "toon" | "normal" | "matcap" | "wireframe" | "shader";
2
+ export type FaceMeshShaderPreset = "basicShader" | "originalFace" | "composite";
3
+ export type FaceMeshTextureMap = "none" | "canonical" | "style2";
4
+ export type FaceMeshAlphaMap = "none" | "canonical";
5
+ export type FaceMeshMaskTextureSource = "none" | "canonical";
6
+ export type FaceMeshSide = "front" | "back" | "double";
7
+ export type FaceMeshBlendMode = "normal" | "add" | "subtract" | "multiply" | "screen" | "overlay" | "softLight" | "hardLight" | "lighten" | "darken" | "difference" | "exclusion";
8
+ export type FaceMeshAppearance = {
9
+ materialType: FaceMeshMaterialType;
10
+ shaderPreset: FaceMeshShaderPreset;
11
+ textureMap: FaceMeshTextureMap;
12
+ alphaMap: FaceMeshAlphaMap;
13
+ alphaOpacity: number;
14
+ side: FaceMeshSide;
15
+ blendMode: FaceMeshBlendMode;
16
+ baseColor: string;
17
+ opacity: number;
18
+ };
19
+ export type FaceMeshMasking = {
20
+ mouth: boolean;
21
+ eyes: boolean;
22
+ nose: boolean;
23
+ };
@@ -0,0 +1 @@
1
+ export declare const FACE_MESH_UV: number[];
@@ -0,0 +1,16 @@
1
+ import * as THREE from "three";
2
+ export type FaceRetouchBackgroundProps = {
3
+ retouchMask: THREE.Texture;
4
+ mouthMask: THREE.Texture;
5
+ retouchAmount: number;
6
+ blurRadius: number;
7
+ teethWhitening: number;
8
+ previewMask: boolean;
9
+ protectLandmarks: boolean;
10
+ };
11
+ /**
12
+ * Full-screen plane that composites the live camera texture with a
13
+ * landmark-driven retouch (skin smoothing + teeth whitening). Pair with
14
+ * `useFaceRetouchMask` to drive the masks.
15
+ */
16
+ export declare const FaceRetouchBackground: ({ retouchMask, mouthMask, retouchAmount, blurRadius, teethWhitening, previewMask, protectLandmarks, }: FaceRetouchBackgroundProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ export { FaceRetouchBackground } from './Background';
2
+ export type { FaceRetouchBackgroundProps } from './Background';
3
+ export { drawFaceRetouchMask, drawMouthRetouchMask, FACE_MASK_SIZE, FACE_OVAL, LEFT_EYE, RIGHT_EYE, OUTER_LIPS, INNER_MOUTH, LEFT_EYEBROW, RIGHT_EYEBROW, } from './landmarkMask';
4
+ export { createFaceRetouchRegions, DEFAULT_FEATURE_GROUPS, DEFAULT_FEATURE_POINT_INDICES, type CreateFaceRetouchRegionsOptions, } from './retouchRegions';
5
+ export { useFaceRetouchMask } from './useFaceRetouchMask';
6
+ export { useFaceRetouchRegions } from './useFaceRetouchRegions';
@@ -0,0 +1,23 @@
1
+ import { FaceLandmark2D } from '../../types/face';
2
+ export declare const FACE_MASK_SIZE = 512;
3
+ export declare const FACE_OVAL: number[];
4
+ export declare const LEFT_EYE: number[];
5
+ export declare const RIGHT_EYE: number[];
6
+ export declare const OUTER_LIPS: number[];
7
+ export declare const INNER_MOUTH: number[];
8
+ export declare const LEFT_EYEBROW: number[];
9
+ export declare const RIGHT_EYEBROW: number[];
10
+ /**
11
+ * Render the three-channel face retouch mask used by FaceRetouchBackground:
12
+ * - R: blurred face oval (soft retouch region)
13
+ * - G: blurred feature polygons (protected: eyes, brows, lips, nose)
14
+ * - B: hard face oval (clamping mask)
15
+ *
16
+ * `size` defaults to FACE_MASK_SIZE (512). The context must be sized to match.
17
+ */
18
+ export declare const drawFaceRetouchMask: (context: CanvasRenderingContext2D, landmarks: FaceLandmark2D[] | undefined, size?: number) => void;
19
+ /**
20
+ * Render a single-channel mouth mask (inner-lip polygon, lightly blurred).
21
+ * Used for teeth-whitening regions.
22
+ */
23
+ export declare const drawMouthRetouchMask: (context: CanvasRenderingContext2D, landmarks: FaceLandmark2D[] | undefined, size?: number) => void;
@@ -0,0 +1,23 @@
1
+ import { FaceLandmark2D, FaceRetouchRegion } from '../../types/face';
2
+ export declare const DEFAULT_FEATURE_GROUPS: number[][];
3
+ export declare const DEFAULT_FEATURE_POINT_INDICES: number[];
4
+ export type CreateFaceRetouchRegionsOptions = {
5
+ faceOvalIndices?: number[];
6
+ featureGroups?: number[][];
7
+ featurePointIndices?: number[];
8
+ faceBoundsExpansion?: number;
9
+ featureBoundsExpansion?: number;
10
+ minRegionRadius?: number;
11
+ faceRegionStrength?: number;
12
+ featureRegionStrength?: number;
13
+ featurePointRegionStrength?: number;
14
+ featurePointRadiusRatio?: number;
15
+ };
16
+ /**
17
+ * Compute elliptical retouch regions from MediaPipe face landmarks.
18
+ *
19
+ * The defaults match the V2 face-retouch demo. Override `featureGroups`
20
+ * or `featurePointIndices` to retouch a different anatomy (or a different
21
+ * landmark model).
22
+ */
23
+ export declare const createFaceRetouchRegions: (landmarks: FaceLandmark2D[] | undefined, options?: CreateFaceRetouchRegionsOptions) => FaceRetouchRegion[];
@@ -0,0 +1,14 @@
1
+ import { XRModelNodeFaceTracking } from '../../types/nodes';
2
+ import * as THREE from "three";
3
+ /**
4
+ * Drive the two CanvasTexture masks consumed by `FaceRetouchBackground`
5
+ * from the latest face landmarks. Re-rendered on requestAnimationFrame.
6
+ *
7
+ * `size` controls the mask resolution (default 512). Both masks share the
8
+ * same size.
9
+ */
10
+ export declare const useFaceRetouchMask: (faceNode: XRModelNodeFaceTracking | null, size?: number) => {
11
+ canvas: HTMLCanvasElement;
12
+ texture: THREE.CanvasTexture;
13
+ mouthTexture: THREE.CanvasTexture;
14
+ };
@@ -0,0 +1,12 @@
1
+ import { FaceRetouchRegion } from '../../types/face';
2
+ import { XRModelNodeFaceTracking } from '../../types/nodes';
3
+ import { CreateFaceRetouchRegionsOptions } from './retouchRegions';
4
+ /**
5
+ * Continuously recompute face-retouch regions from the active face's
6
+ * landmarks. Returns a stable array reference when the regions haven't
7
+ * meaningfully changed (4-decimal precision).
8
+ *
9
+ * Pass `options` to retouch a different anatomy or landmark model — see
10
+ * `createFaceRetouchRegions`.
11
+ */
12
+ export declare const useFaceRetouchRegions: (faceNode: XRModelNodeFaceTracking | null, options?: CreateFaceRetouchRegionsOptions) => FaceRetouchRegion[];
@@ -0,0 +1,20 @@
1
+ import { CSSProperties } from 'react';
2
+ import { BoundingBox } from '../../types/face';
3
+ export type BoundingBoxOverlayProps = {
4
+ /** Normalized 0..1 bounding box, e.g. from `useFaceBoundingBox`. */
5
+ boundingBox: BoundingBox;
6
+ /** Optional label rendered above the box. Pass `null` to hide. Default: "face bounding box". */
7
+ label?: string | null;
8
+ /** Border color. Default: tailwind green-500. */
9
+ color?: string;
10
+ /** Override the rendered <div> style (merges over defaults). */
11
+ style?: CSSProperties;
12
+ /** Override the label <div> style (merges over defaults). */
13
+ labelStyle?: CSSProperties;
14
+ };
15
+ /**
16
+ * Absolutely-positioned DOM overlay for a normalized bounding box.
17
+ * Render this inside a relatively-positioned container that mirrors the
18
+ * camera feed dimensions.
19
+ */
20
+ export declare const BoundingBoxOverlay: ({ boundingBox, label, color, style, labelStyle, }: BoundingBoxOverlayProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,54 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { FaceMesh } from '../FaceMesh';
3
+ type FaceTrackerProps = PropsWithChildren & {
4
+ /** Index of the face to bind to in the face-tracking model's results. */
5
+ faceIndex?: number;
6
+ /**
7
+ * Maximum number of faces the shared face-tracking model should detect.
8
+ * The first mounted face-tracking consumer initializes the shared model,
9
+ * so multi-face scenes should pass the same value to every binding.
10
+ */
11
+ numFaces?: number;
12
+ /**
13
+ * When `true`, children are also scaled by the detected face's
14
+ * cheek-to-cheek extent (face-normalized units, ~0.13 world units per
15
+ * authored unit). Useful for filters and jewellery that should resize
16
+ * with the face. Default `false` so that 1×1 author units stay 1×1
17
+ * world units — preserves WYSIWYG with the design editor.
18
+ */
19
+ scaleWithFace?: boolean;
20
+ /**
21
+ * Cap this tracker's inference rate (fps). Overrides the session-level
22
+ * `perf.targetFps`. Lower = cooler, less smooth. Omit to inherit the session
23
+ * default (or uncapped). The first mounted face consumer wins, mirroring
24
+ * `numFaces`.
25
+ */
26
+ targetFps?: number;
27
+ /**
28
+ * Whether this tracker should run. `false` pauses the shared model's
29
+ * per-frame inference (and its expensive GPU→CPU readback) while keeping it
30
+ * mounted and initialized, so gating it off-scene costs nothing yet flipping
31
+ * back to `true` resumes instantly — no unmount, no registry re-acquire race.
32
+ * When several trackers share the model, it runs while any is active.
33
+ * Defaults to `true`.
34
+ */
35
+ active?: boolean;
36
+ };
37
+ declare const FaceTrackerComponent: ({ faceIndex, numFaces, scaleWithFace, targetFps, active, children, }: FaceTrackerProps) => import("react/jsx-runtime").JSX.Element;
38
+ /**
39
+ * Face mesh sub-component. Renders the deforming MediaPipe face mesh
40
+ * for the parent `FaceTracker`'s face index. Replaces the legacy
41
+ * `FaceMesh` top-level component.
42
+ *
43
+ * Implementation delegates to the existing `FaceMesh` component, which
44
+ * already handles geometry updates per frame and material composition.
45
+ */
46
+ declare const FaceTrackerMesh: typeof FaceMesh;
47
+ export declare const FaceTracker: typeof FaceTrackerComponent & {
48
+ Mesh: typeof FaceTrackerMesh;
49
+ };
50
+ export declare const HeadTracker: (({ faceIndex, numFaces, scaleWithFace, targetFps, active, children, }: FaceTrackerProps) => import("react/jsx-runtime").JSX.Element) & {
51
+ Mesh: typeof FaceTrackerMesh;
52
+ };
53
+ export { BoundingBoxOverlay } from './BoundingBoxOverlay';
54
+ export type { BoundingBoxOverlayProps } from './BoundingBoxOverlay';
@@ -0,0 +1,31 @@
1
+ import { PropsWithChildren } from 'react';
2
+ type GestureTrackerProps = PropsWithChildren & {
3
+ /** Hand index in detection results. Defaults to 0. */
4
+ handIndex?: number;
5
+ /**
6
+ * Cap this tracker's inference rate (fps). Overrides the session-level
7
+ * `perf.targetFps` and the gesture model's 15fps default. Lower = cooler.
8
+ */
9
+ targetFps?: number;
10
+ /**
11
+ * Whether this tracker should run. `false` pauses the shared model's
12
+ * per-frame inference (and its expensive GPU→CPU readback) while keeping it
13
+ * mounted and initialized, so gating it off-scene costs nothing yet flipping
14
+ * back to `true` resumes instantly — no unmount, no registry re-acquire race.
15
+ * When several trackers share the model, it runs while any is active.
16
+ * Defaults to `true`.
17
+ */
18
+ active?: boolean;
19
+ };
20
+ /**
21
+ * Declarative wrapper around the gesture-tracking model. Mounting this
22
+ * acquires the model for as long as the component is mounted; consumers
23
+ * can read `context.xr.session.getModelNode(XRModel.GESTURE_TRACKER)` in
24
+ * scene scripts without calling `registerXRPipeline` themselves.
25
+ *
26
+ * Mirrors `<HandTracker>` semantics — children inherit the wrist
27
+ * transform — but binds to the gesture recognizer so the node also
28
+ * exposes `.gesture` (e.g. `"victory"`, `"pointing_up"`).
29
+ */
30
+ export declare const GestureTracker: ({ children, targetFps, active }: GestureTrackerProps) => import("react/jsx-runtime").JSX.Element;
31
+ export {};
@@ -0,0 +1,3 @@
1
+ import { UseGestureEdgeOptions } from '../../hooks/useGestureEdge';
2
+ export type GestureTriggerProps = UseGestureEdgeOptions;
3
+ export declare const GestureTrigger: (props: GestureTriggerProps) => null;
@@ -0,0 +1,24 @@
1
+ import { PropsWithChildren } from 'react';
2
+ type HandTrackerProps = PropsWithChildren & {
3
+ /** Which hand to bind to. Currently informational — the model tracks one hand. */
4
+ hand?: "left" | "right";
5
+ /** Hand index in detection results. Defaults to 0. */
6
+ handIndex?: number;
7
+ /**
8
+ * Cap this tracker's inference rate (fps). Overrides the session-level
9
+ * `perf.targetFps`. Lower = cooler, less smooth. Omit to inherit the session
10
+ * default (or uncapped).
11
+ */
12
+ targetFps?: number;
13
+ /**
14
+ * Whether this tracker should run. `false` pauses the shared model's
15
+ * per-frame inference (and its expensive GPU→CPU readback) while keeping it
16
+ * mounted and initialized, so gating it off-scene costs nothing yet flipping
17
+ * back to `true` resumes instantly — no unmount, no registry re-acquire race.
18
+ * When several trackers share the model, it runs while any is active.
19
+ * Defaults to `true`.
20
+ */
21
+ active?: boolean;
22
+ };
23
+ export declare const HandTracker: ({ children, targetFps, active }: HandTrackerProps) => import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1,31 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import * as THREE from "three";
3
+ export type HeadBindingOccluderOptions = {
4
+ position?: [number, number, number];
5
+ rotation?: [number, number, number];
6
+ scale?: [number, number, number];
7
+ url?: string;
8
+ showDebugMaterial?: boolean;
9
+ opacity?: number;
10
+ };
11
+ export type HeadBindingProps = PropsWithChildren & {
12
+ /** Face index from the shared face-tracking result to bind this subtree to. */
13
+ faceIndex?: number;
14
+ /**
15
+ * Maximum number of faces the shared tracker should detect. Defaults to 4
16
+ * so multiple `<HeadBinding faceIndex={...}>` instances work out of the box.
17
+ * Use `numFaces={1}` for single-face experiences that need maximum speed.
18
+ */
19
+ numFaces?: number;
20
+ /**
21
+ * Optional face-relative scaling. Enabled by default because head occlusion
22
+ * must follow the detected face size rather than raw world units.
23
+ */
24
+ scaleWithFace?: boolean;
25
+ /** Render the depth-only head mesh that lets 3D children pass behind the head. */
26
+ occluder?: boolean | HeadBindingOccluderOptions;
27
+ /** Optional debug face mesh for calibration and authoring. */
28
+ showFaceMesh?: boolean;
29
+ faceMeshMaterial?: THREE.Material;
30
+ };
31
+ export declare const HeadBinding: ({ children, faceIndex, numFaces, scaleWithFace, occluder, showFaceMesh, faceMeshMaterial, }: HeadBindingProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { FaceTrackingResult } from '../../types/face';
2
+ import { HeadBindingCubeModel, HeadBindingCubePose } from '../../types/headBinding';
3
+ type HeadBindingOccluderProps = {
4
+ boxColor: string;
5
+ boxOpacity: number;
6
+ face: FaceTrackingResult | null;
7
+ headDepthOffset: number;
8
+ lockDepth: boolean;
9
+ lockRotation: boolean;
10
+ model: HeadBindingCubeModel;
11
+ occluderOffset: [number, number, number];
12
+ occluderOpacity: number;
13
+ occluderScale: [number, number, number];
14
+ showOccluderProxy?: boolean;
15
+ offsetX: number;
16
+ offsetY: number;
17
+ pose?: HeadBindingCubePose | null;
18
+ rotationOffsetX: number;
19
+ rotationOffsetY: number;
20
+ rotationOffsetZ: number;
21
+ scaleX: number;
22
+ scaleY: number;
23
+ scaleZ: number;
24
+ show: boolean;
25
+ showCenterDot: boolean;
26
+ showFacePlaneReference: boolean;
27
+ showGizmo: boolean;
28
+ showHeadOccluder: boolean;
29
+ skullCenterMode: boolean;
30
+ skullVerticalBias: number;
31
+ url?: string;
32
+ viewportHeight: number;
33
+ viewportWidth: number;
34
+ };
35
+ export declare const HeadBindingOccluder: ({ boxColor, boxOpacity, face, headDepthOffset, lockDepth, lockRotation, model, occluderOffset, occluderOpacity, occluderScale, showOccluderProxy, offsetX, offsetY, pose: solvedPose, rotationOffsetX, rotationOffsetY, rotationOffsetZ, scaleX, scaleY, scaleZ, show, showCenterDot, showFacePlaneReference, showGizmo, showHeadOccluder, skullCenterMode, skullVerticalBias, url, viewportHeight, viewportWidth, }: HeadBindingOccluderProps) => import("react/jsx-runtime").JSX.Element | null;
36
+ export {};
@@ -0,0 +1,13 @@
1
+ type HeadOccluderProps = {
2
+ position?: [number, number, number];
3
+ rotation?: [number, number, number];
4
+ scale?: [number, number, number];
5
+ url?: string;
6
+ showDebugMaterial?: boolean;
7
+ opacity?: number;
8
+ };
9
+ export declare const HEAD_OCCLUDER_DEFAULT_POSITION: [number, number, number];
10
+ export declare const HEAD_OCCLUDER_DEFAULT_SCALE: [number, number, number];
11
+ export declare const HEAD_OCCLUDER_DEFAULT_OPACITY = 1;
12
+ export declare const HeadOccluder: ({ position: modelPosition, rotation: modelRotation, scale: modelScale, url, showDebugMaterial, opacity, }: HeadOccluderProps) => import("react/jsx-runtime").JSX.Element | null;
13
+ export {};
@@ -0,0 +1,71 @@
1
+ import * as THREE from "three";
2
+ /**
3
+ * `<Panel>` — a rounded, colored, optionally outlined rectangle rendered as
4
+ * a single textured mesh. A first-class scene-tree primitive so lifecycle
5
+ * scripts don't have to hand-paint canvas textures for cosmetic surfaces.
6
+ *
7
+ * The mesh is sized 1×1 in world units by default; place / size it through
8
+ * the parent (`scale` on the JSX node, or anchored inside a
9
+ * `<ScreenTransform>` / `<TrackingAnchor>`).
10
+ *
11
+ * Rendering: a single `MeshBasicMaterial` with a procedurally drawn
12
+ * `CanvasTexture`. The texture is rebuilt only when one of the visual
13
+ * props changes, never per frame.
14
+ */
15
+ export type PanelProps = {
16
+ /** Fill color. CSS color string. Default `rgba(20,40,110,0.88)`. */
17
+ color?: string;
18
+ /** Optional border color. Omit for no border. */
19
+ borderColor?: string;
20
+ /** Border thickness, in canvas px. Ignored when `borderColor` is unset. Default 0. */
21
+ borderWidth?: number;
22
+ /**
23
+ * Corner radius, in canvas px. Use 0 for a square panel. Default 24.
24
+ * Note: the texture canvas is fixed at ~512×512 px; visual radius scales
25
+ * with the mesh's world size.
26
+ */
27
+ borderRadius?: number;
28
+ /**
29
+ * Internal canvas size (px). Larger = crisper at the cost of GPU memory.
30
+ * 512 is plenty for most cosmetic panels. Default 512.
31
+ */
32
+ resolution?: number;
33
+ /**
34
+ * Aspect ratio of the panel's content area (width / height). The mesh
35
+ * itself is always 1×1; this controls how the texture is drawn so that
36
+ * the corner radius reads correctly when the panel is non-square.
37
+ * Default 1 (square).
38
+ */
39
+ aspect?: number;
40
+ /** Material opacity multiplier. Default 1. */
41
+ opacity?: number;
42
+ /** Optional `name` for runtime `getObjectByName` lookups. */
43
+ name?: string;
44
+ /**
45
+ * When true, the panel ignores depth — appropriate for overlay UI.
46
+ * Default true (matches the common ScreenSpaceUI use case).
47
+ */
48
+ overlay?: boolean;
49
+ /** Local position offset, forwarded to the underlying mesh. */
50
+ position?: [number, number, number];
51
+ /** Local rotation (Euler radians), forwarded to the underlying mesh. */
52
+ rotation?: [number, number, number];
53
+ /** Local scale, forwarded to the underlying mesh. */
54
+ scale?: [number, number, number] | number;
55
+ /** Mesh visibility, forwarded so descendants inherit correctly. */
56
+ visible?: boolean;
57
+ };
58
+ export declare function Panel({ color, borderColor, borderWidth, borderRadius, resolution, aspect, opacity, name, overlay, position, rotation, scale, visible, }: PanelProps): import("react/jsx-runtime").JSX.Element;
59
+ /**
60
+ * Internal: draw a rounded rect with optional stroke into an offscreen
61
+ * canvas and wrap it as a CanvasTexture. Exported for `<TextLabel>` to
62
+ * reuse the same drawing path.
63
+ */
64
+ export declare function buildPanelTexture(opts: {
65
+ width: number;
66
+ height: number;
67
+ color: string;
68
+ borderColor?: string;
69
+ borderWidth: number;
70
+ borderRadius: number;
71
+ }): THREE.CanvasTexture;
@@ -0,0 +1,14 @@
1
+ import { PerspectiveCameraProps } from '@react-three/fiber';
2
+ /**
3
+ * @deprecated Use @react-three/drei's PerspectiveCamera directly for the new unified architecture.
4
+ * This component is kept for backwards compatibility with old examples.
5
+ *
6
+ * For new projects, use:
7
+ * ```tsx
8
+ * import { PerspectiveCamera } from '@react-three/drei';
9
+ * <PerspectiveCamera makeDefault position={[0, 0, 5]} fov={45} />
10
+ * ```
11
+ */
12
+ export declare const PerspectiveCamera: (props: PerspectiveCameraProps & {
13
+ makeDefault?: boolean;
14
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,54 @@
1
+ import { ReactNode } from 'react';
2
+ export type ScreenAnchorEdges = {
3
+ left?: number;
4
+ right?: number;
5
+ top?: number;
6
+ bottom?: number;
7
+ };
8
+ export type ScreenOffsetEdges = {
9
+ left?: number;
10
+ right?: number;
11
+ top?: number;
12
+ bottom?: number;
13
+ };
14
+ export type ScreenTransformProps = {
15
+ /**
16
+ * Per-edge anchors normalized to [-1, 1]. -1 = parent's left/bottom edge,
17
+ * +1 = parent's right/top edge. When `left !== right` or `top !== bottom`
18
+ * the element stretches between the anchor positions.
19
+ * @default { left: 0, right: 0, top: 0, bottom: 0 }
20
+ */
21
+ anchors?: ScreenAnchorEdges;
22
+ /**
23
+ * Per-edge offsets in world units. Each offset is applied as inward
24
+ * padding from the corresponding anchor position.
25
+ * @default { left: 0, right: 0, top: 0, bottom: 0 }
26
+ */
27
+ offsets?: ScreenOffsetEdges;
28
+ /**
29
+ * Pivot in normalized local space ([-1, 1] per axis). Used as the
30
+ * (0, 0) point for children and as the rotation center.
31
+ * @default [0, 0]
32
+ */
33
+ pivot?: [number, number];
34
+ children?: ReactNode;
35
+ };
36
+ export type ResolvedScreenTransform = {
37
+ centerX: number;
38
+ centerY: number;
39
+ width: number;
40
+ height: number;
41
+ pivotX: number;
42
+ pivotY: number;
43
+ };
44
+ /**
45
+ * Pure layout math for `ScreenTransform`. Exported for unit testing
46
+ * and for the editor's anchor picker preview.
47
+ */
48
+ export declare const computeScreenTransform: (parentWidth: number, parentHeight: number, anchors: Required<ScreenAnchorEdges>, offsets: Required<ScreenOffsetEdges>, pivot: [number, number]) => ResolvedScreenTransform;
49
+ /**
50
+ * `ScreenTransform` lays out its children inside a `ScreenSpaceUI`
51
+ * parent using normalized anchors + per-edge offsets. The element
52
+ * stretches between opposing anchors when they differ.
53
+ */
54
+ export declare const ScreenTransform: ({ anchors, offsets, pivot, children, }: ScreenTransformProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ export type ScreenDimensions = {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ export declare const ScreenSpaceContext: import('react').Context<ScreenDimensions | null>;
6
+ export declare const useScreenSpace: () => ScreenDimensions;
7
+ /**
8
+ * Published by `ScreenTransform` so descendants (specifically the xr-client
9
+ * renderer applying `mapFit: "contain"`) know the rendered width/height
10
+ * aspect of the enclosing rect. The v2 fit mechanism multiplies a
11
+ * contain-scale factor into the mesh's scale using this aspect as the
12
+ * "rect aspect" input to `computeContainScale`.
13
+ *
14
+ * `null` outside a ScreenTransform — the renderer uses the null sentinel
15
+ * to detect the out-of-context case and skip fit with a warning (rect is
16
+ * ambiguous without a ScreenTransform). Consumers that just want the
17
+ * aspect for layout can use `useScreenRectAspect()` which maps `null` → 1.
18
+ */
19
+ export declare const ScreenRectAspectContext: import('react').Context<number | null>;
20
+ /**
21
+ * Returns the rendered aspect ratio (width / height) of the nearest
22
+ * enclosing `ScreenTransform`, or `1` when no ScreenTransform is above.
23
+ *
24
+ * Consumers that need to distinguish "no ScreenTransform above me" from
25
+ * "rect aspect is 1" (specifically the renderer's `mapFit: "contain"` path)
26
+ * should read `ScreenRectAspectContext` directly with `useContext` so they
27
+ * see the `null` sentinel.
28
+ */
29
+ export declare const useScreenRectAspect: () => number;
@@ -0,0 +1,40 @@
1
+ import { ReactNode } from 'react';
2
+ import { useScreenSpace, useScreenRectAspect, ScreenRectAspectContext, ScreenDimensions } from './context';
3
+ export { useScreenSpace, useScreenRectAspect, ScreenRectAspectContext };
4
+ export type { ScreenDimensions };
5
+ export type ScreenSpaceUIProps = {
6
+ /**
7
+ * Child components to render in screen space.
8
+ * Use useScreenSpace() hook to access screen dimensions.
9
+ */
10
+ children: ReactNode;
11
+ /**
12
+ * Z position of the screen plane.
13
+ * Default: 0 (at the camera's focal plane)
14
+ */
15
+ depth?: number;
16
+ };
17
+ /**
18
+ * ScreenSpaceUI provides a container for 2D UI elements that maintain
19
+ * consistent screen-space positioning regardless of camera movement.
20
+ *
21
+ * Children must be `ScreenTransform` nodes, which express normalized-anchor +
22
+ * edge-offset layouts (corners, edges, full-width bands, fill, …). The editor
23
+ * exposes the common cases as `AnchorPicker` presets.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * <ScreenSpaceUI>
28
+ * <ScreenTransform
29
+ * anchors={{ left: -1, right: 1, top: -0.7, bottom: -1 }}
30
+ * offsets={{ left: 0.1, right: 0.1, top: 0, bottom: 0.1 }}
31
+ * >
32
+ * <FullWidthBanner />
33
+ * </ScreenTransform>
34
+ * </ScreenSpaceUI>
35
+ * ```
36
+ */
37
+ export declare const ScreenSpaceUI: ({ children, depth }: ScreenSpaceUIProps) => import("react/jsx-runtime").JSX.Element;
38
+ export { ScreenTransform } from './ScreenTransform';
39
+ export type { ScreenTransformProps, ScreenAnchorEdges, ScreenOffsetEdges, ResolvedScreenTransform, } from './ScreenTransform';
40
+ export { computeScreenTransform } from './ScreenTransform';