@react-three/fiber 9.6.1 → 9.8.0
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 +1241 -1204
- package/dist/declarations/react-reconciler/index.d.ts +30 -13
- package/dist/declarations/src/core/events.d.ts +94 -94
- package/dist/declarations/src/core/hooks.d.ts +53 -53
- package/dist/declarations/src/core/index.d.ts +14 -13
- package/dist/declarations/src/core/loop.d.ts +31 -31
- package/dist/declarations/src/core/promise.d.ts +15 -0
- package/dist/declarations/src/core/reconciler.d.ts +54 -50
- package/dist/declarations/src/core/renderer.d.ts +91 -89
- package/dist/declarations/src/core/store.d.ts +130 -130
- package/dist/declarations/src/core/utils.d.ts +265 -262
- package/dist/declarations/src/index.d.ts +6 -6
- package/dist/declarations/src/native/Canvas.d.ts +13 -13
- package/dist/declarations/src/native/events.d.ts +4 -4
- package/dist/declarations/src/native.d.ts +6 -6
- package/dist/declarations/src/three-types.d.ts +68 -68
- package/dist/declarations/src/web/Canvas.d.ts +23 -23
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/dist/events-803f4abc.esm.js +17563 -0
- package/dist/{events-583399dd.cjs.prod.js → events-a79ef12b.cjs.prod.js} +3558 -2807
- package/dist/{events-f19bcc32.cjs.dev.js → events-ce5e34e8.cjs.dev.js} +7985 -6652
- package/dist/react-three-fiber.cjs.dev.js +61 -43
- package/dist/react-three-fiber.cjs.prod.js +61 -43
- package/dist/react-three-fiber.esm.js +63 -45
- package/native/dist/react-three-fiber-native.cjs.dev.js +49 -43
- package/native/dist/react-three-fiber-native.cjs.prod.js +49 -43
- package/native/dist/react-three-fiber-native.esm.js +50 -44
- package/native/package.json +5 -5
- package/package.json +6 -6
- package/react-reconciler/index.d.ts +30 -13
- package/react-reconciler/index.js +79 -77
- package/readme.md +253 -253
- package/dist/events-b389eeca.esm.js +0 -16231
|
@@ -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-a79ef12b.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var reactNative = require('react-native');
|
|
@@ -190,45 +190,50 @@ function CanvasImpl({
|
|
|
190
190
|
});
|
|
191
191
|
setBind(responder.panHandlers);
|
|
192
192
|
}, []);
|
|
193
|
+
|
|
194
|
+
// Waits for an async renderer without hiding the view
|
|
195
|
+
const [gate, waitFor] = events.useGate();
|
|
193
196
|
events.useIsomorphicLayoutEffect(() => {
|
|
194
197
|
if (root.current && width > 0 && height > 0) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
198
|
+
root.current.configure({
|
|
199
|
+
gl,
|
|
200
|
+
events: events$1,
|
|
201
|
+
shadows,
|
|
202
|
+
linear,
|
|
203
|
+
flat,
|
|
204
|
+
legacy,
|
|
205
|
+
orthographic,
|
|
206
|
+
frameloop,
|
|
207
|
+
performance,
|
|
208
|
+
raycaster,
|
|
209
|
+
camera,
|
|
210
|
+
scene,
|
|
211
|
+
// expo-gl can only render at native dpr/resolution
|
|
212
|
+
// https://github.com/expo/expo-three/issues/39
|
|
213
|
+
dpr: reactNative.PixelRatio.get(),
|
|
214
|
+
size: {
|
|
215
|
+
width,
|
|
216
|
+
height,
|
|
217
|
+
top,
|
|
218
|
+
left
|
|
219
|
+
},
|
|
220
|
+
// Pass mutable reference to onPointerMissed so it's free to update
|
|
221
|
+
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
222
|
+
// Overwrite onCreated to apply RN bindings
|
|
223
|
+
onCreated: state => {
|
|
224
|
+
// Bind render to RN bridge
|
|
225
|
+
const context = state.gl.getContext();
|
|
226
|
+
const renderFrame = state.gl.render.bind(state.gl);
|
|
227
|
+
state.gl.render = (scene, camera) => {
|
|
228
|
+
renderFrame(scene, camera);
|
|
229
|
+
context.endFrameEXP();
|
|
230
|
+
};
|
|
231
|
+
return onCreated == null ? void 0 : onCreated(state);
|
|
232
|
+
}
|
|
233
|
+
}).catch(setError);
|
|
234
|
+
|
|
235
|
+
// Pending re-runs this effect once the renderer lands. Rejected is reported by the catch
|
|
236
|
+
if (root.current.ready.status === 'fulfilled') {
|
|
232
237
|
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
233
238
|
children: /*#__PURE__*/jsxRuntime.jsx(events.ErrorBoundary, {
|
|
234
239
|
set: setError,
|
|
@@ -240,8 +245,9 @@ function CanvasImpl({
|
|
|
240
245
|
})
|
|
241
246
|
})
|
|
242
247
|
}));
|
|
248
|
+
} else if (root.current.ready.status === 'pending') {
|
|
249
|
+
waitFor(root.current.ready);
|
|
243
250
|
}
|
|
244
|
-
run();
|
|
245
251
|
}
|
|
246
252
|
});
|
|
247
253
|
React__namespace.useEffect(() => {
|
|
@@ -265,13 +271,13 @@ function CanvasImpl({
|
|
|
265
271
|
style: reactNative.StyleSheet.absoluteFill,
|
|
266
272
|
pointerEvents: pointerEvents,
|
|
267
273
|
...bind
|
|
268
|
-
})]
|
|
274
|
+
}), gate]
|
|
269
275
|
});
|
|
270
276
|
}
|
|
271
277
|
|
|
272
|
-
/**
|
|
273
|
-
* A native canvas which accepts threejs elements as children.
|
|
274
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
278
|
+
/**
|
|
279
|
+
* A native canvas which accepts threejs elements as children.
|
|
280
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
275
281
|
*/
|
|
276
282
|
function Canvas(props) {
|
|
277
283
|
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as extend, u as useBridge, a as useMutableCallback,
|
|
2
|
-
export { t as ReactThreeFiber, _ as _roots,
|
|
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, f as unmountComponentAtNode, g as createPointerEvents, h as createEvents } from '../../dist/events-803f4abc.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, _ as _roots, y as act, l as addAfterEffect, k as addEffect, m as addTail, o as advance, v as applyProps, z as buildGraph, s as context, h as createEvents, p as createPortal, d as createRoot, x as dispose, e as extend, j as flushGlobalEffects, q as flushSync, w as getRootState, n as invalidate, r as reconciler, f as unmountComponentAtNode, F as useFrame, G as useGraph, A as useInstanceHandle, H as useLoader, C as useStore, D as useThree } from '../../dist/events-803f4abc.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';
|
|
@@ -166,45 +166,50 @@ function CanvasImpl({
|
|
|
166
166
|
});
|
|
167
167
|
setBind(responder.panHandlers);
|
|
168
168
|
}, []);
|
|
169
|
+
|
|
170
|
+
// Waits for an async renderer without hiding the view
|
|
171
|
+
const [gate, waitFor] = useGate();
|
|
169
172
|
useIsomorphicLayoutEffect(() => {
|
|
170
173
|
if (root.current && width > 0 && height > 0) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
174
|
+
root.current.configure({
|
|
175
|
+
gl,
|
|
176
|
+
events,
|
|
177
|
+
shadows,
|
|
178
|
+
linear,
|
|
179
|
+
flat,
|
|
180
|
+
legacy,
|
|
181
|
+
orthographic,
|
|
182
|
+
frameloop,
|
|
183
|
+
performance,
|
|
184
|
+
raycaster,
|
|
185
|
+
camera,
|
|
186
|
+
scene,
|
|
187
|
+
// expo-gl can only render at native dpr/resolution
|
|
188
|
+
// https://github.com/expo/expo-three/issues/39
|
|
189
|
+
dpr: PixelRatio.get(),
|
|
190
|
+
size: {
|
|
191
|
+
width,
|
|
192
|
+
height,
|
|
193
|
+
top,
|
|
194
|
+
left
|
|
195
|
+
},
|
|
196
|
+
// Pass mutable reference to onPointerMissed so it's free to update
|
|
197
|
+
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
198
|
+
// Overwrite onCreated to apply RN bindings
|
|
199
|
+
onCreated: state => {
|
|
200
|
+
// Bind render to RN bridge
|
|
201
|
+
const context = state.gl.getContext();
|
|
202
|
+
const renderFrame = state.gl.render.bind(state.gl);
|
|
203
|
+
state.gl.render = (scene, camera) => {
|
|
204
|
+
renderFrame(scene, camera);
|
|
205
|
+
context.endFrameEXP();
|
|
206
|
+
};
|
|
207
|
+
return onCreated == null ? void 0 : onCreated(state);
|
|
208
|
+
}
|
|
209
|
+
}).catch(setError);
|
|
210
|
+
|
|
211
|
+
// Pending re-runs this effect once the renderer lands. Rejected is reported by the catch
|
|
212
|
+
if (root.current.ready.status === 'fulfilled') {
|
|
208
213
|
root.current.render( /*#__PURE__*/jsx(Bridge, {
|
|
209
214
|
children: /*#__PURE__*/jsx(ErrorBoundary, {
|
|
210
215
|
set: setError,
|
|
@@ -216,8 +221,9 @@ function CanvasImpl({
|
|
|
216
221
|
})
|
|
217
222
|
})
|
|
218
223
|
}));
|
|
224
|
+
} else if (root.current.ready.status === 'pending') {
|
|
225
|
+
waitFor(root.current.ready);
|
|
219
226
|
}
|
|
220
|
-
run();
|
|
221
227
|
}
|
|
222
228
|
});
|
|
223
229
|
React.useEffect(() => {
|
|
@@ -241,13 +247,13 @@ function CanvasImpl({
|
|
|
241
247
|
style: StyleSheet.absoluteFill,
|
|
242
248
|
pointerEvents: pointerEvents,
|
|
243
249
|
...bind
|
|
244
|
-
})]
|
|
250
|
+
}), gate]
|
|
245
251
|
});
|
|
246
252
|
}
|
|
247
253
|
|
|
248
|
-
/**
|
|
249
|
-
* A native canvas which accepts threejs elements as children.
|
|
250
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
254
|
+
/**
|
|
255
|
+
* A native canvas which accepts threejs elements as children.
|
|
256
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
251
257
|
*/
|
|
252
258
|
function Canvas(props) {
|
|
253
259
|
return /*#__PURE__*/jsx(FiberProvider, {
|
package/native/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "dist/react-three-fiber-native.cjs.js",
|
|
3
|
-
"module": "dist/react-three-fiber-native.esm.js",
|
|
4
|
-
"types": "dist/react-three-fiber-native.cjs.d.ts"
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"main": "dist/react-three-fiber-native.cjs.js",
|
|
3
|
+
"module": "dist/react-three-fiber-native.esm.js",
|
|
4
|
+
"types": "dist/react-three-fiber-native.cjs.d.ts"
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/fiber",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.0",
|
|
4
4
|
"description": "A React renderer for Threejs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"prebuild": "cp ../../readme.md readme.md"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/react-reconciler": "^0.
|
|
47
|
-
"react-reconciler": "^0.
|
|
46
|
+
"@types/react-reconciler": "^0.33.0",
|
|
47
|
+
"react-reconciler": "^0.34.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@babel/runtime": "^7.17.8",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"buffer": "^6.0.3",
|
|
54
54
|
"its-fine": "^2.0.0",
|
|
55
55
|
"react-use-measure": "^2.1.7",
|
|
56
|
-
"scheduler": "^0.
|
|
56
|
+
"scheduler": "^0.28.0",
|
|
57
57
|
"suspend-react": "^0.1.3",
|
|
58
58
|
"use-sync-external-store": "^1.4.0",
|
|
59
59
|
"zustand": "^5.0.3"
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"expo-asset": ">=8.4",
|
|
64
64
|
"expo-file-system": ">=11.0",
|
|
65
65
|
"expo-gl": ">=11.0",
|
|
66
|
-
"react": ">=19 <19.
|
|
67
|
-
"react-dom": ">=19 <19.
|
|
66
|
+
"react": ">=19 <19.4",
|
|
67
|
+
"react-dom": ">=19 <19.4",
|
|
68
68
|
"react-native": ">=0.78",
|
|
69
69
|
"three": ">=0.156"
|
|
70
70
|
},
|
|
@@ -610,7 +610,8 @@ declare namespace ReactReconciler {
|
|
|
610
610
|
type LanePriority = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17;
|
|
611
611
|
|
|
612
612
|
type Lanes = number;
|
|
613
|
-
|
|
613
|
+
|
|
614
|
+
type Lane = number & { __LaneBrand: any };
|
|
614
615
|
|
|
615
616
|
type Flags = number;
|
|
616
617
|
|
|
@@ -941,7 +942,6 @@ declare namespace ReactReconciler {
|
|
|
941
942
|
onCaughtError: (error: Error, info: BaseErrorInfo) => void,
|
|
942
943
|
onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
|
|
943
944
|
onDefaultTransitionIndicator: () => void,
|
|
944
|
-
transitionCallbacks: null | TransitionTracingCallbacks,
|
|
945
945
|
): OpaqueRoot;
|
|
946
946
|
|
|
947
947
|
createPortal(
|
|
@@ -951,8 +951,6 @@ declare namespace ReactReconciler {
|
|
|
951
951
|
key?: string | null,
|
|
952
952
|
): ReactPortal;
|
|
953
953
|
|
|
954
|
-
registerMutableSourceForHydration(root: FiberRoot, mutableSource: MutableSource): void;
|
|
955
|
-
|
|
956
954
|
createComponentSelector(component: React$AbstractComponent<never, unknown>): ComponentSelector;
|
|
957
955
|
|
|
958
956
|
createHasPseudoClassSelector(selectors: Selector[]): HasPseudoClassSelector;
|
|
@@ -987,8 +985,12 @@ declare namespace ReactReconciler {
|
|
|
987
985
|
isStrictMode: boolean,
|
|
988
986
|
concurrentUpdatesByDefaultOverride: null | boolean,
|
|
989
987
|
identifierPrefix: string,
|
|
990
|
-
|
|
988
|
+
onUncaughtError: (error: Error, info: BaseErrorInfo & { errorBoundary?: Component }) => void,
|
|
989
|
+
onCaughtError: (error: Error, info: BaseErrorInfo) => void,
|
|
990
|
+
onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
|
|
991
|
+
onDefaultTransitionIndicator: () => void,
|
|
991
992
|
transitionCallbacks: null | TransitionTracingCallbacks,
|
|
993
|
+
formState: unknown,
|
|
992
994
|
): OpaqueRoot;
|
|
993
995
|
|
|
994
996
|
updateContainer(
|
|
@@ -998,17 +1000,27 @@ declare namespace ReactReconciler {
|
|
|
998
1000
|
callback?: (() => void) | null,
|
|
999
1001
|
): Lane;
|
|
1000
1002
|
|
|
1003
|
+
updateContainerSync(
|
|
1004
|
+
element: ReactNode,
|
|
1005
|
+
container: OpaqueRoot,
|
|
1006
|
+
parentComponent?: Component<any, any> | null,
|
|
1007
|
+
callback?: (() => void) | null,
|
|
1008
|
+
): Lane;
|
|
1009
|
+
|
|
1001
1010
|
batchedUpdates<A, R>(fn: (a: A) => R, a: A): R;
|
|
1002
1011
|
|
|
1003
1012
|
deferredUpdates<A>(fn: () => A): A;
|
|
1004
1013
|
|
|
1005
1014
|
discreteUpdates<A, B, C, D, R>(fn: (arg0: A, arg1: B, arg2: C, arg3: D) => R, a: A, b: B, c: C, d: D): R;
|
|
1006
1015
|
|
|
1007
|
-
flushControlled(fn: () => any): void;
|
|
1008
|
-
|
|
1009
1016
|
flushSync(): void;
|
|
1010
1017
|
flushSync<R>(fn: () => R): R;
|
|
1011
1018
|
|
|
1019
|
+
flushSyncFromReconciler(): void;
|
|
1020
|
+
flushSyncFromReconciler<R>(fn: () => R): R;
|
|
1021
|
+
|
|
1022
|
+
flushSyncWork(): boolean;
|
|
1023
|
+
|
|
1012
1024
|
isAlreadyRendering(): boolean;
|
|
1013
1025
|
|
|
1014
1026
|
flushPassiveEffects(): boolean;
|
|
@@ -1017,16 +1029,10 @@ declare namespace ReactReconciler {
|
|
|
1017
1029
|
|
|
1018
1030
|
attemptSynchronousHydration(fiber: Fiber): void;
|
|
1019
1031
|
|
|
1020
|
-
attemptDiscreteHydration(fiber: Fiber): void;
|
|
1021
|
-
|
|
1022
1032
|
attemptContinuousHydration(fiber: Fiber): void;
|
|
1023
1033
|
|
|
1024
1034
|
attemptHydrationAtCurrentPriority(fiber: Fiber): void;
|
|
1025
1035
|
|
|
1026
|
-
getCurrentUpdatePriority(): LanePriority;
|
|
1027
|
-
|
|
1028
|
-
runWithPriority<T>(priority: LanePriority, fn: () => T): T;
|
|
1029
|
-
|
|
1030
1036
|
findHostInstance(component: any): PublicInstance | null;
|
|
1031
1037
|
|
|
1032
1038
|
findHostInstanceWithWarning(component: any, methodName: string): PublicInstance | null;
|
|
@@ -1039,6 +1045,17 @@ declare namespace ReactReconciler {
|
|
|
1039
1045
|
|
|
1040
1046
|
injectIntoDevTools(devToolsConfig: DevToolsConfig<Instance, TextInstance, any>): boolean;
|
|
1041
1047
|
}
|
|
1048
|
+
|
|
1049
|
+
function defaultOnUncaughtError(error: Error): void;
|
|
1050
|
+
function defaultOnCaughtError(error: Error): void;
|
|
1051
|
+
function defaultOnRecoverableError(error: Error): void;
|
|
1052
|
+
|
|
1053
|
+
function startHostTransition(
|
|
1054
|
+
formFiber: Fiber,
|
|
1055
|
+
pendingState: unknown,
|
|
1056
|
+
action: ((formData: FormData) => void) | null,
|
|
1057
|
+
formData: FormData,
|
|
1058
|
+
): void;
|
|
1042
1059
|
}
|
|
1043
1060
|
|
|
1044
1061
|
export = ReactReconciler;
|