@react-three/fiber 10.0.0-alpha.1 → 10.0.0-alpha.2
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/index.cjs +117 -68
- package/dist/index.d.cts +32 -21
- package/dist/index.d.mts +32 -21
- package/dist/index.d.ts +32 -21
- package/dist/index.mjs +116 -68
- package/dist/legacy.cjs +115 -67
- package/dist/legacy.d.cts +32 -21
- package/dist/legacy.d.mts +32 -21
- package/dist/legacy.d.ts +32 -21
- package/dist/legacy.mjs +114 -67
- package/dist/webgpu/index.cjs +347 -114
- package/dist/webgpu/index.d.cts +119 -26
- package/dist/webgpu/index.d.mts +119 -26
- package/dist/webgpu/index.d.ts +119 -26
- package/dist/webgpu/index.mjs +344 -115
- package/package.json +5 -5
- package/react-reconciler/constants.js +1 -9
- package/react-reconciler/index.js +4 -20
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ import * as React$1 from 'react';
|
|
|
8
8
|
import { ReactNode, Component, RefObject, JSX } from 'react';
|
|
9
9
|
import { StoreApi } from 'zustand';
|
|
10
10
|
import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
|
|
11
|
-
import * as react_reconciler from 'C:\\dev\\react-three-fiber\\node_modules\\.pnpm\\@types+react-reconciler@0.32.3_@types+react@19.2.7\\node_modules\\@types\\react-reconciler\\index.d.ts';
|
|
12
11
|
import { Options } from 'react-use-measure';
|
|
13
12
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
14
13
|
|
|
@@ -615,8 +614,8 @@ interface RootState {
|
|
|
615
614
|
advance: (timestamp: number, runGlobalEffects?: boolean) => void
|
|
616
615
|
/** Shortcut to setting the event layer */
|
|
617
616
|
setEvents: (events: Partial<EventManager<any>>) => void
|
|
618
|
-
/** Shortcut to manual sizing */
|
|
619
|
-
setSize: (width
|
|
617
|
+
/** Shortcut to manual sizing. No args resets to props/container. Single arg creates square. */
|
|
618
|
+
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
620
619
|
/** Shortcut to manual setting the pixel ratio */
|
|
621
620
|
setDpr: (dpr: Dpr) => void
|
|
622
621
|
/** Shortcut to setting frameloop flags */
|
|
@@ -635,6 +634,12 @@ interface RootState {
|
|
|
635
634
|
postProcessing: any | null // THREE.PostProcessing when available
|
|
636
635
|
/** Global TSL pass nodes for post-processing - use usePostProcessing() hook */
|
|
637
636
|
passes: Record<string, any>
|
|
637
|
+
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
638
|
+
_hmrVersion: number
|
|
639
|
+
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
640
|
+
_sizeImperative: boolean
|
|
641
|
+
/** Internal: stored size props from Canvas for reset functionality */
|
|
642
|
+
_sizeProps: { width?: number; height?: number } | null
|
|
638
643
|
/** When the canvas was clicked but nothing was hit */
|
|
639
644
|
onPointerMissed?: (event: MouseEvent) => void
|
|
640
645
|
/** When a dragover event has missed any target */
|
|
@@ -781,6 +786,8 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
781
786
|
* Only works with WebGPU renderer - WebGL will log a warning.
|
|
782
787
|
*/
|
|
783
788
|
occlusion?: boolean
|
|
789
|
+
/** Internal: stored size props from Canvas for reset functionality */
|
|
790
|
+
_sizeProps?: { width?: number; height?: number } | null
|
|
784
791
|
}
|
|
785
792
|
|
|
786
793
|
//* Reconciler Root ==============================
|
|
@@ -812,8 +819,12 @@ type InjectState = Partial<
|
|
|
812
819
|
|
|
813
820
|
//* Reconciler Types ==============================
|
|
814
821
|
|
|
822
|
+
// FiberRoot is an opaque internal React type - we define it locally
|
|
823
|
+
// to avoid bundling @types/react-reconciler which causes absolute path issues
|
|
824
|
+
type FiberRoot = any
|
|
825
|
+
|
|
815
826
|
interface Root {
|
|
816
|
-
fiber:
|
|
827
|
+
fiber: FiberRoot
|
|
817
828
|
store: RootStore
|
|
818
829
|
}
|
|
819
830
|
|
|
@@ -891,8 +902,7 @@ type GlobalEffectType = 'before' | 'after' | 'tail'
|
|
|
891
902
|
//* Canvas Types ==============================
|
|
892
903
|
|
|
893
904
|
interface CanvasProps
|
|
894
|
-
extends Omit<RenderProps<HTMLCanvasElement>, 'size'>,
|
|
895
|
-
React$1.HTMLAttributes<HTMLDivElement> {
|
|
905
|
+
extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React$1.HTMLAttributes<HTMLDivElement> {
|
|
896
906
|
children?: React$1.ReactNode
|
|
897
907
|
ref?: React$1.Ref<HTMLCanvasElement>
|
|
898
908
|
/** Canvas fallback content, similar to img's alt prop */
|
|
@@ -906,6 +916,12 @@ interface CanvasProps
|
|
|
906
916
|
eventSource?: HTMLElement | React$1.RefObject<HTMLElement>
|
|
907
917
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
908
918
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
|
|
919
|
+
/** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
|
|
920
|
+
hmr?: boolean
|
|
921
|
+
/** Canvas resolution width in pixels. If omitted, uses container width. */
|
|
922
|
+
width?: number
|
|
923
|
+
/** Canvas resolution height in pixels. If omitted, uses container height. */
|
|
924
|
+
height?: number
|
|
909
925
|
}
|
|
910
926
|
|
|
911
927
|
//* Loader Types ==============================
|
|
@@ -934,20 +950,15 @@ type InferLoadResult<T> = T extends {
|
|
|
934
950
|
}
|
|
935
951
|
? R
|
|
936
952
|
: T extends ConstructorRepresentation<any>
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
953
|
+
? InstanceType<T> extends {
|
|
954
|
+
load(url: any, onLoad?: (result: infer R) => void, ...args: any[]): any
|
|
955
|
+
}
|
|
956
|
+
? R
|
|
957
|
+
: any
|
|
941
958
|
: any
|
|
942
|
-
: any
|
|
943
959
|
|
|
944
|
-
type LoaderResult<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> =
|
|
945
|
-
LoaderInstance<T
|
|
946
|
-
> extends infer R
|
|
947
|
-
? R extends GLTFLike
|
|
948
|
-
? R & ObjectMap
|
|
949
|
-
: R
|
|
950
|
-
: never
|
|
960
|
+
type LoaderResult<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> =
|
|
961
|
+
InferLoadResult<LoaderInstance<T>> extends infer R ? (R extends GLTFLike ? R & ObjectMap : R) : never
|
|
951
962
|
|
|
952
963
|
type Extensions<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> = (
|
|
953
964
|
loader: LoaderInstance<T>,
|
|
@@ -1246,8 +1257,8 @@ type MathTypes = MathRepresentation | Euler$1 | Color$2
|
|
|
1246
1257
|
type MathType<T extends MathTypes> = T extends Color$2
|
|
1247
1258
|
? Args<typeof Color$2> | ColorRepresentation$1
|
|
1248
1259
|
: T extends VectorRepresentation | Layers$1 | Euler$1
|
|
1249
|
-
|
|
1250
|
-
|
|
1260
|
+
? T | MutableOrReadonlyParameters<T['set']> | number
|
|
1261
|
+
: T | MutableOrReadonlyParameters<T['set']>
|
|
1251
1262
|
|
|
1252
1263
|
type MathProps<P> = {
|
|
1253
1264
|
[K in keyof P as P[K] extends MathTypes ? K : never]: P[K] extends MathTypes ? MathType<P[K]> : never
|
|
@@ -3523,4 +3534,4 @@ declare const hasConstructor: (object: unknown) => object is {
|
|
|
3523
3534
|
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3524
3535
|
|
|
3525
3536
|
export { Block, Canvas, ErrorBoundary, IsObject, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber, Scheduler, Texture, _roots, act, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, context, createEvents, createPointerEvents, createPortal, createRoot, createStore, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, getInstanceProps, getRootState, getScheduler, getUuidPrefix, hasConstructor, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isObject3D, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, prepare, reconciler, removeInteractivity, resolve, unmountComponentAtNode, updateCamera, updateFrustum, useBridge, useFrame, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useMutableCallback, useRenderTarget, useStore, useTexture, useTextures, useThree };
|
|
3526
|
-
export type { Act, AddPhaseOptions, Args, ArgsProp, AttachFnType, AttachType, BaseRendererProps, Bridge, Camera, CameraProps, CanvasProps, Catalogue, Color, ComputeFunction, ConstructorRepresentation, DefaultGLProps, DefaultRendererProps, Disposable, DomEvent, Dpr, ElementProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FilterFunction, FrameCallback, FrameControls, FrameNextCallback, FrameNextControls, FrameNextState, FrameState, FrameTimingState, Frameloop, GLProps, GLTFLike, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LoaderInstance, LoaderLike, LoaderResult, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, Properties, Quaternion, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererFactory, RendererProps, Root, RootOptions, RootState, RootStore, SchedulerApi, SetBlock, Size, Subscription, TextureEntry, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UseFrameNextOptions, UseFrameOptions, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, XRManager };
|
|
3537
|
+
export type { Act, AddPhaseOptions, Args, ArgsProp, AttachFnType, AttachType, BaseRendererProps, Bridge, Camera, CameraProps, CanvasProps, Catalogue, Color, ComputeFunction, ConstructorRepresentation, DefaultGLProps, DefaultRendererProps, Disposable, DomEvent, Dpr, ElementProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameControls, FrameNextCallback, FrameNextControls, FrameNextState, FrameState, FrameTimingState, Frameloop, GLProps, GLTFLike, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LoaderInstance, LoaderLike, LoaderResult, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, Properties, Quaternion, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererFactory, RendererProps, Root, RootOptions, RootState, RootStore, SchedulerApi, SetBlock, Size, Subscription, TextureEntry, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UseFrameNextOptions, UseFrameOptions, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, XRManager };
|
package/dist/index.mjs
CHANGED
|
@@ -528,7 +528,7 @@ function applyProps(object, props) {
|
|
|
528
528
|
const rootState = instance && findInitialRoot(instance).getState();
|
|
529
529
|
const prevHandlers = instance?.eventCount;
|
|
530
530
|
for (const prop in props) {
|
|
531
|
-
|
|
531
|
+
const value = props[prop];
|
|
532
532
|
if (RESERVED_PROPS.includes(prop)) continue;
|
|
533
533
|
if (instance && EVENT_REGEX.test(prop)) {
|
|
534
534
|
if (typeof value === "function") instance.handlers[prop] = value;
|
|
@@ -680,13 +680,14 @@ function createEvents(store) {
|
|
|
680
680
|
for (const hit of hits) {
|
|
681
681
|
let eventObject = hit.object;
|
|
682
682
|
while (eventObject) {
|
|
683
|
-
if (eventObject.__r3f?.eventCount)
|
|
683
|
+
if (eventObject.__r3f?.eventCount) {
|
|
684
684
|
intersections.push({ ...hit, eventObject });
|
|
685
|
+
}
|
|
685
686
|
eventObject = eventObject.parent;
|
|
686
687
|
}
|
|
687
688
|
}
|
|
688
689
|
if ("pointerId" in event && state.internal.capturedMap.has(event.pointerId)) {
|
|
689
|
-
for (
|
|
690
|
+
for (const captureData of state.internal.capturedMap.get(event.pointerId).values()) {
|
|
690
691
|
if (!duplicates.has(makeId(captureData.intersection))) intersections.push(captureData.intersection);
|
|
691
692
|
}
|
|
692
693
|
}
|
|
@@ -716,12 +717,12 @@ function createEvents(store) {
|
|
|
716
717
|
releaseInternalPointerCapture(internal.capturedMap, hit.eventObject, captures, id);
|
|
717
718
|
}
|
|
718
719
|
};
|
|
719
|
-
|
|
720
|
-
for (
|
|
721
|
-
|
|
720
|
+
const extractEventProps = {};
|
|
721
|
+
for (const prop in event) {
|
|
722
|
+
const property = event[prop];
|
|
722
723
|
if (typeof property !== "function") extractEventProps[prop] = property;
|
|
723
724
|
}
|
|
724
|
-
|
|
725
|
+
const raycastEvent = {
|
|
725
726
|
...hit,
|
|
726
727
|
...extractEventProps,
|
|
727
728
|
pointer,
|
|
@@ -1104,10 +1105,38 @@ const createStore = (invalidate, advance) => {
|
|
|
1104
1105
|
getCurrentViewport
|
|
1105
1106
|
},
|
|
1106
1107
|
setEvents: (events) => set((state2) => ({ ...state2, events: { ...state2.events, ...events } })),
|
|
1107
|
-
setSize: (width, height, top
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
|
|
1108
|
+
setSize: (width, height, top, left) => {
|
|
1109
|
+
const state2 = get();
|
|
1110
|
+
if (width === void 0) {
|
|
1111
|
+
set({ _sizeImperative: false });
|
|
1112
|
+
if (state2._sizeProps) {
|
|
1113
|
+
const { width: propW, height: propH } = state2._sizeProps;
|
|
1114
|
+
if (propW !== void 0 || propH !== void 0) {
|
|
1115
|
+
const currentSize = state2.size;
|
|
1116
|
+
const newSize = {
|
|
1117
|
+
width: propW ?? currentSize.width,
|
|
1118
|
+
height: propH ?? currentSize.height,
|
|
1119
|
+
top: currentSize.top,
|
|
1120
|
+
left: currentSize.left
|
|
1121
|
+
};
|
|
1122
|
+
set((s) => ({
|
|
1123
|
+
size: newSize,
|
|
1124
|
+
viewport: { ...s.viewport, ...getCurrentViewport(state2.camera, defaultTarget, newSize) }
|
|
1125
|
+
}));
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
const w = width;
|
|
1131
|
+
const h = height ?? width;
|
|
1132
|
+
const t = top ?? state2.size.top;
|
|
1133
|
+
const l = left ?? state2.size.left;
|
|
1134
|
+
const size = { width: w, height: h, top: t, left: l };
|
|
1135
|
+
set((s) => ({
|
|
1136
|
+
size,
|
|
1137
|
+
viewport: { ...s.viewport, ...getCurrentViewport(state2.camera, defaultTarget, size) },
|
|
1138
|
+
_sizeImperative: true
|
|
1139
|
+
}));
|
|
1111
1140
|
},
|
|
1112
1141
|
setDpr: (dpr) => set((state2) => {
|
|
1113
1142
|
const resolved = calculateDpr(dpr);
|
|
@@ -1124,6 +1153,9 @@ const createStore = (invalidate, advance) => {
|
|
|
1124
1153
|
textures: /* @__PURE__ */ new Map(),
|
|
1125
1154
|
postProcessing: null,
|
|
1126
1155
|
passes: {},
|
|
1156
|
+
_hmrVersion: 0,
|
|
1157
|
+
_sizeImperative: false,
|
|
1158
|
+
_sizeProps: null,
|
|
1127
1159
|
previousRoot: void 0,
|
|
1128
1160
|
internal: {
|
|
1129
1161
|
// Events
|
|
@@ -1331,8 +1363,9 @@ class PhaseGraph {
|
|
|
1331
1363
|
const node = { name, isAutoGenerated: false };
|
|
1332
1364
|
let insertIndex = this.phases.length;
|
|
1333
1365
|
const targetIndex = this.getPhaseIndex(before ?? after);
|
|
1334
|
-
if (targetIndex !== -1)
|
|
1335
|
-
|
|
1366
|
+
if (targetIndex !== -1) {
|
|
1367
|
+
insertIndex = before ? targetIndex : targetIndex + 1;
|
|
1368
|
+
} else {
|
|
1336
1369
|
const constraintType = before ? "before" : "after";
|
|
1337
1370
|
console.warn(`[useFrame] Phase "${before ?? after}" not found for '${constraintType}' constraint`);
|
|
1338
1371
|
}
|
|
@@ -2745,24 +2778,14 @@ function advance(timestamp, runGlobalEffects = true, state, frame) {
|
|
|
2745
2778
|
getScheduler().step(timestamp);
|
|
2746
2779
|
}
|
|
2747
2780
|
|
|
2748
|
-
const version = "10.0.0-alpha.
|
|
2781
|
+
const version = "10.0.0-alpha.2";
|
|
2749
2782
|
const packageData = {
|
|
2750
2783
|
version: version};
|
|
2751
2784
|
|
|
2752
2785
|
function Xb(Tt) {
|
|
2753
2786
|
return Tt && Tt.__esModule && Object.prototype.hasOwnProperty.call(Tt, "default") ? Tt.default : Tt;
|
|
2754
2787
|
}
|
|
2755
|
-
var Rm = { exports: {} }, Og = { exports: {} };
|
|
2756
|
-
/**
|
|
2757
|
-
* @license React
|
|
2758
|
-
* react-reconciler.production.js
|
|
2759
|
-
*
|
|
2760
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2761
|
-
*
|
|
2762
|
-
* This source code is licensed under the MIT license found in the
|
|
2763
|
-
* LICENSE file in the root directory of this source tree.
|
|
2764
|
-
*/
|
|
2765
|
-
var _b;
|
|
2788
|
+
var Rm = { exports: {} }, Og = { exports: {} }, _b;
|
|
2766
2789
|
function Kb() {
|
|
2767
2790
|
return _b || (_b = 1, (function(Tt) {
|
|
2768
2791
|
Tt.exports = function(m) {
|
|
@@ -3834,7 +3857,6 @@ Error generating stack: ` + l.message + `
|
|
|
3834
3857
|
if (J === cl || J === jc) throw J;
|
|
3835
3858
|
var Ge = Yn(29, J, null, P.mode);
|
|
3836
3859
|
return Ge.lanes = H, Ge.return = P, Ge;
|
|
3837
|
-
} finally {
|
|
3838
3860
|
}
|
|
3839
3861
|
};
|
|
3840
3862
|
}
|
|
@@ -4488,7 +4510,6 @@ Error generating stack: ` + l.message + `
|
|
|
4488
4510
|
var h = r.lastRenderedState, y = d(h, a);
|
|
4489
4511
|
if (c.hasEagerState = true, c.eagerState = y, jn(y, h)) return go(t, r, c, 0), Ne === null && Bn(), false;
|
|
4490
4512
|
} catch {
|
|
4491
|
-
} finally {
|
|
4492
4513
|
}
|
|
4493
4514
|
if (a = yo(t, r, c, l), a !== null) return nt(a, t, l), ns(a, r, l), true;
|
|
4494
4515
|
}
|
|
@@ -6909,10 +6930,7 @@ Error generating stack: ` + l.message + `
|
|
|
6909
6930
|
function vr(t, r) {
|
|
6910
6931
|
Sf(t, r), (t = t.alternate) && Sf(t, r);
|
|
6911
6932
|
}
|
|
6912
|
-
var ie = {}, Fm = React__default, tt = Tb, Lt = Object.assign, hc = Symbol.for("react.element"), zs = Symbol.for("react.transitional.element"), sa = Symbol.for("react.portal"), $a = Symbol.for("react.fragment"), kf = Symbol.for("react.strict_mode"), Cs = Symbol.for("react.profiler"), mc = Symbol.for("react.consumer"), Io = Symbol.for("react.context"), Zi = Symbol.for("react.forward_ref"), Va = Symbol.for("react.suspense"), Te = Symbol.for("react.suspense_list"), wf = Symbol.for("react.memo"), ua = Symbol.for("react.lazy");
|
|
6913
|
-
var gc = Symbol.for("react.activity");
|
|
6914
|
-
var $r = Symbol.for("react.memo_cache_sentinel");
|
|
6915
|
-
var Pf = Symbol.iterator, xf = Symbol.for("react.client.reference"), ca = Array.isArray, M = Fm.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Yp = m.rendererVersion, zf = m.rendererPackageName, Cf = m.extraDevToolsConfig, Ts = m.getPublicInstance, Hm = m.getRootHostContext, Xp = m.getChildHostContext, Am = m.prepareForCommit, _s = m.resetAfterCommit, Vr = m.createInstance;
|
|
6933
|
+
var ie = {}, Fm = React__default, tt = Tb, Lt = Object.assign, hc = Symbol.for("react.element"), zs = Symbol.for("react.transitional.element"), sa = Symbol.for("react.portal"), $a = Symbol.for("react.fragment"), kf = Symbol.for("react.strict_mode"), Cs = Symbol.for("react.profiler"), mc = Symbol.for("react.consumer"), Io = Symbol.for("react.context"), Zi = Symbol.for("react.forward_ref"), Va = Symbol.for("react.suspense"), Te = Symbol.for("react.suspense_list"), wf = Symbol.for("react.memo"), ua = Symbol.for("react.lazy"), gc = Symbol.for("react.activity"), $r = Symbol.for("react.memo_cache_sentinel"), Pf = Symbol.iterator, xf = Symbol.for("react.client.reference"), ca = Array.isArray, M = Fm.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Yp = m.rendererVersion, zf = m.rendererPackageName, Cf = m.extraDevToolsConfig, Ts = m.getPublicInstance, Hm = m.getRootHostContext, Xp = m.getChildHostContext, Am = m.prepareForCommit, _s = m.resetAfterCommit, Vr = m.createInstance;
|
|
6916
6934
|
m.cloneMutableInstance;
|
|
6917
6935
|
var yc = m.appendInitialChild, Kp = m.finalizeInitialChildren, Rs = m.shouldSetTextContent, bc = m.createTextInstance;
|
|
6918
6936
|
m.cloneMutableTextInstance;
|
|
@@ -7281,17 +7299,7 @@ No matching component was found for:
|
|
|
7281
7299
|
}, Tt.exports.default = Tt.exports, Object.defineProperty(Tt.exports, "__esModule", { value: true });
|
|
7282
7300
|
})(Og)), Og.exports;
|
|
7283
7301
|
}
|
|
7284
|
-
var Mg = { exports: {} };
|
|
7285
|
-
/**
|
|
7286
|
-
* @license React
|
|
7287
|
-
* react-reconciler.development.js
|
|
7288
|
-
*
|
|
7289
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7290
|
-
*
|
|
7291
|
-
* This source code is licensed under the MIT license found in the
|
|
7292
|
-
* LICENSE file in the root directory of this source tree.
|
|
7293
|
-
*/
|
|
7294
|
-
var Rb;
|
|
7302
|
+
var Mg = { exports: {} }, Rb;
|
|
7295
7303
|
function e0() {
|
|
7296
7304
|
return Rb || (Rb = 1, (function(Tt) {
|
|
7297
7305
|
process.env.NODE_ENV !== "production" && (Tt.exports = function(m) {
|
|
@@ -13058,10 +13066,7 @@ Check the render method of %s.`, G(di) || "Unknown")), i = zo(n), i.payload = {
|
|
|
13058
13066
|
function Ic() {
|
|
13059
13067
|
return di;
|
|
13060
13068
|
}
|
|
13061
|
-
var le = {}, qm = React__default, St = Tb, ze = Object.assign, Uh = Symbol.for("react.element"), Ho = Symbol.for("react.transitional.element"), Ao = Symbol.for("react.portal"), ol = Symbol.for("react.fragment"), Lc = Symbol.for("react.strict_mode"), Uf = Symbol.for("react.profiler"), ei = Symbol.for("react.consumer"), on = Symbol.for("react.context"), jn = Symbol.for("react.forward_ref"), Nc = Symbol.for("react.suspense"), Bf = Symbol.for("react.suspense_list"), al = Symbol.for("react.memo"), kt = Symbol.for("react.lazy");
|
|
13062
|
-
var Ds = Symbol.for("react.activity");
|
|
13063
|
-
var Bh = Symbol.for("react.memo_cache_sentinel");
|
|
13064
|
-
var ni = Symbol.iterator, il = Symbol.for("react.client.reference"), fn = Array.isArray, x = qm.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Jt = m.rendererVersion, Zt = m.rendererPackageName, jo = m.extraDevToolsConfig, ot = m.getPublicInstance, Zr = m.getRootHostContext, Dn = m.getChildHostContext, Ws = m.prepareForCommit, pa = m.resetAfterCommit, Fc = m.createInstance;
|
|
13069
|
+
var le = {}, qm = React__default, St = Tb, ze = Object.assign, Uh = Symbol.for("react.element"), Ho = Symbol.for("react.transitional.element"), Ao = Symbol.for("react.portal"), ol = Symbol.for("react.fragment"), Lc = Symbol.for("react.strict_mode"), Uf = Symbol.for("react.profiler"), ei = Symbol.for("react.consumer"), on = Symbol.for("react.context"), jn = Symbol.for("react.forward_ref"), Nc = Symbol.for("react.suspense"), Bf = Symbol.for("react.suspense_list"), al = Symbol.for("react.memo"), kt = Symbol.for("react.lazy"), Ds = Symbol.for("react.activity"), Bh = Symbol.for("react.memo_cache_sentinel"), ni = Symbol.iterator, il = Symbol.for("react.client.reference"), fn = Array.isArray, x = qm.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Jt = m.rendererVersion, Zt = m.rendererPackageName, jo = m.extraDevToolsConfig, ot = m.getPublicInstance, Zr = m.getRootHostContext, Dn = m.getChildHostContext, Ws = m.prepareForCommit, pa = m.resetAfterCommit, Fc = m.createInstance;
|
|
13065
13070
|
m.cloneMutableInstance;
|
|
13066
13071
|
var bn = m.appendInitialChild, Ue = m.finalizeInitialChildren, ue = m.shouldSetTextContent, Do = m.createTextInstance;
|
|
13067
13072
|
m.cloneMutableTextInstance;
|
|
@@ -14029,15 +14034,6 @@ function n0() {
|
|
|
14029
14034
|
var t0 = n0();
|
|
14030
14035
|
const r0 = Xb(t0);
|
|
14031
14036
|
|
|
14032
|
-
/**
|
|
14033
|
-
* @license React
|
|
14034
|
-
* react-reconciler-constants.production.js
|
|
14035
|
-
*
|
|
14036
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14037
|
-
*
|
|
14038
|
-
* This source code is licensed under the MIT license found in the
|
|
14039
|
-
* LICENSE file in the root directory of this source tree.
|
|
14040
|
-
*/
|
|
14041
14037
|
const t = 1, o = 8, r = 32, e = 2;
|
|
14042
14038
|
|
|
14043
14039
|
function createReconciler(config) {
|
|
@@ -14064,10 +14060,11 @@ function extend(objects) {
|
|
|
14064
14060
|
function validateInstance(type, props) {
|
|
14065
14061
|
const name = toPascalCase(type);
|
|
14066
14062
|
const target = catalogue[name];
|
|
14067
|
-
if (type !== "primitive" && !target)
|
|
14063
|
+
if (type !== "primitive" && !target) {
|
|
14068
14064
|
throw new Error(
|
|
14069
14065
|
`R3F: ${name} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`
|
|
14070
14066
|
);
|
|
14067
|
+
}
|
|
14071
14068
|
if (type === "primitive" && !props.object) throw new Error(`R3F: Primitives without 'object' are invalid!`);
|
|
14072
14069
|
if (props.args !== void 0 && !Array.isArray(props.args)) throw new Error("R3F: The args prop must be an array!");
|
|
14073
14070
|
}
|
|
@@ -14518,14 +14515,14 @@ function createRoot(canvas) {
|
|
|
14518
14515
|
if (!prevRoot) _roots.set(canvas, { fiber, store });
|
|
14519
14516
|
let onCreated;
|
|
14520
14517
|
let lastCamera;
|
|
14521
|
-
|
|
14518
|
+
const lastConfiguredProps = {};
|
|
14522
14519
|
let configured = false;
|
|
14523
14520
|
let pending = null;
|
|
14524
14521
|
return {
|
|
14525
14522
|
async configure(props = {}) {
|
|
14526
14523
|
let resolve;
|
|
14527
14524
|
pending = new Promise((_resolve) => resolve = _resolve);
|
|
14528
|
-
|
|
14525
|
+
const {
|
|
14529
14526
|
gl: glConfig,
|
|
14530
14527
|
renderer: rendererConfig,
|
|
14531
14528
|
size: propsSize,
|
|
@@ -14547,9 +14544,10 @@ function createRoot(canvas) {
|
|
|
14547
14544
|
onDragOverMissed,
|
|
14548
14545
|
onDropMissed,
|
|
14549
14546
|
autoUpdateFrustum = true,
|
|
14550
|
-
occlusion = false
|
|
14547
|
+
occlusion = false,
|
|
14548
|
+
_sizeProps
|
|
14551
14549
|
} = props;
|
|
14552
|
-
|
|
14550
|
+
const state = store.getState();
|
|
14553
14551
|
const defaultGLProps = {
|
|
14554
14552
|
canvas,
|
|
14555
14553
|
powerPreference: "high-performance",
|
|
@@ -14589,8 +14587,9 @@ function createRoot(canvas) {
|
|
|
14589
14587
|
if (!raycaster) state.set({ raycaster: raycaster = new Raycaster() });
|
|
14590
14588
|
const { params, ...options } = raycastOptions || {};
|
|
14591
14589
|
if (!is.equ(options, raycaster, shallowLoose)) applyProps(raycaster, { ...options });
|
|
14592
|
-
if (!is.equ(params, raycaster.params, shallowLoose))
|
|
14590
|
+
if (!is.equ(params, raycaster.params, shallowLoose)) {
|
|
14593
14591
|
applyProps(raycaster, { params: { ...raycaster.params, ...params } });
|
|
14592
|
+
}
|
|
14594
14593
|
if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {
|
|
14595
14594
|
lastCamera = cameraOptions;
|
|
14596
14595
|
const isCamera = cameraOptions?.isCamera;
|
|
@@ -14641,9 +14640,14 @@ function createRoot(canvas) {
|
|
|
14641
14640
|
wasEnabled = enabled;
|
|
14642
14641
|
});
|
|
14643
14642
|
}
|
|
14643
|
+
if (_sizeProps !== void 0) {
|
|
14644
|
+
state.set({ _sizeProps });
|
|
14645
|
+
}
|
|
14644
14646
|
const size = computeInitialSize(canvas, propsSize);
|
|
14645
|
-
if (!is.equ(size, state.size, shallowLoose)) {
|
|
14647
|
+
if (!state._sizeImperative && !is.equ(size, state.size, shallowLoose)) {
|
|
14648
|
+
const wasImperative = state._sizeImperative;
|
|
14646
14649
|
state.setSize(size.width, size.height, size.top, size.left);
|
|
14650
|
+
if (!wasImperative) state.set({ _sizeImperative: false });
|
|
14647
14651
|
}
|
|
14648
14652
|
if (dpr !== void 0 && !is.equ(dpr, lastConfiguredProps.dpr, shallowLoose)) {
|
|
14649
14653
|
state.setDpr(dpr);
|
|
@@ -14713,20 +14717,22 @@ function createRoot(canvas) {
|
|
|
14713
14717
|
} else if (is.obj(shadows)) {
|
|
14714
14718
|
Object.assign(renderer.shadowMap, shadows);
|
|
14715
14719
|
}
|
|
14716
|
-
if (oldEnabled !== renderer.shadowMap.enabled || oldType !== renderer.shadowMap.type)
|
|
14720
|
+
if (oldEnabled !== renderer.shadowMap.enabled || oldType !== renderer.shadowMap.type) {
|
|
14717
14721
|
renderer.shadowMap.needsUpdate = true;
|
|
14722
|
+
}
|
|
14718
14723
|
}
|
|
14719
14724
|
{
|
|
14720
14725
|
const legacyChanged = legacy !== lastConfiguredProps.legacy;
|
|
14721
14726
|
const linearChanged = linear !== lastConfiguredProps.linear;
|
|
14722
14727
|
const flatChanged = flat !== lastConfiguredProps.flat;
|
|
14723
14728
|
if (legacyChanged) {
|
|
14724
|
-
if (legacy)
|
|
14729
|
+
if (legacy) {
|
|
14725
14730
|
notifyDepreciated({
|
|
14726
14731
|
heading: "Legacy Color Management",
|
|
14727
14732
|
body: "Legacy color management is deprecated and will be removed in a future version.",
|
|
14728
14733
|
link: "https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe"
|
|
14729
14734
|
});
|
|
14735
|
+
}
|
|
14730
14736
|
}
|
|
14731
14737
|
if (legacyChanged) {
|
|
14732
14738
|
ColorManagement.enabled = !legacy;
|
|
@@ -14748,8 +14754,9 @@ function createRoot(canvas) {
|
|
|
14748
14754
|
if (state.textureColorSpace !== textureColorSpace) state.set(() => ({ textureColorSpace }));
|
|
14749
14755
|
lastConfiguredProps.textureColorSpace = textureColorSpace;
|
|
14750
14756
|
}
|
|
14751
|
-
if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, renderer, shallowLoose))
|
|
14757
|
+
if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, renderer, shallowLoose)) {
|
|
14752
14758
|
applyProps(renderer, glConfig);
|
|
14759
|
+
}
|
|
14753
14760
|
if (rendererConfig && !is.fun(rendererConfig) && !isRenderer(rendererConfig) && state.renderer) {
|
|
14754
14761
|
const currentRenderer = state.renderer;
|
|
14755
14762
|
if (!is.equ(rendererConfig, currentRenderer, shallowLoose)) {
|
|
@@ -15017,6 +15024,9 @@ function CanvasImpl({
|
|
|
15017
15024
|
onDragOverMissed,
|
|
15018
15025
|
onDropMissed,
|
|
15019
15026
|
onCreated,
|
|
15027
|
+
hmr,
|
|
15028
|
+
width,
|
|
15029
|
+
height,
|
|
15020
15030
|
...props
|
|
15021
15031
|
}) {
|
|
15022
15032
|
React.useMemo(() => extend(THREE), []);
|
|
@@ -15037,7 +15047,16 @@ function CanvasImpl({
|
|
|
15037
15047
|
};
|
|
15038
15048
|
}, [resize, hasInitialSizeRef.current]);
|
|
15039
15049
|
const [containerRef, containerRect] = useMeasure(measureConfig);
|
|
15040
|
-
|
|
15050
|
+
const effectiveSize = React.useMemo(
|
|
15051
|
+
() => ({
|
|
15052
|
+
width: width ?? containerRect.width,
|
|
15053
|
+
height: height ?? containerRect.height,
|
|
15054
|
+
top: containerRect.top,
|
|
15055
|
+
left: containerRect.left
|
|
15056
|
+
}),
|
|
15057
|
+
[width, height, containerRect]
|
|
15058
|
+
);
|
|
15059
|
+
if (!hasInitialSizeRef.current && effectiveSize.width > 0 && effectiveSize.height > 0) {
|
|
15041
15060
|
hasInitialSizeRef.current = true;
|
|
15042
15061
|
}
|
|
15043
15062
|
const canvasRef = React.useRef(null);
|
|
@@ -15056,7 +15075,7 @@ function CanvasImpl({
|
|
|
15056
15075
|
useIsomorphicLayoutEffect(() => {
|
|
15057
15076
|
effectActiveRef.current = true;
|
|
15058
15077
|
const canvas = canvasRef.current;
|
|
15059
|
-
if (
|
|
15078
|
+
if (effectiveSize.width > 0 && effectiveSize.height > 0 && canvas) {
|
|
15060
15079
|
if (!root.current) {
|
|
15061
15080
|
root.current = createRoot(canvas);
|
|
15062
15081
|
notifyAlpha({
|
|
@@ -15090,7 +15109,9 @@ function CanvasImpl({
|
|
|
15090
15109
|
performance,
|
|
15091
15110
|
raycaster,
|
|
15092
15111
|
camera,
|
|
15093
|
-
size:
|
|
15112
|
+
size: effectiveSize,
|
|
15113
|
+
// Store size props for reset functionality
|
|
15114
|
+
_sizeProps: width !== void 0 || height !== void 0 ? { width, height } : null,
|
|
15094
15115
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
15095
15116
|
onPointerMissed: (...args) => handlePointerMissed.current?.(...args),
|
|
15096
15117
|
onDragOverMissed: (...args) => handleDragOverMissed.current?.(...args),
|
|
@@ -15136,6 +15157,33 @@ function CanvasImpl({
|
|
|
15136
15157
|
};
|
|
15137
15158
|
}
|
|
15138
15159
|
}, []);
|
|
15160
|
+
React.useEffect(() => {
|
|
15161
|
+
if (hmr === false) return;
|
|
15162
|
+
const canvas = canvasRef.current;
|
|
15163
|
+
if (!canvas) return;
|
|
15164
|
+
const handleHMR = () => {
|
|
15165
|
+
const rootEntry = _roots.get(canvas);
|
|
15166
|
+
if (rootEntry?.store) {
|
|
15167
|
+
rootEntry.store.setState((state) => ({
|
|
15168
|
+
nodes: {},
|
|
15169
|
+
uniforms: {},
|
|
15170
|
+
_hmrVersion: state._hmrVersion + 1
|
|
15171
|
+
}));
|
|
15172
|
+
}
|
|
15173
|
+
};
|
|
15174
|
+
if (typeof import.meta !== "undefined" && import.meta.hot) {
|
|
15175
|
+
const hot = import.meta.hot;
|
|
15176
|
+
hot.on("vite:afterUpdate", handleHMR);
|
|
15177
|
+
return () => hot.dispose?.(() => {
|
|
15178
|
+
});
|
|
15179
|
+
}
|
|
15180
|
+
if (typeof module !== "undefined" && module.hot) {
|
|
15181
|
+
const hot = module.hot;
|
|
15182
|
+
hot.addStatusHandler((status) => {
|
|
15183
|
+
if (status === "idle") handleHMR();
|
|
15184
|
+
});
|
|
15185
|
+
}
|
|
15186
|
+
}, [hmr]);
|
|
15139
15187
|
const pointerEvents = eventSource ? "none" : "auto";
|
|
15140
15188
|
return /* @__PURE__ */ jsx(
|
|
15141
15189
|
"div",
|