@react-three/fiber 8.17.5 → 8.17.6

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +1040 -1034
  2. package/dist/declarations/src/core/events.d.ts +93 -93
  3. package/dist/declarations/src/core/hooks.d.ts +57 -57
  4. package/dist/declarations/src/core/index.d.ts +94 -94
  5. package/dist/declarations/src/core/loop.d.ts +38 -38
  6. package/dist/declarations/src/core/renderer.d.ts +58 -58
  7. package/dist/declarations/src/core/store.d.ts +138 -138
  8. package/dist/declarations/src/core/utils.d.ts +134 -134
  9. package/dist/declarations/src/index.d.ts +12 -12
  10. package/dist/declarations/src/native/Canvas.d.ts +14 -14
  11. package/dist/declarations/src/native/events.d.ts +5 -5
  12. package/dist/declarations/src/native/polyfills.d.ts +1 -1
  13. package/dist/declarations/src/native.d.ts +13 -13
  14. package/dist/declarations/src/three-types.d.ts +396 -393
  15. package/dist/declarations/src/web/Canvas.d.ts +24 -24
  16. package/dist/declarations/src/web/events.d.ts +5 -5
  17. package/dist/declarations/src/web/use-measure.d.ts +34 -34
  18. package/dist/{events-be1682bd.cjs.prod.js → events-2e7e6eab.cjs.prod.js} +76 -76
  19. package/dist/{events-a5fc3e51.esm.js → events-3515660a.esm.js} +76 -76
  20. package/dist/{events-66f43fbc.cjs.dev.js → events-c54ce65e.cjs.dev.js} +76 -76
  21. package/dist/react-three-fiber.cjs.dev.js +4 -4
  22. package/dist/react-three-fiber.cjs.prod.js +4 -4
  23. package/dist/react-three-fiber.esm.js +5 -5
  24. package/native/dist/react-three-fiber-native.cjs.dev.js +13 -18
  25. package/native/dist/react-three-fiber-native.cjs.prod.js +13 -18
  26. package/native/dist/react-three-fiber-native.esm.js +14 -19
  27. package/native/package.json +5 -5
  28. package/package.json +1 -1
  29. package/readme.md +253 -253
