@react-three/fiber 10.0.0-canary.dc0ec15 → 10.0.0-canary.e53bd54

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.
@@ -1,1573 +1,13 @@
1
- import * as React$1 from 'react';
2
- import { ReactNode } from 'react';
3
- import * as THREE$1 from 'three';
4
- import { WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Euler as Euler$2, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
5
- import * as three_webgpu from 'three/webgpu';
6
- import { WebGPURenderer, Node, StorageTexture, Storage3DTexture, StorageArrayTexture, Data3DTexture, CanvasTarget, CubeRenderTarget, RenderTarget, Euler as Euler$1, Color as Color$1, ColorRepresentation, 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 } from 'three/webgpu';
7
- import { StoreApi } from 'zustand';
8
- import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
9
- import { FrameCallback as FrameCallback$1, FrameTimingState, SchedulerApi, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
1
+ import { z as FrameNextCallback } from './shared/fiber.Bw8YnGg5.js';
2
+ export { A as Act, B as Bridge, C as Camera, i as ComputeFunction, w as Disposable, f as DomEvent, D as Dpr, v as EquConfig, g as EventHandlers, k as EventManager, E as Events, h as FilterFunction, G as FrameCallback, x as FrameNextState, y as FrameState, F as Frameloop, a5 as InternalState, I as Intersection, e as IntersectionEvent, p as IsAllOptional, o as IsOptional, M as Mutable, N as NonFunctionKeys, u as ObjectMap, O as Overwrite, c as Performance, l as PointerCaptureTarget, P as PointerState, n as Properties, a4 as R3FRenderer, b as RenderCallback, R as RootExtension, a6 as RootState, d as RootStore, t as SetBlock, a as Size, S as Subscription, q as ThreeCamera, T as ThreeEvent, U as UnblockProps, V as Viewport, m as VisibilityEntry, X as XRManager, j as XRPointerConfig, a3 as context, r as registerRootExtension, s as setRenderOverride, a2 as useStore, a7 as useThree } from './shared/fiber.Bw8YnGg5.js';
3
+ import { UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
10
4
  export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, SchedulerApi, UseFrameNextOptions, UseFrameOptions } from '@pmndrs/scheduler';
11
- import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
12
- import { WebGLRendererParameters } from 'three/src/renderers/WebGLRenderer.js';
13
- import { Inspector } from 'three/addons/inspector/Inspector.js';
14
- import { Options } from 'react-use-measure';
15
-
16
-
17
- //* Utility Types ==============================
18
-
19
- type NonFunctionKeys<P> = { [K in keyof P]-?: P[K] extends Function ? never : K }[keyof P]
20
- type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O
21
- type Properties<T> = Pick<T, NonFunctionKeys<T>>
22
- type Mutable<P> = { -readonly [K in keyof P]: P[K] }
23
- type IsOptional<T> = undefined extends T ? true : false
24
- type IsAllOptional<T extends any[]> = T extends [infer First, ...infer Rest]
25
- ? IsOptional<First> extends true
26
- ? IsAllOptional<Rest>
27
- : false
28
- : true
29
-
30
- //* Camera Types ==============================
31
-
32
- type ThreeCamera = (THREE$1.OrthographicCamera | THREE$1.PerspectiveCamera) & { manual?: boolean }
33
-
34
- //* Act Type ==============================
35
-
36
- type Act = <T = any>(cb: () => Promise<T>) => Promise<T>
37
-
38
- //* Bridge & Block Types ==============================
39
-
40
- type Bridge = React$1.FC<{ children?: React$1.ReactNode }>
41
-
42
- type SetBlock = false | Promise<null> | null
43
- type UnblockProps = { set: React$1.Dispatch<React$1.SetStateAction<SetBlock>>; children: React$1.ReactNode }
44
-
45
- //* Object Map Type ==============================
46
-
47
- /* Original version
48
- export interface ObjectMap {
49
- nodes: { [name: string]: THREE.Object3D }
50
- materials: { [name: string]: THREE.Material }
51
- meshes: { [name: string]: THREE.Mesh }
52
- }
53
- */
54
- /* This version is an expansion found in a PR by itsdouges that seems abandoned but looks useful.
55
- It allows expansion but falls back to the original shape. (deleted due to stale, but If it doesnt conflict
56
- I will keep the use here)
57
- https://github.com/pmndrs/react-three-fiber/commits/generic-object-map/
58
- His description is:
59
- The object map type is now generic and can optionally declare the available properties for nodes, materials, and meshes.
60
- */
61
- interface ObjectMap<
62
- T extends { nodes?: string; materials?: string; meshes?: string } = {
63
- nodes: string
64
- materials: string
65
- meshes: string
66
- },
67
- > {
68
- nodes: Record<T['nodes'] extends string ? T['nodes'] : string, THREE$1.Object3D>
69
- materials: Record<T['materials'] extends string ? T['materials'] : string, THREE$1.Material>
70
- meshes: Record<T['meshes'] extends string ? T['meshes'] : string, THREE$1.Mesh>
71
- }
72
-
73
- //* Equality Config ==============================
74
-
75
- interface EquConfig {
76
- /** Compare arrays by reference equality a === b (default), or by shallow equality */
77
- arrays?: 'reference' | 'shallow'
78
- /** Compare objects by reference equality a === b (default), or by shallow equality */
79
- objects?: 'reference' | 'shallow'
80
- /** If true the keys in both a and b must match 1:1 (default), if false a's keys must intersect b's */
81
- strict?: boolean
82
- }
83
-
84
- //* Disposable Type ==============================
85
-
86
- interface Disposable {
87
- type?: string
88
- dispose?: () => void
89
- }
90
-
91
- //* Event-related Types =====================================
92
-
93
- interface Intersection extends THREE$1.Intersection {
94
- /** The event source (the object which registered the handler) */
95
- eventObject: THREE$1.Object3D
96
- }
97
-
98
- type Camera = THREE$1.OrthographicCamera | THREE$1.PerspectiveCamera
99
-
100
- interface IntersectionEvent<TSourceEvent> extends Intersection {
101
- /** The event source (the object which registered the handler) */
102
- eventObject: THREE$1.Object3D
103
- /** An array of intersections */
104
- intersections: Intersection[]
105
- /** vec3.set(pointer.x, pointer.y, 0).unproject(camera) */
106
- unprojectedPoint: THREE$1.Vector3
107
- /** Normalized event coordinates */
108
- pointer: THREE$1.Vector2
109
- /** pointerId of the original event for multiple pointer events */
110
- pointerId: number
111
- /** Delta between first click and this event */
112
- delta: number
113
- /** The ray that pierced it */
114
- ray: THREE$1.Ray
115
- /** The camera that was used by the raycaster */
116
- camera: Camera
117
- /** stopPropagation will stop underlying handlers from firing */
118
- stopPropagation: () => void
119
- /** The original host event */
120
- nativeEvent: TSourceEvent
121
- /** If the event was stopped by calling stopPropagation */
122
- stopped: boolean
123
- }
124
-
125
- type ThreeEvent<TEvent> = IntersectionEvent<TEvent> & Properties<TEvent>
126
- type DomEvent = PointerEvent | MouseEvent | WheelEvent
127
-
128
- /** DOM event handlers registered on the canvas element */
129
- interface Events {
130
- onClick: EventListener
131
- onContextMenu: EventListener
132
- onDoubleClick: EventListener
133
- onWheel: EventListener
134
- onPointerDown: EventListener
135
- onPointerUp: EventListener
136
- onPointerLeave: EventListener
137
- onPointerMove: EventListener
138
- onPointerCancel: EventListener
139
- onLostPointerCapture: EventListener
140
- onDragEnter: EventListener
141
- onDragLeave: EventListener
142
- onDragOver: EventListener
143
- onDrop: EventListener
144
- }
145
-
146
- /** Event handlers that can be attached to R3F objects (meshes, groups, etc.) */
147
- interface EventHandlers {
148
- onClick?: (event: ThreeEvent<MouseEvent>) => void
149
- onContextMenu?: (event: ThreeEvent<MouseEvent>) => void
150
- onDoubleClick?: (event: ThreeEvent<MouseEvent>) => void
151
- /** Fires continuously while dragging over the object */
152
- onDragOver?: (event: ThreeEvent<DragEvent>) => void
153
- /** Fires once when drag enters the object */
154
- onDragOverEnter?: (event: ThreeEvent<DragEvent>) => void
155
- /** Fires once when drag leaves the object */
156
- onDragOverLeave?: (event: ThreeEvent<DragEvent>) => void
157
- /** Fires when drag misses this object (for objects that have drag handlers) */
158
- onDragOverMissed?: (event: DragEvent) => void
159
- /** Fires when a drop occurs on this object */
160
- onDrop?: (event: ThreeEvent<DragEvent>) => void
161
- /** Fires when a drop misses this object (for objects that have drop handlers) */
162
- onDropMissed?: (event: DragEvent) => void
163
- onPointerUp?: (event: ThreeEvent<PointerEvent>) => void
164
- onPointerDown?: (event: ThreeEvent<PointerEvent>) => void
165
- onPointerOver?: (event: ThreeEvent<PointerEvent>) => void
166
- onPointerOut?: (event: ThreeEvent<PointerEvent>) => void
167
- onPointerEnter?: (event: ThreeEvent<PointerEvent>) => void
168
- onPointerLeave?: (event: ThreeEvent<PointerEvent>) => void
169
- onPointerMove?: (event: ThreeEvent<PointerEvent>) => void
170
- onPointerMissed?: (event: MouseEvent) => void
171
- onPointerCancel?: (event: ThreeEvent<PointerEvent>) => void
172
- onWheel?: (event: ThreeEvent<WheelEvent>) => void
173
- onLostPointerCapture?: (event: ThreeEvent<PointerEvent>) => void
174
-
175
- //* Visibility Events --------------------------------
176
- /** Fires when object enters/exits camera frustum. Receives true when in view, false when out. */
177
- onFramed?: (inView: boolean) => void
178
- /** Fires when object occlusion state changes (WebGPU only, requires occlusionTest=true on object) */
179
- onOccluded?: (occluded: boolean) => void
180
- /** Fires when combined visibility changes (frustum + occlusion + visible prop) */
181
- onVisible?: (visible: boolean) => void
182
- }
183
-
184
- type FilterFunction = (items: THREE$1.Intersection[], state: RootState) => THREE$1.Intersection[]
185
- type ComputeFunction = (event: DomEvent, root: RootState, previous?: RootState) => void
186
-
187
- /** Configuration for XR pointer registration (controllers/hands) */
188
- interface XRPointerConfig {
189
- /** Ray origin (updated each frame by XR system) */
190
- ray: THREE$1.Ray
191
- /** Optional: custom compute function for this pointer */
192
- compute?: (state: RootState) => void
193
- /** Pointer type identifier */
194
- type: 'controller' | 'hand' | 'gaze'
195
- /** Which hand (for controller/hand types) */
196
- handedness?: 'left' | 'right'
197
- }
198
-
199
- interface EventManager<TTarget> {
200
- /** Determines if the event layer is active */
201
- enabled: boolean
202
- /** Event layer priority, higher prioritized layers come first and may stop(-propagate) lower layer */
203
- priority: number
204
- /** The compute function needs to set up the raycaster and an xy- pointer */
205
- compute?: ComputeFunction
206
- /** The filter can re-order or re-structure the intersections */
207
- filter?: FilterFunction
208
- /** The target node the event layer is tied to */
209
- connected?: TTarget
210
- /** All the pointer event handlers through which the host forwards native events */
211
- handlers?: Events
212
- /** Allows re-connecting to another target */
213
- connect?: (target: TTarget) => void
214
- /** Removes all existing events handlers from the target */
215
- disconnect?: () => void
216
- /** Triggers a onPointerMove with the last known event. This can be useful to enable raycasting without
217
- * explicit user interaction, for instance when the camera moves a hoverable object underneath the cursor.
218
- * @param pointerId - Optional pointer ID to update specific pointer only
219
- */
220
- update?: (pointerId?: number) => void
221
- /** Defer pointer move raycasting to frame start (default: true) */
222
- frameTimedRaycasts?: boolean
223
- /** Always fire raycaster immediately on scroll events (default: true) */
224
- alwaysFireOnScroll?: boolean
225
- /** Automatically re-raycast every frame to detect hover changes from moving objects/camera (default: false) */
226
- updateOnFrame?: boolean
227
- /** Flush deferred pointer raycasts. Called by scheduler at frame start (input phase). */
228
- flush?: () => void
229
- /** Register an XR pointer (controller/hand). Returns assigned pointerId */
230
- registerPointer?: (config: XRPointerConfig) => number
231
- /** Unregister an XR pointer */
232
- unregisterPointer?: (pointerId: number) => void
233
- }
234
-
235
- interface PointerCaptureTarget {
236
- intersection: Intersection
237
- target: Element
238
- }
239
-
240
- //* Visibility System Types =====================================
241
-
242
- /** Entry in the visibility registry for tracking object visibility state */
243
- interface VisibilityEntry {
244
- object: THREE$1.Object3D
245
- handlers: Pick<EventHandlers, 'onFramed' | 'onOccluded' | 'onVisible'>
246
- lastFramedState: boolean | null
247
- lastOccludedState: boolean | null
248
- lastVisibleState: boolean | null
249
- }
250
-
251
- //* Scheduler Types (useFrame) ==============================
252
- //
253
- // The generic, framework-agnostic scheduler types now live in @pmndrs/scheduler.
254
- // This file re-exports them and layers r3f's RootState-aware frame state on top,
255
- // so existing `#types` imports across the codebase keep resolving unchanged.
256
-
257
-
258
-
259
- // Frame State (r3f-specific) --------------------------------
260
-
261
- /**
262
- * State passed to useFrame callbacks (extends RootState with timing).
263
- */
264
- interface FrameNextState extends RootState, FrameTimingState {}
265
-
266
- /** Alias for FrameNextState */
267
- type FrameState = FrameNextState
268
-
269
- // Callback Types (r3f-specific) --------------------------------
270
-
271
- /**
272
- * Callback function for useFrame. Receives the full r3f RootState plus timing.
273
- */
274
- type FrameNextCallback = FrameCallback$1<RootState>
275
-
276
- /** Alias for FrameNextCallback */
277
- type FrameCallback = FrameNextCallback
278
-
279
- //* Buffer Types (useBuffers) ========================================
280
-
281
- /**
282
- * Buffer-like types for GPU compute and storage operations.
283
- * Includes raw CPU arrays, Three.js buffer attributes, and TSL buffer nodes.
284
- *
285
- * @example
286
- * ```tsx
287
- * const { positions, velocities } = useBuffers(() => ({
288
- * positions: instancedArray(count, 'vec3'), // StorageBufferNode
289
- * velocities: new Float32Array(count * 3), // TypedArray
290
- * }), 'particles')
291
- * ```
292
- */
293
- type BufferLike =
294
- | Float32Array
295
- | Uint32Array
296
- | Int32Array
297
- | Float64Array
298
- | Uint8Array
299
- | Int8Array
300
- | Uint16Array
301
- | Int16Array
302
- | THREE$1.BufferAttribute // Base class for all buffer attributes
303
- | THREE$1.InterleavedBufferAttribute
304
- | Node // TSL buffer nodes (instancedArray, storage)
305
-
306
- /** Flat record of buffer-like values (no nested scopes) */
307
- type BufferRecord = Record<string, BufferLike>
308
-
309
- /**
310
- * Buffer store that can contain both root-level buffers and scoped buffer objects.
311
- * Structure: { positions: Float32Array, particles: { vel: StorageBufferNode } }
312
- */
313
- type BufferStore = Record<string, BufferLike | BufferRecord>
314
-
315
- //* Node Types (useNodes) ========================================
316
-
317
- /**
318
- * Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
319
- * the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
320
- * code passes through. Creators are constrained to this same type, so the shape a creator returns
321
- * and the shape the store holds are one type by construction.
322
- */
323
- type NodeLike = TSLNodeType | LegacyTSLNodeLike
324
-
325
- /** Flat record of TSL nodes (no nested scopes) */
326
- type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
327
-
328
- /**
329
- * Node store that can contain both root-level nodes and scoped node objects.
330
- * Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
331
- */
332
- type NodeStore = Record<string, NodeLike | NodeRecord>
333
-
334
- //* Storage Types (useGPUStorage) ========================================
335
-
336
- /**
337
- * GPU storage types for texture-based storage operations.
338
- * Includes Three.js storage textures and TSL storage texture nodes.
339
- *
340
- * @example
341
- * ```tsx
342
- * const { heightMap } = useGPUStorage(() => ({
343
- * heightMap: new StorageTexture(512, 512),
344
- * }), 'terrain')
345
- * ```
346
- */
347
- type StorageLike =
348
- | StorageTexture // 2D GPU storage texture
349
- | Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
350
- | StorageArrayTexture // 2D-array GPU storage texture
351
- | Data3DTexture // 3D texture (can be used as storage)
352
- | Node // TSL storage texture nodes (storageTexture)
353
-
354
- /** Flat record of storage-like values (no nested scopes) */
355
- type StorageRecord = Record<string, StorageLike>
356
-
357
- /**
358
- * Storage store that can contain both root-level storage and scoped storage objects.
359
- * Structure: { heightMap: StorageTexture, terrain: { normal: StorageTextureNode } }
360
- */
361
- type StorageStore = Record<string, StorageLike | StorageRecord>
362
-
363
- //* Renderer Types ========================================
364
-
365
- /** Default renderer type - union of WebGL and WebGPU renderers */
366
- type R3FRenderer = THREE$1.WebGLRenderer | WebGPURenderer
367
-
368
- //* Core Store Types ========================================
369
-
370
- type Subscription = {
371
- ref: React$1.RefObject<RenderCallback>
372
- priority: number
373
- store: RootStore
374
- }
375
-
376
- /** Per-pointer state for multi-touch and XR support */
377
- type PointerState = {
378
- /** Objects currently hovered by this pointer */
379
- hovered: Map<string, ThreeEvent<DomEvent>>
380
- /** Objects capturing this pointer */
381
- captured: Map<THREE$1.Object3D, PointerCaptureTarget>
382
- /** Initial click position [x, y] */
383
- initialClick: [x: number, y: number]
384
- /** Objects hit on initial click */
385
- initialHits: THREE$1.Object3D[]
386
- }
387
-
388
- type Dpr = number | [min: number, max: number]
389
-
390
- interface Size {
391
- width: number
392
- height: number
393
- top: number
394
- left: number
395
- }
396
-
397
- type Frameloop = 'always' | 'demand' | 'never'
398
-
399
- interface Viewport extends Size {
400
- /** The initial pixel ratio */
401
- initialDpr: number
402
- /** Current pixel ratio */
403
- dpr: number
404
- /** size.width / viewport.width */
405
- factor: number
406
- /** Camera distance */
407
- distance: number
408
- /** Camera aspect ratio: width / height */
409
- aspect: number
410
- }
411
-
412
- type RenderCallback = (state: RootState, delta: number, frame?: XRFrame) => void
413
-
414
- interface Performance {
415
- /** Current performance normal, between min and max */
416
- current: number
417
- /** How low the performance can go, between 0 and max */
418
- min: number
419
- /** How high the performance can go, between min and max */
420
- max: number
421
- /** Time until current returns to max in ms */
422
- debounce: number
423
- /** Sets current to min, puts the system in regression */
424
- regress: () => void
425
- }
426
-
427
- interface InternalState {
428
- interaction: THREE$1.Object3D[]
429
- subscribers: Subscription[]
430
- /** Per-pointer state (hover, capture, click tracking) - replaces hovered, capturedMap, initialClick, initialHits */
431
- pointerMap: Map<number, PointerState>
432
- /** Pointers needing raycast this frame (used with frameTimedRaycasts) */
433
- pointerDirty: Map<number, DomEvent>
434
- /** Last event received (for events.update() compatibility) */
435
- lastEvent: React$1.RefObject<DomEvent | null>
436
- /** @deprecated Use pointerMap.get(pointerId).hovered instead */
437
- hovered: Map<string, ThreeEvent<DomEvent>>
438
- /** @deprecated Use pointerMap.get(pointerId).captured instead */
439
- capturedMap: Map<number, Map<THREE$1.Object3D, PointerCaptureTarget>>
440
- /** @deprecated Use pointerMap.get(pointerId).initialClick instead */
441
- initialClick: [x: number, y: number]
442
- /** @deprecated Use pointerMap.get(pointerId).initialHits instead */
443
- initialHits: THREE$1.Object3D[]
444
- /** Visibility event registry (onFramed, onOccluded, onVisible) */
445
- visibilityRegistry: Map<string, VisibilityEntry>
446
- /** Whether occlusion queries are enabled (WebGPU only) */
447
- occlusionEnabled: boolean
448
- /** Reference to the invisible occlusion observer mesh */
449
- occlusionObserver: THREE$1.Mesh | null
450
- /** Cached occlusion results from render pass - keyed by Object3D */
451
- occlusionCache: Map<THREE$1.Object3D, boolean | null>
452
- /** Internal helper group for R3F system objects (occlusion observer, etc.) */
453
- helperGroup: THREE$1.Group | null
454
- active: boolean
455
- priority: number
456
- frames: number
457
- subscribe: (callback: React$1.RefObject<RenderCallback>, priority: number, store: RootStore) => () => void
458
- /** Internal renderer storage - use state.renderer or state.gl to access */
459
- actualRenderer: R3FRenderer
460
- /** Global scheduler reference (for useFrame hook) */
461
- scheduler: SchedulerApi | null
462
- /**
463
- * Replaces `renderer.render(scene, camera)` in the default render job when set. Set it with
464
- * `setRenderOverride(store, fn)`; the job keeps its fps throttle, error handling and user
465
- * render-phase takeover. Used by `useRenderPipeline`.
466
- */
467
- renderOverride?: (() => void) | null
468
- /** This root's unique ID in the global scheduler */
469
- rootId?: string
470
- /** Function to unregister this root from the global scheduler */
471
- unregisterRoot?: () => void
472
- /** Container for child attachment (scene for root, original container for portals) */
473
- container?: THREE$1.Object3D
474
- /**
475
- * The CanvasTarget this root sizes and renders through.
476
- *
477
- * A primary (`<Canvas id>`) owns the renderer's default target -- the one three itself built
478
- * around the canvas element -- so sizing it is sizing the renderer. A secondary owns a target
479
- * R3F created for its own element. Either way there is exactly one target per canvas element,
480
- * and the canvas-target job makes it the renderer's active one before this root renders.
481
- * Absent on WebGL and on an id-less WebGPU canvas, where the renderer is sized directly.
482
- * @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
483
- */
484
- canvasTarget?: CanvasTarget
485
- /**
486
- * Set when this root's canvas target has been resized and the backend's cached render pass
487
- * descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
488
- *
489
- * Flushed by the canvas-target job in the `start` phase, which is the only place this root's
490
- * target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
491
- * whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
492
- * invalidate some other canvas's descriptor instead.
493
- *
494
- * @see https://github.com/pmndrs/react-three-fiber/issues/3847
495
- */
496
- canvasTargetSizeDirty?: boolean
497
- /**
498
- * Whether multi-canvas rendering is active.
499
- * True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
500
- * When true, setCanvasTarget is called before each render.
501
- */
502
- isMultiCanvas?: boolean
503
- /**
504
- * Whether this canvas is a secondary canvas sharing another's renderer.
505
- * True when `target` prop is used.
506
- */
507
- isSecondary?: boolean
508
- /**
509
- * The id of the primary canvas this secondary canvas targets.
510
- * Only set when isSecondary is true.
511
- */
512
- targetId?: string
513
- /**
514
- * Function to unregister this primary canvas from the registry.
515
- * Only set when this canvas has an `id` prop.
516
- */
517
- unregisterPrimary?: () => void
518
- /** Whether canvas dimensions are forced to even numbers */
519
- forceEven?: boolean
520
- }
521
-
522
- interface XRManager {
523
- connect: () => void
524
- disconnect: () => void
525
- }
526
-
527
- //* Root State Interface ====================================
528
-
529
- interface RootState {
530
- /** Set current state */
531
- set: StoreApi<RootState>['setState']
532
- /** Get current state */
533
- get: StoreApi<RootState>['getState']
534
- /**
535
- * Reference to the authoritative store for shared TSL resources (uniforms, nodes, etc).
536
- * - For primary/independent canvases: points to its own store (self-reference)
537
- * - For secondary canvases: points to the primary canvas's store
538
- *
539
- * Hooks like useNodes/useUniforms should read from primaryStore to ensure
540
- * consistent shared state across all canvases sharing a renderer.
541
- */
542
- primaryStore: RootStore
543
- /** @deprecated Use `renderer` instead. The instance of the renderer (typed as WebGLRenderer for backwards compat) */
544
- gl: THREE$1.WebGLRenderer
545
- /** The renderer instance - type depends on entry point (WebGPU, Legacy, or union for default) */
546
- renderer: R3FRenderer
547
- /** Inspector of the webGPU Renderer. Init in the canvas */
548
- inspector: any // Inspector type from three/webgpu
549
-
550
- /** Default camera */
551
- camera: ThreeCamera
552
- /** Camera frustum for visibility checks - auto-updated each frame when autoUpdateFrustum is true */
553
- frustum: THREE$1.Frustum
554
- /** Whether to automatically update the frustum each frame (default: true) */
555
- autoUpdateFrustum: boolean
556
- /** Default scene (may be overridden in portals to point to the portal container) */
557
- scene: THREE$1.Scene
558
- /** The actual root THREE.Scene - always points to the true scene, even inside portals */
559
- rootScene: THREE$1.Scene
560
- /** Default raycaster */
561
- raycaster: THREE$1.Raycaster
562
- /** Event layer interface, contains the event handler and the node they're connected to */
563
- events: EventManager<any>
564
- /** XR interface */
565
- xr: XRManager
566
- /** Currently used controls */
567
- controls: THREE$1.EventDispatcher | null
568
- /** Normalized event coordinates */
569
- pointer: THREE$1.Vector2
570
- /** @deprecated Normalized event coordinates, use "pointer" instead! */
571
- mouse: THREE$1.Vector2
572
- /** Color space assigned to 8-bit input textures (color maps). Most textures are authored in sRGB. */
573
- textureColorSpace: THREE$1.ColorSpace
574
- /** Render loop flags */
575
- frameloop: Frameloop
576
- performance: Performance
577
- /** Reactive pixel-size of the canvas */
578
- size: Size
579
- /** Reactive size of the viewport in threejs units */
580
- viewport: Viewport & {
581
- getCurrentViewport: (
582
- camera?: ThreeCamera,
583
- target?: THREE$1.Vector3 | Parameters<THREE$1.Vector3['set']>,
584
- size?: Size,
585
- ) => Omit<Viewport, 'dpr' | 'initialDpr'>
586
- }
587
- /** Flags the canvas for render, but doesn't render in itself */
588
- invalidate: (frames?: number, stackFrames?: boolean) => void
589
- /** Advance (render) one step */
590
- advance: (timestamp: number, runGlobalEffects?: boolean) => void
591
- /** Shortcut to setting the event layer */
592
- setEvents: (events: Partial<EventManager<any>>) => void
593
- /** Shortcut to manual sizing. No args resets to props/container. Single arg creates square. */
594
- setSize: (width?: number, height?: number, top?: number, left?: number) => void
595
- /** Shortcut to manual setting the pixel ratio */
596
- setDpr: (dpr: Dpr) => void
597
- /** Shortcut to setting frameloop flags. No args resets to 'always'. */
598
- setFrameloop: (frameloop?: Frameloop) => void
599
- /** Set error state to propagate to error boundary */
600
- setError: (error: Error | null) => void
601
- /** Current error state (null when no error) */
602
- error: Error | null
603
- /** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
604
- uniforms: UniformStore
605
- /** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
606
- nodes: NodeStore
607
- /** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
608
- buffers: BufferStore
609
- /** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
610
- gpuStorage: StorageStore
611
- /** Global Texture registry (key → Texture, usually keyed by URL) - use useTextures() hook for access + lifecycle */
612
- textures: Map<string, THREE$1.Texture>
613
- /** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
614
- _textureRefs: Map<string, number>
615
- /** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
616
- renderPipeline: ThreeRenderPipeline | null
617
- /** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
618
- passes: PassRecord
619
- /** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
620
- _hmrVersion: number
621
- /** Internal: whether setSize() has taken ownership of canvas dimensions */
622
- _sizeImperative: boolean
623
- /** Internal: stored size props from Canvas for reset functionality */
624
- _sizeProps: { width?: number; height?: number } | null
625
- /** When the canvas was clicked but nothing was hit */
626
- onPointerMissed?: (event: MouseEvent) => void
627
- /** When a dragover event has missed any target */
628
- onDragOverMissed?: (event: DragEvent) => void
629
- /** When a drop event has missed any target */
630
- onDropMissed?: (event: DragEvent) => void
631
- /** If this state model is layered (via createPortal) then this contains the previous layer */
632
- previousRoot?: RootStore
633
- /** Internals */
634
- internal: InternalState
635
- // flags for triggers
636
- // if we are using the webGl renderer, this will be true
637
- isLegacy: boolean
638
- // regardless of renderer, if the system supports webGpu, this will be true
639
- webGPUSupported: boolean
640
- //if we are on native
641
- isNative: boolean
642
- }
643
-
644
- type RootStore = UseBoundStoreWithEqualityFn<StoreApi<RootState>>
645
-
646
- /**
647
- * @fileoverview Internal Three.js re-exports - DEFAULT ENTRY
648
- *
649
- * This is the single source of truth for Three.js imports within R3F.
650
- * All internal code should import from '#three' (or '../three' relative).
651
- *
652
- * DEFAULT behavior (root import):
653
- * - Exports from three/webgpu (the new standard)
654
- * - Also exports WebGLRenderer for backwards compatibility (with deprecation)
655
- * - Both renderer types available, runtime decides which to use
656
- *
657
- * For explicit legacy or webgpu-only builds, use:
658
- * - #three/legacy - WebGL only, no WebGPU
659
- * - #three/webgpu - WebGPU only, no WebGL legacy
660
- */
661
- declare const R3F_BUILD_LEGACY = true;
662
- declare const R3F_BUILD_WEBGPU = true;
663
-
664
- /** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
665
- declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
666
-
667
-
668
- type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
669
-
670
- interface MathRepresentation {
671
- set(...args: number[]): any
672
- }
673
- interface VectorRepresentation extends MathRepresentation {
674
- setScalar(value: number): any
675
- }
676
- type MathTypes = MathRepresentation | Euler$1 | Color$1
677
-
678
- type MathType<T extends MathTypes> = T extends Color$1
679
- ? Args<typeof Color$1> | ColorRepresentation
680
- : T extends VectorRepresentation | Layers$1 | Euler$1
681
- ? T | MutableOrReadonlyParameters<T['set']> | number
682
- : T | MutableOrReadonlyParameters<T['set']>
683
-
684
- type MathProps<P> = {
685
- [K in keyof P as P[K] extends MathTypes ? K : never]: P[K] extends MathTypes ? MathType<P[K]> : never
686
- }
687
-
688
- type Vector2 = MathType<Vector2$1>
689
- type Vector3 = MathType<Vector3$1>
690
- type Vector4 = MathType<Vector4$1>
691
- type Color = MathType<Color$1>
692
- type Layers = MathType<Layers$1>
693
- type Quaternion = MathType<Quaternion$1>
694
- type Euler = MathType<Euler$1>
695
- type Matrix3 = MathType<Matrix3$1>
696
- type Matrix4 = MathType<Matrix4$1>
697
-
698
- interface RaycastableRepresentation {
699
- raycast(raycaster: Raycaster, intersects: Intersection$1[]): void
700
- }
701
- type EventProps<P> = P extends RaycastableRepresentation ? Partial<EventHandlers> : {}
702
-
703
- /**
704
- * Props for geometry transform methods that can be called with `once()`.
705
- * These methods modify the geometry in-place and only make sense to call once on mount.
706
- *
707
- * @example
708
- * import { once } from '@react-three/fiber'
709
- *
710
- * <boxGeometry args={[1, 1, 1]} rotateX={once(Math.PI / 2)} />
711
- * <planeGeometry args={[10, 10]} translate={once(0, 0, 5)} />
712
- * <bufferGeometry applyMatrix4={once(matrix)} center={once()} />
713
- */
714
- interface GeometryTransformProps {
715
- /** Rotate the geometry about the X axis (radians). Use with once(). */
716
- rotateX?: number
717
- /** Rotate the geometry about the Y axis (radians). Use with once(). */
718
- rotateY?: number
719
- /** Rotate the geometry about the Z axis (radians). Use with once(). */
720
- rotateZ?: number
721
- /** Translate the geometry (x, y, z). Use with once(). */
722
- translate?: [x: number, y: number, z: number]
723
- /** Scale the geometry (x, y, z). Use with once(). */
724
- scale?: [x: number, y: number, z: number]
725
- /** Center the geometry based on bounding box. Use with once(). */
726
- center?: true
727
- /** Apply a Matrix4 transformation. Use with once(). */
728
- applyMatrix4?: Matrix4$1
729
- /** Apply a Quaternion rotation. Use with once(). */
730
- applyQuaternion?: Quaternion$1
731
- }
732
-
733
- type GeometryProps<P> = P extends BufferGeometry ? GeometryTransformProps : {}
734
-
735
- /**
736
- * Workaround for @types/three TSL node type issues.
737
- * The Node base class has properties that subclasses (OperatorNode, ConstNode, etc.) don't inherit.
738
- * This transforms `Node | null` properties to accept any object with node-like shape.
739
- */
740
- type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
741
-
742
- /**
743
- * For node material properties (colorNode, positionNode, etc.), accept broader types
744
- * since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
745
- * `nodeType`, so this structural key test remains neutral to the selected Three entry.
746
- */
747
- type NodeProps<P> = {
748
- [K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
749
- }
750
-
751
- interface ReactProps<P> {
752
- children?: React.ReactNode
753
- ref?: React.Ref<P>
754
- key?: React.Key
755
- }
756
-
757
- type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<
758
- Overwrite<P, MathProps<P> & ReactProps<P> & EventProps<P> & GeometryProps<P> & NodeProps<P>>
759
- >
760
-
761
- type ThreeElement<T extends ConstructorRepresentation> = Mutable<
762
- Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>
763
- >
764
-
765
- type ThreeToJSXElements<T extends Record<string, any>> = {
766
- [K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
767
- }
768
-
769
- /** Method names of Object3D, excluded from the `primitive` element's typed props. */
770
- type Object3DMethod = NonNullable<
771
- {
772
- [K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
773
- }[keyof Object3D]
774
- >
775
-
776
- type ThreeExports = typeof import('three') & typeof import('three/webgpu')
777
- type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
778
-
779
- interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
780
- /**
781
- * `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
782
- * Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
783
- * untyped, and any other prop is accepted and applied to the object by name. Object3D's own
784
- * methods are left out of the typed surface: they return `this`, so a subclass element's
785
- * props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
786
- */
787
- primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | Object3DMethod> & {
788
- object: object
789
- ref?: React.Ref<any>
790
- [prop: string]: unknown
791
- }
792
- // Conflicts with DOM types can be accessed through a three* prefix
793
- threeAudio: ThreeElementsImpl['audio']
794
- threeSource: ThreeElementsImpl['source']
795
- threeLine: ThreeElementsImpl['line']
796
- threePath: ThreeElementsImpl['path']
797
- }
798
-
799
- declare module 'react' {
800
- namespace JSX {
801
- interface IntrinsicElements extends ThreeElements {}
802
- }
803
- }
804
-
805
- declare module 'react/jsx-runtime' {
806
- namespace JSX {
807
- interface IntrinsicElements extends ThreeElements {}
808
- }
809
- }
810
-
811
- declare module 'react/jsx-dev-runtime' {
812
- namespace JSX {
813
- interface IntrinsicElements extends ThreeElements {}
814
- }
815
- }
816
-
817
- //* Base Renderer Types =====================================
818
-
819
- // Shim for OffscreenCanvas since it was removed from DOM types
820
- interface OffscreenCanvas extends EventTarget {}
821
-
822
- interface BaseRendererProps {
823
- canvas: HTMLCanvasElement | OffscreenCanvas
824
- powerPreference?: 'high-performance' | 'low-power' | 'default'
825
- antialias?: boolean
826
- alpha?: boolean
827
- }
828
-
829
- type RendererFactory<TRenderer, TParams> =
830
- | TRenderer
831
- | ((defaultProps: TParams) => TRenderer)
832
- | ((defaultProps: TParams) => Promise<TRenderer>)
833
-
834
- interface Renderer {
835
- render: (scene: THREE$1.Scene, camera: THREE$1.Camera) => any
836
- }
837
-
838
- //* Color Management Config ==============================
839
-
840
- /**
841
- * Color management configuration shared by both WebGL and WebGPU renderers.
842
- */
843
- interface ColorManagementConfig {
844
- /**
845
- * Color space assigned to 8-bit input textures (color maps).
846
- * Defaults to sRGB. Most textures are authored in sRGB.
847
- * @default THREE.SRGBColorSpace
848
- */
849
- textureColorSpace?: THREE$1.ColorSpace
850
- }
851
-
852
- //* WebGL Renderer Props ==============================
853
-
854
- type DefaultGLProps = Omit<THREE$1.WebGLRendererParameters, 'canvas'> & {
855
- canvas: HTMLCanvasElement | OffscreenCanvas
856
- }
857
-
858
- type GLProps =
859
- | Renderer
860
- | ((defaultProps: DefaultGLProps) => Renderer)
861
- | ((defaultProps: DefaultGLProps) => Promise<Renderer>)
862
- | (Partial<Properties<THREE$1.WebGLRenderer> | THREE$1.WebGLRendererParameters> & ColorManagementConfig)
863
-
864
- //* WebGPU Renderer Props ==============================
865
-
866
- type DefaultRendererProps = {
867
- canvas: HTMLCanvasElement | OffscreenCanvas
868
- [key: string]: any
869
- }
870
-
871
- /**
872
- * Canvas-level scheduler configuration.
873
- * Controls render timing relative to other canvases.
874
- */
875
- interface CanvasSchedulerConfig {
876
- /**
877
- * Run this Canvas root before the referenced Canvas root id(s).
878
- */
879
- before?: string | string[]
880
- /**
881
- * Run this Canvas root after the referenced Canvas root id(s).
882
- */
883
- after?: string | string[]
884
- /**
885
- * Numeric root order. Lower values run first.
886
- */
887
- order?: number
888
- /**
889
- * Limit this Canvas's default render job (frames per second).
890
- */
891
- fps?: number
892
- }
893
-
894
- /**
895
- * Extended renderer configuration for multi-canvas support and color management.
896
- */
897
- interface RendererConfigExtended extends ColorManagementConfig {
898
- /** Share renderer from another canvas (WebGPU only) */
899
- primaryCanvas?: string
900
- /** Canvas-level scheduler options */
901
- scheduler?: CanvasSchedulerConfig
902
- }
903
-
904
- type RendererProps =
905
- | any // WebGPURenderer
906
- | ((defaultProps: DefaultRendererProps) => any)
907
- | ((defaultProps: DefaultRendererProps) => Promise<any>)
908
- | (Partial<Properties<any> | Record<string, any>> & RendererConfigExtended)
909
-
910
- //* Camera Props ==============================
911
-
912
- type CameraProps = (
913
- | THREE$1.Camera
914
- | Partial<
915
- ThreeElement<typeof THREE$1.Camera> &
916
- ThreeElement<typeof THREE$1.PerspectiveCamera> &
917
- ThreeElement<typeof THREE$1.OrthographicCamera>
918
- >
919
- ) & {
920
- /** Flags the camera as manual, putting projection into your own hands */
921
- manual?: boolean
922
- }
923
-
924
- //* Render Props ==============================
925
-
926
- interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas> {
927
- /**
928
- * Unique identifier for multi-canvas renderer sharing.
929
- * Makes this canvas targetable by other canvases using the `primaryCanvas` prop.
930
- * Also sets the HTML `id` attribute on the canvas element.
931
- * @example <Canvas id="main-viewer">...</Canvas>
932
- */
933
- id?: string
934
- /**
935
- * Share the renderer from another canvas instead of creating a new one.
936
- * Pass the `id` of the primary canvas to share its WebGPURenderer.
937
- * Only available with WebGPU (not legacy WebGL).
938
- *
939
- * Note: This is extracted from `renderer={{ primaryCanvas: "id" }}` by Canvas.
940
- * @internal
941
- */
942
- primaryCanvas?: string
943
- /**
944
- * Canvas-level scheduler options. Controls render timing relative to other canvases.
945
- *
946
- * Note: This is extracted from `renderer={{ scheduler: {...} }}` by Canvas.
947
- * @internal
948
- */
949
- scheduler?: CanvasSchedulerConfig
950
- /** A threejs renderer instance or props that go into the default renderer */
951
- gl?: GLProps
952
- /** A WebGPU renderer instance or props that go into the default renderer */
953
- renderer?: RendererProps
954
- /** Dimensions to fit the renderer to. Will measure canvas dimensions if omitted */
955
- size?: Size
956
- /**
957
- * Enables shadows (by default PCFsoft). Can accept `gl.shadowMap` options for fine-tuning,
958
- * but also strings: 'basic' | 'percentage' | 'soft' | 'variance'.
959
- * @see https://threejs.org/docs/#api/en/renderers/WebGLRenderer.shadowMap
960
- */
961
- shadows?: boolean | 'basic' | 'percentage' | 'soft' | 'variance' | Partial<THREE$1.WebGLShadowMap>
962
- /** Creates an orthographic camera */
963
- orthographic?: boolean
964
- /**
965
- * R3F's render mode. Set to `demand` to only render on state change or `never` to take control.
966
- * @see https://docs.pmnd.rs/react-three-fiber/advanced/scaling-performance#on-demand-rendering
967
- */
968
- frameloop?: Frameloop
969
- /**
970
- * R3F performance options for adaptive performance.
971
- * @see https://docs.pmnd.rs/react-three-fiber/advanced/scaling-performance#movement-regression
972
- */
973
- performance?: Partial<Omit<Performance, 'regress'>>
974
- /** Target pixel ratio. Can clamp between a range: `[min, max]` */
975
- dpr?: Dpr
976
- /**
977
- * Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
978
- * so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
979
- */
980
- raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
981
- /** A `THREE.Scene` instance or props that go into the default scene */
982
- scene?: THREE$1.Scene | Partial<THREE$1.Scene>
983
- /** A `THREE.Camera` instance or props that go into the default camera */
984
- camera?: CameraProps
985
- /** An R3F event manager to manage elements' pointer events */
986
- events?: (store: RootStore) => EventManager<Element>
987
- /** Callback after the canvas has rendered (but not yet committed) */
988
- onCreated?: (state: RootState) => void
989
- /** Response for pointer clicks that have missed any target */
990
- onPointerMissed?: (event: MouseEvent) => void
991
- /** Response for dragover events that have missed any target */
992
- onDragOverMissed?: (event: DragEvent) => void
993
- /** Response for drop events that have missed any target */
994
- onDropMissed?: (event: DragEvent) => void
995
- /** Whether to automatically update the frustum each frame (default: true) */
996
- autoUpdateFrustum?: boolean
997
- /**
998
- * Enable WebGPU occlusion queries for onOccluded/onVisible events.
999
- * Auto-enabled when any object uses onOccluded or onVisible handlers.
1000
- * Only works with WebGPU renderer - WebGL will log a warning.
1001
- */
1002
- occlusion?: boolean
1003
- /** Internal: stored size props from Canvas for reset functionality */
1004
- _sizeProps?: { width?: number; height?: number } | null
1005
- /** Force canvas dimensions to even numbers (fixes Safari rendering issues with odd/fractional sizes) */
1006
- forceEven?: boolean
1007
- }
1008
-
1009
- //* Reconciler Root ==============================
1010
-
1011
- interface ReconcilerRoot<TCanvas extends HTMLCanvasElement | OffscreenCanvas> {
1012
- configure: (config?: RenderProps<TCanvas>) => Promise<ReconcilerRoot<TCanvas>>
1013
- render: (element: ReactNode) => RootStore
1014
- unmount: () => void
1015
- }
1016
-
1017
- //* Inject State ==============================
1018
-
1019
- type InjectState = Partial<
1020
- Omit<RootState, 'events'> & {
1021
- events?: {
1022
- enabled?: boolean
1023
- priority?: number
1024
- compute?: ComputeFunction
1025
- connected?: any
1026
- }
1027
- /**
1028
- * When true (default), injects a THREE.Scene between container and children if container isn't already a Scene.
1029
- * This ensures state.scene is always a real THREE.Scene with proper properties (background, environment, fog).
1030
- * Set to false to use the container directly as scene (anti-pattern, but supported for edge cases).
1031
- */
1032
- injectScene?: boolean
1033
- }
1034
- >
1035
-
1036
- //* Reconciler Types ==============================
1037
-
1038
- // FiberRoot is an opaque internal React type - we define it locally
1039
- // to avoid bundling @types/react-reconciler which causes absolute path issues
1040
- type FiberRoot = any
1041
-
1042
- interface Root {
1043
- fiber: FiberRoot
1044
- store: RootStore
1045
- }
1046
-
1047
- type AttachFnType<O = any> = (parent: any, self: O) => () => void
1048
- type AttachType<O = any> = string | AttachFnType<O>
1049
-
1050
- type ConstructorRepresentation<T = any> = new (...args: any[]) => T
1051
-
1052
- interface Catalogue {
1053
- [name: string]: ConstructorRepresentation
1054
- }
1055
-
1056
- // TODO: handle constructor overloads
1057
- // https://github.com/pmndrs/react-three-fiber/pull/2931
1058
- // https://github.com/microsoft/TypeScript/issues/37079
1059
- type Args<T> = T extends ConstructorRepresentation
1060
- ? T extends typeof Color$2
1061
- ? [r: number, g: number, b: number] | [color: ColorRepresentation$1]
1062
- : ConstructorParameters<T>
1063
- : any[]
1064
-
1065
- type ArgsProp<P> = P extends ConstructorRepresentation
1066
- ? IsAllOptional<ConstructorParameters<P>> extends true
1067
- ? { args?: Args<P> }
1068
- : { args: Args<P> }
1069
- : { args: unknown[] }
1070
-
1071
- type InstanceProps<T = any, P = any> = ArgsProp<P> & {
1072
- object?: T
1073
- dispose?: null
1074
- attach?: AttachType<T>
1075
- }
1076
-
1077
- interface Instance<O = any> {
1078
- root: RootStore
1079
- type: string
1080
- parent: Instance | null
1081
- children: Instance[]
1082
- props: InstanceProps<O> & Record<string, unknown>
1083
- object: O & { __r3f?: Instance<O> }
1084
- eventCount: number
1085
- handlers: Partial<EventHandlers>
1086
- attach?: AttachType<O>
1087
- previousAttach?: any
1088
- isHidden: boolean
1089
- /** Set of props that have been applied via once() */
1090
- appliedOnce?: Set<string>
1091
- }
1092
-
1093
- interface HostConfig {
1094
- type: string
1095
- props: Instance['props']
1096
- container: RootStore
1097
- instance: Instance
1098
- textInstance: void
1099
- suspenseInstance: Instance
1100
- hydratableInstance: never
1101
- formInstance: never
1102
- publicInstance: Instance['object']
1103
- hostContext: {}
1104
- childSet: never
1105
- timeoutHandle: number | undefined
1106
- noTimeout: -1
1107
- TransitionStatus: null
1108
- }
1109
- declare global {
1110
- var IS_REACT_ACT_ENVIRONMENT: boolean | undefined
1111
- }
1112
-
1113
- //* Loop Types ==============================
1114
-
1115
- type GlobalRenderCallback = (timestamp: number) => void
1116
-
1117
- type GlobalEffectType = 'before' | 'after' | 'tail'
1118
-
1119
- declare const presetsObj: {
1120
- apartment: string;
1121
- city: string;
1122
- dawn: string;
1123
- forest: string;
1124
- lobby: string;
1125
- night: string;
1126
- park: string;
1127
- studio: string;
1128
- sunset: string;
1129
- warehouse: string;
1130
- };
1131
- type PresetsType = keyof typeof presetsObj;
1132
-
1133
- //* Background Types ==============================
1134
-
1135
- /**
1136
- * Expanded object form for background configuration.
1137
- * Allows separate textures for background (visual backdrop) and environment (PBR lighting).
1138
- */
1139
- interface BackgroundConfig {
1140
- /** HDRI preset name: 'apartment', 'city', 'dawn', 'forest', 'lobby', 'night', 'park', 'studio', 'sunset', 'warehouse' */
1141
- preset?: PresetsType
1142
- /** Files for cube texture (6 faces) or single HDR/EXR */
1143
- files?: string | string[]
1144
- /** Separate files for scene.background (visual backdrop) */
1145
- backgroundMap?: string | string[]
1146
- backgroundRotation?: Euler$2 | [number, number, number]
1147
- backgroundBlurriness?: number
1148
- backgroundIntensity?: number
1149
- /** Separate files for scene.environment (PBR lighting/reflections) */
1150
- envMap?: string | string[]
1151
- environmentRotation?: Euler$2 | [number, number, number]
1152
- environmentIntensity?: number
1153
- path?: string
1154
- extensions?: (loader: Loader) => void
1155
- }
1156
-
1157
- /**
1158
- * Background prop type for Canvas.
1159
- *
1160
- * String detection priority:
1161
- * 1. Preset - exact match against known presets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
1162
- * 2. URL - starts with /, ./, ../, http://, https://, OR has image extension
1163
- * 3. Color - default fallback (CSS color names, hex values, rgb(), etc.)
1164
- *
1165
- * @example Color
1166
- * ```tsx
1167
- * <Canvas background="red" />
1168
- * <Canvas background="#ff0000" />
1169
- * <Canvas background={0xff0000} />
1170
- * ```
1171
- *
1172
- * @example Preset
1173
- * ```tsx
1174
- * <Canvas background="city" />
1175
- * ```
1176
- *
1177
- * @example URL
1178
- * ```tsx
1179
- * <Canvas background="/path/to/env.hdr" />
1180
- * <Canvas background="./sky.jpg" />
1181
- * ```
1182
- *
1183
- * @example Object form
1184
- * ```tsx
1185
- * <Canvas background={{
1186
- * files: ['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png'],
1187
- * backgroundMap: 'path/to/sky.jpg',
1188
- * envMap: 'path/to/lighting.hdr',
1189
- * backgroundBlurriness: 0.5,
1190
- * }} />
1191
- * ```
1192
- */
1193
- type BackgroundProp =
1194
- | ColorRepresentation$1 // "red", "#ff0000", 0xff0000
1195
- | string // URL or preset
1196
- | BackgroundConfig // Expanded object form
1197
-
1198
- //* Canvas Types ==============================
1199
-
1200
- interface CanvasProps
1201
- extends
1202
- Omit<RenderProps<HTMLCanvasElement>, 'size' | 'primaryCanvas' | 'scheduler'>,
1203
- React$1.HTMLAttributes<HTMLDivElement> {
1204
- children?: React$1.ReactNode
1205
- ref?: React$1.Ref<HTMLCanvasElement>
1206
- /** Canvas fallback content, similar to img's alt prop */
1207
- fallback?: React$1.ReactNode
1208
- /**
1209
- * Options to pass to useMeasure.
1210
- * @see https://github.com/pmndrs/react-use-measure#api
1211
- */
1212
- resize?: Options
1213
- /** The target where events are being subscribed to, default: the div that wraps canvas */
1214
- eventSource?: Element | React$1.RefObject<Element | null>
1215
- /** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
1216
- eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
1217
- /** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
1218
- hmr?: boolean
1219
- /** Canvas resolution width in pixels. If omitted, uses container width. */
1220
- width?: number
1221
- /** Canvas resolution height in pixels. If omitted, uses container height. */
1222
- height?: number
1223
- /** Force canvas dimensions to even numbers (fixes Safari rendering issues with odd/fractional sizes) */
1224
- forceEven?: boolean
1225
- /**
1226
- * Scene background configuration.
1227
- * Accepts colors, URLs, presets, or an expanded object for separate background/environment.
1228
- * @see BackgroundProp for full documentation and examples
1229
- */
1230
- background?: BackgroundProp
1231
- }
1232
-
1233
- //* Loader Types ==============================
1234
-
1235
- type InputLike = string | string[] | string[][] | Readonly<string | string[] | string[][]>
1236
-
1237
- // Define a loader-like interface that matches THREE.Loader's load signature
1238
- // This works for both generic and non-generic THREE.Loader instances
1239
- interface LoaderLike {
1240
- load(
1241
- url: InputLike,
1242
- onLoad?: (result: any) => void,
1243
- onProgress?: (event: ProgressEvent<EventTarget>) => void,
1244
- onError?: (error: unknown) => void,
1245
- ): any
1246
- }
1247
-
1248
- type GLTFLike = { scene: THREE$1.Object3D }
1249
-
1250
- type LoaderInstance<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> =
1251
- T extends ConstructorRepresentation<LoaderLike> ? InstanceType<T> : T
1252
-
1253
- // Infer result type from the load method's callback parameter
1254
- type InferLoadResult<T> = T extends {
1255
- load(url: any, onLoad?: (result: infer R) => void, ...args: any[]): any
1256
- }
1257
- ? R
1258
- : T extends ConstructorRepresentation<any>
1259
- ? InstanceType<T> extends {
1260
- load(url: any, onLoad?: (result: infer R) => void, ...args: any[]): any
1261
- }
1262
- ? R
1263
- : any
1264
- : any
1265
-
1266
- type LoaderResult<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> =
1267
- InferLoadResult<LoaderInstance<T>> extends infer R ? (R extends GLTFLike ? R & ObjectMap : R) : never
1268
-
1269
- type Extensions<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> = (
1270
- loader: LoaderInstance<T>,
1271
- ) => void
1272
-
1273
- //* Renderer Props ========================================
1274
-
1275
- type WebGLDefaultProps = Omit<THREE$1.WebGLRendererParameters, 'canvas'> & BaseRendererProps
1276
-
1277
- type WebGLProps =
1278
- | RendererFactory<THREE$1.WebGLRenderer, WebGLDefaultProps>
1279
- | Partial<Properties<THREE$1.WebGLRenderer> | THREE$1.WebGLRendererParameters>
1280
-
1281
- interface WebGLShadowConfig {
1282
- shadows?: boolean | 'basic' | 'percentage' | 'soft' | 'variance' | Partial<THREE$1.WebGLShadowMap>
1283
- }
1284
-
1285
- //* Legacy-specific Types ========================================
1286
-
1287
- /** Legacy (WebGL) renderer type - re-exported as R3FRenderer from @react-three/fiber/legacy */
1288
- type LegacyRenderer = THREE$1.WebGLRenderer
1289
-
1290
- /** Legacy internal state with narrowed renderer type */
1291
- interface LegacyInternalState extends Omit<InternalState, 'actualRenderer'> {
1292
- actualRenderer: THREE$1.WebGLRenderer
1293
- }
1294
-
1295
- /**
1296
- * Legacy-specific RootState with narrowed renderer type.
1297
- * Automatically used when importing from `@react-three/fiber/legacy`.
1298
- *
1299
- * @example
1300
- * ```tsx
1301
- * import { useThree } from '@react-three/fiber/legacy'
1302
- *
1303
- * function MyComponent() {
1304
- * const { renderer } = useThree()
1305
- * // renderer is typed as THREE.WebGLRenderer
1306
- * renderer.shadowMap.enabled = true
1307
- * }
1308
- * ```
1309
- */
1310
- interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
1311
- /** The WebGL renderer instance */
1312
- renderer: THREE$1.WebGLRenderer
1313
- /** Internals with WebGL renderer */
1314
- internal: LegacyInternalState
1315
- }
1316
-
1317
- //* RenderTarget Types ==============================
1318
-
1319
-
1320
- type RenderTargetOptions = RenderTargetOptions$1
1321
-
1322
- //* Global TSL Types ==============================
1323
-
1324
- declare global {
1325
- /**
1326
- * Broad callable-node fallback for dynamic store readers.
1327
- * Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
1328
- */
1329
- type CallableTSLNode = ((...params: never[]) => unknown) & {
1330
- readonly shaderNode: unknown
1331
- readonly id: number
1332
- }
1333
-
1334
- /** Legacy structural node accepted when at least one historical marker exists. */
1335
- type LegacyTSLNodeLike = {
1336
- label?: ((label: string) => unknown) | string
1337
- setName?: (name: string) => unknown
1338
- } & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
1339
-
1340
- /** Node type accepted by broad dynamic node-store readers. */
1341
- type TSLNodeType = three_webgpu.Node | CallableTSLNode
1342
-
1343
- /**
1344
- * Derive Three's shader node type from an existing node or a supported raw input.
1345
- * Existing InputNode generics take precedence over structural value normalization.
1346
- * Both generics must be inferred because Three's UniformNode intersects an unknown-typed
1347
- * InputNode base with its concrete InputNode specialization.
1348
- */
1349
- type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
1350
- ? TNodeType
1351
- : T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
1352
- ? TNodeType
1353
- : T extends number
1354
- ? 'float'
1355
- : T extends boolean
1356
- ? 'bool'
1357
- : T extends string | three_webgpu.Color | { r: number; g: number; b: number }
1358
- ? 'color'
1359
- : T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
1360
- ? 'vec4'
1361
- : T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
1362
- ? 'vec3'
1363
- : T extends three_webgpu.Vector2 | { x: number; y: number }
1364
- ? 'vec2'
1365
- : T extends three_webgpu.Matrix4
1366
- ? 'mat4'
1367
- : T extends three_webgpu.Matrix3
1368
- ? 'mat3'
1369
- : T extends three_webgpu.Matrix2
1370
- ? 'mat2'
1371
- : unknown
1372
-
1373
- /** Derive the normalized JavaScript value stored by a uniform node. */
1374
- type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
1375
- ? TValue
1376
- : T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
1377
- ? TValue
1378
- : T extends string | { r: number; g: number; b: number }
1379
- ? three_webgpu.Color
1380
- : T extends { x: number; y: number; z: number; w: number }
1381
- ? three_webgpu.Vector4
1382
- : T extends { x: number; y: number; z: number }
1383
- ? three_webgpu.Vector3
1384
- : T extends { x: number; y: number }
1385
- ? three_webgpu.Vector2
1386
- : T extends number
1387
- ? number
1388
- : T extends boolean
1389
- ? boolean
1390
- : T
1391
-
1392
- /** Three's exact UniformNode with shader and value generics derived from an input. */
1393
- type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
1394
-
1395
- /** Preserve every input key while mapping values to exact Three uniform nodes. */
1396
- type UniformNodesFor<T extends UniformInputRecord> = {
1397
- [K in keyof T]: UniformNodeFor<T[K]>
1398
- }
1399
-
1400
- /** Backward-compatible single-parameter uniform alias. */
1401
- type UniformNode<T = unknown> = UniformNodeFor<T>
1402
-
1403
- /** Flat record of uniform nodes (no nested scopes) */
1404
- type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
1405
-
1406
- /**
1407
- * Uniform store that can contain both root-level uniforms and scoped uniform objects
1408
- * Used by state.uniforms which has structure like:
1409
- * { uTime: UniformNode, player: { uHealth: UniformNode }, enemy: { uHealth: UniformNode } }
1410
- */
1411
- type UniformStore = Record<string, UniformNode | UniformRecord>
1412
-
1413
- /**
1414
- * Helper to safely access a uniform node from the store.
1415
- * Use this when accessing state.uniforms to get proper typing.
1416
- * @example
1417
- * const uTime = uniforms.uTime as UniformNode<number>
1418
- * const uColor = uniforms.uColor as UniformNode<import('three/webgpu').Color>
1419
- */
1420
- type GetUniform<T = unknown> = UniformNode<T>
1421
-
1422
- /**
1423
- * Acceptable input values for useUniforms - raw values that get converted to UniformNodes
1424
- * Supports:
1425
- * - Primitives: number, string (color), boolean
1426
- * - Three.js types: Color, Vector2/3/4, Matrix2/3/4
1427
- * - Plain objects: { x, y, z, w } converted to vectors
1428
- * - TSL nodes: color(), vec3(), float() for type casting
1429
- * - UniformNode: existing uniforms (reused as-is)
1430
- */
1431
- type UniformValue =
1432
- | number
1433
- | string
1434
- | boolean
1435
- | three_webgpu.Color
1436
- | three_webgpu.Vector2
1437
- | three_webgpu.Vector3
1438
- | three_webgpu.Vector4
1439
- | three_webgpu.Matrix2
1440
- | three_webgpu.Matrix3
1441
- | three_webgpu.Matrix4
1442
- | { x: number; y: number }
1443
- | { x: number; y: number; z: number }
1444
- | { x: number; y: number; z: number; w: number }
1445
- | { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
1446
- | three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
1447
- | UniformNode
1448
-
1449
- /** Input record for useUniforms - accepts raw values or UniformNodes */
1450
- type UniformInputRecord = Record<string, UniformValue>
1451
- }
1452
-
1453
- declare global {
1454
- /**
1455
- * three's own render pipeline type. Named here so the rest of R3F refers to three's shape
1456
- * rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
1457
- * is r185, so the new name is the only one.
1458
- */
1459
- type ThreeRenderPipeline = three_webgpu.RenderPipeline
1460
-
1461
- /**
1462
- * The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
1463
- * `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
1464
- * `getTextureNode`, `setMRT` and `dispose` track the installed version.
1465
- */
1466
- type ScenePassNode = three_webgpu.PassNode
1467
-
1468
- /**
1469
- * Pass record - stores TSL pass nodes for render pipeline.
1470
- *
1471
- * `scenePass` is the only key the library owns. It is optional here because this is also the
1472
- * shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
1473
- * or `clearPasses()`. Inside the callbacks it is always present; see
1474
- * {@link RenderPipelineCallbackState}.
1475
- *
1476
- * Every other key is user-registered, via a callback's return value. Those are TSL nodes of
1477
- * any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
1478
- * `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
1479
- * site when you need a member, e.g. `passes.velocity as TextureNode`.
1480
- *
1481
- * The index signature admits `undefined` because a key may simply not be registered, and
1482
- * because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
1483
- * optional property whose type excludes `undefined` from the index signature is an error
1484
- * (TS2411) for every consumer compiling these declarations.
1485
- */
1486
- interface PassRecord {
1487
- scenePass?: ScenePassNode
1488
- [key: string]: three_webgpu.Node | undefined
1489
- }
1490
-
1491
- /**
1492
- * State passed to pipeline callbacks after the active pipeline has been created.
1493
- *
1494
- * `passes.scenePass` is required here: the hook installs the default scene pass before either
1495
- * callback runs, so callbacks can use it without a guard or a cast.
1496
- *
1497
- * `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
1498
- * the legacy renderer before either callback can run, so a callback never sees WebGL.
1499
- */
1500
- type RenderPipelineCallbackState = RootState & {
1501
- renderPipeline: ThreeRenderPipeline
1502
- passes: PassRecord & { scenePass: ScenePassNode }
1503
- renderer: three_webgpu.WebGPURenderer
1504
- isLegacy: false
1505
- }
1506
-
1507
- /**
1508
- * What a callback may return to register entries into `state.passes`.
1509
- *
1510
- * `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
1511
- * created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
1512
- * store entry would leave the store pointing at a node the hook never disposes, and the hook
1513
- * disposing a pass nothing references. So returning it is a type error.
1514
- */
1515
- type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
1516
-
1517
- /** Setup callback - runs first to configure MRT, create additional passes */
1518
- type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1519
-
1520
- /** Main callback - runs second to configure outputNode, create effect passes */
1521
- type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1522
-
1523
- /** The imperative half of useRenderPipeline's return value, present in every state */
1524
- interface UseRenderPipelineActions {
1525
- /** Current passes from state */
1526
- passes: PassRecord
1527
- /** Clear all passes from state */
1528
- clearPasses: () => void
1529
- /** Reset RenderPipeline entirely (clears PP + passes) */
1530
- reset: () => void
1531
- /** Re-run setup/main callbacks with current closure values */
1532
- rebuild: () => void
1533
- }
1534
-
1535
- /**
1536
- * Return type for useRenderPipeline hook, discriminated on `isReady`.
1537
- *
1538
- * `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
1539
- * callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
1540
- * `clearPasses()` empties the record while leaving the pipeline in place.
1541
- */
1542
- type UseRenderPipelineReturn = UseRenderPipelineActions &
1543
- (
1544
- | {
1545
- /** True when RenderPipeline is configured and ready */
1546
- isReady: true
1547
- /** RenderPipeline instance */
1548
- renderPipeline: ThreeRenderPipeline
1549
- }
1550
- | {
1551
- /** False until the pipeline has been created */
1552
- isReady: false
1553
- /** Not initialized yet, or torn down by reset() */
1554
- renderPipeline: null
1555
- }
1556
- )
1557
- }
1558
-
1559
- declare const context: React$1.Context<RootStore>;
1560
-
1561
- /**
1562
- * Returns the R3F Canvas' Zustand store. Useful for [transient updates](https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes).
1563
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
1564
- */
1565
- declare function useStore(): RootStore;
1566
- /**
1567
- * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
1568
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
1569
- */
1570
- declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
5
+ import 'react';
6
+ import 'three';
7
+ import 'three/webgpu';
8
+ import 'zustand';
9
+ import 'zustand/traditional';
10
+ import 'three/tsl';
1571
11
 
1572
12
  /**
1573
13
  * Frame hook with phase-based ordering, priority, and FPS throttling.
@@ -1613,35 +53,4 @@ declare function useThree<T = RootState>(selector?: (state: RootState) => T, equ
1613
53
  */
1614
54
  declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
1615
55
 
1616
- interface RootExtension {
1617
- /** Unique name. Registering the same name again replaces the entry (HMR-safe); roots it already
1618
- * set up are not set up a second time, but get the new entry's dispose and hmr. */
1619
- name: string;
1620
- /**
1621
- * Called once per root, after its renderer exists and before `onCreated` and the first frame.
1622
- * `isLegacy` and `primaryStore` are known by then, so an extension can skip WebGL roots or defer
1623
- * to the primary canvas. Return fields to merge into the root's state, or nothing.
1624
- */
1625
- setup?(store: RootStore): Partial<RootState> | void;
1626
- /** Called when a root this extension set up unmounts. */
1627
- dispose?(store: RootStore): void;
1628
- /** Called when `<Canvas>` detects hot module replacement (skipped with `hmr={false}`). */
1629
- hmr?(store: RootStore): void;
1630
- }
1631
- /**
1632
- * Register an extension. It is set up on every live root immediately, and on every root created
1633
- * afterwards. Returns a function that unregisters it: new roots are no longer set up, while roots
1634
- * it already set up keep its state and still get its dispose when they unmount.
1635
- */
1636
- declare function registerRootExtension(extension: RootExtension): () => void;
1637
- /**
1638
- * Point a root's default render job at a different render function, or back at
1639
- * `renderer.render(scene, camera)` with `null`.
1640
- *
1641
- * The default job keeps everything else: the Canvas `fps` throttle, error propagation to the error
1642
- * boundary, and backing off when a user `useFrame(..., { phase: 'render' })` job takes over.
1643
- */
1644
- declare function setRenderOverride(store: RootStore, render: (() => void) | null): void;
1645
-
1646
- export { context, registerRootExtension, setRenderOverride, useFrame, useStore, useThree };
1647
- 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, DomEvent, Dpr, ElementProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeLike, NodeProps, NodeRecord, NodeStore, NonFunctionKeys, Object3DMethod, ObjectMap, OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, Properties, Quaternion, R3FRenderer, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootExtension, RootState, RootStore, SetBlock, Size, StorageLike, StorageRecord, StorageStore, Subscription, TSLNodeInput, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, XRManager, XRPointerConfig };
56
+ export { FrameNextCallback, useFrame };