@react-three/fiber 8.12.2 → 8.13.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 +6 -0
- package/dist/declarations/src/core/events.d.ts +71 -71
- package/dist/declarations/src/core/hooks.d.ts +29 -29
- package/dist/declarations/src/core/index.d.ts +58 -58
- package/dist/declarations/src/core/loop.d.ts +14 -14
- package/dist/declarations/src/core/renderer.d.ts +58 -58
- package/dist/declarations/src/core/store.d.ts +95 -95
- package/dist/declarations/src/core/utils.d.ts +94 -89
- package/dist/declarations/src/index.d.ts +12 -12
- package/dist/declarations/src/native/Canvas.d.ts +10 -8
- package/dist/declarations/src/native/events.d.ts +4 -4
- package/dist/declarations/src/native/polyfills.d.ts +1 -1
- package/dist/declarations/src/native.d.ts +12 -12
- package/dist/declarations/src/three-types.d.ts +335 -335
- package/dist/declarations/src/web/Canvas.d.ts +13 -11
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/dist/{index-21bbaaf9.esm.js → index-22ee0173.esm.js} +31 -6
- package/dist/{index-1fcbd5a8.cjs.prod.js → index-ed22818c.cjs.prod.js} +31 -6
- package/dist/{index-ab4b9c97.cjs.dev.js → index-f4b96a62.cjs.dev.js} +31 -6
- 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
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
-
import { RenderProps } from '../core';
|
|
4
|
-
export interface
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
fallback?: React.ReactNode;
|
|
7
|
-
resize?: ResizeOptions;
|
|
8
|
-
eventSource?: HTMLElement | React.MutableRefObject<HTMLElement>;
|
|
9
|
-
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
10
|
-
}
|
|
11
|
-
export
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
+
import { RenderProps } from '../core';
|
|
4
|
+
export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
fallback?: React.ReactNode;
|
|
7
|
+
resize?: ResizeOptions;
|
|
8
|
+
eventSource?: HTMLElement | React.MutableRefObject<HTMLElement>;
|
|
9
|
+
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
10
|
+
}
|
|
11
|
+
export interface Props extends CanvasProps {
|
|
12
|
+
}
|
|
13
|
+
export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseBoundStore } from 'zustand';
|
|
2
|
-
import { RootState } from '../core/store';
|
|
3
|
-
import { EventManager } from '../core/events';
|
|
4
|
-
export declare function createPointerEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
|
|
1
|
+
import { UseBoundStore } from 'zustand';
|
|
2
|
+
import { RootState } from '../core/store';
|
|
3
|
+
import { EventManager } from '../core/events';
|
|
4
|
+
export declare function createPointerEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
|
|
@@ -350,6 +350,10 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
var _window$document, _window$navigator;
|
|
353
|
+
/**
|
|
354
|
+
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
355
|
+
*/
|
|
356
|
+
const hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;
|
|
353
357
|
/**
|
|
354
358
|
* The current THREE.ColorManagement instance, if present.
|
|
355
359
|
*/
|
|
@@ -635,6 +639,21 @@ function applyProps$1(instance, data) {
|
|
|
635
639
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
636
640
|
for (let i = 0; i < changes.length; i++) {
|
|
637
641
|
let [key, value, isEvent, keys] = changes[i];
|
|
642
|
+
|
|
643
|
+
// Alias (output)encoding => (output)colorSpace (since r152)
|
|
644
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2829
|
|
645
|
+
if (hasColorSpace(instance)) {
|
|
646
|
+
const sRGBEncoding = 3001;
|
|
647
|
+
const SRGBColorSpace = 'srgb';
|
|
648
|
+
const LinearSRGBColorSpace = 'srgb-linear';
|
|
649
|
+
if (key === 'encoding') {
|
|
650
|
+
key = 'colorSpace';
|
|
651
|
+
value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
652
|
+
} else if (key === 'outputEncoding') {
|
|
653
|
+
key = 'outputColorSpace';
|
|
654
|
+
value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
638
657
|
let currentInstance = instance;
|
|
639
658
|
let targetProp = currentInstance[key];
|
|
640
659
|
|
|
@@ -703,12 +722,14 @@ function applyProps$1(instance, data) {
|
|
|
703
722
|
// Else, just overwrite the value
|
|
704
723
|
} else {
|
|
705
724
|
currentInstance[key] = value;
|
|
725
|
+
|
|
706
726
|
// Auto-convert sRGB textures, for now ...
|
|
707
727
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
708
|
-
if (
|
|
728
|
+
if (currentInstance[key] instanceof THREE.Texture &&
|
|
709
729
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
710
730
|
currentInstance[key].format === THREE.RGBAFormat && currentInstance[key].type === THREE.UnsignedByteType) {
|
|
711
|
-
currentInstance[key]
|
|
731
|
+
const texture = currentInstance[key];
|
|
732
|
+
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
712
733
|
}
|
|
713
734
|
}
|
|
714
735
|
invalidateInstance(instance);
|
|
@@ -1888,10 +1909,14 @@ function createRoot(canvas) {
|
|
|
1888
1909
|
if (ColorManagement) {
|
|
1889
1910
|
if ('enabled' in ColorManagement) ColorManagement.enabled = !legacy;else if ('legacyMode' in ColorManagement) ColorManagement.legacyMode = legacy;
|
|
1890
1911
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1912
|
+
|
|
1913
|
+
// Set color space and tonemapping preferences
|
|
1914
|
+
const LinearEncoding = 3000;
|
|
1915
|
+
const sRGBEncoding = 3001;
|
|
1916
|
+
applyProps(gl, {
|
|
1917
|
+
outputEncoding: linear ? LinearEncoding : sRGBEncoding,
|
|
1918
|
+
toneMapping: flat ? THREE.NoToneMapping : THREE.ACESFilmicToneMapping
|
|
1919
|
+
});
|
|
1895
1920
|
|
|
1896
1921
|
// Update color management state
|
|
1897
1922
|
if (state.legacy !== legacy) state.set(() => ({
|
|
@@ -377,6 +377,10 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
var _window$document, _window$navigator;
|
|
380
|
+
/**
|
|
381
|
+
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
382
|
+
*/
|
|
383
|
+
const hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;
|
|
380
384
|
/**
|
|
381
385
|
* The current THREE.ColorManagement instance, if present.
|
|
382
386
|
*/
|
|
@@ -662,6 +666,21 @@ function applyProps$1(instance, data) {
|
|
|
662
666
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
663
667
|
for (let i = 0; i < changes.length; i++) {
|
|
664
668
|
let [key, value, isEvent, keys] = changes[i];
|
|
669
|
+
|
|
670
|
+
// Alias (output)encoding => (output)colorSpace (since r152)
|
|
671
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2829
|
|
672
|
+
if (hasColorSpace(instance)) {
|
|
673
|
+
const sRGBEncoding = 3001;
|
|
674
|
+
const SRGBColorSpace = 'srgb';
|
|
675
|
+
const LinearSRGBColorSpace = 'srgb-linear';
|
|
676
|
+
if (key === 'encoding') {
|
|
677
|
+
key = 'colorSpace';
|
|
678
|
+
value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
679
|
+
} else if (key === 'outputEncoding') {
|
|
680
|
+
key = 'outputColorSpace';
|
|
681
|
+
value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
665
684
|
let currentInstance = instance;
|
|
666
685
|
let targetProp = currentInstance[key];
|
|
667
686
|
|
|
@@ -730,12 +749,14 @@ function applyProps$1(instance, data) {
|
|
|
730
749
|
// Else, just overwrite the value
|
|
731
750
|
} else {
|
|
732
751
|
currentInstance[key] = value;
|
|
752
|
+
|
|
733
753
|
// Auto-convert sRGB textures, for now ...
|
|
734
754
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
735
|
-
if (
|
|
755
|
+
if (currentInstance[key] instanceof THREE__namespace.Texture &&
|
|
736
756
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
737
757
|
currentInstance[key].format === THREE__namespace.RGBAFormat && currentInstance[key].type === THREE__namespace.UnsignedByteType) {
|
|
738
|
-
currentInstance[key]
|
|
758
|
+
const texture = currentInstance[key];
|
|
759
|
+
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
739
760
|
}
|
|
740
761
|
}
|
|
741
762
|
invalidateInstance(instance);
|
|
@@ -1915,10 +1936,14 @@ function createRoot(canvas) {
|
|
|
1915
1936
|
if (ColorManagement) {
|
|
1916
1937
|
if ('enabled' in ColorManagement) ColorManagement.enabled = !legacy;else if ('legacyMode' in ColorManagement) ColorManagement.legacyMode = legacy;
|
|
1917
1938
|
}
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1939
|
+
|
|
1940
|
+
// Set color space and tonemapping preferences
|
|
1941
|
+
const LinearEncoding = 3000;
|
|
1942
|
+
const sRGBEncoding = 3001;
|
|
1943
|
+
applyProps(gl, {
|
|
1944
|
+
outputEncoding: linear ? LinearEncoding : sRGBEncoding,
|
|
1945
|
+
toneMapping: flat ? THREE__namespace.NoToneMapping : THREE__namespace.ACESFilmicToneMapping
|
|
1946
|
+
});
|
|
1922
1947
|
|
|
1923
1948
|
// Update color management state
|
|
1924
1949
|
if (state.legacy !== legacy) state.set(() => ({
|
|
@@ -377,6 +377,10 @@ function createRenderer(_roots, _getEventPriority) {
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
var _window$document, _window$navigator;
|
|
380
|
+
/**
|
|
381
|
+
* Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
|
|
382
|
+
*/
|
|
383
|
+
const hasColorSpace = object => 'colorSpace' in object || 'outputColorSpace' in object;
|
|
380
384
|
/**
|
|
381
385
|
* The current THREE.ColorManagement instance, if present.
|
|
382
386
|
*/
|
|
@@ -662,6 +666,21 @@ function applyProps$1(instance, data) {
|
|
|
662
666
|
if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
|
|
663
667
|
for (let i = 0; i < changes.length; i++) {
|
|
664
668
|
let [key, value, isEvent, keys] = changes[i];
|
|
669
|
+
|
|
670
|
+
// Alias (output)encoding => (output)colorSpace (since r152)
|
|
671
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2829
|
|
672
|
+
if (hasColorSpace(instance)) {
|
|
673
|
+
const sRGBEncoding = 3001;
|
|
674
|
+
const SRGBColorSpace = 'srgb';
|
|
675
|
+
const LinearSRGBColorSpace = 'srgb-linear';
|
|
676
|
+
if (key === 'encoding') {
|
|
677
|
+
key = 'colorSpace';
|
|
678
|
+
value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
679
|
+
} else if (key === 'outputEncoding') {
|
|
680
|
+
key = 'outputColorSpace';
|
|
681
|
+
value = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
665
684
|
let currentInstance = instance;
|
|
666
685
|
let targetProp = currentInstance[key];
|
|
667
686
|
|
|
@@ -730,12 +749,14 @@ function applyProps$1(instance, data) {
|
|
|
730
749
|
// Else, just overwrite the value
|
|
731
750
|
} else {
|
|
732
751
|
currentInstance[key] = value;
|
|
752
|
+
|
|
733
753
|
// Auto-convert sRGB textures, for now ...
|
|
734
754
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
735
|
-
if (
|
|
755
|
+
if (currentInstance[key] instanceof THREE__namespace.Texture &&
|
|
736
756
|
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
737
757
|
currentInstance[key].format === THREE__namespace.RGBAFormat && currentInstance[key].type === THREE__namespace.UnsignedByteType) {
|
|
738
|
-
currentInstance[key]
|
|
758
|
+
const texture = currentInstance[key];
|
|
759
|
+
if (hasColorSpace(texture) && hasColorSpace(rootState.gl)) texture.colorSpace = rootState.gl.outputColorSpace;else texture.encoding = rootState.gl.outputEncoding;
|
|
739
760
|
}
|
|
740
761
|
}
|
|
741
762
|
invalidateInstance(instance);
|
|
@@ -1915,10 +1936,14 @@ function createRoot(canvas) {
|
|
|
1915
1936
|
if (ColorManagement) {
|
|
1916
1937
|
if ('enabled' in ColorManagement) ColorManagement.enabled = !legacy;else if ('legacyMode' in ColorManagement) ColorManagement.legacyMode = legacy;
|
|
1917
1938
|
}
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1939
|
+
|
|
1940
|
+
// Set color space and tonemapping preferences
|
|
1941
|
+
const LinearEncoding = 3000;
|
|
1942
|
+
const sRGBEncoding = 3001;
|
|
1943
|
+
applyProps(gl, {
|
|
1944
|
+
outputEncoding: linear ? LinearEncoding : sRGBEncoding,
|
|
1945
|
+
toneMapping: flat ? THREE__namespace.NoToneMapping : THREE__namespace.ACESFilmicToneMapping
|
|
1946
|
+
});
|
|
1922
1947
|
|
|
1923
1948
|
// Update color management state
|
|
1924
1949
|
if (state.legacy !== legacy) state.set(() => ({
|
|
@@ -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-f4b96a62.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-ed22818c.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 useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './index-
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, 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, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z 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-22ee0173.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, 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, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from './index-22ee0173.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-f4b96a62.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-ed22818c.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, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, 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, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z 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-22ee0173.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, 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, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-22ee0173.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';
|