@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",
@@ -6979,6 +6980,12 @@ function handleContainerEffects(parent, child, beforeChild) {
6979
6980
  function appendChild(parent, child) {
6980
6981
  if (!child) return;
6981
6982
 
6983
+ // Move an existing child instead of duplicating it
6984
+ if (child.parent === parent) {
6985
+ const childIndex = parent.children.indexOf(child);
6986
+ if (childIndex !== -1) parent.children.splice(childIndex, 1);
6987
+ }
6988
+
6982
6989
  // Link instances
6983
6990
  child.parent = parent;
6984
6991
  parent.children.push(child);
@@ -6989,6 +6996,12 @@ function appendChild(parent, child) {
6989
6996
  function insertBefore(parent, child, beforeChild) {
6990
6997
  if (!child || !beforeChild) return;
6991
6998
 
6999
+ // Move an existing child instead of duplicating it.
7000
+ if (child.parent === parent) {
7001
+ const childIndex = parent.children.indexOf(child);
7002
+ if (childIndex !== -1) parent.children.splice(childIndex, 1);
7003
+ }
7004
+
6992
7005
  // Link instances
6993
7006
  child.parent = parent;
6994
7007
  const childIndex = parent.children.indexOf(beforeChild);
@@ -7069,7 +7082,15 @@ function setFiberRef(fiber, publicInstance) {
7069
7082
  }
7070
7083
  }
7071
7084
  const reconstructed = [];
7072
- function swapInstances() {
7085
+ function flushReconstructedInstances() {
7086
+ if (reconstructed.length === 0) return;
7087
+ try {
7088
+ swapReconstructedInstances();
7089
+ } finally {
7090
+ reconstructed.length = 0;
7091
+ }
7092
+ }
7093
+ function swapReconstructedInstances() {
7073
7094
  // Detach instance
7074
7095
  for (const [instance] of reconstructed) {
7075
7096
  const parent = instance.parent;
@@ -7132,7 +7153,6 @@ function swapInstances() {
7132
7153
  invalidateInstance(instance);
7133
7154
  }
7134
7155
  }
7135
- reconstructed.length = 0;
7136
7156
  }
7137
7157
 
7138
7158
  // Don't handle text instances, make it no-op
@@ -7140,9 +7160,112 @@ const handleTextInstance = () => {};
7140
7160
  const NO_CONTEXT = {};
7141
7161
  let currentUpdatePriority = NoEventPriority;
7142
7162
 
7143
- // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberFlags.js
7144
- const NoFlags = 0;
7145
- const Update = 4;
7163
+ // Mirrors react-dom's getEventPriority for parity with events outside of React
7164
+ // https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/events/ReactDOMEventListener.js
7165
+ function getEventPriority(type) {
7166
+ switch (type) {
7167
+ case 'beforetoggle':
7168
+ case 'cancel':
7169
+ case 'click':
7170
+ case 'close':
7171
+ case 'contextmenu':
7172
+ case 'copy':
7173
+ case 'cut':
7174
+ case 'auxclick':
7175
+ case 'dblclick':
7176
+ case 'dragend':
7177
+ case 'dragstart':
7178
+ case 'drop':
7179
+ case 'focusin':
7180
+ case 'focusout':
7181
+ case 'input':
7182
+ case 'invalid':
7183
+ case 'keydown':
7184
+ case 'keypress':
7185
+ case 'keyup':
7186
+ case 'mousedown':
7187
+ case 'mouseup':
7188
+ case 'paste':
7189
+ case 'pause':
7190
+ case 'play':
7191
+ case 'pointercancel':
7192
+ case 'pointerdown':
7193
+ case 'pointerup':
7194
+ case 'ratechange':
7195
+ case 'reset':
7196
+ case 'resize':
7197
+ case 'seeked':
7198
+ case 'submit':
7199
+ case 'touchcancel':
7200
+ case 'touchend':
7201
+ case 'touchstart':
7202
+ case 'volumechange':
7203
+ case 'change':
7204
+ case 'selectionchange':
7205
+ case 'compositionstart':
7206
+ case 'compositionend':
7207
+ case 'compositionupdate':
7208
+ case 'beforeinput':
7209
+ case 'blur':
7210
+ case 'fullscreenchange':
7211
+ case 'focus':
7212
+ case 'hashchange':
7213
+ case 'popstate':
7214
+ case 'select':
7215
+ case 'selectstart':
7216
+ return e;
7217
+ case 'drag':
7218
+ case 'dragenter':
7219
+ case 'dragexit':
7220
+ case 'dragleave':
7221
+ case 'dragover':
7222
+ case 'mousemove':
7223
+ case 'mouseout':
7224
+ case 'mouseover':
7225
+ case 'pointermove':
7226
+ case 'pointerout':
7227
+ case 'pointerover':
7228
+ case 'scroll':
7229
+ case 'touchmove':
7230
+ case 'wheel':
7231
+ case 'mouseenter':
7232
+ case 'mouseleave':
7233
+ case 'pointerenter':
7234
+ case 'pointerleave':
7235
+ return o;
7236
+ case 'message':
7237
+ {
7238
+ switch (Tb.unstable_getCurrentPriorityLevel()) {
7239
+ case Tb.unstable_ImmediatePriority:
7240
+ return e;
7241
+ case Tb.unstable_UserBlockingPriority:
7242
+ return o;
7243
+ case Tb.unstable_NormalPriority:
7244
+ case Tb.unstable_LowPriority:
7245
+ return r;
7246
+ case Tb.unstable_IdlePriority:
7247
+ return i$1;
7248
+ default:
7249
+ return r;
7250
+ }
7251
+ }
7252
+ default:
7253
+ return r;
7254
+ }
7255
+ }
7256
+ function scheduleMicrotask(callback) {
7257
+ if (typeof queueMicrotask === 'function') {
7258
+ queueMicrotask(callback);
7259
+ } else if (typeof Promise !== 'undefined') {
7260
+ Promise.resolve().then(callback).catch(error => {
7261
+ setTimeout(() => {
7262
+ throw error;
7263
+ });
7264
+ });
7265
+ } else {
7266
+ setTimeout(callback);
7267
+ }
7268
+ }
7146
7269
  const reconciler = /* @__PURE__ */createReconciler({
7147
7270
  isPrimaryRenderer: false,
7148
7271
  warnsIfNotActing: false,
@@ -7186,30 +7309,30 @@ const reconciler = /* @__PURE__ */createReconciler({
7186
7309
  return value !== ((_oldProps$args2 = oldProps.args) == null ? void 0 : _oldProps$args2[index]);
7187
7310
  })) reconstruct = true;
7188
7311
 
7189
- // Reconstruct when args or <primitive object={...} have changes
7312
+ // Reconstruct when args or <primitive object={...} have changes.
7313
+ // Instances are swapped at the end of the mutation phase (resetAfterCommit)
7190
7314
  if (reconstruct) {
7191
- reconstructed.push([instance, {
7192
- ...newProps
7193
- }, fiber]);
7315
+ reconstructed.push([instance, getInstanceProps(newProps), fiber]);
7194
7316
  } else {
7195
7317
  // Create a diff-set, flag if there are any changes
7196
7318
  const changedProps = diffProps(instance, newProps);
7197
- if (Object.keys(changedProps).length) {
7198
- Object.assign(instance.props, changedProps);
7199
- applyProps(instance.object, changedProps);
7200
- }
7201
- }
7202
7319
 
7203
- // Flush reconstructed siblings when we hit the last updated child in a sequence
7204
- const isTailSibling = fiber.sibling === null || (fiber.flags & Update) === NoFlags;
7205
- if (isTailSibling) swapInstances();
7320
+ // Replace the old prop snapshot after computing the diff
7321
+ //`attach` is preserved since it cannot be updated dynamically
7322
+ const attach = instance.props.attach;
7323
+ instance.props = getInstanceProps(newProps);
7324
+ if (attach !== undefined) instance.props.attach = attach;else delete instance.props.attach;
7325
+ if (Object.keys(changedProps).length) applyProps(instance.object, changedProps);
7326
+ }
7206
7327
  },
7207
7328
  finalizeInitialChildren: () => false,
7208
7329
  commitMount() {},
7209
7330
  getPublicInstance: instance => instance == null ? void 0 : instance.object,
7210
7331
  prepareForCommit: () => null,
7211
7332
  preparePortalMount: container => prepare(container.getState().scene, container, '', {}),
7212
- resetAfterCommit: () => {},
7333
+ // Reconstructed instances are swapped once all mutations are committed,
7334
+ // before layout effects run so refs point to the new objects
7335
+ resetAfterCommit: flushReconstructedInstances,
7213
7336
  shouldSetTextContent: () => false,
7214
7337
  clearContainer: () => false,
7215
7338
  hideInstance,
@@ -7217,6 +7340,9 @@ const reconciler = /* @__PURE__ */createReconciler({
7217
7340
  createTextInstance: handleTextInstance,
7218
7341
  hideTextInstance: handleTextInstance,
7219
7342
  unhideTextInstance: handleTextInstance,
7343
+ // Mirrors react-dom, which flushes discrete work in microtasks
7344
+ supportsMicrotasks: true,
7345
+ scheduleMicrotask,
7220
7346
  scheduleTimeout: typeof setTimeout === 'function' ? setTimeout : undefined,
7221
7347
  cancelTimeout: typeof clearTimeout === 'function' ? clearTimeout : undefined,
7222
7348
  noTimeout: -1,
@@ -7249,24 +7375,9 @@ const reconciler = /* @__PURE__ */createReconciler({
7249
7375
  resolveUpdatePriority() {
7250
7376
  var _window$event;
7251
7377
  if (currentUpdatePriority !== NoEventPriority) return currentUpdatePriority;
7252
- switch (typeof window !== 'undefined' && ((_window$event = window.event) == null ? void 0 : _window$event.type)) {
7253
- case 'click':
7254
- case 'contextmenu':
7255
- case 'dblclick':
7256
- case 'pointercancel':
7257
- case 'pointerdown':
7258
- case 'pointerup':
7259
- return e;
7260
- case 'pointermove':
7261
- case 'pointerout':
7262
- case 'pointerover':
7263
- case 'pointerenter':
7264
- case 'pointerleave':
7265
- case 'wheel':
7266
- return o;
7267
- default:
7268
- return r;
7269
- }
7378
+ const eventType = typeof window !== 'undefined' ? (_window$event = window.event) == null ? void 0 : _window$event.type : undefined;
7379
+ if (eventType === undefined) return r;
7380
+ return getEventPriority(eventType);
7270
7381
  },
7271
7382
  resetFormInstance() {},
7272
7383
  // @ts-ignore DefinitelyTyped is not up to date
@@ -7723,10 +7834,10 @@ function Portal({
7723
7834
  children,
7724
7835
  container
7725
7836
  }) {
7726
- /** This has to be a component because it would not be able to call useThree/useStore otherwise since
7727
- * if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
7728
- * the "R3F hooks can only be used within the Canvas component!" warning:
7729
- * <Canvas>
7837
+ /** This has to be a component because it would not be able to call useThree/useStore otherwise since
7838
+ * if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
7839
+ * the "R3F hooks can only be used within the Canvas component!" warning:
7840
+ * <Canvas>
7730
7841
  * {createPortal(...)} */
7731
7842
  const {
7732
7843
  events,
@@ -7807,11 +7918,11 @@ function Portal({
7807
7918
  );
7808
7919
  }
7809
7920
 
7810
- /**
7811
- * Force React to flush any updates inside the provided callback synchronously and immediately.
7812
- * All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
7813
- * Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
7814
- * having to revert to a non-React solution. Note: this will only flush updates within the `Canvas` root.
7921
+ /**
7922
+ * Force React to flush any updates inside the provided callback synchronously and immediately.
7923
+ * All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
7924
+ * Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
7925
+ * having to revert to a non-React solution. Note: this will only flush updates within the `Canvas` root.
7815
7926
  */
7816
7927
  function flushSync(fn) {
7817
7928
  // @ts-ignore - reconciler types are not maintained
@@ -7829,21 +7940,21 @@ const globalEffects = new Set();
7829
7940
  const globalAfterEffects = new Set();
7830
7941
  const globalTailEffects = new Set();
7831
7942
 
7832
- /**
7833
- * Adds a global render callback which is called each frame.
7834
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
7943
+ /**
7944
+ * Adds a global render callback which is called each frame.
7945
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
7835
7946
  */
7836
7947
  const addEffect = callback => createSubs(callback, globalEffects);
7837
7948
 
7838
- /**
7839
- * Adds a global after-render callback which is called each frame.
7840
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
7949
+ /**
7950
+ * Adds a global after-render callback which is called each frame.
7951
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
7841
7952
  */
7842
7953
  const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
7843
7954
 
7844
- /**
7845
- * Adds a global callback which is called when rendering stops.
7846
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
7955
+ /**
7956
+ * Adds a global callback which is called when rendering stops.
7957
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
7847
7958
  */
7848
7959
  const addTail = callback => createSubs(callback, globalTailEffects);
7849
7960
  function run(effects, timestamp) {
@@ -7931,9 +8042,9 @@ function loop(timestamp) {
7931
8042
  }
7932
8043
  }
7933
8044
 
7934
- /**
7935
- * Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
7936
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
8045
+ /**
8046
+ * Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
8047
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
7937
8048
  */
7938
8049
  function invalidate(state, frames = 1) {
7939
8050
  var _state$gl$xr2;
@@ -7960,9 +8071,9 @@ function invalidate(state, frames = 1) {
7960
8071
  }
7961
8072
  }
7962
8073
 
7963
- /**
7964
- * Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
7965
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
8074
+ /**
8075
+ * Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
8076
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
7966
8077
  */
7967
8078
  function advance(timestamp, runGlobalEffects = true, state, frame) {
7968
8079
  if (runGlobalEffects) flushGlobalEffects('before', timestamp);