@react-three/fiber 8.2.2 → 8.2.3
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 +6 -0
- package/dist/declarations/src/core/hooks.d.ts +2 -1
- package/dist/{index-876a6569.cjs.prod.js → index-1be7d4d7.cjs.prod.js} +37 -15
- package/dist/{index-af244448.esm.js → index-201bf0bf.esm.js} +37 -15
- package/dist/{index-2a5b06d3.cjs.dev.js → index-942a305b.cjs.dev.js} +37 -15
- 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 +3 -1
- package/native/dist/react-three-fiber-native.cjs.prod.js +3 -1
- package/native/dist/react-three-fiber-native.esm.js +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,7 @@ import { StateSelector, EqualityChecker } from 'zustand';
|
|
|
3
3
|
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
4
4
|
import { RootState, RenderCallback } from './store';
|
|
5
5
|
import { ObjectMap } from './utils';
|
|
6
|
+
import { LoadingManager } from 'three';
|
|
6
7
|
export interface Loader<T> extends THREE.Loader {
|
|
7
8
|
load(url: string, onLoad?: (result: T) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): unknown;
|
|
8
9
|
}
|
|
@@ -14,7 +15,7 @@ export declare function useStore(): import("zustand").UseBoundStore<RootState, i
|
|
|
14
15
|
export declare function useThree<T = RootState>(selector?: StateSelector<RootState, T>, equalityFn?: EqualityChecker<T>): T;
|
|
15
16
|
export declare function useFrame(callback: RenderCallback, renderPriority?: number): null;
|
|
16
17
|
export declare function useGraph(object: THREE.Object3D): ObjectMap;
|
|
17
|
-
export declare function useLoader<T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U, extensions?: Extensions, onProgress?: (event: ProgressEvent<EventTarget>) => void): U extends any[] ? BranchingReturn<T, GLTF, GLTF & ObjectMap>[] : BranchingReturn<T, GLTF, GLTF & ObjectMap>;
|
|
18
|
+
export declare function useLoader<T, U extends string | string[]>(Proto: new (manager?: LoadingManager) => LoaderResult<T>, input: U, extensions?: Extensions, onProgress?: (event: ProgressEvent<EventTarget>) => void): U extends any[] ? BranchingReturn<T, GLTF, GLTF & ObjectMap>[] : BranchingReturn<T, GLTF, GLTF & ObjectMap>;
|
|
18
19
|
export declare namespace useLoader {
|
|
19
20
|
var preload: <T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U, extensions?: Extensions | undefined) => undefined;
|
|
20
21
|
var clear: <T, U extends string | string[]>(Proto: new () => LoaderResult<T>, input: U) => void;
|
|
@@ -1700,11 +1700,43 @@ const createRendererInstance = (gl, canvas) => {
|
|
|
1700
1700
|
});
|
|
1701
1701
|
};
|
|
1702
1702
|
|
|
1703
|
+
function isCanvas(maybeCanvas) {
|
|
1704
|
+
return maybeCanvas instanceof HTMLCanvasElement;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
function computeInitialSize(canvas, defaultSize) {
|
|
1708
|
+
if (defaultSize) {
|
|
1709
|
+
return defaultSize;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
if (isCanvas(canvas) && canvas.parentElement) {
|
|
1713
|
+
const {
|
|
1714
|
+
width,
|
|
1715
|
+
height,
|
|
1716
|
+
top,
|
|
1717
|
+
left
|
|
1718
|
+
} = canvas.parentElement.getBoundingClientRect();
|
|
1719
|
+
return {
|
|
1720
|
+
width,
|
|
1721
|
+
height,
|
|
1722
|
+
top,
|
|
1723
|
+
left
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
return {
|
|
1728
|
+
width: 0,
|
|
1729
|
+
height: 0,
|
|
1730
|
+
top: 0,
|
|
1731
|
+
left: 0
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1703
1735
|
function createRoot(canvas) {
|
|
1704
1736
|
// Check against mistaken use of createRoot
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1737
|
+
const prevRoot = roots.get(canvas);
|
|
1738
|
+
const prevFiber = prevRoot == null ? void 0 : prevRoot.fiber;
|
|
1739
|
+
const prevStore = prevRoot == null ? void 0 : prevRoot.store;
|
|
1708
1740
|
if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Report when an error was detected in a previous render
|
|
1709
1741
|
// https://github.com/pmndrs/react-three-fiber/pull/2261
|
|
1710
1742
|
|
|
@@ -1728,7 +1760,7 @@ function createRoot(canvas) {
|
|
|
1728
1760
|
configure(props = {}) {
|
|
1729
1761
|
let {
|
|
1730
1762
|
gl: glConfig,
|
|
1731
|
-
size,
|
|
1763
|
+
size: propsSize,
|
|
1732
1764
|
events,
|
|
1733
1765
|
onCreated: onCreatedCallback,
|
|
1734
1766
|
shadows = false,
|
|
@@ -1863,17 +1895,7 @@ function createRoot(canvas) {
|
|
|
1863
1895
|
|
|
1864
1896
|
if (dpr && state.viewport.dpr !== calculateDpr(dpr)) state.setDpr(dpr); // Check size, allow it to take on container bounds initially
|
|
1865
1897
|
|
|
1866
|
-
size =
|
|
1867
|
-
width: canvas.parentElement.clientWidth,
|
|
1868
|
-
height: canvas.parentElement.clientHeight,
|
|
1869
|
-
top: canvas.parentElement.clientTop,
|
|
1870
|
-
left: canvas.parentElement.clientLeft
|
|
1871
|
-
} : {
|
|
1872
|
-
width: 0,
|
|
1873
|
-
height: 0,
|
|
1874
|
-
top: 0,
|
|
1875
|
-
left: 0
|
|
1876
|
-
});
|
|
1898
|
+
const size = computeInitialSize(canvas, propsSize);
|
|
1877
1899
|
|
|
1878
1900
|
if (!is.equ(size, state.size, shallowLoose)) {
|
|
1879
1901
|
state.setSize(size.width, size.height, size.updateStyle, size.top, size.left);
|
|
@@ -1673,11 +1673,43 @@ const createRendererInstance = (gl, canvas) => {
|
|
|
1673
1673
|
});
|
|
1674
1674
|
};
|
|
1675
1675
|
|
|
1676
|
+
function isCanvas(maybeCanvas) {
|
|
1677
|
+
return maybeCanvas instanceof HTMLCanvasElement;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
function computeInitialSize(canvas, defaultSize) {
|
|
1681
|
+
if (defaultSize) {
|
|
1682
|
+
return defaultSize;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
if (isCanvas(canvas) && canvas.parentElement) {
|
|
1686
|
+
const {
|
|
1687
|
+
width,
|
|
1688
|
+
height,
|
|
1689
|
+
top,
|
|
1690
|
+
left
|
|
1691
|
+
} = canvas.parentElement.getBoundingClientRect();
|
|
1692
|
+
return {
|
|
1693
|
+
width,
|
|
1694
|
+
height,
|
|
1695
|
+
top,
|
|
1696
|
+
left
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
return {
|
|
1701
|
+
width: 0,
|
|
1702
|
+
height: 0,
|
|
1703
|
+
top: 0,
|
|
1704
|
+
left: 0
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1676
1708
|
function createRoot(canvas) {
|
|
1677
1709
|
// Check against mistaken use of createRoot
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1710
|
+
const prevRoot = roots.get(canvas);
|
|
1711
|
+
const prevFiber = prevRoot == null ? void 0 : prevRoot.fiber;
|
|
1712
|
+
const prevStore = prevRoot == null ? void 0 : prevRoot.store;
|
|
1681
1713
|
if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Report when an error was detected in a previous render
|
|
1682
1714
|
// https://github.com/pmndrs/react-three-fiber/pull/2261
|
|
1683
1715
|
|
|
@@ -1701,7 +1733,7 @@ function createRoot(canvas) {
|
|
|
1701
1733
|
configure(props = {}) {
|
|
1702
1734
|
let {
|
|
1703
1735
|
gl: glConfig,
|
|
1704
|
-
size,
|
|
1736
|
+
size: propsSize,
|
|
1705
1737
|
events,
|
|
1706
1738
|
onCreated: onCreatedCallback,
|
|
1707
1739
|
shadows = false,
|
|
@@ -1836,17 +1868,7 @@ function createRoot(canvas) {
|
|
|
1836
1868
|
|
|
1837
1869
|
if (dpr && state.viewport.dpr !== calculateDpr(dpr)) state.setDpr(dpr); // Check size, allow it to take on container bounds initially
|
|
1838
1870
|
|
|
1839
|
-
size =
|
|
1840
|
-
width: canvas.parentElement.clientWidth,
|
|
1841
|
-
height: canvas.parentElement.clientHeight,
|
|
1842
|
-
top: canvas.parentElement.clientTop,
|
|
1843
|
-
left: canvas.parentElement.clientLeft
|
|
1844
|
-
} : {
|
|
1845
|
-
width: 0,
|
|
1846
|
-
height: 0,
|
|
1847
|
-
top: 0,
|
|
1848
|
-
left: 0
|
|
1849
|
-
});
|
|
1871
|
+
const size = computeInitialSize(canvas, propsSize);
|
|
1850
1872
|
|
|
1851
1873
|
if (!is.equ(size, state.size, shallowLoose)) {
|
|
1852
1874
|
state.setSize(size.width, size.height, size.updateStyle, size.top, size.left);
|
|
@@ -1700,11 +1700,43 @@ const createRendererInstance = (gl, canvas) => {
|
|
|
1700
1700
|
});
|
|
1701
1701
|
};
|
|
1702
1702
|
|
|
1703
|
+
function isCanvas(maybeCanvas) {
|
|
1704
|
+
return maybeCanvas instanceof HTMLCanvasElement;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
function computeInitialSize(canvas, defaultSize) {
|
|
1708
|
+
if (defaultSize) {
|
|
1709
|
+
return defaultSize;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
if (isCanvas(canvas) && canvas.parentElement) {
|
|
1713
|
+
const {
|
|
1714
|
+
width,
|
|
1715
|
+
height,
|
|
1716
|
+
top,
|
|
1717
|
+
left
|
|
1718
|
+
} = canvas.parentElement.getBoundingClientRect();
|
|
1719
|
+
return {
|
|
1720
|
+
width,
|
|
1721
|
+
height,
|
|
1722
|
+
top,
|
|
1723
|
+
left
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
return {
|
|
1728
|
+
width: 0,
|
|
1729
|
+
height: 0,
|
|
1730
|
+
top: 0,
|
|
1731
|
+
left: 0
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1703
1735
|
function createRoot(canvas) {
|
|
1704
1736
|
// Check against mistaken use of createRoot
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1737
|
+
const prevRoot = roots.get(canvas);
|
|
1738
|
+
const prevFiber = prevRoot == null ? void 0 : prevRoot.fiber;
|
|
1739
|
+
const prevStore = prevRoot == null ? void 0 : prevRoot.store;
|
|
1708
1740
|
if (prevRoot) console.warn('R3F.createRoot should only be called once!'); // Report when an error was detected in a previous render
|
|
1709
1741
|
// https://github.com/pmndrs/react-three-fiber/pull/2261
|
|
1710
1742
|
|
|
@@ -1728,7 +1760,7 @@ function createRoot(canvas) {
|
|
|
1728
1760
|
configure(props = {}) {
|
|
1729
1761
|
let {
|
|
1730
1762
|
gl: glConfig,
|
|
1731
|
-
size,
|
|
1763
|
+
size: propsSize,
|
|
1732
1764
|
events,
|
|
1733
1765
|
onCreated: onCreatedCallback,
|
|
1734
1766
|
shadows = false,
|
|
@@ -1863,17 +1895,7 @@ function createRoot(canvas) {
|
|
|
1863
1895
|
|
|
1864
1896
|
if (dpr && state.viewport.dpr !== calculateDpr(dpr)) state.setDpr(dpr); // Check size, allow it to take on container bounds initially
|
|
1865
1897
|
|
|
1866
|
-
size =
|
|
1867
|
-
width: canvas.parentElement.clientWidth,
|
|
1868
|
-
height: canvas.parentElement.clientHeight,
|
|
1869
|
-
top: canvas.parentElement.clientTop,
|
|
1870
|
-
left: canvas.parentElement.clientLeft
|
|
1871
|
-
} : {
|
|
1872
|
-
width: 0,
|
|
1873
|
-
height: 0,
|
|
1874
|
-
top: 0,
|
|
1875
|
-
left: 0
|
|
1876
|
-
});
|
|
1898
|
+
const size = computeInitialSize(canvas, propsSize);
|
|
1877
1899
|
|
|
1878
1900
|
if (!is.equ(size, state.size, shallowLoose)) {
|
|
1879
1901
|
state.setSize(size.width, size.height, size.updateStyle, size.top, size.left);
|
|
@@ -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-942a305b.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-1be7d4d7.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-201bf0bf.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-201bf0bf.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-942a305b.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -39,6 +39,8 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
39
39
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
40
40
|
var Pressability__default = /*#__PURE__*/_interopDefault(Pressability);
|
|
41
41
|
|
|
42
|
+
/* eslint-enable import/default, import/no-named-as-default, import/no-named-as-default-member */
|
|
43
|
+
|
|
42
44
|
const EVENTS = {
|
|
43
45
|
PRESS: 'onPress',
|
|
44
46
|
PRESSIN: 'onPressIn',
|
|
@@ -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-1be7d4d7.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -39,6 +39,8 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
39
39
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
40
40
|
var Pressability__default = /*#__PURE__*/_interopDefault(Pressability);
|
|
41
41
|
|
|
42
|
+
/* eslint-enable import/default, import/no-named-as-default, import/no-named-as-default-member */
|
|
43
|
+
|
|
42
44
|
const EVENTS = {
|
|
43
45
|
PRESS: 'onPress',
|
|
44
46
|
PRESSIN: 'onPressIn',
|
|
@@ -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-201bf0bf.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-201bf0bf.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';
|
|
@@ -12,6 +12,8 @@ import 'react-reconciler';
|
|
|
12
12
|
import 'scheduler';
|
|
13
13
|
import 'suspend-react';
|
|
14
14
|
|
|
15
|
+
/* eslint-enable import/default, import/no-named-as-default, import/no-named-as-default-member */
|
|
16
|
+
|
|
15
17
|
const EVENTS = {
|
|
16
18
|
PRESS: 'onPress',
|
|
17
19
|
PRESSIN: 'onPressIn',
|