@react-three/fiber 8.13.3 → 8.13.5

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,13 +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 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
+ 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>;
@@ -251,8 +251,11 @@ function createRenderer(_roots, _getEventPriority) {
251
251
  return Boolean(localState.handlers);
252
252
  },
253
253
  prepareUpdate(instance, _type, oldProps, newProps) {
254
+ var _instance$__r3f3;
255
+ const localState = (_instance$__r3f3 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f3 : {};
256
+
254
257
  // Create diff-sets
255
- if (instance.__r3f.primitive && newProps.object && newProps.object !== instance) {
258
+ if (localState.primitive && newProps.object && newProps.object !== instance) {
256
259
  return [true];
257
260
  } else {
258
261
  // This is a data object, let's extract critical information about it
@@ -287,10 +290,10 @@ function createRenderer(_roots, _getEventPriority) {
287
290
  else applyProps$1(instance, diff);
288
291
  },
289
292
  commitMount(instance, _type, _props, _int) {
290
- var _instance$__r3f3;
293
+ var _instance$__r3f4;
291
294
  // https://github.com/facebook/react/issues/20271
292
295
  // This will make sure events are only added once to the central container
293
- const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
296
+ const localState = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
294
297
  if (instance.raycast && localState.handlers && localState.eventCount) {
295
298
  instance.__r3f.root.getState().internal.interaction.push(instance);
296
299
  }
@@ -302,23 +305,23 @@ function createRenderer(_roots, _getEventPriority) {
302
305
  shouldSetTextContent: () => false,
303
306
  clearContainer: () => false,
304
307
  hideInstance(instance) {
305
- var _instance$__r3f4;
308
+ var _instance$__r3f5;
306
309
  // Detach while the instance is hidden
307
310
  const {
308
311
  attach: type,
309
312
  parent
310
- } = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
313
+ } = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
311
314
  if (type && parent) detach(parent, instance, type);
312
315
  if (instance.isObject3D) instance.visible = false;
313
316
  invalidateInstance(instance);
314
317
  },
315
318
  unhideInstance(instance, props) {
316
- var _instance$__r3f5;
319
+ var _instance$__r3f6;
317
320
  // Re-attach when the instance is unhidden
318
321
  const {
319
322
  attach: type,
320
323
  parent
321
- } = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
324
+ } = (_instance$__r3f6 = instance.__r3f) != null ? _instance$__r3f6 : {};
322
325
  if (type && parent) attach(parent, instance, type);
323
326
  if (instance.isObject3D && props.visible == null || props.visible) instance.visible = true;
324
327
  invalidateInstance(instance);
@@ -494,19 +497,17 @@ function dispose(obj) {
494
497
  // Each object in the scene carries a small LocalState descriptor
495
498
  function prepare(object, state) {
496
499
  const instance = object;
497
- if (state != null && state.primitive || !instance.__r3f) {
498
- instance.__r3f = {
499
- type: '',
500
- root: null,
501
- previousAttach: null,
502
- memoizedProps: {},
503
- eventCount: 0,
504
- handlers: {},
505
- objects: [],
506
- parent: null,
507
- ...state
508
- };
509
- }
500
+ instance.__r3f = {
501
+ type: '',
502
+ root: null,
503
+ previousAttach: null,
504
+ memoizedProps: {},
505
+ eventCount: 0,
506
+ handlers: {},
507
+ objects: [],
508
+ parent: null,
509
+ ...state
510
+ };
510
511
  return object;
511
512
  }
512
513
  function resolve(instance, key) {
@@ -278,8 +278,11 @@ function createRenderer(_roots, _getEventPriority) {
278
278
  return Boolean(localState.handlers);
279
279
  },
280
280
  prepareUpdate(instance, _type, oldProps, newProps) {
281
+ var _instance$__r3f3;
282
+ const localState = (_instance$__r3f3 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f3 : {};
283
+
281
284
  // Create diff-sets
282
- if (instance.__r3f.primitive && newProps.object && newProps.object !== instance) {
285
+ if (localState.primitive && newProps.object && newProps.object !== instance) {
283
286
  return [true];
284
287
  } else {
285
288
  // This is a data object, let's extract critical information about it
@@ -314,10 +317,10 @@ function createRenderer(_roots, _getEventPriority) {
314
317
  else applyProps$1(instance, diff);
315
318
  },
316
319
  commitMount(instance, _type, _props, _int) {
317
- var _instance$__r3f3;
320
+ var _instance$__r3f4;
318
321
  // https://github.com/facebook/react/issues/20271
319
322
  // This will make sure events are only added once to the central container
320
- const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
323
+ const localState = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
321
324
  if (instance.raycast && localState.handlers && localState.eventCount) {
322
325
  instance.__r3f.root.getState().internal.interaction.push(instance);
323
326
  }
@@ -329,23 +332,23 @@ function createRenderer(_roots, _getEventPriority) {
329
332
  shouldSetTextContent: () => false,
330
333
  clearContainer: () => false,
331
334
  hideInstance(instance) {
332
- var _instance$__r3f4;
335
+ var _instance$__r3f5;
333
336
  // Detach while the instance is hidden
334
337
  const {
335
338
  attach: type,
336
339
  parent
337
- } = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
340
+ } = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
338
341
  if (type && parent) detach(parent, instance, type);
339
342
  if (instance.isObject3D) instance.visible = false;
340
343
  invalidateInstance(instance);
341
344
  },
342
345
  unhideInstance(instance, props) {
343
- var _instance$__r3f5;
346
+ var _instance$__r3f6;
344
347
  // Re-attach when the instance is unhidden
345
348
  const {
346
349
  attach: type,
347
350
  parent
348
- } = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
351
+ } = (_instance$__r3f6 = instance.__r3f) != null ? _instance$__r3f6 : {};
349
352
  if (type && parent) attach(parent, instance, type);
350
353
  if (instance.isObject3D && props.visible == null || props.visible) instance.visible = true;
351
354
  invalidateInstance(instance);
@@ -521,19 +524,17 @@ function dispose(obj) {
521
524
  // Each object in the scene carries a small LocalState descriptor
522
525
  function prepare(object, state) {
523
526
  const instance = object;
524
- if (state != null && state.primitive || !instance.__r3f) {
525
- instance.__r3f = {
526
- type: '',
527
- root: null,
528
- previousAttach: null,
529
- memoizedProps: {},
530
- eventCount: 0,
531
- handlers: {},
532
- objects: [],
533
- parent: null,
534
- ...state
535
- };
536
- }
527
+ instance.__r3f = {
528
+ type: '',
529
+ root: null,
530
+ previousAttach: null,
531
+ memoizedProps: {},
532
+ eventCount: 0,
533
+ handlers: {},
534
+ objects: [],
535
+ parent: null,
536
+ ...state
537
+ };
537
538
  return object;
538
539
  }
539
540
  function resolve(instance, key) {
@@ -278,8 +278,11 @@ function createRenderer(_roots, _getEventPriority) {
278
278
  return Boolean(localState.handlers);
279
279
  },
280
280
  prepareUpdate(instance, _type, oldProps, newProps) {
281
+ var _instance$__r3f3;
282
+ const localState = (_instance$__r3f3 = instance == null ? void 0 : instance.__r3f) != null ? _instance$__r3f3 : {};
283
+
281
284
  // Create diff-sets
282
- if (instance.__r3f.primitive && newProps.object && newProps.object !== instance) {
285
+ if (localState.primitive && newProps.object && newProps.object !== instance) {
283
286
  return [true];
284
287
  } else {
285
288
  // This is a data object, let's extract critical information about it
@@ -314,10 +317,10 @@ function createRenderer(_roots, _getEventPriority) {
314
317
  else applyProps$1(instance, diff);
315
318
  },
316
319
  commitMount(instance, _type, _props, _int) {
317
- var _instance$__r3f3;
320
+ var _instance$__r3f4;
318
321
  // https://github.com/facebook/react/issues/20271
319
322
  // This will make sure events are only added once to the central container
320
- const localState = (_instance$__r3f3 = instance.__r3f) != null ? _instance$__r3f3 : {};
323
+ const localState = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
321
324
  if (instance.raycast && localState.handlers && localState.eventCount) {
322
325
  instance.__r3f.root.getState().internal.interaction.push(instance);
323
326
  }
@@ -329,23 +332,23 @@ function createRenderer(_roots, _getEventPriority) {
329
332
  shouldSetTextContent: () => false,
330
333
  clearContainer: () => false,
331
334
  hideInstance(instance) {
332
- var _instance$__r3f4;
335
+ var _instance$__r3f5;
333
336
  // Detach while the instance is hidden
334
337
  const {
335
338
  attach: type,
336
339
  parent
337
- } = (_instance$__r3f4 = instance.__r3f) != null ? _instance$__r3f4 : {};
340
+ } = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
338
341
  if (type && parent) detach(parent, instance, type);
339
342
  if (instance.isObject3D) instance.visible = false;
340
343
  invalidateInstance(instance);
341
344
  },
342
345
  unhideInstance(instance, props) {
343
- var _instance$__r3f5;
346
+ var _instance$__r3f6;
344
347
  // Re-attach when the instance is unhidden
345
348
  const {
346
349
  attach: type,
347
350
  parent
348
- } = (_instance$__r3f5 = instance.__r3f) != null ? _instance$__r3f5 : {};
351
+ } = (_instance$__r3f6 = instance.__r3f) != null ? _instance$__r3f6 : {};
349
352
  if (type && parent) attach(parent, instance, type);
350
353
  if (instance.isObject3D && props.visible == null || props.visible) instance.visible = true;
351
354
  invalidateInstance(instance);
@@ -521,19 +524,17 @@ function dispose(obj) {
521
524
  // Each object in the scene carries a small LocalState descriptor
522
525
  function prepare(object, state) {
523
526
  const instance = object;
524
- if (state != null && state.primitive || !instance.__r3f) {
525
- instance.__r3f = {
526
- type: '',
527
- root: null,
528
- previousAttach: null,
529
- memoizedProps: {},
530
- eventCount: 0,
531
- handlers: {},
532
- objects: [],
533
- parent: null,
534
- ...state
535
- };
536
- }
527
+ instance.__r3f = {
528
+ type: '',
529
+ root: null,
530
+ previousAttach: null,
531
+ memoizedProps: {},
532
+ eventCount: 0,
533
+ handlers: {},
534
+ objects: [],
535
+ parent: null,
536
+ ...state
537
+ };
537
538
  return object;
538
539
  }
539
540
  function resolve(instance, key) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-c307a54a.cjs.dev.js');
5
+ var index = require('./index-c4a77a3a.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-5195c1db.cjs.prod.js');
5
+ var index = require('./index-eae395d9.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-76c68185.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-76c68185.esm.js';
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-27578f8f.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-27578f8f.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-c307a54a.cjs.dev.js');
5
+ var index = require('../../dist/index-c4a77a3a.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-5195c1db.cjs.prod.js');
5
+ var index = require('../../dist/index-eae395d9.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-76c68185.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-76c68185.esm.js';
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-27578f8f.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-27578f8f.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.13.3",
3
+ "version": "8.13.5",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",