@react-three/fiber 8.9.0 → 8.9.2
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 +12 -0
- package/dist/declarations/src/core/events.d.ts +2 -1
- package/dist/declarations/src/core/index.d.ts +1 -3
- package/dist/declarations/src/core/renderer.d.ts +1 -0
- package/dist/declarations/src/three-types.d.ts +4 -1
- package/dist/{index-57cb2f85.cjs.prod.js → index-25dfa84d.cjs.prod.js} +9 -1
- package/dist/{index-6f0019d1.esm.js → index-79f9c7e9.esm.js} +9 -1
- package/dist/{index-8539ced2.cjs.dev.js → index-efc69a1d.cjs.dev.js} +9 -1
- package/dist/react-three-fiber.cjs.dev.js +1 -1
- package/dist/react-three-fiber.cjs.prod.js +1 -1
- package/dist/react-three-fiber.esm.js +2 -2
- package/native/dist/react-three-fiber-native.cjs.dev.js +1 -1
- package/native/dist/react-three-fiber-native.cjs.prod.js +1 -1
- package/native/dist/react-three-fiber-native.esm.js +2 -2
- package/package.json +1 -1
- package/readme.md +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 8.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2aeb6500: fix: primitives are incorrectly swapped on key change in maps
|
|
8
|
+
|
|
9
|
+
## 8.9.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0cf11797: fix(events): type spread event props
|
|
14
|
+
|
|
3
15
|
## 8.9.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import type { UseBoundStore } from 'zustand';
|
|
3
3
|
import type { RootState } from './store';
|
|
4
|
+
import type { Properties } from '../three-types';
|
|
4
5
|
export interface Intersection extends THREE.Intersection {
|
|
5
6
|
eventObject: THREE.Object3D;
|
|
6
7
|
}
|
|
@@ -17,7 +18,7 @@ export interface IntersectionEvent<TSourceEvent> extends Intersection {
|
|
|
17
18
|
stopped: boolean;
|
|
18
19
|
}
|
|
19
20
|
export declare type Camera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
|
|
20
|
-
export declare type ThreeEvent<TEvent> = IntersectionEvent<TEvent>;
|
|
21
|
+
export declare type ThreeEvent<TEvent> = IntersectionEvent<TEvent> & Properties<TEvent>;
|
|
21
22
|
export declare type DomEvent = PointerEvent | MouseEvent | WheelEvent;
|
|
22
23
|
export declare type Events = {
|
|
23
24
|
onClick: EventListener;
|
|
@@ -8,12 +8,10 @@ import { extend, Root } from './renderer';
|
|
|
8
8
|
import { addEffect, addAfterEffect, addTail, flushGlobalEffects } from './loop';
|
|
9
9
|
import { EventManager, ComputeFunction } from './events';
|
|
10
10
|
import { dispose, getRootState, Camera } from './utils';
|
|
11
|
+
import type { Properties } from '../three-types';
|
|
11
12
|
declare const roots: Map<Element, Root>;
|
|
12
13
|
declare const invalidate: (state?: RootState | undefined, frames?: number) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState | undefined, frame?: THREE.XRFrame | undefined) => void;
|
|
13
14
|
declare const reconciler: import("react-reconciler").Reconciler<UseBoundStore<RootState, import("zustand").StoreApi<RootState>>, import("./renderer").Instance, void, import("./renderer").Instance, import("./renderer").Instance>, applyProps: typeof import("./utils").applyProps;
|
|
14
|
-
declare type Properties<T> = Pick<T, {
|
|
15
|
-
[K in keyof T]: T[K] extends (_: any) => any ? never : K;
|
|
16
|
-
}[keyof T]>;
|
|
17
15
|
declare type GLProps = Renderer | ((canvas: HTMLCanvasElement) => Renderer) | Partial<Properties<THREE.WebGLRenderer> | THREE.WebGLRendererParameters> | undefined;
|
|
18
16
|
export declare type RenderProps<TCanvas extends Element> = {
|
|
19
17
|
gl?: GLProps;
|
|
@@ -21,6 +21,7 @@ export declare type LocalState = {
|
|
|
21
21
|
memoizedProps: {
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
};
|
|
24
|
+
autoRemovedBeforeAppend?: boolean;
|
|
24
25
|
};
|
|
25
26
|
export declare type AttachFnType = (parent: Instance, self: Instance) => () => void;
|
|
26
27
|
export declare type AttachType = string | AttachFnType;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import { EventHandlers } from './core/events';
|
|
4
4
|
import { AttachType } from './core/renderer';
|
|
5
|
+
export declare type Properties<T> = Pick<T, {
|
|
6
|
+
[K in keyof T]: T[K] extends (_: any) => any ? never : K;
|
|
7
|
+
}[keyof T]>;
|
|
5
8
|
export declare type NonFunctionKeys<T> = {
|
|
6
9
|
[K in keyof T]-?: T[K] extends Function ? never : K;
|
|
7
10
|
}[keyof T];
|
|
@@ -123,7 +126,7 @@ export declare type MeshMatcapMaterialProps = MaterialNode<THREE.MeshMatcapMater
|
|
|
123
126
|
export declare type LineDashedMaterialProps = MaterialNode<THREE.LineDashedMaterial, [THREE.LineDashedMaterialParameters]>;
|
|
124
127
|
export declare type LineBasicMaterialProps = MaterialNode<THREE.LineBasicMaterial, [THREE.LineBasicMaterialParameters]>;
|
|
125
128
|
export declare type PrimitiveProps = {
|
|
126
|
-
object:
|
|
129
|
+
object: object;
|
|
127
130
|
} & {
|
|
128
131
|
[properties: string]: any;
|
|
129
132
|
};
|
|
@@ -1077,7 +1077,15 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1077
1077
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
1078
1078
|
|
|
1079
1079
|
instance.__r3f.objects = [];
|
|
1080
|
-
|
|
1080
|
+
|
|
1081
|
+
if (!instance.__r3f.autoRemovedBeforeAppend) {
|
|
1082
|
+
removeChild(parent, instance);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
if (newInstance.parent) {
|
|
1086
|
+
newInstance.__r3f.autoRemovedBeforeAppend = true;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1081
1089
|
appendChild(parent, newInstance); // Re-bind event handlers
|
|
1082
1090
|
|
|
1083
1091
|
if (newInstance.raycast && newInstance.__r3f.eventCount) {
|
|
@@ -1050,7 +1050,15 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1050
1050
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
1051
1051
|
|
|
1052
1052
|
instance.__r3f.objects = [];
|
|
1053
|
-
|
|
1053
|
+
|
|
1054
|
+
if (!instance.__r3f.autoRemovedBeforeAppend) {
|
|
1055
|
+
removeChild(parent, instance);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
if (newInstance.parent) {
|
|
1059
|
+
newInstance.__r3f.autoRemovedBeforeAppend = true;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1054
1062
|
appendChild(parent, newInstance); // Re-bind event handlers
|
|
1055
1063
|
|
|
1056
1064
|
if (newInstance.raycast && newInstance.__r3f.eventCount) {
|
|
@@ -1077,7 +1077,15 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1077
1077
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
1078
1078
|
|
|
1079
1079
|
instance.__r3f.objects = [];
|
|
1080
|
-
|
|
1080
|
+
|
|
1081
|
+
if (!instance.__r3f.autoRemovedBeforeAppend) {
|
|
1082
|
+
removeChild(parent, instance);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
if (newInstance.parent) {
|
|
1086
|
+
newInstance.__r3f.autoRemovedBeforeAppend = true;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1081
1089
|
appendChild(parent, newInstance); // Re-bind event handlers
|
|
1082
1090
|
|
|
1083
1091
|
if (newInstance.raycast && newInstance.__r3f.eventCount) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-efc69a1d.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-25dfa84d.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, i as isRef, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from './index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, i as isRef, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-79f9c7e9.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from './index-79f9c7e9.esm.js';
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-efc69a1d.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-25dfa84d.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-79f9c7e9.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-79f9c7e9.esm.js';
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -55,7 +55,7 @@ function Box(props) {
|
|
|
55
55
|
const [hovered, hover] = useState(false)
|
|
56
56
|
const [clicked, click] = useState(false)
|
|
57
57
|
// Subscribe this component to the render-loop, rotate the mesh every frame
|
|
58
|
-
useFrame((state, delta) => (ref.current.rotation.x +=
|
|
58
|
+
useFrame((state, delta) => (ref.current.rotation.x += delta))
|
|
59
59
|
// Return the view, these are regular Threejs elements expressed in JSX
|
|
60
60
|
return (
|
|
61
61
|
<mesh
|
|
@@ -98,7 +98,7 @@ function Box(props: ThreeElements['mesh']) {
|
|
|
98
98
|
const ref = useRef<THREE.Mesh>(null!)
|
|
99
99
|
const [hovered, hover] = useState(false)
|
|
100
100
|
const [clicked, click] = useState(false)
|
|
101
|
-
useFrame((state, delta) => (ref.current.rotation.x +=
|
|
101
|
+
useFrame((state, delta) => (ref.current.rotation.x += delta))
|
|
102
102
|
return (
|
|
103
103
|
<mesh
|
|
104
104
|
{...props}
|
|
@@ -163,7 +163,7 @@ function Box(props) {
|
|
|
163
163
|
const mesh = useRef(null)
|
|
164
164
|
const [hovered, setHover] = useState(false)
|
|
165
165
|
const [active, setActive] = useState(false)
|
|
166
|
-
useFrame((state, delta) => (mesh.current.rotation.x +=
|
|
166
|
+
useFrame((state, delta) => (mesh.current.rotation.x += delta))
|
|
167
167
|
return (
|
|
168
168
|
<mesh
|
|
169
169
|
{...props}
|