@react-three/fiber 9.0.0-alpha.5 → 9.0.0-alpha.7
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/core/reconciler.d.ts +4 -1
- package/dist/declarations/src/core/renderer.d.ts +1 -1
- package/dist/declarations/src/core/utils.d.ts +1 -1
- package/dist/declarations/src/three-types.d.ts +12 -0
- package/dist/{loop-d73c6316.esm.js → loop-2db547cd.esm.js} +36 -26
- package/dist/{loop-1fad3b6f.cjs.prod.js → loop-2e09d861.cjs.prod.js} +36 -26
- package/dist/{loop-02cefb27.cjs.dev.js → loop-4ac96174.cjs.dev.js} +36 -26
- package/dist/react-three-fiber.cjs.dev.js +36 -25
- package/dist/react-three-fiber.cjs.prod.js +36 -25
- package/dist/react-three-fiber.esm.js +37 -26
- package/native/dist/react-three-fiber-native.cjs.dev.js +29 -19
- package/native/dist/react-three-fiber-native.cjs.prod.js +29 -19
- package/native/dist/react-three-fiber-native.esm.js +30 -20
- package/package.json +3 -3
- package/readme.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 8.16.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 03ab82fe: fix(applyProps): null check indeterminate instances
|
|
8
|
+
|
|
9
|
+
## 8.16.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- cb913e01: fix: use fast JSX, future JSX types
|
|
14
|
+
|
|
15
|
+
## 8.16.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 1270d24c: fix: missing dependency on inject function
|
|
20
|
+
|
|
3
21
|
## 8.16.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -4,6 +4,9 @@ import Reconciler from 'react-reconciler';
|
|
|
4
4
|
import type { RootStore } from "./store.js";
|
|
5
5
|
import { type EventHandlers } from "./events.js";
|
|
6
6
|
import type { ThreeElement } from "../three-types.js";
|
|
7
|
+
declare module 'react-reconciler/constants' {
|
|
8
|
+
const NoEventPriority = 0;
|
|
9
|
+
}
|
|
7
10
|
export interface Root {
|
|
8
11
|
fiber: Reconciler.FiberRoot;
|
|
9
12
|
store: RootStore;
|
|
@@ -39,5 +42,5 @@ export interface Instance<O = any> {
|
|
|
39
42
|
autoRemovedBeforeAppend?: boolean;
|
|
40
43
|
}
|
|
41
44
|
export declare const catalogue: Catalogue;
|
|
42
|
-
export declare const extend: <T extends
|
|
45
|
+
export declare const extend: <T extends ConstructorRepresentation<any> | Catalogue>(objects: T) => T extends ConstructorRepresentation<any> ? React.ExoticComponent<import("../three-types.js").Mutable<import("../three-types.js").Overwrite<Partial<import("../three-types.js").Overwrite<import("../three-types.js").WithMathProps<InstanceType<T>>, import("../three-types.js").ReactProps<InstanceType<T>> & import("../three-types.js").EventProps<InstanceType<T>>>>, Omit<InstanceProps<InstanceType<T>, T>, "object">>>> : void;
|
|
43
46
|
export declare const reconciler: Reconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, any>;
|
|
@@ -80,5 +80,5 @@ export type InjectState = Partial<Omit<RootState, 'events'> & {
|
|
|
80
80
|
connected?: any;
|
|
81
81
|
};
|
|
82
82
|
}>;
|
|
83
|
-
export declare function createPortal(children: React.ReactNode, container: THREE.Object3D, state?: InjectState): JSX.Element;
|
|
83
|
+
export declare function createPortal(children: React.ReactNode, container: THREE.Object3D, state?: InjectState): React.JSX.Element;
|
|
84
84
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function findInitialRoot<T>(instance: Instance<T>): RootStore;
|
|
|
10
10
|
/**
|
|
11
11
|
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
12
12
|
*/
|
|
13
|
-
export declare const hasColorSpace: <T extends object |
|
|
13
|
+
export declare const hasColorSpace: <T extends object | THREE.Texture | Renderer, P = T extends Renderer ? {
|
|
14
14
|
outputColorSpace: string;
|
|
15
15
|
} : {
|
|
16
16
|
colorSpace: string;
|
|
@@ -53,4 +53,16 @@ declare module 'react' {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
declare module 'react/jsx-runtime' {
|
|
57
|
+
namespace JSX {
|
|
58
|
+
interface IntrinsicElements extends ThreeElements {
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
declare module 'react/jsx-dev-runtime' {
|
|
63
|
+
namespace JSX {
|
|
64
|
+
interface IntrinsicElements extends ThreeElements {
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
56
68
|
export {};
|
|
@@ -3,15 +3,17 @@ import * as React from 'react';
|
|
|
3
3
|
import { NoEventPriority, DefaultEventPriority, ContinuousEventPriority, DiscreteEventPriority, ConcurrentRoot } from 'react-reconciler/constants';
|
|
4
4
|
import { createWithEqualityFn } from 'zustand/traditional';
|
|
5
5
|
import { useFiber, useContextBridge, traverseFiber } from 'its-fine';
|
|
6
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
7
6
|
import Reconciler from 'react-reconciler';
|
|
8
7
|
import { unstable_scheduleCallback, unstable_IdlePriority } from 'scheduler';
|
|
8
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { suspend, preload, clear } from 'suspend-react';
|
|
10
10
|
|
|
11
11
|
var threeTypes = /*#__PURE__*/Object.freeze({
|
|
12
12
|
__proto__: null
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
+
const createReconciler = Reconciler;
|
|
16
|
+
|
|
15
17
|
// TODO: handle constructor overloads
|
|
16
18
|
// https://github.com/pmndrs/react-three-fiber/pull/2931
|
|
17
19
|
// https://github.com/microsoft/TypeScript/issues/37079
|
|
@@ -26,9 +28,10 @@ const extend = objects => {
|
|
|
26
28
|
// Returns a component whose name will be inferred in devtools
|
|
27
29
|
// @ts-expect-error
|
|
28
30
|
return /*#__PURE__*/React.forwardRef({
|
|
29
|
-
[objects.name]: (props, ref) => /*#__PURE__*/
|
|
31
|
+
[objects.name]: (props, ref) => /*#__PURE__*/jsx(Component, {
|
|
32
|
+
...props,
|
|
30
33
|
ref: ref
|
|
31
|
-
})
|
|
34
|
+
})
|
|
32
35
|
}[objects.name]);
|
|
33
36
|
} else {
|
|
34
37
|
return void Object.assign(catalogue, objects);
|
|
@@ -269,7 +272,7 @@ function switchInstance(oldInstance, type, props, fiber) {
|
|
|
269
272
|
const handleTextInstance = () => console.warn('R3F: Text is not allowed in JSX! This could be stray whitespace or characters.');
|
|
270
273
|
const NO_CONTEXT = {};
|
|
271
274
|
let currentUpdatePriority = NoEventPriority;
|
|
272
|
-
const reconciler =
|
|
275
|
+
const reconciler = createReconciler({
|
|
273
276
|
isPrimaryRenderer: false,
|
|
274
277
|
warnsIfNotActing: false,
|
|
275
278
|
supportsMutation: true,
|
|
@@ -299,7 +302,6 @@ const reconciler = Reconciler({
|
|
|
299
302
|
},
|
|
300
303
|
getRootHostContext: () => NO_CONTEXT,
|
|
301
304
|
getChildHostContext: () => NO_CONTEXT,
|
|
302
|
-
// @ts-expect-error prepareUpdate and updatePayload removed with React 19
|
|
303
305
|
commitUpdate(instance, type, oldProps, newProps, fiber) {
|
|
304
306
|
var _newProps$args, _oldProps$args, _newProps$args2;
|
|
305
307
|
let reconstruct = false;
|
|
@@ -346,8 +348,8 @@ const reconciler = Reconciler({
|
|
|
346
348
|
beforeActiveInstanceBlur() {},
|
|
347
349
|
afterActiveInstanceBlur() {},
|
|
348
350
|
detachDeletedInstance() {},
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
prepareScopeUpdate() {},
|
|
352
|
+
getInstanceFromScope: () => null,
|
|
351
353
|
shouldAttemptEagerTransition() {
|
|
352
354
|
return false;
|
|
353
355
|
},
|
|
@@ -391,7 +393,8 @@ const reconciler = Reconciler({
|
|
|
391
393
|
default:
|
|
392
394
|
return DefaultEventPriority;
|
|
393
395
|
}
|
|
394
|
-
}
|
|
396
|
+
},
|
|
397
|
+
resetFormInstance() {}
|
|
395
398
|
});
|
|
396
399
|
|
|
397
400
|
var _window$document, _window$navigator;
|
|
@@ -448,7 +451,11 @@ function useBridge() {
|
|
|
448
451
|
}) => {
|
|
449
452
|
const strict = !!traverseFiber(fiber, true, node => node.type === React.StrictMode);
|
|
450
453
|
const Root = strict ? React.StrictMode : React.Fragment;
|
|
451
|
-
return /*#__PURE__*/
|
|
454
|
+
return /*#__PURE__*/jsx(Root, {
|
|
455
|
+
children: /*#__PURE__*/jsx(ContextBridge, {
|
|
456
|
+
children: children
|
|
457
|
+
})
|
|
458
|
+
});
|
|
452
459
|
}, [fiber, ContextBridge]);
|
|
453
460
|
}
|
|
454
461
|
function Block({
|
|
@@ -1789,9 +1796,6 @@ useLoader.clear = function (loader, input) {
|
|
|
1789
1796
|
return clear([loader, ...keys]);
|
|
1790
1797
|
};
|
|
1791
1798
|
|
|
1792
|
-
// Shim for OffscreenCanvas since it was removed from DOM types
|
|
1793
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/54988
|
|
1794
|
-
|
|
1795
1799
|
const _roots = new Map();
|
|
1796
1800
|
const shallowLoose = {
|
|
1797
1801
|
objects: 'shallow',
|
|
@@ -1984,9 +1988,11 @@ function createRoot(canvas) {
|
|
|
1984
1988
|
applyProps(camera, cameraOptions);
|
|
1985
1989
|
// Preserve user-defined frustum if possible
|
|
1986
1990
|
// https://github.com/pmndrs/react-three-fiber/issues/3160
|
|
1987
|
-
if (
|
|
1988
|
-
|
|
1989
|
-
|
|
1991
|
+
if (!camera.manual) {
|
|
1992
|
+
if ('aspect' in cameraOptions || 'left' in cameraOptions || 'right' in cameraOptions || 'bottom' in cameraOptions || 'top' in cameraOptions) {
|
|
1993
|
+
camera.manual = true;
|
|
1994
|
+
camera.updateProjectionMatrix();
|
|
1995
|
+
}
|
|
1990
1996
|
}
|
|
1991
1997
|
}
|
|
1992
1998
|
// Always look at center by default
|
|
@@ -2143,7 +2149,7 @@ function createRoot(canvas) {
|
|
|
2143
2149
|
render(children) {
|
|
2144
2150
|
// The root has to be configured before it can be rendered
|
|
2145
2151
|
if (!configured) this.configure();
|
|
2146
|
-
reconciler.updateContainer( /*#__PURE__*/
|
|
2152
|
+
reconciler.updateContainer( /*#__PURE__*/jsx(Provider, {
|
|
2147
2153
|
store: store,
|
|
2148
2154
|
children: children,
|
|
2149
2155
|
onCreated: onCreated,
|
|
@@ -2184,9 +2190,10 @@ function Provider({
|
|
|
2184
2190
|
if (!store.getState().events.connected) state.events.connect == null ? void 0 : state.events.connect(rootElement);
|
|
2185
2191
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2186
2192
|
}, []);
|
|
2187
|
-
return /*#__PURE__*/
|
|
2188
|
-
value: store
|
|
2189
|
-
|
|
2193
|
+
return /*#__PURE__*/jsx(context.Provider, {
|
|
2194
|
+
value: store,
|
|
2195
|
+
children: children
|
|
2196
|
+
});
|
|
2190
2197
|
}
|
|
2191
2198
|
function unmountComponentAtNode(canvas, callback) {
|
|
2192
2199
|
const root = _roots.get(canvas);
|
|
@@ -2215,7 +2222,7 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
2215
2222
|
}
|
|
2216
2223
|
}
|
|
2217
2224
|
function createPortal(children, container, state) {
|
|
2218
|
-
return /*#__PURE__*/
|
|
2225
|
+
return /*#__PURE__*/jsx(Portal, {
|
|
2219
2226
|
children: children,
|
|
2220
2227
|
container: container,
|
|
2221
2228
|
state: state
|
|
@@ -2240,7 +2247,7 @@ function Portal({
|
|
|
2240
2247
|
const [raycaster] = React.useState(() => new THREE.Raycaster());
|
|
2241
2248
|
const [pointer] = React.useState(() => new THREE.Vector2());
|
|
2242
2249
|
const inject = useMutableCallback((rootState, injectState) => {
|
|
2243
|
-
let viewport;
|
|
2250
|
+
let viewport = undefined;
|
|
2244
2251
|
if (injectState.camera && size) {
|
|
2245
2252
|
const camera = injectState.camera;
|
|
2246
2253
|
// Calculate the override viewport, if present
|
|
@@ -2251,8 +2258,7 @@ function Portal({
|
|
|
2251
2258
|
return {
|
|
2252
2259
|
// The intersect consists of the previous root state
|
|
2253
2260
|
...rootState,
|
|
2254
|
-
|
|
2255
|
-
set: injectState.set,
|
|
2261
|
+
...injectState,
|
|
2256
2262
|
// Portals have their own scene, which forms the root, a raycaster and a pointer
|
|
2257
2263
|
scene: container,
|
|
2258
2264
|
raycaster,
|
|
@@ -2285,6 +2291,7 @@ function Portal({
|
|
|
2285
2291
|
};
|
|
2286
2292
|
});
|
|
2287
2293
|
const usePortalStore = React.useMemo(() => {
|
|
2294
|
+
// Create a mirrored store, based on the previous root with a few overrides ...
|
|
2288
2295
|
const store = createWithEqualityFn((set, get) => ({
|
|
2289
2296
|
...rest,
|
|
2290
2297
|
set,
|
|
@@ -2298,9 +2305,12 @@ function Portal({
|
|
|
2298
2305
|
return store;
|
|
2299
2306
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2300
2307
|
}, [previousRoot, container]);
|
|
2301
|
-
return /*#__PURE__*/
|
|
2302
|
-
|
|
2303
|
-
|
|
2308
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
2309
|
+
children: reconciler.createPortal( /*#__PURE__*/jsx(context.Provider, {
|
|
2310
|
+
value: usePortalStore,
|
|
2311
|
+
children: children
|
|
2312
|
+
}), usePortalStore, null)
|
|
2313
|
+
});
|
|
2304
2314
|
}
|
|
2305
2315
|
reconciler.injectIntoDevTools({
|
|
2306
2316
|
bundleType: process.env.NODE_ENV === 'production' ? 0 : 1,
|
|
@@ -5,9 +5,9 @@ var React = require('react');
|
|
|
5
5
|
var constants = require('react-reconciler/constants');
|
|
6
6
|
var traditional = require('zustand/traditional');
|
|
7
7
|
var itsFine = require('its-fine');
|
|
8
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
9
8
|
var Reconciler = require('react-reconciler');
|
|
10
9
|
var scheduler = require('scheduler');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
var suspendReact = require('suspend-react');
|
|
12
12
|
|
|
13
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -38,6 +38,8 @@ var threeTypes = /*#__PURE__*/Object.freeze({
|
|
|
38
38
|
__proto__: null
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
const createReconciler = Reconciler__default["default"];
|
|
42
|
+
|
|
41
43
|
// TODO: handle constructor overloads
|
|
42
44
|
// https://github.com/pmndrs/react-three-fiber/pull/2931
|
|
43
45
|
// https://github.com/microsoft/TypeScript/issues/37079
|
|
@@ -52,9 +54,10 @@ const extend = objects => {
|
|
|
52
54
|
// Returns a component whose name will be inferred in devtools
|
|
53
55
|
// @ts-expect-error
|
|
54
56
|
return /*#__PURE__*/React__namespace.forwardRef({
|
|
55
|
-
[objects.name]: (props, ref) => /*#__PURE__*/
|
|
57
|
+
[objects.name]: (props, ref) => /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
58
|
+
...props,
|
|
56
59
|
ref: ref
|
|
57
|
-
})
|
|
60
|
+
})
|
|
58
61
|
}[objects.name]);
|
|
59
62
|
} else {
|
|
60
63
|
return void Object.assign(catalogue, objects);
|
|
@@ -295,7 +298,7 @@ function switchInstance(oldInstance, type, props, fiber) {
|
|
|
295
298
|
const handleTextInstance = () => console.warn('R3F: Text is not allowed in JSX! This could be stray whitespace or characters.');
|
|
296
299
|
const NO_CONTEXT = {};
|
|
297
300
|
let currentUpdatePriority = constants.NoEventPriority;
|
|
298
|
-
const reconciler =
|
|
301
|
+
const reconciler = createReconciler({
|
|
299
302
|
isPrimaryRenderer: false,
|
|
300
303
|
warnsIfNotActing: false,
|
|
301
304
|
supportsMutation: true,
|
|
@@ -325,7 +328,6 @@ const reconciler = Reconciler__default["default"]({
|
|
|
325
328
|
},
|
|
326
329
|
getRootHostContext: () => NO_CONTEXT,
|
|
327
330
|
getChildHostContext: () => NO_CONTEXT,
|
|
328
|
-
// @ts-expect-error prepareUpdate and updatePayload removed with React 19
|
|
329
331
|
commitUpdate(instance, type, oldProps, newProps, fiber) {
|
|
330
332
|
var _newProps$args, _oldProps$args, _newProps$args2;
|
|
331
333
|
let reconstruct = false;
|
|
@@ -372,8 +374,8 @@ const reconciler = Reconciler__default["default"]({
|
|
|
372
374
|
beforeActiveInstanceBlur() {},
|
|
373
375
|
afterActiveInstanceBlur() {},
|
|
374
376
|
detachDeletedInstance() {},
|
|
375
|
-
|
|
376
|
-
|
|
377
|
+
prepareScopeUpdate() {},
|
|
378
|
+
getInstanceFromScope: () => null,
|
|
377
379
|
shouldAttemptEagerTransition() {
|
|
378
380
|
return false;
|
|
379
381
|
},
|
|
@@ -417,7 +419,8 @@ const reconciler = Reconciler__default["default"]({
|
|
|
417
419
|
default:
|
|
418
420
|
return constants.DefaultEventPriority;
|
|
419
421
|
}
|
|
420
|
-
}
|
|
422
|
+
},
|
|
423
|
+
resetFormInstance() {}
|
|
421
424
|
});
|
|
422
425
|
|
|
423
426
|
var _window$document, _window$navigator;
|
|
@@ -474,7 +477,11 @@ function useBridge() {
|
|
|
474
477
|
}) => {
|
|
475
478
|
const strict = !!itsFine.traverseFiber(fiber, true, node => node.type === React__namespace.StrictMode);
|
|
476
479
|
const Root = strict ? React__namespace.StrictMode : React__namespace.Fragment;
|
|
477
|
-
return /*#__PURE__*/
|
|
480
|
+
return /*#__PURE__*/jsxRuntime.jsx(Root, {
|
|
481
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ContextBridge, {
|
|
482
|
+
children: children
|
|
483
|
+
})
|
|
484
|
+
});
|
|
478
485
|
}, [fiber, ContextBridge]);
|
|
479
486
|
}
|
|
480
487
|
function Block({
|
|
@@ -1815,9 +1822,6 @@ useLoader.clear = function (loader, input) {
|
|
|
1815
1822
|
return suspendReact.clear([loader, ...keys]);
|
|
1816
1823
|
};
|
|
1817
1824
|
|
|
1818
|
-
// Shim for OffscreenCanvas since it was removed from DOM types
|
|
1819
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/54988
|
|
1820
|
-
|
|
1821
1825
|
const _roots = new Map();
|
|
1822
1826
|
const shallowLoose = {
|
|
1823
1827
|
objects: 'shallow',
|
|
@@ -2010,9 +2014,11 @@ function createRoot(canvas) {
|
|
|
2010
2014
|
applyProps(camera, cameraOptions);
|
|
2011
2015
|
// Preserve user-defined frustum if possible
|
|
2012
2016
|
// https://github.com/pmndrs/react-three-fiber/issues/3160
|
|
2013
|
-
if (
|
|
2014
|
-
|
|
2015
|
-
|
|
2017
|
+
if (!camera.manual) {
|
|
2018
|
+
if ('aspect' in cameraOptions || 'left' in cameraOptions || 'right' in cameraOptions || 'bottom' in cameraOptions || 'top' in cameraOptions) {
|
|
2019
|
+
camera.manual = true;
|
|
2020
|
+
camera.updateProjectionMatrix();
|
|
2021
|
+
}
|
|
2016
2022
|
}
|
|
2017
2023
|
}
|
|
2018
2024
|
// Always look at center by default
|
|
@@ -2169,7 +2175,7 @@ function createRoot(canvas) {
|
|
|
2169
2175
|
render(children) {
|
|
2170
2176
|
// The root has to be configured before it can be rendered
|
|
2171
2177
|
if (!configured) this.configure();
|
|
2172
|
-
reconciler.updateContainer( /*#__PURE__*/
|
|
2178
|
+
reconciler.updateContainer( /*#__PURE__*/jsxRuntime.jsx(Provider, {
|
|
2173
2179
|
store: store,
|
|
2174
2180
|
children: children,
|
|
2175
2181
|
onCreated: onCreated,
|
|
@@ -2210,9 +2216,10 @@ function Provider({
|
|
|
2210
2216
|
if (!store.getState().events.connected) state.events.connect == null ? void 0 : state.events.connect(rootElement);
|
|
2211
2217
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2212
2218
|
}, []);
|
|
2213
|
-
return /*#__PURE__*/
|
|
2214
|
-
value: store
|
|
2215
|
-
|
|
2219
|
+
return /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
|
|
2220
|
+
value: store,
|
|
2221
|
+
children: children
|
|
2222
|
+
});
|
|
2216
2223
|
}
|
|
2217
2224
|
function unmountComponentAtNode(canvas, callback) {
|
|
2218
2225
|
const root = _roots.get(canvas);
|
|
@@ -2241,7 +2248,7 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
2241
2248
|
}
|
|
2242
2249
|
}
|
|
2243
2250
|
function createPortal(children, container, state) {
|
|
2244
|
-
return /*#__PURE__*/
|
|
2251
|
+
return /*#__PURE__*/jsxRuntime.jsx(Portal, {
|
|
2245
2252
|
children: children,
|
|
2246
2253
|
container: container,
|
|
2247
2254
|
state: state
|
|
@@ -2266,7 +2273,7 @@ function Portal({
|
|
|
2266
2273
|
const [raycaster] = React__namespace.useState(() => new THREE__namespace.Raycaster());
|
|
2267
2274
|
const [pointer] = React__namespace.useState(() => new THREE__namespace.Vector2());
|
|
2268
2275
|
const inject = useMutableCallback((rootState, injectState) => {
|
|
2269
|
-
let viewport;
|
|
2276
|
+
let viewport = undefined;
|
|
2270
2277
|
if (injectState.camera && size) {
|
|
2271
2278
|
const camera = injectState.camera;
|
|
2272
2279
|
// Calculate the override viewport, if present
|
|
@@ -2277,8 +2284,7 @@ function Portal({
|
|
|
2277
2284
|
return {
|
|
2278
2285
|
// The intersect consists of the previous root state
|
|
2279
2286
|
...rootState,
|
|
2280
|
-
|
|
2281
|
-
set: injectState.set,
|
|
2287
|
+
...injectState,
|
|
2282
2288
|
// Portals have their own scene, which forms the root, a raycaster and a pointer
|
|
2283
2289
|
scene: container,
|
|
2284
2290
|
raycaster,
|
|
@@ -2311,6 +2317,7 @@ function Portal({
|
|
|
2311
2317
|
};
|
|
2312
2318
|
});
|
|
2313
2319
|
const usePortalStore = React__namespace.useMemo(() => {
|
|
2320
|
+
// Create a mirrored store, based on the previous root with a few overrides ...
|
|
2314
2321
|
const store = traditional.createWithEqualityFn((set, get) => ({
|
|
2315
2322
|
...rest,
|
|
2316
2323
|
set,
|
|
@@ -2324,9 +2331,12 @@ function Portal({
|
|
|
2324
2331
|
return store;
|
|
2325
2332
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2326
2333
|
}, [previousRoot, container]);
|
|
2327
|
-
return /*#__PURE__*/
|
|
2328
|
-
|
|
2329
|
-
|
|
2334
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2335
|
+
children: reconciler.createPortal( /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
|
|
2336
|
+
value: usePortalStore,
|
|
2337
|
+
children: children
|
|
2338
|
+
}), usePortalStore, null)
|
|
2339
|
+
});
|
|
2330
2340
|
}
|
|
2331
2341
|
reconciler.injectIntoDevTools({
|
|
2332
2342
|
bundleType: 0 ,
|
|
@@ -5,9 +5,9 @@ var React = require('react');
|
|
|
5
5
|
var constants = require('react-reconciler/constants');
|
|
6
6
|
var traditional = require('zustand/traditional');
|
|
7
7
|
var itsFine = require('its-fine');
|
|
8
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
9
8
|
var Reconciler = require('react-reconciler');
|
|
10
9
|
var scheduler = require('scheduler');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
var suspendReact = require('suspend-react');
|
|
12
12
|
|
|
13
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -38,6 +38,8 @@ var threeTypes = /*#__PURE__*/Object.freeze({
|
|
|
38
38
|
__proto__: null
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
const createReconciler = Reconciler__default["default"];
|
|
42
|
+
|
|
41
43
|
// TODO: handle constructor overloads
|
|
42
44
|
// https://github.com/pmndrs/react-three-fiber/pull/2931
|
|
43
45
|
// https://github.com/microsoft/TypeScript/issues/37079
|
|
@@ -52,9 +54,10 @@ const extend = objects => {
|
|
|
52
54
|
// Returns a component whose name will be inferred in devtools
|
|
53
55
|
// @ts-expect-error
|
|
54
56
|
return /*#__PURE__*/React__namespace.forwardRef({
|
|
55
|
-
[objects.name]: (props, ref) => /*#__PURE__*/
|
|
57
|
+
[objects.name]: (props, ref) => /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
58
|
+
...props,
|
|
56
59
|
ref: ref
|
|
57
|
-
})
|
|
60
|
+
})
|
|
58
61
|
}[objects.name]);
|
|
59
62
|
} else {
|
|
60
63
|
return void Object.assign(catalogue, objects);
|
|
@@ -295,7 +298,7 @@ function switchInstance(oldInstance, type, props, fiber) {
|
|
|
295
298
|
const handleTextInstance = () => console.warn('R3F: Text is not allowed in JSX! This could be stray whitespace or characters.');
|
|
296
299
|
const NO_CONTEXT = {};
|
|
297
300
|
let currentUpdatePriority = constants.NoEventPriority;
|
|
298
|
-
const reconciler =
|
|
301
|
+
const reconciler = createReconciler({
|
|
299
302
|
isPrimaryRenderer: false,
|
|
300
303
|
warnsIfNotActing: false,
|
|
301
304
|
supportsMutation: true,
|
|
@@ -325,7 +328,6 @@ const reconciler = Reconciler__default["default"]({
|
|
|
325
328
|
},
|
|
326
329
|
getRootHostContext: () => NO_CONTEXT,
|
|
327
330
|
getChildHostContext: () => NO_CONTEXT,
|
|
328
|
-
// @ts-expect-error prepareUpdate and updatePayload removed with React 19
|
|
329
331
|
commitUpdate(instance, type, oldProps, newProps, fiber) {
|
|
330
332
|
var _newProps$args, _oldProps$args, _newProps$args2;
|
|
331
333
|
let reconstruct = false;
|
|
@@ -372,8 +374,8 @@ const reconciler = Reconciler__default["default"]({
|
|
|
372
374
|
beforeActiveInstanceBlur() {},
|
|
373
375
|
afterActiveInstanceBlur() {},
|
|
374
376
|
detachDeletedInstance() {},
|
|
375
|
-
|
|
376
|
-
|
|
377
|
+
prepareScopeUpdate() {},
|
|
378
|
+
getInstanceFromScope: () => null,
|
|
377
379
|
shouldAttemptEagerTransition() {
|
|
378
380
|
return false;
|
|
379
381
|
},
|
|
@@ -417,7 +419,8 @@ const reconciler = Reconciler__default["default"]({
|
|
|
417
419
|
default:
|
|
418
420
|
return constants.DefaultEventPriority;
|
|
419
421
|
}
|
|
420
|
-
}
|
|
422
|
+
},
|
|
423
|
+
resetFormInstance() {}
|
|
421
424
|
});
|
|
422
425
|
|
|
423
426
|
var _window$document, _window$navigator;
|
|
@@ -474,7 +477,11 @@ function useBridge() {
|
|
|
474
477
|
}) => {
|
|
475
478
|
const strict = !!itsFine.traverseFiber(fiber, true, node => node.type === React__namespace.StrictMode);
|
|
476
479
|
const Root = strict ? React__namespace.StrictMode : React__namespace.Fragment;
|
|
477
|
-
return /*#__PURE__*/
|
|
480
|
+
return /*#__PURE__*/jsxRuntime.jsx(Root, {
|
|
481
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ContextBridge, {
|
|
482
|
+
children: children
|
|
483
|
+
})
|
|
484
|
+
});
|
|
478
485
|
}, [fiber, ContextBridge]);
|
|
479
486
|
}
|
|
480
487
|
function Block({
|
|
@@ -1815,9 +1822,6 @@ useLoader.clear = function (loader, input) {
|
|
|
1815
1822
|
return suspendReact.clear([loader, ...keys]);
|
|
1816
1823
|
};
|
|
1817
1824
|
|
|
1818
|
-
// Shim for OffscreenCanvas since it was removed from DOM types
|
|
1819
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/54988
|
|
1820
|
-
|
|
1821
1825
|
const _roots = new Map();
|
|
1822
1826
|
const shallowLoose = {
|
|
1823
1827
|
objects: 'shallow',
|
|
@@ -2010,9 +2014,11 @@ function createRoot(canvas) {
|
|
|
2010
2014
|
applyProps(camera, cameraOptions);
|
|
2011
2015
|
// Preserve user-defined frustum if possible
|
|
2012
2016
|
// https://github.com/pmndrs/react-three-fiber/issues/3160
|
|
2013
|
-
if (
|
|
2014
|
-
|
|
2015
|
-
|
|
2017
|
+
if (!camera.manual) {
|
|
2018
|
+
if ('aspect' in cameraOptions || 'left' in cameraOptions || 'right' in cameraOptions || 'bottom' in cameraOptions || 'top' in cameraOptions) {
|
|
2019
|
+
camera.manual = true;
|
|
2020
|
+
camera.updateProjectionMatrix();
|
|
2021
|
+
}
|
|
2016
2022
|
}
|
|
2017
2023
|
}
|
|
2018
2024
|
// Always look at center by default
|
|
@@ -2169,7 +2175,7 @@ function createRoot(canvas) {
|
|
|
2169
2175
|
render(children) {
|
|
2170
2176
|
// The root has to be configured before it can be rendered
|
|
2171
2177
|
if (!configured) this.configure();
|
|
2172
|
-
reconciler.updateContainer( /*#__PURE__*/
|
|
2178
|
+
reconciler.updateContainer( /*#__PURE__*/jsxRuntime.jsx(Provider, {
|
|
2173
2179
|
store: store,
|
|
2174
2180
|
children: children,
|
|
2175
2181
|
onCreated: onCreated,
|
|
@@ -2210,9 +2216,10 @@ function Provider({
|
|
|
2210
2216
|
if (!store.getState().events.connected) state.events.connect == null ? void 0 : state.events.connect(rootElement);
|
|
2211
2217
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2212
2218
|
}, []);
|
|
2213
|
-
return /*#__PURE__*/
|
|
2214
|
-
value: store
|
|
2215
|
-
|
|
2219
|
+
return /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
|
|
2220
|
+
value: store,
|
|
2221
|
+
children: children
|
|
2222
|
+
});
|
|
2216
2223
|
}
|
|
2217
2224
|
function unmountComponentAtNode(canvas, callback) {
|
|
2218
2225
|
const root = _roots.get(canvas);
|
|
@@ -2241,7 +2248,7 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
2241
2248
|
}
|
|
2242
2249
|
}
|
|
2243
2250
|
function createPortal(children, container, state) {
|
|
2244
|
-
return /*#__PURE__*/
|
|
2251
|
+
return /*#__PURE__*/jsxRuntime.jsx(Portal, {
|
|
2245
2252
|
children: children,
|
|
2246
2253
|
container: container,
|
|
2247
2254
|
state: state
|
|
@@ -2266,7 +2273,7 @@ function Portal({
|
|
|
2266
2273
|
const [raycaster] = React__namespace.useState(() => new THREE__namespace.Raycaster());
|
|
2267
2274
|
const [pointer] = React__namespace.useState(() => new THREE__namespace.Vector2());
|
|
2268
2275
|
const inject = useMutableCallback((rootState, injectState) => {
|
|
2269
|
-
let viewport;
|
|
2276
|
+
let viewport = undefined;
|
|
2270
2277
|
if (injectState.camera && size) {
|
|
2271
2278
|
const camera = injectState.camera;
|
|
2272
2279
|
// Calculate the override viewport, if present
|
|
@@ -2277,8 +2284,7 @@ function Portal({
|
|
|
2277
2284
|
return {
|
|
2278
2285
|
// The intersect consists of the previous root state
|
|
2279
2286
|
...rootState,
|
|
2280
|
-
|
|
2281
|
-
set: injectState.set,
|
|
2287
|
+
...injectState,
|
|
2282
2288
|
// Portals have their own scene, which forms the root, a raycaster and a pointer
|
|
2283
2289
|
scene: container,
|
|
2284
2290
|
raycaster,
|
|
@@ -2311,6 +2317,7 @@ function Portal({
|
|
|
2311
2317
|
};
|
|
2312
2318
|
});
|
|
2313
2319
|
const usePortalStore = React__namespace.useMemo(() => {
|
|
2320
|
+
// Create a mirrored store, based on the previous root with a few overrides ...
|
|
2314
2321
|
const store = traditional.createWithEqualityFn((set, get) => ({
|
|
2315
2322
|
...rest,
|
|
2316
2323
|
set,
|
|
@@ -2324,9 +2331,12 @@ function Portal({
|
|
|
2324
2331
|
return store;
|
|
2325
2332
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2326
2333
|
}, [previousRoot, container]);
|
|
2327
|
-
return /*#__PURE__*/
|
|
2328
|
-
|
|
2329
|
-
|
|
2334
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2335
|
+
children: reconciler.createPortal( /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
|
|
2336
|
+
value: usePortalStore,
|
|
2337
|
+
children: children
|
|
2338
|
+
}), usePortalStore, null)
|
|
2339
|
+
});
|
|
2330
2340
|
}
|
|
2331
2341
|
reconciler.injectIntoDevTools({
|
|
2332
2342
|
bundleType: process.env.NODE_ENV === 'production' ? 0 : 1,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var loop = require('./loop-
|
|
6
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
|
+
var loop = require('./loop-4ac96174.cjs.dev.js');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var THREE = require('three');
|
|
9
8
|
var useMeasure = require('react-use-measure');
|
|
10
9
|
var itsFine = require('its-fine');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
require('react-reconciler/constants');
|
|
12
12
|
require('zustand/traditional');
|
|
13
13
|
require('react-reconciler');
|
|
@@ -213,13 +213,17 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
213
213
|
onCreated == null ? void 0 : onCreated(state);
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
|
-
root.current.render( /*#__PURE__*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
216
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
217
|
+
children: /*#__PURE__*/jsxRuntime.jsx(loop.ErrorBoundary, {
|
|
218
|
+
set: setError,
|
|
219
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
220
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(loop.Block, {
|
|
221
|
+
set: setBlock
|
|
222
|
+
}),
|
|
223
|
+
children: children
|
|
224
|
+
})
|
|
221
225
|
})
|
|
222
|
-
}
|
|
226
|
+
}));
|
|
223
227
|
}
|
|
224
228
|
});
|
|
225
229
|
React__namespace.useEffect(() => {
|
|
@@ -230,7 +234,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
230
234
|
// When the event source is not this div, we need to set pointer-events to none
|
|
231
235
|
// Or else the canvas will block events from reaching the event source
|
|
232
236
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
233
|
-
return /*#__PURE__*/
|
|
237
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
234
238
|
ref: divRef,
|
|
235
239
|
style: {
|
|
236
240
|
position: 'relative',
|
|
@@ -239,19 +243,23 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
239
243
|
overflow: 'hidden',
|
|
240
244
|
pointerEvents,
|
|
241
245
|
...style
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
246
|
+
},
|
|
247
|
+
...props,
|
|
248
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
249
|
+
ref: containerRef,
|
|
250
|
+
style: {
|
|
251
|
+
width: '100%',
|
|
252
|
+
height: '100%'
|
|
253
|
+
},
|
|
254
|
+
children: /*#__PURE__*/jsxRuntime.jsx("canvas", {
|
|
255
|
+
ref: canvasRef,
|
|
256
|
+
style: {
|
|
257
|
+
display: 'block'
|
|
258
|
+
},
|
|
259
|
+
children: fallback
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
});
|
|
255
263
|
});
|
|
256
264
|
|
|
257
265
|
/**
|
|
@@ -259,9 +267,12 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
259
267
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
260
268
|
*/
|
|
261
269
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
262
|
-
return /*#__PURE__*/
|
|
263
|
-
|
|
264
|
-
|
|
270
|
+
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
271
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
272
|
+
...props,
|
|
273
|
+
ref: ref
|
|
274
|
+
})
|
|
275
|
+
});
|
|
265
276
|
});
|
|
266
277
|
|
|
267
278
|
exports.FixedStage = loop.FixedStage;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var loop = require('./loop-
|
|
6
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
|
+
var loop = require('./loop-2e09d861.cjs.prod.js');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var THREE = require('three');
|
|
9
8
|
var useMeasure = require('react-use-measure');
|
|
10
9
|
var itsFine = require('its-fine');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
require('react-reconciler/constants');
|
|
12
12
|
require('zustand/traditional');
|
|
13
13
|
require('react-reconciler');
|
|
@@ -213,13 +213,17 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
213
213
|
onCreated == null ? void 0 : onCreated(state);
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
|
-
root.current.render( /*#__PURE__*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
216
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
217
|
+
children: /*#__PURE__*/jsxRuntime.jsx(loop.ErrorBoundary, {
|
|
218
|
+
set: setError,
|
|
219
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
220
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(loop.Block, {
|
|
221
|
+
set: setBlock
|
|
222
|
+
}),
|
|
223
|
+
children: children
|
|
224
|
+
})
|
|
221
225
|
})
|
|
222
|
-
}
|
|
226
|
+
}));
|
|
223
227
|
}
|
|
224
228
|
});
|
|
225
229
|
React__namespace.useEffect(() => {
|
|
@@ -230,7 +234,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
230
234
|
// When the event source is not this div, we need to set pointer-events to none
|
|
231
235
|
// Or else the canvas will block events from reaching the event source
|
|
232
236
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
233
|
-
return /*#__PURE__*/
|
|
237
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
234
238
|
ref: divRef,
|
|
235
239
|
style: {
|
|
236
240
|
position: 'relative',
|
|
@@ -239,19 +243,23 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
239
243
|
overflow: 'hidden',
|
|
240
244
|
pointerEvents,
|
|
241
245
|
...style
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
246
|
+
},
|
|
247
|
+
...props,
|
|
248
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
249
|
+
ref: containerRef,
|
|
250
|
+
style: {
|
|
251
|
+
width: '100%',
|
|
252
|
+
height: '100%'
|
|
253
|
+
},
|
|
254
|
+
children: /*#__PURE__*/jsxRuntime.jsx("canvas", {
|
|
255
|
+
ref: canvasRef,
|
|
256
|
+
style: {
|
|
257
|
+
display: 'block'
|
|
258
|
+
},
|
|
259
|
+
children: fallback
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
});
|
|
255
263
|
});
|
|
256
264
|
|
|
257
265
|
/**
|
|
@@ -259,9 +267,12 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
259
267
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
260
268
|
*/
|
|
261
269
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
262
|
-
return /*#__PURE__*/
|
|
263
|
-
|
|
264
|
-
|
|
270
|
+
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
271
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
272
|
+
...props,
|
|
273
|
+
ref: ref
|
|
274
|
+
})
|
|
275
|
+
});
|
|
265
276
|
});
|
|
266
277
|
|
|
267
278
|
exports.FixedStage = loop.FixedStage;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useBridge, a as useMutableCallback, b as useIsomorphicLayoutEffect, d as createRoot, i as isRef, E as ErrorBoundary, B as Block, f as unmountComponentAtNode } from './loop-
|
|
2
|
-
export { F as FixedStage, t as ReactThreeFiber, S as Stage, p as Stages, _ as _roots, x as act, j as addAfterEffect, h as addEffect, k as addTail, m as advance, s as applyProps, y as buildGraph, q as context, c as createEvents, o as createPortal, d as createRoot, w as dispose, e as extend, g as flushGlobalEffects, v as getRootState, l as invalidate, r as reconciler, n as render, f as unmountComponentAtNode, D as useFrame, H as useGraph, z as useInstanceHandle, I as useLoader, A as useStore, C as useThree, G as useUpdate } from './loop-
|
|
3
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
1
|
+
import { c as createEvents, e as extend, u as useBridge, a as useMutableCallback, b as useIsomorphicLayoutEffect, d as createRoot, i as isRef, E as ErrorBoundary, B as Block, f as unmountComponentAtNode } from './loop-2db547cd.esm.js';
|
|
2
|
+
export { F as FixedStage, t as ReactThreeFiber, S as Stage, p as Stages, _ as _roots, x as act, j as addAfterEffect, h as addEffect, k as addTail, m as advance, s as applyProps, y as buildGraph, q as context, c as createEvents, o as createPortal, d as createRoot, w as dispose, e as extend, g as flushGlobalEffects, v as getRootState, l as invalidate, r as reconciler, n as render, f as unmountComponentAtNode, D as useFrame, H as useGraph, z as useInstanceHandle, I as useLoader, A as useStore, C as useThree, G as useUpdate } from './loop-2db547cd.esm.js';
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import * as THREE from 'three';
|
|
6
5
|
import useMeasure from 'react-use-measure';
|
|
7
6
|
import { FiberProvider } from 'its-fine';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
import 'react-reconciler/constants';
|
|
9
9
|
import 'zustand/traditional';
|
|
10
10
|
import 'react-reconciler';
|
|
@@ -186,13 +186,17 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
186
186
|
onCreated == null ? void 0 : onCreated(state);
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
|
-
root.current.render( /*#__PURE__*/
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
root.current.render( /*#__PURE__*/jsx(Bridge, {
|
|
190
|
+
children: /*#__PURE__*/jsx(ErrorBoundary, {
|
|
191
|
+
set: setError,
|
|
192
|
+
children: /*#__PURE__*/jsx(React.Suspense, {
|
|
193
|
+
fallback: /*#__PURE__*/jsx(Block, {
|
|
194
|
+
set: setBlock
|
|
195
|
+
}),
|
|
196
|
+
children: children
|
|
197
|
+
})
|
|
194
198
|
})
|
|
195
|
-
}
|
|
199
|
+
}));
|
|
196
200
|
}
|
|
197
201
|
});
|
|
198
202
|
React.useEffect(() => {
|
|
@@ -203,7 +207,7 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
203
207
|
// When the event source is not this div, we need to set pointer-events to none
|
|
204
208
|
// Or else the canvas will block events from reaching the event source
|
|
205
209
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
206
|
-
return /*#__PURE__*/
|
|
210
|
+
return /*#__PURE__*/jsx("div", {
|
|
207
211
|
ref: divRef,
|
|
208
212
|
style: {
|
|
209
213
|
position: 'relative',
|
|
@@ -212,19 +216,23 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
212
216
|
overflow: 'hidden',
|
|
213
217
|
pointerEvents,
|
|
214
218
|
...style
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
219
|
+
},
|
|
220
|
+
...props,
|
|
221
|
+
children: /*#__PURE__*/jsx("div", {
|
|
222
|
+
ref: containerRef,
|
|
223
|
+
style: {
|
|
224
|
+
width: '100%',
|
|
225
|
+
height: '100%'
|
|
226
|
+
},
|
|
227
|
+
children: /*#__PURE__*/jsx("canvas", {
|
|
228
|
+
ref: canvasRef,
|
|
229
|
+
style: {
|
|
230
|
+
display: 'block'
|
|
231
|
+
},
|
|
232
|
+
children: fallback
|
|
233
|
+
})
|
|
234
|
+
})
|
|
235
|
+
});
|
|
228
236
|
});
|
|
229
237
|
|
|
230
238
|
/**
|
|
@@ -232,9 +240,12 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
232
240
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
233
241
|
*/
|
|
234
242
|
const Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref) {
|
|
235
|
-
return /*#__PURE__*/
|
|
236
|
-
|
|
237
|
-
|
|
243
|
+
return /*#__PURE__*/jsx(FiberProvider, {
|
|
244
|
+
children: /*#__PURE__*/jsx(CanvasImpl, {
|
|
245
|
+
...props,
|
|
246
|
+
ref: ref
|
|
247
|
+
})
|
|
248
|
+
});
|
|
238
249
|
});
|
|
239
250
|
|
|
240
251
|
export { Canvas, createPointerEvents as events };
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var loop = require('../../dist/loop-
|
|
6
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
|
+
var loop = require('../../dist/loop-4ac96174.cjs.dev.js');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var THREE = require('three');
|
|
9
8
|
var reactNative = require('react-native');
|
|
10
9
|
var expoGl = require('expo-gl');
|
|
11
10
|
var itsFine = require('its-fine');
|
|
11
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
var expoAsset = require('expo-asset');
|
|
13
13
|
var fs = require('expo-file-system');
|
|
14
14
|
var base64Js = require('base64-js');
|
|
@@ -255,31 +255,38 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
255
255
|
return onCreated == null ? void 0 : onCreated(state);
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
root.current.render( /*#__PURE__*/
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
258
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
259
|
+
children: /*#__PURE__*/jsxRuntime.jsx(loop.ErrorBoundary, {
|
|
260
|
+
set: setError,
|
|
261
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
262
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(loop.Block, {
|
|
263
|
+
set: setBlock
|
|
264
|
+
}),
|
|
265
|
+
children: children
|
|
266
|
+
})
|
|
263
267
|
})
|
|
264
|
-
}
|
|
268
|
+
}));
|
|
265
269
|
}
|
|
266
270
|
React__namespace.useEffect(() => {
|
|
267
271
|
if (canvas) {
|
|
268
272
|
return () => loop.unmountComponentAtNode(canvas);
|
|
269
273
|
}
|
|
270
274
|
}, [canvas]);
|
|
271
|
-
return /*#__PURE__*/
|
|
275
|
+
return /*#__PURE__*/jsxRuntime.jsx(_View, {
|
|
276
|
+
...props,
|
|
272
277
|
ref: viewRef,
|
|
273
278
|
onLayout: onLayout,
|
|
274
279
|
style: {
|
|
275
280
|
flex: 1,
|
|
276
281
|
...style
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
282
|
+
},
|
|
283
|
+
...bind,
|
|
284
|
+
children: width > 0 && /*#__PURE__*/jsxRuntime.jsx(expoGl.GLView, {
|
|
285
|
+
msaaSamples: antialias ? 4 : 0,
|
|
286
|
+
onContextCreate: onContextCreate,
|
|
287
|
+
style: reactNative.StyleSheet.absoluteFill
|
|
288
|
+
})
|
|
289
|
+
});
|
|
283
290
|
});
|
|
284
291
|
|
|
285
292
|
/**
|
|
@@ -287,9 +294,12 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
287
294
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
288
295
|
*/
|
|
289
296
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
290
|
-
return /*#__PURE__*/
|
|
291
|
-
|
|
292
|
-
|
|
297
|
+
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
298
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
299
|
+
...props,
|
|
300
|
+
ref: ref
|
|
301
|
+
})
|
|
302
|
+
});
|
|
293
303
|
});
|
|
294
304
|
|
|
295
305
|
// http://stackoverflow.com/questions/105034
|
|
@@ -425,7 +435,7 @@ function polyfills() {
|
|
|
425
435
|
texture.needsUpdate = true;
|
|
426
436
|
|
|
427
437
|
// Force non-DOM upload for EXGL texImage2D
|
|
428
|
-
// @ts-
|
|
438
|
+
// @ts-expect-error
|
|
429
439
|
texture.isDataTexture = true;
|
|
430
440
|
onLoad == null ? void 0 : onLoad(texture);
|
|
431
441
|
}).catch(onError);
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var loop = require('../../dist/loop-
|
|
6
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
|
+
var loop = require('../../dist/loop-2e09d861.cjs.prod.js');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var THREE = require('three');
|
|
9
8
|
var reactNative = require('react-native');
|
|
10
9
|
var expoGl = require('expo-gl');
|
|
11
10
|
var itsFine = require('its-fine');
|
|
11
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
var expoAsset = require('expo-asset');
|
|
13
13
|
var fs = require('expo-file-system');
|
|
14
14
|
var base64Js = require('base64-js');
|
|
@@ -255,31 +255,38 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
255
255
|
return onCreated == null ? void 0 : onCreated(state);
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
root.current.render( /*#__PURE__*/
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
258
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
259
|
+
children: /*#__PURE__*/jsxRuntime.jsx(loop.ErrorBoundary, {
|
|
260
|
+
set: setError,
|
|
261
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
262
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(loop.Block, {
|
|
263
|
+
set: setBlock
|
|
264
|
+
}),
|
|
265
|
+
children: children
|
|
266
|
+
})
|
|
263
267
|
})
|
|
264
|
-
}
|
|
268
|
+
}));
|
|
265
269
|
}
|
|
266
270
|
React__namespace.useEffect(() => {
|
|
267
271
|
if (canvas) {
|
|
268
272
|
return () => loop.unmountComponentAtNode(canvas);
|
|
269
273
|
}
|
|
270
274
|
}, [canvas]);
|
|
271
|
-
return /*#__PURE__*/
|
|
275
|
+
return /*#__PURE__*/jsxRuntime.jsx(_View, {
|
|
276
|
+
...props,
|
|
272
277
|
ref: viewRef,
|
|
273
278
|
onLayout: onLayout,
|
|
274
279
|
style: {
|
|
275
280
|
flex: 1,
|
|
276
281
|
...style
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
282
|
+
},
|
|
283
|
+
...bind,
|
|
284
|
+
children: width > 0 && /*#__PURE__*/jsxRuntime.jsx(expoGl.GLView, {
|
|
285
|
+
msaaSamples: antialias ? 4 : 0,
|
|
286
|
+
onContextCreate: onContextCreate,
|
|
287
|
+
style: reactNative.StyleSheet.absoluteFill
|
|
288
|
+
})
|
|
289
|
+
});
|
|
283
290
|
});
|
|
284
291
|
|
|
285
292
|
/**
|
|
@@ -287,9 +294,12 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
287
294
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
288
295
|
*/
|
|
289
296
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
290
|
-
return /*#__PURE__*/
|
|
291
|
-
|
|
292
|
-
|
|
297
|
+
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
298
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
299
|
+
...props,
|
|
300
|
+
ref: ref
|
|
301
|
+
})
|
|
302
|
+
});
|
|
293
303
|
});
|
|
294
304
|
|
|
295
305
|
// http://stackoverflow.com/questions/105034
|
|
@@ -425,7 +435,7 @@ function polyfills() {
|
|
|
425
435
|
texture.needsUpdate = true;
|
|
426
436
|
|
|
427
437
|
// Force non-DOM upload for EXGL texImage2D
|
|
428
|
-
// @ts-
|
|
438
|
+
// @ts-expect-error
|
|
429
439
|
texture.isDataTexture = true;
|
|
430
440
|
onLoad == null ? void 0 : onLoad(texture);
|
|
431
441
|
}).catch(onError);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useBridge, a as useMutableCallback, d as createRoot, E as ErrorBoundary, B as Block, f as unmountComponentAtNode } from '../../dist/loop-
|
|
2
|
-
export { F as FixedStage, t as ReactThreeFiber, S as Stage, p as Stages, _ as _roots, x as act, j as addAfterEffect, h as addEffect, k as addTail, m as advance, s as applyProps, y as buildGraph, q as context, c as createEvents, o as createPortal, d as createRoot, w as dispose, e as extend, g as flushGlobalEffects, v as getRootState, l as invalidate, r as reconciler, n as render, f as unmountComponentAtNode, D as useFrame, H as useGraph, z as useInstanceHandle, I as useLoader, A as useStore, C as useThree, G as useUpdate } from '../../dist/loop-
|
|
3
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
1
|
+
import { c as createEvents, e as extend, u as useBridge, a as useMutableCallback, d as createRoot, E as ErrorBoundary, B as Block, f as unmountComponentAtNode } from '../../dist/loop-2db547cd.esm.js';
|
|
2
|
+
export { F as FixedStage, t as ReactThreeFiber, S as Stage, p as Stages, _ as _roots, x as act, j as addAfterEffect, h as addEffect, k as addTail, m as advance, s as applyProps, y as buildGraph, q as context, c as createEvents, o as createPortal, d as createRoot, w as dispose, e as extend, g as flushGlobalEffects, v as getRootState, l as invalidate, r as reconciler, n as render, f as unmountComponentAtNode, D as useFrame, H as useGraph, z as useInstanceHandle, I as useLoader, A as useStore, C as useThree, G as useUpdate } from '../../dist/loop-2db547cd.esm.js';
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import * as THREE from 'three';
|
|
6
5
|
import { PanResponder, PixelRatio, StyleSheet, View, Platform, Image, NativeModules } from 'react-native';
|
|
7
6
|
import { GLView } from 'expo-gl';
|
|
8
7
|
import { FiberProvider } from 'its-fine';
|
|
8
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
import { Asset } from 'expo-asset';
|
|
10
10
|
import * as fs from 'expo-file-system';
|
|
11
11
|
import { fromByteArray } from 'base64-js';
|
|
@@ -230,31 +230,38 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
|
230
230
|
return onCreated == null ? void 0 : onCreated(state);
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
|
-
root.current.render( /*#__PURE__*/
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
root.current.render( /*#__PURE__*/jsx(Bridge, {
|
|
234
|
+
children: /*#__PURE__*/jsx(ErrorBoundary, {
|
|
235
|
+
set: setError,
|
|
236
|
+
children: /*#__PURE__*/jsx(React.Suspense, {
|
|
237
|
+
fallback: /*#__PURE__*/jsx(Block, {
|
|
238
|
+
set: setBlock
|
|
239
|
+
}),
|
|
240
|
+
children: children
|
|
241
|
+
})
|
|
238
242
|
})
|
|
239
|
-
}
|
|
243
|
+
}));
|
|
240
244
|
}
|
|
241
245
|
React.useEffect(() => {
|
|
242
246
|
if (canvas) {
|
|
243
247
|
return () => unmountComponentAtNode(canvas);
|
|
244
248
|
}
|
|
245
249
|
}, [canvas]);
|
|
246
|
-
return /*#__PURE__*/
|
|
250
|
+
return /*#__PURE__*/jsx(_View, {
|
|
251
|
+
...props,
|
|
247
252
|
ref: viewRef,
|
|
248
253
|
onLayout: onLayout,
|
|
249
254
|
style: {
|
|
250
255
|
flex: 1,
|
|
251
256
|
...style
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
},
|
|
258
|
+
...bind,
|
|
259
|
+
children: width > 0 && /*#__PURE__*/jsx(GLView, {
|
|
260
|
+
msaaSamples: antialias ? 4 : 0,
|
|
261
|
+
onContextCreate: onContextCreate,
|
|
262
|
+
style: StyleSheet.absoluteFill
|
|
263
|
+
})
|
|
264
|
+
});
|
|
258
265
|
});
|
|
259
266
|
|
|
260
267
|
/**
|
|
@@ -262,9 +269,12 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
|
262
269
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
263
270
|
*/
|
|
264
271
|
const Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref) {
|
|
265
|
-
return /*#__PURE__*/
|
|
266
|
-
|
|
267
|
-
|
|
272
|
+
return /*#__PURE__*/jsx(FiberProvider, {
|
|
273
|
+
children: /*#__PURE__*/jsx(CanvasImpl, {
|
|
274
|
+
...props,
|
|
275
|
+
ref: ref
|
|
276
|
+
})
|
|
277
|
+
});
|
|
268
278
|
});
|
|
269
279
|
|
|
270
280
|
// http://stackoverflow.com/questions/105034
|
|
@@ -400,7 +410,7 @@ function polyfills() {
|
|
|
400
410
|
texture.needsUpdate = true;
|
|
401
411
|
|
|
402
412
|
// Force non-DOM upload for EXGL texImage2D
|
|
403
|
-
// @ts-
|
|
413
|
+
// @ts-expect-error
|
|
404
414
|
texture.isDataTexture = true;
|
|
405
415
|
onLoad == null ? void 0 : onLoad(texture);
|
|
406
416
|
}).catch(onError);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/fiber",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.7",
|
|
4
4
|
"description": "A React renderer for Threejs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"base64-js": "^1.5.1",
|
|
48
48
|
"buffer": "^6.0.3",
|
|
49
49
|
"its-fine": "^1.2.5",
|
|
50
|
-
"react-reconciler": "0.31.0-
|
|
50
|
+
"react-reconciler": "0.31.0-rc-915b914b3a-20240515",
|
|
51
51
|
"react-use-measure": "^2.1.1",
|
|
52
|
-
"scheduler": "0.25.0-
|
|
52
|
+
"scheduler": "0.25.0-rc-915b914b3a-20240515",
|
|
53
53
|
"suspend-react": "^0.1.3",
|
|
54
54
|
"zustand": "^4.1.2"
|
|
55
55
|
},
|
package/readme.md
CHANGED
|
@@ -22,7 +22,7 @@ None. Everything that works in Threejs will work here without exception.
|
|
|
22
22
|
|
|
23
23
|
#### Is it slower than plain Threejs?
|
|
24
24
|
|
|
25
|
-
No. There is no overhead. Components render outside of React. It outperforms Threejs in scale due to
|
|
25
|
+
No. There is no overhead. Components render outside of React. It outperforms Threejs in scale due to React's scheduling abilities.
|
|
26
26
|
|
|
27
27
|
#### Can it keep up with frequent feature updates to Threejs?
|
|
28
28
|
|