@react-three/fiber 9.0.0-rc.0 → 9.0.0-rc.2
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/CHANGELOG.md +12 -0
- package/dist/declarations/src/core/hooks.d.ts +10 -12
- package/dist/declarations/src/core/reconciler.d.ts +0 -3
- package/dist/declarations/src/core/utils.d.ts +78 -31
- package/dist/{events-5a08b43f.esm.js → events-89bb769e.esm.js} +1248 -1287
- package/dist/{events-aef54ace.cjs.prod.js → events-bcbe26a9.cjs.prod.js} +1247 -1285
- package/dist/{events-fa0fb3db.cjs.dev.js → events-ec103e1e.cjs.dev.js} +1247 -1286
- package/dist/react-three-fiber.cjs.dev.js +2 -2
- package/dist/react-three-fiber.cjs.prod.js +2 -2
- package/dist/react-three-fiber.esm.js +3 -3
- package/native/dist/react-three-fiber-native.cjs.dev.js +2 -2
- package/native/dist/react-three-fiber-native.cjs.prod.js +2 -2
- package/native/dist/react-three-fiber-native.esm.js +3 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 8.17.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ff1a16f1: fix: narrow React peer dep range
|
|
8
|
+
|
|
9
|
+
## 8.17.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7461bf0c: fix: loosen instanceof checks for CSB issue
|
|
14
|
+
|
|
3
15
|
## 8.17.10
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -2,10 +2,10 @@ import * as THREE from 'three';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { RootState, RenderCallback, RootStore } from "./store.js";
|
|
4
4
|
import { ObjectMap } from "./utils.js";
|
|
5
|
-
import type { Instance } from "./reconciler.js";
|
|
5
|
+
import type { Instance, ConstructorRepresentation } from "./reconciler.js";
|
|
6
6
|
/**
|
|
7
7
|
* Exposes an object's {@link Instance}.
|
|
8
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#
|
|
8
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
9
9
|
*
|
|
10
10
|
* **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
|
|
11
11
|
*/
|
|
@@ -31,22 +31,20 @@ export declare function useFrame(callback: RenderCallback, renderPriority?: numb
|
|
|
31
31
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
|
|
32
32
|
*/
|
|
33
33
|
export declare function useGraph(object: THREE.Object3D): ObjectMap;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
export type LoaderProto<T> = new (...args: any[]) => Loader<T>;
|
|
38
|
-
export type LoaderResult<T> = T extends {
|
|
34
|
+
type LoaderInstance<T extends THREE.Loader<any> | ConstructorRepresentation<THREE.Loader<any>>> = T extends ConstructorRepresentation<THREE.Loader<any>> ? InstanceType<T> : T;
|
|
35
|
+
export type LoaderResult<T extends THREE.Loader<any> | ConstructorRepresentation<THREE.Loader<any>>> = Awaited<ReturnType<LoaderInstance<T>['loadAsync']>> extends infer R ? R extends {
|
|
39
36
|
scene: THREE.Object3D;
|
|
40
|
-
} ?
|
|
41
|
-
export type Extensions<T> = (loader:
|
|
37
|
+
} ? R & ObjectMap : R : never;
|
|
38
|
+
export type Extensions<T extends THREE.Loader<any> | ConstructorRepresentation<THREE.Loader<any>>> = (loader: LoaderInstance<T>) => void;
|
|
42
39
|
/**
|
|
43
40
|
* Synchronously loads and caches assets with a three loader.
|
|
44
41
|
*
|
|
45
42
|
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
46
43
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
47
44
|
*/
|
|
48
|
-
export declare function useLoader<T, U extends string | string[] | string[][]
|
|
45
|
+
export declare function useLoader<T, U extends string | string[] | string[][], L extends THREE.Loader<any> | ConstructorRepresentation<THREE.Loader<any>>>(loader: L, input: U, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void): U extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
|
|
49
46
|
export declare namespace useLoader {
|
|
50
|
-
var preload: <T, U extends string | string[] | string[][]
|
|
51
|
-
var clear: <T, U extends string | string[] | string[][]
|
|
47
|
+
var preload: <T, U extends string | string[] | string[][], L extends THREE.Loader<any, string> | ConstructorRepresentation<THREE.Loader<any, string>>>(loader: L, input: U, extensions?: Extensions<L> | undefined) => void;
|
|
48
|
+
var clear: <T, U extends string | string[] | string[][], L extends THREE.Loader<any, string> | ConstructorRepresentation<THREE.Loader<any, string>>>(loader: L, input: U) => void;
|
|
52
49
|
}
|
|
50
|
+
export {};
|
|
@@ -5,9 +5,6 @@ import { IsAllOptional } from "./utils.js";
|
|
|
5
5
|
import type { RootStore } from "./store.js";
|
|
6
6
|
import { type EventHandlers } from "./events.js";
|
|
7
7
|
import type { ThreeElement } from "../three-types.js";
|
|
8
|
-
declare module 'react-reconciler/constants' {
|
|
9
|
-
const NoEventPriority = 0;
|
|
10
|
-
}
|
|
11
8
|
export interface Root {
|
|
12
9
|
fiber: Reconciler.FiberRoot;
|
|
13
10
|
store: RootStore;
|
|
@@ -2,7 +2,7 @@ import * as THREE from 'three';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Instance } from "./reconciler.js";
|
|
4
4
|
import type { Fiber } from 'react-reconciler';
|
|
5
|
-
import type { Dpr,
|
|
5
|
+
import type { Dpr, RootStore, Size } from "./store.js";
|
|
6
6
|
export type NonFunctionKeys<P> = {
|
|
7
7
|
[K in keyof P]-?: P[K] extends Function ? never : K;
|
|
8
8
|
}[keyof P];
|
|
@@ -17,23 +17,6 @@ export type IsAllOptional<T extends any[]> = T extends [infer First, ...infer Re
|
|
|
17
17
|
* Returns the instance's initial (outmost) root.
|
|
18
18
|
*/
|
|
19
19
|
export declare function findInitialRoot<T>(instance: Instance<T>): RootStore;
|
|
20
|
-
/**
|
|
21
|
-
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
22
|
-
*/
|
|
23
|
-
export declare const hasColorSpace: <T extends object | THREE.Texture | Renderer, P = T extends Renderer ? {
|
|
24
|
-
outputColorSpace: string;
|
|
25
|
-
} : {
|
|
26
|
-
colorSpace: string;
|
|
27
|
-
}>(object: T) => object is T & P;
|
|
28
|
-
export type ColorManagementRepresentation = {
|
|
29
|
-
enabled: boolean | never;
|
|
30
|
-
} | {
|
|
31
|
-
legacyMode: boolean | never;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The current THREE.ColorManagement instance, if present.
|
|
35
|
-
*/
|
|
36
|
-
export declare const getColorManagement: () => ColorManagementRepresentation | null;
|
|
37
20
|
export type Act = <T = any>(cb: () => Promise<T>) => Promise<T>;
|
|
38
21
|
/**
|
|
39
22
|
* Safely flush async effects when testing, simulating a legacy root.
|
|
@@ -68,21 +51,85 @@ export type UnblockProps = {
|
|
|
68
51
|
children: React.ReactNode;
|
|
69
52
|
};
|
|
70
53
|
export declare function Block({ set }: Omit<UnblockProps, 'children'>): null;
|
|
71
|
-
export declare
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
54
|
+
export declare const ErrorBoundary: {
|
|
55
|
+
new (props: {
|
|
56
|
+
set: React.Dispatch<Error | undefined>;
|
|
57
|
+
children: React.ReactNode;
|
|
58
|
+
}): {
|
|
59
|
+
state: {
|
|
60
|
+
error: boolean;
|
|
61
|
+
};
|
|
62
|
+
componentDidCatch(err: Error): void;
|
|
63
|
+
render(): React.ReactNode;
|
|
64
|
+
context: unknown;
|
|
65
|
+
setState<K extends "error">(state: {
|
|
66
|
+
error: boolean;
|
|
67
|
+
} | ((prevState: Readonly<{
|
|
68
|
+
error: boolean;
|
|
69
|
+
}>, props: Readonly<{
|
|
70
|
+
set: React.Dispatch<Error | undefined>;
|
|
71
|
+
children: React.ReactNode;
|
|
72
|
+
}>) => {
|
|
73
|
+
error: boolean;
|
|
74
|
+
} | Pick<{
|
|
75
|
+
error: boolean;
|
|
76
|
+
}, K> | null) | Pick<{
|
|
77
|
+
error: boolean;
|
|
78
|
+
}, K> | null, callback?: (() => void) | undefined): void;
|
|
79
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
80
|
+
readonly props: Readonly<{
|
|
81
|
+
set: React.Dispatch<Error | undefined>;
|
|
82
|
+
children: React.ReactNode;
|
|
83
|
+
}>;
|
|
84
|
+
componentDidMount?(): void;
|
|
85
|
+
shouldComponentUpdate?(nextProps: Readonly<{
|
|
86
|
+
set: React.Dispatch<Error | undefined>;
|
|
87
|
+
children: React.ReactNode;
|
|
88
|
+
}>, nextState: Readonly<{
|
|
89
|
+
error: boolean;
|
|
90
|
+
}>): boolean;
|
|
91
|
+
componentWillUnmount?(): void;
|
|
92
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<{
|
|
93
|
+
set: React.Dispatch<Error | undefined>;
|
|
94
|
+
children: React.ReactNode;
|
|
95
|
+
}>, prevState: Readonly<{
|
|
96
|
+
error: boolean;
|
|
97
|
+
}>): any;
|
|
98
|
+
componentDidUpdate?(prevProps: Readonly<{
|
|
99
|
+
set: React.Dispatch<Error | undefined>;
|
|
100
|
+
children: React.ReactNode;
|
|
101
|
+
}>, prevState: Readonly<{
|
|
102
|
+
error: boolean;
|
|
103
|
+
}>, snapshot?: any): void;
|
|
104
|
+
componentWillMount?(): void;
|
|
105
|
+
UNSAFE_componentWillMount?(): void;
|
|
106
|
+
componentWillReceiveProps?(nextProps: Readonly<{
|
|
107
|
+
set: React.Dispatch<Error | undefined>;
|
|
108
|
+
children: React.ReactNode;
|
|
109
|
+
}>): void;
|
|
110
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{
|
|
111
|
+
set: React.Dispatch<Error | undefined>;
|
|
112
|
+
children: React.ReactNode;
|
|
113
|
+
}>): void;
|
|
114
|
+
componentWillUpdate?(nextProps: Readonly<{
|
|
115
|
+
set: React.Dispatch<Error | undefined>;
|
|
116
|
+
children: React.ReactNode;
|
|
117
|
+
}>, nextState: Readonly<{
|
|
118
|
+
error: boolean;
|
|
119
|
+
}>): void;
|
|
120
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<{
|
|
121
|
+
set: React.Dispatch<Error | undefined>;
|
|
122
|
+
children: React.ReactNode;
|
|
123
|
+
}>, nextState: Readonly<{
|
|
124
|
+
error: boolean;
|
|
125
|
+
}>): void;
|
|
79
126
|
};
|
|
80
|
-
|
|
127
|
+
getDerivedStateFromError: () => {
|
|
81
128
|
error: boolean;
|
|
82
129
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
130
|
+
contextType?: React.Context<any> | undefined;
|
|
131
|
+
propTypes?: any;
|
|
132
|
+
};
|
|
86
133
|
export interface ObjectMap {
|
|
87
134
|
nodes: {
|
|
88
135
|
[name: string]: THREE.Object3D;
|
|
@@ -135,4 +182,4 @@ export declare function diffProps<T = any>(instance: Instance<T>, newProps: Inst
|
|
|
135
182
|
export declare function applyProps<T = any>(object: Instance<T>['object'], props: Instance<T>['props']): Instance<T>['object'];
|
|
136
183
|
export declare function invalidateInstance(instance: Instance): void;
|
|
137
184
|
export declare function updateCamera(camera: Camera, size: Size): void;
|
|
138
|
-
export declare const isObject3D: (object: any) => object is THREE.Object3D<THREE.
|
|
185
|
+
export declare const isObject3D: (object: any) => object is THREE.Object3D<THREE.Object3DEventMap>;
|