@react-three/fiber 8.0.0-beta-04 → 8.0.0-beta.1

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 CHANGED
@@ -1,5 +1,23 @@
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
+
3
21
  ## 7.0.23
4
22
 
5
23
  ### Patch Changes
@@ -2,14 +2,14 @@
2
2
  import * as THREE from 'three';
3
3
  import * as React from 'react';
4
4
  import { UseStore } from 'zustand';
5
- import { dispose } from '../core/utils';
6
- import { Renderer, StoreProps, context, RootState, Size } from '../core/store';
7
- import { extend, Root } from '../core/renderer';
8
- import { addEffect, addAfterEffect, addTail } from '../core/loop';
5
+ import { Renderer, StoreProps, context, RootState, Size } from './store';
6
+ import { extend, Root } from './renderer';
7
+ import { addEffect, addAfterEffect, addTail } from './loop';
9
8
  import { EventManager } from './events';
9
+ import { dispose } from './utils';
10
10
  declare const roots: Map<Element, Root>;
11
- declare const invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined) => void;
12
- declare const reconciler: import("react-reconciler").Reconciler<unknown, unknown, unknown, unknown, unknown>, applyProps: typeof import("../core/utils").applyProps;
11
+ declare const invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void;
12
+ declare const reconciler: import("react-reconciler").Reconciler<unknown, unknown, unknown, unknown, unknown>, applyProps: typeof import("./utils").applyProps;
13
13
  declare type Properties<T> = Pick<T, {
14
14
  [K in keyof T]: T[K] extends (_: any) => any ? never : K;
15
15
  }[keyof T]>;
@@ -20,12 +20,15 @@ export declare type RenderProps<TCanvas extends Element> = Omit<StoreProps, 'gl'
20
20
  size?: Size;
21
21
  onCreated?: (state: RootState) => void;
22
22
  };
