@react-three/fiber 10.0.0-canary.2c50459 → 10.0.0-canary.471df95
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 +2624 -2343
- package/dist/index.d.cts +106 -43
- package/dist/index.d.mts +106 -43
- package/dist/index.d.ts +106 -43
- package/dist/index.mjs +2627 -2346
- package/dist/legacy.cjs +2511 -2235
- package/dist/legacy.d.cts +105 -45
- package/dist/legacy.d.mts +105 -45
- package/dist/legacy.d.ts +105 -45
- package/dist/legacy.mjs +2513 -2237
- package/dist/webgpu/index.cjs +2960 -2895
- package/dist/webgpu/index.d.cts +160 -95
- package/dist/webgpu/index.d.mts +160 -95
- package/dist/webgpu/index.d.ts +160 -95
- package/dist/webgpu/index.mjs +2799 -2734
- package/package.json +6 -6
- package/readme.md +1 -2
- 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.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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 { RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera } from 'three/webgpu';
|
|
3
|
+
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera } from 'three/webgpu';
|
|
3
4
|
import * as THREE$1 from 'three';
|
|
4
|
-
import { WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
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';
|
|
6
7
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
7
8
|
import * as React$1 from 'react';
|
|
@@ -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,15 +48,22 @@ 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,
|
|
56
|
+
CubeRenderTarget: CubeRenderTarget,
|
|
57
|
+
CubeRenderTargetCompat: CubeRenderTarget,
|
|
53
58
|
Inspector: Inspector,
|
|
54
59
|
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
55
60
|
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
56
61
|
RenderTargetCompat: RenderTarget,
|
|
62
|
+
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
57
63
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
58
64
|
WebGLRenderer: WebGLRenderer,
|
|
59
|
-
WebGLRendererParameters: WebGLRendererParameters
|
|
65
|
+
WebGLRendererParameters: WebGLRendererParameters,
|
|
66
|
+
loadInspector: loadInspector
|
|
60
67
|
}, [three_webgpu]);
|
|
61
68
|
|
|
62
69
|
//* Utility Types ==============================
|
|
@@ -494,9 +501,21 @@ interface InternalState {
|
|
|
494
501
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
495
502
|
*/
|
|
496
503
|
canvasTarget?: CanvasTarget
|
|
504
|
+
/**
|
|
505
|
+
* Set when this root's canvas target has been resized and the backend's cached render pass
|
|
506
|
+
* descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
|
|
507
|
+
*
|
|
508
|
+
* Flushed by the canvas-target job in the `start` phase, which is the only place this root's
|
|
509
|
+
* target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
|
|
510
|
+
* whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
|
|
511
|
+
* invalidate some other canvas's descriptor instead.
|
|
512
|
+
*
|
|
513
|
+
* @see https://github.com/pmndrs/react-three-fiber/issues/3847
|
|
514
|
+
*/
|
|
515
|
+
canvasTargetSizeDirty?: boolean
|
|
497
516
|
/**
|
|
498
517
|
* Whether multi-canvas rendering is active.
|
|
499
|
-
* True when any canvas uses `
|
|
518
|
+
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
500
519
|
* When true, setCanvasTarget is called before each render.
|
|
501
520
|
*/
|
|
502
521
|
isMultiCanvas?: boolean
|
|
@@ -594,8 +613,8 @@ interface RootState {
|
|
|
594
613
|
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
595
614
|
/** Shortcut to manual setting the pixel ratio */
|
|
596
615
|
setDpr: (dpr: Dpr) => void
|
|
597
|
-
/** Shortcut to setting frameloop flags */
|
|
598
|
-
setFrameloop: (frameloop
|
|
616
|
+
/** Shortcut to setting frameloop flags. No args resets to 'always'. */
|
|
617
|
+
setFrameloop: (frameloop?: Frameloop) => void
|
|
599
618
|
/** Set error state to propagate to error boundary */
|
|
600
619
|
setError: (error: Error | null) => void
|
|
601
620
|
/** Current error state (null when no error) */
|
|
@@ -613,7 +632,7 @@ interface RootState {
|
|
|
613
632
|
/** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
|
|
614
633
|
_textureRefs: Map<string, number>
|
|
615
634
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
616
|
-
renderPipeline:
|
|
635
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
617
636
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
618
637
|
passes: Record<string, any>
|
|
619
638
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
@@ -906,8 +925,6 @@ interface Instance<O = any> {
|
|
|
906
925
|
attach?: AttachType<O>
|
|
907
926
|
previousAttach?: any
|
|
908
927
|
isHidden: boolean
|
|
909
|
-
/** Deferred ref props to apply in commitMount */
|
|
910
|
-
deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
|
|
911
928
|
/** Set of props that have been applied via once() */
|
|
912
929
|
appliedOnce?: Set<string>
|
|
913
930
|
}
|
|
@@ -1144,10 +1161,21 @@ type RenderTargetOptions = RenderTargetOptions$1
|
|
|
1144
1161
|
//* Global Types ==============================
|
|
1145
1162
|
|
|
1146
1163
|
declare global {
|
|
1147
|
-
/**
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* Uniform node type.
|
|
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.
|
|
1177
|
+
*/
|
|
1178
|
+
type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
|
|
1151
1179
|
|
|
1152
1180
|
/**
|
|
1153
1181
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1292,28 +1320,34 @@ declare module 'three/tsl' {
|
|
|
1292
1320
|
): ShaderCallable<R>
|
|
1293
1321
|
}
|
|
1294
1322
|
|
|
1295
|
-
/**
|
|
1296
|
-
* RenderPipeline Types for useRenderPipeline hook (WebGPU only)
|
|
1297
|
-
*/
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
1323
|
declare global {
|
|
1324
|
+
/**
|
|
1325
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1326
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1327
|
+
* is r185, so the new name is the only one.
|
|
1328
|
+
*/
|
|
1329
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1330
|
+
|
|
1302
1331
|
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1303
1332
|
type PassRecord = Record<string, any>
|
|
1304
1333
|
|
|
1334
|
+
/** State passed to pipeline callbacks after the active pipeline has been created */
|
|
1335
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1336
|
+
renderPipeline: ThreeRenderPipeline
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1305
1339
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1306
|
-
type RenderPipelineSetupCallback = (state:
|
|
1340
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => PassRecord | void
|
|
1307
1341
|
|
|
1308
1342
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1309
|
-
type RenderPipelineMainCallback = (state:
|
|
1343
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => PassRecord | void
|
|
1310
1344
|
|
|
1311
1345
|
/** Return type for useRenderPipeline hook */
|
|
1312
1346
|
interface UseRenderPipelineReturn {
|
|
1313
1347
|
/** Current passes from state */
|
|
1314
1348
|
passes: PassRecord
|
|
1315
1349
|
/** RenderPipeline instance (null if not initialized) */
|
|
1316
|
-
renderPipeline:
|
|
1350
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
1317
1351
|
/** Clear all passes from state */
|
|
1318
1352
|
clearPasses: () => void
|
|
1319
1353
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
@@ -1494,7 +1528,7 @@ declare namespace three_d {
|
|
|
1494
1528
|
* a single WebGPURenderer using Three.js CanvasTarget API.
|
|
1495
1529
|
*
|
|
1496
1530
|
* Primary canvas: Has `id` prop, creates its own renderer, registers here
|
|
1497
|
-
* Secondary canvas: Has `
|
|
1531
|
+
* Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
|
|
1498
1532
|
*/
|
|
1499
1533
|
|
|
1500
1534
|
interface PrimaryCanvasEntry {
|
|
@@ -1562,12 +1596,23 @@ type EnvironmentLoaderProps = {
|
|
|
1562
1596
|
* const texture = useEnvironment({ preset: 'sunset' })
|
|
1563
1597
|
* ```
|
|
1564
1598
|
*/
|
|
1565
|
-
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture
|
|
1599
|
+
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
|
|
1566
1600
|
declare namespace useEnvironment {
|
|
1567
1601
|
var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
|
|
1568
1602
|
var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
|
|
1569
1603
|
}
|
|
1570
|
-
|
|
1604
|
+
/**
|
|
1605
|
+
* Options accepted by `useEnvironment.preload`.
|
|
1606
|
+
*
|
|
1607
|
+
* `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
|
|
1608
|
+
* applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
|
|
1609
|
+
* advertise an option this function silently ignores.
|
|
1610
|
+
*
|
|
1611
|
+
* This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
|
|
1612
|
+
* `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
|
|
1613
|
+
* type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
|
|
1614
|
+
*/
|
|
1615
|
+
type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
|
|
1571
1616
|
type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
|
|
1572
1617
|
|
|
1573
1618
|
/**
|
|
@@ -1611,9 +1656,9 @@ type EnvironmentProps = {
|
|
|
1611
1656
|
blur?: number;
|
|
1612
1657
|
backgroundBlurriness?: number;
|
|
1613
1658
|
backgroundIntensity?: number;
|
|
1614
|
-
backgroundRotation?: Euler
|
|
1659
|
+
backgroundRotation?: Euler;
|
|
1615
1660
|
environmentIntensity?: number;
|
|
1616
|
-
environmentRotation?: Euler
|
|
1661
|
+
environmentRotation?: Euler;
|
|
1617
1662
|
map?: Texture$1;
|
|
1618
1663
|
preset?: PresetsType;
|
|
1619
1664
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -1697,7 +1742,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
1697
1742
|
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;
|
|
1698
1743
|
declare module '@react-three/fiber' {
|
|
1699
1744
|
interface ThreeElements {
|
|
1700
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1745
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
1701
1746
|
}
|
|
1702
1747
|
}
|
|
1703
1748
|
/**
|
|
@@ -1797,6 +1842,24 @@ declare module '@react-three/fiber' {
|
|
|
1797
1842
|
*/
|
|
1798
1843
|
declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
1799
1844
|
|
|
1845
|
+
/**
|
|
1846
|
+
* Moves every trace of interactivity from one object to its replacement, for reconstruction.
|
|
1847
|
+
*
|
|
1848
|
+
* When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
|
|
1849
|
+
* instance. Removing the old object from the interaction state and registering the new one from
|
|
1850
|
+
* scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
|
|
1851
|
+
* the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
|
|
1852
|
+
* is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
|
|
1853
|
+
* swap the user never asked to see (#3744).
|
|
1854
|
+
*
|
|
1855
|
+
* Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
|
|
1856
|
+
* left alone — releasing and re-acquiring it is precisely the glitch being avoided.
|
|
1857
|
+
*
|
|
1858
|
+
* Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
|
|
1859
|
+
* the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
|
|
1860
|
+
* cannot outlive the object it described.
|
|
1861
|
+
*/
|
|
1862
|
+
declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
|
|
1800
1863
|
declare function removeInteractivity(store: RootStore, object: Object3D): void;
|
|
1801
1864
|
declare function createEvents(store: RootStore): {
|
|
1802
1865
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
@@ -1817,10 +1880,10 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
|
|
|
1817
1880
|
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1818
1881
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1819
1882
|
*/
|
|
1820
|
-
declare function useLoader<I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void): I extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
|
|
1883
|
+
declare function useLoader<I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cacheKey?: InputLike): I extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
|
|
1821
1884
|
declare namespace useLoader {
|
|
1822
|
-
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
|
|
1823
|
-
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
|
|
1885
|
+
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cacheKey?: InputLike) => void;
|
|
1886
|
+
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
|
|
1824
1887
|
var loader: typeof getLoader;
|
|
1825
1888
|
}
|
|
1826
1889
|
|
|
@@ -1837,7 +1900,7 @@ declare namespace useLoader {
|
|
|
1837
1900
|
*
|
|
1838
1901
|
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1839
1902
|
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1840
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1903
|
+
* @returns Controls object with step(), stepAll(), invalidate(), pause(), resume(), isPaused, id, rootId, scheduler
|
|
1841
1904
|
*
|
|
1842
1905
|
* @example
|
|
1843
1906
|
* // Simple priority (backwards compat)
|
|
@@ -2133,7 +2196,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2133
2196
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2134
2197
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2135
2198
|
*
|
|
2136
|
-
*
|
|
2199
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2200
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2201
|
+
*
|
|
2202
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2137
2203
|
* @param frames - Number of frames to request (default: 1)
|
|
2138
2204
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2139
2205
|
*
|
|
@@ -2144,14 +2210,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2144
2210
|
* Advances the frameloop and runs render effects.
|
|
2145
2211
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2146
2212
|
*
|
|
2213
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2214
|
+
* registered root is stepped for backwards compatibility.
|
|
2215
|
+
*
|
|
2147
2216
|
* @param timestamp - The timestamp to use for this frame
|
|
2148
2217
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2149
|
-
* @param state -
|
|
2150
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2218
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2151
2219
|
*
|
|
2152
2220
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2153
2221
|
*/
|
|
2154
|
-
declare function advance(timestamp: number): void;
|
|
2222
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2155
2223
|
|
|
2156
2224
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2157
2225
|
declare function ReactReconciler<
|
|
@@ -3222,11 +3290,6 @@ declare function flushSync<R>(fn: () => R): R;
|
|
|
3222
3290
|
declare const context: React$1.Context<RootStore>;
|
|
3223
3291
|
declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
|
|
3224
3292
|
|
|
3225
|
-
/**
|
|
3226
|
-
* Safely flush async effects when testing, simulating a legacy root.
|
|
3227
|
-
* @deprecated Import from React instead. import { act } from 'react'
|
|
3228
|
-
*/
|
|
3229
|
-
declare const act: typeof React$1.act;
|
|
3230
3293
|
/**
|
|
3231
3294
|
* An SSR-friendly useLayoutEffect.
|
|
3232
3295
|
*
|
|
@@ -3710,5 +3773,5 @@ declare function isOnce(value: unknown): value is {
|
|
|
3710
3773
|
*/
|
|
3711
3774
|
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3712
3775
|
|
|
3713
|
-
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,
|
|
3776
|
+
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 };
|
|
3714
3777
|
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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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 { RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera } from 'three/webgpu';
|
|
3
|
+
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera } from 'three/webgpu';
|
|
3
4
|
import * as THREE$1 from 'three';
|
|
4
|
-
import { WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
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';
|
|
6
7
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
7
8
|
import * as React$1 from 'react';
|
|
@@ -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,15 +48,22 @@ 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,
|
|
56
|
+
CubeRenderTarget: CubeRenderTarget,
|
|
57
|
+
CubeRenderTargetCompat: CubeRenderTarget,
|
|
53
58
|
Inspector: Inspector,
|
|
54
59
|
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
55
60
|
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
56
61
|
RenderTargetCompat: RenderTarget,
|
|
62
|
+
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
57
63
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
58
64
|
WebGLRenderer: WebGLRenderer,
|
|
59
|
-
WebGLRendererParameters: WebGLRendererParameters
|
|
65
|
+
WebGLRendererParameters: WebGLRendererParameters,
|
|
66
|
+
loadInspector: loadInspector
|
|
60
67
|
}, [three_webgpu]);
|
|
61
68
|
|
|
62
69
|
//* Utility Types ==============================
|
|
@@ -494,9 +501,21 @@ interface InternalState {
|
|
|
494
501
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
495
502
|
*/
|
|
496
503
|
canvasTarget?: CanvasTarget
|
|
504
|
+
/**
|
|
505
|
+
* Set when this root's canvas target has been resized and the backend's cached render pass
|
|
506
|
+
* descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
|
|
507
|
+
*
|
|
508
|
+
* Flushed by the canvas-target job in the `start` phase, which is the only place this root's
|
|
509
|
+
* target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
|
|
510
|
+
* whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
|
|
511
|
+
* invalidate some other canvas's descriptor instead.
|
|
512
|
+
*
|
|
513
|
+
* @see https://github.com/pmndrs/react-three-fiber/issues/3847
|
|
514
|
+
*/
|
|
515
|
+
canvasTargetSizeDirty?: boolean
|
|
497
516
|
/**
|
|
498
517
|
* Whether multi-canvas rendering is active.
|
|
499
|
-
* True when any canvas uses `
|
|
518
|
+
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
500
519
|
* When true, setCanvasTarget is called before each render.
|
|
501
520
|
*/
|
|
502
521
|
isMultiCanvas?: boolean
|
|
@@ -594,8 +613,8 @@ interface RootState {
|
|
|
594
613
|
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
595
614
|
/** Shortcut to manual setting the pixel ratio */
|
|
596
615
|
setDpr: (dpr: Dpr) => void
|
|
597
|
-
/** Shortcut to setting frameloop flags */
|
|
598
|
-
setFrameloop: (frameloop
|
|
616
|
+
/** Shortcut to setting frameloop flags. No args resets to 'always'. */
|
|
617
|
+
setFrameloop: (frameloop?: Frameloop) => void
|
|
599
618
|
/** Set error state to propagate to error boundary */
|
|
600
619
|
setError: (error: Error | null) => void
|
|
601
620
|
/** Current error state (null when no error) */
|
|
@@ -613,7 +632,7 @@ interface RootState {
|
|
|
613
632
|
/** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
|
|
614
633
|
_textureRefs: Map<string, number>
|
|
615
634
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
616
|
-
renderPipeline:
|
|
635
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
617
636
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
618
637
|
passes: Record<string, any>
|
|
619
638
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
@@ -906,8 +925,6 @@ interface Instance<O = any> {
|
|
|
906
925
|
attach?: AttachType<O>
|
|
907
926
|
previousAttach?: any
|
|
908
927
|
isHidden: boolean
|
|
909
|
-
/** Deferred ref props to apply in commitMount */
|
|
910
|
-
deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
|
|
911
928
|
/** Set of props that have been applied via once() */
|
|
912
929
|
appliedOnce?: Set<string>
|
|
913
930
|
}
|
|
@@ -1144,10 +1161,21 @@ type RenderTargetOptions = RenderTargetOptions$1
|
|
|
1144
1161
|
//* Global Types ==============================
|
|
1145
1162
|
|
|
1146
1163
|
declare global {
|
|
1147
|
-
/**
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* Uniform node type.
|
|
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.
|
|
1177
|
+
*/
|
|
1178
|
+
type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
|
|
1151
1179
|
|
|
1152
1180
|
/**
|
|
1153
1181
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1292,28 +1320,34 @@ declare module 'three/tsl' {
|
|
|
1292
1320
|
): ShaderCallable<R>
|
|
1293
1321
|
}
|
|
1294
1322
|
|
|
1295
|
-
/**
|
|
1296
|
-
* RenderPipeline Types for useRenderPipeline hook (WebGPU only)
|
|
1297
|
-
*/
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
1323
|
declare global {
|
|
1324
|
+
/**
|
|
1325
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1326
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1327
|
+
* is r185, so the new name is the only one.
|
|
1328
|
+
*/
|
|
1329
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1330
|
+
|
|
1302
1331
|
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1303
1332
|
type PassRecord = Record<string, any>
|
|
1304
1333
|
|
|
1334
|
+
/** State passed to pipeline callbacks after the active pipeline has been created */
|
|
1335
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1336
|
+
renderPipeline: ThreeRenderPipeline
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1305
1339
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1306
|
-
type RenderPipelineSetupCallback = (state:
|
|
1340
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => PassRecord | void
|
|
1307
1341
|
|
|
1308
1342
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1309
|
-
type RenderPipelineMainCallback = (state:
|
|
1343
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => PassRecord | void
|
|
1310
1344
|
|
|
1311
1345
|
/** Return type for useRenderPipeline hook */
|
|
1312
1346
|
interface UseRenderPipelineReturn {
|
|
1313
1347
|
/** Current passes from state */
|
|
1314
1348
|
passes: PassRecord
|
|
1315
1349
|
/** RenderPipeline instance (null if not initialized) */
|
|
1316
|
-
renderPipeline:
|
|
1350
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
1317
1351
|
/** Clear all passes from state */
|
|
1318
1352
|
clearPasses: () => void
|
|
1319
1353
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
@@ -1494,7 +1528,7 @@ declare namespace three_d {
|
|
|
1494
1528
|
* a single WebGPURenderer using Three.js CanvasTarget API.
|
|
1495
1529
|
*
|
|
1496
1530
|
* Primary canvas: Has `id` prop, creates its own renderer, registers here
|
|
1497
|
-
* Secondary canvas: Has `
|
|
1531
|
+
* Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
|
|
1498
1532
|
*/
|
|
1499
1533
|
|
|
1500
1534
|
interface PrimaryCanvasEntry {
|
|
@@ -1562,12 +1596,23 @@ type EnvironmentLoaderProps = {
|
|
|
1562
1596
|
* const texture = useEnvironment({ preset: 'sunset' })
|
|
1563
1597
|
* ```
|
|
1564
1598
|
*/
|
|
1565
|
-
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture
|
|
1599
|
+
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
|
|
1566
1600
|
declare namespace useEnvironment {
|
|
1567
1601
|
var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
|
|
1568
1602
|
var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
|
|
1569
1603
|
}
|
|
1570
|
-
|
|
1604
|
+
/**
|
|
1605
|
+
* Options accepted by `useEnvironment.preload`.
|
|
1606
|
+
*
|
|
1607
|
+
* `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
|
|
1608
|
+
* applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
|
|
1609
|
+
* advertise an option this function silently ignores.
|
|
1610
|
+
*
|
|
1611
|
+
* This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
|
|
1612
|
+
* `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
|
|
1613
|
+
* type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
|
|
1614
|
+
*/
|
|
1615
|
+
type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
|
|
1571
1616
|
type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
|
|
1572
1617
|
|
|
1573
1618
|
/**
|
|
@@ -1611,9 +1656,9 @@ type EnvironmentProps = {
|
|
|
1611
1656
|
blur?: number;
|
|
1612
1657
|
backgroundBlurriness?: number;
|
|
1613
1658
|
backgroundIntensity?: number;
|
|
1614
|
-
backgroundRotation?: Euler
|
|
1659
|
+
backgroundRotation?: Euler;
|
|
1615
1660
|
environmentIntensity?: number;
|
|
1616
|
-
environmentRotation?: Euler
|
|
1661
|
+
environmentRotation?: Euler;
|
|
1617
1662
|
map?: Texture$1;
|
|
1618
1663
|
preset?: PresetsType;
|
|
1619
1664
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -1697,7 +1742,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
1697
1742
|
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;
|
|
1698
1743
|
declare module '@react-three/fiber' {
|
|
1699
1744
|
interface ThreeElements {
|
|
1700
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1745
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
1701
1746
|
}
|
|
1702
1747
|
}
|
|
1703
1748
|
/**
|
|
@@ -1797,6 +1842,24 @@ declare module '@react-three/fiber' {
|
|
|
1797
1842
|
*/
|
|
1798
1843
|
declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
1799
1844
|
|
|
1845
|
+
/**
|
|
1846
|
+
* Moves every trace of interactivity from one object to its replacement, for reconstruction.
|
|
1847
|
+
*
|
|
1848
|
+
* When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
|
|
1849
|
+
* instance. Removing the old object from the interaction state and registering the new one from
|
|
1850
|
+
* scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
|
|
1851
|
+
* the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
|
|
1852
|
+
* is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
|
|
1853
|
+
* swap the user never asked to see (#3744).
|
|
1854
|
+
*
|
|
1855
|
+
* Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
|
|
1856
|
+
* left alone — releasing and re-acquiring it is precisely the glitch being avoided.
|
|
1857
|
+
*
|
|
1858
|
+
* Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
|
|
1859
|
+
* the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
|
|
1860
|
+
* cannot outlive the object it described.
|
|
1861
|
+
*/
|
|
1862
|
+
declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
|
|
1800
1863
|
declare function removeInteractivity(store: RootStore, object: Object3D): void;
|
|
1801
1864
|
declare function createEvents(store: RootStore): {
|
|
1802
1865
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
@@ -1817,10 +1880,10 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
|
|
|
1817
1880
|
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1818
1881
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1819
1882
|
*/
|
|
1820
|
-
declare function useLoader<I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void): I extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
|
|
1883
|
+
declare function useLoader<I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cacheKey?: InputLike): I extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
|
|
1821
1884
|
declare namespace useLoader {
|
|
1822
|
-
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
|
|
1823
|
-
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
|
|
1885
|
+
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cacheKey?: InputLike) => void;
|
|
1886
|
+
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
|
|
1824
1887
|
var loader: typeof getLoader;
|
|
1825
1888
|
}
|
|
1826
1889
|
|
|
@@ -1837,7 +1900,7 @@ declare namespace useLoader {
|
|
|
1837
1900
|
*
|
|
1838
1901
|
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1839
1902
|
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1840
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1903
|
+
* @returns Controls object with step(), stepAll(), invalidate(), pause(), resume(), isPaused, id, rootId, scheduler
|
|
1841
1904
|
*
|
|
1842
1905
|
* @example
|
|
1843
1906
|
* // Simple priority (backwards compat)
|
|
@@ -2133,7 +2196,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2133
2196
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2134
2197
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2135
2198
|
*
|
|
2136
|
-
*
|
|
2199
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2200
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2201
|
+
*
|
|
2202
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2137
2203
|
* @param frames - Number of frames to request (default: 1)
|
|
2138
2204
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2139
2205
|
*
|
|
@@ -2144,14 +2210,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2144
2210
|
* Advances the frameloop and runs render effects.
|
|
2145
2211
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2146
2212
|
*
|
|
2213
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2214
|
+
* registered root is stepped for backwards compatibility.
|
|
2215
|
+
*
|
|
2147
2216
|
* @param timestamp - The timestamp to use for this frame
|
|
2148
2217
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2149
|
-
* @param state -
|
|
2150
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2218
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2151
2219
|
*
|
|
2152
2220
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2153
2221
|
*/
|
|
2154
|
-
declare function advance(timestamp: number): void;
|
|
2222
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2155
2223
|
|
|
2156
2224
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2157
2225
|
declare function ReactReconciler<
|
|
@@ -3222,11 +3290,6 @@ declare function flushSync<R>(fn: () => R): R;
|
|
|
3222
3290
|
declare const context: React$1.Context<RootStore>;
|
|
3223
3291
|
declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
|
|
3224
3292
|
|
|
3225
|
-
/**
|
|
3226
|
-
* Safely flush async effects when testing, simulating a legacy root.
|
|
3227
|
-
* @deprecated Import from React instead. import { act } from 'react'
|
|
3228
|
-
*/
|
|
3229
|
-
declare const act: typeof React$1.act;
|
|
3230
3293
|
/**
|
|
3231
3294
|
* An SSR-friendly useLayoutEffect.
|
|
3232
3295
|
*
|
|
@@ -3710,5 +3773,5 @@ declare function isOnce(value: unknown): value is {
|
|
|
3710
3773
|
*/
|
|
3711
3774
|
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3712
3775
|
|
|
3713
|
-
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,
|
|
3776
|
+
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 };
|
|
3714
3777
|
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 };
|