@react-three/fiber 10.0.0-canary.20de6b2 → 10.0.0-canary.27df622
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 +106 -63
- package/dist/index.d.cts +270 -142
- package/dist/index.d.mts +270 -142
- package/dist/index.d.ts +270 -170
- package/dist/index.mjs +106 -63
- package/dist/legacy.cjs +105 -61
- package/dist/legacy.d.cts +274 -146
- package/dist/legacy.d.mts +274 -146
- package/dist/legacy.d.ts +274 -172
- package/dist/legacy.mjs +105 -61
- package/dist/webgpu/index.cjs +197 -135
- package/dist/webgpu/index.d.cts +333 -204
- package/dist/webgpu/index.d.mts +333 -204
- package/dist/webgpu/index.d.ts +333 -232
- package/dist/webgpu/index.mjs +197 -135
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
|
|
2
2
|
import * as three_webgpu from 'three/webgpu';
|
|
3
|
-
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget,
|
|
3
|
+
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Storage3DTexture, StorageArrayTexture, Data3DTexture, CanvasTarget, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Object3D, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Frustum, OrthographicCamera } from 'three/webgpu';
|
|
4
4
|
import * as THREE$1 from 'three';
|
|
5
5
|
import { WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
6
6
|
import { WebGLRendererParameters } from 'three/src/renderers/WebGLRenderer.js';
|
|
@@ -15,20 +15,6 @@ import { Options } from 'react-use-measure';
|
|
|
15
15
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
16
16
|
import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
|
|
17
17
|
|
|
18
|
-
function _mergeNamespaces(n, m) {
|
|
19
|
-
m.forEach(function (e) {
|
|
20
|
-
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
21
|
-
if (k !== 'default' && !(k in n)) {
|
|
22
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () { return e[k]; }
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
return Object.freeze(n);
|
|
31
|
-
}
|
|
32
18
|
|
|
33
19
|
/**
|
|
34
20
|
* @fileoverview Internal Three.js re-exports - DEFAULT ENTRY
|
|
@@ -51,20 +37,6 @@ declare const R3F_BUILD_WEBGPU = true;
|
|
|
51
37
|
/** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
|
|
52
38
|
declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
|
|
53
39
|
|
|
54
|
-
var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
55
|
-
__proto__: null,
|
|
56
|
-
CubeRenderTarget: CubeRenderTarget,
|
|
57
|
-
CubeRenderTargetCompat: CubeRenderTarget,
|
|
58
|
-
Inspector: Inspector,
|
|
59
|
-
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
60
|
-
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
61
|
-
RenderTargetCompat: RenderTarget,
|
|
62
|
-
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
63
|
-
WebGLRenderTarget: WebGLRenderTarget,
|
|
64
|
-
WebGLRenderer: WebGLRenderer,
|
|
65
|
-
WebGLRendererParameters: WebGLRendererParameters,
|
|
66
|
-
loadInspector: loadInspector
|
|
67
|
-
}, [three_webgpu]);
|
|
68
40
|
|
|
69
41
|
//* Utility Types ==============================
|
|
70
42
|
|
|
@@ -352,6 +324,7 @@ type BufferLike =
|
|
|
352
324
|
| Uint16Array
|
|
353
325
|
| Int16Array
|
|
354
326
|
| THREE$1.BufferAttribute // Base class for all buffer attributes
|
|
327
|
+
| THREE$1.InterleavedBufferAttribute
|
|
355
328
|
| Node // TSL buffer nodes (instancedArray, storage)
|
|
356
329
|
|
|
357
330
|
/** Flat record of buffer-like values (no nested scopes) */
|
|
@@ -363,6 +336,25 @@ type BufferRecord = Record<string, BufferLike>
|
|
|
363
336
|
*/
|
|
364
337
|
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
365
338
|
|
|
339
|
+
//* Node Types (useNodes) ========================================
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
|
|
343
|
+
* the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
|
|
344
|
+
* code passes through. Creators are constrained to this same type, so the shape a creator returns
|
|
345
|
+
* and the shape the store holds are one type by construction.
|
|
346
|
+
*/
|
|
347
|
+
type NodeLike = TSLNodeType | LegacyTSLNodeLike
|
|
348
|
+
|
|
349
|
+
/** Flat record of TSL nodes (no nested scopes) */
|
|
350
|
+
type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Node store that can contain both root-level nodes and scoped node objects.
|
|
354
|
+
* Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
|
|
355
|
+
*/
|
|
356
|
+
type NodeStore = Record<string, NodeLike | NodeRecord>
|
|
357
|
+
|
|
366
358
|
//* Storage Types (useGPUStorage) ========================================
|
|
367
359
|
|
|
368
360
|
/**
|
|
@@ -377,7 +369,9 @@ type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
|
377
369
|
* ```
|
|
378
370
|
*/
|
|
379
371
|
type StorageLike =
|
|
380
|
-
| StorageTexture // GPU storage texture
|
|
372
|
+
| StorageTexture // 2D GPU storage texture
|
|
373
|
+
| Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
|
|
374
|
+
| StorageArrayTexture // 2D-array GPU storage texture
|
|
381
375
|
| Data3DTexture // 3D texture (can be used as storage)
|
|
382
376
|
| Node // TSL storage texture nodes (storageTexture)
|
|
383
377
|
|
|
@@ -496,8 +490,13 @@ interface InternalState {
|
|
|
496
490
|
/** Container for child attachment (scene for root, original container for portals) */
|
|
497
491
|
container?: THREE$1.Object3D
|
|
498
492
|
/**
|
|
499
|
-
* CanvasTarget
|
|
500
|
-
*
|
|
493
|
+
* The CanvasTarget this root sizes and renders through.
|
|
494
|
+
*
|
|
495
|
+
* A primary (`<Canvas id>`) owns the renderer's default target -- the one three itself built
|
|
496
|
+
* around the canvas element -- so sizing it is sizing the renderer. A secondary owns a target
|
|
497
|
+
* R3F created for its own element. Either way there is exactly one target per canvas element,
|
|
498
|
+
* and the canvas-target job makes it the renderer's active one before this root renders.
|
|
499
|
+
* Absent on WebGL and on an id-less WebGPU canvas, where the renderer is sized directly.
|
|
501
500
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
502
501
|
*/
|
|
503
502
|
canvasTarget?: CanvasTarget
|
|
@@ -622,7 +621,7 @@ interface RootState {
|
|
|
622
621
|
/** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
|
|
623
622
|
uniforms: UniformStore
|
|
624
623
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
625
|
-
nodes:
|
|
624
|
+
nodes: NodeStore
|
|
626
625
|
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
627
626
|
buffers: BufferStore
|
|
628
627
|
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
@@ -634,7 +633,7 @@ interface RootState {
|
|
|
634
633
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
635
634
|
renderPipeline: ThreeRenderPipeline | null
|
|
636
635
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
637
|
-
passes:
|
|
636
|
+
passes: PassRecord
|
|
638
637
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
639
638
|
_hmrVersion: number
|
|
640
639
|
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
@@ -722,12 +721,19 @@ type DefaultRendererProps = {
|
|
|
722
721
|
*/
|
|
723
722
|
interface CanvasSchedulerConfig {
|
|
724
723
|
/**
|
|
725
|
-
*
|
|
726
|
-
|
|
724
|
+
* Run this Canvas root before the referenced Canvas root id(s).
|
|
725
|
+
*/
|
|
726
|
+
before?: string | string[]
|
|
727
|
+
/**
|
|
728
|
+
* Run this Canvas root after the referenced Canvas root id(s).
|
|
729
|
+
*/
|
|
730
|
+
after?: string | string[]
|
|
731
|
+
/**
|
|
732
|
+
* Numeric root order. Lower values run first.
|
|
727
733
|
*/
|
|
728
|
-
|
|
734
|
+
order?: number
|
|
729
735
|
/**
|
|
730
|
-
* Limit this
|
|
736
|
+
* Limit this Canvas's default render job (frames per second).
|
|
731
737
|
*/
|
|
732
738
|
fps?: number
|
|
733
739
|
}
|
|
@@ -814,14 +820,17 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
814
820
|
performance?: Partial<Omit<Performance, 'regress'>>
|
|
815
821
|
/** Target pixel ratio. Can clamp between a range: `[min, max]` */
|
|
816
822
|
dpr?: Dpr
|
|
817
|
-
/**
|
|
818
|
-
|
|
823
|
+
/**
|
|
824
|
+
* Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
|
|
825
|
+
* so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
|
|
826
|
+
*/
|
|
827
|
+
raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
|
|
819
828
|
/** A `THREE.Scene` instance or props that go into the default scene */
|
|
820
829
|
scene?: THREE$1.Scene | Partial<THREE$1.Scene>
|
|
821
830
|
/** A `THREE.Camera` instance or props that go into the default camera */
|
|
822
831
|
camera?: CameraProps
|
|
823
832
|
/** An R3F event manager to manage elements' pointer events */
|
|
824
|
-
events?: (store: RootStore) => EventManager<
|
|
833
|
+
events?: (store: RootStore) => EventManager<Element>
|
|
825
834
|
/** Callback after the canvas has rendered (but not yet committed) */
|
|
826
835
|
onCreated?: (state: RootState) => void
|
|
827
836
|
/** Response for pointer clicks that have missed any target */
|
|
@@ -1050,7 +1059,7 @@ interface CanvasProps
|
|
|
1050
1059
|
*/
|
|
1051
1060
|
resize?: Options
|
|
1052
1061
|
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
1053
|
-
eventSource?:
|
|
1062
|
+
eventSource?: Element | React$1.RefObject<Element | null>
|
|
1054
1063
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
1055
1064
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
|
|
1056
1065
|
/** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
|
|
@@ -1158,81 +1167,86 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
|
|
|
1158
1167
|
|
|
1159
1168
|
type RenderTargetOptions = RenderTargetOptions$1
|
|
1160
1169
|
|
|
1161
|
-
//* Global Types ==============================
|
|
1170
|
+
//* Global TSL Types ==============================
|
|
1162
1171
|
|
|
1163
1172
|
declare global {
|
|
1164
1173
|
/**
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
* This is three's own `UniformNode`, not a re-declaration of it. It previously was a
|
|
1168
|
-
* hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
|
|
1169
|
-
* exported type globally — so R3F's ~58 references resolved to an approximation that was
|
|
1170
|
-
* missing members three actually ships (`setName` among them) and had drifted to the wrong
|
|
1171
|
-
* arity when three made `UniformNode` two-parameter.
|
|
1172
|
-
*
|
|
1173
|
-
* three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
|
|
1174
|
-
* so the node type is fixed to `unknown` and the single parameter is kept for call-site
|
|
1175
|
-
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1176
|
-
* installed three instead of needing to be mirrored by hand.
|
|
1174
|
+
* Broad callable-node fallback for dynamic store readers.
|
|
1175
|
+
* Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
|
|
1177
1176
|
*/
|
|
1178
|
-
type
|
|
1177
|
+
type CallableTSLNode = ((...params: never[]) => unknown) & {
|
|
1178
|
+
readonly shaderNode: unknown
|
|
1179
|
+
readonly id: number
|
|
1180
|
+
}
|
|
1179
1181
|
|
|
1180
|
-
/**
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
* @example
|
|
1186
|
-
* ```tsx
|
|
1187
|
-
* // Define a shader function
|
|
1188
|
-
* const blendColorFn = Fn(([color1, color2, factor]) => {
|
|
1189
|
-
* return mix(color1, color2, factor)
|
|
1190
|
-
* })
|
|
1191
|
-
*
|
|
1192
|
-
* // Type when retrieving from nodes store
|
|
1193
|
-
* const { blendColorFn } = nodes as { blendColorFn: ShaderCallable }
|
|
1194
|
-
*
|
|
1195
|
-
* // Or with specific return type
|
|
1196
|
-
* const { myFn } = nodes as { myFn: ShaderCallable<THREE.Node> }
|
|
1197
|
-
* ```
|
|
1198
|
-
*/
|
|
1199
|
-
type ShaderCallable<R extends Node = Node> = ((...params: unknown[]) => ShaderNodeObject<R>) & Node
|
|
1182
|
+
/** Legacy structural node accepted when at least one historical marker exists. */
|
|
1183
|
+
type LegacyTSLNodeLike = {
|
|
1184
|
+
label?: ((label: string) => unknown) | string
|
|
1185
|
+
setName?: (name: string) => unknown
|
|
1186
|
+
} & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
|
|
1200
1187
|
|
|
1201
|
-
/**
|
|
1202
|
-
|
|
1203
|
-
* This is the common return type for TSL operations (add, mul, sin, etc.)
|
|
1204
|
-
*
|
|
1205
|
-
* @example
|
|
1206
|
-
* ```tsx
|
|
1207
|
-
* const { wobble } = nodes as { wobble: ShaderNodeRef }
|
|
1208
|
-
* ```
|
|
1209
|
-
*/
|
|
1210
|
-
type ShaderNodeRef<T extends Node = Node> = ShaderNodeObject<T>
|
|
1188
|
+
/** Node type accepted by broad dynamic node-store readers. */
|
|
1189
|
+
type TSLNodeType = three_webgpu.Node | CallableTSLNode
|
|
1211
1190
|
|
|
1212
1191
|
/**
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1215
|
-
*
|
|
1216
|
-
*
|
|
1217
|
-
* - Node: base Three.js node type
|
|
1218
|
-
* - ShaderCallable: function nodes created with Fn()
|
|
1219
|
-
* - ShaderNodeObject: wrapped nodes from TSL operations (sin, mul, mix, etc.)
|
|
1220
|
-
*
|
|
1221
|
-
* @example
|
|
1222
|
-
* ```tsx
|
|
1223
|
-
* // In useLocalNodes, nodes are typed as TSLNodeType
|
|
1224
|
-
* const { positionNode, blendColorFn } = useLocalNodes(({ nodes }) => ({
|
|
1225
|
-
* positionNode: nodes.myPosition, // Works - Node is in union
|
|
1226
|
-
* blendColorFn: nodes.myFn, // Works - ShaderCallable is in union
|
|
1227
|
-
* }))
|
|
1228
|
-
*
|
|
1229
|
-
* // Can narrow with type guard or assertion when needed
|
|
1230
|
-
* if (typeof blendColorFn === 'function') {
|
|
1231
|
-
* blendColorFn(someColor, 0.5)
|
|
1232
|
-
* }
|
|
1233
|
-
* ```
|
|
1192
|
+
* Derive Three's shader node type from an existing node or a supported raw input.
|
|
1193
|
+
* Existing InputNode generics take precedence over structural value normalization.
|
|
1194
|
+
* Both generics must be inferred because Three's UniformNode intersects an unknown-typed
|
|
1195
|
+
* InputNode base with its concrete InputNode specialization.
|
|
1234
1196
|
*/
|
|
1235
|
-
type
|
|
1197
|
+
type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
|
|
1198
|
+
? TNodeType
|
|
1199
|
+
: T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
|
|
1200
|
+
? TNodeType
|
|
1201
|
+
: T extends number
|
|
1202
|
+
? 'float'
|
|
1203
|
+
: T extends boolean
|
|
1204
|
+
? 'bool'
|
|
1205
|
+
: T extends string | three_webgpu.Color | { r: number; g: number; b: number }
|
|
1206
|
+
? 'color'
|
|
1207
|
+
: T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
|
|
1208
|
+
? 'vec4'
|
|
1209
|
+
: T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
|
|
1210
|
+
? 'vec3'
|
|
1211
|
+
: T extends three_webgpu.Vector2 | { x: number; y: number }
|
|
1212
|
+
? 'vec2'
|
|
1213
|
+
: T extends three_webgpu.Matrix4
|
|
1214
|
+
? 'mat4'
|
|
1215
|
+
: T extends three_webgpu.Matrix3
|
|
1216
|
+
? 'mat3'
|
|
1217
|
+
: T extends three_webgpu.Matrix2
|
|
1218
|
+
? 'mat2'
|
|
1219
|
+
: unknown
|
|
1220
|
+
|
|
1221
|
+
/** Derive the normalized JavaScript value stored by a uniform node. */
|
|
1222
|
+
type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
|
|
1223
|
+
? TValue
|
|
1224
|
+
: T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
|
|
1225
|
+
? TValue
|
|
1226
|
+
: T extends string | { r: number; g: number; b: number }
|
|
1227
|
+
? three_webgpu.Color
|
|
1228
|
+
: T extends { x: number; y: number; z: number; w: number }
|
|
1229
|
+
? three_webgpu.Vector4
|
|
1230
|
+
: T extends { x: number; y: number; z: number }
|
|
1231
|
+
? three_webgpu.Vector3
|
|
1232
|
+
: T extends { x: number; y: number }
|
|
1233
|
+
? three_webgpu.Vector2
|
|
1234
|
+
: T extends number
|
|
1235
|
+
? number
|
|
1236
|
+
: T extends boolean
|
|
1237
|
+
? boolean
|
|
1238
|
+
: T
|
|
1239
|
+
|
|
1240
|
+
/** Three's exact UniformNode with shader and value generics derived from an input. */
|
|
1241
|
+
type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
|
|
1242
|
+
|
|
1243
|
+
/** Preserve every input key while mapping values to exact Three uniform nodes. */
|
|
1244
|
+
type UniformNodesFor<T extends UniformInputRecord> = {
|
|
1245
|
+
[K in keyof T]: UniformNodeFor<T[K]>
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/** Backward-compatible single-parameter uniform alias. */
|
|
1249
|
+
type UniformNode<T = unknown> = UniformNodeFor<T>
|
|
1236
1250
|
|
|
1237
1251
|
/** Flat record of uniform nodes (no nested scopes) */
|
|
1238
1252
|
type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
|
|
@@ -1257,7 +1271,7 @@ declare global {
|
|
|
1257
1271
|
* Acceptable input values for useUniforms - raw values that get converted to UniformNodes
|
|
1258
1272
|
* Supports:
|
|
1259
1273
|
* - Primitives: number, string (color), boolean
|
|
1260
|
-
* - Three.js types: Color, Vector2/3/4,
|
|
1274
|
+
* - Three.js types: Color, Vector2/3/4, Matrix2/3/4
|
|
1261
1275
|
* - Plain objects: { x, y, z, w } converted to vectors
|
|
1262
1276
|
* - TSL nodes: color(), vec3(), float() for type casting
|
|
1263
1277
|
* - UniformNode: existing uniforms (reused as-is)
|
|
@@ -1270,88 +1284,124 @@ declare global {
|
|
|
1270
1284
|
| three_webgpu.Vector2
|
|
1271
1285
|
| three_webgpu.Vector3
|
|
1272
1286
|
| three_webgpu.Vector4
|
|
1287
|
+
| three_webgpu.Matrix2
|
|
1273
1288
|
| three_webgpu.Matrix3
|
|
1274
1289
|
| three_webgpu.Matrix4
|
|
1275
|
-
|
|
|
1276
|
-
|
|
|
1277
|
-
| { x: number; y
|
|
1290
|
+
| { x: number; y: number }
|
|
1291
|
+
| { x: number; y: number; z: number }
|
|
1292
|
+
| { x: number; y: number; z: number; w: number }
|
|
1278
1293
|
| { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
|
|
1279
|
-
| Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1294
|
+
| three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1280
1295
|
| UniformNode
|
|
1281
1296
|
|
|
1282
1297
|
/** Input record for useUniforms - accepts raw values or UniformNodes */
|
|
1283
1298
|
type UniformInputRecord = Record<string, UniformValue>
|
|
1284
1299
|
}
|
|
1285
1300
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
declare module 'three/tsl' {
|
|
1301
|
+
declare global {
|
|
1289
1302
|
/**
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1303
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1304
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1305
|
+
* is r185, so the new name is the only one.
|
|
1292
1306
|
*/
|
|
1293
|
-
|
|
1294
|
-
jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
|
|
1295
|
-
): ShaderCallable<R>
|
|
1307
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1296
1308
|
|
|
1297
1309
|
/**
|
|
1298
|
-
*
|
|
1299
|
-
*
|
|
1310
|
+
* The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
|
|
1311
|
+
* `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
|
|
1312
|
+
* `getTextureNode`, `setMRT` and `dispose` track the installed version.
|
|
1300
1313
|
*/
|
|
1301
|
-
|
|
1302
|
-
jsFunc: (inputs: T) => ShaderNodeObject<R>,
|
|
1303
|
-
): ShaderCallable<R>
|
|
1314
|
+
type ScenePassNode = three_webgpu.PassNode
|
|
1304
1315
|
|
|
1305
1316
|
/**
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1317
|
+
* Pass record - stores TSL pass nodes for render pipeline.
|
|
1318
|
+
*
|
|
1319
|
+
* `scenePass` is the only key the library owns. It is optional here because this is also the
|
|
1320
|
+
* shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
|
|
1321
|
+
* or `clearPasses()`. Inside the callbacks it is always present; see
|
|
1322
|
+
* {@link RenderPipelineCallbackState}.
|
|
1323
|
+
*
|
|
1324
|
+
* Every other key is user-registered, via a callback's return value. Those are TSL nodes of
|
|
1325
|
+
* any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
|
|
1326
|
+
* `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
|
|
1327
|
+
* site when you need a member, e.g. `passes.velocity as TextureNode`.
|
|
1328
|
+
*
|
|
1329
|
+
* The index signature admits `undefined` because a key may simply not be registered, and
|
|
1330
|
+
* because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
|
|
1331
|
+
* optional property whose type excludes `undefined` from the index signature is an error
|
|
1332
|
+
* (TS2411) for every consumer compiling these declarations.
|
|
1308
1333
|
*/
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1334
|
+
interface PassRecord {
|
|
1335
|
+
scenePass?: ScenePassNode
|
|
1336
|
+
[key: string]: three_webgpu.Node | undefined
|
|
1337
|
+
}
|
|
1313
1338
|
|
|
1314
1339
|
/**
|
|
1315
|
-
*
|
|
1340
|
+
* State passed to pipeline callbacks after the active pipeline has been created.
|
|
1341
|
+
*
|
|
1342
|
+
* `passes.scenePass` is required here: the hook installs the default scene pass before either
|
|
1343
|
+
* callback runs, so callbacks can use it without a guard or a cast.
|
|
1344
|
+
*
|
|
1345
|
+
* `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
|
|
1346
|
+
* the legacy renderer before either callback can run, so a callback never sees WebGL.
|
|
1316
1347
|
*/
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1348
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1349
|
+
renderPipeline: ThreeRenderPipeline
|
|
1350
|
+
passes: PassRecord & { scenePass: ScenePassNode }
|
|
1351
|
+
renderer: three_webgpu.WebGPURenderer
|
|
1352
|
+
isLegacy: false
|
|
1353
|
+
}
|
|
1322
1354
|
|
|
1323
|
-
declare global {
|
|
1324
1355
|
/**
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
* is
|
|
1356
|
+
* What a callback may return to register entries into `state.passes`.
|
|
1357
|
+
*
|
|
1358
|
+
* `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
|
|
1359
|
+
* created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
|
|
1360
|
+
* store entry would leave the store pointing at a node the hook never disposes, and the hook
|
|
1361
|
+
* disposing a pass nothing references. So returning it is a type error.
|
|
1328
1362
|
*/
|
|
1329
|
-
type
|
|
1330
|
-
|
|
1331
|
-
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1332
|
-
type PassRecord = Record<string, any>
|
|
1363
|
+
type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
|
|
1333
1364
|
|
|
1334
1365
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1335
|
-
type RenderPipelineSetupCallback = (state:
|
|
1366
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1336
1367
|
|
|
1337
1368
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1338
|
-
type RenderPipelineMainCallback = (state:
|
|
1369
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1339
1370
|
|
|
1340
|
-
/**
|
|
1341
|
-
interface
|
|
1371
|
+
/** The imperative half of useRenderPipeline's return value, present in every state */
|
|
1372
|
+
interface UseRenderPipelineActions {
|
|
1342
1373
|
/** Current passes from state */
|
|
1343
1374
|
passes: PassRecord
|
|
1344
|
-
/** RenderPipeline instance (null if not initialized) */
|
|
1345
|
-
renderPipeline: ThreeRenderPipeline | null
|
|
1346
1375
|
/** Clear all passes from state */
|
|
1347
1376
|
clearPasses: () => void
|
|
1348
1377
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1349
1378
|
reset: () => void
|
|
1350
1379
|
/** Re-run setup/main callbacks with current closure values */
|
|
1351
1380
|
rebuild: () => void
|
|
1352
|
-
/** True when RenderPipeline is configured and ready */
|
|
1353
|
-
isReady: boolean
|
|
1354
1381
|
}
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Return type for useRenderPipeline hook, discriminated on `isReady`.
|
|
1385
|
+
*
|
|
1386
|
+
* `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
|
|
1387
|
+
* callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
|
|
1388
|
+
* `clearPasses()` empties the record while leaving the pipeline in place.
|
|
1389
|
+
*/
|
|
1390
|
+
type UseRenderPipelineReturn = UseRenderPipelineActions &
|
|
1391
|
+
(
|
|
1392
|
+
| {
|
|
1393
|
+
/** True when RenderPipeline is configured and ready */
|
|
1394
|
+
isReady: true
|
|
1395
|
+
/** RenderPipeline instance */
|
|
1396
|
+
renderPipeline: ThreeRenderPipeline
|
|
1397
|
+
}
|
|
1398
|
+
| {
|
|
1399
|
+
/** False until the pipeline has been created */
|
|
1400
|
+
isReady: false
|
|
1401
|
+
/** Not initialized yet, or torn down by reset() */
|
|
1402
|
+
renderPipeline: null
|
|
1403
|
+
}
|
|
1404
|
+
)
|
|
1355
1405
|
}
|
|
1356
1406
|
|
|
1357
1407
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
@@ -1430,10 +1480,11 @@ type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
|
|
|
1430
1480
|
|
|
1431
1481
|
/**
|
|
1432
1482
|
* For node material properties (colorNode, positionNode, etc.), accept broader types
|
|
1433
|
-
* since @types/three has broken inheritance for TSL node subclasses.
|
|
1483
|
+
* since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
|
|
1484
|
+
* `nodeType`, so this structural key test remains neutral to the selected Three entry.
|
|
1434
1485
|
*/
|
|
1435
1486
|
type NodeProps<P> = {
|
|
1436
|
-
[K in keyof P as P[K] extends
|
|
1487
|
+
[K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
|
|
1437
1488
|
}
|
|
1438
1489
|
|
|
1439
1490
|
interface ReactProps<P> {
|
|
@@ -1454,11 +1505,30 @@ type ThreeToJSXElements<T extends Record<string, any>> = {
|
|
|
1454
1505
|
[K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
|
|
1455
1506
|
}
|
|
1456
1507
|
|
|
1508
|
+
/** Method names of Object3D, excluded from the `primitive` element's typed props. */
|
|
1509
|
+
type Object3DMethod = NonNullable<
|
|
1510
|
+
{
|
|
1511
|
+
[K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
|
|
1512
|
+
}[keyof Object3D]
|
|
1513
|
+
>
|
|
1514
|
+
|
|
1457
1515
|
type ThreeExports = typeof import('three') & typeof import('three/webgpu')
|
|
1458
1516
|
type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
|
|
1459
1517
|
|
|
1460
1518
|
interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
|
|
1461
|
-
|
|
1519
|
+
/**
|
|
1520
|
+
* `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
|
|
1521
|
+
* Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
|
|
1522
|
+
* untyped, and any other prop is accepted and applied to the object by name. Object3D's own
|
|
1523
|
+
* methods are left out of the typed surface: they return `this`, so a subclass element's
|
|
1524
|
+
* props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
|
|
1525
|
+
*/
|
|
1526
|
+
primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | 'onUpdate' | Object3DMethod> & {
|
|
1527
|
+
object: object
|
|
1528
|
+
ref?: React.Ref<any>
|
|
1529
|
+
onUpdate?: (self: any) => void
|
|
1530
|
+
[prop: string]: unknown
|
|
1531
|
+
}
|
|
1462
1532
|
// Conflicts with DOM types can be accessed through a three* prefix
|
|
1463
1533
|
threeAudio: ThreeElementsImpl['audio']
|
|
1464
1534
|
threeSource: ThreeElementsImpl['source']
|
|
@@ -1499,6 +1569,7 @@ type three_d_Matrix3 = Matrix3;
|
|
|
1499
1569
|
type three_d_Matrix4 = Matrix4;
|
|
1500
1570
|
type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
|
|
1501
1571
|
type three_d_NodeProps<P> = NodeProps<P>;
|
|
1572
|
+
type three_d_Object3DMethod = Object3DMethod;
|
|
1502
1573
|
type three_d_Quaternion = Quaternion;
|
|
1503
1574
|
type three_d_RaycastableRepresentation = RaycastableRepresentation;
|
|
1504
1575
|
type three_d_ReactProps<P> = ReactProps<P>;
|
|
@@ -1513,7 +1584,7 @@ type three_d_Vector3 = Vector3;
|
|
|
1513
1584
|
type three_d_Vector4 = Vector4;
|
|
1514
1585
|
type three_d_VectorRepresentation = VectorRepresentation;
|
|
1515
1586
|
declare namespace three_d {
|
|
1516
|
-
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 };
|
|
1587
|
+
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 };
|
|
1517
1588
|
}
|
|
1518
1589
|
|
|
1519
1590
|
/**
|
|
@@ -1862,7 +1933,7 @@ declare function createEvents(store: RootStore): {
|
|
|
1862
1933
|
processDeferredPointer: (event: DomEvent, pointerId: number) => void;
|
|
1863
1934
|
};
|
|
1864
1935
|
/** Default R3F event manager for web */
|
|
1865
|
-
declare function createPointerEvents(store: RootStore): EventManager<
|
|
1936
|
+
declare function createPointerEvents(store: RootStore): EventManager<Element>;
|
|
1866
1937
|
|
|
1867
1938
|
/**
|
|
1868
1939
|
* Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
|
|
@@ -1895,7 +1966,7 @@ declare namespace useLoader {
|
|
|
1895
1966
|
*
|
|
1896
1967
|
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1897
1968
|
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1898
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1969
|
+
* @returns Controls object with step(), stepAll(), invalidate(), pause(), resume(), isPaused, id, rootId, scheduler
|
|
1899
1970
|
*
|
|
1900
1971
|
* @example
|
|
1901
1972
|
* // Simple priority (backwards compat)
|
|
@@ -2191,7 +2262,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2191
2262
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2192
2263
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2193
2264
|
*
|
|
2194
|
-
*
|
|
2265
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2266
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2267
|
+
*
|
|
2268
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2195
2269
|
* @param frames - Number of frames to request (default: 1)
|
|
2196
2270
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2197
2271
|
*
|
|
@@ -2202,14 +2276,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2202
2276
|
* Advances the frameloop and runs render effects.
|
|
2203
2277
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2204
2278
|
*
|
|
2279
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2280
|
+
* registered root is stepped for backwards compatibility.
|
|
2281
|
+
*
|
|
2205
2282
|
* @param timestamp - The timestamp to use for this frame
|
|
2206
2283
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2207
|
-
* @param state -
|
|
2208
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2284
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2209
2285
|
*
|
|
2210
2286
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2211
2287
|
*/
|
|
2212
|
-
declare function advance(timestamp: number): void;
|
|
2288
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2213
2289
|
|
|
2214
2290
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2215
2291
|
declare function ReactReconciler<
|
|
@@ -3254,6 +3330,7 @@ declare namespace ReactReconciler {
|
|
|
3254
3330
|
|
|
3255
3331
|
declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
|
|
3256
3332
|
declare function extend<T extends Catalogue>(objects: T): void;
|
|
3333
|
+
declare function extend(objects: Record<string, unknown>): void;
|
|
3257
3334
|
declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
|
|
3258
3335
|
|
|
3259
3336
|
declare const isRenderer: (def: any) => boolean;
|
|
@@ -3697,29 +3774,44 @@ declare const hasConstructor: (object: unknown) => object is {
|
|
|
3697
3774
|
* Used to identify values that should be resolved from refs after mount.
|
|
3698
3775
|
*/
|
|
3699
3776
|
declare const FROM_REF: unique symbol;
|
|
3777
|
+
/** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
|
|
3778
|
+
interface FromRefMarker<T = unknown, R = T> {
|
|
3779
|
+
[FROM_REF]: React$1.RefObject<T | null>;
|
|
3780
|
+
/** Optional transform applied to the resolved ref before assignment. */
|
|
3781
|
+
transform?: (value: T) => R;
|
|
3782
|
+
}
|
|
3700
3783
|
/**
|
|
3701
3784
|
* Defers prop application until the referenced object is available.
|
|
3702
3785
|
* Useful for props like `target` that need sibling refs to be populated.
|
|
3703
3786
|
*
|
|
3787
|
+
* Only top-level props on a three element are resolved: a marker nested inside another value
|
|
3788
|
+
* (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
|
|
3789
|
+
* than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
|
|
3790
|
+
* what gets assigned.
|
|
3791
|
+
*
|
|
3704
3792
|
* @param ref - React ref object to resolve at mount time
|
|
3705
|
-
* @
|
|
3793
|
+
* @param transform - Optional mapping from the resolved object to the value the prop expects
|
|
3794
|
+
* @returns A marker value that the reconciler resolves after mount
|
|
3706
3795
|
*
|
|
3707
3796
|
* @example
|
|
3708
3797
|
* const targetRef = useRef<THREE.Object3D>(null)
|
|
3709
3798
|
*
|
|
3710
3799
|
* <group ref={targetRef} position={[-3, -2, -15]} />
|
|
3711
3800
|
* <spotLight target={fromRef(targetRef)} intensity={100} />
|
|
3801
|
+
*
|
|
3802
|
+
* @example
|
|
3803
|
+
* // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
|
|
3804
|
+
* <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
|
|
3712
3805
|
*/
|
|
3713
3806
|
declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
|
|
3807
|
+
declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
|
|
3714
3808
|
/**
|
|
3715
3809
|
* Type guard to check if a value is a fromRef marker.
|
|
3716
3810
|
*
|
|
3717
3811
|
* @param value - Value to check
|
|
3718
3812
|
* @returns True if value is a fromRef marker
|
|
3719
3813
|
*/
|
|
3720
|
-
declare function isFromRef(value: unknown): value is
|
|
3721
|
-
[FROM_REF]: React$1.RefObject<any>;
|
|
3722
|
-
};
|
|
3814
|
+
declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
|
|
3723
3815
|
|
|
3724
3816
|
/**
|
|
3725
3817
|
* Symbol marker for mount-only method calls.
|
|
@@ -3746,7 +3838,15 @@ declare const ONCE: unique symbol;
|
|
|
3746
3838
|
* // No arguments
|
|
3747
3839
|
* <geometry center={once()} />
|
|
3748
3840
|
*/
|
|
3749
|
-
declare function once<
|
|
3841
|
+
declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
|
|
3842
|
+
/**
|
|
3843
|
+
* What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
|
|
3844
|
+
* the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
|
|
3845
|
+
* methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
|
|
3846
|
+
*
|
|
3847
|
+
* The runtime value is always the marker object; only the declared type follows the prop.
|
|
3848
|
+
*/
|
|
3849
|
+
type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
|
|
3750
3850
|
/**
|
|
3751
3851
|
* Type guard to check if a value is a once marker.
|
|
3752
3852
|
*
|
|
@@ -3764,4 +3864,4 @@ declare function isOnce(value: unknown): value is {
|
|
|
3764
3864
|
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3765
3865
|
|
|
3766
3866
|
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 };
|
|
3767
|
-
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 };
|
|
3867
|
+
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 };
|