23
- declare function createRoot<TCanvas extends Element>(canvas: TCanvas, config?: RenderProps<TCanvas>): {
23
+ export declare type ReconcilerRoot<TCanvas extends Element> = {
24
+ configure: (config?: RenderProps<TCanvas>) => ReconcilerRoot<TCanvas>;
24
25
  render: (element: React.ReactNode) => UseStore<RootState>;
25
26
  unmount: () => void;
26
27
  };
28
+ declare function createRoot<TCanvas extends Element>(canvas: TCanvas): ReconcilerRoot<TCanvas>;
27
29
  declare function render<TCanvas extends Element>(element: React.ReactNode, canvas: TCanvas, config?: RenderProps<TCanvas>): UseStore<RootState>;
28
30
  declare function unmountComponentAtNode<TElement extends Element>(canvas: TElement, callback?: (canvas: TElement) => void): void;
29
31
  declare const act: any;
30
32
  declare function createPortal(children: React.ReactNode, container: THREE.Object3D): React.ReactNode;
33
+ export * from './hooks';
31
34
  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;
@@ -5,8 +6,8 @@ export declare const addEffect: (callback: GlobalRenderCallback) => () => void;
5
6
  export declare const addAfterEffect: (callback: GlobalRenderCallback) => () => void;
6
7
  export declare const addTail: (callback: GlobalRenderCallback) => () => void;
7
8
  export declare function createLoop<TCanvas>(roots: Map<TCanvas, Root>): {
8
- loop: (timestamp: number) => number | undefined;
9
+ loop: (timestamp: number) => void;
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 {};
@@ -2,7 +2,6 @@ import * as THREE from 'three';
2
2
  import * as React from 'react';
3
3
  import * as ReactThreeFiber from '../three-types';
4
4
  import { GetState, SetState, UseStore } from 'zustand';
5
- import { Instance, InstanceProps } from './renderer';
6
5
  import { DomEvent, EventManager, PointerCaptureTarget, ThreeEvent } from './events';
7
6
  export interface Intersection extends THREE.Intersection {
8
7
  eventObject: THREE.Object3D;
@@ -29,7 +28,7 @@ export declare type Raycaster = THREE.Raycaster & {
29
28
  filter?: FilterFunction;
30
29
  computeOffsets?: ComputeOffsetsFunction;
31
30
  };
32
- export declare type RenderCallback = (state: RootState, delta: number) => void;
31
+ export declare type RenderCallback = (state: RootState, delta: number, frame?: THREE.XRFrame) => void;
33
32
  export declare type Performance = {
34
33
  current: number;
35
34
  min: number;
@@ -40,13 +39,12 @@ export declare type Performance = {
40
39
  export declare type Renderer = {
41
40
  render: (scene: THREE.Scene, camera: THREE.Camera) => any;
42
41
  };
43
- export declare const isRenderer: (def: Renderer) => boolean;
44
- export declare const isOrthographicCamera: (def: THREE.Camera) => def is THREE.OrthographicCamera;
42
+ export declare const isRenderer: (def: any) => boolean;
43
+ export declare const isOrthographicCamera: (def: any) => def is THREE.OrthographicCamera;
45
44
  export declare type InternalState = {
46
45
  active: boolean;
47
46
  priority: number;
48
47
  frames: number;
49
- lastProps: StoreProps;
50
48
  lastEvent: React.MutableRefObject<DomEvent | null>;
51
49
  interaction: THREE.Object3D[];
52
50
  hovered: Map<string, ThreeEvent<DomEvent>>;
@@ -54,20 +52,21 @@ export declare type InternalState = {
54
52
  capturedMap: Map<number, Map<THREE.Object3D, PointerCaptureTarget>>;
55
53
  initialClick: [x: number, y: number];
56
54
  initialHits: THREE.Object3D[];
57
- xr: {
58
- connect: () => void;
59
- disconnect: () => void;
60
- };
61
55
  subscribe: (callback: React.MutableRefObject<RenderCallback>, priority?: number) => () => void;
62
56
  };
63
57
  export declare type RootState = {
64
58
  gl: THREE.WebGLRenderer;
65
- scene: THREE.Scene;
66
59
  camera: Camera & {
67
60
  manual?: boolean;
68
61
  };
69
- controls: THREE.EventDispatcher | null;
70
62
  raycaster: Raycaster;
63
+ events: EventManager<any>;
64
+ xr: {
65
+ connect: () => void;
66
+ disconnect: () => void;
67
+ };
68
+ scene: THREE.Scene;
69
+ controls: THREE.EventDispatcher | null;
71
70
  mouse: THREE.Vector2;
72
71
  clock: THREE.Clock;
73
72
  linear: boolean;
@@ -86,13 +85,14 @@ export declare type RootState = {
86
85
  setDpr: (dpr: Dpr) => void;
87
86
  setFrameloop: (frameloop?: 'always' | 'demand' | 'never') => void;
88
87
  onPointerMissed?: (event: MouseEvent) => void;
89
- events: EventManager<any>;
90
88
  internal: InternalState;
91
89
  };
92
90
  export declare type FilterFunction = (items: THREE.Intersection[], state: RootState) => THREE.Intersection[];
93
91
  export declare type ComputeOffsetsFunction = (event: any, state: RootState) => {
94
92
  offsetX: number;
95
93
  offsetY: number;
94
+ width?: number;
95
+ height?: number;
96
96
  };
97
97
  export declare type StoreProps = {
98
98
  gl: THREE.WebGLRenderer;
@@ -104,14 +104,12 @@ export declare type StoreProps = {
104
104
  frameloop?: 'always' | 'demand' | 'never';
105
105
  performance?: Partial<Omit<Performance, 'regress'>>;
106
106
  dpr?: Dpr;
107
- clock?: THREE.Clock;
108
107
  raycaster?: Partial<Raycaster>;
109
108
  camera?: (Camera | Partial<ReactThreeFiber.Object3DNode<THREE.Camera, typeof THREE.Camera> & ReactThreeFiber.Object3DNode<THREE.PerspectiveCamera, typeof THREE.PerspectiveCamera> & ReactThreeFiber.Object3DNode<THREE.OrthographicCamera, typeof THREE.OrthographicCamera>>) & {
110
109
  manual?: boolean;
111
110
  };
112
111
  onPointerMissed?: (event: MouseEvent) => void;
113
112
  };
114
- export declare type ApplyProps = (instance: Instance, newProps: InstanceProps) => void;
115
113
  declare const context: React.Context<UseStore<RootState>>;
116
- declare const createStore: (applyProps: ApplyProps, invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean | undefined, state?: RootState | undefined) => void, props: StoreProps) => UseStore<RootState>;
114
+ declare const createStore: (invalidate: (state?: RootState | undefined) => void, advance: (timestamp: number, runGlobalEffects?: boolean | undefined, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void) => UseStore<RootState>;
117
115
  export { createStore, context };
@@ -26,14 +26,20 @@ export declare function filterKeys<TObj extends {
26
26
  }, TOmit extends boolean, TKey extends keyof TObj>(obj: TObj, omit: TOmit, ...keys: TKey[]): TOmit extends true ? Omit<TObj, TKey> : Pick<TObj, TKey>;
27
27
  export declare const pick: <TObj>(obj: Partial<TObj>, keys: (keyof TObj)[]) => Pick<Partial<TObj>, keyof TObj>;
28
28
  export declare const omit: <TObj>(obj: Partial<TObj>, keys: (keyof TObj)[]) => Omit<Partial<TObj>, keyof TObj>;
29
+ export declare type EquConfig = {
30
+ arrays?: 'reference' | 'shallow';
31
+ objects?: 'reference' | 'shallow';
32
+ strict?: boolean;
33
+ };
29
34
  export declare const is: {
30
35
  obj: (a: any) => boolean;
31
36
  fun: (a: any) => a is Function;
32
37
  str: (a: any) => a is string;
33
38
  num: (a: any) => a is number;
39
+ boo: (a: any) => a is boolean;
34
40
  und: (a: any) => boolean;
35
41
  arr: (a: any) => boolean;
36
- equ(a: any, b: any): boolean;
42
+ equ(a: any, b: any, { arrays, objects, strict }?: EquConfig): boolean;
37
43
  };
38
44
  export declare function buildGraph(object: THREE.Object3D): ObjectMap;
39
45
  export declare function dispose<TObj extends {
@@ -1,10 +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
7
  export type { ObjectMap } from './core/utils';
7
- export * from './core/hooks';
8
8
  export * from './web/Canvas';
9
9
  export { createPointerEvents as events } from './web/events';
10
10
  export * from './core';
@@ -1,10 +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
7
  export type { ObjectMap } from './core/utils';
7
- export * from './native/hooks';
8
8
  export * from './native/Canvas';
9
9
  export { createTouchEvents as events } from './native/events';
10
10
  export * from './core';
@@ -24,7 +24,10 @@ export interface NodeProps<T, P> {
24
24
  key?: React.Key;
25
25
  onUpdate?: (self: T) => void;
26
26
  }
27
- export declare type Node<T, P> = Overwrite<Partial<T>, NodeProps<T, P>>;
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>>>;
28
31
  export declare type Object3DNode<T, P> = Overwrite<Node<T, P>, {
29
32
  position?: Vector3;
30
33
  up?: Vector3;
@@ -35,13 +38,9 @@ export declare type Object3DNode<T, P> = Overwrite<Node<T, P>, {
35
38
  layers?: Layers;
36
39
  dispose?: (() => void) | null;
37
40
  }> & EventHandlers;
38
- export declare type BufferGeometryNode<T extends THREE.BufferGeometry, P> = Overwrite<Node<T, P>, {}>;
39
- export declare type MaterialNode<T extends THREE.Material, P> = Overwrite<Node<T, P>, {
40
- color?: Color;
41
- }>;
42
- export declare type LightNode<T extends THREE.Light, P> = Overwrite<Object3DNode<T, P>, {
43
- color?: Color;
44
- }>;
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>;
45
44
  export declare type AudioListenerProps = Object3DNode<THREE.AudioListener, typeof THREE.AudioListener>;
46
45
  export declare type PositionalAudioProps = Object3DNode<THREE.PositionalAudio, typeof THREE.PositionalAudio>;
47
46
  export declare type MeshProps = Object3DNode<THREE.Mesh, typeof THREE.Mesh>;