@react-three/fiber 9.0.0-alpha.8 → 9.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import Reconciler from 'react-reconciler';
|
|
4
|
+
import { IsAllOptional } from "./utils.js";
|
|
4
5
|
import type { RootStore } from "./store.js";
|
|
5
6
|
import { type EventHandlers } from "./events.js";
|
|
6
7
|
import type { ThreeElement } from "../three-types.js";
|
|
@@ -18,14 +19,20 @@ export interface Catalogue {
|
|
|
18
19
|
[name: string]: ConstructorRepresentation;
|
|
19
20
|
}
|
|
20
21
|
export type Args<T> = T extends ConstructorRepresentation ? T extends typeof THREE.Color ? [r: number, g: number, b: number] | [color: THREE.ColorRepresentation] : ConstructorParameters<T> : any[];
|
|
21
|
-
|
|
22
|
+
type ArgsProp<P> = P extends ConstructorRepresentation ? IsAllOptional<ConstructorParameters<P>> extends true ? {
|
|
22
23
|
args?: Args<P>;
|
|
24
|
+
} : {
|
|
25
|
+
args: Args<P>;
|
|
26
|
+
} : {
|
|
27
|
+
args: unknown[];
|
|
28
|
+
};
|
|
29
|
+
export type InstanceProps<T = any, P = any> = ArgsProp<P> & {
|
|
23
30
|
object?: T;
|
|
24
31
|
visible?: boolean;
|
|
25
32
|
dispose?: null;
|
|
26
33
|
attach?: AttachType<T>;
|
|
27
34
|
onUpdate?: (self: T) => void;
|
|
28
|
-
}
|
|
35
|
+
};
|
|
29
36
|
export interface Instance<O = any> {
|
|
30
37
|
root: RootStore;
|
|
31
38
|
type: string;
|
|
@@ -45,3 +52,4 @@ export declare const catalogue: Catalogue;
|
|
|
45
52
|
export declare function extend<T extends ConstructorRepresentation>(objects: T): React.ExoticComponent<ThreeElement<T>>;
|
|
46
53
|
export declare function extend<T extends Catalogue>(objects: T): void;
|
|
47
54
|
export declare const reconciler: Reconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, any>;
|
|
55
|
+
export {};
|
|
@@ -11,6 +11,8 @@ export type Properties<T> = Pick<T, NonFunctionKeys<T>>;
|
|
|
11
11
|
export type Mutable<P> = {
|
|
12
12
|
[K in keyof P]: P[K] | Readonly<P[K]>;
|
|
13
13
|
};
|
|
14
|
+
export type IsOptional<T> = undefined extends T ? true : false;
|
|
15
|
+
export type IsAllOptional<T extends any[]> = T extends [infer First, ...infer Rest] ? IsOptional<First> extends true ? IsAllOptional<Rest> : false : true;
|
|
14
16
|
/**
|
|
15
17
|
* Returns the instance's initial (outmost) root.
|
|
16
18
|
*/
|
|
@@ -2,14 +2,15 @@ import type * as THREE from 'three';
|
|
|
2
2
|
import type { Args, EventHandlers, InstanceProps, ConstructorRepresentation } from "./core/index.js";
|
|
3
3
|
import type { Overwrite, Mutable } from "./core/utils.js";
|
|
4
4
|
export interface MathRepresentation {
|
|
5
|
-
set(...args:
|
|
5
|
+
set(...args: number[]): any;
|
|
6
6
|
}
|
|
7
7
|
export interface VectorRepresentation extends MathRepresentation {
|
|
8
8
|
setScalar(value: number): any;
|
|
9
9
|
}
|
|
10
|
-
export type
|
|
10
|
+
export type MathTypes = MathRepresentation | THREE.Euler | THREE.Color;
|
|
11
|
+
export type MathType<T extends MathTypes> = 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']>;
|
|
11
12
|
export type MathProps<P> = {
|
|
12
|
-
[K in keyof P as P[K] extends
|
|
13
|
+
[K in keyof P as P[K] extends MathTypes ? K : never]: P[K] extends MathTypes ? MathType<P[K]> : never;
|
|
13
14
|
};
|
|
14
15
|
export type Vector2 = MathType<THREE.Vector2>;
|
|
15
16
|
export type Vector3 = MathType<THREE.Vector3>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/fiber",
|
|
3
|
-
"version": "9.0.0-
|
|
3
|
+
"version": "9.0.0-beta.0",
|
|
4
4
|
"description": "A React renderer for Threejs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"base64-js": "^1.5.1",
|
|
48
48
|
"buffer": "^6.0.3",
|
|
49
49
|
"its-fine": "^1.2.5",
|
|
50
|
-
"react-reconciler": "0.31.0-rc-
|
|
50
|
+
"react-reconciler": "0.31.0-rc-38e3b23483-20240529",
|
|
51
51
|
"react-use-measure": "^2.1.1",
|
|
52
|
-
"scheduler": "0.25.0-rc-
|
|
52
|
+
"scheduler": "0.25.0-rc-38e3b23483-20240529",
|
|
53
53
|
"suspend-react": "^0.1.3",
|
|
54
54
|
"zustand": "^4.1.2"
|
|
55
55
|
},
|