@react-three/fiber 8.16.4 → 8.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/declarations/src/core/index.d.ts +1 -1
- package/dist/declarations/src/core/utils.d.ts +7 -4
- package/dist/declarations/src/three-types.d.ts +18 -0
- package/dist/{index-67aff14f.cjs.prod.js → index-4664c596.cjs.prod.js} +34 -32
- package/dist/{index-d449885c.esm.js → index-ba8afaa4.esm.js} +34 -32
- package/dist/{index-20975705.cjs.dev.js → index-f983265a.cjs.dev.js} +34 -32
- 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 +1 -1
- package/readme.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
3
15
|
## 8.16.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -81,7 +81,7 @@ export declare type InjectState = Partial<Omit<RootState, PrivateKeys> & {
|
|
|
81
81
|
};
|
|
82
82
|
size?: Size;
|
|
83
83
|
}>;
|
|
84
|
-
declare function createPortal(children: React.ReactNode, container: THREE.Object3D, state?: InjectState): JSX.Element;
|
|
84
|
+
declare function createPortal(children: React.ReactNode, container: THREE.Object3D, state?: InjectState): React.JSX.Element;
|
|
85
85
|
declare const act: any;
|
|
86
86
|
export * from './hooks';
|
|
87
87
|
export { context, render, createRoot, unmountComponentAtNode, createPortal, reconciler, applyProps, dispose, invalidate, advance, extend, addEffect, addAfterEffect, addTail, flushGlobalEffects, getRootState, act, buildGraph, roots as _roots, };
|
|
@@ -121,10 +121,13 @@ export declare function dispose<TObj extends {
|
|
|
121
121
|
export declare function prepare<T = THREE.Object3D>(object: T, state?: Partial<LocalState>): T;
|
|
122
122
|
export declare function attach(parent: Instance, child: Instance, type: AttachType): void;
|
|
123
123
|
export declare function detach(parent: Instance, child: Instance, type: AttachType): void;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
export declare function
|
|
124
|
+
declare type MaybeInstance = Omit<Instance, '__r3f'> & {
|
|
125
|
+
__r3f?: LocalState;
|
|
126
|
+
};
|
|
127
|
+
export declare function diffProps(instance: MaybeInstance, { children: cN, key: kN, ref: rN, ...props }: InstanceProps, { children: cP, key: kP, ref: rP, ...previous }?: InstanceProps, remove?: boolean): DiffSet;
|
|
128
|
+
export declare function applyProps(instance: MaybeInstance, data: InstanceProps | DiffSet): MaybeInstance;
|
|
129
|
+
export declare function invalidateInstance(instance: MaybeInstance): void;
|
|
130
|
+
export declare function updateInstance(instance: MaybeInstance): void;
|
|
128
131
|
export declare function updateCamera(camera: Camera & {
|
|
129
132
|
manual?: boolean;
|
|
130
133
|
}, size: Size): void;
|
|
@@ -390,4 +390,22 @@ declare global {
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
+
declare module 'react' {
|
|
394
|
+
namespace JSX {
|
|
395
|
+
interface IntrinsicElements extends ThreeElements {
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
declare module 'react/jsx-runtime' {
|
|
400
|
+
namespace JSX {
|
|
401
|
+
interface IntrinsicElements extends ThreeElements {
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
declare module 'react/jsx-dev-runtime' {
|
|
406
|
+
namespace JSX {
|
|
407
|
+
interface IntrinsicElements extends ThreeElements {
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
393
411
|
export {};
|
|
@@ -7,6 +7,7 @@ var create = require('zustand');
|
|
|
7
7
|
var Reconciler = require('react-reconciler');
|
|
8
8
|
var scheduler = require('scheduler');
|
|
9
9
|
var suspendReact = require('suspend-react');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
|
|
11
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
12
13
|
|
|
@@ -154,7 +155,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
154
155
|
} else if (child.isObject3D && parentInstance.isObject3D) {
|
|
155
156
|
var _child$__r3f4;
|
|
156
157
|
parentInstance.remove(child);
|
|
157
|
-
// @ts-
|
|
158
|
+
// @ts-expect-error
|
|
158
159
|
// Remove interactivity on the initial root
|
|
159
160
|
if ((_child$__r3f4 = child.__r3f) != null && _child$__r3f4.root) {
|
|
160
161
|
removeInteractivity(findInitialRoot(child), child);
|
|
@@ -369,7 +370,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
369
370
|
hideTextInstance: handleTextInstance,
|
|
370
371
|
unhideTextInstance: handleTextInstance,
|
|
371
372
|
// https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
|
372
|
-
// @ts-
|
|
373
|
+
// @ts-expect-error
|
|
373
374
|
getCurrentEventPriority: () => _getEventPriority ? _getEventPriority() : constants.DefaultEventPriority,
|
|
374
375
|
beforeActiveInstanceBlur: () => {},
|
|
375
376
|
afterActiveInstanceBlur: () => {},
|
|
@@ -612,7 +613,6 @@ function detach(parent, child, type) {
|
|
|
612
613
|
} else (_child$__r3f = child.__r3f) == null ? void 0 : _child$__r3f.previousAttach == null ? void 0 : _child$__r3f.previousAttach(parent, child);
|
|
613
614
|
(_child$__r3f2 = child.__r3f) == null ? true : delete _child$__r3f2.previousAttach;
|
|
614
615
|
}
|
|
615
|
-
|
|
616
616
|
// This function prepares a set of changes to be applied to the instance
|
|
617
617
|
function diffProps(instance, {
|
|
618
618
|
children: cN,
|
|
@@ -625,8 +625,7 @@ function diffProps(instance, {
|
|
|
625
625
|
ref: rP,
|
|
626
626
|
...previous
|
|
627
627
|
} = {}, remove = false) {
|
|
628
|
-
|
|
629
|
-
const localState = (_instance$__r3f = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f : {};
|
|
628
|
+
const localState = instance.__r3f;
|
|
630
629
|
const entries = Object.entries(props);
|
|
631
630
|
const changes = [];
|
|
632
631
|
|
|
@@ -638,9 +637,9 @@ function diffProps(instance, {
|
|
|
638
637
|
}
|
|
639
638
|
}
|
|
640
639
|
entries.forEach(([key, value]) => {
|
|
641
|
-
var _instance$
|
|
640
|
+
var _instance$__r3f;
|
|
642
641
|
// Bail out on primitive object
|
|
643
|
-
if ((_instance$
|
|
642
|
+
if ((_instance$__r3f = instance.__r3f) != null && _instance$__r3f.primitive && key === 'object') return;
|
|
644
643
|
// When props match bail out
|
|
645
644
|
if (is.equ(value, previous[key])) return;
|
|
646
645
|
// Collect handlers and bail out
|
|
@@ -659,8 +658,8 @@ function diffProps(instance, {
|
|
|
659
658
|
const memoized = {
|
|
660
659
|
...props
|
|
661
660
|
};
|
|
662
|
-
if (localState.memoizedProps && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
663
|
-
if (localState.memoizedProps && localState.memoizedProps.attach) memoized.attach = localState.memoizedProps.attach;
|
|
661
|
+
if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
662
|
+
if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.attach) memoized.attach = localState.memoizedProps.attach;
|
|
664
663
|
return {
|
|
665
664
|
memoized,
|
|
666
665
|
changes
|
|
@@ -670,16 +669,16 @@ const __DEV__ = typeof process !== 'undefined' && "production" !== 'prod
|
|
|
670
669
|
|
|
671
670
|
// This function applies a set of changes to the instance
|
|
672
671
|
function applyProps$1(instance, data) {
|
|
673
|
-
var _instance$
|
|
672
|
+
var _instance$__r3f2;
|
|
674
673
|
// Filter equals, events and reserved props
|
|
675
|
-
const localState =
|
|
676
|
-
const root = localState.root;
|
|
677
|
-
const rootState =
|
|
674
|
+
const localState = instance.__r3f;
|
|
675
|
+
const root = localState == null ? void 0 : localState.root;
|
|
676
|
+
const rootState = root == null ? void 0 : root.getState == null ? void 0 : root.getState();
|
|
678
677
|
const {
|
|
679
678
|
memoized,
|
|
680
679
|
changes
|
|
681
680
|
} = isDiffSet(data) ? data : diffProps(instance, data);
|
|
682
|
-
const prevHandlers = localState.eventCount;
|
|
681
|
+
const prevHandlers = localState == null ? void 0 : localState.eventCount;
|
|
683
682
|
|
|
684
683
|
// Prepare memoized props
|
|
685
684
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
@@ -724,7 +723,7 @@ function applyProps$1(instance, data) {
|
|
|
724
723
|
// create a blank slate of the instance and copy the particular parameter.
|
|
725
724
|
let ctor = DEFAULTS.get(currentInstance.constructor);
|
|
726
725
|
if (!ctor) {
|
|
727
|
-
// @ts-
|
|
726
|
+
// @ts-expect-error
|
|
728
727
|
ctor = new currentInstance.constructor();
|
|
729
728
|
DEFAULTS.set(currentInstance.constructor, ctor);
|
|
730
729
|
}
|
|
@@ -736,7 +735,7 @@ function applyProps$1(instance, data) {
|
|
|
736
735
|
}
|
|
737
736
|
|
|
738
737
|
// Deal with pointer events ...
|
|
739
|
-
if (isEvent) {
|
|
738
|
+
if (isEvent && localState) {
|
|
740
739
|
if (value) localState.handlers[key] = value;else delete localState.handlers[key];
|
|
741
740
|
localState.eventCount = Object.keys(localState.handlers).length;
|
|
742
741
|
}
|
|
@@ -768,7 +767,7 @@ function applyProps$1(instance, data) {
|
|
|
768
767
|
// For versions of three which don't support THREE.ColorManagement,
|
|
769
768
|
// Auto-convert sRGB colors
|
|
770
769
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
771
|
-
if (!getColorManagement() && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
770
|
+
if (!getColorManagement() && rootState && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
772
771
|
}
|
|
773
772
|
// Else, just overwrite the value
|
|
774
773
|
} else {
|
|
@@ -778,14 +777,14 @@ function applyProps$1(instance, data) {
|
|
|
778
777
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
779
778
|
if (currentInstance[key] instanceof THREE__namespace.Texture &&
|
|
780
779
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
781
|
-
currentInstance[key].format === THREE__namespace.RGBAFormat && currentInstance[key].type === THREE__namespace.UnsignedByteType) {
|
|
780
|
+
currentInstance[key].format === THREE__namespace.RGBAFormat && currentInstance[key].type === THREE__namespace.UnsignedByteType && rootState) {
|
|
782
781
|
const texture = currentInstance[key];
|
|
783
782
|
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
784
783
|
}
|
|
785
784
|
}
|
|
786
785
|
invalidateInstance(instance);
|
|
787
786
|
}
|
|
788
|
-
if (localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
787
|
+
if (localState && localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
789
788
|
// Get the initial root state's internals
|
|
790
789
|
const internal = findInitialRoot(instance).getState().internal;
|
|
791
790
|
// Pre-emptively remove the instance from the interaction manager
|
|
@@ -798,12 +797,12 @@ function applyProps$1(instance, data) {
|
|
|
798
797
|
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
799
798
|
// Skip updates to the `onUpdate` prop itself
|
|
800
799
|
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
801
|
-
if (!isCircular && changes.length && (_instance$
|
|
800
|
+
if (!isCircular && changes.length && (_instance$__r3f2 = instance.__r3f) != null && _instance$__r3f2.parent) updateInstance(instance);
|
|
802
801
|
return instance;
|
|
803
802
|
}
|
|
804
803
|
function invalidateInstance(instance) {
|
|
805
|
-
var _instance$
|
|
806
|
-
const state = (_instance$
|
|
804
|
+
var _instance$__r3f3, _instance$__r3f3$root;
|
|
805
|
+
const state = (_instance$__r3f3 = instance.__r3f) == null ? void 0 : (_instance$__r3f3$root = _instance$__r3f3.root) == null ? void 0 : _instance$__r3f3$root.getState == null ? void 0 : _instance$__r3f3$root.getState();
|
|
807
806
|
if (state && state.internal.frames === 0) state.invalidate();
|
|
808
807
|
}
|
|
809
808
|
function updateInstance(instance) {
|
|
@@ -2059,7 +2058,7 @@ function createRoot(canvas) {
|
|
|
2059
2058
|
render(children) {
|
|
2060
2059
|
// The root has to be configured before it can be rendered
|
|
2061
2060
|
if (!configured) this.configure();
|
|
2062
|
-
reconciler.updateContainer( /*#__PURE__*/
|
|
2061
|
+
reconciler.updateContainer( /*#__PURE__*/jsxRuntime.jsx(Provider, {
|
|
2063
2062
|
store: store,
|
|
2064
2063
|
children: children,
|
|
2065
2064
|
onCreated: onCreated,
|
|
@@ -2100,9 +2099,10 @@ function Provider({
|
|
|
2100
2099
|
if (!store.getState().events.connected) state.events.connect == null ? void 0 : state.events.connect(rootElement);
|
|
2101
2100
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2102
2101
|
}, []);
|
|
2103
|
-
return /*#__PURE__*/
|
|
2104
|
-
value: store
|
|
2105
|
-
|
|
2102
|
+
return /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
|
|
2103
|
+
value: store,
|
|
2104
|
+
children: children
|
|
2105
|
+
});
|
|
2106
2106
|
}
|
|
2107
2107
|
function unmountComponentAtNode(canvas, callback) {
|
|
2108
2108
|
const root = roots.get(canvas);
|
|
@@ -2131,12 +2131,11 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
2131
2131
|
}
|
|
2132
2132
|
}
|
|
2133
2133
|
function createPortal(children, container, state) {
|
|
2134
|
-
return /*#__PURE__*/
|
|
2135
|
-
key: container.uuid,
|
|
2134
|
+
return /*#__PURE__*/jsxRuntime.jsx(Portal, {
|
|
2136
2135
|
children: children,
|
|
2137
2136
|
container: container,
|
|
2138
2137
|
state: state
|
|
2139
|
-
});
|
|
2138
|
+
}, container.uuid);
|
|
2140
2139
|
}
|
|
2141
2140
|
function Portal({
|
|
2142
2141
|
state = {},
|
|
@@ -2262,9 +2261,12 @@ function Portal({
|
|
|
2262
2261
|
};
|
|
2263
2262
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2264
2263
|
}, []);
|
|
2265
|
-
return /*#__PURE__*/
|
|
2266
|
-
|
|
2267
|
-
|
|
2264
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2265
|
+
children: reconciler.createPortal( /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
|
|
2266
|
+
value: usePortalStore,
|
|
2267
|
+
children: children
|
|
2268
|
+
}), usePortalStore, null)
|
|
2269
|
+
});
|
|
2268
2270
|
}
|
|
2269
2271
|
reconciler.injectIntoDevTools({
|
|
2270
2272
|
bundleType: 0 ,
|
|
@@ -5,6 +5,7 @@ import create from 'zustand';
|
|
|
5
5
|
import Reconciler from 'react-reconciler';
|
|
6
6
|
import { unstable_scheduleCallback, unstable_IdlePriority } from 'scheduler';
|
|
7
7
|
import { suspend, preload, clear } from 'suspend-react';
|
|
8
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
8
9
|
|
|
9
10
|
var threeTypes = /*#__PURE__*/Object.freeze({
|
|
10
11
|
__proto__: null
|
|
@@ -127,7 +128,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
127
128
|
} else if (child.isObject3D && parentInstance.isObject3D) {
|
|
128
129
|
var _child$__r3f4;
|
|
129
130
|
parentInstance.remove(child);
|
|
130
|
-
// @ts-
|
|
131
|
+
// @ts-expect-error
|
|
131
132
|
// Remove interactivity on the initial root
|
|
132
133
|
if ((_child$__r3f4 = child.__r3f) != null && _child$__r3f4.root) {
|
|
133
134
|
removeInteractivity(findInitialRoot(child), child);
|
|
@@ -342,7 +343,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
342
343
|
hideTextInstance: handleTextInstance,
|
|
343
344
|
unhideTextInstance: handleTextInstance,
|
|
344
345
|
// https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
|
345
|
-
// @ts-
|
|
346
|
+
// @ts-expect-error
|
|
346
347
|
getCurrentEventPriority: () => _getEventPriority ? _getEventPriority() : DefaultEventPriority,
|
|
347
348
|
beforeActiveInstanceBlur: () => {},
|
|
348
349
|
afterActiveInstanceBlur: () => {},
|
|
@@ -585,7 +586,6 @@ function detach(parent, child, type) {
|
|
|
585
586
|
} else (_child$__r3f = child.__r3f) == null ? void 0 : _child$__r3f.previousAttach == null ? void 0 : _child$__r3f.previousAttach(parent, child);
|
|
586
587
|
(_child$__r3f2 = child.__r3f) == null ? true : delete _child$__r3f2.previousAttach;
|
|
587
588
|
}
|
|
588
|
-
|
|
589
589
|
// This function prepares a set of changes to be applied to the instance
|
|
590
590
|
function diffProps(instance, {
|
|
591
591
|
children: cN,
|
|
@@ -598,8 +598,7 @@ function diffProps(instance, {
|
|
|
598
598
|
ref: rP,
|
|
599
599
|
...previous
|
|
600
600
|
} = {}, remove = false) {
|
|
601
|
-
|
|
602
|
-
const localState = (_instance$__r3f = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f : {};
|
|
601
|
+
const localState = instance.__r3f;
|
|
603
602
|
const entries = Object.entries(props);
|
|
604
603
|
const changes = [];
|
|
605
604
|
|
|
@@ -611,9 +610,9 @@ function diffProps(instance, {
|
|
|
611
610
|
}
|
|
612
611
|
}
|
|
613
612
|
entries.forEach(([key, value]) => {
|
|
614
|
-
var _instance$
|
|
613
|
+
var _instance$__r3f;
|
|
615
614
|
// Bail out on primitive object
|
|
616
|
-
if ((_instance$
|
|
615
|
+
if ((_instance$__r3f = instance.__r3f) != null && _instance$__r3f.primitive && key === 'object') return;
|
|
617
616
|
// When props match bail out
|
|
618
617
|
if (is.equ(value, previous[key])) return;
|
|
619
618
|
// Collect handlers and bail out
|
|
@@ -632,8 +631,8 @@ function diffProps(instance, {
|
|
|
632
631
|
const memoized = {
|
|
633
632
|
...props
|
|
634
633
|
};
|
|
635
|
-
if (localState.memoizedProps && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
636
|
-
if (localState.memoizedProps && localState.memoizedProps.attach) memoized.attach = localState.memoizedProps.attach;
|
|
634
|
+
if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
635
|
+
if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.attach) memoized.attach = localState.memoizedProps.attach;
|
|
637
636
|
return {
|
|
638
637
|
memoized,
|
|
639
638
|
changes
|
|
@@ -643,16 +642,16 @@ const __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV !== 'prod
|
|
|
643
642
|
|
|
644
643
|
// This function applies a set of changes to the instance
|
|
645
644
|
function applyProps$1(instance, data) {
|
|
646
|
-
var _instance$
|
|
645
|
+
var _instance$__r3f2;
|
|
647
646
|
// Filter equals, events and reserved props
|
|
648
|
-
const localState =
|
|
649
|
-
const root = localState.root;
|
|
650
|
-
const rootState =
|
|
647
|
+
const localState = instance.__r3f;
|
|
648
|
+
const root = localState == null ? void 0 : localState.root;
|
|
649
|
+
const rootState = root == null ? void 0 : root.getState == null ? void 0 : root.getState();
|
|
651
650
|
const {
|
|
652
651
|
memoized,
|
|
653
652
|
changes
|
|
654
653
|
} = isDiffSet(data) ? data : diffProps(instance, data);
|
|
655
|
-
const prevHandlers = localState.eventCount;
|
|
654
|
+
const prevHandlers = localState == null ? void 0 : localState.eventCount;
|
|
656
655
|
|
|
657
656
|
// Prepare memoized props
|
|
658
657
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
@@ -697,7 +696,7 @@ function applyProps$1(instance, data) {
|
|
|
697
696
|
// create a blank slate of the instance and copy the particular parameter.
|
|
698
697
|
let ctor = DEFAULTS.get(currentInstance.constructor);
|
|
699
698
|
if (!ctor) {
|
|
700
|
-
// @ts-
|
|
699
|
+
// @ts-expect-error
|
|
701
700
|
ctor = new currentInstance.constructor();
|
|
702
701
|
DEFAULTS.set(currentInstance.constructor, ctor);
|
|
703
702
|
}
|
|
@@ -709,7 +708,7 @@ function applyProps$1(instance, data) {
|
|
|
709
708
|
}
|
|
710
709
|
|
|
711
710
|
// Deal with pointer events ...
|
|
712
|
-
if (isEvent) {
|
|
711
|
+
if (isEvent && localState) {
|
|
713
712
|
if (value) localState.handlers[key] = value;else delete localState.handlers[key];
|
|
714
713
|
localState.eventCount = Object.keys(localState.handlers).length;
|
|
715
714
|
}
|
|
@@ -741,7 +740,7 @@ function applyProps$1(instance, data) {
|
|
|
741
740
|
// For versions of three which don't support THREE.ColorManagement,
|
|
742
741
|
// Auto-convert sRGB colors
|
|
743
742
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
744
|
-
if (!getColorManagement() && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
743
|
+
if (!getColorManagement() && rootState && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
745
744
|
}
|
|
746
745
|
// Else, just overwrite the value
|
|
747
746
|
} else {
|
|
@@ -751,14 +750,14 @@ function applyProps$1(instance, data) {
|
|
|
751
750
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
752
751
|
if (currentInstance[key] instanceof THREE.Texture &&
|
|
753
752
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
754
|
-
currentInstance[key].format === THREE.RGBAFormat && currentInstance[key].type === THREE.UnsignedByteType) {
|
|
753
|
+
currentInstance[key].format === THREE.RGBAFormat && currentInstance[key].type === THREE.UnsignedByteType && rootState) {
|
|
755
754
|
const texture = currentInstance[key];
|
|
756
755
|
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
757
756
|
}
|
|
758
757
|
}
|
|
759
758
|
invalidateInstance(instance);
|
|
760
759
|
}
|
|
761
|
-
if (localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
760
|
+
if (localState && localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
762
761
|
// Get the initial root state's internals
|
|
763
762
|
const internal = findInitialRoot(instance).getState().internal;
|
|
764
763
|
// Pre-emptively remove the instance from the interaction manager
|
|
@@ -771,12 +770,12 @@ function applyProps$1(instance, data) {
|
|
|
771
770
|
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
772
771
|
// Skip updates to the `onUpdate` prop itself
|
|
773
772
|
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
774
|
-
if (!isCircular && changes.length && (_instance$
|
|
773
|
+
if (!isCircular && changes.length && (_instance$__r3f2 = instance.__r3f) != null && _instance$__r3f2.parent) updateInstance(instance);
|
|
775
774
|
return instance;
|
|
776
775
|
}
|
|
777
776
|
function invalidateInstance(instance) {
|
|
778
|
-
var _instance$
|
|
779
|
-
const state = (_instance$
|
|
777
|
+
var _instance$__r3f3, _instance$__r3f3$root;
|
|
778
|
+
const state = (_instance$__r3f3 = instance.__r3f) == null ? void 0 : (_instance$__r3f3$root = _instance$__r3f3.root) == null ? void 0 : _instance$__r3f3$root.getState == null ? void 0 : _instance$__r3f3$root.getState();
|
|
780
779
|
if (state && state.internal.frames === 0) state.invalidate();
|
|
781
780
|
}
|
|
782
781
|
function updateInstance(instance) {
|
|
@@ -2032,7 +2031,7 @@ function createRoot(canvas) {
|
|
|
2032
2031
|
render(children) {
|
|
2033
2032
|
// The root has to be configured before it can be rendered
|
|
2034
2033
|
if (!configured) this.configure();
|
|
2035
|
-
reconciler.updateContainer( /*#__PURE__*/
|
|
2034
|
+
reconciler.updateContainer( /*#__PURE__*/jsx(Provider, {
|
|
2036
2035
|
store: store,
|
|
2037
2036
|
children: children,
|
|
2038
2037
|
onCreated: onCreated,
|
|
@@ -2073,9 +2072,10 @@ function Provider({
|
|
|
2073
2072
|
if (!store.getState().events.connected) state.events.connect == null ? void 0 : state.events.connect(rootElement);
|
|
2074
2073
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2075
2074
|
}, []);
|
|
2076
|
-
return /*#__PURE__*/
|
|
2077
|
-
value: store
|
|
2078
|
-
|
|
2075
|
+
return /*#__PURE__*/jsx(context.Provider, {
|
|
2076
|
+
value: store,
|
|
2077
|
+
children: children
|
|
2078
|
+
});
|
|
2079
2079
|
}
|
|
2080
2080
|
function unmountComponentAtNode(canvas, callback) {
|
|
2081
2081
|
const root = roots.get(canvas);
|
|
@@ -2104,12 +2104,11 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
2106
|
function createPortal(children, container, state) {
|
|
2107
|
-
return /*#__PURE__*/
|
|
2108
|
-
key: container.uuid,
|
|
2107
|
+
return /*#__PURE__*/jsx(Portal, {
|
|
2109
2108
|
children: children,
|
|
2110
2109
|
container: container,
|
|
2111
2110
|
state: state
|
|
2112
|
-
});
|
|
2111
|
+
}, container.uuid);
|
|
2113
2112
|
}
|
|
2114
2113
|
function Portal({
|
|
2115
2114
|
state = {},
|
|
@@ -2235,9 +2234,12 @@ function Portal({
|
|
|
2235
2234
|
};
|
|
2236
2235
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2237
2236
|
}, []);
|
|
2238
|
-
return /*#__PURE__*/
|
|
2239
|
-
|
|
2240
|
-
|
|
2237
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
2238
|
+
children: reconciler.createPortal( /*#__PURE__*/jsx(context.Provider, {
|
|
2239
|
+
value: usePortalStore,
|
|
2240
|
+
children: children
|
|
2241
|
+
}), usePortalStore, null)
|
|
2242
|
+
});
|
|
2241
2243
|
}
|
|
2242
2244
|
reconciler.injectIntoDevTools({
|
|
2243
2245
|
bundleType: process.env.NODE_ENV === 'production' ? 0 : 1,
|
|
@@ -7,6 +7,7 @@ var create = require('zustand');
|
|
|
7
7
|
var Reconciler = require('react-reconciler');
|
|
8
8
|
var scheduler = require('scheduler');
|
|
9
9
|
var suspendReact = require('suspend-react');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
|
|
11
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
12
13
|
|
|
@@ -154,7 +155,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
154
155
|
} else if (child.isObject3D && parentInstance.isObject3D) {
|
|
155
156
|
var _child$__r3f4;
|
|
156
157
|
parentInstance.remove(child);
|
|
157
|
-
// @ts-
|
|
158
|
+
// @ts-expect-error
|
|
158
159
|
// Remove interactivity on the initial root
|
|
159
160
|
if ((_child$__r3f4 = child.__r3f) != null && _child$__r3f4.root) {
|
|
160
161
|
removeInteractivity(findInitialRoot(child), child);
|
|
@@ -369,7 +370,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
369
370
|
hideTextInstance: handleTextInstance,
|
|
370
371
|
unhideTextInstance: handleTextInstance,
|
|
371
372
|
// https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
|
372
|
-
// @ts-
|
|
373
|
+
// @ts-expect-error
|
|
373
374
|
getCurrentEventPriority: () => _getEventPriority ? _getEventPriority() : constants.DefaultEventPriority,
|
|
374
375
|
beforeActiveInstanceBlur: () => {},
|
|
375
376
|
afterActiveInstanceBlur: () => {},
|
|
@@ -612,7 +613,6 @@ function detach(parent, child, type) {
|
|
|
612
613
|
} else (_child$__r3f = child.__r3f) == null ? void 0 : _child$__r3f.previousAttach == null ? void 0 : _child$__r3f.previousAttach(parent, child);
|
|
613
614
|
(_child$__r3f2 = child.__r3f) == null ? true : delete _child$__r3f2.previousAttach;
|
|
614
615
|
}
|
|
615
|
-
|
|
616
616
|
// This function prepares a set of changes to be applied to the instance
|
|
617
617
|
function diffProps(instance, {
|
|
618
618
|
children: cN,
|
|
@@ -625,8 +625,7 @@ function diffProps(instance, {
|
|
|
625
625
|
ref: rP,
|
|
626
626
|
...previous
|
|
627
627
|
} = {}, remove = false) {
|
|
628
|
-
|
|
629
|
-
const localState = (_instance$__r3f = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f : {};
|
|
628
|
+
const localState = instance.__r3f;
|
|
630
629
|
const entries = Object.entries(props);
|
|
631
630
|
const changes = [];
|
|
632
631
|
|
|
@@ -638,9 +637,9 @@ function diffProps(instance, {
|
|
|
638
637
|
}
|
|
639
638
|
}
|
|
640
639
|
entries.forEach(([key, value]) => {
|
|
641
|
-
var _instance$
|
|
640
|
+
var _instance$__r3f;
|
|
642
641
|
// Bail out on primitive object
|
|
643
|
-
if ((_instance$
|
|
642
|
+
if ((_instance$__r3f = instance.__r3f) != null && _instance$__r3f.primitive && key === 'object') return;
|
|
644
643
|
// When props match bail out
|
|
645
644
|
if (is.equ(value, previous[key])) return;
|
|
646
645
|
// Collect handlers and bail out
|
|
@@ -659,8 +658,8 @@ function diffProps(instance, {
|
|
|
659
658
|
const memoized = {
|
|
660
659
|
...props
|
|
661
660
|
};
|
|
662
|
-
if (localState.memoizedProps && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
663
|
-
if (localState.memoizedProps && localState.memoizedProps.attach) memoized.attach = localState.memoizedProps.attach;
|
|
661
|
+
if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
662
|
+
if (localState != null && localState.memoizedProps && localState != null && localState.memoizedProps.attach) memoized.attach = localState.memoizedProps.attach;
|
|
664
663
|
return {
|
|
665
664
|
memoized,
|
|
666
665
|
changes
|
|
@@ -670,16 +669,16 @@ const __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV !== 'prod
|
|
|
670
669
|
|
|
671
670
|
// This function applies a set of changes to the instance
|
|
672
671
|
function applyProps$1(instance, data) {
|
|
673
|
-
var _instance$
|
|
672
|
+
var _instance$__r3f2;
|
|
674
673
|
// Filter equals, events and reserved props
|
|
675
|
-
const localState =
|
|
676
|
-
const root = localState.root;
|
|
677
|
-
const rootState =
|
|
674
|
+
const localState = instance.__r3f;
|
|
675
|
+
const root = localState == null ? void 0 : localState.root;
|
|
676
|
+
const rootState = root == null ? void 0 : root.getState == null ? void 0 : root.getState();
|
|
678
677
|
const {
|
|
679
678
|
memoized,
|
|
680
679
|
changes
|
|
681
680
|
} = isDiffSet(data) ? data : diffProps(instance, data);
|
|
682
|
-
const prevHandlers = localState.eventCount;
|
|
681
|
+
const prevHandlers = localState == null ? void 0 : localState.eventCount;
|
|
683
682
|
|
|
684
683
|
// Prepare memoized props
|
|
685
684
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
@@ -724,7 +723,7 @@ function applyProps$1(instance, data) {
|
|
|
724
723
|
// create a blank slate of the instance and copy the particular parameter.
|
|
725
724
|
let ctor = DEFAULTS.get(currentInstance.constructor);
|
|
726
725
|
if (!ctor) {
|
|
727
|
-
// @ts-
|
|
726
|
+
// @ts-expect-error
|
|
728
727
|
ctor = new currentInstance.constructor();
|
|
729
728
|
DEFAULTS.set(currentInstance.constructor, ctor);
|
|
730
729
|
}
|
|
@@ -736,7 +735,7 @@ function applyProps$1(instance, data) {
|
|
|
736
735
|
}
|
|
737
736
|
|
|
738
737
|
// Deal with pointer events ...
|
|
739
|
-
if (isEvent) {
|
|
738
|
+
if (isEvent && localState) {
|
|
740
739
|
if (value) localState.handlers[key] = value;else delete localState.handlers[key];
|
|
741
740
|
localState.eventCount = Object.keys(localState.handlers).length;
|
|
742
741
|
}
|
|
@@ -768,7 +767,7 @@ function applyProps$1(instance, data) {
|
|
|
768
767
|
// For versions of three which don't support THREE.ColorManagement,
|
|
769
768
|
// Auto-convert sRGB colors
|
|
770
769
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
771
|
-
if (!getColorManagement() && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
770
|
+
if (!getColorManagement() && rootState && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
772
771
|
}
|
|
773
772
|
// Else, just overwrite the value
|
|
774
773
|
} else {
|
|
@@ -778,14 +777,14 @@ function applyProps$1(instance, data) {
|
|
|
778
777
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
779
778
|
if (currentInstance[key] instanceof THREE__namespace.Texture &&
|
|
780
779
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
781
|
-
currentInstance[key].format === THREE__namespace.RGBAFormat && currentInstance[key].type === THREE__namespace.UnsignedByteType) {
|
|
780
|
+
currentInstance[key].format === THREE__namespace.RGBAFormat && currentInstance[key].type === THREE__namespace.UnsignedByteType && rootState) {
|
|
782
781
|
const texture = currentInstance[key];
|
|
783
782
|
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
784
783
|
}
|
|
785
784
|
}
|
|
786
785
|
invalidateInstance(instance);
|
|
787
786
|
}
|
|
788
|
-
if (localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
787
|
+
if (localState && localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
789
788
|
// Get the initial root state's internals
|
|
790
789
|
const internal = findInitialRoot(instance).getState().internal;
|
|
791
790
|
// Pre-emptively remove the instance from the interaction manager
|
|
@@ -798,12 +797,12 @@ function applyProps$1(instance, data) {
|
|
|
798
797
|
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
799
798
|
// Skip updates to the `onUpdate` prop itself
|
|
800
799
|
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
801
|
-
if (!isCircular && changes.length && (_instance$
|
|
800
|
+
if (!isCircular && changes.length && (_instance$__r3f2 = instance.__r3f) != null && _instance$__r3f2.parent) updateInstance(instance);
|
|
802
801
|
return instance;
|
|
803
802
|
}
|
|
804
803
|
function invalidateInstance(instance) {
|
|
805
|
-
var _instance$
|
|
806
|
-
const state = (_instance$
|
|
804
|
+
var _instance$__r3f3, _instance$__r3f3$root;
|
|
805
|
+
const state = (_instance$__r3f3 = instance.__r3f) == null ? void 0 : (_instance$__r3f3$root = _instance$__r3f3.root) == null ? void 0 : _instance$__r3f3$root.getState == null ? void 0 : _instance$__r3f3$root.getState();
|
|
807
806
|
if (state && state.internal.frames === 0) state.invalidate();
|
|
808
807
|
}
|
|
809
808
|
function updateInstance(instance) {
|
|
@@ -2059,7 +2058,7 @@ function createRoot(canvas) {
|
|
|
2059
2058
|
render(children) {
|
|
2060
2059
|
// The root has to be configured before it can be rendered
|
|
2061
2060
|
if (!configured) this.configure();
|
|
2062
|
-
reconciler.updateContainer( /*#__PURE__*/
|
|
2061
|
+
reconciler.updateContainer( /*#__PURE__*/jsxRuntime.jsx(Provider, {
|
|
2063
2062
|
store: store,
|
|
2064
2063
|
children: children,
|
|
2065
2064
|
onCreated: onCreated,
|
|
@@ -2100,9 +2099,10 @@ function Provider({
|
|
|
2100
2099
|
if (!store.getState().events.connected) state.events.connect == null ? void 0 : state.events.connect(rootElement);
|
|
2101
2100
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2102
2101
|
}, []);
|
|
2103
|
-
return /*#__PURE__*/
|
|
2104
|
-
value: store
|
|
2105
|
-
|
|
2102
|
+
return /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
|
|
2103
|
+
value: store,
|
|
2104
|
+
children: children
|
|
2105
|
+
});
|
|
2106
2106
|
}
|
|
2107
2107
|
function unmountComponentAtNode(canvas, callback) {
|
|
2108
2108
|
const root = roots.get(canvas);
|
|
@@ -2131,12 +2131,11 @@ function unmountComponentAtNode(canvas, callback) {
|
|
|
2131
2131
|
}
|
|
2132
2132
|
}
|
|
2133
2133
|
function createPortal(children, container, state) {
|
|
2134
|
-
return /*#__PURE__*/
|
|
2135
|
-
key: container.uuid,
|
|
2134
|
+
return /*#__PURE__*/jsxRuntime.jsx(Portal, {
|
|
2136
2135
|
children: children,
|
|
2137
2136
|
container: container,
|
|
2138
2137
|
state: state
|
|
2139
|
-
});
|
|
2138
|
+
}, container.uuid);
|
|
2140
2139
|
}
|
|
2141
2140
|
function Portal({
|
|
2142
2141
|
state = {},
|
|
@@ -2262,9 +2261,12 @@ function Portal({
|
|
|
2262
2261
|
};
|
|
2263
2262
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2264
2263
|
}, []);
|
|
2265
|
-
return /*#__PURE__*/
|
|
2266
|
-
|
|
2267
|
-
|
|
2264
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2265
|
+
children: reconciler.createPortal( /*#__PURE__*/jsxRuntime.jsx(context.Provider, {
|
|
2266
|
+
value: usePortalStore,
|
|
2267
|
+
children: children
|
|
2268
|
+
}), usePortalStore, null)
|
|
2269
|
+
});
|
|
2268
2270
|
}
|
|
2269
2271
|
reconciler.injectIntoDevTools({
|
|
2270
2272
|
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 index = require('./index-
|
|
6
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
|
+
var index = require('./index-f983265a.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');
|
|
13
13
|
require('react-reconciler');
|
|
@@ -210,13 +210,17 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
210
210
|
onCreated == null ? void 0 : onCreated(state);
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
-
root.current.render( /*#__PURE__*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
214
|
+
children: /*#__PURE__*/jsxRuntime.jsx(index.ErrorBoundary, {
|
|
215
|
+
set: setError,
|
|
216
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
217
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(index.Block, {
|
|
218
|
+
set: setBlock
|
|
219
|
+
}),
|
|
220
|
+
children: children
|
|
221
|
+
})
|
|
218
222
|
})
|
|
219
|
-
}
|
|
223
|
+
}));
|
|
220
224
|
}
|
|
221
225
|
});
|
|
222
226
|
React__namespace.useEffect(() => {
|
|
@@ -227,7 +231,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
227
231
|
// When the event source is not this div, we need to set pointer-events to none
|
|
228
232
|
// Or else the canvas will block events from reaching the event source
|
|
229
233
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
230
|
-
return /*#__PURE__*/
|
|
234
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
231
235
|
ref: divRef,
|
|
232
236
|
style: {
|
|
233
237
|
position: 'relative',
|
|
@@ -236,19 +240,23 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
236
240
|
overflow: 'hidden',
|
|
237
241
|
pointerEvents,
|
|
238
242
|
...style
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
},
|
|
244
|
+
...props,
|
|
245
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
246
|
+
ref: containerRef,
|
|
247
|
+
style: {
|
|
248
|
+
width: '100%',
|
|
249
|
+
height: '100%'
|
|
250
|
+
},
|
|
251
|
+
children: /*#__PURE__*/jsxRuntime.jsx("canvas", {
|
|
252
|
+
ref: canvasRef,
|
|
253
|
+
style: {
|
|
254
|
+
display: 'block'
|
|
255
|
+
},
|
|
256
|
+
children: fallback
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
});
|
|
252
260
|
});
|
|
253
261
|
|
|
254
262
|
/**
|
|
@@ -256,9 +264,12 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
256
264
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
257
265
|
*/
|
|
258
266
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
259
|
-
return /*#__PURE__*/
|
|
260
|
-
|
|
261
|
-
|
|
267
|
+
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
268
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
269
|
+
...props,
|
|
270
|
+
ref: ref
|
|
271
|
+
})
|
|
272
|
+
});
|
|
262
273
|
});
|
|
263
274
|
|
|
264
275
|
exports.ReactThreeFiber = index.threeTypes;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
6
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
|
+
var index = require('./index-4664c596.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');
|
|
13
13
|
require('react-reconciler');
|
|
@@ -210,13 +210,17 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
210
210
|
onCreated == null ? void 0 : onCreated(state);
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
-
root.current.render( /*#__PURE__*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
214
|
+
children: /*#__PURE__*/jsxRuntime.jsx(index.ErrorBoundary, {
|
|
215
|
+
set: setError,
|
|
216
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
217
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(index.Block, {
|
|
218
|
+
set: setBlock
|
|
219
|
+
}),
|
|
220
|
+
children: children
|
|
221
|
+
})
|
|
218
222
|
})
|
|
219
|
-
}
|
|
223
|
+
}));
|
|
220
224
|
}
|
|
221
225
|
});
|
|
222
226
|
React__namespace.useEffect(() => {
|
|
@@ -227,7 +231,7 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
227
231
|
// When the event source is not this div, we need to set pointer-events to none
|
|
228
232
|
// Or else the canvas will block events from reaching the event source
|
|
229
233
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
230
|
-
return /*#__PURE__*/
|
|
234
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
231
235
|
ref: divRef,
|
|
232
236
|
style: {
|
|
233
237
|
position: 'relative',
|
|
@@ -236,19 +240,23 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
236
240
|
overflow: 'hidden',
|
|
237
241
|
pointerEvents,
|
|
238
242
|
...style
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
},
|
|
244
|
+
...props,
|
|
245
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
246
|
+
ref: containerRef,
|
|
247
|
+
style: {
|
|
248
|
+
width: '100%',
|
|
249
|
+
height: '100%'
|
|
250
|
+
},
|
|
251
|
+
children: /*#__PURE__*/jsxRuntime.jsx("canvas", {
|
|
252
|
+
ref: canvasRef,
|
|
253
|
+
style: {
|
|
254
|
+
display: 'block'
|
|
255
|
+
},
|
|
256
|
+
children: fallback
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
});
|
|
252
260
|
});
|
|
253
261
|
|
|
254
262
|
/**
|
|
@@ -256,9 +264,12 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
256
264
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
257
265
|
*/
|
|
258
266
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
259
|
-
return /*#__PURE__*/
|
|
260
|
-
|
|
261
|
-
|
|
267
|
+
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
268
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
269
|
+
...props,
|
|
270
|
+
ref: ref
|
|
271
|
+
})
|
|
272
|
+
});
|
|
262
273
|
});
|
|
263
274
|
|
|
264
275
|
exports.ReactThreeFiber = index.threeTypes;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './index-
|
|
2
|
-
export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-
|
|
3
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './index-ba8afaa4.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-ba8afaa4.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, useContextBridge } from 'its-fine';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
import 'react-reconciler/constants';
|
|
9
9
|
import 'zustand';
|
|
10
10
|
import 'react-reconciler';
|
|
@@ -183,13 +183,17 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
183
183
|
onCreated == null ? void 0 : onCreated(state);
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
|
-
root.current.render( /*#__PURE__*/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
root.current.render( /*#__PURE__*/jsx(Bridge, {
|
|
187
|
+
children: /*#__PURE__*/jsx(ErrorBoundary, {
|
|
188
|
+
set: setError,
|
|
189
|
+
children: /*#__PURE__*/jsx(React.Suspense, {
|
|
190
|
+
fallback: /*#__PURE__*/jsx(Block, {
|
|
191
|
+
set: setBlock
|
|
192
|
+
}),
|
|
193
|
+
children: children
|
|
194
|
+
})
|
|
191
195
|
})
|
|
192
|
-
}
|
|
196
|
+
}));
|
|
193
197
|
}
|
|
194
198
|
});
|
|
195
199
|
React.useEffect(() => {
|
|
@@ -200,7 +204,7 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
200
204
|
// When the event source is not this div, we need to set pointer-events to none
|
|
201
205
|
// Or else the canvas will block events from reaching the event source
|
|
202
206
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
203
|
-
return /*#__PURE__*/
|
|
207
|
+
return /*#__PURE__*/jsx("div", {
|
|
204
208
|
ref: divRef,
|
|
205
209
|
style: {
|
|
206
210
|
position: 'relative',
|
|
@@ -209,19 +213,23 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
209
213
|
overflow: 'hidden',
|
|
210
214
|
pointerEvents,
|
|
211
215
|
...style
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
216
|
+
},
|
|
217
|
+
...props,
|
|
218
|
+
children: /*#__PURE__*/jsx("div", {
|
|
219
|
+
ref: containerRef,
|
|
220
|
+
style: {
|
|
221
|
+
width: '100%',
|
|
222
|
+
height: '100%'
|
|
223
|
+
},
|
|
224
|
+
children: /*#__PURE__*/jsx("canvas", {
|
|
225
|
+
ref: canvasRef,
|
|
226
|
+
style: {
|
|
227
|
+
display: 'block'
|
|
228
|
+
},
|
|
229
|
+
children: fallback
|
|
230
|
+
})
|
|
231
|
+
})
|
|
232
|
+
});
|
|
225
233
|
});
|
|
226
234
|
|
|
227
235
|
/**
|
|
@@ -229,9 +237,12 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
229
237
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
230
238
|
*/
|
|
231
239
|
const Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref) {
|
|
232
|
-
return /*#__PURE__*/
|
|
233
|
-
|
|
234
|
-
|
|
240
|
+
return /*#__PURE__*/jsx(FiberProvider, {
|
|
241
|
+
children: /*#__PURE__*/jsx(CanvasImpl, {
|
|
242
|
+
...props,
|
|
243
|
+
ref: ref
|
|
244
|
+
})
|
|
245
|
+
});
|
|
235
246
|
});
|
|
236
247
|
|
|
237
248
|
export { Canvas, createPointerEvents as events };
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
6
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
|
+
var index = require('../../dist/index-f983265a.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');
|
|
@@ -251,31 +251,38 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
251
251
|
return onCreated == null ? void 0 : onCreated(state);
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
|
-
root.current.render( /*#__PURE__*/
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
255
|
+
children: /*#__PURE__*/jsxRuntime.jsx(index.ErrorBoundary, {
|
|
256
|
+
set: setError,
|
|
257
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
258
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(index.Block, {
|
|
259
|
+
set: setBlock
|
|
260
|
+
}),
|
|
261
|
+
children: children
|
|
262
|
+
})
|
|
259
263
|
})
|
|
260
|
-
}
|
|
264
|
+
}));
|
|
261
265
|
}
|
|
262
266
|
React__namespace.useEffect(() => {
|
|
263
267
|
if (canvas) {
|
|
264
268
|
return () => index.unmountComponentAtNode(canvas);
|
|
265
269
|
}
|
|
266
270
|
}, [canvas]);
|
|
267
|
-
return /*#__PURE__*/
|
|
271
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
|
|
272
|
+
...props,
|
|
268
273
|
ref: viewRef,
|
|
269
274
|
onLayout: onLayout,
|
|
270
275
|
style: {
|
|
271
276
|
flex: 1,
|
|
272
277
|
...style
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
},
|
|
279
|
+
...bind,
|
|
280
|
+
children: width > 0 && /*#__PURE__*/jsxRuntime.jsx(expoGl.GLView, {
|
|
281
|
+
msaaSamples: antialias ? 4 : 0,
|
|
282
|
+
onContextCreate: onContextCreate,
|
|
283
|
+
style: reactNative.StyleSheet.absoluteFill
|
|
284
|
+
})
|
|
285
|
+
});
|
|
279
286
|
});
|
|
280
287
|
|
|
281
288
|
/**
|
|
@@ -283,9 +290,12 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
283
290
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
284
291
|
*/
|
|
285
292
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
286
|
-
return /*#__PURE__*/
|
|
287
|
-
|
|
288
|
-
|
|
293
|
+
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
294
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
295
|
+
...props,
|
|
296
|
+
ref: ref
|
|
297
|
+
})
|
|
298
|
+
});
|
|
289
299
|
});
|
|
290
300
|
|
|
291
301
|
// http://stackoverflow.com/questions/105034
|
|
@@ -421,7 +431,7 @@ function polyfills() {
|
|
|
421
431
|
texture.needsUpdate = true;
|
|
422
432
|
|
|
423
433
|
// Force non-DOM upload for EXGL texImage2D
|
|
424
|
-
// @ts-
|
|
434
|
+
// @ts-expect-error
|
|
425
435
|
texture.isDataTexture = true;
|
|
426
436
|
onLoad == null ? void 0 : onLoad(texture);
|
|
427
437
|
}).catch(onError);
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
6
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
|
+
var index = require('../../dist/index-4664c596.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');
|
|
@@ -251,31 +251,38 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
251
251
|
return onCreated == null ? void 0 : onCreated(state);
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
|
-
root.current.render( /*#__PURE__*/
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
255
|
+
children: /*#__PURE__*/jsxRuntime.jsx(index.ErrorBoundary, {
|
|
256
|
+
set: setError,
|
|
257
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
258
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(index.Block, {
|
|
259
|
+
set: setBlock
|
|
260
|
+
}),
|
|
261
|
+
children: children
|
|
262
|
+
})
|
|
259
263
|
})
|
|
260
|
-
}
|
|
264
|
+
}));
|
|
261
265
|
}
|
|
262
266
|
React__namespace.useEffect(() => {
|
|
263
267
|
if (canvas) {
|
|
264
268
|
return () => index.unmountComponentAtNode(canvas);
|
|
265
269
|
}
|
|
266
270
|
}, [canvas]);
|
|
267
|
-
return /*#__PURE__*/
|
|
271
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
|
|
272
|
+
...props,
|
|
268
273
|
ref: viewRef,
|
|
269
274
|
onLayout: onLayout,
|
|
270
275
|
style: {
|
|
271
276
|
flex: 1,
|
|
272
277
|
...style
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
},
|
|
279
|
+
...bind,
|
|
280
|
+
children: width > 0 && /*#__PURE__*/jsxRuntime.jsx(expoGl.GLView, {
|
|
281
|
+
msaaSamples: antialias ? 4 : 0,
|
|
282
|
+
onContextCreate: onContextCreate,
|
|
283
|
+
style: reactNative.StyleSheet.absoluteFill
|
|
284
|
+
})
|
|
285
|
+
});
|
|
279
286
|
});
|
|
280
287
|
|
|
281
288
|
/**
|
|
@@ -283,9 +290,12 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
283
290
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
284
291
|
*/
|
|
285
292
|
const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(props, ref) {
|
|
286
|
-
return /*#__PURE__*/
|
|
287
|
-
|
|
288
|
-
|
|
293
|
+
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
294
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CanvasImpl, {
|
|
295
|
+
...props,
|
|
296
|
+
ref: ref
|
|
297
|
+
})
|
|
298
|
+
});
|
|
289
299
|
});
|
|
290
300
|
|
|
291
301
|
// http://stackoverflow.com/questions/105034
|
|
@@ -421,7 +431,7 @@ function polyfills() {
|
|
|
421
431
|
texture.needsUpdate = true;
|
|
422
432
|
|
|
423
433
|
// Force non-DOM upload for EXGL texImage2D
|
|
424
|
-
// @ts-
|
|
434
|
+
// @ts-expect-error
|
|
425
435
|
texture.isDataTexture = true;
|
|
426
436
|
onLoad == null ? void 0 : onLoad(texture);
|
|
427
437
|
}).catch(onError);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-
|
|
2
|
-
export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/index-
|
|
3
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-ba8afaa4.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/index-ba8afaa4.esm.js';
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import * as THREE from 'three';
|
|
6
5
|
import { PanResponder, PixelRatio, View, StyleSheet, Platform, Image, NativeModules } from 'react-native';
|
|
7
6
|
import { GLView } from 'expo-gl';
|
|
8
7
|
import { FiberProvider, useContextBridge } 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';
|
|
@@ -226,31 +226,38 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
|
226
226
|
return onCreated == null ? void 0 : onCreated(state);
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
|
-
root.current.render( /*#__PURE__*/
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
root.current.render( /*#__PURE__*/jsx(Bridge, {
|
|
230
|
+
children: /*#__PURE__*/jsx(ErrorBoundary, {
|
|
231
|
+
set: setError,
|
|
232
|
+
children: /*#__PURE__*/jsx(React.Suspense, {
|
|
233
|
+
fallback: /*#__PURE__*/jsx(Block, {
|
|
234
|
+
set: setBlock
|
|
235
|
+
}),
|
|
236
|
+
children: children
|
|
237
|
+
})
|
|
234
238
|
})
|
|
235
|
-
}
|
|
239
|
+
}));
|
|
236
240
|
}
|
|
237
241
|
React.useEffect(() => {
|
|
238
242
|
if (canvas) {
|
|
239
243
|
return () => unmountComponentAtNode(canvas);
|
|
240
244
|
}
|
|
241
245
|
}, [canvas]);
|
|
242
|
-
return /*#__PURE__*/
|
|
246
|
+
return /*#__PURE__*/jsx(View, {
|
|
247
|
+
...props,
|
|
243
248
|
ref: viewRef,
|
|
244
249
|
onLayout: onLayout,
|
|
245
250
|
style: {
|
|
246
251
|
flex: 1,
|
|
247
252
|
...style
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
},
|
|
254
|
+
...bind,
|
|
255
|
+
children: width > 0 && /*#__PURE__*/jsx(GLView, {
|
|
256
|
+
msaaSamples: antialias ? 4 : 0,
|
|
257
|
+
onContextCreate: onContextCreate,
|
|
258
|
+
style: StyleSheet.absoluteFill
|
|
259
|
+
})
|
|
260
|
+
});
|
|
254
261
|
});
|
|
255
262
|
|
|
256
263
|
/**
|
|
@@ -258,9 +265,12 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(({
|
|
|
258
265
|
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
259
266
|
*/
|
|
260
267
|
const Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref) {
|
|
261
|
-
return /*#__PURE__*/
|
|
262
|
-
|
|
263
|
-
|
|
268
|
+
return /*#__PURE__*/jsx(FiberProvider, {
|
|
269
|
+
children: /*#__PURE__*/jsx(CanvasImpl, {
|
|
270
|
+
...props,
|
|
271
|
+
ref: ref
|
|
272
|
+
})
|
|
273
|
+
});
|
|
264
274
|
});
|
|
265
275
|
|
|
266
276
|
// http://stackoverflow.com/questions/105034
|
|
@@ -396,7 +406,7 @@ function polyfills() {
|
|
|
396
406
|
texture.needsUpdate = true;
|
|
397
407
|
|
|
398
408
|
// Force non-DOM upload for EXGL texImage2D
|
|
399
|
-
// @ts-
|
|
409
|
+
// @ts-expect-error
|
|
400
410
|
texture.isDataTexture = true;
|
|
401
411
|
onLoad == null ? void 0 : onLoad(texture);
|
|
402
412
|
}).catch(onError);
|
package/package.json
CHANGED
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
|
|