@react-three/fiber 10.0.0-canary.4f316e6 → 10.0.0-canary.4f9f64c

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.
@@ -11,6 +11,7 @@ export { Scheduler, getScheduler } from '@pmndrs/scheduler';
11
11
  import Tb, { unstable_getCurrentPriorityLevel, unstable_IdlePriority, unstable_LowPriority, unstable_NormalPriority, unstable_UserBlockingPriority, unstable_ImmediatePriority, unstable_scheduleCallback } from 'scheduler';
12
12
  import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
13
13
  import { HDRLoader } from 'three/examples/jsm/loaders/HDRLoader.js';
14
+ import { HDRCubeTextureLoader } from 'three/examples/jsm/loaders/HDRCubeTextureLoader.js';
14
15
  import { EXRLoader } from 'three/examples/jsm/loaders/EXRLoader.js';
15
16
  import { UltraHDRLoader } from 'three/examples/jsm/loaders/UltraHDRLoader.js';
16
17
  import { GainMapLoader } from '@monogrid/gainmap-js';
@@ -519,8 +520,10 @@ function hasVisibilityHandlers(handlers) {
519
520
  }
520
521
 
521
522
  const FROM_REF = Symbol.for("@react-three/fiber.fromRef");
522
- function fromRef(ref) {
523
- return { [FROM_REF]: ref };
523
+ function fromRef(ref, transform) {
524
+ const marker = { [FROM_REF]: ref };
525
+ if (transform) marker.transform = transform;
526
+ return marker;
524
527
  }
525
528
  function isFromRef(value) {
526
529
  return value !== null && typeof value === "object" && FROM_REF in value;
@@ -612,12 +615,7 @@ function diffProps(instance, newProps) {
612
615
  const changedProps = {};
613
616
  for (const prop in newProps) {
614
617
  if (RESERVED_PROPS.includes(prop)) continue;
615
- if (is.equ(newProps[prop], instance.props[prop])) {
616
- const value = newProps[prop];
617
- if (!isCopyable(value)) continue;
618
- const { target } = resolve(instance.object, prop);
619
- if (!isCopyable(target) || target.constructor !== value.constructor) continue;
620
- }
618
+ if (is.equ(newProps[prop], instance.props[prop])) continue;
621
619
  changedProps[prop] = newProps[prop];
622
620
  for (const other in newProps) {
623
621
  if (other.startsWith(`${prop}-`)) changedProps[other] = newProps[other];
@@ -626,11 +624,9 @@ function diffProps(instance, newProps) {
626
624
  for (const prop in instance.props) {
627
625
  if (RESERVED_PROPS.includes(prop) || newProps.hasOwnProperty(prop)) continue;
628
626
  const { root, key } = resolve(instance.object, prop);
629
- if (root.constructor && root.constructor.length === 0) {
627
+ if (typeof root?.constructor === "function") {
630
628
  const ctor = getMemoizedPrototype(root);
631
629
  if (!is.und(ctor)) changedProps[prop] = ctor[key];
632
- } else {
633
- changedProps[prop] = 0;
634
630
  }
635
631
  }
636
632
  return changedProps;
@@ -1353,12 +1349,24 @@ function useTexture(input, optionsOrOnLoad) {
1353
1349
  TextureLoader,
1354
1350
  IsObject(stableInput) ? Object.values(stableInput) : stableInput
1355
1351
  );
1352
+ const mappedTextures = useMemo(() => {
1353
+ if (cachedResult) return cachedResult;
1354
+ if (IsObject(stableInput)) {
1355
+ const keyed = {};
1356
+ const textureArray = loadedTextures;
1357
+ let i = 0;
1358
+ for (const key in stableInput) keyed[key] = textureArray[i++];
1359
+ return keyed;
1360
+ } else {
1361
+ return loadedTextures;
1362
+ }
1363
+ }, [stableInput, loadedTextures, cachedResult]);
1356
1364
  useLayoutEffect(() => {
1357
1365
  if (cachedResult) return;
1358
1366
  if (onLoadCalledForRef.current === inputKey) return;
1359
1367
  onLoadCalledForRef.current = inputKey;
1360
- onLoadRef.current?.(loadedTextures);
1361
- }, [cachedResult, loadedTextures, inputKey]);
1368
+ onLoadRef.current?.(mappedTextures);
1369
+ }, [cachedResult, mappedTextures, inputKey]);
1362
1370
  useEffect(() => {
1363
1371
  if (cachedResult) return;
1364
1372
  if ("initTexture" in renderer) {
@@ -1377,18 +1385,6 @@ function useTexture(input, optionsOrOnLoad) {
1377
1385
  });
1378
1386
  }
1379
1387
  }, [renderer, loadedTextures, cachedResult]);
1380
- const mappedTextures = useMemo(() => {
1381
- if (cachedResult) return cachedResult;
1382
- if (IsObject(stableInput)) {
1383
- const keyed = {};
1384
- const textureArray = loadedTextures;
1385
- let i = 0;
1386
- for (const key in stableInput) keyed[key] = textureArray[i++];
1387
- return keyed;
1388
- } else {
1389
- return loadedTextures;
1390
- }
1391
- }, [stableInput, loadedTextures, cachedResult]);
1392
1388
  useEffect(() => {
1393
1389
  if (!cache) return;
1394
1390
  const urlTextureMap = [];
@@ -1590,7 +1586,7 @@ function useEnvironment({
1590
1586
  texture = texture.renderTarget?.texture;
1591
1587
  }
1592
1588
  texture.mapping = isCubemap ? CubeReflectionMapping : EquirectangularReflectionMapping;
1593
- texture.colorSpace = colorSpace ?? (isCubemap ? "srgb" : "srgb-linear");
1589
+ texture.colorSpace = colorSpace ?? (isCubemap && extension !== "hdr-cube" ? "srgb" : "srgb-linear");
1594
1590
  return texture;
1595
1591
  }
1596
1592
  const preloadDefaultOptions = {
@@ -1643,11 +1639,12 @@ function getExtension(files) {
1643
1639
  const isCubemap = isArray(files) && files.length === 6;
1644
1640
  const isGainmap = isArray(files) && files.length === 3 && files.some((file) => file.endsWith("json"));
1645
1641
  const firstEntry = isArray(files) ? files[0] : files;
1646
- const extension = isCubemap ? "cube" : isGainmap ? "webp" : firstEntry.startsWith("data:application/exr") ? "exr" : firstEntry.startsWith("data:application/hdr") ? "hdr" : firstEntry.startsWith("data:image/jpeg") ? "jpg" : firstEntry.split(".").pop()?.split("?")?.shift()?.toLowerCase();
1642
+ const firstExtension = firstEntry.split(".").pop()?.split("?")?.shift()?.toLowerCase();
1643
+ const extension = isCubemap ? firstExtension === "hdr" ? "hdr-cube" : "cube" : isGainmap ? "webp" : firstEntry.startsWith("data:application/exr") ? "exr" : firstEntry.startsWith("data:application/hdr") ? "hdr" : firstEntry.startsWith("data:image/jpeg") ? "jpg" : firstExtension;
1647
1644
  return { extension, isCubemap, isGainmap };
1648
1645
  }
1649
1646
  function getLoader(extension) {
1650
- const loader = extension === "cube" ? CubeTextureLoader : extension === "hdr" ? HDRLoader : extension === "exr" ? EXRLoader : extension === "jpg" || extension === "jpeg" ? UltraHDRLoader : extension === "webp" ? GainMapLoader : null;
1647
+ const loader = extension === "cube" ? CubeTextureLoader : extension === "hdr-cube" ? HDRCubeTextureLoader : extension === "hdr" ? HDRLoader : extension === "exr" ? EXRLoader : extension === "jpg" || extension === "jpeg" ? UltraHDRLoader : extension === "webp" ? GainMapLoader : null;
1651
1648
  return loader;
1652
1649
  }
1653
1650
 
@@ -1710,16 +1707,16 @@ function advance(timestamp, runGlobalEffects, state) {
1710
1707
  else scheduler.step(timestamp);
1711
1708
  }
1712
1709
 
1713
- const version = "10.0.0-alpha.4";
1710
+ const version = "10.0.0-alpha.5";
1714
1711
  const packageData = {
1715
1712
  version: version};
1716
1713
 
1717
1714
  function Xb(Tt) {
1718
1715
  return Tt && Tt.__esModule && Object.prototype.hasOwnProperty.call(Tt, "default") ? Tt.default : Tt;
1719
1716
  }
1720
- var Rm = { exports: {} }, Og = { exports: {} }, _b;
1717
+ var Rm = { exports: {} }, Og = { exports: {} }, _b$1;
1721
1718
  function Kb() {
1722
- return _b || (_b = 1, (function(Tt) {
1719
+ return _b$1 || (_b$1 = 1, (function(Tt) {
1723
1720
  Tt.exports = function(m) {
1724
1721
  function Yn(t, r, a, l) {
1725
1722
  return new uc(t, r, a, l);
@@ -13569,7 +13566,10 @@ function extend(objects) {
13569
13566
  catalogue[Component] = objects;
13570
13567
  return Component;
13571
13568
  } else {
13572
- Object.assign(catalogue, objects);
13569
+ for (const name in objects) {
13570
+ const object = objects[name];
13571
+ if (isConstructor(object)) catalogue[name] = object;
13572
+ }
13573
13573
  }
13574
13574
  }
13575
13575
  function validateInstance(type, props) {
@@ -13917,7 +13917,7 @@ const reconciler = /* @__PURE__ */ createReconciler({
13917
13917
  getRootHostContext: () => NO_CONTEXT,
13918
13918
  getChildHostContext: () => NO_CONTEXT,
13919
13919
  commitUpdate(instance, type, oldProps, newProps, fiber) {
13920
- validateInstance(type, newProps);
13920
+ validateInstance(instance.type, newProps);
13921
13921
  let reconstruct = false;
13922
13922
  if (instance.type === "primitive" && oldProps.object !== newProps.object) reconstruct = true;
13923
13923
  else if (newProps.args?.length !== oldProps.args?.length) reconstruct = true;
@@ -13944,8 +13944,8 @@ const reconciler = /* @__PURE__ */ createReconciler({
13944
13944
  for (const prop in instance.props) {
13945
13945
  const value = instance.props[prop];
13946
13946
  if (isFromRef(value)) {
13947
- const ref = value[FROM_REF];
13948
- if (ref.current != null) resolved[prop] = ref.current;
13947
+ const { [FROM_REF]: ref, transform } = value;
13948
+ if (ref.current != null) resolved[prop] = transform ? transform(ref.current) : ref.current;
13949
13949
  }
13950
13950
  }
13951
13951
  if (Object.keys(resolved).length) applyProps(instance.object, resolved);
@@ -14757,16 +14757,11 @@ function setEnvProps(background, scene, defaultScene, texture, sceneProps = {})
14757
14757
  const oldbg = target.background;
14758
14758
  const oldenv = target.environment;
14759
14759
  const oldSceneProps = {
14760
- // @ts-ignore
14761
14760
  backgroundBlurriness: target.backgroundBlurriness,
14762
- // @ts-ignore
14763
14761
  backgroundIntensity: target.backgroundIntensity,
14764
- // @ts-ignore
14765
- backgroundRotation: target.backgroundRotation?.clone?.() ?? [0, 0, 0],
14766
- // @ts-ignore
14762
+ backgroundRotation: target.backgroundRotation.clone(),
14767
14763
  environmentIntensity: target.environmentIntensity,
14768
- // @ts-ignore
14769
- environmentRotation: target.environmentRotation?.clone?.() ?? [0, 0, 0]
14764
+ environmentRotation: target.environmentRotation.clone()
14770
14765
  };
14771
14766
  if (background !== "only") target.environment = texture;
14772
14767
  if (background) target.background = texture;
@@ -15360,20 +15355,36 @@ function CanvasImpl({
15360
15355
  }
15361
15356
  );
15362
15357
  }
15363
- function Canvas(props) {
15358
+ function Canvas$1(props) {
15364
15359
  return /* @__PURE__ */ jsx(FiberProvider, { children: /* @__PURE__ */ jsx(CanvasImpl, { ...props }) });
15365
15360
  }
15366
15361
 
15362
+ const isObjectLike = (value) => value !== null && (typeof value === "object" || typeof value === "function");
15363
+ const hasValidLegacyNodeMarkers = (value) => {
15364
+ const hasUuid = "uuid" in value;
15365
+ const hasNodeType = "nodeType" in value;
15366
+ const uuid = Reflect.get(value, "uuid");
15367
+ const nodeType = Reflect.get(value, "nodeType");
15368
+ return (hasUuid || hasNodeType) && (!hasUuid || uuid === void 0 || typeof uuid === "string") && (!hasNodeType || nodeType === void 0 || nodeType === null || typeof nodeType === "string");
15369
+ };
15370
+ const isUniformNode = (value) => isObjectLike(value) && "isUniformNode" in value && value.isUniformNode === true;
15371
+ const isTSLNode = (value) => isObjectLike(value) && (Reflect.get(value, "isNode") === true || Reflect.get(value, "shaderNode") !== void 0 && typeof Reflect.get(value, "id") === "number" || hasValidLegacyNodeMarkers(value));
15372
+ const isBufferLike = (value) => ArrayBuffer.isView(value) && !(value instanceof DataView) || isObjectLike(value) && ("isBufferAttribute" in value || "isInterleavedBufferAttribute" in value || isTSLNode(value));
15373
+ const isStorageLike = (value) => isObjectLike(value) && ("isTexture" in value || "isData3DTexture" in value || isTSLNode(value));
15374
+
15367
15375
  var __defProp = Object.defineProperty;
15368
15376
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15369
15377
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
15370
- var _a;
15378
+ var _a, _b;
15371
15379
  const INTERNAL_DATA = Symbol("ScopedStore.data");
15372
- _a = INTERNAL_DATA;
15380
+ const INTERNAL_IS_LEAF = Symbol("ScopedStore.isLeaf");
15381
+ _b = INTERNAL_DATA, _a = INTERNAL_IS_LEAF;
15373
15382
  const _ScopedStore = class _ScopedStore {
15374
- constructor(data) {
15383
+ constructor(data, isLeaf) {
15384
+ __publicField(this, _b);
15375
15385
  __publicField(this, _a);
15376
15386
  this[INTERNAL_DATA] = data;
15387
+ this[INTERNAL_IS_LEAF] = isLeaf;
15377
15388
  return new Proxy(this, {
15378
15389
  get(target, prop, receiver) {
15379
15390
  if (typeof prop === "string") {
@@ -15407,10 +15418,10 @@ const _ScopedStore = class _ScopedStore {
15407
15418
  * If the key doesn't exist or isn't a scope object, returns an empty ScopedStore.
15408
15419
  */
15409
15420
  scope(key) {
15410
- const data = this[INTERNAL_DATA][key];
15411
- return new _ScopedStore(
15412
- data && typeof data === "object" ? data : {}
15413
- );
15421
+ const value = this[INTERNAL_DATA][key];
15422
+ const isLeaf = this[INTERNAL_IS_LEAF];
15423
+ const scope = value && typeof value === "object" && !isLeaf(value) ? value : {};
15424
+ return new _ScopedStore(scope, isLeaf);
15414
15425
  }
15415
15426
  /**
15416
15427
  * Check if a key exists in the store.
@@ -15426,8 +15437,8 @@ const _ScopedStore = class _ScopedStore {
15426
15437
  }
15427
15438
  };
15428
15439
  let ScopedStore = _ScopedStore;
15429
- function createScopedStore(data) {
15430
- return new ScopedStore(data);
15440
+ function createScopedStore(data, isLeaf) {
15441
+ return new ScopedStore(data, isLeaf);
15431
15442
  }
15432
15443
  function createLazyCreatorState(state, store) {
15433
15444
  let _uniforms = null;
@@ -15438,22 +15449,22 @@ function createLazyCreatorState(state, store) {
15438
15449
  return Object.create(state, {
15439
15450
  uniforms: {
15440
15451
  get() {
15441
- return _uniforms ?? (_uniforms = createScopedStore(view("uniforms")));
15452
+ return _uniforms ?? (_uniforms = createScopedStore(view("uniforms"), isUniformNode));
15442
15453
  }
15443
15454
  },
15444
15455
  nodes: {
15445
15456
  get() {
15446
- return _nodes ?? (_nodes = createScopedStore(view("nodes")));
15457
+ return _nodes ?? (_nodes = createScopedStore(view("nodes"), isTSLNode));
15447
15458
  }
15448
15459
  },
15449
15460
  buffers: {
15450
15461
  get() {
15451
- return _buffers ?? (_buffers = createScopedStore(view("buffers")));
15462
+ return _buffers ?? (_buffers = createScopedStore(view("buffers"), isBufferLike));
15452
15463
  }
15453
15464
  },
15454
15465
  gpuStorage: {
15455
15466
  get() {
15456
- return _gpuStorage ?? (_gpuStorage = createScopedStore(view("gpuStorage")));
15467
+ return _gpuStorage ?? (_gpuStorage = createScopedStore(view("gpuStorage"), isStorageLike));
15457
15468
  }
15458
15469
  }
15459
15470
  });
@@ -15554,7 +15565,7 @@ function vectorize(inObject) {
15554
15565
  return extractTSLValue(inObject);
15555
15566
  }
15556
15567
  if (obj.isVector2 || obj.isVector3 || obj.isVector4) return inObject;
15557
- if (obj.isMatrix3 || obj.isMatrix4) return inObject;
15568
+ if (obj.isMatrix2 || obj.isMatrix3 || obj.isMatrix4) return inObject;
15558
15569
  if (obj.isColor || obj.isEuler || obj.isQuaternion || obj.isSpherical) return inObject;
15559
15570
  if ("r" in obj && "g" in obj && "b" in obj && typeof obj.r === "number" && typeof obj.g === "number" && typeof obj.b === "number") {
15560
15571
  const scale = obj.r > 1 || obj.g > 1 || obj.b > 1 ? 1 / 255 : 1;
@@ -15612,22 +15623,21 @@ function useScopedResource(options) {
15612
15623
  return entries;
15613
15624
  }
15614
15625
 
15615
- const isUniformNode$1 = (value) => value !== null && typeof value === "object" && "value" in value && "uuid" in value;
15616
15626
  function useUniforms(creatorOrScope, scope) {
15617
15627
  const store = usePrimaryStore();
15618
15628
  const removeUniforms2 = useCallback(
15619
- (names, targetScope) => removeResourceEntries(store, "uniforms", Array.isArray(names) ? names : [names], targetScope, isUniformNode$1),
15629
+ (names, targetScope) => removeResourceEntries(store, "uniforms", Array.isArray(names) ? names : [names], targetScope, isUniformNode),
15620
15630
  [store]
15621
15631
  );
15622
15632
  const clearUniforms = useCallback(
15623
- (targetScope) => clearResourceEntries(store, "uniforms", targetScope, isUniformNode$1),
15633
+ (targetScope) => clearResourceEntries(store, "uniforms", targetScope, isUniformNode),
15624
15634
  [store]
15625
15635
  );
15626
15636
  const rebuildUniforms = useCallback(
15627
15637
  (targetScope) => rebuildResource(store, "uniforms", targetScope),
15628
15638
  [store]
15629
15639
  );
15630
- const inputForMemoization = useMemo(() => {
15640
+ const processedInput = useMemo(() => {
15631
15641
  let raw = creatorOrScope;
15632
15642
  if (is.fun(creatorOrScope)) {
15633
15643
  const wrappedState = createLazyCreatorState(store.getState(), store);
@@ -15638,23 +15648,24 @@ function useUniforms(creatorOrScope, scope) {
15638
15648
  for (const [key, value] of Object.entries(raw)) {
15639
15649
  normalized[key] = vectorize(value);
15640
15650
  }
15641
- return normalized;
15651
+ return { candidates: raw, normalized };
15642
15652
  }
15643
- return raw;
15653
+ return { candidates: raw, normalized: raw };
15644
15654
  }, [creatorOrScope, store]);
15645
- const memoizedInput = useCompareMemoize(inputForMemoization);
15655
+ const memoizedInput = useCompareMemoize(processedInput.normalized);
15646
15656
  const isReader = memoizedInput === void 0 || typeof memoizedInput === "string";
15647
15657
  const storeUniforms = usePrimaryThree((s) => s.uniforms);
15648
15658
  const created = useScopedResource({
15649
15659
  store,
15650
15660
  kind: "uniforms",
15651
15661
  scope: isReader ? void 0 : scope,
15652
- isLeaf: isUniformNode$1,
15662
+ isLeaf: isUniformNode,
15653
15663
  input: memoizedInput,
15654
15664
  create: () => {
15655
15665
  if (isReader) return {};
15656
- if (typeof memoizedInput !== "object" || memoizedInput === null) throw new Error("Invalid uniform input");
15657
- return memoizedInput;
15666
+ if (typeof processedInput.candidates !== "object" || processedInput.candidates === null)
15667
+ throw new Error("Invalid uniform input");
15668
+ return processedInput.candidates;
15658
15669
  },
15659
15670
  prepare: (name, candidate) => createUniform(name, candidate, scope),
15660
15671
  reconcile: (existing, candidate) => {
@@ -15676,7 +15687,7 @@ function useUniforms(creatorOrScope, scope) {
15676
15687
  uniforms = storeUniforms;
15677
15688
  } else if (typeof memoizedInput === "string") {
15678
15689
  const scopeData = storeUniforms[memoizedInput];
15679
- uniforms = scopeData && !isUniformNode$1(scopeData) ? scopeData : {};
15690
+ uniforms = scopeData && !isUniformNode(scopeData) ? scopeData : {};
15680
15691
  }
15681
15692
  return { ...uniforms, removeUniforms: removeUniforms2, clearUniforms, rebuildUniforms };
15682
15693
  }
@@ -15691,7 +15702,7 @@ function removeUniforms(set, names, scope) {
15691
15702
  return { uniforms: { ...state.uniforms, [scope]: currentScope } };
15692
15703
  }
15693
15704
  const uniforms = { ...state.uniforms };
15694
- for (const name of names) if (isUniformNode$1(uniforms[name])) delete uniforms[name];
15705
+ for (const name of names) if (isUniformNode(uniforms[name])) delete uniforms[name];
15695
15706
  return { uniforms };
15696
15707
  });
15697
15708
  }
@@ -15705,7 +15716,7 @@ function clearRootUniforms(set) {
15705
15716
  set((state) => {
15706
15717
  const uniforms = {};
15707
15718
  for (const [key, value] of Object.entries(state.uniforms)) {
15708
- if (!isUniformNode$1(value)) uniforms[key] = value;
15719
+ if (!isUniformNode(value)) uniforms[key] = value;
15709
15720
  }
15710
15721
  return { uniforms };
15711
15722
  });
@@ -15741,12 +15752,10 @@ function hasEqualsMethod(value) {
15741
15752
  function isSameThreeType(a, b) {
15742
15753
  const obj_a = a;
15743
15754
  const obj_b = b;
15744
- return obj_a.isColor && obj_b.isColor || obj_a.isMatrix3 && obj_b.isMatrix3 || obj_a.isMatrix4 && obj_b.isMatrix4 || obj_a.isEuler && obj_b.isEuler || obj_a.isQuaternion && obj_b.isQuaternion;
15755
+ return obj_a.isColor && obj_b.isColor || obj_a.isMatrix2 && obj_b.isMatrix2 || obj_a.isMatrix3 && obj_b.isMatrix3 || obj_a.isMatrix4 && obj_b.isMatrix4 || obj_a.isEuler && obj_b.isEuler || obj_a.isQuaternion && obj_b.isQuaternion;
15745
15756
  }
15746
15757
 
15747
15758
  const uniformOf = uniform;
15748
- const isUniformNode = (value) => value !== null && typeof value === "object" && "value" in value && "uuid" in value;
15749
- const isTSLNode$1 = (value) => value !== null && typeof value === "object" && "uuid" in value && "nodeType" in value;
15750
15759
  function useUniform(name, value) {
15751
15760
  const store = useStore();
15752
15761
  const registered = useScopedResource({
@@ -15758,7 +15767,7 @@ function useUniform(name, value) {
15758
15767
  create: () => value === void 0 ? {} : { [name]: value },
15759
15768
  prepare: createNamedUniform,
15760
15769
  reconcile: (existing2) => {
15761
- if (value !== void 0 && !isTSLNode$1(value) && !isUniformNode(value)) {
15770
+ if (value !== void 0 && !isTSLNode(value) && !isUniformNode(value)) {
15762
15771
  existing2.value = typeof value === "string" ? new Color(value) : value;
15763
15772
  }
15764
15773
  }
@@ -15774,7 +15783,7 @@ function createNamedUniform(name, value) {
15774
15783
  let node;
15775
15784
  if (isUniformNode(value)) {
15776
15785
  node = value;
15777
- } else if (isTSLNode$1(value)) {
15786
+ } else if (isTSLNode(value)) {
15778
15787
  node = uniformOf(value);
15779
15788
  } else if (typeof value === "string") {
15780
15789
  node = uniform(new Color(value));
@@ -15787,7 +15796,6 @@ function createNamedUniform(name, value) {
15787
15796
  return node;
15788
15797
  }
15789
15798
 
15790
- const isTSLNode = (value) => value !== null && typeof value === "object" && ("uuid" in value || "nodeType" in value);
15791
15799
  function useNodes(creatorOrScope, scope) {
15792
15800
  const store = usePrimaryStore();
15793
15801
  const removeNodes2 = useCallback(
@@ -15814,7 +15822,8 @@ function useNodes(creatorOrScope, scope) {
15814
15822
  return creatorOrScope(createLazyCreatorState(store.getState(), store));
15815
15823
  },
15816
15824
  prepare: (name, node) => {
15817
- node.setName?.(scopedNodeName(scope, name));
15825
+ const setName = Reflect.get(node, "setName");
15826
+ if (typeof setName === "function") setName.call(node, scopedNodeName(scope, name));
15818
15827
  return node;
15819
15828
  }
15820
15829
  });
@@ -15869,13 +15878,6 @@ function useLocalNodes(creator) {
15869
15878
  }, [store, creator, uniforms, nodes, textures, hmrVersion]);
15870
15879
  }
15871
15880
 
15872
- const isBufferLike = (value) => {
15873
- if (value === null || typeof value !== "object") return false;
15874
- if (ArrayBuffer.isView(value)) return true;
15875
- if ("isBufferAttribute" in value) return true;
15876
- if ("uuid" in value || "nodeType" in value) return true;
15877
- return false;
15878
- };
15879
15881
  const disposeBuffer = (buffer) => {
15880
15882
  if (buffer === null || typeof buffer !== "object") return;
15881
15883
  if ("dispose" in buffer && typeof buffer.dispose === "function") {
@@ -15922,9 +15924,8 @@ function useBuffers(creatorOrScope, scope) {
15922
15924
  return creatorOrScope(createLazyCreatorState(store.getState(), store));
15923
15925
  },
15924
15926
  prepare: (name, buffer) => {
15925
- if ("setName" in buffer && typeof buffer.setName === "function") {
15926
- buffer.setName(scopedNodeName(scope, name));
15927
- }
15927
+ const setName = Reflect.get(buffer, "setName");
15928
+ if (typeof setName === "function") setName.call(buffer, scopedNodeName(scope, name));
15928
15929
  return buffer;
15929
15930
  }
15930
15931
  });
@@ -15941,13 +15942,6 @@ function rebuildAllBuffers(store, scope) {
15941
15942
  rebuildResource(store, "buffers", scope);
15942
15943
  }
15943
15944
 
15944
- const isStorageLike = (value) => {
15945
- if (value === null || typeof value !== "object") return false;
15946
- if ("isTexture" in value) return true;
15947
- if ("isData3DTexture" in value) return true;
15948
- if ("uuid" in value || "nodeType" in value) return true;
15949
- return false;
15950
- };
15951
15945
  const disposeStorage = (storage) => {
15952
15946
  if (storage === null || typeof storage !== "object") return;
15953
15947
  if ("dispose" in storage && typeof storage.dispose === "function") {
@@ -15995,9 +15989,8 @@ function useGPUStorage(creatorOrScope, scope) {
15995
15989
  },
15996
15990
  prepare: (name, storage) => {
15997
15991
  const label = scopedNodeName(scope, name);
15998
- if ("setName" in storage && typeof storage.setName === "function") {
15999
- storage.setName(label);
16000
- }
15992
+ const setName = Reflect.get(storage, "setName");
15993
+ if (typeof setName === "function") setName.call(storage, label);
16001
15994
  if ("name" in storage && typeof storage.name === "string") {
16002
15995
  storage.name = label;
16003
15996
  }
@@ -16139,5 +16132,6 @@ function useRenderPipeline(mainCB, setupCB) {
16139
16132
  extend(THREE);
16140
16133
  const useThree = useThree$1;
16141
16134
  const useFrame = useFrame$1;
16135
+ const Canvas = Canvas$1;
16142
16136
 
16143
16137
  export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, Texture, _roots, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, fromRef, getInstanceProps, getPrimary, getPrimaryIds, getRootState, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef$1 as isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "10.0.0-canary.4f316e6",
3
+ "version": "10.0.0-canary.4f9f64c",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",