@react-three/fiber 10.0.0-alpha.3 → 10.0.0-alpha.5
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 +143 -90
- package/dist/index.d.cts +288 -143
- package/dist/index.d.mts +288 -143
- package/dist/index.d.ts +286 -169
- package/dist/index.mjs +143 -90
- package/dist/legacy.cjs +141 -92
- package/dist/legacy.d.cts +291 -150
- package/dist/legacy.d.mts +291 -150
- package/dist/legacy.d.ts +289 -174
- package/dist/legacy.mjs +141 -92
- package/dist/webgpu/index.cjs +260 -182
- package/dist/webgpu/index.d.cts +368 -254
- package/dist/webgpu/index.d.mts +368 -254
- package/dist/webgpu/index.d.ts +366 -280
- package/dist/webgpu/index.mjs +260 -182
- package/package.json +2 -2
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';
|
|
@@ -47,6 +48,9 @@ function _mergeNamespaces(n, m) {
|
|
|
47
48
|
declare const R3F_BUILD_LEGACY = true;
|
|
48
49
|
declare const R3F_BUILD_WEBGPU = true;
|
|
49
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
|
+
|
|
50
54
|
var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
51
55
|
__proto__: null,
|
|
52
56
|
CubeRenderTarget: CubeRenderTarget,
|
|
@@ -58,7 +62,8 @@ var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
|
58
62
|
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
59
63
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
60
64
|
WebGLRenderer: WebGLRenderer,
|
|
61
|
-
WebGLRendererParameters: WebGLRendererParameters
|
|
65
|
+
WebGLRendererParameters: WebGLRendererParameters,
|
|
66
|
+
loadInspector: loadInspector
|
|
62
67
|
}, [three_webgpu]);
|
|
63
68
|
|
|
64
69
|
//* Utility Types ==============================
|
|
@@ -347,6 +352,7 @@ type BufferLike =
|
|
|
347
352
|
| Uint16Array
|
|
348
353
|
| Int16Array
|
|
349
354
|
| THREE$1.BufferAttribute // Base class for all buffer attributes
|
|
355
|
+
| THREE$1.InterleavedBufferAttribute
|
|
350
356
|
| Node // TSL buffer nodes (instancedArray, storage)
|
|
351
357
|
|
|
352
358
|
/** Flat record of buffer-like values (no nested scopes) */
|
|
@@ -358,6 +364,25 @@ type BufferRecord = Record<string, BufferLike>
|
|
|
358
364
|
*/
|
|
359
365
|
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
360
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
|
+
|
|
361
386
|
//* Storage Types (useGPUStorage) ========================================
|
|
362
387
|
|
|
363
388
|
/**
|
|
@@ -372,7 +397,9 @@ type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
|
372
397
|
* ```
|
|
373
398
|
*/
|
|
374
399
|
type StorageLike =
|
|
375
|
-
| 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
|
|
376
403
|
| Data3DTexture // 3D texture (can be used as storage)
|
|
377
404
|
| Node // TSL storage texture nodes (storageTexture)
|
|
378
405
|
|
|
@@ -491,11 +518,28 @@ interface InternalState {
|
|
|
491
518
|
/** Container for child attachment (scene for root, original container for portals) */
|
|
492
519
|
container?: THREE$1.Object3D
|
|
493
520
|
/**
|
|
494
|
-
* CanvasTarget
|
|
495
|
-
*
|
|
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.
|
|
496
528
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
497
529
|
*/
|
|
498
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
|
|
499
543
|
/**
|
|
500
544
|
* Whether multi-canvas rendering is active.
|
|
501
545
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -605,7 +649,7 @@ interface RootState {
|
|
|
605
649
|
/** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
|
|
606
650
|
uniforms: UniformStore
|
|
607
651
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
608
|
-
nodes:
|
|
652
|
+
nodes: NodeStore
|
|
609
653
|
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
610
654
|
buffers: BufferStore
|
|
611
655
|
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
@@ -617,7 +661,7 @@ interface RootState {
|
|
|
617
661
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
618
662
|
renderPipeline: ThreeRenderPipeline | null
|
|
619
663
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
620
|
-
passes:
|
|
664
|
+
passes: PassRecord
|
|
621
665
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
622
666
|
_hmrVersion: number
|
|
623
667
|
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
@@ -705,12 +749,19 @@ type DefaultRendererProps = {
|
|
|
705
749
|
*/
|
|
706
750
|
interface CanvasSchedulerConfig {
|
|
707
751
|
/**
|
|
708
|
-
*
|
|
709
|
-
|
|
752
|
+
* Run this Canvas root before the referenced Canvas root id(s).
|
|
753
|
+
*/
|
|
754
|
+
before?: string | string[]
|
|
755
|
+
/**
|
|
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.
|
|
710
761
|
*/
|
|
711
|
-
|
|
762
|
+
order?: number
|
|
712
763
|
/**
|
|
713
|
-
* Limit this
|
|
764
|
+
* Limit this Canvas's default render job (frames per second).
|
|
714
765
|
*/
|
|
715
766
|
fps?: number
|
|
716
767
|
}
|
|
@@ -797,14 +848,17 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
797
848
|
performance?: Partial<Omit<Performance, 'regress'>>
|
|
798
849
|
/** Target pixel ratio. Can clamp between a range: `[min, max]` */
|
|
799
850
|
dpr?: Dpr
|
|
800
|
-
/**
|
|
801
|
-
|
|
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> }
|
|
802
856
|
/** A `THREE.Scene` instance or props that go into the default scene */
|
|
803
857
|
scene?: THREE$1.Scene | Partial<THREE$1.Scene>
|
|
804
858
|
/** A `THREE.Camera` instance or props that go into the default camera */
|
|
805
859
|
camera?: CameraProps
|
|
806
860
|
/** An R3F event manager to manage elements' pointer events */
|
|
807
|
-
events?: (store: RootStore) => EventManager<
|
|
861
|
+
events?: (store: RootStore) => EventManager<Element>
|
|
808
862
|
/** Callback after the canvas has rendered (but not yet committed) */
|
|
809
863
|
onCreated?: (state: RootState) => void
|
|
810
864
|
/** Response for pointer clicks that have missed any target */
|
|
@@ -1033,7 +1087,7 @@ interface CanvasProps
|
|
|
1033
1087
|
*/
|
|
1034
1088
|
resize?: Options
|
|
1035
1089
|
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
1036
|
-
eventSource?:
|
|
1090
|
+
eventSource?: Element | React$1.RefObject<Element | null>
|
|
1037
1091
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
1038
1092
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
|
|
1039
1093
|
/** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
|
|
@@ -1141,81 +1195,86 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
|
|
|
1141
1195
|
|
|
1142
1196
|
type RenderTargetOptions = RenderTargetOptions$1
|
|
1143
1197
|
|
|
1144
|
-
//* Global Types ==============================
|
|
1198
|
+
//* Global TSL Types ==============================
|
|
1145
1199
|
|
|
1146
1200
|
declare global {
|
|
1147
1201
|
/**
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1150
|
-
* This is three's own `UniformNode`, not a re-declaration of it. It previously was a
|
|
1151
|
-
* hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
|
|
1152
|
-
* exported type globally — so R3F's ~58 references resolved to an approximation that was
|
|
1153
|
-
* missing members three actually ships (`setName` among them) and had drifted to the wrong
|
|
1154
|
-
* arity when three made `UniformNode` two-parameter.
|
|
1155
|
-
*
|
|
1156
|
-
* three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
|
|
1157
|
-
* so the node type is fixed to `unknown` and the single parameter is kept for call-site
|
|
1158
|
-
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1159
|
-
* installed three instead of needing to be mirrored by hand.
|
|
1202
|
+
* Broad callable-node fallback for dynamic store readers.
|
|
1203
|
+
* Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
|
|
1160
1204
|
*/
|
|
1161
|
-
type
|
|
1205
|
+
type CallableTSLNode = ((...params: never[]) => unknown) & {
|
|
1206
|
+
readonly shaderNode: unknown
|
|
1207
|
+
readonly id: number
|
|
1208
|
+
}
|
|
1162
1209
|
|
|
1163
|
-
/**
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
* @example
|
|
1169
|
-
* ```tsx
|
|
1170
|
-
* // Define a shader function
|
|
1171
|
-
* const blendColorFn = Fn(([color1, color2, factor]) => {
|
|
1172
|
-
* return mix(color1, color2, factor)
|
|
1173
|
-
* })
|
|
1174
|
-
*
|
|
1175
|
-
* // Type when retrieving from nodes store
|
|
1176
|
-
* const { blendColorFn } = nodes as { blendColorFn: ShaderCallable }
|
|
1177
|
-
*
|
|
1178
|
-
* // Or with specific return type
|
|
1179
|
-
* const { myFn } = nodes as { myFn: ShaderCallable<THREE.Node> }
|
|
1180
|
-
* ```
|
|
1181
|
-
*/
|
|
1182
|
-
type ShaderCallable<R extends Node = Node> = ((...params: unknown[]) => ShaderNodeObject<R>) & Node
|
|
1210
|
+
/** Legacy structural node accepted when at least one historical marker exists. */
|
|
1211
|
+
type LegacyTSLNodeLike = {
|
|
1212
|
+
label?: ((label: string) => unknown) | string
|
|
1213
|
+
setName?: (name: string) => unknown
|
|
1214
|
+
} & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
|
|
1183
1215
|
|
|
1184
|
-
/**
|
|
1185
|
-
|
|
1186
|
-
* This is the common return type for TSL operations (add, mul, sin, etc.)
|
|
1187
|
-
*
|
|
1188
|
-
* @example
|
|
1189
|
-
* ```tsx
|
|
1190
|
-
* const { wobble } = nodes as { wobble: ShaderNodeRef }
|
|
1191
|
-
* ```
|
|
1192
|
-
*/
|
|
1193
|
-
type ShaderNodeRef<T extends Node = Node> = ShaderNodeObject<T>
|
|
1216
|
+
/** Node type accepted by broad dynamic node-store readers. */
|
|
1217
|
+
type TSLNodeType = three_webgpu.Node | CallableTSLNode
|
|
1194
1218
|
|
|
1195
1219
|
/**
|
|
1196
|
-
*
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
* - Node: base Three.js node type
|
|
1201
|
-
* - ShaderCallable: function nodes created with Fn()
|
|
1202
|
-
* - ShaderNodeObject: wrapped nodes from TSL operations (sin, mul, mix, etc.)
|
|
1203
|
-
*
|
|
1204
|
-
* @example
|
|
1205
|
-
* ```tsx
|
|
1206
|
-
* // In useLocalNodes, nodes are typed as TSLNodeType
|
|
1207
|
-
* const { positionNode, blendColorFn } = useLocalNodes(({ nodes }) => ({
|
|
1208
|
-
* positionNode: nodes.myPosition, // Works - Node is in union
|
|
1209
|
-
* blendColorFn: nodes.myFn, // Works - ShaderCallable is in union
|
|
1210
|
-
* }))
|
|
1211
|
-
*
|
|
1212
|
-
* // Can narrow with type guard or assertion when needed
|
|
1213
|
-
* if (typeof blendColorFn === 'function') {
|
|
1214
|
-
* blendColorFn(someColor, 0.5)
|
|
1215
|
-
* }
|
|
1216
|
-
* ```
|
|
1220
|
+
* Derive Three's shader node type from an existing node or a supported raw input.
|
|
1221
|
+
* Existing InputNode generics take precedence over structural value normalization.
|
|
1222
|
+
* Both generics must be inferred because Three's UniformNode intersects an unknown-typed
|
|
1223
|
+
* InputNode base with its concrete InputNode specialization.
|
|
1217
1224
|
*/
|
|
1218
|
-
type
|
|
1225
|
+
type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
|
|
1226
|
+
? TNodeType
|
|
1227
|
+
: T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
|
|
1228
|
+
? TNodeType
|
|
1229
|
+
: T extends number
|
|
1230
|
+
? 'float'
|
|
1231
|
+
: T extends boolean
|
|
1232
|
+
? 'bool'
|
|
1233
|
+
: T extends string | three_webgpu.Color | { r: number; g: number; b: number }
|
|
1234
|
+
? 'color'
|
|
1235
|
+
: T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
|
|
1236
|
+
? 'vec4'
|
|
1237
|
+
: T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
|
|
1238
|
+
? 'vec3'
|
|
1239
|
+
: T extends three_webgpu.Vector2 | { x: number; y: number }
|
|
1240
|
+
? 'vec2'
|
|
1241
|
+
: T extends three_webgpu.Matrix4
|
|
1242
|
+
? 'mat4'
|
|
1243
|
+
: T extends three_webgpu.Matrix3
|
|
1244
|
+
? 'mat3'
|
|
1245
|
+
: T extends three_webgpu.Matrix2
|
|
1246
|
+
? 'mat2'
|
|
1247
|
+
: unknown
|
|
1248
|
+
|
|
1249
|
+
/** Derive the normalized JavaScript value stored by a uniform node. */
|
|
1250
|
+
type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
|
|
1251
|
+
? TValue
|
|
1252
|
+
: T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
|
|
1253
|
+
? TValue
|
|
1254
|
+
: T extends string | { r: number; g: number; b: number }
|
|
1255
|
+
? three_webgpu.Color
|
|
1256
|
+
: T extends { x: number; y: number; z: number; w: number }
|
|
1257
|
+
? three_webgpu.Vector4
|
|
1258
|
+
: T extends { x: number; y: number; z: number }
|
|
1259
|
+
? three_webgpu.Vector3
|
|
1260
|
+
: T extends { x: number; y: number }
|
|
1261
|
+
? three_webgpu.Vector2
|
|
1262
|
+
: T extends number
|
|
1263
|
+
? number
|
|
1264
|
+
: T extends boolean
|
|
1265
|
+
? boolean
|
|
1266
|
+
: T
|
|
1267
|
+
|
|
1268
|
+
/** Three's exact UniformNode with shader and value generics derived from an input. */
|
|
1269
|
+
type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
|
|
1270
|
+
|
|
1271
|
+
/** Preserve every input key while mapping values to exact Three uniform nodes. */
|
|
1272
|
+
type UniformNodesFor<T extends UniformInputRecord> = {
|
|
1273
|
+
[K in keyof T]: UniformNodeFor<T[K]>
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
/** Backward-compatible single-parameter uniform alias. */
|
|
1277
|
+
type UniformNode<T = unknown> = UniformNodeFor<T>
|
|
1219
1278
|
|
|
1220
1279
|
/** Flat record of uniform nodes (no nested scopes) */
|
|
1221
1280
|
type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
|
|
@@ -1240,7 +1299,7 @@ declare global {
|
|
|
1240
1299
|
* Acceptable input values for useUniforms - raw values that get converted to UniformNodes
|
|
1241
1300
|
* Supports:
|
|
1242
1301
|
* - Primitives: number, string (color), boolean
|
|
1243
|
-
* - Three.js types: Color, Vector2/3/4,
|
|
1302
|
+
* - Three.js types: Color, Vector2/3/4, Matrix2/3/4
|
|
1244
1303
|
* - Plain objects: { x, y, z, w } converted to vectors
|
|
1245
1304
|
* - TSL nodes: color(), vec3(), float() for type casting
|
|
1246
1305
|
* - UniformNode: existing uniforms (reused as-is)
|
|
@@ -1253,88 +1312,124 @@ declare global {
|
|
|
1253
1312
|
| three_webgpu.Vector2
|
|
1254
1313
|
| three_webgpu.Vector3
|
|
1255
1314
|
| three_webgpu.Vector4
|
|
1315
|
+
| three_webgpu.Matrix2
|
|
1256
1316
|
| three_webgpu.Matrix3
|
|
1257
1317
|
| three_webgpu.Matrix4
|
|
1258
|
-
|
|
|
1259
|
-
|
|
|
1260
|
-
| { x: number; y
|
|
1318
|
+
| { x: number; y: number }
|
|
1319
|
+
| { x: number; y: number; z: number }
|
|
1320
|
+
| { x: number; y: number; z: number; w: number }
|
|
1261
1321
|
| { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
|
|
1262
|
-
| Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1322
|
+
| three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1263
1323
|
| UniformNode
|
|
1264
1324
|
|
|
1265
1325
|
/** Input record for useUniforms - accepts raw values or UniformNodes */
|
|
1266
1326
|
type UniformInputRecord = Record<string, UniformValue>
|
|
1267
1327
|
}
|
|
1268
1328
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
declare module 'three/tsl' {
|
|
1329
|
+
declare global {
|
|
1272
1330
|
/**
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1331
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1332
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1333
|
+
* is r185, so the new name is the only one.
|
|
1275
1334
|
*/
|
|
1276
|
-
|
|
1277
|
-
jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
|
|
1278
|
-
): ShaderCallable<R>
|
|
1335
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1279
1336
|
|
|
1280
1337
|
/**
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1338
|
+
* The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
|
|
1339
|
+
* `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
|
|
1340
|
+
* `getTextureNode`, `setMRT` and `dispose` track the installed version.
|
|
1283
1341
|
*/
|
|
1284
|
-
|
|
1285
|
-
jsFunc: (inputs: T) => ShaderNodeObject<R>,
|
|
1286
|
-
): ShaderCallable<R>
|
|
1342
|
+
type ScenePassNode = three_webgpu.PassNode
|
|
1287
1343
|
|
|
1288
1344
|
/**
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1345
|
+
* Pass record - stores TSL pass nodes for render pipeline.
|
|
1346
|
+
*
|
|
1347
|
+
* `scenePass` is the only key the library owns. It is optional here because this is also the
|
|
1348
|
+
* shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
|
|
1349
|
+
* or `clearPasses()`. Inside the callbacks it is always present; see
|
|
1350
|
+
* {@link RenderPipelineCallbackState}.
|
|
1351
|
+
*
|
|
1352
|
+
* Every other key is user-registered, via a callback's return value. Those are TSL nodes of
|
|
1353
|
+
* any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
|
|
1354
|
+
* `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
|
|
1355
|
+
* site when you need a member, e.g. `passes.velocity as TextureNode`.
|
|
1356
|
+
*
|
|
1357
|
+
* The index signature admits `undefined` because a key may simply not be registered, and
|
|
1358
|
+
* because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
|
|
1359
|
+
* optional property whose type excludes `undefined` from the index signature is an error
|
|
1360
|
+
* (TS2411) for every consumer compiling these declarations.
|
|
1291
1361
|
*/
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1362
|
+
interface PassRecord {
|
|
1363
|
+
scenePass?: ScenePassNode
|
|
1364
|
+
[key: string]: three_webgpu.Node | undefined
|
|
1365
|
+
}
|
|
1296
1366
|
|
|
1297
1367
|
/**
|
|
1298
|
-
*
|
|
1368
|
+
* State passed to pipeline callbacks after the active pipeline has been created.
|
|
1369
|
+
*
|
|
1370
|
+
* `passes.scenePass` is required here: the hook installs the default scene pass before either
|
|
1371
|
+
* callback runs, so callbacks can use it without a guard or a cast.
|
|
1372
|
+
*
|
|
1373
|
+
* `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
|
|
1374
|
+
* the legacy renderer before either callback can run, so a callback never sees WebGL.
|
|
1299
1375
|
*/
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1376
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1377
|
+
renderPipeline: ThreeRenderPipeline
|
|
1378
|
+
passes: PassRecord & { scenePass: ScenePassNode }
|
|
1379
|
+
renderer: three_webgpu.WebGPURenderer
|
|
1380
|
+
isLegacy: false
|
|
1381
|
+
}
|
|
1305
1382
|
|
|
1306
|
-
declare global {
|
|
1307
1383
|
/**
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
* is
|
|
1384
|
+
* What a callback may return to register entries into `state.passes`.
|
|
1385
|
+
*
|
|
1386
|
+
* `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
|
|
1387
|
+
* created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
|
|
1388
|
+
* store entry would leave the store pointing at a node the hook never disposes, and the hook
|
|
1389
|
+
* disposing a pass nothing references. So returning it is a type error.
|
|
1311
1390
|
*/
|
|
1312
|
-
type
|
|
1313
|
-
|
|
1314
|
-
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1315
|
-
type PassRecord = Record<string, any>
|
|
1391
|
+
type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
|
|
1316
1392
|
|
|
1317
1393
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1318
|
-
type RenderPipelineSetupCallback = (state:
|
|
1394
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1319
1395
|
|
|
1320
1396
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1321
|
-
type RenderPipelineMainCallback = (state:
|
|
1397
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1322
1398
|
|
|
1323
|
-
/**
|
|
1324
|
-
interface
|
|
1399
|
+
/** The imperative half of useRenderPipeline's return value, present in every state */
|
|
1400
|
+
interface UseRenderPipelineActions {
|
|
1325
1401
|
/** Current passes from state */
|
|
1326
1402
|
passes: PassRecord
|
|
1327
|
-
/** RenderPipeline instance (null if not initialized) */
|
|
1328
|
-
renderPipeline: ThreeRenderPipeline | null
|
|
1329
1403
|
/** Clear all passes from state */
|
|
1330
1404
|
clearPasses: () => void
|
|
1331
1405
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1332
1406
|
reset: () => void
|
|
1333
1407
|
/** Re-run setup/main callbacks with current closure values */
|
|
1334
1408
|
rebuild: () => void
|
|
1335
|
-
/** True when RenderPipeline is configured and ready */
|
|
1336
|
-
isReady: boolean
|
|
1337
1409
|
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* Return type for useRenderPipeline hook, discriminated on `isReady`.
|
|
1413
|
+
*
|
|
1414
|
+
* `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
|
|
1415
|
+
* callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
|
|
1416
|
+
* `clearPasses()` empties the record while leaving the pipeline in place.
|
|
1417
|
+
*/
|
|
1418
|
+
type UseRenderPipelineReturn = UseRenderPipelineActions &
|
|
1419
|
+
(
|
|
1420
|
+
| {
|
|
1421
|
+
/** True when RenderPipeline is configured and ready */
|
|
1422
|
+
isReady: true
|
|
1423
|
+
/** RenderPipeline instance */
|
|
1424
|
+
renderPipeline: ThreeRenderPipeline
|
|
1425
|
+
}
|
|
1426
|
+
| {
|
|
1427
|
+
/** False until the pipeline has been created */
|
|
1428
|
+
isReady: false
|
|
1429
|
+
/** Not initialized yet, or torn down by reset() */
|
|
1430
|
+
renderPipeline: null
|
|
1431
|
+
}
|
|
1432
|
+
)
|
|
1338
1433
|
}
|
|
1339
1434
|
|
|
1340
1435
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
@@ -1413,10 +1508,11 @@ type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
|
|
|
1413
1508
|
|
|
1414
1509
|
/**
|
|
1415
1510
|
* For node material properties (colorNode, positionNode, etc.), accept broader types
|
|
1416
|
-
* since @types/three has broken inheritance for TSL node subclasses.
|
|
1511
|
+
* since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
|
|
1512
|
+
* `nodeType`, so this structural key test remains neutral to the selected Three entry.
|
|
1417
1513
|
*/
|
|
1418
1514
|
type NodeProps<P> = {
|
|
1419
|
-
[K in keyof P as P[K] extends
|
|
1515
|
+
[K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
|
|
1420
1516
|
}
|
|
1421
1517
|
|
|
1422
1518
|
interface ReactProps<P> {
|
|
@@ -1437,11 +1533,30 @@ type ThreeToJSXElements<T extends Record<string, any>> = {
|
|
|
1437
1533
|
[K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
|
|
1438
1534
|
}
|
|
1439
1535
|
|
|
1536
|
+
/** Method names of Object3D, excluded from the `primitive` element's typed props. */
|
|
1537
|
+
type Object3DMethod = NonNullable<
|
|
1538
|
+
{
|
|
1539
|
+
[K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
|
|
1540
|
+
}[keyof Object3D]
|
|
1541
|
+
>
|
|
1542
|
+
|
|
1440
1543
|
type ThreeExports = typeof THREE
|
|
1441
1544
|
type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
|
|
1442
1545
|
|
|
1443
1546
|
interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
|
|
1444
|
-
|
|
1547
|
+
/**
|
|
1548
|
+
* `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
|
|
1549
|
+
* Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
|
|
1550
|
+
* untyped, and any other prop is accepted and applied to the object by name. Object3D's own
|
|
1551
|
+
* methods are left out of the typed surface: they return `this`, so a subclass element's
|
|
1552
|
+
* props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
|
|
1553
|
+
*/
|
|
1554
|
+
primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | 'onUpdate' | Object3DMethod> & {
|
|
1555
|
+
object: object
|
|
1556
|
+
ref?: React.Ref<any>
|
|
1557
|
+
onUpdate?: (self: any) => void
|
|
1558
|
+
[prop: string]: unknown
|
|
1559
|
+
}
|
|
1445
1560
|
// Conflicts with DOM types can be accessed through a three* prefix
|
|
1446
1561
|
threeAudio: ThreeElementsImpl['audio']
|
|
1447
1562
|
threeSource: ThreeElementsImpl['source']
|
|
@@ -1482,6 +1597,7 @@ type three_d_Matrix3 = Matrix3;
|
|
|
1482
1597
|
type three_d_Matrix4 = Matrix4;
|
|
1483
1598
|
type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
|
|
1484
1599
|
type three_d_NodeProps<P> = NodeProps<P>;
|
|
1600
|
+
type three_d_Object3DMethod = Object3DMethod;
|
|
1485
1601
|
type three_d_Quaternion = Quaternion;
|
|
1486
1602
|
type three_d_RaycastableRepresentation = RaycastableRepresentation;
|
|
1487
1603
|
type three_d_ReactProps<P> = ReactProps<P>;
|
|
@@ -1496,7 +1612,7 @@ type three_d_Vector3 = Vector3;
|
|
|
1496
1612
|
type three_d_Vector4 = Vector4;
|
|
1497
1613
|
type three_d_VectorRepresentation = VectorRepresentation;
|
|
1498
1614
|
declare namespace three_d {
|
|
1499
|
-
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 };
|
|
1615
|
+
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 };
|
|
1500
1616
|
}
|
|
1501
1617
|
|
|
1502
1618
|
/**
|
|
@@ -1845,7 +1961,7 @@ declare function createEvents(store: RootStore): {
|
|
|
1845
1961
|
processDeferredPointer: (event: DomEvent, pointerId: number) => void;
|
|
1846
1962
|
};
|
|
1847
1963
|
/** Default R3F event manager for web */
|
|
1848
|
-
declare function createPointerEvents(store: RootStore): EventManager<
|
|
1964
|
+
declare function createPointerEvents(store: RootStore): EventManager<Element>;
|
|
1849
1965
|
|
|
1850
1966
|
/**
|
|
1851
1967
|
* Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
|
|
@@ -1878,7 +1994,7 @@ declare namespace useLoader {
|
|
|
1878
1994
|
*
|
|
1879
1995
|
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1880
1996
|
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1881
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1997
|
+
* @returns Controls object with step(), stepAll(), invalidate(), pause(), resume(), isPaused, id, rootId, scheduler
|
|
1882
1998
|
*
|
|
1883
1999
|
* @example
|
|
1884
2000
|
* // Simple priority (backwards compat)
|
|
@@ -2174,7 +2290,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2174
2290
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2175
2291
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2176
2292
|
*
|
|
2177
|
-
*
|
|
2293
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2294
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2295
|
+
*
|
|
2296
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2178
2297
|
* @param frames - Number of frames to request (default: 1)
|
|
2179
2298
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2180
2299
|
*
|
|
@@ -2185,14 +2304,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2185
2304
|
* Advances the frameloop and runs render effects.
|
|
2186
2305
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2187
2306
|
*
|
|
2307
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2308
|
+
* registered root is stepped for backwards compatibility.
|
|
2309
|
+
*
|
|
2188
2310
|
* @param timestamp - The timestamp to use for this frame
|
|
2189
2311
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2190
|
-
* @param state -
|
|
2191
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2312
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2192
2313
|
*
|
|
2193
2314
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2194
2315
|
*/
|
|
2195
|
-
declare function advance(timestamp: number): void;
|
|
2316
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2196
2317
|
|
|
2197
2318
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2198
2319
|
declare function ReactReconciler<
|
|
@@ -3237,6 +3358,7 @@ declare namespace ReactReconciler {
|
|
|
3237
3358
|
|
|
3238
3359
|
declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
|
|
3239
3360
|
declare function extend<T extends Catalogue>(objects: T): void;
|
|
3361
|
+
declare function extend(objects: Record<string, unknown>): void;
|
|
3240
3362
|
declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
|
|
3241
3363
|
|
|
3242
3364
|
declare const isRenderer: (def: any) => boolean;
|
|
@@ -3680,29 +3802,44 @@ declare const hasConstructor: (object: unknown) => object is {
|
|
|
3680
3802
|
* Used to identify values that should be resolved from refs after mount.
|
|
3681
3803
|
*/
|
|
3682
3804
|
declare const FROM_REF: unique symbol;
|
|
3805
|
+
/** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
|
|
3806
|
+
interface FromRefMarker<T = unknown, R = T> {
|
|
3807
|
+
[FROM_REF]: React$1.RefObject<T | null>;
|
|
3808
|
+
/** Optional transform applied to the resolved ref before assignment. */
|
|
3809
|
+
transform?: (value: T) => R;
|
|
3810
|
+
}
|
|
3683
3811
|
/**
|
|
3684
3812
|
* Defers prop application until the referenced object is available.
|
|
3685
3813
|
* Useful for props like `target` that need sibling refs to be populated.
|
|
3686
3814
|
*
|
|
3815
|
+
* Only top-level props on a three element are resolved: a marker nested inside another value
|
|
3816
|
+
* (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
|
|
3817
|
+
* than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
|
|
3818
|
+
* what gets assigned.
|
|
3819
|
+
*
|
|
3687
3820
|
* @param ref - React ref object to resolve at mount time
|
|
3688
|
-
* @
|
|
3821
|
+
* @param transform - Optional mapping from the resolved object to the value the prop expects
|
|
3822
|
+
* @returns A marker value that the reconciler resolves after mount
|
|
3689
3823
|
*
|
|
3690
3824
|
* @example
|
|
3691
3825
|
* const targetRef = useRef<THREE.Object3D>(null)
|
|
3692
3826
|
*
|
|
3693
3827
|
* <group ref={targetRef} position={[-3, -2, -15]} />
|
|
3694
3828
|
* <spotLight target={fromRef(targetRef)} intensity={100} />
|
|
3829
|
+
*
|
|
3830
|
+
* @example
|
|
3831
|
+
* // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
|
|
3832
|
+
* <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
|
|
3695
3833
|
*/
|
|
3696
3834
|
declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
|
|
3835
|
+
declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
|
|
3697
3836
|
/**
|
|
3698
3837
|
* Type guard to check if a value is a fromRef marker.
|
|
3699
3838
|
*
|
|
3700
3839
|
* @param value - Value to check
|
|
3701
3840
|
* @returns True if value is a fromRef marker
|
|
3702
3841
|
*/
|
|
3703
|
-
declare function isFromRef(value: unknown): value is
|
|
3704
|
-
[FROM_REF]: React$1.RefObject<any>;
|
|
3705
|
-
};
|
|
3842
|
+
declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
|
|
3706
3843
|
|
|
3707
3844
|
/**
|
|
3708
3845
|
* Symbol marker for mount-only method calls.
|
|
@@ -3729,7 +3866,15 @@ declare const ONCE: unique symbol;
|
|
|
3729
3866
|
* // No arguments
|
|
3730
3867
|
* <geometry center={once()} />
|
|
3731
3868
|
*/
|
|
3732
|
-
declare function once<
|
|
3869
|
+
declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
|
|
3870
|
+
/**
|
|
3871
|
+
* What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
|
|
3872
|
+
* the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
|
|
3873
|
+
* methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
|
|
3874
|
+
*
|
|
3875
|
+
* The runtime value is always the marker object; only the declared type follows the prop.
|
|
3876
|
+
*/
|
|
3877
|
+
type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
|
|
3733
3878
|
/**
|
|
3734
3879
|
* Type guard to check if a value is a once marker.
|
|
3735
3880
|
*
|
|
@@ -3747,4 +3892,4 @@ declare function isOnce(value: unknown): value is {
|
|
|
3747
3892
|
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3748
3893
|
|
|
3749
3894
|
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 };
|
|
3750
|
-
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 };
|
|
3895
|
+
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 };
|