@react-three/fiber 10.0.0-canary.98da52a → 10.0.0-canary.a1c1d93

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 (32) hide show
  1. package/dist/extension.d.cts +3 -3
  2. package/dist/extension.d.mts +3 -3
  3. package/dist/extension.d.ts +3 -3
  4. package/dist/extension.mjs +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.d.cts +5 -5
  7. package/dist/index.d.mts +5 -5
  8. package/dist/index.d.ts +5 -5
  9. package/dist/index.mjs +3 -3
  10. package/dist/legacy.cjs +1 -1
  11. package/dist/legacy.d.cts +4 -4
  12. package/dist/legacy.d.mts +4 -4
  13. package/dist/legacy.d.ts +4 -4
  14. package/dist/legacy.mjs +4 -4
  15. package/dist/shared/{fiber.DAl4H27x.d.cts → fiber.-1JhXWEC.d.cts} +1 -1
  16. package/dist/shared/{fiber.DNehrxK5.d.ts → fiber.Bkpap4yF.d.mts} +76 -1
  17. package/dist/shared/{fiber.TWXdbcWP.d.mts → fiber.BnIfHyTk.d.cts} +76 -1
  18. package/dist/shared/{fiber.I5Q4dVvl.d.cts → fiber.CLTHZhZp.d.cts} +30 -2
  19. package/dist/shared/{fiber.I5Q4dVvl.d.mts → fiber.CLTHZhZp.d.mts} +30 -2
  20. package/dist/shared/{fiber.I5Q4dVvl.d.ts → fiber.CLTHZhZp.d.ts} +30 -2
  21. package/dist/shared/{fiber.Cx-UAmMb.d.ts → fiber.CTEAJNmg.d.ts} +1 -1
  22. package/dist/shared/{fiber.B0oukOFO.mjs → fiber.CUKAa7Rv.mjs} +1 -1
  23. package/dist/shared/{fiber.BU0vBHc9.d.mts → fiber.CksZuiOV.d.mts} +1 -1
  24. package/dist/shared/{fiber.CT-cCVjA.mjs → fiber.Dl_2kSXg.mjs} +284 -88
  25. package/dist/shared/{fiber.11sXr8Eb.d.cts → fiber.NwhGYEh-.d.ts} +76 -1
  26. package/dist/shared/{fiber.Cn-vxHMl.cjs → fiber.nPYZB2AE.cjs} +284 -88
  27. package/dist/webgpu/index.cjs +1 -1
  28. package/dist/webgpu/index.d.cts +4 -4
  29. package/dist/webgpu/index.d.mts +4 -4
  30. package/dist/webgpu/index.d.ts +4 -4
  31. package/dist/webgpu/index.mjs +4 -4
  32. package/package.json +1 -1
