@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.
@@ -1,5 +1,6 @@
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, WebGPURendererParameters } 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, Matrix2, WebGPURendererParameters } from 'three/webgpu';
3
4
  import { Inspector } from 'three/addons/inspector/Inspector.js';
4
5
  import * as THREE$1 from 'three';
5
6
  import { Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
@@ -7,25 +8,12 @@ import * as React$1 from 'react';
7
8
  import { ReactNode, Component, RefObject, JSX } from 'react';
8
9
  import { StoreApi } from 'zustand';
9
10
  import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
11
+ import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
12
+ export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
10
13
  import { Options } from 'react-use-measure';
11
14
  import * as react_jsx_runtime from 'react/jsx-runtime';
12
- import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
13
15
  import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
14
16
 
15
- function _mergeNamespaces(n, m) {
16
- m.forEach(function (e) {
17
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
18
- if (k !== 'default' && !(k in n)) {
19
- var d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: function () { return e[k]; }
23
- });
24
- }
25
- });
26
- });
27
- return Object.freeze(n);
28
- }
29
17
 
30
18
  /**
31
19
  * @fileoverview Internal Three.js re-exports - WEBGPU ONLY ENTRY
@@ -39,6 +27,8 @@ function _mergeNamespaces(n, m) {
39
27
  declare const R3F_BUILD_LEGACY = false;
40
28
  declare const R3F_BUILD_WEBGPU = true;
41
29
 
30
+ /** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
31
+ declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
42
32
  declare const WebGLRenderer: {
43
33
  new (): {};
44
34
  };
@@ -47,17 +37,8 @@ type WebGLShadowMap = never;
47
37
 
48
38
  declare const WebGLRenderTarget: any;
49
39
 
50
- var THREE = /*#__PURE__*/_mergeNamespaces({
51
- __proto__: null,
52
- Inspector: Inspector,
53
- R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
54
- R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
55
- RenderTargetCompat: RenderTarget,
56
- WebGLRenderTarget: WebGLRenderTarget,
57
- WebGLRenderer: WebGLRenderer,
58
- WebGLRendererParameters: WebGLRendererParameters,
59
- WebGLShadowMap: WebGLShadowMap
60
- }, [three_webgpu]);
40
+ declare const WebGLCubeRenderTarget: any;
41
+
61
42
 
62
43
  //* Utility Types ==============================
63
44
 
@@ -294,228 +275,33 @@ interface VisibilityEntry {
294
275
  }
295
276
 
296
277
  //* Scheduler Types (useFrame) ==============================
278
+ //
279
+ // The generic, framework-agnostic scheduler types now live in @pmndrs/scheduler.
280
+ // This file re-exports them and layers r3f's RootState-aware frame state on top,
281
+ // so existing `#types` imports across the codebase keep resolving unchanged.
297
282
 
298
283
 
299
284
 
300
- // Public Options --------------------------------
301
-
302
- /**
303
- * Options for useFrame hook
304
- */
305
- interface UseFrameNextOptions {
306
- /** Optional stable id for the job. Auto-generated if not provided */
307
- id?: string
308
- /** Named phase to run in. Default: 'update' */
309
- phase?: string
310
- /** Run before this phase or job id */
311
- before?: string | string[]
312
- /** Run after this phase or job id */
313
- after?: string | string[]
314
- /** Priority within phase. Higher runs first. Default: 0 */
315
- priority?: number
316
- /** Max frames per second for this job */
317
- fps?: number
318
- /** If true, skip frames when behind. If false, try to catch up. Default: true */
319
- drop?: boolean
320
- /** Enable/disable without unregistering. Default: true */
321
- enabled?: boolean
322
- }
323
-
324
- /** Alias for UseFrameNextOptions */
325
- type UseFrameOptions = UseFrameNextOptions
326
-
327
- /**
328
- * Options for addPhase
329
- */
330
- interface AddPhaseOptions {
331
- /** Insert this phase before the specified phase */
332
- before?: string
333
- /** Insert this phase after the specified phase */
334
- after?: string
335
- }
336
-
337
- // Frame State --------------------------------
338
-
339
- /**
340
- * Timing-only state for independent/outside mode (no RootState)
341
- */
342
- interface FrameTimingState {
343
- /** High-resolution timestamp from RAF (ms) */
344
- time: number
345
- /** Time since last frame in seconds (for legacy compatibility with THREE.Clock) */
346
- delta: number
347
- /** Elapsed time since first frame in seconds (for legacy compatibility with THREE.Clock) */
348
- elapsed: number
349
- /** Incrementing frame counter */
350
- frame: number
351
- }
285
+ // Frame State (r3f-specific) --------------------------------
352
286
 
353
287
  /**
354
- * State passed to useFrame callbacks (extends RootState with timing)
288
+ * State passed to useFrame callbacks (extends RootState with timing).
355
289
  */
356
290
  interface FrameNextState extends RootState, FrameTimingState {}
357
291
 
358
292
  /** Alias for FrameNextState */
359
293
  type FrameState = FrameNextState
360
294
 
361
- // Root Options --------------------------------
362
-
363
- /**
364
- * Options for registerRoot
365
- */
366
- interface RootOptions {
367
- /** State provider for callbacks. Optional in independent mode. */
368
- getState?: () => any
369
- /** Error handler for job errors. Falls back to console.error if not provided. */
370
- onError?: (error: Error) => void
371
- }
372
-
373
- // Callback Types --------------------------------
295
+ // Callback Types (r3f-specific) --------------------------------
374
296
 
375
297
  /**
376
- * Callback function for useFrame
298
+ * Callback function for useFrame. Receives the full r3f RootState plus timing.
377
299
  */
378
- type FrameNextCallback = (state: FrameNextState, delta: number) => void
300
+ type FrameNextCallback = FrameCallback$1<RootState>
379
301
 
380
302
  /** Alias for FrameNextCallback */
381
303
  type FrameCallback = FrameNextCallback
382
304
 
383
- // Controls returned from useFrame --------------------------------
384
-
385
- /**
386
- * Controls object returned from useFrame hook
387
- */
388
- interface FrameNextControls {
389
- /** The job's unique ID */
390
- id: string
391
- /** Access to the global scheduler for frame loop control */
392
- scheduler: SchedulerApi
393
- /** Manually step this job only (bypasses FPS limiting) */
394
- step(timestamp?: number): void
395
- /** Manually step ALL jobs in the scheduler */
396
- stepAll(timestamp?: number): void
397
- /** Pause this job (set enabled=false) */
398
- pause(): void
399
- /** Resume this job (set enabled=true) */
400
- resume(): void
401
- /** Reactive paused state - automatically triggers re-render when changed */
402
- isPaused: boolean
403
- }
404
-
405
- /** Alias for FrameNextControls */
406
- type FrameControls = FrameNextControls
407
-
408
- // Scheduler Interface --------------------------------
409
-
410
- /**
411
- * Public interface for the global Scheduler
412
- */
413
- interface SchedulerApi {
414
- //* Phase Management --------------------------------
415
-
416
- /** Add a named phase to the scheduler */
417
- addPhase(name: string, options?: AddPhaseOptions): void
418
- /** Get the ordered list of phase names */
419
- readonly phases: string[]
420
- /** Check if a phase exists */
421
- hasPhase(name: string): boolean
422
-
423
- //* Root Management --------------------------------
424
-
425
- /** Register a root (Canvas) with the scheduler. Returns unsubscribe function. */
426
- registerRoot(id: string, options?: RootOptions): () => void
427
- /** Unregister a root */
428
- unregisterRoot(id: string): void
429
- /** Generate a unique root ID */
430
- generateRootId(): string
431
- /** Get the number of registered roots */
432
- getRootCount(): number
433
- /** Check if any root is registered and ready */
434
- readonly isReady: boolean
435
- /** Subscribe to root-ready event. Fires immediately if already ready. Returns unsubscribe. */
436
- onRootReady(callback: () => void): () => void
437
-
438
- //* Job Registration --------------------------------
439
-
440
- /** Register a job with the scheduler (returns unsubscribe function) */
441
- register(
442
- callback: FrameNextCallback,
443
- options?: {
444
- id?: string
445
- rootId?: string
446
- phase?: string
447
- before?: string | string[]
448
- after?: string | string[]
449
- priority?: number
450
- fps?: number
451
- drop?: boolean
452
- enabled?: boolean
453
- },
454
- ): () => void
455
- /** Update a job's options */
456
- updateJob(
457
- id: string,
458
- options: {
459
- priority?: number
460
- fps?: number
461
- drop?: boolean
462
- enabled?: boolean
463
- phase?: string
464
- before?: string | string[]
465
- after?: string | string[]
466
- },
467
- ): void
468
- /** Unregister a job by ID */
469
- unregister(id: string, rootId?: string): void
470
- /** Get the number of registered jobs */
471
- getJobCount(): number
472
- /** Get all job IDs */
473
- getJobIds(): string[]
474
-
475
- //* Global Jobs (for legacy addEffect/addAfterEffect) --------------------------------
476
-
477
- /** Register a global job (runs once per frame, not per-root). Returns unsubscribe function. */
478
- registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void
479
-
480
- //* Idle Callbacks (for legacy addTail) --------------------------------
481
-
482
- /** Register an idle callback (fires when loop stops). Returns unsubscribe function. */
483
- onIdle(callback: (timestamp: number) => void): () => void
484
-
485
- //* Frame Loop Control --------------------------------
486
-
487
- /** Start the scheduler loop */
488
- start(): void
489
- /** Stop the scheduler loop */
490
- stop(): void
491
- /** Check if the scheduler is running */
492
- readonly isRunning: boolean
493
- /** Get/set the frameloop mode ('always', 'demand', 'never') */
494
- frameloop: Frameloop
495
- /** Independent mode - runs without Canvas, callbacks receive timing-only state */
496
- independent: boolean
497
-
498
- //* Manual Stepping --------------------------------
499
-
500
- /** Manually step all jobs once (for frameloop='never' or testing) */
501
- step(timestamp?: number): void
502
- /** Manually step a single job by ID */
503
- stepJob(id: string, timestamp?: number): void
504
- /** Request frame(s) to be rendered (for frameloop='demand') */
505
- invalidate(frames?: number): void
506
-
507
- //* Per-Job Control --------------------------------
508
-
509
- /** Check if a job is paused */
510
- isJobPaused(id: string): boolean
511
- /** Pause a job */
512
- pauseJob(id: string): void
513
- /** Resume a job */
514
- resumeJob(id: string): void
515
- /** Subscribe to job state changes (for reactive isPaused). Returns unsubscribe function. */
516
- subscribeJobState(id: string, listener: () => void): () => void
517
- }
518
-
519
305
  //* Buffer Types (useBuffers) ========================================
520
306
 
521
307
  /**
@@ -540,6 +326,7 @@ type BufferLike =
540
326
  | Uint16Array
541
327
  | Int16Array
542
328
  | THREE$1.BufferAttribute // Base class for all buffer attributes
329
+ | THREE$1.InterleavedBufferAttribute
543
330
  | Node // TSL buffer nodes (instancedArray, storage)
544
331
 
545
332
  /** Flat record of buffer-like values (no nested scopes) */
@@ -551,6 +338,25 @@ type BufferRecord = Record<string, BufferLike>
551
338
  */
552
339
  type BufferStore = Record<string, BufferLike | BufferRecord>
553
340
 
341
+ //* Node Types (useNodes) ========================================
342
+
343
+ /**
344
+ * Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
345
+ * the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
346
+ * code passes through. Creators are constrained to this same type, so the shape a creator returns
347
+ * and the shape the store holds are one type by construction.
348
+ */
349
+ type NodeLike = TSLNodeType | LegacyTSLNodeLike
350
+
351
+ /** Flat record of TSL nodes (no nested scopes) */
352
+ type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
353
+
354
+ /**
355
+ * Node store that can contain both root-level nodes and scoped node objects.
356
+ * Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
357
+ */
358
+ type NodeStore = Record<string, NodeLike | NodeRecord>
359
+
554
360
  //* Storage Types (useGPUStorage) ========================================
555
361
 
556
362
  /**
@@ -565,7 +371,9 @@ type BufferStore = Record<string, BufferLike | BufferRecord>
565
371
  * ```
566
372
  */
