@react-three/fiber 9.0.0-rc.7 → 9.0.0-rc.8

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.
@@ -366,29 +366,23 @@ function applyProps(object, props) {
366
366
  target
367
367
  } = resolve(object, prop);
368
368
 
369
- // Copy if properties match signatures
370
- if (target != null && target.copy && value != null && value.constructor && target.constructor === value.constructor) {
371
- // fetch the default state of the target
372
- const ctor = getMemoizedPrototype(root);
373
- // The target key was originally null or undefined, which indicates that the object which
374
- // is now present was externally set by the user, we should therefore assign the value directly
375
- if (!is.und(ctor) && (is.und(ctor[key]) || is.nul(ctor[key]))) root[key] = value;
376
- // Otherwise copy is correct
377
- else target.copy(value);
378
- }
379
- // Layers have no copy function, we must therefore copy the mask property
380
- else if (target instanceof THREE.Layers && value instanceof THREE.Layers) {
369
+ // Layers must be written to the mask property
370
+ if (target instanceof THREE.Layers && value instanceof THREE.Layers) {
381
371
  target.mask = value.mask;
382
372
  }
373
+ // Copy if properties match signatures and implement math interface (likely read-only)
374
+ else if (target && typeof target.set === 'function' && typeof target.copy === 'function' && value != null && value.constructor && target.constructor === value.constructor) {
375
+ target.copy(value);
376
+ }
383
377
  // Set array types
384
- else if (target != null && target.set && Array.isArray(value)) {
385
- if (target.fromArray) target.fromArray(value);else target.set(...value);
378
+ else if (target && typeof target.set === 'function' && Array.isArray(value)) {
379
+ if (typeof target.fromArray === 'function') target.fromArray(value);else target.set(...value);
386
380
  }
387
381
  // Set literal types
388
- else if (target != null && target.set && typeof value !== 'object') {
389
- const isColor = target == null ? void 0 : target.isColor;
390
- // Allow setting array scalars
391
- if (!isColor && target.setScalar && typeof value === 'number') target.setScalar(value);
382
+ else if (target && typeof target.set === 'function' && typeof value === 'number') {
383
+ // Allow setting array scalars (don't call setScalar for Color since it skips conversions)
384
+ const isColor = target.isColor;
385
+ if (!isColor && typeof target.setScalar === 'function') target.setScalar(value);
392
386
  // Otherwise just set single value
393
387
  else target.set(value);
394
388
  }
@@ -392,29 +392,23 @@ function applyProps(object, props) {
392
392
  target
393
393
  } = resolve(object, prop);
394
394
 
395
- // Copy if properties match signatures
396
- if (target != null && target.copy && value != null && value.constructor && target.constructor === value.constructor) {
397
- // fetch the default state of the target
398
- const ctor = getMemoizedPrototype(root);
399
- // The target key was originally null or undefined, which indicates that the object which
400
- // is now present was externally set by the user, we should therefore assign the value directly
401
- if (!is.und(ctor) && (is.und(ctor[key]) || is.nul(ctor[key]))) root[key] = value;
402
- // Otherwise copy is correct
403
- else target.copy(value);
404
- }
405
- // Layers have no copy function, we must therefore copy the mask property
406
- else if (target instanceof THREE__namespace.Layers && value instanceof THREE__namespace.Layers) {
395
+ // Layers must be written to the mask property
396
+ if (target instanceof THREE__namespace.Layers && value instanceof THREE__namespace.Layers) {
407
397
  target.mask = value.mask;
408
398
  }
399
+ // Copy if properties match signatures and implement math interface (likely read-only)
400
+ else if (target && typeof target.set === 'function' && typeof target.copy === 'function' && value != null && value.constructor && target.constructor === value.constructor) {
401
+ target.copy(value);
402
+ }
409
403
  // Set array types
410
- else if (target != null && target.set && Array.isArray(value)) {
411
- if (target.fromArray) target.fromArray(value);else target.set(...value);
404
+ else if (target && typeof target.set === 'function' && Array.isArray(value)) {
405
+ if (typeof target.fromArray === 'function') target.fromArray(value);else target.set(...value);
412
406
  }
413
407
  // Set literal types
414
- else if (target != null && target.set && typeof value !== 'object') {
415
- const isColor = target == null ? void 0 : target.isColor;
416
- // Allow setting array scalars
417
- if (!isColor && target.setScalar && typeof value === 'number') target.setScalar(value);
408
+ else if (target && typeof target.set === 'function' && typeof value === 'number') {
409
+ // Allow setting array scalars (don't call setScalar for Color since it skips conversions)
410
+ const isColor = target.isColor;
411
+ if (!isColor && typeof target.setScalar === 'function') target.setScalar(value);
418
412
  // Otherwise just set single value
419
413
  else target.set(value);
420
414
  }
@@ -392,29 +392,23 @@ function applyProps(object, props) {
392
392
  target
393
393
  } = resolve(object, prop);
394
394
 
395
- // Copy if properties match signatures
396
- if (target != null && target.copy && value != null && value.constructor && target.constructor === value.constructor) {
397
- // fetch the default state of the target
398
- const ctor = getMemoizedPrototype(root);
399
- // The target key was originally null or undefined, which indicates that the object which
400
- // is now present was externally set by the user, we should therefore assign the value directly
401
- if (!is.und(ctor) && (is.und(ctor[key]) || is.nul(ctor[key]))) root[key] = value;
402
- // Otherwise copy is correct
403
- else target.copy(value);
404
- }
405
- // Layers have no copy function, we must therefore copy the mask property
406
- else if (target instanceof THREE__namespace.Layers && value instanceof THREE__namespace.Layers) {
395
+ // Layers must be written to the mask property
396
+ if (target instanceof THREE__namespace.Layers && value instanceof THREE__namespace.Layers) {
407
397
  target.mask = value.mask;
408
398
  }
399
+ // Copy if properties match signatures and implement math interface (likely read-only)
400
+ else if (target && typeof target.set === 'function' && typeof target.copy === 'function' && value != null && value.constructor && target.constructor === value.constructor) {
401
+ target.copy(value);
402
+ }
409
403
  // Set array types
410
- else if (target != null && target.set && Array.isArray(value)) {
411
- if (target.fromArray) target.fromArray(value);else target.set(...value);
404
+ else if (target && typeof target.set === 'function' && Array.isArray(value)) {
405
+ if (typeof target.fromArray === 'function') target.fromArray(value);else target.set(...value);
412
406
  }
413
407
  // Set literal types
414
- else if (target != null && target.set && typeof value !== 'object') {
415
- const isColor = target == null ? void 0 : target.isColor;
416
- // Allow setting array scalars
417
- if (!isColor && target.setScalar && typeof value === 'number') target.setScalar(value);
408
+ else if (target && typeof target.set === 'function' && typeof value === 'number') {
409
+ // Allow setting array scalars (don't call setScalar for Color since it skips conversions)
410
+ const isColor = target.isColor;
411
+ if (!isColor && typeof target.setScalar === 'function') target.setScalar(value);
418
412
  // Otherwise just set single value
419
413
  else target.set(value);
420
414
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var events = require('./events-56f909a9.cjs.dev.js');
5
+ var events = require('./events-89dd614d.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var useMeasure = require('react-use-measure');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var events = require('./events-858f07e7.cjs.prod.js');
5
+ var events = require('./events-b4105f71.cjs.prod.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var useMeasure = require('react-use-measure');
@@ -1,5 +1,5 @@
1
- import { e as extend, u as useBridge, a as useMutableCallback, b as useIsomorphicLayoutEffect, c as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents } from './events-12fa3319.esm.js';
2
- export { t as ReactThreeFiber, _ as _roots, w as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, q as applyProps, x as buildGraph, p as context, g as createEvents, o as createPortal, c as createRoot, v as dispose, f as events, e as extend, h as flushGlobalEffects, s as getRootState, m as invalidate, r as reconciler, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './events-12fa3319.esm.js';
1
+ import { e as extend, u as useBridge, a as useMutableCallback, b as useIsomorphicLayoutEffect, c as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents } from './events-5b423474.esm.js';
2
+ export { t as ReactThreeFiber, _ as _roots, w as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, q as applyProps, x as buildGraph, p as context, g as createEvents, o as createPortal, c as createRoot, v as dispose, f as events, e as extend, h as flushGlobalEffects, s as getRootState, m as invalidate, r as reconciler, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './events-5b423474.esm.js';
3
3
  import * as React from 'react';
4
4
  import * as THREE from 'three';
5
5
  import useMeasure from 'react-use-measure';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var events = require('../../dist/events-56f909a9.cjs.dev.js');
5
+ var events = require('../../dist/events-89dd614d.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var reactNative = require('react-native');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var events = require('../../dist/events-858f07e7.cjs.prod.js');
5
+ var events = require('../../dist/events-b4105f71.cjs.prod.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var reactNative = require('react-native');
@@ -1,5 +1,5 @@
1
- import { e as extend, u as useBridge, a as useMutableCallback, c as createRoot, b as useIsomorphicLayoutEffect, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents, g as createEvents } from '../../dist/events-12fa3319.esm.js';
2
- export { t as ReactThreeFiber, _ as _roots, w as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, q as applyProps, x as buildGraph, p as context, g as createEvents, o as createPortal, c as createRoot, v as dispose, e as extend, h as flushGlobalEffects, s as getRootState, m as invalidate, r as reconciler, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/events-12fa3319.esm.js';
1
+ import { e as extend, u as useBridge, a as useMutableCallback, c as createRoot, b as useIsomorphicLayoutEffect, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents, g as createEvents } from '../../dist/events-5b423474.esm.js';
2
+ export { t as ReactThreeFiber, _ as _roots, w as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, q as applyProps, x as buildGraph, p as context, g as createEvents, o as createPortal, c as createRoot, v as dispose, e as extend, h as flushGlobalEffects, s as getRootState, m as invalidate, r as reconciler, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/events-5b423474.esm.js';
3
3
  import * as React from 'react';
4
4
  import * as THREE from 'three';
5
5
  import { PanResponder, PixelRatio, StyleSheet, View, Platform, Image, NativeModules } from 'react-native';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "9.0.0-rc.7",
3
+ "version": "9.0.0-rc.8",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",