@react-three/fiber 8.0.0-alpha.0 → 8.0.0-beta-04
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 +103 -0
- package/dist/declarations/src/core/events.d.ts +64 -59
- package/dist/declarations/src/core/hooks.d.ts +21 -29
- package/dist/declarations/src/core/index.d.ts +31 -0
- package/dist/declarations/src/core/loop.d.ts +12 -12
- package/dist/declarations/src/core/renderer.d.ts +50 -52
- package/dist/declarations/src/core/store.d.ts +117 -106
- package/dist/declarations/src/core/utils.d.ts +50 -0
- package/dist/declarations/src/index.d.ts +10 -7
- package/dist/declarations/src/native/Canvas.d.ts +13 -0
- package/dist/declarations/src/native/events.d.ts +5 -0
- package/dist/declarations/src/native/hooks.d.ts +9 -0
- package/dist/declarations/src/native.d.ts +10 -0
- package/dist/declarations/src/three-types.d.ts +309 -320
- package/dist/declarations/src/web/Canvas.d.ts +13 -13
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/dist/index-eb414398.cjs.prod.js +1805 -0
- package/dist/index-fccd77b0.esm.js +1750 -0
- package/dist/index-ff3eb68b.cjs.dev.js +1805 -0
- package/dist/react-three-fiber.cjs.dev.js +108 -1734
- package/dist/react-three-fiber.cjs.prod.js +108 -1734
- package/dist/react-three-fiber.esm.js +63 -1686
- package/native/dist/react-three-fiber-native.cjs.d.ts +1 -0
- package/native/dist/react-three-fiber-native.cjs.dev.js +388 -0
- package/native/dist/react-three-fiber-native.cjs.js +7 -0
- package/native/dist/react-three-fiber-native.cjs.prod.js +388 -0
- package/native/dist/react-three-fiber-native.esm.js +336 -0
- package/native/package.json +5 -0
- package/package.json +19 -8
- package/readme.md +10 -10
- package/__mocks__/react-use-measure/index.ts +0 -22
- package/dist/declarations/src/core/is.d.ts +0 -9
- package/dist/declarations/src/web/index.d.ts +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 7.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 30d38b1: remove logs
|
|
8
|
+
|
|
9
|
+
## 7.0.22
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 259e1fa: add camera:manual
|
|
14
|
+
|
|
15
|
+
## 7.0.21
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 65e4147: up usemeasure, add last event to internals"
|
|
20
|
+
|
|
21
|
+
## 7.0.20
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 54cb0fd: update react-use-measure, allow it to use the offsetSize
|
|
26
|
+
|
|
27
|
+
## 7.0.19
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- 7aa2eab: fix: remove zustand subcribe selector
|
|
32
|
+
|
|
33
|
+
## 7.0.18
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 6780f58: fix unmount pointer capture
|
|
38
|
+
|
|
39
|
+
## 7.0.17
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 894c550: fix: event count
|
|
44
|
+
|
|
45
|
+
## 7.0.16
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- c7a4220: patch: applyprops returns the same instance
|
|
50
|
+
|
|
51
|
+
## 7.0.15
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- c5645e8: fix primitve leftovers on switch
|
|
56
|
+
|
|
57
|
+
## 7.0.14
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- 05af996: fix: revert the is function
|
|
62
|
+
|
|
63
|
+
## 7.0.13
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- f256558: fix(core): don't overwrite camera rotation
|
|
68
|
+
- 51e6fc9: fix(core): safely handle external instances
|
|
69
|
+
|
|
70
|
+
## 7.0.12
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- 0df6073: fix: missed events
|
|
75
|
+
|
|
76
|
+
## 7.0.11
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- 62b0a3a: fix: event order of missed pointers
|
|
81
|
+
|
|
82
|
+
## 7.0.10
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- e019dd4: fixes
|
|
87
|
+
|
|
88
|
+
## 7.0.9
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- cd266e4: Fix diffProps dashed keys
|
|
93
|
+
|
|
94
|
+
## 7.0.8
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- 6f68406: Allow getCurrentViewport to receive an array
|
|
99
|
+
|
|
100
|
+
## 7.0.7
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- 0375896: Simplify useframe, support instanced event cancelation, silence disposal
|
|
105
|
+
|
|
3
106
|
## 7.0.6
|
|
4
107
|
|
|
5
108
|
### Patch Changes
|
|
@@ -1,59 +1,64 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import type { UseStore } from 'zustand';
|
|
3
|
-
import type { RootState } from './store';
|
|
4
|
-
export interface Intersection extends THREE.Intersection {
|
|
5
|
-
eventObject: THREE.Object3D;
|
|
6
|
-
}
|
|
7
|
-
export interface
|
|
8
|
-
intersections: Intersection[];
|
|
9
|
-
stopped: boolean;
|
|
10
|
-
unprojectedPoint: THREE.Vector3;
|
|
11
|
-
ray: THREE.Ray;
|
|
12
|
-
camera: Camera;
|
|
13
|
-
stopPropagation: () => void;
|
|
14
|
-
sourceEvent: TSourceEvent;
|
|
15
|
-
nativeEvent: TSourceEvent;
|
|
16
|
-
delta: number;
|
|
17
|
-
spaceX: number;
|
|
18
|
-
spaceY: number;
|
|
19
|
-
}
|
|
20
|
-
export declare type Camera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
|
|
21
|
-
export declare type ThreeEvent<TEvent> =
|
|
22
|
-
export declare type DomEvent =
|
|
23
|
-
export declare type Events = {
|
|
24
|
-
onClick: EventListener;
|
|
25
|
-
onContextMenu: EventListener;
|
|
26
|
-
onDoubleClick: EventListener;
|
|
27
|
-
onWheel: EventListener;
|
|
28
|
-
onPointerDown: EventListener;
|
|
29
|
-
onPointerUp: EventListener;
|
|
30
|
-
onPointerLeave: EventListener;
|
|
31
|
-
onPointerMove: EventListener;
|
|
32
|
-
onPointerCancel: EventListener;
|
|
33
|
-
onLostPointerCapture: EventListener;
|
|
34
|
-
};
|
|
35
|
-
export declare type EventHandlers = {
|
|
36
|
-
onClick?: (event: ThreeEvent<MouseEvent>) => void;
|
|
37
|
-
onContextMenu?: (event: ThreeEvent<MouseEvent>) => void;
|
|
38
|
-
onDoubleClick?: (event: ThreeEvent<MouseEvent>) => void;
|
|
39
|
-
onPointerUp?: (event: ThreeEvent<PointerEvent>) => void;
|
|
40
|
-
onPointerDown?: (event: ThreeEvent<PointerEvent>) => void;
|
|
41
|
-
onPointerOver?: (event: ThreeEvent<PointerEvent>) => void;
|
|
42
|
-
onPointerOut?: (event: ThreeEvent<PointerEvent>) => void;
|
|
43
|
-
onPointerEnter?: (event: ThreeEvent<PointerEvent>) => void;
|
|
44
|
-
onPointerLeave?: (event: ThreeEvent<PointerEvent>) => void;
|
|
45
|
-
onPointerMove?: (event: ThreeEvent<PointerEvent>) => void;
|
|
46
|
-
onPointerMissed?: (event:
|
|
47
|
-
onPointerCancel?: (event: ThreeEvent<PointerEvent>) => void;
|
|
48
|
-
onWheel?: (event: ThreeEvent<WheelEvent>) => void;
|
|
49
|
-
};
|
|
50
|
-
export interface EventManager<TTarget> {
|
|
51
|
-
connected: TTarget | boolean;
|
|
52
|
-
handlers?: Events;
|
|
53
|
-
connect?: (target: TTarget) => void;
|
|
54
|
-
disconnect?: () => void;
|
|
55
|
-
}
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { UseStore } from 'zustand';
|
|
3
|
+
import type { RootState } from './store';
|
|
4
|
+
export interface Intersection extends THREE.Intersection {
|
|
5
|
+
eventObject: THREE.Object3D;
|
|
6
|
+
}
|
|
7
|
+
export interface IntersectionEvent<TSourceEvent> extends Intersection {
|
|
8
|
+
intersections: Intersection[];
|
|
9
|
+
stopped: boolean;
|
|
10
|
+
unprojectedPoint: THREE.Vector3;
|
|
11
|
+
ray: THREE.Ray;
|
|
12
|
+
camera: Camera;
|
|
13
|
+
stopPropagation: () => void;
|
|
14
|
+
sourceEvent: TSourceEvent;
|
|
15
|
+
nativeEvent: TSourceEvent;
|
|
16
|
+
delta: number;
|
|
17
|
+
spaceX: number;
|
|
18
|
+
spaceY: number;
|
|
19
|
+
}
|
|
20
|
+
export declare type Camera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
|
|
21
|
+
export declare type ThreeEvent<TEvent> = IntersectionEvent<TEvent>;
|
|
22
|
+
export declare type DomEvent = PointerEvent | MouseEvent | WheelEvent;
|
|
23
|
+
export declare type Events = {
|
|
24
|
+
onClick: EventListener;
|
|
25
|
+
onContextMenu: EventListener;
|
|
26
|
+
onDoubleClick: EventListener;
|
|
27
|
+
onWheel: EventListener;
|
|
28
|
+
onPointerDown: EventListener;
|
|
29
|
+
onPointerUp: EventListener;
|
|
30
|
+
onPointerLeave: EventListener;
|
|
31
|
+
onPointerMove: EventListener;
|
|
32
|
+
onPointerCancel: EventListener;
|
|
33
|
+
onLostPointerCapture: EventListener;
|
|
34
|
+
};
|
|
35
|
+
export declare type EventHandlers = {
|
|
36
|
+
onClick?: (event: ThreeEvent<MouseEvent>) => void;
|
|
37
|
+
onContextMenu?: (event: ThreeEvent<MouseEvent>) => void;
|
|
38
|
+
onDoubleClick?: (event: ThreeEvent<MouseEvent>) => void;
|
|
39
|
+
onPointerUp?: (event: ThreeEvent<PointerEvent>) => void;
|
|
40
|
+
onPointerDown?: (event: ThreeEvent<PointerEvent>) => void;
|
|
41
|
+
onPointerOver?: (event: ThreeEvent<PointerEvent>) => void;
|
|
42
|
+
onPointerOut?: (event: ThreeEvent<PointerEvent>) => void;
|
|
43
|
+
onPointerEnter?: (event: ThreeEvent<PointerEvent>) => void;
|
|
44
|
+
onPointerLeave?: (event: ThreeEvent<PointerEvent>) => void;
|
|
45
|
+
onPointerMove?: (event: ThreeEvent<PointerEvent>) => void;
|
|
46
|
+
onPointerMissed?: (event: MouseEvent) => void;
|
|
47
|
+
onPointerCancel?: (event: ThreeEvent<PointerEvent>) => void;
|
|
48
|
+
onWheel?: (event: ThreeEvent<WheelEvent>) => void;
|
|
49
|
+
};
|
|
50
|
+
export interface EventManager<TTarget> {
|
|
51
|
+
connected: TTarget | boolean;
|
|
52
|
+
handlers?: Events;
|
|
53
|
+
connect?: (target: TTarget) => void;
|
|
54
|
+
disconnect?: () => void;
|
|
55
|
+
}
|
|
56
|
+
export interface PointerCaptureTarget {
|
|
57
|
+
intersection: Intersection;
|
|
58
|
+
target: Element;
|
|
59
|
+
}
|
|
60
|
+
export declare function getEventPriority(): any;
|
|
61
|
+
export declare function removeInteractivity(store: UseStore<RootState>, object: THREE.Object3D): void;
|
|
62
|
+
export declare function createEvents(store: UseStore<RootState>): {
|
|
63
|
+
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
64
|
+
};
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { StateSelector, EqualityChecker } from 'zustand';
|
|
3
|
-
import
|
|
4
|
-
import { RootState, RenderCallback } from './store';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
declare type
|
|
10
|
-
declare type
|
|
11
|
-
declare type
|
|
12
|
-
export declare type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare function useFrame(callback: RenderCallback, renderPriority?: number): null;
|
|
23
|
-
export declare function useGraph(object: THREE.Object3D): ObjectMap;
|
|
24
|
-
export declare function useLoader<T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U, extensions?: Extensions, onProgress?: (event: ProgressEvent<EventTarget>) => void): U extends any[] ? BranchingReturn<T, GLTF, GLTF & ObjectMap>[] : BranchingReturn<T, GLTF, GLTF & ObjectMap>;
|
|
25
|
-
export declare namespace useLoader {
|
|
26
|
-
var preload: <T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U, extensions?: Extensions | undefined) => undefined;
|
|
27
|
-
var clear: <T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U) => void;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { StateSelector, EqualityChecker } from 'zustand';
|
|
3
|
+
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
4
|
+
import { RootState, RenderCallback } from './store';
|
|
5
|
+
import { ObjectMap } from './utils';
|
|
6
|
+
export interface Loader<T> extends THREE.Loader {
|
|
7
|
+
load(url: string, onLoad?: (result: T) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare type Extensions = (loader: THREE.Loader) => void;
|
|
10
|
+
export declare type LoaderResult<T> = T extends any[] ? Loader<T[number]> : Loader<T>;
|
|
11
|
+
export declare type ConditionalType<Child, Parent, Truthy, Falsy> = Child extends Parent ? Truthy : Falsy;
|
|
12
|
+
export declare type BranchingReturn<T, Parent, Coerced> = ConditionalType<T, Parent, Coerced, T>;
|
|
13
|
+
export declare function useStore(): import("zustand").UseStore<RootState>;
|
|
14
|
+
export declare function useThree<T = RootState>(selector?: StateSelector<RootState, T>, equalityFn?: EqualityChecker<T>): T;
|
|
15
|
+
export declare function useFrame(callback: RenderCallback, renderPriority?: number): null;
|
|
16
|
+
export declare function useGraph(object: THREE.Object3D): ObjectMap;
|
|
17
|
+
export declare function useLoader<T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U, extensions?: Extensions, onProgress?: (event: ProgressEvent<EventTarget>) => void): U extends any[] ? BranchingReturn<T, GLTF, GLTF & ObjectMap>[] : BranchingReturn<T, GLTF, GLTF & ObjectMap>;
|
|
18
|
+
export declare namespace useLoader {
|
|
19
|
+
var preload: <T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U, extensions?: Extensions | undefined) => undefined;
|
|
20
|
+
var clear: <T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U) => void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react-reconciler" />
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { UseStore } from 'zustand';
|
|
5
|
+
import { dispose } from '../core/utils';
|
|
6
|
+
import { Renderer, StoreProps, context, RootState, Size } from '../core/store';
|
|
7
|
+
import { extend, Root } from '../core/renderer';
|
|
8
|
+
import { addEffect, addAfterEffect, addTail } from '../core/loop';
|
|
9
|
+
import { EventManager } from './events';
|
|
10
|
+
declare const roots: Map<Element, Root>;
|
|
11
|
+
declare const invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined) => void;
|
|
12
|
+
declare const reconciler: import("react-reconciler").Reconciler<unknown, unknown, unknown, unknown, unknown>, applyProps: typeof import("../core/utils").applyProps;
|
|
13
|
+
declare type Properties<T> = Pick<T, {
|
|
14
|
+
[K in keyof T]: T[K] extends (_: any) => any ? never : K;
|
|
15
|
+
}[keyof T]>;
|
|
16
|
+
declare type GLProps = Renderer | ((canvas: HTMLCanvasElement) => Renderer) | Partial<Properties<THREE.WebGLRenderer> | THREE.WebGLRendererParameters> | undefined;
|
|
17
|
+
export declare type RenderProps<TCanvas extends Element> = Omit<StoreProps, 'gl' | 'events' | 'size'> & {
|
|
18
|
+
gl?: GLProps;
|
|
19
|
+
events?: (store: UseStore<RootState>) => EventManager<TCanvas>;
|
|
20
|
+
size?: Size;
|
|
21
|
+
onCreated?: (state: RootState) => void;
|
|
22
|
+
};
|
|
23
|
+
declare function createRoot<TCanvas extends Element>(canvas: TCanvas, config?: RenderProps<TCanvas>): {
|
|
24
|
+
render: (element: React.ReactNode) => UseStore<RootState>;
|
|
25
|
+
unmount: () => void;
|
|
26
|
+
};
|
|
27
|
+
declare function render<TCanvas extends Element>(element: React.ReactNode, canvas: TCanvas, config?: RenderProps<TCanvas>): UseStore<RootState>;
|
|
28
|
+
declare function unmountComponentAtNode<TElement extends Element>(canvas: TElement, callback?: (canvas: TElement) => void): void;
|
|
29
|
+
declare const act: any;
|
|
30
|
+
declare function createPortal(children: React.ReactNode, container: THREE.Object3D): React.ReactNode;
|
|
31
|
+
export { context, render, createRoot, unmountComponentAtNode, createPortal, reconciler, applyProps, dispose, invalidate, advance, extend, addEffect, addAfterEffect, addTail, act, roots as _roots, };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Root } from './renderer';
|
|
2
|
-
import { RootState } from './store';
|
|
3
|
-
declare type GlobalRenderCallback = (timeStamp: number) => void;
|
|
4
|
-
export declare const addEffect: (callback: GlobalRenderCallback) => () => void;
|
|
5
|
-
export declare const addAfterEffect: (callback: GlobalRenderCallback) => () => void;
|
|
6
|
-
export declare const addTail: (callback: GlobalRenderCallback) => () => void;
|
|
7
|
-
export declare function createLoop<TCanvas>(roots: Map<TCanvas, Root>): {
|
|
8
|
-
loop: (timestamp: number) => number | undefined;
|
|
9
|
-
invalidate: (state?: RootState | undefined) => void;
|
|
10
|
-
advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined) => void;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
1
|
+
import { Root } from './renderer';
|
|
2
|
+
import { RootState } from './store';
|
|
3
|
+
declare type GlobalRenderCallback = (timeStamp: number) => void;
|
|
4
|
+
export declare const addEffect: (callback: GlobalRenderCallback) => () => void;
|
|
5
|
+
export declare const addAfterEffect: (callback: GlobalRenderCallback) => () => void;
|
|
6
|
+
export declare const addTail: (callback: GlobalRenderCallback) => () => void;
|
|
7
|
+
export declare function createLoop<TCanvas>(roots: Map<TCanvas, Root>): {
|
|
8
|
+
loop: (timestamp: number) => number | undefined;
|
|
9
|
+
invalidate: (state?: RootState | undefined) => void;
|
|
10
|
+
advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined) => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -1,52 +1,50 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export declare type
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
declare
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
export { prepare, createRenderer, extend };
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { UseStore } from 'zustand';
|
|
3
|
+
import Reconciler from 'react-reconciler';
|
|
4
|
+
import { prepare, applyProps } from './utils';
|
|
5
|
+
import { RootState } from './store';
|
|
6
|
+
import { EventHandlers } from './events';
|
|
7
|
+
export declare type Root = {
|
|
8
|
+
fiber: Reconciler.FiberRoot;
|
|
9
|
+
store: UseStore<RootState>;
|
|
10
|
+
};
|
|
11
|
+
export declare type LocalState = {
|
|
12
|
+
root: UseStore<RootState>;
|
|
13
|
+
objects: Instance[];
|
|
14
|
+
parent: Instance | null;
|
|
15
|
+
primitive?: boolean;
|
|
16
|
+
eventCount: number;
|
|
17
|
+
handlers: Partial<EventHandlers>;
|
|
18
|
+
attach?: AttachType;
|
|
19
|
+
previousAttach?: any;
|
|
20
|
+
memoizedProps: {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare type AttachFnType = (parent: Instance, self: Instance) => void;
|
|
25
|
+
export declare type AttachType = string | [attach: string | AttachFnType, detach: string | AttachFnType];
|
|
26
|
+
export declare type BaseInstance = Omit<THREE.Object3D, 'children' | 'attach' | 'add' | 'remove' | 'raycast'> & {
|
|
27
|
+
__r3f: LocalState;
|
|
28
|
+
children: Instance[];
|
|
29
|
+
remove: (...object: Instance[]) => Instance;
|
|
30
|
+
add: (...object: Instance[]) => Instance;
|
|
31
|
+
raycast?: (raycaster: THREE.Raycaster, intersects: THREE.Intersection[]) => void;
|
|
32
|
+
};
|
|
33
|
+
export declare type Instance = BaseInstance & {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
};
|
|
36
|
+
export declare type InstanceProps = {
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
} & {
|
|
39
|
+
args?: any[];
|
|
40
|
+
object?: object;
|
|
41
|
+
visible?: boolean;
|
|
42
|
+
dispose?: null;
|
|
43
|
+
attach?: AttachType;
|
|
44
|
+
};
|
|
45
|
+
declare let extend: (objects: object) => void;
|
|
46
|
+
declare function createRenderer<TCanvas>(roots: Map<TCanvas, Root>, getEventPriority?: () => any): {
|
|
47
|
+
reconciler: Reconciler.Reconciler<unknown, unknown, unknown, unknown, unknown>;
|
|
48
|
+
applyProps: typeof applyProps;
|
|
49
|
+
};
|
|
50
|
+
export { prepare, createRenderer, extend };
|