@react-three/fiber 10.0.0-canary.ea31ccd → 10.0.0-canary.ee5a08a

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 (39) hide show
  1. package/dist/chunks/webgl.cjs +27 -0
  2. package/dist/chunks/webgl.mjs +11 -0
  3. package/dist/chunks/webgpu.cjs +37 -0
  4. package/dist/chunks/webgpu.mjs +21 -0
  5. package/dist/extension.cjs +13 -0
  6. package/dist/extension.d.cts +19 -0
  7. package/dist/extension.d.mts +19 -0
  8. package/dist/extension.d.ts +19 -0
  9. package/dist/extension.mjs +1 -0
  10. package/dist/index.cjs +97 -15371
  11. package/dist/index.d.cts +123 -3873
  12. package/dist/index.d.mts +123 -3873
  13. package/dist/index.d.ts +122 -3844
  14. package/dist/index.mjs +10 -15272
  15. package/dist/legacy.cjs +97 -15326
  16. package/dist/legacy.d.cts +114 -3874
  17. package/dist/legacy.d.mts +114 -3874
  18. package/dist/legacy.d.ts +115 -3849
  19. package/dist/legacy.mjs +14 -15230
  20. package/dist/shared/fiber.B0oukOFO.mjs +364 -0
  21. package/dist/shared/fiber.BDWBTuAk.d.mts +2797 -0
  22. package/dist/shared/fiber.BU0vBHc9.d.mts +48 -0
  23. package/dist/shared/fiber.Cx-UAmMb.d.ts +48 -0
  24. package/dist/shared/fiber.DAl4H27x.d.cts +48 -0
  25. package/dist/shared/fiber.DNgUv56V.d.ts +2797 -0
  26. package/dist/shared/fiber.DlTSmVjz.d.cts +2797 -0
  27. package/dist/shared/fiber.I5Q4dVvl.d.cts +778 -0
  28. package/dist/shared/fiber.I5Q4dVvl.d.mts +778 -0
  29. package/dist/shared/fiber.I5Q4dVvl.d.ts +778 -0
  30. package/dist/shared/fiber.khFlPHPf.cjs +397 -0
  31. package/dist/shared/fiber.oKEFddXj.cjs +16059 -0
  32. package/dist/shared/fiber.tsM9NKZ9.mjs +15961 -0
  33. package/dist/webgpu/index.cjs +100 -16211
  34. package/dist/webgpu/index.d.cts +112 -4190
  35. package/dist/webgpu/index.d.mts +112 -4190
  36. package/dist/webgpu/index.d.ts +112 -4162
  37. package/dist/webgpu/index.mjs +15 -16095
  38. package/package.json +11 -8
  39. package/readme.md +1 -1