567
373
  type StorageLike =
568
- | StorageTexture // GPU storage texture
374
+ | StorageTexture // 2D GPU storage texture
375
+ | Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
376
+ | StorageArrayTexture // 2D-array GPU storage texture
569
377
  | Data3DTexture // 3D texture (can be used as storage)
570
378
  | Node // TSL storage texture nodes (storageTexture)
571
379
 
@@ -684,14 +492,31 @@ interface InternalState {
684
492
  /** Container for child attachment (scene for root, original container for portals) */
685
493
  container?: THREE$1.Object3D
686
494
  /**
687
- * CanvasTarget for multi-canvas WebGPU rendering.
688
- * Created for all WebGPU canvases to support renderer sharing.
495
+ * The CanvasTarget this root sizes and renders through.
496
+ *
497
+ * A primary (`<Canvas id>`) owns the renderer's default target -- the one three itself built
498
+ * around the canvas element -- so sizing it is sizing the renderer. A secondary owns a target
499
+ * R3F created for its own element. Either way there is exactly one target per canvas element,
500
+ * and the canvas-target job makes it the renderer's active one before this root renders.
501
+ * Absent on WebGL and on an id-less WebGPU canvas, where the renderer is sized directly.
689
502
  * @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
690
503
  */
691
504
  canvasTarget?: CanvasTarget
505
+ /**
506
+ * Set when this root's canvas target has been resized and the backend's cached render pass
507
+ * descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
508
+ *
509
+ * Flushed by the canvas-target job in the `start` phase, which is the only place this root's
510
+ * target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
511
+ * whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
512
+ * invalidate some other canvas's descriptor instead.
513
+ *
514
+ * @see https://github.com/pmndrs/react-three-fiber/issues/3847
515
+ */
516
+ canvasTargetSizeDirty?: boolean
692
517
  /**
693
518
  * Whether multi-canvas rendering is active.
694
- * True when any canvas uses `target` prop to share a renderer.
519
+ * True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
695
520
  * When true, setCanvasTarget is called before each render.
696
521
  */
697
522
  isMultiCanvas?: boolean
@@ -789,8 +614,8 @@ interface RootState {
789
614
  setSize: (width?: number, height?: number, top?: number, left?: number) => void
790
615
  /** Shortcut to manual setting the pixel ratio */
791
616
  setDpr: (dpr: Dpr) => void
792
- /** Shortcut to setting frameloop flags */
793
- setFrameloop: (frameloop: Frameloop) => void
617
+ /** Shortcut to setting frameloop flags. No args resets to 'always'. */
618
+ setFrameloop: (frameloop?: Frameloop) => void
794
619
  /** Set error state to propagate to error boundary */
795
620
  setError: (error: Error | null) => void
796
621
  /** Current error state (null when no error) */
@@ -798,17 +623,19 @@ interface RootState {
798
623
  /** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
799
624
  uniforms: UniformStore
800
625
  /** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
801
- nodes: Record<string, any>
626
+ nodes: NodeStore
802
627
  /** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
803
628
  buffers: BufferStore
804
629
  /** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
805
630
  gpuStorage: StorageStore
806
- /** Global TSL texture nodes - use useTextures() hook for operations */
807
- textures: Map<string, any>
631
+ /** Global Texture registry (key → Texture, usually keyed by URL) - use useTextures() hook for access + lifecycle */
632
+ textures: Map<string, THREE$1.Texture>
633
+ /** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
634
+ _textureRefs: Map<string, number>
808
635
  /** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
809
- renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
636
+ renderPipeline: ThreeRenderPipeline | null
810
637
  /** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
811
- passes: Record<string, any>
638
+ passes: PassRecord
812
639
  /** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
813
640
  _hmrVersion: number
814
641
  /** Internal: whether setSize() has taken ownership of canvas dimensions */
@@ -896,12 +723,19 @@ type DefaultRendererProps = {
896
723
  */
897
724
  interface CanvasSchedulerConfig {
898
725
  /**
899
- * Render this canvas after another canvas completes.
900
- * Pass the `id` of another canvas.
726
+ * Run this Canvas root before the referenced Canvas root id(s).
727
+ */
728
+ before?: string | string[]
729
+ /**
730
+ * Run this Canvas root after the referenced Canvas root id(s).
901
731
  */
902
- after?: string
732
+ after?: string | string[]
903
733
  /**
904
- * Limit this canvas's render rate (frames per second).
734
+ * Numeric root order. Lower values run first.
735
+ */
736
+ order?: number
737
+ /**
738
+ * Limit this Canvas's default render job (frames per second).
905
739
  */
906
740
  fps?: number
907
741
  }
@@ -988,14 +822,17 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
988
822
  performance?: Partial<Omit<Performance, 'regress'>>
989
823
  /** Target pixel ratio. Can clamp between a range: `[min, max]` */
990
824
  dpr?: Dpr
991
- /** Props that go into the default raycaster */
992
- raycaster?: Partial<THREE$1.Raycaster>
825
+ /**
826
+ * Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
827
+ * so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
828
+ */
829
+ raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
993
830
  /** A `THREE.Scene` instance or props that go into the default scene */
994
831
  scene?: THREE$1.Scene | Partial<THREE$1.Scene>
995
832
  /** A `THREE.Camera` instance or props that go into the default camera */
996
833
  camera?: CameraProps
997
834
  /** An R3F event manager to manage elements' pointer events */
998
- events?: (store: RootStore) => EventManager<HTMLElement>
835
+ events?: (store: RootStore) => EventManager<Element>
999
836
  /** Callback after the canvas has rendered (but not yet committed) */
1000
837
  onCreated?: (state: RootState) => void
1001
838
  /** Response for pointer clicks that have missed any target */
@@ -1084,7 +921,6 @@ type InstanceProps<T = any, P = any> = ArgsProp<P> & {
1084
921
  object?: T
1085
922
  dispose?: null
1086
923
  attach?: AttachType<T>
1087
- onUpdate?: (self: T) => void
1088
924
  }
1089
925
 
1090
926
  interface Instance<O = any> {
@@ -1099,8 +935,6 @@ interface Instance<O = any> {
1099
935
  attach?: AttachType<O>
1100
936
  previousAttach?: any
1101
937
  isHidden: boolean
1102
- /** Deferred ref props to apply in commitMount */
1103
- deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
1104
938
  /** Set of props that have been applied via once() */
1105
939
  appliedOnce?: Set<string>
1106
940
  }
@@ -1226,7 +1060,7 @@ interface CanvasProps
1226
1060
  */
1227
1061
  resize?: Options
1228
1062
  /** The target where events are being subscribed to, default: the div that wraps canvas */
1229
- eventSource?: HTMLElement | React$1.RefObject<HTMLElement | null>
1063
+ eventSource?: Element | React$1.RefObject<Element | null>
1230
1064
  /** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
1231
1065
  eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
1232
1066
  /** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
@@ -1334,70 +1168,86 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
1334
1168
 
1335
1169
  type RenderTargetOptions = RenderTargetOptions$1
1336
1170
 
1337
- //* Global Types ==============================
1171
+ //* Global TSL Types ==============================
1338
1172
 
1339
1173
  declare global {
1340
- /** Uniform node type - a Node with a value property (matches Three.js UniformNode) */
1341
- interface UniformNode<T = unknown> extends Node {
1342
- value: T
1343
- }
1344
-
1345
1174
  /**
1346
- * ShaderCallable - the return type of Fn()
1347
- * A callable shader function node that can be invoked with parameters.
1348
- * The function returns a ShaderNodeObject when called.
1349
- *
1350
- * @example
1351
- * ```tsx
1352
- * // Define a shader function
1353
- * const blendColorFn = Fn(([color1, color2, factor]) => {
1354
- * return mix(color1, color2, factor)
1355
- * })
1356
- *
1357
- * // Type when retrieving from nodes store
1358
- * const { blendColorFn } = nodes as { blendColorFn: ShaderCallable }
1359
- *
1360
- * // Or with specific return type
1361
- * const { myFn } = nodes as { myFn: ShaderCallable<THREE.Node> }
1362
- * ```
1175
+ * Broad callable-node fallback for dynamic store readers.
1176
+ * Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
1363
1177
  */
1364
- type ShaderCallable<R extends Node = Node> = ((...params: unknown[]) => ShaderNodeObject<R>) & Node
1178
+ type CallableTSLNode = ((...params: never[]) => unknown) & {
1179
+ readonly shaderNode: unknown
1180
+ readonly id: number
1181
+ }
1365
1182
 
1366
- /**
1367
- * ShaderNodeRef - a ShaderNodeObject wrapper around a Node
1368
- * This is the common return type for TSL operations (add, mul, sin, etc.)
1369
- *
1370
- * @example
1371
- * ```tsx
1372
- * const { wobble } = nodes as { wobble: ShaderNodeRef }
1373
- * ```
1374
- */
1375
- type ShaderNodeRef<T extends Node = Node> = ShaderNodeObject<T>
1183
+ /** Legacy structural node accepted when at least one historical marker exists. */
1184
+ type LegacyTSLNodeLike = {
1185
+ label?: ((label: string) => unknown) | string
1186
+ setName?: (name: string) => unknown
1187
+ } & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
1188
+
1189
+ /** Node type accepted by broad dynamic node-store readers. */
1190
+ type TSLNodeType = three_webgpu.Node | CallableTSLNode
1376
1191
 
1377
1192
  /**
1378
- * TSLNodeType - Union of all common TSL node types
1379
- * Used by ScopedStore to properly type node access from the store.
1380
- *
1381
- * Includes:
1382
- * - Node: base Three.js node type
1383
- * - ShaderCallable: function nodes created with Fn()
1384
- * - ShaderNodeObject: wrapped nodes from TSL operations (sin, mul, mix, etc.)
1385
- *
1386
- * @example
1387
- * ```tsx
1388
- * // In useLocalNodes, nodes are typed as TSLNodeType
1389
- * const { positionNode, blendColorFn } = useLocalNodes(({ nodes }) => ({
1390
- * positionNode: nodes.myPosition, // Works - Node is in union
1391
- * blendColorFn: nodes.myFn, // Works - ShaderCallable is in union
1392
- * }))
1393
- *
1394
- * // Can narrow with type guard or assertion when needed
1395
- * if (typeof blendColorFn === 'function') {
1396
- * blendColorFn(someColor, 0.5)
1397
- * }
1398
- * ```
1193
+ * Derive Three's shader node type from an existing node or a supported raw input.
1194
+ * Existing InputNode generics take precedence over structural value normalization.
1195
+ * Both generics must be inferred because Three's UniformNode intersects an unknown-typed
1196
+ * InputNode base with its concrete InputNode specialization.
1399
1197
  */
1400
- type TSLNodeType = Node | ShaderCallable<Node> | ShaderNodeObject<Node>
1198
+ type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
1199
+ ? TNodeType
1200
+ : T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
1201
+ ? TNodeType
1202
+ : T extends number
1203
+ ? 'float'
1204
+ : T extends boolean
1205
+ ? 'bool'
1206
+ : T extends string | three_webgpu.Color | { r: number; g: number; b: number }
1207
+ ? 'color'
1208
+ : T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
1209
+ ? 'vec4'
1210
+ : T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
1211
+ ? 'vec3'
1212
+ : T extends three_webgpu.Vector2 | { x: number; y: number }
1213
+ ? 'vec2'
1214
+ : T extends three_webgpu.Matrix4
1215
+ ? 'mat4'
1216
+ : T extends three_webgpu.Matrix3
1217
+ ? 'mat3'
1218
+ : T extends three_webgpu.Matrix2
1219
+ ? 'mat2'
1220
+ : unknown
1221
+
1222
+ /** Derive the normalized JavaScript value stored by a uniform node. */
1223
+ type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
1224
+ ? TValue
1225
+ : T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
1226
+ ? TValue
1227
+ : T extends string | { r: number; g: number; b: number }
1228
+ ? three_webgpu.Color
1229
+ : T extends { x: number; y: number; z: number; w: number }
1230
+ ? three_webgpu.Vector4
1231
+ : T extends { x: number; y: number; z: number }
1232
+ ? three_webgpu.Vector3
1233
+ : T extends { x: number; y: number }
1234
+ ? three_webgpu.Vector2
1235
+ : T extends number
1236
+ ? number
1237
+ : T extends boolean
1238
+ ? boolean
1239
+ : T
1240
+
1241
+ /** Three's exact UniformNode with shader and value generics derived from an input. */
1242
+ type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
1243
+
1244
+ /** Preserve every input key while mapping values to exact Three uniform nodes. */
1245
+ type UniformNodesFor<T extends UniformInputRecord> = {
1246
+ [K in keyof T]: UniformNodeFor<T[K]>
1247
+ }
1248
+
1249
+ /** Backward-compatible single-parameter uniform alias. */
1250
+ type UniformNode<T = unknown> = UniformNodeFor<T>
1401
1251
 
1402
1252
  /** Flat record of uniform nodes (no nested scopes) */
1403
1253
  type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
@@ -1422,7 +1272,7 @@ declare global {
1422
1272
  * Acceptable input values for useUniforms - raw values that get converted to UniformNodes
1423
1273
  * Supports:
1424
1274
  * - Primitives: number, string (color), boolean
1425
- * - Three.js types: Color, Vector2/3/4, Matrix3/4, Euler, Quaternion
1275
+ * - Three.js types: Color, Vector2/3/4, Matrix2/3/4
1426
1276
  * - Plain objects: { x, y, z, w } converted to vectors
1427
1277
  * - TSL nodes: color(), vec3(), float() for type casting
1428
1278
  * - UniformNode: existing uniforms (reused as-is)
@@ -1435,227 +1285,124 @@ declare global {
1435
1285
  | three_webgpu.Vector2
1436
1286
  | three_webgpu.Vector3
1437
1287
  | three_webgpu.Vector4
1288
+ | three_webgpu.Matrix2
1438
1289
  | three_webgpu.Matrix3
1439
1290
  | three_webgpu.Matrix4
1440
- | three_webgpu.Euler
1441
- | three_webgpu.Quaternion
1442
- | { x: number; y?: number; z?: number; w?: number } // Plain objects converted to vectors
1291
+ | { x: number; y: number }
1292
+ | { x: number; y: number; z: number }
1293
+ | { x: number; y: number; z: number; w: number }
1443
1294
  | { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
1444
- | Node // TSL nodes like color(), vec3(), float() for type casting
1295
+ | three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
1445
1296
  | UniformNode
1446
1297
 
1447
1298
  /** Input record for useUniforms - accepts raw values or UniformNodes */
1448
1299
  type UniformInputRecord = Record<string, UniformValue>
1449
1300
  }
1450
1301
 
1451
- //* Module Augmentation ==============================
1452
-
1453
- declare module 'three/tsl' {
1302
+ declare global {
1454
1303
  /**
1455
- * Fn with array parameter destructuring
1456
- * @example Fn(([uv, skew]) => { ... })
1304
+ * three's own render pipeline type. Named here so the rest of R3F refers to three's shape
1305
+ * rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
1306
+ * is r185, so the new name is the only one.
1457
1307
  */
1458
- export function Fn<R extends Node = Node>(
1459
- jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
1460
- ): ShaderCallable<R>
1308
+ type ThreeRenderPipeline = three_webgpu.RenderPipeline
1461
1309
 
1462
1310
  /**
1463
- * Fn with object parameter destructuring
1464
- * @example Fn(({ color, intensity }) => { ... })
1311
+ * The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
1312
+ * `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
1313
+ * `getTextureNode`, `setMRT` and `dispose` track the installed version.
1465
1314
  */
1466
- export function Fn<T extends Record<string, unknown>, R extends Node = Node>(
1467
- jsFunc: (inputs: T) => ShaderNodeObject<R>,
1468
- ): ShaderCallable<R>
1315
+ type ScenePassNode = three_webgpu.PassNode
1469
1316
 
1470
1317
  /**
1471
- * Fn with array params + layout
1472
- * @example Fn(([a, b]) => { ... }, { layout: [...] })
1318
+ * Pass record - stores TSL pass nodes for render pipeline.
1319
+ *
1320
+ * `scenePass` is the only key the library owns. It is optional here because this is also the
1321
+ * shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
1322
+ * or `clearPasses()`. Inside the callbacks it is always present; see
1323
+ * {@link RenderPipelineCallbackState}.
1324
+ *
1325
+ * Every other key is user-registered, via a callback's return value. Those are TSL nodes of
1326
+ * any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
1327
+ * `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
1328
+ * site when you need a member, e.g. `passes.velocity as TextureNode`.
1329
+ *
1330
+ * The index signature admits `undefined` because a key may simply not be registered, and
1331
+ * because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
1332
+ * optional property whose type excludes `undefined` from the index signature is an error
1333
+ * (TS2411) for every consumer compiling these declarations.
1473
1334
  */
1474
- export function Fn<R extends Node = Node>(
1475
- jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
1476
- layout: { layout?: unknown },
1477
- ): ShaderCallable<R>
1335
+ interface PassRecord {
1336
+ scenePass?: ScenePassNode
1337
+ [key: string]: three_webgpu.Node | undefined
1338
+ }
1478
1339
 
1479
1340
  /**
1480
- * Fn with object params + layout
1341
+ * State passed to pipeline callbacks after the active pipeline has been created.
1342
+ *
1343
+ * `passes.scenePass` is required here: the hook installs the default scene pass before either
1344
+ * callback runs, so callbacks can use it without a guard or a cast.
1345
+ *
1346
+ * `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
1347
+ * the legacy renderer before either callback can run, so a callback never sees WebGL.
1481
1348
  */
1482
- export function Fn<T extends Record<string, unknown>, R extends Node = Node>(
1483
- jsFunc: (inputs: T) => ShaderNodeObject<R>,
1484
- layout: { layout?: unknown },
1485
- ): ShaderCallable<R>
1486
- }
1487
-
1488
- /**
1489
- * RenderPipeline Types for useRenderPipeline hook (WebGPU only)
1490
- */
1491
-
1492
-
1349
+ type RenderPipelineCallbackState = RootState & {
1350
+ renderPipeline: ThreeRenderPipeline
1351
+ passes: PassRecord & { scenePass: ScenePassNode }
1352
+ renderer: three_webgpu.WebGPURenderer
1353
+ isLegacy: false
1354
+ }
1493
1355
 
1494
- declare global {
1495
- /** Pass record - stores TSL pass nodes for render pipeline */
1496
- type PassRecord = Record<string, any>
1356
+ /**
1357
+ * What a callback may return to register entries into `state.passes`.
1358
+ *
1359
+ * `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
1360
+ * created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
1361
+ * store entry would leave the store pointing at a node the hook never disposes, and the hook
1362
+ * disposing a pass nothing references. So returning it is a type error.
1363
+ */
1364
+ type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
1497
1365
 
1498
1366
  /** Setup callback - runs first to configure MRT, create additional passes */
1499
- type RenderPipelineSetupCallback = (state: RootState) => PassRecord | void
1367
+ type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1500
1368
 
1501
1369
  /** Main callback - runs second to configure outputNode, create effect passes */
1502
- type RenderPipelineMainCallback = (state: RootState) => PassRecord | void
1370
+ type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1503
1371
 
1504
- /** Return type for useRenderPipeline hook */
1505
- interface UseRenderPipelineReturn {
1372
+ /** The imperative half of useRenderPipeline's return value, present in every state */
1373
+ interface UseRenderPipelineActions {
1506
1374
  /** Current passes from state */
1507
1375
  passes: PassRecord
1508
- /** RenderPipeline instance (null if not initialized) */
1509
- renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
1510
1376
  /** Clear all passes from state */
1511
1377
  clearPasses: () => void
1512
1378
  /** Reset RenderPipeline entirely (clears PP + passes) */
1513
1379
  reset: () => void
1514
1380
  /** Re-run setup/main callbacks with current closure values */
1515
1381
  rebuild: () => void
1516
- /** True when RenderPipeline is configured and ready */
1517
- isReady: boolean
1518
- }
1519
- }
1520
-
1521
- //* useFrameNext Types ==============================
1522
-
1523
-
1524
-
1525
- //* Global Type Declarations ==============================
1526
-
1527
- declare global {
1528
- // Job --------------------------------
1529
-
1530
- /**
1531
- * Internal job representation in the scheduler
1532
- */
1533
- interface Job {
1534
- /** Unique identifier */
1535
- id: string
1536
- /** The callback to execute */
1537
- callback: FrameNextCallback
1538
- /** Phase this job belongs to */
1539
- phase: string
1540
- /** Run before these phases/job ids */
1541
- before: Set<string>
1542
- /** Run after these phases/job ids */
1543
- after: Set<string>
1544
- /** Priority within phase (higher first) */
1545
- priority: number
1546
- /** Insertion order for deterministic tie-breaking */
1547
- index: number
1548
- /** Max FPS for this job (undefined = no limit) */
1549
- fps?: number
1550
- /** Drop frames when behind (true) or catch up (false) */
1551
- drop: boolean
1552
- /** Last run timestamp (ms) */
1553
- lastRun?: number
1554
- /** Whether job is enabled */
1555
- enabled: boolean
1556
- /** Internal flag: system jobs (like default render) don't block user render takeover */
1557
- system?: boolean
1558
- }
1559
-
1560
- // Phase Graph --------------------------------
1561
-
1562
- /**
1563
- * A node in the phase graph
1564
- */
1565
- interface PhaseNode {
1566
- /** Phase name */
1567
- name: string
1568
- /** Whether this was auto-generated from a before/after constraint */
1569
- isAutoGenerated: boolean
1570
- }
1571
-
1572
- /**
1573
- * Options for creating a job from hook options
1574
- */
1575
- interface JobOptions {
1576
- id?: string
1577
- phase?: string
1578
- before?: string | string[]
1579
- after?: string | string[]
1580
- priority?: number
1581
- fps?: number
1582
- drop?: boolean
1583
- enabled?: boolean
1584
- }
1585
-
1586
- // Frame Loop State --------------------------------
1587
-
1588
- /**
1589
- * Internal frame loop state
1590
- */
1591
- interface FrameLoopState {
1592
- /** Whether the loop is running */
1593
- running: boolean
1594
- /** Current RAF handle */
1595
- rafHandle: number | null
1596
- /** Last frame timestamp in ms (null = uninitialized) */
1597
- lastTime: number | null
1598
- /** Frame counter */
1599
- frameCount: number
1600
- /** Elapsed time since first frame in ms */
1601
- elapsedTime: number
1602
- /** createdAt timestamp in ms */
1603
- createdAt: number
1604
1382
  }
1605
1383
 
1606
- // Root Entry --------------------------------
1607
-
1608
1384
  /**
1609
- * Internal representation of a registered root (Canvas).
1610
- * Tracks jobs and manages rebuild state for this root.
1611
- * @internal
1612
- */
1613
- interface RootEntry {
1614
- /** Unique identifier for this root */
1615
- id: string
1616
- /** Function to get the root's current state. Returns any to support independent mode. */
1617
- getState: () => any
1618
- /** Map of job IDs to Job objects */
1619
- jobs: Map<string, Job>
1620
- /** Cached sorted job list for execution order */
1621
- sortedJobs: Job[]
1622
- /** Whether sortedJobs needs rebuilding */
1623
- needsRebuild: boolean
1624
- }
1625
-
1626
- /**
1627
- * Internal representation of a global job (deprecated API).
1628
- * Global jobs run once per frame, not per-root.
1629
- * Used by legacy addEffect/addAfterEffect APIs.
1630
- * @internal
1631
- * @deprecated Use useFrame with phases instead
1632
- */
1633
- interface GlobalJob {
1634
- /** Unique identifier for this global job */
1635
- id: string
1636
- /** Callback invoked with RAF timestamp in ms */
1637
- callback: (timestamp: number) => void
1638
- }
1639
-
1640
- // HMR Support --------------------------------
1641
-
1642
- /**
1643
- * Hot Module Replacement data structure for preserving scheduler state
1644
- * @internal
1645
- */
1646
- interface HMRData {
1647
- /** Shared data object for storing values across reloads */
1648
- data: Record<string, any>
1649
- /** Optional function to accept HMR updates */
1650
- accept?: () => void
1651
- }
1652
-
1653
- // Default Phases --------------------------------
1654
-
1655
- /**
1656
- * Default phase names for the scheduler
1385
+ * Return type for useRenderPipeline hook, discriminated on `isReady`.
1386
+ *
1387
+ * `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
1388
+ * callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
1389
+ * `clearPasses()` empties the record while leaving the pipeline in place.
1657
1390
  */
1658
- type DefaultPhase = 'start' | 'input' | 'physics' | 'update' | 'render' | 'finish'
1391
+ type UseRenderPipelineReturn = UseRenderPipelineActions &
1392
+ (
1393
+ | {
1394
+ /** True when RenderPipeline is configured and ready */
1395
+ isReady: true
1396
+ /** RenderPipeline instance */
1397
+ renderPipeline: ThreeRenderPipeline
1398
+ }
1399
+ | {
1400
+ /** False until the pipeline has been created */
1401
+ isReady: false
1402
+ /** Not initialized yet, or torn down by reset() */
1403
+ renderPipeline: null
1404
+ }
1405
+ )
1659
1406
  }
1660
1407
 
1661
1408
  type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
@@ -1734,10 +1481,11 @@ type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
1734
1481
 
1735
1482
  /**
1736
1483
  * For node material properties (colorNode, positionNode, etc.), accept broader types
1737
- * since @types/three has broken inheritance for TSL node subclasses.
1484
+ * since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
1485
+ * `nodeType`, so this structural key test remains neutral to the selected Three entry.
1738
1486
  */
1739
1487
  type NodeProps<P> = {
1740
- [K in keyof P as P[K] extends Node | null ? K : never]?: TSLNodeInput
1488
+ [K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
1741
1489
  }
1742
1490
 
1743
1491
  interface ReactProps<P> {
@@ -1758,11 +1506,29 @@ type ThreeToJSXElements<T extends Record<string, any>> = {
1758
1506
  [K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
1759
1507
  }
1760
1508
 
1509
+ /** Method names of Object3D, excluded from the `primitive` element's typed props. */
1510
+ type Object3DMethod = NonNullable<
1511
+ {
1512
+ [K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
1513
+ }[keyof Object3D]
1514
+ >
1515
+
1761
1516
  type ThreeExports = typeof import('three/webgpu')
1762
1517
  type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
1763
1518
 
1764
1519
  interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
1765
- primitive: Omit<ThreeElement<any>, 'args'> & { object: object }
1520
+ /**
1521
+ * `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
1522
+ * Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
1523
+ * untyped, and any other prop is accepted and applied to the object by name. Object3D's own
1524
+ * methods are left out of the typed surface: they return `this`, so a subclass element's
1525
+ * props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
1526
+ */
1527
+ primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | Object3DMethod> & {
1528
+ object: object
1529
+ ref?: React.Ref<any>
1530
+ [prop: string]: unknown
1531
+ }
1766
1532
  // Conflicts with DOM types can be accessed through a three* prefix
1767
1533
  threeAudio: ThreeElementsImpl['audio']
1768
1534
  threeSource: ThreeElementsImpl['source']
@@ -1803,6 +1569,7 @@ type three_d_Matrix3 = Matrix3;
1803
1569
  type three_d_Matrix4 = Matrix4;
1804
1570
  type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
1805
1571
  type three_d_NodeProps<P> = NodeProps<P>;
1572
+ type three_d_Object3DMethod = Object3DMethod;
1806
1573
  type three_d_Quaternion = Quaternion;
1807
1574
  type three_d_RaycastableRepresentation = RaycastableRepresentation;
1808
1575
  type three_d_ReactProps<P> = ReactProps<P>;
@@ -1817,7 +1584,7 @@ type three_d_Vector3 = Vector3;
1817
1584
  type three_d_Vector4 = Vector4;
1818
1585
  type three_d_VectorRepresentation = VectorRepresentation;
1819
1586
  declare namespace three_d {
1820
- 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 };
1587
+ 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 };
1821
1588
  }
1822
1589
 
1823
1590
  /**
@@ -1827,7 +1594,7 @@ declare namespace three_d {
1827
1594
  * a single WebGPURenderer using Three.js CanvasTarget API.
1828
1595
  *
1829
1596
  * Primary canvas: Has `id` prop, creates its own renderer, registers here
1830
- * Secondary canvas: Has `target="id"` prop, shares primary's renderer via CanvasTarget
1597
+ * Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
1831
1598
  */
1832
1599
 
1833
1600
  interface PrimaryCanvasEntry {
@@ -1895,12 +1662,23 @@ type EnvironmentLoaderProps = {
1895
1662
  * const texture = useEnvironment({ preset: 'sunset' })
1896
1663
  * ```
1897
1664
  */
1898
- declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture;
1665
+ declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
1899
1666
  declare namespace useEnvironment {
1900
1667
  var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
1901
1668
  var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
1902
1669
  }
1903
- type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'encoding'>;
1670
+ /**
1671
+ * Options accepted by `useEnvironment.preload`.
1672
+ *
1673
+ * `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
1674
+ * applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
1675
+ * advertise an option this function silently ignores.
1676
+ *
1677
+ * This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
1678
+ * `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
1679
+ * type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
1680
+ */
1681
+ type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
1904
1682
  type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
1905
1683
 
1906
1684
  /**
@@ -1944,9 +1722,9 @@ type EnvironmentProps = {
1944
1722
  blur?: number;
1945
1723
  backgroundBlurriness?: number;
1946
1724
  backgroundIntensity?: number;
1947
- backgroundRotation?: Euler$3;
1725
+ backgroundRotation?: Euler;
1948
1726
  environmentIntensity?: number;
1949
- environmentRotation?: Euler$3;
1727
+ environmentRotation?: Euler;
1950
1728
  map?: Texture$1;
1951
1729
  preset?: PresetsType;
1952
1730
  scene?: Scene | React$1.RefObject<Scene>;
@@ -2030,7 +1808,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
2030
1808
  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;
2031
1809
  declare module '@react-three/fiber' {
2032
1810
  interface ThreeElements {
2033
- groundProjectedEnvImpl: ThreeElement$1<typeof GroundedSkybox>;
1811
+ groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
2034
1812
  }
2035
1813
  }
2036
1814
  /**
@@ -2130,6 +1908,24 @@ declare module '@react-three/fiber' {
2130
1908
  */
2131
1909
  declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
2132
1910
 
1911
+ /**
1912
+ * Moves every trace of interactivity from one object to its replacement, for reconstruction.
1913
+ *
1914
+ * When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
1915
+ * instance. Removing the old object from the interaction state and registering the new one from
1916
+ * scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
1917
+ * the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
1918
+ * is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
1919
+ * swap the user never asked to see (#3744).
1920
+ *
1921
+ * Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
1922
+ * left alone — releasing and re-acquiring it is precisely the glitch being avoided.
1923
+ *
1924
+ * Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
1925
+ * the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
1926
+ * cannot outlive the object it described.
1927
+ */
1928
+ declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
2133
1929
  declare function removeInteractivity(store: RootStore, object: Object3D): void;
2134
1930
  declare function createEvents(store: RootStore): {
2135
1931
  handlePointer: (name: string) => (event: DomEvent) => void;
@@ -2137,7 +1933,7 @@ declare function createEvents(store: RootStore): {
2137
1933
  processDeferredPointer: (event: DomEvent, pointerId: number) => void;
2138
1934
  };
2139
1935
  /** Default R3F event manager for web */
2140
- declare function createPointerEvents(store: RootStore): EventManager<HTMLElement>;
1936
+ declare function createPointerEvents(store: RootStore): EventManager<Element>;
2141
1937
 
2142
1938
  /**
2143
1939
  * Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
@@ -2150,419 +1946,13 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
2150
1946
  * Note: this hook's caller must be wrapped with `React.Suspense`
2151
1947
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
2152
1948
  */
2153
- 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>;
1949
+ 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>;
2154
1950
  declare namespace useLoader {
2155
- var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
2156
- var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
1951
+ 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;
1952
+ var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
2157
1953
  var loader: typeof getLoader;
2158
1954
  }
2159
1955
 
2160
- /**
2161
- * Global Singleton Scheduler - manages the frame loop and job execution for ALL R3F roots.
2162
- *
2163
- * Features:
2164
- * - Single RAF loop for entire application
2165
- * - Root registration (multiple Canvas support)
2166
- * - Global phases for addEffect/addAfterEffect (deprecated)
2167
- * - Per-root job management with phases, priorities, FPS throttling
2168
- * - onIdle callbacks for addTail (deprecated)
2169
- * - Demand mode support via invalidate()
2170
- */
2171
- declare class Scheduler {
2172
- private static readonly INSTANCE_KEY;
2173
- private static get instance();
2174
- private static set instance(value);
2175
- /**
2176
- * Get the global scheduler instance (creates if doesn't exist).
2177
- * Uses HMR data to preserve instance across hot reloads.
2178
- * @returns {Scheduler} The singleton scheduler instance
2179
- */
2180
- static get(): Scheduler;
2181
- /**
2182
- * Reset the singleton instance. Stops the loop and clears all state.
2183
- * Primarily used for testing to ensure clean state between tests.
2184
- * @returns {void}
2185
- */
2186
- static reset(): void;
2187
- private roots;
2188
- private phaseGraph;
2189
- private loopState;
2190
- private stoppedTime;
2191
- private nextRootIndex;
2192
- private globalBeforeJobs;
2193
- private globalAfterJobs;
2194
- private nextGlobalIndex;
2195
- private idleCallbacks;
2196
- private nextJobIndex;
2197
- private jobStateListeners;
2198
- private pendingFrames;
2199
- private _frameloop;
2200
- private _independent;
2201
- private errorHandler;
2202
- private rootReadyCallbacks;
2203
- get phases(): string[];
2204
- get frameloop(): Frameloop;
2205
- set frameloop(mode: Frameloop);
2206
- get isRunning(): boolean;
2207
- get isReady(): boolean;
2208
- get independent(): boolean;
2209
- set independent(value: boolean);
2210
- constructor();
2211
- /**
2212
- * Register a root (Canvas) with the scheduler.
2213
- * The first root to register starts the RAF loop (if frameloop='always').
2214
- * @param {string} id - Unique identifier for this root
2215
- * @param {RootOptions} [options] - Optional configuration with getState and onError callbacks
2216
- * @returns {() => void} Unsubscribe function to remove this root
2217
- */
2218
- registerRoot(id: string, options?: RootOptions): () => void;
2219
- /**
2220
- * Unregister a root from the scheduler.
2221
- * Cleans up all job state listeners for this root's jobs.
2222
- * The last root to unregister stops the RAF loop.
2223
- * @param {string} id - The root ID to unregister
2224
- * @returns {void}
2225
- */
2226
- unregisterRoot(id: string): void;
2227
- /**
2228
- * Subscribe to be notified when a root becomes available.
2229
- * Fires immediately if a root already exists.
2230
- * @param {() => void} callback - Function called when first root registers
2231
- * @returns {() => void} Unsubscribe function
2232
- */
2233
- onRootReady(callback: () => void): () => void;
2234
- /**
2235
- * Notify all registered root-ready callbacks.
2236
- * Called when the first root registers.
2237
- * @returns {void}
2238
- * @private
2239
- */
2240
- private notifyRootReady;
2241
- /**
2242
- * Ensure a default root exists for independent mode.
2243
- * Creates a minimal root with no state provider.
2244
- * @returns {void}
2245
- * @private
2246
- */
2247
- private ensureDefaultRoot;
2248
- /**
2249
- * Trigger error handling for job errors.
2250
- * Uses the bound error handler if available, otherwise logs to console.
2251
- * @param {Error} error - The error to handle
2252
- * @returns {void}
2253
- */
2254
- triggerError(error: Error): void;
2255
- /**
2256
- * Add a named phase to the scheduler's execution order.
2257
- * Marks all roots for rebuild to incorporate the new phase.
2258
- * @param {string} name - The phase name (e.g., 'physics', 'postprocess')
2259
- * @param {AddPhaseOptions} [options] - Positioning options (before/after other phases)
2260
- * @returns {void}
2261
- * @example
2262
- * scheduler.addPhase('physics', { before: 'update' });
2263
- * scheduler.addPhase('postprocess', { after: 'render' });
2264
- */
2265
- addPhase(name: string, options?: AddPhaseOptions): void;
2266
- /**
2267
- * Check if a phase exists in the scheduler.
2268
- * @param {string} name - The phase name to check
2269
- * @returns {boolean} True if the phase exists
2270
- */
2271
- hasPhase(name: string): boolean;
2272
- /**
2273
- * Register a global job that runs once per frame (not per-root).
2274
- * Used internally by deprecated addEffect/addAfterEffect APIs.
2275
- * @param {'before' | 'after'} phase - When to run: 'before' all roots or 'after' all roots
2276
- * @param {string} id - Unique identifier for this global job
2277
- * @param {(timestamp: number) => void} callback - Function called each frame with RAF timestamp
2278
- * @returns {() => void} Unsubscribe function to remove this global job
2279
- * @deprecated Use useFrame with phases instead
2280
- */
2281
- registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void;
2282
- /**
2283
- * Register an idle callback that fires when the loop stops.
2284
- * Used internally by deprecated addTail API.
2285
- * @param {(timestamp: number) => void} callback - Function called when loop becomes idle
2286
- * @returns {() => void} Unsubscribe function to remove this idle callback
2287
- * @deprecated Use demand mode with invalidate() instead
2288
- */
2289
- onIdle(callback: (timestamp: number) => void): () => void;
2290
- /**
2291
- * Notify all registered idle callbacks.
2292
- * Called when the loop stops in demand mode.
2293
- * @param {number} timestamp - The RAF timestamp when idle occurred
2294
- * @returns {void}
2295
- * @private
2296
- */
2297
- private notifyIdle;
2298
- /**
2299
- * Register a job (frame callback) with a specific root.
2300
- * This is the core registration method used by useFrame internally.
2301
- * @param {FrameNextCallback} callback - The function to call each frame
2302
- * @param {JobOptions & { rootId?: string; system?: boolean }} [options] - Job configuration
2303
- * @param {string} [options.rootId] - Target root ID (defaults to first registered root)
2304
- * @param {string} [options.id] - Unique job ID (auto-generated if not provided)
2305
- * @param {string} [options.phase] - Execution phase (defaults to 'update')
2306
- * @param {number} [options.priority] - Priority within phase (higher = earlier, default 0)
2307
- * @param {number} [options.fps] - FPS throttle limit
2308
- * @param {boolean} [options.drop] - Drop frames when behind (default true)
2309
- * @param {boolean} [options.enabled] - Whether job is active (default true)
2310
- * @param {boolean} [options.system] - Internal flag for system jobs (not user-facing)
2311
- * @returns {() => void} Unsubscribe function to remove this job
2312
- */
2313
- register(callback: FrameNextCallback, options?: JobOptions & {
2314
- rootId?: string;
2315
- system?: boolean;
2316
- }): () => void;
2317
- /**
2318
- * Unregister a job by its ID.
2319
- * Searches all roots if rootId is not provided.
2320
- * @param {string} id - The job ID to unregister
2321
- * @param {string} [rootId] - Optional root ID to search (searches all if not provided)
2322
- * @returns {void}
2323
- */
2324
- unregister(id: string, rootId?: string): void;
2325
- /**
2326
- * Update a job's options dynamically.
2327
- * Searches all roots to find the job by ID.
2328
- * Phase/constraint changes trigger a rebuild of the sorted job list.
2329
- * @param {string} id - The job ID to update
2330
- * @param {Partial<JobOptions>} options - The options to update
2331
- * @returns {void}
2332
- */
2333
- updateJob(id: string, options: Partial<JobOptions>): void;
2334
- /**
2335
- * Check if a job is currently paused (disabled).
2336
- * @param {string} id - The job ID to check
2337
- * @returns {boolean} True if the job exists and is paused
2338
- */
2339
- isJobPaused(id: string): boolean;
2340
- /**
2341
- * Subscribe to state changes for a specific job.
2342
- * Listener is called when job is paused or resumed.
2343
- * @param {string} id - The job ID to subscribe to
2344
- * @param {() => void} listener - Callback invoked on state changes
2345
- * @returns {() => void} Unsubscribe function
2346
- */
2347
- subscribeJobState(id: string, listener: () => void): () => void;
2348
- /**
2349
- * Notify all listeners that a job's state has changed.
2350
- * @param {string} id - The job ID that changed
2351
- * @returns {void}
2352
- * @private
2353
- */
2354
- private notifyJobStateChange;
2355
- /**
2356
- * Pause a job by ID (sets enabled=false).
2357
- * Notifies any subscribed state listeners.
2358
- * @param {string} id - The job ID to pause
2359
- * @returns {void}
2360
- */
2361
- pauseJob(id: string): void;
2362
- /**
2363
- * Resume a paused job by ID (sets enabled=true).
2364
- * Resets job timing to prevent frame accumulation.
2365
- * Notifies any subscribed state listeners.
2366
- * @param {string} id - The job ID to resume
2367
- * @returns {void}
2368
- */
2369
- resumeJob(id: string): void;
2370
- /**
2371
- * Start the requestAnimationFrame loop.
2372
- * Resets timing state (elapsedTime, frameCount) on start.
2373
- * No-op if already running.
2374
- * @returns {void}
2375
- */
2376
- start(): void;
2377
- /**
2378
- * Stop the requestAnimationFrame loop.
2379
- * Cancels any pending RAF callback.
2380
- * No-op if not running.
2381
- * @returns {void}
2382
- */
2383
- stop(): void;
2384
- /**
2385
- * Request frames to be rendered in demand mode.
2386
- * Accumulates pending frames (capped at 60) and starts the loop if not running.
2387
- * No-op if frameloop is not 'demand'.
2388
- * @param {number} [frames=1] - Number of frames to request
2389
- * @param {boolean} [stackFrames=false] - Whether to add frames to existing pending count
2390
- * - `false` (default): Sets pending frames to the specified value (replaces existing count)
2391
- * - `true`: Adds frames to existing pending count (useful for accumulating invalidations)
2392
- * @returns {void}
2393
- * @example
2394
- * // Request a single frame render
2395
- * scheduler.invalidate();
2396
- *
2397
- * @example
2398
- * // Request 5 frames (e.g., for animations)
2399
- * scheduler.invalidate(5);
2400
- *
2401
- * @example
2402
- * // Set pending frames to exactly 3 (don't stack with existing)
2403
- * scheduler.invalidate(3, false);
2404
- *
2405
- * @example
2406
- * // Add 2 more frames to existing pending count
2407
- * scheduler.invalidate(2, true);
2408
- */
2409
- invalidate(frames?: number, stackFrames?: boolean): void;
2410
- /**
2411
- * Reset timing state for deterministic testing.
2412
- * Preserves jobs and roots but resets lastTime, frameCount, elapsedTime, etc.
2413
- * @returns {void}
2414
- */
2415
- resetTiming(): void;
2416
- /**
2417
- * Manually execute a single frame for all roots.
2418
- * Useful for frameloop='never' mode or testing scenarios.
2419
- * @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
2420
- * @returns {void}
2421
- * @example
2422
- * // Manual control mode
2423
- * scheduler.frameloop = 'never';
2424
- * scheduler.step(); // Execute one frame
2425
- */
2426
- step(timestamp?: number): void;
2427
- /**
2428
- * Manually execute a single job by its ID.
2429
- * Useful for testing individual job callbacks in isolation.
2430
- * @param {string} id - The job ID to step
2431
- * @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
2432
- * @returns {void}
2433
- */
2434
- stepJob(id: string, timestamp?: number): void;
2435
- /**
2436
- * Main RAF loop callback.
2437
- * Executes frame, handles demand mode, and schedules next frame.
2438
- * @param {number} timestamp - RAF timestamp in milliseconds
2439
- * @returns {void}
2440
- * @private
2441
- */
2442
- private loop;
2443
- /**
2444
- * Execute a single frame across all roots.
2445
- * Order: globalBefore → each root's jobs → globalAfter
2446
- * @param {number} timestamp - RAF timestamp in milliseconds
2447
- * @returns {void}
2448
- * @private
2449
- */
2450
- private executeFrame;
2451
- /**
2452
- * Run all global jobs from a job map.
2453
- * Catches and logs errors without stopping execution.
2454
- * @param {Map<string, GlobalJob>} jobs - The global jobs map to execute
2455
- * @param {number} timestamp - RAF timestamp in milliseconds
2456
- * @returns {void}
2457
- * @private
2458
- */
2459
- private runGlobalJobs;
2460
- /**
2461
- * Execute all jobs for a single root in sorted order.
2462
- * Rebuilds sorted job list if needed, then dispatches each job.
2463
- * Errors are caught and propagated via triggerError.
2464
- * @param {RootEntry} root - The root entry to tick
2465
- * @param {number} timestamp - RAF timestamp in milliseconds
2466
- * @param {number} delta - Time since last frame in seconds
2467
- * @returns {void}
2468
- * @private
2469
- */
2470
- private tickRoot;
2471
- /**
2472
- * Get the total number of registered jobs across all roots.
2473
- * Includes both per-root jobs and global before/after jobs.
2474
- * @returns {number} Total job count
2475
- */
2476
- getJobCount(): number;
2477
- /**
2478
- * Get all registered job IDs across all roots.
2479
- * Includes both per-root jobs and global before/after jobs.
2480
- * @returns {string[]} Array of all job IDs
2481
- */
2482
- getJobIds(): string[];
2483
- /**
2484
- * Get the number of registered roots (Canvas instances).
2485
- * @returns {number} Number of registered roots
2486
- */
2487
- getRootCount(): number;
2488
- /**
2489
- * Check if any user (non-system) jobs are registered in a specific phase.
2490
- * Used by the default render job to know if a user has taken over rendering.
2491
- *
2492
- * @param phase The phase to check
2493
- * @param rootId Optional root ID to check (checks all roots if not provided)
2494
- * @returns true if any user jobs exist in the phase
2495
- */
2496
- hasUserJobsInPhase(phase: string, rootId?: string): boolean;
2497
- /**
2498
- * Generate a unique root ID for automatic root registration.
2499
- * @returns {string} A unique root ID in the format 'root_N'
2500
- */
2501
- generateRootId(): string;
2502
- /**
2503
- * Generate a unique job ID.
2504
- * @returns {string} A unique job ID in the format 'job_N'
2505
- * @private
2506
- */
2507
- private generateJobId;
2508
- /**
2509
- * Normalize before/after constraints to a Set.
2510
- * Handles undefined, single string, or array inputs.
2511
- * @param {string | string[] | undefined} value - The constraint value(s)
2512
- * @returns {Set<string>} Normalized Set of constraint strings
2513
- * @private
2514
- */
2515
- private normalizeConstraints;
2516
- }
2517
- /**
2518
- * Get the global scheduler instance.
2519
- * Creates one if it doesn't exist.
2520
- */
2521
- declare const getScheduler: () => Scheduler;
2522
-
2523
- /**
2524
- * Frame hook with phase-based ordering, priority, and FPS throttling.
2525
- *
2526
- * Works both inside and outside Canvas context:
2527
- * - Inside Canvas: Full RootState (gl, scene, camera, etc.)
2528
- * - Outside Canvas (waiting mode): Waits for Canvas to mount, then gets full state
2529
- * - Outside Canvas (independent mode): Fires immediately with timing-only state
2530
- *
2531
- * Returns a controls object for manual stepping, pausing, and resuming.
2532
- *
2533
- * @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
2534
- * @param priorityOrOptions - Either a priority number (backwards compat) or options object
2535
- * @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
2536
- *
2537
- * @example
2538
- * // Simple priority (backwards compat)
2539
- * useFrame((state, delta) => { ... }, 5)
2540
- *
2541
- * @example
2542
- * // With phase-based ordering
2543
- * useFrame((state, delta) => { ... }, { phase: 'physics' })
2544
- *
2545
- * @example
2546
- * // Outside Canvas - waits for Canvas to mount
2547
- * function UI() {
2548
- * useFrame((state, delta) => { syncUI(state.camera) });
2549
- * return <button>...</button>;
2550
- * }
2551
- *
2552
- * @example
2553
- * // Independent mode - no Canvas needed
2554
- * getScheduler().independent = true;
2555
- * useFrame((state, delta) => { updateGame(delta) });
2556
- *
2557
- * @example
2558
- * // Scheduler-only access (no callback)
2559
- * const { scheduler } = useFrame()
2560
- * scheduler.pauseJob('some-job-id')
2561
- *
2562
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
2563
- */
2564
- declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
2565
-
2566
1956
  declare const IsObject: (url: unknown) => url is Record<string, string>;
2567
1957
  type TextureArray<T> = T extends string[] ? Texture$1[] : never;
2568
1958
  type TextureRecord<T> = T extends Record<string, string> ? {
@@ -2575,11 +1965,16 @@ type UseTextureOptions<Url extends string[] | string | Record<string, string>> =
2575
1965
  /** Callback when texture(s) finish loading */
2576
1966
  onLoad?: (texture: MappedTextureType<Url>) => void;
2577
1967
  /**
2578
- * Cache the texture in R3F's global state for access via useTextures().
2579
- * When true:
1968
+ * Register the texture(s) in R3F's global texture registry for access via useTextures().
1969
+ * When true (the default):
2580
1970
  * - Textures persist until explicitly disposed
2581
- * - Returns existing cached textures if available (preserving modifications like colorSpace)
2582
- * @default false
1971
+ * - On mount, returns existing registered textures if available (preserving modifications like colorSpace)
1972
+ *
1973
+ * Reads are taken once at mount — a mounted `useTexture` does not re-render when the registry
1974
+ * changes. To react to registry swaps, use `useTextures(s => s.get(key))` instead.
1975
+ *
1976
+ * Pass `false` to opt out of registry enrollment entirely.
1977
+ * @default true
2583
1978
  */
2584
1979
  cache?: boolean;
2585
1980
  };
@@ -2603,15 +1998,18 @@ type UseTextureOptions<Url extends string[] | string | Record<string, string>> =
2603
1998
  * normal: '/normal.png'
2604
1999
  * })
2605
2000
  *
2606
- * // With caching - returns same texture object across components
2607
- * // Modifications (colorSpace, wrapS, etc.) are preserved
2608
- * const diffuse = useTexture('/diffuse.png', { cache: true })
2001
+ * // Textures are registered in the global registry by default — the same texture
2002
+ * // object is shared across components and modifications (colorSpace, wrapS, etc.) are preserved
2003
+ * const diffuse = useTexture('/diffuse.png')
2609
2004
  * diffuse.colorSpace = THREE.SRGBColorSpace
2610
2005
  *
2611
2006
  * // Another component gets the SAME texture with colorSpace already set
2612
- * const sameDiffuse = useTexture('/diffuse.png', { cache: true })
2007
+ * const sameDiffuse = useTexture('/diffuse.png')
2008
+ *
2009
+ * // Opt out of registry enrollment for a one-off texture
2010
+ * const scratch = useTexture('/scratch.png', { cache: false })
2613
2011
  *
2614
- * // Access cache directly
2012
+ * // Access the registry directly
2615
2013
  * const { get } = useTextures()
2616
2014
  * const cached = get('/diffuse.png')
2617
2015
  * ```
@@ -2628,63 +2026,80 @@ declare const Texture: ({ children, input, onLoad, cache, }: {
2628
2026
  cache?: boolean;
2629
2027
  }) => react_jsx_runtime.JSX.Element;
2630
2028
 
2631
- type TextureEntry = Texture$1 | {
2632
- value: Texture$1;
2633
- [key: string]: any;
2029
+ /** Accepted shapes for a registry read: a single key, a list of keys, or a name→key map. */
2030
+ type TextureInput = string | string[] | Record<string, string>;
2031
+ /** Result of a `get()` read, mirroring the input shape. */
2032
+ type TextureResult<Input extends TextureInput> = Input extends string ? Texture$1 | undefined : Input extends string[] ? (Texture$1 | undefined)[] : {
2033
+ [K in keyof Input]: Texture$1 | undefined;
2634
2034
  };
2035
+ /** Options for `dispose()`. */
2036
+ interface DisposeOptions {
2037
+ /** Dispose even if the texture still has active references (default false). */
2038
+ force?: boolean;
2039
+ }
2635
2040
  interface UseTexturesReturn {
2636
- /** Map of all textures currently in cache */
2637
- textures: Map<string, TextureEntry>;
2638
- /** Get a specific texture by key (usually URL) */
2639
- get: (key: string) => TextureEntry | undefined;
2640
- /** Check if a texture exists in cache */
2641
- has: (key: string) => boolean;
2642
- /** Add a texture to the cache */
2643
- add: (key: string, value: TextureEntry) => void;
2644
- /** Add multiple textures to the cache */
2645
- addMultiple: (items: Map<string, TextureEntry> | Record<string, TextureEntry>) => void;
2646
- /** Remove a texture from cache (does NOT dispose GPU resources) */
2647
- remove: (key: string) => void;
2648
- /** Remove multiple textures from cache */
2649
- removeMultiple: (keys: string[]) => void;
2650
- /** Dispose a texture's GPU resources and remove from cache */
2651
- dispose: (key: string) => void;
2652
- /** Dispose multiple textures */
2653
- disposeMultiple: (keys: string[]) => void;
2654
- /** Dispose ALL cached textures - use with caution */
2655
- disposeAll: () => void;
2041
+ /** The live registry Map (key → Texture). Treat as read-only. */
2042
+ readonly all: Map<string, Texture$1>;
2043
+ /** Read one texture, an array of textures, or a name→texture record (mirrors the input shape). */
2044
+ get<Input extends TextureInput>(input: Input): TextureResult<Input>;
2045
+ /** Check whether a key exists in the registry. */
2046
+ has(key: string): boolean;
2047
+ /**
2048
+ * Register a texture (or a record of textures) that has no URL — e.g. a render
2049
+ * target or procedural texture. URL-loaded textures are registered automatically
2050
+ * by `useTexture` (registry enrollment is on by default).
2051
+ */
2052
+ add(key: string, texture: Texture$1): void;
2053
+ add(record: Record<string, Texture$1>): void;
2054
+ /**
2055
+ * Dispose a texture's GPU resources and remove it from the registry.
2056
+ * Refcount-aware: if the key is still in use by a mounted `useTexture` consumer it is
2057
+ * skipped (with a warning) unless `{ force: true }` is passed.
2058
+ * @returns true if disposed, false if skipped.
2059
+ */
2060
+ dispose(key: string, options?: DisposeOptions): boolean;
2061
+ /** Dispose every texture in the registry and clear it. Use on scene teardown. */
2062
+ disposeAll(): void;
2656
2063
  }
2657
2064
  /**
2658
- * Hook for managing the global texture cache in R3F state.
2065
+ * Reactive Texture registry — load once with `useTexture`, reach the textures from anywhere.
2659
2066
  *
2660
- * Textures are stored in a Map with URL/path keys for efficient lookup.
2661
- * Useful for sharing texture references across materials and components.
2067
+ * This is a registry of plain `Texture` objects (not TSL nodes), so the same texture can feed
2068
+ * a material map, a heightmap sampler, or anything else. It does **not** load — pair it with
2069
+ * `useTexture` for loading (registry enrollment is on by default); `useTextures` is for access and lifecycle.
2070
+ *
2071
+ * The returned handle is **reactive**: the calling component re-renders when the registry
2072
+ * changes. Pass a selector to scope the subscription to a single read.
2662
2073
  *
2663
2074
  * @example
2664
2075
  * ```tsx
2665
- * const { textures, add, get, remove, has, dispose } = useTextures()
2666
- *
2667
- * // Check if texture is already cached
2668
- * if (!has('/textures/diffuse.png')) {
2669
- * // Load with useTexture and cache: true, or manually add
2670
- * const tex = useTexture('/textures/diffuse.png', { cache: true })
2671
- * }
2076
+ * // Load + register once (anywhere in the tree) — registered by default
2077
+ * useTexture({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
2672
2078
  *
2673
- * // Access cached texture from anywhere
2674
- * const diffuse = get('/textures/diffuse.png')
2675
- * if (diffuse) material.map = diffuse
2079
+ * // Reach them from another component — record form lands straight into a material
2080
+ * const { map, normalMap } = useTextures().get({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
2081
+ * return <meshStandardMaterial map={map} normalMap={normalMap} />
2676
2082
  *
2677
- * // Remove from cache only (texture still in GPU memory)
2678
- * remove('/textures/old.png')
2083
+ * // A set of heightmaps at once
2084
+ * const [a, b, c] = useTextures().get(['/h0.png', '/h1.png', '/h2.png'])
2679
2085
  *
2680
- * // Fully dispose (frees GPU memory + removes from cache)
2681
- * dispose('/textures/unused.png')
2086
+ * // Register a non-URL texture (render target / procedural)
2087
+ * useTextures().add('rt-main', renderTarget.texture)
2682
2088
  *
2683
- * // Nuclear option - dispose everything
2684
- * disposeAll()
2089
+ * // Deliberate GPU cleanup (refcount-aware; force to override)
2090
+ * useTextures().dispose('/diffuse.jpg')
2091
+ * useTextures().disposeAll() // scene teardown
2685
2092
  * ```
2093
+ *
2094
+ * @remarks
2095
+ * **Future expansion:** an imperative async loader (e.g. `await useTextures().load('/x.jpg')`) is
2096
+ * intentionally not included yet. It would let non-React code (loading screens, dynamic streaming)
2097
+ * populate the registry without Suspense, at the cost of putting loading back into this hook. It
2098
+ * will be added only if a concrete consumer needs imperative loading; for now, loading lives in
2099
+ * `useTexture`.
2686
2100
  */
2687
2101
  declare function useTextures(): UseTexturesReturn;
2102
+ declare function useTextures<T>(selector: (registry: UseTexturesReturn) => T): T;
2688
2103
 
2689
2104
  /**
2690
2105
  * Creates a render target compatible with the current renderer.
@@ -2723,11 +2138,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
2723
2138
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
2724
2139
  */
2725
2140
  declare function useStore(): RootStore;
2726
- /**
2727
- * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
2728
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
2729
- */
2730
- declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
2731
2141
  /**
2732
2142
  * Exposes an object's {@link Instance}.
2733
2143
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
@@ -2803,7 +2213,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
2803
2213
  * Invalidates the view, requesting a frame to be rendered.
2804
2214
  * In demand mode, this triggers the scheduler to run frames.
2805
2215
  *
2806
- * @param state - Optional root state (ignored in new scheduler, kept for backwards compat)
2216
+ * With a state argument, only that root's jobs run on the requested frames; other
2217
+ * roots on 'demand' stay idle. Without one, every registered root is invalidated.
2218
+ *
2219
+ * @param state - Optional root state; targets the invalidation at that root
2807
2220
  * @param frames - Number of frames to request (default: 1)
2808
2221
  * @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
2809
2222
  *
@@ -2814,14 +2227,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
2814
2227
  * Advances the frameloop and runs render effects.
2815
2228
  * Useful for when manually rendering via `frameloop="never"`.
2816
2229
  *
2230
+ * With a state argument, only that root is stepped. Without one, every
2231
+ * registered root is stepped for backwards compatibility.
2232
+ *
2817
2233
  * @param timestamp - The timestamp to use for this frame
2818
2234
  * @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
2819
- * @param state - Ignored (kept for backwards compat)
2820
- * @param frame - Ignored (kept for backwards compat)
2235
+ * @param state - Optional root state; targets the manual step at that root
2821
2236
  *
2822
2237
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
2823
2238
  */
2824
- declare function advance(timestamp: number): void;
2239
+ declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
2825
2240
 
2826
2241
  /* eslint-disable @definitelytyped/no-unnecessary-generics */
2827
2242
  declare function ReactReconciler<
@@ -3866,6 +3281,7 @@ declare namespace ReactReconciler {
3866
3281
 
3867
3282
  declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
3868
3283
  declare function extend<T extends Catalogue>(objects: T): void;
3284
+ declare function extend(objects: Record<string, unknown>): void;
3869
3285
  declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
3870
3286
 
3871
3287
  declare const isRenderer: (def: any) => boolean;
@@ -3892,11 +3308,6 @@ declare function flushSync<R>(fn: () => R): R;
3892
3308
  declare const context: React$1.Context<RootStore>;
3893
3309
  declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
3894
3310
 
3895
- /**
3896
- * Safely flush async effects when testing, simulating a legacy root.
3897
- * @deprecated Import from React instead. import { act } from 'react'
3898
- */
3899
- declare const act: typeof React$1.act;
3900
3311
  /**
3901
3312
  * An SSR-friendly useLayoutEffect.
3902
3313
  *
@@ -4148,7 +3559,7 @@ declare function getInstanceProps<T = any>(pendingProps: Record<string, unknown>
4148
3559
  declare function prepare<T = any>(target: T, root: RootStore, type: string, props: Instance<T>['props']): Instance<T>;
4149
3560
  /**
4150
3561
  * Triggers an update for an instance.
4151
- * Calls onUpdate callback and invalidates the frame if necessary.
3562
+ * Invalidates the frame if the root is in demand mode.
4152
3563
  *
4153
3564
  * @param instance - Instance to invalidate
4154
3565
  */
@@ -4314,29 +3725,44 @@ declare const hasConstructor: (object: unknown) => object is {
4314
3725
  * Used to identify values that should be resolved from refs after mount.
4315
3726
  */
4316
3727
  declare const FROM_REF: unique symbol;
3728
+ /** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
3729
+ interface FromRefMarker<T = unknown, R = T> {
3730
+ [FROM_REF]: React$1.RefObject<T | null>;
3731
+ /** Optional transform applied to the resolved ref before assignment. */
3732
+ transform?: (value: T) => R;
3733
+ }
4317
3734
  /**
4318
3735
  * Defers prop application until the referenced object is available.
4319
3736
  * Useful for props like `target` that need sibling refs to be populated.
4320
3737
  *
3738
+ * Only top-level props on a three element are resolved: a marker nested inside another value
3739
+ * (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
3740
+ * than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
3741
+ * what gets assigned.
3742
+ *
4321
3743
  * @param ref - React ref object to resolve at mount time
4322
- * @returns A marker value that applyProps will resolve after mount
3744
+ * @param transform - Optional mapping from the resolved object to the value the prop expects
3745
+ * @returns A marker value that the reconciler resolves after mount
4323
3746
  *
4324
3747
  * @example
4325
3748
  * const targetRef = useRef<THREE.Object3D>(null)
4326
3749
  *
4327
3750
  * <group ref={targetRef} position={[-3, -2, -15]} />
4328
3751
  * <spotLight target={fromRef(targetRef)} intensity={100} />
3752
+ *
3753
+ * @example
3754
+ * // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
3755
+ * <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
4329
3756
  */
4330
3757
  declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
3758
+ declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
4331
3759
  /**
4332
3760
  * Type guard to check if a value is a fromRef marker.
4333
3761
  *
4334
3762
  * @param value - Value to check
4335
3763
  * @returns True if value is a fromRef marker
4336
3764
  */
4337
- declare function isFromRef(value: unknown): value is {
4338
- [FROM_REF]: React$1.RefObject<any>;
4339
- };
3765
+ declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
4340
3766
 
4341
3767
  /**
4342
3768
  * Symbol marker for mount-only method calls.
@@ -4363,7 +3789,15 @@ declare const ONCE: unique symbol;
4363
3789
  * // No arguments
4364
3790
  * <geometry center={once()} />
4365
3791
  */
4366
- declare function once<T>(...args: T[]): T;
3792
+ declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
3793
+ /**
3794
+ * What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
3795
+ * the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
3796
+ * methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
3797
+ *
3798
+ * The runtime value is always the marker object; only the declared type follows the prop.
3799
+ */
3800
+ type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
4367
3801
  /**
4368
3802
  * Type guard to check if a value is a once marker.
4369
3803
  *
@@ -4374,11 +3808,8 @@ declare function isOnce(value: unknown): value is {
4374
3808
  [ONCE]: any[] | true;
4375
3809
  };
4376
3810
 
4377
- /**
4378
- * A DOM canvas which accepts threejs elements as children.
4379
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
4380
- */
4381
- declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
3811
+ /** Distinguishes a resource leaf from a nested resource scope. */
3812
+ type ResourceLeafGuard<T> = (value: unknown) => value is T;
4382
3813
 
4383
3814
  /**
4384
3815
  * ScopedStore - Type-safe wrapper for nested stores (uniforms, nodes)
@@ -4400,33 +3831,30 @@ declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
4400
3831
  * ```
4401
3832
  */
4402
3833
 
4403
- /** Keys reserved for methods (excluded from index signature) */
4404
- type MethodKeys = 'scope' | 'has' | 'keys';
4405
3834
  /**
4406
3835
  * Type-safe wrapper interface for accessing nested store data.
4407
3836
  * Property access returns `T` (assumes leaf node).
4408
3837
  * Use `.scope(key)` for nested object access.
4409
3838
  *
4410
- * Uses mapped type with key filtering to exclude method names from index signature,
4411
- * allowing methods to have their correct return types.
4412
3839
  */
4413
- type ScopedStoreType<T> = {
4414
- /** Direct property access returns the leaf type T (method keys excluded) */
4415
- readonly [K in string as K extends MethodKeys ? never : K]: T;
4416
- } & {
3840
+ type ScopedStoreMethods<TLeaf> = {
4417
3841
  /** Access a nested scope by key. Returns empty wrapper if scope doesn't exist. */
4418
- scope(key: string): ScopedStoreType<T>;
3842
+ scope<TScope extends Record<string, TLeaf> = Record<string, TLeaf>>(key: string): ScopedStoreType<TLeaf, TScope>;
4419
3843
  /** Check if a key exists in the store */
4420
3844
  has(key: string): boolean;
4421
3845
  /** Get all keys in the store */
4422
3846
  keys(): string[];
4423
3847
  };
3848
+ type ScopedStoreType<TLeaf, TEntries extends Record<string, TLeaf> = Record<string, TLeaf>> = Readonly<TEntries> & ScopedStoreMethods<TLeaf>;
3849
+ interface ScopedStoreData<TLeaf> {
3850
+ [key: string]: TLeaf | ScopedStoreData<TLeaf>;
3851
+ }
4424
3852
  /**
4425
3853
  * Create a type-safe ScopedStore wrapper around store data.
4426
3854
  * @param data - The raw store data (uniforms or nodes from RootState)
4427
3855
  * @returns A ScopedStoreType wrapper with type-safe access
4428
3856
  */
4429
- declare function createScopedStore<T>(data: Record<string, any>): ScopedStoreType<T>;
3857
+ declare function createScopedStore<TLeaf>(data: ScopedStoreData<TLeaf>, isLeaf: ResourceLeafGuard<TLeaf>): ScopedStoreType<TLeaf>;
4430
3858
  /**
4431
3859
  * State type passed to creator functions with ScopedStore wrappers.
4432
3860
  * Provides type-safe access to uniforms, nodes, buffers, and gpuStorage without manual casting.
@@ -4434,8 +3862,8 @@ declare function createScopedStore<T>(data: Record<string, any>): ScopedStoreTyp
4434
3862
  type CreatorState = Omit<RootState, 'uniforms' | 'nodes' | 'buffers' | 'gpuStorage'> & {
4435
3863
  /** Type-safe uniform access - property access returns UniformNode */
4436
3864
  uniforms: ScopedStoreType<UniformNode>;
4437
- /** Type-safe node access - property access returns TSLNodeType (Node | ShaderCallable | ShaderNodeObject) */
4438
- nodes: ScopedStoreType<TSLNodeType>;
3865
+ /** Type-safe node access for real, callable, and legacy structural nodes */
3866
+ nodes: ScopedStoreType<NodeLike>;
4439
3867
  /** Type-safe buffer access - property access returns BufferLike (TypedArrays, BufferAttributes, TSL nodes) */
4440
3868
  buffers: ScopedStoreType<BufferLike>;
4441
3869
  /** Type-safe GPU storage access - property access returns StorageLike (StorageTexture, TSL nodes) */
@@ -4451,22 +3879,26 @@ type ClearUniformsFn = (scope?: string) => void;
4451
3879
  /** Function signature for rebuildUniforms util */
4452
3880
  type RebuildUniformsFn = (scope?: string) => void;
4453
3881
  /** Return type with utils included */
4454
- type UniformsWithUtils<T extends UniformRecord = UniformRecord> = T & {
3882
+ type UniformsWithUtils<T extends UniformRecord | UniformStore = UniformRecord> = T & {
4455
3883
  removeUniforms: RemoveUniformsFn;
4456
3884
  clearUniforms: ClearUniformsFn;
4457
3885
  rebuildUniforms: RebuildUniformsFn;
4458
3886
  };
4459
- declare function useUniforms(): UniformsWithUtils<UniformRecord & Record<string, UniformRecord>>;
3887
+ declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>): UniformsWithUtils<UniformNodesFor<T>>;
3888
+ declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
3889
+ declare function useUniforms<T extends UniformInputRecord>(uniforms: T): UniformsWithUtils<UniformNodesFor<T>>;
3890
+ declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
3891
+ declare function useUniforms(): UniformsWithUtils<UniformStore>;
4460
3892
  declare function useUniforms(scope: string): UniformsWithUtils;
4461
- declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>): UniformsWithUtils<UniformRecord<UniformNode>>;
4462
- declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
4463
- declare function useUniforms<T extends UniformInputRecord>(uniforms: T): UniformsWithUtils<UniformRecord<UniformNode>>;
4464
- declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
3893
+ declare function useUniforms<T extends UniformInputRecord>(scope?: string): UniformsWithUtils<UniformNodesFor<T>>;
4465
3894
  /**
4466
3895
  * Global rebuildUniforms function for HMR integration.
4467
- * Clears cached uniforms and increments _hmrVersion to trigger re-creation.
3896
+ * Invalidates cached uniforms and increments _hmrVersion to trigger re-creation.
4468
3897
  * Call this when HMR is detected to refresh all uniform creators.
4469
3898
  *
3899
+ * Resolves to the primary store so shared TSL resources rebuild on the
3900
+ * authoritative store.
3901
+ *
4470
3902
  * @param store - The R3F store (from useStore or context)
4471
3903
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4472
3904
  */
@@ -4489,47 +3921,28 @@ declare function clearRootUniforms(set: ReturnType<typeof useStore>['setState'])
4489
3921
 
4490
3922
  /**
4491
3923
  * Supported uniform value types:
4492
- * - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix3, Matrix4
3924
+ * - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix2, Matrix3, Matrix4
4493
3925
  * - String colors: '#ff0000', 'red', 'rgb(255,0,0)' (auto-converted to Color)
4494
3926
  * - TSL nodes: color(), vec3(), float(), etc. (for type casting)
4495
3927
  * - UniformNode: existing uniforms (reused as-is)
4496
3928
  */
4497
- type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
4498
- /**
4499
- * Widen literal types to their base types:
4500
- * - 0 → number
4501
- * - true → boolean
4502
- * - '#ff0000' → Color (string colors are converted to Color objects)
4503
- * - Node → Node (TSL nodes passed through for uniform type casting)
4504
- */
4505
- type Widen<T> = T extends number ? number : T extends boolean ? boolean : T extends string ? Color$2 : T;
4506
- declare function useUniform<T extends UniformValue>(name: string): UniformNode<T>;
4507
- declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNode<Widen<T>>;
3929
+ type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
3930
+ declare function useUniform<T extends UniformValue = UniformValue>(name: string): UniformNodeFor<T>;
3931
+ declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNodeFor<T>;
4508
3932
 
4509
3933
  /**
4510
- * Minimal interface for TSL nodes.
4511
- * Used instead of Three.js's Node type because the @types/three definitions
4512
- * have inconsistencies where OperatorNode, ConstNode, etc. don't properly
4513
- * extend Node with all required properties.
3934
+ * Every node representation a creator may return. The definition lives with the store types as
3935
+ * `NodeLike`, so the shape creators return and the shape `state.nodes` holds are one type by
3936
+ * construction: three's real `Node`, the callable proxy `Fn()` returns, or the legacy structural
3937
+ * `{ uuid, nodeType }` shape.
4514
3938
  */
4515
- interface TSLNodeLike {
4516
- uuid?: string;
4517
- nodeType?: string | null;
4518
- /** label method for chaining - sets the node's label and returns self */
4519
- label?: ((label: string) => TSLNodeLike) | string;
4520
- setName?: (name: string) => this;
4521
- }
4522
- /** TSL node type - alias for compatibility */
3939
+ type TSLNodeLike = NodeLike;
3940
+
3941
+ /** Backward-compatible alias covering every accepted node representation. */
4523
3942
  type TSLNode = TSLNodeLike;
4524
- /**
4525
- * A record of TSL nodes - allows mixed node types (OperatorNode, ConstNode, etc.)
4526
- * Uses TSLNodeLike for broader compatibility with Three.js's TSL type definitions.
4527
- */
4528
- type NodeRecord<T extends TSLNodeLike = TSLNodeLike> = Record<string, T>;
4529
3943
  /**
4530
3944
  * Creator function that returns a record of nodes.
4531
- * Uses TSLNodeLike constraint to allow mixed node types
4532
- * (e.g., { n: OperatorNode; color: ConstNode<Color> }) to pass type checking.
3945
+ * Exact creator return inference is preserved within the compatible node constraint.
4533
3946
  */
4534
3947
  type NodeCreator<T extends Record<string, TSLNodeLike>> = (state: CreatorState) => T;
4535
3948
  /** Function signature for removeNodes util */
@@ -4539,20 +3952,25 @@ type ClearNodesFn = (scope?: string) => void;
4539
3952
  /** Function signature for rebuildNodes util */
4540
3953
  type RebuildNodesFn = (scope?: string) => void;
4541
3954
  /** Return type with utils included */
4542
- type NodesWithUtils<T extends Record<string, TSLNodeLike> = Record<string, TSLNodeLike>> = T & {
3955
+ type NodesWithUtils<T extends Record<string, unknown> = NodeRecord> = T & {
4543
3956
  removeNodes: RemoveNodesFn;
4544
3957
  clearNodes: ClearNodesFn;
4545
3958
  rebuildNodes: RebuildNodesFn;
4546
3959
  };
4547
- declare function useNodes(): NodesWithUtils<Record<string, TSLNodeLike> & Record<string, Record<string, TSLNodeLike>>>;
4548
- declare function useNodes(scope: string): NodesWithUtils<Record<string, TSLNodeLike>>;
4549
- declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCreator<T>): NodesWithUtils<T>;
4550
- declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
3960
+ declare function useNodes(): NodesWithUtils<NodeStore>;
3961
+ declare function useNodes(scope: string): NodesWithUtils<NodeRecord>;
3962
+ declare function useNodes<T extends NodeRecord>(scope?: string): NodesWithUtils<T>;
3963
+ declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>): NodesWithUtils<T>;
3964
+ declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
3965
+ declare function useNodes(creatorOrScope?: NodeCreator<NodeRecord> | string, scope?: string): NodesWithUtils<Record<string, unknown>>;
4551
3966
  /**
4552
3967
  * Global rebuildNodes function for HMR integration.
4553
- * Clears cached nodes and increments _hmrVersion to trigger re-creation.
3968
+ * Invalidates cached nodes and increments _hmrVersion to trigger re-creation.
4554
3969
  * Call this when HMR is detected to refresh all node creators.
4555
3970
  *
3971
+ * Resolves to the primary store so shared TSL resources rebuild on the
3972
+ * authoritative store.
3973
+ *
4556
3974
  * @param store - The R3F store (from useStore or context)
4557
3975
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4558
3976
  */
@@ -4603,6 +4021,10 @@ type LocalNodeCreator<T extends Record<string, unknown>> = (state: CreatorState)
4603
4021
  */
4604
4022
  declare function useLocalNodes<T extends Record<string, unknown>>(creator: LocalNodeCreator<T>): T;
4605
4023
 
4024
+ /**
4025
+ * A record of buffer-like values - allows mixed types (TypedArrays, BufferAttributes, TSL nodes)
4026
+ */
4027
+ type BufferRecordType<T extends BufferLike = BufferLike> = Record<string, T>;
4606
4028
  /**
4607
4029
  * Creator function that returns a record of buffers.
4608
4030
  * Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
@@ -4617,26 +4039,34 @@ type RebuildBuffersFn = (scope?: string) => void;
4617
4039
  /** Function signature for disposeBuffers util - releases GPU resources */
4618
4040
  type DisposeBuffersFn = (names: string | string[], scope?: string) => void;
4619
4041
  /** Return type with utils included */
4620
- type BuffersWithUtils<T extends Record<string, BufferLike> = Record<string, BufferLike>> = T & {
4042
+ type BuffersWithUtils<T extends BufferRecordType | BufferStore = BufferRecordType> = T & {
4621
4043
  removeBuffers: RemoveBuffersFn;
4622
4044
  clearBuffers: ClearBuffersFn;
4623
4045
  rebuildBuffers: RebuildBuffersFn;
4624
4046
  disposeBuffers: DisposeBuffersFn;
4625
4047
  };
4626
- declare function useBuffers(): BuffersWithUtils<Record<string, BufferLike> & Record<string, Record<string, BufferLike>>>;
4048
+ declare function useBuffers(): BuffersWithUtils<BufferStore>;
4627
4049
  declare function useBuffers(scope: string): BuffersWithUtils<Record<string, BufferLike>>;
4050
+ declare function useBuffers<T extends Record<string, BufferLike>>(scope?: string): BuffersWithUtils<T>;
4628
4051
  declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>): BuffersWithUtils<T>;
4629
4052
  declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
4630
4053
  /**
4631
4054
  * Global rebuildBuffers function for HMR integration.
4632
- * Clears cached buffers and increments _hmrVersion to trigger re-creation.
4055
+ * Invalidates cached buffers and increments _hmrVersion to trigger re-creation.
4633
4056
  * Call this when HMR is detected to refresh all buffer creators.
4634
4057
  *
4058
+ * Resolves to the primary store so shared TSL resources rebuild on the
4059
+ * authoritative store.
4060
+ *
4635
4061
  * @param store - The R3F store (from useStore or context)
4636
4062
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4637
4063
  */
4638
4064
  declare function rebuildAllBuffers(store: ReturnType<typeof useStore>, scope?: string): void;
4639
4065
 
4066
+ /**
4067
+ * A record of storage-like values - allows mixed types (StorageTexture, Storage3DTexture, TSL nodes)
4068
+ */
4069
+ type StorageRecordType<T extends StorageLike = StorageLike> = Record<string, T>;
4640
4070
  /**
4641
4071
  * Creator function that returns a record of GPU storage objects.
4642
4072
  * Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
@@ -4651,26 +4081,47 @@ type RebuildStorageFn = (scope?: string) => void;
4651
4081
  /** Function signature for disposeStorage util - releases GPU resources */
4652
4082
  type DisposeStorageFn = (names: string | string[], scope?: string) => void;
4653
4083
  /** Return type with utils included */
4654
- type StorageWithUtils<T extends Record<string, StorageLike> = Record<string, StorageLike>> = T & {
4084
+ type StorageWithUtils<T extends StorageRecordType | StorageStore = StorageRecordType> = T & {
4655
4085
  removeStorage: RemoveStorageFn;
4656
4086
  clearStorage: ClearStorageFn;
4657
4087
  rebuildStorage: RebuildStorageFn;
4658
4088
  disposeStorage: DisposeStorageFn;
4659
4089
  };
4660
- declare function useGPUStorage(): StorageWithUtils<Record<string, StorageLike> & Record<string, Record<string, StorageLike>>>;
4090
+ declare function useGPUStorage(): StorageWithUtils<StorageStore>;
4661
4091
  declare function useGPUStorage(scope: string): StorageWithUtils<Record<string, StorageLike>>;
4092
+ declare function useGPUStorage<T extends Record<string, StorageLike>>(scope?: string): StorageWithUtils<T>;
4662
4093
  declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>): StorageWithUtils<T>;
4663
4094
  declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
4664
4095
  /**
4665
4096
  * Global rebuildStorage function for HMR integration.
4666
- * Clears cached storage and increments _hmrVersion to trigger re-creation.
4097
+ * Invalidates cached storage and increments _hmrVersion to trigger re-creation.
4667
4098
  * Call this when HMR is detected to refresh all storage creators.
4668
4099
  *
4100
+ * Resolves to the primary store so shared TSL resources rebuild on the
4101
+ * authoritative store.
4102
+ *
4669
4103
  * @param store - The R3F store (from useStore or context)
4670
4104
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4671
4105
  */
4672
4106
  declare function rebuildAllStorage(store: ReturnType<typeof useStore>, scope?: string): void;
4673
4107
 
4108
+ /**
4109
+ * Re-export from core - useTextures is now a core R3F hook (a reactive Texture registry).
4110
+ *
4111
+ * This file maintains backwards compatibility for existing webgpu imports.
4112
+ */
4113
+
4114
+ /**
4115
+ * @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
4116
+ * Kept as an alias for backwards compatibility.
4117
+ */
4118
+ type TextureEntry = Texture$1;
4119
+ /**
4120
+ * @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
4121
+ * Kept as an alias for backwards compatibility.
4122
+ */
4123
+ type TextureNode = Texture$1;
4124
+
4674
4125
  interface TextureOperations {
4675
4126
  add: (key: string, value: any) => void;
4676
4127
  addMultiple: (items: Map<string, any> | Record<string, any>) => void;
@@ -4688,6 +4139,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
4688
4139
  * - Callbacks receive full RootState for flexibility
4689
4140
  * - No auto-cleanup on unmount - use reset() for explicit cleanup
4690
4141
  * - Scene/camera changes trigger scenePass recreation
4142
+ * - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
4143
+ * strand its render target (and MRT attachments) on the GPU
4144
+ * - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
4145
+ * recompiles instead of silently keeping the first compiled graph
4691
4146
  *
4692
4147
  * @param mainCB - Main callback to configure outputNode and create effect passes
4693
4148
  * @param setupCB - Optional setup callback to configure MRT on scenePass
@@ -4765,5 +4220,32 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
4765
4220
  internal: WebGPUInternalState
4766
4221
  }
4767
4222
 
4768
- 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, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, 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, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
4769
- export type { Act, AddPhaseOptions, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeStorageFn, 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, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootOptions, WebGPURootState as RootState, RootStore, SchedulerApi, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureOperations, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameNextOptions, UseFrameOptions, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
4223
+ /**
4224
+ * @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
4225
+ *
4226
+ * This entry point is for apps that want to use ONLY WebGPURenderer.
4227
+ * Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
4228
+ * Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
4229
+ *
4230
+ * Usage:
4231
+ * import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
4232
+ */
4233
+
4234
+ /** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
4235
+ type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
4236
+ /** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
4237
+ type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
4238
+ declare const useThree: UseThreeWebGPU;
4239
+ declare const useFrame: UseFrameWebGPU;
4240
+
4241
+ /** Canvas props on the WebGPU entry: `onCreated` receives `WebGPURootState`. */
4242
+ type WebGPUCanvasProps = Omit<CanvasProps, 'onCreated'> & {
4243
+ /** Callback after the canvas has rendered (but not yet committed); `state.renderer` is a `WebGPURenderer` */
4244
+ onCreated?: (state: WebGPURootState) => void;
4245
+ };
4246
+
4247
+ /** `Canvas` narrowed to WebGPU state — the same component, `onCreated` typed against `WebGPURootState`. */
4248
+ declare const Canvas: (props: WebGPUCanvasProps) => JSX.Element;
4249
+
4250
+ 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, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, 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, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
4251
+ export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, WebGPUCanvasProps as CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, 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, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeLike, NodeProps, NodeRecord, NodeStore, NodesWithUtils, NonFunctionKeys, Object3DMethod, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, OnceValue, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TSLNodeLike, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameWebGPU, UseTextureOptions, UseTexturesReturn, UseThreeWebGPU, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUCanvasProps, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };