@react-three/fiber 8.11.0 → 8.11.2
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/events.d.ts +71 -71
- package/dist/declarations/src/core/hooks.d.ts +29 -29
- package/dist/declarations/src/core/index.d.ts +55 -55
- package/dist/declarations/src/core/loop.d.ts +14 -14
- package/dist/declarations/src/core/renderer.d.ts +52 -52
- package/dist/declarations/src/core/store.d.ts +95 -95
- package/dist/declarations/src/core/utils.d.ts +84 -83
- package/dist/declarations/src/index.d.ts +12 -12
- package/dist/declarations/src/native/Canvas.d.ts +8 -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 +11 -11
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/dist/{index-7dbf758c.esm.js → index-3c94c6e9.esm.js} +16 -10
- package/dist/{index-6442a2a3.cjs.dev.js → index-b2f18198.cjs.dev.js} +16 -10
- package/dist/{index-455b51ca.cjs.prod.js → index-ce6281d5.cjs.prod.js} +16 -10
- 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,11 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
-
import { RenderProps } from '../core';
|
|
4
|
-
export interface Props 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 declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
+
import { RenderProps } from '../core';
|
|
4
|
+
export interface Props 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 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>;
|
|
@@ -56,6 +56,7 @@ ErrorBoundary.getDerivedStateFromError = () => ({
|
|
|
56
56
|
error: true
|
|
57
57
|
});
|
|
58
58
|
const DEFAULT = '__default';
|
|
59
|
+
const DEFAULTS = new Map();
|
|
59
60
|
const isDiffSet = def => def && !!def.memoized && !!def.changes;
|
|
60
61
|
function calculateDpr(dpr) {
|
|
61
62
|
const target = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
@@ -293,13 +294,14 @@ function applyProps$1(instance, data) {
|
|
|
293
294
|
// For removed props, try to set default values, if possible
|
|
294
295
|
if (value === DEFAULT + 'remove') {
|
|
295
296
|
if (currentInstance.constructor) {
|
|
296
|
-
var _currentInstance$__r;
|
|
297
297
|
// create a blank slate of the instance and copy the particular parameter.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
298
|
+
let ctor = DEFAULTS.get(currentInstance.constructor);
|
|
299
|
+
if (!ctor) {
|
|
300
|
+
// @ts-ignore
|
|
301
|
+
ctor = new currentInstance.constructor();
|
|
302
|
+
DEFAULTS.set(currentInstance.constructor, ctor);
|
|
303
|
+
}
|
|
304
|
+
value = ctor[key];
|
|
303
305
|
} else {
|
|
304
306
|
// instance does not have constructor, just set it to 0
|
|
305
307
|
value = 0;
|
|
@@ -318,7 +320,7 @@ function applyProps$1(instance, data) {
|
|
|
318
320
|
if (targetProp.fromArray) targetProp.fromArray(value);else targetProp.set(...value);
|
|
319
321
|
}
|
|
320
322
|
// Test again target.copy(class) next ...
|
|
321
|
-
else if (targetProp.copy && value && value.constructor && targetProp.constructor
|
|
323
|
+
else if (targetProp.copy && value && value.constructor && targetProp.constructor === value.constructor) {
|
|
322
324
|
targetProp.copy(value);
|
|
323
325
|
}
|
|
324
326
|
// If nothing else fits, just set the single value, ignore undefined
|
|
@@ -342,7 +344,9 @@ function applyProps$1(instance, data) {
|
|
|
342
344
|
currentInstance[key] = value;
|
|
343
345
|
// Auto-convert sRGB textures, for now ...
|
|
344
346
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
345
|
-
if (!rootState.linear && currentInstance[key] instanceof THREE.Texture
|
|
347
|
+
if (!rootState.linear && currentInstance[key] instanceof THREE.Texture &&
|
|
348
|
+
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
349
|
+
currentInstance[key].format === THREE.RGBAFormat && currentInstance[key].type === THREE.UnsignedByteType) {
|
|
346
350
|
currentInstance[key].encoding = THREE.sRGBEncoding;
|
|
347
351
|
}
|
|
348
352
|
}
|
|
@@ -356,8 +360,10 @@ function applyProps$1(instance, data) {
|
|
|
356
360
|
if (localState.eventCount) rootState.internal.interaction.push(instance);
|
|
357
361
|
}
|
|
358
362
|
|
|
359
|
-
// Call the update lifecycle when it is being updated, but only when it is part of the scene
|
|
360
|
-
|
|
363
|
+
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
364
|
+
// Skip updates to the `onUpdate` prop itself
|
|
365
|
+
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
366
|
+
if (!isCircular && changes.length && (_instance$__r3f4 = instance.__r3f) != null && _instance$__r3f4.parent) updateInstance(instance);
|
|
361
367
|
return instance;
|
|
362
368
|
}
|
|
363
369
|
function invalidateInstance(instance) {
|
|
@@ -83,6 +83,7 @@ ErrorBoundary.getDerivedStateFromError = () => ({
|
|
|
83
83
|
error: true
|
|
84
84
|
});
|
|
85
85
|
const DEFAULT = '__default';
|
|
86
|
+
const DEFAULTS = new Map();
|
|
86
87
|
const isDiffSet = def => def && !!def.memoized && !!def.changes;
|
|
87
88
|
function calculateDpr(dpr) {
|
|
88
89
|
const target = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
@@ -320,13 +321,14 @@ function applyProps$1(instance, data) {
|
|
|
320
321
|
// For removed props, try to set default values, if possible
|
|
321
322
|
if (value === DEFAULT + 'remove') {
|
|
322
323
|
if (currentInstance.constructor) {
|
|
323
|
-
var _currentInstance$__r;
|
|
324
324
|
// create a blank slate of the instance and copy the particular parameter.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
325
|
+
let ctor = DEFAULTS.get(currentInstance.constructor);
|
|
326
|
+
if (!ctor) {
|
|
327
|
+
// @ts-ignore
|
|
328
|
+
ctor = new currentInstance.constructor();
|
|
329
|
+
DEFAULTS.set(currentInstance.constructor, ctor);
|
|
330
|
+
}
|
|
331
|
+
value = ctor[key];
|
|
330
332
|
} else {
|
|
331
333
|
// instance does not have constructor, just set it to 0
|
|
332
334
|
value = 0;
|
|
@@ -345,7 +347,7 @@ function applyProps$1(instance, data) {
|
|
|
345
347
|
if (targetProp.fromArray) targetProp.fromArray(value);else targetProp.set(...value);
|
|
346
348
|
}
|
|
347
349
|
// Test again target.copy(class) next ...
|
|
348
|
-
else if (targetProp.copy && value && value.constructor && targetProp.constructor
|
|
350
|
+
else if (targetProp.copy && value && value.constructor && targetProp.constructor === value.constructor) {
|
|
349
351
|
targetProp.copy(value);
|
|
350
352
|
}
|
|
351
353
|
// If nothing else fits, just set the single value, ignore undefined
|
|
@@ -369,7 +371,9 @@ function applyProps$1(instance, data) {
|
|
|
369
371
|
currentInstance[key] = value;
|
|
370
372
|
// Auto-convert sRGB textures, for now ...
|
|
371
373
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
372
|
-
if (!rootState.linear && currentInstance[key] instanceof THREE__namespace.Texture
|
|
374
|
+
if (!rootState.linear && currentInstance[key] instanceof THREE__namespace.Texture &&
|
|
375
|
+
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
376
|
+
currentInstance[key].format === THREE__namespace.RGBAFormat && currentInstance[key].type === THREE__namespace.UnsignedByteType) {
|
|
373
377
|
currentInstance[key].encoding = THREE__namespace.sRGBEncoding;
|
|
374
378
|
}
|
|
375
379
|
}
|
|
@@ -383,8 +387,10 @@ function applyProps$1(instance, data) {
|
|
|
383
387
|
if (localState.eventCount) rootState.internal.interaction.push(instance);
|
|
384
388
|
}
|
|
385
389
|
|
|
386
|
-
// Call the update lifecycle when it is being updated, but only when it is part of the scene
|
|
387
|
-
|
|
390
|
+
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
391
|
+
// Skip updates to the `onUpdate` prop itself
|
|
392
|
+
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
393
|
+
if (!isCircular && changes.length && (_instance$__r3f4 = instance.__r3f) != null && _instance$__r3f4.parent) updateInstance(instance);
|
|
388
394
|
return instance;
|
|
389
395
|
}
|
|
390
396
|
function invalidateInstance(instance) {
|
|
@@ -83,6 +83,7 @@ ErrorBoundary.getDerivedStateFromError = () => ({
|
|
|
83
83
|
error: true
|
|
84
84
|
});
|
|
85
85
|
const DEFAULT = '__default';
|
|
86
|
+
const DEFAULTS = new Map();
|
|
86
87
|
const isDiffSet = def => def && !!def.memoized && !!def.changes;
|
|
87
88
|
function calculateDpr(dpr) {
|
|
88
89
|
const target = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
@@ -320,13 +321,14 @@ function applyProps$1(instance, data) {
|
|
|
320
321
|
// For removed props, try to set default values, if possible
|
|
321
322
|
if (value === DEFAULT + 'remove') {
|
|
322
323
|
if (currentInstance.constructor) {
|
|
323
|
-
var _currentInstance$__r;
|
|
324
324
|
// create a blank slate of the instance and copy the particular parameter.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
325
|
+
let ctor = DEFAULTS.get(currentInstance.constructor);
|
|
326
|
+
if (!ctor) {
|
|
327
|
+
// @ts-ignore
|
|
328
|
+
ctor = new currentInstance.constructor();
|
|
329
|
+
DEFAULTS.set(currentInstance.constructor, ctor);
|
|
330
|
+
}
|
|
331
|
+
value = ctor[key];
|
|
330
332
|
} else {
|
|
331
333
|
// instance does not have constructor, just set it to 0
|
|
332
334
|
value = 0;
|
|
@@ -345,7 +347,7 @@ function applyProps$1(instance, data) {
|
|
|
345
347
|
if (targetProp.fromArray) targetProp.fromArray(value);else targetProp.set(...value);
|
|
346
348
|
}
|
|
347
349
|
// Test again target.copy(class) next ...
|
|
348
|
-
else if (targetProp.copy && value && value.constructor && targetProp.constructor
|
|
350
|
+
else if (targetProp.copy && value && value.constructor && targetProp.constructor === value.constructor) {
|
|
349
351
|
targetProp.copy(value);
|
|
350
352
|
}
|
|
351
353
|
// If nothing else fits, just set the single value, ignore undefined
|
|
@@ -369,7 +371,9 @@ function applyProps$1(instance, data) {
|
|
|
369
371
|
currentInstance[key] = value;
|
|
370
372
|
// Auto-convert sRGB textures, for now ...
|
|
371
373
|
// https://github.com/pmndrs/react-three-fiber/issues/344
|
|
372
|
-
if (!rootState.linear && currentInstance[key] instanceof THREE__namespace.Texture
|
|
374
|
+
if (!rootState.linear && currentInstance[key] instanceof THREE__namespace.Texture &&
|
|
375
|
+
// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129
|
|
376
|
+
currentInstance[key].format === THREE__namespace.RGBAFormat && currentInstance[key].type === THREE__namespace.UnsignedByteType) {
|
|
373
377
|
currentInstance[key].encoding = THREE__namespace.sRGBEncoding;
|
|
374
378
|
}
|
|
375
379
|
}
|
|
@@ -383,8 +387,10 @@ function applyProps$1(instance, data) {
|
|
|
383
387
|
if (localState.eventCount) rootState.internal.interaction.push(instance);
|
|
384
388
|
}
|
|
385
389
|
|
|
386
|
-
// Call the update lifecycle when it is being updated, but only when it is part of the scene
|
|
387
|
-
|
|
390
|
+
// Call the update lifecycle when it is being updated, but only when it is part of the scene.
|
|
391
|
+
// Skip updates to the `onUpdate` prop itself
|
|
392
|
+
const isCircular = changes.length === 1 && changes[0][0] === 'onUpdate';
|
|
393
|
+
if (!isCircular && changes.length && (_instance$__r3f4 = instance.__r3f) != null && _instance$__r3f4.parent) updateInstance(instance);
|
|
388
394
|
return instance;
|
|
389
395
|
}
|
|
390
396
|
function 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-b2f18198.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-ce6281d5.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, i as isRef, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, 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, a 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 createRoot, i as isRef, E as ErrorBoundary, B as Block, b as useIsomorphicLayoutEffect, d as unmountComponentAtNode } from './index-3c94c6e9.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, a 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-3c94c6e9.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-b2f18198.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-ce6281d5.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, 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, a 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, a as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-3c94c6e9.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, a 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-3c94c6e9.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';
|