@react-three/fiber 9.2.0 → 9.4.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 +1174 -1160
  2. package/dist/declarations/src/core/events.d.ts +92 -92
  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 +191 -191
  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-59fae97e.cjs.prod.js → events-3afec6fc.cjs.prod.js} +128 -101
  18. package/dist/{events-e63d28a3.cjs.dev.js → events-6ab58ae5.cjs.dev.js} +128 -101
  19. package/dist/{events-cf57b220.esm.js → events-f8cd670d.esm.js} +127 -100
  20. package/dist/react-three-fiber.cjs.dev.js +5 -5
  21. package/dist/react-three-fiber.cjs.prod.js +5 -5
  22. package/dist/react-three-fiber.esm.js +6 -6
  23. package/native/dist/react-three-fiber-native.cjs.dev.js +8 -6
  24. package/native/dist/react-three-fiber-native.cjs.prod.js +8 -6
  25. package/native/dist/react-three-fiber-native.esm.js +9 -7
  26. package/native/package.json +5 -5
  27. package/package.json +2 -2
  28. package/readme.md +253 -253
@@ -1,10 +1,10 @@
1
- import * as THREE from 'three';
2
1
  import * as React from 'react';
3
2
  import { DefaultEventPriority, ContinuousEventPriority, DiscreteEventPriority, ConcurrentRoot } from 'react-reconciler/constants';
3
+ import * as THREE from 'three';
4
4
  import { createWithEqualityFn } from 'zustand/traditional';
5
+ import { suspend, preload, clear } from 'suspend-react';
5
6
  import Reconciler from 'react-reconciler';
6
7
  import { unstable_scheduleCallback, unstable_IdlePriority } from 'scheduler';
7
- import { suspend, preload, clear } from 'suspend-react';
8
8
  import { jsx, Fragment } from 'react/jsx-runtime';
9
9
  import { useFiber, useContextBridge, traverseFiber } from 'its-fine';
10
10
 
@@ -12,17 +12,17 @@ var threeTypes = /*#__PURE__*/Object.freeze({
12
12
  __proto__: null
13
13
  });
14
14
 
15
- /**
16
- * Returns the instance's initial (outmost) root.
15
+ /**
16
+ * Returns the instance's initial (outmost) root.
17
17
  */
18
18
  function findInitialRoot(instance) {
19
19
  let root = instance.root;
20
20
  while (root.getState().previousRoot) root = root.getState().previousRoot;
21
21
  return root;
22
22
  }
23
- /**
24
- * Safely flush async effects when testing, simulating a legacy root.
25
- * @deprecated Import from React instead. import { act } from 'react'
23
+ /**
24
+ * Safely flush async effects when testing, simulating a legacy root.
25
+ * @deprecated Import from React instead. import { act } from 'react'
26
26
  */
27
27
  // Reference with computed key to break Webpack static analysis
28
28
  // https://github.com/webpack/webpack/issues/14814
@@ -31,14 +31,14 @@ const isOrthographicCamera = def => def && def.isOrthographicCamera;
31
31
  const isRef = obj => obj && obj.hasOwnProperty('current');
32
32
  const isColorRepresentation = value => value != null && (typeof value === 'string' || typeof value === 'number' || value.isColor);
33
33
 
34
- /**
35
- * An SSR-friendly useLayoutEffect.
36
- *
37
- * React currently throws a warning when using useLayoutEffect on the server.
38
- * To get around it, we can conditionally useEffect on the server (no-op) and
39
- * useLayoutEffect elsewhere.
40
- *
41
- * @see https://github.com/facebook/react/issues/14927
34
+ /**
35
+ * An SSR-friendly useLayoutEffect.
36
+ *
37
+ * React currently throws a warning when using useLayoutEffect on the server.
38
+ * To get around it, we can conditionally useEffect on the server (no-op) and
39
+ * useLayoutEffect elsewhere.
40
+ *
41
+ * @see https://github.com/facebook/react/issues/14927
42
42
  */
