@react-three/fiber 10.0.0-canary.2c50459 → 10.0.0-canary.471df95

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';
@@ -11,7 +12,6 @@ import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFr
11
12
  export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
12
13
  import { Options } from 'react-use-measure';
13
14
  import * as react_jsx_runtime from 'react/jsx-runtime';
14
- import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
15
15
  import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
16
16
 
17
17
  function _mergeNamespaces(n, m) {
@@ -41,6 +41,8 @@ function _mergeNamespaces(n, m) {
41
41
  declare const R3F_BUILD_LEGACY = false;
42
42
  declare const R3F_BUILD_WEBGPU = true;
43
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>;
44
46
  declare const WebGLRenderer: {
45
47
  new (): {};
46
48
  };
@@ -49,16 +51,21 @@ type WebGLShadowMap = never;
49
51
 
50
52
  declare const WebGLRenderTarget: any;
51
53
 
54
+ declare const WebGLCubeRenderTarget: any;
55
+
52
56
  var THREE = /*#__PURE__*/_mergeNamespaces({
53
57
  __proto__: null,
58
+ CubeRenderTargetCompat: CubeRenderTarget,
54
59
  Inspector: Inspector,
55
60
  R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
56
61
  R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
57
62
  RenderTargetCompat: RenderTarget,
63
+ WebGLCubeRenderTarget: WebGLCubeRenderTarget,
58
64
  WebGLRenderTarget: WebGLRenderTarget,
59
65
  WebGLRenderer: WebGLRenderer,
60
66
  WebGLRendererParameters: WebGLRendererParameters,
61
- WebGLShadowMap: WebGLShadowMap
67
+ WebGLShadowMap: WebGLShadowMap,
68
+ loadInspector: loadInspector
62
69
  }, [three_webgpu]);
63
70
 
64
71
  //* Utility Types ==============================
@@ -496,9 +503,21 @@ interface InternalState {
496
503
  * @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
497
504
  */
498
505
  canvasTarget?: CanvasTarget
506
+ /**
507
+ * Set when this root's canvas target has been resized and the backend's cached render pass
508
+ * descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
509
+ *
510
+ * Flushed by the canvas-target job in the `start` phase, which is the only place this root's
511
+ * target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
512
+ * whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
513
+ * invalidate some other canvas's descriptor instead.
514
+ *
515
+ * @see https://github.com/pmndrs/react-three-fiber/issues/3847
516
+ */
517
+ canvasTargetSizeDirty?: boolean
499
518
  /**
500
519
  * Whether multi-canvas rendering is active.
501
- * True when any canvas uses `target` prop to share a renderer.
520
+ * True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
502
521
  * When true, setCanvasTarget is called before each render.
503
522
  */
504
523
  isMultiCanvas?: boolean
@@ -596,8 +615,8 @@ interface RootState {
596
615
  setSize: (width?: number, height?: number, top?: number, left?: number) => void
597
616
  /** Shortcut to manual setting the pixel ratio */
598
617
  setDpr: (dpr: Dpr) => void
599
- /** Shortcut to setting frameloop flags */
600
- setFrameloop: (frameloop: Frameloop) => void
618
+ /** Shortcut to setting frameloop flags. No args resets to 'always'. */
619
+ setFrameloop: (frameloop?: Frameloop) => void
601
620
  /** Set error state to propagate to error boundary */
602
621
  setError: (error: Error | null) => void
603
622
  /** Current error state (null when no error) */
@@ -615,7 +634,7 @@ interface RootState {
615
634
  /** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
616
635
  _textureRefs: Map<string, number>
617
636
  /** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
618
- renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
637
+ renderPipeline: ThreeRenderPipeline | null
619
638
  /** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
620
639
  passes: Record<string, any>
621
640
  /** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
@@ -908,8 +927,6 @@ interface Instance<O = any> {
908
927
  attach?: AttachType<O>
909
928
  previousAttach?: any
910
929
  isHidden: boolean
911
- /** Deferred ref props to apply in commitMount */
912
- deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
913
930
  /** Set of props that have been applied via once() */
914
931
  appliedOnce?: Set<string>
915
932
  }
@@ -1146,10 +1163,21 @@ type RenderTargetOptions = RenderTargetOptions$1
1146
1163
  //* Global Types ==============================
1147
1164
 
1148
1165
  declare global {
1149
- /** Uniform node type - a Node with a value property (matches Three.js UniformNode) */
1150
- interface UniformNode<T = unknown> extends Node {
1151
- value: T
1152
- }
1166
+ /**
1167
+ * Uniform node type.
1168
+ *
1169
+ * This is three's own `UniformNode`, not a re-declaration of it. It previously was a
1170
+ * hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
1171
+ * exported type globally — so R3F's ~58 references resolved to an approximation that was
1172
+ * missing members three actually ships (`setName` among them) and had drifted to the wrong
1173
+ * arity when three made `UniformNode` two-parameter.
1174
+ *
1175
+ * three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
1176
+ * so the node type is fixed to `unknown` and the single parameter is kept for call-site
1177
+ * ergonomics. The result is three's structural type, so members stay in sync with the
1178
+ * installed three instead of needing to be mirrored by hand.
1179
+ */
1180
+ type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
1153
1181
 
1154
1182
  /**
1155
1183
  * ShaderCallable - the return type of Fn()
@@ -1294,28 +1322,34 @@ declare module 'three/tsl' {
1294
1322
  ): ShaderCallable<R>
1295
1323
  }
1296
1324
 
1297
- /**
1298
- * RenderPipeline Types for useRenderPipeline hook (WebGPU only)
1299
- */
1300
-
1301
-
1302
-
1303
1325
  declare global {
1326
+ /**
1327
+ * three's own render pipeline type. Named here so the rest of R3F refers to three's shape
1328
+ * rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
1329
+ * is r185, so the new name is the only one.
1330
+ */
1331
+ type ThreeRenderPipeline = three_webgpu.RenderPipeline
1332
+
1304
1333
  /** Pass record - stores TSL pass nodes for render pipeline */
1305
1334
  type PassRecord = Record<string, any>
1306
1335
 
1336
+ /** State passed to pipeline callbacks after the active pipeline has been created */
1337
+ type RenderPipelineCallbackState = RootState & {
1338
+ renderPipeline: ThreeRenderPipeline
1339
+ }
1340
+
1307
1341
  /** Setup callback - runs first to configure MRT, create additional passes */
1308
- type RenderPipelineSetupCallback = (state: RootState) => PassRecord | void
1342
+ type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => PassRecord | void
1309
1343
 
1310
1344
  /** Main callback - runs second to configure outputNode, create effect passes */
1311
- type RenderPipelineMainCallback = (state: RootState) => PassRecord | void
1345
+ type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => PassRecord | void
1312
1346
 
1313
1347
  /** Return type for useRenderPipeline hook */
1314
1348
  interface UseRenderPipelineReturn {
1315
1349
  /** Current passes from state */
1316
1350
  passes: PassRecord
1317
1351
  /** RenderPipeline instance (null if not initialized) */
1318
- renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
1352
+ renderPipeline: ThreeRenderPipeline | null
1319
1353
  /** Clear all passes from state */
1320
1354
  clearPasses: () => void
1321
1355
  /** Reset RenderPipeline entirely (clears PP + passes) */
@@ -1496,7 +1530,7 @@ declare namespace three_d {
1496
1530
  * a single WebGPURenderer using Three.js CanvasTarget API.
1497
1531
  *
1498
1532
  * Primary canvas: Has `id` prop, creates its own renderer, registers here
1499
- * Secondary canvas: Has `target="id"` prop, shares primary's renderer via CanvasTarget
1533
+ * Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
1500
1534
  */
1501
1535
 
1502
1536
  interface PrimaryCanvasEntry {
@@ -1564,12 +1598,23 @@ type EnvironmentLoaderProps = {
1564
1598
  * const texture = useEnvironment({ preset: 'sunset' })
1565
1599
  * ```
1566
1600
  */
1567
- declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture;
1601
+ declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
1568
1602
  declare namespace useEnvironment {
1569
1603
  var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
1570
1604
  var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
1571
1605
  }
1572
- type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'encoding'>;
1606
+ /**
1607
+ * Options accepted by `useEnvironment.preload`.
1608
+ *
1609
+ * `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
1610
+ * applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
1611
+ * advertise an option this function silently ignores.
1612
+ *
1613
+ * This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
1614
+ * `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
1615
+ * type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
1616
+ */
1617
+ type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
1573
1618
  type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
1574
1619
 
1575
1620
  /**
@@ -1613,9 +1658,9 @@ type EnvironmentProps = {
1613
1658
  blur?: number;
1614
1659
  backgroundBlurriness?: number;
1615
1660
  backgroundIntensity?: number;
1616
- backgroundRotation?: Euler$3;
1661
+ backgroundRotation?: Euler;
1617
1662
  environmentIntensity?: number;
1618
- environmentRotation?: Euler$3;
1663
+ environmentRotation?: Euler;
1619
1664
  map?: Texture$1;
1620
1665
  preset?: PresetsType;
1621
1666
  scene?: Scene | React$1.RefObject<Scene>;
@@ -1699,7 +1744,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
1699
1744
  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;
1700
1745
  declare module '@react-three/fiber' {
1701
1746
  interface ThreeElements {
1702
- groundProjectedEnvImpl: ThreeElement$1<typeof GroundedSkybox>;
1747
+ groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
1703
1748
  }
1704
1749
  }
1705
1750
  /**
@@ -1799,6 +1844,24 @@ declare module '@react-three/fiber' {
1799
1844
  */
1800
1845
  declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
1801
1846
 
1847
+ /**
1848
+ * Moves every trace of interactivity from one object to its replacement, for reconstruction.
1849
+ *
1850
+ * When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
1851
+ * instance. Removing the old object from the interaction state and registering the new one from
1852
+ * scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
1853
+ * the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
1854
+ * is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
1855
+ * swap the user never asked to see (#3744).
1856
+ *
1857
+ * Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
1858
+ * left alone — releasing and re-acquiring it is precisely the glitch being avoided.
1859
+ *
1860
+ * Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
1861
+ * the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
1862
+ * cannot outlive the object it described.
1863
+ */
1864
+ declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
1802
1865
  declare function removeInteractivity(store: RootStore, object: Object3D): void;
1803
1866
  declare function createEvents(store: RootStore): {
1804
1867
  handlePointer: (name: string) => (event: DomEvent) => void;
@@ -1819,57 +1882,13 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
1819
1882
  * Note: this hook's caller must be wrapped with `React.Suspense`
1820
1883
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1821
1884
  */
1822
- 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>;
1885
+ 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>;
1823
1886
  declare namespace useLoader {
1824
- var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
1825
- var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
1887
+ 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;
1888
+ var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
1826
1889
  var loader: typeof getLoader;
1827
1890
  }
1828
1891
 
1829
- /**
1830
- * Frame hook with phase-based ordering, priority, and FPS throttling.
1831
- *
1832
- * Always delivers full RootState — works both inside and outside Canvas context:
1833
- * - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
1834
- * - Outside Canvas: The job registers immediately but the callback is held until a
1835
- * Canvas adopts it, then runs with full RootState. For hostless / standalone
1836
- * frame loops with no Canvas, use `@pmndrs/scheduler` directly.
1837
- *
1838
- * Returns a controls object for manual stepping, pausing, and resuming.
1839
- *
1840
- * @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
1841
- * @param priorityOrOptions - Either a priority number (backwards compat) or options object
1842
- * @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
1843
- *
1844
- * @example
1845
- * // Simple priority (backwards compat)
1846
- * useFrame((state, delta) => { ... }, 5)
1847
- *
1848
- * @example
1849
- * // With phase-based ordering
1850
- * useFrame((state, delta) => { ... }, { phase: 'physics' })
1851
- *
1852
- * @example
1853
- * // Outside Canvas - callback waits for a Canvas, then always has full state
1854
- * function UI() {
1855
- * useFrame((state, delta) => { syncUI(state.camera) });
1856
- * return <button>...</button>;
1857
- * }
1858
- *
1859
- * @example
1860
- * // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
1861
- * import { getScheduler } from '@pmndrs/scheduler'
1862
- * getScheduler().register((state, delta) => { updateGame(delta) })
1863
- *
1864
- * @example
1865
- * // Scheduler-only access (no callback)
1866
- * const { scheduler } = useFrame()
1867
- * scheduler.pauseJob('some-job-id')
1868
- *
1869
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
1870
- */
1871
- declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
1872
-
1873
1892
  declare const IsObject: (url: unknown) => url is Record<string, string>;
1874
1893
  type TextureArray<T> = T extends string[] ? Texture$1[] : never;
1875
1894
  type TextureRecord<T> = T extends Record<string, string> ? {
@@ -2055,11 +2074,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
2055
2074
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
2056
2075
  */
2057
2076
  declare function useStore(): RootStore;
2058
- /**
2059
- * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
2060
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
2061
- */
2062
- declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
2063
2077
  /**
2064
2078
  * Exposes an object's {@link Instance}.
2065
2079
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
@@ -2135,7 +2149,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
2135
2149
  * Invalidates the view, requesting a frame to be rendered.
2136
2150
  * In demand mode, this triggers the scheduler to run frames.
2137
2151
  *
2138
- * @param state - Optional root state (ignored in new scheduler, kept for backwards compat)
2152
+ * With a state argument, only that root's jobs run on the requested frames; other
2153
+ * roots on 'demand' stay idle. Without one, every registered root is invalidated.
2154
+ *
2155
+ * @param state - Optional root state; targets the invalidation at that root
2139
2156
  * @param frames - Number of frames to request (default: 1)
2140
2157
  * @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
2141
2158
  *
@@ -2146,14 +2163,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
2146
2163
  * Advances the frameloop and runs render effects.
2147
2164
  * Useful for when manually rendering via `frameloop="never"`.
2148
2165
  *
2166
+ * With a state argument, only that root is stepped. Without one, every
2167
+ * registered root is stepped for backwards compatibility.
2168
+ *
2149
2169
  * @param timestamp - The timestamp to use for this frame
2150
2170
  * @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
2151
- * @param state - Ignored (kept for backwards compat)
2152
- * @param frame - Ignored (kept for backwards compat)
2171
+ * @param state - Optional root state; targets the manual step at that root
2153
2172
  *
2154
2173
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
2155
2174
  */
2156
- declare function advance(timestamp: number): void;
2175
+ declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
2157
2176
 
2158
2177
  /* eslint-disable @definitelytyped/no-unnecessary-generics */
2159
2178
  declare function ReactReconciler<
@@ -3224,11 +3243,6 @@ declare function flushSync<R>(fn: () => R): R;
3224
3243
  declare const context: React$1.Context<RootStore>;
3225
3244
  declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
3226
3245
 
3227
- /**
3228
- * Safely flush async effects when testing, simulating a legacy root.
3229
- * @deprecated Import from React instead. import { act } from 'react'
3230
- */
3231
- declare const act: typeof React$1.act;
3232
3246
  /**
3233
3247
  * An SSR-friendly useLayoutEffect.
3234
3248
  *
@@ -3796,9 +3810,12 @@ declare function useUniforms<T extends UniformInputRecord>(uniforms: T): Uniform
3796
3810
  declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
3797
3811
  /**
3798
3812
  * Global rebuildUniforms function for HMR integration.
3799
- * Clears cached uniforms and increments _hmrVersion to trigger re-creation.
3813
+ * Invalidates cached uniforms and increments _hmrVersion to trigger re-creation.
3800
3814
  * Call this when HMR is detected to refresh all uniform creators.
3801
3815
  *
3816
+ * Resolves to the primary store so shared TSL resources rebuild on the
3817
+ * authoritative store.
3818
+ *
3802
3819
  * @param store - The R3F store (from useStore or context)
3803
3820
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
3804
3821
  */
@@ -3882,9 +3899,12 @@ declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCr
3882
3899
  declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
3883
3900
  /**
3884
3901
  * Global rebuildNodes function for HMR integration.
3885
- * Clears cached nodes and increments _hmrVersion to trigger re-creation.
3902
+ * Invalidates cached nodes and increments _hmrVersion to trigger re-creation.
3886
3903
  * Call this when HMR is detected to refresh all node creators.
3887
3904
  *
3905
+ * Resolves to the primary store so shared TSL resources rebuild on the
3906
+ * authoritative store.
3907
+ *
3888
3908
  * @param store - The R3F store (from useStore or context)
3889
3909
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
3890
3910
  */
@@ -3961,9 +3981,12 @@ declare function useBuffers<T extends Record<string, BufferLike>>(creator: Buffe
3961
3981
  declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
3962
3982
  /**
3963
3983
  * Global rebuildBuffers function for HMR integration.
3964
- * Clears cached buffers and increments _hmrVersion to trigger re-creation.
3984
+ * Invalidates cached buffers and increments _hmrVersion to trigger re-creation.
3965
3985
  * Call this when HMR is detected to refresh all buffer creators.
3966
3986
  *
3987
+ * Resolves to the primary store so shared TSL resources rebuild on the
3988
+ * authoritative store.
3989
+ *
3967
3990
  * @param store - The R3F store (from useStore or context)
3968
3991
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
3969
3992
  */
@@ -3995,14 +4018,34 @@ declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: S
3995
4018
  declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
3996
4019
  /**
3997
4020
  * Global rebuildStorage function for HMR integration.
3998
- * Clears cached storage and increments _hmrVersion to trigger re-creation.
4021
+ * Invalidates cached storage and increments _hmrVersion to trigger re-creation.
3999
4022
  * Call this when HMR is detected to refresh all storage creators.
4000
4023
  *
4024
+ * Resolves to the primary store so shared TSL resources rebuild on the
4025
+ * authoritative store.
4026
+ *
4001
4027
  * @param store - The R3F store (from useStore or context)
4002
4028
  * @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
4003
4029
  */
4004
4030
  declare function rebuildAllStorage(store: ReturnType<typeof useStore>, scope?: string): void;
4005
4031
 
4032
+ /**
4033
+ * Re-export from core - useTextures is now a core R3F hook (a reactive Texture registry).
4034
+ *
4035
+ * This file maintains backwards compatibility for existing webgpu imports.
4036
+ */
4037
+
4038
+ /**
4039
+ * @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
4040
+ * Kept as an alias for backwards compatibility.
4041
+ */
4042
+ type TextureEntry = Texture$1;
4043
+ /**
4044
+ * @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
4045
+ * Kept as an alias for backwards compatibility.
4046
+ */
4047
+ type TextureNode = Texture$1;
4048
+
4006
4049
  interface TextureOperations {
4007
4050
  add: (key: string, value: any) => void;
4008
4051
  addMultiple: (items: Map<string, any> | Record<string, any>) => void;
@@ -4020,6 +4063,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
4020
4063
  * - Callbacks receive full RootState for flexibility
4021
4064
  * - No auto-cleanup on unmount - use reset() for explicit cleanup
4022
4065
  * - Scene/camera changes trigger scenePass recreation
4066
+ * - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
4067
+ * strand its render target (and MRT attachments) on the GPU
4068
+ * - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
4069
+ * recompiles instead of silently keeping the first compiled graph
4023
4070
  *
4024
4071
  * @param mainCB - Main callback to configure outputNode and create effect passes
4025
4072
  * @param setupCB - Optional setup callback to configure MRT on scenePass
@@ -4097,5 +4144,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
4097
4144
  internal: WebGPUInternalState
4098
4145
  }
4099
4146
 
4100
- 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, 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, 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 };
4101
- 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, TextureInput, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
4147
+ /**
4148
+ * @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
4149
+ *
4150
+ * This entry point is for apps that want to use ONLY WebGPURenderer.
4151
+ * Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
4152
+ * Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
4153
+ *
4154
+ * Usage:
4155
+ * import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
4156
+ */
4157
+
4158
+ /** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
4159
+ type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
4160
+ /** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
4161
+ type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
4162
+ declare const useThree: UseThreeWebGPU;
4163
+ declare const useFrame: UseFrameWebGPU;
4164
+
4165
+ 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 };
4166
+ 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 };