@react-three/fiber 10.0.0-canary.4f316e6 → 10.0.0-canary.4f9f64c

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,6 +1,6 @@
1
1
  import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
2
2
  import * as three_webgpu 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
+ import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Storage3DTexture, StorageArrayTexture, Data3DTexture, CanvasTarget, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Object3D, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Frustum, OrthographicCamera, Matrix2, WebGPURendererParameters } from 'three/webgpu';
4
4
  import { Inspector } from 'three/addons/inspector/Inspector.js';
5
5
  import * as THREE$1 from 'three';
6
6
  import { Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
@@ -14,20 +14,6 @@ import { Options } from 'react-use-measure';
14
14
  import * as react_jsx_runtime from 'react/jsx-runtime';
15
15
  import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
16
16
 
17
- function _mergeNamespaces(n, m) {
18
- m.forEach(function (e) {
19
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
20
- if (k !== 'default' && !(k in n)) {
21
- var d = Object.getOwnPropertyDescriptor(e, k);
22
- Object.defineProperty(n, k, d.get ? d : {
23
- enumerable: true,
24
- get: function () { return e[k]; }
25
- });
26
- }
27
- });
28
- });
29
- return Object.freeze(n);
30
- }
31
17
 
32
18
  /**
33
19
  * @fileoverview Internal Three.js re-exports - WEBGPU ONLY ENTRY
@@ -53,20 +39,6 @@ declare const WebGLRenderTarget: any;
53
39
 
54
40
  declare const WebGLCubeRenderTarget: any;
55
41
 
56
- var THREE = /*#__PURE__*/_mergeNamespaces({
57
- __proto__: null,
58
- CubeRenderTargetCompat: CubeRenderTarget,
59
- Inspector: Inspector,
60
- R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
61
- R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
62
- RenderTargetCompat: RenderTarget,
63
- WebGLCubeRenderTarget: WebGLCubeRenderTarget,
64
- WebGLRenderTarget: WebGLRenderTarget,
65
- WebGLRenderer: WebGLRenderer,
66
- WebGLRendererParameters: WebGLRendererParameters,
67
- WebGLShadowMap: WebGLShadowMap,
68
- loadInspector: loadInspector
69
- }, [three_webgpu]);
70
42
 
71
43
  //* Utility Types ==============================
72
44
 
@@ -354,6 +326,7 @@ type BufferLike =
354
326
  | Uint16Array
355
327
  | Int16Array
356
328
  | THREE$1.BufferAttribute // Base class for all buffer attributes
329
+ | THREE$1.InterleavedBufferAttribute
357
330
  | Node // TSL buffer nodes (instancedArray, storage)
358
331
 
359
332
  /** Flat record of buffer-like values (no nested scopes) */
@@ -368,23 +341,15 @@ type BufferStore = Record<string, BufferLike | BufferRecord>
368
341
  //* Node Types (useNodes) ========================================
369
342
 
370
343
  /**
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`).
344
+ * Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
345
+ * the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
346
+ * code passes through. Creators are constrained to this same type, so the shape a creator returns
347
+ * and the shape the store holds are one type by construction.
377
348
  */
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
- }
349
+ type NodeLike = TSLNodeType | LegacyTSLNodeLike
385
350
 
386
351
  /** Flat record of TSL nodes (no nested scopes) */
387
- type NodeRecord = Record<string, NodeLike>
352
+ type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
388
353
 
389
354
  /**
390
355
  * Node store that can contain both root-level nodes and scoped node objects.
@@ -406,7 +371,9 @@ type NodeStore = Record<string, NodeLike | NodeRecord>
406
371
  * ```
407
372
  */
408
373
  type StorageLike =
409
- | StorageTexture // GPU storage texture
374
+ | StorageTexture // 2D GPU storage texture
375
+ | Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
376
+ | StorageArrayTexture // 2D-array GPU storage texture
410
377
  | Data3DTexture // 3D texture (can be used as storage)
411
378
  | Node // TSL storage texture nodes (storageTexture)
412
379
 
@@ -855,14 +822,17 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
855
822
  performance?: Partial<Omit<Performance, 'regress'>>
856
823
  /** Target pixel ratio. Can clamp between a range: `[min, max]` */
857
824
  dpr?: Dpr
858
- /** Props that go into the default raycaster */
859
- raycaster?: Partial<THREE$1.Raycaster>
825
+ /**
826
+ * Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
827
+ * so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
828
+ */
829
+ raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
860
830
  /** A `THREE.Scene` instance or props that go into the default scene */
861
831
  scene?: THREE$1.Scene | Partial<THREE$1.Scene>
862
832
  /** A `THREE.Camera` instance or props that go into the default camera */
863
833
  camera?: CameraProps
864
834
  /** An R3F event manager to manage elements' pointer events */
865
- events?: (store: RootStore) => EventManager<HTMLElement>
835
+ events?: (store: RootStore) => EventManager<Element>
866
836
  /** Callback after the canvas has rendered (but not yet committed) */
867
837
  onCreated?: (state: RootState) => void
868
838
  /** Response for pointer clicks that have missed any target */
@@ -1091,7 +1061,7 @@ interface CanvasProps
1091
1061
  */
1092
1062
  resize?: Options
1093
1063
  /** The target where events are being subscribed to, default: the div that wraps canvas */
