@react-three/fiber 8.0.27 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/declarations/src/core/index.d.ts +2 -5
- package/dist/declarations/src/core/renderer.d.ts +2 -2
- package/dist/declarations/src/core/store.d.ts +3 -1
- package/dist/declarations/src/core/utils.d.ts +1 -1
- package/dist/declarations/src/three-types.d.ts +140 -138
- package/dist/{index-4f1a8e2f.esm.js → index-2e68c2a1.esm.js} +78 -44
- package/dist/{index-acc8c265.cjs.dev.js → index-6716e497.cjs.dev.js} +78 -44
- package/dist/{index-c30de6b8.cjs.prod.js → index-8296e46a.cjs.prod.js} +78 -44
- package/dist/react-three-fiber.cjs.dev.js +4 -10
- package/dist/react-three-fiber.cjs.prod.js +4 -10
- package/dist/react-three-fiber.esm.js +5 -11
- package/native/dist/react-three-fiber-native.cjs.dev.js +16 -6
- package/native/dist/react-three-fiber-native.cjs.prod.js +16 -6
- package/native/dist/react-three-fiber-native.esm.js +17 -7
- package/package.json +1 -1
|
@@ -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-2e68c2a1.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-2e68c2a1.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';
|
|
@@ -117,10 +117,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
117
117
|
// This will include the entire THREE namespace by default, users can extend
|
|
118
118
|
// their own elements by using the createRoot API instead
|
|
119
119
|
React.useMemo(() => extend(THREE), []);
|
|
120
|
-
const [containerRef, {
|
|
121
|
-
width,
|
|
122
|
-
height
|
|
123
|
-
}] = useMeasure({
|
|
120
|
+
const [containerRef, containerRect] = useMeasure({
|
|
124
121
|
scroll: true,
|
|
125
122
|
debounce: {
|
|
126
123
|
scroll: 50,
|
|
@@ -141,7 +138,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
141
138
|
if (error) throw error;
|
|
142
139
|
const root = React.useRef(null);
|
|
143
140
|
|
|
144
|
-
if (width > 0 && height > 0 && canvas) {
|
|
141
|
+
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
145
142
|
if (!root.current) root.current = createRoot(canvas);
|
|
146
143
|
root.current.configure({
|
|
147
144
|
gl,
|
|
@@ -156,10 +153,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
156
153
|
performance,
|
|
157
154
|
raycaster,
|
|
158
155
|
camera,
|
|
159
|
-
size:
|
|
160
|
-
width,
|
|
161
|
-
height
|
|
162
|
-
},
|
|
156
|
+
size: containerRect,
|
|
163
157
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
164
158
|
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
165
159
|
onCreated: state => {
|
|
@@ -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-6716e497.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -258,10 +258,14 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
258
258
|
React__namespace.useMemo(() => index.extend(THREE__namespace), []);
|
|
259
259
|
const [{
|
|
260
260
|
width,
|
|
261
|
-
height
|
|
261
|
+
height,
|
|
262
|
+
top,
|
|
263
|
+
left
|
|
262
264
|
}, setSize] = React__namespace.useState({
|
|
263
265
|
width: 0,
|
|
264
|
-
height: 0
|
|
266
|
+
height: 0,
|
|
267
|
+
top: 0,
|
|
268
|
+
left: 0
|
|
265
269
|
});
|
|
266
270
|
const [canvas, setCanvas] = React__namespace.useState(null);
|
|
267
271
|
const [bind, setBind] = React__namespace.useState();
|
|
@@ -280,11 +284,15 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
280
284
|
const onLayout = React__namespace.useCallback(e => {
|
|
281
285
|
const {
|
|
282
286
|
width,
|
|
283
|
-
height
|
|
287
|
+
height,
|
|
288
|
+
x,
|
|
289
|
+
y
|
|
284
290
|
} = e.nativeEvent.layout;
|
|
285
291
|
setSize({
|
|
286
292
|
width,
|
|
287
|
-
height
|
|
293
|
+
height,
|
|
294
|
+
top: y,
|
|
295
|
+
left: x
|
|
288
296
|
});
|
|
289
297
|
}, []); // Called on context create or swap
|
|
290
298
|
// https://github.com/pmndrs/react-three-fiber/pull/2297
|
|
@@ -321,7 +329,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
321
329
|
dpr: reactNative.PixelRatio.get(),
|
|
322
330
|
size: {
|
|
323
331
|
width,
|
|
324
|
-
height
|
|
332
|
+
height,
|
|
333
|
+
top,
|
|
334
|
+
left
|
|
325
335
|
},
|
|
326
336
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
327
337
|
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
@@ -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-8296e46a.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -258,10 +258,14 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
258
258
|
React__namespace.useMemo(() => index.extend(THREE__namespace), []);
|
|
259
259
|
const [{
|
|
260
260
|
width,
|
|
261
|
-
height
|
|
261
|
+
height,
|
|
262
|
+
top,
|
|
263
|
+
left
|
|
262
264
|
}, setSize] = React__namespace.useState({
|
|
263
265
|
width: 0,
|
|
264
|
-
height: 0
|
|
266
|
+
height: 0,
|
|
267
|
+
top: 0,
|
|
268
|
+
left: 0
|
|
265
269
|
});
|
|
266
270
|
const [canvas, setCanvas] = React__namespace.useState(null);
|
|
267
271
|
const [bind, setBind] = React__namespace.useState();
|
|
@@ -280,11 +284,15 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
280
284
|
const onLayout = React__namespace.useCallback(e => {
|
|
281
285
|
const {
|
|
282
286
|
width,
|
|
283
|
-
height
|
|
287
|
+
height,
|
|
288
|
+
x,
|
|
289
|
+
y
|
|
284
290
|
} = e.nativeEvent.layout;
|
|
285
291
|
setSize({
|
|
286
292
|
width,
|
|
287
|
-
height
|
|
293
|
+
height,
|
|
294
|
+
top: y,
|
|
295
|
+
left: x
|
|
288
296
|
});
|
|
289
297
|
}, []); // Called on context create or swap
|
|
290
298
|
// https://github.com/pmndrs/react-three-fiber/pull/2297
|
|
@@ -321,7 +329,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
321
329
|
dpr: reactNative.PixelRatio.get(),
|
|
322
330
|
size: {
|
|
323
331
|
width,
|
|
324
|
-
height
|
|
332
|
+
height,
|
|
333
|
+
top,
|
|
334
|
+
left
|
|
325
335
|
},
|
|
326
336
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
327
337
|
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
@@ -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-2e68c2a1.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-2e68c2a1.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';
|
|
@@ -231,10 +231,14 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
231
231
|
React.useMemo(() => extend(THREE), []);
|
|
232
232
|
const [{
|
|
233
233
|
width,
|
|
234
|
-
height
|
|
234
|
+
height,
|
|
235
|
+
top,
|
|
236
|
+
left
|
|
235
237
|
}, setSize] = React.useState({
|
|
236
238
|
width: 0,
|
|
237
|
-
height: 0
|
|
239
|
+
height: 0,
|
|
240
|
+
top: 0,
|
|
241
|
+
left: 0
|
|
238
242
|
});
|
|
239
243
|
const [canvas, setCanvas] = React.useState(null);
|
|
240
244
|
const [bind, setBind] = React.useState();
|
|
@@ -253,11 +257,15 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
253
257
|
const onLayout = React.useCallback(e => {
|
|
254
258
|
const {
|
|
255
259
|
width,
|
|
256
|
-
height
|
|
260
|
+
height,
|
|
261
|
+
x,
|
|
262
|
+
y
|
|
257
263
|
} = e.nativeEvent.layout;
|
|
258
264
|
setSize({
|
|
259
265
|
width,
|
|
260
|
-
height
|
|
266
|
+
height,
|
|
267
|
+
top: y,
|
|
268
|
+
left: x
|
|
261
269
|
});
|
|
262
270
|
}, []); // Called on context create or swap
|
|
263
271
|
// https://github.com/pmndrs/react-three-fiber/pull/2297
|
|
@@ -294,7 +302,9 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
294
302
|
dpr: PixelRatio.get(),
|
|
295
303
|
size: {
|
|
296
304
|
width,
|
|
297
|
-
height
|
|
305
|
+
height,
|
|
306
|
+
top,
|
|
307
|
+
left
|
|
298
308
|
},
|
|
299
309
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
300
310
|
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|