@react-three/fiber 8.4.1 → 8.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -4
- package/dist/{index-bcd3e47c.cjs.dev.js → index-08c4a2bb.cjs.dev.js} +15 -12
- package/dist/{index-e086bd20.cjs.prod.js → index-8826c241.cjs.prod.js} +15 -12
- package/dist/{index-212b30d8.esm.js → index-cf0284c7.esm.js} +15 -12
- 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,16 +1,22 @@
|
|
|
1
1
|
# @react-three/fiber
|
|
2
2
|
|
|
3
|
-
## 8.
|
|
3
|
+
## 8.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 85c80e70: eventsource and eventprefix on the canvas component
|
|
8
|
+
|
|
9
|
+
## 8.5.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
|
-
-
|
|
13
|
+
- 87821d9: fix: null-check instance.children on reconstruct
|
|
8
14
|
|
|
9
|
-
## 8.
|
|
15
|
+
## 8.5.0
|
|
10
16
|
|
|
11
17
|
### Minor Changes
|
|
12
18
|
|
|
13
|
-
-
|
|
19
|
+
- edc8252: feat: handle primitive children, auto-attach via instanceof
|
|
14
20
|
|
|
15
21
|
## 8.3.1
|
|
16
22
|
|
|
@@ -869,11 +869,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
869
869
|
...props
|
|
870
870
|
}, root) {
|
|
871
871
|
let name = `${type[0].toUpperCase()}${type.slice(1)}`;
|
|
872
|
-
let instance;
|
|
873
|
-
|
|
874
|
-
if (attach === undefined) {
|
|
875
|
-
if (name.endsWith('Geometry')) attach = 'geometry';else if (name.endsWith('Material')) attach = 'material';
|
|
876
|
-
}
|
|
872
|
+
let instance;
|
|
877
873
|
|
|
878
874
|
if (type === 'primitive') {
|
|
879
875
|
if (props.object === undefined) throw new Error("R3F: Primitives without 'object' are invalid!");
|
|
@@ -904,6 +900,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
904
900
|
args
|
|
905
901
|
}
|
|
906
902
|
});
|
|
903
|
+
} // Auto-attach geometries and materials
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
if (instance.__r3f.attach === undefined) {
|
|
907
|
+
if (instance instanceof THREE__namespace.BufferGeometry) instance.__r3f.attach = 'geometry';else if (instance instanceof THREE__namespace.Material) instance.__r3f.attach = 'material';
|
|
907
908
|
} // It should NOT call onUpdate on object instanciation, because it hasn't been added to the
|
|
908
909
|
// view yet. If the callback relies on references for instance, they won't be ready yet, this is
|
|
909
910
|
// why it passes "true" here
|
|
@@ -1043,11 +1044,13 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1043
1044
|
const newInstance = createInstance(type, newProps, instance.__r3f.root); // https://github.com/pmndrs/react-three-fiber/issues/1348
|
|
1044
1045
|
// When args change the instance has to be re-constructed, which then
|
|
1045
1046
|
// forces r3f to re-parent the children and non-scene objects
|
|
1046
|
-
// This can not include primitives, which should not have declarative children
|
|
1047
1047
|
|
|
1048
|
-
if (
|
|
1049
|
-
|
|
1050
|
-
|
|
1048
|
+
if (instance.children) {
|
|
1049
|
+
for (const child of instance.children) {
|
|
1050
|
+
if (child.__r3f) appendChild(newInstance, child);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
instance.children = instance.children.filter(child => !child.__r3f);
|
|
1051
1054
|
}
|
|
1052
1055
|
|
|
1053
1056
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
@@ -1169,11 +1172,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1169
1172
|
hideInstance(instance) {
|
|
1170
1173
|
var _instance$__r3f4;
|
|
1171
1174
|
|
|
1172
|
-
//
|
|
1175
|
+
// Detach while the instance is hidden
|
|
1173
1176
|
const {
|
|
1174
1177
|
attach: type,
|
|
1175
1178
|
parent
|
|
1176
|
-
} = (_instance$__r3f4 = instance
|
|
1179
|
+
} = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
|
|
1177
1180
|
if (type && parent) detach(parent, instance, type);
|
|
1178
1181
|
if (instance.isObject3D) instance.visible = false;
|
|
1179
1182
|
invalidateInstance(instance);
|
|
@@ -1186,7 +1189,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1186
1189
|
const {
|
|
1187
1190
|
attach: type,
|
|
1188
1191
|
parent
|
|
1189
|
-
} = (_instance$__r3f5 = instance
|
|
1192
|
+
} = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
|
|
1190
1193
|
if (type && parent) attach(parent, instance, type);
|
|
1191
1194
|
if (instance.isObject3D && props.visible == null || props.visible) instance.visible = true;
|
|
1192
1195
|
invalidateInstance(instance);
|
|
@@ -869,11 +869,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
869
869
|
...props
|
|
870
870
|
}, root) {
|
|
871
871
|
let name = `${type[0].toUpperCase()}${type.slice(1)}`;
|
|
872
|
-
let instance;
|
|
873
|
-
|
|
874
|
-
if (attach === undefined) {
|
|
875
|
-
if (name.endsWith('Geometry')) attach = 'geometry';else if (name.endsWith('Material')) attach = 'material';
|
|
876
|
-
}
|
|
872
|
+
let instance;
|
|
877
873
|
|
|
878
874
|
if (type === 'primitive') {
|
|
879
875
|
if (props.object === undefined) throw new Error("R3F: Primitives without 'object' are invalid!");
|
|
@@ -904,6 +900,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
904
900
|
args
|
|
905
901
|
}
|
|
906
902
|
});
|
|
903
|
+
} // Auto-attach geometries and materials
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
if (instance.__r3f.attach === undefined) {
|
|
907
|
+
if (instance instanceof THREE__namespace.BufferGeometry) instance.__r3f.attach = 'geometry';else if (instance instanceof THREE__namespace.Material) instance.__r3f.attach = 'material';
|
|
907
908
|
} // It should NOT call onUpdate on object instanciation, because it hasn't been added to the
|
|
908
909
|
// view yet. If the callback relies on references for instance, they won't be ready yet, this is
|
|
909
910
|
// why it passes "true" here
|
|
@@ -1043,11 +1044,13 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1043
1044
|
const newInstance = createInstance(type, newProps, instance.__r3f.root); // https://github.com/pmndrs/react-three-fiber/issues/1348
|
|
1044
1045
|
// When args change the instance has to be re-constructed, which then
|
|
1045
1046
|
// forces r3f to re-parent the children and non-scene objects
|
|
1046
|
-
// This can not include primitives, which should not have declarative children
|
|
1047
1047
|
|
|
1048
|
-
if (
|
|
1049
|
-
|
|
1050
|
-
|
|
1048
|
+
if (instance.children) {
|
|
1049
|
+
for (const child of instance.children) {
|
|
1050
|
+
if (child.__r3f) appendChild(newInstance, child);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
instance.children = instance.children.filter(child => !child.__r3f);
|
|
1051
1054
|
}
|
|
1052
1055
|
|
|
1053
1056
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
@@ -1169,11 +1172,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1169
1172
|
hideInstance(instance) {
|
|
1170
1173
|
var _instance$__r3f4;
|
|
1171
1174
|
|
|
1172
|
-
//
|
|
1175
|
+
// Detach while the instance is hidden
|
|
1173
1176
|
const {
|
|
1174
1177
|
attach: type,
|
|
1175
1178
|
parent
|
|
1176
|
-
} = (_instance$__r3f4 = instance
|
|
1179
|
+
} = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
|
|
1177
1180
|
if (type && parent) detach(parent, instance, type);
|
|
1178
1181
|
if (instance.isObject3D) instance.visible = false;
|
|
1179
1182
|
invalidateInstance(instance);
|
|
@@ -1186,7 +1189,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1186
1189
|
const {
|
|
1187
1190
|
attach: type,
|
|
1188
1191
|
parent
|
|
1189
|
-
} = (_instance$__r3f5 = instance
|
|
1192
|
+
} = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
|
|
1190
1193
|
if (type && parent) attach(parent, instance, type);
|
|
1191
1194
|
if (instance.isObject3D && props.visible == null || props.visible) instance.visible = true;
|
|
1192
1195
|
invalidateInstance(instance);
|
|
@@ -842,11 +842,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
842
842
|
...props
|
|
843
843
|
}, root) {
|
|
844
844
|
let name = `${type[0].toUpperCase()}${type.slice(1)}`;
|
|
845
|
-
let instance;
|
|
846
|
-
|
|
847
|
-
if (attach === undefined) {
|
|
848
|
-
if (name.endsWith('Geometry')) attach = 'geometry';else if (name.endsWith('Material')) attach = 'material';
|
|
849
|
-
}
|
|
845
|
+
let instance;
|
|
850
846
|
|
|
851
847
|
if (type === 'primitive') {
|
|
852
848
|
if (props.object === undefined) throw new Error("R3F: Primitives without 'object' are invalid!");
|
|
@@ -877,6 +873,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
877
873
|
args
|
|
878
874
|
}
|
|
879
875
|
});
|
|
876
|
+
} // Auto-attach geometries and materials
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
if (instance.__r3f.attach === undefined) {
|
|
880
|
+
if (instance instanceof THREE.BufferGeometry) instance.__r3f.attach = 'geometry';else if (instance instanceof THREE.Material) instance.__r3f.attach = 'material';
|
|
880
881
|
} // It should NOT call onUpdate on object instanciation, because it hasn't been added to the
|
|
881
882
|
// view yet. If the callback relies on references for instance, they won't be ready yet, this is
|
|
882
883
|
// why it passes "true" here
|
|
@@ -1016,11 +1017,13 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1016
1017
|
const newInstance = createInstance(type, newProps, instance.__r3f.root); // https://github.com/pmndrs/react-three-fiber/issues/1348
|
|
1017
1018
|
// When args change the instance has to be re-constructed, which then
|
|
1018
1019
|
// forces r3f to re-parent the children and non-scene objects
|
|
1019
|
-
// This can not include primitives, which should not have declarative children
|
|
1020
1020
|
|
|
1021
|
-
if (
|
|
1022
|
-
|
|
1023
|
-
|
|
1021
|
+
if (instance.children) {
|
|
1022
|
+
for (const child of instance.children) {
|
|
1023
|
+
if (child.__r3f) appendChild(newInstance, child);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
instance.children = instance.children.filter(child => !child.__r3f);
|
|
1024
1027
|
}
|
|
1025
1028
|
|
|
1026
1029
|
instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
|
|
@@ -1142,11 +1145,11 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1142
1145
|
hideInstance(instance) {
|
|
1143
1146
|
var _instance$__r3f4;
|
|
1144
1147
|
|
|
1145
|
-
//
|
|
1148
|
+
// Detach while the instance is hidden
|
|
1146
1149
|
const {
|
|
1147
1150
|
attach: type,
|
|
1148
1151
|
parent
|
|
1149
|
-
} = (_instance$__r3f4 = instance
|
|
1152
|
+
} = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
|
|
1150
1153
|
if (type && parent) detach(parent, instance, type);
|
|
1151
1154
|
if (instance.isObject3D) instance.visible = false;
|
|
1152
1155
|
invalidateInstance(instance);
|
|
@@ -1159,7 +1162,7 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
1159
1162
|
const {
|
|
1160
1163
|
attach: type,
|
|
1161
1164
|
parent
|
|
1162
|
-
} = (_instance$__r3f5 = instance
|
|
1165
|
+
} = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
|
|
1163
1166
|
if (type && parent) attach(parent, instance, type);
|
|
1164
1167
|
if (instance.isObject3D && props.visible == null || props.visible) instance.visible = true;
|
|
1165
1168
|
invalidateInstance(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-08c4a2bb.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -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-8826c241.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-
|
|
2
|
-
export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-cf0284c7.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, c as createEvents, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from './index-cf0284c7.esm.js';
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
@@ -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-08c4a2bb.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -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-8826c241.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-
|
|
2
|
-
export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from '../../dist/index-
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-cf0284c7.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, s as _roots, q as act, n as addAfterEffect, m as addEffect, o as addTail, l as advance, i as applyProps, f as context, g as createPortal, a as createRoot, j as dispose, e as extend, p as getRootState, k as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, x as useFrame, y as useGraph, z as useLoader, v as useStore, w as useThree } from '../../dist/index-cf0284c7.esm.js';
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|