@@ -1,58 +1,58 @@
1
- import * as THREE from 'three';
2
- import { UseBoundStore } from 'zustand';
3
- import Reconciler from 'react-reconciler';
4
- import { prepare, applyProps } from './utils';
5
- import { RootState } from './store';
6
- import { EventHandlers } from './events';
7
- export declare type Root = {
8
- fiber: Reconciler.FiberRoot;
9
- store: UseBoundStore<RootState>;
10
- };
11
- export declare type LocalState = {
12
- type: string;
13
- root: UseBoundStore<RootState>;
14
- objects: Instance[];
15
- parent: Instance | null;
16
- primitive?: boolean;
17
- eventCount: number;
18
- handlers: Partial<EventHandlers>;
19
- attach?: AttachType;
20
- previousAttach: any;
21
- memoizedProps: {
22
- [key: string]: any;
23
- };
24
- autoRemovedBeforeAppend?: boolean;
25
- };
26
- export declare type AttachFnType = (parent: Instance, self: Instance) => () => void;
27
- export declare type AttachType = string | AttachFnType;
28
- export declare type BaseInstance = Omit<THREE.Object3D, 'children' | 'attach' | 'add' | 'remove' | 'raycast'> & {
29
- __r3f: LocalState;
30
- children: Instance[];
31
- remove: (...object: Instance[]) => Instance;
32
- add: (...object: Instance[]) => Instance;
33
- raycast?: (raycaster: THREE.Raycaster, intersects: THREE.Intersection[]) => void;
34
- };
35
- export declare type Instance = BaseInstance & {
36
- [key: string]: any;
37
- };
38
- export declare type InstanceProps = {
39
- [key: string]: unknown;
40
- } & {
41
- args?: any[];
42
- object?: object;
43
- visible?: boolean;
44
- dispose?: null;
45
- attach?: AttachType;
46
- };
47
- interface Catalogue {
48
- [name: string]: {
49
- new (...args: any): Instance;
50
- };
51
- }
52
- export declare const catalogue: Catalogue;
53
- declare const extend: (objects: object) => void;
54
- declare function createRenderer<TCanvas>(_roots: Map<TCanvas, Root>, _getEventPriority?: () => any): {
55
- reconciler: Reconciler.Reconciler<UseBoundStore<RootState, import("zustand").StoreApi<RootState>>, Instance, void, Instance, Instance>;
56
- applyProps: typeof applyProps;
57
- };
58
- export { prepare, createRenderer, extend };
1
+ import * as THREE from 'three';
2
+ import { UseBoundStore } from 'zustand';
3
+ import Reconciler from 'react-reconciler';
4
+ import { prepare, applyProps } from './utils';
5
+ import { RootState } from './store';
6
+ import { EventHandlers } from './events';
7
+ export declare type Root = {
8
+ fiber: Reconciler.FiberRoot;
9
+ store: UseBoundStore<RootState>;
10
+ };
11
+ export declare type LocalState = {
12
+ type: string;
13
+ root: UseBoundStore<RootState>;
14
+ objects: Instance[];
15
+ parent: Instance | null;
16
+ primitive?: boolean;
17
+ eventCount: number;
18
+ handlers: Partial<EventHandlers>;
19
+ attach?: AttachType;
20
+ previousAttach: any;
21
+ memoizedProps: {
22
+ [key: string]: any;
23
+ };
24
+ autoRemovedBeforeAppend?: boolean;
25
+ };
26
+ export declare type AttachFnType = (parent: Instance, self: Instance) => () => void;
27
+ export declare type AttachType = string | AttachFnType;
28
+ export declare type BaseInstance = Omit<THREE.Object3D, 'children' | 'attach' | 'add' | 'remove' | 'raycast'> & {
29
+ __r3f: LocalState;
30
+ children: Instance[];
31
+ remove: (...object: Instance[]) => Instance;
32
+ add: (...object: Instance[]) => Instance;
33
+ raycast?: (raycaster: THREE.Raycaster, intersects: THREE.Intersection[]) => void;
34
+ };
35
+ export declare type Instance = BaseInstance & {
36
+ [key: string]: any;
37
+ };
38
+ export declare type InstanceProps = {
39
+ [key: string]: unknown;
40
+ } & {
41
+ args?: any[];
42
+ object?: object;
43
+ visible?: boolean;
44
+ dispose?: null;
45
+ attach?: AttachType;
46
+ };
47
+ interface Catalogue {
48
+ [name: string]: {
49
+ new (...args: any): Instance;
50
+ };
51
+ }
52
+ export declare const catalogue: Catalogue;
53
+ declare const extend: (objects: object) => void;
54
+ declare function createRenderer<TCanvas>(_roots: Map<TCanvas, Root>, _getEventPriority?: () => any): {
55
+ reconciler: Reconciler.Reconciler<UseBoundStore<RootState, import("zustand").StoreApi<RootState>>, Instance, void, Instance, Instance>;
56
+ applyProps: typeof applyProps;
57
+ };
58
+ export { prepare, createRenderer, extend };
@@ -1,138 +1,138 @@
1
- import * as THREE from 'three';
2
- import * as React from 'react';
3
- import { GetState, SetState, StoreApi, UseBoundStore } from 'zustand';
4
- import { DomEvent, EventManager, PointerCaptureTarget, ThreeEvent } from './events';
5
- import { _XRFrame, Camera } from './utils';
6
- import { Advance, Invalidate } from './loop';
7
- export declare const privateKeys: readonly ["set", "get", "setSize", "setFrameloop", "setDpr", "events", "invalidate", "advance", "size", "viewport"];
8
- export declare type PrivateKeys = typeof privateKeys[number];
9
- export interface Intersection extends THREE.Intersection {
10
- eventObject: THREE.Object3D;
11
- }
12
- export declare type Subscription = {
13
- ref: React.MutableRefObject<RenderCallback>;
14
- priority: number;
15
- store: UseBoundStore<RootState, StoreApi<RootState>>;
16
- };
17
- export declare type Dpr = number | [min: number, max: number];
18
- export declare type Size = {
19
- width: number;
20
- height: number;
21
- top: number;
22
- left: number;
23
- /** @deprecated `updateStyle` is now disabled for OffscreenCanvas and will be removed in v9. */
24
- updateStyle?: boolean;
25
- };
26
- export declare type Viewport = Size & {
27
- /** The initial pixel ratio */
28
- initialDpr: number;
29
- /** Current pixel ratio */
30
- dpr: number;
31
- /** size.width / viewport.width */
32
- factor: number;
33
- /** Camera distance */
34
- distance: number;
35
- /** Camera aspect ratio: width / height */
36
- aspect: number;
37
- };
38
- export declare type RenderCallback = (state: RootState, delta: number, frame?: _XRFrame) => void;
39
- export declare type Performance = {
40
- /** Current performance normal, between min and max */
41
- current: number;
42
- /** How low the performance can go, between 0 and max */
43
- min: number;
44
- /** How high the performance can go, between min and max */
45
- max: number;
46
- /** Time until current returns to max in ms */
47
- debounce: number;
48
- /** Sets current to min, puts the system in regression */
49
- regress: () => void;
50
- };
51
- export declare type Renderer = {
52
- render: (scene: THREE.Scene, camera: THREE.Camera) => any;
53
- };
54
- export declare const isRenderer: (def: any) => boolean;
55
- export declare type InternalState = {
56
- active: boolean;
57
- priority: number;
58
- frames: number;
59
- lastEvent: React.MutableRefObject<DomEvent | null>;
60
- interaction: THREE.Object3D[];
61
- hovered: Map<string, ThreeEvent<DomEvent>>;
62
- subscribers: Subscription[];
63
- capturedMap: Map<number, Map<THREE.Object3D, PointerCaptureTarget>>;
64
- initialClick: [x: number, y: number];
65
- initialHits: THREE.Object3D[];
66
- subscribe: (callback: React.MutableRefObject<RenderCallback>, priority: number, store: UseBoundStore<RootState, StoreApi<RootState>>) => () => void;
67
- };
68
- export declare type RootState = {
69
- /** Set current state */
70
- set: SetState<RootState>;
71
- /** Get current state */
72
- get: GetState<RootState>;
73
- /** The instance of the renderer */
74
- gl: THREE.WebGLRenderer;
75
- /** Default camera */
76
- camera: Camera & {
77
- manual?: boolean;
78
- };
79
- /** Default scene */
80
- scene: THREE.Scene;
81
- /** Default raycaster */
82
- raycaster: THREE.Raycaster;
83
- /** Default clock */
84
- clock: THREE.Clock;
85
- /** Event layer interface, contains the event handler and the node they're connected to */
86
- events: EventManager<any>;
87
- /** XR interface */
88
- xr: {
89
- connect: () => void;
90
- disconnect: () => void;
91
- };
92
- /** Currently used controls */
93
- controls: THREE.EventDispatcher | null;
94
- /** Normalized event coordinates */
95
- pointer: THREE.Vector2;
96
- /** @deprecated Normalized event coordinates, use "pointer" instead! */
97
- mouse: THREE.Vector2;
98
- legacy: boolean;
99
- /** Shortcut to gl.outputColorSpace = THREE.LinearSRGBColorSpace */
100
- linear: boolean;
101
- /** Shortcut to gl.toneMapping = NoTonemapping */
102
- flat: boolean;
103
- /** Render loop flags */
104
- frameloop: 'always' | 'demand' | 'never';
105
- /** Adaptive performance interface */
106
- performance: Performance;
107
- /** Reactive pixel-size of the canvas */
108
- size: Size;
109
- /** Reactive size of the viewport in threejs units */
110
- viewport: Viewport & {
111
- getCurrentViewport: (camera?: Camera, target?: THREE.Vector3 | Parameters<THREE.Vector3['set']>, size?: Size) => Omit<Viewport, 'dpr' | 'initialDpr'>;
112
- };
113
- /** Flags the canvas for render, but doesn't render in itself */
114
- invalidate: (frames?: number) => void;
115
- /** Advance (render) one step */
116
- advance: (timestamp: number, runGlobalEffects?: boolean) => void;
117
- /** Shortcut to setting the event layer */
118
- setEvents: (events: Partial<EventManager<any>>) => void;
119
- /**
120
- * Shortcut to manual sizing
121
- */
122
- setSize: (width: number, height: number,
123
- /** @deprecated `updateStyle` is now disabled for OffscreenCanvas and will be removed in v9. */
124
- updateStyle?: boolean, top?: number, left?: number) => void;
125
- /** Shortcut to manual setting the pixel ratio */
126
- setDpr: (dpr: Dpr) => void;
127
- /** Shortcut to frameloop flags */
128
- setFrameloop: (frameloop?: 'always' | 'demand' | 'never') => void;
129
- /** When the canvas was clicked but nothing was hit */
130
- onPointerMissed?: (event: MouseEvent) => void;
131
- /** If this state model is layered (via createPortal) then this contains the previous layer */
132
- previousRoot?: UseBoundStore<RootState, StoreApi<RootState>>;
133
- /** Internals */
134
- internal: InternalState;
135
- };
136
- declare const context: React.Context<UseBoundStore<RootState, StoreApi<RootState>>>;
137
- declare const createStore: (invalidate: Invalidate, advance: Advance) => UseBoundStore<RootState>;
138
- export { createStore, context };
1
+ import * as THREE from 'three';
2
+ import * as React from 'react';
3
+ import { GetState, SetState, StoreApi, UseBoundStore } from 'zustand';
4
+ import { DomEvent, EventManager, PointerCaptureTarget, ThreeEvent } from './events';
5
+ import { _XRFrame, Camera } from './utils';
6
+ import { Advance, Invalidate } from './loop';
7
+ export declare const privateKeys: readonly ["set", "get", "setSize", "setFrameloop", "setDpr", "events", "invalidate", "advance", "size", "viewport"];
8
+ export declare type PrivateKeys = typeof privateKeys[number];
9
+ export interface Intersection extends THREE.Intersection {
10
+ eventObject: THREE.Object3D;
11
+ }
12
+ export declare type Subscription = {
13
+ ref: React.MutableRefObject<RenderCallback>;
14
+ priority: number;
15
+ store: UseBoundStore<RootState, StoreApi<RootState>>;
16
+ };
17
+ export declare type Dpr = number | [min: number, max: number];
18
+ export declare type Size = {
19
+ width: number;
20
+ height: number;
21
+ top: number;
22
+ left: number;
23
+ /** @deprecated `updateStyle` is now disabled for OffscreenCanvas and will be removed in v9. */
24
+ updateStyle?: boolean;
25
+ };
26
+ export declare type Viewport = Size & {
27
+ /** The initial pixel ratio */
28
+ initialDpr: number;
29
+ /** Current pixel ratio */
30
+ dpr: number;
31
+ /** size.width / viewport.width */
32
+ factor: number;
33
+ /** Camera distance */
34
+ distance: number;
35
+ /** Camera aspect ratio: width / height */
36
+ aspect: number;
37
+ };
38
+ export declare type RenderCallback = (state: RootState, delta: number, frame?: _XRFrame) => void;
39
+ export declare type Performance = {
40
+ /** Current performance normal, between min and max */
41
+ current: number;
42
+ /** How low the performance can go, between 0 and max */
43
+ min: number;
44
+ /** How high the performance can go, between min and max */
45
+ max: number;
46
+ /** Time until current returns to max in ms */
47
+ debounce: number;
48
+ /** Sets current to min, puts the system in regression */
49
+ regress: () => void;
50
+ };
51
+ export declare type Renderer = {
52
+ render: (scene: THREE.Scene, camera: THREE.Camera) => any;
53
+ };
54
+ export declare const isRenderer: (def: any) => boolean;
55
+ export declare type InternalState = {
56
+ active: boolean;
57
+ priority: number;
58
+ frames: number;
59
+ lastEvent: React.MutableRefObject<DomEvent | null>;
60
+ interaction: THREE.Object3D[];
61
+ hovered: Map<string, ThreeEvent<DomEvent>>;
62
+ subscribers: Subscription[];
63
+ capturedMap: Map<number, Map<THREE.Object3D, PointerCaptureTarget>>;
64
+ initialClick: [x: number, y: number];
65
+ initialHits: THREE.Object3D[];
66
+ subscribe: (callback: React.MutableRefObject<RenderCallback>, priority: number, store: UseBoundStore<RootState, StoreApi<RootState>>) => () => void;
67
+ };
68
+ export declare type RootState = {
69
+ /** Set current state */
70
+ set: SetState<RootState>;
71
+ /** Get current state */
72
+ get: GetState<RootState>;
73
+ /** The instance of the renderer */
74
+ gl: THREE.WebGLRenderer;
75
+ /** Default camera */
76
+ camera: Camera & {
77
+ manual?: boolean;
78
+ };
79
+ /** Default scene */
80
+ scene: THREE.Scene;
81
+ /** Default raycaster */
82
+ raycaster: THREE.Raycaster;
83
+ /** Default clock */
84
+ clock: THREE.Clock;
85
+ /** Event layer interface, contains the event handler and the node they're connected to */
86
+ events: EventManager<any>;
87
+ /** XR interface */
88
+ xr: {
89
+ connect: () => void;
90
+ disconnect: () => void;
91
+ };
92
+ /** Currently used controls */
93
+ controls: THREE.EventDispatcher | null;
94
+ /** Normalized event coordinates */
95
+ pointer: THREE.Vector2;
96
+ /** @deprecated Normalized event coordinates, use "pointer" instead! */
97
+ mouse: THREE.Vector2;
98
+ legacy: boolean;
99
+ /** Shortcut to gl.outputColorSpace = THREE.LinearSRGBColorSpace */
100
+ linear: boolean;
101
+ /** Shortcut to gl.toneMapping = NoTonemapping */
102
+ flat: boolean;
103
+ /** Render loop flags */
104
+ frameloop: 'always' | 'demand' | 'never';
105
+ /** Adaptive performance interface */
106
+ performance: Performance;
107
+ /** Reactive pixel-size of the canvas */
108
+ size: Size;
109
+ /** Reactive size of the viewport in threejs units */
110
+ viewport: Viewport & {
111
+ getCurrentViewport: (camera?: Camera, target?: THREE.Vector3 | Parameters<THREE.Vector3['set']>, size?: Size) => Omit<Viewport, 'dpr' | 'initialDpr'>;
112
+ };
113
+ /** Flags the canvas for render, but doesn't render in itself */
114
+ invalidate: (frames?: number) => void;
115
+ /** Advance (render) one step */
116
+ advance: (timestamp: number, runGlobalEffects?: boolean) => void;
117
+ /** Shortcut to setting the event layer */
118
+ setEvents: (events: Partial<EventManager<any>>) => void;
119
+ /**
120
+ * Shortcut to manual sizing
121
+ */
122
+ setSize: (width: number, height: number,
123
+ /** @deprecated `updateStyle` is now disabled for OffscreenCanvas and will be removed in v9. */
124
+ updateStyle?: boolean, top?: number, left?: number) => void;
125
+ /** Shortcut to manual setting the pixel ratio */
126
+ setDpr: (dpr: Dpr) => void;
127
+ /** Shortcut to frameloop flags */
128
+ setFrameloop: (frameloop?: 'always' | 'demand' | 'never') => void;
129
+ /** When the canvas was clicked but nothing was hit */
130
+ onPointerMissed?: (event: MouseEvent) => void;
131
+ /** If this state model is layered (via createPortal) then this contains the previous layer */
132
+ previousRoot?: UseBoundStore<RootState, StoreApi<RootState>>;
133
+ /** Internals */
134
+ internal: InternalState;
135
+ };
136
+ declare const context: React.Context<UseBoundStore<RootState, StoreApi<RootState>>>;
137
+ declare const createStore: (invalidate: Invalidate, advance: Advance) => UseBoundStore<RootState>;
138
+ export { createStore, context };