@react-three/fiber 9.0.0-alpha.2 → 9.0.0-alpha.3
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 +962 -522
- package/dist/declarations/src/core/events.d.ts +91 -69
- package/dist/declarations/src/core/hooks.d.ts +53 -27
- package/dist/declarations/src/core/index.d.ts +15 -60
- package/dist/declarations/src/core/loop.d.ts +31 -15
- package/dist/declarations/src/core/reconciler.d.ts +43 -0
- package/dist/declarations/src/core/renderer.d.ts +85 -40
- package/dist/declarations/src/core/stages.d.ts +64 -59
- package/dist/declarations/src/core/store.d.ts +147 -109
- package/dist/declarations/src/core/utils.d.ts +128 -80
- package/dist/declarations/src/index.d.ts +6 -10
- package/dist/declarations/src/native/Canvas.d.ts +14 -8
- package/dist/declarations/src/native/events.d.ts +4 -4
- package/dist/declarations/src/native.d.ts +6 -8
- package/dist/declarations/src/three-types.d.ts +56 -47
- package/dist/declarations/src/web/Canvas.d.ts +24 -11
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/dist/{index-5bd4d3cf.cjs.dev.js → loop-0698c205.cjs.dev.js} +1469 -1268
- package/dist/{index-8128f248.cjs.prod.js → loop-a0ef8208.cjs.prod.js} +1469 -1268
- package/dist/{index-47b7622a.esm.js → loop-b2aca207.esm.js} +1466 -1268
- package/dist/react-three-fiber.cjs.d.ts +1 -0
- package/dist/react-three-fiber.cjs.dev.js +126 -115
- package/dist/react-three-fiber.cjs.prod.js +126 -115
- package/dist/react-three-fiber.esm.js +92 -84
- package/native/dist/react-three-fiber-native.cjs.d.ts +1 -0
- package/native/dist/react-three-fiber-native.cjs.dev.js +278 -211
- package/native/dist/react-three-fiber-native.cjs.prod.js +278 -211
- package/native/dist/react-three-fiber-native.esm.js +242 -180
- package/native/package.json +5 -5
- package/package.json +18 -12
- package/readme.md +253 -202
- package/dist/declarations/src/native/polyfills.d.ts +0 -1
|
@@ -1,59 +1,64 @@
|
|
|
1
|
-
/// <reference types="webxr" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
private
|
|
36
|
-
private
|
|
37
|
-
private
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
get
|
|
48
|
-
get
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
/// <reference types="webxr" />
|
|
2
|
+
import type { Subscription, RootStore } from "./store.js";
|
|
3
|
+
export type UpdateSubscription = Omit<Subscription, 'priority'>;
|
|
4
|
+
/**
|
|
5
|
+
* Class representing a stage that updates every frame.
|
|
6
|
+
* Stages are used to build a lifecycle of effects for an app's frameloop.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Stage {
|
|
9
|
+
private subscribers;
|
|
10
|
+
private _frameTime;
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Executes all callback subscriptions on the stage.
|
|
14
|
+
* @param delta - Delta time between frame calls.
|
|
15
|
+
* @param [frame] - The XR frame if it exists.
|
|
16
|
+
*/
|
|
17
|
+
frame(delta: number, frame?: XRFrame): void;
|
|
18
|
+
/**
|
|
19
|
+
* Adds a callback subscriber to the stage.
|
|
20
|
+
* @param ref - The mutable callback reference.
|
|
21
|
+
* @param store - The store to be used with the callback execution.
|
|
22
|
+
* @returns A function to remove the subscription.
|
|
23
|
+
*/
|
|
24
|
+
add(ref: UpdateSubscription['ref'], store: RootStore): () => void;
|
|
25
|
+
get frameTime(): number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Class representing a stage that updates every frame at a fixed rate.
|
|
29
|
+
* @param name - Name of the stage.
|
|
30
|
+
* @param [fixedStep] - Fixed step rate.
|
|
31
|
+
* @param [maxSubsteps] - Maximum number of substeps.
|
|
32
|
+
*/
|
|
33
|
+
export declare class FixedStage extends Stage {
|
|
34
|
+
private _fixedStep;
|
|
35
|
+
private _maxSubsteps;
|
|
36
|
+
private _accumulator;
|
|
37
|
+
private _alpha;
|
|
38
|
+
private _fixedFrameTime;
|
|
39
|
+
private _substepTimes;
|
|
40
|
+
constructor(fixedStep?: number, maxSubSteps?: number);
|
|
41
|
+
/**
|
|
42
|
+
* Executes all callback subscriptions on the stage.
|
|
43
|
+
* @param delta - Delta time between frame calls.
|
|
44
|
+
* @param [frame] - The XR frame if it exists.
|
|
45
|
+
*/
|
|
46
|
+
frame(delta: number, frame?: XRFrame): void;
|
|
47
|
+
get frameTime(): number;
|
|
48
|
+
get substepTimes(): number[];
|
|
49
|
+
get fixedStep(): number;
|
|
50
|
+
set fixedStep(fixedStep: number);
|
|
51
|
+
get maxSubsteps(): number;
|
|
52
|
+
set maxSubsteps(maxSubsteps: number);
|
|
53
|
+
get accumulator(): number;
|
|
54
|
+
get alpha(): number;
|
|
55
|
+
}
|
|
56
|
+
export declare const Stages: {
|
|
57
|
+
Early: Stage;
|
|
58
|
+
Fixed: FixedStage;
|
|
59
|
+
Update: Stage;
|
|
60
|
+
Late: Stage;
|
|
61
|
+
Render: Stage;
|
|
62
|
+
After: Stage;
|
|
63
|
+
};
|
|
64
|
+
export declare const Lifecycle: Stage[];
|
|
@@ -1,109 +1,147 @@
|
|
|
1
|
-
/// <reference types="webxr" />
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { DomEvent, EventManager, PointerCaptureTarget, ThreeEvent } from
|
|
6
|
-
import { Camera } from
|
|
7
|
-
import { FixedStage, Stage } from
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
dpr: number;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
1
|
+
/// <reference types="webxr" />
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { type StoreApi, type UseBoundStore } from 'zustand';
|
|
5
|
+
import type { DomEvent, EventManager, PointerCaptureTarget, ThreeEvent } from "./events.js";
|
|
6
|
+
import { type Camera } from "./utils.js";
|
|
7
|
+
import type { FixedStage, Stage } from "./stages.js";
|
|
8
|
+
export interface Intersection extends THREE.Intersection {
|
|
9
|
+
eventObject: THREE.Object3D;
|
|
10
|
+
}
|
|
11
|
+
export type Subscription = {
|
|
12
|
+
ref: React.MutableRefObject<RenderCallback>;
|
|
13
|
+
priority: number;
|
|
14
|
+
store: RootStore;
|
|
15
|
+
};
|
|
16
|
+
export type Dpr = number | [min: number, max: number];
|
|
17
|
+
export interface Size {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
top: number;
|
|
21
|
+
left: number;
|
|
22
|
+
}
|
|
23
|
+
export interface Viewport extends Size {
|
|
24
|
+
/** The initial pixel ratio */
|
|
25
|
+
initialDpr: number;
|
|
26
|
+
/** Current pixel ratio */
|
|
27
|
+
dpr: number;
|
|
28
|
+
/** size.width / viewport.width */
|
|
29
|
+
factor: number;
|
|
30
|
+
/** Camera distance */
|
|
31
|
+
distance: number;
|
|
32
|
+
/** Camera aspect ratio: width / height */
|
|
33
|
+
aspect: number;
|
|
34
|
+
}
|
|
35
|
+
export type RenderCallback = (state: RootState, delta: number, frame?: XRFrame) => void;
|
|
36
|
+
export type UpdateCallback = RenderCallback;
|
|
37
|
+
export type LegacyAlways = 'always';
|
|
38
|
+
export type FrameloopMode = LegacyAlways | 'auto' | 'demand' | 'never';
|
|
39
|
+
export type FrameloopRender = 'auto' | 'manual';
|
|
40
|
+
export type FrameloopLegacy = 'always' | 'demand' | 'never';
|
|
41
|
+
export type Frameloop = FrameloopLegacy | {
|
|
42
|
+
mode?: FrameloopMode;
|
|
43
|
+
render?: FrameloopRender;
|
|
44
|
+
maxDelta?: number;
|
|
45
|
+
};
|
|
46
|
+
export interface Performance {
|
|
47
|
+
/** Current performance normal, between min and max */
|
|
48
|
+
current: number;
|
|
49
|
+
/** How low the performance can go, between 0 and max */
|
|
50
|
+
min: number;
|
|
51
|
+
/** How high the performance can go, between min and max */
|
|
52
|
+
max: number;
|
|
53
|
+
/** Time until current returns to max in ms */
|
|
54
|
+
debounce: number;
|
|
55
|
+
/** Sets current to min, puts the system in regression */
|
|
56
|
+
regress: () => void;
|
|
57
|
+
}
|
|
58
|
+
export interface Renderer {
|
|
59
|
+
render: (scene: THREE.Scene, camera: THREE.Camera) => any;
|
|
60
|
+
}
|
|
61
|
+
export declare const isRenderer: (def: any) => boolean;
|
|
62
|
+
export type StageTypes = Stage | FixedStage;
|
|
63
|
+
export interface InternalState {
|
|
64
|
+
interaction: THREE.Object3D[];
|
|
65
|
+
hovered: Map<string, ThreeEvent<DomEvent>>;
|
|
66
|
+
subscribers: Subscription[];
|
|
67
|
+
capturedMap: Map<number, Map<THREE.Object3D, PointerCaptureTarget>>;
|
|
68
|
+
initialClick: [x: number, y: number];
|
|
69
|
+
initialHits: THREE.Object3D[];
|
|
70
|
+
lastEvent: React.MutableRefObject<DomEvent | null>;
|
|
71
|
+
active: boolean;
|
|
72
|
+
priority: number;
|
|
73
|
+
frames: number;
|
|
74
|
+
/** The ordered stages defining the lifecycle. */
|
|
75
|
+
stages: StageTypes[];
|
|
76
|
+
/** Render function flags */
|
|
77
|
+
render: 'auto' | 'manual';
|
|
78
|
+
/** The max delta time between two frames. */
|
|
79
|
+
maxDelta: number;
|
|
80
|
+
subscribe: (callback: React.MutableRefObject<RenderCallback>, priority: number, store: RootStore) => () => void;
|
|
81
|
+
}
|
|
82
|
+
export interface XRManager {
|
|
83
|
+
connect: () => void;
|
|
84
|
+
disconnect: () => void;
|
|
85
|
+
}
|
|
86
|
+
export interface RootState {
|
|
87
|
+
/** Set current state */
|
|
88
|
+
set: StoreApi<RootState>['setState'];
|
|
89
|
+
/** Get current state */
|
|
90
|
+
get: StoreApi<RootState>['getState'];
|
|
91
|
+
/** The instance of the renderer */
|
|
92
|
+
gl: THREE.WebGLRenderer;
|
|
93
|
+
/** Default camera */
|
|
94
|
+
camera: Camera;
|
|
95
|
+
/** Default scene */
|
|
96
|
+
scene: THREE.Scene;
|
|
97
|
+
/** Default raycaster */
|
|
98
|
+
raycaster: THREE.Raycaster;
|
|
99
|
+
/** Default clock */
|
|
100
|
+
clock: THREE.Clock;
|
|
101
|
+
/** Event layer interface, contains the event handler and the node they're connected to */
|
|
102
|
+
events: EventManager<any>;
|
|
103
|
+
/** XR interface */
|
|
104
|
+
xr: XRManager;
|
|
105
|
+
/** Currently used controls */
|
|
106
|
+
controls: THREE.EventDispatcher | null;
|
|
107
|
+
/** Normalized event coordinates */
|
|
108
|
+
pointer: THREE.Vector2;
|
|
109
|
+
/** @deprecated Normalized event coordinates, use "pointer" instead! */
|
|
110
|
+
mouse: THREE.Vector2;
|
|
111
|
+
legacy: boolean;
|
|
112
|
+
/** Shortcut to gl.outputColorSpace = THREE.LinearSRGBColorSpace */
|
|
113
|
+
linear: boolean;
|
|
114
|
+
/** Shortcut to gl.toneMapping = NoTonemapping */
|
|
115
|
+
flat: boolean;
|
|
116
|
+
/** Update frame loop flags */
|
|
117
|
+
frameloop: FrameloopLegacy;
|
|
118
|
+
/** Adaptive performance interface */
|
|
119
|
+
performance: Performance;
|
|
120
|
+
/** Reactive pixel-size of the canvas */
|
|
121
|
+
size: Size;
|
|
122
|
+
/** Reactive size of the viewport in threejs units */
|
|
123
|
+
viewport: Viewport & {
|
|
124
|
+
getCurrentViewport: (camera?: Camera, target?: THREE.Vector3 | Parameters<THREE.Vector3['set']>, size?: Size) => Omit<Viewport, 'dpr' | 'initialDpr'>;
|
|
125
|
+
};
|
|
126
|
+
/** Flags the canvas for render, but doesn't render in itself */
|
|
127
|
+
invalidate: (frames?: number) => void;
|
|
128
|
+
/** Advance (render) one step */
|
|
129
|
+
advance: (timestamp: number, runGlobalEffects?: boolean) => void;
|
|
130
|
+
/** Shortcut to setting the event layer */
|
|
131
|
+
setEvents: (events: Partial<EventManager<any>>) => void;
|
|
132
|
+
/** Shortcut to manual sizing */
|
|
133
|
+
setSize: (width: number, height: number, top?: number, left?: number) => void;
|
|
134
|
+
/** Shortcut to manual setting the pixel ratio */
|
|
135
|
+
setDpr: (dpr: Dpr) => void;
|
|
136
|
+
/** Shortcut to setting frameloop flags */
|
|
137
|
+
setFrameloop: (frameloop: Frameloop) => void;
|
|
138
|
+
/** When the canvas was clicked but nothing was hit */
|
|
139
|
+
onPointerMissed?: (event: MouseEvent) => void;
|
|
140
|
+
/** If this state model is layered (via createPortal) then this contains the previous layer */
|
|
141
|
+
previousRoot?: RootStore;
|
|
142
|
+
/** Internals */
|
|
143
|
+
internal: InternalState;
|
|
144
|
+
}
|
|
145
|
+
export type RootStore = UseBoundStore<StoreApi<RootState>>;
|
|
146
|
+
export declare const context: React.Context<RootStore>;
|
|
147
|
+
export declare const createStore: (invalidate: (state?: RootState, frames?: number) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
|
|
@@ -1,80 +1,128 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
import type { Dpr,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
export
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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, Renderer, RootStore, Size } from "./store.js";
|
|
6
|
+
/**
|
|
7
|
+
* Returns the instance's initial (outmost) root.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findInitialRoot<T>(instance: Instance<T>): RootStore;
|
|
10
|
+
/**
|
|
11
|
+
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
12
|
+
*/
|
|
13
|
+
export declare const hasColorSpace: <T extends object | Renderer | THREE.Texture, P = T extends Renderer ? {
|
|
14
|
+
outputColorSpace: string;
|
|
15
|
+
} : {
|
|
16
|
+
colorSpace: string;
|
|
17
|
+
}>(object: T) => object is T & P;
|
|
18
|
+
export type ColorManagementRepresentation = {
|
|
19
|
+
enabled: boolean | never;
|
|
20
|
+
} | {
|
|
21
|
+
legacyMode: boolean | never;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The current THREE.ColorManagement instance, if present.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getColorManagement: () => ColorManagementRepresentation | null;
|
|
27
|
+
export type Act = <T = any>(cb: () => Promise<T>) => Promise<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Safely flush async effects when testing, simulating a legacy root.
|
|
30
|
+
*/
|
|
31
|
+
export declare const act: Act;
|
|
32
|
+
export type Camera = (THREE.OrthographicCamera | THREE.PerspectiveCamera) & {
|
|
33
|
+
manual?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare const isOrthographicCamera: (def: Camera) => def is THREE.OrthographicCamera;
|
|
36
|
+
export declare const isRef: (obj: any) => obj is React.MutableRefObject<unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* An SSR-friendly useLayoutEffect.
|
|
39
|
+
*
|
|
40
|
+
* React currently throws a warning when using useLayoutEffect on the server.
|
|
41
|
+
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
42
|
+
* useLayoutEffect elsewhere.
|
|
43
|
+
*
|
|
44
|
+
* @see https://github.com/facebook/react/issues/14927
|
|
45
|
+
*/
|
|
46
|
+
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
47
|
+
export declare function useMutableCallback<T>(fn: T): React.MutableRefObject<T>;
|
|
48
|
+
export type Bridge = React.FC<{
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Bridges renderer Context and StrictMode from a primary renderer.
|
|
53
|
+
*/
|
|
54
|
+
export declare function useBridge(): Bridge;
|
|
55
|
+
export type SetBlock = false | Promise<null> | null;
|
|
56
|
+
export type UnblockProps = {
|
|
57
|
+
set: React.Dispatch<React.SetStateAction<SetBlock>>;
|
|
58
|
+
children: React.ReactNode;
|
|
59
|
+
};
|
|
60
|
+
export declare function Block({ set }: Omit<UnblockProps, 'children'>): null;
|
|
61
|
+
export declare class ErrorBoundary extends React.Component<{
|
|
62
|
+
set: React.Dispatch<Error | undefined>;
|
|
63
|
+
children: React.ReactNode;
|
|
64
|
+
}, {
|
|
65
|
+
error: boolean;
|
|
66
|
+
}> {
|
|
67
|
+
state: {
|
|
68
|
+
error: boolean;
|
|
69
|
+
};
|
|
70
|
+
static getDerivedStateFromError: () => {
|
|
71
|
+
error: boolean;
|
|
72
|
+
};
|
|
73
|
+
componentDidCatch(err: Error): void;
|
|
74
|
+
render(): React.ReactNode;
|
|
75
|
+
}
|
|
76
|
+
export interface ObjectMap {
|
|
77
|
+
nodes: {
|
|
78
|
+
[name: string]: THREE.Object3D;
|
|
79
|
+
};
|
|
80
|
+
materials: {
|
|
81
|
+
[name: string]: THREE.Material;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export declare function calculateDpr(dpr: Dpr): number;
|
|
85
|
+
/**
|
|
86
|
+
* Returns instance root state
|
|
87
|
+
*/
|
|
88
|
+
export declare function getRootState<T extends THREE.Object3D = THREE.Object3D>(obj: T): import("./store.js").RootState | undefined;
|
|
89
|
+
export interface EquConfig {
|
|
90
|
+
/** Compare arrays by reference equality a === b (default), or by shallow equality */
|
|
91
|
+
arrays?: 'reference' | 'shallow';
|
|
92
|
+
/** Compare objects by reference equality a === b (default), or by shallow equality */
|
|
93
|
+
objects?: 'reference' | 'shallow';
|
|
94
|
+
/** If true the keys in both a and b must match 1:1 (default), if false a's keys must intersect b's */
|
|
95
|
+
strict?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export declare const is: {
|
|
98
|
+
obj: (a: any) => boolean;
|
|
99
|
+
fun: (a: any) => a is Function;
|
|
100
|
+
str: (a: any) => a is string;
|
|
101
|
+
num: (a: any) => a is number;
|
|
102
|
+
boo: (a: any) => a is boolean;
|
|
103
|
+
und: (a: any) => boolean;
|
|
104
|
+
arr: (a: any) => boolean;
|
|
105
|
+
equ(a: any, b: any, { arrays, objects, strict }?: EquConfig): boolean;
|
|
106
|
+
};
|
|
107
|
+
export declare function buildGraph(object: THREE.Object3D): ObjectMap;
|
|
108
|
+
export interface Disposable {
|
|
109
|
+
type?: string;
|
|
110
|
+
dispose?: () => void;
|
|
111
|
+
}
|
|
112
|
+
export declare function dispose<T extends Disposable>(obj: T): void;
|
|
113
|
+
export declare const REACT_INTERNAL_PROPS: string[];
|
|
114
|
+
export declare function getInstanceProps<T = any>(queue: Fiber['pendingProps']): Instance<T>['props'];
|
|
115
|
+
export declare function prepare<T = any>(target: T, root: RootStore, type: string, props: Instance<T>['props']): Instance<T>;
|
|
116
|
+
export declare function resolve(root: any, key: string): {
|
|
117
|
+
root: any;
|
|
118
|
+
key: string;
|
|
119
|
+
target: any;
|
|
120
|
+
};
|
|
121
|
+
export declare function attach(parent: Instance, child: Instance): void;
|
|
122
|
+
export declare function detach(parent: Instance, child: Instance): void;
|
|
123
|
+
export declare const RESERVED_PROPS: string[];
|
|
124
|
+
export declare function diffProps<T = any>(instance: Instance<T>, newProps: Instance<T>['props'], resetRemoved?: boolean): Instance<T>['props'];
|
|
125
|
+
export declare function applyProps<T = any>(object: Instance<T>['object'], props: Instance<T>['props']): Instance<T>['object'];
|
|
126
|
+
export declare function invalidateInstance(instance: Instance): void;
|
|
127
|
+
export declare function updateCamera(camera: Camera, size: Size): void;
|
|
128
|
+
export declare const isObject3D: (object: any) => object is THREE.Object3D<THREE.Event>;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export { createEvents } from './core/events';
|
|
8
|
-
export { createPointerEvents as events } from './web/events';
|
|
9
|
-
export * from './core';
|
|
10
|
-
export { Stage, FixedStage, Stages } from './core/stages';
|
|
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,8 +1,14 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { View, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
-
import { RenderProps } from
|
|
4
|
-
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'dpr'>, ViewProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
style?: ViewStyle;
|
|
7
|
-
}
|
|
8
|
-
export
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
import { RenderProps } from "../core/index.js";
|
|
4
|
+
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'dpr'>, ViewProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
style?: ViewStyle;
|
|
7
|
+
}
|
|
8
|
+
export interface Props extends CanvasProps {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A native canvas which accepts threejs elements as children.
|
|
12
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
13
|
+
*/
|
|
14
|
+
export declare const Canvas: React.ForwardRefExoticComponent<CanvasProps & React.RefAttributes<View>>;
|