@react-three/fiber 8.5.1 → 8.6.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 +18 -0
- package/dist/declarations/src/three-types.d.ts +1 -1
- package/dist/declarations/src/web/Canvas.d.ts +2 -0
- package/dist/{index-08c4a2bb.cjs.dev.js → index-9a338808.cjs.dev.js} +9 -4
- package/dist/{index-cf0284c7.esm.js → index-cecf55e8.esm.js} +9 -4
- package/dist/{index-8826c241.cjs.prod.js → index-f368ca4a.cjs.prod.js} +9 -4
- package/dist/react-three-fiber.cjs.dev.js +18 -2
- package/dist/react-three-fiber.cjs.prod.js +18 -2
- package/dist/react-three-fiber.esm.js +19 -3
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 8.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 57c12e9c: fix(types): @react-three/drei declaration files
|
|
8
|
+
|
|
9
|
+
## 8.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7a0b5670: fix(core): don't append to unmounted containers
|
|
14
|
+
|
|
15
|
+
## 8.6.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 85c80e70: eventsource and eventprefix on the canvas component
|
|
20
|
+
|
|
3
21
|
## 8.5.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@ import * as THREE from 'three';
|
|
|
3
3
|
import { EventHandlers } from './core/events';
|
|
4
4
|
import { AttachType } from './core/renderer';
|
|
5
5
|
export declare type NonFunctionKeys<T> = {
|
|
6
|
-
[K in keyof T]
|
|
6
|
+
[K in keyof T]-?: T[K] extends Function ? never : K;
|
|
7
7
|
}[keyof T];
|
|
8
8
|
export declare type Overwrite<T, O> = Omit<T, NonFunctionKeys<O>> & O;
|
|
9
9
|
declare type Args<T> = T extends new (...args: any) => any ? ConstructorParameters<T> : T;
|
|
@@ -5,5 +5,7 @@ export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, Rea
|
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
fallback?: React.ReactNode;
|
|
7
7
|
resize?: ResizeOptions;
|
|
8
|
+
eventSource?: HTMLElement;
|
|
9
|
+
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
8
10
|
}
|
|
9
11
|
export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
|
|
@@ -1090,8 +1090,10 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1090
1090
|
supportsHydration: false,
|
|
1091
1091
|
noTimeout: -1,
|
|
1092
1092
|
appendChildToContainer: (container, child) => {
|
|
1093
|
-
if (!child) return;
|
|
1094
|
-
|
|
1093
|
+
if (!child) return; // Don't append to unmounted container
|
|
1094
|
+
|
|
1095
|
+
const scene = container.getState().scene;
|
|
1096
|
+
if (!scene.__r3f) return; // Link current root to the default scene
|
|
1095
1097
|
|
|
1096
1098
|
scene.__r3f.root = container;
|
|
1097
1099
|
appendChild(scene, child);
|
|
@@ -1101,8 +1103,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1101
1103
|
removeChild(container.getState().scene, child);
|
|
1102
1104
|
},
|
|
1103
1105
|
insertInContainerBefore: (container, child, beforeChild) => {
|
|
1104
|
-
if (!child || !beforeChild) return;
|
|
1105
|
-
|
|
1106
|
+
if (!child || !beforeChild) return; // Don't append to unmounted container
|
|
1107
|
+
|
|
1108
|
+
const scene = container.getState().scene;
|
|
1109
|
+
if (!scene.__r3f) return;
|
|
1110
|
+
insertBefore(scene, child, beforeChild);
|
|
1106
1111
|
},
|
|
1107
1112
|
getRootHostContext: () => null,
|
|
1108
1113
|
getChildHostContext: parentHostContext => parentHostContext,
|
|
@@ -1063,8 +1063,10 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1063
1063
|
supportsHydration: false,
|
|
1064
1064
|
noTimeout: -1,
|
|
1065
1065
|
appendChildToContainer: (container, child) => {
|
|
1066
|
-
if (!child) return;
|
|
1067
|
-
|
|
1066
|
+
if (!child) return; // Don't append to unmounted container
|
|
1067
|
+
|
|
1068
|
+
const scene = container.getState().scene;
|
|
1069
|
+
if (!scene.__r3f) return; // Link current root to the default scene
|
|
1068
1070
|
|
|
1069
1071
|
scene.__r3f.root = container;
|
|
1070
1072
|
appendChild(scene, child);
|
|
@@ -1074,8 +1076,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1074
1076
|
removeChild(container.getState().scene, child);
|
|
1075
1077
|
},
|
|
1076
1078
|
insertInContainerBefore: (container, child, beforeChild) => {
|
|
1077
|
-
if (!child || !beforeChild) return;
|
|
1078
|
-
|
|
1079
|
+
if (!child || !beforeChild) return; // Don't append to unmounted container
|
|
1080
|
+
|
|
1081
|
+
const scene = container.getState().scene;
|
|
1082
|
+
if (!scene.__r3f) return;
|
|
1083
|
+
insertBefore(scene, child, beforeChild);
|
|
1079
1084
|
},
|
|
1080
1085
|
getRootHostContext: () => null,
|
|
1081
1086
|
getChildHostContext: parentHostContext => parentHostContext,
|
|
@@ -1090,8 +1090,10 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1090
1090
|
supportsHydration: false,
|
|
1091
1091
|
noTimeout: -1,
|
|
1092
1092
|
appendChildToContainer: (container, child) => {
|
|
1093
|
-
if (!child) return;
|
|
1094
|
-
|
|
1093
|
+
if (!child) return; // Don't append to unmounted container
|
|
1094
|
+
|
|
1095
|
+
const scene = container.getState().scene;
|
|
1096
|
+
if (!scene.__r3f) return; // Link current root to the default scene
|
|
1095
1097
|
|
|
1096
1098
|
scene.__r3f.root = container;
|
|
1097
1099
|
appendChild(scene, child);
|
|
@@ -1101,8 +1103,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1101
1103
|
removeChild(container.getState().scene, child);
|
|
1102
1104
|
},
|
|
1103
1105
|
insertInContainerBefore: (container, child, beforeChild) => {
|
|
1104
|
-
if (!child || !beforeChild) return;
|
|
1105
|
-
|
|
1106
|
+
if (!child || !beforeChild) return; // Don't append to unmounted container
|
|
1107
|
+
|
|
1108
|
+
const scene = container.getState().scene;
|
|
1109
|
+
if (!scene.__r3f) return;
|
|
1110
|
+
insertBefore(scene, child, beforeChild);
|
|
1106
1111
|
},
|
|
1107
1112
|
getRootHostContext: () => null,
|
|
1108
1113
|
getChildHostContext: parentHostContext => parentHostContext,
|
|
@@ -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-9a338808.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -126,6 +126,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
126
126
|
style,
|
|
127
127
|
gl,
|
|
128
128
|
events = createPointerEvents,
|
|
129
|
+
eventSource,
|
|
130
|
+
eventPrefix,
|
|
129
131
|
shadows,
|
|
130
132
|
linear,
|
|
131
133
|
flat,
|
|
@@ -184,7 +186,21 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
184
186
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
185
187
|
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
186
188
|
onCreated: state => {
|
|
187
|
-
|
|
189
|
+
// Connect to event source
|
|
190
|
+
state.events.connect == null ? void 0 : state.events.connect(eventSource ? eventSource : divRef.current); // Set up compute function
|
|
191
|
+
|
|
192
|
+
if (eventPrefix) {
|
|
193
|
+
state.setEvents({
|
|
194
|
+
compute: (event, state) => {
|
|
195
|
+
const x = event[eventPrefix + 'X'];
|
|
196
|
+
const y = event[eventPrefix + 'Y'];
|
|
197
|
+
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
198
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
} // Call onCreated callback
|
|
202
|
+
|
|
203
|
+
|
|
188
204
|
onCreated == null ? void 0 : onCreated(state);
|
|
189
205
|
}
|
|
190
206
|
});
|
|
@@ -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-f368ca4a.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -126,6 +126,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
126
126
|
style,
|
|
127
127
|
gl,
|
|
128
128
|
events = createPointerEvents,
|
|
129
|
+
eventSource,
|
|
130
|
+
eventPrefix,
|
|
129
131
|
shadows,
|
|
130
132
|
linear,
|
|
131
133
|
flat,
|
|
@@ -184,7 +186,21 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
184
186
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
185
187
|
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
186
188
|
onCreated: state => {
|
|
187
|
-
|
|
189
|
+
// Connect to event source
|
|
190
|
+
state.events.connect == null ? void 0 : state.events.connect(eventSource ? eventSource : divRef.current); // Set up compute function
|
|
191
|
+
|
|
192
|
+
if (eventPrefix) {
|
|
193
|
+
state.setEvents({
|
|
194
|
+
compute: (event, state) => {
|
|
195
|
+
const x = event[eventPrefix + 'X'];
|
|
196
|
+
const y = event[eventPrefix + 'Y'];
|
|
197
|
+
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
198
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
} // Call onCreated callback
|
|
202
|
+
|
|
203
|
+
|
|
188
204
|
onCreated == null ? void 0 : onCreated(state);
|
|
189
205
|
}
|
|
190
206
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-
|
|
2
|
-
export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-cecf55e8.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-cecf55e8.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';
|
|
@@ -99,6 +99,8 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
99
99
|
style,
|
|
100
100
|
gl,
|
|
101
101
|
events = createPointerEvents,
|
|
102
|
+
eventSource,
|
|
103
|
+
eventPrefix,
|
|
102
104
|
shadows,
|
|
103
105
|
linear,
|
|
104
106
|
flat,
|
|
@@ -157,7 +159,21 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
157
159
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
158
160
|
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
159
161
|
onCreated: state => {
|
|
160
|
-
|
|
162
|
+
// Connect to event source
|
|
163
|
+
state.events.connect == null ? void 0 : state.events.connect(eventSource ? eventSource : divRef.current); // Set up compute function
|
|
164
|
+
|
|
165
|
+
if (eventPrefix) {
|
|
166
|
+
state.setEvents({
|
|
167
|
+
compute: (event, state) => {
|
|
168
|
+
const x = event[eventPrefix + 'X'];
|
|
169
|
+
const y = event[eventPrefix + 'Y'];
|
|
170
|
+
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
171
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
} // Call onCreated callback
|
|
175
|
+
|
|
176
|
+
|
|
161
177
|
onCreated == null ? void 0 : onCreated(state);
|
|
162
178
|
}
|
|
163
179
|
});
|
|
@@ -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-9a338808.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-f368ca4a.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, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w 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-cecf55e8.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from '../../dist/index-cecf55e8.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';
|