@react-three/fiber 9.6.1 → 9.7.0

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +1214 -1204
  2. package/dist/declarations/src/core/events.d.ts +94 -94
  3. package/dist/declarations/src/core/hooks.d.ts +53 -53
  4. package/dist/declarations/src/core/index.d.ts +13 -13
  5. package/dist/declarations/src/core/loop.d.ts +31 -31
  6. package/dist/declarations/src/core/reconciler.d.ts +50 -50
  7. package/dist/declarations/src/core/renderer.d.ts +89 -89
  8. package/dist/declarations/src/core/store.d.ts +130 -130
  9. package/dist/declarations/src/core/utils.d.ts +262 -262
  10. package/dist/declarations/src/index.d.ts +6 -6
  11. package/dist/declarations/src/native/Canvas.d.ts +13 -13
  12. package/dist/declarations/src/native/events.d.ts +4 -4
  13. package/dist/declarations/src/native.d.ts +6 -6
  14. package/dist/declarations/src/three-types.d.ts +68 -68
  15. package/dist/declarations/src/web/Canvas.d.ts +23 -23
  16. package/dist/declarations/src/web/events.d.ts +4 -4
  17. package/dist/{events-b389eeca.esm.js → events-156d8d12.esm.js} +236 -125
  18. package/dist/{events-583399dd.cjs.prod.js → events-4c71f21f.cjs.prod.js} +235 -124
  19. package/dist/{events-f19bcc32.cjs.dev.js → events-b1bdeb1a.cjs.dev.js} +235 -124
  20. package/dist/react-three-fiber.cjs.dev.js +4 -4
  21. package/dist/react-three-fiber.cjs.prod.js +4 -4
  22. package/dist/react-three-fiber.esm.js +5 -5
  23. package/native/dist/react-three-fiber-native.cjs.dev.js +4 -4
  24. package/native/dist/react-three-fiber-native.cjs.prod.js +4 -4
  25. package/native/dist/react-three-fiber-native.esm.js +5 -5
  26. package/native/package.json +5 -5
  27. package/package.json +1 -1
  28. package/readme.md +253 -253
@@ -36,17 +36,17 @@ var threeTypes = /*#__PURE__*/Object.freeze({
36
36
  __proto__: null
37
37
  });
38
38
 
39
- /**
40
- * Returns the instance's initial (outmost) root.
39
+ /**
40
+ * Returns the instance's initial (outmost) root.
41
41
  */
42
42
  function findInitialRoot(instance) {
43
43
  let root = instance.root;
44
44
  while (root.getState().previousRoot) root = root.getState().previousRoot;
45
45
  return root;
46
46
  }
47
- /**
48
- * Safely flush async effects when testing, simulating a legacy root.
49
- * @deprecated Import from React instead. import { act } from 'react'
47
+ /**
48
+ * Safely flush async effects when testing, simulating a legacy root.
49
+ * @deprecated Import from React instead. import { act } from 'react'
50
50
  */
51
51
  // Reference with computed key to break Webpack static analysis
52
52
  // https://github.com/webpack/webpack/issues/14814
@@ -55,14 +55,14 @@ const isOrthographicCamera = def => def && def.isOrthographicCamera;
55
55
  const isRef = obj => obj && obj.hasOwnProperty('current');
56
56
  const isColorRepresentation = value => value != null && (typeof value === 'string' || typeof value === 'number' || value.isColor);
57
57
 
58
- /**
59
- * An SSR-friendly useLayoutEffect.
60
- *
61
- * React currently throws a warning when using useLayoutEffect on the server.
62
- * To get around it, we can conditionally useEffect on the server (no-op) and
63
- * useLayoutEffect elsewhere.
64
- *
65
- * @see https://github.com/facebook/react/issues/14927
58
+ /**
59
+ * An SSR-friendly useLayoutEffect.
60
+ *
61
+ * React currently throws a warning when using useLayoutEffect on the server.
62
+ * To get around it, we can conditionally useEffect on the server (no-op) and
63
+ * useLayoutEffect elsewhere.
64
+ *
65
+ * @see https://github.com/facebook/react/issues/14927
66
66
  */
