@react-three/fiber 8.0.0-beta-02 → 8.0.0-beta.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 +54 -0
- package/dist/declarations/src/core/events.d.ts +5 -4
- package/dist/declarations/src/{web → core}/index.d.ts +6 -8
- package/dist/declarations/src/core/loop.d.ts +2 -1
- package/dist/declarations/src/core/renderer.d.ts +5 -5
- package/dist/declarations/src/core/store.d.ts +15 -7
- package/dist/declarations/src/core/utils.d.ts +8 -1
- package/dist/declarations/src/index.d.ts +5 -2
- package/dist/declarations/src/native/Canvas.d.ts +2 -5
- package/dist/declarations/src/native/events.d.ts +0 -1
- package/dist/declarations/src/native.d.ts +5 -2
- package/dist/declarations/src/three-types.d.ts +12 -24
- package/dist/declarations/src/web/Canvas.d.ts +2 -2
- package/dist/declarations/src/web/events.d.ts +0 -1
- package/dist/{hooks-c89a6f88.esm.js → index-3f4e5f46.esm.js} +459 -163
- package/dist/{hooks-e01f12ec.cjs.prod.js → index-95c17855.cjs.dev.js} +478 -175
- package/dist/{hooks-dd693347.cjs.dev.js → index-ff8b5912.cjs.prod.js} +478 -175
- package/dist/react-three-fiber.cjs.dev.js +83 -300
- package/dist/react-three-fiber.cjs.prod.js +83 -300
- package/dist/react-three-fiber.esm.js +56 -273
- package/native/dist/react-three-fiber-native.cjs.dev.js +160 -392
- package/native/dist/react-three-fiber-native.cjs.prod.js +160 -392
- package/native/dist/react-three-fiber-native.esm.js +135 -367
- package/package.json +20 -15
- package/readme.md +10 -10
- package/dist/declarations/src/native/hooks.d.ts +0 -9
- package/dist/declarations/src/native/index.d.ts +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 8.0.0-beta.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cf6316c: new beta for library testing
|
|
8
|
+
|
|
9
|
+
## 7.0.25
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 8698734: Release latest patches
|
|
14
|
+
|
|
15
|
+
## 7.0.24
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 7f46ddf: cleanup captured pointers when released (#1914)
|
|
20
|
+
|
|
21
|
+
## 7.0.23
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 30d38b1: remove logs
|
|
26
|
+
|
|
27
|
+
## 7.0.22
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- 259e1fa: add camera:manual
|
|
32
|
+
|
|
33
|
+
## 7.0.21
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 65e4147: up usemeasure, add last event to internals"
|
|
38
|
+
|
|
39
|
+
## 7.0.20
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 54cb0fd: update react-use-measure, allow it to use the offsetSize
|
|
44
|
+
|
|
45
|
+
## 7.0.19
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 7aa2eab: fix: remove zustand subcribe selector
|
|
50
|
+
|
|
51
|
+
## 7.0.18
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- 6780f58: fix unmount pointer capture
|
|
56
|
+
|
|
3
57
|
## 7.0.17
|
|
4
58
|
|
|
5
59
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ import type { RootState } from './store';
|
|
|
4
4
|
export interface Intersection extends THREE.Intersection {
|
|
5
5
|
eventObject: THREE.Object3D;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface IntersectionEvent<TSourceEvent> extends Intersection {
|
|
8
8
|
intersections: Intersection[];
|
|
9
9
|
stopped: boolean;
|
|
10
10
|
unprojectedPoint: THREE.Vector3;
|
|
@@ -18,8 +18,8 @@ export interface IntesectionEvent<TSourceEvent> extends Intersection {
|
|
|
18
18
|
spaceY: number;
|
|
19
19
|
}
|
|
20
20
|
export declare type Camera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
|
|
21
|
-
export declare type ThreeEvent<TEvent> =
|
|
22
|
-
export declare type DomEvent =
|
|
21
|
+
export declare type ThreeEvent<TEvent> = IntersectionEvent<TEvent>;
|
|
22
|
+
export declare type DomEvent = PointerEvent | MouseEvent | WheelEvent;
|
|
23
23
|
export declare type Events = {
|
|
24
24
|
onClick: EventListener;
|
|
25
25
|
onContextMenu: EventListener;
|
|
@@ -43,7 +43,7 @@ export declare type EventHandlers = {
|
|
|
43
43
|
onPointerEnter?: (event: ThreeEvent<PointerEvent>) => void;
|
|
44
44
|
onPointerLeave?: (event: ThreeEvent<PointerEvent>) => void;
|
|
45
45
|
onPointerMove?: (event: ThreeEvent<PointerEvent>) => void;
|
|
46
|
-
onPointerMissed?: (event:
|
|
46
|
+
onPointerMissed?: (event: MouseEvent) => void;
|
|
47
47
|
onPointerCancel?: (event: ThreeEvent<PointerEvent>) => void;
|
|
48
48
|
onWheel?: (event: ThreeEvent<WheelEvent>) => void;
|
|
49
49
|
};
|
|
@@ -57,6 +57,7 @@ export interface PointerCaptureTarget {
|
|
|
57
57
|
intersection: Intersection;
|
|
58
58
|
target: Element;
|
|
59
59
|
}
|
|
60
|
+
export declare function getEventPriority(): any;
|
|
60
61
|
export declare function removeInteractivity(store: UseStore<RootState>, object: THREE.Object3D): void;
|
|
61
62
|
export declare function createEvents(store: UseStore<RootState>): {
|
|
62
63
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
@@ -6,11 +6,9 @@ import { dispose } from '../core/utils';
|
|
|
6
6
|
import { Renderer, StoreProps, context, RootState, Size } from '../core/store';
|
|
7
7
|
import { extend, Root } from '../core/renderer';
|
|
8
8
|
import { addEffect, addAfterEffect, addTail } from '../core/loop';
|
|
9
|
-
import {
|
|
10
|
-
import { Canvas } from './Canvas';
|
|
11
|
-
import { EventManager } from '../core/events';
|
|
9
|
+
import { EventManager } from './events';
|
|
12
10
|
declare const roots: Map<Element, Root>;
|
|
13
|
-
declare const invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined) => void;
|
|
11
|
+
declare const invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void;
|
|
14
12
|
declare const reconciler: import("react-reconciler").Reconciler<unknown, unknown, unknown, unknown, unknown>, applyProps: typeof import("../core/utils").applyProps;
|
|
15
13
|
declare type Properties<T> = Pick<T, {
|
|
16
14
|
[K in keyof T]: T[K] extends (_: any) => any ? never : K;
|
|
@@ -26,9 +24,9 @@ declare function createRoot<TCanvas extends Element>(canvas: TCanvas, config?: R
|
|
|
26
24
|
render: (element: React.ReactNode) => UseStore<RootState>;
|
|
27
25
|
unmount: () => void;
|
|
28
26
|
};
|
|
29
|
-
declare function render<TCanvas extends Element>(element: React.ReactNode, canvas: TCanvas,
|
|
27
|
+
declare function render<TCanvas extends Element>(element: React.ReactNode, canvas: TCanvas, config?: RenderProps<TCanvas>): UseStore<RootState>;
|
|
30
28
|
declare function unmountComponentAtNode<TElement extends Element>(canvas: TElement, callback?: (canvas: TElement) => void): void;
|
|
31
|
-
declare const act:
|
|
29
|
+
declare const act: any;
|
|
32
30
|
declare function createPortal(children: React.ReactNode, container: THREE.Object3D): React.ReactNode;
|
|
33
|
-
export * from '
|
|
34
|
-
export { context, render, createRoot, unmountComponentAtNode, createPortal,
|
|
31
|
+
export * from './hooks';
|
|
32
|
+
export { context, render, createRoot, unmountComponentAtNode, createPortal, reconciler, applyProps, dispose, invalidate, advance, extend, addEffect, addAfterEffect, addTail, act, roots as _roots, };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
1
2
|
import { Root } from './renderer';
|
|
2
3
|
import { RootState } from './store';
|
|
3
4
|
declare type GlobalRenderCallback = (timeStamp: number) => void;
|
|
@@ -7,6 +8,6 @@ export declare const addTail: (callback: GlobalRenderCallback) => () => void;
|
|
|
7
8
|
export declare function createLoop<TCanvas>(roots: Map<TCanvas, Root>): {
|
|
8
9
|
loop: (timestamp: number) => number | undefined;
|
|
9
10
|
invalidate: (state?: RootState | undefined) => void;
|
|
10
|
-
advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined) => void;
|
|
11
|
+
advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void;
|
|
11
12
|
};
|
|
12
13
|
export {};
|
|
@@ -15,17 +15,17 @@ export declare type LocalState = {
|
|
|
15
15
|
primitive?: boolean;
|
|
16
16
|
eventCount: number;
|
|
17
17
|
handlers: Partial<EventHandlers>;
|
|
18
|
+
attach?: AttachType;
|
|
19
|
+
previousAttach?: any;
|
|
18
20
|
memoizedProps: {
|
|
19
21
|
[key: string]: any;
|
|
20
22
|
};
|
|
21
23
|
};
|
|
22
|
-
export declare type AttachFnType = (
|
|
23
|
-
export declare type
|
|
24
|
+
export declare type AttachFnType = (parent: Instance, self: Instance) => void;
|
|
25
|
+
export declare type AttachType = string | [attach: string | AttachFnType, detach: string | AttachFnType];
|
|
24
26
|
export declare type BaseInstance = Omit<THREE.Object3D, 'children' | 'attach' | 'add' | 'remove' | 'raycast'> & {
|
|
25
27
|
__r3f: LocalState;
|
|
26
28
|
children: Instance[];
|
|
27
|
-
attach?: string;
|
|
28
|
-
attachFns?: AttachFnsType;
|
|
29
29
|
remove: (...object: Instance[]) => Instance;
|
|
30
30
|
add: (...object: Instance[]) => Instance;
|
|
31
31
|
raycast?: (raycaster: THREE.Raycaster, intersects: THREE.Intersection[]) => void;
|
|
@@ -40,7 +40,7 @@ export declare type InstanceProps = {
|
|
|
40
40
|
object?: object;
|
|
41
41
|
visible?: boolean;
|
|
42
42
|
dispose?: null;
|
|
43
|
-
attach?:
|
|
43
|
+
attach?: AttachType;
|
|
44
44
|
};
|
|
45
45
|
declare let extend: (objects: object) => void;
|
|
46
46
|
declare function createRenderer<TCanvas>(roots: Map<TCanvas, Root>, getEventPriority?: () => any): {
|
|
@@ -29,7 +29,7 @@ export declare type Raycaster = THREE.Raycaster & {
|
|
|
29
29
|
filter?: FilterFunction;
|
|
30
30
|
computeOffsets?: ComputeOffsetsFunction;
|
|
31
31
|
};
|
|
32
|
-
export declare type RenderCallback = (state: RootState, delta: number) => void;
|
|
32
|
+
export declare type RenderCallback = (state: RootState, delta: number, frame?: THREE.XRFrame) => void;
|
|
33
33
|
export declare type Performance = {
|
|
34
34
|
current: number;
|
|
35
35
|
min: number;
|
|
@@ -47,8 +47,9 @@ export declare type InternalState = {
|
|
|
47
47
|
priority: number;
|
|
48
48
|
frames: number;
|
|
49
49
|
lastProps: StoreProps;
|
|
50
|
+
lastEvent: React.MutableRefObject<DomEvent | null>;
|
|
50
51
|
interaction: THREE.Object3D[];
|
|
51
|
-
hovered: Map<string, DomEvent
|
|
52
|
+
hovered: Map<string, ThreeEvent<DomEvent>>;
|
|
52
53
|
subscribers: Subscription[];
|
|
53
54
|
capturedMap: Map<number, Map<THREE.Object3D, PointerCaptureTarget>>;
|
|
54
55
|
initialClick: [x: number, y: number];
|
|
@@ -62,7 +63,9 @@ export declare type InternalState = {
|
|
|
62
63
|
export declare type RootState = {
|
|
63
64
|
gl: THREE.WebGLRenderer;
|
|
64
65
|
scene: THREE.Scene;
|
|
65
|
-
camera: Camera
|
|
66
|
+
camera: Camera & {
|
|
67
|
+
manual?: boolean;
|
|
68
|
+
};
|
|
66
69
|
controls: THREE.EventDispatcher | null;
|
|
67
70
|
raycaster: Raycaster;
|
|
68
71
|
mouse: THREE.Vector2;
|
|
@@ -81,7 +84,8 @@ export declare type RootState = {
|
|
|
81
84
|
advance: (timestamp: number, runGlobalEffects?: boolean) => void;
|
|
82
85
|
setSize: (width: number, height: number) => void;
|
|
83
86
|
setDpr: (dpr: Dpr) => void;
|
|
84
|
-
|
|
87
|
+
setFrameloop: (frameloop?: 'always' | 'demand' | 'never') => void;
|
|
88
|
+
onPointerMissed?: (event: MouseEvent) => void;
|
|
85
89
|
events: EventManager<any>;
|
|
86
90
|
internal: InternalState;
|
|
87
91
|
};
|
|
@@ -89,6 +93,8 @@ export declare type FilterFunction = (items: THREE.Intersection[], state: RootSt
|
|
|
89
93
|
export declare type ComputeOffsetsFunction = (event: any, state: RootState) => {
|
|
90
94
|
offsetX: number;
|
|
91
95
|
offsetY: number;
|
|
96
|
+
width?: number;
|
|
97
|
+
height?: number;
|
|
92
98
|
};
|
|
93
99
|
export declare type StoreProps = {
|
|
94
100
|
gl: THREE.WebGLRenderer;
|
|
@@ -102,10 +108,12 @@ export declare type StoreProps = {
|
|
|
102
108
|
dpr?: Dpr;
|
|
103
109
|
clock?: THREE.Clock;
|
|
104
110
|
raycaster?: Partial<Raycaster>;
|
|
105
|
-
camera?: Camera | Partial<ReactThreeFiber.Object3DNode<THREE.Camera, typeof THREE.Camera> & ReactThreeFiber.Object3DNode<THREE.PerspectiveCamera, typeof THREE.PerspectiveCamera> & ReactThreeFiber.Object3DNode<THREE.OrthographicCamera, typeof THREE.OrthographicCamera
|
|
106
|
-
|
|
111
|
+
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
|
+
manual?: boolean;
|
|
113
|
+
};
|
|
114
|
+
onPointerMissed?: (event: MouseEvent) => void;
|
|
107
115
|
};
|
|
108
116
|
export declare type ApplyProps = (instance: Instance, newProps: InstanceProps) => void;
|
|
109
117
|
declare const context: React.Context<UseStore<RootState>>;
|
|
110
|
-
declare const createStore: (applyProps: ApplyProps, invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean | undefined, state?: RootState | undefined) => void, props: StoreProps) => UseStore<RootState>;
|
|
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>;
|
|
111
119
|
export { createStore, context };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { Instance, InstanceProps, LocalState } from './renderer';
|
|
2
|
+
import { AttachType, Instance, InstanceProps, LocalState } from './renderer';
|
|
3
3
|
import { Dpr } from './store';
|
|
4
4
|
export declare const DEFAULT = "__default";
|
|
5
5
|
export declare type DiffSet = {
|
|
@@ -21,6 +21,11 @@ export declare type ObjectMap = {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
export declare function calculateDpr(dpr: Dpr): number;
|
|
24
|
+
export declare function filterKeys<TObj extends {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}, TOmit extends boolean, TKey extends keyof TObj>(obj: TObj, omit: TOmit, ...keys: TKey[]): TOmit extends true ? Omit<TObj, TKey> : Pick<TObj, TKey>;
|
|
27
|
+
export declare const pick: <TObj>(obj: Partial<TObj>, keys: (keyof TObj)[]) => Pick<Partial<TObj>, keyof TObj>;
|
|
28
|
+
export declare const omit: <TObj>(obj: Partial<TObj>, keys: (keyof TObj)[]) => Omit<Partial<TObj>, keyof TObj>;
|
|
24
29
|
export declare const is: {
|
|
25
30
|
obj: (a: any) => boolean;
|
|
26
31
|
fun: (a: any) => a is Function;
|
|
@@ -37,6 +42,8 @@ export declare function dispose<TObj extends {
|
|
|
37
42
|
[key: string]: any;
|
|
38
43
|
}>(obj: TObj): void;
|
|
39
44
|
export declare function prepare<T = THREE.Object3D>(object: T, state?: Partial<LocalState>): T;
|
|
45
|
+
export declare function attach(parent: Instance, child: Instance, type: AttachType): void;
|
|
46
|
+
export declare function detach(parent: Instance, child: Instance, type: AttachType): void;
|
|
40
47
|
export declare function diffProps(instance: Instance, { children: cN, key: kN, ref: rN, ...props }: InstanceProps, { children: cP, key: kP, ref: rP, ...previous }?: InstanceProps, remove?: boolean): DiffSet;
|
|
41
48
|
export declare function applyProps(instance: Instance, data: InstanceProps | DiffSet): void;
|
|
42
49
|
export declare function invalidateInstance(instance: Instance): void;
|
|
@@ -1,7 +1,10 @@
|
|
|
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
|
-
export type {
|
|
7
|
-
export * from './web';
|
|
7
|
+
export type { ObjectMap } from './core/utils';
|
|
8
|
+
export * from './web/Canvas';
|
|
9
|
+
export { createPointerEvents as events } from './web/events';
|
|
10
|
+
export * from './core';
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
-
import { ExpoWebGLRenderingContext } from 'expo-gl';
|
|
4
3
|
import { UseStore } from 'zustand';
|
|
5
|
-
import { RenderProps } from '
|
|
4
|
+
import { RenderProps } from '../core';
|
|
6
5
|
import { RootState } from '../core/store';
|
|
7
6
|
import { EventManager } from '../core/events';
|
|
8
|
-
export interface Props extends Omit<RenderProps<
|
|
7
|
+
export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'events'>, ViewProps {
|
|
9
8
|
children: React.ReactNode;
|
|
10
9
|
fallback?: React.ReactNode;
|
|
11
10
|
style?: ViewStyle;
|
|
12
11
|
events?: (store: UseStore<RootState>) => EventManager<any>;
|
|
13
|
-
nativeRef_EXPERIMENTAL?: React.MutableRefObject<any>;
|
|
14
|
-
onContextCreate?: (gl: ExpoWebGLRenderingContext) => Promise<any> | void;
|
|
15
12
|
}
|
|
16
13
|
export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<View>>;
|
|
@@ -2,5 +2,4 @@ import { UseStore } from 'zustand';
|
|
|
2
2
|
import { RootState } from '../core/store';
|
|
3
3
|
import { EventManager } from '../core/events';
|
|
4
4
|
import { View } from 'react-native';
|
|
5
|
-
export declare function getEventPriority(): any;
|
|
6
5
|
export declare function createTouchEvents(store: UseStore<RootState>): EventManager<View>;
|
|
@@ -1,7 +1,10 @@
|
|
|
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
|
-
export type {
|
|
7
|
-
export * from './native/
|
|
7
|
+
export type { ObjectMap } from './core/utils';
|
|
8
|
+
export * from './native/Canvas';
|
|
9
|
+
export { createTouchEvents as events } from './native/events';
|
|
10
|
+
export * from './core';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import * as THREE from 'three';
|
|
3
2
|
import { EventHandlers } from './core/events';
|
|
3
|
+
import { AttachType } from './core/renderer';
|
|
4
4
|
export declare type NonFunctionKeys<T> = {
|
|
5
5
|
[K in keyof T]: T[K] extends Function ? never : K;
|
|
6
6
|
}[keyof T];
|
|
@@ -17,17 +17,17 @@ export declare type Layers = THREE.Layers | Parameters<THREE.Layers['set']>[0];
|
|
|
17
17
|
export declare type Quaternion = THREE.Quaternion | Parameters<THREE.Quaternion['set']>;
|
|
18
18
|
export declare type AttachCallback = string | ((child: any, parentInstance: any) => void);
|
|
19
19
|
export interface NodeProps<T, P> {
|
|
20
|
-
attach?:
|
|
21
|
-
attachArray?: string;
|
|
22
|
-
attachObject?: [target: string, name: string];
|
|
23
|
-
attachFns?: [AttachCallback, AttachCallback];
|
|
20
|
+
attach?: AttachType;
|
|
24
21
|
args?: Args<P>;
|
|
25
22
|
children?: React.ReactNode;
|
|
26
|
-
ref?: React.
|
|
23
|
+
ref?: React.RefCallback<T> | React.RefObject<React.ReactNode> | null;
|
|
27
24
|
key?: React.Key;
|
|
28
25
|
onUpdate?: (self: T) => void;
|
|
29
26
|
}
|
|
30
|
-
export declare type
|
|
27
|
+
export declare type ExtendedColors<T> = {
|
|
28
|
+
[K in keyof T]: T[K] extends THREE.Color | undefined ? Color : T[K];
|
|
29
|
+
};
|
|
30
|
+
export declare type Node<T, P> = ExtendedColors<Overwrite<Partial<T>, NodeProps<T, P>>>;
|
|
31
31
|
export declare type Object3DNode<T, P> = Overwrite<Node<T, P>, {
|
|
32
32
|
position?: Vector3;
|
|
33
33
|
up?: Vector3;
|
|
@@ -38,13 +38,9 @@ export declare type Object3DNode<T, P> = Overwrite<Node<T, P>, {
|
|
|
38
38
|
layers?: Layers;
|
|
39
39
|
dispose?: (() => void) | null;
|
|
40
40
|
}> & EventHandlers;
|
|
41
|
-
export declare type BufferGeometryNode<T extends THREE.BufferGeometry, P> =
|
|
42
|
-
export declare type MaterialNode<T extends THREE.Material, P> =
|
|
43
|
-
|
|
44
|
-
}>;
|
|
45
|
-
export declare type LightNode<T extends THREE.Light, P> = Overwrite<Object3DNode<T, P>, {
|
|
46
|
-
color?: Color;
|
|
47
|
-
}>;
|
|
41
|
+
export declare type BufferGeometryNode<T extends THREE.BufferGeometry, P> = Node<T, P>;
|
|
42
|
+
export declare type MaterialNode<T extends THREE.Material, P> = Node<T, P>;
|
|
43
|
+
export declare type LightNode<T extends THREE.Light, P> = Object3DNode<T, P>;
|
|
48
44
|
export declare type AudioListenerProps = Object3DNode<THREE.AudioListener, typeof THREE.AudioListener>;
|
|
49
45
|
export declare type PositionalAudioProps = Object3DNode<THREE.PositionalAudio, typeof THREE.PositionalAudio>;
|
|
50
46
|
export declare type MeshProps = Object3DNode<THREE.Mesh, typeof THREE.Mesh>;
|
|
@@ -59,7 +55,6 @@ export declare type LineSegmentsProps = Object3DNode<THREE.LineSegments, typeof
|
|
|
59
55
|
export declare type LineLoopProps = Object3DNode<THREE.LineLoop, typeof THREE.LineLoop>;
|
|
60
56
|
export declare type PointsProps = Object3DNode<THREE.Points, typeof THREE.Points>;
|
|
61
57
|
export declare type GroupProps = Object3DNode<THREE.Group, typeof THREE.Group>;
|
|
62
|
-
export declare type ImmediateRenderObjectProps = Object3DNode<THREE.ImmediateRenderObject, typeof THREE.ImmediateRenderObject>;
|
|
63
58
|
export declare type CameraProps = Object3DNode<THREE.Camera, typeof THREE.Camera>;
|
|
64
59
|
export declare type PerspectiveCameraProps = Object3DNode<THREE.PerspectiveCamera, typeof THREE.PerspectiveCamera>;
|
|
65
60
|
export declare type OrthographicCameraProps = Object3DNode<THREE.OrthographicCamera, typeof THREE.OrthographicCamera>;
|
|
@@ -76,19 +71,16 @@ export declare type ExtrudeBufferGeometryProps = BufferGeometryNode<THREE.Extrud
|
|
|
76
71
|
export declare type IcosahedronBufferGeometryProps = BufferGeometryNode<THREE.IcosahedronBufferGeometry, typeof THREE.IcosahedronBufferGeometry>;
|
|
77
72
|
export declare type LatheBufferGeometryProps = BufferGeometryNode<THREE.LatheBufferGeometry, typeof THREE.LatheBufferGeometry>;
|
|
78
73
|
export declare type OctahedronBufferGeometryProps = BufferGeometryNode<THREE.OctahedronBufferGeometry, typeof THREE.OctahedronBufferGeometry>;
|
|
79
|
-
export declare type ParametricBufferGeometryProps = BufferGeometryNode<THREE.ParametricBufferGeometry, typeof THREE.ParametricBufferGeometry>;
|
|
80
74
|
export declare type PlaneBufferGeometryProps = BufferGeometryNode<THREE.PlaneBufferGeometry, typeof THREE.PlaneBufferGeometry>;
|
|
81
75
|
export declare type PolyhedronBufferGeometryProps = BufferGeometryNode<THREE.PolyhedronBufferGeometry, typeof THREE.PolyhedronBufferGeometry>;
|
|
82
76
|
export declare type RingBufferGeometryProps = BufferGeometryNode<THREE.RingBufferGeometry, typeof THREE.RingBufferGeometry>;
|
|
83
77
|
export declare type ShapeBufferGeometryProps = BufferGeometryNode<THREE.ShapeBufferGeometry, typeof THREE.ShapeBufferGeometry>;
|
|
84
78
|
export declare type SphereBufferGeometryProps = BufferGeometryNode<THREE.SphereBufferGeometry, typeof THREE.SphereBufferGeometry>;
|
|
85
79
|
export declare type TetrahedronBufferGeometryProps = BufferGeometryNode<THREE.TetrahedronBufferGeometry, typeof THREE.TetrahedronBufferGeometry>;
|
|
86
|
-
export declare type TextBufferGeometryProps = BufferGeometryNode<THREE.TextBufferGeometry, typeof THREE.TextBufferGeometry>;
|
|
87
80
|
export declare type TorusBufferGeometryProps = BufferGeometryNode<THREE.TorusBufferGeometry, typeof THREE.TorusBufferGeometry>;
|
|
88
81
|
export declare type TorusKnotBufferGeometryProps = BufferGeometryNode<THREE.TorusKnotBufferGeometry, typeof THREE.TorusKnotBufferGeometry>;
|
|
89
82
|
export declare type TubeBufferGeometryProps = BufferGeometryNode<THREE.TubeBufferGeometry, typeof THREE.TubeBufferGeometry>;
|
|
90
83
|
export declare type WireframeGeometryProps = BufferGeometryNode<THREE.WireframeGeometry, typeof THREE.WireframeGeometry>;
|
|
91
|
-
export declare type ParametricGeometryProps = BufferGeometryNode<THREE.ParametricGeometry, typeof THREE.ParametricGeometry>;
|
|
92
84
|
export declare type TetrahedronGeometryProps = BufferGeometryNode<THREE.TetrahedronGeometry, typeof THREE.TetrahedronGeometry>;
|
|
93
85
|
export declare type OctahedronGeometryProps = BufferGeometryNode<THREE.OctahedronGeometry, typeof THREE.OctahedronGeometry>;
|
|
94
86
|
export declare type IcosahedronGeometryProps = BufferGeometryNode<THREE.IcosahedronGeometry, typeof THREE.IcosahedronGeometry>;
|
|
@@ -97,7 +89,6 @@ export declare type PolyhedronGeometryProps = BufferGeometryNode<THREE.Polyhedro
|
|
|
97
89
|
export declare type TubeGeometryProps = BufferGeometryNode<THREE.TubeGeometry, typeof THREE.TubeGeometry>;
|
|
98
90
|
export declare type TorusKnotGeometryProps = BufferGeometryNode<THREE.TorusKnotGeometry, typeof THREE.TorusKnotGeometry>;
|
|
99
91
|
export declare type TorusGeometryProps = BufferGeometryNode<THREE.TorusGeometry, typeof THREE.TorusGeometry>;
|
|
100
|
-
export declare type TextGeometryProps = BufferGeometryNode<THREE.TextGeometry, typeof THREE.TextGeometry>;
|
|
101
92
|
export declare type SphereGeometryProps = BufferGeometryNode<THREE.SphereGeometry, typeof THREE.SphereGeometry>;
|
|
102
93
|
export declare type RingGeometryProps = BufferGeometryNode<THREE.RingGeometry, typeof THREE.RingGeometry>;
|
|
103
94
|
export declare type PlaneGeometryProps = BufferGeometryNode<THREE.PlaneGeometry, typeof THREE.PlaneGeometry>;
|
|
@@ -175,6 +166,7 @@ export declare type Matrix3Props = Node<THREE.Matrix3, typeof THREE.Matrix3>;
|
|
|
175
166
|
export declare type Matrix4Props = Node<THREE.Matrix4, typeof THREE.Matrix4>;
|
|
176
167
|
export declare type QuaternionProps = Node<THREE.Quaternion, typeof THREE.Quaternion>;
|
|
177
168
|
export declare type BufferAttributeProps = Node<THREE.BufferAttribute, typeof THREE.BufferAttribute>;
|
|
169
|
+
export declare type Float32BufferAttributeProps = Node<THREE.Float32BufferAttribute, typeof THREE.Float32BufferAttribute>;
|
|
178
170
|
export declare type InstancedBufferAttributeProps = Node<THREE.InstancedBufferAttribute, typeof THREE.InstancedBufferAttribute>;
|
|
179
171
|
export declare type ColorProps = Node<THREE.Color, ColorArray>;
|
|
180
172
|
export declare type FogProps = Node<THREE.Fog, typeof THREE.Fog>;
|
|
@@ -197,7 +189,6 @@ declare global {
|
|
|
197
189
|
lineLoop: LineLoopProps;
|
|
198
190
|
points: PointsProps;
|
|
199
191
|
group: GroupProps;
|
|
200
|
-
immediateRenderObject: ImmediateRenderObjectProps;
|
|
201
192
|
camera: CameraProps;
|
|
202
193
|
perspectiveCamera: PerspectiveCameraProps;
|
|
203
194
|
orthographicCamera: OrthographicCameraProps;
|
|
@@ -214,19 +205,16 @@ declare global {
|
|
|
214
205
|
icosahedronBufferGeometry: IcosahedronBufferGeometryProps;
|
|
215
206
|
latheBufferGeometry: LatheBufferGeometryProps;
|
|
216
207
|
octahedronBufferGeometry: OctahedronBufferGeometryProps;
|
|
217
|
-
parametricBufferGeometry: ParametricBufferGeometryProps;
|
|
218
208
|
planeBufferGeometry: PlaneBufferGeometryProps;
|
|
219
209
|
polyhedronBufferGeometry: PolyhedronBufferGeometryProps;
|
|
220
210
|
ringBufferGeometry: RingBufferGeometryProps;
|
|
221
211
|
shapeBufferGeometry: ShapeBufferGeometryProps;
|
|
222
212
|
sphereBufferGeometry: SphereBufferGeometryProps;
|
|
223
213
|
tetrahedronBufferGeometry: TetrahedronBufferGeometryProps;
|
|
224
|
-
textBufferGeometry: TextBufferGeometryProps;
|
|
225
214
|
torusBufferGeometry: TorusBufferGeometryProps;
|
|
226
215
|
torusKnotBufferGeometry: TorusKnotBufferGeometryProps;
|
|
227
216
|
tubeBufferGeometry: TubeBufferGeometryProps;
|
|
228
217
|
wireframeGeometry: WireframeGeometryProps;
|
|
229
|
-
parametricGeometry: ParametricGeometryProps;
|
|
230
218
|
tetrahedronGeometry: TetrahedronGeometryProps;
|
|
231
219
|
octahedronGeometry: OctahedronGeometryProps;
|
|
232
220
|
icosahedronGeometry: IcosahedronGeometryProps;
|
|
@@ -235,7 +223,6 @@ declare global {
|
|
|
235
223
|
tubeGeometry: TubeGeometryProps;
|
|
236
224
|
torusKnotGeometry: TorusKnotGeometryProps;
|
|
237
225
|
torusGeometry: TorusGeometryProps;
|
|
238
|
-
textGeometry: TextGeometryProps;
|
|
239
226
|
sphereGeometry: SphereGeometryProps;
|
|
240
227
|
ringGeometry: RingGeometryProps;
|
|
241
228
|
planeGeometry: PlaneGeometryProps;
|
|
@@ -309,6 +296,7 @@ declare global {
|
|
|
309
296
|
matrix4: Matrix4Props;
|
|
310
297
|
quaternion: QuaternionProps;
|
|
311
298
|
bufferAttribute: BufferAttributeProps;
|
|
299
|
+
float32BufferAttribute: Float32BufferAttributeProps;
|
|
312
300
|
instancedBufferAttribute: InstancedBufferAttributeProps;
|
|
313
301
|
color: ColorProps;
|
|
314
302
|
fog: FogProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Options as ResizeOptions } from 'react-use-measure';
|
|
2
|
+
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
3
|
import { UseStore } from 'zustand';
|
|
4
|
-
import { RenderProps } from '
|
|
4
|
+
import { RenderProps } from '../core';
|
|
5
5
|
import { RootState } from '../core/store';
|
|
6
6
|
import { EventManager } from '../core/events';
|
|
7
7
|
export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'events'>, React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UseStore } from 'zustand';
|
|
2
2
|
import { RootState } from '../core/store';
|
|
3
3
|
import { EventManager } from '../core/events';
|
|
4
|
-
export declare function getEventPriority(): any;
|
|
5
4
|
export declare function createPointerEvents(store: UseStore<RootState>): EventManager<HTMLElement>;
|