@@ -477,6 +477,11 @@ interface InternalState {
477
477
  * Selected once, from the entry's provider, and copied into portals with the rest of `internal`.
478
478
  */
479
479
  support: R3FRendererSupport
480
+ /**
481
+ * Releases this root's lease on its renderer. The last release disposes a renderer R3F created;
482
+ * a renderer passed in as an instance is never disposed by R3F.
483
+ */
484
+ releaseRenderer?: () => void | Promise<void>
480
485
  /** Global scheduler reference (for useFrame hook) */
481
486
  scheduler: SchedulerApi | null
482
487
  /**
@@ -489,6 +494,8 @@ interface InternalState {
489
494
  rootId?: string
490
495
  /** Function to unregister this root from the global scheduler */
491
496
  unregisterRoot?: () => void
497
+ /** Function to stop following devicePixelRatio changes */
498
+ unwatchDpr?: () => void
492
499
  /** Container for child attachment (scene for root, original container for portals) */
493
500
  container?: THREE.Object3D
494
501
  /**
@@ -530,6 +537,12 @@ interface InternalState {
530
537
  * Only set when isSecondary is true.
531
538
  */
532
539
  targetId?: string
540
+ /**
541
+ * This secondary stopped sharing because the primary's renderer fell back to its
542
+ * WebGL2 backend (#3965): it owns the renderer it constructed, so it is not
543
+ * `isSecondary` (which marks a canvas borrowing another's renderer).
544
+ */
545
+ sharedRendererFallback?: boolean
533
546
  /**
534
547
  * Function to unregister this primary canvas from the registry.
535
548
  * Only set when this canvas has an `id` prop.
@@ -660,9 +673,17 @@ type RootStore = UseBoundStoreWithEqualityFn<StoreApi<RootState>>
660
673
  // to avoid bundling @types/react-reconciler which causes absolute path issues
661
674
  type FiberRoot = any
662
675
 
676
+ /** A promise tagged with its state, the protocol React's `use` reads */
677
+ type TrackedPromise<T> = Promise<T> &
678
+ ({ status: 'pending' } | { status: 'fulfilled'; value: T } | { status: 'rejected'; reason: unknown })
679
+
663
680
  interface Root {
664
681
  fiber: FiberRoot
665
682
  store: RootStore
683
+ /** Set while a teardown waits on React. Configure and render clear it, which cancels the teardown */
684
+ unmountClaim: symbol | null
685
+ /** Pending only while a renderer is being created */
686
+ ready: TrackedPromise<unknown>
666
687
  }
667
688
 
668
689
  type AttachFnType<O = any> = (parent: any, self: O) => () => void
@@ -772,7 +793,14 @@ declare function useStore(): RootStore;
772
793
  */
773
794
  declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
774
795
 
796
+ /**
797
+ * React context that carries the current root's {@link RootStore}. Each root provides its store and
798
+ * each portal provides its own scoped one; `useStore`, and every hook built on it, reads it.
799
+ *
800
+ * Stored on `globalThis` under `Symbol.for('@react-three/fiber.context')`, so every copy and entry
801
+ * of fiber shares a single context.
802
+ */
775
803
  declare const context: React.Context<RootStore>;
776
804
 
777
- export { useStore as ag, useThree as ah, context as ai, registerRootExtension as r, setRenderOverride as s };
778
- export type { EquConfig as $, AttachFnType as A, InstanceProps as B, ConstructorRepresentation as C, Dpr as D, Events as E, Frameloop as F, Instance as G, HostConfig as H, InternalState as I, Properties as J, IsOptional as K, IsAllOptional as L, Mutable as M, NonFunctionKeys as N, Overwrite as O, PointerState as P, ThreeCamera as Q, R3FRenderTarget as R, Subscription as S, ThreeEvent as T, Act as U, Viewport as V, Bridge as W, XRManager as X, SetBlock as Y, UnblockProps as Z, ObjectMap as _, RootExtension as a, Disposable as a0, FrameNextState as a1, FrameState as a2, FrameNextCallback as a3, FrameCallback as a4, ThreeNamespace as a5, ThreeCore as a6, OcclusionSupport as a7, WebGLSupport as a8, WebGPUSupport as a9, RendererSupport as aa, RendererProvider as ab, Register as ac, RegisteredRenderer as ad, ForRegisteredRenderer as ae, R3FRendererSupport as af, R3FRenderer as b, Size as c, RenderCallback as d, Performance as e, RootState as f, RootStore as g, Intersection as h, Camera as i, IntersectionEvent as j, DomEvent as k, EventHandlers as l, FilterFunction as m, ComputeFunction as n, XRPointerConfig as o, EventManager as p, PointerCaptureTarget as q, VisibilityEntry as t, FiberRoot as u, Root as v, AttachType as w, Catalogue as x, Args as y, ArgsProp as z };
805
+ export { useStore as ah, useThree as ai, context as aj, registerRootExtension as r, setRenderOverride as s };
806
+ export type { ObjectMap as $, AttachFnType as A, ArgsProp as B, ConstructorRepresentation as C, Dpr as D, Events as E, Frameloop as F, InstanceProps as G, Instance as H, InternalState as I, HostConfig as J, Properties as K, IsOptional as L, Mutable as M, NonFunctionKeys as N, Overwrite as O, PointerState as P, IsAllOptional as Q, R3FRenderTarget as R, Subscription as S, ThreeEvent as T, ThreeCamera as U, Viewport as V, Act as W, XRManager as X, Bridge as Y, SetBlock as Z, UnblockProps as _, RootExtension as a, EquConfig as a0, Disposable as a1, FrameNextState as a2, FrameState as a3, FrameNextCallback as a4, FrameCallback as a5, ThreeNamespace as a6, ThreeCore as a7, OcclusionSupport as a8, WebGLSupport as a9, WebGPUSupport as aa, RendererSupport as ab, RendererProvider as ac, Register as ad, RegisteredRenderer as ae, ForRegisteredRenderer as af, R3FRendererSupport as ag, R3FRenderer as b, Size as c, RenderCallback as d, Performance as e, RootState as f, RootStore as g, Intersection as h, Camera as i, IntersectionEvent as j, DomEvent as k, EventHandlers as l, FilterFunction as m, ComputeFunction as n, XRPointerConfig as o, EventManager as p, PointerCaptureTarget as q, VisibilityEntry as t, FiberRoot as u, TrackedPromise as v, Root as w, AttachType as x, Catalogue as y, Args as z };
@@ -477,6 +477,11 @@ interface InternalState {
477
477
  * Selected once, from the entry's provider, and copied into portals with the rest of `internal`.
478
478
  */
479
479
  support: R3FRendererSupport
480
+ /**
481
+ * Releases this root's lease on its renderer. The last release disposes a renderer R3F created;
482
+ * a renderer passed in as an instance is never disposed by R3F.
483
+ */
484
+ releaseRenderer?: () => void | Promise<void>
480
485
  /** Global scheduler reference (for useFrame hook) */
481
486
  scheduler: SchedulerApi | null
482
487
  /**
@@ -489,6 +494,8 @@ interface InternalState {
489
494
  rootId?: string
490
495
  /** Function to unregister this root from the global scheduler */
491
496
  unregisterRoot?: () => void
497
+ /** Function to stop following devicePixelRatio changes */
498
+ unwatchDpr?: () => void
492
499
  /** Container for child attachment (scene for root, original container for portals) */
493
500
  container?: THREE.Object3D
494
501
  /**
@@ -530,6 +537,12 @@ interface InternalState {
530
537
  * Only set when isSecondary is true.
531
538
  */
532
539
  targetId?: string
540
+ /**
541
+ * This secondary stopped sharing because the primary's renderer fell back to its
542
+ * WebGL2 backend (#3965): it owns the renderer it constructed, so it is not
543
+ * `isSecondary` (which marks a canvas borrowing another's renderer).
544
+ */
545
+ sharedRendererFallback?: boolean
533
546
  /**
534
547
  * Function to unregister this primary canvas from the registry.
535
548
  * Only set when this canvas has an `id` prop.
@@ -660,9 +673,17 @@ type RootStore = UseBoundStoreWithEqualityFn<StoreApi<RootState>>
660
673
  // to avoid bundling @types/react-reconciler which causes absolute path issues
661
674
  type FiberRoot = any
662
675
 
676
+ /** A promise tagged with its state, the protocol React's `use` reads */
677
+ type TrackedPromise<T> = Promise<T> &
678
+ ({ status: 'pending' } | { status: 'fulfilled'; value: T } | { status: 'rejected'; reason: unknown })
679
+
663
680
  interface Root {
664
681
  fiber: FiberRoot
665
682
  store: RootStore
683
+ /** Set while a teardown waits on React. Configure and render clear it, which cancels the teardown */
684
+ unmountClaim: symbol | null
685
+ /** Pending only while a renderer is being created */
686
+ ready: TrackedPromise<unknown>
666
687
  }
667
688
 
668
689
  type AttachFnType<O = any> = (parent: any, self: O) => () => void
@@ -772,7 +793,14 @@ declare function useStore(): RootStore;
772
793
  */
773
794
  declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
774
795
 
796
+ /**
797
+ * React context that carries the current root's {@link RootStore}. Each root provides its store and
798
+ * each portal provides its own scoped one; `useStore`, and every hook built on it, reads it.
799
+ *
800
+ * Stored on `globalThis` under `Symbol.for('@react-three/fiber.context')`, so every copy and entry
801
+ * of fiber shares a single context.
802
+ */
775
803
  declare const context: React.Context<RootStore>;
776
804
 
777
- export { useStore as ag, useThree as ah, context as ai, registerRootExtension as r, setRenderOverride as s };
778
- export type { EquConfig as $, AttachFnType as A, InstanceProps as B, ConstructorRepresentation as C, Dpr as D, Events as E, Frameloop as F, Instance as G, HostConfig as H, InternalState as I, Properties as J, IsOptional as K, IsAllOptional as L, Mutable as M, NonFunctionKeys as N, Overwrite as O, PointerState as P, ThreeCamera as Q, R3FRenderTarget as R, Subscription as S, ThreeEvent as T, Act as U, Viewport as V, Bridge as W, XRManager as X, SetBlock as Y, UnblockProps as Z, ObjectMap as _, RootExtension as a, Disposable as a0, FrameNextState as a1, FrameState as a2, FrameNextCallback as a3, FrameCallback as a4, ThreeNamespace as a5, ThreeCore as a6, OcclusionSupport as a7, WebGLSupport as a8, WebGPUSupport as a9, RendererSupport as aa, RendererProvider as ab, Register as ac, RegisteredRenderer as ad, ForRegisteredRenderer as ae, R3FRendererSupport as af, R3FRenderer as b, Size as c, RenderCallback as d, Performance as e, RootState as f, RootStore as g, Intersection as h, Camera as i, IntersectionEvent as j, DomEvent as k, EventHandlers as l, FilterFunction as m, ComputeFunction as n, XRPointerConfig as o, EventManager as p, PointerCaptureTarget as q, VisibilityEntry as t, FiberRoot as u, Root as v, AttachType as w, Catalogue as x, Args as y, ArgsProp as z };
805
+ export { useStore as ah, useThree as ai, context as aj, registerRootExtension as r, setRenderOverride as s };
806
+ export type { ObjectMap as $, AttachFnType as A, ArgsProp as B, ConstructorRepresentation as C, Dpr as D, Events as E, Frameloop as F, InstanceProps as G, Instance as H, InternalState as I, HostConfig as J, Properties as K, IsOptional as L, Mutable as M, NonFunctionKeys as N, Overwrite as O, PointerState as P, IsAllOptional as Q, R3FRenderTarget as R, Subscription as S, ThreeEvent as T, ThreeCamera as U, Viewport as V, Act as W, XRManager as X, Bridge as Y, SetBlock as Z, UnblockProps as _, RootExtension as a, EquConfig as a0, Disposable as a1, FrameNextState as a2, FrameState as a3, FrameNextCallback as a4, FrameCallback as a5, ThreeNamespace as a6, ThreeCore as a7, OcclusionSupport as a8, WebGLSupport as a9, WebGPUSupport as aa, RendererSupport as ab, RendererProvider as ac, Register as ad, RegisteredRenderer as ae, ForRegisteredRenderer as af, R3FRendererSupport as ag, R3FRenderer as b, Size as c, RenderCallback as d, Performance as e, RootState as f, RootStore as g, Intersection as h, Camera as i, IntersectionEvent as j, DomEvent as k, EventHandlers as l, FilterFunction as m, ComputeFunction as n, XRPointerConfig as o, EventManager as p, PointerCaptureTarget as q, VisibilityEntry as t, FiberRoot as u, TrackedPromise as v, Root as w, AttachType as x, Catalogue as y, Args as z };
@@ -477,6 +477,11 @@ interface InternalState {
477
477
  * Selected once, from the entry's provider, and copied into portals with the rest of `internal`.
478
478
  */
479
479
  support: R3FRendererSupport
480
+ /**
481
+ * Releases this root's lease on its renderer. The last release disposes a renderer R3F created;
482
+ * a renderer passed in as an instance is never disposed by R3F.
483
+ */
484
+ releaseRenderer?: () => void | Promise<void>
480
485
  /** Global scheduler reference (for useFrame hook) */
481
486
  scheduler: SchedulerApi | null
482
487
  /**
@@ -489,6 +494,8 @@ interface InternalState {
489
494
  rootId?: string
490
495
  /** Function to unregister this root from the global scheduler */
491
496
  unregisterRoot?: () => void
497
+ /** Function to stop following devicePixelRatio changes */
498
+ unwatchDpr?: () => void
492
499
  /** Container for child attachment (scene for root, original container for portals) */
493
500
  container?: THREE.Object3D
494
501
  /**
@@ -530,6 +537,12 @@ interface InternalState {
530
537
  * Only set when isSecondary is true.
531
538
  */
532
539
  targetId?: string
540
+ /**
541
+ * This secondary stopped sharing because the primary's renderer fell back to its
542
+ * WebGL2 backend (#3965): it owns the renderer it constructed, so it is not
543
+ * `isSecondary` (which marks a canvas borrowing another's renderer).
544
+ */
545
+ sharedRendererFallback?: boolean
533
546
  /**
534
547
  * Function to unregister this primary canvas from the registry.
535
548
  * Only set when this canvas has an `id` prop.
@@ -660,9 +673,17 @@ type RootStore = UseBoundStoreWithEqualityFn<StoreApi<RootState>>
660
673
  // to avoid bundling @types/react-reconciler which causes absolute path issues
661
674
  type FiberRoot = any
662
675
 
676
+ /** A promise tagged with its state, the protocol React's `use` reads */
677
+ type TrackedPromise<T> = Promise<T> &
678
+ ({ status: 'pending' } | { status: 'fulfilled'; value: T } | { status: 'rejected'; reason: unknown })
679
+
663
680
  interface Root {
664
681
  fiber: FiberRoot
665
682
  store: RootStore
683
+ /** Set while a teardown waits on React. Configure and render clear it, which cancels the teardown */
684
+ unmountClaim: symbol | null
685
+ /** Pending only while a renderer is being created */
686
+ ready: TrackedPromise<unknown>
666
687
  }
667
688
 
668
689
  type AttachFnType<O = any> = (parent: any, self: O) => () => void
@@ -772,7 +793,14 @@ declare function useStore(): RootStore;
772
793
  */
773
794
  declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
774
795
 
796
+ /**
797
+ * React context that carries the current root's {@link RootStore}. Each root provides its store and
798
+ * each portal provides its own scoped one; `useStore`, and every hook built on it, reads it.
799
+ *
800
+ * Stored on `globalThis` under `Symbol.for('@react-three/fiber.context')`, so every copy and entry
801
+ * of fiber shares a single context.
802
+ */
775
803
  declare const context: React.Context<RootStore>;
776
804
 
777
- export { useStore as ag, useThree as ah, context as ai, registerRootExtension as r, setRenderOverride as s };
778
- export type { EquConfig as $, AttachFnType as A, InstanceProps as B, ConstructorRepresentation as C, Dpr as D, Events as E, Frameloop as F, Instance as G, HostConfig as H, InternalState as I, Properties as J, IsOptional as K, IsAllOptional as L, Mutable as M, NonFunctionKeys as N, Overwrite as O, PointerState as P, ThreeCamera as Q, R3FRenderTarget as R, Subscription as S, ThreeEvent as T, Act as U, Viewport as V, Bridge as W, XRManager as X, SetBlock as Y, UnblockProps as Z, ObjectMap as _, RootExtension as a, Disposable as a0, FrameNextState as a1, FrameState as a2, FrameNextCallback as a3, FrameCallback as a4, ThreeNamespace as a5, ThreeCore as a6, OcclusionSupport as a7, WebGLSupport as a8, WebGPUSupport as a9, RendererSupport as aa, RendererProvider as ab, Register as ac, RegisteredRenderer as ad, ForRegisteredRenderer as ae, R3FRendererSupport as af, R3FRenderer as b, Size as c, RenderCallback as d, Performance as e, RootState as f, RootStore as g, Intersection as h, Camera as i, IntersectionEvent as j, DomEvent as k, EventHandlers as l, FilterFunction as m, ComputeFunction as n, XRPointerConfig as o, EventManager as p, PointerCaptureTarget as q, VisibilityEntry as t, FiberRoot as u, Root as v, AttachType as w, Catalogue as x, Args as y, ArgsProp as z };
805
+ export { useStore as ah, useThree as ai, context as aj, registerRootExtension as r, setRenderOverride as s };
806
+ export type { ObjectMap as $, AttachFnType as A, ArgsProp as B, ConstructorRepresentation as C, Dpr as D, Events as E, Frameloop as F, InstanceProps as G, Instance as H, InternalState as I, HostConfig as J, Properties as K, IsOptional as L, Mutable as M, NonFunctionKeys as N, Overwrite as O, PointerState as P, IsAllOptional as Q, R3FRenderTarget as R, Subscription as S, ThreeEvent as T, ThreeCamera as U, Viewport as V, Act as W, XRManager as X, Bridge as Y, SetBlock as Z, UnblockProps as _, RootExtension as a, EquConfig as a0, Disposable as a1, FrameNextState as a2, FrameState as a3, FrameNextCallback as a4, FrameCallback as a5, ThreeNamespace as a6, ThreeCore as a7, OcclusionSupport as a8, WebGLSupport as a9, WebGPUSupport as aa, RendererSupport as ab, RendererProvider as ac, Register as ad, RegisteredRenderer as ae, ForRegisteredRenderer as af, R3FRendererSupport as ag, R3FRenderer as b, Size as c, RenderCallback as d, Performance as e, RootState as f, RootStore as g, Intersection as h, Camera as i, IntersectionEvent as j, DomEvent as k, EventHandlers as l, FilterFunction as m, ComputeFunction as n, XRPointerConfig as o, EventManager as p, PointerCaptureTarget as q, VisibilityEntry as t, FiberRoot as u, TrackedPromise as v, Root as w, AttachType as x, Catalogue as y, Args as z };
@@ -1,4 +1,4 @@
1
- import { a3 as FrameNextCallback } from './fiber.I5Q4dVvl.js';
1
+ import { a4 as FrameNextCallback } from './fiber.CLTHZhZp.js';
2
2
  import { UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
3
3
 
4
4
  /**
@@ -361,4 +361,4 @@ function notifyRootExtensionsHmr(store) {
361
361
  for (const setUpBy of applied.values()) current(registry, setUpBy).hmr?.(store);
362
362
  }
363
363
 
364
- export { Block as B, ErrorBoundary as E, useThree as a, useFrame as b, context as c, useIsomorphicLayoutEffect as d, useMutableCallback as e, useBridge as f, getTextureView as g, unstageTextures as h, stageTextures as i, detachRootExtensions as j, attachRootExtensions as k, notifyAlpha as l, notifyRootExtensionsHmr as m, notifyDepreciated as n, registerRootExtension as r, setRenderOverride as s, useStore as u };
364
+ export { Block as B, ErrorBoundary as E, useThree as a, useFrame as b, context as c, useIsomorphicLayoutEffect as d, useMutableCallback as e, useBridge as f, getTextureView as g, unstageTextures as h, stageTextures as i, attachRootExtensions as j, detachRootExtensions as k, notifyAlpha as l, notifyRootExtensionsHmr as m, notifyDepreciated as n, registerRootExtension as r, setRenderOverride as s, useStore as u };
@@ -1,4 +1,4 @@
1
- import { a3 as FrameNextCallback } from './fiber.I5Q4dVvl.mjs';
1
+ import { a4 as FrameNextCallback } from './fiber.CLTHZhZp.mjs';
2
2
  import { UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
3
3
 
4
4
  /**