43
43
  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.useLayoutEffect : React.useEffect;
44
44
  function useMutableCallback(fn) {
@@ -46,8 +46,8 @@ function useMutableCallback(fn) {
46
46
  useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]);
47
47
  return ref;
48
48
  }
49
- /**
50
- * Bridges renderer Context and StrictMode from a primary renderer.
49
+ /**
50
+ * Bridges renderer Context and StrictMode from a primary renderer.
51
51
  */
52
52
  function useBridge() {
53
53
  const fiber = useFiber();
@@ -99,8 +99,8 @@ function calculateDpr(dpr) {
99
99
  return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
100
100
  }
101
101
 
102
- /**
103
- * Returns instance root state
102
+ /**
103
+ * Returns instance root state
104
104
  */
105
105
  function getRootState(obj) {
106
106
  var _r3f;
@@ -215,24 +215,46 @@ function prepare(target, root, type, props) {
215
215
  return instance;
216
216
  }
217
217
  function resolve(root, key) {
218
- let target = root[key];
219
218
  if (!key.includes('-')) return {
220
219
  root,
221
220
  key,
222
- target
221
+ target: root[key]
223
222
  };
224
223
 
225
- // Resolve pierced target
226
- target = root;
227
- for (const part of key.split('-')) {
228
- var _target;
224
+ // First try the entire key as a single property (e.g., 'foo-bar')
225
+ if (key in root) {
226
+ return {
227
+ root,
228
+ key,
229
+ target: root[key]
230
+ };
231
+ }
232
+
233
+ // Try piercing (e.g., 'material-color' -> material.color)
234
+ let target = root;
235
+ const parts = key.split('-');
236
+ for (const part of parts) {
237
+ if (typeof target !== 'object' || target === null) {
238
+ if (target !== undefined) {
239
+ // Property exists but has unexpected shape
240
+ const remaining = parts.slice(parts.indexOf(part)).join('-');
241
+ return {
242
+ root: target,
243
+ key: remaining,
244
+ target: undefined
245
+ };
246
+ }
247
+ // Property doesn't exist - fallback to original key
248
+ return {
249
+ root,
250
+ key,
251
+ target: undefined
252
+ };
253
+ }
229
254
  key = part;
230
255
  root = target;
231
- target = (_target = target) == null ? void 0 : _target[key];
256
+ target = target[key];
232
257
  }
233
-
234
- // TODO: change key to 'foo-bar' if target is undefined?
235
-
236
258
  return {
237
259
  root,
238
260
  key,
@@ -375,6 +397,11 @@ function applyProps(object, props) {
375
397
  target
376
398
  } = resolve(object, prop);
377
399
 
400
+ // Throw an error if we attempted to set a pierced prop to a non-object
401
+ if (target === undefined && (typeof root !== 'object' || root === null)) {
402
+ throw Error(`R3F: Cannot set "${prop}". Ensure it is an object before setting "${key}".`);
403
+ }
404
+
378
405
  // Layers must be written to the mask property
379
406
  if (target instanceof THREE.Layers && value instanceof THREE.Layers) {
380
407
  target.mask = value.mask;
@@ -463,9 +490,9 @@ function makeId(event) {
463
490
  return (event.eventObject || event.object).uuid + '/' + event.index + event.instanceId;
464
491
  }
465
492
 
466
- /**
467
- * Release pointer captures.
468
- * This is called by releasePointerCapture in the API, and when an object is removed.
493
+ /**
494
+ * Release pointer captures.
495
+ * This is called by releasePointerCapture in the API, and when an object is removed.
469
496
  */
470
497
  function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
471
498
  const captureData = captures.get(obj);
@@ -812,19 +839,19 @@ function createEvents(store) {
812
839
  if (!(instance != null && instance.eventCount)) return;
813
840
  const handlers = instance.handlers;
814
841
 
815
- /*
816
- MAYBE TODO, DELETE IF NOT:
817
- Check if the object is captured, captured events should not have intersects running in parallel
818
- But wouldn't it be better to just replace capturedMap with a single entry?
819
- Also, are we OK with straight up making picking up multiple objects impossible?
820
-
821
- const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
822
- if (pointerId !== undefined) {
823
- const capturedMeshSet = internal.capturedMap.get(pointerId)
824
- if (capturedMeshSet) {
825
- const captured = capturedMeshSet.get(eventObject)
826
- if (captured && captured.localState.stopped) return
827
- }
842
+ /*
843
+ MAYBE TODO, DELETE IF NOT:
844
+ Check if the object is captured, captured events should not have intersects running in parallel
845
+ But wouldn't it be better to just replace capturedMap with a single entry?
846
+ Also, are we OK with straight up making picking up multiple objects impossible?
847
+
848
+ const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
849
+ if (pointerId !== undefined) {
850
+ const capturedMeshSet = internal.capturedMap.get(pointerId)
851
+ if (capturedMeshSet) {
852
+ const captured = capturedMeshSet.get(eventObject)
853
+ if (captured && captured.localState.stopped) return
854
+ }
828
855
  }*/
829
856
 
830
857
  if (isPointerMove) {
@@ -1115,11 +1142,11 @@ const createStore = (invalidate, advance) => {
1115
1142
  return rootStore;
1116
1143
  };
1117
1144
 
1118
- /**
1119
- * Exposes an object's {@link Instance}.
1120
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
1121
- *
1122
- * **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
1145
+ /**
1146
+ * Exposes an object's {@link Instance}.
1147
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
1148
+ *
1149
+ * **Note**: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
1123
1150
  */
1124
1151
  function useInstanceHandle(ref) {
1125
1152
  const instance = React.useRef(null);
@@ -1127,9 +1154,9 @@ function useInstanceHandle(ref) {
1127
1154
  return instance;
1128
1155
  }
1129
1156
 
1130
- /**
1131
- * Returns the R3F Canvas' Zustand store. Useful for [transient updates](https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes).
1132
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
1157
+ /**
1158
+ * Returns the R3F Canvas' Zustand store. Useful for [transient updates](https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes).
1159
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
1133
1160
  */
1134
1161
  function useStore() {
1135
1162
  const store = React.useContext(context);
@@ -1137,18 +1164,18 @@ function useStore() {
1137
1164
  return store;
1138
1165
  }
1139
1166
 
1140
- /**
1141
- * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
1142
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
1167
+ /**
1168
+ * Accesses R3F's internal state, containing renderer, canvas, scene, etc.
1169
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
1143
1170
  */
1144
1171
  function useThree(selector = state => state, equalityFn) {
1145
1172
  return useStore()(selector, equalityFn);
1146
1173
  }
1147
1174
 
1148
- /**
1149
- * Executes a callback before render in a shared frame loop.
1150
- * Can order effects with render priority or manually render with a positive priority.
1151
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
1175
+ /**
1176
+ * Executes a callback before render in a shared frame loop.
1177
+ * Can order effects with render priority or manually render with a positive priority.
1178
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
1152
1179
  */
1153
1180
  function useFrame(callback, renderPriority = 0) {
1154
1181
  const store = useStore();
@@ -1160,9 +1187,9 @@ function useFrame(callback, renderPriority = 0) {
1160
1187
  return null;
1161
1188
  }
1162
1189
 
1163
- /**
1164
- * Returns a node graph of an object with named nodes & materials.
1165
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
1190
+ /**
1191
+ * Returns a node graph of an object with named nodes & materials.
1192
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usegraph
1166
1193
  */
1167
1194
  function useGraph(object) {
1168
1195
  return React.useMemo(() => buildGraph(object), [object]);
@@ -1198,11 +1225,11 @@ function loadingFn(extensions, onProgress) {
1198
1225
  };
1199
1226
  }
1200
1227
 
1201
- /**
1202
- * Synchronously loads and caches assets with a three loader.
1203
- *
1204
- * Note: this hook's caller must be wrapped with `React.Suspense`
1205
- * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1228
+ /**
1229
+ * Synchronously loads and caches assets with a three loader.
1230
+ *
1231
+ * Note: this hook's caller must be wrapped with `React.Suspense`
1232
+ * @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
1206
1233
  */
1207
1234
  function useLoader(loader, input, extensions, onProgress) {
1208
1235
  // Use suspense to load async assets
@@ -1214,25 +1241,22 @@ function useLoader(loader, input, extensions, onProgress) {
1214
1241
  return Array.isArray(input) ? results : results[0];
1215
1242
  }
1216
1243
 
1217
- /**
1218
- * Preloads an asset into cache as a side-effect.
1244
+ /**
1245
+ * Preloads an asset into cache as a side-effect.
1219
1246
  */
1220
1247
  useLoader.preload = function (loader, input, extensions) {
1221
1248
  const keys = Array.isArray(input) ? input : [input];
1222
1249
  return preload(loadingFn(extensions), [loader, ...keys]);
1223
1250
  };
1224
1251
 
1225
- /**
1226
- * Removes a loaded asset from cache.
1252
+ /**
1253
+ * Removes a loaded asset from cache.
1227
1254
  */
1228
1255
  useLoader.clear = function (loader, input) {
1229
1256
  const keys = Array.isArray(input) ? input : [input];
1230
1257
  return clear([loader, ...keys]);
1231
1258
  };
1232
1259
 
1233
- // TODO: upstream to DefinitelyTyped for React 19
1234
- // https://github.com/facebook/react/issues/28956
1235
-
1236
1260
  function createReconciler(config) {
1237
1261
  const reconciler = Reconciler(config);
1238
1262
  reconciler.injectIntoDevTools({
@@ -1630,6 +1654,8 @@ const reconciler = /* @__PURE__ */createReconciler({
1630
1654
  suspendInstance() {},
1631
1655
  waitForCommitToBeReady: () => null,
1632
1656
  NotPendingTransition: null,
1657
+ // The reconciler types use the internal ReactContext with all the hidden properties
1658
+ // so we have to cast from the public React.Context type
1633
1659
  HostTransitionContext: /* @__PURE__ */React.createContext(null),
1634
1660
  setCurrentUpdatePriority(newPriority) {
1635
1661
  currentUpdatePriority = newPriority;
@@ -2057,10 +2083,10 @@ function Portal({
2057
2083
  children,
2058
2084
  container
2059
2085
  }) {
2060
- /** This has to be a component because it would not be able to call useThree/useStore otherwise since
2061
- * if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
2062
- * the "R3F hooks can only be used within the Canvas component!" warning:
2063
- * <Canvas>
2086
+ /** This has to be a component because it would not be able to call useThree/useStore otherwise since
2087
+ * if this is our environment, then we are not in r3f's renderer but in react-dom, it would trigger
2088
+ * the "R3F hooks can only be used within the Canvas component!" warning:
2089
+ * <Canvas>
2064
2090
  * {createPortal(...)} */
2065
2091
  const {
2066
2092
  events,
@@ -2141,14 +2167,15 @@ function Portal({
2141
2167
  );
2142
2168
  }
2143
2169
 
2144
- /**
2145
- * Force React to flush any updates inside the provided callback synchronously and immediately.
2146
- * All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
2147
- * Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
2148
- * having to revert to a non-React solution.
2170
+ /**
2171
+ * Force React to flush any updates inside the provided callback synchronously and immediately.
2172
+ * All the same caveats documented for react-dom's `flushSync` apply here (see https://react.dev/reference/react-dom/flushSync).
2173
+ * Nevertheless, sometimes one needs to render synchronously, for example to keep DOM and 3D changes in lock-step without
2174
+ * having to revert to a non-React solution. Note: this will only flush updates within the `Canvas` root.
2149
2175
  */
2150
2176
  function flushSync(fn) {
2151
- return reconciler.flushSync(fn);
2177
+ // @ts-ignore - reconciler types are not maintained
2178
+ return reconciler.flushSyncFromReconciler(fn);
2152
2179
  }
2153
2180
 
2154
2181
  function createSubs(callback, subs) {
@@ -2162,21 +2189,21 @@ const globalEffects = new Set();
2162
2189
  const globalAfterEffects = new Set();
2163
2190
  const globalTailEffects = new Set();
2164
2191
 
2165
- /**
2166
- * Adds a global render callback which is called each frame.
2167
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
2192
+ /**
2193
+ * Adds a global render callback which is called each frame.
2194
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect
2168
2195
  */
2169
2196
  const addEffect = callback => createSubs(callback, globalEffects);
2170
2197
 
2171
- /**
2172
- * Adds a global after-render callback which is called each frame.
2173
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
2198
+ /**
2199
+ * Adds a global after-render callback which is called each frame.
2200
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect
2174
2201
  */
2175
2202
  const addAfterEffect = callback => createSubs(callback, globalAfterEffects);
2176
2203
 
2177
- /**
2178
- * Adds a global callback which is called when rendering stops.
2179
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
2204
+ /**
2205
+ * Adds a global callback which is called when rendering stops.
2206
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail
2180
2207
  */
2181
2208
  const addTail = callback => createSubs(callback, globalTailEffects);
2182
2209
  function run(effects, timestamp) {
@@ -2264,9 +2291,9 @@ function loop(timestamp) {
2264
2291
  }
2265
2292
  }
2266
2293
 
2267
- /**
2268
- * Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
2269
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
2294
+ /**
2295
+ * Invalidates the view, requesting a frame to be rendered. Will globally invalidate unless passed a root's state.
2296
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#invalidate
2270
2297
  */
2271
2298
  function invalidate(state, frames = 1) {
2272
2299
  var _state$gl$xr2;
@@ -2293,9 +2320,9 @@ function invalidate(state, frames = 1) {
2293
2320
  }
2294
2321
  }
2295
2322
 
2296
- /**
2297
- * Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
2298
- * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
2323
+ /**
2324
+ * Advances the frameloop and runs render effects, useful for when manually rendering via `frameloop="never"`.
2325
+ * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
2299
2326
  */
2300
2327
  function advance(timestamp, runGlobalEffects = true, state, frame) {
2301
2328
  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-e63d28a3.cjs.dev.js');
5
+ var events = require('./events-6ab58ae5.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var useMeasure = require('react-use-measure');
@@ -10,9 +10,9 @@ var itsFine = require('its-fine');
10
10
  var jsxRuntime = require('react/jsx-runtime');
11
11
  require('react-reconciler/constants');
12
12
  require('zustand/traditional');
13
+ require('suspend-react');
13
14
  require('react-reconciler');
14
15
  require('scheduler');
15
- require('suspend-react');
16
16
 
17
17
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
18
18
 
@@ -179,9 +179,9 @@ function CanvasImpl({
179
179
  });
180
180
  }
181
181
 
182
- /**
183
- * A DOM canvas which accepts threejs elements as children.
184
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
182
+ /**
183
+ * A DOM canvas which accepts threejs elements as children.
184
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
185
185
  */
186
186
  function Canvas(props) {
187
187
  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-59fae97e.cjs.prod.js');
5
+ var events = require('./events-3afec6fc.cjs.prod.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var useMeasure = require('react-use-measure');
@@ -10,9 +10,9 @@ var itsFine = require('its-fine');
10
10
  var jsxRuntime = require('react/jsx-runtime');
11
11
  require('react-reconciler/constants');
12
12
  require('zustand/traditional');
13
+ require('suspend-react');
13
14
  require('react-reconciler');
14
15
  require('scheduler');
15
- require('suspend-react');
16
16
 
17
17
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
18
18
 
@@ -179,9 +179,9 @@ function CanvasImpl({
179
179
  });
180
180
  }
181
181
 
182
- /**
183
- * A DOM canvas which accepts threejs elements as children.
184
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
182
+ /**
183
+ * A DOM canvas which accepts threejs elements as children.
184
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
185
185
  */
186
186
  function Canvas(props) {
187
187
  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-cf57b220.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-cf57b220.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-f8cd670d.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-f8cd670d.esm.js';
3
3
  import * as React from 'react';
4
4
  import * as THREE from 'three';
5
5
  import useMeasure from 'react-use-measure';
@@ -7,9 +7,9 @@ import { FiberProvider } from 'its-fine';
7
7
  import { jsx } from 'react/jsx-runtime';
8
8
  import 'react-reconciler/constants';
9
9
  import 'zustand/traditional';
10
+ import 'suspend-react';
10
11
  import 'react-reconciler';
11
12
  import 'scheduler';
12
- import 'suspend-react';
13
13
 
14
14
  function CanvasImpl({
15
15
  ref,
@@ -152,9 +152,9 @@ function CanvasImpl({
152
152
  });
153
153
  }
154
154
 
155
- /**
156
- * A DOM canvas which accepts threejs elements as children.
157
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
155
+ /**
156
+ * A DOM canvas which accepts threejs elements as children.
157
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
158
158
  */
159
159
  function Canvas(props) {
160
160
  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-e63d28a3.cjs.dev.js');
5
+ var events = require('../../dist/events-6ab58ae5.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var reactNative = require('react-native');
@@ -15,9 +15,9 @@ var base64Js = require('base64-js');
15
15
  var buffer = require('buffer');
16
16
  require('react-reconciler/constants');
17
17
  require('zustand/traditional');
18
+ require('suspend-react');
18
19
  require('react-reconciler');
19
20
  require('scheduler');
20
- require('suspend-react');
21
21
 
22
22
  function _interopNamespace(e) {
23
23
  if (e && e.__esModule) return e;
@@ -273,9 +273,9 @@ function CanvasImpl({
273
273
  });
274
274
  }
275
275
 
276
- /**
277
- * A native canvas which accepts threejs elements as children.
278
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
276
+ /**
277
+ * A native canvas which accepts threejs elements as children.
278
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
279
279
  */
280
280
  function Canvas(props) {
281
281
  return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
@@ -438,7 +438,9 @@ function polyfills() {
438
438
  const url = URL.createObjectURL(blob);
439
439
  URL.revokeObjectURL(url);
440
440
  } catch (_) {
441
- const BlobManager = require('react-native/Libraries/Blob/BlobManager.js');
441
+ var _BlobManagerModule$de;
442
+ const BlobManagerModule = require('react-native/Libraries/Blob/BlobManager.js');
443
+ const BlobManager = (_BlobManagerModule$de = BlobManagerModule.default) != null ? _BlobManagerModule$de : BlobManagerModule;
442
444
  const createObjectURL = URL.createObjectURL;
443
445
  URL.createObjectURL = function (blob) {
444
446
  if (blob.data._base64) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var events = require('../../dist/events-59fae97e.cjs.prod.js');
5
+ var events = require('../../dist/events-3afec6fc.cjs.prod.js');
6
6
  var React = require('react');
7
7
  var THREE = require('three');
8
8
  var reactNative = require('react-native');
@@ -15,9 +15,9 @@ var base64Js = require('base64-js');
15
15
  var buffer = require('buffer');
16
16
  require('react-reconciler/constants');
17
17
  require('zustand/traditional');
18
+ require('suspend-react');
18
19
  require('react-reconciler');
19
20
  require('scheduler');
20
- require('suspend-react');
21
21
 
22
22
  function _interopNamespace(e) {
23
23
  if (e && e.__esModule) return e;
@@ -273,9 +273,9 @@ function CanvasImpl({
273
273
  });
274
274
  }
275
275
 
276
- /**
277
- * A native canvas which accepts threejs elements as children.
278
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
276
+ /**
277
+ * A native canvas which accepts threejs elements as children.
278
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
279
279
  */
280
280
  function Canvas(props) {
281
281
  return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
@@ -438,7 +438,9 @@ function polyfills() {
438
438
  const url = URL.createObjectURL(blob);
439
439
  URL.revokeObjectURL(url);
440
440
  } catch (_) {
441
- const BlobManager = require('react-native/Libraries/Blob/BlobManager.js');
441
+ var _BlobManagerModule$de;
442
+ const BlobManagerModule = require('react-native/Libraries/Blob/BlobManager.js');
443
+ const BlobManager = (_BlobManagerModule$de = BlobManagerModule.default) != null ? _BlobManagerModule$de : BlobManagerModule;
442
444
  const createObjectURL = URL.createObjectURL;
443
445
  URL.createObjectURL = function (blob) {
444
446
  if (blob.data._base64) {
@@ -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-cf57b220.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, 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 '../../dist/events-cf57b220.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-f8cd670d.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, 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 '../../dist/events-f8cd670d.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';
@@ -12,9 +12,9 @@ import { fromByteArray } from 'base64-js';
12
12
  import { Buffer } from 'buffer';
13
13
  import 'react-reconciler/constants';
14
14
  import 'zustand/traditional';
15
+ import 'suspend-react';
15
16
  import 'react-reconciler';
16
17
  import 'scheduler';
17
- import 'suspend-react';
18
18
 
19
19
  // TODO: React 19 needs support from react-native
20
20
  const _View = View;
@@ -248,9 +248,9 @@ function CanvasImpl({
248
248
  });
249
249
  }
250
250
 
251
- /**
252
- * A native canvas which accepts threejs elements as children.
253
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
251
+ /**
252
+ * A native canvas which accepts threejs elements as children.
253
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
254
254
  */
255
255
  function Canvas(props) {
256
256
  return /*#__PURE__*/jsx(FiberProvider, {
@@ -413,7 +413,9 @@ function polyfills() {
413
413
  const url = URL.createObjectURL(blob);
414
414
  URL.revokeObjectURL(url);
415
415
  } catch (_) {
416
- const BlobManager = require('react-native/Libraries/Blob/BlobManager.js');
416
+ var _BlobManagerModule$de;
417
+ const BlobManagerModule = require('react-native/Libraries/Blob/BlobManager.js');
418
+ const BlobManager = (_BlobManagerModule$de = BlobManagerModule.default) != null ? _BlobManagerModule$de : BlobManagerModule;
417
419
  const createObjectURL = URL.createObjectURL;
418
420
  URL.createObjectURL = function (blob) {
419
421
  if (blob.data._base64) {
@@ -1,5 +1,5 @@
1
- {
2
- "main": "dist/react-three-fiber-native.cjs.js",
3
- "module": "dist/react-three-fiber-native.esm.js",
4
- "types": "dist/react-three-fiber-native.cjs.d.ts"
5
- }
1
+ {
2
+ "main": "dist/react-three-fiber-native.cjs.js",
3
+ "module": "dist/react-three-fiber-native.esm.js",
4
+ "types": "dist/react-three-fiber-native.cjs.d.ts"
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "9.2.0",
3
+ "version": "9.4.0",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.17.8",
47
- "@types/react-reconciler": "^0.28.9",
47
+ "@types/react-reconciler": "^0.32.0",
48
48
  "@types/webxr": "*",
49
49
  "base64-js": "^1.5.1",
50
50
  "buffer": "^6.0.3",