package/dist/legacy.d.ts CHANGED
@@ -1,3863 +1,129 @@
1
- import * as THREE$1 from 'three';
2
- import { WebGLCubeRenderTarget, WebGLRenderTarget, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Object3D, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Frustum, OrthographicCamera } from 'three';
3
- import * as React$1 from 'react';
4
- import { ReactNode, Component, RefObject, JSX } from 'react';
5
- import * as three_webgpu from 'three/webgpu';
6
- import { WebGPURenderer as WebGPURenderer$1, Node, StorageTexture, Storage3DTexture, StorageArrayTexture, Data3DTexture, CanvasTarget } from 'three/webgpu';
7
- import { StoreApi } from 'zustand';
8
- import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
9
- import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
1
+ import * as THREE from 'three';
2
+ import { WebGLRenderTarget } from 'three';
3
+ import { M as MutableOrReadonlyParameters$1, a as MathRepresentation$1, V as VectorRepresentation$1, b as MathTypes$1, c as MathType$1, d as MathProps$1, e as Vector2$1, f as Vector3$1, g as Vector4$1, C as Color$1, L as Layers$1, Q as Quaternion$1, E as Euler$1, h as Matrix3$1, i as Matrix4$1, R as RaycastableRepresentation$1, j as EventProps$1, G as GeometryTransformProps$1, k as GeometryProps$1, T as TSLNodeInput$1, N as NodeProps$1, l as ReactProps$1, m as ElementProps$1, n as ThreeElement$1, o as ThreeToJSXElements$1, O as Object3DMethod$1, p as ThreeElementsOf$1, q as ElementOf$1, t as CanvasProps, ab as LegacyRootState, s as ReconcilerRoot, r as RenderTargetOptions } from './shared/fiber.DNgUv56V.js';
4
+ export { Z as BackgroundConfig, _ as BackgroundProp, B as BaseRendererProps, aZ as Block, S as CameraProps, J as CanvasSchedulerConfig, D as ColorManagementConfig, F as DefaultGLProps, I as DefaultRendererProps, aD as DisposeOptions, an as Environment, al as EnvironmentCube, aG as EnvironmentLoaderProps, ak as EnvironmentMap, am as EnvironmentPortal, aj as EnvironmentProps, a_ as ErrorBoundary, a5 as Extensions, bs as FROM_REF, bt as FromRefMarker, H as GLProps, a1 as GLTFLike, Y as GlobalEffectType, X as GlobalRenderCallback, a3 as InferLoadResult, W as InjectState, $ as InputLike, aa as InternalState, aw as IsObject, aa as LegacyInternalState, a9 as LegacyRenderer, a2 as LoaderInstance, a0 as LoaderLike, a4 as LoaderResult, ax as MappedTextureType, bw as ONCE, y as OffscreenCanvas, by as OnceValue, aT as Portal, ap as PresetsType, ac as PrimaryCanvasEntry, a9 as R3FRenderer, a$ as REACT_INTERNAL_PROPS, b7 as RESERVED_PROPS, U as RenderProps, A as Renderer, K as RendererConfigExtended, z as RendererFactory, P as RendererProps, aA as Texture, aB as TextureInput, aC as TextureResult, ay as UseTextureOptions, aE as UseTexturesReturn, a6 as WebGLDefaultProps, a7 as WebGLProps, a8 as WebGLShadowConfig, aQ as _roots, aJ as addAfterEffect, aI as addEffect, aK as addTail, aM as advance, bc as applyProps, b9 as attach, b2 as buildGraph, bd as calculateDpr, as as createEvents, u as createPointerEvents, aS as createPortal, aV as createStore, ba as detach, bb as diffProps, b3 as dispose, u as events, aN as extend, b0 as findInitialRoot, aU as flushSync, bu as fromRef, b4 as getInstanceProps, ae as getPrimary, ai as getPrimaryIds, b1 as getRootState, v as getThree, be as getUuidPrefix, br as hasConstructor, ag as hasPrimary, w as hasThree, aL as invalidate, b6 as invalidateInstance, bh as is, bk as isColorRepresentation, bq as isCopyable, bv as isFromRef, bn as isLayers, bl as isObject3D, bz as isOnce, bi as isOrthographicCamera, bj as isRef, aP as isRenderer, bm as isTexture, bo as isUniform, bp as isVectorLike, bx as once, b5 as prepare, ao as presetsObj, aO as reconciler, ad as registerPrimary, ar as removeInteractivity, b8 as resolve, aq as swapInteractivity, aR as unmountComponentAtNode, ah as unregisterPrimary, bf as updateCamera, bg as updateFrustum, aY as useBridge, aH as useEnvironment, au as useGraph, at as useInstanceHandle, aW as useIsomorphicLayoutEffect, av as useLoader, aX as useMutableCallback, az as useTexture, aF as useTextures, af as waitForPrimary, x as whenThree } from './shared/fiber.DNgUv56V.js';
5
+ import { C as ConstructorRepresentation } from './shared/fiber.I5Q4dVvl.js';
6
+ export { U as Act, y as Args, z as ArgsProp, A as AttachFnType, w as AttachType, W as Bridge, i as Camera, x as Catalogue, n as ComputeFunction, a0 as Disposable, k as DomEvent, D as Dpr, $ as EquConfig, l as EventHandlers, p as EventManager, E as Events, u as FiberRoot, m as FilterFunction, ae as ForRegisteredRenderer, a4 as FrameCallback, a3 as FrameNextCallback, a1 as FrameNextState, a2 as FrameState, F as Frameloop, H as HostConfig, G as Instance, B as InstanceProps, h as Intersection, j as IntersectionEvent, L as IsAllOptional, K as IsOptional, M as Mutable, N as NonFunctionKeys, _ as ObjectMap, a7 as OcclusionSupport, O as Overwrite, e as Performance, q as PointerCaptureTarget, P as PointerState, J as Properties, R as R3FRenderTarget, af as R3FRendererSupport, ac as Register, ad as RegisteredRenderer, d as RenderCallback, ab as RendererProvider, aa as RendererSupport, v as Root, a as RootExtension, g as RootStore, Y as SetBlock, c as Size, S as Subscription, Q as ThreeCamera, a6 as ThreeCore, T as ThreeEvent, a5 as ThreeNamespace, Z as UnblockProps, V as Viewport, t as VisibilityEntry, a8 as WebGLSupport, a9 as WebGPUSupport, X as XRManager, o as XRPointerConfig, ai as context, r as registerRootExtension, s as setRenderOverride, ag as useStore } from './shared/fiber.I5Q4dVvl.js';
7
+ import { FrameCallback, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
10
8
  export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
11
- import { Options } from 'react-use-measure';
12
- import * as react_jsx_runtime from 'react/jsx-runtime';
13
- import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
14
-
9
+ import { JSX } from 'react';
10
+ import 'react-use-measure';
11
+ import 'three/webgpu';
12
+ import 'zustand';
13
+ import 'zustand/traditional';
14
+ import 'three/tsl';
15
+
16
+ /**
17
+ * The `ReactThreeFiber` namespace of the legacy entry: the shared element types plus this entry's JSX map.
18
+ *
19
+ * Explicit aliases, not `export type *`: rollup-dts otherwise re-exports the types as namespace values
20
+ * and the built declaration fails to compile for consumers.
21
+ */
22
+
23
+
24
+ type MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters$1<T>
25
+ type MathRepresentation = MathRepresentation$1
26
+ type VectorRepresentation = VectorRepresentation$1
27
+ type MathTypes = MathTypes$1
28
+ type MathType<T extends MathTypes$1> = MathType$1<T>
29
+ type MathProps<P> = MathProps$1<P>
30
+ type Vector2 = Vector2$1
31
+ type Vector3 = Vector3$1
32
+ type Vector4 = Vector4$1
33
+ type Color = Color$1
34
+ type Layers = Layers$1
35
+ type Quaternion = Quaternion$1
36
+ type Euler = Euler$1
37
+ type Matrix3 = Matrix3$1
38
+ type Matrix4 = Matrix4$1
39
+ type RaycastableRepresentation = RaycastableRepresentation$1
40
+ type EventProps<P> = EventProps$1<P>
41
+ type GeometryTransformProps = GeometryTransformProps$1
42
+ type GeometryProps<P> = GeometryProps$1<P>
43
+ type TSLNodeInput = TSLNodeInput$1
44
+ type NodeProps<P> = NodeProps$1<P>
45
+ type ReactProps<P> = ReactProps$1<P>
46
+ type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = ElementProps$1<T, P>
47
+ type ThreeElement<T extends ConstructorRepresentation> = ThreeElement$1<T>
48
+ type ThreeToJSXElements<T extends Record<string, any>> = ThreeToJSXElements$1<T>
49
+ type Object3DMethod = Object3DMethod$1
50
+ type ThreeElementsOf<T extends Record<string, any>> = ThreeElementsOf$1<T>
51
+ type ElementOf<E, K extends string> = ElementOf$1<E, K>
52
+
53
+ type legacy_d_Color = Color;
54
+ type legacy_d_ElementOf<E, K extends string> = ElementOf<E, K>;
55
+ type legacy_d_ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = ElementProps<T, P>;
56
+ type legacy_d_Euler = Euler;
57
+ type legacy_d_EventProps<P> = EventProps<P>;
58
+ type legacy_d_GeometryProps<P> = GeometryProps<P>;
59
+ type legacy_d_GeometryTransformProps = GeometryTransformProps;
60
+ type legacy_d_Layers = Layers;
61
+ type legacy_d_MathProps<P> = MathProps<P>;
62
+ type legacy_d_MathRepresentation = MathRepresentation;
63
+ type legacy_d_MathType<T extends MathTypes$1> = MathType<T>;
64
+ type legacy_d_MathTypes = MathTypes;
65
+ type legacy_d_Matrix3 = Matrix3;
66
+ type legacy_d_Matrix4 = Matrix4;
67
+ type legacy_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
68
+ type legacy_d_NodeProps<P> = NodeProps<P>;
69
+ type legacy_d_Object3DMethod = Object3DMethod;
70
+ type legacy_d_Quaternion = Quaternion;
71
+ type legacy_d_RaycastableRepresentation = RaycastableRepresentation;
72
+ type legacy_d_ReactProps<P> = ReactProps<P>;
73
+ type legacy_d_TSLNodeInput = TSLNodeInput;
74
+ type legacy_d_ThreeElement<T extends ConstructorRepresentation> = ThreeElement<T>;
75
+ type legacy_d_ThreeElements = ThreeElements;
76
+ type legacy_d_ThreeElementsOf<T extends Record<string, any>> = ThreeElementsOf<T>;
77
+ type legacy_d_ThreeExports = ThreeExports;
78
+ type legacy_d_ThreeToJSXElements<T extends Record<string, any>> = ThreeToJSXElements<T>;
79
+ type legacy_d_Vector2 = Vector2;
80
+ type legacy_d_Vector3 = Vector3;
81
+ type legacy_d_Vector4 = Vector4;
82
+ type legacy_d_VectorRepresentation = VectorRepresentation;
83
+ declare namespace legacy_d {
84
+ export type { legacy_d_Color as Color, legacy_d_ElementOf as ElementOf, legacy_d_ElementProps as ElementProps, legacy_d_Euler as Euler, legacy_d_EventProps as EventProps, legacy_d_GeometryProps as GeometryProps, legacy_d_GeometryTransformProps as GeometryTransformProps, legacy_d_Layers as Layers, legacy_d_MathProps as MathProps, legacy_d_MathRepresentation as MathRepresentation, legacy_d_MathType as MathType, legacy_d_MathTypes as MathTypes, legacy_d_Matrix3 as Matrix3, legacy_d_Matrix4 as Matrix4, legacy_d_MutableOrReadonlyParameters as MutableOrReadonlyParameters, legacy_d_NodeProps as NodeProps, legacy_d_Object3DMethod as Object3DMethod, legacy_d_Quaternion as Quaternion, legacy_d_RaycastableRepresentation as RaycastableRepresentation, legacy_d_ReactProps as ReactProps, legacy_d_TSLNodeInput as TSLNodeInput, legacy_d_ThreeElement as ThreeElement, legacy_d_ThreeElements as ThreeElements, legacy_d_ThreeElementsOf as ThreeElementsOf, legacy_d_ThreeExports as ThreeExports, legacy_d_ThreeToJSXElements as ThreeToJSXElements, legacy_d_Vector2 as Vector2, legacy_d_Vector3 as Vector3, legacy_d_Vector4 as Vector4, legacy_d_VectorRepresentation as VectorRepresentation };
85
+ }
15
86
 
16
- /**
17
- * @fileoverview Internal Three.js re-exports - LEGACY ENTRY
18
- *
19
- * Pure WebGL path - no WebGPU imports.
20
- * Use this for the legacy import path: @react-three/fiber/legacy
21
- *
22
- * This keeps bundle size minimal for apps that don't need WebGPU.
23
- */
24
87
  declare const R3F_BUILD_LEGACY = true;
25
88
  declare const R3F_BUILD_WEBGPU = false;
89
+ /** Create a root that always constructs a WebGLRenderer. */
90
+ declare function createRoot<TCanvas extends HTMLCanvasElement | OffscreenCanvas>(canvas: TCanvas): ReconcilerRoot<TCanvas>;
26
91
 
27
- type Inspector = never;
28
- /** Not available on the legacy (WebGL-only) entry. */
29
- declare function loadInspector(): Promise<never>;
30
- declare class WebGPURenderer {
31
- constructor();
32
- }
33
-
34
- declare const RenderTarget: any;
35
-
36
- declare const CubeRenderTarget: any;
37
-
38
-
39
- //* Utility Types ==============================
40
-
41
- type NonFunctionKeys<P> = { [K in keyof P]-?: P[K] extends Function ? never : K }[keyof P]
42
- type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O
43
- type Properties<T> = Pick<T, NonFunctionKeys<T>>
44
- type Mutable<P> = { -readonly [K in keyof P]: P[K] }
45
- type IsOptional<T> = undefined extends T ? true : false
46
- type IsAllOptional<T extends any[]> = T extends [infer First, ...infer Rest]
47
- ? IsOptional<First> extends true
48
- ? IsAllOptional<Rest>
49
- : false
50
- : true
51
-
52
- //* Camera Types ==============================
53
-
54
- type ThreeCamera = (THREE$1.OrthographicCamera | THREE$1.PerspectiveCamera) & { manual?: boolean }
55
-
56
- //* Act Type ==============================
57
-
58
- type Act = <T = any>(cb: () => Promise<T>) => Promise<T>
59
-
60
- //* Bridge & Block Types ==============================
61
-
62
- type Bridge = React$1.FC<{ children?: React$1.ReactNode }>
63
-
64
- type SetBlock = false | Promise<null> | null
65
- type UnblockProps = { set: React$1.Dispatch<React$1.SetStateAction<SetBlock>>; children: React$1.ReactNode }
66
-
67
- //* Object Map Type ==============================
68
-
69
- /* Original version
70
- export interface ObjectMap {
71
- nodes: { [name: string]: THREE.Object3D }
72
- materials: { [name: string]: THREE.Material }
73
- meshes: { [name: string]: THREE.Mesh }
74
- }
75
- */
76
- /* This version is an expansion found in a PR by itsdouges that seems abandoned but looks useful.
77
- It allows expansion but falls back to the original shape. (deleted due to stale, but If it doesnt conflict
78
- I will keep the use here)
79
- https://github.com/pmndrs/react-three-fiber/commits/generic-object-map/
80
- His description is:
81
- The object map type is now generic and can optionally declare the available properties for nodes, materials, and meshes.
82
- */
83
- interface ObjectMap<
84
- T extends { nodes?: string; materials?: string; meshes?: string } = {
85
- nodes: string
86
- materials: string
87
- meshes: string
88
- },
89
- > {
90
- nodes: Record<T['nodes'] extends string ? T['nodes'] : string, THREE$1.Object3D>
91
- materials: Record<T['materials'] extends string ? T['materials'] : string, THREE$1.Material>
92
- meshes: Record<T['meshes'] extends string ? T['meshes'] : string, THREE$1.Mesh>
93
- }
94
-
95
- //* Equality Config ==============================
96
-
97
- interface EquConfig {
98
- /** Compare arrays by reference equality a === b (default), or by shallow equality */
99
- arrays?: 'reference' | 'shallow'
100
- /** Compare objects by reference equality a === b (default), or by shallow equality */
101
- objects?: 'reference' | 'shallow'
102
- /** If true the keys in both a and b must match 1:1 (default), if false a's keys must intersect b's */
103
- strict?: boolean
104
- }
105
-
106
- //* Disposable Type ==============================
107
-
108
- interface Disposable {
109
- type?: string
110
- dispose?: () => void
111
- }
112
-
113
- //* Event-related Types =====================================
114
-
115
- interface Intersection extends THREE$1.Intersection {
116
- /** The event source (the object which registered the handler) */
117
- eventObject: THREE$1.Object3D
118
- }
119
-
120
- type Camera = THREE$1.OrthographicCamera | THREE$1.PerspectiveCamera
121
-
122
- interface IntersectionEvent<TSourceEvent> extends Intersection {
123
- /** The event source (the object which registered the handler) */
124
- eventObject: THREE$1.Object3D
125
- /** An array of intersections */
126
- intersections: Intersection[]
127
- /** vec3.set(pointer.x, pointer.y, 0).unproject(camera) */
128
- unprojectedPoint: THREE$1.Vector3
129
- /** Normalized event coordinates */
130
- pointer: THREE$1.Vector2
131
- /** pointerId of the original event for multiple pointer events */
132
- pointerId: number
133
- /** Delta between first click and this event */
134
- delta: number
135
- /** The ray that pierced it */
136
- ray: THREE$1.Ray
137
- /** The camera that was used by the raycaster */
138
- camera: Camera
139
- /** stopPropagation will stop underlying handlers from firing */
140
- stopPropagation: () => void
141
- /** The original host event */
142
- nativeEvent: TSourceEvent
143
- /** If the event was stopped by calling stopPropagation */
144
- stopped: boolean
145
- }
146
-
147
- type ThreeEvent<TEvent> = IntersectionEvent<TEvent> & Properties<TEvent>
148
- type DomEvent = PointerEvent | MouseEvent | WheelEvent
149
-
150
- /** DOM event handlers registered on the canvas element */
151
- interface Events {
152
- onClick: EventListener
153
- onContextMenu: EventListener
154
- onDoubleClick: EventListener
155
- onWheel: EventListener
156
- onPointerDown: EventListener
157
- onPointerUp: EventListener
158
- onPointerLeave: EventListener
159
- onPointerMove: EventListener
160
- onPointerCancel: EventListener
161
- onLostPointerCapture: EventListener
162
- onDragEnter: EventListener
163
- onDragLeave: EventListener
164
- onDragOver: EventListener
165
- onDrop: EventListener
166
- }
167
-
168
- /** Event handlers that can be attached to R3F objects (meshes, groups, etc.) */
169
- interface EventHandlers {
170
- onClick?: (event: ThreeEvent<MouseEvent>) => void
171
- onContextMenu?: (event: ThreeEvent<MouseEvent>) => void
172
- onDoubleClick?: (event: ThreeEvent<MouseEvent>) => void
173
- /** Fires continuously while dragging over the object */
174
- onDragOver?: (event: ThreeEvent<DragEvent>) => void
175
- /** Fires once when drag enters the object */
176
- onDragOverEnter?: (event: ThreeEvent<DragEvent>) => void
177
- /** Fires once when drag leaves the object */
178
- onDragOverLeave?: (event: ThreeEvent<DragEvent>) => void
179
- /** Fires when drag misses this object (for objects that have drag handlers) */
180
- onDragOverMissed?: (event: DragEvent) => void
181
- /** Fires when a drop occurs on this object */
182
- onDrop?: (event: ThreeEvent<DragEvent>) => void
183
- /** Fires when a drop misses this object (for objects that have drop handlers) */
184
- onDropMissed?: (event: DragEvent) => void
185
- onPointerUp?: (event: ThreeEvent<PointerEvent>) => void
186
- onPointerDown?: (event: ThreeEvent<PointerEvent>) => void
187
- onPointerOver?: (event: ThreeEvent<PointerEvent>) => void
188
- onPointerOut?: (event: ThreeEvent<PointerEvent>) => void
189
- onPointerEnter?: (event: ThreeEvent<PointerEvent>) => void
190
- onPointerLeave?: (event: ThreeEvent<PointerEvent>) => void
191
- onPointerMove?: (event: ThreeEvent<PointerEvent>) => void
192
- onPointerMissed?: (event: MouseEvent) => void
193
- onPointerCancel?: (event: ThreeEvent<PointerEvent>) => void
194
- onWheel?: (event: ThreeEvent<WheelEvent>) => void
195
- onLostPointerCapture?: (event: ThreeEvent<PointerEvent>) => void
196
-
197
- //* Visibility Events --------------------------------
198
- /** Fires when object enters/exits camera frustum. Receives true when in view, false when out. */
199
- onFramed?: (inView: boolean) => void
200
- /** Fires when object occlusion state changes (WebGPU only, requires occlusionTest=true on object) */
201
- onOccluded?: (occluded: boolean) => void
202
- /** Fires when combined visibility changes (frustum + occlusion + visible prop) */
203
- onVisible?: (visible: boolean) => void
204
- }
205
-
206
- type FilterFunction = (items: THREE$1.Intersection[], state: RootState) => THREE$1.Intersection[]
207
- type ComputeFunction = (event: DomEvent, root: RootState, previous?: RootState) => void
208
-
209
- /** Configuration for XR pointer registration (controllers/hands) */
210
- interface XRPointerConfig {
211
- /** Ray origin (updated each frame by XR system) */
212
- ray: THREE$1.Ray
213
- /** Optional: custom compute function for this pointer */
214
- compute?: (state: RootState) => void
215
- /** Pointer type identifier */
216
- type: 'controller' | 'hand' | 'gaze'
217
- /** Which hand (for controller/hand types) */
218
- handedness?: 'left' | 'right'
219
- }
220
-
221
- interface EventManager<TTarget> {
222
- /** Determines if the event layer is active */
223
- enabled: boolean
224
- /** Event layer priority, higher prioritized layers come first and may stop(-propagate) lower layer */
225
- priority: number
226
- /** The compute function needs to set up the raycaster and an xy- pointer */
227
- compute?: ComputeFunction
228
- /** The filter can re-order or re-structure the intersections */
229
- filter?: FilterFunction
230
- /** The target node the event layer is tied to */
231
- connected?: TTarget
232
- /** All the pointer event handlers through which the host forwards native events */
233
- handlers?: Events
234
- /** Allows re-connecting to another target */
235
- connect?: (target: TTarget) => void
236
- /** Removes all existing events handlers from the target */
237
- disconnect?: () => void
238
- /** Triggers a onPointerMove with the last known event. This can be useful to enable raycasting without
239
- * explicit user interaction, for instance when the camera moves a hoverable object underneath the cursor.
240
- * @param pointerId - Optional pointer ID to update specific pointer only
241
- */
242
- update?: (pointerId?: number) => void
243
- /** Defer pointer move raycasting to frame start (default: true) */
244
- frameTimedRaycasts?: boolean
245
- /** Always fire raycaster immediately on scroll events (default: true) */
246
- alwaysFireOnScroll?: boolean
247
- /** Automatically re-raycast every frame to detect hover changes from moving objects/camera (default: false) */
248
- updateOnFrame?: boolean
249
- /** Flush deferred pointer raycasts. Called by scheduler at frame start (input phase). */
250
- flush?: () => void
251
- /** Register an XR pointer (controller/hand). Returns assigned pointerId */
252
- registerPointer?: (config: XRPointerConfig) => number
253
- /** Unregister an XR pointer */
254
- unregisterPointer?: (pointerId: number) => void
255
- }
256
-
257
- interface PointerCaptureTarget {
258
- intersection: Intersection
259
- target: Element
260
- }
261
-
262
- //* Visibility System Types =====================================
263
-
264
- /** Entry in the visibility registry for tracking object visibility state */
265
- interface VisibilityEntry {
266
- object: THREE$1.Object3D
267
- handlers: Pick<EventHandlers, 'onFramed' | 'onOccluded' | 'onVisible'>
268
- lastFramedState: boolean | null
269
- lastOccludedState: boolean | null
270
- lastVisibleState: boolean | null
271
- }
272
-
273
- //* Scheduler Types (useFrame) ==============================
274
- //
275
- // The generic, framework-agnostic scheduler types now live in @pmndrs/scheduler.
276
- // This file re-exports them and layers r3f's RootState-aware frame state on top,
277
- // so existing `#types` imports across the codebase keep resolving unchanged.
278
-
279
-
280
-
281
- // Frame State (r3f-specific) --------------------------------
282
-
283
- /**
284
- * State passed to useFrame callbacks (extends RootState with timing).
285
- */
286
- interface FrameNextState extends RootState, FrameTimingState {}
287
-
288
- /** Alias for FrameNextState */
289
- type FrameState = FrameNextState
290
-
291
- // Callback Types (r3f-specific) --------------------------------
292
-
293
- /**
294
- * Callback function for useFrame. Receives the full r3f RootState plus timing.
295
- */
296
- type FrameNextCallback = FrameCallback$1<RootState>
297
-
298
- /** Alias for FrameNextCallback */
299
- type FrameCallback = FrameNextCallback
300
-
301
- //* Buffer Types (useBuffers) ========================================
302
-
303
- /**
304
- * Buffer-like types for GPU compute and storage operations.
305
- * Includes raw CPU arrays, Three.js buffer attributes, and TSL buffer nodes.
306
- *
307
- * @example
308
- * ```tsx
309
- * const { positions, velocities } = useBuffers(() => ({
310
- * positions: instancedArray(count, 'vec3'), // StorageBufferNode
311
- * velocities: new Float32Array(count * 3), // TypedArray
312
- * }), 'particles')
313
- * ```
314
- */
315
- type BufferLike =
316
- | Float32Array
317
- | Uint32Array
318
- | Int32Array
319
- | Float64Array
320
- | Uint8Array
321
- | Int8Array
322
- | Uint16Array
323
- | Int16Array
324
- | THREE$1.BufferAttribute // Base class for all buffer attributes
325
- | THREE$1.InterleavedBufferAttribute
326
- | Node // TSL buffer nodes (instancedArray, storage)
327
-
328
- /** Flat record of buffer-like values (no nested scopes) */
329
- type BufferRecord = Record<string, BufferLike>
330
-
331
- /**
332
- * Buffer store that can contain both root-level buffers and scoped buffer objects.
333
- * Structure: { positions: Float32Array, particles: { vel: StorageBufferNode } }
334
- */
335
- type BufferStore = Record<string, BufferLike | BufferRecord>
336
-
337
- //* Node Types (useNodes) ========================================
338
-
339
- /**
340
- * Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
341
- * the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
342
- * code passes through. Creators are constrained to this same type, so the shape a creator returns
343
- * and the shape the store holds are one type by construction.
344
- */
345
- type NodeLike = TSLNodeType | LegacyTSLNodeLike
346
-
347
- /** Flat record of TSL nodes (no nested scopes) */
348
- type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
349
-
350
- /**
351
- * Node store that can contain both root-level nodes and scoped node objects.
352
- * Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
353
- */
354
- type NodeStore = Record<string, NodeLike | NodeRecord>
355
-
356
- //* Storage Types (useGPUStorage) ========================================
357
-
358
- /**
359
- * GPU storage types for texture-based storage operations.
360
- * Includes Three.js storage textures and TSL storage texture nodes.
361
- *
362
- * @example
363
- * ```tsx
364
- * const { heightMap } = useGPUStorage(() => ({
365
- * heightMap: new StorageTexture(512, 512),
366
- * }), 'terrain')
367
- * ```
368
- */
369
- type StorageLike =
370
- | StorageTexture // 2D GPU storage texture
371
- | Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
372
- | StorageArrayTexture // 2D-array GPU storage texture
373
- | Data3DTexture // 3D texture (can be used as storage)
374
- | Node // TSL storage texture nodes (storageTexture)
375
-
376
- /** Flat record of storage-like values (no nested scopes) */
377
- type StorageRecord = Record<string, StorageLike>
378
-
379
- /**
380
- * Storage store that can contain both root-level storage and scoped storage objects.
381
- * Structure: { heightMap: StorageTexture, terrain: { normal: StorageTextureNode } }
382
- */
383
- type StorageStore = Record<string, StorageLike | StorageRecord>
384
-
385
- //* Renderer Types ========================================
386
-
387
- /** Default renderer type - union of WebGL and WebGPU renderers */
388
- type R3FRenderer = THREE$1.WebGLRenderer | WebGPURenderer$1
389
-
390
- //* Core Store Types ========================================
391
-
392
- type Subscription = {
393
- ref: React$1.RefObject<RenderCallback>
394
- priority: number
395
- store: RootStore
396
- }
397
-
398
- /** Per-pointer state for multi-touch and XR support */
399
- type PointerState = {
400
- /** Objects currently hovered by this pointer */
401
- hovered: Map<string, ThreeEvent<DomEvent>>
402
- /** Objects capturing this pointer */
403
- captured: Map<THREE$1.Object3D, PointerCaptureTarget>
404
- /** Initial click position [x, y] */
405
- initialClick: [x: number, y: number]
406
- /** Objects hit on initial click */
407
- initialHits: THREE$1.Object3D[]
408
- }
409
-
410
- type Dpr = number | [min: number, max: number]
411
-
412
- interface Size {
413
- width: number
414
- height: number
415
- top: number
416
- left: number
417
- }
418
-
419
- type Frameloop = 'always' | 'demand' | 'never'
420
-
421
- interface Viewport extends Size {
422
- /** The initial pixel ratio */
423
- initialDpr: number
424
- /** Current pixel ratio */
425
- dpr: number
426
- /** size.width / viewport.width */
427
- factor: number
428
- /** Camera distance */
429
- distance: number
430
- /** Camera aspect ratio: width / height */
431
- aspect: number
432
- }
433
-
434
- type RenderCallback = (state: RootState, delta: number, frame?: XRFrame) => void
435
-
436
- interface Performance {
437
- /** Current performance normal, between min and max */
438
- current: number
439
- /** How low the performance can go, between 0 and max */
440
- min: number
441
- /** How high the performance can go, between min and max */
442
- max: number
443
- /** Time until current returns to max in ms */
444
- debounce: number
445
- /** Sets current to min, puts the system in regression */
446
- regress: () => void
447
- }
448
-
449
- interface InternalState {
450
- interaction: THREE$1.Object3D[]
451
- subscribers: Subscription[]
452
- /** Per-pointer state (hover, capture, click tracking) - replaces hovered, capturedMap, initialClick, initialHits */
453
- pointerMap: Map<number, PointerState>
454
- /** Pointers needing raycast this frame (used with frameTimedRaycasts) */
455
- pointerDirty: Map<number, DomEvent>
456
- /** Last event received (for events.update() compatibility) */
457
- lastEvent: React$1.RefObject<DomEvent | null>
458
- /** @deprecated Use pointerMap.get(pointerId).hovered instead */
459
- hovered: Map<string, ThreeEvent<DomEvent>>
460
- /** @deprecated Use pointerMap.get(pointerId).captured instead */
461
- capturedMap: Map<number, Map<THREE$1.Object3D, PointerCaptureTarget>>
462
- /** @deprecated Use pointerMap.get(pointerId).initialClick instead */
463
- initialClick: [x: number, y: number]
464
- /** @deprecated Use pointerMap.get(pointerId).initialHits instead */
465
- initialHits: THREE$1.Object3D[]
466
- /** Visibility event registry (onFramed, onOccluded, onVisible) */
467
- visibilityRegistry: Map<string, VisibilityEntry>
468
- /** Whether occlusion queries are enabled (WebGPU only) */
469
- occlusionEnabled: boolean
470
- /** Reference to the invisible occlusion observer mesh */
471
- occlusionObserver: THREE$1.Mesh | null
472
- /** Cached occlusion results from render pass - keyed by Object3D */
473
- occlusionCache: Map<THREE$1.Object3D, boolean | null>
474
- /** Internal helper group for R3F system objects (occlusion observer, etc.) */
475
- helperGroup: THREE$1.Group | null
476
- active: boolean
477
- priority: number
478
- frames: number
479
- subscribe: (callback: React$1.RefObject<RenderCallback>, priority: number, store: RootStore) => () => void
480
- /** Internal renderer storage - use state.renderer or state.gl to access */
481
- actualRenderer: R3FRenderer
482
- /** Global scheduler reference (for useFrame hook) */
483
- scheduler: SchedulerApi | null
484
- /** This root's unique ID in the global scheduler */
485
- rootId?: string
486
- /** Function to unregister this root from the global scheduler */
487
- unregisterRoot?: () => void
488
- /** Container for child attachment (scene for root, original container for portals) */
489
- container?: THREE$1.Object3D
490
- /**
491
- * The CanvasTarget this root sizes and renders through.
492
- *
493
- * A primary (`<Canvas id>`) owns the renderer's default target -- the one three itself built
494
- * around the canvas element -- so sizing it is sizing the renderer. A secondary owns a target
495
- * R3F created for its own element. Either way there is exactly one target per canvas element,
496
- * and the canvas-target job makes it the renderer's active one before this root renders.
497
- * Absent on WebGL and on an id-less WebGPU canvas, where the renderer is sized directly.
498
- * @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
499
- */
500
- canvasTarget?: CanvasTarget
501
- /**
502
- * Set when this root's canvas target has been resized and the backend's cached render pass
503
- * descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
504
- *
505
- * Flushed by the canvas-target job in the `start` phase, which is the only place this root's
506
- * target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
507
- * whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
508
- * invalidate some other canvas's descriptor instead.
509
- *
510
- * @see https://github.com/pmndrs/react-three-fiber/issues/3847
511
- */
512
- canvasTargetSizeDirty?: boolean
513
- /**
514
- * Whether multi-canvas rendering is active.
515
- * True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
516
- * When true, setCanvasTarget is called before each render.
517
- */
518
- isMultiCanvas?: boolean
519
- /**
520
- * Whether this canvas is a secondary canvas sharing another's renderer.
521
- * True when `target` prop is used.
522
- */
523
- isSecondary?: boolean
524
- /**
525
- * The id of the primary canvas this secondary canvas targets.
526
- * Only set when isSecondary is true.
527
- */
528
- targetId?: string
529
- /**
530
- * Function to unregister this primary canvas from the registry.
531
- * Only set when this canvas has an `id` prop.
532
- */
533
- unregisterPrimary?: () => void
534
- /** Whether canvas dimensions are forced to even numbers */
535
- forceEven?: boolean
536
- }
537
-
538
- interface XRManager {
539
- connect: () => void
540
- disconnect: () => void
541
- }
542
-
543
- //* Root State Interface ====================================
544
-
545
- interface RootState {
546
- /** Set current state */
547
- set: StoreApi<RootState>['setState']
548
- /** Get current state */
549
- get: StoreApi<RootState>['getState']
550
- /**
551
- * Reference to the authoritative store for shared TSL resources (uniforms, nodes, etc).
552
- * - For primary/independent canvases: points to its own store (self-reference)
553
- * - For secondary canvases: points to the primary canvas's store
554
- *
555
- * Hooks like useNodes/useUniforms should read from primaryStore to ensure
556
- * consistent shared state across all canvases sharing a renderer.
557
- */
558
- primaryStore: RootStore
559
- /** @deprecated Use `renderer` instead. The instance of the renderer (typed as WebGLRenderer for backwards compat) */
560
- gl: THREE$1.WebGLRenderer
561
- /** The renderer instance - type depends on entry point (WebGPU, Legacy, or union for default) */
562
- renderer: R3FRenderer
563
- /** Inspector of the webGPU Renderer. Init in the canvas */
564
- inspector: any // Inspector type from three/webgpu
565
-
566
- /** Default camera */
567
- camera: ThreeCamera
568
- /** Camera frustum for visibility checks - auto-updated each frame when autoUpdateFrustum is true */
569
- frustum: THREE$1.Frustum
570
- /** Whether to automatically update the frustum each frame (default: true) */
571
- autoUpdateFrustum: boolean
572
- /** Default scene (may be overridden in portals to point to the portal container) */
573
- scene: THREE$1.Scene
574
- /** The actual root THREE.Scene - always points to the true scene, even inside portals */
575
- rootScene: THREE$1.Scene
576
- /** Default raycaster */
577
- raycaster: THREE$1.Raycaster
578
- /** Event layer interface, contains the event handler and the node they're connected to */
579
- events: EventManager<any>
580
- /** XR interface */
581
- xr: XRManager
582
- /** Currently used controls */
583
- controls: THREE$1.EventDispatcher | null
584
- /** Normalized event coordinates */
585
- pointer: THREE$1.Vector2
586
- /** @deprecated Normalized event coordinates, use "pointer" instead! */
587
- mouse: THREE$1.Vector2
588
- /** Color space assigned to 8-bit input textures (color maps). Most textures are authored in sRGB. */
589
- textureColorSpace: THREE$1.ColorSpace
590
- /** Render loop flags */
591
- frameloop: Frameloop
592
- performance: Performance
593
- /** Reactive pixel-size of the canvas */
594
- size: Size
595
- /** Reactive size of the viewport in threejs units */
596
- viewport: Viewport & {
597
- getCurrentViewport: (
598
- camera?: ThreeCamera,
599
- target?: THREE$1.Vector3 | Parameters<THREE$1.Vector3['set']>,
600
- size?: Size,
601
- ) => Omit<Viewport, 'dpr' | 'initialDpr'>
602
- }
603
- /** Flags the canvas for render, but doesn't render in itself */
604
- invalidate: (frames?: number, stackFrames?: boolean) => void
605
- /** Advance (render) one step */
606
- advance: (timestamp: number, runGlobalEffects?: boolean) => void
607
- /** Shortcut to setting the event layer */
608
- setEvents: (events: Partial<EventManager<any>>) => void
609
- /** Shortcut to manual sizing. No args resets to props/container. Single arg creates square. */
610
- setSize: (width?: number, height?: number, top?: number, left?: number) => void
611
- /** Shortcut to manual setting the pixel ratio */
612
- setDpr: (dpr: Dpr) => void
613
- /** Shortcut to setting frameloop flags. No args resets to 'always'. */
614
- setFrameloop: (frameloop?: Frameloop) => void
615
- /** Set error state to propagate to error boundary */
616
- setError: (error: Error | null) => void
617
- /** Current error state (null when no error) */
618
- error: Error | null
619
- /** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
620
- uniforms: UniformStore
621
- /** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
622
- nodes: NodeStore
623
- /** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
624
- buffers: BufferStore
625
- /** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
626
- gpuStorage: StorageStore
627
- /** Global Texture registry (key → Texture, usually keyed by URL) - use useTextures() hook for access + lifecycle */
628
- textures: Map<string, THREE$1.Texture>
629
- /** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
630
- _textureRefs: Map<string, number>
631
- /** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
632
- renderPipeline: ThreeRenderPipeline | null
633
- /** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
634
- passes: PassRecord
635
- /** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
636
- _hmrVersion: number
637
- /** Internal: whether setSize() has taken ownership of canvas dimensions */
638
- _sizeImperative: boolean
639
- /** Internal: stored size props from Canvas for reset functionality */
640
- _sizeProps: { width?: number; height?: number } | null
641
- /** When the canvas was clicked but nothing was hit */
642
- onPointerMissed?: (event: MouseEvent) => void
643
- /** When a dragover event has missed any target */
644
- onDragOverMissed?: (event: DragEvent) => void
645
- /** When a drop event has missed any target */
646
- onDropMissed?: (event: DragEvent) => void
647
- /** If this state model is layered (via createPortal) then this contains the previous layer */
648
- previousRoot?: RootStore
649
- /** Internals */
650
- internal: InternalState
651
- // flags for triggers
652
- // if we are using the webGl renderer, this will be true
653
- isLegacy: boolean
654
- // regardless of renderer, if the system supports webGpu, this will be true
655
- webGPUSupported: boolean
656
- //if we are on native
657
- isNative: boolean
658
- }
659
-
660
- type RootStore = UseBoundStoreWithEqualityFn<StoreApi<RootState>>
661
-
662
- //* Base Renderer Types =====================================
663
-
664
- // Shim for OffscreenCanvas since it was removed from DOM types
665
- interface OffscreenCanvas$1 extends EventTarget {}
666
-
667
- interface BaseRendererProps {
668
- canvas: HTMLCanvasElement | OffscreenCanvas$1
669
- powerPreference?: 'high-performance' | 'low-power' | 'default'
670
- antialias?: boolean
671
- alpha?: boolean
672
- }
673
-
674
- type RendererFactory<TRenderer, TParams> =
675
- | TRenderer
676
- | ((defaultProps: TParams) => TRenderer)
677
- | ((defaultProps: TParams) => Promise<TRenderer>)
678
-
679
- interface Renderer {
680
- render: (scene: THREE$1.Scene, camera: THREE$1.Camera) => any
681
- }
682
-
683
- //* Color Management Config ==============================
684
-
685
- /**
686
- * Color management configuration shared by both WebGL and WebGPU renderers.
687
- */
688
- interface ColorManagementConfig {
689
- /**
690
- * Color space assigned to 8-bit input textures (color maps).
691
- * Defaults to sRGB. Most textures are authored in sRGB.
692
- * @default THREE.SRGBColorSpace
693
- */
694
- textureColorSpace?: THREE$1.ColorSpace
695
- }
696
-
697
- //* WebGL Renderer Props ==============================
698
-
699
- type DefaultGLProps = Omit<THREE$1.WebGLRendererParameters, 'canvas'> & {
700
- canvas: HTMLCanvasElement | OffscreenCanvas$1
701
- }
702
-
703
- type GLProps =
704
- | Renderer
705
- | ((defaultProps: DefaultGLProps) => Renderer)
706
- | ((defaultProps: DefaultGLProps) => Promise<Renderer>)
707
- | (Partial<Properties<THREE$1.WebGLRenderer> | THREE$1.WebGLRendererParameters> & ColorManagementConfig)
708
-
709
- //* WebGPU Renderer Props ==============================
710
-
711
- type DefaultRendererProps = {
712
- canvas: HTMLCanvasElement | OffscreenCanvas$1
713
- [key: string]: any
714
- }
715
-
716
- /**
717
- * Canvas-level scheduler configuration.
718
- * Controls render timing relative to other canvases.
719
- */
720
- interface CanvasSchedulerConfig {
721
- /**
722
- * Run this Canvas root before the referenced Canvas root id(s).
723
- */
724
- before?: string | string[]
725
- /**
726
- * Run this Canvas root after the referenced Canvas root id(s).
727
- */
728
- after?: string | string[]
729
- /**
730
- * Numeric root order. Lower values run first.
731
- */
732
- order?: number
733
- /**
734
- * Limit this Canvas's default render job (frames per second).
735
- */
736
- fps?: number
737
- }
738
-
739
- /**
740
- * Extended renderer configuration for multi-canvas support and color management.
741
- */
742
- interface RendererConfigExtended extends ColorManagementConfig {
743
- /** Share renderer from another canvas (WebGPU only) */
744
- primaryCanvas?: string
745
- /** Canvas-level scheduler options */
746
- scheduler?: CanvasSchedulerConfig
747
- }
748
-
749
- type RendererProps =
750
- | any // WebGPURenderer
751
- | ((defaultProps: DefaultRendererProps) => any)
752
- | ((defaultProps: DefaultRendererProps) => Promise<any>)
753
- | (Partial<Properties<any> | Record<string, any>> & RendererConfigExtended)
754
-
755
- //* Camera Props ==============================
756
-
757
- type CameraProps = (
758
- | THREE$1.Camera
759
- | Partial<
760
- ThreeElement<typeof THREE$1.Camera> &
761
- ThreeElement<typeof THREE$1.PerspectiveCamera> &
762
- ThreeElement<typeof THREE$1.OrthographicCamera>
763
- >
764
- ) & {
765
- /** Flags the camera as manual, putting projection into your own hands */
766
- manual?: boolean
767
- }
768
-
769
- //* Render Props ==============================
770
-
771
- interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
772
- /**
773
- * Unique identifier for multi-canvas renderer sharing.
774
- * Makes this canvas targetable by other canvases using the `primaryCanvas` prop.
775
- * Also sets the HTML `id` attribute on the canvas element.
776
- * @example <Canvas id="main-viewer">...</Canvas>
777
- */
778
- id?: string
779
- /**
780
- * Share the renderer from another canvas instead of creating a new one.
781
- * Pass the `id` of the primary canvas to share its WebGPURenderer.
782
- * Only available with WebGPU (not legacy WebGL).
783
- *
784
- * Note: This is extracted from `renderer={{ primaryCanvas: "id" }}` by Canvas.
785
- * @internal
786
- */
787
- primaryCanvas?: string
788
- /**
789
- * Canvas-level scheduler options. Controls render timing relative to other canvases.
790
- *
791
- * Note: This is extracted from `renderer={{ scheduler: {...} }}` by Canvas.
792
- * @internal
793
- */
794
- scheduler?: CanvasSchedulerConfig
795
- /** A threejs renderer instance or props that go into the default renderer */
796
- gl?: GLProps
797
- /** A WebGPU renderer instance or props that go into the default renderer */
798
- renderer?: RendererProps
799
- /** Dimensions to fit the renderer to. Will measure canvas dimensions if omitted */
800
- size?: Size
801
- /**
802
- * Enables shadows (by default PCFsoft). Can accept `gl.shadowMap` options for fine-tuning,
803
- * but also strings: 'basic' | 'percentage' | 'soft' | 'variance'.
804
- * @see https://threejs.org/docs/#api/en/renderers/WebGLRenderer.shadowMap
805
- */
806
- shadows?: boolean | 'basic' | 'percentage' | 'soft' | 'variance' | Partial<THREE$1.WebGLShadowMap>
807
- /** Creates an orthographic camera */
808
- orthographic?: boolean
809
- /**
810
- * R3F's render mode. Set to `demand` to only render on state change or `never` to take control.
811
- * @see https://docs.pmnd.rs/react-three-fiber/advanced/scaling-performance#on-demand-rendering
812
- */
813
- frameloop?: Frameloop
814
- /**
815
- * R3F performance options for adaptive performance.
816
- * @see https://docs.pmnd.rs/react-three-fiber/advanced/scaling-performance#movement-regression
817
- */
818
- performance?: Partial<Omit<Performance, 'regress'>>
819
- /** Target pixel ratio. Can clamp between a range: `[min, max]` */
820
- dpr?: Dpr
821
- /**
822
- * Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
823
- * so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
824
- */
825
- raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
826
- /** A `THREE.Scene` instance or props that go into the default scene */
827
- scene?: THREE$1.Scene | Partial<THREE$1.Scene>
828
- /** A `THREE.Camera` instance or props that go into the default camera */
829
- camera?: CameraProps
830
- /** An R3F event manager to manage elements' pointer events */
831
- events?: (store: RootStore) => EventManager<Element>
832
- /** Callback after the canvas has rendered (but not yet committed) */
833
- onCreated?: (state: RootState) => void
834
- /** Response for pointer clicks that have missed any target */
835
- onPointerMissed?: (event: MouseEvent) => void
836
- /** Response for dragover events that have missed any target */
837
- onDragOverMissed?: (event: DragEvent) => void
838
- /** Response for drop events that have missed any target */
839
- onDropMissed?: (event: DragEvent) => void
840
- /** Whether to automatically update the frustum each frame (default: true) */
841
- autoUpdateFrustum?: boolean
842
- /**
843
- * Enable WebGPU occlusion queries for onOccluded/onVisible events.
844
- * Auto-enabled when any object uses onOccluded or onVisible handlers.
845
- * Only works with WebGPU renderer - WebGL will log a warning.
846
- */
847
- occlusion?: boolean
848
- /** Internal: stored size props from Canvas for reset functionality */
849
- _sizeProps?: { width?: number; height?: number } | null
850
- /** Force canvas dimensions to even numbers (fixes Safari rendering issues with odd/fractional sizes) */
851
- forceEven?: boolean
852
- }
853
-
854
- //* Reconciler Root ==============================
855
-
856
- interface ReconcilerRoot<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
857
- configure: (config?: RenderProps<TCanvas>) => Promise<ReconcilerRoot<TCanvas>>
858
- render: (element: ReactNode) => RootStore
859
- unmount: () => void
860
- }
861
-
862
- //* Inject State ==============================
863
-
864
- type InjectState = Partial<
865
- Omit<RootState, 'events'> & {
866
- events?: {
867
- enabled?: boolean
868
- priority?: number
869
- compute?: ComputeFunction
870
- connected?: any
871
- }
872
- /**
873
- * When true (default), injects a THREE.Scene between container and children if container isn't already a Scene.
874
- * This ensures state.scene is always a real THREE.Scene with proper properties (background, environment, fog).
875
- * Set to false to use the container directly as scene (anti-pattern, but supported for edge cases).
876
- */
877
- injectScene?: boolean
878
- }
879
- >
880
-
881
- //* Reconciler Types ==============================
882
-
883
- // FiberRoot is an opaque internal React type - we define it locally
884
- // to avoid bundling @types/react-reconciler which causes absolute path issues
885
- type FiberRoot = any
886
-
887
- interface Root {
888
- fiber: FiberRoot
889
- store: RootStore
890
- }
891
-
892
- type AttachFnType<O = any> = (parent: any, self: O) => () => void
893
- type AttachType<O = any> = string | AttachFnType<O>
894
-
895
- type ConstructorRepresentation<T = any> = new (...args: any[]) => T
896
-
897
- interface Catalogue {
898
- [name: string]: ConstructorRepresentation
899
- }
900
-
901
- // TODO: handle constructor overloads
902
- // https://github.com/pmndrs/react-three-fiber/pull/2931
903
- // https://github.com/microsoft/TypeScript/issues/37079
904
- type Args<T> = T extends ConstructorRepresentation
905
- ? T extends typeof Color$1
906
- ? [r: number, g: number, b: number] | [color: ColorRepresentation]
907
- : ConstructorParameters<T>
908
- : any[]
909
-
910
- type ArgsProp<P> = P extends ConstructorRepresentation
911
- ? IsAllOptional<ConstructorParameters<P>> extends true
912
- ? { args?: Args<P> }
913
- : { args: Args<P> }
914
- : { args: unknown[] }
915
-
916
- type InstanceProps<T = any, P = any> = ArgsProp<P> & {
917
- object?: T
918
- dispose?: null
919
- attach?: AttachType<T>
920
- }
921
-
922
- interface Instance<O = any> {
923
- root: RootStore
924
- type: string
925
- parent: Instance | null
926
- children: Instance[]
927
- props: InstanceProps<O> & Record<string, unknown>
928
- object: O & { __r3f?: Instance<O> }
929
- eventCount: number
930
- handlers: Partial<EventHandlers>
931
- attach?: AttachType<O>
932
- previousAttach?: any
933
- isHidden: boolean
934
- /** Set of props that have been applied via once() */
935
- appliedOnce?: Set<string>
936
- }
937
-
938
- interface HostConfig {
939
- type: string
940
- props: Instance['props']
941
- container: RootStore
942
- instance: Instance
943
- textInstance: void
944
- suspenseInstance: Instance
945
- hydratableInstance: never
946
- formInstance: never
947
- publicInstance: Instance['object']
948
- hostContext: {}
949
- childSet: never
950
- timeoutHandle: number | undefined
951
- noTimeout: -1
952
- TransitionStatus: null
953
- }
954
- declare global {
955
- var IS_REACT_ACT_ENVIRONMENT: boolean | undefined
956
- }
957
-
958
- //* Loop Types ==============================
959
-
960
- type GlobalRenderCallback = (timestamp: number) => void
961
-
962
- type GlobalEffectType = 'before' | 'after' | 'tail'
963
-
964
- declare const presetsObj: {
965
- apartment: string;
966
- city: string;
967
- dawn: string;
968
- forest: string;
969
- lobby: string;
970
- night: string;
971
- park: string;
972
- studio: string;
973
- sunset: string;
974
- warehouse: string;
92
+ /** `useThree` narrowed to legacy state — `state.renderer` is a `WebGLRenderer`. */
93
+ type UseThreeLegacy = <T = LegacyRootState>(selector?: (state: LegacyRootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
94
+ /** `useFrame` narrowed to legacy state — the callback's `state.renderer` is a `WebGLRenderer`. */
95
+ type UseFrameLegacy = (callback?: FrameCallback<LegacyRootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
96
+ declare const useThree: UseThreeLegacy;
97
+ declare const useFrame: UseFrameLegacy;
98
+ /** `useRenderTarget` narrowed to the target this entry's renderer produces. */
99
+ declare const useRenderTarget: {
100
+ (options?: RenderTargetOptions): WebGLRenderTarget;
101
+ (size: number, options?: RenderTargetOptions): WebGLRenderTarget;
102
+ (width: number, height: number, options?: RenderTargetOptions): WebGLRenderTarget;
975
103
  };
976
- type PresetsType = keyof typeof presetsObj;
977
-
978
- //* Background Types ==============================
979
-
980
- /**
981
- * Expanded object form for background configuration.
982
- * Allows separate textures for background (visual backdrop) and environment (PBR lighting).
983
- */
984
- interface BackgroundConfig {
985
- /** HDRI preset name: 'apartment', 'city', 'dawn', 'forest', 'lobby', 'night', 'park', 'studio', 'sunset', 'warehouse' */
986
- preset?: PresetsType
987
- /** Files for cube texture (6 faces) or single HDR/EXR */
988
- files?: string | string[]
989
- /** Separate files for scene.background (visual backdrop) */
990
- backgroundMap?: string | string[]
991
- backgroundRotation?: Euler$1 | [number, number, number]
992
- backgroundBlurriness?: number
993
- backgroundIntensity?: number
994
- /** Separate files for scene.environment (PBR lighting/reflections) */
995
- envMap?: string | string[]
996
- environmentRotation?: Euler$1 | [number, number, number]
997
- environmentIntensity?: number
998
- path?: string
999
- extensions?: (loader: Loader) => void
1000
- }
1001
-
1002
- /**
1003
- * Background prop type for Canvas.
1004
- *
1005
- * String detection priority:
1006
- * 1. Preset - exact match against known presets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
1007
- * 2. URL - starts with /, ./, ../, http://, https://, OR has image extension
1008
- * 3. Color - default fallback (CSS color names, hex values, rgb(), etc.)
1009
- *
1010
- * @example Color
1011
- * ```tsx
1012
- * <Canvas background="red" />
1013
- * <Canvas background="#ff0000" />
1014
- * <Canvas background={0xff0000} />
1015
- * ```
1016
- *
1017
- * @example Preset
1018
- * ```tsx
1019
- * <Canvas background="city" />
1020
- * ```
1021
- *
1022
- * @example URL
1023
- * ```tsx
1024
- * <Canvas background="/path/to/env.hdr" />
1025
- * <Canvas background="./sky.jpg" />
1026
- * ```
1027
- *
1028
- * @example Object form
1029
- * ```tsx
1030
- * <Canvas background={{
1031
- * files: ['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png'],
1032
- * backgroundMap: 'path/to/sky.jpg',
1033
- * envMap: 'path/to/lighting.hdr',
1034
- * backgroundBlurriness: 0.5,
1035
- * }} />
1036
- * ```
1037
- */
1038
- type BackgroundProp =
1039
- | ColorRepresentation // "red", "#ff0000", 0xff0000
1040
- | string // URL or preset
1041
- | BackgroundConfig // Expanded object form
1042
-
1043
- //* Canvas Types ==============================
1044
-
1045
- interface CanvasProps
1046
- extends
1047
- Omit<RenderProps<HTMLCanvasElement>, 'size' | 'primaryCanvas' | 'scheduler'>,
1048
- React$1.HTMLAttributes<HTMLDivElement> {
1049
- children?: React$1.ReactNode
1050
- ref?: React$1.Ref<HTMLCanvasElement>
1051
- /** Canvas fallback content, similar to img's alt prop */
1052
- fallback?: React$1.ReactNode
1053
- /**
1054
- * Options to pass to useMeasure.
1055
- * @see https://github.com/pmndrs/react-use-measure#api
1056
- */
1057
- resize?: Options
1058
- /** The target where events are being subscribed to, default: the div that wraps canvas */
1059
- eventSource?: Element | React$1.RefObject<Element | null>
1060
- /** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
1061
- eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
1062
- /** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
1063
- hmr?: boolean
1064
- /** Canvas resolution width in pixels. If omitted, uses container width. */
1065
- width?: number
1066
- /** Canvas resolution height in pixels. If omitted, uses container height. */
1067
- height?: number
1068
- /** Force canvas dimensions to even numbers (fixes Safari rendering issues with odd/fractional sizes) */
1069
- forceEven?: boolean
1070
- /**
1071
- * Scene background configuration.
1072
- * Accepts colors, URLs, presets, or an expanded object for separate background/environment.
1073
- * @see BackgroundProp for full documentation and examples
1074
- */
1075
- background?: BackgroundProp
1076
- }
1077
-
1078
- //* Loader Types ==============================
1079
-
1080
- type InputLike = string | string[] | string[][] | Readonly<string | string[] | string[][]>
1081
-
1082
- // Define a loader-like interface that matches THREE.Loader's load signature
1083
- // This works for both generic and non-generic THREE.Loader instances
1084
- interface LoaderLike {
1085
- load(
1086
- url: InputLike,
1087
- onLoad?: (result: any) => void,
1088
- onProgress?: (event: ProgressEvent<EventTarget>) => void,
1089
- onError?: (error: unknown) => void,
1090
- ): any
1091
- }
1092
-
1093
- type GLTFLike = { scene: THREE$1.Object3D }
1094
-
1095
- type LoaderInstance<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> =
1096
- T extends ConstructorRepresentation<LoaderLike> ? InstanceType<T> : T
1097
-
1098
- // Infer result type from the load method's callback parameter
1099
- type InferLoadResult<T> = T extends {
1100
- load(url: any, onLoad?: (result: infer R) => void, ...args: any[]): any
1101
- }
1102
- ? R
1103
- : T extends ConstructorRepresentation<any>
1104
- ? InstanceType<T> extends {
1105
- load(url: any, onLoad?: (result: infer R) => void, ...args: any[]): any
1106
- }
1107
- ? R
1108
- : any
1109
- : any
1110
-
1111
- type LoaderResult<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> =
1112
- InferLoadResult<LoaderInstance<T>> extends infer R ? (R extends GLTFLike ? R & ObjectMap : R) : never
1113
-
1114
- type Extensions<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> = (
1115
- loader: LoaderInstance<T>,
1116
- ) => void
1117
-
1118
- //* Renderer Props ========================================
1119
-
1120
- type WebGLDefaultProps = Omit<THREE$1.WebGLRendererParameters, 'canvas'> & BaseRendererProps
1121
-
1122
- type WebGLProps =
1123
- | RendererFactory<THREE$1.WebGLRenderer, WebGLDefaultProps>
1124
- | Partial<Properties<THREE$1.WebGLRenderer> | THREE$1.WebGLRendererParameters>
1125
-
1126
- interface WebGLShadowConfig {
1127
- shadows?: boolean | 'basic' | 'percentage' | 'soft' | 'variance' | Partial<THREE$1.WebGLShadowMap>
1128
- }
1129
104
 
1130
- //* Legacy-specific Types ========================================
1131
-
1132
- /** Legacy (WebGL) renderer type - re-exported as R3FRenderer from @react-three/fiber/legacy */
1133
- type LegacyRenderer = THREE$1.WebGLRenderer
1134
-
1135
- /** Legacy internal state with narrowed renderer type */
1136
- interface LegacyInternalState extends Omit<InternalState, 'actualRenderer'> {
1137
- actualRenderer: THREE$1.WebGLRenderer
1138
- }
105
+ /** Canvas props on the legacy entry: `onCreated` receives `LegacyRootState`. */
106
+ type LegacyCanvasProps = Omit<CanvasProps, 'onCreated'> & {
107
+ /** Callback after the canvas has rendered (but not yet committed); `state.renderer` is a `WebGLRenderer` */
108
+ onCreated?: (state: LegacyRootState) => void;
109
+ };
1139
110
 
1140
111
  /**
1141
- * Legacy-specific RootState with narrowed renderer type.
1142
- * Automatically used when importing from `@react-three/fiber/legacy`.
1143
- *
1144
- * @example
1145
- * ```tsx
1146
- * import { useThree } from '@react-three/fiber/legacy'
1147
- *
1148
- * function MyComponent() {
1149
- * const { renderer } = useThree()
1150
- * // renderer is typed as THREE.WebGLRenderer
1151
- * renderer.shadowMap.enabled = true
1152
- * }
1153
- * ```
112
+ * A DOM canvas which accepts threejs elements as children, rendered with WebGL. `onCreated` is
113
+ * typed against `LegacyRootState`.
114
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
1154
115
  */
1155
- interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
1156
- /** The WebGL renderer instance */
1157
- renderer: THREE$1.WebGLRenderer
1158
- /** Internals with WebGL renderer */
1159
- internal: LegacyInternalState
1160
- }
1161
-
1162
- //* RenderTarget Types ==============================
1163
-
1164
-
1165
- type RenderTargetOptions = RenderTargetOptions$1
1166
-
1167
- //* Global TSL Types ==============================
1168
-
1169
- declare global {
1170
- /**
1171
- * Broad callable-node fallback for dynamic store readers.
1172
- * Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
1173
- */
1174
- type CallableTSLNode = ((...params: never[]) => unknown) & {
1175
- readonly shaderNode: unknown
1176
- readonly id: number
1177
- }
1178
-
1179
- /** Legacy structural node accepted when at least one historical marker exists. */
1180
- type LegacyTSLNodeLike = {
1181
- label?: ((label: string) => unknown) | string
1182
- setName?: (name: string) => unknown
1183
- } & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
1184
-
1185
- /** Node type accepted by broad dynamic node-store readers. */
1186
- type TSLNodeType = three_webgpu.Node | CallableTSLNode
1187
-
1188
- /**
1189
- * Derive Three's shader node type from an existing node or a supported raw input.
1190
- * Existing InputNode generics take precedence over structural value normalization.
1191
- * Both generics must be inferred because Three's UniformNode intersects an unknown-typed
1192
- * InputNode base with its concrete InputNode specialization.
1193
- */
1194
- type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
1195
- ? TNodeType
1196
- : T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
1197
- ? TNodeType
1198
- : T extends number
1199
- ? 'float'
1200
- : T extends boolean
1201
- ? 'bool'
1202
- : T extends string | three_webgpu.Color | { r: number; g: number; b: number }
1203
- ? 'color'
1204
- : T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
1205
- ? 'vec4'
1206
- : T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
1207
- ? 'vec3'
1208
- : T extends three_webgpu.Vector2 | { x: number; y: number }
1209
- ? 'vec2'
1210
- : T extends three_webgpu.Matrix4
1211
- ? 'mat4'
1212
- : T extends three_webgpu.Matrix3
1213
- ? 'mat3'
1214
- : T extends three_webgpu.Matrix2
1215
- ? 'mat2'
1216
- : unknown
1217
-
1218
- /** Derive the normalized JavaScript value stored by a uniform node. */
1219
- type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
1220
- ? TValue
1221
- : T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
1222
- ? TValue
1223
- : T extends string | { r: number; g: number; b: number }
1224
- ? three_webgpu.Color
1225
- : T extends { x: number; y: number; z: number; w: number }
1226
- ? three_webgpu.Vector4
1227
- : T extends { x: number; y: number; z: number }
1228
- ? three_webgpu.Vector3
1229
- : T extends { x: number; y: number }
1230
- ? three_webgpu.Vector2
1231
- : T extends number
1232
- ? number
1233
- : T extends boolean
1234
- ? boolean
1235
- : T
1236
-
1237
- /** Three's exact UniformNode with shader and value generics derived from an input. */
1238
- type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
1239
-
1240
- /** Preserve every input key while mapping values to exact Three uniform nodes. */
1241
- type UniformNodesFor<T extends UniformInputRecord> = {
1242
- [K in keyof T]: UniformNodeFor<T[K]>
1243
- }
1244
-
1245
- /** Backward-compatible single-parameter uniform alias. */
1246
- type UniformNode<T = unknown> = UniformNodeFor<T>
1247
-
1248
- /** Flat record of uniform nodes (no nested scopes) */
1249
- type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
1250
-
1251
- /**
1252
- * Uniform store that can contain both root-level uniforms and scoped uniform objects
1253
- * Used by state.uniforms which has structure like:
1254
- * { uTime: UniformNode, player: { uHealth: UniformNode }, enemy: { uHealth: UniformNode } }
1255
- */
1256
- type UniformStore = Record<string, UniformNode | UniformRecord>
1257
-
1258
- /**
1259
- * Helper to safely access a uniform node from the store.
1260
- * Use this when accessing state.uniforms to get proper typing.
1261
- * @example
1262
- * const uTime = uniforms.uTime as UniformNode<number>
1263
- * const uColor = uniforms.uColor as UniformNode<import('three/webgpu').Color>
1264
- */
1265
- type GetUniform<T = unknown> = UniformNode<T>
1266
-
1267
- /**
1268
- * Acceptable input values for useUniforms - raw values that get converted to UniformNodes
1269
- * Supports:
1270
- * - Primitives: number, string (color), boolean
1271
- * - Three.js types: Color, Vector2/3/4, Matrix2/3/4
1272
- * - Plain objects: { x, y, z, w } converted to vectors
1273
- * - TSL nodes: color(), vec3(), float() for type casting
1274
- * - UniformNode: existing uniforms (reused as-is)
1275
- */
1276
- type UniformValue =
1277
- | number
1278
- | string
1279
- | boolean
1280
- | three_webgpu.Color
1281
- | three_webgpu.Vector2
1282
- | three_webgpu.Vector3
1283
- | three_webgpu.Vector4
1284
- | three_webgpu.Matrix2
1285
- | three_webgpu.Matrix3
1286
- | three_webgpu.Matrix4
1287
- | { x: number; y: number }
1288
- | { x: number; y: number; z: number }
1289
- | { x: number; y: number; z: number; w: number }
1290
- | { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
1291
- | three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
1292
- | UniformNode
1293
-
1294
- /** Input record for useUniforms - accepts raw values or UniformNodes */
1295
- type UniformInputRecord = Record<string, UniformValue>
116
+ declare const Canvas: (props: LegacyCanvasProps) => JSX.Element;
117
+ /** Three.js constructors available as JSX elements on this entry. */
118
+ type ThreeExports = typeof THREE;
119
+ interface ThreeElements extends ThreeElementsOf$1<ThreeExports> {
1296
120
  }
1297
-
1298
- declare global {
1299
- /**
1300
- * three's own render pipeline type. Named here so the rest of R3F refers to three's shape
1301
- * rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
1302
- * is r185, so the new name is the only one.
1303
- */
1304
- type ThreeRenderPipeline = three_webgpu.RenderPipeline
1305
-
1306
- /**
1307
- * The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
1308
- * `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
1309
- * `getTextureNode`, `setMRT` and `dispose` track the installed version.
1310
- */
1311
- type ScenePassNode = three_webgpu.PassNode
1312
-
1313
- /**
1314
- * Pass record - stores TSL pass nodes for render pipeline.
1315
- *
1316
- * `scenePass` is the only key the library owns. It is optional here because this is also the
1317
- * shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
1318
- * or `clearPasses()`. Inside the callbacks it is always present; see
1319
- * {@link RenderPipelineCallbackState}.
1320
- *
1321
- * Every other key is user-registered, via a callback's return value. Those are TSL nodes of
1322
- * any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
1323
- * `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
1324
- * site when you need a member, e.g. `passes.velocity as TextureNode`.
1325
- *
1326
- * The index signature admits `undefined` because a key may simply not be registered, and
1327
- * because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
1328
- * optional property whose type excludes `undefined` from the index signature is an error
1329
- * (TS2411) for every consumer compiling these declarations.
1330
- */
1331
- interface PassRecord {
1332
- scenePass?: ScenePassNode
1333
- [key: string]: three_webgpu.Node | undefined
1334
- }
1335
-
1336
- /**
1337
- * State passed to pipeline callbacks after the active pipeline has been created.
1338
- *
1339
- * `passes.scenePass` is required here: the hook installs the default scene pass before either
1340
- * callback runs, so callbacks can use it without a guard or a cast.
1341
- *
1342
- * `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
1343
- * the legacy renderer before either callback can run, so a callback never sees WebGL.
1344
- */
1345
- type RenderPipelineCallbackState = RootState & {
1346
- renderPipeline: ThreeRenderPipeline
1347
- passes: PassRecord & { scenePass: ScenePassNode }
1348
- renderer: three_webgpu.WebGPURenderer
1349
- isLegacy: false
1350
- }
1351
-
1352
- /**
1353
- * What a callback may return to register entries into `state.passes`.
1354
- *
1355
- * `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
1356
- * created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
1357
- * store entry would leave the store pointing at a node the hook never disposes, and the hook
1358
- * disposing a pass nothing references. So returning it is a type error.
1359
- */
1360
- type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
1361
-
1362
- /** Setup callback - runs first to configure MRT, create additional passes */
1363
- type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1364
-
1365
- /** Main callback - runs second to configure outputNode, create effect passes */
1366
- type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1367
-
1368
- /** The imperative half of useRenderPipeline's return value, present in every state */
1369
- interface UseRenderPipelineActions {
1370
- /** Current passes from state */
1371
- passes: PassRecord
1372
- /** Clear all passes from state */
1373
- clearPasses: () => void
1374
- /** Reset RenderPipeline entirely (clears PP + passes) */
1375
- reset: () => void
1376
- /** Re-run setup/main callbacks with current closure values */
1377
- rebuild: () => void
1378
- }
1379
-
1380
- /**
1381
- * Return type for useRenderPipeline hook, discriminated on `isReady`.
1382
- *
1383
- * `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
1384
- * callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
1385
- * `clearPasses()` empties the record while leaving the pipeline in place.
1386
- */
1387
- type UseRenderPipelineReturn = UseRenderPipelineActions &
1388
- (
1389
- | {
1390
- /** True when RenderPipeline is configured and ready */
1391
- isReady: true
1392
- /** RenderPipeline instance */
1393
- renderPipeline: ThreeRenderPipeline
1394
- }
1395
- | {
1396
- /** False until the pipeline has been created */
1397
- isReady: false
1398
- /** Not initialized yet, or torn down by reset() */
1399
- renderPipeline: null
121
+ declare module 'react' {
122
+ namespace JSX {
123
+ interface IntrinsicElements extends ThreeElements {
1400
124
  }
1401
- )
1402
- }
1403
-
1404
- type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
1405
-
1406
- interface MathRepresentation {
1407
- set(...args: number[]): any
1408
- }
1409
- interface VectorRepresentation extends MathRepresentation {
1410
- setScalar(value: number): any
1411
- }
1412
- type MathTypes = MathRepresentation | Euler$1 | Color$1
1413
-
1414
- type MathType<T extends MathTypes> = T extends Color$1
1415
- ? Args<typeof Color$1> | ColorRepresentation
1416
- : T extends VectorRepresentation | Layers$1 | Euler$1
1417
- ? T | MutableOrReadonlyParameters<T['set']> | number
1418
- : T | MutableOrReadonlyParameters<T['set']>
1419
-
1420
- type MathProps<P> = {
1421
- [K in keyof P as P[K] extends MathTypes ? K : never]: P[K] extends MathTypes ? MathType<P[K]> : never
1422
- }
1423
-
1424
- type Vector2 = MathType<Vector2$1>
1425
- type Vector3 = MathType<Vector3$1>
1426
- type Vector4 = MathType<Vector4$1>
1427
- type Color = MathType<Color$1>
1428
- type Layers = MathType<Layers$1>
1429
- type Quaternion = MathType<Quaternion$1>
1430
- type Euler = MathType<Euler$1>
1431
- type Matrix3 = MathType<Matrix3$1>
1432
- type Matrix4 = MathType<Matrix4$1>
1433
-
1434
- interface RaycastableRepresentation {
1435
- raycast(raycaster: Raycaster, intersects: Intersection$1[]): void
125
+ }
1436
126
  }
1437
- type EventProps<P> = P extends RaycastableRepresentation ? Partial<EventHandlers> : {}
1438
-
1439
- /**
1440
- * Props for geometry transform methods that can be called with `once()`.
1441
- * These methods modify the geometry in-place and only make sense to call once on mount.
1442
- *
1443
- * @example
1444
- * import { once } from '@react-three/fiber'
1445
- *
1446
- * <boxGeometry args={[1, 1, 1]} rotateX={once(Math.PI / 2)} />
1447
- * <planeGeometry args={[10, 10]} translate={once(0, 0, 5)} />
1448
- * <bufferGeometry applyMatrix4={once(matrix)} center={once()} />
1449
- */
1450
- interface GeometryTransformProps {
1451
- /** Rotate the geometry about the X axis (radians). Use with once(). */
1452
- rotateX?: number
1453
- /** Rotate the geometry about the Y axis (radians). Use with once(). */
1454
- rotateY?: number
1455
- /** Rotate the geometry about the Z axis (radians). Use with once(). */
1456
- rotateZ?: number
1457
- /** Translate the geometry (x, y, z). Use with once(). */
1458
- translate?: [x: number, y: number, z: number]
1459
- /** Scale the geometry (x, y, z). Use with once(). */
1460
- scale?: [x: number, y: number, z: number]
1461
- /** Center the geometry based on bounding box. Use with once(). */
1462
- center?: true
1463
- /** Apply a Matrix4 transformation. Use with once(). */
1464
- applyMatrix4?: Matrix4$1
1465
- /** Apply a Quaternion rotation. Use with once(). */
1466
- applyQuaternion?: Quaternion$1
1467
- }
1468
-
1469
- type GeometryProps<P> = P extends BufferGeometry ? GeometryTransformProps : {}
1470
-
1471
- /**
1472
- * Workaround for @types/three TSL node type issues.
1473
- * The Node base class has properties that subclasses (OperatorNode, ConstNode, etc.) don't inherit.
1474
- * This transforms `Node | null` properties to accept any object with node-like shape.
1475
- */
1476
- type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
1477
-
1478
- /**
1479
- * For node material properties (colorNode, positionNode, etc.), accept broader types
1480
- * since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
1481
- * `nodeType`, so this structural key test remains neutral to the selected Three entry.
1482
- */
1483
- type NodeProps<P> = {
1484
- [K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
1485
- }
1486
-
1487
- interface ReactProps<P> {
1488
- children?: React.ReactNode
1489
- ref?: React.Ref<P>
1490
- key?: React.Key
1491
- }
1492
-
1493
- type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<
1494
- Overwrite<P, MathProps<P> & ReactProps<P> & EventProps<P> & GeometryProps<P> & NodeProps<P>>
1495
- >
1496
-
1497
- type ThreeElement<T extends ConstructorRepresentation> = Mutable<
1498
- Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>
1499
- >
1500
-
1501
- type ThreeToJSXElements<T extends Record<string, any>> = {
1502
- [K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
1503
- }
1504
-
1505
- /** Method names of Object3D, excluded from the `primitive` element's typed props. */
1506
- type Object3DMethod = NonNullable<
1507
- {
1508
- [K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
1509
- }[keyof Object3D]
1510
- >
1511
-
1512
- type ThreeExports = typeof import('three')
1513
- type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
1514
-
1515
- interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
1516
- /**
1517
- * `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
1518
- * Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
1519
- * untyped, and any other prop is accepted and applied to the object by name. Object3D's own
1520
- * methods are left out of the typed surface: they return `this`, so a subclass element's
1521
- * props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
1522
- */
1523
- primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | Object3DMethod> & {
1524
- object: object
1525
- ref?: React.Ref<any>
1526
- [prop: string]: unknown
1527
- }
1528
- // Conflicts with DOM types can be accessed through a three* prefix
1529
- threeAudio: ThreeElementsImpl['audio']
1530
- threeSource: ThreeElementsImpl['source']
1531
- threeLine: ThreeElementsImpl['line']
1532
- threePath: ThreeElementsImpl['path']
1533
- }
1534
-
1535
- declare module 'react' {
1536
- namespace JSX {
1537
- interface IntrinsicElements extends ThreeElements {}
1538
- }
1539
- }
1540
-
1541
- declare module 'react/jsx-runtime' {
1542
- namespace JSX {
1543
- interface IntrinsicElements extends ThreeElements {}
1544
- }
1545
- }
1546
-
1547
- declare module 'react/jsx-dev-runtime' {
1548
- namespace JSX {
1549
- interface IntrinsicElements extends ThreeElements {}
1550
- }
1551
- }
1552
-
1553
- type three_d_Color = Color;
1554
- type three_d_ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = ElementProps<T, P>;
1555
- type three_d_Euler = Euler;
1556
- type three_d_EventProps<P> = EventProps<P>;
1557
- type three_d_GeometryProps<P> = GeometryProps<P>;
1558
- type three_d_GeometryTransformProps = GeometryTransformProps;
1559
- type three_d_Layers = Layers;
1560
- type three_d_MathProps<P> = MathProps<P>;
1561
- type three_d_MathRepresentation = MathRepresentation;
1562
- type three_d_MathType<T extends MathTypes> = MathType<T>;
1563
- type three_d_MathTypes = MathTypes;
1564
- type three_d_Matrix3 = Matrix3;
1565
- type three_d_Matrix4 = Matrix4;
1566
- type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
1567
- type three_d_NodeProps<P> = NodeProps<P>;
1568
- type three_d_Object3DMethod = Object3DMethod;
1569
- type three_d_Quaternion = Quaternion;
1570
- type three_d_RaycastableRepresentation = RaycastableRepresentation;
1571
- type three_d_ReactProps<P> = ReactProps<P>;
1572
- type three_d_TSLNodeInput = TSLNodeInput;
1573
- type three_d_ThreeElement<T extends ConstructorRepresentation> = ThreeElement<T>;
1574
- type three_d_ThreeElements = ThreeElements;
1575
- type three_d_ThreeElementsImpl = ThreeElementsImpl;
1576
- type three_d_ThreeExports = ThreeExports;
1577
- type three_d_ThreeToJSXElements<T extends Record<string, any>> = ThreeToJSXElements<T>;
1578
- type three_d_Vector2 = Vector2;
1579
- type three_d_Vector3 = Vector3;
1580
- type three_d_Vector4 = Vector4;
1581
- type three_d_VectorRepresentation = VectorRepresentation;
1582
- declare namespace three_d {
1583
- export type { three_d_Color as Color, three_d_ElementProps as ElementProps, three_d_Euler as Euler, three_d_EventProps as EventProps, three_d_GeometryProps as GeometryProps, three_d_GeometryTransformProps as GeometryTransformProps, three_d_Layers as Layers, three_d_MathProps as MathProps, three_d_MathRepresentation as MathRepresentation, three_d_MathType as MathType, three_d_MathTypes as MathTypes, three_d_Matrix3 as Matrix3, three_d_Matrix4 as Matrix4, three_d_MutableOrReadonlyParameters as MutableOrReadonlyParameters, three_d_NodeProps as NodeProps, three_d_Object3DMethod as Object3DMethod, three_d_Quaternion as Quaternion, three_d_RaycastableRepresentation as RaycastableRepresentation, three_d_ReactProps as ReactProps, three_d_TSLNodeInput as TSLNodeInput, three_d_ThreeElement as ThreeElement, three_d_ThreeElements as ThreeElements, three_d_ThreeElementsImpl as ThreeElementsImpl, three_d_ThreeExports as ThreeExports, three_d_ThreeToJSXElements as ThreeToJSXElements, three_d_Vector2 as Vector2, three_d_Vector3 as Vector3, three_d_Vector4 as Vector4, three_d_VectorRepresentation as VectorRepresentation };
1584
- }
1585
-
1586
- /**
1587
- * @fileoverview Registry for primary canvases that can be targeted by secondary canvases
1588
- *
1589
- * Enables multi-canvas WebGPU rendering where multiple Canvas components share
1590
- * a single WebGPURenderer using Three.js CanvasTarget API.
1591
- *
1592
- * Primary canvas: Has `id` prop, creates its own renderer, registers here
1593
- * Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
1594
- */
1595
-
1596
- interface PrimaryCanvasEntry {
1597
- /** The WebGPURenderer instance owned by this primary canvas */
1598
- renderer: WebGPURenderer;
1599
- /** The zustand store for this canvas */
1600
- store: RootStore;
1601
- }
1602
- /**
1603
- * Register a primary canvas that can be targeted by secondary canvases.
1604
- *
1605
- * @param id - Unique identifier for this primary canvas
1606
- * @param renderer - The WebGPURenderer owned by this canvas
1607
- * @param store - The zustand store for this canvas
1608
- * @returns Cleanup function to unregister on unmount
1609
- */
1610
- declare function registerPrimary(id: string, renderer: WebGPURenderer, store: RootStore): () => void;
1611
- /**
1612
- * Get a registered primary canvas by id.
1613
- *
1614
- * @param id - The id of the primary canvas to look up
1615
- * @returns The primary canvas entry or undefined if not found
1616
- */
1617
- declare function getPrimary(id: string): PrimaryCanvasEntry | undefined;
1618
- /**
1619
- * Wait for a primary canvas to be registered.
1620
- * Returns immediately if already registered, otherwise waits.
1621
- *
1622
- * @param id - The id of the primary canvas to wait for
1623
- * @param timeout - Optional timeout in ms (default: 5000)
1624
- * @returns Promise that resolves with the primary canvas entry
1625
- */
1626
- declare function waitForPrimary(id: string, timeout?: number): Promise<PrimaryCanvasEntry>;
1627
- /**
1628
- * Check if a primary canvas with the given id exists.
1629
- *
1630
- * @param id - The id to check
1631
- * @returns True if a primary canvas with this id is registered
1632
- */
1633
- declare function hasPrimary(id: string): boolean;
1634
- /**
1635
- * Unregister a primary canvas. Called on unmount.
1636
- *
1637
- * @param id - The id of the primary canvas to unregister
1638
- */
1639
- declare function unregisterPrimary(id: string): void;
1640
- /**
1641
- * Get all registered primary canvas ids. Useful for debugging.
1642
- */
1643
- declare function getPrimaryIds(): string[];
1644
-
1645
- type EnvironmentLoaderProps = {
1646
- files?: string | string[];
1647
- path?: string;
1648
- preset?: PresetsType;
1649
- extensions?: (loader: Loader) => void;
1650
- colorSpace?: ColorSpace;
1651
- };
1652
- /**
1653
- * Loads environment textures for reflections and lighting.
1654
- * Supports HDR files, presets, and cubemaps.
1655
- *
1656
- * @example Basic usage
1657
- * ```jsx
1658
- * const texture = useEnvironment({ preset: 'sunset' })
1659
- * ```
1660
- */
1661
- declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
1662
- declare namespace useEnvironment {
1663
- var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
1664
- var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
1665
- }
1666
- /**
1667
- * Options accepted by `useEnvironment.preload`.
1668
- *
1669
- * `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
1670
- * applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
1671
- * advertise an option this function silently ignores.
1672
- *
1673
- * This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
1674
- * `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
1675
- * type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
1676
- */
1677
- type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
1678
- type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
1679
-
1680
- /**
1681
- * Props for Environment component that sets up global cubemap for PBR materials and backgrounds.
1682
- *
1683
- * @property children - React children to render into custom environment portal
1684
- * @property frames - Number of frames to render the environment. Use 1 for static, Infinity for animated (default: 1)
1685
- * @property near - Near clipping plane for cube camera (default: 0.1)
1686
- * @property far - Far clipping plane for cube camera (default: 1000)
1687
- * @property resolution - Resolution of the cube render target (default: 256)
1688
- * @property background - Whether to set scene.background. Can be true, false, or "only" (which only sets background) (default: false)
1689
- *
1690
- * @property blur - @deprecated Use backgroundBlurriness instead
1691
- * @property backgroundBlurriness - Blur factor between 0 and 1 for background (default: 0, requires three.js 0.146+)
1692
- * @property backgroundIntensity - Intensity factor for background (default: 1, requires three.js 0.163+)
1693
- * @property backgroundRotation - Rotation for background as Euler angles (default: [0,0,0], requires three.js 0.163+)
1694
- * @property environmentIntensity - Intensity factor for environment lighting (default: 1, requires three.js 0.163+)
1695
- * @property environmentRotation - Rotation for environment as Euler angles (default: [0,0,0], requires three.js 0.163+)
1696
- *
1697
- * @property map - Pre-existing texture to use as environment map
1698
- * @property preset - HDRI Haven preset: 'apartment', 'city', 'dawn', 'forest', 'lobby', 'night', 'park', 'studio', 'sunset', 'warehouse'. Not for production use.
1699
- * @property scene - Custom THREE.Scene or ref to apply environment to (default: uses default scene)
1700
- * @property ground - Ground projection settings. Use true for defaults or object with:
1701
- * - height: Height of camera used to create env map (default: 15)
1702
- * - radius: Radius of the world (default: 60)
1703
- * - scale: Scale of backside projected sphere (default: 1000)
1704
- *
1705
- * Additional loader props:
1706
- * @property files - File path(s) for environment. Supports .hdr, .exr, gainmap .jpg/.webp, or array of 6 cube faces
1707
- * @property path - Base path for file loading
1708
- * @property extensions - Texture extensions override
1709
- */
1710
- type EnvironmentProps = {
1711
- children?: React$1.ReactNode;
1712
- frames?: number;
1713
- near?: number;
1714
- far?: number;
1715
- resolution?: number;
1716
- background?: boolean | 'only';
1717
- /** deprecated, use backgroundBlurriness */
1718
- blur?: number;
1719
- backgroundBlurriness?: number;
1720
- backgroundIntensity?: number;
1721
- backgroundRotation?: Euler;
1722
- environmentIntensity?: number;
1723
- environmentRotation?: Euler;
1724
- map?: Texture$1;
1725
- preset?: PresetsType;
1726
- scene?: Scene | React$1.RefObject<Scene>;
1727
- ground?: boolean | {
1728
- radius?: number;
1729
- height?: number;
1730
- scale?: number;
1731
- };
1732
- /** Solid color for background (alternative to files/preset) */
1733
- color?: ColorRepresentation;
1734
- /** Separate files for background (when different from environment files) */
1735
- backgroundFiles?: string | string[];
1736
- } & EnvironmentLoaderProps;
1737
- /**
1738
- * Internal component that applies a pre-existing texture as environment map.
1739
- * Sets scene.environment and optionally scene.background.
1740
- *
1741
- * @example
1742
- * ```jsx
1743
- * <CubeCamera>{(texture) => <EnvironmentMap map={texture} />}</CubeCamera>
1744
- * ```
1745
- */
1746
- declare function EnvironmentMap({ scene, background, map, ...config }: EnvironmentProps): null;
1747
- /**
1748
- * Internal component that loads environment textures from files or presets.
1749
- * Uses HDRLoader for .hdr, EXRLoader for .exr, UltraHDRLoader for .jpg/.jpeg HDR,
1750
- * GainMapLoader for gainmap .webp, or CubeTextureLoader for arrays of images.
1751
- *
1752
- * @example With preset
1753
- * ```jsx
1754
- * <EnvironmentCube preset="sunset" />
1755
- * ```
1756
- *
1757
- * @example From HDR file
1758
- * ```jsx
1759
- * <EnvironmentCube files="environment.hdr" />
1760
- * ```
1761
- *
1762
- * @example From gainmap (smallest footprint)
1763
- * ```jsx
1764
- * <EnvironmentCube files={['file.webp', 'file-gainmap.webp', 'file.json']} />
1765
- * ```
1766
- *
1767
- * @example From cube faces
1768
- * ```jsx
1769
- * <EnvironmentCube files={['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']} />
1770
- * ```
1771
- */
1772
- declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, ...rest }: EnvironmentProps): null;
1773
- /**
1774
- * Internal component that renders custom environment using a portal and cube camera.
1775
- * Renders children into an off-buffer and films with a cube camera to create environment map.
1776
- * Can be static (frames=1) or animated (frames=Infinity).
1777
- *
1778
- * @example Custom environment with sphere
1779
- * ```jsx
1780
- * <EnvironmentPortal background near={1} far={1000} resolution={256}>
1781
- * <mesh scale={100}>
1782
- * <sphereGeometry args={[1, 64, 64]} />
1783
- * <meshBasicMaterial map={texture} side={THREE.BackSide} />
1784
- * </mesh>
1785
- * </EnvironmentPortal>
1786
- * ```
1787
- *
1788
- * @example Animated environment
1789
- * ```jsx
1790
- * <EnvironmentPortal frames={Infinity} resolution={256}>
1791
- * <Float>
1792
- * <mesh />
1793
- * </Float>
1794
- * </EnvironmentPortal>
1795
- * ```
1796
- *
1797
- * @example Mixed with preset
1798
- * ```jsx
1799
- * <EnvironmentPortal preset="warehouse">
1800
- * <mesh />
1801
- * </EnvironmentPortal>
1802
- * ```
1803
- */
1804
- declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps): react_jsx_runtime.JSX.Element;
1805
- declare module '@react-three/fiber' {
1806
- interface ThreeElements {
1807
- groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
1808
- }
1809
- }
1810
- /**
1811
- * Sets up a global environment map for PBR materials and backgrounds.
1812
- * Affects scene.environment and optionally scene.background unless a custom scene is passed.
1813
- *
1814
- * Supports multiple input methods:
1815
- * - **Presets**: Selection of HDRI Haven assets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
1816
- * - **Files**: HDR (.hdr), EXR (.exr), gainmap JPEG (.jpg), gainmap WebP (.webp), or cube faces (array of 6 images)
1817
- * - **Texture**: Pre-existing cube texture via `map` prop
1818
- * - **Custom Scene**: Render children into environment using portal and cube camera
1819
- * - **Ground Projection**: Project environment onto ground plane
1820
- *
1821
- * @remarks
1822
- * - Preset property is NOT meant for production and may fail (relies on CDNs)
1823
- * - Gainmap format has the smallest file footprint
1824
- * - Use `frames={Infinity}` for animated environments with low resolution for performance
1825
- * - Ground projection places models on the "ground" within the environment map
1826
- * - Supports self-hosting with @pmndrs/assets using dynamic imports
1827
- *
1828
- * @example Basic preset usage
1829
- * ```jsx
1830
- * <Environment preset="sunset" />
1831
- * ```
1832
- *
1833
- * @example From HDR file
1834
- * ```jsx
1835
- * <Environment files="/hdr/environment.hdr" />
1836
- * ```
1837
- *
1838
- * @example From gainmap (smallest footprint)
1839
- * ```jsx
1840
- * <Environment files={['file.webp', 'file-gainmap.webp', 'file.json']} />
1841
- * ```
1842
- *
1843
- * @example With self-hosted assets
1844
- * ```jsx
1845
- * import { suspend } from 'suspend-react'
1846
- * const city = import('@pmndrs/assets/hdri/city.exr').then(m => m.default)
1847
- *
1848
- * <Environment files={suspend(city)} />
1849
- * ```
1850
- *
1851
- * @example From existing texture
1852
- * ```jsx
1853
- * <CubeCamera>{(texture) => <Environment map={texture} />}</CubeCamera>
1854
- * ```
1855
- *
1856
- * @example Custom environment scene
1857
- * ```jsx
1858
- * <Environment background near={1} far={1000} resolution={256}>
1859
- * <mesh scale={100}>
1860
- * <sphereGeometry args={[1, 64, 64]} />
1861
- * <meshBasicMaterial map={texture} side={THREE.BackSide} />
1862
- * </mesh>
1863
- * </Environment>
1864
- * ```
1865
- *
1866
- * @example Animated environment
1867
- * ```jsx
1868
- * <Environment frames={Infinity} resolution={256}>
1869
- * <Float>
1870
- * <mesh />
1871
- * </Float>
1872
- * </Environment>
1873
- * ```
1874
- *
1875
- * @example Mixed custom scene with preset
1876
- * ```jsx
1877
- * <Environment background preset="warehouse">
1878
- * <mesh />
1879
- * </Environment>
1880
- * ```
1881
- *
1882
- * @example With ground projection
1883
- * ```jsx
1884
- * <Environment ground={{ height: 15, radius: 60 }} preset="city" />
1885
- * ```
1886
- *
1887
- * @example As background only
1888
- * ```jsx
1889
- * <Environment background="only" preset="sunset" />
1890
- * ```
1891
- *
1892
- * @example With rotation and intensity
1893
- * ```jsx
1894
- * <Environment
1895
- * background
1896
- * backgroundBlurriness={0.5}
1897
- * backgroundIntensity={0.8}
1898
- * backgroundRotation={[0, Math.PI / 2, 0]}
1899
- * environmentIntensity={1.2}
1900
- * environmentRotation={[0, Math.PI / 4, 0]}
1901
- * preset="studio"
1902
- * />
1903
- * ```
1904
- */
1905
- declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
1906
-
1907
- /**
1908
- * Moves every trace of interactivity from one object to its replacement, for reconstruction.
1909
- *
1910
- * When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
1911
- * instance. Removing the old object from the interaction state and registering the new one from
1912
- * scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
1913
- * the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
1914
- * is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
1915
- * swap the user never asked to see (#3744).
1916
- *
1917
- * Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
1918
- * left alone — releasing and re-acquiring it is precisely the glitch being avoided.
1919
- *
1920
- * Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
1921
- * the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
1922
- * cannot outlive the object it described.
1923
- */
1924
- declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
1925
- declare function removeInteractivity(store: RootStore, object: Object3D): void;
1926
- declare function createEvents(store: RootStore): {
1927
- handlePointer: (name: string) => (event: DomEvent) => void;
1928
- flushDeferredPointers: () => void;
1929
- processDeferredPointer: (event: DomEvent, pointerId: number) => void;
1930
- };
1931
- /** Default R3F event manager for web */
1932
- declare function createPointerEvents(store: RootStore): EventManager<Element>;
1933
-
1934
- /**
1935
- * Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
1936
- * This allows external code to access loader methods like abort().
1937
- */
1938
- declare function getLoader<L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(Proto: L): L extends ConstructorRepresentation<infer T> ? T : L;
1939
- /**
1940
- * Synchronously loads and caches assets with a three loader.
1941
- *
1942
- * Note: this hook's caller must be wrapped with `React.Suspense`
1943
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1944
- */
1945
- declare function useLoader<I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cacheKey?: InputLike): I extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
1946
- declare namespace useLoader {
1947
- var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cacheKey?: InputLike) => void;
1948
- var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
1949
- var loader: typeof getLoader;
1950
- }
1951
-
1952
- /**
1953
- * Frame hook with phase-based ordering, priority, and FPS throttling.
1954
- *
1955
- * Always delivers full RootState — works both inside and outside Canvas context:
1956
- * - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
1957
- * - Outside Canvas: The job registers immediately but the callback is held until a
1958
- * Canvas adopts it, then runs with full RootState. For hostless / standalone
1959
- * frame loops with no Canvas, use `@pmndrs/scheduler` directly.
1960
- *
1961
- * Returns a controls object for manual stepping, pausing, and resuming.
1962
- *
1963
- * @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
1964
- * @param priorityOrOptions - Either a priority number (backwards compat) or options object
1965
- * @returns Controls object with step(), stepAll(), invalidate(), pause(), resume(), isPaused, id, rootId, scheduler
1966
- *
1967
- * @example
1968
- * // Simple priority (backwards compat)
1969
- * useFrame((state, delta) => { ... }, 5)
1970
- *
1971
- * @example
1972
- * // With phase-based ordering
1973
- * useFrame((state, delta) => { ... }, { phase: 'physics' })
1974
- *
1975
- * @example
1976
- * // Outside Canvas - callback waits for a Canvas, then always has full state
1977
- * function UI() {
1978
- * useFrame((state, delta) => { syncUI(state.camera) });
1979
- * return <button>...</button>;
1980
- * }
1981
- *
1982
- * @example
1983
- * // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
1984
- * import { getScheduler } from '@pmndrs/scheduler'
1985
- * getScheduler().register((state, delta) => { updateGame(delta) })
1986
- *
1987
- * @example
1988
- * // Scheduler-only access (no callback)
1989
- * const { scheduler } = useFrame()
1990
- * scheduler.pauseJob('some-job-id')
1991
- *
1992
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
1993
- */
1994
- declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
1995
-
1996
- declare const IsObject: (url: unknown) => url is Record<string, string>;
1997
- type TextureArray<T> = T extends string[] ? Texture$1[] : never;
1998
- type TextureRecord<T> = T extends Record<string, string> ? {
1999
- [key in keyof T]: Texture$1;
2000
- } : never;
2001
- type SingleTexture<T> = T extends string ? Texture$1 : never;
2002
- type MappedTextureType<T extends string[] | string | Record<string, string>> = TextureArray<T> | TextureRecord<T> | SingleTexture<T>;
2003
- /** Options for useTexture hook */
2004
- type UseTextureOptions<Url extends string[] | string | Record<string, string>> = {
2005
- /** Callback when texture(s) finish loading */
2006
- onLoad?: (texture: MappedTextureType<Url>) => void;
2007
- /**
2008
- * Register the texture(s) in R3F's global texture registry for access via useTextures().
2009
- * When true (the default):
2010
- * - Textures persist until explicitly disposed
2011
- * - On mount, returns existing registered textures if available (preserving modifications like colorSpace)
2012
- *
2013
- * Reads are taken once at mount — a mounted `useTexture` does not re-render when the registry
2014
- * changes. To react to registry swaps, use `useTextures(s => s.get(key))` instead.
2015
- *
2016
- * Pass `false` to opt out of registry enrollment entirely.
2017
- * @default true
2018
- */
2019
- cache?: boolean;
2020
- };
2021
- /**
2022
- * Load texture(s) using Three's TextureLoader with Suspense support.
2023
- *
2024
- * @param input - URL string, array of URLs, or object mapping keys to URLs
2025
- * @param optionsOrOnLoad - Options object or legacy onLoad callback
2026
- *
2027
- * @example
2028
- * ```tsx
2029
- * // Single texture
2030
- * const diffuse = useTexture('/textures/diffuse.png')
2031
- *
2032
- * // Multiple textures (array)
2033
- * const [diffuse, normal] = useTexture(['/diffuse.png', '/normal.png'])
2034
- *
2035
- * // Named textures (object)
2036
- * const { diffuse, normal } = useTexture({
2037
- * diffuse: '/diffuse.png',
2038
- * normal: '/normal.png'
2039
- * })
2040
- *
2041
- * // Textures are registered in the global registry by default — the same texture
2042
- * // object is shared across components and modifications (colorSpace, wrapS, etc.) are preserved
2043
- * const diffuse = useTexture('/diffuse.png')
2044
- * diffuse.colorSpace = THREE.SRGBColorSpace
2045
- *
2046
- * // Another component gets the SAME texture with colorSpace already set
2047
- * const sameDiffuse = useTexture('/diffuse.png')
2048
- *
2049
- * // Opt out of registry enrollment for a one-off texture
2050
- * const scratch = useTexture('/scratch.png', { cache: false })
2051
- *
2052
- * // Access the registry directly
2053
- * const { get } = useTextures()
2054
- * const cached = get('/diffuse.png')
2055
- * ```
2056
- */
2057
- declare function useTexture<Url extends string[] | string | Record<string, string>>(input: Url, optionsOrOnLoad?: UseTextureOptions<Url> | ((texture: MappedTextureType<Url>) => void)): MappedTextureType<Url>;
2058
- declare namespace useTexture {
2059
- var preload: (url: string | string[]) => void;
2060
- var clear: (input: string | string[]) => void;
2061
- }
2062
- declare const Texture: ({ children, input, onLoad, cache, }: {
2063
- children?: (texture: ReturnType<typeof useTexture>) => ReactNode;
2064
- input: Parameters<typeof useTexture>[0];
2065
- onLoad?: Parameters<typeof useTexture>[1];
2066
- cache?: boolean;
2067
- }) => react_jsx_runtime.JSX.Element;
2068
-
2069
- /** Accepted shapes for a registry read: a single key, a list of keys, or a name→key map. */
2070
- type TextureInput = string | string[] | Record<string, string>;
2071
- /** Result of a `get()` read, mirroring the input shape. */
2072
- type TextureResult<Input extends TextureInput> = Input extends string ? Texture$1 | undefined : Input extends string[] ? (Texture$1 | undefined)[] : {
2073
- [K in keyof Input]: Texture$1 | undefined;
2074
- };
2075
- /** Options for `dispose()`. */
2076
- interface DisposeOptions {
2077
- /** Dispose even if the texture still has active references (default false). */
2078
- force?: boolean;
2079
- }
2080
- interface UseTexturesReturn {
2081
- /** The live registry Map (key → Texture). Treat as read-only. */
2082
- readonly all: Map<string, Texture$1>;
2083
- /** Read one texture, an array of textures, or a name→texture record (mirrors the input shape). */
2084
- get<Input extends TextureInput>(input: Input): TextureResult<Input>;
2085
- /** Check whether a key exists in the registry. */
2086
- has(key: string): boolean;
2087
- /**
2088
- * Register a texture (or a record of textures) that has no URL — e.g. a render
2089
- * target or procedural texture. URL-loaded textures are registered automatically
2090
- * by `useTexture` (registry enrollment is on by default).
2091
- */
2092
- add(key: string, texture: Texture$1): void;
2093
- add(record: Record<string, Texture$1>): void;
2094
- /**
2095
- * Dispose a texture's GPU resources and remove it from the registry.
2096
- * Refcount-aware: if the key is still in use by a mounted `useTexture` consumer it is
2097
- * skipped (with a warning) unless `{ force: true }` is passed.
2098
- * @returns true if disposed, false if skipped.
2099
- */
2100
- dispose(key: string, options?: DisposeOptions): boolean;
2101
- /** Dispose every texture in the registry and clear it. Use on scene teardown. */
2102
- disposeAll(): void;
2103
- }
2104
- /**
2105
- * Reactive Texture registry — load once with `useTexture`, reach the textures from anywhere.
2106
- *
2107
- * This is a registry of plain `Texture` objects (not TSL nodes), so the same texture can feed
2108
- * a material map, a heightmap sampler, or anything else. It does **not** load — pair it with
2109
- * `useTexture` for loading (registry enrollment is on by default); `useTextures` is for access and lifecycle.
2110
- *
2111
- * The returned handle is **reactive**: the calling component re-renders when the registry
2112
- * changes. Pass a selector to scope the subscription to a single read.
2113
- *
2114
- * @example
2115
- * ```tsx
2116
- * // Load + register once (anywhere in the tree) — registered by default
2117
- * useTexture({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
2118
- *
2119
- * // Reach them from another component — record form lands straight into a material
2120
- * const { map, normalMap } = useTextures().get({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
2121
- * return <meshStandardMaterial map={map} normalMap={normalMap} />
2122
- *
2123
- * // A set of heightmaps at once
2124
- * const [a, b, c] = useTextures().get(['/h0.png', '/h1.png', '/h2.png'])
2125
- *
2126
- * // Register a non-URL texture (render target / procedural)
2127
- * useTextures().add('rt-main', renderTarget.texture)
2128
- *
2129
- * // Deliberate GPU cleanup (refcount-aware; force to override)
2130
- * useTextures().dispose('/diffuse.jpg')
2131
- * useTextures().disposeAll() // scene teardown
2132
- * ```
2133
- *
2134
- * @remarks
2135
- * **Future expansion:** an imperative async loader (e.g. `await useTextures().load('/x.jpg')`) is
2136
- * intentionally not included yet. It would let non-React code (loading screens, dynamic streaming)
2137
- * populate the registry without Suspense, at the cost of putting loading back into this hook. It
2138
- * will be added only if a concrete consumer needs imperative loading; for now, loading lives in
2139
- * `useTexture`.
2140
- */
2141
- declare function useTextures(): UseTexturesReturn;
2142
- declare function useTextures<T>(selector: (registry: UseTexturesReturn) => T): T;
2143
-
2144
- /**
2145
- * Creates a render target compatible with the current renderer.
2146
- *
2147
- * - Legacy build: Returns WebGLRenderTarget
2148
- * - WebGPU build: Returns RenderTarget
2149
- * - Default build: Returns whichever matches the active renderer
2150
- *
2151
- * @example
2152
- * ```tsx
2153
- * // Use canvas size
2154
- * const fbo = useRenderTarget()
2155
- *
2156
- * // Use canvas size with options
2157
- * const fbo = useRenderTarget({ samples: 4 })
2158
- *
2159
- * // Square render target
2160
- * const fbo = useRenderTarget(512)
2161
- *
2162
- * // Square render target with options
2163
- * const fbo = useRenderTarget(512, { depthBuffer: true })
2164
- *
2165
- * // Explicit dimensions
2166
- * const fbo = useRenderTarget(512, 256)
2167
- *
2168
- * // Explicit dimensions with options
2169
- * const fbo = useRenderTarget(512, 256, { samples: 4 })
2170
- * ```
2171
- */
2172
- declare function useRenderTarget(options?: RenderTargetOptions): WebGLRenderTarget;
2173
- declare function useRenderTarget(size: number, options?: RenderTargetOptions): WebGLRenderTarget;
2174
- declare function useRenderTarget(width: number, height: number, options?: RenderTargetOptions): WebGLRenderTarget;
2175
-
2176
- /**
2177
- * Returns the R3F Canvas' Zustand store. Useful for [transient updates](https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes).
2178
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
2179
- */
2180
- declare function useStore(): RootStore;
2181
- /**
2182
- * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
2183
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
2184
- */
2185
- declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
2186
- /**
2187
- * Exposes an object's {@link Instance}.
2188
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
2189
- *
2190
- * **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
2191
- */
2192
- declare function useInstanceHandle<T>(ref: React.RefObject<T>): React.RefObject<Instance<T>>;
2193
- /**
2194
- * Returns a node graph of an object with named nodes & materials.
2195
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
2196
- */
2197
- declare function useGraph(object: Object3D): ObjectMap;
2198
-
2199
- /**
2200
- * Adds a global render callback which is called each frame BEFORE rendering.
2201
- *
2202
- * @deprecated Use `useFrame(callback, { phase: 'start' })` instead.
2203
- * This function will be removed in a future version.
2204
- *
2205
- * @param callback - Function called each frame with timestamp
2206
- * @returns Unsubscribe function
2207
- *
2208
- * @example
2209
- * // OLD (deprecated)
2210
- * const unsub = addEffect((timestamp) => { ... })
2211
- *
2212
- * // NEW
2213
- * useFrame((state, delta) => { ... }, { phase: 'start' })
2214
- *
2215
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
2216
- */
2217
- declare function addEffect(callback: GlobalRenderCallback): () => void;
2218
- /**
2219
- * Adds a global after-render callback which is called each frame AFTER rendering.
2220
- *
2221
- * @deprecated Use `useFrame(callback, { phase: 'finish' })` instead.
2222
- * This function will be removed in a future version.
2223
- *
2224
- * @param callback - Function called each frame with timestamp
2225
- * @returns Unsubscribe function
2226
- *
2227
- * @example
2228
- * // OLD (deprecated)
2229
- * const unsub = addAfterEffect((timestamp) => { ... })
2230
- *
2231
- * // NEW
2232
- * useFrame((state, delta) => { ... }, { phase: 'finish' })
2233
- *
2234
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
2235
- */
2236
- declare function addAfterEffect(callback: GlobalRenderCallback): () => void;
2237
- /**
2238
- * Adds a global callback which is called when rendering stops.
2239
- *
2240
- * @deprecated Use `scheduler.onIdle(callback)` instead.
2241
- * This function will be removed in a future version.
2242
- *
2243
- * @param callback - Function called when rendering stops
2244
- * @returns Unsubscribe function
2245
- *
2246
- * @example
2247
- * // OLD (deprecated)
2248
- * const unsub = addTail((timestamp) => { ... })
2249
- *
2250
- * // NEW
2251
- * const { scheduler } = useFrame()
2252
- * const unsub = scheduler.onIdle((timestamp) => { ... })
2253
- *
2254
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
2255
- */
2256
- declare function addTail(callback: GlobalRenderCallback): () => void;
2257
- /**
2258
- * Invalidates the view, requesting a frame to be rendered.
2259
- * In demand mode, this triggers the scheduler to run frames.
2260
- *
2261
- * With a state argument, only that root's jobs run on the requested frames; other
2262
- * roots on 'demand' stay idle. Without one, every registered root is invalidated.
2263
- *
2264
- * @param state - Optional root state; targets the invalidation at that root
2265
- * @param frames - Number of frames to request (default: 1)
2266
- * @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
2267
- *
2268
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
2269
- */
2270
- declare function invalidate(state?: RootState, frames?: number, stackFrames?: boolean): void;
2271
- /**
2272
- * Advances the frameloop and runs render effects.
2273
- * Useful for when manually rendering via `frameloop="never"`.
2274
- *
2275
- * With a state argument, only that root is stepped. Without one, every
2276
- * registered root is stepped for backwards compatibility.
2277
- *
2278
- * @param timestamp - The timestamp to use for this frame
2279
- * @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
2280
- * @param state - Optional root state; targets the manual step at that root
2281
- *
2282
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
2283
- */
2284
- declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
2285
-
2286
- /* eslint-disable @definitelytyped/no-unnecessary-generics */
2287
- declare function ReactReconciler<
2288
- Type,
2289
- Props,
2290
- Container,
2291
- Instance,
2292
- TextInstance,
2293
- SuspenseInstance,
2294
- HydratableInstance,
2295
- FormInstance,
2296
- PublicInstance,
2297
- HostContext,
2298
- ChildSet,
2299
- TimeoutHandle,
2300
- NoTimeout,
2301
- TransitionStatus,
2302
- >(
2303
- /* eslint-enable @definitelytyped/no-unnecessary-generics */
2304
- config: ReactReconciler.HostConfig<
2305
- Type,
2306
- Props,
2307
- Container,
2308
- Instance,
2309
- TextInstance,
2310
- SuspenseInstance,
2311
- HydratableInstance,
2312
- FormInstance,
2313
- PublicInstance,
2314
- HostContext,
2315
- ChildSet,
2316
- TimeoutHandle,
2317
- NoTimeout,
2318
- TransitionStatus
2319
- >,
2320
- ): ReactReconciler.Reconciler<Container, Instance, TextInstance, SuspenseInstance, FormInstance, PublicInstance>;
2321
-
2322
- declare namespace ReactReconciler {
2323
- interface HostConfig<
2324
- Type,
2325
- Props,
2326
- Container,
2327
- Instance,
2328
- TextInstance,
2329
- SuspenseInstance,
2330
- HydratableInstance,
2331
- FormInstance,
2332
- PublicInstance,
2333
- HostContext,
2334
- ChildSet,
2335
- TimeoutHandle,
2336
- NoTimeout,
2337
- TransitionStatus,
2338
- > {
2339
- // -------------------
2340
- // Modes
2341
- // -------------------
2342
- /**
2343
- * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.
2344
- *
2345
- * If your target platform is similar to the DOM and has methods similar to `appendChild`, `removeChild`, and so on, you'll want to use the **mutation mode**. This is the same mode used by React DOM, React ART, and the classic React Native renderer.
2346
- *
2347
- * ```js
2348
- * const HostConfig = {
2349
- * // ...
2350
- * supportsMutation: true,
2351
- * // ...
2352
- * }
2353
- * ```
2354
- *
2355
- * Depending on the mode, the reconciler will call different methods on your host config.
2356
- *
2357
- * If you're not sure which one you want, you likely need the mutation mode.
2358
- */
2359
- supportsMutation: boolean;
2360
-
2361
- /**
2362
- * The reconciler has two modes: mutation mode and persistent mode. You must specify one of them.
2363
- *
2364
- * If your target platform has immutable trees, you'll want the **persistent mode** instead. In that mode, existing nodes are never mutated, and instead every change clones the parent tree and then replaces the whole parent tree at the root. This is the node used by the new React Native renderer, codenamed "Fabric".
2365
- *
2366
- * ```js
2367
- * const HostConfig = {
2368
- * // ...
2369
- * supportsPersistence: true,
2370
- * // ...
2371
- * }
2372
- * ```
2373
- *
2374
- * Depending on the mode, the reconciler will call different methods on your host config.
2375
- *
2376
- * If you're not sure which one you want, you likely need the mutation mode.
2377
- */
2378
- supportsPersistence: boolean;
2379
-
2380
- // -------------------
2381
- // Core Methods
2382
- // -------------------
2383
-
2384
- /**
2385
- * This method should return a newly created node. For example, the DOM renderer would call `document.createElement(type)` here and then set the properties from `props`.
2386
- *
2387
- * You can use `rootContainer` to access the root container associated with that tree. For example, in the DOM renderer, this is useful to get the correct `document` reference that the root belongs to.
2388
- *
2389
- * The `hostContext` parameter lets you keep track of some information about your current place in the tree. To learn more about it, see `getChildHostContext` below.
2390
- *
2391
- * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal fields, be aware that it may change significantly between versions. You're taking on additional maintenance risk by reading from it, and giving up all guarantees if you write something to it.
2392
- *
2393
- * This method happens **in the render phase**. It can (and usually should) mutate the node it has just created before returning it, but it must not modify any other nodes. It must not register any event handlers on the parent tree. This is because an instance being created doesn't guarantee it would be placed in the tree — it could be left unused and later collected by GC. If you need to do something when an instance is definitely in the tree, look at `commitMount` instead.
2394
- */
2395
- createInstance(
2396
- type: Type,
2397
- props: Props,
2398
- rootContainer: Container,
2399
- hostContext: HostContext,
2400
- internalHandle: OpaqueHandle,
2401
- ): Instance;
2402
-
2403
- /**
2404
- * Same as `createInstance`, but for text nodes. If your renderer doesn't support text nodes, you can throw here.
2405
- */
2406
- createTextInstance(
2407
- text: string,
2408
- rootContainer: Container,
2409
- hostContext: HostContext,
2410
- internalHandle: OpaqueHandle,
2411
- ): TextInstance;
2412
-
2413
- /**
2414
- * This method should mutate the `parentInstance` and add the child to its list of children. For example, in the DOM this would translate to a `parentInstance.appendChild(child)` call.
2415
- *
2416
- * This method happens **in the render phase**. It can mutate `parentInstance` and `child`, but it must not modify any other nodes. It's called while the tree is still being built up and not connected to the actual tree on the screen.
2417
- */
2418
- appendInitialChild(parentInstance: Instance, child: Instance | TextInstance): void;
2419
-
2420
- /**
2421
- * In this method, you can perform some final mutations on the `instance`. Unlike with `createInstance`, by the time `finalizeInitialChildren` is called, all the initial children have already been added to the `instance`, but the instance itself has not yet been connected to the tree on the screen.
2422
- *
2423
- * This method happens **in the render phase**. It can mutate `instance`, but it must not modify any other nodes. It's called while the tree is still being built up and not connected to the actual tree on the screen.
2424
- *
2425
- * There is a second purpose to this method. It lets you specify whether there is some work that needs to happen when the node is connected to the tree on the screen. If you return `true`, the instance will receive a `commitMount` call later. See its documentation below.
2426
- *
2427
- * If you don't want to do anything here, you should return `false`.
2428
- */
2429
- finalizeInitialChildren(
2430
- instance: Instance,
2431
- type: Type,
2432
- props: Props,
2433
- rootContainer: Container,
2434
- hostContext: HostContext,
2435
- ): boolean;
2436
-
2437
- /**
2438
- * Some target platforms support setting an instance's text content without manually creating a text node. For example, in the DOM, you can set `node.textContent` instead of creating a text node and appending it.
2439
- *
2440
- * If you return `true` from this method, React will assume that this node's children are text, and will not create nodes for them. It will instead rely on you to have filled that text during `createInstance`. This is a performance optimization. For example, the DOM renderer returns `true` only if `type` is a known text-only parent (like `'textarea'`) or if `props.children` has a `'string'` type. If you return `true`, you will need to implement `resetTextContent` too.
2441
- *
2442
- * If you don't want to do anything here, you should return `false`.
2443
- *
2444
- * This method happens **in the render phase**. Do not mutate the tree from it.
2445
- */
2446
- shouldSetTextContent(type: Type, props: Props): boolean;
2447
-
2448
- /**
2449
- * This method lets you return the initial host context from the root of the tree. See `getChildHostContext` for the explanation of host context.
2450
- *
2451
- * If you don't intend to use host context, you can return `null`.
2452
- *
2453
- * This method happens **in the render phase**. Do not mutate the tree from it.
2454
- */
2455
- getRootHostContext(rootContainer: Container): HostContext | null;
2456
-
2457
- /**
2458
- * Host context lets you track some information about where you are in the tree so that it's available inside `createInstance` as the `hostContext` parameter. For example, the DOM renderer uses it to track whether it's inside an HTML or an SVG tree, because `createInstance` implementation needs to be different for them.
2459
- *
2460
- * If the node of this `type` does not influence the context you want to pass down, you can return `parentHostContext`. Alternatively, you can return any custom object representing the information you want to pass down.
2461
- *
2462
- * If you don't want to do anything here, return `parentHostContext`.
2463
- *
2464
- * This method happens **in the render phase**. Do not mutate the tree from it.
2465
- */
2466
- getChildHostContext(parentHostContext: HostContext, type: Type, rootContainer: Container): HostContext;
2467
-
2468
- /**
2469
- * Determines what object gets exposed as a ref. You'll likely want to return the `instance` itself. But in some cases it might make sense to only expose some part of it.
2470
- *
2471
- * If you don't want to do anything here, return `instance`.
2472
- */
2473
- getPublicInstance(instance: Instance | TextInstance): PublicInstance;
2474
-
2475
- /**
2476
- * This method lets you store some information before React starts making changes to the tree on the screen. For example, the DOM renderer stores the current text selection so that it can later restore it. This method is mirrored by `resetAfterCommit`.
2477
- *
2478
- * Even if you don't want to do anything here, you need to return `null` from it.
2479
- */
2480
- prepareForCommit(containerInfo: Container): Record<string, any> | null;
2481
-
2482
- /**
2483
- * This method is called right after React has performed the tree mutations. You can use it to restore something you've stored in `prepareForCommit` — for example, text selection.
2484
- *
2485
- * You can leave it empty.
2486
- */
2487
- resetAfterCommit(containerInfo: Container): void;
2488
-
2489
- /**
2490
- * This method is called for a container that's used as a portal target. Usually you can leave it empty.
2491
- */
2492
- preparePortalMount(containerInfo: Container): void;
2493
-
2494
- /**
2495
- * You can proxy this to `setTimeout` or its equivalent in your environment.
2496
- */
2497
- scheduleTimeout(fn: (...args: unknown[]) => unknown, delay?: number): TimeoutHandle;
2498
-
2499
- /**
2500
- * You can proxy this to `clearTimeout` or its equivalent in your environment.
2501
- */
2502
- cancelTimeout(id: TimeoutHandle): void;
2503
-
2504
- /**
2505
- * This is a property (not a function) that should be set to something that can never be a valid timeout ID. For example, you can set it to `-1`.
2506
- */
2507
- noTimeout: NoTimeout;
2508
-
2509
- /**
2510
- * Set this to true to indicate that your renderer supports `scheduleMicrotask`. We use microtasks as part of our discrete event implementation in React DOM. If you're not sure if your renderer should support this, you probably should. The option to not implement `scheduleMicrotask` exists so that platforms with more control over user events, like React Native, can choose to use a different mechanism.
2511
- */
2512
- supportsMicrotasks?: boolean;
2513
-
2514
- /**
2515
- * Optional. You can proxy this to `queueMicrotask` or its equivalent in your environment.
2516
- */
2517
- scheduleMicrotask?(fn: () => unknown): void;
2518
-
2519
- /**
2520
- * This is a property (not a function) that should be set to `true` if your renderer is the main one on the page. For example, if you're writing a renderer for the Terminal, it makes sense to set it to `true`, but if your renderer is used *on top of* React DOM or some other existing renderer, set it to `false`.
2521
- */
2522
- isPrimaryRenderer: boolean;
2523
-
2524
- /**
2525
- * Whether the renderer shouldn't trigger missing `act()` warnings
2526
- */
2527
- warnsIfNotActing?: boolean;
2528
-
2529
- getInstanceFromNode(node: any): Fiber | null | undefined;
2530
-
2531
- beforeActiveInstanceBlur(): void;
2532
-
2533
- afterActiveInstanceBlur(): void;
2534
-
2535
- prepareScopeUpdate(scopeInstance: any, instance: any): void;
2536
-
2537
- getInstanceFromScope(scopeInstance: any): null | Instance;
2538
-
2539
- detachDeletedInstance(node: Instance): void;
2540
-
2541
- // -------------------
2542
- // Mutation Methods
2543
- // (optional)
2544
- // If you're using React in mutation mode (you probably do), you'll need to implement a few more methods.
2545
- // -------------------
2546
-
2547
- /**
2548
- * This method should mutate the `parentInstance` and add the child to its list of children. For example, in the DOM this would translate to a `parentInstance.appendChild(child)` call.
2549
- *
2550
- * Although this method currently runs in the commit phase, you still should not mutate any other nodes in it. If you need to do some additional work when a node is definitely connected to the visible tree, look at `commitMount`.
2551
- */
2552
- appendChild?(parentInstance: Instance, child: Instance | TextInstance): void;
2553
-
2554
- /**
2555
- * Same as `appendChild`, but for when a node is attached to the root container. This is useful if attaching to the root has a slightly different implementation, or if the root container nodes are of a different type than the rest of the tree.
2556
- */
2557
- appendChildToContainer?(container: Container, child: Instance | TextInstance): void;
2558
-
2559
- /**
2560
- * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list of its children. For example, in the DOM this would translate to a `parentInstance.insertBefore(child, beforeChild)` call.
2561
- *
2562
- * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is expected that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts of the tree from it.
2563
- */
2564
- insertBefore?(
2565
- parentInstance: Instance,
2566
- child: Instance | TextInstance,
2567
- beforeChild: Instance | TextInstance | SuspenseInstance,
2568
- ): void;
2569
-
2570
- /**
2571
- * Same as `insertBefore`, but for when a node is attached to the root container. This is useful if attaching to the root has a slightly different implementation, or if the root container nodes are of a different type than the rest of the tree.
2572
- */
2573
- insertInContainerBefore?(
2574
- container: Container,
2575
- child: Instance | TextInstance,
2576
- beforeChild: Instance | TextInstance | SuspenseInstance,
2577
- ): void;
2578
-
2579
- /**
2580
- * This method should mutate the `parentInstance` to remove the `child` from the list of its children.
2581
- *
2582
- * React will only call it for the top-level node that is being removed. It is expected that garbage collection would take care of the whole subtree. You are not expected to traverse the child tree in it.
2583
- */
2584
- removeChild?(parentInstance: Instance, child: Instance | TextInstance | SuspenseInstance): void;
2585
-
2586
- /**
2587
- * Same as `removeChild`, but for when a node is detached from the root container. This is useful if attaching to the root has a slightly different implementation, or if the root container nodes are of a different type than the rest of the tree.
2588
- */
2589
- removeChildFromContainer?(container: Container, child: Instance | TextInstance | SuspenseInstance): void;
2590
-
2591
- /**
2592
- * If you returned `true` from `shouldSetTextContent` for the previous props, but returned `false` from `shouldSetTextContent` for the next props, React will call this method so that you can clear the text content you were managing manually. For example, in the DOM you could set `node.textContent = ''`.
2593
- *
2594
- * If you never return `true` from `shouldSetTextContent`, you can leave it empty.
2595
- */
2596
- resetTextContent?(instance: Instance): void;
2597
-
2598
- /**
2599
- * This method should mutate the `textInstance` and update its text content to `nextText`.
2600
- *
2601
- * Here, `textInstance` is a node created by `createTextInstance`.
2602
- */
2603
- commitTextUpdate?(textInstance: TextInstance, oldText: string, newText: string): void;
2604
-
2605
- /**
2606
- * This method is only called if you returned `true` from `finalizeInitialChildren` for this instance.
2607
- *
2608
- * It lets you do some additional work after the node is actually attached to the tree on the screen for the first time. For example, the DOM renderer uses it to trigger focus on nodes with the `autoFocus` attribute.
2609
- *
2610
- * Note that `commitMount` does not mirror `removeChild` one to one because `removeChild` is only called for the top-level removed node. This is why ideally `commitMount` should not mutate any nodes other than the `instance` itself. For example, if it registers some events on some node above, it will be your responsibility to traverse the tree in `removeChild` and clean them up, which is not ideal.
2611
- *
2612
- * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal fields, be aware that it may change significantly between versions. You're taking on additional maintenance risk by reading from it, and giving up all guarantees if you write something to it.
2613
- *
2614
- * If you never return `true` from `finalizeInitialChildren`, you can leave it empty.
2615
- */
2616
- commitMount?(instance: Instance, type: Type, props: Props, internalInstanceHandle: OpaqueHandle): void;
2617
-
2618
- /**
2619
- * This method should mutate the instance to match nextProps.
2620
- *
2621
- * The internalHandle data structure is meant to be opaque. If you bend the rules and rely on its internal fields, be aware that it may change significantly between versions. You're taking on additional maintenance risk by reading from it, and giving up all guarantees if you write something to it.
2622
- */
2623
- commitUpdate?(
2624
- instance: Instance,
2625
- type: Type,
2626
- prevProps: Props,
2627
- nextProps: Props,
2628
- internalHandle: OpaqueHandle,
2629
- ): void;
2630
-
2631
- /**
2632
- * This method should make the `instance` invisible without removing it from the tree. For example, it can apply visual styling to hide it. It is used by Suspense to hide the tree while the fallback is visible.
2633
- */
2634
- hideInstance?(instance: Instance): void;
2635
-
2636
- /**
2637
- * Same as `hideInstance`, but for nodes created by `createTextInstance`.
2638
- */
2639
- hideTextInstance?(textInstance: TextInstance): void;
2640
-
2641
- /**
2642
- * This method should make the `instance` visible, undoing what `hideInstance` did.
2643
- */
2644
- unhideInstance?(instance: Instance, props: Props): void;
2645
-
2646
- /**
2647
- * Same as `unhideInstance`, but for nodes created by `createTextInstance`.
2648
- */
2649
- unhideTextInstance?(textInstance: TextInstance, text: string): void;
2650
-
2651
- /**
2652
- * This method should mutate the `container` root node and remove all children from it.
2653
- */
2654
- clearContainer?(container: Container): void;
2655
-
2656
- // -------------------
2657
- // Persistence Methods
2658
- // (optional)
2659
- // If you use the persistent mode instead of the mutation mode, you would still need the "Core Methods". However, instead of the Mutation Methods above you will implement a different set of methods that performs cloning nodes and replacing them at the root level. You can find a list of them in the "Persistence" section [listed in this file](https://github.com/facebook/react/blob/master/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js). File an issue if you need help.
2660
- // -------------------
2661
- cloneInstance?(
2662
- instance: Instance,
2663
- type: Type,
2664
- oldProps: Props,
2665
- newProps: Props,
2666
- keepChildren: boolean,
2667
- recyclableInstance: null | Instance,
2668
- ): Instance;
2669
- createContainerChildSet?(container: Container): ChildSet;
2670
- appendChildToContainerChildSet?(childSet: ChildSet, child: Instance | TextInstance): void;
2671
- finalizeContainerChildren?(container: Container, newChildren: ChildSet): void;
2672
- replaceContainerChildren?(container: Container, newChildren: ChildSet): void;
2673
- cloneHiddenInstance?(
2674
- instance: Instance,
2675
- type: Type,
2676
- props: Props,
2677
- internalInstanceHandle: OpaqueHandle,
2678
- ): Instance;
2679
- cloneHiddenTextInstance?(instance: Instance, text: Type, internalInstanceHandle: OpaqueHandle): TextInstance;
2680
-
2681
- // -------------------
2682
- // Hydration Methods
2683
- // (optional)
2684
- // You can optionally implement hydration to "attach" to the existing tree during the initial render instead of creating it from scratch. For example, the DOM renderer uses this to attach to an HTML markup.
2685
- //
2686
- // To support hydration, you need to declare `supportsHydration: true` and then implement the methods in the "Hydration" section [listed in this file](https://github.com/facebook/react/blob/master/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js). File an issue if you need help.
2687
- // -------------------
2688
- supportsHydration: boolean;
2689
-
2690
- canHydrateInstance?(instance: HydratableInstance, type: Type, props: Props): null | Instance;
2691
-
2692
- canHydrateTextInstance?(instance: HydratableInstance, text: string): null | TextInstance;
2693
-
2694
- canHydrateSuspenseInstance?(instance: HydratableInstance): null | SuspenseInstance;
2695
-
2696
- isSuspenseInstancePending?(instance: SuspenseInstance): boolean;
2697
-
2698
- isSuspenseInstanceFallback?(instance: SuspenseInstance): boolean;
2699
-
2700
- registerSuspenseInstanceRetry?(instance: SuspenseInstance, callback: () => void): void;
2701
-
2702
- getNextHydratableSibling?(instance: HydratableInstance): null | HydratableInstance;
2703
-
2704
- getFirstHydratableChild?(parentInstance: Container | Instance): null | HydratableInstance;
2705
-
2706
- hydrateInstance?(
2707
- instance: Instance,
2708
- type: Type,
2709
- props: Props,
2710
- rootContainerInstance: Container,
2711
- hostContext: HostContext,
2712
- internalInstanceHandle: any,
2713
- ): null | any[];
2714
-
2715
- hydrateTextInstance?(textInstance: TextInstance, text: string, internalInstanceHandle: any): boolean;
2716
-
2717
- hydrateSuspenseInstance?(suspenseInstance: SuspenseInstance, internalInstanceHandle: any): void;
2718
-
2719
- getNextHydratableInstanceAfterSuspenseInstance?(suspenseInstance: SuspenseInstance): null | HydratableInstance;
2720
-
2721
- // Returns the SuspenseInstance if this node is a direct child of a
2722
- // SuspenseInstance. I.e. if its previous sibling is a Comment with
2723
- // SUSPENSE_x_START_DATA. Otherwise, null.
2724
- getParentSuspenseInstance?(targetInstance: any): null | SuspenseInstance;
2725
-
2726
- commitHydratedContainer?(container: Container): void;
2727
-
2728
- commitHydratedSuspenseInstance?(suspenseInstance: SuspenseInstance): void;
2729
-
2730
- didNotMatchHydratedContainerTextInstance?(
2731
- parentContainer: Container,
2732
- textInstance: TextInstance,
2733
- text: string,
2734
- ): void;
2735
-
2736
- didNotMatchHydratedTextInstance?(
2737
- parentType: Type,
2738
- parentProps: Props,
2739
- parentInstance: Instance,
2740
- textInstance: TextInstance,
2741
- text: string,
2742
- ): void;
2743
-
2744
- didNotHydrateContainerInstance?(parentContainer: Container, instance: HydratableInstance): void;
2745
-
2746
- didNotHydrateInstance?(
2747
- parentType: Type,
2748
- parentProps: Props,
2749
- parentInstance: Instance,
2750
- instance: HydratableInstance,
2751
- ): void;
2752
-
2753
- didNotFindHydratableContainerInstance?(parentContainer: Container, type: Type, props: Props): void;
2754
-
2755
- didNotFindHydratableContainerTextInstance?(parentContainer: Container, text: string): void;
2756
-
2757
- didNotFindHydratableContainerSuspenseInstance?(parentContainer: Container): void;
2758
-
2759
- didNotFindHydratableInstance?(
2760
- parentType: Type,
2761
- parentProps: Props,
2762
- parentInstance: Instance,
2763
- type: Type,
2764
- props: Props,
2765
- ): void;
2766
-
2767
- didNotFindHydratableTextInstance?(
2768
- parentType: Type,
2769
- parentProps: Props,
2770
- parentInstance: Instance,
2771
- text: string,
2772
- ): void;
2773
-
2774
- didNotFindHydratableSuspenseInstance?(parentType: Type, parentProps: Props, parentInstance: Instance): void;
2775
-
2776
- errorHydratingContainer?(parentContainer: Container): void;
2777
-
2778
- // Undocumented
2779
- // https://github.com/facebook/react/pull/26722
2780
- NotPendingTransition: TransitionStatus | null;
2781
- HostTransitionContext: ReactContext<TransitionStatus>;
2782
-
2783
- // https://github.com/facebook/react/pull/28751
2784
- setCurrentUpdatePriority(newPriority: EventPriority): void;
2785
- getCurrentUpdatePriority(): EventPriority;
2786
- resolveUpdatePriority(): EventPriority;
2787
-
2788
- // https://github.com/facebook/react/pull/28804
2789
- resetFormInstance(form: FormInstance): void;
2790
-
2791
- // https://github.com/facebook/react/pull/25105
2792
- requestPostPaintCallback(callback: (time: number) => void): void;
2793
-
2794
- // https://github.com/facebook/react/pull/26025
2795
- shouldAttemptEagerTransition(): boolean;
2796
-
2797
- // https://github.com/facebook/react/pull/31528
2798
- trackSchedulerEvent(): void;
2799
-
2800
- // https://github.com/facebook/react/pull/31008
2801
- resolveEventType(): null | string;
2802
- resolveEventTimeStamp(): number;
2803
-
2804
- /**
2805
- * This method is called during render to determine if the Host Component type and props require some kind of loading process to complete before committing an update.
2806
- */
2807
- maySuspendCommit(type: Type, props: Props): boolean;
2808
-
2809
- /**
2810
- * This method may be called during render if the Host Component type and props might suspend a commit. It can be used to initiate any work that might shorten the duration of a suspended commit.
2811
- */
2812
- preloadInstance(type: Type, props: Props): boolean;
2813
-
2814
- /**
2815
- * This method is called just before the commit phase. Use it to set up any necessary state while any Host Components that might suspend this commit are evaluated to determine if the commit must be suspended.
2816
- */
2817
- startSuspendingCommit(): void;
2818
-
2819
- /**
2820
- * This method is called after `startSuspendingCommit` for each Host Component that indicated it might suspend a commit.
2821
- */
2822
- suspendInstance(type: Type, props: Props): void;
2823
-
2824
- /**
2825
- * This method is called after all `suspendInstance` calls are complete.
2826
- *
2827
- * Return `null` if the commit can happen immediately.
2828
- *
2829
- * Return `(initiateCommit: Function) => Function` if the commit must be suspended. The argument to this callback will initiate the commit when called. The return value is a cancellation function that the Reconciler can use to abort the commit.
2830
- */
2831
- waitForCommitToBeReady():
2832
- | ((initiateCommit: (...args: unknown[]) => unknown) => (...args: unknown[]) => unknown)
2833
- | null;
2834
- }
2835
-
2836
- interface Thenable<T> {
2837
- then(resolve: () => T, reject?: () => T): T;
2838
- }
2839
-
2840
- type RootTag = 0 | 1 | 2;
2841
-
2842
- type WorkTag =
2843
- | 0
2844
- | 1
2845
- | 2
2846
- | 3
2847
- | 4
2848
- | 5
2849
- | 6
2850
- | 7
2851
- | 8
2852
- | 9
2853
- | 10
2854
- | 11
2855
- | 12
2856
- | 13
2857
- | 14
2858
- | 15
2859
- | 16
2860
- | 17
2861
- | 18
2862
- | 19
2863
- | 20
2864
- | 21
2865
- | 22
2866
- | 23
2867
- | 24;
2868
-
2869
- type HookType =
2870
- | "useState"
2871
- | "useReducer"
2872
- | "useContext"
2873
- | "useRef"
2874
- | "useEffect"
2875
- | "useLayoutEffect"
2876
- | "useCallback"
2877
- | "useMemo"
2878
- | "useImperativeHandle"
2879
- | "useDebugValue"
2880
- | "useDeferredValue"
2881
- | "useTransition"
2882
- | "useMutableSource"
2883
- | "useOpaqueIdentifier"
2884
- | "useCacheRefresh";
2885
-
2886
- interface Source {
2887
- fileName: string;
2888
- lineNumber: number;
2889
- }
2890
-
2891
- // TODO: Ideally these types would be opaque but that doesn't work well with
2892
- // our reconciler fork infra, since these leak into non-reconciler packages.
2893
- type LanePriority = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17;
2894
-
2895
- type Lanes = number;
2896
- type Lane = number;
2897
-
2898
- type Flags = number;
2899
-
2900
- type TypeOfMode = number;
2901
-
2902
- type EventPriority = number;
2903
-
2904
- interface ReactProvider<T> {
2905
- $$typeof: symbol | number;
2906
- type: ReactProviderType<T>;
2907
- key: null | string;
2908
- ref: null;
2909
- props: {
2910
- value: T;
2911
- children?: ReactNode;
2912
- };
2913
- }
2914
-
2915
- interface ReactProviderType<T> {
2916
- $$typeof: symbol | number;
2917
- _context: ReactContext<T>;
2918
- }
2919
-
2920
- interface ReactConsumer<T> {
2921
- $$typeof: symbol | number;
2922
- type: ReactContext<T>;
2923
- key: null | string;
2924
- ref: null;
2925
- props: {
2926
- children: (value: T) => ReactNode;
2927
- unstable_observedBits?: number;
2928
- };
2929
- }
2930
-
2931
- interface ReactContext<T> {
2932
- $$typeof: symbol | number;
2933
- Consumer: ReactContext<T>;
2934
- Provider: ReactProviderType<T>;
2935
- _currentValue: T;
2936
- _currentValue2: T;
2937
- _threadCount: number;
2938
- // DEV only
2939
- _currentRenderer?: {
2940
- [key: string]: any;
2941
- } | null;
2942
- _currentRenderer2?: {
2943
- [key: string]: any;
2944
- } | null;
2945
- // This value may be added by application code
2946
- // to improve DEV tooling display names
2947
- displayName?: string;
2948
- }
2949
-
2950
- interface ReactPortal {
2951
- $$typeof: symbol | number;
2952
- key: null | string;
2953
- containerInfo: any;
2954
- children: ReactNode;
2955
- // TODO: figure out the API for cross-renderer implementation.
2956
- implementation: any;
2957
- }
2958
-
2959
- interface RefObject {
2960
- current: any;
2961
- }
2962
-
2963
- interface ContextDependency<T> {
2964
- context: ReactContext<T>;
2965
- observedBits: number;
2966
- next: ContextDependency<unknown> | null;
2967
- }
2968
-
2969
- interface Dependencies {
2970
- lanes: Lanes;
2971
- firstContext: ContextDependency<unknown> | null;
2972
- }
2973
-
2974
- interface Fiber {
2975
- // These first fields are conceptually members of an Instance. This used to
2976
- // be split into a separate type and intersected with the other Fiber fields,
2977
- // but until Flow fixes its intersection bugs, we've merged them into a
2978
- // single type.
2979
-
2980
- // An Instance is shared between all versions of a component. We can easily
2981
- // break this out into a separate object to avoid copying so much to the
2982
- // alternate versions of the tree. We put this on a single object for now to
2983
- // minimize the number of objects created during the initial render.
2984
-
2985
- // Tag identifying the type of fiber.
2986
- tag: WorkTag;
2987
-
2988
- // Unique identifier of this child.
2989
- key: null | string;
2990
-
2991
- // The value of element.type which is used to preserve the identity during
2992
- // reconciliation of this child.
2993
- elementType: any;
2994
-
2995
- // The resolved function/class/ associated with this fiber.
2996
- type: any;
2997
-
2998
- // The local state associated with this fiber.
2999
- stateNode: any;
3000
-
3001
- // Conceptual aliases
3002
- // parent : Instance -> return The parent happens to be the same as the
3003
- // return fiber since we've merged the fiber and instance.
3004
-
3005
- // Remaining fields belong to Fiber
3006
-
3007
- // The Fiber to return to after finishing processing this one.
3008
- // This is effectively the parent, but there can be multiple parents (two)
3009
- // so this is only the parent of the thing we're currently processing.
3010
- // It is conceptually the same as the return address of a stack frame.
3011
- return: Fiber | null;
3012
-
3013
- // Singly Linked List Tree Structure.
3014
- child: Fiber | null;
3015
- sibling: Fiber | null;
3016
- index: number;
3017
-
3018
- // The ref last used to attach this node.
3019
- // I'll avoid adding an owner field for prod and model that as functions.
3020
- ref:
3021
- | null
3022
- | (((handle: unknown) => void) & {
3023
- _stringRef?: string | null;
3024
- })
3025
- | RefObject;
3026
-
3027
- // Input is the data coming into process this fiber. Arguments. Props.
3028
- pendingProps: any; // This type will be more specific once we overload the tag.
3029
- memoizedProps: any; // The props used to create the output.
3030
-
3031
- // A queue of state updates and callbacks.
3032
- updateQueue: unknown;
3033
-
3034
- // The state used to create the output
3035
- memoizedState: any;
3036
-
3037
- // Dependencies (contexts, events) for this fiber, if it has any
3038
- dependencies: Dependencies | null;
3039
-
3040
- // Bitfield that describes properties about the fiber and its subtree. E.g.
3041
- // the ConcurrentMode flag indicates whether the subtree should be async-by-
3042
- // default. When a fiber is created, it inherits the mode of its
3043
- // parent. Additional flags can be set at creation time, but after that the
3044
- // value should remain unchanged throughout the fiber's lifetime, particularly
3045
- // before its child fibers are created.
3046
- mode: TypeOfMode;
3047
-
3048
- // Effect
3049
- flags: Flags;
3050
- subtreeFlags: Flags;
3051
- deletions: Fiber[] | null;
3052
-
3053
- // Singly linked list fast path to the next fiber with side-effects.
3054
- nextEffect: Fiber | null;
3055
-
3056
- // The first and last fiber with side-effect within this subtree. This allows
3057
- // us to reuse a slice of the linked list when we reuse the work done within
3058
- // this fiber.
3059
- firstEffect: Fiber | null;
3060
- lastEffect: Fiber | null;
3061
-
3062
- lanes: Lanes;
3063
- childLanes: Lanes;
3064
-
3065
- // This is a pooled version of a Fiber. Every fiber that gets updated will
3066
- // eventually have a pair. There are cases when we can clean up pairs to save
3067
- // memory if we need to.
3068
- alternate: Fiber | null;
3069
-
3070
- // Time spent rendering this Fiber and its descendants for the current update.
3071
- // This tells us how well the tree makes use of sCU for memoization.
3072
- // It is reset to 0 each time we render and only updated when we don't bailout.
3073
- // This field is only set when the enableProfilerTimer flag is enabled.
3074
- actualDuration?: number;
3075
-
3076
- // If the Fiber is currently active in the "render" phase,
3077
- // This marks the time at which the work began.
3078
- // This field is only set when the enableProfilerTimer flag is enabled.
3079
- actualStartTime?: number;
3080
-
3081
- // Duration of the most recent render time for this Fiber.
3082
- // This value is not updated when we bailout for memoization purposes.
3083
- // This field is only set when the enableProfilerTimer flag is enabled.
3084
- selfBaseDuration?: number;
3085
-
3086
- // Sum of base times for all descendants of this Fiber.
3087
- // This value bubbles up during the "complete" phase.
3088
- // This field is only set when the enableProfilerTimer flag is enabled.
3089
- treeBaseDuration?: number;
3090
-
3091
- // Conceptual aliases
3092
- // workInProgress : Fiber -> alternate The alternate used for reuse happens
3093
- // to be the same as work in progress.
3094
- // __DEV__ only
3095
- _debugID?: number;
3096
- _debugSource?: Source | null;
3097
- _debugOwner?: Fiber | null;
3098
- _debugIsCurrentlyTiming?: boolean;
3099
- _debugNeedsRemount?: boolean;
3100
-
3101
- // Used to verify that the order of hooks does not change between renders.
3102
- _debugHookTypes?: HookType[] | null;
3103
- }
3104
-
3105
- type FiberRoot = any;
3106
-
3107
- // Concurrent related struct
3108
- type MutableSource = any;
3109
-
3110
- type OpaqueHandle = any;
3111
- type OpaqueRoot = any;
3112
-
3113
- // 0 is PROD, 1 is DEV.
3114
- // Might add PROFILE later.
3115
- type BundleType = 0 | 1;
3116
-
3117
- interface DevToolsConfig<Instance, TextInstance, RendererInspectionConfig> {
3118
- bundleType: BundleType;
3119
- version: string;
3120
- rendererPackageName: string;
3121
- // Note: this actually *does* depend on Fiber internal fields.
3122
- // Used by "inspect clicked DOM element" in React DevTools.
3123
- findFiberByHostInstance?: (instance: Instance | TextInstance) => Fiber | null;
3124
- rendererConfig?: RendererInspectionConfig;
3125
- }
3126
-
3127
- interface SuspenseHydrationCallbacks<SuspenseInstance> {
3128
- onHydrated?: (suspenseInstance: SuspenseInstance) => void;
3129
- onDeleted?: (suspenseInstance: SuspenseInstance) => void;
3130
- }
3131
-
3132
- interface TransitionTracingCallbacks {
3133
- onTransitionStart?: (transitionName: string, startTime: number) => void;
3134
- onTransitionProgress?: (
3135
- transitionName: string,
3136
- startTime: number,
3137
- currentTime: number,
3138
- pending: Array<{ name: null | string }>,
3139
- ) => void;
3140
- onTransitionIncomplete?: (
3141
- transitionName: string,
3142
- startTime: number,
3143
- deletions: Array<{
3144
- type: string;
3145
- name?: string;
3146
- newName?: string;
3147
- endTime: number;
3148
- }>,
3149
- ) => void;
3150
- onTransitionComplete?: (transitionName: string, startTime: number, endTime: number) => void;
3151
- onMarkerProgress?: (
3152
- transitionName: string,
3153
- marker: string,
3154
- startTime: number,
3155
- currentTime: number,
3156
- pending: Array<{ name: null | string }>,
3157
- ) => void;
3158
- onMarkerIncomplete?: (
3159
- transitionName: string,
3160
- marker: string,
3161
- startTime: number,
3162
- deletions: Array<{
3163
- type: string;
3164
- name?: string;
3165
- newName?: string;
3166
- endTime: number;
3167
- }>,
3168
- ) => void;
3169
- onMarkerComplete?: (transitionName: string, marker: string, startTime: number, endTime: number) => void;
3170
- }
3171
-
3172
- interface ComponentSelector {
3173
- $$typeof: symbol | number;
3174
- value: React$AbstractComponent<never, unknown>;
3175
- }
3176
-
3177
- interface HasPseudoClassSelector {
3178
- $$typeof: symbol | number;
3179
- value: Selector[];
3180
- }
3181
-
3182
- interface RoleSelector {
3183
- $$typeof: symbol | number;
3184
- value: string;
3185
- }
3186
-
3187
- interface TextSelector {
3188
- $$typeof: symbol | number;
3189
- value: string;
3190
- }
3191
-
3192
- interface TestNameSelector {
3193
- $$typeof: symbol | number;
3194
- value: string;
3195
- }
3196
-
3197
- type Selector = ComponentSelector | HasPseudoClassSelector | RoleSelector | TextSelector | TestNameSelector;
3198
-
3199
- // TODO can not find React$AbstractComponent def
3200
- type React$AbstractComponent<Config, Instance = any> = any;
3201
-
3202
- interface BoundingRect {
3203
- x: number;
3204
- y: number;
3205
- width: number;
3206
- height: number;
3207
- }
3208
-
3209
- type IntersectionObserverOptions = any;
3210
-
3211
- interface BaseErrorInfo {
3212
- componentStack?: string;
3213
- }
3214
-
3215
- interface Reconciler<Container, Instance, TextInstance, SuspenseInstance, FormInstance, PublicInstance> {
3216
- createContainer(
3217
- containerInfo: Container,
3218
- tag: RootTag,
3219
- hydrationCallbacks: null | SuspenseHydrationCallbacks<SuspenseInstance>,
3220
- isStrictMode: boolean,
3221
- concurrentUpdatesByDefaultOverride: null | boolean,
3222
- identifierPrefix: string,
3223
- onUncaughtError: (error: Error, info: BaseErrorInfo & { errorBoundary?: Component }) => void,
3224
- onCaughtError: (error: Error, info: BaseErrorInfo) => void,
3225
- onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
3226
- onDefaultTransitionIndicator: () => void,
3227
- transitionCallbacks: null | TransitionTracingCallbacks,
3228
- ): OpaqueRoot;
3229
-
3230
- createPortal(
3231
- children: ReactNode,
3232
- containerInfo: any, // TODO: figure out the API for cross-renderer implementation.
3233
- implementation: any,
3234
- key?: string | null,
3235
- ): ReactPortal;
3236
-
3237
- registerMutableSourceForHydration(root: FiberRoot, mutableSource: MutableSource): void;
3238
-
3239
- createComponentSelector(component: React$AbstractComponent<never, unknown>): ComponentSelector;
3240
-
3241
- createHasPseudoClassSelector(selectors: Selector[]): HasPseudoClassSelector;
3242
-
3243
- createRoleSelector(role: string): RoleSelector;
3244
-
3245
- createTextSelector(text: string): TextSelector;
3246
-
3247
- createTestNameSelector(id: string): TestNameSelector;
3248
-
3249
- getFindAllNodesFailureDescription(hostRoot: Instance, selectors: Selector[]): string | null;
3250
-
3251
- findAllNodes(hostRoot: Instance, selectors: Selector[]): Instance[];
3252
-
3253
- findBoundingRects(hostRoot: Instance, selectors: Selector[]): BoundingRect[];
3254
-
3255
- focusWithin(hostRoot: Instance, selectors: Selector[]): boolean;
3256
-
3257
- observeVisibleRects(
3258
- hostRoot: Instance,
3259
- selectors: Selector[],
3260
- callback: (intersections: Array<{ ratio: number; rect: BoundingRect }>) => void,
3261
- options?: IntersectionObserverOptions,
3262
- ): { disconnect: () => void };
3263
-
3264
- createHydrationContainer(
3265
- initialChildren: ReactNode,
3266
- callback: (() => void) | null | undefined,
3267
- containerInfo: Container,
3268
- tag: RootTag,
3269
- hydrationCallbacks: null | SuspenseHydrationCallbacks<SuspenseInstance>,
3270
- isStrictMode: boolean,
3271
- concurrentUpdatesByDefaultOverride: null | boolean,
3272
- identifierPrefix: string,
3273
- onRecoverableError: (error: Error) => void,
3274
- transitionCallbacks: null | TransitionTracingCallbacks,
3275
- ): OpaqueRoot;
3276
-
3277
- updateContainer(
3278
- element: ReactNode,
3279
- container: OpaqueRoot,
3280
- parentComponent?: Component<any, any> | null,
3281
- callback?: (() => void) | null,
3282
- ): Lane;
3283
-
3284
- batchedUpdates<A, R>(fn: (a: A) => R, a: A): R;
3285
-
3286
- deferredUpdates<A>(fn: () => A): A;
3287
-
3288
- discreteUpdates<A, B, C, D, R>(fn: (arg0: A, arg1: B, arg2: C, arg3: D) => R, a: A, b: B, c: C, d: D): R;
3289
-
3290
- flushControlled(fn: () => any): void;
3291
-
3292
- flushSync(): void;
3293
- flushSync<R>(fn: () => R): R;
3294
-
3295
- isAlreadyRendering(): boolean;
3296
-
3297
- flushPassiveEffects(): boolean;
3298
-
3299
- getPublicRootInstance(container: OpaqueRoot): Component<any, any> | PublicInstance | null;
3300
-
3301
- attemptSynchronousHydration(fiber: Fiber): void;
3302
-
3303
- attemptDiscreteHydration(fiber: Fiber): void;
3304
-
3305
- attemptContinuousHydration(fiber: Fiber): void;
3306
-
3307
- attemptHydrationAtCurrentPriority(fiber: Fiber): void;
3308
-
3309
- getCurrentUpdatePriority(): LanePriority;
3310
-
3311
- runWithPriority<T>(priority: LanePriority, fn: () => T): T;
3312
-
3313
- findHostInstance(component: any): PublicInstance | null;
3314
-
3315
- findHostInstanceWithWarning(component: any, methodName: string): PublicInstance | null;
3316
-
3317
- findHostInstanceWithNoPortals(fiber: Fiber): PublicInstance | null;
3318
-
3319
- shouldError(fiber: Fiber): boolean | undefined;
3320
-
3321
- shouldSuspend(fiber: Fiber): boolean;
3322
-
3323
- injectIntoDevTools(devToolsConfig: DevToolsConfig<Instance, TextInstance, any>): boolean;
3324
- }
3325
- }
3326
-
3327
- declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
3328
- declare function extend<T extends Catalogue>(objects: T): void;
3329
- declare function extend(objects: Record<string, unknown>): void;
3330
- declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
3331
-
3332
- declare const isRenderer: (def: any) => boolean;
3333
- interface OffscreenCanvas extends EventTarget {
3334
- }
3335
- declare const _roots: Map<HTMLCanvasElement | OffscreenCanvas, Root>;
3336
- declare function createRoot<TCanvas extends HTMLCanvasElement | OffscreenCanvas>(canvas: TCanvas): ReconcilerRoot<TCanvas>;
3337
- declare function unmountComponentAtNode<TCanvas extends HTMLCanvasElement | OffscreenCanvas>(canvas: TCanvas, callback?: (canvas: TCanvas) => void): void;
3338
- declare function createPortal(children: ReactNode, container: Object3D | RefObject<Object3D | null> | RefObject<Object3D>, state?: InjectState): JSX.Element;
3339
- interface PortalProps {
3340
- children: ReactNode;
3341
- state?: InjectState;
3342
- container: Object3D | RefObject<Object3D | null> | RefObject<Object3D>;
3343
- }
3344
- declare function Portal({ children, container, state }: PortalProps): JSX.Element;
3345
- /**
3346
- * Force React to flush any updates inside the provided callback synchronously and immediately.
3347
- * All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
3348
- * Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
3349
- * having to revert to a non-React solution. Note: this will only flush updates within the `Canvas` root.
3350
- */
3351
- declare function flushSync<R>(fn: () => R): R;
3352
-
3353
- declare const context: React$1.Context<RootStore>;
3354
- declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
3355
-
3356
- /**
3357
- * An SSR-friendly useLayoutEffect.
3358
- *
3359
- * React currently throws a warning when using useLayoutEffect on the server.
3360
- * To get around it, we can conditionally useEffect on the server (no-op) and
3361
- * useLayoutEffect elsewhere.
3362
- *
3363
- * @see https://github.com/facebook/react/issues/14927
3364
- */
3365
- declare const useIsomorphicLayoutEffect: typeof React$1.useLayoutEffect;
3366
- /**
3367
- * Creates a stable ref that always contains the latest callback.
3368
- * Useful for avoiding dependency arrays while ensuring the latest closure is called.
3369
- *
3370
- * @param fn - The callback function to wrap
3371
- * @returns A ref containing the current callback
3372
- */
3373
- declare function useMutableCallback<T>(fn: T): React$1.RefObject<T>;
3374
- /**
3375
- * Bridges renderer Context and StrictMode from a primary renderer.
3376
- * Used to maintain React context when rendering into portals or secondary canvases.
3377
- *
3378
- * @returns A Bridge component that wraps children with the parent renderer's context
3379
- */
3380
- declare function useBridge(): Bridge;
3381
- /**
3382
- * Internal component that blocks rendering until a promise resolves.
3383
- * Used for suspense-like blocking behavior.
3384
- *
3385
- * @param set - Function to set the blocking promise
3386
- */
3387
- declare function Block({ set }: Omit<UnblockProps, 'children'>): null;
3388
- /**
3389
- * Error boundary component for catching and handling errors in the React tree.
3390
- * Forwards errors to a state setter for external handling.
3391
- *
3392
- * NOTE: static members get down-level transpiled to mutations which break tree-shaking
3393
- */
3394
- declare const ErrorBoundary: {
3395
- new (props: {
3396
- set: React$1.Dispatch<Error | undefined>;
3397
- children: React$1.ReactNode;
3398
- }): {
3399
- state: {
3400
- error: boolean;
3401
- };
3402
- componentDidCatch(err: Error): void;
3403
- render(): React$1.ReactNode;
3404
- context: unknown;
3405
- setState<K extends "error">(state: {
3406
- error: boolean;
3407
- } | ((prevState: Readonly<{
3408
- error: boolean;
3409
- }>, props: Readonly<{
3410
- set: React$1.Dispatch<Error | undefined>;
3411
- children: React$1.ReactNode;
3412
- }>) => {
3413
- error: boolean;
3414
- } | Pick<{
3415
- error: boolean;
3416
- }, K> | null) | Pick<{
3417
- error: boolean;
3418
- }, K> | null, callback?: (() => void) | undefined): void;
3419
- forceUpdate(callback?: (() => void) | undefined): void;
3420
- readonly props: Readonly<{
3421
- set: React$1.Dispatch<Error | undefined>;
3422
- children: React$1.ReactNode;
3423
- }>;
3424
- componentDidMount?(): void;
3425
- shouldComponentUpdate?(nextProps: Readonly<{
3426
- set: React$1.Dispatch<Error | undefined>;
3427
- children: React$1.ReactNode;
3428
- }>, nextState: Readonly<{
3429
- error: boolean;
3430
- }>, nextContext: any): boolean;
3431
- componentWillUnmount?(): void;
3432
- getSnapshotBeforeUpdate?(prevProps: Readonly<{
3433
- set: React$1.Dispatch<Error | undefined>;
3434
- children: React$1.ReactNode;
3435
- }>, prevState: Readonly<{
3436
- error: boolean;
3437
- }>): any;
3438
- componentDidUpdate?(prevProps: Readonly<{
3439
- set: React$1.Dispatch<Error | undefined>;
3440
- children: React$1.ReactNode;
3441
- }>, prevState: Readonly<{
3442
- error: boolean;
3443
- }>, snapshot?: any): void;
3444
- componentWillMount?(): void;
3445
- UNSAFE_componentWillMount?(): void;
3446
- componentWillReceiveProps?(nextProps: Readonly<{
3447
- set: React$1.Dispatch<Error | undefined>;
3448
- children: React$1.ReactNode;
3449
- }>, nextContext: any): void;
3450
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{
3451
- set: React$1.Dispatch<Error | undefined>;
3452
- children: React$1.ReactNode;
3453
- }>, nextContext: any): void;
3454
- componentWillUpdate?(nextProps: Readonly<{
3455
- set: React$1.Dispatch<Error | undefined>;
3456
- children: React$1.ReactNode;
3457
- }>, nextState: Readonly<{
3458
- error: boolean;
3459
- }>, nextContext: any): void;
3460
- UNSAFE_componentWillUpdate?(nextProps: Readonly<{
3461
- set: React$1.Dispatch<Error | undefined>;
3462
- children: React$1.ReactNode;
3463
- }>, nextState: Readonly<{
3464
- error: boolean;
3465
- }>, nextContext: any): void;
3466
- };
3467
- new (props: {
3468
- set: React$1.Dispatch<Error | undefined>;
3469
- children: React$1.ReactNode;
3470
- }, context: any): {
3471
- state: {
3472
- error: boolean;
3473
- };
3474
- componentDidCatch(err: Error): void;
3475
- render(): React$1.ReactNode;
3476
- context: unknown;
3477
- setState<K extends "error">(state: {
3478
- error: boolean;
3479
- } | ((prevState: Readonly<{
3480
- error: boolean;
3481
- }>, props: Readonly<{
3482
- set: React$1.Dispatch<Error | undefined>;
3483
- children: React$1.ReactNode;
3484
- }>) => {
3485
- error: boolean;
3486
- } | Pick<{
3487
- error: boolean;
3488
- }, K> | null) | Pick<{
3489
- error: boolean;
3490
- }, K> | null, callback?: (() => void) | undefined): void;
3491
- forceUpdate(callback?: (() => void) | undefined): void;
3492
- readonly props: Readonly<{
3493
- set: React$1.Dispatch<Error | undefined>;
3494
- children: React$1.ReactNode;
3495
- }>;
3496
- componentDidMount?(): void;
3497
- shouldComponentUpdate?(nextProps: Readonly<{
3498
- set: React$1.Dispatch<Error | undefined>;
3499
- children: React$1.ReactNode;
3500
- }>, nextState: Readonly<{
3501
- error: boolean;
3502
- }>, nextContext: any): boolean;
3503
- componentWillUnmount?(): void;
3504
- getSnapshotBeforeUpdate?(prevProps: Readonly<{
3505
- set: React$1.Dispatch<Error | undefined>;
3506
- children: React$1.ReactNode;
3507
- }>, prevState: Readonly<{
3508
- error: boolean;
3509
- }>): any;
3510
- componentDidUpdate?(prevProps: Readonly<{
3511
- set: React$1.Dispatch<Error | undefined>;
3512
- children: React$1.ReactNode;
3513
- }>, prevState: Readonly<{
3514
- error: boolean;
3515
- }>, snapshot?: any): void;
3516
- componentWillMount?(): void;
3517
- UNSAFE_componentWillMount?(): void;
3518
- componentWillReceiveProps?(nextProps: Readonly<{
3519
- set: React$1.Dispatch<Error | undefined>;
3520
- children: React$1.ReactNode;
3521
- }>, nextContext: any): void;
3522
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{
3523
- set: React$1.Dispatch<Error | undefined>;
3524
- children: React$1.ReactNode;
3525
- }>, nextContext: any): void;
3526
- componentWillUpdate?(nextProps: Readonly<{
3527
- set: React$1.Dispatch<Error | undefined>;
3528
- children: React$1.ReactNode;
3529
- }>, nextState: Readonly<{
3530
- error: boolean;
3531
- }>, nextContext: any): void;
3532
- UNSAFE_componentWillUpdate?(nextProps: Readonly<{
3533
- set: React$1.Dispatch<Error | undefined>;
3534
- children: React$1.ReactNode;
3535
- }>, nextState: Readonly<{
3536
- error: boolean;
3537
- }>, nextContext: any): void;
3538
- };
3539
- getDerivedStateFromError: () => {
3540
- error: boolean;
3541
- };
3542
- contextType?: React$1.Context<any> | undefined;
3543
- propTypes?: any;
3544
- };
3545
-
3546
- /**
3547
- * React internal props that should not be passed to Three.js objects.
3548
- */
3549
- declare const REACT_INTERNAL_PROPS: string[];
3550
- /**
3551
- * Returns the instance's initial (outermost) root.
3552
- * Traverses through previousRoot links to find the original root store.
3553
- *
3554
- * @param instance - R3F instance to find root for
3555
- * @returns The outermost root store
3556
- */
3557
- declare function findInitialRoot<T>(instance: Instance<T>): RootStore;
3558
- /**
3559
- * Returns instance root state.
3560
- * If the object doesn't have __r3f (e.g., child meshes in primitives/GLTFs),
3561
- * traverses ancestors to find the nearest managed parent.
3562
- *
3563
- * @param obj - Three.js object to get root state for
3564
- * @returns Root state if found, undefined otherwise
3565
- */
3566
- declare function getRootState<T extends Object3D = Object3D>(obj: T): RootState | undefined;
3567
- /**
3568
- * Collects nodes, materials, and meshes from a Three.js Object3D hierarchy.
3569
- * Handles duplicate material names by appending UUID prefixes.
3570
- *
3571
- * @param object - Root object to traverse
3572
- * @returns ObjectMap containing named nodes, materials, and meshes
3573
- *
3574
- * @example
3575
- * const { nodes, materials, meshes } = buildGraph(gltf.scene)
3576
- * // Access by name: nodes.Head, materials.Metal, meshes.Body
3577
- */
3578
- declare function buildGraph(object: Object3D): ObjectMap;
3579
- /**
3580
- * Disposes an object and all its disposable properties.
3581
- * Skips Scene objects as they should not be disposed automatically.
3582
- *
3583
- * @param obj - Object to dispose
3584
- */
3585
- declare function dispose<T extends Disposable>(obj: T): void;
3586
- /**
3587
- * Extracts instance props from React reconciler fiber props.
3588
- * Filters out React-internal props (children, key, ref).
3589
- *
3590
- * @param queue - Pending props from reconciler fiber
3591
- * @returns Props object without React-internal keys
3592
- */
3593
- declare function getInstanceProps<T = any>(pendingProps: Record<string, unknown>): Instance<T>['props'];
3594
- /**
3595
- * Creates or retrieves an R3F instance descriptor for a Three.js object.
3596
- * Each object in the scene carries a LocalState descriptor (__r3f).
3597
- *
3598
- * @param target - Target object to prepare
3599
- * @param root - Root store for this instance
3600
- * @param type - String identifier for the object type
3601
- * @param props - Initial props for the instance
3602
- * @returns Instance descriptor
3603
- */
3604
- declare function prepare<T = any>(target: T, root: RootStore, type: string, props: Instance<T>['props']): Instance<T>;
3605
- /**
3606
- * Triggers an update for an instance.
3607
- * Invalidates the frame if the root is in demand mode.
3608
- *
3609
- * @param instance - Instance to invalidate
3610
- */
3611
- declare function invalidateInstance(instance: Instance): void;
3612
-
3613
- /**
3614
- * Reserved prop names that should not be applied to Three.js objects.
3615
- */
3616
- declare const RESERVED_PROPS: string[];
3617
- /**
3618
- * Resolves a potentially pierced property key (e.g., 'material-color' → material.color).
3619
- * First tries the entire key as a single property, then attempts piercing.
3620
- *
3621
- * @param root - Root object to resolve from
3622
- * @param key - Property key (may contain dashes for piercing)
3623
- * @returns Object containing root, key, and target value
3624
- *
3625
- * @example
3626
- * resolve(mesh, 'material-color')
3627
- * // => { root: mesh.material, key: 'color', target: mesh.material.color }
3628
- */
3629
- declare function resolve(root: any, key: string): {
3630
- root: any;
3631
- key: string;
3632
- target: any;
3633
- };
3634
- /**
3635
- * Attaches a child instance to a parent instance.
3636
- * Handles both string-based attachment (e.g., 'geometry', 'material-map')
3637
- * and function-based attachment for custom logic.
3638
- *
3639
- * @param parent - Parent instance
3640
- * @param child - Child instance to attach
3641
- *
3642
- * @example
3643
- * // String attachment
3644
- * <bufferGeometry attach="geometry" />
3645
- * // Array attachment
3646
- * <light attach="lights-0" />
3647
- * // Function attachment
3648
- * <thing attach={(parent, self) => { parent.customProp = self }} />
3649
- */
3650
- declare function attach(parent: Instance, child: Instance): void;
3651
- /**
3652
- * Detaches a child instance from a parent instance.
3653
- * Restores the previous value or deletes the property if it was never set.
3654
- *
3655
- * @param parent - Parent instance
3656
- * @param child - Child instance to detach
3657
- */
3658
- declare function detach(parent: Instance, child: Instance): void;
3659
- /**
3660
- * Compares old and new props to determine which properties have changed.
3661
- * Also handles resetting removed props for HMR/fast-refresh.
3662
- *
3663
- * @param instance - Instance to diff props for
3664
- * @param newProps - New props to compare against
3665
- * @returns Object containing only changed props
3666
- *
3667
- * @example
3668
- * const changes = diffProps(instance, { position: [1, 2, 3], color: 'red' })
3669
- * // => { position: [1, 2, 3] } (only if position changed)
3670
- */
3671
- declare function diffProps<T = any>(instance: Instance<T>, newProps: Instance<T>['props']): Instance<T>['props'];
3672
- /**
3673
- * Applies a set of props to a Three.js object.
3674
- * Handles special cases like colors, vectors, textures, events, and pierced props.
3675
- *
3676
- * @param object - Three.js object to apply props to
3677
- * @param props - Props to apply
3678
- * @returns The object with props applied
3679
- *
3680
- * @example
3681
- * applyProps(mesh, { position: [0, 1, 0], 'material-color': 'red' })
3682
- */
3683
- declare function applyProps<T = any>(object: Instance<T>['object'], props: Instance<T>['props']): Instance<T>['object'];
3684
-
3685
- /**
3686
- * Calculates the device pixel ratio for rendering.
3687
- * Handles array DPR ranges [min, max] to clamp devicePixelRatio.
3688
- *
3689
- * @param dpr - Target DPR value or [min, max] range
3690
- * @returns Calculated DPR value
3691
- *
3692
- * @example
3693
- * calculateDpr(2) // => 2
3694
- * calculateDpr([1, 2]) // => clamps window.devicePixelRatio between 1 and 2
3695
- */
3696
- declare function calculateDpr(dpr: Dpr): number;
3697
- /**
3698
- * Extracts the first segment of a UUID string (before the first hyphen).
3699
- * Used for creating unique material names when duplicates exist.
3700
- *
3701
- * @param uuid - UUID string to extract prefix from
3702
- * @returns First segment of the UUID
3703
- *
3704
- * @example
3705
- * getUuidPrefix('a1b2c3d4-e5f6-g7h8-i9j0') // => 'a1b2c3d4'
3706
- */
3707
- declare function getUuidPrefix(uuid: string): string;
3708
- /**
3709
- * Updates camera projection based on viewport size.
3710
- * Adjusts aspect ratio for perspective cameras or bounds for orthographic cameras.
3711
- * Respects camera.manual flag - manual cameras are not modified.
3712
- *
3713
- * @param camera - Camera to update
3714
- * @param size - Current viewport size
3715
- */
3716
- declare function updateCamera(camera: ThreeCamera, size: Size): void;
3717
- /**
3718
- * Updates a frustum from a camera's projection and world matrices.
3719
- * If no target frustum is provided, creates and returns a new one.
3720
- *
3721
- * @param camera - Camera to extract frustum from
3722
- * @param frustum - Optional existing frustum to update (creates new if not provided)
3723
- * @returns The updated or newly created frustum
3724
- *
3725
- * @example
3726
- * // Create new frustum
3727
- * const frustum = updateFrustum(camera)
3728
- *
3729
- * // Update existing frustum (no allocation)
3730
- * updateFrustum(camera, existingFrustum)
3731
- *
3732
- * // Use for visibility checks
3733
- * if (frustum.containsPoint(point)) { ... }
3734
- * if (frustum.intersectsObject(mesh)) { ... }
3735
- */
3736
- declare function updateFrustum(camera: ThreeCamera, frustum?: Frustum): Frustum;
3737
-
3738
- declare const is: {
3739
- obj: (a: any) => boolean;
3740
- fun: (a: any) => a is Function;
3741
- str: (a: any) => a is string;
3742
- num: (a: any) => a is number;
3743
- boo: (a: any) => a is boolean;
3744
- und: (a: any) => boolean;
3745
- nul: (a: any) => boolean;
3746
- arr: (a: any) => a is any[];
3747
- equ(a: any, b: any, { arrays, objects, strict }?: EquConfig): boolean;
3748
- };
3749
- declare const isOrthographicCamera: (def: ThreeCamera) => def is OrthographicCamera;
3750
- declare const isRef: (obj: unknown) => obj is React.RefObject<unknown>;
3751
- declare const isColorRepresentation: (value: unknown) => value is ColorRepresentation;
3752
- declare const isObject3D: (object: any) => object is Object3D;
3753
- declare const isTexture: (value: unknown) => value is Texture$1;
3754
- type VectorLike = {
3755
- set: (...args: any[]) => void;
3756
- constructor?: Function;
3757
- };
3758
- declare const isVectorLike: (object: unknown) => object is VectorLike;
3759
- type Copyable = {
3760
- copy: (...args: any[]) => void;
3761
- constructor?: Function;
3762
- };
3763
- declare const isCopyable: (object: unknown) => object is Copyable;
3764
- declare const hasConstructor: (object: unknown) => object is {
3765
- constructor?: Function;
3766
- };
3767
-
3768
- /**
3769
- * Symbol marker for deferred ref resolution.
3770
- * Used to identify values that should be resolved from refs after mount.
3771
- */
3772
- declare const FROM_REF: unique symbol;
3773
- /** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
3774
- interface FromRefMarker<T = unknown, R = T> {
3775
- [FROM_REF]: React$1.RefObject<T | null>;
3776
- /** Optional transform applied to the resolved ref before assignment. */
3777
- transform?: (value: T) => R;
3778
- }
3779
- /**
3780
- * Defers prop application until the referenced object is available.
3781
- * Useful for props like `target` that need sibling refs to be populated.
3782
- *
3783
- * Only top-level props on a three element are resolved: a marker nested inside another value
3784
- * (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
3785
- * than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
3786
- * what gets assigned.
3787
- *
3788
- * @param ref - React ref object to resolve at mount time
3789
- * @param transform - Optional mapping from the resolved object to the value the prop expects
3790
- * @returns A marker value that the reconciler resolves after mount
3791
- *
3792
- * @example
3793
- * const targetRef = useRef<THREE.Object3D>(null)
3794
- *
3795
- * <group ref={targetRef} position={[-3, -2, -15]} />
3796
- * <spotLight target={fromRef(targetRef)} intensity={100} />
3797
- *
3798
- * @example
3799
- * // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
3800
- * <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
3801
- */
3802
- declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
3803
- declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
3804
- /**
3805
- * Type guard to check if a value is a fromRef marker.
3806
- *
3807
- * @param value - Value to check
3808
- * @returns True if value is a fromRef marker
3809
- */
3810
- declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
3811
-
3812
- /**
3813
- * Symbol marker for mount-only method calls.
3814
- * Used to identify methods that should only be called once on initial mount.
3815
- */
3816
- declare const ONCE: unique symbol;
3817
- /**
3818
- * Marks a method call to be executed only on initial mount.
3819
- * Useful for geometry transforms that should not be reapplied on every render.
3820
- *
3821
- * When `args` prop changes (triggering reconstruction), the method will be
3822
- * called again on the new instance since appliedOnce is not carried over.
3823
- *
3824
- * @param args - Arguments to pass to the method
3825
- * @returns A marker value that applyProps will execute once
3826
- *
3827
- * @example
3828
- * // Rotate geometry on mount
3829
- * <boxGeometry args={[1, 1, 1]} rotateX={once(Math.PI / 2)} />
3830
- *
3831
- * // Multiple arguments
3832
- * <bufferGeometry applyMatrix4={once(matrix)} />
3833
- *
3834
- * // No arguments
3835
- * <geometry center={once()} />
3836
- */
3837
- declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
3838
- /**
3839
- * What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
3840
- * the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
3841
- * methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
3842
- *
3843
- * The runtime value is always the marker object; only the declared type follows the prop.
3844
- */
3845
- type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
3846
- /**
3847
- * Type guard to check if a value is a once marker.
3848
- *
3849
- * @param value - Value to check
3850
- * @returns True if value is a once marker
3851
- */
3852
- declare function isOnce(value: unknown): value is {
3853
- [ONCE]: any[] | true;
3854
- };
3855
-
3856
- /**
3857
- * A DOM canvas which accepts threejs elements as children.
3858
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
3859
- */
3860
- declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
3861
127
 
3862
- export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber, Texture, _roots, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, context, createEvents, createPointerEvents, createPortal, createRoot, createStore, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, fromRef, getInstanceProps, getPrimary, getPrimaryIds, getRootState, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, reconciler, registerPrimary, removeInteractivity, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useEnvironment, useFrame, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useMutableCallback, useRenderTarget, useStore, useTexture, useTextures, useThree, waitForPrimary };
3863
- export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferLike, BufferRecord, BufferStore, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, DefaultGLProps, DefaultRendererProps, Disposable, DisposeOptions, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, FromRefMarker, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, LegacyInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeLike, NodeProps, NodeRecord, NodeStore, NonFunctionKeys, Object3DMethod, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, OnceValue, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, LegacyRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, LegacyRootState as RootState, RootStore, SetBlock, Size, StorageLike, StorageRecord, StorageStore, Subscription, TSLNodeInput, TextureInput, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, XRManager, XRPointerConfig };
128
+ export { Canvas, Color$1 as Color, ConstructorRepresentation, ElementOf$1 as ElementOf, ElementProps$1 as ElementProps, Euler$1 as Euler, EventProps$1 as EventProps, GeometryProps$1 as GeometryProps, GeometryTransformProps$1 as GeometryTransformProps, Layers$1 as Layers, LegacyRootState, MathProps$1 as MathProps, MathRepresentation$1 as MathRepresentation, MathType$1 as MathType, MathTypes$1 as MathTypes, Matrix3$1 as Matrix3, Matrix4$1 as Matrix4, MutableOrReadonlyParameters$1 as MutableOrReadonlyParameters, NodeProps$1 as NodeProps, Object3DMethod$1 as Object3DMethod, Quaternion$1 as Quaternion, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, RaycastableRepresentation$1 as RaycastableRepresentation, ReactProps$1 as ReactProps, legacy_d as ReactThreeFiber, ReconcilerRoot, RenderTargetOptions, LegacyRootState as RootState, TSLNodeInput$1 as TSLNodeInput, ThreeElement$1 as ThreeElement, ThreeElementsOf$1 as ThreeElementsOf, ThreeToJSXElements$1 as ThreeToJSXElements, Vector2$1 as Vector2, Vector3$1 as Vector3, Vector4$1 as Vector4, VectorRepresentation$1 as VectorRepresentation, createRoot, useFrame, useRenderTarget, useThree };
129
+ export type { LegacyCanvasProps as CanvasProps, LegacyCanvasProps, ThreeElements, ThreeExports, UseFrameLegacy, UseThreeLegacy };