@react-three/fiber 10.0.0-canary.c3fa45d → 10.0.0-canary.c4ecb6a

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.
package/dist/index.d.cts CHANGED
@@ -1,16 +1,18 @@
1
+ import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
1
2
  import * as three_webgpu from 'three/webgpu';
2
- import { RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera } from 'three/webgpu';
3
+ import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Storage3DTexture, StorageArrayTexture, Data3DTexture, CanvasTarget, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$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, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Frustum, OrthographicCamera } from 'three/webgpu';
3
4
  import * as THREE$1 from 'three';
4
- import { WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
5
+ import { WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
5
6
  import { WebGLRendererParameters } from 'three/src/renderers/WebGLRenderer.js';
6
7
  import { Inspector } from 'three/addons/inspector/Inspector.js';
7
8
  import * as React$1 from 'react';
8
9
  import { ReactNode, Component, RefObject, JSX } from 'react';
9
10
  import { StoreApi } from 'zustand';
10
11
  import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
12
+ import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
13
+ export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
11
14
  import { Options } from 'react-use-measure';
12
15
  import * as react_jsx_runtime from 'react/jsx-runtime';
13
- import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
14
16
  import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
15
17
 
16
18
  function _mergeNamespaces(n, m) {
@@ -46,15 +48,22 @@ function _mergeNamespaces(n, m) {
46
48
  declare const R3F_BUILD_LEGACY = true;
47
49
  declare const R3F_BUILD_WEBGPU = true;
48
50
 
51
+ /** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
52
+ declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
53
+
49
54
  var THREE = /*#__PURE__*/_mergeNamespaces({
50
55
  __proto__: null,
56
+ CubeRenderTarget: CubeRenderTarget,
57
+ CubeRenderTargetCompat: CubeRenderTarget,
51
58
  Inspector: Inspector,
52
59
  R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
53
60
  R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
54
61
  RenderTargetCompat: RenderTarget,
62
+ WebGLCubeRenderTarget: WebGLCubeRenderTarget,
55
63
  WebGLRenderTarget: WebGLRenderTarget,
56
64
  WebGLRenderer: WebGLRenderer,
57
- WebGLRendererParameters: WebGLRendererParameters
65
+ WebGLRendererParameters: WebGLRendererParameters,
66
+ loadInspector: loadInspector
58
67
  }, [three_webgpu]);
59
68
 
60
69
  //* Utility Types ==============================
@@ -292,228 +301,33 @@ interface VisibilityEntry {
292
301
  }
293
302
 
294
303
  //* Scheduler Types (useFrame) ==============================
304
+ //
305
+ // The generic, framework-agnostic scheduler types now live in @pmndrs/scheduler.
306
+ // This file re-exports them and layers r3f's RootState-aware frame state on top,
307
+ // so existing `#types` imports across the codebase keep resolving unchanged.
295
308
 
296
309
 
297
310
 
298
- // Public Options --------------------------------
299
-
300
- /**
301
- * Options for useFrame hook
302
- */
303
- interface UseFrameNextOptions {
304
- /** Optional stable id for the job. Auto-generated if not provided */
305
- id?: string
306
- /** Named phase to run in. Default: 'update' */
307
- phase?: string
308
- /** Run before this phase or job id */
309
- before?: string | string[]
310
- /** Run after this phase or job id */
311
- after?: string | string[]
312
- /** Priority within phase. Higher runs first. Default: 0 */
313
- priority?: number
314
- /** Max frames per second for this job */
315
- fps?: number
316
- /** If true, skip frames when behind. If false, try to catch up. Default: true */
317
- drop?: boolean
318
- /** Enable/disable without unregistering. Default: true */
319
- enabled?: boolean
320
- }
321
-
322
- /** Alias for UseFrameNextOptions */
323
- type UseFrameOptions = UseFrameNextOptions
324
-
325
- /**
326
- * Options for addPhase
327
- */
328
- interface AddPhaseOptions {
329
- /** Insert this phase before the specified phase */
330
- before?: string
331
- /** Insert this phase after the specified phase */
332
- after?: string
333
- }
334
-
335
- // Frame State --------------------------------
336
-
337
- /**
338
- * Timing-only state for independent/outside mode (no RootState)
339
- */
340
- interface FrameTimingState {
341
- /** High-resolution timestamp from RAF (ms) */
342
- time: number
343
- /** Time since last frame in seconds (for legacy compatibility with THREE.Clock) */
344
- delta: number
345
- /** Elapsed time since first frame in seconds (for legacy compatibility with THREE.Clock) */
346
- elapsed: number
347
- /** Incrementing frame counter */
348
- frame: number
349
- }
311
+ // Frame State (r3f-specific) --------------------------------
350
312
 
351
313
  /**
352
- * State passed to useFrame callbacks (extends RootState with timing)
314
+ * State passed to useFrame callbacks (extends RootState with timing).
353
315
  */
354
316
  interface FrameNextState extends RootState, FrameTimingState {}
355
317
 
356
318
  /** Alias for FrameNextState */
357
319
  type FrameState = FrameNextState
358
320
 
359
- // Root Options --------------------------------
321
+ // Callback Types (r3f-specific) --------------------------------
360
322
 
361
323
  /**
362
- * Options for registerRoot
324
+ * Callback function for useFrame. Receives the full r3f RootState plus timing.
363
325
  */
364
- interface RootOptions {
365
- /** State provider for callbacks. Optional in independent mode. */
366
- getState?: () => any
367
- /** Error handler for job errors. Falls back to console.error if not provided. */
368
- onError?: (error: Error) => void
369
- }
370
-
371
- // Callback Types --------------------------------
372
-
373
- /**
374
- * Callback function for useFrame
375
- */
376
- type FrameNextCallback = (state: FrameNextState, delta: number) => void
326
+ type FrameNextCallback = FrameCallback$1<RootState>
377
327
 
378
328
  /** Alias for FrameNextCallback */
379
329
  type FrameCallback = FrameNextCallback
380
330
 
381
- // Controls returned from useFrame --------------------------------
382
-
383
- /**
384
- * Controls object returned from useFrame hook
385
- */
386
- interface FrameNextControls {
387
- /** The job's unique ID */
388
- id: string
389
- /** Access to the global scheduler for frame loop control */
390
- scheduler: SchedulerApi
391
- /** Manually step this job only (bypasses FPS limiting) */
392
- step(timestamp?: number): void
393
- /** Manually step ALL jobs in the scheduler */
394
- stepAll(timestamp?: number): void
395
- /** Pause this job (set enabled=false) */
396
- pause(): void
397
- /** Resume this job (set enabled=true) */
398
- resume(): void
399
- /** Reactive paused state - automatically triggers re-render when changed */
400
- isPaused: boolean
401
- }
402
-
403
- /** Alias for FrameNextControls */
404
- type FrameControls = FrameNextControls
405
-
406
- // Scheduler Interface --------------------------------
407
-
408
- /**
409
- * Public interface for the global Scheduler
410
- */
411
- interface SchedulerApi {
412
- //* Phase Management --------------------------------
413
-
414
- /** Add a named phase to the scheduler */
415
- addPhase(name: string, options?: AddPhaseOptions): void
416
- /** Get the ordered list of phase names */
417
- readonly phases: string[]
418
- /** Check if a phase exists */
419
- hasPhase(name: string): boolean
420
-
421
- //* Root Management --------------------------------
422
-
423
- /** Register a root (Canvas) with the scheduler. Returns unsubscribe function. */
424
- registerRoot(id: string, options?: RootOptions): () => void
425
- /** Unregister a root */
426
- unregisterRoot(id: string): void
427
- /** Generate a unique root ID */
428
- generateRootId(): string
429
- /** Get the number of registered roots */
430
- getRootCount(): number
431
- /** Check if any root is registered and ready */
432
- readonly isReady: boolean
433
- /** Subscribe to root-ready event. Fires immediately if already ready. Returns unsubscribe. */
434
- onRootReady(callback: () => void): () => void
435
-
436
- //* Job Registration --------------------------------
437
-
438
- /** Register a job with the scheduler (returns unsubscribe function) */
439
- register(
440
- callback: FrameNextCallback,
441
- options?: {
442
- id?: string
443
- rootId?: string
444
- phase?: string
445
- before?: string | string[]
446
- after?: string | string[]
447
- priority?: number
448
- fps?: number
449
- drop?: boolean
450
- enabled?: boolean
451
- },
452
- ): () => void
453
- /** Update a job's options */
454
- updateJob(
455
- id: string,
456
- options: {
457
- priority?: number
458
- fps?: number
459
- drop?: boolean
460
- enabled?: boolean
461
- phase?: string
462
- before?: string | string[]
463
- after?: string | string[]
464
- },
465
- ): void
466
- /** Unregister a job by ID */
467
- unregister(id: string, rootId?: string): void
468
- /** Get the number of registered jobs */
469
- getJobCount(): number
470
- /** Get all job IDs */
471
- getJobIds(): string[]
472
-
473
- //* Global Jobs (for legacy addEffect/addAfterEffect) --------------------------------
474
-
475
- /** Register a global job (runs once per frame, not per-root). Returns unsubscribe function. */
476
- registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void
477
-
478
- //* Idle Callbacks (for legacy addTail) --------------------------------
479
-
480
- /** Register an idle callback (fires when loop stops). Returns unsubscribe function. */
481
- onIdle(callback: (timestamp: number) => void): () => void
482
-
483
- //* Frame Loop Control --------------------------------
484
-
485
- /** Start the scheduler loop */
486
- start(): void
487
- /** Stop the scheduler loop */
488
- stop(): void
489
- /** Check if the scheduler is running */
490
- readonly isRunning: boolean
491
- /** Get/set the frameloop mode ('always', 'demand', 'never') */
492
- frameloop: Frameloop
493
- /** Independent mode - runs without Canvas, callbacks receive timing-only state */
494
- independent: boolean
495
-
496
- //* Manual Stepping --------------------------------
497
-
498
- /** Manually step all jobs once (for frameloop='never' or testing) */
499
- step(timestamp?: number): void
500
- /** Manually step a single job by ID */
501
- stepJob(id: string, timestamp?: number): void
502
- /** Request frame(s) to be rendered (for frameloop='demand') */
503
- invalidate(frames?: number): void
504
-
505
- //* Per-Job Control --------------------------------
506
-
507
- /** Check if a job is paused */
508
- isJobPaused(id: string): boolean
509
- /** Pause a job */
510
- pauseJob(id: string): void
511
- /** Resume a job */
512
- resumeJob(id: string): void
513
- /** Subscribe to job state changes (for reactive isPaused). Returns unsubscribe function. */
514
- subscribeJobState(id: string, listener: () => void): () => void
515
- }
516
-
517
331
  //* Buffer Types (useBuffers) ========================================
518
332
 
519
333
  /**
@@ -538,6 +352,7 @@ type BufferLike =
538
352
  | Uint16Array
539
353
  | Int16Array
540
354
  | THREE$1.BufferAttribute // Base class for all buffer attributes
355
+ | THREE$1.InterleavedBufferAttribute
541
356
  | Node // TSL buffer nodes (instancedArray, storage)
542
357
 
543
358
  /** Flat record of buffer-like values (no nested scopes) */
@@ -549,6 +364,25 @@ type BufferRecord = Record<string, BufferLike>
549
364
  */
550
365
  type BufferStore = Record<string, BufferLike | BufferRecord>
551
366
 
367
+ //* Node Types (useNodes) ========================================
368
+
369
+ /**
370
+ * Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
371
+ * the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
372
+ * code passes through. Creators are constrained to this same type, so the shape a creator returns
373
+ * and the shape the store holds are one type by construction.
374
+ */
375
+ type NodeLike = TSLNodeType | LegacyTSLNodeLike
376
+
377
+ /** Flat record of TSL nodes (no nested scopes) */
378
+ type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
379
+
380
+ /**
381
+ * Node store that can contain both root-level nodes and scoped node objects.
382
+ * Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
383
+ */
384
+ type NodeStore = Record<string, NodeLike | NodeRecord>
385
+
552
386
  //* Storage Types (useGPUStorage) ========================================
553
387
 
554
388
  /**
@@ -563,7 +397,9 @@ type BufferStore = Record<string, BufferLike | BufferRecord>
563
397
  * ```
564
398
  */
565
399
  type StorageLike =
566
- | StorageTexture // GPU storage texture
400
+ | StorageTexture // 2D GPU storage texture
401
+ | Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
402
+ | StorageArrayTexture // 2D-array GPU storage texture
567
403
  | Data3DTexture // 3D texture (can be used as storage)
568
404
  | Node // TSL storage texture nodes (storageTexture)
569
405
 
@@ -682,14 +518,31 @@ interface InternalState {
682
518
  /** Container for child attachment (scene for root, original container for portals) */
683
519
  container?: THREE$1.Object3D
684
520
  /**
685
- * CanvasTarget for multi-canvas WebGPU rendering.
686
- * Created for all WebGPU canvases to support renderer sharing.
521
+ * The CanvasTarget this root sizes and renders through.
522
+ *
523
+ * A primary (`<Canvas id>`) owns the renderer's default target -- the one three itself built
524
+ * around the canvas element -- so sizing it is sizing the renderer. A secondary owns a target
525
+ * R3F created for its own element. Either way there is exactly one target per canvas element,
526
+ * and the canvas-target job makes it the renderer's active one before this root renders.
527
+ * Absent on WebGL and on an id-less WebGPU canvas, where the renderer is sized directly.
687
528
  * @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
688
529
  */
689
530
  canvasTarget?: CanvasTarget
531
+ /**
532
+ * Set when this root's canvas target has been resized and the backend's cached render pass
533
+ * descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
534
+ *
535
+ * Flushed by the canvas-target job in the `start` phase, which is the only place this root's
536
+ * target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
537
+ * whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
538
+ * invalidate some other canvas's descriptor instead.
539
+ *
540
+ * @see https://github.com/pmndrs/react-three-fiber/issues/3847
541
+ */
542
+ canvasTargetSizeDirty?: boolean
690
543
  /**
691
544
  * Whether multi-canvas rendering is active.
692
- * True when any canvas uses `target` prop to share a renderer.
545
+ * True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
693
546
  * When true, setCanvasTarget is called before each render.
694
547
  */
695
548
  isMultiCanvas?: boolean
@@ -787,8 +640,8 @@ interface RootState {
787
640
  setSize: (width?: number, height?: number, top?: number, left?: number) => void
788
641
  /** Shortcut to manual setting the pixel ratio */
789
642
  setDpr: (dpr: Dpr) => void
790
- /** Shortcut to setting frameloop flags */
791
- setFrameloop: (frameloop: Frameloop) => void
643
+ /** Shortcut to setting frameloop flags. No args resets to 'always'. */
644
+ setFrameloop: (frameloop?: Frameloop) => void
792
645
  /** Set error state to propagate to error boundary */
793
646
  setError: (error: Error | null) => void
794
647
  /** Current error state (null when no error) */
@@ -796,17 +649,19 @@ interface RootState {
796
649
  /** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
797
650
  uniforms: UniformStore
798
651
  /** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
799
- nodes: Record<string, any>
652
+ nodes: NodeStore
800
653
  /** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
801
654
  buffers: BufferStore
802
655
  /** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
803
656
  gpuStorage: StorageStore
804
- /** Global TSL texture nodes - use useTextures() hook for operations */
805
- textures: Map<string, any>
657
+ /** Global Texture registry (key → Texture, usually keyed by URL) - use useTextures() hook for access + lifecycle */
658
+ textures: Map<string, THREE$1.Texture>
659
+ /** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
660
+ _textureRefs: Map<string, number>
806
661
  /** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
807
- renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
662
+ renderPipeline: ThreeRenderPipeline | null
808
663
  /** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
809
- passes: Record<string, any>
664
+ passes: PassRecord
810
665
  /** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
811
666
  _hmrVersion: number
812
667
  /** Internal: whether setSize() has taken ownership of canvas dimensions */
@@ -894,12 +749,19 @@ type DefaultRendererProps = {
894
749
  */
895
750
  interface CanvasSchedulerConfig {
896
751
  /**
897
- * Render this canvas after another canvas completes.
898
- * Pass the `id` of another canvas.
752
+ * Run this Canvas root before the referenced Canvas root id(s).
753
+ */
754
+ before?: string | string[]
755
+ /**
756
+ * Run this Canvas root after the referenced Canvas root id(s).
757
+ */
758
+ after?: string | string[]
759
+ /**
760
+ * Numeric root order. Lower values run first.
899
761
  */
900
- after?: string
762
+ order?: number
901
763
  /**
902
- * Limit this canvas's render rate (frames per second).
764
+ * Limit this Canvas's default render job (frames per second).
903
765
  */
904
766
  fps?: number
905
767
  }
@@ -986,14 +848,17 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
986
848
  performance?: Partial<Omit<Performance, 'regress'>>
987
849
  /** Target pixel ratio. Can clamp between a range: `[min, max]` */
988
850
  dpr?: Dpr
989
- /** Props that go into the default raycaster */
990
- raycaster?: Partial<THREE$1.Raycaster>
851
+ /**
852
+ * Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
853
+ * so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
854
+ */
855
+ raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
991
856
  /** A `THREE.Scene` instance or props that go into the default scene */
992
857
  scene?: THREE$1.Scene | Partial<THREE$1.Scene>
993
858
  /** A `THREE.Camera` instance or props that go into the default camera */
994
859
  camera?: CameraProps
995
860
  /** An R3F event manager to manage elements' pointer events */
996
- events?: (store: RootStore) => EventManager<HTMLElement>
861
+ events?: (store: RootStore) => EventManager<Element>
997
862
  /** Callback after the canvas has rendered (but not yet committed) */
998
863
  onCreated?: (state: RootState) => void
999
864
  /** Response for pointer clicks that have missed any target */
@@ -1082,7 +947,6 @@ type InstanceProps<T = any, P = any> = ArgsProp<P> & {
1082
947
  object?: T
1083
948
  dispose?: null
1084
949
  attach?: AttachType<T>
1085
- onUpdate?: (self: T) => void
1086
950
  }
1087
951
 
1088
952
  interface Instance<O = any> {
@@ -1097,8 +961,6 @@ interface Instance<O = any> {
1097
961
  attach?: AttachType<O>
1098
962
  previousAttach?: any
1099
963
  isHidden: boolean
1100
- /** Deferred ref props to apply in commitMount */
1101
- deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
1102
964
  /** Set of props that have been applied via once() */
1103
965
  appliedOnce?: Set<string>
1104
966
  }
@@ -1224,7 +1086,7 @@ interface CanvasProps
1224
1086
  */
1225
1087
  resize?: Options
1226
1088
  /** The target where events are being subscribed to, default: the div that wraps canvas */
1227
- eventSource?: HTMLElement | React$1.RefObject<HTMLElement | null>
1089
+ eventSource?: Element | React$1.RefObject<Element | null>
1228
1090
  /** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
1229
1091
  eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
1230
1092
  /** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
@@ -1332,70 +1194,86 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
1332
1194
 
1333
1195
  type RenderTargetOptions = RenderTargetOptions$1
1334
1196
 
1335
- //* Global Types ==============================
1197
+ //* Global TSL Types ==============================
1336
1198
 
1337
1199
  declare global {
1338
- /** Uniform node type - a Node with a value property (matches Three.js UniformNode) */
1339
- interface UniformNode<T = unknown> extends Node {
1340
- value: T
1341
- }
1342
-
1343
1200
  /**
1344
- * ShaderCallable - the return type of Fn()
1345
- * A callable shader function node that can be invoked with parameters.
1346
- * The function returns a ShaderNodeObject when called.
1347
- *
1348
- * @example
1349
- * ```tsx
1350
- * // Define a shader function
1351
- * const blendColorFn = Fn(([color1, color2, factor]) => {
1352
- * return mix(color1, color2, factor)
1353
- * })
1354
- *
1355
- * // Type when retrieving from nodes store
1356
- * const { blendColorFn } = nodes as { blendColorFn: ShaderCallable }
1357
- *
1358
- * // Or with specific return type
1359
- * const { myFn } = nodes as { myFn: ShaderCallable<THREE.Node> }
1360
- * ```
1201
+ * Broad callable-node fallback for dynamic store readers.
1202
+ * Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
1361
1203
  */
1362
- type ShaderCallable<R extends Node = Node> = ((...params: unknown[]) => ShaderNodeObject<R>) & Node
1204
+ type CallableTSLNode = ((...params: never[]) => unknown) & {
1205
+ readonly shaderNode: unknown
1206
+ readonly id: number
1207
+ }
1363
1208
 
1364
- /**
1365
- * ShaderNodeRef - a ShaderNodeObject wrapper around a Node
1366
- * This is the common return type for TSL operations (add, mul, sin, etc.)
1367
- *
1368
- * @example
1369
- * ```tsx
1370
- * const { wobble } = nodes as { wobble: ShaderNodeRef }
1371
- * ```
1372
- */
1373
- type ShaderNodeRef<T extends Node = Node> = ShaderNodeObject<T>
1209
+ /** Legacy structural node accepted when at least one historical marker exists. */
1210
+ type LegacyTSLNodeLike = {
1211
+ label?: ((label: string) => unknown) | string
1212
+ setName?: (name: string) => unknown
1213
+ } & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
1214
+
1215
+ /** Node type accepted by broad dynamic node-store readers. */
1216
+ type TSLNodeType = three_webgpu.Node | CallableTSLNode
1374
1217
 
1375
1218
  /**
1376
- * TSLNodeType - Union of all common TSL node types
1377
- * Used by ScopedStore to properly type node access from the store.
1378
- *
1379
- * Includes:
1380
- * - Node: base Three.js node type
1381
- * - ShaderCallable: function nodes created with Fn()
1382
- * - ShaderNodeObject: wrapped nodes from TSL operations (sin, mul, mix, etc.)
1383
- *
1384
- * @example
1385
- * ```tsx
1386
- * // In useLocalNodes, nodes are typed as TSLNodeType
1387
- * const { positionNode, blendColorFn } = useLocalNodes(({ nodes }) => ({
1388
- * positionNode: nodes.myPosition, // Works - Node is in union
1389
- * blendColorFn: nodes.myFn, // Works - ShaderCallable is in union
1390
- * }))
1391
- *
1392
- * // Can narrow with type guard or assertion when needed
1393
- * if (typeof blendColorFn === 'function') {
1394
- * blendColorFn(someColor, 0.5)
1395
- * }
1396
- * ```
1219
+ * Derive Three's shader node type from an existing node or a supported raw input.
1220
+ * Existing InputNode generics take precedence over structural value normalization.
1221
+ * Both generics must be inferred because Three's UniformNode intersects an unknown-typed
1222
+ * InputNode base with its concrete InputNode specialization.
1397
1223
  */
1398
- type TSLNodeType = Node | ShaderCallable<Node> | ShaderNodeObject<Node>
1224
+ type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
1225
+ ? TNodeType
1226
+ : T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
1227
+ ? TNodeType
1228
+ : T extends number
1229
+ ? 'float'
1230
+ : T extends boolean
1231
+ ? 'bool'
1232
+ : T extends string | three_webgpu.Color | { r: number; g: number; b: number }
1233
+ ? 'color'
1234
+ : T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
1235
+ ? 'vec4'
1236
+ : T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
1237
+ ? 'vec3'
1238
+ : T extends three_webgpu.Vector2 | { x: number; y: number }
1239
+ ? 'vec2'
1240
+ : T extends three_webgpu.Matrix4
1241
+ ? 'mat4'
1242
+ : T extends three_webgpu.Matrix3
1243
+ ? 'mat3'
1244
+ : T extends three_webgpu.Matrix2
1245
+ ? 'mat2'
1246
+ : unknown
1247
+
1248
+ /** Derive the normalized JavaScript value stored by a uniform node. */
1249
+ type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
1250
+ ? TValue
1251
+ : T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
1252
+ ? TValue
1253
+ : T extends string | { r: number; g: number; b: number }
1254
+ ? three_webgpu.Color
1255
+ : T extends { x: number; y: number; z: number; w: number }
1256
+ ? three_webgpu.Vector4
1257
+ : T extends { x: number; y: number; z: number }
1258
+ ? three_webgpu.Vector3
1259
+ : T extends { x: number; y: number }
1260
+ ? three_webgpu.Vector2
1261
+ : T extends number
1262
+ ? number
1263
+ : T extends boolean
1264
+ ? boolean
1265
+ : T
1266
+
1267
+ /** Three's exact UniformNode with shader and value generics derived from an input. */
1268
+ type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
1269
+
1270
+ /** Preserve every input key while mapping values to exact Three uniform nodes. */
1271
+ type UniformNodesFor<T extends UniformInputRecord> = {
1272
+ [K in keyof T]: UniformNodeFor<T[K]>
1273
+ }
1274
+
1275
+ /** Backward-compatible single-parameter uniform alias. */
1276
+ type UniformNode<T = unknown> = UniformNodeFor<T>
1399
1277
 
1400
1278
  /** Flat record of uniform nodes (no nested scopes) */
1401
1279
  type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
@@ -1420,7 +1298,7 @@ declare global {
1420
1298
  * Acceptable input values for useUniforms - raw values that get converted to UniformNodes
1421
1299
  * Supports:
1422
1300
  * - Primitives: number, string (color), boolean
1423
- * - Three.js types: Color, Vector2/3/4, Matrix3/4, Euler, Quaternion
1301
+ * - Three.js types: Color, Vector2/3/4, Matrix2/3/4
1424
1302
  * - Plain objects: { x, y, z, w } converted to vectors
1425
1303
  * - TSL nodes: color(), vec3(), float() for type casting
1426
1304
  * - UniformNode: existing uniforms (reused as-is)
@@ -1433,227 +1311,124 @@ declare global {
1433
1311
  | three_webgpu.Vector2
1434
1312
  | three_webgpu.Vector3
1435
1313
  | three_webgpu.Vector4
1314
+ | three_webgpu.Matrix2
1436
1315
  | three_webgpu.Matrix3
1437
1316
  | three_webgpu.Matrix4
1438
- | three_webgpu.Euler
1439
- | three_webgpu.Quaternion
1440
- | { x: number; y?: number; z?: number; w?: number } // Plain objects converted to vectors
1317
+ | { x: number; y: number }
1318
+ | { x: number; y: number; z: number }
1319
+ | { x: number; y: number; z: number; w: number }
1441
1320
  | { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
1442
- | Node // TSL nodes like color(), vec3(), float() for type casting
1321
+ | three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
1443
1322
  | UniformNode
1444
1323
 
1445
1324
  /** Input record for useUniforms - accepts raw values or UniformNodes */
1446
1325
  type UniformInputRecord = Record<string, UniformValue>
1447
1326
  }
1448
1327
 
1449
- //* Module Augmentation ==============================
1450
-
1451
- declare module 'three/tsl' {
1328
+ declare global {
1452
1329
  /**
1453
- * Fn with array parameter destructuring
1454
- * @example Fn(([uv, skew]) => { ... })
1330
+ * three's own render pipeline type. Named here so the rest of R3F refers to three's shape
1331
+ * rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
1332
+ * is r185, so the new name is the only one.
1455
1333
  */
1456
- export function Fn<R extends Node = Node>(
1457
- jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
1458
- ): ShaderCallable<R>
1334
+ type ThreeRenderPipeline = three_webgpu.RenderPipeline
1459
1335
 
1460
1336
  /**
1461
- * Fn with object parameter destructuring
1462
- * @example Fn(({ color, intensity }) => { ... })
1337
+ * The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
1338
+ * `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
1339
+ * `getTextureNode`, `setMRT` and `dispose` track the installed version.
1463
1340
  */
1464
- export function Fn<T extends Record<string, unknown>, R extends Node = Node>(
1465
- jsFunc: (inputs: T) => ShaderNodeObject<R>,
1466
- ): ShaderCallable<R>
1341
+ type ScenePassNode = three_webgpu.PassNode
1467
1342
 
1468
1343
  /**
1469
- * Fn with array params + layout
1470
- * @example Fn(([a, b]) => { ... }, { layout: [...] })
1344
+ * Pass record - stores TSL pass nodes for render pipeline.
1345
+ *
1346
+ * `scenePass` is the only key the library owns. It is optional here because this is also the
1347
+ * shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
1348
+ * or `clearPasses()`. Inside the callbacks it is always present; see
1349
+ * {@link RenderPipelineCallbackState}.
1350
+ *
1351
+ * Every other key is user-registered, via a callback's return value. Those are TSL nodes of
1352
+ * any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
1353
+ * `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
1354
+ * site when you need a member, e.g. `passes.velocity as TextureNode`.
1355
+ *
1356
+ * The index signature admits `undefined` because a key may simply not be registered, and
1357
+ * because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
1358
+ * optional property whose type excludes `undefined` from the index signature is an error
1359
+ * (TS2411) for every consumer compiling these declarations.
1471
1360
  */
1472
- export function Fn<R extends Node = Node>(
1473
- jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
1474
- layout: { layout?: unknown },
1475
- ): ShaderCallable<R>
1361
+ interface PassRecord {
1362
+ scenePass?: ScenePassNode
1363
+ [key: string]: three_webgpu.Node | undefined
1364
+ }
1476
1365
 
1477
1366
  /**
1478
- * Fn with object params + layout
1367
+ * State passed to pipeline callbacks after the active pipeline has been created.
1368
+ *
1369
+ * `passes.scenePass` is required here: the hook installs the default scene pass before either
1370
+ * callback runs, so callbacks can use it without a guard or a cast.
1371
+ *
1372
+ * `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
1373
+ * the legacy renderer before either callback can run, so a callback never sees WebGL.
1479
1374
  */
1480
- export function Fn<T extends Record<string, unknown>, R extends Node = Node>(
1481
- jsFunc: (inputs: T) => ShaderNodeObject<R>,
1482
- layout: { layout?: unknown },
1483
- ): ShaderCallable<R>
1484
- }
1485
-
1486
- /**
1487
- * RenderPipeline Types for useRenderPipeline hook (WebGPU only)
1488
- */
1489
-
1490
-
1375
+ type RenderPipelineCallbackState = RootState & {
1376
+ renderPipeline: ThreeRenderPipeline
1377
+ passes: PassRecord & { scenePass: ScenePassNode }
1378
+ renderer: three_webgpu.WebGPURenderer
1379
+ isLegacy: false
1380
+ }
1491
1381
 
1492
- declare global {
1493
- /** Pass record - stores TSL pass nodes for render pipeline */
1494
- type PassRecord = Record<string, any>
1382
+ /**
1383
+ * What a callback may return to register entries into `state.passes`.
1384
+ *
1385
+ * `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
1386
+ * created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
1387
+ * store entry would leave the store pointing at a node the hook never disposes, and the hook
1388
+ * disposing a pass nothing references. So returning it is a type error.
1389
+ */
1390
+ type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
1495
1391
 
1496
1392
  /** Setup callback - runs first to configure MRT, create additional passes */
1497
- type RenderPipelineSetupCallback = (state: RootState) => PassRecord | void
1393
+ type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1498
1394
 
1499
1395
  /** Main callback - runs second to configure outputNode, create effect passes */
1500
- type RenderPipelineMainCallback = (state: RootState) => PassRecord | void
1396
+ type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1501
1397
 
1502
- /** Return type for useRenderPipeline hook */
1503
- interface UseRenderPipelineReturn {
1398
+ /** The imperative half of useRenderPipeline's return value, present in every state */
1399
+ interface UseRenderPipelineActions {
1504
1400
  /** Current passes from state */
1505
1401
  passes: PassRecord
1506
- /** RenderPipeline instance (null if not initialized) */
1507
- renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
1508
1402
  /** Clear all passes from state */
1509
1403
  clearPasses: () => void
1510
1404
  /** Reset RenderPipeline entirely (clears PP + passes) */
1511
1405
  reset: () => void
1512
1406
  /** Re-run setup/main callbacks with current closure values */
1513
1407
  rebuild: () => void
1514
- /** True when RenderPipeline is configured and ready */
1515
- isReady: boolean
1516
- }
1517
- }
1518
-
1519
- //* useFrameNext Types ==============================
1520
-
1521
-
1522
-
1523
- //* Global Type Declarations ==============================
1524
-
1525
- declare global {
1526
- // Job --------------------------------
1527
-
1528
- /**
1529
- * Internal job representation in the scheduler
1530
- */
1531
- interface Job {
1532
- /** Unique identifier */
1533
- id: string
1534
- /** The callback to execute */
1535
- callback: FrameNextCallback
1536
- /** Phase this job belongs to */
1537
- phase: string
1538
- /** Run before these phases/job ids */
1539
- before: Set<string>
1540
- /** Run after these phases/job ids */
1541
- after: Set<string>
1542
- /** Priority within phase (higher first) */
1543
- priority: number
1544
- /** Insertion order for deterministic tie-breaking */
1545
- index: number
1546
- /** Max FPS for this job (undefined = no limit) */
1547
- fps?: number
1548
- /** Drop frames when behind (true) or catch up (false) */
1549
- drop: boolean
1550
- /** Last run timestamp (ms) */
1551
- lastRun?: number
1552
- /** Whether job is enabled */
1553
- enabled: boolean
1554
- /** Internal flag: system jobs (like default render) don't block user render takeover */
1555
- system?: boolean
1556
- }
1557
-
1558
- // Phase Graph --------------------------------
1559
-
1560
- /**
1561
- * A node in the phase graph
1562
- */
1563
- interface PhaseNode {
1564
- /** Phase name */
1565
- name: string
1566
- /** Whether this was auto-generated from a before/after constraint */
1567
- isAutoGenerated: boolean
1568
- }
1569
-
1570
- /**
1571
- * Options for creating a job from hook options
1572
- */
1573
- interface JobOptions {
1574
- id?: string
1575
- phase?: string
1576
- before?: string | string[]
1577
- after?: string | string[]
1578
- priority?: number
1579
- fps?: number
1580
- drop?: boolean
1581
- enabled?: boolean
1582
- }
1583
-
1584
- // Frame Loop State --------------------------------
1585
-
1586
- /**
1587
- * Internal frame loop state
1588
- */
1589
- interface FrameLoopState {
1590
- /** Whether the loop is running */
1591
- running: boolean
1592
- /** Current RAF handle */
1593
- rafHandle: number | null
1594
- /** Last frame timestamp in ms (null = uninitialized) */
1595
- lastTime: number | null
1596
- /** Frame counter */
1597
- frameCount: number
1598
- /** Elapsed time since first frame in ms */
1599
- elapsedTime: number
1600
- /** createdAt timestamp in ms */
1601
- createdAt: number
1602
- }
1603
-
1604
- // Root Entry --------------------------------
1605
-
1606
- /**
1607
- * Internal representation of a registered root (Canvas).
1608
- * Tracks jobs and manages rebuild state for this root.
1609
- * @internal
1610
- */
1611
- interface RootEntry {
1612
- /** Unique identifier for this root */
1613
- id: string
1614
- /** Function to get the root's current state. Returns any to support independent mode. */
1615
- getState: () => any
1616
- /** Map of job IDs to Job objects */
1617
- jobs: Map<string, Job>
1618
- /** Cached sorted job list for execution order */
1619
- sortedJobs: Job[]
1620
- /** Whether sortedJobs needs rebuilding */
1621
- needsRebuild: boolean
1622
- }
1623
-
1624
- /**
1625
- * Internal representation of a global job (deprecated API).
1626
- * Global jobs run once per frame, not per-root.
1627
- * Used by legacy addEffect/addAfterEffect APIs.
1628
- * @internal
1629
- * @deprecated Use useFrame with phases instead
1630
- */
1631
- interface GlobalJob {
1632
- /** Unique identifier for this global job */
1633
- id: string
1634
- /** Callback invoked with RAF timestamp in ms */
1635
- callback: (timestamp: number) => void
1636
1408
  }
1637
1409
 
1638
- // HMR Support --------------------------------
1639
-
1640
1410
  /**
1641
- * Hot Module Replacement data structure for preserving scheduler state
1642
- * @internal
1643
- */
1644
- interface HMRData {
1645
- /** Shared data object for storing values across reloads */
1646
- data: Record<string, any>
1647
- /** Optional function to accept HMR updates */
1648
- accept?: () => void
1649
- }
1650
-
1651
- // Default Phases --------------------------------
1652
-
1653
- /**
1654
- * Default phase names for the scheduler
1411
+ * Return type for useRenderPipeline hook, discriminated on `isReady`.
1412
+ *
1413
+ * `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
1414
+ * callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
1415
+ * `clearPasses()` empties the record while leaving the pipeline in place.
1655
1416
  */
1656
- type DefaultPhase = 'start' | 'input' | 'physics' | 'update' | 'render' | 'finish'
1417
+ type UseRenderPipelineReturn = UseRenderPipelineActions &
1418
+ (
1419
+ | {
1420
+ /** True when RenderPipeline is configured and ready */
1421
+ isReady: true
1422
+ /** RenderPipeline instance */
1423
+ renderPipeline: ThreeRenderPipeline
1424
+ }
1425
+ | {
1426
+ /** False until the pipeline has been created */
1427
+ isReady: false
1428
+ /** Not initialized yet, or torn down by reset() */
1429
+ renderPipeline: null
1430
+ }
1431
+ )
1657
1432
  }
1658
1433
 
1659
1434
  type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
@@ -1732,10 +1507,11 @@ type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
1732
1507
 
1733
1508
  /**
1734
1509
  * For node material properties (colorNode, positionNode, etc.), accept broader types
1735
- * since @types/three has broken inheritance for TSL node subclasses.
1510
+ * since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
1511
+ * `nodeType`, so this structural key test remains neutral to the selected Three entry.
1736
1512
  */
1737
1513
  type NodeProps<P> = {
1738
- [K in keyof P as P[K] extends Node | null ? K : never]?: TSLNodeInput
1514
+ [K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
1739
1515
  }
1740
1516
 
1741
1517
  interface ReactProps<P> {
@@ -1756,11 +1532,29 @@ type ThreeToJSXElements<T extends Record<string, any>> = {
1756
1532
  [K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
1757
1533
  }
1758
1534
 
1535
+ /** Method names of Object3D, excluded from the `primitive` element's typed props. */
1536
+ type Object3DMethod = NonNullable<
1537
+ {
1538
+ [K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
1539
+ }[keyof Object3D]
1540
+ >
1541
+
1759
1542
  type ThreeExports = typeof THREE
1760
1543
  type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
1761
1544
 
1762
1545
  interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
1763
- primitive: Omit<ThreeElement<any>, 'args'> & { object: object }
1546
+ /**
1547
+ * `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
1548
+ * Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
1549
+ * untyped, and any other prop is accepted and applied to the object by name. Object3D's own
1550
+ * methods are left out of the typed surface: they return `this`, so a subclass element's
1551
+ * props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
1552
+ */
1553
+ primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | Object3DMethod> & {
1554
+ object: object
1555
+ ref?: React.Ref<any>
1556
+ [prop: string]: unknown
1557
+ }
1764
1558
  // Conflicts with DOM types can be accessed through a three* prefix
1765
1559
  threeAudio: ThreeElementsImpl['audio']
1766
1560
  threeSource: ThreeElementsImpl['source']
@@ -1801,6 +1595,7 @@ type three_d_Matrix3 = Matrix3;
1801
1595
  type three_d_Matrix4 = Matrix4;
1802
1596
  type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
1803
1597
  type three_d_NodeProps<P> = NodeProps<P>;
1598
+ type three_d_Object3DMethod = Object3DMethod;
1804
1599
  type three_d_Quaternion = Quaternion;
1805
1600
  type three_d_RaycastableRepresentation = RaycastableRepresentation;
1806
1601
  type three_d_ReactProps<P> = ReactProps<P>;
@@ -1815,7 +1610,7 @@ type three_d_Vector3 = Vector3;
1815
1610
  type three_d_Vector4 = Vector4;
1816
1611
  type three_d_VectorRepresentation = VectorRepresentation;
1817
1612
  declare namespace three_d {
1818
- 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_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 };
1613
+ 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 };
1819
1614
  }
1820
1615
 
1821
1616
  /**
@@ -1825,7 +1620,7 @@ declare namespace three_d {
1825
1620
  * a single WebGPURenderer using Three.js CanvasTarget API.
1826
1621
  *
1827
1622
  * Primary canvas: Has `id` prop, creates its own renderer, registers here
1828
- * Secondary canvas: Has `target="id"` prop, shares primary's renderer via CanvasTarget
1623
+ * Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
1829
1624
  */
1830
1625
 
1831
1626
  interface PrimaryCanvasEntry {
@@ -1893,12 +1688,23 @@ type EnvironmentLoaderProps = {
1893
1688
  * const texture = useEnvironment({ preset: 'sunset' })
1894
1689
  * ```
1895
1690
  */
1896
- declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture;
1691
+ declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
1897
1692
  declare namespace useEnvironment {
1898
1693
  var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
1899
1694
  var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
1900
1695
  }
1901
- type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'encoding'>;
1696
+ /**
1697
+ * Options accepted by `useEnvironment.preload`.
1698
+ *
1699
+ * `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
1700
+ * applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
1701
+ * advertise an option this function silently ignores.
1702
+ *
1703
+ * This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
1704
+ * `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
1705
+ * type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
1706
+ */
1707
+ type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
1902
1708
  type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
1903
1709
 
1904
1710
  /**
@@ -1942,9 +1748,9 @@ type EnvironmentProps = {
1942
1748
  blur?: number;
1943
1749
  backgroundBlurriness?: number;
1944
1750
  backgroundIntensity?: number;
1945
- backgroundRotation?: Euler$3;
1751
+ backgroundRotation?: Euler;
1946
1752
  environmentIntensity?: number;
1947
- environmentRotation?: Euler$3;
1753
+ environmentRotation?: Euler;
1948
1754
  map?: Texture$1;
1949
1755
  preset?: PresetsType;
1950
1756
  scene?: Scene | React$1.RefObject<Scene>;
@@ -2028,7 +1834,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
2028
1834
  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;
2029
1835
  declare module '@react-three/fiber' {
2030
1836
  interface ThreeElements {
2031
- groundProjectedEnvImpl: ThreeElement$1<typeof GroundedSkybox>;
1837
+ groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
2032
1838
  }
2033
1839
  }
2034
1840
  /**
@@ -2128,6 +1934,24 @@ declare module '@react-three/fiber' {
2128
1934
  */
2129
1935
  declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
2130
1936
 
1937
+ /**
1938
+ * Moves every trace of interactivity from one object to its replacement, for reconstruction.
1939
+ *
1940
+ * When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
1941
+ * instance. Removing the old object from the interaction state and registering the new one from
1942
+ * scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
1943
+ * the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
1944
+ * is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
1945
+ * swap the user never asked to see (#3744).
1946
+ *
1947
+ * Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
1948
+ * left alone — releasing and re-acquiring it is precisely the glitch being avoided.
1949
+ *
1950
+ * Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
1951
+ * the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
1952
+ * cannot outlive the object it described.
1953
+ */
1954
+ declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
2131
1955
  declare function removeInteractivity(store: RootStore, object: Object3D): void;
2132
1956
  declare function createEvents(store: RootStore): {
2133
1957
  handlePointer: (name: string) => (event: DomEvent) => void;
@@ -2135,7 +1959,7 @@ declare function createEvents(store: RootStore): {
2135
1959
  processDeferredPointer: (event: DomEvent, pointerId: number) => void;
2136
1960
  };
2137
1961
  /** Default R3F event manager for web */
2138
- declare function createPointerEvents(store: RootStore): EventManager<HTMLElement>;
1962
+ declare function createPointerEvents(store: RootStore): EventManager<Element>;
2139
1963
 
2140
1964
  /**
2141
1965
  * Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
@@ -2148,389 +1972,27 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
2148
1972
  * Note: this hook's caller must be wrapped with `React.Suspense`
2149
1973
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
2150
1974
  */
2151
- declare function useLoader<I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void): I extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
1975
+ 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>;
2152
1976
  declare namespace useLoader {
2153
- var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
2154
- var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
1977
+ 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;
1978
+ var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
2155
1979
  var loader: typeof getLoader;
2156
1980
  }
2157
1981
 
2158
- /**
2159
- * Global Singleton Scheduler - manages the frame loop and job execution for ALL R3F roots.
2160
- *
2161
- * Features:
2162
- * - Single RAF loop for entire application
2163
- * - Root registration (multiple Canvas support)
2164
- * - Global phases for addEffect/addAfterEffect (deprecated)
2165
- * - Per-root job management with phases, priorities, FPS throttling
2166
- * - onIdle callbacks for addTail (deprecated)
2167
- * - Demand mode support via invalidate()
2168
- */
2169
- declare class Scheduler {
2170
- private static readonly INSTANCE_KEY;
2171
- private static get instance();
2172
- private static set instance(value);
2173
- /**
2174
- * Get the global scheduler instance (creates if doesn't exist).
2175
- * Uses HMR data to preserve instance across hot reloads.
2176
- * @returns {Scheduler} The singleton scheduler instance
2177
- */
2178
- static get(): Scheduler;
2179
- /**
2180
- * Reset the singleton instance. Stops the loop and clears all state.
2181
- * Primarily used for testing to ensure clean state between tests.
2182
- * @returns {void}
2183
- */
2184
- static reset(): void;
2185
- private roots;
2186
- private phaseGraph;
2187
- private loopState;
2188
- private stoppedTime;
2189
- private nextRootIndex;
2190
- private globalBeforeJobs;
2191
- private globalAfterJobs;
2192
- private nextGlobalIndex;
2193
- private idleCallbacks;
2194
- private nextJobIndex;
2195
- private jobStateListeners;
2196
- private pendingFrames;
2197
- private _frameloop;
2198
- private _independent;
2199
- private errorHandler;
2200
- private rootReadyCallbacks;
2201
- get phases(): string[];
2202
- get frameloop(): Frameloop;
2203
- set frameloop(mode: Frameloop);
2204
- get isRunning(): boolean;
2205
- get isReady(): boolean;
2206
- get independent(): boolean;
2207
- set independent(value: boolean);
2208
- constructor();
2209
- /**
2210
- * Register a root (Canvas) with the scheduler.
2211
- * The first root to register starts the RAF loop (if frameloop='always').
2212
- * @param {string} id - Unique identifier for this root
2213
- * @param {RootOptions} [options] - Optional configuration with getState and onError callbacks
2214
- * @returns {() => void} Unsubscribe function to remove this root
2215
- */
2216
- registerRoot(id: string, options?: RootOptions): () => void;
2217
- /**
2218
- * Unregister a root from the scheduler.
2219
- * Cleans up all job state listeners for this root's jobs.
2220
- * The last root to unregister stops the RAF loop.
2221
- * @param {string} id - The root ID to unregister
2222
- * @returns {void}
2223
- */
2224
- unregisterRoot(id: string): void;
2225
- /**
2226
- * Subscribe to be notified when a root becomes available.
2227
- * Fires immediately if a root already exists.
2228
- * @param {() => void} callback - Function called when first root registers
2229
- * @returns {() => void} Unsubscribe function
2230
- */
2231
- onRootReady(callback: () => void): () => void;
2232
- /**
2233
- * Notify all registered root-ready callbacks.
2234
- * Called when the first root registers.
2235
- * @returns {void}
2236
- * @private
2237
- */
2238
- private notifyRootReady;
2239
- /**
2240
- * Ensure a default root exists for independent mode.
2241
- * Creates a minimal root with no state provider.
2242
- * @returns {void}
2243
- * @private
2244
- */
2245
- private ensureDefaultRoot;
2246
- /**
2247
- * Trigger error handling for job errors.
2248
- * Uses the bound error handler if available, otherwise logs to console.
2249
- * @param {Error} error - The error to handle
2250
- * @returns {void}
2251
- */
2252
- triggerError(error: Error): void;
2253
- /**
2254
- * Add a named phase to the scheduler's execution order.
2255
- * Marks all roots for rebuild to incorporate the new phase.
2256
- * @param {string} name - The phase name (e.g., 'physics', 'postprocess')
2257
- * @param {AddPhaseOptions} [options] - Positioning options (before/after other phases)
2258
- * @returns {void}
2259
- * @example
2260
- * scheduler.addPhase('physics', { before: 'update' });
2261
- * scheduler.addPhase('postprocess', { after: 'render' });
2262
- */
2263
- addPhase(name: string, options?: AddPhaseOptions): void;
2264
- /**
2265
- * Check if a phase exists in the scheduler.
2266
- * @param {string} name - The phase name to check
2267
- * @returns {boolean} True if the phase exists
2268
- */
2269
- hasPhase(name: string): boolean;
2270
- /**
2271
- * Register a global job that runs once per frame (not per-root).
2272
- * Used internally by deprecated addEffect/addAfterEffect APIs.
2273
- * @param {'before' | 'after'} phase - When to run: 'before' all roots or 'after' all roots
2274
- * @param {string} id - Unique identifier for this global job
2275
- * @param {(timestamp: number) => void} callback - Function called each frame with RAF timestamp
2276
- * @returns {() => void} Unsubscribe function to remove this global job
2277
- * @deprecated Use useFrame with phases instead
2278
- */
2279
- registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void;
2280
- /**
2281
- * Register an idle callback that fires when the loop stops.
2282
- * Used internally by deprecated addTail API.
2283
- * @param {(timestamp: number) => void} callback - Function called when loop becomes idle
2284
- * @returns {() => void} Unsubscribe function to remove this idle callback
2285
- * @deprecated Use demand mode with invalidate() instead
2286
- */
2287
- onIdle(callback: (timestamp: number) => void): () => void;
2288
- /**
2289
- * Notify all registered idle callbacks.
2290
- * Called when the loop stops in demand mode.
2291
- * @param {number} timestamp - The RAF timestamp when idle occurred
2292
- * @returns {void}
2293
- * @private
2294
- */
2295
- private notifyIdle;
2296
- /**
2297
- * Register a job (frame callback) with a specific root.
2298
- * This is the core registration method used by useFrame internally.
2299
- * @param {FrameNextCallback} callback - The function to call each frame
2300
- * @param {JobOptions & { rootId?: string; system?: boolean }} [options] - Job configuration
2301
- * @param {string} [options.rootId] - Target root ID (defaults to first registered root)
2302
- * @param {string} [options.id] - Unique job ID (auto-generated if not provided)
2303
- * @param {string} [options.phase] - Execution phase (defaults to 'update')
2304
- * @param {number} [options.priority] - Priority within phase (higher = earlier, default 0)
2305
- * @param {number} [options.fps] - FPS throttle limit
2306
- * @param {boolean} [options.drop] - Drop frames when behind (default true)
2307
- * @param {boolean} [options.enabled] - Whether job is active (default true)
2308
- * @param {boolean} [options.system] - Internal flag for system jobs (not user-facing)
2309
- * @returns {() => void} Unsubscribe function to remove this job
2310
- */
2311
- register(callback: FrameNextCallback, options?: JobOptions & {
2312
- rootId?: string;
2313
- system?: boolean;
2314
- }): () => void;
2315
- /**
2316
- * Unregister a job by its ID.
2317
- * Searches all roots if rootId is not provided.
2318
- * @param {string} id - The job ID to unregister
2319
- * @param {string} [rootId] - Optional root ID to search (searches all if not provided)
2320
- * @returns {void}
2321
- */
2322
- unregister(id: string, rootId?: string): void;
2323
- /**
2324
- * Update a job's options dynamically.
2325
- * Searches all roots to find the job by ID.
2326
- * Phase/constraint changes trigger a rebuild of the sorted job list.
2327
- * @param {string} id - The job ID to update
2328
- * @param {Partial<JobOptions>} options - The options to update
2329
- * @returns {void}
2330
- */
2331
- updateJob(id: string, options: Partial<JobOptions>): void;
2332
- /**
2333
- * Check if a job is currently paused (disabled).
2334
- * @param {string} id - The job ID to check
2335
- * @returns {boolean} True if the job exists and is paused
2336
- */
2337
- isJobPaused(id: string): boolean;
2338
- /**
2339
- * Subscribe to state changes for a specific job.
2340
- * Listener is called when job is paused or resumed.
2341
- * @param {string} id - The job ID to subscribe to
2342
- * @param {() => void} listener - Callback invoked on state changes
2343
- * @returns {() => void} Unsubscribe function
2344
- */
2345
- subscribeJobState(id: string, listener: () => void): () => void;
2346
- /**
2347
- * Notify all listeners that a job's state has changed.
2348
- * @param {string} id - The job ID that changed
2349
- * @returns {void}
2350
- * @private
2351
- */
2352
- private notifyJobStateChange;
2353
- /**
2354
- * Pause a job by ID (sets enabled=false).
2355
- * Notifies any subscribed state listeners.
2356
- * @param {string} id - The job ID to pause
2357
- * @returns {void}
2358
- */
2359
- pauseJob(id: string): void;
2360
- /**
2361
- * Resume a paused job by ID (sets enabled=true).
2362
- * Resets job timing to prevent frame accumulation.
2363
- * Notifies any subscribed state listeners.
2364
- * @param {string} id - The job ID to resume
2365
- * @returns {void}
2366
- */
2367
- resumeJob(id: string): void;
2368
- /**
2369
- * Start the requestAnimationFrame loop.
2370
- * Resets timing state (elapsedTime, frameCount) on start.
2371
- * No-op if already running.
2372
- * @returns {void}
2373
- */
2374
- start(): void;
2375
- /**
2376
- * Stop the requestAnimationFrame loop.
2377
- * Cancels any pending RAF callback.
2378
- * No-op if not running.
2379
- * @returns {void}
2380
- */
2381
- stop(): void;
2382
- /**
2383
- * Request frames to be rendered in demand mode.
2384
- * Accumulates pending frames (capped at 60) and starts the loop if not running.
2385
- * No-op if frameloop is not 'demand'.
2386
- * @param {number} [frames=1] - Number of frames to request
2387
- * @param {boolean} [stackFrames=false] - Whether to add frames to existing pending count
2388
- * - `false` (default): Sets pending frames to the specified value (replaces existing count)
2389
- * - `true`: Adds frames to existing pending count (useful for accumulating invalidations)
2390
- * @returns {void}
2391
- * @example
2392
- * // Request a single frame render
2393
- * scheduler.invalidate();
2394
- *
2395
- * @example
2396
- * // Request 5 frames (e.g., for animations)
2397
- * scheduler.invalidate(5);
2398
- *
2399
- * @example
2400
- * // Set pending frames to exactly 3 (don't stack with existing)
2401
- * scheduler.invalidate(3, false);
2402
- *
2403
- * @example
2404
- * // Add 2 more frames to existing pending count
2405
- * scheduler.invalidate(2, true);
2406
- */
2407
- invalidate(frames?: number, stackFrames?: boolean): void;
2408
- /**
2409
- * Reset timing state for deterministic testing.
2410
- * Preserves jobs and roots but resets lastTime, frameCount, elapsedTime, etc.
2411
- * @returns {void}
2412
- */
2413
- resetTiming(): void;
2414
- /**
2415
- * Manually execute a single frame for all roots.
2416
- * Useful for frameloop='never' mode or testing scenarios.
2417
- * @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
2418
- * @returns {void}
2419
- * @example
2420
- * // Manual control mode
2421
- * scheduler.frameloop = 'never';
2422
- * scheduler.step(); // Execute one frame
2423
- */
2424
- step(timestamp?: number): void;
2425
- /**
2426
- * Manually execute a single job by its ID.
2427
- * Useful for testing individual job callbacks in isolation.
2428
- * @param {string} id - The job ID to step
2429
- * @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
2430
- * @returns {void}
2431
- */
2432
- stepJob(id: string, timestamp?: number): void;
2433
- /**
2434
- * Main RAF loop callback.
2435
- * Executes frame, handles demand mode, and schedules next frame.
2436
- * @param {number} timestamp - RAF timestamp in milliseconds
2437
- * @returns {void}
2438
- * @private
2439
- */
2440
- private loop;
2441
- /**
2442
- * Execute a single frame across all roots.
2443
- * Order: globalBefore → each root's jobs → globalAfter
2444
- * @param {number} timestamp - RAF timestamp in milliseconds
2445
- * @returns {void}
2446
- * @private
2447
- */
2448
- private executeFrame;
2449
- /**
2450
- * Run all global jobs from a job map.
2451
- * Catches and logs errors without stopping execution.
2452
- * @param {Map<string, GlobalJob>} jobs - The global jobs map to execute
2453
- * @param {number} timestamp - RAF timestamp in milliseconds
2454
- * @returns {void}
2455
- * @private
2456
- */
2457
- private runGlobalJobs;
2458
- /**
2459
- * Execute all jobs for a single root in sorted order.
2460
- * Rebuilds sorted job list if needed, then dispatches each job.
2461
- * Errors are caught and propagated via triggerError.
2462
- * @param {RootEntry} root - The root entry to tick
2463
- * @param {number} timestamp - RAF timestamp in milliseconds
2464
- * @param {number} delta - Time since last frame in seconds
2465
- * @returns {void}
2466
- * @private
2467
- */
2468
- private tickRoot;
2469
- /**
2470
- * Get the total number of registered jobs across all roots.
2471
- * Includes both per-root jobs and global before/after jobs.
2472
- * @returns {number} Total job count
2473
- */
2474
- getJobCount(): number;
2475
- /**
2476
- * Get all registered job IDs across all roots.
2477
- * Includes both per-root jobs and global before/after jobs.
2478
- * @returns {string[]} Array of all job IDs
2479
- */
2480
- getJobIds(): string[];
2481
- /**
2482
- * Get the number of registered roots (Canvas instances).
2483
- * @returns {number} Number of registered roots
2484
- */
2485
- getRootCount(): number;
2486
- /**
2487
- * Check if any user (non-system) jobs are registered in a specific phase.
2488
- * Used by the default render job to know if a user has taken over rendering.
2489
- *
2490
- * @param phase The phase to check
2491
- * @param rootId Optional root ID to check (checks all roots if not provided)
2492
- * @returns true if any user jobs exist in the phase
2493
- */
2494
- hasUserJobsInPhase(phase: string, rootId?: string): boolean;
2495
- /**
2496
- * Generate a unique root ID for automatic root registration.
2497
- * @returns {string} A unique root ID in the format 'root_N'
2498
- */
2499
- generateRootId(): string;
2500
- /**
2501
- * Generate a unique job ID.
2502
- * @returns {string} A unique job ID in the format 'job_N'
2503
- * @private
2504
- */
2505
- private generateJobId;
2506
- /**
2507
- * Normalize before/after constraints to a Set.
2508
- * Handles undefined, single string, or array inputs.
2509
- * @param {string | string[] | undefined} value - The constraint value(s)
2510
- * @returns {Set<string>} Normalized Set of constraint strings
2511
- * @private
2512
- */
2513
- private normalizeConstraints;
2514
- }
2515
- /**
2516
- * Get the global scheduler instance.
2517
- * Creates one if it doesn't exist.
2518
- */
2519
- declare const getScheduler: () => Scheduler;
2520
-
2521
1982
  /**
2522
1983
  * Frame hook with phase-based ordering, priority, and FPS throttling.
2523
1984
  *
2524
- * Works both inside and outside Canvas context:
2525
- * - Inside Canvas: Full RootState (gl, scene, camera, etc.)
2526
- * - Outside Canvas (waiting mode): Waits for Canvas to mount, then gets full state
2527
- * - Outside Canvas (independent mode): Fires immediately with timing-only state
1985
+ * Always delivers full RootState — works both inside and outside Canvas context:
1986
+ * - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
1987
+ * - Outside Canvas: The job registers immediately but the callback is held until a
1988
+ * Canvas adopts it, then runs with full RootState. For hostless / standalone
1989
+ * frame loops with no Canvas, use `@pmndrs/scheduler` directly.
2528
1990
  *
2529
1991
  * Returns a controls object for manual stepping, pausing, and resuming.
2530
1992
  *
2531
1993
  * @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
2532
1994
  * @param priorityOrOptions - Either a priority number (backwards compat) or options object
2533
- * @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
1995
+ * @returns Controls object with step(), stepAll(), invalidate(), pause(), resume(), isPaused, id, rootId, scheduler
2534
1996
  *
2535
1997
  * @example
2536
1998
  * // Simple priority (backwards compat)
@@ -2541,16 +2003,16 @@ declare const getScheduler: () => Scheduler;
2541
2003
  * useFrame((state, delta) => { ... }, { phase: 'physics' })
2542
2004
  *
2543
2005
  * @example
2544
- * // Outside Canvas - waits for Canvas to mount
2006
+ * // Outside Canvas - callback waits for a Canvas, then always has full state
2545
2007
  * function UI() {
2546
2008
  * useFrame((state, delta) => { syncUI(state.camera) });
2547
2009
  * return <button>...</button>;
2548
2010
  * }
2549
2011
  *
2550
2012
  * @example
2551
- * // Independent mode - no Canvas needed
2552
- * getScheduler().independent = true;
2553
- * useFrame((state, delta) => { updateGame(delta) });
2013
+ * // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
2014
+ * import { getScheduler } from '@pmndrs/scheduler'
2015
+ * getScheduler().register((state, delta) => { updateGame(delta) })
2554
2016
  *
2555
2017
  * @example
2556
2018
  * // Scheduler-only access (no callback)
@@ -2573,11 +2035,16 @@ type UseTextureOptions<Url extends string[] | string | Record<string, string>> =
2573
2035
  /** Callback when texture(s) finish loading */
2574
2036
  onLoad?: (texture: MappedTextureType<Url>) => void;
2575
2037
  /**
2576
- * Cache the texture in R3F's global state for access via useTextures().
2577
- * When true:
2038
+ * Register the texture(s) in R3F's global texture registry for access via useTextures().
2039
+ * When true (the default):
2578
2040
  * - Textures persist until explicitly disposed
2579
- * - Returns existing cached textures if available (preserving modifications like colorSpace)
2580
- * @default false
2041
+ * - On mount, returns existing registered textures if available (preserving modifications like colorSpace)
2042
+ *
2043
+ * Reads are taken once at mount — a mounted `useTexture` does not re-render when the registry
2044
+ * changes. To react to registry swaps, use `useTextures(s => s.get(key))` instead.
2045
+ *
2046
+ * Pass `false` to opt out of registry enrollment entirely.
2047
+ * @default true
2581
2048
  */
2582
2049
  cache?: boolean;
2583
2050
  };
@@ -2601,15 +2068,18 @@ type UseTextureOptions<Url extends string[] | string | Record<string, string>> =
2601
2068
  * normal: '/normal.png'
2602
2069
  * })
2603
2070
  *
2604
- * // With caching - returns same texture object across components
2605
- * // Modifications (colorSpace, wrapS, etc.) are preserved
2606
- * const diffuse = useTexture('/diffuse.png', { cache: true })
2071
+ * // Textures are registered in the global registry by default — the same texture
2072
+ * // object is shared across components and modifications (colorSpace, wrapS, etc.) are preserved
2073
+ * const diffuse = useTexture('/diffuse.png')
2607
2074
  * diffuse.colorSpace = THREE.SRGBColorSpace
2608
2075
  *
2609
2076
  * // Another component gets the SAME texture with colorSpace already set
2610
- * const sameDiffuse = useTexture('/diffuse.png', { cache: true })
2077
+ * const sameDiffuse = useTexture('/diffuse.png')
2078
+ *
2079
+ * // Opt out of registry enrollment for a one-off texture
2080
+ * const scratch = useTexture('/scratch.png', { cache: false })
2611
2081
  *
2612
- * // Access cache directly
2082
+ * // Access the registry directly
2613
2083
  * const { get } = useTextures()
2614
2084
  * const cached = get('/diffuse.png')
2615
2085
  * ```
@@ -2626,63 +2096,80 @@ declare const Texture: ({ children, input, onLoad, cache, }: {
2626
2096
  cache?: boolean;
2627
2097
  }) => react_jsx_runtime.JSX.Element;
2628
2098
 
2629
- type TextureEntry = Texture$1 | {
2630
- value: Texture$1;
2631
- [key: string]: any;
2099
+ /** Accepted shapes for a registry read: a single key, a list of keys, or a name→key map. */
2100
+ type TextureInput = string | string[] | Record<string, string>;
2101
+ /** Result of a `get()` read, mirroring the input shape. */
2102
+ type TextureResult<Input extends TextureInput> = Input extends string ? Texture$1 | undefined : Input extends string[] ? (Texture$1 | undefined)[] : {
2103
+ [K in keyof Input]: Texture$1 | undefined;
2632
2104
  };
2105
+ /** Options for `dispose()`. */
2106
+ interface DisposeOptions {
2107
+ /** Dispose even if the texture still has active references (default false). */
2108
+ force?: boolean;
2109
+ }
2633
2110
  interface UseTexturesReturn {
2634
- /** Map of all textures currently in cache */
2635
- textures: Map<string, TextureEntry>;
2636
- /** Get a specific texture by key (usually URL) */
2637
- get: (key: string) => TextureEntry | undefined;
2638
- /** Check if a texture exists in cache */
2639
- has: (key: string) => boolean;
2640
- /** Add a texture to the cache */
2641
- add: (key: string, value: TextureEntry) => void;
2642
- /** Add multiple textures to the cache */
2643
- addMultiple: (items: Map<string, TextureEntry> | Record<string, TextureEntry>) => void;
2644
- /** Remove a texture from cache (does NOT dispose GPU resources) */
2645
- remove: (key: string) => void;
2646
- /** Remove multiple textures from cache */
2647
- removeMultiple: (keys: string[]) => void;
2648
- /** Dispose a texture's GPU resources and remove from cache */
2649
- dispose: (key: string) => void;
2650
- /** Dispose multiple textures */
2651
- disposeMultiple: (keys: string[]) => void;
2652
- /** Dispose ALL cached textures - use with caution */
2653
- disposeAll: () => void;
2111
+ /** The live registry Map (key → Texture). Treat as read-only. */
2112
+ readonly all: Map<string, Texture$1>;
2113
+ /** Read one texture, an array of textures, or a name→texture record (mirrors the input shape). */
2114
+ get<Input extends TextureInput>(input: Input): TextureResult<Input>;
2115
+ /** Check whether a key exists in the registry. */
2116
+ has(key: string): boolean;
2117
+ /**
2118
+ * Register a texture (or a record of textures) that has no URL — e.g. a render
2119
+ * target or procedural texture. URL-loaded textures are registered automatically
2120
+ * by `useTexture` (registry enrollment is on by default).
2121
+ */
2122
+ add(key: string, texture: Texture$1): void;
2123
+ add(record: Record<string, Texture$1>): void;
2124
+ /**
2125
+ * Dispose a texture's GPU resources and remove it from the registry.
2126
+ * Refcount-aware: if the key is still in use by a mounted `useTexture` consumer it is
2127
+ * skipped (with a warning) unless `{ force: true }` is passed.
2128
+ * @returns true if disposed, false if skipped.
2129
+ */
2130
+ dispose(key: string, options?: DisposeOptions): boolean;
2131
+ /** Dispose every texture in the registry and clear it. Use on scene teardown. */
2132
+ disposeAll(): void;
2654
2133
  }
2655
2134
  /**
2656
- * Hook for managing the global texture cache in R3F state.
2135
+ * Reactive Texture registry — load once with `useTexture`, reach the textures from anywhere.
2136
+ *
2137
+ * This is a registry of plain `Texture` objects (not TSL nodes), so the same texture can feed
2138
+ * a material map, a heightmap sampler, or anything else. It does **not** load — pair it with
2139
+ * `useTexture` for loading (registry enrollment is on by default); `useTextures` is for access and lifecycle.
2657
2140
  *
2658
- * Textures are stored in a Map with URL/path keys for efficient lookup.
2659
- * Useful for sharing texture references across materials and components.
2141
+ * The returned handle is **reactive**: the calling component re-renders when the registry
2142
+ * changes. Pass a selector to scope the subscription to a single read.
2660
2143
  *
2661
2144
  * @example
2662
2145
  * ```tsx
2663
- * const { textures, add, get, remove, has, dispose } = useTextures()
2146
+ * // Load + register once (anywhere in the tree) — registered by default
2147
+ * useTexture({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
2664
2148
  *
2665
- * // Check if texture is already cached
2666
- * if (!has('/textures/diffuse.png')) {
2667
- * // Load with useTexture and cache: true, or manually add
2668
- * const tex = useTexture('/textures/diffuse.png', { cache: true })
2669
- * }
2670
- *
2671
- * // Access cached texture from anywhere
2672
- * const diffuse = get('/textures/diffuse.png')
2673
- * if (diffuse) material.map = diffuse
2149
+ * // Reach them from another component — record form lands straight into a material
2150
+ * const { map, normalMap } = useTextures().get({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
2151
+ * return <meshStandardMaterial map={map} normalMap={normalMap} />
2674
2152
  *
2675
- * // Remove from cache only (texture still in GPU memory)
2676
- * remove('/textures/old.png')
2153
+ * // A set of heightmaps at once
2154
+ * const [a, b, c] = useTextures().get(['/h0.png', '/h1.png', '/h2.png'])
2677
2155
  *
2678
- * // Fully dispose (frees GPU memory + removes from cache)
2679
- * dispose('/textures/unused.png')
2156
+ * // Register a non-URL texture (render target / procedural)
2157
+ * useTextures().add('rt-main', renderTarget.texture)
2680
2158
  *
2681
- * // Nuclear option - dispose everything
2682
- * disposeAll()
2159
+ * // Deliberate GPU cleanup (refcount-aware; force to override)
2160
+ * useTextures().dispose('/diffuse.jpg')
2161
+ * useTextures().disposeAll() // scene teardown
2683
2162
  * ```
2163
+ *
2164
+ * @remarks
2165
+ * **Future expansion:** an imperative async loader (e.g. `await useTextures().load('/x.jpg')`) is
2166
+ * intentionally not included yet. It would let non-React code (loading screens, dynamic streaming)
2167
+ * populate the registry without Suspense, at the cost of putting loading back into this hook. It
2168
+ * will be added only if a concrete consumer needs imperative loading; for now, loading lives in
2169
+ * `useTexture`.
2684
2170
  */
2685
2171
  declare function useTextures(): UseTexturesReturn;
2172
+ declare function useTextures<T>(selector: (registry: UseTexturesReturn) => T): T;
2686
2173
 
2687
2174
  /**
2688
2175
  * Creates a render target compatible with the current renderer.
@@ -2801,7 +2288,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
2801
2288
  * Invalidates the view, requesting a frame to be rendered.
2802
2289
  * In demand mode, this triggers the scheduler to run frames.
2803
2290
  *
2804
- * @param state - Optional root state (ignored in new scheduler, kept for backwards compat)
2291
+ * With a state argument, only that root's jobs run on the requested frames; other
2292
+ * roots on 'demand' stay idle. Without one, every registered root is invalidated.
2293
+ *
2294
+ * @param state - Optional root state; targets the invalidation at that root
2805
2295
  * @param frames - Number of frames to request (default: 1)
2806
2296
  * @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
2807
2297
  *
@@ -2812,14 +2302,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
2812
2302
  * Advances the frameloop and runs render effects.
2813
2303
  * Useful for when manually rendering via `frameloop="never"`.
2814
2304
  *
2305
+ * With a state argument, only that root is stepped. Without one, every
2306
+ * registered root is stepped for backwards compatibility.
2307
+ *
2815
2308
  * @param timestamp - The timestamp to use for this frame
2816
2309
  * @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
2817
- * @param state - Ignored (kept for backwards compat)
2818
- * @param frame - Ignored (kept for backwards compat)
2310
+ * @param state - Optional root state; targets the manual step at that root
2819
2311
  *
2820
2312
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
2821
2313
  */
2822
- declare function advance(timestamp: number): void;
2314
+ declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
2823
2315
 
2824
2316
  /* eslint-disable @definitelytyped/no-unnecessary-generics */
2825
2317
  declare function ReactReconciler<
@@ -3864,6 +3356,7 @@ declare namespace ReactReconciler {
3864
3356
 
3865
3357
  declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
3866
3358
  declare function extend<T extends Catalogue>(objects: T): void;
3359
+ declare function extend(objects: Record<string, unknown>): void;
3867
3360
  declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
3868
3361
 
3869
3362
  declare const isRenderer: (def: any) => boolean;
@@ -3890,11 +3383,6 @@ declare function flushSync<R>(fn: () => R): R;
3890
3383
  declare const context: React$1.Context<RootStore>;
3891
3384
  declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
3892
3385
 
3893
- /**
3894
- * Safely flush async effects when testing, simulating a legacy root.
3895
- * @deprecated Import from React instead. import { act } from 'react'
3896
- */
3897
- declare const act: typeof React$1.act;
3898
3386
  /**
3899
3387
  * An SSR-friendly useLayoutEffect.
3900
3388
  *
@@ -4146,7 +3634,7 @@ declare function getInstanceProps<T = any>(pendingProps: Record<string, unknown>
4146
3634
  declare function prepare<T = any>(target: T, root: RootStore, type: string, props: Instance<T>['props']): Instance<T>;
4147
3635
  /**
4148
3636
  * Triggers an update for an instance.
4149
- * Calls onUpdate callback and invalidates the frame if necessary.
3637
+ * Invalidates the frame if the root is in demand mode.
4150
3638
  *
4151
3639
  * @param instance - Instance to invalidate
4152
3640
  */
@@ -4312,29 +3800,44 @@ declare const hasConstructor: (object: unknown) => object is {
4312
3800
  * Used to identify values that should be resolved from refs after mount.
4313
3801
  */
4314
3802
  declare const FROM_REF: unique symbol;
3803
+ /** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
3804
+ interface FromRefMarker<T = unknown, R = T> {
3805
+ [FROM_REF]: React$1.RefObject<T | null>;
3806
+ /** Optional transform applied to the resolved ref before assignment. */
3807
+ transform?: (value: T) => R;
3808
+ }
4315
3809
  /**
4316
3810
  * Defers prop application until the referenced object is available.
4317
3811
  * Useful for props like `target` that need sibling refs to be populated.
4318
3812
  *
3813
+ * Only top-level props on a three element are resolved: a marker nested inside another value
3814
+ * (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
3815
+ * than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
3816
+ * what gets assigned.
3817
+ *
4319
3818
  * @param ref - React ref object to resolve at mount time
4320
- * @returns A marker value that applyProps will resolve after mount
3819
+ * @param transform - Optional mapping from the resolved object to the value the prop expects
3820
+ * @returns A marker value that the reconciler resolves after mount
4321
3821
  *
4322
3822
  * @example
4323
3823
  * const targetRef = useRef<THREE.Object3D>(null)
4324
3824
  *
4325
3825
  * <group ref={targetRef} position={[-3, -2, -15]} />
4326
3826
  * <spotLight target={fromRef(targetRef)} intensity={100} />
3827
+ *
3828
+ * @example
3829
+ * // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
3830
+ * <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
4327
3831
  */
4328
3832
  declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
3833
+ declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
4329
3834
  /**
4330
3835
  * Type guard to check if a value is a fromRef marker.
4331
3836
  *
4332
3837
  * @param value - Value to check
4333
3838
  * @returns True if value is a fromRef marker
4334
3839
  */
4335
- declare function isFromRef(value: unknown): value is {
4336
- [FROM_REF]: React$1.RefObject<any>;
4337
- };
3840
+ declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
4338
3841
 
4339
3842
  /**
4340
3843
  * Symbol marker for mount-only method calls.
@@ -4361,7 +3864,15 @@ declare const ONCE: unique symbol;
4361
3864
  * // No arguments
4362
3865
  * <geometry center={once()} />
4363
3866
  */
4364
- declare function once<T>(...args: T[]): T;
3867
+ declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
3868
+ /**
3869
+ * What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
3870
+ * the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
3871
+ * methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
3872
+ *
3873
+ * The runtime value is always the marker object; only the declared type follows the prop.
3874
+ */
3875
+ type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
4365
3876
  /**
4366
3877
  * Type guard to check if a value is a once marker.
4367
3878
  *
@@ -4378,5 +3889,5 @@ declare function isOnce(value: unknown): value is {
4378
3889
  */
4379
3890
  declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
4380
3891
 
4381
- 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, Scheduler, Texture, _roots, act, 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, getScheduler, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, reconciler, registerPrimary, removeInteractivity, resolve, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useEnvironment, useFrame, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useMutableCallback, useRenderTarget, useStore, useTexture, useTextures, useThree, waitForPrimary };
4382
- export type { Act, AddPhaseOptions, 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, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameControls, FrameNextCallback, FrameNextControls, FrameNextState, FrameState, FrameTimingState, 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, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeProps, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, R3FRenderer, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootOptions, RootState, RootStore, SchedulerApi, SetBlock, Size, StorageLike, StorageRecord, StorageStore, Subscription, TSLNodeInput, TextureEntry, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UseFrameNextOptions, UseFrameOptions, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, XRManager, XRPointerConfig };
3892
+ 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 };
3893
+ 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, 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, R3FRenderer, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, 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 };