@react-three/fiber 10.0.0-canary.e881a4a → 10.0.0-canary.ea31ccd
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 +2050 -1856
- package/dist/index.d.cts +310 -155
- package/dist/index.d.mts +310 -155
- package/dist/index.d.ts +308 -181
- package/dist/index.mjs +2052 -1858
- package/dist/legacy.cjs +2617 -2427
- package/dist/legacy.d.cts +313 -162
- package/dist/legacy.d.mts +313 -162
- package/dist/legacy.d.ts +311 -186
- package/dist/legacy.mjs +2619 -2429
- package/dist/webgpu/index.cjs +2161 -1942
- package/dist/webgpu/index.d.cts +390 -266
- package/dist/webgpu/index.d.mts +390 -266
- package/dist/webgpu/index.d.ts +388 -292
- package/dist/webgpu/index.mjs +2001 -1782
- package/package.json +4 -4
- package/readme.md +1 -1
- package/react-reconciler/constants.d.ts +0 -7
- package/react-reconciler/constants.js +0 -1
- package/react-reconciler/index.d.ts +0 -1044
- package/react-reconciler/index.js +0 -208
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
|
|
1
2
|
import * as three_webgpu from 'three/webgpu';
|
|
2
|
-
import { 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 } from 'three/webgpu';
|
|
3
4
|
import * as THREE$1 from 'three';
|
|
4
5
|
import { WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
5
6
|
import { WebGLRendererParameters } from 'three/src/renderers/WebGLRenderer.js';
|
|
@@ -12,7 +13,6 @@ import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFr
|
|
|
12
13
|
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
13
14
|
import { Options } from 'react-use-measure';
|
|
14
15
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
15
|
-
import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
|
|
16
16
|
import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
|
|
17
17
|
|
|
18
18
|
function _mergeNamespaces(n, m) {
|
|
@@ -48,6 +48,9 @@ function _mergeNamespaces(n, m) {
|
|
|
48
48
|
declare const R3F_BUILD_LEGACY = true;
|
|
49
49
|
declare const R3F_BUILD_WEBGPU = true;
|
|
50
50
|
|
|
51
|
+
/** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
|
|
52
|
+
declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
|
|
53
|
+
|
|
51
54
|
var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
52
55
|
__proto__: null,
|
|
53
56
|
CubeRenderTarget: CubeRenderTarget,
|
|
@@ -59,7 +62,8 @@ var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
|
59
62
|
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
60
63
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
61
64
|
WebGLRenderer: WebGLRenderer,
|
|
62
|
-
WebGLRendererParameters: WebGLRendererParameters
|
|
65
|
+
WebGLRendererParameters: WebGLRendererParameters,
|
|
66
|
+
loadInspector: loadInspector
|
|
63
67
|
}, [three_webgpu]);
|
|
64
68
|
|
|
65
69
|
//* Utility Types ==============================
|
|
@@ -348,6 +352,7 @@ type BufferLike =
|
|
|
348
352
|
| Uint16Array
|
|
349
353
|
| Int16Array
|
|
350
354
|
| THREE$1.BufferAttribute // Base class for all buffer attributes
|
|
355
|
+
| THREE$1.InterleavedBufferAttribute
|
|
351
356
|
| Node // TSL buffer nodes (instancedArray, storage)
|
|
352
357
|
|
|
353
358
|
/** Flat record of buffer-like values (no nested scopes) */
|
|
@@ -359,6 +364,25 @@ type BufferRecord = Record<string, BufferLike>
|
|
|
359
364
|
*/
|
|
360
365
|
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
361
366
|
|
|
367
|
+
//* Node Types (useNodes) ========================================
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
|
|
371
|
+
* the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
|
|
372
|
+
* code passes through. Creators are constrained to this same type, so the shape a creator returns
|
|
373
|
+
* and the shape the store holds are one type by construction.
|
|
374
|
+
*/
|
|
375
|
+
type NodeLike = TSLNodeType | LegacyTSLNodeLike
|
|
376
|
+
|
|
377
|
+
/** Flat record of TSL nodes (no nested scopes) */
|
|
378
|
+
type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Node store that can contain both root-level nodes and scoped node objects.
|
|
382
|
+
* Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
|
|
383
|
+
*/
|
|
384
|
+
type NodeStore = Record<string, NodeLike | NodeRecord>
|
|
385
|
+
|
|
362
386
|
//* Storage Types (useGPUStorage) ========================================
|
|
363
387
|
|
|
364
388
|
/**
|
|
@@ -373,7 +397,9 @@ type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
|
373
397
|
* ```
|
|
374
398
|
*/
|
|
375
399
|
type StorageLike =
|
|
376
|
-
| StorageTexture // GPU storage texture
|
|
400
|
+
| StorageTexture // 2D GPU storage texture
|
|
401
|
+
| Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
|
|
402
|
+
| StorageArrayTexture // 2D-array GPU storage texture
|
|
377
403
|
| Data3DTexture // 3D texture (can be used as storage)
|
|
378
404
|
| Node // TSL storage texture nodes (storageTexture)
|
|
379
405
|
|
|
@@ -492,11 +518,28 @@ interface InternalState {
|
|
|
492
518
|
/** Container for child attachment (scene for root, original container for portals) */
|
|
493
519
|
container?: THREE$1.Object3D
|
|
494
520
|
/**
|
|
495
|
-
* CanvasTarget
|
|
496
|
-
*
|
|
521
|
+
* The CanvasTarget this root sizes and renders through.
|
|
522
|
+
*
|
|
523
|
+
* A primary (`<Canvas id>`) owns the renderer's default target -- the one three itself built
|
|
524
|
+
* around the canvas element -- so sizing it is sizing the renderer. A secondary owns a target
|
|
525
|
+
* R3F created for its own element. Either way there is exactly one target per canvas element,
|
|
526
|
+
* and the canvas-target job makes it the renderer's active one before this root renders.
|
|
527
|
+
* Absent on WebGL and on an id-less WebGPU canvas, where the renderer is sized directly.
|
|
497
528
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
498
529
|
*/
|
|
499
530
|
canvasTarget?: CanvasTarget
|
|
531
|
+
/**
|
|
532
|
+
* Set when this root's canvas target has been resized and the backend's cached render pass
|
|
533
|
+
* descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
|
|
534
|
+
*
|
|
535
|
+
* Flushed by the canvas-target job in the `start` phase, which is the only place this root's
|
|
536
|
+
* target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
|
|
537
|
+
* whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
|
|
538
|
+
* invalidate some other canvas's descriptor instead.
|
|
539
|
+
*
|
|
540
|
+
* @see https://github.com/pmndrs/react-three-fiber/issues/3847
|
|
541
|
+
*/
|
|
542
|
+
canvasTargetSizeDirty?: boolean
|
|
500
543
|
/**
|
|
501
544
|
* Whether multi-canvas rendering is active.
|
|
502
545
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -606,7 +649,7 @@ interface RootState {
|
|
|
606
649
|
/** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
|
|
607
650
|
uniforms: UniformStore
|
|
608
651
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
609
|
-
nodes:
|
|
652
|
+
nodes: NodeStore
|
|
610
653
|
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
611
654
|
buffers: BufferStore
|
|
612
655
|
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
@@ -618,7 +661,7 @@ interface RootState {
|
|
|
618
661
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
619
662
|
renderPipeline: ThreeRenderPipeline | null
|
|
620
663
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
621
|
-
passes:
|
|
664
|
+
passes: PassRecord
|
|
622
665
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
623
666
|
_hmrVersion: number
|
|
624
667
|
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
@@ -706,12 +749,19 @@ type DefaultRendererProps = {
|
|
|
706
749
|
*/
|
|
707
750
|
interface CanvasSchedulerConfig {
|
|
708
751
|
/**
|
|
709
|
-
*
|
|
710
|
-
* Pass the `id` of another canvas.
|
|
752
|
+
* Run this Canvas root before the referenced Canvas root id(s).
|
|
711
753
|
*/
|
|
712
|
-
|
|
754
|
+
before?: string | string[]
|
|
713
755
|
/**
|
|
714
|
-
*
|
|
756
|
+
* Run this Canvas root after the referenced Canvas root id(s).
|
|
757
|
+
*/
|
|
758
|
+
after?: string | string[]
|
|
759
|
+
/**
|
|
760
|
+
* Numeric root order. Lower values run first.
|
|
761
|
+
*/
|
|
762
|
+
order?: number
|
|
763
|
+
/**
|
|
764
|
+
* Limit this Canvas's default render job (frames per second).
|
|
715
765
|
*/
|
|
716
766
|
fps?: number
|
|
717
767
|
}
|
|
@@ -798,14 +848,17 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
798
848
|
performance?: Partial<Omit<Performance, 'regress'>>
|
|
799
849
|
/** Target pixel ratio. Can clamp between a range: `[min, max]` */
|
|
800
850
|
dpr?: Dpr
|
|
801
|
-
/**
|
|
802
|
-
|
|
851
|
+
/**
|
|
852
|
+
* Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
|
|
853
|
+
* so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
|
|
854
|
+
*/
|
|
855
|
+
raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
|
|
803
856
|
/** A `THREE.Scene` instance or props that go into the default scene */
|
|
804
857
|
scene?: THREE$1.Scene | Partial<THREE$1.Scene>
|
|
805
858
|
/** A `THREE.Camera` instance or props that go into the default camera */
|
|
806
859
|
camera?: CameraProps
|
|
807
860
|
/** An R3F event manager to manage elements' pointer events */
|
|
808
|
-
events?: (store: RootStore) => EventManager<
|
|
861
|
+
events?: (store: RootStore) => EventManager<Element>
|
|
809
862
|
/** Callback after the canvas has rendered (but not yet committed) */
|
|
810
863
|
onCreated?: (state: RootState) => void
|
|
811
864
|
/** Response for pointer clicks that have missed any target */
|
|
@@ -894,7 +947,6 @@ type InstanceProps<T = any, P = any> = ArgsProp<P> & {
|
|
|
894
947
|
object?: T
|
|
895
948
|
dispose?: null
|
|
896
949
|
attach?: AttachType<T>
|
|
897
|
-
onUpdate?: (self: T) => void
|
|
898
950
|
}
|
|
899
951
|
|
|
900
952
|
interface Instance<O = any> {
|
|
@@ -1034,7 +1086,7 @@ interface CanvasProps
|
|
|
1034
1086
|
*/
|
|
1035
1087
|
resize?: Options
|
|
1036
1088
|
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
1037
|
-
eventSource?:
|
|
1089
|
+
eventSource?: Element | React$1.RefObject<Element | null>
|
|
1038
1090
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
1039
1091
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
|
|
1040
1092
|
/** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
|
|
@@ -1142,81 +1194,86 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
|
|
|
1142
1194
|
|
|
1143
1195
|
type RenderTargetOptions = RenderTargetOptions$1
|
|
1144
1196
|
|
|
1145
|
-
//* Global Types ==============================
|
|
1197
|
+
//* Global TSL Types ==============================
|
|
1146
1198
|
|
|
1147
1199
|
declare global {
|
|
1148
1200
|
/**
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1151
|
-
* This is three's own `UniformNode`, not a re-declaration of it. It previously was a
|
|
1152
|
-
* hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
|
|
1153
|
-
* exported type globally — so R3F's ~58 references resolved to an approximation that was
|
|
1154
|
-
* missing members three actually ships (`setName` among them) and had drifted to the wrong
|
|
1155
|
-
* arity when three made `UniformNode` two-parameter.
|
|
1156
|
-
*
|
|
1157
|
-
* three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
|
|
1158
|
-
* so the node type is fixed to `unknown` and the single parameter is kept for call-site
|
|
1159
|
-
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1160
|
-
* installed three instead of needing to be mirrored by hand.
|
|
1201
|
+
* Broad callable-node fallback for dynamic store readers.
|
|
1202
|
+
* Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
|
|
1161
1203
|
*/
|
|
1162
|
-
type
|
|
1204
|
+
type CallableTSLNode = ((...params: never[]) => unknown) & {
|
|
1205
|
+
readonly shaderNode: unknown
|
|
1206
|
+
readonly id: number
|
|
1207
|
+
}
|
|
1163
1208
|
|
|
1164
|
-
/**
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
* @example
|
|
1170
|
-
* ```tsx
|
|
1171
|
-
* // Define a shader function
|
|
1172
|
-
* const blendColorFn = Fn(([color1, color2, factor]) => {
|
|
1173
|
-
* return mix(color1, color2, factor)
|
|
1174
|
-
* })
|
|
1175
|
-
*
|
|
1176
|
-
* // Type when retrieving from nodes store
|
|
1177
|
-
* const { blendColorFn } = nodes as { blendColorFn: ShaderCallable }
|
|
1178
|
-
*
|
|
1179
|
-
* // Or with specific return type
|
|
1180
|
-
* const { myFn } = nodes as { myFn: ShaderCallable<THREE.Node> }
|
|
1181
|
-
* ```
|
|
1182
|
-
*/
|
|
1183
|
-
type ShaderCallable<R extends Node = Node> = ((...params: unknown[]) => ShaderNodeObject<R>) & Node
|
|
1209
|
+
/** Legacy structural node accepted when at least one historical marker exists. */
|
|
1210
|
+
type LegacyTSLNodeLike = {
|
|
1211
|
+
label?: ((label: string) => unknown) | string
|
|
1212
|
+
setName?: (name: string) => unknown
|
|
1213
|
+
} & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
|
|
1184
1214
|
|
|
1185
|
-
/**
|
|
1186
|
-
|
|
1187
|
-
* This is the common return type for TSL operations (add, mul, sin, etc.)
|
|
1188
|
-
*
|
|
1189
|
-
* @example
|
|
1190
|
-
* ```tsx
|
|
1191
|
-
* const { wobble } = nodes as { wobble: ShaderNodeRef }
|
|
1192
|
-
* ```
|
|
1193
|
-
*/
|
|
1194
|
-
type ShaderNodeRef<T extends Node = Node> = ShaderNodeObject<T>
|
|
1215
|
+
/** Node type accepted by broad dynamic node-store readers. */
|
|
1216
|
+
type TSLNodeType = three_webgpu.Node | CallableTSLNode
|
|
1195
1217
|
|
|
1196
1218
|
/**
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
*
|
|
1201
|
-
* - Node: base Three.js node type
|
|
1202
|
-
* - ShaderCallable: function nodes created with Fn()
|
|
1203
|
-
* - ShaderNodeObject: wrapped nodes from TSL operations (sin, mul, mix, etc.)
|
|
1204
|
-
*
|
|
1205
|
-
* @example
|
|
1206
|
-
* ```tsx
|
|
1207
|
-
* // In useLocalNodes, nodes are typed as TSLNodeType
|
|
1208
|
-
* const { positionNode, blendColorFn } = useLocalNodes(({ nodes }) => ({
|
|
1209
|
-
* positionNode: nodes.myPosition, // Works - Node is in union
|
|
1210
|
-
* blendColorFn: nodes.myFn, // Works - ShaderCallable is in union
|
|
1211
|
-
* }))
|
|
1212
|
-
*
|
|
1213
|
-
* // Can narrow with type guard or assertion when needed
|
|
1214
|
-
* if (typeof blendColorFn === 'function') {
|
|
1215
|
-
* blendColorFn(someColor, 0.5)
|
|
1216
|
-
* }
|
|
1217
|
-
* ```
|
|
1219
|
+
* Derive Three's shader node type from an existing node or a supported raw input.
|
|
1220
|
+
* Existing InputNode generics take precedence over structural value normalization.
|
|
1221
|
+
* Both generics must be inferred because Three's UniformNode intersects an unknown-typed
|
|
1222
|
+
* InputNode base with its concrete InputNode specialization.
|
|
1218
1223
|
*/
|
|
1219
|
-
type
|
|
1224
|
+
type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
|
|
1225
|
+
? TNodeType
|
|
1226
|
+
: T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
|
|
1227
|
+
? TNodeType
|
|
1228
|
+
: T extends number
|
|
1229
|
+
? 'float'
|
|
1230
|
+
: T extends boolean
|
|
1231
|
+
? 'bool'
|
|
1232
|
+
: T extends string | three_webgpu.Color | { r: number; g: number; b: number }
|
|
1233
|
+
? 'color'
|
|
1234
|
+
: T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
|
|
1235
|
+
? 'vec4'
|
|
1236
|
+
: T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
|
|
1237
|
+
? 'vec3'
|
|
1238
|
+
: T extends three_webgpu.Vector2 | { x: number; y: number }
|
|
1239
|
+
? 'vec2'
|
|
1240
|
+
: T extends three_webgpu.Matrix4
|
|
1241
|
+
? 'mat4'
|
|
1242
|
+
: T extends three_webgpu.Matrix3
|
|
1243
|
+
? 'mat3'
|
|
1244
|
+
: T extends three_webgpu.Matrix2
|
|
1245
|
+
? 'mat2'
|
|
1246
|
+
: unknown
|
|
1247
|
+
|
|
1248
|
+
/** Derive the normalized JavaScript value stored by a uniform node. */
|
|
1249
|
+
type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
|
|
1250
|
+
? TValue
|
|
1251
|
+
: T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
|
|
1252
|
+
? TValue
|
|
1253
|
+
: T extends string | { r: number; g: number; b: number }
|
|
1254
|
+
? three_webgpu.Color
|
|
1255
|
+
: T extends { x: number; y: number; z: number; w: number }
|
|
1256
|
+
? three_webgpu.Vector4
|
|
1257
|
+
: T extends { x: number; y: number; z: number }
|
|
1258
|
+
? three_webgpu.Vector3
|
|
1259
|
+
: T extends { x: number; y: number }
|
|
1260
|
+
? three_webgpu.Vector2
|
|
1261
|
+
: T extends number
|
|
1262
|
+
? number
|
|
1263
|
+
: T extends boolean
|
|
1264
|
+
? boolean
|
|
1265
|
+
: T
|
|
1266
|
+
|
|
1267
|
+
/** Three's exact UniformNode with shader and value generics derived from an input. */
|
|
1268
|
+
type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
|
|
1269
|
+
|
|
1270
|
+
/** Preserve every input key while mapping values to exact Three uniform nodes. */
|
|
1271
|
+
type UniformNodesFor<T extends UniformInputRecord> = {
|
|
1272
|
+
[K in keyof T]: UniformNodeFor<T[K]>
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/** Backward-compatible single-parameter uniform alias. */
|
|
1276
|
+
type UniformNode<T = unknown> = UniformNodeFor<T>
|
|
1220
1277
|
|
|
1221
1278
|
/** Flat record of uniform nodes (no nested scopes) */
|
|
1222
1279
|
type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
|
|
@@ -1241,7 +1298,7 @@ declare global {
|
|
|
1241
1298
|
* Acceptable input values for useUniforms - raw values that get converted to UniformNodes
|
|
1242
1299
|
* Supports:
|
|
1243
1300
|
* - Primitives: number, string (color), boolean
|
|
1244
|
-
* - Three.js types: Color, Vector2/3/4,
|
|
1301
|
+
* - Three.js types: Color, Vector2/3/4, Matrix2/3/4
|
|
1245
1302
|
* - Plain objects: { x, y, z, w } converted to vectors
|
|
1246
1303
|
* - TSL nodes: color(), vec3(), float() for type casting
|
|
1247
1304
|
* - UniformNode: existing uniforms (reused as-is)
|
|
@@ -1254,88 +1311,124 @@ declare global {
|
|
|
1254
1311
|
| three_webgpu.Vector2
|
|
1255
1312
|
| three_webgpu.Vector3
|
|
1256
1313
|
| three_webgpu.Vector4
|
|
1314
|
+
| three_webgpu.Matrix2
|
|
1257
1315
|
| three_webgpu.Matrix3
|
|
1258
1316
|
| three_webgpu.Matrix4
|
|
1259
|
-
|
|
|
1260
|
-
|
|
|
1261
|
-
| { x: number; y
|
|
1317
|
+
| { x: number; y: number }
|
|
1318
|
+
| { x: number; y: number; z: number }
|
|
1319
|
+
| { x: number; y: number; z: number; w: number }
|
|
1262
1320
|
| { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
|
|
1263
|
-
| Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1321
|
+
| three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1264
1322
|
| UniformNode
|
|
1265
1323
|
|
|
1266
1324
|
/** Input record for useUniforms - accepts raw values or UniformNodes */
|
|
1267
1325
|
type UniformInputRecord = Record<string, UniformValue>
|
|
1268
1326
|
}
|
|
1269
1327
|
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
declare module 'three/tsl' {
|
|
1328
|
+
declare global {
|
|
1273
1329
|
/**
|
|
1274
|
-
*
|
|
1275
|
-
*
|
|
1330
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1331
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1332
|
+
* is r185, so the new name is the only one.
|
|
1276
1333
|
*/
|
|
1277
|
-
|
|
1278
|
-
jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
|
|
1279
|
-
): ShaderCallable<R>
|
|
1334
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1280
1335
|
|
|
1281
1336
|
/**
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
1337
|
+
* The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
|
|
1338
|
+
* `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
|
|
1339
|
+
* `getTextureNode`, `setMRT` and `dispose` track the installed version.
|
|
1284
1340
|
*/
|
|
1285
|
-
|
|
1286
|
-
jsFunc: (inputs: T) => ShaderNodeObject<R>,
|
|
1287
|
-
): ShaderCallable<R>
|
|
1341
|
+
type ScenePassNode = three_webgpu.PassNode
|
|
1288
1342
|
|
|
1289
1343
|
/**
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1344
|
+
* Pass record - stores TSL pass nodes for render pipeline.
|
|
1345
|
+
*
|
|
1346
|
+
* `scenePass` is the only key the library owns. It is optional here because this is also the
|
|
1347
|
+
* shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
|
|
1348
|
+
* or `clearPasses()`. Inside the callbacks it is always present; see
|
|
1349
|
+
* {@link RenderPipelineCallbackState}.
|
|
1350
|
+
*
|
|
1351
|
+
* Every other key is user-registered, via a callback's return value. Those are TSL nodes of
|
|
1352
|
+
* any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
|
|
1353
|
+
* `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
|
|
1354
|
+
* site when you need a member, e.g. `passes.velocity as TextureNode`.
|
|
1355
|
+
*
|
|
1356
|
+
* The index signature admits `undefined` because a key may simply not be registered, and
|
|
1357
|
+
* because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
|
|
1358
|
+
* optional property whose type excludes `undefined` from the index signature is an error
|
|
1359
|
+
* (TS2411) for every consumer compiling these declarations.
|
|
1292
1360
|
*/
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1361
|
+
interface PassRecord {
|
|
1362
|
+
scenePass?: ScenePassNode
|
|
1363
|
+
[key: string]: three_webgpu.Node | undefined
|
|
1364
|
+
}
|
|
1297
1365
|
|
|
1298
1366
|
/**
|
|
1299
|
-
*
|
|
1367
|
+
* State passed to pipeline callbacks after the active pipeline has been created.
|
|
1368
|
+
*
|
|
1369
|
+
* `passes.scenePass` is required here: the hook installs the default scene pass before either
|
|
1370
|
+
* callback runs, so callbacks can use it without a guard or a cast.
|
|
1371
|
+
*
|
|
1372
|
+
* `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
|
|
1373
|
+
* the legacy renderer before either callback can run, so a callback never sees WebGL.
|
|
1300
1374
|
*/
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1375
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1376
|
+
renderPipeline: ThreeRenderPipeline
|
|
1377
|
+
passes: PassRecord & { scenePass: ScenePassNode }
|
|
1378
|
+
renderer: three_webgpu.WebGPURenderer
|
|
1379
|
+
isLegacy: false
|
|
1380
|
+
}
|
|
1306
1381
|
|
|
1307
|
-
declare global {
|
|
1308
1382
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1311
|
-
* is
|
|
1383
|
+
* What a callback may return to register entries into `state.passes`.
|
|
1384
|
+
*
|
|
1385
|
+
* `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
|
|
1386
|
+
* created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
|
|
1387
|
+
* store entry would leave the store pointing at a node the hook never disposes, and the hook
|
|
1388
|
+
* disposing a pass nothing references. So returning it is a type error.
|
|
1312
1389
|
*/
|
|
1313
|
-
type
|
|
1314
|
-
|
|
1315
|
-
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1316
|
-
type PassRecord = Record<string, any>
|
|
1390
|
+
type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
|
|
1317
1391
|
|
|
1318
1392
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1319
|
-
type RenderPipelineSetupCallback = (state:
|
|
1393
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1320
1394
|
|
|
1321
1395
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1322
|
-
type RenderPipelineMainCallback = (state:
|
|
1396
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1323
1397
|
|
|
1324
|
-
/**
|
|
1325
|
-
interface
|
|
1398
|
+
/** The imperative half of useRenderPipeline's return value, present in every state */
|
|
1399
|
+
interface UseRenderPipelineActions {
|
|
1326
1400
|
/** Current passes from state */
|
|
1327
1401
|
passes: PassRecord
|
|
1328
|
-
/** RenderPipeline instance (null if not initialized) */
|
|
1329
|
-
renderPipeline: ThreeRenderPipeline | null
|
|
1330
1402
|
/** Clear all passes from state */
|
|
1331
1403
|
clearPasses: () => void
|
|
1332
1404
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1333
1405
|
reset: () => void
|
|
1334
1406
|
/** Re-run setup/main callbacks with current closure values */
|
|
1335
1407
|
rebuild: () => void
|
|
1336
|
-
/** True when RenderPipeline is configured and ready */
|
|
1337
|
-
isReady: boolean
|
|
1338
1408
|
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Return type for useRenderPipeline hook, discriminated on `isReady`.
|
|
1412
|
+
*
|
|
1413
|
+
* `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
|
|
1414
|
+
* callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
|
|
1415
|
+
* `clearPasses()` empties the record while leaving the pipeline in place.
|
|
1416
|
+
*/
|
|
1417
|
+
type UseRenderPipelineReturn = UseRenderPipelineActions &
|
|
1418
|
+
(
|
|
1419
|
+
| {
|
|
1420
|
+
/** True when RenderPipeline is configured and ready */
|
|
1421
|
+
isReady: true
|
|
1422
|
+
/** RenderPipeline instance */
|
|
1423
|
+
renderPipeline: ThreeRenderPipeline
|
|
1424
|
+
}
|
|
1425
|
+
| {
|
|
1426
|
+
/** False until the pipeline has been created */
|
|
1427
|
+
isReady: false
|
|
1428
|
+
/** Not initialized yet, or torn down by reset() */
|
|
1429
|
+
renderPipeline: null
|
|
1430
|
+
}
|
|
1431
|
+
)
|
|
1339
1432
|
}
|
|
1340
1433
|
|
|
1341
1434
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
@@ -1414,10 +1507,11 @@ type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
|
|
|
1414
1507
|
|
|
1415
1508
|
/**
|
|
1416
1509
|
* For node material properties (colorNode, positionNode, etc.), accept broader types
|
|
1417
|
-
* since @types/three has broken inheritance for TSL node subclasses.
|
|
1510
|
+
* since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
|
|
1511
|
+
* `nodeType`, so this structural key test remains neutral to the selected Three entry.
|
|
1418
1512
|
*/
|
|
1419
1513
|
type NodeProps<P> = {
|
|
1420
|
-
[K in keyof P as P[K] extends
|
|
1514
|
+
[K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
|
|
1421
1515
|
}
|
|
1422
1516
|
|
|
1423
1517
|
interface ReactProps<P> {
|
|
@@ -1438,11 +1532,29 @@ type ThreeToJSXElements<T extends Record<string, any>> = {
|
|
|
1438
1532
|
[K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
|
|
1439
1533
|
}
|
|
1440
1534
|
|
|
1535
|
+
/** Method names of Object3D, excluded from the `primitive` element's typed props. */
|
|
1536
|
+
type Object3DMethod = NonNullable<
|
|
1537
|
+
{
|
|
1538
|
+
[K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
|
|
1539
|
+
}[keyof Object3D]
|
|
1540
|
+
>
|
|
1541
|
+
|
|
1441
1542
|
type ThreeExports = typeof THREE
|
|
1442
1543
|
type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
|
|
1443
1544
|
|
|
1444
1545
|
interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
|
|
1445
|
-
|
|
1546
|
+
/**
|
|
1547
|
+
* `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
|
|
1548
|
+
* Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
|
|
1549
|
+
* untyped, and any other prop is accepted and applied to the object by name. Object3D's own
|
|
1550
|
+
* methods are left out of the typed surface: they return `this`, so a subclass element's
|
|
1551
|
+
* props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
|
|
1552
|
+
*/
|
|
1553
|
+
primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | Object3DMethod> & {
|
|
1554
|
+
object: object
|
|
1555
|
+
ref?: React.Ref<any>
|
|
1556
|
+
[prop: string]: unknown
|
|
1557
|
+
}
|
|
1446
1558
|
// Conflicts with DOM types can be accessed through a three* prefix
|
|
1447
1559
|
threeAudio: ThreeElementsImpl['audio']
|
|
1448
1560
|
threeSource: ThreeElementsImpl['source']
|
|
@@ -1483,6 +1595,7 @@ type three_d_Matrix3 = Matrix3;
|
|
|
1483
1595
|
type three_d_Matrix4 = Matrix4;
|
|
1484
1596
|
type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
|
|
1485
1597
|
type three_d_NodeProps<P> = NodeProps<P>;
|
|
1598
|
+
type three_d_Object3DMethod = Object3DMethod;
|
|
1486
1599
|
type three_d_Quaternion = Quaternion;
|
|
1487
1600
|
type three_d_RaycastableRepresentation = RaycastableRepresentation;
|
|
1488
1601
|
type three_d_ReactProps<P> = ReactProps<P>;
|
|
@@ -1497,7 +1610,7 @@ type three_d_Vector3 = Vector3;
|
|
|
1497
1610
|
type three_d_Vector4 = Vector4;
|
|
1498
1611
|
type three_d_VectorRepresentation = VectorRepresentation;
|
|
1499
1612
|
declare namespace three_d {
|
|
1500
|
-
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 };
|
|
1613
|
+
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 };
|
|
1501
1614
|
}
|
|
1502
1615
|
|
|
1503
1616
|
/**
|
|
@@ -1635,9 +1748,9 @@ type EnvironmentProps = {
|
|
|
1635
1748
|
blur?: number;
|
|
1636
1749
|
backgroundBlurriness?: number;
|
|
1637
1750
|
backgroundIntensity?: number;
|
|
1638
|
-
backgroundRotation?: Euler
|
|
1751
|
+
backgroundRotation?: Euler;
|
|
1639
1752
|
environmentIntensity?: number;
|
|
1640
|
-
environmentRotation?: Euler
|
|
1753
|
+
environmentRotation?: Euler;
|
|
1641
1754
|
map?: Texture$1;
|
|
1642
1755
|
preset?: PresetsType;
|
|
1643
1756
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -1721,7 +1834,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
1721
1834
|
declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
1722
1835
|
declare module '@react-three/fiber' {
|
|
1723
1836
|
interface ThreeElements {
|
|
1724
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1837
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
1725
1838
|
}
|
|
1726
1839
|
}
|
|
1727
1840
|
/**
|
|
@@ -1821,6 +1934,24 @@ declare module '@react-three/fiber' {
|
|
|
1821
1934
|
*/
|
|
1822
1935
|
declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
1823
1936
|
|
|
1937
|
+
/**
|
|
1938
|
+
* Moves every trace of interactivity from one object to its replacement, for reconstruction.
|
|
1939
|
+
*
|
|
1940
|
+
* When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
|
|
1941
|
+
* instance. Removing the old object from the interaction state and registering the new one from
|
|
1942
|
+
* scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
|
|
1943
|
+
* the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
|
|
1944
|
+
* is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
|
|
1945
|
+
* swap the user never asked to see (#3744).
|
|
1946
|
+
*
|
|
1947
|
+
* Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
|
|
1948
|
+
* left alone — releasing and re-acquiring it is precisely the glitch being avoided.
|
|
1949
|
+
*
|
|
1950
|
+
* Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
|
|
1951
|
+
* the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
|
|
1952
|
+
* cannot outlive the object it described.
|
|
1953
|
+
*/
|
|
1954
|
+
declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
|
|
1824
1955
|
declare function removeInteractivity(store: RootStore, object: Object3D): void;
|
|
1825
1956
|
declare function createEvents(store: RootStore): {
|
|
1826
1957
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
@@ -1828,7 +1959,7 @@ declare function createEvents(store: RootStore): {
|
|
|
1828
1959
|
processDeferredPointer: (event: DomEvent, pointerId: number) => void;
|
|
1829
1960
|
};
|
|
1830
1961
|
/** Default R3F event manager for web */
|
|
1831
|
-
declare function createPointerEvents(store: RootStore): EventManager<
|
|
1962
|
+
declare function createPointerEvents(store: RootStore): EventManager<Element>;
|
|
1832
1963
|
|
|
1833
1964
|
/**
|
|
1834
1965
|
* Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
|
|
@@ -1861,7 +1992,7 @@ declare namespace useLoader {
|
|
|
1861
1992
|
*
|
|
1862
1993
|
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1863
1994
|
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1864
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1995
|
+
* @returns Controls object with step(), stepAll(), invalidate(), pause(), resume(), isPaused, id, rootId, scheduler
|
|
1865
1996
|
*
|
|
1866
1997
|
* @example
|
|
1867
1998
|
* // Simple priority (backwards compat)
|
|
@@ -2157,7 +2288,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2157
2288
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2158
2289
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2159
2290
|
*
|
|
2160
|
-
*
|
|
2291
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2292
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2293
|
+
*
|
|
2294
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2161
2295
|
* @param frames - Number of frames to request (default: 1)
|
|
2162
2296
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2163
2297
|
*
|
|
@@ -2168,14 +2302,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2168
2302
|
* Advances the frameloop and runs render effects.
|
|
2169
2303
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2170
2304
|
*
|
|
2305
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2306
|
+
* registered root is stepped for backwards compatibility.
|
|
2307
|
+
*
|
|
2171
2308
|
* @param timestamp - The timestamp to use for this frame
|
|
2172
2309
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2173
|
-
* @param state -
|
|
2174
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2310
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2175
2311
|
*
|
|
2176
2312
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2177
2313
|
*/
|
|
2178
|
-
declare function advance(timestamp: number): void;
|
|
2314
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2179
2315
|
|
|
2180
2316
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2181
2317
|
declare function ReactReconciler<
|
|
@@ -3220,6 +3356,7 @@ declare namespace ReactReconciler {
|
|
|
3220
3356
|
|
|
3221
3357
|
declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
|
|
3222
3358
|
declare function extend<T extends Catalogue>(objects: T): void;
|
|
3359
|
+
declare function extend(objects: Record<string, unknown>): void;
|
|
3223
3360
|
declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
|
|
3224
3361
|
|
|
3225
3362
|
declare const isRenderer: (def: any) => boolean;
|
|
@@ -3246,11 +3383,6 @@ declare function flushSync<R>(fn: () => R): R;
|
|
|
3246
3383
|
declare const context: React$1.Context<RootStore>;
|
|
3247
3384
|
declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
|
|
3248
3385
|
|
|
3249
|
-
/**
|
|
3250
|
-
* Safely flush async effects when testing, simulating a legacy root.
|
|
3251
|
-
* @deprecated Import from React instead. import { act } from 'react'
|
|
3252
|
-
*/
|
|
3253
|
-
declare const act: typeof React$1.act;
|
|
3254
3386
|
/**
|
|
3255
3387
|
* An SSR-friendly useLayoutEffect.
|
|
3256
3388
|
*
|
|
@@ -3502,7 +3634,7 @@ declare function getInstanceProps<T = any>(pendingProps: Record<string, unknown>
|
|
|
3502
3634
|
declare function prepare<T = any>(target: T, root: RootStore, type: string, props: Instance<T>['props']): Instance<T>;
|
|
3503
3635
|
/**
|
|
3504
3636
|
* Triggers an update for an instance.
|
|
3505
|
-
*
|
|
3637
|
+
* Invalidates the frame if the root is in demand mode.
|
|
3506
3638
|
*
|
|
3507
3639
|
* @param instance - Instance to invalidate
|
|
3508
3640
|
*/
|
|
@@ -3668,29 +3800,44 @@ declare const hasConstructor: (object: unknown) => object is {
|
|
|
3668
3800
|
* Used to identify values that should be resolved from refs after mount.
|
|
3669
3801
|
*/
|
|
3670
3802
|
declare const FROM_REF: unique symbol;
|
|
3803
|
+
/** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
|
|
3804
|
+
interface FromRefMarker<T = unknown, R = T> {
|
|
3805
|
+
[FROM_REF]: React$1.RefObject<T | null>;
|
|
3806
|
+
/** Optional transform applied to the resolved ref before assignment. */
|
|
3807
|
+
transform?: (value: T) => R;
|
|
3808
|
+
}
|
|
3671
3809
|
/**
|
|
3672
3810
|
* Defers prop application until the referenced object is available.
|
|
3673
3811
|
* Useful for props like `target` that need sibling refs to be populated.
|
|
3674
3812
|
*
|
|
3813
|
+
* Only top-level props on a three element are resolved: a marker nested inside another value
|
|
3814
|
+
* (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
|
|
3815
|
+
* than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
|
|
3816
|
+
* what gets assigned.
|
|
3817
|
+
*
|
|
3675
3818
|
* @param ref - React ref object to resolve at mount time
|
|
3676
|
-
* @
|
|
3819
|
+
* @param transform - Optional mapping from the resolved object to the value the prop expects
|
|
3820
|
+
* @returns A marker value that the reconciler resolves after mount
|
|
3677
3821
|
*
|
|
3678
3822
|
* @example
|
|
3679
3823
|
* const targetRef = useRef<THREE.Object3D>(null)
|
|
3680
3824
|
*
|
|
3681
3825
|
* <group ref={targetRef} position={[-3, -2, -15]} />
|
|
3682
3826
|
* <spotLight target={fromRef(targetRef)} intensity={100} />
|
|
3827
|
+
*
|
|
3828
|
+
* @example
|
|
3829
|
+
* // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
|
|
3830
|
+
* <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
|
|
3683
3831
|
*/
|
|
3684
3832
|
declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
|
|
3833
|
+
declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
|
|
3685
3834
|
/**
|
|
3686
3835
|
* Type guard to check if a value is a fromRef marker.
|
|
3687
3836
|
*
|
|
3688
3837
|
* @param value - Value to check
|
|
3689
3838
|
* @returns True if value is a fromRef marker
|
|
3690
3839
|
*/
|
|
3691
|
-
declare function isFromRef(value: unknown): value is
|
|
3692
|
-
[FROM_REF]: React$1.RefObject<any>;
|
|
3693
|
-
};
|
|
3840
|
+
declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
|
|
3694
3841
|
|
|
3695
3842
|
/**
|
|
3696
3843
|
* Symbol marker for mount-only method calls.
|
|
@@ -3717,7 +3864,15 @@ declare const ONCE: unique symbol;
|
|
|
3717
3864
|
* // No arguments
|
|
3718
3865
|
* <geometry center={once()} />
|
|
3719
3866
|
*/
|
|
3720
|
-
declare function once<
|
|
3867
|
+
declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
|
|
3868
|
+
/**
|
|
3869
|
+
* What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
|
|
3870
|
+
* the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
|
|
3871
|
+
* methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
|
|
3872
|
+
*
|
|
3873
|
+
* The runtime value is always the marker object; only the declared type follows the prop.
|
|
3874
|
+
*/
|
|
3875
|
+
type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
|
|
3721
3876
|
/**
|
|
3722
3877
|
* Type guard to check if a value is a once marker.
|
|
3723
3878
|
*
|
|
@@ -3734,5 +3889,5 @@ declare function isOnce(value: unknown): value is {
|
|
|
3734
3889
|
*/
|
|
3735
3890
|
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3736
3891
|
|
|
3737
|
-
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,
|
|
3738
|
-
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferLike, BufferRecord, BufferStore, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, DefaultGLProps, DefaultRendererProps, Disposable, DisposeOptions, 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, InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeProps, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, R3FRenderer, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootState, RootStore, SetBlock, Size, StorageLike, StorageRecord, StorageStore, Subscription, TSLNodeInput, TextureInput, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, XRManager, XRPointerConfig };
|
|
3892
|
+
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, context, createEvents, createPointerEvents, createPortal, createRoot, createStore, 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, reconciler, registerPrimary, removeInteractivity, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useEnvironment, useFrame, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useMutableCallback, useRenderTarget, useStore, useTexture, useTextures, useThree, waitForPrimary };
|
|
3893
|
+
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferLike, BufferRecord, BufferStore, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, DefaultGLProps, DefaultRendererProps, Disposable, DisposeOptions, 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, InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeLike, NodeProps, NodeRecord, NodeStore, NonFunctionKeys, Object3DMethod, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, OnceValue, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, R3FRenderer, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootState, RootStore, SetBlock, Size, StorageLike, StorageRecord, StorageStore, Subscription, TSLNodeInput, TextureInput, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, XRManager, XRPointerConfig };
|