1094
- eventSource?: HTMLElement | React$1.RefObject<HTMLElement | null>
1064
+ eventSource?: Element | React$1.RefObject<Element | null>
1095
1065
  /** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
1096
1066
  eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
1097
1067
  /** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
@@ -1199,107 +1169,86 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
1199
1169
 
1200
1170
  type RenderTargetOptions = RenderTargetOptions$1
1201
1171
 
1202
- //* Global Types ==============================
1172
+ //* Global TSL Types ==============================
1203
1173
 
1204
1174
  declare global {
1205
1175
  /**
1206
- * Uniform node type.
1207
- *
1208
- * This is three's own `UniformNode`, not a re-declaration of it. It previously was a
1209
- * hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
1210
- * exported type globally — so R3F's ~58 references resolved to an approximation that was
1211
- * missing members three actually ships (`setName` among them) and had drifted to the wrong
1212
- * arity when three made `UniformNode` two-parameter.
1213
- *
1214
- * three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
1215
- * so the node type is fixed to `unknown` and the single parameter is kept for call-site
1216
- * ergonomics. The result is three's structural type, so members stay in sync with the
1217
- * installed three instead of needing to be mirrored by hand.
1176
+ * Broad callable-node fallback for dynamic store readers.
1177
+ * Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
1218
1178
  */
1219
- type UniformNode<T = unknown> = three_webgpu.UniformNode<UniformNodeTypeFor<T>, T>
1179
+ type CallableTSLNode = ((...params: never[]) => unknown) & {
1180
+ readonly shaderNode: unknown
1181
+ readonly id: number
1182
+ }
1183
+
1184
+ /** Legacy structural node accepted when at least one historical marker exists. */
1185
+ type LegacyTSLNodeLike = {
1186
+ label?: ((label: string) => unknown) | string
1187
+ setName?: (name: string) => unknown
1188
+ } & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
1189
+
1190
+ /** Node type accepted by broad dynamic node-store readers. */
1191
+ type TSLNodeType = three_webgpu.Node | CallableTSLNode
1220
1192
 
1221
1193
  /**
1222
- * three's node type name for a uniform value type, mirroring the `uniform()` overloads.
1223
- * A `UniformNode<number>` is a `Node<'float'>`, so TSL math (`.mul`, `.add`, ...) accepts it.
1224
- * Unknown or unlisted value types resolve to `unknown`, which TSL math rejects: narrow with
1225
- * `as UniformNode<number>` (or the matching value type) at the call site.
1194
+ * Derive Three's shader node type from an existing node or a supported raw input.
1195
+ * Existing InputNode generics take precedence over structural value normalization.
1196
+ * Both generics must be inferred because Three's UniformNode intersects an unknown-typed
1197
+ * InputNode base with its concrete InputNode specialization.
1226
1198
  */
1227
- type UniformNodeTypeFor<T> = T extends number
1228
- ? 'float'
1229
- : T extends boolean
1230
- ? 'bool'
1231
- : T extends three_webgpu.Color
1232
- ? 'color'
1233
- : T extends three_webgpu.Vector2
1234
- ? 'vec2'
1235
- : T extends three_webgpu.Vector3
1236
- ? 'vec3'
1237
- : T extends three_webgpu.Vector4
1199
+ type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
1200
+ ? TNodeType
1201
+ : T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
1202
+ ? TNodeType
1203
+ : T extends number
1204
+ ? 'float'
1205
+ : T extends boolean
1206
+ ? 'bool'
1207
+ : T extends string | three_webgpu.Color | { r: number; g: number; b: number }
1208
+ ? 'color'
1209
+ : T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
1238
1210
  ? 'vec4'
1239
- : T extends three_webgpu.Matrix2
1240
- ? 'mat2'
1241
- : T extends three_webgpu.Matrix3
1242
- ? 'mat3'
1211
+ : T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
1212
+ ? 'vec3'
1213
+ : T extends three_webgpu.Vector2 | { x: number; y: number }
1214
+ ? 'vec2'
1243
1215
  : T extends three_webgpu.Matrix4
1244
1216
  ? 'mat4'
