@react-three/fiber 8.10.1 → 8.10.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.
@@ -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>;
@@ -39,9 +39,12 @@ function Block({
39
39
  return null;
40
40
  }
41
41
  class ErrorBoundary extends React.Component {
42
- state = {
43
- error: false
44
- };
42
+ constructor(props) {
43
+ super(props);
44
+ this.state = {
45
+ error: false
46
+ };
47
+ }
45
48
  static getDerivedStateFromError = () => ({
46
49
  error: true
47
50
  });
@@ -559,6 +562,7 @@ function createEvents(store) {
559
562
  /** Handles intersections by forwarding them to handlers */
560
563
  function handleIntersects(intersections, event, delta, callback) {
561
564
  const rootState = store.getState();
565
+
562
566
  // If anything has been found, forward it to the event listeners
563
567
  if (intersections.length) {
564
568
  const localState = {
@@ -728,7 +732,6 @@ function createEvents(store) {
728
732
  const isPointerMove = name === 'onPointerMove';
729
733
  const isClickEvent = name === 'onClick' || name === 'onContextMenu' || name === 'onDoubleClick';
730
734
  const filter = isPointerMove ? filterPointerEvents : undefined;
731
- // const hits = patchIntersects(intersect(filter), event)
732
735
  const hits = intersect(event, filter);
733
736
  const delta = isClickEvent ? calculateDistance(event) : 0;
734
737
 
@@ -752,6 +755,7 @@ function createEvents(store) {
752
755
  const eventObject = data.eventObject;
753
756
  const instance = eventObject.__r3f;
754
757
  const handlers = instance == null ? void 0 : instance.handlers;
758
+
755
759
  // Check presence of handlers
756
760
  if (!(instance != null && instance.eventCount)) return;
757
761
  if (isPointerMove) {
@@ -1963,7 +1967,6 @@ function Portal({
1963
1967
  * the "R3F hooks can only be used within the Canvas component!" warning:
1964
1968
  * <Canvas>
1965
1969
  * {createPortal(...)} */
1966
-
1967
1970
  const {
1968
1971
  events,
1969
1972
  size,
@@ -1985,7 +1988,8 @@ function Portal({
1985
1988
  // Some props should be off-limits
1986
1989
  privateKeys.includes(key) ||
1987
1990
  // Otherwise filter out the props that are different and let the inject layer take precedence
1988
- rootState[key] !== injectState[key]) {
1991
+ // Unless the inject layer props is undefined, then we keep the root layer
1992
+ rootState[key] !== injectState[key] && injectState[key]) {
1989
1993
  delete intersect[key];
1990
1994
  }
1991
1995
  });
@@ -66,9 +66,12 @@ function Block({
66
66
  return null;
67
67
  }
68
68
  class ErrorBoundary extends React__namespace.Component {
69
- state = {
70
- error: false
71
- };
69
+ constructor(props) {
70
+ super(props);
71
+ this.state = {
72
+ error: false
73
+ };
74
+ }
72
75
  static getDerivedStateFromError = () => ({
73
76
  error: true
74
77
  });
@@ -586,6 +589,7 @@ function createEvents(store) {
586
589
  /** Handles intersections by forwarding them to handlers */
587
590
  function handleIntersects(intersections, event, delta, callback) {
588
591
  const rootState = store.getState();
592
+
589
593
  // If anything has been found, forward it to the event listeners
590
594
  if (intersections.length) {
591
595
  const localState = {
@@ -755,7 +759,6 @@ function createEvents(store) {
755
759
  const isPointerMove = name === 'onPointerMove';
756
760
  const isClickEvent = name === 'onClick' || name === 'onContextMenu' || name === 'onDoubleClick';
757
761
  const filter = isPointerMove ? filterPointerEvents : undefined;
758
- // const hits = patchIntersects(intersect(filter), event)
759
762
  const hits = intersect(event, filter);
760
763
  const delta = isClickEvent ? calculateDistance(event) : 0;
761
764
 
@@ -779,6 +782,7 @@ function createEvents(store) {
779
782
  const eventObject = data.eventObject;
780
783
  const instance = eventObject.__r3f;
781
784
  const handlers = instance == null ? void 0 : instance.handlers;
785
+
782
786
  // Check presence of handlers
783
787
  if (!(instance != null && instance.eventCount)) return;
784
788
  if (isPointerMove) {
@@ -1990,7 +1994,6 @@ function Portal({
1990
1994
  * the "R3F hooks can only be used within the Canvas component!" warning:
1991
1995
  * <Canvas>
1992
1996
  * {createPortal(...)} */
1993
-
1994
1997
  const {
1995
1998
  events,
1996
1999
  size,
@@ -2012,7 +2015,8 @@ function Portal({
2012
2015
  // Some props should be off-limits
2013
2016
  privateKeys.includes(key) ||
2014
2017
  // Otherwise filter out the props that are different and let the inject layer take precedence
2015
- rootState[key] !== injectState[key]) {
2018
+ // Unless the inject layer props is undefined, then we keep the root layer
2019
+ rootState[key] !== injectState[key] && injectState[key]) {
2016
2020
  delete intersect[key];
2017
2021
  }
2018
2022
  });
@@ -66,9 +66,12 @@ function Block({
66
66
  return null;
67
67
  }
68
68
  class ErrorBoundary extends React__namespace.Component {
69
- state = {
70
- error: false
71
- };
69
+ constructor(props) {
70
+ super(props);
71
+ this.state = {
72
+ error: false
73
+ };
74
+ }
72
75
  static getDerivedStateFromError = () => ({
73
76
  error: true
74
77
  });
@@ -586,6 +589,7 @@ function createEvents(store) {
586
589
  /** Handles intersections by forwarding them to handlers */
587
590
  function handleIntersects(intersections, event, delta, callback) {
588
591
  const rootState = store.getState();
592
+
589
593
  // If anything has been found, forward it to the event listeners
590
594
  if (intersections.length) {
591
595
  const localState = {
@@ -755,7 +759,6 @@ function createEvents(store) {
755
759
  const isPointerMove = name === 'onPointerMove';
756
760
  const isClickEvent = name === 'onClick' || name === 'onContextMenu' || name === 'onDoubleClick';
757
761
  const filter = isPointerMove ? filterPointerEvents : undefined;
758
- // const hits = patchIntersects(intersect(filter), event)
759
762
  const hits = intersect(event, filter);
760
763
  const delta = isClickEvent ? calculateDistance(event) : 0;
761
764
 
@@ -779,6 +782,7 @@ function createEvents(store) {
779
782
  const eventObject = data.eventObject;
780
783
  const instance = eventObject.__r3f;
781
784
  const handlers = instance == null ? void 0 : instance.handlers;
785
+
782
786
  // Check presence of handlers
783
787
  if (!(instance != null && instance.eventCount)) return;
784
788
  if (isPointerMove) {
@@ -1990,7 +1994,6 @@ function Portal({
1990
1994
  * the "R3F hooks can only be used within the Canvas component!" warning:
1991
1995
  * <Canvas>
1992
1996
  * {createPortal(...)} */
1993
-
1994
1997
  const {
1995
1998
  events,
1996
1999
  size,
@@ -2012,7 +2015,8 @@ function Portal({
2012
2015
  // Some props should be off-limits
2013
2016
  privateKeys.includes(key) ||
2014
2017
  // Otherwise filter out the props that are different and let the inject layer take precedence
2015
- rootState[key] !== injectState[key]) {
2018
+ // Unless the inject layer props is undefined, then we keep the root layer
2019
+ rootState[key] !== injectState[key] && injectState[key]) {
2016
2020
  delete intersect[key];
2017
2021
  }
2018
2022
  });
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-f2e97578.cjs.dev.js');
5
+ var index = require('./index-dff4d2eb.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-5d1efa67.cjs.prod.js');
5
+ var index = require('./index-6e3ece64.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-adfddf12.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-adfddf12.esm.js';
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-291d12f4.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-291d12f4.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-f2e97578.cjs.dev.js');
5
+ var index = require('../../dist/index-dff4d2eb.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-5d1efa67.cjs.prod.js');
5
+ var index = require('../../dist/index-6e3ece64.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-adfddf12.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-adfddf12.esm.js';
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-291d12f4.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-291d12f4.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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "8.10.1",
3
+ "version": "8.10.3",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",