@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/legacy.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import * as React$1 from 'react';
|
|
|
4
4
|
import { ReactNode, Component, RefObject, JSX } from 'react';
|
|
5
5
|
import { StoreApi } from 'zustand';
|
|
6
6
|
import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
|
|
7
|
-
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';
|
|
8
7
|
import * as three_webgpu from 'three/webgpu';
|
|
9
8
|
import { Node, ShaderNodeObject } from 'three/webgpu';
|
|
10
9
|
import { Options } from 'react-use-measure';
|
|
@@ -614,8 +613,8 @@ interface RootState {
|
|
|
614
613
|
advance: (timestamp: number, runGlobalEffects?: boolean) => void
|
|
615
614
|
/** Shortcut to setting the event layer */
|
|
616
615
|
setEvents: (events: Partial<EventManager<any>>) => void
|
|
617
|
-
/** Shortcut to manual sizing */
|
|
618
|
-
setSize: (width
|
|
616
|
+
/** Shortcut to manual sizing. No args resets to props/container. Single arg creates square. */
|
|
617
|
+
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
619
618
|
/** Shortcut to manual setting the pixel ratio */
|
|
620
619
|
setDpr: (dpr: Dpr) => void
|
|
621
620
|
/** Shortcut to setting frameloop flags */
|
|
@@ -634,6 +633,12 @@ interface RootState {
|
|
|
634
633
|
postProcessing: any | null // THREE.PostProcessing when available
|
|
635
634
|
/** Global TSL pass nodes for post-processing - use usePostProcessing() hook */
|
|
636
635
|
passes: Record<string, any>
|
|
636
|
+
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
637
|
+
_hmrVersion: number
|
|
638
|
+
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
639
|
+
_sizeImperative: boolean
|
|
640
|
+
/** Internal: stored size props from Canvas for reset functionality */
|
|
641
|
+
_sizeProps: { width?: number; height?: number } | null
|
|
637
642
|
/** When the canvas was clicked but nothing was hit */
|
|
638
643
|
onPointerMissed?: (event: MouseEvent) => void
|
|
639
644
|
/** When a dragover event has missed any target */
|
|
@@ -780,6 +785,8 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
780
785
|
* Only works with WebGPU renderer - WebGL will log a warning.
|
|
781
786
|
*/
|
|
782
787
|
occlusion?: boolean
|
|
788
|
+
/** Internal: stored size props from Canvas for reset functionality */
|
|
789
|
+
_sizeProps?: { width?: number; height?: number } | null
|
|
783
790
|
}
|
|
784
791
|
|
|
785
792
|
//* Reconciler Root ==============================
|
|
@@ -811,8 +818,12 @@ type InjectState = Partial<
|
|
|
811
818
|
|
|
812
819
|
//* Reconciler Types ==============================
|
|
813
820
|
|
|
821
|
+
// FiberRoot is an opaque internal React type - we define it locally
|
|
822
|
+
// to avoid bundling @types/react-reconciler which causes absolute path issues
|
|
823
|
+
type FiberRoot = any
|
|
824
|
+
|
|
814
825
|
interface Root {
|
|
815
|
-
fiber:
|
|
826
|
+
fiber: FiberRoot
|
|
816
827
|
store: RootStore
|
|
817
828
|
}
|
|
818
829
|
|
|
@@ -890,8 +901,7 @@ type GlobalEffectType = 'before' | 'after' | 'tail'
|
|
|
890
901
|
//* Canvas Types ==============================
|
|
891
902
|
|
|
892
903
|
interface CanvasProps
|
|
893
|
-
extends Omit<RenderProps<HTMLCanvasElement>, 'size'>,
|
|
894
|
-
React$1.HTMLAttributes<HTMLDivElement> {
|
|
904
|
+
extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React$1.HTMLAttributes<HTMLDivElement> {
|
|
895
905
|
children?: React$1.ReactNode
|
|
896
906
|
ref?: React$1.Ref<HTMLCanvasElement>
|
|
897
907
|
/** Canvas fallback content, similar to img's alt prop */
|
|
@@ -905,6 +915,12 @@ interface CanvasProps
|
|
|
905
915
|
eventSource?: HTMLElement | React$1.RefObject<HTMLElement>
|
|
906
916
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
907
917
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
|
|
918
|
+
/** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
|
|
919
|
+
hmr?: boolean
|
|
920
|
+
/** Canvas resolution width in pixels. If omitted, uses container width. */
|
|
921
|
+
width?: number
|
|
922
|
+
/** Canvas resolution height in pixels. If omitted, uses container height. */
|
|
923
|
+
height?: number
|
|
908
924
|
}
|
|
909
925
|
|
|
910
926
|
//* Loader Types ==============================
|
|
@@ -933,20 +949,15 @@ type InferLoadResult<T> = T extends {
|
|
|
933
949
|
}
|
|
934
950
|
? R
|
|
935
951
|
: T extends ConstructorRepresentation<any>
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
952
|
+
? InstanceType<T> extends {
|
|
953
|
+
load(url: any, onLoad?: (result: infer R) => void, ...args: any[]): any
|
|
954
|
+
}
|
|
955
|
+
? R
|
|
956
|
+
: any
|
|
940
957
|
: any
|
|
941
|
-
: any
|
|
942
958
|
|
|
943
|
-
type LoaderResult<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> =
|
|
944
|
-
LoaderInstance<T
|
|
945
|
-
> extends infer R
|
|
946
|
-
? R extends GLTFLike
|
|
947
|
-
? R & ObjectMap
|
|
948
|
-
: R
|
|
949
|
-
: never
|
|
959
|
+
type LoaderResult<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> =
|
|
960
|
+
InferLoadResult<LoaderInstance<T>> extends infer R ? (R extends GLTFLike ? R & ObjectMap : R) : never
|
|
950
961
|
|
|
951
962
|
type Extensions<T extends LoaderLike | ConstructorRepresentation<LoaderLike>> = (
|
|
952
963
|
loader: LoaderInstance<T>,
|
|
@@ -1245,8 +1256,8 @@ type MathTypes = MathRepresentation | Euler$1 | Color$1
|
|
|
1245
1256
|
type MathType<T extends MathTypes> = T extends Color$1
|
|
1246
1257
|
? Args<typeof Color$1> | ColorRepresentation
|
|
1247
1258
|
: T extends VectorRepresentation | Layers$1 | Euler$1
|
|
1248
|
-
|
|
1249
|
-
|
|
1259
|
+
? T | MutableOrReadonlyParameters<T['set']> | number
|
|
1260
|
+
: T | MutableOrReadonlyParameters<T['set']>
|
|
1250
1261
|
|
|
1251
1262
|
type MathProps<P> = {
|
|
1252
1263
|
[K in keyof P as P[K] extends MathTypes ? K : never]: P[K] extends MathTypes ? MathType<P[K]> : never
|
|
@@ -3522,4 +3533,4 @@ declare const hasConstructor: (object: unknown) => object is {
|
|
|
3522
3533
|
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3523
3534
|
|
|
3524
3535
|
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 };
|
|
3525
|
-
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 };
|
|
3536
|
+
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/legacy.mjs
CHANGED
|
@@ -537,7 +537,7 @@ function applyProps(object, props) {
|
|
|
537
537
|
const rootState = instance && findInitialRoot(instance).getState();
|
|
538
538
|
const prevHandlers = instance?.eventCount;
|
|
539
539
|
for (const prop in props) {
|
|
540
|
-
|
|
540
|
+
const value = props[prop];
|
|
541
541
|
if (RESERVED_PROPS.includes(prop)) continue;
|
|
542
542
|
if (instance && EVENT_REGEX.test(prop)) {
|
|
543
543
|
if (typeof value === "function") instance.handlers[prop] = value;
|
|
@@ -689,13 +689,14 @@ function createEvents(store) {
|
|
|
689
689
|
for (const hit of hits) {
|
|
690
690
|
let eventObject = hit.object;
|
|
691
691
|
while (eventObject) {
|
|
692
|
-
if (eventObject.__r3f?.eventCount)
|
|
692
|
+
if (eventObject.__r3f?.eventCount) {
|
|
693
693
|
intersections.push({ ...hit, eventObject });
|
|
694
|
+
}
|
|
694
695
|
eventObject = eventObject.parent;
|
|
695
696
|
}
|
|
696
697
|
}
|
|
697
698
|
if ("pointerId" in event && state.internal.capturedMap.has(event.pointerId)) {
|
|
698
|
-
for (
|
|
699
|
+
for (const captureData of state.internal.capturedMap.get(event.pointerId).values()) {
|
|
699
700
|
if (!duplicates.has(makeId(captureData.intersection))) intersections.push(captureData.intersection);
|
|
700
701
|
}
|
|
701
702
|
}
|
|
@@ -725,12 +726,12 @@ function createEvents(store) {
|
|
|
725
726
|
releaseInternalPointerCapture(internal.capturedMap, hit.eventObject, captures, id);
|
|
726
727
|
}
|
|
727
728
|
};
|
|
728
|
-
|
|
729
|
-
for (
|
|
730
|
-
|
|
729
|
+
const extractEventProps = {};
|
|
730
|
+
for (const prop in event) {
|
|
731
|
+
const property = event[prop];
|
|
731
732
|
if (typeof property !== "function") extractEventProps[prop] = property;
|
|
732
733
|
}
|
|
733
|
-
|
|
734
|
+
const raycastEvent = {
|
|
734
735
|
...hit,
|
|
735
736
|
...extractEventProps,
|
|
736
737
|
pointer,
|
|
@@ -1113,10 +1114,38 @@ const createStore = (invalidate, advance) => {
|
|
|
1113
1114
|
getCurrentViewport
|
|
1114
1115
|
},
|
|
1115
1116
|
setEvents: (events) => set((state2) => ({ ...state2, events: { ...state2.events, ...events } })),
|
|
1116
|
-
setSize: (width, height, top
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
|
|
1117
|
+
setSize: (width, height, top, left) => {
|
|
1118
|
+
const state2 = get();
|
|
1119
|
+
if (width === void 0) {
|
|
1120
|
+
set({ _sizeImperative: false });
|
|
1121
|
+
if (state2._sizeProps) {
|
|
1122
|
+
const { width: propW, height: propH } = state2._sizeProps;
|
|
1123
|
+
if (propW !== void 0 || propH !== void 0) {
|
|
1124
|
+
const currentSize = state2.size;
|
|
1125
|
+
const newSize = {
|
|
1126
|
+
width: propW ?? currentSize.width,
|
|
1127
|
+
height: propH ?? currentSize.height,
|
|
1128
|
+
top: currentSize.top,
|
|
1129
|
+
left: currentSize.left
|
|
1130
|
+
};
|
|
1131
|
+
set((s) => ({
|
|
1132
|
+
size: newSize,
|
|
1133
|
+
viewport: { ...s.viewport, ...getCurrentViewport(state2.camera, defaultTarget, newSize) }
|
|
1134
|
+
}));
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
const w = width;
|
|
1140
|
+
const h = height ?? width;
|
|
1141
|
+
const t = top ?? state2.size.top;
|
|
1142
|
+
const l = left ?? state2.size.left;
|
|
1143
|
+
const size = { width: w, height: h, top: t, left: l };
|
|
1144
|
+
set((s) => ({
|
|
1145
|
+
size,
|
|
1146
|
+
viewport: { ...s.viewport, ...getCurrentViewport(state2.camera, defaultTarget, size) },
|
|
1147
|
+
_sizeImperative: true
|
|
1148
|
+
}));
|
|
1120
1149
|
},
|
|
1121
1150
|
setDpr: (dpr) => set((state2) => {
|
|
1122
1151
|
const resolved = calculateDpr(dpr);
|
|
@@ -1133,6 +1162,9 @@ const createStore = (invalidate, advance) => {
|
|
|
1133
1162
|
textures: /* @__PURE__ */ new Map(),
|
|
1134
1163
|
postProcessing: null,
|
|
1135
1164
|
passes: {},
|
|
1165
|
+
_hmrVersion: 0,
|
|
1166
|
+
_sizeImperative: false,
|
|
1167
|
+
_sizeProps: null,
|
|
1136
1168
|
previousRoot: void 0,
|
|
1137
1169
|
internal: {
|
|
1138
1170
|
// Events
|
|
@@ -1340,8 +1372,9 @@ class PhaseGraph {
|
|
|
1340
1372
|
const node = { name, isAutoGenerated: false };
|
|
1341
1373
|
let insertIndex = this.phases.length;
|
|
1342
1374
|
const targetIndex = this.getPhaseIndex(before ?? after);
|
|
1343
|
-
if (targetIndex !== -1)
|
|
1344
|
-
|
|
1375
|
+
if (targetIndex !== -1) {
|
|
1376
|
+
insertIndex = before ? targetIndex : targetIndex + 1;
|
|
1377
|
+
} else {
|
|
1345
1378
|
const constraintType = before ? "before" : "after";
|
|
1346
1379
|
console.warn(`[useFrame] Phase "${before ?? after}" not found for '${constraintType}' constraint`);
|
|
1347
1380
|
}
|
|
@@ -2752,24 +2785,14 @@ function advance(timestamp, runGlobalEffects = true, state, frame) {
|
|
|
2752
2785
|
getScheduler().step(timestamp);
|
|
2753
2786
|
}
|
|
2754
2787
|
|
|
2755
|
-
const version = "10.0.0-alpha.
|
|
2788
|
+
const version = "10.0.0-alpha.2";
|
|
2756
2789
|
const packageData = {
|
|
2757
2790
|
version: version};
|
|
2758
2791
|
|
|
2759
2792
|
function Xb(Tt) {
|
|
2760
2793
|
return Tt && Tt.__esModule && Object.prototype.hasOwnProperty.call(Tt, "default") ? Tt.default : Tt;
|
|
2761
2794
|
}
|
|
2762
|
-
var Rm = { exports: {} }, Og = { exports: {} };
|
|
2763
|
-
/**
|
|
2764
|
-
* @license React
|
|
2765
|
-
* react-reconciler.production.js
|
|
2766
|
-
*
|
|
2767
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2768
|
-
*
|
|
2769
|
-
* This source code is licensed under the MIT license found in the
|
|
2770
|
-
* LICENSE file in the root directory of this source tree.
|
|
2771
|
-
*/
|
|
2772
|
-
var _b;
|
|
2795
|
+
var Rm = { exports: {} }, Og = { exports: {} }, _b;
|
|
2773
2796
|
function Kb() {
|
|
2774
2797
|
return _b || (_b = 1, (function(Tt) {
|
|
2775
2798
|
Tt.exports = function(m) {
|
|
@@ -3841,7 +3864,6 @@ Error generating stack: ` + l.message + `
|
|
|
3841
3864
|
if (J === cl || J === jc) throw J;
|
|
3842
3865
|
var Ge = Yn(29, J, null, P.mode);
|
|
3843
3866
|
return Ge.lanes = H, Ge.return = P, Ge;
|
|
3844
|
-
} finally {
|
|
3845
3867
|
}
|
|
3846
3868
|
};
|
|
3847
3869
|
}
|
|
@@ -4495,7 +4517,6 @@ Error generating stack: ` + l.message + `
|
|
|
4495
4517
|
var h = r.lastRenderedState, y = d(h, a);
|
|
4496
4518
|
if (c.hasEagerState = true, c.eagerState = y, jn(y, h)) return go(t, r, c, 0), Ne === null && Bn(), false;
|
|
4497
4519
|
} catch {
|
|
4498
|
-
} finally {
|
|
4499
4520
|
}
|
|
4500
4521
|
if (a = yo(t, r, c, l), a !== null) return nt(a, t, l), ns(a, r, l), true;
|
|
4501
4522
|
}
|
|
@@ -6916,10 +6937,7 @@ Error generating stack: ` + l.message + `
|
|
|
6916
6937
|
function vr(t, r) {
|
|
6917
6938
|
Sf(t, r), (t = t.alternate) && Sf(t, r);
|
|
6918
6939
|
}
|
|
6919
|
-
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");
|
|
6920
|
-
var gc = Symbol.for("react.activity");
|
|
6921
|
-
var $r = Symbol.for("react.memo_cache_sentinel");
|
|
6922
|
-
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;
|
|
6940
|
+
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;
|
|
6923
6941
|
m.cloneMutableInstance;
|
|
6924
6942
|
var yc = m.appendInitialChild, Kp = m.finalizeInitialChildren, Rs = m.shouldSetTextContent, bc = m.createTextInstance;
|
|
6925
6943
|
m.cloneMutableTextInstance;
|
|
@@ -7288,17 +7306,7 @@ No matching component was found for:
|
|
|
7288
7306
|
}, Tt.exports.default = Tt.exports, Object.defineProperty(Tt.exports, "__esModule", { value: true });
|
|
7289
7307
|
})(Og)), Og.exports;
|
|
7290
7308
|
}
|
|
7291
|
-
var Mg = { exports: {} };
|
|
7292
|
-
/**
|
|
7293
|
-
* @license React
|
|
7294
|
-
* react-reconciler.development.js
|
|
7295
|
-
*
|
|
7296
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7297
|
-
*
|
|
7298
|
-
* This source code is licensed under the MIT license found in the
|
|
7299
|
-
* LICENSE file in the root directory of this source tree.
|
|
7300
|
-
*/
|
|
7301
|
-
var Rb;
|
|
7309
|
+
var Mg = { exports: {} }, Rb;
|
|
7302
7310
|
function e0() {
|
|
7303
7311
|
return Rb || (Rb = 1, (function(Tt) {
|
|
7304
7312
|
process.env.NODE_ENV !== "production" && (Tt.exports = function(m) {
|
|
@@ -13065,10 +13073,7 @@ Check the render method of %s.`, G(di) || "Unknown")), i = zo(n), i.payload = {
|
|
|
13065
13073
|
function Ic() {
|
|
13066
13074
|
return di;
|
|
13067
13075
|
}
|
|
13068
|
-
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");
|
|
13069
|
-
var Ds = Symbol.for("react.activity");
|
|
13070
|
-
var Bh = Symbol.for("react.memo_cache_sentinel");
|
|
13071
|
-
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;
|
|
13076
|
+
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;
|
|
13072
13077
|
m.cloneMutableInstance;
|
|
13073
13078
|
var bn = m.appendInitialChild, Ue = m.finalizeInitialChildren, ue = m.shouldSetTextContent, Do = m.createTextInstance;
|
|
13074
13079
|
m.cloneMutableTextInstance;
|
|
@@ -14036,15 +14041,6 @@ function n0() {
|
|
|
14036
14041
|
var t0 = n0();
|
|
14037
14042
|
const r0 = Xb(t0);
|
|
14038
14043
|
|
|
14039
|
-
/**
|
|
14040
|
-
* @license React
|
|
14041
|
-
* react-reconciler-constants.production.js
|
|
14042
|
-
*
|
|
14043
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14044
|
-
*
|
|
14045
|
-
* This source code is licensed under the MIT license found in the
|
|
14046
|
-
* LICENSE file in the root directory of this source tree.
|
|
14047
|
-
*/
|
|
14048
14044
|
const t = 1, o = 8, r = 32, e = 2;
|
|
14049
14045
|
|
|
14050
14046
|
function createReconciler(config) {
|
|
@@ -14071,10 +14067,11 @@ function extend(objects) {
|
|
|
14071
14067
|
function validateInstance(type, props) {
|
|
14072
14068
|
const name = toPascalCase(type);
|
|
14073
14069
|
const target = catalogue[name];
|
|
14074
|
-
if (type !== "primitive" && !target)
|
|
14070
|
+
if (type !== "primitive" && !target) {
|
|
14075
14071
|
throw new Error(
|
|
14076
14072
|
`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`
|
|
14077
14073
|
);
|
|
14074
|
+
}
|
|
14078
14075
|
if (type === "primitive" && !props.object) throw new Error(`R3F: Primitives without 'object' are invalid!`);
|
|
14079
14076
|
if (props.args !== void 0 && !Array.isArray(props.args)) throw new Error("R3F: The args prop must be an array!");
|
|
14080
14077
|
}
|
|
@@ -14525,14 +14522,14 @@ function createRoot(canvas) {
|
|
|
14525
14522
|
if (!prevRoot) _roots.set(canvas, { fiber, store });
|
|
14526
14523
|
let onCreated;
|
|
14527
14524
|
let lastCamera;
|
|
14528
|
-
|
|
14525
|
+
const lastConfiguredProps = {};
|
|
14529
14526
|
let configured = false;
|
|
14530
14527
|
let pending = null;
|
|
14531
14528
|
return {
|
|
14532
14529
|
async configure(props = {}) {
|
|
14533
14530
|
let resolve;
|
|
14534
14531
|
pending = new Promise((_resolve) => resolve = _resolve);
|
|
14535
|
-
|
|
14532
|
+
const {
|
|
14536
14533
|
gl: glConfig,
|
|
14537
14534
|
renderer: rendererConfig,
|
|
14538
14535
|
size: propsSize,
|
|
@@ -14554,9 +14551,10 @@ function createRoot(canvas) {
|
|
|
14554
14551
|
onDragOverMissed,
|
|
14555
14552
|
onDropMissed,
|
|
14556
14553
|
autoUpdateFrustum = true,
|
|
14557
|
-
occlusion = false
|
|
14554
|
+
occlusion = false,
|
|
14555
|
+
_sizeProps
|
|
14558
14556
|
} = props;
|
|
14559
|
-
|
|
14557
|
+
const state = store.getState();
|
|
14560
14558
|
const defaultGLProps = {
|
|
14561
14559
|
canvas,
|
|
14562
14560
|
powerPreference: "high-performance",
|
|
@@ -14582,8 +14580,9 @@ function createRoot(canvas) {
|
|
|
14582
14580
|
if (!raycaster) state.set({ raycaster: raycaster = new Raycaster() });
|
|
14583
14581
|
const { params, ...options } = raycastOptions || {};
|
|
14584
14582
|
if (!is.equ(options, raycaster, shallowLoose)) applyProps(raycaster, { ...options });
|
|
14585
|
-
if (!is.equ(params, raycaster.params, shallowLoose))
|
|
14583
|
+
if (!is.equ(params, raycaster.params, shallowLoose)) {
|
|
14586
14584
|
applyProps(raycaster, { params: { ...raycaster.params, ...params } });
|
|
14585
|
+
}
|
|
14587
14586
|
if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {
|
|
14588
14587
|
lastCamera = cameraOptions;
|
|
14589
14588
|
const isCamera = cameraOptions?.isCamera;
|
|
@@ -14634,9 +14633,14 @@ function createRoot(canvas) {
|
|
|
14634
14633
|
wasEnabled = enabled;
|
|
14635
14634
|
});
|
|
14636
14635
|
}
|
|
14636
|
+
if (_sizeProps !== void 0) {
|
|
14637
|
+
state.set({ _sizeProps });
|
|
14638
|
+
}
|
|
14637
14639
|
const size = computeInitialSize(canvas, propsSize);
|
|
14638
|
-
if (!is.equ(size, state.size, shallowLoose)) {
|
|
14640
|
+
if (!state._sizeImperative && !is.equ(size, state.size, shallowLoose)) {
|
|
14641
|
+
const wasImperative = state._sizeImperative;
|
|
14639
14642
|
state.setSize(size.width, size.height, size.top, size.left);
|
|
14643
|
+
if (!wasImperative) state.set({ _sizeImperative: false });
|
|
14640
14644
|
}
|
|
14641
14645
|
if (dpr !== void 0 && !is.equ(dpr, lastConfiguredProps.dpr, shallowLoose)) {
|
|
14642
14646
|
state.setDpr(dpr);
|
|
@@ -14706,8 +14710,9 @@ function createRoot(canvas) {
|
|
|
14706
14710
|
} else if (is.obj(shadows)) {
|
|
14707
14711
|
Object.assign(renderer.shadowMap, shadows);
|
|
14708
14712
|
}
|
|
14709
|
-
if (oldEnabled !== renderer.shadowMap.enabled || oldType !== renderer.shadowMap.type)
|
|
14713
|
+
if (oldEnabled !== renderer.shadowMap.enabled || oldType !== renderer.shadowMap.type) {
|
|
14710
14714
|
renderer.shadowMap.needsUpdate = true;
|
|
14715
|
+
}
|
|
14711
14716
|
}
|
|
14712
14717
|
{
|
|
14713
14718
|
const legacyChanged = legacy !== lastConfiguredProps.legacy;
|
|
@@ -14733,8 +14738,9 @@ function createRoot(canvas) {
|
|
|
14733
14738
|
if (state.textureColorSpace !== textureColorSpace) state.set(() => ({ textureColorSpace }));
|
|
14734
14739
|
lastConfiguredProps.textureColorSpace = textureColorSpace;
|
|
14735
14740
|
}
|
|
14736
|
-
if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, renderer, shallowLoose))
|
|
14741
|
+
if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, renderer, shallowLoose)) {
|
|
14737
14742
|
applyProps(renderer, glConfig);
|
|
14743
|
+
}
|
|
14738
14744
|
if (rendererConfig && !is.fun(rendererConfig) && !isRenderer(rendererConfig) && state.renderer) {
|
|
14739
14745
|
const currentRenderer = state.renderer;
|
|
14740
14746
|
if (!is.equ(rendererConfig, currentRenderer, shallowLoose)) {
|
|
@@ -15002,6 +15008,9 @@ function CanvasImpl({
|
|
|
15002
15008
|
onDragOverMissed,
|
|
15003
15009
|
onDropMissed,
|
|
15004
15010
|
onCreated,
|
|
15011
|
+
hmr,
|
|
15012
|
+
width,
|
|
15013
|
+
height,
|
|
15005
15014
|
...props
|
|
15006
15015
|
}) {
|
|
15007
15016
|
React.useMemo(() => extend(THREE), []);
|
|
@@ -15022,7 +15031,16 @@ function CanvasImpl({
|
|
|
15022
15031
|
};
|
|
15023
15032
|
}, [resize, hasInitialSizeRef.current]);
|
|
15024
15033
|
const [containerRef, containerRect] = useMeasure(measureConfig);
|
|
15025
|
-
|
|
15034
|
+
const effectiveSize = React.useMemo(
|
|
15035
|
+
() => ({
|
|
15036
|
+
width: width ?? containerRect.width,
|
|
15037
|
+
height: height ?? containerRect.height,
|
|
15038
|
+
top: containerRect.top,
|
|
15039
|
+
left: containerRect.left
|
|
15040
|
+
}),
|
|
15041
|
+
[width, height, containerRect]
|
|
15042
|
+
);
|
|
15043
|
+
if (!hasInitialSizeRef.current && effectiveSize.width > 0 && effectiveSize.height > 0) {
|
|
15026
15044
|
hasInitialSizeRef.current = true;
|
|
15027
15045
|
}
|
|
15028
15046
|
const canvasRef = React.useRef(null);
|
|
@@ -15041,7 +15059,7 @@ function CanvasImpl({
|
|
|
15041
15059
|
useIsomorphicLayoutEffect(() => {
|
|
15042
15060
|
effectActiveRef.current = true;
|
|
15043
15061
|
const canvas = canvasRef.current;
|
|
15044
|
-
if (
|
|
15062
|
+
if (effectiveSize.width > 0 && effectiveSize.height > 0 && canvas) {
|
|
15045
15063
|
if (!root.current) {
|
|
15046
15064
|
root.current = createRoot(canvas);
|
|
15047
15065
|
notifyAlpha({
|
|
@@ -15075,7 +15093,9 @@ function CanvasImpl({
|
|
|
15075
15093
|
performance,
|
|
15076
15094
|
raycaster,
|
|
15077
15095
|
camera,
|
|
15078
|
-
size:
|
|
15096
|
+
size: effectiveSize,
|
|
15097
|
+
// Store size props for reset functionality
|
|
15098
|
+
_sizeProps: width !== void 0 || height !== void 0 ? { width, height } : null,
|
|
15079
15099
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
15080
15100
|
onPointerMissed: (...args) => handlePointerMissed.current?.(...args),
|
|
15081
15101
|
onDragOverMissed: (...args) => handleDragOverMissed.current?.(...args),
|
|
@@ -15121,6 +15141,33 @@ function CanvasImpl({
|
|
|
15121
15141
|
};
|
|
15122
15142
|
}
|
|
15123
15143
|
}, []);
|
|
15144
|
+
React.useEffect(() => {
|
|
15145
|
+
if (hmr === false) return;
|
|
15146
|
+
const canvas = canvasRef.current;
|
|
15147
|
+
if (!canvas) return;
|
|
15148
|
+
const handleHMR = () => {
|
|
15149
|
+
const rootEntry = _roots.get(canvas);
|
|
15150
|
+
if (rootEntry?.store) {
|
|
15151
|
+
rootEntry.store.setState((state) => ({
|
|
15152
|
+
nodes: {},
|
|
15153
|
+
uniforms: {},
|
|
15154
|
+
_hmrVersion: state._hmrVersion + 1
|
|
15155
|
+
}));
|
|
15156
|
+
}
|
|
15157
|
+
};
|
|
15158
|
+
if (typeof import.meta !== "undefined" && import.meta.hot) {
|
|
15159
|
+
const hot = import.meta.hot;
|
|
15160
|
+
hot.on("vite:afterUpdate", handleHMR);
|
|
15161
|
+
return () => hot.dispose?.(() => {
|
|
15162
|
+
});
|
|
15163
|
+
}
|
|
15164
|
+
if (typeof module !== "undefined" && module.hot) {
|
|
15165
|
+
const hot = module.hot;
|
|
15166
|
+
hot.addStatusHandler((status) => {
|
|
15167
|
+
if (status === "idle") handleHMR();
|
|
15168
|
+
});
|
|
15169
|
+
}
|
|
15170
|
+
}, [hmr]);
|
|
15124
15171
|
const pointerEvents = eventSource ? "none" : "auto";
|
|
15125
15172
|
return /* @__PURE__ */ jsx(
|
|
15126
15173
|
"div",
|