@react-three/fiber 10.0.0-canary.14007b4 → 10.0.0-canary.1998a73
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.
- package/dist/extension.cjs +2 -1
- package/dist/extension.d.cts +9 -46
- package/dist/extension.d.mts +9 -46
- package/dist/extension.d.ts +9 -46
- package/dist/extension.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +7 -8
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.mjs +3 -3
- package/dist/legacy.cjs +2 -2
- package/dist/legacy.d.cts +4 -4
- package/dist/legacy.d.mts +4 -4
- package/dist/legacy.d.ts +4 -4
- package/dist/legacy.mjs +4 -4
- package/dist/shared/{fiber.DAg-9ieU.d.ts → fiber.11sXr8Eb.d.cts} +49 -101
- package/dist/shared/{fiber.C_v1rkNg.mjs → fiber.B0oukOFO.mjs} +38 -3
- package/dist/shared/fiber.BU0vBHc9.d.mts +48 -0
- package/dist/shared/{fiber.Ch4JrXS2.mjs → fiber.CT-cCVjA.mjs} +6091 -5146
- package/dist/shared/{fiber.BGL2rpse.cjs → fiber.Cn-vxHMl.cjs} +6100 -5155
- package/dist/shared/fiber.Cx-UAmMb.d.ts +48 -0
- package/dist/shared/fiber.DAl4H27x.d.cts +48 -0
- package/dist/shared/{fiber.Ddgoyqql.d.mts → fiber.DNehrxK5.d.ts} +49 -101
- package/dist/shared/{fiber.Bw8YnGg5.d.ts → fiber.I5Q4dVvl.d.cts} +81 -4
- package/dist/shared/{fiber.Bw8YnGg5.d.cts → fiber.I5Q4dVvl.d.mts} +81 -4
- package/dist/shared/{fiber.Bw8YnGg5.d.mts → fiber.I5Q4dVvl.d.ts} +81 -4
- package/dist/shared/{fiber.DiPB625B.d.cts → fiber.TWXdbcWP.d.mts} +49 -101
- package/dist/shared/{fiber.B6zNSmwj.cjs → fiber.khFlPHPf.cjs} +40 -2
- package/dist/webgpu/index.cjs +2 -2
- package/dist/webgpu/index.d.cts +4 -5
- package/dist/webgpu/index.d.mts +4 -5
- package/dist/webgpu/index.d.ts +4 -5
- package/dist/webgpu/index.mjs +4 -4
- package/package.json +6 -6
- package/readme.md +1 -1
package/dist/legacy.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { x as useRenderTarget$1, c as createRoot$1, C as Canvas$1 } from './shared/fiber.
|
|
3
|
-
export { k as Environment, i as EnvironmentCube, E as EnvironmentMap, j as EnvironmentPortal, ai as FROM_REF, I as IsObject, al as ONCE, P as Portal, R as REACT_INTERNAL_PROPS, Y as RESERVED_PROPS, T as Texture, _ as _roots, A as addAfterEffect, z as addEffect, B as addTail, F as advance, a2 as applyProps, $ as attach, S as buildGraph, a3 as calculateDpr, m as createEvents, a as createPointerEvents, L as createPortal, N as createStore, a0 as detach, a1 as diffProps, U as dispose, a as events, G as extend, O as findInitialRoot, M as flushSync, aj as fromRef, V as getInstanceProps, b as getPrimary, f as getPrimaryIds, Q as getRootState, g as getThree, a4 as getUuidPrefix, ah as hasConstructor, e as hasPrimary, h as hasThree, D as invalidate, X as invalidateInstance, a7 as is, aa as isColorRepresentation, ag as isCopyable, ak as isFromRef, ad as isLayers, ab as isObject3D, an as isOnce, a8 as isOrthographicCamera, a9 as isRef, J as isRenderer, ac as isTexture, ae as isUniform, af as isVectorLike, am as once, W as prepare, p as presetsObj, H as reconciler, r as registerPrimary, l as removeInteractivity, Z as resolve, s as swapInteractivity, K as unmountComponentAtNode, u as unregisterPrimary, a5 as updateCamera, a6 as updateFrustum, y as useEnvironment, o as useGraph, n as useInstanceHandle, q as useLoader, t as useTexture, v as useTextures, d as waitForPrimary, w as whenThree } from './shared/fiber.
|
|
2
|
+
import { x as useRenderTarget$1, c as createRoot$1, C as Canvas$1 } from './shared/fiber.CT-cCVjA.mjs';
|
|
3
|
+
export { k as Environment, i as EnvironmentCube, E as EnvironmentMap, j as EnvironmentPortal, ai as FROM_REF, I as IsObject, al as ONCE, P as Portal, R as REACT_INTERNAL_PROPS, Y as RESERVED_PROPS, T as Texture, _ as _roots, A as addAfterEffect, z as addEffect, B as addTail, F as advance, a2 as applyProps, $ as attach, S as buildGraph, a3 as calculateDpr, m as createEvents, a as createPointerEvents, L as createPortal, N as createStore, a0 as detach, a1 as diffProps, U as dispose, a as events, G as extend, O as findInitialRoot, M as flushSync, aj as fromRef, V as getInstanceProps, b as getPrimary, f as getPrimaryIds, Q as getRootState, g as getThree, a4 as getUuidPrefix, ah as hasConstructor, e as hasPrimary, h as hasThree, D as invalidate, X as invalidateInstance, a7 as is, aa as isColorRepresentation, ag as isCopyable, ak as isFromRef, ad as isLayers, ab as isObject3D, an as isOnce, a8 as isOrthographicCamera, a9 as isRef, J as isRenderer, ac as isTexture, ae as isUniform, af as isVectorLike, am as once, W as prepare, p as presetsObj, H as reconciler, r as registerPrimary, l as removeInteractivity, Z as resolve, s as swapInteractivity, K as unmountComponentAtNode, u as unregisterPrimary, a5 as updateCamera, a6 as updateFrustum, y as useEnvironment, o as useGraph, n as useInstanceHandle, q as useLoader, t as useTexture, v as useTextures, d as waitForPrimary, w as whenThree } from './shared/fiber.CT-cCVjA.mjs';
|
|
4
4
|
import { webglSupport } from './chunks/webgl.mjs';
|
|
5
|
-
import { a as useThree$1, b as useFrame$1 } from './shared/fiber.
|
|
6
|
-
export { B as Block, E as ErrorBoundary, c as context, r as registerRootExtension, s as setRenderOverride, f as useBridge, d as useIsomorphicLayoutEffect, e as useMutableCallback, u as useStore } from './shared/fiber.
|
|
5
|
+
import { a as useThree$1, b as useFrame$1 } from './shared/fiber.B0oukOFO.mjs';
|
|
6
|
+
export { B as Block, E as ErrorBoundary, c as context, r as registerRootExtension, s as setRenderOverride, f as useBridge, d as useIsomorphicLayoutEffect, e as useMutableCallback, u as useStore } from './shared/fiber.B0oukOFO.mjs';
|
|
7
7
|
export { Scheduler, getScheduler } from '@pmndrs/scheduler';
|
|
8
8
|
|
|
9
9
|
const R3F_BUILD_LEGACY = true;
|
|
@@ -2,10 +2,9 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import { ReactNode, Component, RefObject, JSX } from 'react';
|
|
3
3
|
import { Options } from 'react-use-measure';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D } from 'three';
|
|
6
|
+
import { J as Properties, c as Size, F as Frameloop, e as Performance, D as Dpr, g as RootStore, p as EventManager, f as RootState, n as ComputeFunction, C as ConstructorRepresentation, _ as ObjectMap, I as InternalState, M as Mutable, O as Overwrite, y as Args, l as EventHandlers, B as InstanceProps, k as DomEvent, G as Instance, x as Catalogue, v as Root, a6 as ThreeCore, W as Bridge, Z as UnblockProps, a0 as Disposable, Q as ThreeCamera, $ as EquConfig } from './fiber.I5Q4dVvl.cjs';
|
|
7
7
|
import { WebGPURenderer, WebGPURendererParameters } from 'three/webgpu';
|
|
8
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
8
|
|
|
10
9
|
//* Base Renderer Types =====================================
|
|
11
10
|
|
|
@@ -156,8 +155,11 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
156
155
|
/** Dimensions to fit the renderer to. Will measure canvas dimensions if omitted */
|
|
157
156
|
size?: Size
|
|
158
157
|
/**
|
|
159
|
-
* Enables shadows (
|
|
160
|
-
* but also strings: 'basic' | 'percentage' | 'soft' | 'variance'.
|
|
158
|
+
* Enables shadows (`true` uses `THREE.PCFShadowMap`). Can accept `renderer.shadowMap` options for
|
|
159
|
+
* fine-tuning, but also strings: 'basic' | 'percentage' | 'soft' | 'variance'.
|
|
160
|
+
*
|
|
161
|
+
* `'soft'` is a deprecated alias of `'percentage'`: both map to `THREE.PCFShadowMap`, because three.js
|
|
162
|
+
* deprecated `PCFSoftShadowMap` and made `PCFShadowMap` soft. Using `'soft'` logs a deprecation notice.
|
|
161
163
|
* @see https://threejs.org/docs/#api/en/renderers/WebGLRenderer.shadowMap
|
|
162
164
|
*/
|
|
163
165
|
shadows?: boolean | 'basic' | 'percentage' | 'soft' | 'variance' | Partial<THREE.WebGLShadowMap>
|
|
@@ -235,83 +237,6 @@ type InjectState = Partial<
|
|
|
235
237
|
}
|
|
236
238
|
>
|
|
237
239
|
|
|
238
|
-
//* Reconciler Types ==============================
|
|
239
|
-
|
|
240
|
-
// FiberRoot is an opaque internal React type - we define it locally
|
|
241
|
-
// to avoid bundling @types/react-reconciler which causes absolute path issues
|
|
242
|
-
type FiberRoot = any
|
|
243
|
-
|
|
244
|
-
interface Root {
|
|
245
|
-
fiber: FiberRoot
|
|
246
|
-
store: RootStore
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
type AttachFnType<O = any> = (parent: any, self: O) => () => void
|
|
250
|
-
type AttachType<O = any> = string | AttachFnType<O>
|
|
251
|
-
|
|
252
|
-
type ConstructorRepresentation<T = any> = new (...args: any[]) => T
|
|
253
|
-
|
|
254
|
-
interface Catalogue {
|
|
255
|
-
[name: string]: ConstructorRepresentation
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// TODO: handle constructor overloads
|
|
259
|
-
// https://github.com/pmndrs/react-three-fiber/pull/2931
|
|
260
|
-
// https://github.com/microsoft/TypeScript/issues/37079
|
|
261
|
-
type Args<T> = T extends ConstructorRepresentation
|
|
262
|
-
? T extends typeof Color$1
|
|
263
|
-
? [r: number, g: number, b: number] | [color: ColorRepresentation]
|
|
264
|
-
: ConstructorParameters<T>
|
|
265
|
-
: any[]
|
|
266
|
-
|
|
267
|
-
type ArgsProp<P> = P extends ConstructorRepresentation
|
|
268
|
-
? IsAllOptional<ConstructorParameters<P>> extends true
|
|
269
|
-
? { args?: Args<P> }
|
|
270
|
-
: { args: Args<P> }
|
|
271
|
-
: { args: unknown[] }
|
|
272
|
-
|
|
273
|
-
type InstanceProps<T = any, P = any> = ArgsProp<P> & {
|
|
274
|
-
object?: T
|
|
275
|
-
dispose?: null
|
|
276
|
-
attach?: AttachType<T>
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
interface Instance<O = any> {
|
|
280
|
-
root: RootStore
|
|
281
|
-
type: string
|
|
282
|
-
parent: Instance | null
|
|
283
|
-
children: Instance[]
|
|
284
|
-
props: InstanceProps<O> & Record<string, unknown>
|
|
285
|
-
object: O & { __r3f?: Instance<O> }
|
|
286
|
-
eventCount: number
|
|
287
|
-
handlers: Partial<EventHandlers>
|
|
288
|
-
attach?: AttachType<O>
|
|
289
|
-
previousAttach?: any
|
|
290
|
-
isHidden: boolean
|
|
291
|
-
/** Set of props that have been applied via once() */
|
|
292
|
-
appliedOnce?: Set<string>
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
interface HostConfig {
|
|
296
|
-
type: string
|
|
297
|
-
props: Instance['props']
|
|
298
|
-
container: RootStore
|
|
299
|
-
instance: Instance
|
|
300
|
-
textInstance: void
|
|
301
|
-
suspenseInstance: Instance
|
|
302
|
-
hydratableInstance: never
|
|
303
|
-
formInstance: never
|
|
304
|
-
publicInstance: Instance['object']
|
|
305
|
-
hostContext: {}
|
|
306
|
-
childSet: never
|
|
307
|
-
timeoutHandle: number | undefined
|
|
308
|
-
noTimeout: -1
|
|
309
|
-
TransitionStatus: null
|
|
310
|
-
}
|
|
311
|
-
declare global {
|
|
312
|
-
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined
|
|
313
|
-
}
|
|
314
|
-
|
|
315
240
|
//* Loop Types ==============================
|
|
316
241
|
|
|
317
242
|
type GlobalRenderCallback = (timestamp: number) => void
|
|
@@ -618,8 +543,14 @@ type ThreeElement<T extends ConstructorRepresentation> = Mutable<
|
|
|
618
543
|
Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>
|
|
619
544
|
>
|
|
620
545
|
|
|
546
|
+
/**
|
|
547
|
+
* Every constructor export of a three namespace as an uncapitalized JSX element. Non-constructor
|
|
548
|
+
* exports (constants, functions, nested namespaces) are dropped from the keys rather than mapped
|
|
549
|
+
* to `never`: a single `never`-valued key in `JSX.IntrinsicElements` collapses the props of any
|
|
550
|
+
* tag typed `React.ElementType` (#3898).
|
|
551
|
+
*/
|
|
621
552
|
type ThreeToJSXElements<T extends Record<string, any>> = {
|
|
622
|
-
[K in keyof T & string as
|
|
553
|
+
[K in keyof T & string as T[K] extends ConstructorRepresentation ? Uncapitalize<K> : never]: ThreeElement<T[K]>
|
|
623
554
|
}
|
|
624
555
|
|
|
625
556
|
/** Method names of Object3D, excluded from the `primitive` element's typed props. */
|
|
@@ -875,7 +806,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
875
806
|
* </EnvironmentPortal>
|
|
876
807
|
* ```
|
|
877
808
|
*/
|
|
878
|
-
declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps):
|
|
809
|
+
declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps): React$1.JSX.Element;
|
|
879
810
|
/**
|
|
880
811
|
* Sets up a global environment map for PBR materials and backgrounds.
|
|
881
812
|
* Affects scene.environment and optionally scene.background unless a custom scene is passed.
|
|
@@ -971,7 +902,7 @@ declare function EnvironmentPortal({ children, near, far, resolution, frames, ma
|
|
|
971
902
|
* />
|
|
972
903
|
* ```
|
|
973
904
|
*/
|
|
974
|
-
declare function Environment(props: EnvironmentProps):
|
|
905
|
+
declare function Environment(props: EnvironmentProps): React$1.JSX.Element;
|
|
975
906
|
|
|
976
907
|
/**
|
|
977
908
|
* Moves every trace of interactivity from one object to its replacement, for reconstruction.
|
|
@@ -1089,7 +1020,7 @@ declare const Texture: ({ children, input, onLoad, cache, }: {
|
|
|
1089
1020
|
input: Parameters<typeof useTexture>[0];
|
|
1090
1021
|
onLoad?: Parameters<typeof useTexture>[1];
|
|
1091
1022
|
cache?: boolean;
|
|
1092
|
-
}) =>
|
|
1023
|
+
}) => React$1.JSX.Element;
|
|
1093
1024
|
|
|
1094
1025
|
/** Accepted shapes for a registry read: a single key, a list of keys, or a name→key map. */
|
|
1095
1026
|
type TextureInput = string | string[] | Record<string, string>;
|
|
@@ -1876,7 +1807,8 @@ declare namespace ReactReconciler {
|
|
|
1876
1807
|
type LanePriority = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17;
|
|
1877
1808
|
|
|
1878
1809
|
type Lanes = number;
|
|
1879
|
-
|
|
1810
|
+
|
|
1811
|
+
type Lane = number & { __LaneBrand: any };
|
|
1880
1812
|
|
|
1881
1813
|
type Flags = number;
|
|
1882
1814
|
|
|
@@ -2207,7 +2139,6 @@ declare namespace ReactReconciler {
|
|
|
2207
2139
|
onCaughtError: (error: Error, info: BaseErrorInfo) => void,
|
|
2208
2140
|
onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
|
|
2209
2141
|
onDefaultTransitionIndicator: () => void,
|
|
2210
|
-
transitionCallbacks: null | TransitionTracingCallbacks,
|
|
2211
2142
|
): OpaqueRoot;
|
|
2212
2143
|
|
|
2213
2144
|
createPortal(
|
|
@@ -2217,8 +2148,6 @@ declare namespace ReactReconciler {
|
|
|
2217
2148
|
key?: string | null,
|
|
2218
2149
|
): ReactPortal;
|
|
2219
2150
|
|
|
2220
|
-
registerMutableSourceForHydration(root: FiberRoot, mutableSource: MutableSource): void;
|
|
2221
|
-
|
|
2222
2151
|
createComponentSelector(component: React$AbstractComponent<never, unknown>): ComponentSelector;
|
|
2223
2152
|
|
|
2224
2153
|
createHasPseudoClassSelector(selectors: Selector[]): HasPseudoClassSelector;
|
|
@@ -2253,8 +2182,12 @@ declare namespace ReactReconciler {
|
|
|
2253
2182
|
isStrictMode: boolean,
|
|
2254
2183
|
concurrentUpdatesByDefaultOverride: null | boolean,
|
|
2255
2184
|
identifierPrefix: string,
|
|
2256
|
-
|
|
2185
|
+
onUncaughtError: (error: Error, info: BaseErrorInfo & { errorBoundary?: Component }) => void,
|
|
2186
|
+
onCaughtError: (error: Error, info: BaseErrorInfo) => void,
|
|
2187
|
+
onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
|
|
2188
|
+
onDefaultTransitionIndicator: () => void,
|
|
2257
2189
|
transitionCallbacks: null | TransitionTracingCallbacks,
|
|
2190
|
+
formState: unknown,
|
|
2258
2191
|
): OpaqueRoot;
|
|
2259
2192
|
|
|
2260
2193
|
updateContainer(
|
|
@@ -2264,17 +2197,27 @@ declare namespace ReactReconciler {
|
|
|
2264
2197
|
callback?: (() => void) | null,
|
|
2265
2198
|
): Lane;
|
|
2266
2199
|
|
|
2200
|
+
updateContainerSync(
|
|
2201
|
+
element: ReactNode,
|
|
2202
|
+
container: OpaqueRoot,
|
|
2203
|
+
parentComponent?: Component<any, any> | null,
|
|
2204
|
+
callback?: (() => void) | null,
|
|
2205
|
+
): Lane;
|
|
2206
|
+
|
|
2267
2207
|
batchedUpdates<A, R>(fn: (a: A) => R, a: A): R;
|
|
2268
2208
|
|
|
2269
2209
|
deferredUpdates<A>(fn: () => A): A;
|
|
2270
2210
|
|
|
2271
2211
|
discreteUpdates<A, B, C, D, R>(fn: (arg0: A, arg1: B, arg2: C, arg3: D) => R, a: A, b: B, c: C, d: D): R;
|
|
2272
2212
|
|
|
2273
|
-
flushControlled(fn: () => any): void;
|
|
2274
|
-
|
|
2275
2213
|
flushSync(): void;
|
|
2276
2214
|
flushSync<R>(fn: () => R): R;
|
|
2277
2215
|
|
|
2216
|
+
flushSyncFromReconciler(): void;
|
|
2217
|
+
flushSyncFromReconciler<R>(fn: () => R): R;
|
|
2218
|
+
|
|
2219
|
+
flushSyncWork(): boolean;
|
|
2220
|
+
|
|
2278
2221
|
isAlreadyRendering(): boolean;
|
|
2279
2222
|
|
|
2280
2223
|
flushPassiveEffects(): boolean;
|
|
@@ -2283,16 +2226,10 @@ declare namespace ReactReconciler {
|
|
|
2283
2226
|
|
|
2284
2227
|
attemptSynchronousHydration(fiber: Fiber): void;
|
|
2285
2228
|
|
|
2286
|
-
attemptDiscreteHydration(fiber: Fiber): void;
|
|
2287
|
-
|
|
2288
2229
|
attemptContinuousHydration(fiber: Fiber): void;
|
|
2289
2230
|
|
|
2290
2231
|
attemptHydrationAtCurrentPriority(fiber: Fiber): void;
|
|
2291
2232
|
|
|
2292
|
-
getCurrentUpdatePriority(): LanePriority;
|
|
2293
|
-
|
|
2294
|
-
runWithPriority<T>(priority: LanePriority, fn: () => T): T;
|
|
2295
|
-
|
|
2296
2233
|
findHostInstance(component: any): PublicInstance | null;
|
|
2297
2234
|
|
|
2298
2235
|
findHostInstanceWithWarning(component: any, methodName: string): PublicInstance | null;
|
|
@@ -2305,6 +2242,17 @@ declare namespace ReactReconciler {
|
|
|
2305
2242
|
|
|
2306
2243
|
injectIntoDevTools(devToolsConfig: DevToolsConfig<Instance, TextInstance, any>): boolean;
|
|
2307
2244
|
}
|
|
2245
|
+
|
|
2246
|
+
function defaultOnUncaughtError(error: Error): void;
|
|
2247
|
+
function defaultOnCaughtError(error: Error): void;
|
|
2248
|
+
function defaultOnRecoverableError(error: Error): void;
|
|
2249
|
+
|
|
2250
|
+
function startHostTransition(
|
|
2251
|
+
formFiber: Fiber,
|
|
2252
|
+
pendingState: unknown,
|
|
2253
|
+
action: ((formData: FormData) => void) | null,
|
|
2254
|
+
formData: FormData,
|
|
2255
|
+
): void;
|
|
2308
2256
|
}
|
|
2309
2257
|
|
|
2310
2258
|
declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
|
|
@@ -2848,5 +2796,5 @@ declare function isOnce(value: unknown): value is {
|
|
|
2848
2796
|
[ONCE]: any[] | true;
|
|
2849
2797
|
};
|
|
2850
2798
|
|
|
2851
|
-
export {
|
|
2852
|
-
export type {
|
|
2799
|
+
export { REACT_INTERNAL_PROPS as a$, Texture as aA, useTextures as aF, useEnvironment as aH, addEffect as aI, addAfterEffect as aJ, addTail as aK, invalidate as aL, advance as aM, extend as aN, reconciler as aO, isRenderer as aP, _roots as aQ, unmountComponentAtNode as aR, createPortal as aS, Portal as aT, flushSync as aU, createStore as aV, useIsomorphicLayoutEffect as aW, useMutableCallback as aX, useBridge as aY, Block as aZ, ErrorBoundary as a_, registerPrimary as ad, getPrimary as ae, waitForPrimary as af, hasPrimary as ag, unregisterPrimary as ah, getPrimaryIds as ai, EnvironmentMap as ak, EnvironmentCube as al, EnvironmentPortal as am, Environment as an, presetsObj as ao, swapInteractivity as aq, removeInteractivity as ar, createEvents as as, useInstanceHandle as at, useGraph as au, useLoader as av, IsObject as aw, useTexture as az, findInitialRoot as b0, getRootState as b1, buildGraph as b2, dispose as b3, getInstanceProps as b4, prepare as b5, invalidateInstance as b6, RESERVED_PROPS as b7, resolve as b8, attach as b9, detach as ba, diffProps as bb, applyProps as bc, calculateDpr as bd, getUuidPrefix as be, updateCamera as bf, updateFrustum as bg, is as bh, isOrthographicCamera as bi, isRef as bj, isColorRepresentation as bk, isObject3D as bl, isTexture as bm, isLayers as bn, isUniform as bo, isVectorLike as bp, isCopyable as bq, hasConstructor as br, FROM_REF as bs, fromRef as bu, isFromRef as bv, ONCE as bw, once as bx, isOnce as bz, createPointerEvents as u, getThree as v, hasThree as w, whenThree as x };
|
|
2800
|
+
export type { InputLike as $, Renderer as A, BaseRendererProps as B, Color as C, ColorManagementConfig as D, Euler as E, DefaultGLProps as F, GeometryTransformProps as G, GLProps as H, DefaultRendererProps as I, CanvasSchedulerConfig as J, RendererConfigExtended as K, Layers as L, MutableOrReadonlyParameters as M, NodeProps as N, Object3DMethod as O, RendererProps as P, Quaternion as Q, RaycastableRepresentation as R, CameraProps as S, TSLNodeInput as T, RenderProps as U, VectorRepresentation as V, InjectState as W, GlobalRenderCallback as X, GlobalEffectType as Y, BackgroundConfig as Z, BackgroundProp as _, MathRepresentation as a, LoaderLike as a0, GLTFLike as a1, LoaderInstance as a2, InferLoadResult as a3, LoaderResult as a4, Extensions as a5, WebGLDefaultProps as a6, WebGLProps as a7, WebGLShadowConfig as a8, LegacyRenderer as a9, TextureInput as aB, TextureResult as aC, DisposeOptions as aD, UseTexturesReturn as aE, EnvironmentLoaderProps as aG, LegacyInternalState as aa, LegacyRootState as ab, PrimaryCanvasEntry as ac, EnvironmentProps as aj, PresetsType as ap, MappedTextureType as ax, UseTextureOptions as ay, MathTypes as b, FromRefMarker as bt, OnceValue as by, MathType as c, MathProps as d, Vector2 as e, Vector3 as f, Vector4 as g, Matrix3 as h, Matrix4 as i, EventProps as j, GeometryProps as k, ReactProps as l, ElementProps as m, ThreeElement as n, ThreeToJSXElements as o, ThreeElementsOf as p, ElementOf as q, RenderTargetOptions as r, ReconcilerRoot as s, CanvasProps as t, OffscreenCanvas$1 as y, RendererFactory as z };
|
|
@@ -138,8 +138,16 @@ function useFrame(callback, priorityOrOptions) {
|
|
|
138
138
|
const id = options.id ?? reactId;
|
|
139
139
|
const callbackRef = useMutableCallback(callback);
|
|
140
140
|
const isLegacyPriority = typeof priorityOrOptions === "number" && priorityOrOptions > 0;
|
|
141
|
+
const isLegacyOrdering = typeof priorityOrOptions === "number" && priorityOrOptions < 0;
|
|
141
142
|
useIsomorphicLayoutEffect(() => {
|
|
142
143
|
if (!callback) return;
|
|
144
|
+
if (isLegacyOrdering) {
|
|
145
|
+
notifyDepreciated({
|
|
146
|
+
heading: "useFrame numeric priority order is reversed in v10",
|
|
147
|
+
body: "useFrame(callback, number) is deprecated and its ordering direction is reversed from v9: v9 ran lower numbers first, v10 maps the number to { priority } and runs higher numbers first, so a negative priority now runs after default-priority jobs.\n\nUse { before, after } to name the dependency, or { priority } with the v10 direction (higher = earlier).",
|
|
148
|
+
link: "https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe"
|
|
149
|
+
});
|
|
150
|
+
}
|
|
143
151
|
if (isInsideCanvas) {
|
|
144
152
|
const state = store.getState();
|
|
145
153
|
const rootId = state.internal.rootId;
|
|
@@ -153,7 +161,7 @@ function useFrame(callback, priorityOrOptions) {
|
|
|
153
161
|
}
|
|
154
162
|
notifyDepreciated({
|
|
155
163
|
heading: "useFrame with numeric priority is deprecated",
|
|
156
|
-
body: 'Using useFrame(callback, number) to control render order is deprecated.\n\nFor custom rendering, use: useFrame(callback, { phase: "render" })\nFor execution order within
|
|
164
|
+
body: 'Using useFrame(callback, number) to control render order is deprecated.\n\nFor custom rendering, use: useFrame(callback, { phase: "render" })\nFor execution order within a phase, use: useFrame(callback, { priority: number }) \u2014 higher runs first, the reverse of v9',
|
|
157
165
|
link: "https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe"
|
|
158
166
|
});
|
|
159
167
|
}
|
|
@@ -198,7 +206,7 @@ function useFrame(callback, priorityOrOptions) {
|
|
|
198
206
|
{ id, ...options }
|
|
199
207
|
);
|
|
200
208
|
}
|
|
201
|
-
}, [store, scheduler, id, optionsKey, isLegacyPriority, isInsideCanvas]);
|
|
209
|
+
}, [store, scheduler, id, optionsKey, isLegacyPriority, isLegacyOrdering, isInsideCanvas]);
|
|
202
210
|
const isPaused = React.useSyncExternalStore(
|
|
203
211
|
// Subscribe function
|
|
204
212
|
React.useCallback(
|
|
@@ -276,6 +284,33 @@ function useFrame(callback, priorityOrOptions) {
|
|
|
276
284
|
return controls;
|
|
277
285
|
}
|
|
278
286
|
|
|
287
|
+
const R3F_STAGED_TEXTURES = Symbol.for("@react-three/fiber.stagedTextures");
|
|
288
|
+
const globalStaging = globalThis;
|
|
289
|
+
const staging = globalStaging[R3F_STAGED_TEXTURES] ?? (globalStaging[R3F_STAGED_TEXTURES] = /* @__PURE__ */ new WeakMap());
|
|
290
|
+
function stageTextures(store, entries) {
|
|
291
|
+
const registered = store.getState().textures;
|
|
292
|
+
let staged = staging.get(store);
|
|
293
|
+
for (const [url, texture] of entries) {
|
|
294
|
+
if (registered.has(url)) continue;
|
|
295
|
+
if (!staged) staging.set(store, staged = /* @__PURE__ */ new Map());
|
|
296
|
+
staged.set(url, texture);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function unstageTextures(store, urls) {
|
|
300
|
+
const staged = staging.get(store);
|
|
301
|
+
if (!staged) return;
|
|
302
|
+
for (const url of urls) staged.delete(url);
|
|
303
|
+
if (staged.size === 0) staging.delete(store);
|
|
304
|
+
}
|
|
305
|
+
function getTextureView(store) {
|
|
306
|
+
const registered = store.getState().textures;
|
|
307
|
+
const staged = staging.get(store);
|
|
308
|
+
if (!staged) return registered;
|
|
309
|
+
const view = new Map(registered);
|
|
310
|
+
for (const [url, texture] of staged) if (!view.has(url)) view.set(url, texture);
|
|
311
|
+
return view;
|
|
312
|
+
}
|
|
313
|
+
|
|
279
314
|
const R3F_EXTENSIONS = Symbol.for("@react-three/fiber.extensions");
|
|
280
315
|
function getRegistry() {
|
|
281
316
|
return globalThis[R3F_EXTENSIONS] ?? (globalThis[R3F_EXTENSIONS] = {
|
|
@@ -326,4 +361,4 @@ function notifyRootExtensionsHmr(store) {
|
|
|
326
361
|
for (const setUpBy of applied.values()) current(registry, setUpBy).hmr?.(store);
|
|
327
362
|
}
|
|
328
363
|
|
|
329
|
-
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,
|
|
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 };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { a3 as FrameNextCallback } from './fiber.I5Q4dVvl.mjs';
|
|
2
|
+
import { UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Frame hook with phase-based ordering, priority, and FPS throttling.
|
|
6
|
+
*
|
|
7
|
+
* Always delivers full RootState — works both inside and outside Canvas context:
|
|
8
|
+
* - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
|
|
9
|
+
* - Outside Canvas: The job registers immediately but the callback is held until a
|
|
10
|
+
* Canvas adopts it, then runs with full RootState. For hostless / standalone
|
|
11
|
+
* frame loops with no Canvas, use `@pmndrs/scheduler` directly.
|
|
12
|
+
*
|
|
13
|
+
* Returns a controls object for manual stepping, pausing, and resuming.
|
|
14
|
+
*
|
|
15
|
+
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
16
|
+
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
17
|
+
* @returns Controls object with step(), stepAll(), invalidate(), pause(), resume(), isPaused, id, rootId, scheduler
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Simple priority (backwards compat)
|
|
21
|
+
* useFrame((state, delta) => { ... }, 5)
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // With phase-based ordering
|
|
25
|
+
* useFrame((state, delta) => { ... }, { phase: 'physics' })
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Outside Canvas - callback waits for a Canvas, then always has full state
|
|
29
|
+
* function UI() {
|
|
30
|
+
* useFrame((state, delta) => { syncUI(state.camera) });
|
|
31
|
+
* return <button>...</button>;
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
|
|
36
|
+
* import { getScheduler } from '@pmndrs/scheduler'
|
|
37
|
+
* getScheduler().register((state, delta) => { updateGame(delta) })
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Scheduler-only access (no callback)
|
|
41
|
+
* const { scheduler } = useFrame()
|
|
42
|
+
* scheduler.pauseJob('some-job-id')
|
|
43
|
+
*
|
|
44
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
45
|
+
*/
|
|
46
|
+
declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
|
|
47
|
+
|
|
48
|
+
export { useFrame as u };
|