@react-three/fiber 9.8.0 → 9.8.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 +24 -0
- package/dist/declarations/src/core/{renderer.d.ts → configuration.d.ts} +21 -28
- package/dist/declarations/src/core/index.d.ts +6 -3
- package/dist/declarations/src/core/portal.d.ts +13 -0
- package/dist/declarations/src/core/promise.d.ts +7 -3
- package/dist/declarations/src/core/reconciler.d.ts +8 -8
- package/dist/declarations/src/core/root.d.ts +35 -0
- package/dist/declarations/src/core/utils.d.ts +1 -1
- package/dist/{events-ce5e34e8.cjs.dev.js → events-21d8cd92.cjs.dev.js} +605 -482
- package/dist/{events-803f4abc.esm.js → events-9ce18a08.esm.js} +607 -484
- package/dist/{events-a79ef12b.cjs.prod.js → events-a816cbab.cjs.prod.js} +605 -482
- package/dist/react-three-fiber.cjs.dev.js +21 -4
- package/dist/react-three-fiber.cjs.prod.js +21 -4
- package/dist/react-three-fiber.esm.js +22 -5
- package/native/dist/react-three-fiber-native.cjs.dev.js +4 -3
- package/native/dist/react-three-fiber-native.cjs.prod.js +4 -3
- package/native/dist/react-three-fiber-native.esm.js +5 -4
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('./events-
|
|
5
|
+
var events = require('./events-21d8cd92.cjs.dev.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var useMeasure = require('react-use-measure');
|
|
@@ -78,6 +78,7 @@ function CanvasImpl({
|
|
|
78
78
|
const divRef = React__namespace.useRef(null);
|
|
79
79
|
React__namespace.useImperativeHandle(ref, () => canvasRef.current);
|
|
80
80
|
const handlePointerMissed = events.useMutableCallback(onPointerMissed);
|
|
81
|
+
const pointerMissed = React__namespace.useCallback(event => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(event), [handlePointerMissed]);
|
|
81
82
|
const [block, setBlock] = React__namespace.useState(false);
|
|
82
83
|
const [error, setError] = React__namespace.useState(false);
|
|
83
84
|
|
|
@@ -91,6 +92,16 @@ function CanvasImpl({
|
|
|
91
92
|
const [gate, waitFor] = events.useGate();
|
|
92
93
|
const rootState = React__namespace.useRef(null);
|
|
93
94
|
const eventTarget = () => eventSource ? events.isRef(eventSource) ? eventSource.current : eventSource : divRef.current;
|
|
95
|
+
|
|
96
|
+
// Insertion effects survive Activity hiding and StrictMode effect replay. Only
|
|
97
|
+
// final removal releases the root, including removal while hidden from React 19.2
|
|
98
|
+
React__namespace.useInsertionEffect(() => {
|
|
99
|
+
return () => {
|
|
100
|
+
const current = root.current;
|
|
101
|
+
root.current = null;
|
|
102
|
+
current == null ? void 0 : current.unmount();
|
|
103
|
+
};
|
|
104
|
+
}, []);
|
|
94
105
|
events.useIsomorphicLayoutEffect(() => {
|
|
95
106
|
const canvas = canvasRef.current;
|
|
96
107
|
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
@@ -110,8 +121,8 @@ function CanvasImpl({
|
|
|
110
121
|
raycaster,
|
|
111
122
|
camera,
|
|
112
123
|
size: containerRect,
|
|
113
|
-
//
|
|
114
|
-
onPointerMissed:
|
|
124
|
+
// Forwards to the latest onPointerMissed, so a new callback does not update the store
|
|
125
|
+
onPointerMissed: pointerMissed,
|
|
115
126
|
onCreated: state => {
|
|
116
127
|
var _eventTarget;
|
|
117
128
|
rootState.current = state;
|
|
@@ -159,9 +170,15 @@ function CanvasImpl({
|
|
|
159
170
|
const target = eventTarget();
|
|
160
171
|
if (state && target && state.events.connected !== target) state.events.connect == null ? void 0 : state.events.connect(target);
|
|
161
172
|
});
|
|
173
|
+
|
|
174
|
+
// Before 19.2, React skips insertion cleanups in a subtree Suspense has hidden but keeps its
|
|
175
|
+
// passive effects connected. A canvas that left the document was removed rather than hidden
|
|
162
176
|
React__namespace.useEffect(() => {
|
|
163
177
|
const canvas = canvasRef.current;
|
|
164
|
-
|
|
178
|
+
return () => {
|
|
179
|
+
var _root$current;
|
|
180
|
+
if (!canvas.isConnected) (_root$current = root.current) == null ? void 0 : _root$current.unmount();
|
|
181
|
+
};
|
|
165
182
|
}, []);
|
|
166
183
|
|
|
167
184
|
// When the event source is not this div, we need to set pointer-events to none
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('./events-
|
|
5
|
+
var events = require('./events-a816cbab.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var useMeasure = require('react-use-measure');
|
|
@@ -78,6 +78,7 @@ function CanvasImpl({
|
|
|
78
78
|
const divRef = React__namespace.useRef(null);
|
|
79
79
|
React__namespace.useImperativeHandle(ref, () => canvasRef.current);
|
|
80
80
|
const handlePointerMissed = events.useMutableCallback(onPointerMissed);
|
|
81
|
+
const pointerMissed = React__namespace.useCallback(event => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(event), [handlePointerMissed]);
|
|
81
82
|
const [block, setBlock] = React__namespace.useState(false);
|
|
82
83
|
const [error, setError] = React__namespace.useState(false);
|
|
83
84
|
|
|
@@ -91,6 +92,16 @@ function CanvasImpl({
|
|
|
91
92
|
const [gate, waitFor] = events.useGate();
|
|
92
93
|
const rootState = React__namespace.useRef(null);
|
|
93
94
|
const eventTarget = () => eventSource ? events.isRef(eventSource) ? eventSource.current : eventSource : divRef.current;
|
|
95
|
+
|
|
96
|
+
// Insertion effects survive Activity hiding and StrictMode effect replay. Only
|
|
97
|
+
// final removal releases the root, including removal while hidden from React 19.2
|
|
98
|
+
React__namespace.useInsertionEffect(() => {
|
|
99
|
+
return () => {
|
|
100
|
+
const current = root.current;
|
|
101
|
+
root.current = null;
|
|
102
|
+
current == null ? void 0 : current.unmount();
|
|
103
|
+
};
|
|
104
|
+
}, []);
|
|
94
105
|
events.useIsomorphicLayoutEffect(() => {
|
|
95
106
|
const canvas = canvasRef.current;
|
|
96
107
|
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
@@ -110,8 +121,8 @@ function CanvasImpl({
|
|
|
110
121
|
raycaster,
|
|
111
122
|
camera,
|
|
112
123
|
size: containerRect,
|
|
113
|
-
//
|
|
114
|
-
onPointerMissed:
|
|
124
|
+
// Forwards to the latest onPointerMissed, so a new callback does not update the store
|
|
125
|
+
onPointerMissed: pointerMissed,
|
|
115
126
|
onCreated: state => {
|
|
116
127
|
var _eventTarget;
|
|
117
128
|
rootState.current = state;
|
|
@@ -159,9 +170,15 @@ function CanvasImpl({
|
|
|
159
170
|
const target = eventTarget();
|
|
160
171
|
if (state && target && state.events.connected !== target) state.events.connect == null ? void 0 : state.events.connect(target);
|
|
161
172
|
});
|
|
173
|
+
|
|
174
|
+
// Before 19.2, React skips insertion cleanups in a subtree Suspense has hidden but keeps its
|
|
175
|
+
// passive effects connected. A canvas that left the document was removed rather than hidden
|
|
162
176
|
React__namespace.useEffect(() => {
|
|
163
177
|
const canvas = canvasRef.current;
|
|
164
|
-
|
|
178
|
+
return () => {
|
|
179
|
+
var _root$current;
|
|
180
|
+
if (!canvas.isConnected) (_root$current = root.current) == null ? void 0 : _root$current.unmount();
|
|
181
|
+
};
|
|
165
182
|
}, []);
|
|
166
183
|
|
|
167
184
|
// When the event source is not this div, we need to set pointer-events to none
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as extend, u as useBridge, a as useMutableCallback, b as useGate, c as useIsomorphicLayoutEffect, d as createRoot, E as ErrorBoundary, B as Block, f as
|
|
2
|
-
export { t as ReactThreeFiber, _ as _roots, y as act,
|
|
1
|
+
import { e as extend, u as useBridge, a as useMutableCallback, b as useGate, c as useIsomorphicLayoutEffect, d as createRoot, E as ErrorBoundary, B as Block, f as createPointerEvents, i as isRef } from './events-9ce18a08.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, _ as _roots, y as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, v as applyProps, z as buildGraph, s as context, g as createEvents, q as createPortal, d as createRoot, x as dispose, f as events, e as extend, h as flushGlobalEffects, o as flushSync, w as getRootState, m as invalidate, r as reconciler, p as unmountComponentAtNode, F as useFrame, G as useGraph, A as useInstanceHandle, H as useLoader, C as useStore, D as useThree } from './events-9ce18a08.esm.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import useMeasure from 'react-use-measure';
|
|
@@ -51,6 +51,7 @@ function CanvasImpl({
|
|
|
51
51
|
const divRef = React.useRef(null);
|
|
52
52
|
React.useImperativeHandle(ref, () => canvasRef.current);
|
|
53
53
|
const handlePointerMissed = useMutableCallback(onPointerMissed);
|
|
54
|
+
const pointerMissed = React.useCallback(event => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(event), [handlePointerMissed]);
|
|
54
55
|
const [block, setBlock] = React.useState(false);
|
|
55
56
|
const [error, setError] = React.useState(false);
|
|
56
57
|
|
|
@@ -64,6 +65,16 @@ function CanvasImpl({
|
|
|
64
65
|
const [gate, waitFor] = useGate();
|
|
65
66
|
const rootState = React.useRef(null);
|
|
66
67
|
const eventTarget = () => eventSource ? isRef(eventSource) ? eventSource.current : eventSource : divRef.current;
|
|
68
|
+
|
|
69
|
+
// Insertion effects survive Activity hiding and StrictMode effect replay. Only
|
|
70
|
+
// final removal releases the root, including removal while hidden from React 19.2
|
|
71
|
+
React.useInsertionEffect(() => {
|
|
72
|
+
return () => {
|
|
73
|
+
const current = root.current;
|
|
74
|
+
root.current = null;
|
|
75
|
+
current == null ? void 0 : current.unmount();
|
|
76
|
+
};
|
|
77
|
+
}, []);
|
|
67
78
|
useIsomorphicLayoutEffect(() => {
|
|
68
79
|
const canvas = canvasRef.current;
|
|
69
80
|
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
@@ -83,8 +94,8 @@ function CanvasImpl({
|
|
|
83
94
|
raycaster,
|
|
84
95
|
camera,
|
|
85
96
|
size: containerRect,
|
|
86
|
-
//
|
|
87
|
-
onPointerMissed:
|
|
97
|
+
// Forwards to the latest onPointerMissed, so a new callback does not update the store
|
|
98
|
+
onPointerMissed: pointerMissed,
|
|
88
99
|
onCreated: state => {
|
|
89
100
|
var _eventTarget;
|
|
90
101
|
rootState.current = state;
|
|
@@ -132,9 +143,15 @@ function CanvasImpl({
|
|
|
132
143
|
const target = eventTarget();
|
|
133
144
|
if (state && target && state.events.connected !== target) state.events.connect == null ? void 0 : state.events.connect(target);
|
|
134
145
|
});
|
|
146
|
+
|
|
147
|
+
// Before 19.2, React skips insertion cleanups in a subtree Suspense has hidden but keeps its
|
|
148
|
+
// passive effects connected. A canvas that left the document was removed rather than hidden
|
|
135
149
|
React.useEffect(() => {
|
|
136
150
|
const canvas = canvasRef.current;
|
|
137
|
-
|
|
151
|
+
return () => {
|
|
152
|
+
var _root$current;
|
|
153
|
+
if (!canvas.isConnected) (_root$current = root.current) == null ? void 0 : _root$current.unmount();
|
|
154
|
+
};
|
|
138
155
|
}, []);
|
|
139
156
|
|
|
140
157
|
// When the event source is not this div, we need to set pointer-events to none
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('../../dist/events-
|
|
5
|
+
var events = require('../../dist/events-21d8cd92.cjs.dev.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var reactNative = require('react-native');
|
|
@@ -80,6 +80,7 @@ function CanvasImpl({
|
|
|
80
80
|
const [bind, setBind] = React__namespace.useState();
|
|
81
81
|
React__namespace.useImperativeHandle(ref, () => viewRef.current);
|
|
82
82
|
const handlePointerMissed = events.useMutableCallback(onPointerMissed);
|
|
83
|
+
const pointerMissed = React__namespace.useCallback(event => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(event), [handlePointerMissed]);
|
|
83
84
|
const [block, setBlock] = React__namespace.useState(false);
|
|
84
85
|
const [error, setError] = React__namespace.useState(undefined);
|
|
85
86
|
|
|
@@ -217,8 +218,8 @@ function CanvasImpl({
|
|
|
217
218
|
top,
|
|
218
219
|
left
|
|
219
220
|
},
|
|
220
|
-
//
|
|
221
|
-
onPointerMissed:
|
|
221
|
+
// Forwards to the latest onPointerMissed, so a new callback does not update the store
|
|
222
|
+
onPointerMissed: pointerMissed,
|
|
222
223
|
// Overwrite onCreated to apply RN bindings
|
|
223
224
|
onCreated: state => {
|
|
224
225
|
// Bind render to RN bridge
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('../../dist/events-
|
|
5
|
+
var events = require('../../dist/events-a816cbab.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var reactNative = require('react-native');
|
|
@@ -80,6 +80,7 @@ function CanvasImpl({
|
|
|
80
80
|
const [bind, setBind] = React__namespace.useState();
|
|
81
81
|
React__namespace.useImperativeHandle(ref, () => viewRef.current);
|
|
82
82
|
const handlePointerMissed = events.useMutableCallback(onPointerMissed);
|
|
83
|
+
const pointerMissed = React__namespace.useCallback(event => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(event), [handlePointerMissed]);
|
|
83
84
|
const [block, setBlock] = React__namespace.useState(false);
|
|
84
85
|
const [error, setError] = React__namespace.useState(undefined);
|
|
85
86
|
|
|
@@ -217,8 +218,8 @@ function CanvasImpl({
|
|
|
217
218
|
top,
|
|
218
219
|
left
|
|
219
220
|
},
|
|
220
|
-
//
|
|
221
|
-
onPointerMissed:
|
|
221
|
+
// Forwards to the latest onPointerMissed, so a new callback does not update the store
|
|
222
|
+
onPointerMissed: pointerMissed,
|
|
222
223
|
// Overwrite onCreated to apply RN bindings
|
|
223
224
|
onCreated: state => {
|
|
224
225
|
// Bind render to RN bridge
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as extend, u as useBridge, a as useMutableCallback, d as createRoot, b as useGate, c as useIsomorphicLayoutEffect, E as ErrorBoundary, B as Block,
|
|
2
|
-
export { t as ReactThreeFiber, _ as _roots, y as act,
|
|
1
|
+
import { e as extend, u as useBridge, a as useMutableCallback, d as createRoot, b as useGate, c as useIsomorphicLayoutEffect, E as ErrorBoundary, B as Block, p as unmountComponentAtNode, f as createPointerEvents, g as createEvents } from '../../dist/events-9ce18a08.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, _ as _roots, y as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, v as applyProps, z as buildGraph, s as context, g as createEvents, q as createPortal, d as createRoot, x as dispose, e as extend, h as flushGlobalEffects, o as flushSync, w as getRootState, m as invalidate, r as reconciler, p as unmountComponentAtNode, F as useFrame, G as useGraph, A as useInstanceHandle, H as useLoader, C as useStore, D as useThree } from '../../dist/events-9ce18a08.esm.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { PanResponder, PixelRatio, StyleSheet, View, Platform, Image, NativeModules } from 'react-native';
|
|
@@ -56,6 +56,7 @@ function CanvasImpl({
|
|
|
56
56
|
const [bind, setBind] = React.useState();
|
|
57
57
|
React.useImperativeHandle(ref, () => viewRef.current);
|
|
58
58
|
const handlePointerMissed = useMutableCallback(onPointerMissed);
|
|
59
|
+
const pointerMissed = React.useCallback(event => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(event), [handlePointerMissed]);
|
|
59
60
|
const [block, setBlock] = React.useState(false);
|
|
60
61
|
const [error, setError] = React.useState(undefined);
|
|
61
62
|
|
|
@@ -193,8 +194,8 @@ function CanvasImpl({
|
|
|
193
194
|
top,
|
|
194
195
|
left
|
|
195
196
|
},
|
|
196
|
-
//
|
|
197
|
-
onPointerMissed:
|
|
197
|
+
// Forwards to the latest onPointerMissed, so a new callback does not update the store
|
|
198
|
+
onPointerMissed: pointerMissed,
|
|
198
199
|
// Overwrite onCreated to apply RN bindings
|
|
199
200
|
onCreated: state => {
|
|
200
201
|
// Bind render to RN bridge
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/fiber",
|
|
3
|
-
"version": "9.8.
|
|
3
|
+
"version": "9.8.1",
|
|
4
4
|
"description": "A React renderer for Threejs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@types/webxr": "*",
|
|
52
52
|
"base64-js": "^1.5.1",
|
|
53
53
|
"buffer": "^6.0.3",
|
|
54
|
-
"its-fine": "^2.
|
|
54
|
+
"its-fine": "^2.1.1",
|
|
55
55
|
"react-use-measure": "^2.1.7",
|
|
56
56
|
"scheduler": "^0.28.0",
|
|
57
57
|
"suspend-react": "^0.1.3",
|