@react-three/fiber 10.0.0-canary.bc9af3b → 10.0.0-canary.c385e9f

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,3 +1,4 @@
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
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';
@@ -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
  };
@@ -62,7 +64,8 @@ var THREE = /*#__PURE__*/_mergeNamespaces({
62
64
  WebGLRenderTarget: WebGLRenderTarget,
63
65
  WebGLRenderer: WebGLRenderer,
64
66
  WebGLRendererParameters: WebGLRendererParameters,
65
- WebGLShadowMap: WebGLShadowMap
67
+ WebGLShadowMap: WebGLShadowMap,
68
+ loadInspector: loadInspector
66
69
  }, [three_webgpu]);
67
70
 
68
71
  //* Utility Types ==============================
@@ -362,6 +365,33 @@ type BufferRecord = Record<string, BufferLike>
362
365
  */
363
366
  type BufferStore = Record<string, BufferLike | BufferRecord>
364
367
 
368
+ //* Node Types (useNodes) ========================================
369
+
370
+ /**
371
+ * Structural shape of a TSL node as stored on `state.nodes`.
372
+ *
373
+ * Deliberately minimal rather than three's nominal `Node`: in @types/three several node classes
374
+ * TSL hands back (OperatorNode, ConstNode, ...) do not extend `Node` cleanly, so a `Node` bound
375
+ * would reject values `useNodes` creators legitimately return. This is the same shape
376
+ * `useNodes` already constrains creators to (`TSLNodeLike`).
377
+ */
378
+ interface NodeLike {
379
+ uuid?: string
380
+ nodeType?: string | null
381
+ /** label method for chaining - sets the node's label and returns self */
382
+ label?: ((label: string) => NodeLike) | string
383
+ setName?: (name: string) => this
384
+ }
385
+
386
+ /** Flat record of TSL nodes (no nested scopes) */
387
+ type NodeRecord = Record<string, NodeLike>
388
+
389
+ /**
390
+ * Node store that can contain both root-level nodes and scoped node objects.
391
+ * Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
392
+ */
393
+ type NodeStore = Record<string, NodeLike | NodeRecord>
394
+
365
395
  //* Storage Types (useGPUStorage) ========================================
366
396
 
367
397
  /**
@@ -500,6 +530,18 @@ interface InternalState {
500
530
  * @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
501
531
  */
502
532
  canvasTarget?: CanvasTarget
533
+ /**
534
+ * Set when this root's canvas target has been resized and the backend's cached render pass
535
+ * descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
536
+ *
537
+ * Flushed by the canvas-target job in the `start` phase, which is the only place this root's
538
+ * target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
539
+ * whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
540
+ * invalidate some other canvas's descriptor instead.
541
+ *
542
+ * @see https://github.com/pmndrs/react-three-fiber/issues/3847
543
+ */
544
+ canvasTargetSizeDirty?: boolean
503
545
  /**
504
546
  * Whether multi-canvas rendering is active.
505
547
  * True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
@@ -609,7 +651,7 @@ interface RootState {
609
651
  /** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
610
652
  uniforms: UniformStore
611
653
  /** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
612
- nodes: Record<string, any>
654
+ nodes: NodeStore
613
655
  /** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
614
656
  buffers: BufferStore
615
657
  /** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
@@ -621,7 +663,7 @@ interface RootState {
621
663
  /** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
622
664
  renderPipeline: ThreeRenderPipeline | null
623
665
  /** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
624
- passes: Record<string, any>
666
+ passes: PassRecord
625
667
  /** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
626
668
  _hmrVersion: number
627
669
  /** Internal: whether setSize() has taken ownership of canvas dimensions */
