@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.
- package/dist/index.cjs +35 -40
- package/dist/index.d.cts +155 -164
- package/dist/index.d.mts +155 -164
- package/dist/index.d.ts +155 -192
- package/dist/index.mjs +35 -40
- package/dist/legacy.cjs +37 -42
- package/dist/legacy.d.cts +159 -168
- package/dist/legacy.d.mts +159 -168
- package/dist/legacy.d.ts +159 -194
- package/dist/legacy.mjs +37 -42
- package/dist/webgpu/index.cjs +91 -97
- package/dist/webgpu/index.d.cts +214 -214
- package/dist/webgpu/index.d.mts +214 -214
- package/dist/webgpu/index.d.ts +214 -242
- package/dist/webgpu/index.mjs +91 -97
- package/package.json +1 -1
package/dist/webgpu/index.d.cts
CHANGED
|
@@ -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,
|
|
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';
|
|
@@ -354,6 +354,7 @@ type BufferLike =
|
|
|
354
354
|
| Uint16Array
|
|
355
355
|
| Int16Array
|
|
356
356
|
| THREE$1.BufferAttribute // Base class for all buffer attributes
|
|
357
|
+
| THREE$1.InterleavedBufferAttribute
|
|
357
358
|
| Node // TSL buffer nodes (instancedArray, storage)
|
|
358
359
|
|
|
359
360
|
/** Flat record of buffer-like values (no nested scopes) */
|
|
@@ -368,23 +369,15 @@ type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
|
368
369
|
//* Node Types (useNodes) ========================================
|
|
369
370
|
|
|
370
371
|
/**
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* would reject values `useNodes` creators legitimately return. This is the same shape
|
|
376
|
-
* `useNodes` already constrains creators to (`TSLNodeLike`).
|
|
372
|
+
* Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
|
|
373
|
+
* the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
|
|
374
|
+
* code passes through. Creators are constrained to this same type, so the shape a creator returns
|
|
375
|
+
* and the shape the store holds are one type by construction.
|
|
377
376
|
*/
|
|
378
|
-
|
|
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
|
-
}
|
|
377
|
+
type NodeLike = TSLNodeType | LegacyTSLNodeLike
|
|
385
378
|
|
|
386
379
|
/** Flat record of TSL nodes (no nested scopes) */
|
|
387
|
-
type NodeRecord = Record<string,
|
|
380
|
+
type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
|
|
388
381
|
|
|
389
382
|
/**
|
|
390
383
|
* Node store that can contain both root-level nodes and scoped node objects.
|
|
@@ -406,7 +399,9 @@ type NodeStore = Record<string, NodeLike | NodeRecord>
|
|
|
406
399
|
* ```
|
|
407
400
|
*/
|
|
408
401
|
type StorageLike =
|
|
409
|
-
| StorageTexture // GPU storage texture
|
|
402
|
+
| StorageTexture // 2D GPU storage texture
|
|
403
|
+
| Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
|
|
404
|
+
| StorageArrayTexture // 2D-array GPU storage texture
|
|
410
405
|
| Data3DTexture // 3D texture (can be used as storage)
|
|
411
406
|
| Node // TSL storage texture nodes (storageTexture)
|
|
412
407
|
|
|
@@ -855,14 +850,17 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
855
850
|
performance?: Partial<Omit<Performance, 'regress'>>
|
|
856
851
|
/** Target pixel ratio. Can clamp between a range: `[min, max]` */
|
|
857
852
|
dpr?: Dpr
|
|
858
|
-
/**
|
|
859
|
-
|
|
853
|
+
/**
|
|
854
|
+
* Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
|
|
855
|
+
* so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
|
|
856
|
+
*/
|
|
857
|
+
raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
|
|
860
858
|
/** A `THREE.Scene` instance or props that go into the default scene */
|
|
861
859
|
scene?: THREE$1.Scene | Partial<THREE$1.Scene>
|
|
862
860
|
/** A `THREE.Camera` instance or props that go into the default camera */
|
|
863
861
|
camera?: CameraProps
|
|
864
862
|
/** An R3F event manager to manage elements' pointer events */
|
|
865
|
-
events?: (store: RootStore) => EventManager<
|
|
863
|
+
events?: (store: RootStore) => EventManager<Element>
|
|
866
864
|
/** Callback after the canvas has rendered (but not yet committed) */
|
|
867
865
|
onCreated?: (state: RootState) => void
|
|
868
866
|
/** Response for pointer clicks that have missed any target */
|
|
@@ -1091,7 +1089,7 @@ interface CanvasProps
|
|
|
1091
1089
|
*/
|
|
1092
1090
|
resize?: Options
|
|
1093
1091
|
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
1094
|
-
eventSource?:
|
|
1092
|
+
eventSource?: Element | React$1.RefObject<Element | null>
|
|
1095
1093
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
1096
1094
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
|
|
1097
1095
|
/** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
|
|
@@ -1199,107 +1197,86 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
|
|
|
1199
1197
|
|
|
1200
1198
|
type RenderTargetOptions = RenderTargetOptions$1
|
|
1201
1199
|
|
|
1202
|
-
//* Global Types ==============================
|
|
1200
|
+
//* Global TSL Types ==============================
|
|
1203
1201
|
|
|
1204
1202
|
declare global {
|
|
1205
1203
|
/**
|
|
1206
|
-
*
|
|
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.
|
|
1204
|
+
* Broad callable-node fallback for dynamic store readers.
|
|
1205
|
+
* Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
|
|
1218
1206
|
*/
|
|
1219
|
-
type
|
|
1207
|
+
type CallableTSLNode = ((...params: never[]) => unknown) & {
|
|
1208
|
+
readonly shaderNode: unknown
|
|
1209
|
+
readonly id: number
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
/** Legacy structural node accepted when at least one historical marker exists. */
|
|
1213
|
+
type LegacyTSLNodeLike = {
|
|
1214
|
+
label?: ((label: string) => unknown) | string
|
|
1215
|
+
setName?: (name: string) => unknown
|
|
1216
|
+
} & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
|
|
1217
|
+
|
|
1218
|
+
/** Node type accepted by broad dynamic node-store readers. */
|
|
1219
|
+
type TSLNodeType = three_webgpu.Node | CallableTSLNode
|
|
1220
1220
|
|
|
1221
1221
|
/**
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1225
|
-
*
|
|
1222
|
+
* Derive Three's shader node type from an existing node or a supported raw input.
|
|
1223
|
+
* Existing InputNode generics take precedence over structural value normalization.
|
|
1224
|
+
* Both generics must be inferred because Three's UniformNode intersects an unknown-typed
|
|
1225
|
+
* InputNode base with its concrete InputNode specialization.
|
|
1226
1226
|
*/
|
|
1227
|
-
type
|
|
1228
|
-
?
|
|
1229
|
-
: T extends
|
|
1230
|
-
?
|
|
1231
|
-
: T extends
|
|
1232
|
-
? '
|
|
1233
|
-
: T extends
|
|
1234
|
-
? '
|
|
1235
|
-
: T extends three_webgpu.
|
|
1236
|
-
? '
|
|
1237
|
-
: T extends three_webgpu.Vector4
|
|
1227
|
+
type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
|
|
1228
|
+
? TNodeType
|
|
1229
|
+
: T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
|
|
1230
|
+
? TNodeType
|
|
1231
|
+
: T extends number
|
|
1232
|
+
? 'float'
|
|
1233
|
+
: T extends boolean
|
|
1234
|
+
? 'bool'
|
|
1235
|
+
: T extends string | three_webgpu.Color | { r: number; g: number; b: number }
|
|
1236
|
+
? 'color'
|
|
1237
|
+
: T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
|
|
1238
1238
|
? 'vec4'
|
|
1239
|
-
: T extends three_webgpu.
|
|
1240
|
-
? '
|
|
1241
|
-
: T extends three_webgpu.
|
|
1242
|
-
? '
|
|
1239
|
+
: T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
|
|
1240
|
+
? 'vec3'
|
|
1241
|
+
: T extends three_webgpu.Vector2 | { x: number; y: number }
|
|
1242
|
+
? 'vec2'
|
|
1243
1243
|
: T extends three_webgpu.Matrix4
|
|
1244
1244
|
? 'mat4'
|
|
1245
|
-
:
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
type ShaderNodeRef<T extends Node = Node> = ShaderNodeObject<T>
|
|
1245
|
+
: T extends three_webgpu.Matrix3
|
|
1246
|
+
? 'mat3'
|
|
1247
|
+
: T extends three_webgpu.Matrix2
|
|
1248
|
+
? 'mat2'
|
|
1249
|
+
: unknown
|
|
1250
|
+
|
|
1251
|
+
/** Derive the normalized JavaScript value stored by a uniform node. */
|
|
1252
|
+
type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
|
|
1253
|
+
? TValue
|
|
1254
|
+
: T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
|
|
1255
|
+
? TValue
|
|
1256
|
+
: T extends string | { r: number; g: number; b: number }
|
|
1257
|
+
? three_webgpu.Color
|
|
1258
|
+
: T extends { x: number; y: number; z: number; w: number }
|
|
1259
|
+
? three_webgpu.Vector4
|
|
1260
|
+
: T extends { x: number; y: number; z: number }
|
|
1261
|
+
? three_webgpu.Vector3
|
|
1262
|
+
: T extends { x: number; y: number }
|
|
1263
|
+
? three_webgpu.Vector2
|
|
1264
|
+
: T extends number
|
|
1265
|
+
? number
|
|
1266
|
+
: T extends boolean
|
|
1267
|
+
? boolean
|
|
1268
|
+
: T
|
|
1269
|
+
|
|
1270
|
+
/** Three's exact UniformNode with shader and value generics derived from an input. */
|
|
1271
|
+
type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
|
|
1272
|
+
|
|
1273
|
+
/** Preserve every input key while mapping values to exact Three uniform nodes. */
|
|
1274
|
+
type UniformNodesFor<T extends UniformInputRecord> = {
|
|
1275
|
+
[K in keyof T]: UniformNodeFor<T[K]>
|
|
1276
|
+
}
|
|
1278
1277
|
|
|
1279
|
-
/**
|
|
1280
|
-
|
|
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>
|
|
1278
|
+
/** Backward-compatible single-parameter uniform alias. */
|
|
1279
|
+
type UniformNode<T = unknown> = UniformNodeFor<T>
|
|
1303
1280
|
|
|
1304
1281
|
/** Flat record of uniform nodes (no nested scopes) */
|
|
1305
1282
|
type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
|
|
@@ -1324,7 +1301,7 @@ declare global {
|
|
|
1324
1301
|
* Acceptable input values for useUniforms - raw values that get converted to UniformNodes
|
|
1325
1302
|
* Supports:
|
|
1326
1303
|
* - Primitives: number, string (color), boolean
|
|
1327
|
-
* - Three.js types: Color, Vector2/3/4,
|
|
1304
|
+
* - Three.js types: Color, Vector2/3/4, Matrix2/3/4
|
|
1328
1305
|
* - Plain objects: { x, y, z, w } converted to vectors
|
|
1329
1306
|
* - TSL nodes: color(), vec3(), float() for type casting
|
|
1330
1307
|
* - UniformNode: existing uniforms (reused as-is)
|
|
@@ -1337,56 +1314,20 @@ declare global {
|
|
|
1337
1314
|
| three_webgpu.Vector2
|
|
1338
1315
|
| three_webgpu.Vector3
|
|
1339
1316
|
| three_webgpu.Vector4
|
|
1317
|
+
| three_webgpu.Matrix2
|
|
1340
1318
|
| three_webgpu.Matrix3
|
|
1341
1319
|
| three_webgpu.Matrix4
|
|
1342
|
-
|
|
|
1343
|
-
|
|
|
1344
|
-
| { x: number; y
|
|
1320
|
+
| { x: number; y: number }
|
|
1321
|
+
| { x: number; y: number; z: number }
|
|
1322
|
+
| { x: number; y: number; z: number; w: number }
|
|
1345
1323
|
| { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
|
|
1346
|
-
| Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1324
|
+
| three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1347
1325
|
| UniformNode
|
|
1348
1326
|
|
|
1349
1327
|
/** Input record for useUniforms - accepts raw values or UniformNodes */
|
|
1350
1328
|
type UniformInputRecord = Record<string, UniformValue>
|
|
1351
1329
|
}
|
|
1352
1330
|
|
|
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
1331
|
declare global {
|
|
1391
1332
|
/**
|
|
1392
1333
|
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
@@ -1414,10 +1355,15 @@ declare global {
|
|
|
1414
1355
|
* any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
|
|
1415
1356
|
* `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
|
|
1416
1357
|
* site when you need a member, e.g. `passes.velocity as TextureNode`.
|
|
1358
|
+
*
|
|
1359
|
+
* The index signature admits `undefined` because a key may simply not be registered, and
|
|
1360
|
+
* because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
|
|
1361
|
+
* optional property whose type excludes `undefined` from the index signature is an error
|
|
1362
|
+
* (TS2411) for every consumer compiling these declarations.
|
|
1417
1363
|
*/
|
|
1418
1364
|
interface PassRecord {
|
|
1419
1365
|
scenePass?: ScenePassNode
|
|
1420
|
-
[key: string]: three_webgpu.Node
|
|
1366
|
+
[key: string]: three_webgpu.Node | undefined
|
|
1421
1367
|
}
|
|
1422
1368
|
|
|
1423
1369
|
/**
|
|
@@ -1564,10 +1510,11 @@ type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
|
|
|
1564
1510
|
|
|
1565
1511
|
/**
|
|
1566
1512
|
* For node material properties (colorNode, positionNode, etc.), accept broader types
|
|
1567
|
-
* since @types/three has broken inheritance for TSL node subclasses.
|
|
1513
|
+
* since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
|
|
1514
|
+
* `nodeType`, so this structural key test remains neutral to the selected Three entry.
|
|
1568
1515
|
*/
|
|
1569
1516
|
type NodeProps<P> = {
|
|
1570
|
-
[K in keyof P as P[K] extends
|
|
1517
|
+
[K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
|
|
1571
1518
|
}
|
|
1572
1519
|
|
|
1573
1520
|
interface ReactProps<P> {
|
|
@@ -1588,11 +1535,30 @@ type ThreeToJSXElements<T extends Record<string, any>> = {
|
|
|
1588
1535
|
[K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
|
|
1589
1536
|
}
|
|
1590
1537
|
|
|
1538
|
+
/** Method names of Object3D, excluded from the `primitive` element's typed props. */
|
|
1539
|
+
type Object3DMethod = NonNullable<
|
|
1540
|
+
{
|
|
1541
|
+
[K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
|
|
1542
|
+
}[keyof Object3D]
|
|
1543
|
+
>
|
|
1544
|
+
|
|
1591
1545
|
type ThreeExports = typeof THREE
|
|
1592
1546
|
type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
|
|
1593
1547
|
|
|
1594
1548
|
interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
|
|
1595
|
-
|
|
1549
|
+
/**
|
|
1550
|
+
* `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
|
|
1551
|
+
* Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
|
|
1552
|
+
* untyped, and any other prop is accepted and applied to the object by name. Object3D's own
|
|
1553
|
+
* methods are left out of the typed surface: they return `this`, so a subclass element's
|
|
1554
|
+
* props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
|
|
1555
|
+
*/
|
|
1556
|
+
primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | 'onUpdate' | Object3DMethod> & {
|
|
1557
|
+
object: object
|
|
1558
|
+
ref?: React.Ref<any>
|
|
1559
|
+
onUpdate?: (self: any) => void
|
|
1560
|
+
[prop: string]: unknown
|
|
1561
|
+
}
|
|
1596
1562
|
// Conflicts with DOM types can be accessed through a three* prefix
|
|
1597
1563
|
threeAudio: ThreeElementsImpl['audio']
|
|
1598
1564
|
threeSource: ThreeElementsImpl['source']
|
|
@@ -1633,6 +1599,7 @@ type three_d_Matrix3 = Matrix3;
|
|
|
1633
1599
|
type three_d_Matrix4 = Matrix4;
|
|
1634
1600
|
type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
|
|
1635
1601
|
type three_d_NodeProps<P> = NodeProps<P>;
|
|
1602
|
+
type three_d_Object3DMethod = Object3DMethod;
|
|
1636
1603
|
type three_d_Quaternion = Quaternion;
|
|
1637
1604
|
type three_d_RaycastableRepresentation = RaycastableRepresentation;
|
|
1638
1605
|
type three_d_ReactProps<P> = ReactProps<P>;
|
|
@@ -1647,7 +1614,7 @@ type three_d_Vector3 = Vector3;
|
|
|
1647
1614
|
type three_d_Vector4 = Vector4;
|
|
1648
1615
|
type three_d_VectorRepresentation = VectorRepresentation;
|
|
1649
1616
|
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 };
|
|
1617
|
+
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
1618
|
}
|
|
1652
1619
|
|
|
1653
1620
|
/**
|
|
@@ -1996,7 +1963,7 @@ declare function createEvents(store: RootStore): {
|
|
|
1996
1963
|
processDeferredPointer: (event: DomEvent, pointerId: number) => void;
|
|
1997
1964
|
};
|
|
1998
1965
|
/** Default R3F event manager for web */
|
|
1999
|
-
declare function createPointerEvents(store: RootStore): EventManager<
|
|
1966
|
+
declare function createPointerEvents(store: RootStore): EventManager<Element>;
|
|
2000
1967
|
|
|
2001
1968
|
/**
|
|
2002
1969
|
* Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
|
|
@@ -3344,6 +3311,7 @@ declare namespace ReactReconciler {
|
|
|
3344
3311
|
|
|
3345
3312
|
declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
|
|
3346
3313
|
declare function extend<T extends Catalogue>(objects: T): void;
|
|
3314
|
+
declare function extend(objects: Record<string, unknown>): void;
|
|
3347
3315
|
declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
|
|
3348
3316
|
|
|
3349
3317
|
declare const isRenderer: (def: any) => boolean;
|
|
@@ -3787,29 +3755,44 @@ declare const hasConstructor: (object: unknown) => object is {
|
|
|
3787
3755
|
* Used to identify values that should be resolved from refs after mount.
|
|
3788
3756
|
*/
|
|
3789
3757
|
declare const FROM_REF: unique symbol;
|
|
3758
|
+
/** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
|
|
3759
|
+
interface FromRefMarker<T = unknown, R = T> {
|
|
3760
|
+
[FROM_REF]: React$1.RefObject<T | null>;
|
|
3761
|
+
/** Optional transform applied to the resolved ref before assignment. */
|
|
3762
|
+
transform?: (value: T) => R;
|
|
3763
|
+
}
|
|
3790
3764
|
/**
|
|
3791
3765
|
* Defers prop application until the referenced object is available.
|
|
3792
3766
|
* Useful for props like `target` that need sibling refs to be populated.
|
|
3793
3767
|
*
|
|
3768
|
+
* Only top-level props on a three element are resolved: a marker nested inside another value
|
|
3769
|
+
* (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
|
|
3770
|
+
* than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
|
|
3771
|
+
* what gets assigned.
|
|
3772
|
+
*
|
|
3794
3773
|
* @param ref - React ref object to resolve at mount time
|
|
3795
|
-
* @
|
|
3774
|
+
* @param transform - Optional mapping from the resolved object to the value the prop expects
|
|
3775
|
+
* @returns A marker value that the reconciler resolves after mount
|
|
3796
3776
|
*
|
|
3797
3777
|
* @example
|
|
3798
3778
|
* const targetRef = useRef<THREE.Object3D>(null)
|
|
3799
3779
|
*
|
|
3800
3780
|
* <group ref={targetRef} position={[-3, -2, -15]} />
|
|
3801
3781
|
* <spotLight target={fromRef(targetRef)} intensity={100} />
|
|
3782
|
+
*
|
|
3783
|
+
* @example
|
|
3784
|
+
* // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
|
|
3785
|
+
* <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
|
|
3802
3786
|
*/
|
|
3803
3787
|
declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
|
|
3788
|
+
declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
|
|
3804
3789
|
/**
|
|
3805
3790
|
* Type guard to check if a value is a fromRef marker.
|
|
3806
3791
|
*
|
|
3807
3792
|
* @param value - Value to check
|
|
3808
3793
|
* @returns True if value is a fromRef marker
|
|
3809
3794
|
*/
|
|
3810
|
-
declare function isFromRef(value: unknown): value is
|
|
3811
|
-
[FROM_REF]: React$1.RefObject<any>;
|
|
3812
|
-
};
|
|
3795
|
+
declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
|
|
3813
3796
|
|
|
3814
3797
|
/**
|
|
3815
3798
|
* Symbol marker for mount-only method calls.
|
|
@@ -3836,7 +3819,15 @@ declare const ONCE: unique symbol;
|
|
|
3836
3819
|
* // No arguments
|
|
3837
3820
|
* <geometry center={once()} />
|
|
3838
3821
|
*/
|
|
3839
|
-
declare function once<
|
|
3822
|
+
declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
|
|
3823
|
+
/**
|
|
3824
|
+
* What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
|
|
3825
|
+
* the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
|
|
3826
|
+
* methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
|
|
3827
|
+
*
|
|
3828
|
+
* The runtime value is always the marker object; only the declared type follows the prop.
|
|
3829
|
+
*/
|
|
3830
|
+
type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
|
|
3840
3831
|
/**
|
|
3841
3832
|
* Type guard to check if a value is a once marker.
|
|
3842
3833
|
*
|
|
@@ -3847,11 +3838,8 @@ declare function isOnce(value: unknown): value is {
|
|
|
3847
3838
|
[ONCE]: any[] | true;
|
|
3848
3839
|
};
|
|
3849
3840
|
|
|
3850
|
-
/**
|
|
3851
|
-
|
|
3852
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
3853
|
-
*/
|
|
3854
|
-
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3841
|
+
/** Distinguishes a resource leaf from a nested resource scope. */
|
|
3842
|
+
type ResourceLeafGuard<T> = (value: unknown) => value is T;
|
|
3855
3843
|
|
|
3856
3844
|
/**
|
|
3857
3845
|
* ScopedStore - Type-safe wrapper for nested stores (uniforms, nodes)
|
|
@@ -3873,33 +3861,30 @@ declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
|
3873
3861
|
* ```
|
|
3874
3862
|
*/
|
|
3875
3863
|
|
|
3876
|
-
/** Keys reserved for methods (excluded from index signature) */
|
|
3877
|
-
type MethodKeys = 'scope' | 'has' | 'keys';
|
|
3878
3864
|
/**
|
|
3879
3865
|
* Type-safe wrapper interface for accessing nested store data.
|
|
3880
3866
|
* Property access returns `T` (assumes leaf node).
|
|
3881
3867
|
* Use `.scope(key)` for nested object access.
|
|
3882
3868
|
*
|
|
3883
|
-
* Uses mapped type with key filtering to exclude method names from index signature,
|
|
3884
|
-
* allowing methods to have their correct return types.
|
|
3885
3869
|
*/
|
|
3886
|
-
type
|
|
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
|
-
} & {
|
|
3870
|
+
type ScopedStoreMethods<TLeaf> = {
|
|
3890
3871
|
/** Access a nested scope by key. Returns empty wrapper if scope doesn't exist. */
|
|
3891
|
-
scope(key: string): ScopedStoreType<
|
|
3872
|
+
scope<TScope extends Record<string, TLeaf> = Record<string, TLeaf>>(key: string): ScopedStoreType<TLeaf, TScope>;
|
|
3892
3873
|
/** Check if a key exists in the store */
|
|
3893
3874
|
has(key: string): boolean;
|
|
3894
3875
|
/** Get all keys in the store */
|
|
3895
3876
|
keys(): string[];
|
|
3896
3877
|
};
|
|
3878
|
+
type ScopedStoreType<TLeaf, TEntries extends Record<string, TLeaf> = Record<string, TLeaf>> = Readonly<TEntries> & ScopedStoreMethods<TLeaf>;
|
|
3879
|
+
interface ScopedStoreData<TLeaf> {
|
|
3880
|
+
[key: string]: TLeaf | ScopedStoreData<TLeaf>;
|
|
3881
|
+
}
|
|
3897
3882
|
/**
|
|
3898
3883
|
* Create a type-safe ScopedStore wrapper around store data.
|
|
3899
3884
|
* @param data - The raw store data (uniforms or nodes from RootState)
|
|
3900
3885
|
* @returns A ScopedStoreType wrapper with type-safe access
|
|
3901
3886
|
*/
|
|
3902
|
-
declare function createScopedStore<
|
|
3887
|
+
declare function createScopedStore<TLeaf>(data: ScopedStoreData<TLeaf>, isLeaf: ResourceLeafGuard<TLeaf>): ScopedStoreType<TLeaf>;
|
|
3903
3888
|
/**
|
|
3904
3889
|
* State type passed to creator functions with ScopedStore wrappers.
|
|
3905
3890
|
* Provides type-safe access to uniforms, nodes, buffers, and gpuStorage without manual casting.
|
|
@@ -3907,8 +3892,8 @@ declare function createScopedStore<T>(data: Record<string, any>): ScopedStoreTyp
|
|
|
3907
3892
|
type CreatorState = Omit<RootState, 'uniforms' | 'nodes' | 'buffers' | 'gpuStorage'> & {
|
|
3908
3893
|
/** Type-safe uniform access - property access returns UniformNode */
|
|
3909
3894
|
uniforms: ScopedStoreType<UniformNode>;
|
|
3910
|
-
/** Type-safe node access
|
|
3911
|
-
nodes: ScopedStoreType<
|
|
3895
|
+
/** Type-safe node access for real, callable, and legacy structural nodes */
|
|
3896
|
+
nodes: ScopedStoreType<NodeLike>;
|
|
3912
3897
|
/** Type-safe buffer access - property access returns BufferLike (TypedArrays, BufferAttributes, TSL nodes) */
|
|
3913
3898
|
buffers: ScopedStoreType<BufferLike>;
|
|
3914
3899
|
/** Type-safe GPU storage access - property access returns StorageLike (StorageTexture, TSL nodes) */
|
|
@@ -3924,17 +3909,18 @@ type ClearUniformsFn = (scope?: string) => void;
|
|
|
3924
3909
|
/** Function signature for rebuildUniforms util */
|
|
3925
3910
|
type RebuildUniformsFn = (scope?: string) => void;
|
|
3926
3911
|
/** Return type with utils included */
|
|
3927
|
-
type UniformsWithUtils<T extends UniformRecord = UniformRecord> = T & {
|
|
3912
|
+
type UniformsWithUtils<T extends UniformRecord | UniformStore = UniformRecord> = T & {
|
|
3928
3913
|
removeUniforms: RemoveUniformsFn;
|
|
3929
3914
|
clearUniforms: ClearUniformsFn;
|
|
3930
3915
|
rebuildUniforms: RebuildUniformsFn;
|
|
3931
3916
|
};
|
|
3932
|
-
declare function useUniforms(): UniformsWithUtils<
|
|
3917
|
+
declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3918
|
+
declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3919
|
+
declare function useUniforms<T extends UniformInputRecord>(uniforms: T): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3920
|
+
declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3921
|
+
declare function useUniforms(): UniformsWithUtils<UniformStore>;
|
|
3933
3922
|
declare function useUniforms(scope: string): UniformsWithUtils;
|
|
3934
|
-
declare function useUniforms<T extends UniformInputRecord>(
|
|
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>>;
|
|
3923
|
+
declare function useUniforms<T extends UniformInputRecord>(scope?: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3938
3924
|
/**
|
|
3939
3925
|
* Global rebuildUniforms function for HMR integration.
|
|
3940
3926
|
* Invalidates cached uniforms and increments _hmrVersion to trigger re-creation.
|
|
@@ -3965,35 +3951,28 @@ declare function clearRootUniforms(set: ReturnType<typeof useStore>['setState'])
|
|
|
3965
3951
|
|
|
3966
3952
|
/**
|
|
3967
3953
|
* Supported uniform value types:
|
|
3968
|
-
* - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix3, Matrix4
|
|
3954
|
+
* - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix2, Matrix3, Matrix4
|
|
3969
3955
|
* - String colors: '#ff0000', 'red', 'rgb(255,0,0)' (auto-converted to Color)
|
|
3970
3956
|
* - TSL nodes: color(), vec3(), float(), etc. (for type casting)
|
|
3971
3957
|
* - UniformNode: existing uniforms (reused as-is)
|
|
3972
3958
|
*/
|
|
3973
|
-
type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
|
|
3974
|
-
|
|
3975
|
-
|
|
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>>;
|
|
3959
|
+
type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
|
|
3960
|
+
declare function useUniform<T extends UniformValue = UniformValue>(name: string): UniformNodeFor<T>;
|
|
3961
|
+
declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNodeFor<T>;
|
|
3984
3962
|
|
|
3985
3963
|
/**
|
|
3986
|
-
*
|
|
3987
|
-
* the shape creators
|
|
3988
|
-
* construction
|
|
3964
|
+
* Every node representation a creator may return. The definition lives with the store types as
|
|
3965
|
+
* `NodeLike`, so the shape creators return and the shape `state.nodes` holds are one type by
|
|
3966
|
+
* construction: three's real `Node`, the callable proxy `Fn()` returns, or the legacy structural
|
|
3967
|
+
* `{ uuid, nodeType }` shape.
|
|
3989
3968
|
*/
|
|
3990
3969
|
type TSLNodeLike = NodeLike;
|
|
3991
|
-
|
|
3970
|
+
|
|
3971
|
+
/** Backward-compatible alias covering every accepted node representation. */
|
|
3992
3972
|
type TSLNode = TSLNodeLike;
|
|
3993
3973
|
/**
|
|
3994
3974
|
* Creator function that returns a record of nodes.
|
|
3995
|
-
*
|
|
3996
|
-
* (e.g., { n: OperatorNode; color: ConstNode<Color> }) to pass type checking.
|
|
3975
|
+
* Exact creator return inference is preserved within the compatible node constraint.
|
|
3997
3976
|
*/
|
|
3998
3977
|
type NodeCreator<T extends Record<string, TSLNodeLike>> = (state: CreatorState) => T;
|
|
3999
3978
|
/** Function signature for removeNodes util */
|
|
@@ -4003,15 +3982,17 @@ type ClearNodesFn = (scope?: string) => void;
|
|
|
4003
3982
|
/** Function signature for rebuildNodes util */
|
|
4004
3983
|
type RebuildNodesFn = (scope?: string) => void;
|
|
4005
3984
|
/** Return type with utils included */
|
|
4006
|
-
type NodesWithUtils<T extends Record<string,
|
|
3985
|
+
type NodesWithUtils<T extends Record<string, unknown> = NodeRecord> = T & {
|
|
4007
3986
|
removeNodes: RemoveNodesFn;
|
|
4008
3987
|
clearNodes: ClearNodesFn;
|
|
4009
3988
|
rebuildNodes: RebuildNodesFn;
|
|
4010
3989
|
};
|
|
4011
|
-
declare function useNodes(): NodesWithUtils<
|
|
4012
|
-
declare function useNodes(scope: string): NodesWithUtils<
|
|
4013
|
-
declare function useNodes<T extends
|
|
4014
|
-
declare function useNodes<T extends
|
|
3990
|
+
declare function useNodes(): NodesWithUtils<NodeStore>;
|
|
3991
|
+
declare function useNodes(scope: string): NodesWithUtils<NodeRecord>;
|
|
3992
|
+
declare function useNodes<T extends NodeRecord>(scope?: string): NodesWithUtils<T>;
|
|
3993
|
+
declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>): NodesWithUtils<T>;
|
|
3994
|
+
declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
|
|
3995
|
+
declare function useNodes(creatorOrScope?: NodeCreator<NodeRecord> | string, scope?: string): NodesWithUtils<Record<string, unknown>>;
|
|
4015
3996
|
/**
|
|
4016
3997
|
* Global rebuildNodes function for HMR integration.
|
|
4017
3998
|
* Invalidates cached nodes and increments _hmrVersion to trigger re-creation.
|
|
@@ -4070,6 +4051,10 @@ type LocalNodeCreator<T extends Record<string, unknown>> = (state: CreatorState)
|
|
|
4070
4051
|
*/
|
|
4071
4052
|
declare function useLocalNodes<T extends Record<string, unknown>>(creator: LocalNodeCreator<T>): T;
|
|
4072
4053
|
|
|
4054
|
+
/**
|
|
4055
|
+
* A record of buffer-like values - allows mixed types (TypedArrays, BufferAttributes, TSL nodes)
|
|
4056
|
+
*/
|
|
4057
|
+
type BufferRecordType<T extends BufferLike = BufferLike> = Record<string, T>;
|
|
4073
4058
|
/**
|
|
4074
4059
|
* Creator function that returns a record of buffers.
|
|
4075
4060
|
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
@@ -4084,14 +4069,15 @@ type RebuildBuffersFn = (scope?: string) => void;
|
|
|
4084
4069
|
/** Function signature for disposeBuffers util - releases GPU resources */
|
|
4085
4070
|
type DisposeBuffersFn = (names: string | string[], scope?: string) => void;
|
|
4086
4071
|
/** Return type with utils included */
|
|
4087
|
-
type BuffersWithUtils<T extends
|
|
4072
|
+
type BuffersWithUtils<T extends BufferRecordType | BufferStore = BufferRecordType> = T & {
|
|
4088
4073
|
removeBuffers: RemoveBuffersFn;
|
|
4089
4074
|
clearBuffers: ClearBuffersFn;
|
|
4090
4075
|
rebuildBuffers: RebuildBuffersFn;
|
|
4091
4076
|
disposeBuffers: DisposeBuffersFn;
|
|
4092
4077
|
};
|
|
4093
|
-
declare function useBuffers(): BuffersWithUtils<
|
|
4078
|
+
declare function useBuffers(): BuffersWithUtils<BufferStore>;
|
|
4094
4079
|
declare function useBuffers(scope: string): BuffersWithUtils<Record<string, BufferLike>>;
|
|
4080
|
+
declare function useBuffers<T extends Record<string, BufferLike>>(scope?: string): BuffersWithUtils<T>;
|
|
4095
4081
|
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>): BuffersWithUtils<T>;
|
|
4096
4082
|
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
|
|
4097
4083
|
/**
|
|
@@ -4107,6 +4093,10 @@ declare function useBuffers<T extends Record<string, BufferLike>>(creator: Buffe
|
|
|
4107
4093
|
*/
|
|
4108
4094
|
declare function rebuildAllBuffers(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4109
4095
|
|
|
4096
|
+
/**
|
|
4097
|
+
* A record of storage-like values - allows mixed types (StorageTexture, Storage3DTexture, TSL nodes)
|
|
4098
|
+
*/
|
|
4099
|
+
type StorageRecordType<T extends StorageLike = StorageLike> = Record<string, T>;
|
|
4110
4100
|
/**
|
|
4111
4101
|
* Creator function that returns a record of GPU storage objects.
|
|
4112
4102
|
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
@@ -4121,14 +4111,15 @@ type RebuildStorageFn = (scope?: string) => void;
|
|
|
4121
4111
|
/** Function signature for disposeStorage util - releases GPU resources */
|
|
4122
4112
|
type DisposeStorageFn = (names: string | string[], scope?: string) => void;
|
|
4123
4113
|
/** Return type with utils included */
|
|
4124
|
-
type StorageWithUtils<T extends
|
|
4114
|
+
type StorageWithUtils<T extends StorageRecordType | StorageStore = StorageRecordType> = T & {
|
|
4125
4115
|
removeStorage: RemoveStorageFn;
|
|
4126
4116
|
clearStorage: ClearStorageFn;
|
|
4127
4117
|
rebuildStorage: RebuildStorageFn;
|
|
4128
4118
|
disposeStorage: DisposeStorageFn;
|
|
4129
4119
|
};
|
|
4130
|
-
declare function useGPUStorage(): StorageWithUtils<
|
|
4120
|
+
declare function useGPUStorage(): StorageWithUtils<StorageStore>;
|
|
4131
4121
|
declare function useGPUStorage(scope: string): StorageWithUtils<Record<string, StorageLike>>;
|
|
4122
|
+
declare function useGPUStorage<T extends Record<string, StorageLike>>(scope?: string): StorageWithUtils<T>;
|
|
4132
4123
|
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>): StorageWithUtils<T>;
|
|
4133
4124
|
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
|
|
4134
4125
|
/**
|
|
@@ -4277,5 +4268,14 @@ type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOp
|
|
|
4277
4268
|
declare const useThree: UseThreeWebGPU;
|
|
4278
4269
|
declare const useFrame: UseFrameWebGPU;
|
|
4279
4270
|
|
|
4271
|
+
/** Canvas props on the WebGPU entry: `onCreated` receives `WebGPURootState`. */
|
|
4272
|
+
type WebGPUCanvasProps = Omit<CanvasProps, 'onCreated'> & {
|
|
4273
|
+
/** Callback after the canvas has rendered (but not yet committed); `state.renderer` is a `WebGPURenderer` */
|
|
4274
|
+
onCreated?: (state: WebGPURootState) => void;
|
|
4275
|
+
};
|
|
4276
|
+
|
|
4277
|
+
/** `Canvas` narrowed to WebGPU state — the same component, `onCreated` typed against `WebGPURootState`. */
|
|
4278
|
+
declare const Canvas: (props: WebGPUCanvasProps) => JSX.Element;
|
|
4279
|
+
|
|
4280
4280
|
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 };
|
|
4281
|
+
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 };
|