@react-three/fiber 9.2.0 → 9.3.0
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 +1168 -1160
- package/dist/declarations/src/core/events.d.ts +92 -92
- package/dist/declarations/src/core/hooks.d.ts +53 -53
- package/dist/declarations/src/core/index.d.ts +13 -13
- package/dist/declarations/src/core/loop.d.ts +31 -31
- package/dist/declarations/src/core/reconciler.d.ts +50 -50
- package/dist/declarations/src/core/renderer.d.ts +89 -89
- package/dist/declarations/src/core/store.d.ts +130 -130
- package/dist/declarations/src/core/utils.d.ts +191 -191
- package/dist/declarations/src/index.d.ts +6 -6
- package/dist/declarations/src/native/Canvas.d.ts +13 -13
- package/dist/declarations/src/native/events.d.ts +4 -4
- package/dist/declarations/src/native.d.ts +6 -6
- package/dist/declarations/src/three-types.d.ts +68 -68
- package/dist/declarations/src/web/Canvas.d.ts +23 -23
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/dist/{events-e63d28a3.cjs.dev.js → events-d0449b76.cjs.dev.js} +91 -91
- package/dist/{events-59fae97e.cjs.prod.js → events-d0a20a9c.cjs.prod.js} +91 -91
- package/dist/{events-cf57b220.esm.js → events-e3cb66e2.esm.js} +90 -90
- package/dist/react-three-fiber.cjs.dev.js +5 -5
- package/dist/react-three-fiber.cjs.prod.js +5 -5
- package/dist/react-three-fiber.esm.js +6 -6
- package/native/dist/react-three-fiber-native.cjs.dev.js +8 -6
- package/native/dist/react-three-fiber-native.cjs.prod.js +8 -6
- package/native/dist/react-three-fiber-native.esm.js +9 -7
- package/native/package.json +5 -5
- package/package.json +2 -2
- package/readme.md +253 -253
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Instance } from "./reconciler.js";
|
|
4
|
-
import type { Fiber } from 'react-reconciler';
|
|
5
|
-
import type { Dpr, RootStore, Size } from "./store.js";
|
|
6
|
-
export type NonFunctionKeys<P> = {
|
|
7
|
-
[K in keyof P]-?: P[K] extends Function ? never : K;
|
|
8
|
-
}[keyof P];
|
|
9
|
-
export type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O;
|
|
10
|
-
export type Properties<T> = Pick<T, NonFunctionKeys<T>>;
|
|
11
|
-
export type Mutable<P> = {
|
|
12
|
-
[K in keyof P]: P[K] | Readonly<P[K]>;
|
|
13
|
-
};
|
|
14
|
-
export type IsOptional<T> = undefined extends T ? true : false;
|
|
15
|
-
export type IsAllOptional<T extends any[]> = T extends [infer First, ...infer Rest] ? IsOptional<First> extends true ? IsAllOptional<Rest> : false : true;
|
|
16
|
-
/**
|
|
17
|
-
* Returns the instance's initial (outmost) root.
|
|
18
|
-
*/
|
|
19
|
-
export declare function findInitialRoot<T>(instance: Instance<T>): RootStore;
|
|
20
|
-
export type Act = <T = any>(cb: () => Promise<T>) => Promise<T>;
|
|
21
|
-
/**
|
|
22
|
-
* Safely flush async effects when testing, simulating a legacy root.
|
|
23
|
-
* @deprecated Import from React instead. import { act } from 'react'
|
|
24
|
-
*/
|
|
25
|
-
export declare const act: Act;
|
|
26
|
-
export type Camera = (THREE.OrthographicCamera | THREE.PerspectiveCamera) & {
|
|
27
|
-
manual?: boolean;
|
|
28
|
-
};
|
|
29
|
-
export declare const isOrthographicCamera: (def: Camera) => def is THREE.OrthographicCamera;
|
|
30
|
-
export declare const isRef: (obj: any) => obj is React.RefObject<unknown>;
|
|
31
|
-
export declare const isColorRepresentation: (value: unknown) => value is THREE.ColorRepresentation;
|
|
32
|
-
/**
|
|
33
|
-
* An SSR-friendly useLayoutEffect.
|
|
34
|
-
*
|
|
35
|
-
* React currently throws a warning when using useLayoutEffect on the server.
|
|
36
|
-
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
37
|
-
* useLayoutEffect elsewhere.
|
|
38
|
-
*
|
|
39
|
-
* @see https://github.com/facebook/react/issues/14927
|
|
40
|
-
*/
|
|
41
|
-
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
42
|
-
export declare function useMutableCallback<T>(fn: T): React.RefObject<T>;
|
|
43
|
-
export type Bridge = React.FC<{
|
|
44
|
-
children?: React.ReactNode;
|
|
45
|
-
}>;
|
|
46
|
-
/**
|
|
47
|
-
* Bridges renderer Context and StrictMode from a primary renderer.
|
|
48
|
-
*/
|
|
49
|
-
export declare function useBridge(): Bridge;
|
|
50
|
-
export type SetBlock = false | Promise<null> | null;
|
|
51
|
-
export type UnblockProps = {
|
|
52
|
-
set: React.Dispatch<React.SetStateAction<SetBlock>>;
|
|
53
|
-
children: React.ReactNode;
|
|
54
|
-
};
|
|
55
|
-
export declare function Block({ set }: Omit<UnblockProps, 'children'>): null;
|
|
56
|
-
export declare const ErrorBoundary: {
|
|
57
|
-
new (props: {
|
|
58
|
-
set: React.Dispatch<Error | undefined>;
|
|
59
|
-
children: React.ReactNode;
|
|
60
|
-
}): {
|
|
61
|
-
state: {
|
|
62
|
-
error: boolean;
|
|
63
|
-
};
|
|
64
|
-
componentDidCatch(err: Error): void;
|
|
65
|
-
render(): React.ReactNode;
|
|
66
|
-
context: unknown;
|
|
67
|
-
setState<K extends "error">(state: {
|
|
68
|
-
error: boolean;
|
|
69
|
-
} | ((prevState: Readonly<{
|
|
70
|
-
error: boolean;
|
|
71
|
-
}>, props: Readonly<{
|
|
72
|
-
set: React.Dispatch<Error | undefined>;
|
|
73
|
-
children: React.ReactNode;
|
|
74
|
-
}>) => {
|
|
75
|
-
error: boolean;
|
|
76
|
-
} | Pick<{
|
|
77
|
-
error: boolean;
|
|
78
|
-
}, K> | null) | Pick<{
|
|
79
|
-
error: boolean;
|
|
80
|
-
}, K> | null, callback?: (() => void) | undefined): void;
|
|
81
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
82
|
-
readonly props: Readonly<{
|
|
83
|
-
set: React.Dispatch<Error | undefined>;
|
|
84
|
-
children: React.ReactNode;
|
|
85
|
-
}>;
|
|
86
|
-
componentDidMount?(): void;
|
|
87
|
-
shouldComponentUpdate?(nextProps: Readonly<{
|
|
88
|
-
set: React.Dispatch<Error | undefined>;
|
|
89
|
-
children: React.ReactNode;
|
|
90
|
-
}>, nextState: Readonly<{
|
|
91
|
-
error: boolean;
|
|
92
|
-
}>): boolean;
|
|
93
|
-
componentWillUnmount?(): void;
|
|
94
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<{
|
|
95
|
-
set: React.Dispatch<Error | undefined>;
|
|
96
|
-
children: React.ReactNode;
|
|
97
|
-
}>, prevState: Readonly<{
|
|
98
|
-
error: boolean;
|
|
99
|
-
}>): any;
|
|
100
|
-
componentDidUpdate?(prevProps: Readonly<{
|
|
101
|
-
set: React.Dispatch<Error | undefined>;
|
|
102
|
-
children: React.ReactNode;
|
|
103
|
-
}>, prevState: Readonly<{
|
|
104
|
-
error: boolean;
|
|
105
|
-
}>, snapshot?: any): void;
|
|
106
|
-
componentWillMount?(): void;
|
|
107
|
-
UNSAFE_componentWillMount?(): void;
|
|
108
|
-
componentWillReceiveProps?(nextProps: Readonly<{
|
|
109
|
-
set: React.Dispatch<Error | undefined>;
|
|
110
|
-
children: React.ReactNode;
|
|
111
|
-
}>): void;
|
|
112
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{
|
|
113
|
-
set: React.Dispatch<Error | undefined>;
|
|
114
|
-
children: React.ReactNode;
|
|
115
|
-
}>): void;
|
|
116
|
-
componentWillUpdate?(nextProps: Readonly<{
|
|
117
|
-
set: React.Dispatch<Error | undefined>;
|
|
118
|
-
children: React.ReactNode;
|
|
119
|
-
}>, nextState: Readonly<{
|
|
120
|
-
error: boolean;
|
|
121
|
-
}>): void;
|
|
122
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<{
|
|
123
|
-
set: React.Dispatch<Error | undefined>;
|
|
124
|
-
children: React.ReactNode;
|
|
125
|
-
}>, nextState: Readonly<{
|
|
126
|
-
error: boolean;
|
|
127
|
-
}>): void;
|
|
128
|
-
};
|
|
129
|
-
getDerivedStateFromError: () => {
|
|
130
|
-
error: boolean;
|
|
131
|
-
};
|
|
132
|
-
contextType?: React.Context<any> | undefined;
|
|
133
|
-
propTypes?: any;
|
|
134
|
-
};
|
|
135
|
-
export interface ObjectMap {
|
|
136
|
-
nodes: {
|
|
137
|
-
[name: string]: THREE.Object3D;
|
|
138
|
-
};
|
|
139
|
-
materials: {
|
|
140
|
-
[name: string]: THREE.Material;
|
|
141
|
-
};
|
|
142
|
-
meshes: {
|
|
143
|
-
[name: string]: THREE.Mesh;
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
export declare function calculateDpr(dpr: Dpr): number;
|
|
147
|
-
/**
|
|
148
|
-
* Returns instance root state
|
|
149
|
-
*/
|
|
150
|
-
export declare function getRootState<T extends THREE.Object3D = THREE.Object3D>(obj: T): import("./store.js").RootState | undefined;
|
|
151
|
-
export interface EquConfig {
|
|
152
|
-
/** Compare arrays by reference equality a === b (default), or by shallow equality */
|
|
153
|
-
arrays?: 'reference' | 'shallow';
|
|
154
|
-
/** Compare objects by reference equality a === b (default), or by shallow equality */
|
|
155
|
-
objects?: 'reference' | 'shallow';
|
|
156
|
-
/** If true the keys in both a and b must match 1:1 (default), if false a's keys must intersect b's */
|
|
157
|
-
strict?: boolean;
|
|
158
|
-
}
|
|
159
|
-
export declare const is: {
|
|
160
|
-
obj: (a: any) => boolean;
|
|
161
|
-
fun: (a: any) => a is Function;
|
|
162
|
-
str: (a: any) => a is string;
|
|
163
|
-
num: (a: any) => a is number;
|
|
164
|
-
boo: (a: any) => a is boolean;
|
|
165
|
-
und: (a: any) => boolean;
|
|
166
|
-
nul: (a: any) => boolean;
|
|
167
|
-
arr: (a: any) => boolean;
|
|
168
|
-
equ(a: any, b: any, { arrays, objects, strict }?: EquConfig): boolean;
|
|
169
|
-
};
|
|
170
|
-
export declare function buildGraph(object: THREE.Object3D): ObjectMap;
|
|
171
|
-
export interface Disposable {
|
|
172
|
-
type?: string;
|
|
173
|
-
dispose?: () => void;
|
|
174
|
-
}
|
|
175
|
-
export declare function dispose<T extends Disposable>(obj: T): void;
|
|
176
|
-
export declare const REACT_INTERNAL_PROPS: string[];
|
|
177
|
-
export declare function getInstanceProps<T = any>(queue: Fiber['pendingProps']): Instance<T>['props'];
|
|
178
|
-
export declare function prepare<T = any>(target: T, root: RootStore, type: string, props: Instance<T>['props']): Instance<T>;
|
|
179
|
-
export declare function resolve(root: any, key: string): {
|
|
180
|
-
root: any;
|
|
181
|
-
key: string;
|
|
182
|
-
target: any;
|
|
183
|
-
};
|
|
184
|
-
export declare function attach(parent: Instance, child: Instance): void;
|
|
185
|
-
export declare function detach(parent: Instance, child: Instance): void;
|
|
186
|
-
export declare const RESERVED_PROPS: string[];
|
|
187
|
-
export declare function diffProps<T = any>(instance: Instance<T>, newProps: Instance<T>['props']): Instance<T>['props'];
|
|
188
|
-
export declare function applyProps<T = any>(object: Instance<T>['object'], props: Instance<T>['props']): Instance<T>['object'];
|
|
189
|
-
export declare function invalidateInstance(instance: Instance): void;
|
|
190
|
-
export declare function updateCamera(camera: Camera, size: Size): void;
|
|
191
|
-
export declare const isObject3D: (object: any) => object is THREE.Object3D<THREE.Object3DEventMap>;
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Instance } from "./reconciler.js";
|
|
4
|
+
import type { Fiber } from 'react-reconciler';
|
|
5
|
+
import type { Dpr, RootStore, Size } from "./store.js";
|
|
6
|
+
export type NonFunctionKeys<P> = {
|
|
7
|
+
[K in keyof P]-?: P[K] extends Function ? never : K;
|
|
8
|
+
}[keyof P];
|
|
9
|
+
export type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O;
|
|
10
|
+
export type Properties<T> = Pick<T, NonFunctionKeys<T>>;
|
|
11
|
+
export type Mutable<P> = {
|
|
12
|
+
[K in keyof P]: P[K] | Readonly<P[K]>;
|
|
13
|
+
};
|
|
14
|
+
export type IsOptional<T> = undefined extends T ? true : false;
|
|
15
|
+
export type IsAllOptional<T extends any[]> = T extends [infer First, ...infer Rest] ? IsOptional<First> extends true ? IsAllOptional<Rest> : false : true;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the instance's initial (outmost) root.
|
|
18
|
+
*/
|
|
19
|
+
export declare function findInitialRoot<T>(instance: Instance<T>): RootStore;
|
|
20
|
+
export type Act = <T = any>(cb: () => Promise<T>) => Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Safely flush async effects when testing, simulating a legacy root.
|
|
23
|
+
* @deprecated Import from React instead. import { act } from 'react'
|
|
24
|
+
*/
|
|
25
|
+
export declare const act: Act;
|
|
26
|
+
export type Camera = (THREE.OrthographicCamera | THREE.PerspectiveCamera) & {
|
|
27
|
+
manual?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare const isOrthographicCamera: (def: Camera) => def is THREE.OrthographicCamera;
|
|
30
|
+
export declare const isRef: (obj: any) => obj is React.RefObject<unknown>;
|
|
31
|
+
export declare const isColorRepresentation: (value: unknown) => value is THREE.ColorRepresentation;
|
|
32
|
+
/**
|
|
33
|
+
* An SSR-friendly useLayoutEffect.
|
|
34
|
+
*
|
|
35
|
+
* React currently throws a warning when using useLayoutEffect on the server.
|
|
36
|
+
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
37
|
+
* useLayoutEffect elsewhere.
|
|
38
|
+
*
|
|
39
|
+
* @see https://github.com/facebook/react/issues/14927
|
|
40
|
+
*/
|
|
41
|
+
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
42
|
+
export declare function useMutableCallback<T>(fn: T): React.RefObject<T>;
|
|
43
|
+
export type Bridge = React.FC<{
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Bridges renderer Context and StrictMode from a primary renderer.
|
|
48
|
+
*/
|
|
49
|
+
export declare function useBridge(): Bridge;
|
|
50
|
+
export type SetBlock = false | Promise<null> | null;
|
|
51
|
+
export type UnblockProps = {
|
|
52
|
+
set: React.Dispatch<React.SetStateAction<SetBlock>>;
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
};
|
|
55
|
+
export declare function Block({ set }: Omit<UnblockProps, 'children'>): null;
|
|
56
|
+
export declare const ErrorBoundary: {
|
|
57
|
+
new (props: {
|
|
58
|
+
set: React.Dispatch<Error | undefined>;
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
}): {
|
|
61
|
+
state: {
|
|
62
|
+
error: boolean;
|
|
63
|
+
};
|
|
64
|
+
componentDidCatch(err: Error): void;
|
|
65
|
+
render(): React.ReactNode;
|
|
66
|
+
context: unknown;
|
|
67
|
+
setState<K extends "error">(state: {
|
|
68
|
+
error: boolean;
|
|
69
|
+
} | ((prevState: Readonly<{
|
|
70
|
+
error: boolean;
|
|
71
|
+
}>, props: Readonly<{
|
|
72
|
+
set: React.Dispatch<Error | undefined>;
|
|
73
|
+
children: React.ReactNode;
|
|
74
|
+
}>) => {
|
|
75
|
+
error: boolean;
|
|
76
|
+
} | Pick<{
|
|
77
|
+
error: boolean;
|
|
78
|
+
}, K> | null) | Pick<{
|
|
79
|
+
error: boolean;
|
|
80
|
+
}, K> | null, callback?: (() => void) | undefined): void;
|
|
81
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
82
|
+
readonly props: Readonly<{
|
|
83
|
+
set: React.Dispatch<Error | undefined>;
|
|
84
|
+
children: React.ReactNode;
|
|
85
|
+
}>;
|
|
86
|
+
componentDidMount?(): void;
|
|
87
|
+
shouldComponentUpdate?(nextProps: Readonly<{
|
|
88
|
+
set: React.Dispatch<Error | undefined>;
|
|
89
|
+
children: React.ReactNode;
|
|
90
|
+
}>, nextState: Readonly<{
|
|
91
|
+
error: boolean;
|
|
92
|
+
}>): boolean;
|
|
93
|
+
componentWillUnmount?(): void;
|
|
94
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<{
|
|
95
|
+
set: React.Dispatch<Error | undefined>;
|
|
96
|
+
children: React.ReactNode;
|
|
97
|
+
}>, prevState: Readonly<{
|
|
98
|
+
error: boolean;
|
|
99
|
+
}>): any;
|
|
100
|
+
componentDidUpdate?(prevProps: Readonly<{
|
|
101
|
+
set: React.Dispatch<Error | undefined>;
|
|
102
|
+
children: React.ReactNode;
|
|
103
|
+
}>, prevState: Readonly<{
|
|
104
|
+
error: boolean;
|
|
105
|
+
}>, snapshot?: any): void;
|
|
106
|
+
componentWillMount?(): void;
|
|
107
|
+
UNSAFE_componentWillMount?(): void;
|
|
108
|
+
componentWillReceiveProps?(nextProps: Readonly<{
|
|
109
|
+
set: React.Dispatch<Error | undefined>;
|
|
110
|
+
children: React.ReactNode;
|
|
111
|
+
}>): void;
|
|
112
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{
|
|
113
|
+
set: React.Dispatch<Error | undefined>;
|
|
114
|
+
children: React.ReactNode;
|
|
115
|
+
}>): void;
|
|
116
|
+
componentWillUpdate?(nextProps: Readonly<{
|
|
117
|
+
set: React.Dispatch<Error | undefined>;
|
|
118
|
+
children: React.ReactNode;
|
|
119
|
+
}>, nextState: Readonly<{
|
|
120
|
+
error: boolean;
|
|
121
|
+
}>): void;
|
|
122
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<{
|
|
123
|
+
set: React.Dispatch<Error | undefined>;
|
|
124
|
+
children: React.ReactNode;
|
|
125
|
+
}>, nextState: Readonly<{
|
|
126
|
+
error: boolean;
|
|
127
|
+
}>): void;
|
|
128
|
+
};
|
|
129
|
+
getDerivedStateFromError: () => {
|
|
130
|
+
error: boolean;
|
|
131
|
+
};
|
|
132
|
+
contextType?: React.Context<any> | undefined;
|
|
133
|
+
propTypes?: any;
|
|
134
|
+
};
|
|
135
|
+
export interface ObjectMap {
|
|
136
|
+
nodes: {
|
|
137
|
+
[name: string]: THREE.Object3D;
|
|
138
|
+
};
|
|
139
|
+
materials: {
|
|
140
|
+
[name: string]: THREE.Material;
|
|
141
|
+
};
|
|
142
|
+
meshes: {
|
|
143
|
+
[name: string]: THREE.Mesh;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
export declare function calculateDpr(dpr: Dpr): number;
|
|
147
|
+
/**
|
|
148
|
+
* Returns instance root state
|
|
149
|
+
*/
|
|
150
|
+
export declare function getRootState<T extends THREE.Object3D = THREE.Object3D>(obj: T): import("./store.js").RootState | undefined;
|
|
151
|
+
export interface EquConfig {
|
|
152
|
+
/** Compare arrays by reference equality a === b (default), or by shallow equality */
|
|
153
|
+
arrays?: 'reference' | 'shallow';
|
|
154
|
+
/** Compare objects by reference equality a === b (default), or by shallow equality */
|
|
155
|
+
objects?: 'reference' | 'shallow';
|
|
156
|
+
/** If true the keys in both a and b must match 1:1 (default), if false a's keys must intersect b's */
|
|
157
|
+
strict?: boolean;
|
|
158
|
+
}
|
|
159
|
+
export declare const is: {
|
|
160
|
+
obj: (a: any) => boolean;
|
|
161
|
+
fun: (a: any) => a is Function;
|
|
162
|
+
str: (a: any) => a is string;
|
|
163
|
+
num: (a: any) => a is number;
|
|
164
|
+
boo: (a: any) => a is boolean;
|
|
165
|
+
und: (a: any) => boolean;
|
|
166
|
+
nul: (a: any) => boolean;
|
|
167
|
+
arr: (a: any) => boolean;
|
|
168
|
+
equ(a: any, b: any, { arrays, objects, strict }?: EquConfig): boolean;
|
|
169
|
+
};
|
|
170
|
+
export declare function buildGraph(object: THREE.Object3D): ObjectMap;
|
|
171
|
+
export interface Disposable {
|
|
172
|
+
type?: string;
|
|
173
|
+
dispose?: () => void;
|
|
174
|
+
}
|
|
175
|
+
export declare function dispose<T extends Disposable>(obj: T): void;
|
|
176
|
+
export declare const REACT_INTERNAL_PROPS: string[];
|
|
177
|
+
export declare function getInstanceProps<T = any>(queue: Fiber['pendingProps']): Instance<T>['props'];
|
|
178
|
+
export declare function prepare<T = any>(target: T, root: RootStore, type: string, props: Instance<T>['props']): Instance<T>;
|
|
179
|
+
export declare function resolve(root: any, key: string): {
|
|
180
|
+
root: any;
|
|
181
|
+
key: string;
|
|
182
|
+
target: any;
|
|
183
|
+
};
|
|
184
|
+
export declare function attach(parent: Instance, child: Instance): void;
|
|
185
|
+
export declare function detach(parent: Instance, child: Instance): void;
|
|
186
|
+
export declare const RESERVED_PROPS: string[];
|
|
187
|
+
export declare function diffProps<T = any>(instance: Instance<T>, newProps: Instance<T>['props']): Instance<T>['props'];
|
|
188
|
+
export declare function applyProps<T = any>(object: Instance<T>['object'], props: Instance<T>['props']): Instance<T>['object'];
|
|
189
|
+
export declare function invalidateInstance(instance: Instance): void;
|
|
190
|
+
export declare function updateCamera(camera: Camera, size: Size): void;
|
|
191
|
+
export declare const isObject3D: (object: any) => object is THREE.Object3D<THREE.Object3DEventMap>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as ReactThreeFiber from "./three-types.js";
|
|
2
|
-
export { ReactThreeFiber };
|
|
3
|
-
export * from "./three-types.js";
|
|
4
|
-
export * from "./core/index.js";
|
|
5
|
-
export * from "./web/Canvas.js";
|
|
6
|
-
export { createPointerEvents as events } from "./web/events.js";
|
|
1
|
+
import * as ReactThreeFiber from "./three-types.js";
|
|
2
|
+
export { ReactThreeFiber };
|
|
3
|
+
export * from "./three-types.js";
|
|
4
|
+
export * from "./core/index.js";
|
|
5
|
+
export * from "./web/Canvas.js";
|
|
6
|
+
export { createPointerEvents as events } from "./web/events.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { View, type ViewProps, type ViewStyle } from 'react-native';
|
|
3
|
-
import { RenderProps } from "../core/index.js";
|
|
4
|
-
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'dpr'>, Omit<ViewProps, 'children'> {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
style?: ViewStyle;
|
|
7
|
-
ref?: React.Ref<View>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A native canvas which accepts threejs elements as children.
|
|
11
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
12
|
-
*/
|
|
13
|
-
export declare function Canvas(props: CanvasProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, type ViewProps, type ViewStyle } from 'react-native';
|
|
3
|
+
import { RenderProps } from "../core/index.js";
|
|
4
|
+
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'dpr'>, Omit<ViewProps, 'children'> {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
style?: ViewStyle;
|
|
7
|
+
ref?: React.Ref<View>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A native canvas which accepts threejs elements as children.
|
|
11
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
12
|
+
*/
|
|
13
|
+
export declare function Canvas(props: CanvasProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RootStore } from "../core/store.js";
|
|
2
|
-
import { EventManager } from "../core/events.js";
|
|
3
|
-
/** Default R3F event manager for react-native */
|
|
4
|
-
export declare function createTouchEvents(store: RootStore): EventManager<HTMLElement>;
|
|
1
|
+
import { RootStore } from "../core/store.js";
|
|
2
|
+
import { EventManager } from "../core/events.js";
|
|
3
|
+
/** Default R3F event manager for react-native */
|
|
4
|
+
export declare function createTouchEvents(store: RootStore): EventManager<HTMLElement>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as ReactThreeFiber from "./three-types.js";
|
|
2
|
-
export { ReactThreeFiber };
|
|
3
|
-
export * from "./three-types.js";
|
|
4
|
-
export * from "./core/index.js";
|
|
5
|
-
export * from "./native/Canvas.js";
|
|
6
|
-
export { createTouchEvents as events } from "./native/events.js";
|
|
1
|
+
import * as ReactThreeFiber from "./three-types.js";
|
|
2
|
+
export { ReactThreeFiber };
|
|
3
|
+
export * from "./three-types.js";
|
|
4
|
+
export * from "./core/index.js";
|
|
5
|
+
export * from "./native/Canvas.js";
|
|
6
|
+
export { createTouchEvents as events } from "./native/events.js";
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import type * as THREE from 'three';
|
|
2
|
-
import type { Args, EventHandlers, InstanceProps, ConstructorRepresentation } from "./core/index.js";
|
|
3
|
-
import type { Overwrite, Mutable } from "./core/utils.js";
|
|
4
|
-
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>;
|
|
5
|
-
export interface MathRepresentation {
|
|
6
|
-
set(...args: number[]): any;
|
|
7
|
-
}
|
|
8
|
-
export interface VectorRepresentation extends MathRepresentation {
|
|
9
|
-
setScalar(value: number): any;
|
|
10
|
-
}
|
|
11
|
-
export type MathTypes = MathRepresentation | THREE.Euler | THREE.Color;
|
|
12
|
-
export type MathType<T extends MathTypes> = T extends THREE.Color ? Args<typeof THREE.Color> | THREE.ColorRepresentation : T extends VectorRepresentation | THREE.Layers | THREE.Euler ? T | MutableOrReadonlyParameters<T['set']> | number : T | MutableOrReadonlyParameters<T['set']>;
|
|
13
|
-
export type MathProps<P> = {
|
|
14
|
-
[K in keyof P as P[K] extends MathTypes ? K : never]: P[K] extends MathTypes ? MathType<P[K]> : never;
|
|
15
|
-
};
|
|
16
|
-
export type Vector2 = MathType<THREE.Vector2>;
|
|
17
|
-
export type Vector3 = MathType<THREE.Vector3>;
|
|
18
|
-
export type Vector4 = MathType<THREE.Vector4>;
|
|
19
|
-
export type Color = MathType<THREE.Color>;
|
|
20
|
-
export type Layers = MathType<THREE.Layers>;
|
|
21
|
-
export type Quaternion = MathType<THREE.Quaternion>;
|
|
22
|
-
export type Euler = MathType<THREE.Euler>;
|
|
23
|
-
export type Matrix3 = MathType<THREE.Matrix3>;
|
|
24
|
-
export type Matrix4 = MathType<THREE.Matrix4>;
|
|
25
|
-
export interface RaycastableRepresentation {
|
|
26
|
-
raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
|
|
27
|
-
}
|
|
28
|
-
export type EventProps<P> = P extends RaycastableRepresentation ? Partial<EventHandlers> : {};
|
|
29
|
-
export interface ReactProps<P> {
|
|
30
|
-
children?: React.ReactNode;
|
|
31
|
-
ref?: React.Ref<P>;
|
|
32
|
-
key?: React.Key;
|
|
33
|
-
}
|
|
34
|
-
export type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<Overwrite<P, MathProps<P> & ReactProps<P> & EventProps<P>>>;
|
|
35
|
-
export type ThreeElement<T extends ConstructorRepresentation> = Mutable<Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>>;
|
|
36
|
-
export type ThreeToJSXElements<T extends Record<string, any>> = {
|
|
37
|
-
[K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never;
|
|
38
|
-
};
|
|
39
|
-
type ThreeExports = typeof THREE;
|
|
40
|
-
type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>;
|
|
41
|
-
export interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
|
|
42
|
-
primitive: Omit<ThreeElement<any>, 'args'> & {
|
|
43
|
-
object: object;
|
|
44
|
-
};
|
|
45
|
-
threeAudio: ThreeElementsImpl['audio'];
|
|
46
|
-
threeSource: ThreeElementsImpl['source'];
|
|
47
|
-
threeLine: ThreeElementsImpl['line'];
|
|
48
|
-
threePath: ThreeElementsImpl['path'];
|
|
49
|
-
}
|
|
50
|
-
declare module 'react' {
|
|
51
|
-
namespace JSX {
|
|
52
|
-
interface IntrinsicElements extends ThreeElements {
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
declare module 'react/jsx-runtime' {
|
|
57
|
-
namespace JSX {
|
|
58
|
-
interface IntrinsicElements extends ThreeElements {
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
declare module 'react/jsx-dev-runtime' {
|
|
63
|
-
namespace JSX {
|
|
64
|
-
interface IntrinsicElements extends ThreeElements {
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export {};
|
|
1
|
+
import type * as THREE from 'three';
|
|
2
|
+
import type { Args, EventHandlers, InstanceProps, ConstructorRepresentation } from "./core/index.js";
|
|
3
|
+
import type { Overwrite, Mutable } from "./core/utils.js";
|
|
4
|
+
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>;
|
|
5
|
+
export interface MathRepresentation {
|
|
6
|
+
set(...args: number[]): any;
|
|
7
|
+
}
|
|
8
|
+
export interface VectorRepresentation extends MathRepresentation {
|
|
9
|
+
setScalar(value: number): any;
|
|
10
|
+
}
|
|
11
|
+
export type MathTypes = MathRepresentation | THREE.Euler | THREE.Color;
|
|
12
|
+
export type MathType<T extends MathTypes> = T extends THREE.Color ? Args<typeof THREE.Color> | THREE.ColorRepresentation : T extends VectorRepresentation | THREE.Layers | THREE.Euler ? T | MutableOrReadonlyParameters<T['set']> | number : T | MutableOrReadonlyParameters<T['set']>;
|
|
13
|
+
export type MathProps<P> = {
|
|
14
|
+
[K in keyof P as P[K] extends MathTypes ? K : never]: P[K] extends MathTypes ? MathType<P[K]> : never;
|
|
15
|
+
};
|
|
16
|
+
export type Vector2 = MathType<THREE.Vector2>;
|
|
17
|
+
export type Vector3 = MathType<THREE.Vector3>;
|
|
18
|
+
export type Vector4 = MathType<THREE.Vector4>;
|
|
19
|
+
export type Color = MathType<THREE.Color>;
|
|
20
|
+
export type Layers = MathType<THREE.Layers>;
|
|
21
|
+
export type Quaternion = MathType<THREE.Quaternion>;
|
|
22
|
+
export type Euler = MathType<THREE.Euler>;
|
|
23
|
+
export type Matrix3 = MathType<THREE.Matrix3>;
|
|
24
|
+
export type Matrix4 = MathType<THREE.Matrix4>;
|
|
25
|
+
export interface RaycastableRepresentation {
|
|
26
|
+
raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
|
|
27
|
+
}
|
|
28
|
+
export type EventProps<P> = P extends RaycastableRepresentation ? Partial<EventHandlers> : {};
|
|
29
|
+
export interface ReactProps<P> {
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
ref?: React.Ref<P>;
|
|
32
|
+
key?: React.Key;
|
|
33
|
+
}
|
|
34
|
+
export type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<Overwrite<P, MathProps<P> & ReactProps<P> & EventProps<P>>>;
|
|
35
|
+
export type ThreeElement<T extends ConstructorRepresentation> = Mutable<Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>>;
|
|
36
|
+
export type ThreeToJSXElements<T extends Record<string, any>> = {
|
|
37
|
+
[K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never;
|
|
38
|
+
};
|
|
39
|
+
type ThreeExports = typeof THREE;
|
|
40
|
+
type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>;
|
|
41
|
+
export interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
|
|
42
|
+
primitive: Omit<ThreeElement<any>, 'args'> & {
|
|
43
|
+
object: object;
|
|
44
|
+
};
|
|
45
|
+
threeAudio: ThreeElementsImpl['audio'];
|
|
46
|
+
threeSource: ThreeElementsImpl['source'];
|
|
47
|
+
threeLine: ThreeElementsImpl['line'];
|
|
48
|
+
threePath: ThreeElementsImpl['path'];
|
|
49
|
+
}
|
|
50
|
+
declare module 'react' {
|
|
51
|
+
namespace JSX {
|
|
52
|
+
interface IntrinsicElements extends ThreeElements {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
declare module 'react/jsx-runtime' {
|
|
57
|
+
namespace JSX {
|
|
58
|
+
interface IntrinsicElements extends ThreeElements {
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
declare module 'react/jsx-dev-runtime' {
|
|
63
|
+
namespace JSX {
|
|
64
|
+
interface IntrinsicElements extends ThreeElements {
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
-
import { RenderProps } from "../core/index.js";
|
|
4
|
-
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
ref?: React.Ref<HTMLCanvasElement>;
|
|
7
|
-
/** Canvas fallback content, similar to img's alt prop */
|
|
8
|
-
fallback?: React.ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* Options to pass to useMeasure.
|
|
11
|
-
* @see https://github.com/pmndrs/react-use-measure#api
|
|
12
|
-
*/
|
|
13
|
-
resize?: ResizeOptions;
|
|
14
|
-
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
15
|
-
eventSource?: HTMLElement | React.RefObject<HTMLElement>;
|
|
16
|
-
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
17
|
-
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A DOM canvas which accepts threejs elements as children.
|
|
21
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
22
|
-
*/
|
|
23
|
-
export declare function Canvas(props: CanvasProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
+
import { RenderProps } from "../core/index.js";
|
|
4
|
+
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
ref?: React.Ref<HTMLCanvasElement>;
|
|
7
|
+
/** Canvas fallback content, similar to img's alt prop */
|
|
8
|
+
fallback?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Options to pass to useMeasure.
|
|
11
|
+
* @see https://github.com/pmndrs/react-use-measure#api
|
|
12
|
+
*/
|
|
13
|
+
resize?: ResizeOptions;
|
|
14
|
+
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
15
|
+
eventSource?: HTMLElement | React.RefObject<HTMLElement>;
|
|
16
|
+
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
17
|
+
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A DOM canvas which accepts threejs elements as children.
|
|
21
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
22
|
+
*/
|
|
23
|
+
export declare function Canvas(props: CanvasProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RootStore } from "../core/store.js";
|
|
2
|
-
import { EventManager } from "../core/events.js";
|
|
3
|
-
/** Default R3F event manager for web */
|
|
4
|
-
export declare function createPointerEvents(store: RootStore): EventManager<HTMLElement>;
|
|
1
|
+
import { RootStore } from "../core/store.js";
|
|
2
|
+
import { EventManager } from "../core/events.js";
|
|
3
|
+
/** Default R3F event manager for web */
|
|
4
|
+
export declare function createPointerEvents(store: RootStore): EventManager<HTMLElement>;
|