@react-three/fiber 10.0.0-canary.d6fdf72 → 10.0.0-canary.da7a768

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
+ import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
1
2
  import * as three_webgpu from 'three/webgpu';
2
- import { RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera, WebGPURendererParameters } from 'three/webgpu';
3
+ import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera, WebGPURendererParameters } from 'three/webgpu';
3
4
  import { Inspector } from 'three/addons/inspector/Inspector.js';
4
5
  import * as THREE$1 from 'three';
5
6
  import { Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
@@ -7,9 +8,10 @@ import * as React$1 from 'react';
7
8
  import { ReactNode, Component, RefObject, JSX } from 'react';
8
9
  import { StoreApi } from 'zustand';
9
10
  import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
11
+ import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
12
+ export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
10
13
  import { Options } from 'react-use-measure';
11
14
  import * as react_jsx_runtime from 'react/jsx-runtime';
12
- import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
13
15
  import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
14
16
 
15
17
  function _mergeNamespaces(n, m) {
@@ -39,6 +41,8 @@ function _mergeNamespaces(n, m) {
39
41
  declare const R3F_BUILD_LEGACY = false;
40
42
  declare const R3F_BUILD_WEBGPU = true;
41
43
 
44
+ /** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
45
+ declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
42
46
  declare const WebGLRenderer: {
43
47
  new (): {};
44
48
  };
@@ -47,16 +51,21 @@ type WebGLShadowMap = never;
47
51
 
48
52
  declare const WebGLRenderTarget: any;
49
53
 
54
+ declare const WebGLCubeRenderTarget: any;
55
+
50
56
  var THREE = /*#__PURE__*/_mergeNamespaces({
51
57
  __proto__: null,
58
+ CubeRenderTargetCompat: CubeRenderTarget,
52
59
  Inspector: Inspector,
53
60
  R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
54
61
  R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
55
62
  RenderTargetCompat: RenderTarget,
63
+ WebGLCubeRenderTarget: WebGLCubeRenderTarget,
56
64
  WebGLRenderTarget: WebGLRenderTarget,
57
65
  WebGLRenderer: WebGLRenderer,
58
66
  WebGLRendererParameters: WebGLRendererParameters,
59
- WebGLShadowMap: WebGLShadowMap
67
+ WebGLShadowMap: WebGLShadowMap,
68
+ loadInspector: loadInspector
60
69
  }, [three_webgpu]);
61
70
 
62
71
  //* Utility Types ==============================
@@ -294,228 +303,33 @@ interface VisibilityEntry {
294
303
  }
295
304
 
296
305
  //* Scheduler Types (useFrame) ==============================
306
+ //
307
+ // The generic, framework-agnostic scheduler types now live in @pmndrs/scheduler.
308
+ // This file re-exports them and layers r3f's RootState-aware frame state on top,
309
+ // so existing `#types` imports across the codebase keep resolving unchanged.
297
310
 
298
311
 
299
312
 
300
- // Public Options --------------------------------
301
-
302
- /**
303
- * Options for useFrame hook
304
- */
305
- interface UseFrameNextOptions {
306
- /** Optional stable id for the job. Auto-generated if not provided */
307
- id?: string
308
- /** Named phase to run in. Default: 'update' */
309
- phase?: string
310
- /** Run before this phase or job id */
311
- before?: string | string[]
312
- /** Run after this phase or job id */
313
- after?: string | string[]
314
- /** Priority within phase. Higher runs first. Default: 0 */
315
- priority?: number
316
- /** Max frames per second for this job */
317
- fps?: number
318
- /** If true, skip frames when behind. If false, try to catch up. Default: true */
319
- drop?: boolean
320
- /** Enable/disable without unregistering. Default: true */
321
- enabled?: boolean
322
- }
323
-
324
- /** Alias for UseFrameNextOptions */
325
- type UseFrameOptions = UseFrameNextOptions
326
-
327
- /**
328
- * Options for addPhase
329
- */
330
- interface AddPhaseOptions {
331
- /** Insert this phase before the specified phase */
332
- before?: string
333
- /** Insert this phase after the specified phase */
334
- after?: string
335
- }
336
-
337
- // Frame State --------------------------------
338
-
339
- /**
340
- * Timing-only state for independent/outside mode (no RootState)
341
- */
342
- interface FrameTimingState {
343
- /** High-resolution timestamp from RAF (ms) */
344
- time: number
345
- /** Time since last frame in seconds (for legacy compatibility with THREE.Clock) */
346
- delta: number
347
- /** Elapsed time since first frame in seconds (for legacy compatibility with THREE.Clock) */
348
- elapsed: number
349
- /** Incrementing frame counter */
350
- frame: number
351
- }
313
+ // Frame State (r3f-specific) --------------------------------
352
314
 
353
315
  /**
354
- * State passed to useFrame callbacks (extends RootState with timing)
316
+ * State passed to useFrame callbacks (extends RootState with timing).
355
317
  */
356
318
  interface FrameNextState extends RootState, FrameTimingState {}
357
319
 
358
320
  /** Alias for FrameNextState */
359
321
  type FrameState = FrameNextState
360
322
 
361
- // Root Options --------------------------------
323
+ // Callback Types (r3f-specific) --------------------------------
362
324
 
363
325
  /**
364
- * Options for registerRoot
326
+ * Callback function for useFrame. Receives the full r3f RootState plus timing.
365
327
  */
366
- interface RootOptions {
367
- /** State provider for callbacks. Optional in independent mode. */
368
- getState?: () => any
369
- /** Error handler for job errors. Falls back to console.error if not provided. */
370
- onError?: (error: Error) => void
371
- }
372
-
373
- // Callback Types --------------------------------
374
-
375
- /**
376
- * Callback function for useFrame
377
- */
378
- type FrameNextCallback = (state: FrameNextState, delta: number) => void
328
+ type FrameNextCallback = FrameCallback$1<RootState>
379
329
 
380
330
  /** Alias for FrameNextCallback */
381
331
  type FrameCallback = FrameNextCallback
382
332
 
383
- // Controls returned from useFrame --------------------------------
384
-
385
- /**
386
- * Controls object returned from useFrame hook
387
- */
388
- interface FrameNextControls {
389
- /** The job's unique ID */
390
- id: string
391
- /** Access to the global scheduler for frame loop control */
392
- scheduler: SchedulerApi
393
- /** Manually step this job only (bypasses FPS limiting) */
394
- step(timestamp?: number): void
395
- /** Manually step ALL jobs in the scheduler */
396
- stepAll(timestamp?: number): void
397
- /** Pause this job (set enabled=false) */
398
- pause(): void
399
- /** Resume this job (set enabled=true) */
400
- resume(): void
401
- /** Reactive paused state - automatically triggers re-render when changed */
402
- isPaused: boolean
403
- }
404
-
405
- /** Alias for FrameNextControls */
406
- type FrameControls = FrameNextControls
407
-
408
- // Scheduler Interface --------------------------------
409
-
410
- /**
411
- * Public interface for the global Scheduler
412
- */
413
- interface SchedulerApi {
414
- //* Phase Management --------------------------------
415
-
416
- /** Add a named phase to the scheduler */
417
- addPhase(name: string, options?: AddPhaseOptions): void
418
- /** Get the ordered list of phase names */
419
- readonly phases: string[]
420
- /** Check if a phase exists */
421
- hasPhase(name: string): boolean
422
-
423
- //* Root Management --------------------------------
424
-
425
- /** Register a root (Canvas) with the scheduler. Returns unsubscribe function. */
426
- registerRoot(id: string, options?: RootOptions): () => void
427
- /** Unregister a root */
428
- unregisterRoot(id: string): void
429
- /** Generate a unique root ID */
430
- generateRootId(): string
431
- /** Get the number of registered roots */
432
- getRootCount(): number
433
- /** Check if any root is registered and ready */
434
- readonly isReady: boolean
435
- /** Subscribe to root-ready event. Fires immediately if already ready. Returns unsubscribe. */
436
- onRootReady(callback: () => void): () => void
437
-
438
- //* Job Registration --------------------------------
439
-
440
- /** Register a job with the scheduler (returns unsubscribe function) */
441
- register(
442
- callback: FrameNextCallback,
443
- options?: {
444
- id?: string
445
- rootId?: string
446
- phase?: string
447
- before?: string | string[]
448
- after?: string | string[]
449
- priority?: number
450
- fps?: number
451
- drop?: boolean
452
- enabled?: boolean
453
- },
454
- ): () => void
455
- /** Update a job's options */
456
- updateJob(
457
- id: string,
458
- options: {
459
- priority?: number
460
- fps?: number
461
- drop?: boolean
462
- enabled?: boolean
463
- phase?: string
464
- before?: string | string[]
465
- after?: string | string[]
466
- },
467
- ): void
468
- /** Unregister a job by ID */
469
- unregister(id: string, rootId?: string): void
470
- /** Get the number of registered jobs */
471
- getJobCount(): number
472
- /** Get all job IDs */
473
- getJobIds(): string[]
474
-
475
- //* Global Jobs (for legacy addEffect/addAfterEffect) --------------------------------
476
-
477
- /** Register a global job (runs once per frame, not per-root). Returns unsubscribe function. */
478
- registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void
479
-
480
- //* Idle Callbacks (for legacy addTail) --------------------------------
481
-
482
- /** Register an idle callback (fires when loop stops). Returns unsubscribe function. */
483
- onIdle(callback: (timestamp: number) => void): () => void
484
-
485
- //* Frame Loop Control --------------------------------
486
-
487
- /** Start the scheduler loop */
488
- start(): void
489
- /** Stop the scheduler loop */
490
- stop(): void
491
- /** Check if the scheduler is running */
492
- readonly isRunning: boolean
493
- /** Get/set the frameloop mode ('always', 'demand', 'never') */
494
- frameloop: Frameloop
495
- /** Independent mode - runs without Canvas, callbacks receive timing-only state */
496
- independent: boolean
497
-
498
- //* Manual Stepping --------------------------------
499
-
500
- /** Manually step all jobs once (for frameloop='never' or testing) */
501
- step(timestamp?: number): void
502
- /** Manually step a single job by ID */
503
- stepJob(id: string, timestamp?: number): void
504
- /** Request frame(s) to be rendered (for frameloop='demand') */
505
- invalidate(frames?: number): void
506
-
507
- //* Per-Job Control --------------------------------
508
-
509
- /** Check if a job is paused */
510
- isJobPaused(id: string): boolean
511
- /** Pause a job */
512
- pauseJob(id: string): void
513
- /** Resume a job */
514
- resumeJob(id: string): void
515
- /** Subscribe to job state changes (for reactive isPaused). Returns unsubscribe function. */
516
- subscribeJobState(id: string, listener: () => void): () => void
517
- }
518
-
519
333
  //* Buffer Types (useBuffers) ========================================
520
334
 
521
335
  /**
@@ -691,7 +505,7 @@ interface InternalState {
691
505
  canvasTarget?: CanvasTarget
692
506
  /**
693
507
  * Whether multi-canvas rendering is active.
694
- * True when any canvas uses `target` prop to share a renderer.
508
+ * True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
695
509
  * When true, setCanvasTarget is called before each render.
696
510
  */
697
511
  isMultiCanvas?: boolean
@@ -789,8 +603,8 @@ interface RootState {
789
603
  setSize: (width?: number, height?: number, top?: number, left?: number) => void
790
604
  /** Shortcut to manual setting the pixel ratio */
791
605
  setDpr: (dpr: Dpr) => void
792
- /** Shortcut to setting frameloop flags */
793
- setFrameloop: (frameloop: Frameloop) => void
606
+ /** Shortcut to setting frameloop flags. No args resets to 'always'. */
607
+ setFrameloop: (frameloop?: Frameloop) => void
794
608
  /** Set error state to propagate to error boundary */
795
609
  setError: (error: Error | null) => void
796
610
  /** Current error state (null when no error) */
@@ -808,7 +622,7 @@ interface RootState {
808
622
  /** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
809
623
  _textureRefs: Map<string, number>
810
624
  /** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
811
- renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
625
+ renderPipeline: ThreeRenderPipeline | null
812
626
  /** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
813
627
  passes: Record<string, any>
814
628
  /** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
@@ -1101,8 +915,6 @@ interface Instance<O = any> {
1101
915
  attach?: AttachType<O>
1102
916
  previousAttach?: any
1103
917
  isHidden: boolean
1104
- /** Deferred ref props to apply in commitMount */
1105
- deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
1106
918
  /** Set of props that have been applied via once() */
1107
919
  appliedOnce?: Set<string>
1108
920
  }
@@ -1339,10 +1151,21 @@ type RenderTargetOptions = RenderTargetOptions$1
1339
1151
  //* Global Types ==============================
1340
1152
 
1341
1153
  declare global {
1342
- /** Uniform node type - a Node with a value property (matches Three.js UniformNode) */
1343
- interface UniformNode<T = unknown> extends Node {
1344
- value: T
1345
- }
1154
+ /**
1155
+ * Uniform node type.
1156
+ *
1157
+ * This is three's own `UniformNode`, not a re-declaration of it. It previously was a
1158
+ * hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
1159
+ * exported type globally — so R3F's ~58 references resolved to an approximation that was
1160
+ * missing members three actually ships (`setName` among them) and had drifted to the wrong
1161
+ * arity when three made `UniformNode` two-parameter.
1162
+ *
1163
+ * three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
1164
+ * so the node type is fixed to `unknown` and the single parameter is kept for call-site
1165
+ * ergonomics. The result is three's structural type, so members stay in sync with the
1166
+ * installed three instead of needing to be mirrored by hand.
1167
+ */
1168
+ type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
1346
1169
 
1347
1170
  /**
1348
1171
  * ShaderCallable - the return type of Fn()
@@ -1487,13 +1310,14 @@ declare module 'three/tsl' {
1487
1310
  ): ShaderCallable<R>
1488
1311
  }
1489
1312
 
1490
- /**
1491
- * RenderPipeline Types for useRenderPipeline hook (WebGPU only)
1492
- */
1493
-
1494
-
1495
-
1496
1313
  declare global {
1314
+ /**
1315
+ * three's own render pipeline type. Named here so the rest of R3F refers to three's shape
1316
+ * rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
1317
+ * is r185, so the new name is the only one.
1318
+ */
1319
+ type ThreeRenderPipeline = three_webgpu.RenderPipeline
1320
+
1497
1321
  /** Pass record - stores TSL pass nodes for render pipeline */
1498
1322
  type PassRecord = Record<string, any>
1499
1323
 
@@ -1508,7 +1332,7 @@ declare global {
1508
1332
  /** Current passes from state */
1509
1333
  passes: PassRecord
1510
1334
  /** RenderPipeline instance (null if not initialized) */
1511
- renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
1335
+ renderPipeline: ThreeRenderPipeline | null
1512
1336
  /** Clear all passes from state */
1513
1337
  clearPasses: () => void
1514
1338
  /** Reset RenderPipeline entirely (clears PP + passes) */
@@ -1520,146 +1344,6 @@ declare global {
1520
1344
  }
1521
1345
  }
1522
1346
 
1523
- //* useFrameNext Types ==============================
1524
-
1525
-
1526
-
1527
- //* Global Type Declarations ==============================
1528
-
1529
- declare global {
1530
- // Job --------------------------------
1531
-
1532
- /**
1533
- * Internal job representation in the scheduler
1534
- */
1535
- interface Job {
1536
- /** Unique identifier */
1537
- id: string
1538
- /** The callback to execute */
1539
- callback: FrameNextCallback
1540
- /** Phase this job belongs to */
1541
- phase: string
1542
- /** Run before these phases/job ids */
1543
- before: Set<string>
1544
- /** Run after these phases/job ids */
1545
- after: Set<string>
1546
- /** Priority within phase (higher first) */
1547
- priority: number
1548
- /** Insertion order for deterministic tie-breaking */
1549
- index: number
1550
- /** Max FPS for this job (undefined = no limit) */
1551
- fps?: number
1552
- /** Drop frames when behind (true) or catch up (false) */
1553
- drop: boolean
1554
- /** Last run timestamp (ms) */
1555
- lastRun?: number
1556
- /** Whether job is enabled */
1557
- enabled: boolean
1558
- /** Internal flag: system jobs (like default render) don't block user render takeover */
1559
- system?: boolean
1560
- }
1561
-
1562
- // Phase Graph --------------------------------
1563
-
1564
- /**
1565
- * A node in the phase graph
1566
- */
1567
- interface PhaseNode {
1568
- /** Phase name */
1569
- name: string
1570
- /** Whether this was auto-generated from a before/after constraint */
1571
- isAutoGenerated: boolean
1572
- }
1573
-
1574
- /**
1575
- * Options for creating a job from hook options
1576
- */
1577
- interface JobOptions {
1578
- id?: string
1579
- phase?: string
1580
- before?: string | string[]
1581
- after?: string | string[]
1582
- priority?: number
1583
- fps?: number
1584
- drop?: boolean
1585
- enabled?: boolean
1586
- }
1587
-
1588
- // Frame Loop State --------------------------------
1589
-
1590
- /**
1591
- * Internal frame loop state
1592
- */
1593
- interface FrameLoopState {
1594
- /** Whether the loop is running */
1595
- running: boolean
1596
- /** Current RAF handle */
1597
- rafHandle: number | null
1598
- /** Last frame timestamp in ms (null = uninitialized) */
1599
- lastTime: number | null
1600
- /** Frame counter */
1601
- frameCount: number
1602
- /** Elapsed time since first frame in ms */
1603
- elapsedTime: number
1604
- /** createdAt timestamp in ms */
1605
- createdAt: number
1606
- }
1607
-
1608
- // Root Entry --------------------------------
1609
-
1610
- /**
1611
- * Internal representation of a registered root (Canvas).
1612
- * Tracks jobs and manages rebuild state for this root.
1613
- * @internal
1614
- */
1615
- interface RootEntry {
1616
- /** Unique identifier for this root */
1617
- id: string
1618
- /** Function to get the root's current state. Returns any to support independent mode. */
1619
- getState: () => any
1620
- /** Map of job IDs to Job objects */
1621
- jobs: Map<string, Job>
1622
- /** Cached sorted job list for execution order */
1623
- sortedJobs: Job[]
1624
- /** Whether sortedJobs needs rebuilding */
1625
- needsRebuild: boolean
1626
- }
1627
-
1628
- /**
1629
- * Internal representation of a global job (deprecated API).
1630
- * Global jobs run once per frame, not per-root.
1631
- * Used by legacy addEffect/addAfterEffect APIs.
1632
- * @internal
1633
- * @deprecated Use useFrame with phases instead
1634
- */
1635
- interface GlobalJob {
1636
- /** Unique identifier for this global job */
1637
- id: string
1638
- /** Callback invoked with RAF timestamp in ms */
1639
- callback: (timestamp: number) => void
1640
- }
1641
-
1642
- // HMR Support --------------------------------
1643
-
1644
- /**
1645
- * Hot Module Replacement data structure for preserving scheduler state
1646
- * @internal
1647
- */
1648
- interface HMRData {
1649
- /** Shared data object for storing values across reloads */
1650
- data: Record<string, any>
1651
- /** Optional function to accept HMR updates */
1652
- accept?: () => void
1653
- }
1654
-
1655
- // Default Phases --------------------------------
1656
-
1657
- /**
1658
- * Default phase names for the scheduler
1659
- */
1660
- type DefaultPhase = 'start' | 'input' | 'physics' | 'update' | 'render' | 'finish'
1661
- }
1662
-
1663
1347
  type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
1664
1348
 
1665
1349
  interface MathRepresentation {
@@ -1829,7 +1513,7 @@ declare namespace three_d {
1829
1513
  * a single WebGPURenderer using Three.js CanvasTarget API.
1830
1514
  *
1831
1515
  * Primary canvas: Has `id` prop, creates its own renderer, registers here
1832
- * Secondary canvas: Has `target="id"` prop, shares primary's renderer via CanvasTarget
1516
+ * Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
1833
1517
  */
1834
1518
 
1835
1519
  interface PrimaryCanvasEntry {
@@ -1897,12 +1581,23 @@ type EnvironmentLoaderProps = {
1897
1581
  * const texture = useEnvironment({ preset: 'sunset' })
1898
1582
  * ```
1899
1583
  */
1900
- declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture;
1584
+ declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
1901
1585
  declare namespace useEnvironment {
1902
1586
  var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
1903
1587
  var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
1904
1588
  }
1905
- type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'encoding'>;
1589
+ /**
1590
+ * Options accepted by `useEnvironment.preload`.
1591
+ *
1592
+ * `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
1593
+ * applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
1594
+ * advertise an option this function silently ignores.
1595
+ *
1596
+ * This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
1597
+ * `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
1598
+ * type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
1599
+ */
1600
+ type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
1906
1601
  type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
1907
1602
 
1908
1603
  /**
@@ -1946,9 +1641,9 @@ type EnvironmentProps = {
1946
1641
  blur?: number;
1947
1642
  backgroundBlurriness?: number;
1948
1643
  backgroundIntensity?: number;
1949
- backgroundRotation?: Euler$3;
1644
+ backgroundRotation?: Euler;
1950
1645
  environmentIntensity?: number;
1951
- environmentRotation?: Euler$3;
1646
+ environmentRotation?: Euler;
1952
1647
  map?: Texture$1;
1953
1648
  preset?: PresetsType;
1954
1649
  scene?: Scene | React$1.RefObject<Scene>;
@@ -2032,7 +1727,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
2032
1727
  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;
2033
1728
  declare module '@react-three/fiber' {
2034
1729
  interface ThreeElements {
2035
- groundProjectedEnvImpl: ThreeElement$1<typeof GroundedSkybox>;
1730
+ groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
2036
1731
  }
2037
1732
  }
2038
1733
  /**
@@ -2132,6 +1827,24 @@ declare module '@react-three/fiber' {
2132
1827
  */
2133
1828
  declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
2134
1829
 
1830
+ /**
1831
+ * Moves every trace of interactivity from one object to its replacement, for reconstruction.
1832
+ *
1833
+ * When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
1834
+ * instance. Removing the old object from the interaction state and registering the new one from
1835
+ * scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
1836
+ * the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
1837
+ * is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
1838
+ * swap the user never asked to see (#3744).
1839
+ *
1840
+ * Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
1841
+ * left alone — releasing and re-acquiring it is precisely the glitch being avoided.
1842
+ *
1843
+ * Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
1844
+ * the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
1845
+ * cannot outlive the object it described.
1846
+ */
1847
+ declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
2135
1848
  declare function removeInteractivity(store: RootStore, object: Object3D): void;
2136
1849
  declare function createEvents(store: RootStore): {
2137
1850
  handlePointer: (name: string) => (event: DomEvent) => void;
@@ -2152,419 +1865,13 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
2152
1865
  * Note: this hook's caller must be wrapped with `React.Suspense`
2153
1866
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
2154
1867
  */
2155
- 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>;
1868
+ 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>;
2156
1869
  declare namespace useLoader {
2157
- var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
2158
- var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
1870
+ 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;
1871
+ var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
2159
1872
  var loader: typeof getLoader;
2160
1873
  }
2161
1874
 
2162
- /**
2163
- * Global Singleton Scheduler - manages the frame loop and job execution for ALL R3F roots.
2164
- *
2165
- * Features:
2166
- * - Single RAF loop for entire application
2167
- * - Root registration (multiple Canvas support)
2168
- * - Global phases for addEffect/addAfterEffect (deprecated)
2169
- * - Per-root job management with phases, priorities, FPS throttling
2170
- * - onIdle callbacks for addTail (deprecated)
2171
- * - Demand mode support via invalidate()
2172
- */
2173
- declare class Scheduler {
2174
- private static readonly INSTANCE_KEY;
2175
- private static get instance();
2176
- private static set instance(value);
2177
- /**
2178
- * Get the global scheduler instance (creates if doesn't exist).
2179
- * Uses HMR data to preserve instance across hot reloads.
2180
- * @returns {Scheduler} The singleton scheduler instance
2181
- */
2182
- static get(): Scheduler;
2183
- /**
2184
- * Reset the singleton instance. Stops the loop and clears all state.
2185
- * Primarily used for testing to ensure clean state between tests.
2186
- * @returns {void}
2187
- */
2188
- static reset(): void;
2189
- private roots;
2190
- private phaseGraph;
2191
- private loopState;
2192
- private stoppedTime;
2193
- private nextRootIndex;
2194
- private globalBeforeJobs;
2195
- private globalAfterJobs;
2196
- private nextGlobalIndex;
2197
- private idleCallbacks;
2198
- private nextJobIndex;
2199
- private jobStateListeners;
2200
- private pendingFrames;
2201
- private _frameloop;
2202
- private _independent;
2203
- private errorHandler;
2204
- private rootReadyCallbacks;
2205
- get phases(): string[];
2206
- get frameloop(): Frameloop;
2207
- set frameloop(mode: Frameloop);
2208
- get isRunning(): boolean;
2209
- get isReady(): boolean;
2210
- get independent(): boolean;
2211
- set independent(value: boolean);
2212
- constructor();
2213
- /**
2214
- * Register a root (Canvas) with the scheduler.
2215
- * The first root to register starts the RAF loop (if frameloop='always').
2216
- * @param {string} id - Unique identifier for this root
2217
- * @param {RootOptions} [options] - Optional configuration with getState and onError callbacks
2218
- * @returns {() => void} Unsubscribe function to remove this root
2219
- */
2220
- registerRoot(id: string, options?: RootOptions): () => void;
2221
- /**
2222
- * Unregister a root from the scheduler.
2223
- * Cleans up all job state listeners for this root's jobs.
2224
- * The last root to unregister stops the RAF loop.
2225
- * @param {string} id - The root ID to unregister
2226
- * @returns {void}
2227
- */
2228
- unregisterRoot(id: string): void;
2229
- /**
2230
- * Subscribe to be notified when a root becomes available.
2231
- * Fires immediately if a root already exists.
2232
- * @param {() => void} callback - Function called when first root registers
2233
- * @returns {() => void} Unsubscribe function
2234
- */
2235
- onRootReady(callback: () => void): () => void;
2236
- /**
2237
- * Notify all registered root-ready callbacks.
2238
- * Called when the first root registers.
2239
- * @returns {void}
2240
- * @private
2241
- */
2242
- private notifyRootReady;
2243
- /**
2244
- * Ensure a default root exists for independent mode.
2245
- * Creates a minimal root with no state provider.
2246
- * @returns {void}
2247
- * @private
2248
- */
2249
- private ensureDefaultRoot;
2250
- /**
2251
- * Trigger error handling for job errors.
2252
- * Uses the bound error handler if available, otherwise logs to console.
2253
- * @param {Error} error - The error to handle
2254
- * @returns {void}
2255
- */
2256
- triggerError(error: Error): void;
2257
- /**
2258
- * Add a named phase to the scheduler's execution order.
2259
- * Marks all roots for rebuild to incorporate the new phase.
2260
- * @param {string} name - The phase name (e.g., 'physics', 'postprocess')
2261
- * @param {AddPhaseOptions} [options] - Positioning options (before/after other phases)
2262
- * @returns {void}
2263
- * @example
2264
- * scheduler.addPhase('physics', { before: 'update' });
2265
- * scheduler.addPhase('postprocess', { after: 'render' });
2266
- */
2267
- addPhase(name: string, options?: AddPhaseOptions): void;
2268
- /**
2269
- * Check if a phase exists in the scheduler.
2270
- * @param {string} name - The phase name to check
2271
- * @returns {boolean} True if the phase exists
2272
- */
2273
- hasPhase(name: string): boolean;
2274
- /**
2275
- * Register a global job that runs once per frame (not per-root).
2276
- * Used internally by deprecated addEffect/addAfterEffect APIs.
2277
- * @param {'before' | 'after'} phase - When to run: 'before' all roots or 'after' all roots
2278
- * @param {string} id - Unique identifier for this global job
2279
- * @param {(timestamp: number) => void} callback - Function called each frame with RAF timestamp
2280
- * @returns {() => void} Unsubscribe function to remove this global job
2281
- * @deprecated Use useFrame with phases instead
2282
- */
2283
- registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void;
2284
- /**
2285
- * Register an idle callback that fires when the loop stops.
2286
- * Used internally by deprecated addTail API.
2287
- * @param {(timestamp: number) => void} callback - Function called when loop becomes idle
2288
- * @returns {() => void} Unsubscribe function to remove this idle callback
2289
- * @deprecated Use demand mode with invalidate() instead
2290
- */
2291
- onIdle(callback: (timestamp: number) => void): () => void;
2292
- /**
2293
- * Notify all registered idle callbacks.
2294
- * Called when the loop stops in demand mode.
2295
- * @param {number} timestamp - The RAF timestamp when idle occurred
2296
- * @returns {void}
2297
- * @private
2298
- */
2299
- private notifyIdle;
2300
- /**
2301
- * Register a job (frame callback) with a specific root.
2302
- * This is the core registration method used by useFrame internally.
2303
- * @param {FrameNextCallback} callback - The function to call each frame
2304
- * @param {JobOptions & { rootId?: string; system?: boolean }} [options] - Job configuration
2305
- * @param {string} [options.rootId] - Target root ID (defaults to first registered root)
2306
- * @param {string} [options.id] - Unique job ID (auto-generated if not provided)
2307
- * @param {string} [options.phase] - Execution phase (defaults to 'update')
2308
- * @param {number} [options.priority] - Priority within phase (higher = earlier, default 0)
2309
- * @param {number} [options.fps] - FPS throttle limit
2310
- * @param {boolean} [options.drop] - Drop frames when behind (default true)
2311
- * @param {boolean} [options.enabled] - Whether job is active (default true)
2312
- * @param {boolean} [options.system] - Internal flag for system jobs (not user-facing)
2313
- * @returns {() => void} Unsubscribe function to remove this job
2314
- */
2315
- register(callback: FrameNextCallback, options?: JobOptions & {
2316
- rootId?: string;
2317
- system?: boolean;
2318
- }): () => void;
2319
- /**
2320
- * Unregister a job by its ID.
2321
- * Searches all roots if rootId is not provided.
2322
- * @param {string} id - The job ID to unregister
2323
- * @param {string} [rootId] - Optional root ID to search (searches all if not provided)
2324
- * @returns {void}
2325
- */
2326
- unregister(id: string, rootId?: string): void;
2327
- /**
2328
- * Update a job's options dynamically.
2329
- * Searches all roots to find the job by ID.
2330
- * Phase/constraint changes trigger a rebuild of the sorted job list.
2331
- * @param {string} id - The job ID to update
2332
- * @param {Partial<JobOptions>} options - The options to update
2333
- * @returns {void}
2334
- */
2335
- updateJob(id: string, options: Partial<JobOptions>): void;
2336
- /**
2337
- * Check if a job is currently paused (disabled).
2338
- * @param {string} id - The job ID to check
2339
- * @returns {boolean} True if the job exists and is paused
2340
- */
2341
- isJobPaused(id: string): boolean;
2342
- /**
2343
- * Subscribe to state changes for a specific job.
2344
- * Listener is called when job is paused or resumed.
2345
- * @param {string} id - The job ID to subscribe to
2346
- * @param {() => void} listener - Callback invoked on state changes
2347
- * @returns {() => void} Unsubscribe function
2348
- */
2349
- subscribeJobState(id: string, listener: () => void): () => void;
2350
- /**
2351
- * Notify all listeners that a job's state has changed.
2352
- * @param {string} id - The job ID that changed
2353
- * @returns {void}
2354
- * @private
2355
- */
2356
- private notifyJobStateChange;
2357
- /**
2358
- * Pause a job by ID (sets enabled=false).
2359
- * Notifies any subscribed state listeners.
2360
- * @param {string} id - The job ID to pause
2361
- * @returns {void}
2362
- */
2363
- pauseJob(id: string): void;
2364
- /**
2365
- * Resume a paused job by ID (sets enabled=true).
2366
- * Resets job timing to prevent frame accumulation.
2367
- * Notifies any subscribed state listeners.
2368
- * @param {string} id - The job ID to resume
2369
- * @returns {void}
2370
- */
2371
- resumeJob(id: string): void;
2372
- /**
2373
- * Start the requestAnimationFrame loop.
2374
- * Resets timing state (elapsedTime, frameCount) on start.
2375
- * No-op if already running.
2376
- * @returns {void}
2377
- */
2378
- start(): void;
2379
- /**
2380
- * Stop the requestAnimationFrame loop.
2381
- * Cancels any pending RAF callback.
2382
- * No-op if not running.
2383
- * @returns {void}
2384
- */
2385
- stop(): void;
2386
- /**
2387
- * Request frames to be rendered in demand mode.
2388
- * Accumulates pending frames (capped at 60) and starts the loop if not running.
2389
- * No-op if frameloop is not 'demand'.
2390
- * @param {number} [frames=1] - Number of frames to request
2391
- * @param {boolean} [stackFrames=false] - Whether to add frames to existing pending count
2392
- * - `false` (default): Sets pending frames to the specified value (replaces existing count)
2393
- * - `true`: Adds frames to existing pending count (useful for accumulating invalidations)
2394
- * @returns {void}
2395
- * @example
2396
- * // Request a single frame render
2397
- * scheduler.invalidate();
2398
- *
2399
- * @example
2400
- * // Request 5 frames (e.g., for animations)
2401
- * scheduler.invalidate(5);
2402
- *
2403
- * @example
2404
- * // Set pending frames to exactly 3 (don't stack with existing)
2405
- * scheduler.invalidate(3, false);
2406
- *
2407
- * @example
2408
- * // Add 2 more frames to existing pending count
2409
- * scheduler.invalidate(2, true);
2410
- */
2411
- invalidate(frames?: number, stackFrames?: boolean): void;
2412
- /**
2413
- * Reset timing state for deterministic testing.
2414
- * Preserves jobs and roots but resets lastTime, frameCount, elapsedTime, etc.
2415
- * @returns {void}
2416
- */
2417
- resetTiming(): void;
2418
- /**
2419
- * Manually execute a single frame for all roots.
2420
- * Useful for frameloop='never' mode or testing scenarios.
2421
- * @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
2422
- * @returns {void}
2423
- * @example
2424
- * // Manual control mode
2425
- * scheduler.frameloop = 'never';
2426
- * scheduler.step(); // Execute one frame
2427
- */
2428
- step(timestamp?: number): void;
2429
- /**
2430
- * Manually execute a single job by its ID.
2431
- * Useful for testing individual job callbacks in isolation.
2432
- * @param {string} id - The job ID to step
2433
- * @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
2434
- * @returns {void}
2435
- */
2436
- stepJob(id: string, timestamp?: number): void;
2437
- /**
2438
- * Main RAF loop callback.
2439
- * Executes frame, handles demand mode, and schedules next frame.
2440
- * @param {number} timestamp - RAF timestamp in milliseconds
2441
- * @returns {void}
2442
- * @private
2443
- */
2444
- private loop;
2445
- /**
2446
- * Execute a single frame across all roots.
2447
- * Order: globalBefore → each root's jobs → globalAfter
2448
- * @param {number} timestamp - RAF timestamp in milliseconds
2449
- * @returns {void}
2450
- * @private
2451
- */
2452
- private executeFrame;
2453
- /**
2454
- * Run all global jobs from a job map.
2455
- * Catches and logs errors without stopping execution.
2456
- * @param {Map<string, GlobalJob>} jobs - The global jobs map to execute
2457
- * @param {number} timestamp - RAF timestamp in milliseconds
2458
- * @returns {void}
2459
- * @private
2460
- */
2461
- private runGlobalJobs;
2462
- /**
2463
- * Execute all jobs for a single root in sorted order.
2464
- * Rebuilds sorted job list if needed, then dispatches each job.
2465
- * Errors are caught and propagated via triggerError.
2466
- * @param {RootEntry} root - The root entry to tick
2467
- * @param {number} timestamp - RAF timestamp in milliseconds
2468
- * @param {number} delta - Time since last frame in seconds
2469
- * @returns {void}
2470
- * @private
2471
- */
2472
- private tickRoot;
2473
- /**
2474
- * Get the total number of registered jobs across all roots.
2475
- * Includes both per-root jobs and global before/after jobs.
2476
- * @returns {number} Total job count
2477
- */
2478
- getJobCount(): number;
2479
- /**
2480
- * Get all registered job IDs across all roots.
2481
- * Includes both per-root jobs and global before/after jobs.
2482
- * @returns {string[]} Array of all job IDs
2483
- */
2484
- getJobIds(): string[];
2485
- /**
2486
- * Get the number of registered roots (Canvas instances).
2487
- * @returns {number} Number of registered roots
2488
- */
2489
- getRootCount(): number;
2490
- /**
2491
- * Check if any user (non-system) jobs are registered in a specific phase.
2492
- * Used by the default render job to know if a user has taken over rendering.
2493
- *
2494
- * @param phase The phase to check
2495
- * @param rootId Optional root ID to check (checks all roots if not provided)
2496
- * @returns true if any user jobs exist in the phase
2497
- */
2498
- hasUserJobsInPhase(phase: string, rootId?: string): boolean;
2499
- /**
2500
- * Generate a unique root ID for automatic root registration.
2501
- * @returns {string} A unique root ID in the format 'root_N'
2502
- */
2503
- generateRootId(): string;
2504
- /**
2505
- * Generate a unique job ID.
2506
- * @returns {string} A unique job ID in the format 'job_N'
2507
- * @private
2508
- */
2509
- private generateJobId;
2510
- /**
2511
- * Normalize before/after constraints to a Set.
2512
- * Handles undefined, single string, or array inputs.
2513
- * @param {string | string[] | undefined} value - The constraint value(s)
2514
- * @returns {Set<string>} Normalized Set of constraint strings
2515
- * @private
2516
- */
2517
- private normalizeConstraints;
2518
- }
2519
- /**
2520
- * Get the global scheduler instance.
2521
- * Creates one if it doesn't exist.
2522
- */
2523
- declare const getScheduler: () => Scheduler;
2524
-
2525
- /**
2526
- * Frame hook with phase-based ordering, priority, and FPS throttling.
2527
- *
2528
- * Works both inside and outside Canvas context:
2529
- * - Inside Canvas: Full RootState (gl, scene, camera, etc.)
2530
- * - Outside Canvas (waiting mode): Waits for Canvas to mount, then gets full state
2531
- * - Outside Canvas (independent mode): Fires immediately with timing-only state
2532
- *
2533
- * Returns a controls object for manual stepping, pausing, and resuming.
2534
- *
2535
- * @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
2536
- * @param priorityOrOptions - Either a priority number (backwards compat) or options object
2537
- * @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
2538
- *
2539
- * @example
2540
- * // Simple priority (backwards compat)
2541
- * useFrame((state, delta) => { ... }, 5)
2542
- *
2543
- * @example
2544
- * // With phase-based ordering
2545
- * useFrame((state, delta) => { ... }, { phase: 'physics' })
2546
- *
2547
- * @example
2548
- * // Outside Canvas - waits for Canvas to mount
2549
- * function UI() {
2550
- * useFrame((state, delta) => { syncUI(state.camera) });
2551
- * return <button>...</button>;
2552
- * }
2553
- *
2554
- * @example
2555
- * // Independent mode - no Canvas needed
2556
- * getScheduler().independent = true;
2557
- * useFrame((state, delta) => { updateGame(delta) });
2558
- *
2559
- * @example
2560
- * // Scheduler-only access (no callback)
2561
- * const { scheduler } = useFrame()
2562
- * scheduler.pauseJob('some-job-id')
2563
- *
2564
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
2565
- */
2566
- declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
2567
-
2568
1875
  declare const IsObject: (url: unknown) => url is Record<string, string>;
2569
1876
  type TextureArray<T> = T extends string[] ? Texture$1[] : never;
2570
1877
  type TextureRecord<T> = T extends Record<string, string> ? {
@@ -2750,11 +2057,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
2750
2057
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
2751
2058
  */
2752
2059
  declare function useStore(): RootStore;
2753
- /**
2754
- * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
2755
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
2756
- */
2757
- declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
2758
2060
  /**
2759
2061
  * Exposes an object's {@link Instance}.
2760
2062
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
@@ -3919,11 +3221,6 @@ declare function flushSync<R>(fn: () => R): R;
3919
3221
  declare const context: React$1.Context<RootStore>;
3920
3222
  declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
3921
3223
 
3922
- /**
3923
- * Safely flush async effects when testing, simulating a legacy root.
3924
- * @deprecated Import from React instead. import { act } from 'react'
3925
- */
3926
- declare const act: typeof React$1.act;
3927
3224
  /**
3928
3225
  * An SSR-friendly useLayoutEffect.
3929
3226
  *
@@ -4491,9 +3788,12 @@ declare function useUniforms<T extends UniformInputRecord>(uniforms: T): Uniform
4491
3788
  declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
4492
3789
  /**
4493
3790
  * Global rebuildUniforms function for HMR integration.
4494
- * Clears cached uniforms and increments _hmrVersion to trigger re-creation.
3791
+ * Invalidates cached uniforms and increments _hmrVersion to trigger re-creation.
4495
3792
  * Call this when HMR is detected to refresh all uniform creators.
4496
3793
  *
3794
+ * Resolves to the primary store so shared TSL resources rebuild on the
3795
+ * authoritative store.
3796
+ *
4497
3797
  * @param store - The R3F store (from useStore or context)
4498
3798
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4499
3799
  */
@@ -4577,9 +3877,12 @@ declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCr
4577
3877
  declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
4578
3878
  /**
4579
3879
  * Global rebuildNodes function for HMR integration.
4580
- * Clears cached nodes and increments _hmrVersion to trigger re-creation.
3880
+ * Invalidates cached nodes and increments _hmrVersion to trigger re-creation.
4581
3881
  * Call this when HMR is detected to refresh all node creators.
4582
3882
  *
3883
+ * Resolves to the primary store so shared TSL resources rebuild on the
3884
+ * authoritative store.
3885
+ *
4583
3886
  * @param store - The R3F store (from useStore or context)
4584
3887
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4585
3888
  */
@@ -4656,9 +3959,12 @@ declare function useBuffers<T extends Record<string, BufferLike>>(creator: Buffe
4656
3959
  declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
4657
3960
  /**
4658
3961
  * Global rebuildBuffers function for HMR integration.
4659
- * Clears cached buffers and increments _hmrVersion to trigger re-creation.
3962
+ * Invalidates cached buffers and increments _hmrVersion to trigger re-creation.
4660
3963
  * Call this when HMR is detected to refresh all buffer creators.
4661
3964
  *
3965
+ * Resolves to the primary store so shared TSL resources rebuild on the
3966
+ * authoritative store.
3967
+ *
4662
3968
  * @param store - The R3F store (from useStore or context)
4663
3969
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4664
3970
  */
@@ -4690,14 +3996,34 @@ declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: S
4690
3996
  declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
4691
3997
  /**
4692
3998
  * Global rebuildStorage function for HMR integration.
4693
- * Clears cached storage and increments _hmrVersion to trigger re-creation.
3999
+ * Invalidates cached storage and increments _hmrVersion to trigger re-creation.
4694
4000
  * Call this when HMR is detected to refresh all storage creators.
4695
4001
  *
4002
+ * Resolves to the primary store so shared TSL resources rebuild on the
4003
+ * authoritative store.
4004
+ *
4696
4005
  * @param store - The R3F store (from useStore or context)
4697
4006
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4698
4007
  */
4699
4008
  declare function rebuildAllStorage(store: ReturnType<typeof useStore>, scope?: string): void;
4700
4009
 
4010
+ /**
4011
+ * Re-export from core - useTextures is now a core R3F hook (a reactive Texture registry).
4012
+ *
4013
+ * This file maintains backwards compatibility for existing webgpu imports.
4014
+ */
4015
+
4016
+ /**
4017
+ * @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
4018
+ * Kept as an alias for backwards compatibility.
4019
+ */
4020
+ type TextureEntry = Texture$1;
4021
+ /**
4022
+ * @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
4023
+ * Kept as an alias for backwards compatibility.
4024
+ */
4025
+ type TextureNode = Texture$1;
4026
+
4701
4027
  interface TextureOperations {
4702
4028
  add: (key: string, value: any) => void;
4703
4029
  addMultiple: (items: Map<string, any> | Record<string, any>) => void;
@@ -4792,5 +4118,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
4792
4118
  internal: WebGPUInternalState
4793
4119
  }
4794
4120
 
4795
- export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber, Scheduler, Texture, _roots, act, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, fromRef, getInstanceProps, getPrimary, getPrimaryIds, getRootState, getScheduler, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
4796
- export type { Act, AddPhaseOptions, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameControls, FrameNextCallback, FrameNextControls, FrameNextState, FrameState, FrameTimingState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootOptions, WebGPURootState as RootState, RootStore, SchedulerApi, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureInput, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameNextOptions, UseFrameOptions, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
4121
+ /**
4122
+ * @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
4123
+ *
4124
+ * This entry point is for apps that want to use ONLY WebGPURenderer.
4125
+ * Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
4126
+ * Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
4127
+ *
4128
+ * Usage:
4129
+ * import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
4130
+ */
4131
+
4132
+ /** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
4133
+ type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
4134
+ /** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
4135
+ type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
4136
+ declare const useThree: UseThreeWebGPU;
4137
+ declare const useFrame: UseFrameWebGPU;
4138
+
4139
+ export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber, Texture, _roots, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, fromRef, getInstanceProps, getPrimary, getPrimaryIds, getRootState, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
4140
+ export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameWebGPU, UseTextureOptions, UseTexturesReturn, UseThreeWebGPU, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };