@react-three/fiber 9.0.0-alpha.2 → 9.0.0-alpha.4
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 +42 -0
- package/dist/declarations/src/core/renderer.d.ts +84 -40
- package/dist/declarations/src/core/stages.d.ts +64 -59
- package/dist/declarations/src/core/store.d.ts +134 -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-8128f248.cjs.prod.js → loop-7224f71f.cjs.prod.js} +1375 -1295
- package/dist/{index-5bd4d3cf.cjs.dev.js → loop-7f1fb121.cjs.dev.js} +1375 -1295
- package/dist/{index-47b7622a.esm.js → loop-bdf826ba.esm.js} +1372 -1295
- package/dist/react-three-fiber.cjs.d.ts +1 -0
- package/dist/react-three-fiber.cjs.dev.js +127 -116
- package/dist/react-three-fiber.cjs.prod.js +127 -116
- package/dist/react-three-fiber.esm.js +93 -85
- package/native/dist/react-three-fiber-native.cjs.d.ts +1 -0
- package/native/dist/react-three-fiber-native.cjs.dev.js +282 -213
- package/native/dist/react-three-fiber-native.cjs.prod.js +282 -213
- package/native/dist/react-three-fiber-native.esm.js +246 -182
- 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,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export { createTouchEvents as events } from './native/events';
|
|
8
|
-
export * from './core';
|
|
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 "./native/Canvas.js";
|
|
6
|
+
export { createTouchEvents as events } from "./native/events.js";
|
|
@@ -1,47 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[K in keyof P]
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import type * as THREE from 'three';
|
|
2
|
+
import type { Args, EventHandlers, InstanceProps, ConstructorRepresentation } from "./core/index.js";
|
|
3
|
+
type NonFunctionKeys<P> = {
|
|
4
|
+
[K in keyof P]-?: P[K] extends Function ? never : K;
|
|
5
|
+
}[keyof P];
|
|
6
|
+
export type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O;
|
|
7
|
+
export type Properties<T> = Pick<T, NonFunctionKeys<T>>;
|
|
8
|
+
export type Mutable<P> = {
|
|
9
|
+
[K in keyof P]: P[K] | Readonly<P[K]>;
|
|
10
|
+
};
|
|
11
|
+
export interface MathRepresentation {
|
|
12
|
+
set(...args: number[]): any;
|
|
13
|
+
}
|
|
14
|
+
export interface VectorRepresentation extends MathRepresentation {
|
|
15
|
+
setScalar(s: number): any;
|
|
16
|
+
}
|
|
17
|
+
export type MathType<T extends MathRepresentation | THREE.Euler> = T extends THREE.Color ? Args<typeof THREE.Color> | THREE.ColorRepresentation : T extends VectorRepresentation | THREE.Layers | THREE.Euler ? T | Parameters<T['set']> | number : T | Parameters<T['set']>;
|
|
18
|
+
export type Vector2 = MathType<THREE.Vector2>;
|
|
19
|
+
export type Vector3 = MathType<THREE.Vector3>;
|
|
20
|
+
export type Vector4 = MathType<THREE.Vector4>;
|
|
21
|
+
export type Color = MathType<THREE.Color>;
|
|
22
|
+
export type Layers = MathType<THREE.Layers>;
|
|
23
|
+
export type Quaternion = MathType<THREE.Quaternion>;
|
|
24
|
+
export type Euler = MathType<THREE.Euler>;
|
|
25
|
+
export type Matrix3 = MathType<THREE.Matrix3>;
|
|
26
|
+
export type Matrix4 = MathType<THREE.Matrix4>;
|
|
27
|
+
export type WithMathProps<P> = {
|
|
28
|
+
[K in keyof P]: P[K] extends MathRepresentation | THREE.Euler ? MathType<P[K]> : P[K];
|
|
29
|
+
};
|
|
30
|
+
export interface RaycastableRepresentation {
|
|
31
|
+
raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
|
|
32
|
+
}
|
|
33
|
+
export type EventProps<P> = P extends RaycastableRepresentation ? Partial<EventHandlers> : {};
|
|
34
|
+
export interface ReactProps<P> {
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
ref?: React.Ref<P>;
|
|
37
|
+
key?: React.Key;
|
|
38
|
+
}
|
|
39
|
+
export type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<Overwrite<WithMathProps<P>, ReactProps<P> & EventProps<P>>>;
|
|
40
|
+
export type ThreeElement<T extends ConstructorRepresentation> = Mutable<Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>>;
|
|
41
|
+
type ThreeExports = typeof THREE;
|
|
42
|
+
type ThreeElementsImpl = {
|
|
43
|
+
[K in keyof ThreeExports as Uncapitalize<K>]: ThreeExports[K] extends ConstructorRepresentation ? ThreeElement<ThreeExports[K]> : never;
|
|
44
|
+
};
|
|
45
|
+
export interface ThreeElements extends ThreeElementsImpl {
|
|
46
|
+
primitive: Omit<ThreeElement<any>, 'args'> & {
|
|
47
|
+
object: object;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
declare module 'react' {
|
|
51
|
+
namespace JSX {
|
|
52
|
+
interface IntrinsicElements extends ThreeElements {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
-
import { RenderProps } from
|
|
4
|
-
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
fallback
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
+
import { RenderProps } from "../core/index.js";
|
|
4
|
+
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Canvas fallback content, similar to img's alt prop */
|
|
7
|
+
fallback?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Options to pass to useMeasure.
|
|
10
|
+
* @see https://github.com/pmndrs/react-use-measure#api
|
|
11
|
+
*/
|
|
12
|
+
resize?: ResizeOptions;
|
|
13
|
+
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
14
|
+
eventSource?: HTMLElement | React.RefObject<HTMLElement>;
|
|
15
|
+
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
16
|
+
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
17
|
+
}
|
|
18
|
+
export interface Props extends CanvasProps {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A DOM canvas which accepts threejs elements as children.
|
|
22
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
23
|
+
*/
|
|
24
|
+
export declare const Canvas: React.ForwardRefExoticComponent<CanvasProps & React.RefAttributes<HTMLCanvasElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function createPointerEvents(store:
|
|
1
|
+
import { RootStore } from "../core/store.js";
|
|
2
|
+
import { EventManager } from "../core/events.js";
|
|
3
|
+
/** Default R3F event manager for web */
|
|
4
|
+
export declare function createPointerEvents(store: RootStore): EventManager<HTMLElement>;
|