67
67
  const useIsomorphicLayoutEffect = /* @__PURE__ */((_window$document, _window$navigator) => typeof window !== 'undefined' && (((_window$document = window.document) == null ? void 0 : _window$document.createElement) || ((_window$navigator = window.navigator) == null ? void 0 : _window$navigator.product) === 'ReactNative'))() ? React__namespace.useLayoutEffect : React__namespace.useEffect;
68
68
  function useMutableCallback(fn) {
@@ -70,8 +70,8 @@ function useMutableCallback(fn) {
70
70
  useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]);
71
71
  return ref;
72
72
  }
73
- /**
74
- * Bridges renderer Context and StrictMode from a primary renderer.
73
+ /**
74
+ * Bridges renderer Context and StrictMode from a primary renderer.
75
75
  */
76
76
  function useBridge() {
77
77
  const fiber = itsFine.useFiber();
@@ -123,8 +123,8 @@ function calculateDpr(dpr) {
123
123
  return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
124
124
  }
125
125
 
126
- /**
127
- * Returns instance root state
126
+ /**
127
+ * Returns instance root state
128
128
  */
129
129
  function getRootState(obj) {
130
130
  var _r3f;
@@ -380,10 +380,10 @@ function diffProps(instance, newProps) {
380
380
  if (root.constructor && root.constructor.length === 0) {
381
381
  // create a blank slate of the instance and copy the particular parameter.
382
382
  const ctor = getMemoizedPrototype(root);
383
- if (!is.und(ctor)) changedProps[key] = ctor[key];
383
+ if (!is.und(ctor)) changedProps[prop] = ctor[key];
384
384
  } else {
385
385
  // instance does not have constructor, just set it to 0
386
- changedProps[key] = 0;
386
+ changedProps[prop] = 0;
387
387
  }
388
388
  }
389
389
  return changedProps;
@@ -527,9 +527,9 @@ function makeId(event) {
527
527
  return (event.eventObject || event.object).uuid + '/' + event.index + event.instanceId;
528
528
  }
529
529
 
530
- /**
531
- * Release pointer captures.
532
- * This is called by releasePointerCapture in the API, and when an object is removed.
530
+ /**
531
+ * Release pointer captures.
532
+ * This is called by releasePointerCapture in the API, and when an object is removed.
533
533
  */
534
534
  function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
535
535
  const captureData = captures.get(obj);
@@ -907,19 +907,19 @@ function createEvents(store) {
907
907
  if (!(instance != null && instance.eventCount)) return;
908
908
  const handlers = instance.handlers;
909
909
 
910
- /*
911
- MAYBE TODO, DELETE IF NOT:
912
- Check if the object is captured, captured events should not have intersects running in parallel
913
- But wouldn't it be better to just replace capturedMap with a single entry?
914
- Also, are we OK with straight up making picking up multiple objects impossible?
915
-
916
- const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
917
- if (pointerId !== undefined) {
918
- const capturedMeshSet = internal.capturedMap.get(pointerId)
919
- if (capturedMeshSet) {
920
- const captured = capturedMeshSet.get(eventObject)
921
- if (captured && captured.localState.stopped) return
922
- }
910
+ /*
911
+ MAYBE TODO, DELETE IF NOT:
912
+ Check if the object is captured, captured events should not have intersects running in parallel
913
+ But wouldn't it be better to just replace capturedMap with a single entry?
914
+ Also, are we OK with straight up making picking up multiple objects impossible?
915
+
916
+ const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
917
+ if (pointerId !== undefined) {
918
+ const capturedMeshSet = internal.capturedMap.get(pointerId)
919
+ if (capturedMeshSet) {
920
+ const captured = capturedMeshSet.get(eventObject)
921
+ if (captured && captured.localState.stopped) return
922
+ }
923
923
  }*/
924
924
 
925
925
  if (isPointerMove) {
@@ -1210,11 +1210,11 @@ const createStore = (invalidate, advance) => {
1210
1210
  return rootStore;
1211
1211
  };
1212
1212
 
1213
- /**
1214
- * Exposes an object's {@link Instance}.
1215
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
1216
- *
1217
- * **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
1213
+ /**
1214
+ * Exposes an object's {@link Instance}.
1215
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
1216
+ *
1217
+ * **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
1218
1218
  */
1219
1219
  function useInstanceHandle(ref) {
1220
1220
  const instance = React__namespace.useRef(null);
@@ -1222,9 +1222,9 @@ function useInstanceHandle(ref) {
1222
1222
  return instance;
1223
1223
  }
1224
1224
 
1225
- /**
1226
- * Returns the R3F Canvas' Zustand store. Useful for [transient updates](https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes).
1227
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
1225
+ /**
1226
+ * Returns the R3F Canvas' Zustand store. Useful for [transient updates](https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes).
1227
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
1228
1228
  */
1229
1229
  function useStore() {
1230
1230
  const store = React__namespace.useContext(context);
@@ -1232,18 +1232,18 @@ function useStore() {
1232
1232
  return store;
1233
1233
  }
1234
1234
 
1235
- /**
1236
- * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
1237
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
1235
+ /**
1236
+ * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
1237
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
1238
1238
  */
1239
1239
  function useThree(selector = state => state, equalityFn) {
1240
1240
  return useStore()(selector, equalityFn);
1241
1241
  }
1242
1242
 
1243
- /**
1244
- * Executes a callback before render in a shared frame loop.
1245
- * Can order effects with render priority or manually render with a positive priority.
1246
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
1243
+ /**
1244
+ * Executes a callback before render in a shared frame loop.
1245
+ * Can order effects with render priority or manually render with a positive priority.
1246
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
1247
1247
  */
1248
1248
  function useFrame(callback, renderPriority = 0) {
1249
1249
  const store = useStore();
@@ -1255,9 +1255,9 @@ function useFrame(callback, renderPriority = 0) {
1255
1255
  return null;
1256
1256
  }
1257
1257
 
1258
- /**
1259
- * Returns a node graph of an object with named nodes & materials.
1260
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
1258
+ /**
1259
+ * Returns a node graph of an object with named nodes & materials.
1260
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
1261
1261
  */
1262
1262
  function useGraph(object) {
1263
1263
  return React__namespace.useMemo(() => buildGraph(object), [object]);
@@ -1293,11 +1293,11 @@ function loadingFn(extensions, onProgress) {
1293
1293
  };
1294
1294
  }
1295
1295
 
1296
- /**
1297
- * Synchronously loads and caches assets with a three loader.
1298
- *
1299
- * Note: this hook's caller must be wrapped with `React.Suspense`
1300
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1296
+ /**
1297
+ * Synchronously loads and caches assets with a three loader.
1298
+ *
1299
+ * Note: this hook's caller must be wrapped with `React.Suspense`
1300
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1301
1301
  */
1302
1302
  function useLoader(loader, input, extensions, onProgress) {
1303
1303
  // Use suspense to load async assets
@@ -1309,16 +1309,16 @@ function useLoader(loader, input, extensions, onProgress) {
1309
1309
  return Array.isArray(input) ? results : results[0];
1310
1310
  }
1311
1311
 
1312
- /**
1313
- * Preloads an asset into cache as a side-effect.
1312
+ /**
1313
+ * Preloads an asset into cache as a side-effect.
1314
1314
  */
1315
1315
  useLoader.preload = function (loader, input, extensions) {
1316
1316
  const keys = Array.isArray(input) ? input : [input];
1317
1317
  return suspendReact.preload(loadingFn(extensions), [loader, ...keys]);
1318
1318
  };
1319
1319
 
1320
- /**
1321
- * Removes a loaded asset from cache.
1320
+ /**
1321
+ * Removes a loaded asset from cache.
1322
1322
  */
1323
1323
  useLoader.clear = function (loader, input) {
1324
1324
  const keys = Array.isArray(input) ? input : [input];
@@ -1336,11 +1336,12 @@ useLoader.clear = function (loader, input) {
1336
1336
  */const t = 1,
1337
1337
  o = 8,
1338
1338
  r = 32,
1339
- e = 2;
1339
+ e = 2,
1340
+ i$1 = 268435456;
1340
1341
 
1341
1342
  var packageData = {
1342
1343
  name: "@react-three/fiber",
1343
- version: "9.6.1",
1344
+ version: "9.7.0",
1344
1345
  description: "A React renderer for Threejs",
1345
1346
  keywords: [
1346
1347
  "react",
@@ -15176,6 +15177,12 @@ function handleContainerEffects(parent, child, beforeChild) {
15176
15177
  function appendChild(parent, child) {
15177
15178
  if (!child) return;
15178
15179
 
15180
+ // Move an existing child instead of duplicating it
15181
+ if (child.parent === parent) {
15182
+ const childIndex = parent.children.indexOf(child);
15183
+ if (childIndex !== -1) parent.children.splice(childIndex, 1);
15184
+ }
15185
+
15179
15186
  // Link instances
15180
15187
  child.parent = parent;
15181
15188
  parent.children.push(child);
@@ -15186,6 +15193,12 @@ function appendChild(parent, child) {
15186
15193
  function insertBefore(parent, child, beforeChild) {
15187
15194
  if (!child || !beforeChild) return;
15188
15195
 
15196
+ // Move an existing child instead of duplicating it.
15197
+ if (child.parent === parent) {
15198
+ const childIndex = parent.children.indexOf(child);
15199
+ if (childIndex !== -1) parent.children.splice(childIndex, 1);
15200
+ }
15201
+
15189
15202
  // Link instances
15190
15203
  child.parent = parent;
15191
15204
  const childIndex = parent.children.indexOf(beforeChild);
@@ -15266,7 +15279,15 @@ function setFiberRef(fiber, publicInstance) {
15266
15279
  }
15267
15280
  }
15268
15281
  const reconstructed = [];
15269
- function swapInstances() {
15282
+ function flushReconstructedInstances() {
15283
+ if (reconstructed.length === 0) return;
15284
+ try {
15285
+ swapReconstructedInstances();
15286
+ } finally {
15287
+ reconstructed.length = 0;
15288
+ }
15289
+ }
15290
+ function swapReconstructedInstances() {
15270
15291
  // Detach instance
15271
15292
  for (const [instance] of reconstructed) {
15272
15293
  const parent = instance.parent;
@@ -15329,7 +15350,6 @@ function swapInstances() {
15329
15350
  invalidateInstance(instance);
15330
15351
  }
15331
15352
  }
15332
- reconstructed.length = 0;
15333
15353
  }
15334
15354
 
15335
15355
  // Don't handle text instances, make it no-op
@@ -15337,9 +15357,112 @@ const handleTextInstance = () => {};
15337
15357
  const NO_CONTEXT = {};
15338
15358
  let currentUpdatePriority = NoEventPriority;
15339
15359
 
15340
- // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberFlags.js
15341
- const NoFlags = 0;
15342
- const Update = 4;
15360
+ // Mirrors react-dom's getEventPriority for parity with events outside of React
15361
+ // https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/events/ReactDOMEventListener.js
15362
+ function getEventPriority(type) {
15363
+ switch (type) {
15364
+ case 'beforetoggle':
15365
+ case 'cancel':
15366
+ case 'click':
15367
+ case 'close':
15368
+ case 'contextmenu':
15369
+ case 'copy':
15370
+ case 'cut':
15371
+ case 'auxclick':
15372
+ case 'dblclick':
15373
+ case 'dragend':
15374
+ case 'dragstart':
15375
+ case 'drop':
15376
+ case 'focusin':
15377
+ case 'focusout':
15378
+ case 'input':
15379
+ case 'invalid':
15380
+ case 'keydown':
15381
+ case 'keypress':
15382
+ case 'keyup':
15383
+ case 'mousedown':
15384
+ case 'mouseup':
15385
+ case 'paste':
15386
+ case 'pause':
15387
+ case 'play':
15388
+ case 'pointercancel':
15389
+ case 'pointerdown':
15390
+ case 'pointerup':
15391
+ case 'ratechange':
15392
+ case 'reset':
15393
+ case 'resize':
15394
+ case 'seeked':
15395
+ case 'submit':
15396
+ case 'touchcancel':
15397
+ case 'touchend':
15398
+ case 'touchstart':
15399
+ case 'volumechange':
15400
+ case 'change':
15401
+ case 'selectionchange':
15402
+ case 'compositionstart':
15403
+ case 'compositionend':
15404
+ case 'compositionupdate':
15405
+ case 'beforeinput':
15406
+ case 'blur':
15407
+ case 'fullscreenchange':
15408
+ case 'focus':
15409
+ case 'hashchange':
15410
+ case 'popstate':
15411
+ case 'select':
15412
+ case 'selectstart':
15413
+ return e;
15414
+ case 'drag':
15415
+ case 'dragenter':
15416
+ case 'dragexit':
15417
+ case 'dragleave':
15418
+ case 'dragover':
15419
+ case 'mousemove':
15420
+ case 'mouseout':
15421
+ case 'mouseover':
15422
+ case 'pointermove':
15423
+ case 'pointerout':
15424
+ case 'pointerover':
15425
+ case 'scroll':
15426
+ case 'touchmove':
15427
+ case 'wheel':
15428
+ case 'mouseenter':
15429
+ case 'mouseleave':
15430
+ case 'pointerenter':
15431
+ case 'pointerleave':
15432
+ return o;
15433
+ case 'message':
15434
+ {
15435
+ switch (Tb.unstable_getCurrentPriorityLevel()) {
15436
+ case Tb.unstable_ImmediatePriority:
15437
+ return e;
15438
+ case Tb.unstable_UserBlockingPriority:
15439
+ return o;
15440
+ case Tb.unstable_NormalPriority:
15441
+ case Tb.unstable_LowPriority:
15442
+ return r;
15443
+ case Tb.unstable_IdlePriority:
15444
+ return i$1;
15445
+ default:
15446
+ return r;
15447
+ }
15448
+ }
15449
+ default:
15450
+ return r;
15451
+ }
15452
+ }
15453
+ function scheduleMicrotask(callback) {
15454
+ if (typeof queueMicrotask === 'function') {
15455
+ queueMicrotask(callback);
15456
+ } else if (typeof Promise !== 'undefined') {
15457
+ Promise.resolve().then(callback).catch(error => {
15458
+ setTimeout(() => {
15459
+ throw error;
15460
+ });
15461
+ });
15462
+ } else {
15463
+ setTimeout(callback);
15464
+ }
15465
+ }
15343
15466
  const reconciler = /* @__PURE__ */createReconciler({
15344
15467
  isPrimaryRenderer: false,
15345
15468
  warnsIfNotActing: false,
@@ -15383,30 +15506,30 @@ const reconciler = /* @__PURE__ */createReconciler({
15383
15506
  return value !== ((_oldProps$args2 = oldProps.args) == null ? void 0 : _oldProps$args2[index]);
15384
15507
  })) reconstruct = true;
15385
15508
 
15386
- // Reconstruct when args or <primitive object={...} have changes
15509
+ // Reconstruct when args or <primitive object={...} have changes.
15510
+ // Instances are swapped at the end of the mutation phase (resetAfterCommit)
15387
15511
  if (reconstruct) {
15388
- reconstructed.push([instance, {
15389
- ...newProps
15390
- }, fiber]);
15512
+ reconstructed.push([instance, getInstanceProps(newProps), fiber]);
15391
15513
  } else {
15392
15514
  // Create a diff-set, flag if there are any changes
15393
15515
  const changedProps = diffProps(instance, newProps);
15394
- if (Object.keys(changedProps).length) {
15395
- Object.assign(instance.props, changedProps);
15396
- applyProps(instance.object, changedProps);
15397
- }
15398
- }
15399
15516
 
15400
- // Flush reconstructed siblings when we hit the last updated child in a sequence
15401
- const isTailSibling = fiber.sibling === null || (fiber.flags & Update) === NoFlags;
15402
- if (isTailSibling) swapInstances();
15517
+ // Replace the old prop snapshot after computing the diff
15518
+ //`attach` is preserved since it cannot be updated dynamically
15519
+ const attach = instance.props.attach;
15520
+ instance.props = getInstanceProps(newProps);
15521
+ if (attach !== undefined) instance.props.attach = attach;else delete instance.props.attach;
15522
+ if (Object.keys(changedProps).length) applyProps(instance.object, changedProps);
15523
+ }
15403
15524
  },
15404
15525
  finalizeInitialChildren: () => false,
15405
15526
  commitMount() {},
15406
15527
  getPublicInstance: instance => instance == null ? void 0 : instance.object,
15407
15528
  prepareForCommit: () => null,
15408
15529
  preparePortalMount: container => prepare(container.getState().scene, container, '', {}),
15409
- resetAfterCommit: () => {},
15530
+ // Reconstructed instances are swapped once all mutations are committed,
15531
+ // before layout effects run so refs point to the new objects
15532
+ resetAfterCommit: flushReconstructedInstances,
15410
15533
  shouldSetTextContent: () => false,
15411
15534
  clearContainer: () => false,
15412
15535
  hideInstance,
@@ -15414,6 +15537,9 @@ const reconciler = /* @__PURE__ */createReconciler({
15414
15537
  createTextInstance: handleTextInstance,
15415
15538
  hideTextInstance: handleTextInstance,
15416
15539
  unhideTextInstance: handleTextInstance,
15540
+ // Mirrors react-dom, which flushes discrete work in microtasks
15541
+ supportsMicrotasks: true,
15542
+ scheduleMicrotask,
15417
15543
  scheduleTimeout: typeof setTimeout === 'function' ? setTimeout : undefined,
15418
15544
  cancelTimeout: typeof clearTimeout === 'function' ? clearTimeout : undefined,
15419
15545
  noTimeout: -1,
@@ -15446,24 +15572,9 @@ const reconciler = /* @__PURE__ */createReconciler({
15446
15572
  resolveUpdatePriority() {
15447
15573
  var _window$event;
15448
15574
  if (currentUpdatePriority !== NoEventPriority) return currentUpdatePriority;
15449
- switch (typeof window !== 'undefined' && ((_window$event = window.event) == null ? void 0 : _window$event.type)) {
15450
- case 'click':
15451
- case 'contextmenu':
15452
- case 'dblclick':
15453
- case 'pointercancel':
15454
- case 'pointerdown':
15455
- case 'pointerup':
15456
- return e;
15457
- case 'pointermove':
15458
- case 'pointerout':
15459
- case 'pointerover':
15460
- case 'pointerenter':
15461
- case 'pointerleave':
15462
- case 'wheel':
15463
- return o;
15464
- default:
15465
- return r;
15466
- }
15575
+ const eventType = typeof window !== 'undefined' ? (_window$event = window.event) == null ? void 0 : _window$event.type : undefined;
15576
+ if (eventType === undefined) return r;
15577
+ return getEventPriority(eventType);
15467
15578
  },
15468
15579
  resetFormInstance() {},
15469
15580
  // @ts-ignore DefinitelyTyped is not up to date
@@ -15920,10 +16031,10 @@ function Portal({
15920
16031
  children,
15921
16032
  container
15922
16033
  }) {
15923
- /** This has to be a component because it would not be able to call useThree/useStore otherwise since
15924
- * if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
15925
- * the "R3F hooks can only be used within the Canvas component!" warning:
15926
- * <Canvas>
16034
+ /** This has to be a component because it would not be able to call useThree/useStore otherwise since
16035
+ * if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
16036
+ * the "R3F hooks can only be used within the Canvas component!" warning:
16037
+ * <Canvas>
15927
16038
  * {createPortal(...)} */
15928
16039
  const {
15929
16040
  events,
@@ -16004,11 +16115,11 @@ function Portal({
16004
16115
  );
16005
16116
  }
16006
16117
 
16007
- /**
16008
- * Force React to flush any updates inside the provided callback synchronously and immediately.
16009
- * All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
16010
- * Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
16011
- * having to revert to a non-React solution. Note: this will only flush updates within the `Canvas` root.
16118
+ /**
16119
+ * Force React to flush any updates inside the provided callback synchronously and immediately.
16120
+ * All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
16121
+ * Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
16122
+ * having to revert to a non-React solution. Note: this will only flush updates within the `Canvas` root.
16012
16123
  */
16013
16124
  function flushSync(fn) {
16014
16125
  // @ts-ignore - reconciler types are not maintained
@@ -16026,21 +16137,21 @@ const globalEffects = new Set();
16026
16137
  const globalAfterEffects = new Set();
16027
16138
  const globalTailEffects = new Set();
16028
16139
 
16029
- /**
16030
- * Adds a global render callback which is called each frame.
16031
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
16140
+ /**
16141
+ * Adds a global render callback which is called each frame.
16142
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
16032
16143
  */
16033
16144
  const addEffect = callback => createSubs(callback, globalEffects);
16034
16145
 
16035
- /**
16036
- * Adds a global after-render callback which is called each frame.
16037
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
16146
+ /**
16147
+ * Adds a global after-render callback which is called each frame.
16148
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
16038
16149
  */
16039
16150
  const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
16040
16151
 
16041
- /**
16042
- * Adds a global callback which is called when rendering stops.
16043
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
16152
+ /**
16153
+ * Adds a global callback which is called when rendering stops.
16154
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
16044
16155
  */
16045
16156
  const addTail = callback => createSubs(callback, globalTailEffects);
16046
16157
  function run(effects, timestamp) {
@@ -16128,9 +16239,9 @@ function loop(timestamp) {
16128
16239
  }
16129
16240
  }
16130
16241
 
16131
- /**
16132
- * Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
16133
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
16242
+ /**
16243
+ * Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
16244
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
16134
16245
  */
16135
16246
  function invalidate(state, frames = 1) {
16136
16247
  var _state$gl$xr2;
@@ -16157,9 +16268,9 @@ function invalidate(state, frames = 1) {
16157
16268
  }
16158
16269
  }
16159
16270
 
16160
- /**
16161
- * Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
16162
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
16271
+ /**
16272
+ * Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
16273
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
16163
16274
  */
16164
16275
  function advance(timestamp, runGlobalEffects = true, state, frame) {
16165
16276
  if (runGlobalEffects) flushGlobalEffects('before', timestamp);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var events = require('./events-f19bcc32.cjs.dev.js');
5
+ var events = require('./events-b1bdeb1a.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var useMeasure = require('react-use-measure');
@@ -177,9 +177,9 @@ function CanvasImpl({
177
177
  });
178
178
  }
179
179
 
180
- /**
181
- * A DOM canvas which accepts threejs elements as children.
182
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
180
+ /**
181
+ * A DOM canvas which accepts threejs elements as children.
182
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
183
183
  */
184
184
  function Canvas(props) {
185
185
  return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var events = require('./events-583399dd.cjs.prod.js');
5
+ var events = require('./events-4c71f21f.cjs.prod.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var useMeasure = require('react-use-measure');
@@ -177,9 +177,9 @@ function CanvasImpl({
177
177
  });
178
178
  }
179
179
 
180
- /**
181
- * A DOM canvas which accepts threejs elements as children.
182
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
180
+ /**
181
+ * A DOM canvas which accepts threejs elements as children.
182
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
183
183
  */
184
184
  function Canvas(props) {
185
185
  return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
@@ -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-b389eeca.esm.js';
2
- export { t as ReactThreeFiber, _ as _roots, x as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, s as applyProps, y as buildGraph, q as context, g as createEvents, o as createPortal, c as createRoot, w as dispose, f as events, e as extend, h as flushGlobalEffects, p as flushSync, v as getRootState, m as invalidate, r as reconciler, d as unmountComponentAtNode, D as useFrame, F as useGraph, z as useInstanceHandle, G as useLoader, A as useStore, C as useThree } from './events-b389eeca.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-156d8d12.esm.js';
2
+ export { t as ReactThreeFiber, _ as _roots, x as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, s as applyProps, y as buildGraph, q as context, g as createEvents, o as createPortal, c as createRoot, w as dispose, f as events, e as extend, h as flushGlobalEffects, p as flushSync, v as getRootState, m as invalidate, r as reconciler, d as unmountComponentAtNode, D as useFrame, F as useGraph, z as useInstanceHandle, G as useLoader, A as useStore, C as useThree } from './events-156d8d12.esm.js';
3
3
  import * as React from 'react';
4
4
  import * as THREE from 'three';
5
5
  import useMeasure from 'react-use-measure';
@@ -150,9 +150,9 @@ function CanvasImpl({
150
150
  });
151
151
  }
152
152
 
153
- /**
154
- * A DOM canvas which accepts threejs elements as children.
155
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
153
+ /**
154
+ * A DOM canvas which accepts threejs elements as children.
155
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
156
156
  */
157
157
  function Canvas(props) {
158
158
  return /*#__PURE__*/jsx(FiberProvider, {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var events = require('../../dist/events-f19bcc32.cjs.dev.js');
5
+ var events = require('../../dist/events-b1bdeb1a.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var reactNative = require('react-native');
@@ -269,9 +269,9 @@ function CanvasImpl({
269
269
  });
270
270
  }
271
271
 
272
- /**
273
- * A native canvas which accepts threejs elements as children.
274
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
272
+ /**
273
+ * A native canvas which accepts threejs elements as children.
274
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
275
275
  */
276
276
  function Canvas(props) {
277
277
  return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {