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

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