@react-three/fiber 8.0.0-beta-05 → 8.0.0-beta.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 +6 -0
- package/dist/declarations/src/core/hooks.d.ts +1 -1
- package/dist/declarations/src/core/index.d.ts +8 -6
- package/dist/declarations/src/core/loop.d.ts +1 -1
- package/dist/declarations/src/core/store.d.ts +11 -15
- package/dist/declarations/src/core/utils.d.ts +7 -1
- package/dist/declarations/src/index.d.ts +1 -0
- package/dist/declarations/src/native.d.ts +1 -0
- package/dist/declarations/src/three-types.d.ts +18 -0
- package/dist/{index-95c17855.cjs.dev.js → index-05ebefd3.cjs.dev.js} +251 -207
- package/dist/{index-ff8b5912.cjs.prod.js → index-85b2df17.cjs.prod.js} +251 -207
- package/dist/{index-3f4e5f46.esm.js → index-e78dd2f0.esm.js} +251 -207
- package/dist/react-three-fiber.cjs.dev.js +9 -6
- package/dist/react-three-fiber.cjs.prod.js +9 -6
- package/dist/react-three-fiber.esm.js +10 -7
- package/native/dist/react-three-fiber-native.cjs.dev.js +11 -6
- package/native/dist/react-three-fiber-native.cjs.prod.js +11 -6
- package/native/dist/react-three-fiber-native.esm.js +12 -7
- package/package.json +5 -7
package/CHANGELOG.md
CHANGED
|
@@ -10,7 +10,7 @@ export declare type Extensions = (loader: THREE.Loader) => void;
|
|
|
10
10
|
export declare type LoaderResult<T> = T extends any[] ? Loader<T[number]> : Loader<T>;
|
|
11
11
|
export declare type ConditionalType<Child, Parent, Truthy, Falsy> = Child extends Parent ? Truthy : Falsy;
|
|
12
12
|
export declare type BranchingReturn<T, Parent, Coerced> = ConditionalType<T, Parent, Coerced, T>;
|
|
13
|
-
export declare function useStore(): import("zustand").UseStore<RootState
|
|
13
|
+
export declare function useStore(): import("zustand").UseStore<RootState, import("zustand").StoreApi<RootState>>;
|
|
14
14
|
export declare function useThree<T = RootState>(selector?: StateSelector<RootState, T>, equalityFn?: EqualityChecker<T>): T;
|
|
15
15
|
export declare function useFrame(callback: RenderCallback, renderPriority?: number): null;
|
|
16
16
|
export declare function useGraph(object: THREE.Object3D): ObjectMap;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { UseStore } from 'zustand';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { addEffect, addAfterEffect, addTail } from '../core/loop';
|
|
5
|
+
import { Renderer, StoreProps, context, RootState, Size } from './store';
|
|
6
|
+
import { extend, Root } from './renderer';
|
|
7
|
+
import { addEffect, addAfterEffect, addTail } from './loop';
|
|
9
8
|
import { EventManager } from './events';
|
|
9
|
+
import { dispose } from './utils';
|
|
10
10
|
declare const roots: Map<Element, Root>;
|
|
11
11
|
declare const invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void;
|
|
12
|
-
declare const reconciler: import("react-reconciler").Reconciler<unknown, unknown, unknown, unknown, unknown>, applyProps: typeof import("
|
|
12
|
+
declare const reconciler: import("react-reconciler").Reconciler<unknown, unknown, unknown, unknown, unknown>, applyProps: typeof import("./utils").applyProps;
|
|
13
13
|
declare type Properties<T> = Pick<T, {
|
|
14
14
|
[K in keyof T]: T[K] extends (_: any) => any ? never : K;
|
|
15
15
|
}[keyof T]>;
|
|
@@ -20,10 +20,12 @@ export declare type RenderProps<TCanvas extends Element> = Omit<StoreProps, 'gl'
|
|
|
20
20
|
size?: Size;
|
|
21
21
|
onCreated?: (state: RootState) => void;
|
|
22
22
|
};
|
|
23
|
-
declare
|
|
23
|
+
export declare type ReconcilerRoot<TCanvas extends Element> = {
|
|
24
|
+
configure: (config?: RenderProps<TCanvas>) => ReconcilerRoot<TCanvas>;
|
|
24
25
|
render: (element: React.ReactNode) => UseStore<RootState>;
|
|
25
26
|
unmount: () => void;
|
|
26
27
|
};
|
|
28
|
+
declare function createRoot<TCanvas extends Element>(canvas: TCanvas): ReconcilerRoot<TCanvas>;
|
|
27
29
|
declare function render<TCanvas extends Element>(element: React.ReactNode, canvas: TCanvas, config?: RenderProps<TCanvas>): UseStore<RootState>;
|
|
28
30
|
declare function unmountComponentAtNode<TElement extends Element>(canvas: TElement, callback?: (canvas: TElement) => void): void;
|
|
29
31
|
declare const act: any;
|
|
@@ -6,7 +6,7 @@ export declare const addEffect: (callback: GlobalRenderCallback) => () => void;
|
|
|
6
6
|
export declare const addAfterEffect: (callback: GlobalRenderCallback) => () => void;
|
|
7
7
|
export declare const addTail: (callback: GlobalRenderCallback) => () => void;
|
|
8
8
|
export declare function createLoop<TCanvas>(roots: Map<TCanvas, Root>): {
|
|
9
|
-
loop: (timestamp: number) =>
|
|
9
|
+
loop: (timestamp: number) => void;
|
|
10
10
|
invalidate: (state?: RootState | undefined) => void;
|
|
11
11
|
advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void;
|
|
12
12
|
};
|
|
@@ -2,7 +2,6 @@ import * as THREE from 'three';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import * as ReactThreeFiber from '../three-types';
|
|
4
4
|
import { GetState, SetState, UseStore } from 'zustand';
|
|
5
|
-
import { Instance, InstanceProps } from './renderer';
|
|
6
5
|
import { DomEvent, EventManager, PointerCaptureTarget, ThreeEvent } from './events';
|
|
7
6
|
export interface Intersection extends THREE.Intersection {
|
|
8
7
|
eventObject: THREE.Object3D;
|
|
@@ -40,13 +39,12 @@ export declare type Performance = {
|
|
|
40
39
|
export declare type Renderer = {
|
|
41
40
|
render: (scene: THREE.Scene, camera: THREE.Camera) => any;
|
|
42
41
|
};
|
|
43
|
-
export declare const isRenderer: (def:
|
|
44
|
-
export declare const isOrthographicCamera: (def:
|
|
42
|
+
export declare const isRenderer: (def: any) => boolean;
|
|
43
|
+
export declare const isOrthographicCamera: (def: any) => def is THREE.OrthographicCamera;
|
|
45
44
|
export declare type InternalState = {
|
|
46
45
|
active: boolean;
|
|
47
46
|
priority: number;
|
|
48
47
|
frames: number;
|
|
49
|
-
lastProps: StoreProps;
|
|
50
48
|
lastEvent: React.MutableRefObject<DomEvent | null>;
|
|
51
49
|
interaction: THREE.Object3D[];
|
|
52
50
|
hovered: Map<string, ThreeEvent<DomEvent>>;
|
|
@@ -54,20 +52,21 @@ export declare type InternalState = {
|
|
|
54
52
|
capturedMap: Map<number, Map<THREE.Object3D, PointerCaptureTarget>>;
|
|
55
53
|
initialClick: [x: number, y: number];
|
|
56
54
|
initialHits: THREE.Object3D[];
|
|
57
|
-
xr: {
|
|
58
|
-
connect: () => void;
|
|
59
|
-
disconnect: () => void;
|
|
60
|
-
};
|
|
61
55
|
subscribe: (callback: React.MutableRefObject<RenderCallback>, priority?: number) => () => void;
|
|
62
56
|
};
|
|
63
57
|
export declare type RootState = {
|
|
64
58
|
gl: THREE.WebGLRenderer;
|
|
65
|
-
scene: THREE.Scene;
|
|
66
59
|
camera: Camera & {
|
|
67
60
|
manual?: boolean;
|
|
68
61
|
};
|
|
69
|
-
controls: THREE.EventDispatcher | null;
|
|
70
62
|
raycaster: Raycaster;
|
|
63
|
+
events: EventManager<any>;
|
|
64
|
+
xr: {
|
|
65
|
+
connect: () => void;
|
|
66
|
+
disconnect: () => void;
|
|
67
|
+
};
|
|
68
|
+
scene: THREE.Scene;
|
|
69
|
+
controls: THREE.EventDispatcher | null;
|
|
71
70
|
mouse: THREE.Vector2;
|
|
72
71
|
clock: THREE.Clock;
|
|
73
72
|
linear: boolean;
|
|
@@ -86,7 +85,6 @@ export declare type RootState = {
|
|
|
86
85
|
setDpr: (dpr: Dpr) => void;
|
|
87
86
|
setFrameloop: (frameloop?: 'always' | 'demand' | 'never') => void;
|
|
88
87
|
onPointerMissed?: (event: MouseEvent) => void;
|
|
89
|
-
events: EventManager<any>;
|
|
90
88
|
internal: InternalState;
|
|
91
89
|
};
|
|
92
90
|
export declare type FilterFunction = (items: THREE.Intersection[], state: RootState) => THREE.Intersection[];
|
|
@@ -106,14 +104,12 @@ export declare type StoreProps = {
|
|
|
106
104
|
frameloop?: 'always' | 'demand' | 'never';
|
|
107
105
|
performance?: Partial<Omit<Performance, 'regress'>>;
|
|
108
106
|
dpr?: Dpr;
|
|
109
|
-
clock?: THREE.Clock;
|
|
110
107
|
raycaster?: Partial<Raycaster>;
|
|
111
108
|
camera?: (Camera | Partial<ReactThreeFiber.Object3DNode<THREE.Camera, typeof THREE.Camera> & ReactThreeFiber.Object3DNode<THREE.PerspectiveCamera, typeof THREE.PerspectiveCamera> & ReactThreeFiber.Object3DNode<THREE.OrthographicCamera, typeof THREE.OrthographicCamera>>) & {
|
|
112
109
|
manual?: boolean;
|
|
113
110
|
};
|
|
114
111
|
onPointerMissed?: (event: MouseEvent) => void;
|
|
115
112
|
};
|
|
116
|
-
|
|
117
|
-
declare const
|
|
118
|
-
declare const createStore: (applyProps: ApplyProps, invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean | undefined, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void, props: StoreProps) => UseStore<RootState>;
|
|
113
|
+
declare const context: React.Context<UseStore<RootState, import("zustand").StoreApi<RootState>>>;
|
|
114
|
+
declare const createStore: (invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean | undefined, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void) => UseStore<RootState>;
|
|
119
115
|
export { createStore, context };
|
|
@@ -26,14 +26,20 @@ export declare function filterKeys<TObj extends {
|
|
|
26
26
|
}, TOmit extends boolean, TKey extends keyof TObj>(obj: TObj, omit: TOmit, ...keys: TKey[]): TOmit extends true ? Omit<TObj, TKey> : Pick<TObj, TKey>;
|
|
27
27
|
export declare const pick: <TObj>(obj: Partial<TObj>, keys: (keyof TObj)[]) => Pick<Partial<TObj>, keyof TObj>;
|
|
28
28
|
export declare const omit: <TObj>(obj: Partial<TObj>, keys: (keyof TObj)[]) => Omit<Partial<TObj>, keyof TObj>;
|
|
29
|
+
export declare type EquConfig = {
|
|
30
|
+
arrays?: 'reference' | 'shallow';
|
|
31
|
+
objects?: 'reference' | 'shallow';
|
|
32
|
+
strict?: boolean;
|
|
33
|
+
};
|
|
29
34
|
export declare const is: {
|
|
30
35
|
obj: (a: any) => boolean;
|
|
31
36
|
fun: (a: any) => a is Function;
|
|
32
37
|
str: (a: any) => a is string;
|
|
33
38
|
num: (a: any) => a is number;
|
|
39
|
+
boo: (a: any) => a is boolean;
|
|
34
40
|
und: (a: any) => boolean;
|
|
35
41
|
arr: (a: any) => boolean;
|
|
36
|
-
equ(a: any, b: any): boolean;
|
|
42
|
+
equ(a: any, b: any, { arrays, objects, strict }?: EquConfig): boolean;
|
|
37
43
|
};
|
|
38
44
|
export declare function buildGraph(object: THREE.Object3D): ObjectMap;
|
|
39
45
|
export declare function dispose<TObj extends {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './three-types';
|
|
2
2
|
import * as ReactThreeFiber from './three-types';
|
|
3
3
|
export { ReactThreeFiber };
|
|
4
|
+
export type { BaseInstance, LocalState } from './core/renderer';
|
|
4
5
|
export type { Intersection, Subscription, Dpr, Size, Viewport, Camera, RenderCallback, Performance, RootState, } from './core/store';
|
|
5
6
|
export type { ThreeEvent, Events, EventManager } from './core/events';
|
|
6
7
|
export type { ObjectMap } from './core/utils';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './three-types';
|
|
2
2
|
import * as ReactThreeFiber from './three-types';
|
|
3
3
|
export { ReactThreeFiber };
|
|
4
|
+
export type { BaseInstance, LocalState } from './core/renderer';
|
|
4
5
|
export type { Intersection, Subscription, Dpr, Size, Viewport, Camera, RenderCallback, Performance, RootState, } from './core/store';
|
|
5
6
|
export type { ThreeEvent, Events, EventManager } from './core/events';
|
|
6
7
|
export type { ObjectMap } from './core/utils';
|
|
@@ -41,6 +41,7 @@ export declare type Object3DNode<T, P> = Overwrite<Node<T, P>, {
|
|
|
41
41
|
export declare type BufferGeometryNode<T extends THREE.BufferGeometry, P> = Node<T, P>;
|
|
42
42
|
export declare type MaterialNode<T extends THREE.Material, P> = Node<T, P>;
|
|
43
43
|
export declare type LightNode<T extends THREE.Light, P> = Object3DNode<T, P>;
|
|
44
|
+
export declare type Object3DProps = Object3DNode<THREE.Object3D, typeof THREE.Object3D>;
|
|
44
45
|
export declare type AudioListenerProps = Object3DNode<THREE.AudioListener, typeof THREE.AudioListener>;
|
|
45
46
|
export declare type PositionalAudioProps = Object3DNode<THREE.PositionalAudio, typeof THREE.PositionalAudio>;
|
|
46
47
|
export declare type MeshProps = Object3DNode<THREE.Mesh, typeof THREE.Mesh>;
|
|
@@ -166,7 +167,15 @@ export declare type Matrix3Props = Node<THREE.Matrix3, typeof THREE.Matrix3>;
|
|
|
166
167
|
export declare type Matrix4Props = Node<THREE.Matrix4, typeof THREE.Matrix4>;
|
|
167
168
|
export declare type QuaternionProps = Node<THREE.Quaternion, typeof THREE.Quaternion>;
|
|
168
169
|
export declare type BufferAttributeProps = Node<THREE.BufferAttribute, typeof THREE.BufferAttribute>;
|
|
170
|
+
export declare type Float16BufferAttributeProps = Node<THREE.Float16BufferAttribute, typeof THREE.Float16BufferAttribute>;
|
|
169
171
|
export declare type Float32BufferAttributeProps = Node<THREE.Float32BufferAttribute, typeof THREE.Float32BufferAttribute>;
|
|
172
|
+
export declare type Float64BufferAttributeProps = Node<THREE.Float64BufferAttribute, typeof THREE.Float64BufferAttribute>;
|
|
173
|
+
export declare type Int8BufferAttributeProps = Node<THREE.Int8BufferAttribute, typeof THREE.Int8BufferAttribute>;
|
|
174
|
+
export declare type Int16BufferAttributeProps = Node<THREE.Int16BufferAttribute, typeof THREE.Int16BufferAttribute>;
|
|
175
|
+
export declare type Int32BufferAttributeProps = Node<THREE.Int32BufferAttribute, typeof THREE.Int32BufferAttribute>;
|
|
176
|
+
export declare type Uint8BufferAttributeProps = Node<THREE.Uint8BufferAttribute, typeof THREE.Uint8BufferAttribute>;
|
|
177
|
+
export declare type Uint16BufferAttributeProps = Node<THREE.Uint16BufferAttribute, typeof THREE.Uint16BufferAttribute>;
|
|
178
|
+
export declare type Uint32BufferAttributeProps = Node<THREE.Uint32BufferAttribute, typeof THREE.Uint32BufferAttribute>;
|
|
170
179
|
export declare type InstancedBufferAttributeProps = Node<THREE.InstancedBufferAttribute, typeof THREE.InstancedBufferAttribute>;
|
|
171
180
|
export declare type ColorProps = Node<THREE.Color, ColorArray>;
|
|
172
181
|
export declare type FogProps = Node<THREE.Fog, typeof THREE.Fog>;
|
|
@@ -175,6 +184,7 @@ export declare type ShapeProps = Node<THREE.Shape, typeof THREE.Shape>;
|
|
|
175
184
|
declare global {
|
|
176
185
|
namespace JSX {
|
|
177
186
|
interface IntrinsicElements {
|
|
187
|
+
object3D: Object3DProps;
|
|
178
188
|
audioListener: AudioListenerProps;
|
|
179
189
|
positionalAudio: PositionalAudioProps;
|
|
180
190
|
mesh: MeshProps;
|
|
@@ -296,7 +306,15 @@ declare global {
|
|
|
296
306
|
matrix4: Matrix4Props;
|
|
297
307
|
quaternion: QuaternionProps;
|
|
298
308
|
bufferAttribute: BufferAttributeProps;
|
|
309
|
+
float16BufferAttribute: Float16BufferAttributeProps;
|
|
299
310
|
float32BufferAttribute: Float32BufferAttributeProps;
|
|
311
|
+
float64BufferAttribute: Float64BufferAttributeProps;
|
|
312
|
+
int8BufferAttribute: Int8BufferAttributeProps;
|
|
313
|
+
int16BufferAttribute: Int16BufferAttributeProps;
|
|
314
|
+
int32BufferAttribute: Int32BufferAttributeProps;
|
|
315
|
+
uint8BufferAttribute: Uint8BufferAttributeProps;
|
|
316
|
+
uint16BufferAttribute: Uint16BufferAttributeProps;
|
|
317
|
+
uint32BufferAttribute: Uint32BufferAttributeProps;
|
|
300
318
|
instancedBufferAttribute: InstancedBufferAttributeProps;
|
|
301
319
|
color: ColorProps;
|
|
302
320
|
fog: FogProps;
|