1245
- : unknown
1246
-
1247
- /**
1248
- * ShaderCallable - the return type of Fn()
1249
- * A callable shader function node that can be invoked with parameters.
1250
- * The function returns a ShaderNodeObject when called.
1251
- *
1252
- * @example
1253
- * ```tsx
1254
- * // Define a shader function
1255
- * const blendColorFn = Fn(([color1, color2, factor]) => {
1256
- * return mix(color1, color2, factor)
1257
- * })
1258
- *
1259
- * // Type when retrieving from nodes store
1260
- * const { blendColorFn } = nodes as { blendColorFn: ShaderCallable }
1261
- *
1262
- * // Or with specific return type
1263
- * const { myFn } = nodes as { myFn: ShaderCallable<THREE.Node> }
1264
- * ```
1265
- */
1266
- type ShaderCallable<R extends Node = Node> = ((...params: unknown[]) => ShaderNodeObject<R>) & Node
1267
-
1268
- /**
1269
- * ShaderNodeRef - a ShaderNodeObject wrapper around a Node
1270
- * This is the common return type for TSL operations (add, mul, sin, etc.)
1271
- *
1272
- * @example
1273
- * ```tsx
1274
- * const { wobble } = nodes as { wobble: ShaderNodeRef }
1275
- * ```
1276
- */
1277
- type ShaderNodeRef<T extends Node = Node> = ShaderNodeObject<T>
1217
+ : T extends three_webgpu.Matrix3
1218
+ ? 'mat3'
1219
+ : T extends three_webgpu.Matrix2
1220
+ ? 'mat2'
1221
+ : unknown
1222
+
1223
+ /** Derive the normalized JavaScript value stored by a uniform node. */
1224
+ type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
1225
+ ? TValue
1226
+ : T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
1227
+ ? TValue
1228
+ : T extends string | { r: number; g: number; b: number }
1229
+ ? three_webgpu.Color
1230
+ : T extends { x: number; y: number; z: number; w: number }
1231
+ ? three_webgpu.Vector4
1232
+ : T extends { x: number; y: number; z: number }
1233
+ ? three_webgpu.Vector3
1234
+ : T extends { x: number; y: number }
1235
+ ? three_webgpu.Vector2
1236
+ : T extends number
1237
+ ? number
1238
+ : T extends boolean
1239
+ ? boolean
1240
+ : T
1241
+
1242
+ /** Three's exact UniformNode with shader and value generics derived from an input. */
1243
+ type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
1244
+
1245
+ /** Preserve every input key while mapping values to exact Three uniform nodes. */
1246
+ type UniformNodesFor<T extends UniformInputRecord> = {
1247
+ [K in keyof T]: UniformNodeFor<T[K]>
1248
+ }
1278
1249
 
1279
- /**
1280
- * TSLNodeType - Union of all common TSL node types
1281
- * Used by ScopedStore to properly type node access from the store.
1282
- *
1283
- * Includes:
1284
- * - Node: base Three.js node type
1285
- * - ShaderCallable: function nodes created with Fn()
1286
- * - ShaderNodeObject: wrapped nodes from TSL operations (sin, mul, mix, etc.)
1287
- *
1288
- * @example
1289
- * ```tsx
1290
- * // In useLocalNodes, nodes are typed as TSLNodeType
1291
- * const { positionNode, blendColorFn } = useLocalNodes(({ nodes }) => ({
1292
- * positionNode: nodes.myPosition, // Works - Node is in union
1293
- * blendColorFn: nodes.myFn, // Works - ShaderCallable is in union
1294
- * }))
1295
- *
1296
- * // Can narrow with type guard or assertion when needed
1297
- * if (typeof blendColorFn === 'function') {
1298
- * blendColorFn(someColor, 0.5)
1299
- * }
1300
- * ```
1301
- */
1302
- type TSLNodeType = Node | ShaderCallable<Node> | ShaderNodeObject<Node>
1250
+ /** Backward-compatible single-parameter uniform alias. */
1251
+ type UniformNode<T = unknown> = UniformNodeFor<T>
1303
1252
 
1304
1253
  /** Flat record of uniform nodes (no nested scopes) */
1305
1254
  type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
