@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/webgpu/index.cjs
CHANGED
|
@@ -13,6 +13,7 @@ const lite = require('dequal/lite');
|
|
|
13
13
|
require('zustand/shallow');
|
|
14
14
|
const tsl = require('three/tsl');
|
|
15
15
|
|
|
16
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
16
17
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
17
18
|
|
|
18
19
|
function _interopNamespaceCompat(e) {
|
|
@@ -66,9 +67,9 @@ const THREE = /*#__PURE__*/_mergeNamespaces({
|
|
|
66
67
|
WebGLRenderer: WebGLRenderer
|
|
67
68
|
}, [webgpu__namespace]);
|
|
68
69
|
|
|
69
|
-
var __defProp$
|
|
70
|
-
var __defNormalProp$
|
|
71
|
-
var __publicField$
|
|
70
|
+
var __defProp$3 = Object.defineProperty;
|
|
71
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
72
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
72
73
|
const act = React__namespace["act"];
|
|
73
74
|
const useIsomorphicLayoutEffect = /* @__PURE__ */ (() => typeof window !== "undefined" && (window.document?.createElement || window.navigator?.product === "ReactNative"))() ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
74
75
|
function useMutableCallback(fn) {
|
|
@@ -100,7 +101,7 @@ const ErrorBoundary = /* @__PURE__ */ (() => {
|
|
|
100
101
|
return _a = class extends React__namespace.Component {
|
|
101
102
|
constructor() {
|
|
102
103
|
super(...arguments);
|
|
103
|
-
__publicField$
|
|
104
|
+
__publicField$3(this, "state", { error: false });
|
|
104
105
|
}
|
|
105
106
|
componentDidCatch(err) {
|
|
106
107
|
this.props.set(err);
|
|
@@ -108,7 +109,7 @@ const ErrorBoundary = /* @__PURE__ */ (() => {
|
|
|
108
109
|
render() {
|
|
109
110
|
return this.state.error ? null : this.props.children;
|
|
110
111
|
}
|
|
111
|
-
}, __publicField$
|
|
112
|
+
}, __publicField$3(_a, "getDerivedStateFromError", () => ({ error: true })), _a;
|
|
112
113
|
})();
|
|
113
114
|
|
|
114
115
|
const is = {
|
|
@@ -558,7 +559,7 @@ function applyProps(object, props) {
|
|
|
558
559
|
const rootState = instance && findInitialRoot(instance).getState();
|
|
559
560
|
const prevHandlers = instance?.eventCount;
|
|
560
561
|
for (const prop in props) {
|
|
561
|
-
|
|
562
|
+
const value = props[prop];
|
|
562
563
|
if (RESERVED_PROPS.includes(prop)) continue;
|
|
563
564
|
if (instance && EVENT_REGEX.test(prop)) {
|
|
564
565
|
if (typeof value === "function") instance.handlers[prop] = value;
|
|
@@ -710,13 +711,14 @@ function createEvents(store) {
|
|
|
710
711
|
for (const hit of hits) {
|
|
711
712
|
let eventObject = hit.object;
|
|
712
713
|
while (eventObject) {
|
|
713
|
-
if (eventObject.__r3f?.eventCount)
|
|
714
|
+
if (eventObject.__r3f?.eventCount) {
|
|
714
715
|
intersections.push({ ...hit, eventObject });
|
|
716
|
+
}
|
|
715
717
|
eventObject = eventObject.parent;
|
|
716
718
|
}
|
|
717
719
|
}
|
|
718
720
|
if ("pointerId" in event && state.internal.capturedMap.has(event.pointerId)) {
|
|
719
|
-
for (
|
|
721
|
+
for (const captureData of state.internal.capturedMap.get(event.pointerId).values()) {
|
|
720
722
|
if (!duplicates.has(makeId(captureData.intersection))) intersections.push(captureData.intersection);
|
|
721
723
|
}
|
|
722
724
|
}
|
|
@@ -746,12 +748,12 @@ function createEvents(store) {
|
|
|
746
748
|
releaseInternalPointerCapture(internal.capturedMap, hit.eventObject, captures, id);
|
|
747
749
|
}
|
|
748
750
|
};
|
|
749
|
-
|
|
750
|
-
for (
|
|
751
|
-
|
|
751
|
+
const extractEventProps = {};
|
|
752
|
+
for (const prop in event) {
|
|
753
|
+
const property = event[prop];
|
|
752
754
|
if (typeof property !== "function") extractEventProps[prop] = property;
|
|
753
755
|
}
|
|
754
|
-
|
|
756
|
+
const raycastEvent = {
|
|
755
757
|
...hit,
|
|
756
758
|
...extractEventProps,
|
|
757
759
|
pointer,
|
|
@@ -1134,10 +1136,38 @@ const createStore = (invalidate, advance) => {
|
|
|
1134
1136
|
getCurrentViewport
|
|
1135
1137
|
},
|
|
1136
1138
|
setEvents: (events) => set((state2) => ({ ...state2, events: { ...state2.events, ...events } })),
|
|
1137
|
-
setSize: (width, height, top
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1140
|
-
|
|
1139
|
+
setSize: (width, height, top, left) => {
|
|
1140
|
+
const state2 = get();
|
|
1141
|
+
if (width === void 0) {
|
|
1142
|
+
set({ _sizeImperative: false });
|
|
1143
|
+
if (state2._sizeProps) {
|
|
1144
|
+
const { width: propW, height: propH } = state2._sizeProps;
|
|
1145
|
+
if (propW !== void 0 || propH !== void 0) {
|
|
1146
|
+
const currentSize = state2.size;
|
|
1147
|
+
const newSize = {
|
|
1148
|
+
width: propW ?? currentSize.width,
|
|
1149
|
+
height: propH ?? currentSize.height,
|
|
1150
|
+
top: currentSize.top,
|
|
1151
|
+
left: currentSize.left
|
|
1152
|
+
};
|
|
1153
|
+
set((s) => ({
|
|
1154
|
+
size: newSize,
|
|
1155
|
+
viewport: { ...s.viewport, ...getCurrentViewport(state2.camera, defaultTarget, newSize) }
|
|
1156
|
+
}));
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
const w = width;
|
|
1162
|
+
const h = height ?? width;
|
|
1163
|
+
const t = top ?? state2.size.top;
|
|
1164
|
+
const l = left ?? state2.size.left;
|
|
1165
|
+
const size = { width: w, height: h, top: t, left: l };
|
|
1166
|
+
set((s) => ({
|
|
1167
|
+
size,
|
|
1168
|
+
viewport: { ...s.viewport, ...getCurrentViewport(state2.camera, defaultTarget, size) },
|
|
1169
|
+
_sizeImperative: true
|
|
1170
|
+
}));
|
|
1141
1171
|
},
|
|
1142
1172
|
setDpr: (dpr) => set((state2) => {
|
|
1143
1173
|
const resolved = calculateDpr(dpr);
|
|
@@ -1154,6 +1184,9 @@ const createStore = (invalidate, advance) => {
|
|
|
1154
1184
|
textures: /* @__PURE__ */ new Map(),
|
|
1155
1185
|
postProcessing: null,
|
|
1156
1186
|
passes: {},
|
|
1187
|
+
_hmrVersion: 0,
|
|
1188
|
+
_sizeImperative: false,
|
|
1189
|
+
_sizeProps: null,
|
|
1157
1190
|
previousRoot: void 0,
|
|
1158
1191
|
internal: {
|
|
1159
1192
|
// Events
|
|
@@ -1323,18 +1356,18 @@ useLoader.clear = function(loader, input) {
|
|
|
1323
1356
|
};
|
|
1324
1357
|
useLoader.loader = getLoader;
|
|
1325
1358
|
|
|
1326
|
-
var __defProp$
|
|
1327
|
-
var __defNormalProp$
|
|
1328
|
-
var __publicField$
|
|
1359
|
+
var __defProp$2 = Object.defineProperty;
|
|
1360
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1361
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1329
1362
|
const DEFAULT_PHASES = ["start", "input", "physics", "update", "render", "finish"];
|
|
1330
1363
|
class PhaseGraph {
|
|
1331
1364
|
constructor() {
|
|
1332
1365
|
/** Ordered list of phase nodes */
|
|
1333
|
-
__publicField$
|
|
1366
|
+
__publicField$2(this, "phases", []);
|
|
1334
1367
|
/** Quick lookup by name */
|
|
1335
|
-
__publicField$
|
|
1368
|
+
__publicField$2(this, "phaseMap", /* @__PURE__ */ new Map());
|
|
1336
1369
|
/** Cached ordered names (invalidated on changes) */
|
|
1337
|
-
__publicField$
|
|
1370
|
+
__publicField$2(this, "orderedNamesCache", null);
|
|
1338
1371
|
this.initializeDefaultPhases();
|
|
1339
1372
|
}
|
|
1340
1373
|
//* Initialization --------------------------------
|
|
@@ -1361,8 +1394,9 @@ class PhaseGraph {
|
|
|
1361
1394
|
const node = { name, isAutoGenerated: false };
|
|
1362
1395
|
let insertIndex = this.phases.length;
|
|
1363
1396
|
const targetIndex = this.getPhaseIndex(before ?? after);
|
|
1364
|
-
if (targetIndex !== -1)
|
|
1365
|
-
|
|
1397
|
+
if (targetIndex !== -1) {
|
|
1398
|
+
insertIndex = before ? targetIndex : targetIndex + 1;
|
|
1399
|
+
} else {
|
|
1366
1400
|
const constraintType = before ? "before" : "after";
|
|
1367
1401
|
console.warn(`[useFrame] Phase "${before ?? after}" not found for '${constraintType}' constraint`);
|
|
1368
1402
|
}
|
|
@@ -1590,9 +1624,9 @@ function resetJobTiming(job) {
|
|
|
1590
1624
|
job.lastRun = void 0;
|
|
1591
1625
|
}
|
|
1592
1626
|
|
|
1593
|
-
var __defProp = Object.defineProperty;
|
|
1594
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1595
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1627
|
+
var __defProp$1 = Object.defineProperty;
|
|
1628
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1629
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1596
1630
|
const hmrData = (() => {
|
|
1597
1631
|
if (typeof process !== "undefined" && process.env.NODE_ENV === "test") return void 0;
|
|
1598
1632
|
if (typeof import_meta_hot !== "undefined") return import_meta_hot;
|
|
@@ -1606,9 +1640,9 @@ const _Scheduler = class _Scheduler {
|
|
|
1606
1640
|
//* Constructor ================================
|
|
1607
1641
|
constructor() {
|
|
1608
1642
|
//* Critical State ================================
|
|
1609
|
-
__publicField(this, "roots", /* @__PURE__ */ new Map());
|
|
1610
|
-
__publicField(this, "phaseGraph");
|
|
1611
|
-
__publicField(this, "loopState", {
|
|
1643
|
+
__publicField$1(this, "roots", /* @__PURE__ */ new Map());
|
|
1644
|
+
__publicField$1(this, "phaseGraph");
|
|
1645
|
+
__publicField$1(this, "loopState", {
|
|
1612
1646
|
running: false,
|
|
1613
1647
|
rafHandle: null,
|
|
1614
1648
|
lastTime: null,
|
|
@@ -1617,21 +1651,21 @@ const _Scheduler = class _Scheduler {
|
|
|
1617
1651
|
elapsedTime: 0,
|
|
1618
1652
|
createdAt: performance.now()
|
|
1619
1653
|
});
|
|
1620
|
-
__publicField(this, "stoppedTime", 0);
|
|
1654
|
+
__publicField$1(this, "stoppedTime", 0);
|
|
1621
1655
|
//* Private State ================================
|
|
1622
|
-
__publicField(this, "nextRootIndex", 0);
|
|
1623
|
-
__publicField(this, "globalBeforeJobs", /* @__PURE__ */ new Map());
|
|
1624
|
-
__publicField(this, "globalAfterJobs", /* @__PURE__ */ new Map());
|
|
1625
|
-
__publicField(this, "nextGlobalIndex", 0);
|
|
1626
|
-
__publicField(this, "idleCallbacks", /* @__PURE__ */ new Set());
|
|
1627
|
-
__publicField(this, "nextJobIndex", 0);
|
|
1628
|
-
__publicField(this, "jobStateListeners", /* @__PURE__ */ new Map());
|
|
1629
|
-
__publicField(this, "pendingFrames", 0);
|
|
1630
|
-
__publicField(this, "_frameloop", "always");
|
|
1656
|
+
__publicField$1(this, "nextRootIndex", 0);
|
|
1657
|
+
__publicField$1(this, "globalBeforeJobs", /* @__PURE__ */ new Map());
|
|
1658
|
+
__publicField$1(this, "globalAfterJobs", /* @__PURE__ */ new Map());
|
|
1659
|
+
__publicField$1(this, "nextGlobalIndex", 0);
|
|
1660
|
+
__publicField$1(this, "idleCallbacks", /* @__PURE__ */ new Set());
|
|
1661
|
+
__publicField$1(this, "nextJobIndex", 0);
|
|
1662
|
+
__publicField$1(this, "jobStateListeners", /* @__PURE__ */ new Map());
|
|
1663
|
+
__publicField$1(this, "pendingFrames", 0);
|
|
1664
|
+
__publicField$1(this, "_frameloop", "always");
|
|
1631
1665
|
//* Independent Mode & Error Handling State ================================
|
|
1632
|
-
__publicField(this, "_independent", false);
|
|
1633
|
-
__publicField(this, "errorHandler", null);
|
|
1634
|
-
__publicField(this, "rootReadyCallbacks", /* @__PURE__ */ new Set());
|
|
1666
|
+
__publicField$1(this, "_independent", false);
|
|
1667
|
+
__publicField$1(this, "errorHandler", null);
|
|
1668
|
+
__publicField$1(this, "rootReadyCallbacks", /* @__PURE__ */ new Set());
|
|
1635
1669
|
//* Core Loop Execution Methods ================================
|
|
1636
1670
|
/**
|
|
1637
1671
|
* Main RAF loop callback.
|
|
@@ -1640,7 +1674,7 @@ const _Scheduler = class _Scheduler {
|
|
|
1640
1674
|
* @returns {void}
|
|
1641
1675
|
* @private
|
|
1642
1676
|
*/
|
|
1643
|
-
__publicField(this, "loop", (timestamp) => {
|
|
1677
|
+
__publicField$1(this, "loop", (timestamp) => {
|
|
1644
1678
|
if (!this.loopState.running) return;
|
|
1645
1679
|
this.executeFrame(timestamp);
|
|
1646
1680
|
if (this._frameloop === "demand") {
|
|
@@ -2347,7 +2381,7 @@ const _Scheduler = class _Scheduler {
|
|
|
2347
2381
|
//* Cross-Bundle Singleton Key ==============================
|
|
2348
2382
|
// Use Symbol.for() to ensure scheduler is shared across bundle boundaries
|
|
2349
2383
|
// This prevents issues when mixing imports from @react-three/fiber and @react-three/fiber/webgpu
|
|
2350
|
-
__publicField(_Scheduler, "INSTANCE_KEY", Symbol.for("@react-three/fiber.scheduler"));
|
|
2384
|
+
__publicField$1(_Scheduler, "INSTANCE_KEY", Symbol.for("@react-three/fiber.scheduler"));
|
|
2351
2385
|
let Scheduler = _Scheduler;
|
|
2352
2386
|
const getScheduler = () => Scheduler.get();
|
|
2353
2387
|
if (hmrData) {
|
|
@@ -2773,24 +2807,14 @@ function advance(timestamp, runGlobalEffects = true, state, frame) {
|
|
|
2773
2807
|
getScheduler().step(timestamp);
|
|
2774
2808
|
}
|
|
2775
2809
|
|
|
2776
|
-
const version = "10.0.0-alpha.
|
|
2810
|
+
const version = "10.0.0-alpha.2";
|
|
2777
2811
|
const packageData = {
|
|
2778
2812
|
version: version};
|
|
2779
2813
|
|
|
2780
2814
|
function Xb(Tt) {
|
|
2781
2815
|
return Tt && Tt.__esModule && Object.prototype.hasOwnProperty.call(Tt, "default") ? Tt.default : Tt;
|
|
2782
2816
|
}
|
|
2783
|
-
var Rm = { exports: {} }, Og = { exports: {} };
|
|
2784
|
-
/**
|
|
2785
|
-
* @license React
|
|
2786
|
-
* react-reconciler.production.js
|
|
2787
|
-
*
|
|
2788
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2789
|
-
*
|
|
2790
|
-
* This source code is licensed under the MIT license found in the
|
|
2791
|
-
* LICENSE file in the root directory of this source tree.
|
|
2792
|
-
*/
|
|
2793
|
-
var _b;
|
|
2817
|
+
var Rm = { exports: {} }, Og = { exports: {} }, _b;
|
|
2794
2818
|
function Kb() {
|
|
2795
2819
|
return _b || (_b = 1, (function(Tt) {
|
|
2796
2820
|
Tt.exports = function(m) {
|
|
@@ -3862,7 +3886,6 @@ Error generating stack: ` + l.message + `
|
|
|
3862
3886
|
if (J === cl || J === jc) throw J;
|
|
3863
3887
|
var Ge = Yn(29, J, null, P.mode);
|
|
3864
3888
|
return Ge.lanes = H, Ge.return = P, Ge;
|
|
3865
|
-
} finally {
|
|
3866
3889
|
}
|
|
3867
3890
|
};
|
|
3868
3891
|
}
|
|
@@ -4516,7 +4539,6 @@ Error generating stack: ` + l.message + `
|
|
|
4516
4539
|
var h = r.lastRenderedState, y = d(h, a);
|
|
4517
4540
|
if (c.hasEagerState = true, c.eagerState = y, jn(y, h)) return go(t, r, c, 0), Ne === null && Bn(), false;
|
|
4518
4541
|
} catch {
|
|
4519
|
-
} finally {
|
|
4520
4542
|
}
|
|
4521
4543
|
if (a = yo(t, r, c, l), a !== null) return nt(a, t, l), ns(a, r, l), true;
|
|
4522
4544
|
}
|
|
@@ -6937,10 +6959,7 @@ Error generating stack: ` + l.message + `
|
|
|
6937
6959
|
function vr(t, r) {
|
|
6938
6960
|
Sf(t, r), (t = t.alternate) && Sf(t, r);
|
|
6939
6961
|
}
|
|
6940
|
-
var ie = {}, Fm = React__default, tt = Tb__default, 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");
|
|
6941
|
-
var gc = Symbol.for("react.activity");
|
|
6942
|
-
var $r = Symbol.for("react.memo_cache_sentinel");
|
|
6943
|
-
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;
|
|
6962
|
+
var ie = {}, Fm = React__default, tt = Tb__default, 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;
|
|
6944
6963
|
m.cloneMutableInstance;
|
|
6945
6964
|
var yc = m.appendInitialChild, Kp = m.finalizeInitialChildren, Rs = m.shouldSetTextContent, bc = m.createTextInstance;
|
|
6946
6965
|
m.cloneMutableTextInstance;
|
|
@@ -7309,17 +7328,7 @@ No matching component was found for:
|
|
|
7309
7328
|
}, Tt.exports.default = Tt.exports, Object.defineProperty(Tt.exports, "__esModule", { value: true });
|
|
7310
7329
|
})(Og)), Og.exports;
|
|
7311
7330
|
}
|
|
7312
|
-
var Mg = { exports: {} };
|
|
7313
|
-
/**
|
|
7314
|
-
* @license React
|
|
7315
|
-
* react-reconciler.development.js
|
|
7316
|
-
*
|
|
7317
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7318
|
-
*
|
|
7319
|
-
* This source code is licensed under the MIT license found in the
|
|
7320
|
-
* LICENSE file in the root directory of this source tree.
|
|
7321
|
-
*/
|
|
7322
|
-
var Rb;
|
|
7331
|
+
var Mg = { exports: {} }, Rb;
|
|
7323
7332
|
function e0() {
|
|
7324
7333
|
return Rb || (Rb = 1, (function(Tt) {
|
|
7325
7334
|
process.env.NODE_ENV !== "production" && (Tt.exports = function(m) {
|
|
@@ -13086,10 +13095,7 @@ Check the render method of %s.`, G(di) || "Unknown")), i = zo(n), i.payload = {
|
|
|
13086
13095
|
function Ic() {
|
|
13087
13096
|
return di;
|
|
13088
13097
|
}
|
|
13089
|
-
var le = {}, qm = React__default, St = Tb__default, 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");
|
|
13090
|
-
var Ds = Symbol.for("react.activity");
|
|
13091
|
-
var Bh = Symbol.for("react.memo_cache_sentinel");
|
|
13092
|
-
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;
|
|
13098
|
+
var le = {}, qm = React__default, St = Tb__default, 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;
|
|
13093
13099
|
m.cloneMutableInstance;
|
|
13094
13100
|
var bn = m.appendInitialChild, Ue = m.finalizeInitialChildren, ue = m.shouldSetTextContent, Do = m.createTextInstance;
|
|
13095
13101
|
m.cloneMutableTextInstance;
|
|
@@ -14057,15 +14063,6 @@ function n0() {
|
|
|
14057
14063
|
var t0 = n0();
|
|
14058
14064
|
const r0 = Xb(t0);
|
|
14059
14065
|
|
|
14060
|
-
/**
|
|
14061
|
-
* @license React
|
|
14062
|
-
* react-reconciler-constants.production.js
|
|
14063
|
-
*
|
|
14064
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14065
|
-
*
|
|
14066
|
-
* This source code is licensed under the MIT license found in the
|
|
14067
|
-
* LICENSE file in the root directory of this source tree.
|
|
14068
|
-
*/
|
|
14069
14066
|
const t = 1, o = 8, r = 32, e = 2;
|
|
14070
14067
|
|
|
14071
14068
|
function createReconciler(config) {
|
|
@@ -14092,10 +14089,11 @@ function extend(objects) {
|
|
|
14092
14089
|
function validateInstance(type, props) {
|
|
14093
14090
|
const name = toPascalCase(type);
|
|
14094
14091
|
const target = catalogue[name];
|
|
14095
|
-
if (type !== "primitive" && !target)
|
|
14092
|
+
if (type !== "primitive" && !target) {
|
|
14096
14093
|
throw new Error(
|
|
14097
14094
|
`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`
|
|
14098
14095
|
);
|
|
14096
|
+
}
|
|
14099
14097
|
if (type === "primitive" && !props.object) throw new Error(`R3F: Primitives without 'object' are invalid!`);
|
|
14100
14098
|
if (props.args !== void 0 && !Array.isArray(props.args)) throw new Error("R3F: The args prop must be an array!");
|
|
14101
14099
|
}
|
|
@@ -14546,14 +14544,14 @@ function createRoot(canvas) {
|
|
|
14546
14544
|
if (!prevRoot) _roots.set(canvas, { fiber, store });
|
|
14547
14545
|
let onCreated;
|
|
14548
14546
|
let lastCamera;
|
|
14549
|
-
|
|
14547
|
+
const lastConfiguredProps = {};
|
|
14550
14548
|
let configured = false;
|
|
14551
14549
|
let pending = null;
|
|
14552
14550
|
return {
|
|
14553
14551
|
async configure(props = {}) {
|
|
14554
14552
|
let resolve;
|
|
14555
14553
|
pending = new Promise((_resolve) => resolve = _resolve);
|
|
14556
|
-
|
|
14554
|
+
const {
|
|
14557
14555
|
gl: glConfig,
|
|
14558
14556
|
renderer: rendererConfig,
|
|
14559
14557
|
size: propsSize,
|
|
@@ -14575,9 +14573,10 @@ function createRoot(canvas) {
|
|
|
14575
14573
|
onDragOverMissed,
|
|
14576
14574
|
onDropMissed,
|
|
14577
14575
|
autoUpdateFrustum = true,
|
|
14578
|
-
occlusion = false
|
|
14576
|
+
occlusion = false,
|
|
14577
|
+
_sizeProps
|
|
14579
14578
|
} = props;
|
|
14580
|
-
|
|
14579
|
+
const state = store.getState();
|
|
14581
14580
|
const defaultGPUProps = {
|
|
14582
14581
|
canvas
|
|
14583
14582
|
};
|
|
@@ -14604,8 +14603,9 @@ function createRoot(canvas) {
|
|
|
14604
14603
|
if (!raycaster) state.set({ raycaster: raycaster = new webgpu.Raycaster() });
|
|
14605
14604
|
const { params, ...options } = raycastOptions || {};
|
|
14606
14605
|
if (!is.equ(options, raycaster, shallowLoose)) applyProps(raycaster, { ...options });
|
|
14607
|
-
if (!is.equ(params, raycaster.params, shallowLoose))
|
|
14606
|
+
if (!is.equ(params, raycaster.params, shallowLoose)) {
|
|
14608
14607
|
applyProps(raycaster, { params: { ...raycaster.params, ...params } });
|
|
14608
|
+
}
|
|
14609
14609
|
if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {
|
|
14610
14610
|
lastCamera = cameraOptions;
|
|
14611
14611
|
const isCamera = cameraOptions?.isCamera;
|
|
@@ -14656,9 +14656,14 @@ function createRoot(canvas) {
|
|
|
14656
14656
|
wasEnabled = enabled;
|
|
14657
14657
|
});
|
|
14658
14658
|
}
|
|
14659
|
+
if (_sizeProps !== void 0) {
|
|
14660
|
+
state.set({ _sizeProps });
|
|
14661
|
+
}
|
|
14659
14662
|
const size = computeInitialSize(canvas, propsSize);
|
|
14660
|
-
if (!is.equ(size, state.size, shallowLoose)) {
|
|
14663
|
+
if (!state._sizeImperative && !is.equ(size, state.size, shallowLoose)) {
|
|
14664
|
+
const wasImperative = state._sizeImperative;
|
|
14661
14665
|
state.setSize(size.width, size.height, size.top, size.left);
|
|
14666
|
+
if (!wasImperative) state.set({ _sizeImperative: false });
|
|
14662
14667
|
}
|
|
14663
14668
|
if (dpr !== void 0 && !is.equ(dpr, lastConfiguredProps.dpr, shallowLoose)) {
|
|
14664
14669
|
state.setDpr(dpr);
|
|
@@ -14728,15 +14733,17 @@ function createRoot(canvas) {
|
|
|
14728
14733
|
} else if (is.obj(shadows)) {
|
|
14729
14734
|
Object.assign(renderer.shadowMap, shadows);
|
|
14730
14735
|
}
|
|
14731
|
-
if (oldEnabled !== renderer.shadowMap.enabled || oldType !== renderer.shadowMap.type)
|
|
14736
|
+
if (oldEnabled !== renderer.shadowMap.enabled || oldType !== renderer.shadowMap.type) {
|
|
14732
14737
|
renderer.shadowMap.needsUpdate = true;
|
|
14738
|
+
}
|
|
14733
14739
|
}
|
|
14734
14740
|
if (textureColorSpace !== lastConfiguredProps.textureColorSpace) {
|
|
14735
14741
|
if (state.textureColorSpace !== textureColorSpace) state.set(() => ({ textureColorSpace }));
|
|
14736
14742
|
lastConfiguredProps.textureColorSpace = textureColorSpace;
|
|
14737
14743
|
}
|
|
14738
|
-
if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, renderer, shallowLoose))
|
|
14744
|
+
if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, renderer, shallowLoose)) {
|
|
14739
14745
|
applyProps(renderer, glConfig);
|
|
14746
|
+
}
|
|
14740
14747
|
if (rendererConfig && !is.fun(rendererConfig) && !isRenderer(rendererConfig) && state.renderer) {
|
|
14741
14748
|
const currentRenderer = state.renderer;
|
|
14742
14749
|
if (!is.equ(rendererConfig, currentRenderer, shallowLoose)) {
|
|
@@ -15004,6 +15011,9 @@ function CanvasImpl({
|
|
|
15004
15011
|
onDragOverMissed,
|
|
15005
15012
|
onDropMissed,
|
|
15006
15013
|
onCreated,
|
|
15014
|
+
hmr,
|
|
15015
|
+
width,
|
|
15016
|
+
height,
|
|
15007
15017
|
...props
|
|
15008
15018
|
}) {
|
|
15009
15019
|
React__namespace.useMemo(() => extend(THREE), []);
|
|
@@ -15024,7 +15034,16 @@ function CanvasImpl({
|
|
|
15024
15034
|
};
|
|
15025
15035
|
}, [resize, hasInitialSizeRef.current]);
|
|
15026
15036
|
const [containerRef, containerRect] = useMeasure__default(measureConfig);
|
|
15027
|
-
|
|
15037
|
+
const effectiveSize = React__namespace.useMemo(
|
|
15038
|
+
() => ({
|
|
15039
|
+
width: width ?? containerRect.width,
|
|
15040
|
+
height: height ?? containerRect.height,
|
|
15041
|
+
top: containerRect.top,
|
|
15042
|
+
left: containerRect.left
|
|
15043
|
+
}),
|
|
15044
|
+
[width, height, containerRect]
|
|
15045
|
+
);
|
|
15046
|
+
if (!hasInitialSizeRef.current && effectiveSize.width > 0 && effectiveSize.height > 0) {
|
|
15028
15047
|
hasInitialSizeRef.current = true;
|
|
15029
15048
|
}
|
|
15030
15049
|
const canvasRef = React__namespace.useRef(null);
|
|
@@ -15043,7 +15062,7 @@ function CanvasImpl({
|
|
|
15043
15062
|
useIsomorphicLayoutEffect(() => {
|
|
15044
15063
|
effectActiveRef.current = true;
|
|
15045
15064
|
const canvas = canvasRef.current;
|
|
15046
|
-
if (
|
|
15065
|
+
if (effectiveSize.width > 0 && effectiveSize.height > 0 && canvas) {
|
|
15047
15066
|
if (!root.current) {
|
|
15048
15067
|
root.current = createRoot(canvas);
|
|
15049
15068
|
notifyAlpha({
|
|
@@ -15077,7 +15096,9 @@ function CanvasImpl({
|
|
|
15077
15096
|
performance,
|
|
15078
15097
|
raycaster,
|
|
15079
15098
|
camera,
|
|
15080
|
-
size:
|
|
15099
|
+
size: effectiveSize,
|
|
15100
|
+
// Store size props for reset functionality
|
|
15101
|
+
_sizeProps: width !== void 0 || height !== void 0 ? { width, height } : null,
|
|
15081
15102
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
15082
15103
|
onPointerMissed: (...args) => handlePointerMissed.current?.(...args),
|
|
15083
15104
|
onDragOverMissed: (...args) => handleDragOverMissed.current?.(...args),
|
|
@@ -15123,6 +15144,33 @@ function CanvasImpl({
|
|
|
15123
15144
|
};
|
|
15124
15145
|
}
|
|
15125
15146
|
}, []);
|
|
15147
|
+
React__namespace.useEffect(() => {
|
|
15148
|
+
if (hmr === false) return;
|
|
15149
|
+
const canvas = canvasRef.current;
|
|
15150
|
+
if (!canvas) return;
|
|
15151
|
+
const handleHMR = () => {
|
|
15152
|
+
const rootEntry = _roots.get(canvas);
|
|
15153
|
+
if (rootEntry?.store) {
|
|
15154
|
+
rootEntry.store.setState((state) => ({
|
|
15155
|
+
nodes: {},
|
|
15156
|
+
uniforms: {},
|
|
15157
|
+
_hmrVersion: state._hmrVersion + 1
|
|
15158
|
+
}));
|
|
15159
|
+
}
|
|
15160
|
+
};
|
|
15161
|
+
if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) }) !== "undefined" && undefined) {
|
|
15162
|
+
const hot = undefined;
|
|
15163
|
+
hot.on("vite:afterUpdate", handleHMR);
|
|
15164
|
+
return () => hot.dispose?.(() => {
|
|
15165
|
+
});
|
|
15166
|
+
}
|
|
15167
|
+
if (typeof module !== "undefined" && module.hot) {
|
|
15168
|
+
const hot = module.hot;
|
|
15169
|
+
hot.addStatusHandler((status) => {
|
|
15170
|
+
if (status === "idle") handleHMR();
|
|
15171
|
+
});
|
|
15172
|
+
}
|
|
15173
|
+
}, [hmr]);
|
|
15126
15174
|
const pointerEvents = eventSource ? "none" : "auto";
|
|
15127
15175
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15128
15176
|
"div",
|
|
@@ -15145,6 +15193,72 @@ function Canvas(props) {
|
|
|
15145
15193
|
return /* @__PURE__ */ jsxRuntime.jsx(itsFine.FiberProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(CanvasImpl, { ...props }) });
|
|
15146
15194
|
}
|
|
15147
15195
|
|
|
15196
|
+
var __defProp = Object.defineProperty;
|
|
15197
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15198
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15199
|
+
var _a;
|
|
15200
|
+
const INTERNAL_DATA = Symbol("ScopedStore.data");
|
|
15201
|
+
_a = INTERNAL_DATA;
|
|
15202
|
+
const _ScopedStore = class _ScopedStore {
|
|
15203
|
+
constructor(data) {
|
|
15204
|
+
__publicField(this, _a);
|
|
15205
|
+
this[INTERNAL_DATA] = data;
|
|
15206
|
+
return new Proxy(this, {
|
|
15207
|
+
get(target, prop, receiver) {
|
|
15208
|
+
if (typeof prop === "string") {
|
|
15209
|
+
if (prop === "scope" || prop === "has" || prop === "keys") {
|
|
15210
|
+
return Reflect.get(target, prop, receiver);
|
|
15211
|
+
}
|
|
15212
|
+
return target[INTERNAL_DATA][prop];
|
|
15213
|
+
}
|
|
15214
|
+
return Reflect.get(target, prop, receiver);
|
|
15215
|
+
},
|
|
15216
|
+
has(target, prop) {
|
|
15217
|
+
return typeof prop === "string" ? prop in target[INTERNAL_DATA] : Reflect.has(target, prop);
|
|
15218
|
+
},
|
|
15219
|
+
ownKeys(target) {
|
|
15220
|
+
return Reflect.ownKeys(target[INTERNAL_DATA]);
|
|
15221
|
+
},
|
|
15222
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
15223
|
+
if (typeof prop === "string" && prop in target[INTERNAL_DATA]) {
|
|
15224
|
+
return {
|
|
15225
|
+
configurable: true,
|
|
15226
|
+
enumerable: true,
|
|
15227
|
+
value: target[INTERNAL_DATA][prop]
|
|
15228
|
+
};
|
|
15229
|
+
}
|
|
15230
|
+
return void 0;
|
|
15231
|
+
}
|
|
15232
|
+
});
|
|
15233
|
+
}
|
|
15234
|
+
/**
|
|
15235
|
+
* Access a nested scope by key.
|
|
15236
|
+
* If the key doesn't exist or isn't a scope object, returns an empty ScopedStore.
|
|
15237
|
+
*/
|
|
15238
|
+
scope(key) {
|
|
15239
|
+
const data = this[INTERNAL_DATA][key];
|
|
15240
|
+
return new _ScopedStore(
|
|
15241
|
+
data && typeof data === "object" ? data : {}
|
|
15242
|
+
);
|
|
15243
|
+
}
|
|
15244
|
+
/**
|
|
15245
|
+
* Check if a key exists in the store.
|
|
15246
|
+
*/
|
|
15247
|
+
has(key) {
|
|
15248
|
+
return key in this[INTERNAL_DATA];
|
|
15249
|
+
}
|
|
15250
|
+
/**
|
|
15251
|
+
* Get all keys in the store.
|
|
15252
|
+
*/
|
|
15253
|
+
keys() {
|
|
15254
|
+
return Object.keys(this[INTERNAL_DATA]);
|
|
15255
|
+
}
|
|
15256
|
+
};
|
|
15257
|
+
let ScopedStore = _ScopedStore;
|
|
15258
|
+
function createScopedStore(data) {
|
|
15259
|
+
return new ScopedStore(data);
|
|
15260
|
+
}
|
|
15261
|
+
|
|
15148
15262
|
function addTexture(set, key, value) {
|
|
15149
15263
|
set((state) => {
|
|
15150
15264
|
const newMap = new Map(state.textures);
|
|
@@ -15258,21 +15372,52 @@ function useUniforms(creatorOrScope, scope) {
|
|
|
15258
15372
|
},
|
|
15259
15373
|
[store]
|
|
15260
15374
|
);
|
|
15375
|
+
const rebuildUniforms = React.useCallback(
|
|
15376
|
+
(targetScope) => {
|
|
15377
|
+
store.setState((state) => {
|
|
15378
|
+
let newUniforms = state.uniforms;
|
|
15379
|
+
if (targetScope && targetScope !== "root") {
|
|
15380
|
+
const { [targetScope]: _, ...rest } = state.uniforms;
|
|
15381
|
+
newUniforms = rest;
|
|
15382
|
+
} else if (targetScope === "root") {
|
|
15383
|
+
newUniforms = {};
|
|
15384
|
+
for (const [key, value] of Object.entries(state.uniforms)) {
|
|
15385
|
+
if (!isUniformNode$1(value)) newUniforms[key] = value;
|
|
15386
|
+
}
|
|
15387
|
+
} else {
|
|
15388
|
+
newUniforms = {};
|
|
15389
|
+
}
|
|
15390
|
+
return { uniforms: newUniforms, _hmrVersion: state._hmrVersion + 1 };
|
|
15391
|
+
});
|
|
15392
|
+
},
|
|
15393
|
+
[store]
|
|
15394
|
+
);
|
|
15261
15395
|
const inputForMemoization = React.useMemo(() => {
|
|
15262
|
-
|
|
15396
|
+
if (is.fun(creatorOrScope)) {
|
|
15397
|
+
const state = store.getState();
|
|
15398
|
+
const wrappedState = {
|
|
15399
|
+
...state,
|
|
15400
|
+
uniforms: createScopedStore(state.uniforms),
|
|
15401
|
+
nodes: createScopedStore(state.nodes)
|
|
15402
|
+
};
|
|
15403
|
+
return creatorOrScope(wrappedState);
|
|
15404
|
+
}
|
|
15405
|
+
return creatorOrScope;
|
|
15263
15406
|
}, [creatorOrScope, store]);
|
|
15264
15407
|
const memoizedInput = useCompareMemoize(inputForMemoization);
|
|
15408
|
+
const isReader = memoizedInput === void 0 || typeof memoizedInput === "string";
|
|
15409
|
+
const storeUniforms = useThree((s) => s.uniforms);
|
|
15265
15410
|
const uniforms = React.useMemo(() => {
|
|
15266
|
-
const state = store.getState();
|
|
15267
|
-
const set = store.setState;
|
|
15268
15411
|
if (memoizedInput === void 0) {
|
|
15269
|
-
return
|
|
15412
|
+
return storeUniforms;
|
|
15270
15413
|
}
|
|
15271
15414
|
if (typeof memoizedInput === "string") {
|
|
15272
|
-
const scopeData =
|
|
15415
|
+
const scopeData = storeUniforms[memoizedInput];
|
|
15273
15416
|
if (scopeData && !isUniformNode$1(scopeData)) return scopeData;
|
|
15274
15417
|
return {};
|
|
15275
15418
|
}
|
|
15419
|
+
const state = store.getState();
|
|
15420
|
+
const set = store.setState;
|
|
15276
15421
|
if (typeof memoizedInput !== "object" || memoizedInput === null) {
|
|
15277
15422
|
throw new Error("Invalid uniform input");
|
|
15278
15423
|
}
|
|
@@ -15316,8 +15461,31 @@ function useUniforms(creatorOrScope, scope) {
|
|
|
15316
15461
|
}
|
|
15317
15462
|
}
|
|
15318
15463
|
return result;
|
|
15319
|
-
}, [
|
|
15320
|
-
|
|
15464
|
+
}, [
|
|
15465
|
+
store,
|
|
15466
|
+
memoizedInput,
|
|
15467
|
+
scope,
|
|
15468
|
+
// Only include storeUniforms in deps for reader modes to enable reactivity
|
|
15469
|
+
isReader ? storeUniforms : null
|
|
15470
|
+
]);
|
|
15471
|
+
return { ...uniforms, removeUniforms: removeUniforms2, clearUniforms, rebuildUniforms };
|
|
15472
|
+
}
|
|
15473
|
+
function rebuildAllUniforms(store, scope) {
|
|
15474
|
+
store.setState((state) => {
|
|
15475
|
+
let newUniforms = state.uniforms;
|
|
15476
|
+
if (scope && scope !== "root") {
|
|
15477
|
+
const { [scope]: _, ...rest } = state.uniforms;
|
|
15478
|
+
newUniforms = rest;
|
|
15479
|
+
} else if (scope === "root") {
|
|
15480
|
+
newUniforms = {};
|
|
15481
|
+
for (const [key, value] of Object.entries(state.uniforms)) {
|
|
15482
|
+
if (!isUniformNode$1(value)) newUniforms[key] = value;
|
|
15483
|
+
}
|
|
15484
|
+
} else {
|
|
15485
|
+
newUniforms = {};
|
|
15486
|
+
}
|
|
15487
|
+
return { uniforms: newUniforms, _hmrVersion: state._hmrVersion + 1 };
|
|
15488
|
+
});
|
|
15321
15489
|
}
|
|
15322
15490
|
function removeUniforms(set, names, scope) {
|
|
15323
15491
|
set((state) => {
|
|
@@ -15451,19 +15619,47 @@ function useNodes(creatorOrScope, scope) {
|
|
|
15451
15619
|
},
|
|
15452
15620
|
[store]
|
|
15453
15621
|
);
|
|
15622
|
+
const rebuildNodes = React.useCallback(
|
|
15623
|
+
(targetScope) => {
|
|
15624
|
+
store.setState((state) => {
|
|
15625
|
+
let newNodes = state.nodes;
|
|
15626
|
+
if (targetScope && targetScope !== "root") {
|
|
15627
|
+
const { [targetScope]: _, ...rest } = state.nodes;
|
|
15628
|
+
newNodes = rest;
|
|
15629
|
+
} else if (targetScope === "root") {
|
|
15630
|
+
newNodes = {};
|
|
15631
|
+
for (const [key, value] of Object.entries(state.nodes)) {
|
|
15632
|
+
if (!isTSLNode(value)) newNodes[key] = value;
|
|
15633
|
+
}
|
|
15634
|
+
} else {
|
|
15635
|
+
newNodes = {};
|
|
15636
|
+
}
|
|
15637
|
+
return { nodes: newNodes, _hmrVersion: state._hmrVersion + 1 };
|
|
15638
|
+
});
|
|
15639
|
+
},
|
|
15640
|
+
[store]
|
|
15641
|
+
);
|
|
15642
|
+
const isReader = creatorOrScope === void 0 || typeof creatorOrScope === "string";
|
|
15643
|
+
const storeNodes = useThree((s) => s.nodes);
|
|
15644
|
+
const hmrVersion = useThree((s) => s._hmrVersion);
|
|
15454
15645
|
const nodes = React.useMemo(() => {
|
|
15455
|
-
const state = store.getState();
|
|
15456
|
-
const set = store.setState;
|
|
15457
15646
|
if (creatorOrScope === void 0) {
|
|
15458
|
-
return
|
|
15647
|
+
return storeNodes;
|
|
15459
15648
|
}
|
|
15460
15649
|
if (typeof creatorOrScope === "string") {
|
|
15461
|
-
const scopeData =
|
|
15650
|
+
const scopeData = storeNodes[creatorOrScope];
|
|
15462
15651
|
if (scopeData && !isTSLNode(scopeData)) return scopeData;
|
|
15463
15652
|
return {};
|
|
15464
15653
|
}
|
|
15654
|
+
const state = store.getState();
|
|
15655
|
+
const set = store.setState;
|
|
15465
15656
|
const creator = creatorOrScope;
|
|
15466
|
-
const
|
|
15657
|
+
const wrappedState = {
|
|
15658
|
+
...state,
|
|
15659
|
+
uniforms: createScopedStore(state.uniforms),
|
|
15660
|
+
nodes: createScopedStore(state.nodes)
|
|
15661
|
+
};
|
|
15662
|
+
const created = creator(wrappedState);
|
|
15467
15663
|
const result = {};
|
|
15468
15664
|
let hasNewNodes = false;
|
|
15469
15665
|
if (scope) {
|
|
@@ -15501,8 +15697,33 @@ function useNodes(creatorOrScope, scope) {
|
|
|
15501
15697
|
set((s) => ({ nodes: { ...s.nodes, ...result } }));
|
|
15502
15698
|
}
|
|
15503
15699
|
return result;
|
|
15504
|
-
}, [
|
|
15505
|
-
|
|
15700
|
+
}, [
|
|
15701
|
+
store,
|
|
15702
|
+
typeof creatorOrScope === "string" ? creatorOrScope : scope,
|
|
15703
|
+
// Only include storeNodes in deps for reader modes to enable reactivity
|
|
15704
|
+
// Creator mode intentionally excludes it to avoid re-running creator on unrelated changes
|
|
15705
|
+
isReader ? storeNodes : null,
|
|
15706
|
+
// Include hmrVersion for creator modes to allow rebuildNodes() to bust the cache
|
|
15707
|
+
isReader ? null : hmrVersion
|
|
15708
|
+
]);
|
|
15709
|
+
return { ...nodes, removeNodes: removeNodes2, clearNodes, rebuildNodes };
|
|
15710
|
+
}
|
|
15711
|
+
function rebuildAllNodes(store, scope) {
|
|
15712
|
+
store.setState((state) => {
|
|
15713
|
+
let newNodes = state.nodes;
|
|
15714
|
+
if (scope && scope !== "root") {
|
|
15715
|
+
const { [scope]: _, ...rest } = state.nodes;
|
|
15716
|
+
newNodes = rest;
|
|
15717
|
+
} else if (scope === "root") {
|
|
15718
|
+
newNodes = {};
|
|
15719
|
+
for (const [key, value] of Object.entries(state.nodes)) {
|
|
15720
|
+
if (!isTSLNode(value)) newNodes[key] = value;
|
|
15721
|
+
}
|
|
15722
|
+
} else {
|
|
15723
|
+
newNodes = {};
|
|
15724
|
+
}
|
|
15725
|
+
return { nodes: newNodes, _hmrVersion: state._hmrVersion + 1 };
|
|
15726
|
+
});
|
|
15506
15727
|
}
|
|
15507
15728
|
function removeNodes(set, names, scope) {
|
|
15508
15729
|
set((state) => {
|
|
@@ -15538,7 +15759,12 @@ function useLocalNodes(creator) {
|
|
|
15538
15759
|
const textures = useThree((s) => s.textures);
|
|
15539
15760
|
return React.useMemo(() => {
|
|
15540
15761
|
const state = store.getState();
|
|
15541
|
-
|
|
15762
|
+
const wrappedState = {
|
|
15763
|
+
...state,
|
|
15764
|
+
uniforms: createScopedStore(state.uniforms),
|
|
15765
|
+
nodes: createScopedStore(state.nodes)
|
|
15766
|
+
};
|
|
15767
|
+
return creator(wrappedState);
|
|
15542
15768
|
}, [store, creator, uniforms, nodes, textures]);
|
|
15543
15769
|
}
|
|
15544
15770
|
|
|
@@ -15552,6 +15778,10 @@ function usePostProcessing(mainCB, setupCB) {
|
|
|
15552
15778
|
mainCBRef.current = mainCB;
|
|
15553
15779
|
setupCBRef.current = setupCB;
|
|
15554
15780
|
const [rebuildVersion, setRebuildVersion] = React.useState(0);
|
|
15781
|
+
React.useEffect(() => {
|
|
15782
|
+
callbacksRanRef.current = false;
|
|
15783
|
+
scenePassCacheRef.current = null;
|
|
15784
|
+
}, []);
|
|
15555
15785
|
const clearPasses = React.useCallback(() => {
|
|
15556
15786
|
store.setState({ passes: {} });
|
|
15557
15787
|
}, [store]);
|
|
@@ -15662,6 +15892,7 @@ exports.createEvents = createEvents;
|
|
|
15662
15892
|
exports.createPointerEvents = createPointerEvents;
|
|
15663
15893
|
exports.createPortal = createPortal;
|
|
15664
15894
|
exports.createRoot = createRoot;
|
|
15895
|
+
exports.createScopedStore = createScopedStore;
|
|
15665
15896
|
exports.createStore = createStore;
|
|
15666
15897
|
exports.createTextureOperations = createTextureOperations;
|
|
15667
15898
|
exports.detach = detach;
|
|
@@ -15688,6 +15919,8 @@ exports.isRenderer = isRenderer;
|
|
|
15688
15919
|
exports.isTexture = isTexture;
|
|
15689
15920
|
exports.isVectorLike = isVectorLike;
|
|
15690
15921
|
exports.prepare = prepare;
|
|
15922
|
+
exports.rebuildAllNodes = rebuildAllNodes;
|
|
15923
|
+
exports.rebuildAllUniforms = rebuildAllUniforms;
|
|
15691
15924
|
exports.reconciler = reconciler;
|
|
15692
15925
|
exports.removeInteractivity = removeInteractivity;
|
|
15693
15926
|
exports.removeNodes = removeNodes;
|