@react-three/fiber 8.16.5 → 8.16.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 +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 +0 -18
- package/dist/{index-81568a48.cjs.prod.js → index-4664c596.cjs.prod.js} +17 -19
- package/dist/{index-b552952e.esm.js → index-ba8afaa4.esm.js} +17 -19
- package/dist/{index-b1a4ae91.cjs.dev.js → index-f983265a.cjs.dev.js} +17 -19
- package/dist/react-three-fiber.cjs.dev.js +1 -1
- package/dist/react-three-fiber.cjs.prod.js +1 -1
- package/dist/react-three-fiber.esm.js +2 -2
- package/native/dist/react-three-fiber-native.cjs.dev.js +1 -1
- package/native/dist/react-three-fiber-native.cjs.prod.js +1 -1
- package/native/dist/react-three-fiber-native.esm.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
+
## 8.16.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4d6408c7: fix(types): revert usage of future module JSX
|
|
8
|
+
|
|
9
|
+
## 8.16.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 03ab82fe: fix(applyProps): null check indeterminate instances
|
|
14
|
+
|
|
3
15
|
## 8.16.5
|
|
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):
|
|
84
|
+
declare function createPortal(children: React.ReactNode, container: THREE.Object3D, state?: InjectState): 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,22 +390,4 @@ 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
|
-
}
|
|
411
393
|
export {};
|
|
@@ -613,7 +613,6 @@ function detach(parent, child, type) {
|
|
|
613
613
|
} else (_child$__r3f = child.__r3f) == null ? void 0 : _child$__r3f.previousAttach == null ? void 0 : _child$__r3f.previousAttach(parent, child);
|
|
614
614
|
(_child$__r3f2 = child.__r3f) == null ? true : delete _child$__r3f2.previousAttach;
|
|
615
615
|
}
|
|
616
|
-
|
|
617
616
|
// This function prepares a set of changes to be applied to the instance
|
|
618
617
|
function diffProps(instance, {
|
|
619
618
|
children: cN,
|
|
@@ -626,8 +625,7 @@ function diffProps(instance, {
|
|
|
626
625
|
ref: rP,
|
|
627
626
|
...previous
|
|
628
627
|
} = {}, remove = false) {
|
|
629
|
-
|
|
630
|
-
const localState = (_instance$__r3f = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f : {};
|
|
628
|
+
const localState = instance.__r3f;
|
|
631
629
|
const entries = Object.entries(props);
|
|
632
630
|
const changes = [];
|
|
633
631
|
|
|
@@ -639,9 +637,9 @@ function diffProps(instance, {
|
|
|
639
637
|
}
|
|
640
638
|
}
|
|
641
639
|
entries.forEach(([key, value]) => {
|
|
642
|
-
var _instance$
|
|
640
|
+
var _instance$__r3f;
|
|
643
641
|
// Bail out on primitive object
|
|
644
|
-
if ((_instance$
|
|
642
|
+
if ((_instance$__r3f = instance.__r3f) != null && _instance$__r3f.primitive && key === 'object') return;
|
|
645
643
|
// When props match bail out
|
|
646
644
|
if (is.equ(value, previous[key])) return;
|
|
647
645
|
// Collect handlers and bail out
|
|
@@ -660,8 +658,8 @@ function diffProps(instance, {
|
|
|
660
658
|
const memoized = {
|
|
661
659
|
...props
|
|
662
660
|
};
|
|
663
|
-
if (localState.memoizedProps && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
664
|
-
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;
|
|
665
663
|
return {
|
|
666
664
|
memoized,
|
|
667
665
|
changes
|
|
@@ -671,16 +669,16 @@ const __DEV__ = typeof process !== 'undefined' && "production" !== 'prod
|
|
|
671
669
|
|
|
672
670
|
// This function applies a set of changes to the instance
|
|
673
671
|
function applyProps$1(instance, data) {
|
|
674
|
-
var _instance$
|
|
672
|
+
var _instance$__r3f2;
|
|
675
673
|
// Filter equals, events and reserved props
|
|
676
|
-
const localState =
|
|
677
|
-
const root = localState.root;
|
|
678
|
-
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();
|
|
679
677
|
const {
|
|
680
678
|
memoized,
|
|
681
679
|
changes
|
|
682
680
|
} = isDiffSet(data) ? data : diffProps(instance, data);
|
|
683
|
-
const prevHandlers = localState.eventCount;
|
|
681
|
+
const prevHandlers = localState == null ? void 0 : localState.eventCount;
|
|
684
682
|
|
|
685
683
|
// Prepare memoized props
|
|
686
684
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
@@ -737,7 +735,7 @@ function applyProps$1(instance, data) {
|
|
|
737
735
|
}
|
|
738
736
|
|
|
739
737
|
// Deal with pointer events ...
|
|
740
|
-
if (isEvent) {
|
|
738
|
+
if (isEvent && localState) {
|
|
741
739
|
if (value) localState.handlers[key] = value;else delete localState.handlers[key];
|
|
742
740
|
localState.eventCount = Object.keys(localState.handlers).length;
|
|
743
741
|
}
|
|
@@ -769,7 +767,7 @@ function applyProps$1(instance, data) {
|
|
|
769
767
|
// For versions of three which don't support THREE.ColorManagement,
|
|
770
768
|
// Auto-convert sRGB colors
|
|
771
769
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
772
|
-
if (!getColorManagement() && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
770
|
+
if (!getColorManagement() && rootState && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
773
771
|
}
|
|
774
772
|
// Else, just overwrite the value
|
|
775
773
|
} else {
|
|
@@ -779,14 +777,14 @@ function applyProps$1(instance, data) {
|
|
|
779
777
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
780
778
|
if (currentInstance[key] instanceof THREE__namespace.Texture &&
|
|
781
779
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
782
|
-
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) {
|
|
783
781
|
const texture = currentInstance[key];
|
|
784
782
|
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
785
783
|
}
|
|
786
784
|
}
|
|
787
785
|
invalidateInstance(instance);
|
|
788
786
|
}
|
|
789
|
-
if (localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
787
|
+
if (localState && localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
790
788
|
// Get the initial root state's internals
|
|
791
789
|
const internal = findInitialRoot(instance).getState().internal;
|
|
792
790
|
// Pre-emptively remove the instance from the interaction manager
|
|
@@ -799,12 +797,12 @@ function applyProps$1(instance, data) {
|
|
|
799
797
|
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
800
798
|
// Skip updates to the `onUpdate` prop itself
|
|
801
799
|
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
802
|
-
if (!isCircular && changes.length && (_instance$
|
|
800
|
+
if (!isCircular && changes.length && (_instance$__r3f2 = instance.__r3f) != null && _instance$__r3f2.parent) updateInstance(instance);
|
|
803
801
|
return instance;
|
|
804
802
|
}
|
|
805
803
|
function invalidateInstance(instance) {
|
|
806
|
-
var _instance$
|
|
807
|
-
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();
|
|
808
806
|
if (state && state.internal.frames === 0) state.invalidate();
|
|
809
807
|
}
|
|
810
808
|
function updateInstance(instance) {
|
|
@@ -586,7 +586,6 @@ function detach(parent, child, type) {
|
|
|
586
586
|
} else (_child$__r3f = child.__r3f) == null ? void 0 : _child$__r3f.previousAttach == null ? void 0 : _child$__r3f.previousAttach(parent, child);
|
|
587
587
|
(_child$__r3f2 = child.__r3f) == null ? true : delete _child$__r3f2.previousAttach;
|
|
588
588
|
}
|
|
589
|
-
|
|
590
589
|
// This function prepares a set of changes to be applied to the instance
|
|
591
590
|
function diffProps(instance, {
|
|
592
591
|
children: cN,
|
|
@@ -599,8 +598,7 @@ function diffProps(instance, {
|
|
|
599
598
|
ref: rP,
|
|
600
599
|
...previous
|
|
601
600
|
} = {}, remove = false) {
|
|
602
|
-
|
|
603
|
-
const localState = (_instance$__r3f = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f : {};
|
|
601
|
+
const localState = instance.__r3f;
|
|
604
602
|
const entries = Object.entries(props);
|
|
605
603
|
const changes = [];
|
|
606
604
|
|
|
@@ -612,9 +610,9 @@ function diffProps(instance, {
|
|
|
612
610
|
}
|
|
613
611
|
}
|
|
614
612
|
entries.forEach(([key, value]) => {
|
|
615
|
-
var _instance$
|
|
613
|
+
var _instance$__r3f;
|
|
616
614
|
// Bail out on primitive object
|
|
617
|
-
if ((_instance$
|
|
615
|
+
if ((_instance$__r3f = instance.__r3f) != null && _instance$__r3f.primitive && key === 'object') return;
|
|
618
616
|
// When props match bail out
|
|
619
617
|
if (is.equ(value, previous[key])) return;
|
|
620
618
|
// Collect handlers and bail out
|
|
@@ -633,8 +631,8 @@ function diffProps(instance, {
|
|
|
633
631
|
const memoized = {
|
|
634
632
|
...props
|
|
635
633
|
};
|
|
636
|
-
if (localState.memoizedProps && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
637
|
-
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;
|
|
638
636
|
return {
|
|
639
637
|
memoized,
|
|
640
638
|
changes
|
|
@@ -644,16 +642,16 @@ const __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV !== 'prod
|
|
|
644
642
|
|
|
645
643
|
// This function applies a set of changes to the instance
|
|
646
644
|
function applyProps$1(instance, data) {
|
|
647
|
-
var _instance$
|
|
645
|
+
var _instance$__r3f2;
|
|
648
646
|
// Filter equals, events and reserved props
|
|
649
|
-
const localState =
|
|
650
|
-
const root = localState.root;
|
|
651
|
-
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();
|
|
652
650
|
const {
|
|
653
651
|
memoized,
|
|
654
652
|
changes
|
|
655
653
|
} = isDiffSet(data) ? data : diffProps(instance, data);
|
|
656
|
-
const prevHandlers = localState.eventCount;
|
|
654
|
+
const prevHandlers = localState == null ? void 0 : localState.eventCount;
|
|
657
655
|
|
|
658
656
|
// Prepare memoized props
|
|
659
657
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
@@ -710,7 +708,7 @@ function applyProps$1(instance, data) {
|
|
|
710
708
|
}
|
|
711
709
|
|
|
712
710
|
// Deal with pointer events ...
|
|
713
|
-
if (isEvent) {
|
|
711
|
+
if (isEvent && localState) {
|
|
714
712
|
if (value) localState.handlers[key] = value;else delete localState.handlers[key];
|
|
715
713
|
localState.eventCount = Object.keys(localState.handlers).length;
|
|
716
714
|
}
|
|
@@ -742,7 +740,7 @@ function applyProps$1(instance, data) {
|
|
|
742
740
|
// For versions of three which don't support THREE.ColorManagement,
|
|
743
741
|
// Auto-convert sRGB colors
|
|
744
742
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
745
|
-
if (!getColorManagement() && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
743
|
+
if (!getColorManagement() && rootState && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
746
744
|
}
|
|
747
745
|
// Else, just overwrite the value
|
|
748
746
|
} else {
|
|
@@ -752,14 +750,14 @@ function applyProps$1(instance, data) {
|
|
|
752
750
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
753
751
|
if (currentInstance[key] instanceof THREE.Texture &&
|
|
754
752
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
755
|
-
currentInstance[key].format === THREE.RGBAFormat && currentInstance[key].type === THREE.UnsignedByteType) {
|
|
753
|
+
currentInstance[key].format === THREE.RGBAFormat && currentInstance[key].type === THREE.UnsignedByteType && rootState) {
|
|
756
754
|
const texture = currentInstance[key];
|
|
757
755
|
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
758
756
|
}
|
|
759
757
|
}
|
|
760
758
|
invalidateInstance(instance);
|
|
761
759
|
}
|
|
762
|
-
if (localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
760
|
+
if (localState && localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
763
761
|
// Get the initial root state's internals
|
|
764
762
|
const internal = findInitialRoot(instance).getState().internal;
|
|
765
763
|
// Pre-emptively remove the instance from the interaction manager
|
|
@@ -772,12 +770,12 @@ function applyProps$1(instance, data) {
|
|
|
772
770
|
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
773
771
|
// Skip updates to the `onUpdate` prop itself
|
|
774
772
|
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
775
|
-
if (!isCircular && changes.length && (_instance$
|
|
773
|
+
if (!isCircular && changes.length && (_instance$__r3f2 = instance.__r3f) != null && _instance$__r3f2.parent) updateInstance(instance);
|
|
776
774
|
return instance;
|
|
777
775
|
}
|
|
778
776
|
function invalidateInstance(instance) {
|
|
779
|
-
var _instance$
|
|
780
|
-
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();
|
|
781
779
|
if (state && state.internal.frames === 0) state.invalidate();
|
|
782
780
|
}
|
|
783
781
|
function updateInstance(instance) {
|
|
@@ -613,7 +613,6 @@ function detach(parent, child, type) {
|
|
|
613
613
|
} else (_child$__r3f = child.__r3f) == null ? void 0 : _child$__r3f.previousAttach == null ? void 0 : _child$__r3f.previousAttach(parent, child);
|
|
614
614
|
(_child$__r3f2 = child.__r3f) == null ? true : delete _child$__r3f2.previousAttach;
|
|
615
615
|
}
|
|
616
|
-
|
|
617
616
|
// This function prepares a set of changes to be applied to the instance
|
|
618
617
|
function diffProps(instance, {
|
|
619
618
|
children: cN,
|
|
@@ -626,8 +625,7 @@ function diffProps(instance, {
|
|
|
626
625
|
ref: rP,
|
|
627
626
|
...previous
|
|
628
627
|
} = {}, remove = false) {
|
|
629
|
-
|
|
630
|
-
const localState = (_instance$__r3f = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f : {};
|
|
628
|
+
const localState = instance.__r3f;
|
|
631
629
|
const entries = Object.entries(props);
|
|
632
630
|
const changes = [];
|
|
633
631
|
|
|
@@ -639,9 +637,9 @@ function diffProps(instance, {
|
|
|
639
637
|
}
|
|
640
638
|
}
|
|
641
639
|
entries.forEach(([key, value]) => {
|
|
642
|
-
var _instance$
|
|
640
|
+
var _instance$__r3f;
|
|
643
641
|
// Bail out on primitive object
|
|
644
|
-
if ((_instance$
|
|
642
|
+
if ((_instance$__r3f = instance.__r3f) != null && _instance$__r3f.primitive && key === 'object') return;
|
|
645
643
|
// When props match bail out
|
|
646
644
|
if (is.equ(value, previous[key])) return;
|
|
647
645
|
// Collect handlers and bail out
|
|
@@ -660,8 +658,8 @@ function diffProps(instance, {
|
|
|
660
658
|
const memoized = {
|
|
661
659
|
...props
|
|
662
660
|
};
|
|
663
|
-
if (localState.memoizedProps && localState.memoizedProps.args) memoized.args = localState.memoizedProps.args;
|
|
664
|
-
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;
|
|
665
663
|
return {
|
|
666
664
|
memoized,
|
|
667
665
|
changes
|
|
@@ -671,16 +669,16 @@ const __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV !== 'prod
|
|
|
671
669
|
|
|
672
670
|
// This function applies a set of changes to the instance
|
|
673
671
|
function applyProps$1(instance, data) {
|
|
674
|
-
var _instance$
|
|
672
|
+
var _instance$__r3f2;
|
|
675
673
|
// Filter equals, events and reserved props
|
|
676
|
-
const localState =
|
|
677
|
-
const root = localState.root;
|
|
678
|
-
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();
|
|
679
677
|
const {
|
|
680
678
|
memoized,
|
|
681
679
|
changes
|
|
682
680
|
} = isDiffSet(data) ? data : diffProps(instance, data);
|
|
683
|
-
const prevHandlers = localState.eventCount;
|
|
681
|
+
const prevHandlers = localState == null ? void 0 : localState.eventCount;
|
|
684
682
|
|
|
685
683
|
// Prepare memoized props
|
|
686
684
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
@@ -737,7 +735,7 @@ function applyProps$1(instance, data) {
|
|
|
737
735
|
}
|
|
738
736
|
|
|
739
737
|
// Deal with pointer events ...
|
|
740
|
-
if (isEvent) {
|
|
738
|
+
if (isEvent && localState) {
|
|
741
739
|
if (value) localState.handlers[key] = value;else delete localState.handlers[key];
|
|
742
740
|
localState.eventCount = Object.keys(localState.handlers).length;
|
|
743
741
|
}
|
|
@@ -769,7 +767,7 @@ function applyProps$1(instance, data) {
|
|
|
769
767
|
// For versions of three which don't support THREE.ColorManagement,
|
|
770
768
|
// Auto-convert sRGB colors
|
|
771
769
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
772
|
-
if (!getColorManagement() && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
770
|
+
if (!getColorManagement() && rootState && !rootState.linear && isColor) targetProp.convertSRGBToLinear();
|
|
773
771
|
}
|
|
774
772
|
// Else, just overwrite the value
|
|
775
773
|
} else {
|
|
@@ -779,14 +777,14 @@ function applyProps$1(instance, data) {
|
|
|
779
777
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
780
778
|
if (currentInstance[key] instanceof THREE__namespace.Texture &&
|
|
781
779
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
782
|
-
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) {
|
|
783
781
|
const texture = currentInstance[key];
|
|
784
782
|
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
785
783
|
}
|
|
786
784
|
}
|
|
787
785
|
invalidateInstance(instance);
|
|
788
786
|
}
|
|
789
|
-
if (localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
787
|
+
if (localState && localState.parent && instance.raycast && prevHandlers !== localState.eventCount) {
|
|
790
788
|
// Get the initial root state's internals
|
|
791
789
|
const internal = findInitialRoot(instance).getState().internal;
|
|
792
790
|
// Pre-emptively remove the instance from the interaction manager
|
|
@@ -799,12 +797,12 @@ function applyProps$1(instance, data) {
|
|
|
799
797
|
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
800
798
|
// Skip updates to the `onUpdate` prop itself
|
|
801
799
|
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
802
|
-
if (!isCircular && changes.length && (_instance$
|
|
800
|
+
if (!isCircular && changes.length && (_instance$__r3f2 = instance.__r3f) != null && _instance$__r3f2.parent) updateInstance(instance);
|
|
803
801
|
return instance;
|
|
804
802
|
}
|
|
805
803
|
function invalidateInstance(instance) {
|
|
806
|
-
var _instance$
|
|
807
|
-
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();
|
|
808
806
|
if (state && state.internal.frames === 0) state.invalidate();
|
|
809
807
|
}
|
|
810
808
|
function updateInstance(instance) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-f983265a.cjs.dev.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var useMeasure = require('react-use-measure');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-4664c596.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var useMeasure = require('react-use-measure');
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import useMeasure from 'react-use-measure';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-f983265a.cjs.dev.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var reactNative = require('react-native');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-4664c596.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var reactNative = require('react-native');
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { PanResponder, PixelRatio, View, StyleSheet, Platform, Image, NativeModules } from 'react-native';
|