@react-three/fiber 8.0.0-alpha-05 → 8.0.0-alpha-09
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/events.d.ts +2 -2
- package/dist/declarations/src/core/hooks.d.ts +1 -1
- package/dist/declarations/src/core/renderer.d.ts +8 -9
- package/dist/declarations/src/core/store.d.ts +1 -1
- package/dist/declarations/src/core/utils.d.ts +27 -0
- package/dist/declarations/src/web/Canvas.d.ts +1 -1
- package/dist/declarations/src/web/events.d.ts +2 -1
- package/dist/declarations/src/web/index.d.ts +3 -3
- package/dist/react-three-fiber.cjs.dev.js +312 -379
- package/dist/react-three-fiber.cjs.prod.js +312 -379
- package/dist/react-three-fiber.esm.js +313 -380
- package/package.json +1 -1
- package/dist/declarations/src/core/is.d.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { UseStore } from 'zustand';
|
|
3
|
+
import { RootState } from './store';
|
|
4
4
|
export interface Intersection extends THREE.Intersection {
|
|
5
5
|
eventObject: THREE.Object3D;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { StateSelector, EqualityChecker } from 'zustand';
|
|
3
|
-
import
|
|
3
|
+
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
4
4
|
import { RootState, RenderCallback } from './store';
|
|
5
5
|
export interface Loader<T> extends THREE.Loader {
|
|
6
6
|
load(url: string, onLoad?: (result: T) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): unknown;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import Reconciler from 'react-reconciler';
|
|
3
2
|
import { UseStore } from 'zustand';
|
|
3
|
+
import Reconciler from 'react-reconciler';
|
|
4
|
+
import { prepare, applyProps } from './utils';
|
|
4
5
|
import { RootState } from './store';
|
|
5
6
|
import { EventHandlers } from './events';
|
|
6
7
|
export declare type Root = {
|
|
@@ -10,15 +11,14 @@ export declare type Root = {
|
|
|
10
11
|
export declare type LocalState = {
|
|
11
12
|
root: UseStore<RootState>;
|
|
12
13
|
objects: Instance[];
|
|
13
|
-
|
|
14
|
-
handlers
|
|
14
|
+
primitive?: boolean;
|
|
15
|
+
handlers: {
|
|
16
|
+
count: number;
|
|
17
|
+
} & Partial<EventHandlers>;
|
|
15
18
|
memoizedProps: {
|
|
16
19
|
[key: string]: any;
|
|
17
20
|
};
|
|
18
21
|
};
|
|
19
|
-
export declare type ClassConstructor = {
|
|
20
|
-
new (): void;
|
|
21
|
-
};
|
|
22
22
|
export declare type AttachFnType = (self: Instance, parent: Instance) => void;
|
|
23
23
|
export declare type AttachFnsType = [attach: string | AttachFnType, detach: string | AttachFnType];
|
|
24
24
|
export declare type BaseInstance = Omit<THREE.Object3D, 'parent' | 'children' | 'attach' | 'add' | 'remove' | 'raycast'> & {
|
|
@@ -44,9 +44,8 @@ export declare type InstanceProps = {
|
|
|
44
44
|
attach?: string;
|
|
45
45
|
};
|
|
46
46
|
declare let extend: (objects: object) => void;
|
|
47
|
-
declare function
|
|
48
|
-
declare function createRenderer<TCanvas>(roots: Map<TCanvas, Root>): {
|
|
47
|
+
declare function createRenderer<TCanvas>(roots: Map<TCanvas, Root>, getEventPriority?: () => any): {
|
|
49
48
|
reconciler: Reconciler.Reconciler<unknown, unknown, unknown, unknown, unknown>;
|
|
50
|
-
applyProps:
|
|
49
|
+
applyProps: typeof applyProps;
|
|
51
50
|
};
|
|
52
51
|
export { prepare, createRenderer, extend };
|
|
@@ -100,7 +100,7 @@ export declare type StoreProps = {
|
|
|
100
100
|
camera?: Camera | Partial<ReactThreeFiber.Object3DNode<THREE.Camera, typeof THREE.Camera> & ReactThreeFiber.Object3DNode<THREE.PerspectiveCamera, typeof THREE.PerspectiveCamera> & ReactThreeFiber.Object3DNode<THREE.OrthographicCamera, typeof THREE.OrthographicCamera>>;
|
|
101
101
|
onPointerMissed?: (event: ThreeEvent<PointerEvent>) => void;
|
|
102
102
|
};
|
|
103
|
-
export declare type ApplyProps = (instance: Instance, newProps: InstanceProps
|
|
103
|
+
export declare type ApplyProps = (instance: Instance, newProps: InstanceProps) => void;
|
|
104
104
|
declare const context: React.Context<UseStore<RootState>>;
|
|
105
105
|
declare const createStore: (applyProps: ApplyProps, invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean | undefined, state?: RootState | undefined) => void, props: StoreProps) => UseStore<RootState>;
|
|
106
106
|
export { createStore, context };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { Instance, InstanceProps, LocalState } from './renderer';
|
|
3
|
+
export declare const DEFAULT = "__default";
|
|
4
|
+
export declare type DiffSet = {
|
|
5
|
+
memoized: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
changes: [key: string, value: unknown, isEvent: boolean, instance: Instance, prop: any][];
|
|
9
|
+
};
|
|
10
|
+
export declare const isDiffSet: (def: any) => def is DiffSet;
|
|
11
|
+
export declare type ClassConstructor = {
|
|
12
|
+
new (): void;
|
|
13
|
+
};
|
|
14
|
+
export declare const is: {
|
|
15
|
+
obj: (a: any) => boolean;
|
|
16
|
+
fun: (a: any) => a is Function;
|
|
17
|
+
str: (a: any) => a is string;
|
|
18
|
+
num: (a: any) => a is number;
|
|
19
|
+
und: (a: any) => boolean;
|
|
20
|
+
arr: (a: any) => boolean;
|
|
21
|
+
equ(a: any, b: any): boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare function prepare<T = THREE.Object3D>(object: T, state?: Partial<LocalState>): T;
|
|
24
|
+
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;
|
|
25
|
+
export declare function applyProps(instance: Instance, data: InstanceProps | DiffSet): void;
|
|
26
|
+
export declare function invalidateInstance(instance: Instance): void;
|
|
27
|
+
export declare function updateInstance(instance: Instance): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
-
import { RenderProps } from './index';
|
|
4
3
|
import { UseStore } from 'zustand';
|
|
4
|
+
import { RenderProps } from './index';
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import { UseStore } from 'zustand';
|
|
2
2
|
import { RootState } from '../core/store';
|
|
3
|
-
import
|
|
3
|
+
import { EventManager } from '../core/events';
|
|
4
|
+
export declare function getEventPriority(): any;
|
|
4
5
|
export declare function createPointerEvents(store: UseStore<RootState>): EventManager<HTMLElement>;
|
|
@@ -10,9 +10,9 @@ import { Canvas } from './Canvas';
|
|
|
10
10
|
import { EventManager } from '../core/events';
|
|
11
11
|
declare const roots: Map<Element, Root>;
|
|
12
12
|
declare const invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined) => void;
|
|
13
|
-
declare const reconciler: import("react-reconciler").Reconciler<unknown, unknown, unknown, unknown, unknown>, applyProps:
|
|
13
|
+
declare const reconciler: import("react-reconciler").Reconciler<unknown, unknown, unknown, unknown, unknown>, applyProps: typeof import("../core/utils").applyProps;
|
|
14
14
|
export declare type RenderProps<TCanvas extends Element> = Omit<StoreProps, 'gl' | 'events' | 'size'> & {
|
|
15
|
-
gl?: THREE.WebGLRenderer | THREE.WebGLRendererParameters
|
|
15
|
+
gl?: THREE.WebGLRenderer | Partial<THREE.WebGLRendererParameters>;
|
|
16
16
|
events?: (store: UseStore<RootState>) => EventManager<TCanvas>;
|
|
17
17
|
size?: Size;
|
|
18
18
|
onCreated?: (state: RootState) => void;
|
|
@@ -25,6 +25,6 @@ declare function dispose<TObj extends {
|
|
|
25
25
|
[key: string]: any;
|
|
26
26
|
}>(obj: TObj): void;
|
|
27
27
|
declare const act: (callback: () => import("react-reconciler").Thenable<unknown>) => import("react-reconciler").Thenable<void>;
|
|
28
|
-
declare function createPortal(children: React.ReactNode, container: THREE.Object3D
|
|
28
|
+
declare function createPortal(children: React.ReactNode, container: THREE.Object3D): React.ReactNode;
|
|
29
29
|
export * from '../core/hooks';
|
|
30
30
|
export { context, render, unmountComponentAtNode, createPortal, events, reconciler, applyProps, dispose, invalidate, advance, extend, addEffect, addAfterEffect, addTail, Canvas, act, roots as _roots, };
|