@@ -709,12 +751,19 @@ type DefaultRendererProps = {
709
751
  */
710
752
  interface CanvasSchedulerConfig {
711
753
  /**
712
- * Render this canvas after another canvas completes.
713
- * Pass the `id` of another canvas.
754
+ * Run this Canvas root before the referenced Canvas root id(s).
755
+ */
756
+ before?: string | string[]
757
+ /**
758
+ * Run this Canvas root after the referenced Canvas root id(s).
714
759
  */
715
- after?: string
760
+ after?: string | string[]
716
761
  /**
717
- * Limit this canvas's render rate (frames per second).
762
+ * Numeric root order. Lower values run first.
763
+ */
764
+ order?: number
765
+ /**
766
+ * Limit this Canvas's default render job (frames per second).
718
767
  */
719
768
  fps?: number
720
769
  }
@@ -1162,7 +1211,33 @@ declare global {
1162
1211
  * ergonomics. The result is three's structural type, so members stay in sync with the
1163
1212
  * installed three instead of needing to be mirrored by hand.
1164
1213
  */
1165
- type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
1214
+ type UniformNode<T = unknown> = three_webgpu.UniformNode<UniformNodeTypeFor<T>, T>
1215
+
1216
+ /**
1217
+ * three's node type name for a uniform value type, mirroring the `uniform()` overloads.
1218
+ * A `UniformNode<number>` is a `Node<'float'>`, so TSL math (`.mul`, `.add`, ...) accepts it.
1219
+ * Unknown or unlisted value types resolve to `unknown`, which TSL math rejects: narrow with
1220
+ * `as UniformNode<number>` (or the matching value type) at the call site.
1221
+ */
1222
+ type UniformNodeTypeFor<T> = T extends number
1223
+ ? 'float'
1224
+ : T extends boolean
1225
+ ? 'bool'
1226
+ : T extends three_webgpu.Color
1227
+ ? 'color'
1228
+ : T extends three_webgpu.Vector2
1229
+ ? 'vec2'
1230
+ : T extends three_webgpu.Vector3
1231
+ ? 'vec3'
1232
+ : T extends three_webgpu.Vector4
1233
+ ? 'vec4'
1234
+ : T extends three_webgpu.Matrix2
1235
+ ? 'mat2'
1236
+ : T extends three_webgpu.Matrix3
1237
+ ? 'mat3'
1238
+ : T extends three_webgpu.Matrix4
1239
+ ? 'mat4'
1240
+ : unknown
1166
1241
 
1167
1242
  /**
1168
1243
  * ShaderCallable - the return type of Fn()
@@ -1315,30 +1390,97 @@ declare global {
1315
1390
  */
1316
1391
  type ThreeRenderPipeline = three_webgpu.RenderPipeline
1317
1392
 
1318
- /** Pass record - stores TSL pass nodes for render pipeline */
1319
- type PassRecord = Record<string, any>
1393
+ /**
1394
+ * The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
1395
+ * `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
1396
+ * `getTextureNode`, `setMRT` and `dispose` track the installed version.
1397
+ */
1398
+ type ScenePassNode = three_webgpu.PassNode
1399
+
1400
+ /**
1401
+ * Pass record - stores TSL pass nodes for render pipeline.
1402
+ *
1403
+ * `scenePass` is the only key the library owns. It is optional here because this is also the
1404
+ * shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
1405
+ * or `clearPasses()`. Inside the callbacks it is always present; see
1406
+ * {@link RenderPipelineCallbackState}.
1407
+ *
1408
+ * Every other key is user-registered, via a callback's return value. Those are TSL nodes of
1409
+ * any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
1410
+ * `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
1411
+ * site when you need a member, e.g. `passes.velocity as TextureNode`.
1412
+ */
1413
+ interface PassRecord {
1414
+ scenePass?: ScenePassNode
1415
+ [key: string]: three_webgpu.Node
1416
+ }
1417
+
1418
+ /**
1419
+ * State passed to pipeline callbacks after the active pipeline has been created.
1420
+ *
1421
+ * `passes.scenePass` is required here: the hook installs the default scene pass before either
1422
+ * callback runs, so callbacks can use it without a guard or a cast.
1423
+ *
1424
+ * `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
1425
+ * the legacy renderer before either callback can run, so a callback never sees WebGL.
1426
+ */
1427
+ type RenderPipelineCallbackState = RootState & {
1428
+ renderPipeline: ThreeRenderPipeline
1429
+ passes: PassRecord & { scenePass: ScenePassNode }
1430
+ renderer: three_webgpu.WebGPURenderer
1431
+ isLegacy: false
1432
+ }
1433
+
1434
+ /**
1435
+ * What a callback may return to register entries into `state.passes`.
1436
+ *
1437
+ * `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
1438
+ * created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
1439
+ * store entry would leave the store pointing at a node the hook never disposes, and the hook
1440
+ * disposing a pass nothing references. So returning it is a type error.
1441
+ */
1442
+ type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
1320
1443
 
1321
1444
  /** Setup callback - runs first to configure MRT, create additional passes */
1322
- type RenderPipelineSetupCallback = (state: RootState) => PassRecord | void
1445
+ type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1323
1446
 
1324
1447
  /** Main callback - runs second to configure outputNode, create effect passes */
1325
- type RenderPipelineMainCallback = (state: RootState) => PassRecord | void
1448
+ type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
1326
1449
 
1327
- /** Return type for useRenderPipeline hook */
1328
- interface UseRenderPipelineReturn {
1450
+ /** The imperative half of useRenderPipeline's return value, present in every state */
1451
+ interface UseRenderPipelineActions {
1329
1452
  /** Current passes from state */
1330
1453
  passes: PassRecord
1331
- /** RenderPipeline instance (null if not initialized) */
1332
- renderPipeline: ThreeRenderPipeline | null
1333
1454
  /** Clear all passes from state */
1334
1455
  clearPasses: () => void
1335
1456
  /** Reset RenderPipeline entirely (clears PP + passes) */
1336
1457
  reset: () => void
1337
1458
  /** Re-run setup/main callbacks with current closure values */
1338
1459
  rebuild: () => void
1339
- /** True when RenderPipeline is configured and ready */
1340
- isReady: boolean
1341
1460
  }
1461
+
1462
+ /**
1463
+ * Return type for useRenderPipeline hook, discriminated on `isReady`.
1464
+ *
1465
+ * `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
1466
+ * callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
1467
+ * `clearPasses()` empties the record while leaving the pipeline in place.
1468
+ */
1469
+ type UseRenderPipelineReturn = UseRenderPipelineActions &
1470
+ (
1471
+ | {
1472
+ /** True when RenderPipeline is configured and ready */
1473
+ isReady: true
1474
+ /** RenderPipeline instance */
1475
+ renderPipeline: ThreeRenderPipeline
1476
+ }
1477
+ | {
1478
+ /** False until the pipeline has been created */
1479
+ isReady: false
1480
+ /** Not initialized yet, or torn down by reset() */
1481
+ renderPipeline: null
1482
+ }
1483
+ )
1342
1484
  }
1343
1485
 
1344
1486
  type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
@@ -1638,9 +1780,9 @@ type EnvironmentProps = {
1638
1780
  blur?: number;
1639
1781
  backgroundBlurriness?: number;
1640
1782
  backgroundIntensity?: number;
1641
- backgroundRotation?: Euler$3;
1783
+ backgroundRotation?: Euler;
1642
1784
  environmentIntensity?: number;
1643
- environmentRotation?: Euler$3;
1785
+ environmentRotation?: Euler;
1644
1786
  map?: Texture$1;
1645
1787
  preset?: PresetsType;
1646
1788
  scene?: Scene | React$1.RefObject<Scene>;
@@ -1724,7 +1866,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
1724
1866
  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;
1725
1867
  declare module '@react-three/fiber' {
1726
1868
  interface ThreeElements {
1727
- groundProjectedEnvImpl: ThreeElement$1<typeof GroundedSkybox>;
1869
+ groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
1728
1870
  }
1729
1871
  }
1730
1872
  /**
@@ -1824,6 +1966,24 @@ declare module '@react-three/fiber' {
1824
1966
  */
1825
1967
  declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
1826
1968
 
1969
+ /**
1970
+ * Moves every trace of interactivity from one object to its replacement, for reconstruction.
1971
+ *
1972
+ * When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
1973
+ * instance. Removing the old object from the interaction state and registering the new one from
1974
+ * scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
1975
+ * the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
1976
+ * is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
1977
+ * swap the user never asked to see (#3744).
1978
+ *
1979
+ * Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
1980
+ * left alone — releasing and re-acquiring it is precisely the glitch being avoided.
1981
+ *
1982
+ * Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
1983
+ * the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
1984
+ * cannot outlive the object it described.
1985
+ */
1986
+ declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
1827
1987
  declare function removeInteractivity(store: RootStore, object: Object3D): void;
1828
1988
  declare function createEvents(store: RootStore): {
1829
1989
  handlePointer: (name: string) => (event: DomEvent) => void;
@@ -1851,50 +2011,6 @@ declare namespace useLoader {
1851
2011
  var loader: typeof getLoader;
1852
2012
  }
1853
2013
 
1854
- /**
1855
- * Frame hook with phase-based ordering, priority, and FPS throttling.
1856
- *
1857
- * Always delivers full RootState — works both inside and outside Canvas context:
1858
- * - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
1859
- * - Outside Canvas: The job registers immediately but the callback is held until a
1860
- * Canvas adopts it, then runs with full RootState. For hostless / standalone
1861
- * frame loops with no Canvas, use `@pmndrs/scheduler` directly.
1862
- *
1863
- * Returns a controls object for manual stepping, pausing, and resuming.
1864
- *
1865
- * @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
1866
- * @param priorityOrOptions - Either a priority number (backwards compat) or options object
1867
- * @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
1868
- *
1869
- * @example
1870
- * // Simple priority (backwards compat)
1871
- * useFrame((state, delta) => { ... }, 5)
1872
- *
1873
- * @example
1874
- * // With phase-based ordering
1875
- * useFrame((state, delta) => { ... }, { phase: 'physics' })
1876
- *
1877
- * @example
1878
- * // Outside Canvas - callback waits for a Canvas, then always has full state
1879
- * function UI() {
1880
- * useFrame((state, delta) => { syncUI(state.camera) });
1881
- * return <button>...</button>;
1882
- * }
1883
- *
1884
- * @example
1885
- * // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
1886
- * import { getScheduler } from '@pmndrs/scheduler'
1887
- * getScheduler().register((state, delta) => { updateGame(delta) })
1888
- *
1889
- * @example
1890
- * // Scheduler-only access (no callback)
1891
- * const { scheduler } = useFrame()
1892
- * scheduler.pauseJob('some-job-id')
1893
- *
1894
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
1895
- */
1896
- declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
1897
-
1898
2014
  declare const IsObject: (url: unknown) => url is Record<string, string>;
1899
2015
  type TextureArray<T> = T extends string[] ? Texture$1[] : never;
1900
2016
  type TextureRecord<T> = T extends Record<string, string> ? {
@@ -2080,11 +2196,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
2080
2196
  * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
2081
2197
  */
2082
2198
  declare function useStore(): RootStore;
2083
- /**
2084
- * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
2085
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
2086
- */
2087
- declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
2088
2199
  /**
2089
2200
  * Exposes an object's {@link Instance}.
2090
2201
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
@@ -2160,7 +2271,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
2160
2271
  * Invalidates the view, requesting a frame to be rendered.
2161
2272
  * In demand mode, this triggers the scheduler to run frames.
2162
2273
  *
2163
- * @param state - Optional root state (ignored in new scheduler, kept for backwards compat)
2274
+ * With a state argument, only that root's jobs run on the requested frames; other
2275
+ * roots on 'demand' stay idle. Without one, every registered root is invalidated.
2276
+ *
2277
+ * @param state - Optional root state; targets the invalidation at that root
2164
2278
  * @param frames - Number of frames to request (default: 1)
2165
2279
  * @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
2166
2280
  *
@@ -2171,14 +2285,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
2171
2285
  * Advances the frameloop and runs render effects.
2172
2286
  * Useful for when manually rendering via `frameloop="never"`.
2173
2287
  *
2288
+ * With a state argument, only that root is stepped. Without one, every
2289
+ * registered root is stepped for backwards compatibility.
2290
+ *
2174
2291
  * @param timestamp - The timestamp to use for this frame
2175
2292
  * @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
2176
- * @param state - Ignored (kept for backwards compat)
2177
- * @param frame - Ignored (kept for backwards compat)
2293
+ * @param state - Optional root state; targets the manual step at that root
2178
2294
  *
2179
2295
  * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
2180
2296
  */
2181
- declare function advance(timestamp: number): void;
2297
+ declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
2182
2298
 
2183
2299
  /* eslint-disable @definitelytyped/no-unnecessary-generics */
2184
2300
  declare function ReactReconciler<
@@ -3249,11 +3365,6 @@ declare function flushSync<R>(fn: () => R): R;
3249
3365
  declare const context: React$1.Context<RootStore>;
3250
3366
  declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
3251
3367
 
3252
- /**
3253
- * Safely flush async effects when testing, simulating a legacy root.
3254
- * @deprecated Import from React instead. import { act } from 'react'
3255
- */
3256
- declare const act: typeof React$1.act;
3257
3368
  /**
3258
3369
  * An SSR-friendly useLayoutEffect.
3259
3370
  *
@@ -3867,25 +3978,13 @@ declare function useUniform<T extends UniformValue>(name: string): UniformNode<T
3867
3978
  declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNode<Widen<T>>;
3868
3979
 
3869
3980
  /**
3870
- * Minimal interface for TSL nodes.
3871
- * Used instead of Three.js's Node type because the @types/three definitions
3872
- * have inconsistencies where OperatorNode, ConstNode, etc. don't properly
3873
- * extend Node with all required properties.
3981
+ * Minimal interface for TSL nodes. The definition lives with the store types as `NodeLike`, so
3982
+ * the shape creators may return and the shape `state.nodes` holds are the same type by
3983
+ * construction. See `NodeLike` for why this is structural rather than three's `Node`.
3874
3984
  */
3875
- interface TSLNodeLike {
3876
- uuid?: string;
3877
- nodeType?: string | null;
3878
- /** label method for chaining - sets the node's label and returns self */
3879
- label?: ((label: string) => TSLNodeLike) | string;
3880
- setName?: (name: string) => this;
3881
- }
3985
+ type TSLNodeLike = NodeLike;
3882
3986
  /** TSL node type - alias for compatibility */
3883
3987
  type TSLNode = TSLNodeLike;
3884
- /**
3885
- * A record of TSL nodes - allows mixed node types (OperatorNode, ConstNode, etc.)
3886
- * Uses TSLNodeLike for broader compatibility with Three.js's TSL type definitions.
3887
- */
3888
- type NodeRecord<T extends TSLNodeLike = TSLNodeLike> = Record<string, T>;
3889
3988
  /**
3890
3989
  * Creator function that returns a record of nodes.
3891
3990
  * Uses TSLNodeLike constraint to allow mixed node types
@@ -4074,6 +4173,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
4074
4173
  * - Callbacks receive full RootState for flexibility
4075
4174
  * - No auto-cleanup on unmount - use reset() for explicit cleanup
4076
4175
  * - Scene/camera changes trigger scenePass recreation
4176
+ * - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
4177
+ * strand its render target (and MRT attachments) on the GPU
4178
+ * - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
4179
+ * recompiles instead of silently keeping the first compiled graph
4077
4180
  *
4078
4181
  * @param mainCB - Main callback to configure outputNode and create effect passes
4079
4182
  * @param setupCB - Optional setup callback to configure MRT on scenePass
@@ -4151,5 +4254,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
4151
4254
  internal: WebGPUInternalState
4152
4255
  }
4153
4256
 
4154
- 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 };
4155
- 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, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
4257
+ /**
4258
+ * @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
4259
+ *
4260
+ * This entry point is for apps that want to use ONLY WebGPURenderer.
4261
+ * Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
4262
+ * Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
4263
+ *
4264
+ * Usage:
4265
+ * import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
4266
+ */
4267
+
4268
+ /** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
4269
+ type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
4270
+ /** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
4271
+ type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
4272
+ declare const useThree: UseThreeWebGPU;
4273
+ declare const useFrame: UseFrameWebGPU;
4274
+
4275
+ 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 };
4276
+ 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, NodeLike, NodeProps, NodeStore, 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 };