@react-three/fiber 10.0.0-canary.9b237a7 → 10.0.0-canary.a9bd42a
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.D9zziEOb.mjs → fiber.B0oukOFO.mjs} +28 -1
- package/dist/shared/fiber.BU0vBHc9.d.mts +48 -0
- package/dist/shared/{fiber.DAg-9ieU.d.ts → fiber.BY6Yf1h-.d.cts} +37 -98
- package/dist/shared/{fiber.Ddgoyqql.d.mts → fiber.Cu2hX1IM.d.mts} +37 -98
- package/dist/shared/fiber.Cx-UAmMb.d.ts +48 -0
- package/dist/shared/fiber.DAl4H27x.d.cts +48 -0
- package/dist/shared/{fiber.DiPB625B.d.cts → fiber.DXw-SLsH.d.ts} +37 -98
- package/dist/shared/{fiber.Bw8YnGg5.d.cts → fiber.I5Q4dVvl.d.cts} +81 -4
- package/dist/shared/{fiber.Bw8YnGg5.d.mts → fiber.I5Q4dVvl.d.mts} +81 -4
- package/dist/shared/{fiber.Bw8YnGg5.d.ts → fiber.I5Q4dVvl.d.ts} +81 -4
- package/dist/shared/{fiber.D9dtW9DT.cjs → fiber.khFlPHPf.cjs} +30 -0
- package/dist/shared/{fiber.COk97oyZ.cjs → fiber.oKEFddXj.cjs} +6085 -5155
- package/dist/shared/{fiber.COTqIf4o.mjs → fiber.tsM9NKZ9.mjs} +6076 -5146
- 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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { a3 as FrameNextCallback } from './fiber.I5Q4dVvl.cjs';
|
|
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 };
|
|
@@ -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.js';
|
|
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
|
|
|
@@ -235,83 +234,6 @@ type InjectState = Partial<
|
|
|
235
234
|
}
|
|
236
235
|
>
|
|
237
236
|
|
|
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
237
|
//* Loop Types ==============================
|
|
316
238
|
|
|
317
239
|
type GlobalRenderCallback = (timestamp: number) => void
|
|
@@ -875,7 +797,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
875
797
|
* </EnvironmentPortal>
|
|
876
798
|
* ```
|
|
877
799
|
*/
|
|
878
|
-
declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps):
|
|
800
|
+
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
801
|
/**
|
|
880
802
|
* Sets up a global environment map for PBR materials and backgrounds.
|
|
881
803
|
* Affects scene.environment and optionally scene.background unless a custom scene is passed.
|
|
@@ -971,7 +893,7 @@ declare function EnvironmentPortal({ children, near, far, resolution, frames, ma
|
|
|
971
893
|
* />
|
|
972
894
|
* ```
|
|
973
895
|
*/
|
|
974
|
-
declare function Environment(props: EnvironmentProps):
|
|
896
|
+
declare function Environment(props: EnvironmentProps): React$1.JSX.Element;
|
|
975
897
|
|
|
976
898
|
/**
|
|
977
899
|
* Moves every trace of interactivity from one object to its replacement, for reconstruction.
|
|
@@ -1089,7 +1011,7 @@ declare const Texture: ({ children, input, onLoad, cache, }: {
|
|
|
1089
1011
|
input: Parameters<typeof useTexture>[0];
|
|
1090
1012
|
onLoad?: Parameters<typeof useTexture>[1];
|
|
1091
1013
|
cache?: boolean;
|
|
1092
|
-
}) =>
|
|
1014
|
+
}) => React$1.JSX.Element;
|
|
1093
1015
|
|
|
1094
1016
|
/** Accepted shapes for a registry read: a single key, a list of keys, or a name→key map. */
|
|
1095
1017
|
type TextureInput = string | string[] | Record<string, string>;
|
|
@@ -1876,7 +1798,8 @@ declare namespace ReactReconciler {
|
|
|
1876
1798
|
type LanePriority = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17;
|
|
1877
1799
|
|
|
1878
1800
|
type Lanes = number;
|
|
1879
|
-
|
|
1801
|
+
|
|
1802
|
+
type Lane = number & { __LaneBrand: any };
|
|
1880
1803
|
|
|
1881
1804
|
type Flags = number;
|
|
1882
1805
|
|
|
@@ -2207,7 +2130,6 @@ declare namespace ReactReconciler {
|
|
|
2207
2130
|
onCaughtError: (error: Error, info: BaseErrorInfo) => void,
|
|
2208
2131
|
onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
|
|
2209
2132
|
onDefaultTransitionIndicator: () => void,
|
|
2210
|
-
transitionCallbacks: null | TransitionTracingCallbacks,
|
|
2211
2133
|
): OpaqueRoot;
|
|
2212
2134
|
|
|
2213
2135
|
createPortal(
|
|
@@ -2217,8 +2139,6 @@ declare namespace ReactReconciler {
|
|
|
2217
2139
|
key?: string | null,
|
|
2218
2140
|
): ReactPortal;
|
|
2219
2141
|
|
|
2220
|
-
registerMutableSourceForHydration(root: FiberRoot, mutableSource: MutableSource): void;
|
|
2221
|
-
|
|
2222
2142
|
createComponentSelector(component: React$AbstractComponent<never, unknown>): ComponentSelector;
|
|
2223
2143
|
|
|
2224
2144
|
createHasPseudoClassSelector(selectors: Selector[]): HasPseudoClassSelector;
|
|
@@ -2253,8 +2173,12 @@ declare namespace ReactReconciler {
|
|
|
2253
2173
|
isStrictMode: boolean,
|
|
2254
2174
|
concurrentUpdatesByDefaultOverride: null | boolean,
|
|
2255
2175
|
identifierPrefix: string,
|
|
2256
|
-
|
|
2176
|
+
onUncaughtError: (error: Error, info: BaseErrorInfo & { errorBoundary?: Component }) => void,
|
|
2177
|
+
onCaughtError: (error: Error, info: BaseErrorInfo) => void,
|
|
2178
|
+
onRecoverableError: (error: Error, info: BaseErrorInfo) => void,
|
|
2179
|
+
onDefaultTransitionIndicator: () => void,
|
|
2257
2180
|
transitionCallbacks: null | TransitionTracingCallbacks,
|
|
2181
|
+
formState: unknown,
|
|
2258
2182
|
): OpaqueRoot;
|
|
2259
2183
|
|
|
2260
2184
|
updateContainer(
|
|
@@ -2264,17 +2188,27 @@ declare namespace ReactReconciler {
|
|
|
2264
2188
|
callback?: (() => void) | null,
|
|
2265
2189
|
): Lane;
|
|
2266
2190
|
|
|
2191
|
+
updateContainerSync(
|
|
2192
|
+
element: ReactNode,
|
|
2193
|
+
container: OpaqueRoot,
|
|
2194
|
+
parentComponent?: Component<any, any> | null,
|
|
2195
|
+
callback?: (() => void) | null,
|
|
2196
|
+
): Lane;
|
|
2197
|
+
|
|
2267
2198
|
batchedUpdates<A, R>(fn: (a: A) => R, a: A): R;
|
|
2268
2199
|
|
|
2269
2200
|
deferredUpdates<A>(fn: () => A): A;
|
|
2270
2201
|
|
|
2271
2202
|
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
2203
|
|
|
2273
|
-
flushControlled(fn: () => any): void;
|
|
2274
|
-
|
|
2275
2204
|
flushSync(): void;
|
|
2276
2205
|
flushSync<R>(fn: () => R): R;
|
|
2277
2206
|
|
|
2207
|
+
flushSyncFromReconciler(): void;
|
|
2208
|
+
flushSyncFromReconciler<R>(fn: () => R): R;
|
|
2209
|
+
|
|
2210
|
+
flushSyncWork(): boolean;
|
|
2211
|
+
|
|
2278
2212
|
isAlreadyRendering(): boolean;
|
|
2279
2213
|
|
|
2280
2214
|
flushPassiveEffects(): boolean;
|
|
@@ -2283,16 +2217,10 @@ declare namespace ReactReconciler {
|
|
|
2283
2217
|
|
|
2284
2218
|
attemptSynchronousHydration(fiber: Fiber): void;
|
|
2285
2219
|
|
|
2286
|
-
attemptDiscreteHydration(fiber: Fiber): void;
|
|
2287
|
-
|
|
2288
2220
|
attemptContinuousHydration(fiber: Fiber): void;
|
|
2289
2221
|
|
|
2290
2222
|
attemptHydrationAtCurrentPriority(fiber: Fiber): void;
|
|
2291
2223
|
|
|
2292
|
-
getCurrentUpdatePriority(): LanePriority;
|
|
2293
|
-
|
|
2294
|
-
runWithPriority<T>(priority: LanePriority, fn: () => T): T;
|
|
2295
|
-
|
|
2296
2224
|
findHostInstance(component: any): PublicInstance | null;
|
|
2297
2225
|
|
|
2298
2226
|
findHostInstanceWithWarning(component: any, methodName: string): PublicInstance | null;
|
|
@@ -2305,6 +2233,17 @@ declare namespace ReactReconciler {
|
|
|
2305
2233
|
|
|
2306
2234
|
injectIntoDevTools(devToolsConfig: DevToolsConfig<Instance, TextInstance, any>): boolean;
|
|
2307
2235
|
}
|
|
2236
|
+
|
|
2237
|
+
function defaultOnUncaughtError(error: Error): void;
|
|
2238
|
+
function defaultOnCaughtError(error: Error): void;
|
|
2239
|
+
function defaultOnRecoverableError(error: Error): void;
|
|
2240
|
+
|
|
2241
|
+
function startHostTransition(
|
|
2242
|
+
formFiber: Fiber,
|
|
2243
|
+
pendingState: unknown,
|
|
2244
|
+
action: ((formData: FormData) => void) | null,
|
|
2245
|
+
formData: FormData,
|
|
2246
|
+
): void;
|
|
2308
2247
|
}
|
|
2309
2248
|
|
|
2310
2249
|
declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
|
|
@@ -2848,5 +2787,5 @@ declare function isOnce(value: unknown): value is {
|
|
|
2848
2787
|
[ONCE]: any[] | true;
|
|
2849
2788
|
};
|
|
2850
2789
|
|
|
2851
|
-
export {
|
|
2852
|
-
export type {
|
|
2790
|
+
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 };
|
|
2791
|
+
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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi } from '@pmndrs/scheduler';
|
|
2
|
-
import * as React from 'react';
|
|
3
2
|
import * as THREE from 'three';
|
|
4
|
-
import { WebGLRenderer, WebGLRenderTarget } from 'three';
|
|
3
|
+
import { WebGLRenderer, WebGLRenderTarget, Color, ColorRepresentation } from 'three';
|
|
4
|
+
import * as React from 'react';
|
|
5
5
|
import * as ThreeWebGPU from 'three/webgpu';
|
|
6
6
|
import { WebGPURenderer, RenderTarget, CanvasTarget } from 'three/webgpu';
|
|
7
7
|
import { StoreApi } from 'zustand';
|
|
@@ -654,6 +654,83 @@ interface RootState {
|
|
|
654
654
|
|
|
655
655
|
type RootStore = UseBoundStoreWithEqualityFn<StoreApi<RootState>>
|
|
656
656
|
|
|
657
|
+
//* Reconciler Types ==============================
|
|
658
|
+
|
|
659
|
+
// FiberRoot is an opaque internal React type - we define it locally
|
|
660
|
+
// to avoid bundling @types/react-reconciler which causes absolute path issues
|
|
661
|
+
type FiberRoot = any
|
|
662
|
+
|
|
663
|
+
interface Root {
|
|
664
|
+
fiber: FiberRoot
|
|
665
|
+
store: RootStore
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
type AttachFnType<O = any> = (parent: any, self: O) => () => void
|
|
669
|
+
type AttachType<O = any> = string | AttachFnType<O>
|
|
670
|
+
|
|
671
|
+
type ConstructorRepresentation<T = any> = new (...args: any[]) => T
|
|
672
|
+
|
|
673
|
+
interface Catalogue {
|
|
674
|
+
[name: string]: ConstructorRepresentation
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// TODO: handle constructor overloads
|
|
678
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2931
|
|
679
|
+
// https://github.com/microsoft/TypeScript/issues/37079
|
|
680
|
+
type Args<T> = T extends ConstructorRepresentation
|
|
681
|
+
? T extends typeof Color
|
|
682
|
+
? [r: number, g: number, b: number] | [color: ColorRepresentation]
|
|
683
|
+
: ConstructorParameters<T>
|
|
684
|
+
: any[]
|
|
685
|
+
|
|
686
|
+
type ArgsProp<P> = P extends ConstructorRepresentation
|
|
687
|
+
? IsAllOptional<ConstructorParameters<P>> extends true
|
|
688
|
+
? { args?: Args<P> }
|
|
689
|
+
: { args: Args<P> }
|
|
690
|
+
: { args: unknown[] }
|
|
691
|
+
|
|
692
|
+
type InstanceProps<T = any, P = any> = ArgsProp<P> & {
|
|
693
|
+
object?: T
|
|
694
|
+
dispose?: null
|
|
695
|
+
attach?: AttachType<T>
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
interface Instance<O = any> {
|
|
699
|
+
root: RootStore
|
|
700
|
+
type: string
|
|
701
|
+
parent: Instance | null
|
|
702
|
+
children: Instance[]
|
|
703
|
+
props: InstanceProps<O> & Record<string, unknown>
|
|
704
|
+
object: O & { __r3f?: Instance<O> }
|
|
705
|
+
eventCount: number
|
|
706
|
+
handlers: Partial<EventHandlers>
|
|
707
|
+
attach?: AttachType<O>
|
|
708
|
+
previousAttach?: any
|
|
709
|
+
isHidden: boolean
|
|
710
|
+
/** Set of props that have been applied via once() */
|
|
711
|
+
appliedOnce?: Set<string>
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
interface HostConfig {
|
|
715
|
+
type: string
|
|
716
|
+
props: Instance['props']
|
|
717
|
+
container: RootStore
|
|
718
|
+
instance: Instance
|
|
719
|
+
textInstance: void
|
|
720
|
+
suspenseInstance: Instance
|
|
721
|
+
hydratableInstance: never
|
|
722
|
+
formInstance: never
|
|
723
|
+
publicInstance: Instance['object']
|
|
724
|
+
hostContext: {}
|
|
725
|
+
childSet: never
|
|
726
|
+
timeoutHandle: number | undefined
|
|
727
|
+
noTimeout: -1
|
|
728
|
+
TransitionStatus: null
|
|
729
|
+
}
|
|
730
|
+
declare global {
|
|
731
|
+
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined
|
|
732
|
+
}
|
|
733
|
+
|
|
657
734
|
interface RootExtension {
|
|
658
735
|
/** Unique name. Registering the same name again replaces the entry (HMR-safe); roots it already
|
|
659
736
|
* set up are not set up a second time, but get the new entry's dispose and hmr. */
|
|
@@ -697,5 +774,5 @@ declare function useThree<T = RootState>(selector?: (state: RootState) => T, equ
|
|
|
697
774
|
|
|
698
775
|
declare const context: React.Context<RootStore>;
|
|
699
776
|
|
|
700
|
-
export { useStore as
|
|
701
|
-
export type {
|
|
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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi } from '@pmndrs/scheduler';
|
|
2
|
-
import * as React from 'react';
|
|
3
2
|
import * as THREE from 'three';
|
|
4
|
-
import { WebGLRenderer, WebGLRenderTarget } from 'three';
|
|
3
|
+
import { WebGLRenderer, WebGLRenderTarget, Color, ColorRepresentation } from 'three';
|
|
4
|
+
import * as React from 'react';
|
|
5
5
|
import * as ThreeWebGPU from 'three/webgpu';
|
|
6
6
|
import { WebGPURenderer, RenderTarget, CanvasTarget } from 'three/webgpu';
|
|
7
7
|
import { StoreApi } from 'zustand';
|
|
@@ -654,6 +654,83 @@ interface RootState {
|
|
|
654
654
|
|
|
655
655
|
type RootStore = UseBoundStoreWithEqualityFn<StoreApi<RootState>>
|
|
656
656
|
|
|
657
|
+
//* Reconciler Types ==============================
|
|
658
|
+
|
|
659
|
+
// FiberRoot is an opaque internal React type - we define it locally
|
|
660
|
+
// to avoid bundling @types/react-reconciler which causes absolute path issues
|
|
661
|
+
type FiberRoot = any
|
|
662
|
+
|
|
663
|
+
interface Root {
|
|
664
|
+
fiber: FiberRoot
|
|
665
|
+
store: RootStore
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
type AttachFnType<O = any> = (parent: any, self: O) => () => void
|
|
669
|
+
type AttachType<O = any> = string | AttachFnType<O>
|
|
670
|
+
|
|
671
|
+
type ConstructorRepresentation<T = any> = new (...args: any[]) => T
|
|
672
|
+
|
|
673
|
+
interface Catalogue {
|
|
674
|
+
[name: string]: ConstructorRepresentation
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// TODO: handle constructor overloads
|
|
678
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2931
|
|
679
|
+
// https://github.com/microsoft/TypeScript/issues/37079
|
|
680
|
+
type Args<T> = T extends ConstructorRepresentation
|
|
681
|
+
? T extends typeof Color
|
|
682
|
+
? [r: number, g: number, b: number] | [color: ColorRepresentation]
|
|
683
|
+
: ConstructorParameters<T>
|
|
684
|
+
: any[]
|
|
685
|
+
|
|
686
|
+
type ArgsProp<P> = P extends ConstructorRepresentation
|
|
687
|
+
? IsAllOptional<ConstructorParameters<P>> extends true
|
|
688
|
+
? { args?: Args<P> }
|
|
689
|
+
: { args: Args<P> }
|
|
690
|
+
: { args: unknown[] }
|
|
691
|
+
|
|
692
|
+
type InstanceProps<T = any, P = any> = ArgsProp<P> & {
|
|
693
|
+
object?: T
|
|
694
|
+
dispose?: null
|
|
695
|
+
attach?: AttachType<T>
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
interface Instance<O = any> {
|
|
699
|
+
root: RootStore
|
|
700
|
+
type: string
|
|
701
|
+
parent: Instance | null
|
|
702
|
+
children: Instance[]
|
|
703
|
+
props: InstanceProps<O> & Record<string, unknown>
|
|
704
|
+
object: O & { __r3f?: Instance<O> }
|
|
705
|
+
eventCount: number
|
|
706
|
+
handlers: Partial<EventHandlers>
|
|
707
|
+
attach?: AttachType<O>
|
|
708
|
+
previousAttach?: any
|
|
709
|
+
isHidden: boolean
|
|
710
|
+
/** Set of props that have been applied via once() */
|
|
711
|
+
appliedOnce?: Set<string>
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
interface HostConfig {
|
|
715
|
+
type: string
|
|
716
|
+
props: Instance['props']
|
|
717
|
+
container: RootStore
|
|
718
|
+
instance: Instance
|
|
719
|
+
textInstance: void
|
|
720
|
+
suspenseInstance: Instance
|
|
721
|
+
hydratableInstance: never
|
|
722
|
+
formInstance: never
|
|
723
|
+
publicInstance: Instance['object']
|
|
724
|
+
hostContext: {}
|
|
725
|
+
childSet: never
|
|
726
|
+
timeoutHandle: number | undefined
|
|
727
|
+
noTimeout: -1
|
|
728
|
+
TransitionStatus: null
|
|
729
|
+
}
|
|
730
|
+
declare global {
|
|
731
|
+
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined
|
|
732
|
+
}
|
|
733
|
+
|
|
657
734
|
interface RootExtension {
|
|
658
735
|
/** Unique name. Registering the same name again replaces the entry (HMR-safe); roots it already
|
|
659
736
|
* set up are not set up a second time, but get the new entry's dispose and hmr. */
|
|
@@ -697,5 +774,5 @@ declare function useThree<T = RootState>(selector?: (state: RootState) => T, equ
|
|
|
697
774
|
|
|
698
775
|
declare const context: React.Context<RootStore>;
|
|
699
776
|
|
|
700
|
-
export { useStore as
|
|
701
|
-
export type {
|
|
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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi } from '@pmndrs/scheduler';
|
|
2
|
-
import * as React from 'react';
|
|
3
2
|
import * as THREE from 'three';
|
|
4
|
-
import { WebGLRenderer, WebGLRenderTarget } from 'three';
|
|
3
|
+
import { WebGLRenderer, WebGLRenderTarget, Color, ColorRepresentation } from 'three';
|
|
4
|
+
import * as React from 'react';
|
|
5
5
|
import * as ThreeWebGPU from 'three/webgpu';
|
|
6
6
|
import { WebGPURenderer, RenderTarget, CanvasTarget } from 'three/webgpu';
|
|
7
7
|
import { StoreApi } from 'zustand';
|
|
@@ -654,6 +654,83 @@ interface RootState {
|
|
|
654
654
|
|
|
655
655
|
type RootStore = UseBoundStoreWithEqualityFn<StoreApi<RootState>>
|
|
656
656
|
|
|
657
|
+
//* Reconciler Types ==============================
|
|
658
|
+
|
|
659
|
+
// FiberRoot is an opaque internal React type - we define it locally
|
|
660
|
+
// to avoid bundling @types/react-reconciler which causes absolute path issues
|
|
661
|
+
type FiberRoot = any
|
|
662
|
+
|
|
663
|
+
interface Root {
|
|
664
|
+
fiber: FiberRoot
|
|
665
|
+
store: RootStore
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
type AttachFnType<O = any> = (parent: any, self: O) => () => void
|
|
669
|
+
type AttachType<O = any> = string | AttachFnType<O>
|
|
670
|
+
|
|
671
|
+
type ConstructorRepresentation<T = any> = new (...args: any[]) => T
|
|
672
|
+
|
|
673
|
+
interface Catalogue {
|
|
674
|
+
[name: string]: ConstructorRepresentation
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// TODO: handle constructor overloads
|
|
678
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2931
|
|
679
|
+
// https://github.com/microsoft/TypeScript/issues/37079
|
|
680
|
+
type Args<T> = T extends ConstructorRepresentation
|
|
681
|
+
? T extends typeof Color
|
|
682
|
+
? [r: number, g: number, b: number] | [color: ColorRepresentation]
|
|
683
|
+
: ConstructorParameters<T>
|
|
684
|
+
: any[]
|
|
685
|
+
|
|
686
|
+
type ArgsProp<P> = P extends ConstructorRepresentation
|
|
687
|
+
? IsAllOptional<ConstructorParameters<P>> extends true
|
|
688
|
+
? { args?: Args<P> }
|
|
689
|
+
: { args: Args<P> }
|
|
690
|
+
: { args: unknown[] }
|
|
691
|
+
|
|
692
|
+
type InstanceProps<T = any, P = any> = ArgsProp<P> & {
|
|
693
|
+
object?: T
|
|
694
|
+
dispose?: null
|
|
695
|
+
attach?: AttachType<T>
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
interface Instance<O = any> {
|
|
699
|
+
root: RootStore
|
|
700
|
+
type: string
|
|
701
|
+
parent: Instance | null
|
|
702
|
+
children: Instance[]
|
|
703
|
+
props: InstanceProps<O> & Record<string, unknown>
|
|
704
|
+
object: O & { __r3f?: Instance<O> }
|
|
705
|
+
eventCount: number
|
|
706
|
+
handlers: Partial<EventHandlers>
|
|
707
|
+
attach?: AttachType<O>
|
|
708
|
+
previousAttach?: any
|
|
709
|
+
isHidden: boolean
|
|
710
|
+
/** Set of props that have been applied via once() */
|
|
711
|
+
appliedOnce?: Set<string>
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
interface HostConfig {
|
|
715
|
+
type: string
|
|
716
|
+
props: Instance['props']
|
|
717
|
+
container: RootStore
|
|
718
|
+
instance: Instance
|
|
719
|
+
textInstance: void
|
|
720
|
+
suspenseInstance: Instance
|
|
721
|
+
hydratableInstance: never
|
|
722
|
+
formInstance: never
|
|
723
|
+
publicInstance: Instance['object']
|
|
724
|
+
hostContext: {}
|
|
725
|
+
childSet: never
|
|
726
|
+
timeoutHandle: number | undefined
|
|
727
|
+
noTimeout: -1
|
|
728
|
+
TransitionStatus: null
|
|
729
|
+
}
|
|
730
|
+
declare global {
|
|
731
|
+
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined
|
|
732
|
+
}
|
|
733
|
+
|
|
657
734
|
interface RootExtension {
|
|
658
735
|
/** Unique name. Registering the same name again replaces the entry (HMR-safe); roots it already
|
|
659
736
|
* set up are not set up a second time, but get the new entry's dispose and hmr. */
|
|
@@ -697,5 +774,5 @@ declare function useThree<T = RootState>(selector?: (state: RootState) => T, equ
|
|
|
697
774
|
|
|
698
775
|
declare const context: React.Context<RootStore>;
|
|
699
776
|
|
|
700
|
-
export { useStore as
|
|
701
|
-
export type {
|
|
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 };
|
|
@@ -299,6 +299,33 @@ function useFrame(callback, priorityOrOptions) {
|
|
|
299
299
|
return controls;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
const R3F_STAGED_TEXTURES = Symbol.for("@react-three/fiber.stagedTextures");
|
|
303
|
+
const globalStaging = globalThis;
|
|
304
|
+
const staging = globalStaging[R3F_STAGED_TEXTURES] ?? (globalStaging[R3F_STAGED_TEXTURES] = /* @__PURE__ */ new WeakMap());
|
|
305
|
+
function stageTextures(store, entries) {
|
|
306
|
+
const registered = store.getState().textures;
|
|
307
|
+
let staged = staging.get(store);
|
|
308
|
+
for (const [url, texture] of entries) {
|
|
309
|
+
if (registered.has(url)) continue;
|
|
310
|
+
if (!staged) staging.set(store, staged = /* @__PURE__ */ new Map());
|
|
311
|
+
staged.set(url, texture);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function unstageTextures(store, urls) {
|
|
315
|
+
const staged = staging.get(store);
|
|
316
|
+
if (!staged) return;
|
|
317
|
+
for (const url of urls) staged.delete(url);
|
|
318
|
+
if (staged.size === 0) staging.delete(store);
|
|
319
|
+
}
|
|
320
|
+
function getTextureView(store) {
|
|
321
|
+
const registered = store.getState().textures;
|
|
322
|
+
const staged = staging.get(store);
|
|
323
|
+
if (!staged) return registered;
|
|
324
|
+
const view = new Map(registered);
|
|
325
|
+
for (const [url, texture] of staged) if (!view.has(url)) view.set(url, texture);
|
|
326
|
+
return view;
|
|
327
|
+
}
|
|
328
|
+
|
|
302
329
|
const R3F_EXTENSIONS = Symbol.for("@react-three/fiber.extensions");
|
|
303
330
|
function getRegistry() {
|
|
304
331
|
return globalThis[R3F_EXTENSIONS] ?? (globalThis[R3F_EXTENSIONS] = {
|
|
@@ -354,11 +381,14 @@ exports.ErrorBoundary = ErrorBoundary;
|
|
|
354
381
|
exports.attachRootExtensions = attachRootExtensions;
|
|
355
382
|
exports.context = context;
|
|
356
383
|
exports.detachRootExtensions = detachRootExtensions;
|
|
384
|
+
exports.getTextureView = getTextureView;
|
|
357
385
|
exports.notifyAlpha = notifyAlpha;
|
|
358
386
|
exports.notifyDepreciated = notifyDepreciated;
|
|
359
387
|
exports.notifyRootExtensionsHmr = notifyRootExtensionsHmr;
|
|
360
388
|
exports.registerRootExtension = registerRootExtension;
|
|
361
389
|
exports.setRenderOverride = setRenderOverride;
|
|
390
|
+
exports.stageTextures = stageTextures;
|
|
391
|
+
exports.unstageTextures = unstageTextures;
|
|
362
392
|
exports.useBridge = useBridge;
|
|
363
393
|
exports.useFrame = useFrame;
|
|
364
394
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|