@@ -1324,7 +1273,7 @@ declare global {
1324
1273
  * Acceptable input values for useUniforms - raw values that get converted to UniformNodes
1325
1274
  * Supports:
1326
1275
  * - Primitives: number, string (color), boolean
1327
- * - Three.js types: Color, Vector2/3/4, Matrix3/4, Euler, Quaternion
1276
+ * - Three.js types: Color, Vector2/3/4, Matrix2/3/4
1328
1277
  * - Plain objects: { x, y, z, w } converted to vectors
1329
1278
  * - TSL nodes: color(), vec3(), float() for type casting
1330
1279
  * - UniformNode: existing uniforms (reused as-is)
@@ -1337,56 +1286,20 @@ declare global {
1337
1286
  | three_webgpu.Vector2
1338
1287
  | three_webgpu.Vector3
1339
1288
  | three_webgpu.Vector4
1289
+ | three_webgpu.Matrix2
1340
1290
  | three_webgpu.Matrix3
1341
1291
  | three_webgpu.Matrix4
1342
- | three_webgpu.Euler
1343
- | three_webgpu.Quaternion
1344
- | { x: number; y?: number; z?: number; w?: number } // Plain objects converted to vectors
1292
+ | { x: number; y: number }
1293
+ | { x: number; y: number; z: number }
1294
+ | { x: number; y: number; z: number; w: number }
1345
1295
  | { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
1346
- | Node // TSL nodes like color(), vec3(), float() for type casting
1296
+ | three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
1347
1297
  | UniformNode
1348
1298
 
1349
1299
  /** Input record for useUniforms - accepts raw values or UniformNodes */
1350
1300
  type UniformInputRecord = Record<string, UniformValue>
1351
1301
  }
1352
1302
 
1353
- //* Module Augmentation ==============================
1354
-
1355
- declare module 'three/tsl' {
1356
- /**
1357
- * Fn with array parameter destructuring
1358
- * @example Fn(([uv, skew]) => { ... })
1359
- */
1360
- export function Fn<R extends Node = Node>(
1361
- jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
1362
- ): ShaderCallable<R>
1363
-
1364
- /**
1365
- * Fn with object parameter destructuring
1366
- * @example Fn(({ color, intensity }) => { ... })
1367
- */
1368
- export function Fn<T extends Record<string, unknown>, R extends Node = Node>(
1369
- jsFunc: (inputs: T) => ShaderNodeObject<R>,
1370
- ): ShaderCallable<R>
1371
-
1372
- /**
1373
- * Fn with array params + layout
1374
- * @example Fn(([a, b]) => { ... }, { layout: [...] })
1375
- */
1376
- export function Fn<R extends Node = Node>(
1377
- jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
1378
- layout: { layout?: unknown },
1379
- ): ShaderCallable<R>
1380
-
1381
- /**
1382
- * Fn with object params + layout
1383
- */
1384
- export function Fn<T extends Record<string, unknown>, R extends Node = Node>(
1385
- jsFunc: (inputs: T) => ShaderNodeObject<R>,
1386
- layout: { layout?: unknown },
1387
- ): ShaderCallable<R>
1388
- }
1389
-
1390
1303
  declare global {
1391
1304
  /**
1392
1305
  * three's own render pipeline type. Named here so the rest of R3F refers to three's shape
@@ -1414,10 +1327,15 @@ declare global {
1414
1327
  * any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
1415
1328
  * `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
1416
1329
  * site when you need a member, e.g. `passes.velocity as TextureNode`.
1330
+ *
1331
+ * The index signature admits `undefined` because a key may simply not be registered, and
1332
+ * because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
1333
+ * optional property whose type excludes `undefined` from the index signature is an error
1334
+ * (TS2411) for every consumer compiling these declarations.
1417
1335
  */
1418
1336
  interface PassRecord {
1419
1337
  scenePass?: ScenePassNode
1420
- [key: string]: three_webgpu.Node
1338
+ [key: string]: three_webgpu.Node | undefined
1421
1339
  }
1422
1340
 
1423
1341
  /**
@@ -1564,10 +1482,11 @@ type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
1564
1482
 
1565
1483
  /**
1566
1484
  * For node material properties (colorNode, positionNode, etc.), accept broader types
1567
- * since @types/three has broken inheritance for TSL node subclasses.
1485
+ * since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
1486
+ * `nodeType`, so this structural key test remains neutral to the selected Three entry.
1568
1487
  */
1569
1488
  type NodeProps<P> = {
1570
- [K in keyof P as P[K] extends Node | null ? K : never]?: TSLNodeInput
1489
+ [K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
1571
1490
  }
1572
1491
 
1573
1492
  interface ReactProps<P> {
@@ -1588,11 +1507,30 @@ type ThreeToJSXElements<T extends Record<string, any>> = {
1588
1507
  [K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
1589
1508
  }
1590
1509
 
1510
+ /** Method names of Object3D, excluded from the `primitive` element's typed props. */
1511
+ type Object3DMethod = NonNullable<
1512
+ {
1513
+ [K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
1514
+ }[keyof Object3D]
1515
+ >
1516
+
1591
1517
  type ThreeExports = typeof import('three/webgpu')
1592
1518
  type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
1593
1519
 
1594
1520
  interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
1595
- primitive: Omit<ThreeElement<any>, 'args'> & { object: object }
1521
+ /**
1522
+ * `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
1523
+ * Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
1524
+ * untyped, and any other prop is accepted and applied to the object by name. Object3D's own
1525
+ * methods are left out of the typed surface: they return `this`, so a subclass element's
1526
+ * props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
1527
+ */
1528
+ primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | 'onUpdate' | Object3DMethod> & {
1529
+ object: object
1530
+ ref?: React.Ref<any>
1531
+ onUpdate?: (self: any) => void
1532
+ [prop: string]: unknown
1533
+ }
1596
1534
  // Conflicts with DOM types can be accessed through a three* prefix
1597
1535
  threeAudio: ThreeElementsImpl['audio']
1598
1536
  threeSource: ThreeElementsImpl['source']
@@ -1633,6 +1571,7 @@ type three_d_Matrix3 = Matrix3;
1633
1571
  type three_d_Matrix4 = Matrix4;
1634
1572
  type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
1635
1573
  type three_d_NodeProps<P> = NodeProps<P>;
1574
+ type three_d_Object3DMethod = Object3DMethod;
1636
1575
  type three_d_Quaternion = Quaternion;
1637
1576
  type three_d_RaycastableRepresentation = RaycastableRepresentation;
1638
1577
  type three_d_ReactProps<P> = ReactProps<P>;
@@ -1647,7 +1586,7 @@ type three_d_Vector3 = Vector3;
1647
1586
  type three_d_Vector4 = Vector4;
1648
1587
  type three_d_VectorRepresentation = VectorRepresentation;
1649
1588
  declare namespace three_d {
1650
- export type { three_d_Color as Color, three_d_ElementProps as ElementProps, three_d_Euler as Euler, three_d_EventProps as EventProps, three_d_GeometryProps as GeometryProps, three_d_GeometryTransformProps as GeometryTransformProps, three_d_Layers as Layers, three_d_MathProps as MathProps, three_d_MathRepresentation as MathRepresentation, three_d_MathType as MathType, three_d_MathTypes as MathTypes, three_d_Matrix3 as Matrix3, three_d_Matrix4 as Matrix4, three_d_MutableOrReadonlyParameters as MutableOrReadonlyParameters, three_d_NodeProps as NodeProps, three_d_Quaternion as Quaternion, three_d_RaycastableRepresentation as RaycastableRepresentation, three_d_ReactProps as ReactProps, three_d_TSLNodeInput as TSLNodeInput, three_d_ThreeElement as ThreeElement, three_d_ThreeElements as ThreeElements, three_d_ThreeElementsImpl as ThreeElementsImpl, three_d_ThreeExports as ThreeExports, three_d_ThreeToJSXElements as ThreeToJSXElements, three_d_Vector2 as Vector2, three_d_Vector3 as Vector3, three_d_Vector4 as Vector4, three_d_VectorRepresentation as VectorRepresentation };
1589
+ export type { three_d_Color as Color, three_d_ElementProps as ElementProps, three_d_Euler as Euler, three_d_EventProps as EventProps, three_d_GeometryProps as GeometryProps, three_d_GeometryTransformProps as GeometryTransformProps, three_d_Layers as Layers, three_d_MathProps as MathProps, three_d_MathRepresentation as MathRepresentation, three_d_MathType as MathType, three_d_MathTypes as MathTypes, three_d_Matrix3 as Matrix3, three_d_Matrix4 as Matrix4, three_d_MutableOrReadonlyParameters as MutableOrReadonlyParameters, three_d_NodeProps as NodeProps, three_d_Object3DMethod as Object3DMethod, three_d_Quaternion as Quaternion, three_d_RaycastableRepresentation as RaycastableRepresentation, three_d_ReactProps as ReactProps, three_d_TSLNodeInput as TSLNodeInput, three_d_ThreeElement as ThreeElement, three_d_ThreeElements as ThreeElements, three_d_ThreeElementsImpl as ThreeElementsImpl, three_d_ThreeExports as ThreeExports, three_d_ThreeToJSXElements as ThreeToJSXElements, three_d_Vector2 as Vector2, three_d_Vector3 as Vector3, three_d_Vector4 as Vector4, three_d_VectorRepresentation as VectorRepresentation };
1651
1590
  }
1652
1591
 
1653
1592
  /**
@@ -1996,7 +1935,7 @@ declare function createEvents(store: RootStore): {
1996
1935
  processDeferredPointer: (event: DomEvent, pointerId: number) => void;
1997
1936
  };
1998
1937
  /** Default R3F event manager for web */
1999
- declare function createPointerEvents(store: RootStore): EventManager<HTMLElement>;
1938
+ declare function createPointerEvents(store: RootStore): EventManager<Element>;
2000
1939
 
2001
1940
  /**
2002
1941
  * Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
@@ -3344,6 +3283,7 @@ declare namespace ReactReconciler {
3344
3283
 
3345
3284
  declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
3346
3285
  declare function extend<T extends Catalogue>(objects: T): void;
3286
+ declare function extend(objects: Record<string, unknown>): void;
3347
3287
  declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
3348
3288
 
3349
3289
  declare const isRenderer: (def: any) => boolean;
@@ -3787,29 +3727,44 @@ declare const hasConstructor: (object: unknown) => object is {
3787
3727
  * Used to identify values that should be resolved from refs after mount.
3788
3728
  */
3789
3729
  declare const FROM_REF: unique symbol;
3730
+ /** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
3731
+ interface FromRefMarker<T = unknown, R = T> {
3732
+ [FROM_REF]: React$1.RefObject<T | null>;
3733
+ /** Optional transform applied to the resolved ref before assignment. */
3734
+ transform?: (value: T) => R;
3735
+ }
3790
3736
  /**
3791
3737
  * Defers prop application until the referenced object is available.
3792
3738
  * Useful for props like `target` that need sibling refs to be populated.
3793
3739
  *
3740
+ * Only top-level props on a three element are resolved: a marker nested inside another value
3741
+ * (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
3742
+ * than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
3743
+ * what gets assigned.
3744
+ *
3794
3745
  * @param ref - React ref object to resolve at mount time
3795
- * @returns A marker value that applyProps will resolve after mount
3746
+ * @param transform - Optional mapping from the resolved object to the value the prop expects
3747
+ * @returns A marker value that the reconciler resolves after mount
3796
3748
  *
3797
3749
  * @example
3798
3750
  * const targetRef = useRef<THREE.Object3D>(null)
3799
3751
  *
3800
3752
  * <group ref={targetRef} position={[-3, -2, -15]} />
3801
3753
  * <spotLight target={fromRef(targetRef)} intensity={100} />
3754
+ *
3755
+ * @example
3756
+ * // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
3757
+ * <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
3802
3758
  */
3803
3759
  declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
3760
+ declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
3804
3761
  /**
3805
3762
  * Type guard to check if a value is a fromRef marker.
3806
3763
  *
3807
3764
  * @param value - Value to check
3808
3765
  * @returns True if value is a fromRef marker
3809
3766
  */
3810
- declare function isFromRef(value: unknown): value is {
3811
- [FROM_REF]: React$1.RefObject<any>;
3812
- };
3767
+ declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
3813
3768
 
3814
3769
  /**
3815
3770
  * Symbol marker for mount-only method calls.
@@ -3836,7 +3791,15 @@ declare const ONCE: unique symbol;
3836
3791
  * // No arguments
3837
3792
  * <geometry center={once()} />
3838
3793
  */
3839
- declare function once<T>(...args: T[]): T;
3794
+ declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
3795
+ /**
3796
+ * What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
3797
+ * the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
3798
+ * methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
3799
+ *
3800
+ * The runtime value is always the marker object; only the declared type follows the prop.
3801
+ */
3802
+ type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
3840
3803
  /**
3841
3804
  * Type guard to check if a value is a once marker.
3842
3805
  *
@@ -3847,11 +3810,8 @@ declare function isOnce(value: unknown): value is {
3847
3810
  [ONCE]: any[] | true;
3848
3811
  };
3849
3812
 
3850
- /**
3851
- * A DOM canvas which accepts threejs elements as children.
3852
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
3853
- */
3854
- declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
3813
+ /** Distinguishes a resource leaf from a nested resource scope. */
3814
+ type ResourceLeafGuard<T> = (value: unknown) => value is T;
3855
3815
 
3856
3816
  /**
3857
3817
  * ScopedStore - Type-safe wrapper for nested stores (uniforms, nodes)
@@ -3873,33 +3833,30 @@ declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
3873
3833
  * ```
3874
3834
  */
3875
3835
 
3876
- /** Keys reserved for methods (excluded from index signature) */
3877
- type MethodKeys = 'scope' | 'has' | 'keys';
3878
3836
  /**
3879
3837
  * Type-safe wrapper interface for accessing nested store data.
3880
3838
  * Property access returns `T` (assumes leaf node).
3881
3839
  * Use `.scope(key)` for nested object access.
3882
3840
  *
3883
- * Uses mapped type with key filtering to exclude method names from index signature,
3884
- * allowing methods to have their correct return types.
3885
3841
  */
3886
- type ScopedStoreType<T> = {
3887
- /** Direct property access returns the leaf type T (method keys excluded) */
3888
- readonly [K in string as K extends MethodKeys ? never : K]: T;
3889
- } & {
3842
+ type ScopedStoreMethods<TLeaf> = {
3890
3843
  /** Access a nested scope by key. Returns empty wrapper if scope doesn't exist. */
3891
- scope(key: string): ScopedStoreType<T>;
3844
+ scope<TScope extends Record<string, TLeaf> = Record<string, TLeaf>>(key: string): ScopedStoreType<TLeaf, TScope>;
3892
3845
  /** Check if a key exists in the store */
3893
3846
  has(key: string): boolean;
3894
3847
  /** Get all keys in the store */
3895
3848
  keys(): string[];
3896
3849
  };
3850
+ type ScopedStoreType<TLeaf, TEntries extends Record<string, TLeaf> = Record<string, TLeaf>> = Readonly<TEntries> & ScopedStoreMethods<TLeaf>;
3851
+ interface ScopedStoreData<TLeaf> {
3852
+ [key: string]: TLeaf | ScopedStoreData<TLeaf>;
3853
+ }
3897
3854
  /**
3898
3855
  * Create a type-safe ScopedStore wrapper around store data.
3899
3856
  * @param data - The raw store data (uniforms or nodes from RootState)
3900
3857
  * @returns A ScopedStoreType wrapper with type-safe access
3901
3858
  */
3902
- declare function createScopedStore<T>(data: Record<string, any>): ScopedStoreType<T>;
3859
+ declare function createScopedStore<TLeaf>(data: ScopedStoreData<TLeaf>, isLeaf: ResourceLeafGuard<TLeaf>): ScopedStoreType<TLeaf>;
3903
3860
  /**
3904
3861
  * State type passed to creator functions with ScopedStore wrappers.
3905
3862
  * Provides type-safe access to uniforms, nodes, buffers, and gpuStorage without manual casting.
@@ -3907,8 +3864,8 @@ declare function createScopedStore<T>(data: Record<string, any>): ScopedStoreTyp
3907
3864
  type CreatorState = Omit<RootState, 'uniforms' | 'nodes' | 'buffers' | 'gpuStorage'> & {
3908
3865
  /** Type-safe uniform access - property access returns UniformNode */
3909
3866
  uniforms: ScopedStoreType<UniformNode>;
3910
- /** Type-safe node access - property access returns TSLNodeType (Node | ShaderCallable | ShaderNodeObject) */
3911
- nodes: ScopedStoreType<TSLNodeType>;
3867
+ /** Type-safe node access for real, callable, and legacy structural nodes */
3868
+ nodes: ScopedStoreType<NodeLike>;
3912
3869
  /** Type-safe buffer access - property access returns BufferLike (TypedArrays, BufferAttributes, TSL nodes) */
3913
3870
  buffers: ScopedStoreType<BufferLike>;
3914
3871
  /** Type-safe GPU storage access - property access returns StorageLike (StorageTexture, TSL nodes) */
@@ -3924,17 +3881,18 @@ type ClearUniformsFn = (scope?: string) => void;
3924
3881
  /** Function signature for rebuildUniforms util */
3925
3882
  type RebuildUniformsFn = (scope?: string) => void;
3926
3883
  /** Return type with utils included */
3927
- type UniformsWithUtils<T extends UniformRecord = UniformRecord> = T & {
3884
+ type UniformsWithUtils<T extends UniformRecord | UniformStore = UniformRecord> = T & {
3928
3885
  removeUniforms: RemoveUniformsFn;
3929
3886
  clearUniforms: ClearUniformsFn;
3930
3887
  rebuildUniforms: RebuildUniformsFn;
3931
3888
  };
3932
- declare function useUniforms(): UniformsWithUtils<UniformRecord & Record<string, UniformRecord>>;
3889
+ declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>): UniformsWithUtils<UniformNodesFor<T>>;
3890
+ declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
3891
+ declare function useUniforms<T extends UniformInputRecord>(uniforms: T): UniformsWithUtils<UniformNodesFor<T>>;
3892
+ declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
3893
+ declare function useUniforms(): UniformsWithUtils<UniformStore>;
3933
3894
  declare function useUniforms(scope: string): UniformsWithUtils;
3934
- declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>): UniformsWithUtils<UniformRecord<UniformNode>>;
3935
- declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
3936
- declare function useUniforms<T extends UniformInputRecord>(uniforms: T): UniformsWithUtils<UniformRecord<UniformNode>>;
3937
- declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
3895
+ declare function useUniforms<T extends UniformInputRecord>(scope?: string): UniformsWithUtils<UniformNodesFor<T>>;
3938
3896
  /**
3939
3897
  * Global rebuildUniforms function for HMR integration.
3940
3898
  * Invalidates cached uniforms and increments _hmrVersion to trigger re-creation.
@@ -3965,35 +3923,28 @@ declare function clearRootUniforms(set: ReturnType<typeof useStore>['setState'])
3965
3923
 
3966
3924
  /**
3967
3925
  * Supported uniform value types:
3968
- * - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix3, Matrix4
3926
+ * - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix2, Matrix3, Matrix4
3969
3927
  * - String colors: '#ff0000', 'red', 'rgb(255,0,0)' (auto-converted to Color)
3970
3928
  * - TSL nodes: color(), vec3(), float(), etc. (for type casting)
3971
3929
  * - UniformNode: existing uniforms (reused as-is)
3972
3930
  */
3973
- type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
3974
- /**
3975
- * Widen literal types to their base types:
3976
- * - 0 → number
3977
- * - true → boolean
3978
- * - '#ff0000' → Color (string colors are converted to Color objects)
3979
- * - Node → Node (TSL nodes passed through for uniform type casting)
3980
- */
3981
- type Widen<T> = T extends number ? number : T extends boolean ? boolean : T extends string ? Color$2 : T;
3982
- declare function useUniform<T extends UniformValue>(name: string): UniformNode<T>;
3983
- declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNode<Widen<T>>;
3931
+ type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
3932
+ declare function useUniform<T extends UniformValue = UniformValue>(name: string): UniformNodeFor<T>;
3933
+ declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNodeFor<T>;
3984
3934
 
3985
3935
  /**
3986
- * Minimal interface for TSL nodes. The definition lives with the store types as `NodeLike`, so
3987
- * the shape creators may return and the shape `state.nodes` holds are the same type by
3988
- * construction. See `NodeLike` for why this is structural rather than three's `Node`.
3936
+ * Every node representation a creator may return. The definition lives with the store types as
3937
+ * `NodeLike`, so the shape creators return and the shape `state.nodes` holds are one type by
3938
+ * construction: three's real `Node`, the callable proxy `Fn()` returns, or the legacy structural
3939
+ * `{ uuid, nodeType }` shape.
3989
3940
  */
3990
3941
  type TSLNodeLike = NodeLike;
3991
- /** TSL node type - alias for compatibility */
3942
+
3943
+ /** Backward-compatible alias covering every accepted node representation. */
3992
3944
  type TSLNode = TSLNodeLike;
3993
3945
  /**
3994
3946
  * Creator function that returns a record of nodes.
3995
- * Uses TSLNodeLike constraint to allow mixed node types
3996
- * (e.g., { n: OperatorNode; color: ConstNode<Color> }) to pass type checking.
3947
+ * Exact creator return inference is preserved within the compatible node constraint.
3997
3948
  */
3998
3949
  type NodeCreator<T extends Record<string, TSLNodeLike>> = (state: CreatorState) => T;
3999
3950
  /** Function signature for removeNodes util */
@@ -4003,15 +3954,17 @@ type ClearNodesFn = (scope?: string) => void;
4003
3954
  /** Function signature for rebuildNodes util */
4004
3955
  type RebuildNodesFn = (scope?: string) => void;
4005
3956
  /** Return type with utils included */
4006
- type NodesWithUtils<T extends Record<string, TSLNodeLike> = Record<string, TSLNodeLike>> = T & {
3957
+ type NodesWithUtils<T extends Record<string, unknown> = NodeRecord> = T & {
4007
3958
  removeNodes: RemoveNodesFn;
4008
3959
  clearNodes: ClearNodesFn;
4009
3960
  rebuildNodes: RebuildNodesFn;
4010
3961
  };
4011
- declare function useNodes(): NodesWithUtils<Record<string, TSLNodeLike> & Record<string, Record<string, TSLNodeLike>>>;
4012
- declare function useNodes(scope: string): NodesWithUtils<Record<string, TSLNodeLike>>;
4013
- declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCreator<T>): NodesWithUtils<T>;
4014
- declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
3962
+ declare function useNodes(): NodesWithUtils<NodeStore>;
3963
+ declare function useNodes(scope: string): NodesWithUtils<NodeRecord>;
3964
+ declare function useNodes<T extends NodeRecord>(scope?: string): NodesWithUtils<T>;
3965
+ declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>): NodesWithUtils<T>;
3966
+ declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
3967
+ declare function useNodes(creatorOrScope?: NodeCreator<NodeRecord> | string, scope?: string): NodesWithUtils<Record<string, unknown>>;
4015
3968
  /**
4016
3969
  * Global rebuildNodes function for HMR integration.
4017
3970
  * Invalidates cached nodes and increments _hmrVersion to trigger re-creation.
@@ -4070,6 +4023,10 @@ type LocalNodeCreator<T extends Record<string, unknown>> = (state: CreatorState)
4070
4023
  */
4071
4024
  declare function useLocalNodes<T extends Record<string, unknown>>(creator: LocalNodeCreator<T>): T;
4072
4025
 
4026
+ /**
4027
+ * A record of buffer-like values - allows mixed types (TypedArrays, BufferAttributes, TSL nodes)
4028
+ */
4029
+ type BufferRecordType<T extends BufferLike = BufferLike> = Record<string, T>;
4073
4030
  /**
4074
4031
  * Creator function that returns a record of buffers.
4075
4032
  * Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
@@ -4084,14 +4041,15 @@ type RebuildBuffersFn = (scope?: string) => void;
4084
4041
  /** Function signature for disposeBuffers util - releases GPU resources */
4085
4042
  type DisposeBuffersFn = (names: string | string[], scope?: string) => void;
4086
4043
  /** Return type with utils included */
4087
- type BuffersWithUtils<T extends Record<string, BufferLike> = Record<string, BufferLike>> = T & {
4044
+ type BuffersWithUtils<T extends BufferRecordType | BufferStore = BufferRecordType> = T & {
4088
4045
  removeBuffers: RemoveBuffersFn;
4089
4046
  clearBuffers: ClearBuffersFn;
4090
4047
  rebuildBuffers: RebuildBuffersFn;
4091
4048
  disposeBuffers: DisposeBuffersFn;
4092
4049
  };
4093
- declare function useBuffers(): BuffersWithUtils<Record<string, BufferLike> & Record<string, Record<string, BufferLike>>>;
4050
+ declare function useBuffers(): BuffersWithUtils<BufferStore>;
4094
4051
  declare function useBuffers(scope: string): BuffersWithUtils<Record<string, BufferLike>>;
4052
+ declare function useBuffers<T extends Record<string, BufferLike>>(scope?: string): BuffersWithUtils<T>;
4095
4053
  declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>): BuffersWithUtils<T>;
4096
4054
  declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
4097
4055
  /**
@@ -4107,6 +4065,10 @@ declare function useBuffers<T extends Record<string, BufferLike>>(creator: Buffe
4107
4065
  */
4108
4066
  declare function rebuildAllBuffers(store: ReturnType<typeof useStore>, scope?: string): void;
4109
4067
 
4068
+ /**
4069
+ * A record of storage-like values - allows mixed types (StorageTexture, Storage3DTexture, TSL nodes)
4070
+ */
4071
+ type StorageRecordType<T extends StorageLike = StorageLike> = Record<string, T>;
4110
4072
  /**
4111
4073
  * Creator function that returns a record of GPU storage objects.
4112
4074
  * Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
@@ -4121,14 +4083,15 @@ type RebuildStorageFn = (scope?: string) => void;
4121
4083
  /** Function signature for disposeStorage util - releases GPU resources */
4122
4084
  type DisposeStorageFn = (names: string | string[], scope?: string) => void;
4123
4085
  /** Return type with utils included */
4124
- type StorageWithUtils<T extends Record<string, StorageLike> = Record<string, StorageLike>> = T & {
4086
+ type StorageWithUtils<T extends StorageRecordType | StorageStore = StorageRecordType> = T & {
4125
4087
  removeStorage: RemoveStorageFn;
4126
4088
  clearStorage: ClearStorageFn;
4127
4089
  rebuildStorage: RebuildStorageFn;
4128
4090
  disposeStorage: DisposeStorageFn;
4129
4091
  };
4130
- declare function useGPUStorage(): StorageWithUtils<Record<string, StorageLike> & Record<string, Record<string, StorageLike>>>;
4092
+ declare function useGPUStorage(): StorageWithUtils<StorageStore>;
4131
4093
  declare function useGPUStorage(scope: string): StorageWithUtils<Record<string, StorageLike>>;
4094
+ declare function useGPUStorage<T extends Record<string, StorageLike>>(scope?: string): StorageWithUtils<T>;
4132
4095
  declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>): StorageWithUtils<T>;
4133
4096
  declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
4134
4097
  /**
@@ -4277,5 +4240,14 @@ type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOp
4277
4240
  declare const useThree: UseThreeWebGPU;
4278
4241
  declare const useFrame: UseFrameWebGPU;
4279
4242
 
4243
+ /** Canvas props on the WebGPU entry: `onCreated` receives `WebGPURootState`. */
4244
+ type WebGPUCanvasProps = Omit<CanvasProps, 'onCreated'> & {
4245
+ /** Callback after the canvas has rendered (but not yet committed); `state.renderer` is a `WebGPURenderer` */
4246
+ onCreated?: (state: WebGPURootState) => void;
4247
+ };
4248
+
4249
+ /** `Canvas` narrowed to WebGPU state — the same component, `onCreated` typed against `WebGPURootState`. */
4250
+ declare const Canvas: (props: WebGPUCanvasProps) => JSX.Element;
4251
+
4280
4252
  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 };
4281
- 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 };
4253
+ export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, WebGPUCanvasProps as CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, FromRefMarker, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeLike, NodeProps, NodeRecord, NodeStore, NodesWithUtils, NonFunctionKeys, Object3DMethod, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, OnceValue, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TSLNodeLike, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameWebGPU, UseTextureOptions, UseTexturesReturn, UseThreeWebGPU, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUCanvasProps, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };