@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.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const Tb = require('scheduler');
|
|
|
11
11
|
const traditional = require('zustand/traditional');
|
|
12
12
|
const suspendReact = require('suspend-react');
|
|
13
13
|
|
|
14
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
14
15
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
15
16
|
|
|
16
17
|
function _interopNamespaceCompat(e) {
|
|
@@ -548,7 +549,7 @@ function applyProps(object, props) {
|
|
|
548
549
|
const rootState = instance && findInitialRoot(instance).getState();
|
|
549
550
|
const prevHandlers = instance?.eventCount;
|
|
550
551
|
for (const prop in props) {
|
|
551
|
-
|
|
552
|
+
const value = props[prop];
|
|
552
553
|
if (RESERVED_PROPS.includes(prop)) continue;
|
|
553
554
|
if (instance && EVENT_REGEX.test(prop)) {
|
|
554
555
|
if (typeof value === "function") instance.handlers[prop] = value;
|
|
@@ -700,13 +701,14 @@ function createEvents(store) {
|
|
|
700
701
|
for (const hit of hits) {
|
|
701
702
|
let eventObject = hit.object;
|
|
702
703
|
while (eventObject) {
|
|
703
|
-
if (eventObject.__r3f?.eventCount)
|
|
704
|
+
if (eventObject.__r3f?.eventCount) {
|
|
704
705
|
intersections.push({ ...hit, eventObject });
|
|
706
|
+
}
|
|
705
707
|
eventObject = eventObject.parent;
|
|
706
708
|
}
|
|
707
709
|
}
|
|
708
710
|
if ("pointerId" in event && state.internal.capturedMap.has(event.pointerId)) {
|
|
709
|
-
for (
|
|
711
|
+
for (const captureData of state.internal.capturedMap.get(event.pointerId).values()) {
|
|
710
712
|
if (!duplicates.has(makeId(captureData.intersection))) intersections.push(captureData.intersection);
|
|
711
713
|
}
|
|
712
714
|
}
|
|
@@ -736,12 +738,12 @@ function createEvents(store) {
|
|
|
736
738
|
releaseInternalPointerCapture(internal.capturedMap, hit.eventObject, captures, id);
|
|
737
739
|
}
|
|
738
740
|
};
|
|
739
|
-
|
|
740
|
-
for (
|
|
741
|
-
|
|
741
|
+
const extractEventProps = {};
|
|
742
|
+
for (const prop in event) {
|
|
743
|
+
const property = event[prop];
|
|
742
744
|
if (typeof property !== "function") extractEventProps[prop] = property;
|
|
743
745
|
}
|
|
744
|
-
|
|
746
|
+
const raycastEvent = {
|
|
745
747
|
...hit,
|
|
746
748
|
...extractEventProps,
|
|
747
749
|
pointer,
|
|
@@ -1124,10 +1126,38 @@ const createStore = (invalidate, advance) => {
|
|
|
1124
1126
|
getCurrentViewport
|
|
1125
1127
|
},
|
|
1126
1128
|
setEvents: (events) => set((state2) => ({ ...state2, events: { ...state2.events, ...events } })),
|
|
1127
|
-
setSize: (width, height, top
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1129
|
+
setSize: (width, height, top, left) => {
|
|
1130
|
+
const state2 = get();
|
|
1131
|
+
if (width === void 0) {
|
|
1132
|
+
set({ _sizeImperative: false });
|
|
1133
|
+
if (state2._sizeProps) {
|
|
1134
|
+
const { width: propW, height: propH } = state2._sizeProps;
|
|
1135
|
+
if (propW !== void 0 || propH !== void 0) {
|
|
1136
|
+
const currentSize = state2.size;
|
|
1137
|
+
const newSize = {
|
|
1138
|
+
width: propW ?? currentSize.width,
|
|
1139
|
+
height: propH ?? currentSize.height,
|
|
1140
|
+
top: currentSize.top,
|
|
1141
|
+
left: currentSize.left
|
|
1142
|
+
};
|
|
1143
|
+
set((s) => ({
|
|
1144
|
+
size: newSize,
|
|
1145
|
+
viewport: { ...s.viewport, ...getCurrentViewport(state2.camera, defaultTarget, newSize) }
|
|
1146
|
+
}));
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
const w = width;
|
|
1152
|
+
const h = height ?? width;
|
|
1153
|
+
const t = top ?? state2.size.top;
|
|
1154
|
+
const l = left ?? state2.size.left;
|
|
1155
|
+
const size = { width: w, height: h, top: t, left: l };
|
|
1156
|
+
set((s) => ({
|
|
1157
|
+
size,
|
|
1158
|
+
viewport: { ...s.viewport, ...getCurrentViewport(state2.camera, defaultTarget, size) },
|
|
1159
|
+
_sizeImperative: true
|
|
1160
|
+
}));
|
|
1131
1161
|
},
|
|
1132
1162
|
setDpr: (dpr) => set((state2) => {
|
|
1133
1163
|
const resolved = calculateDpr(dpr);
|
|
@@ -1144,6 +1174,9 @@ const createStore = (invalidate, advance) => {
|
|
|
1144
1174
|
textures: /* @__PURE__ */ new Map(),
|
|
1145
1175
|
postProcessing: null,
|
|
1146
1176
|
passes: {},
|
|
1177
|
+
_hmrVersion: 0,
|
|
1178
|
+
_sizeImperative: false,
|
|
1179
|
+
_sizeProps: null,
|
|
1147
1180
|
previousRoot: void 0,
|
|
1148
1181
|
internal: {
|
|
1149
1182
|
// Events
|
|
@@ -1351,8 +1384,9 @@ class PhaseGraph {
|
|
|
1351
1384
|
const node = { name, isAutoGenerated: false };
|
|
1352
1385
|
let insertIndex = this.phases.length;
|
|
1353
1386
|
const targetIndex = this.getPhaseIndex(before ?? after);
|
|
1354
|
-
if (targetIndex !== -1)
|
|
1355
|
-
|
|
1387
|
+
if (targetIndex !== -1) {
|
|
1388
|
+
insertIndex = before ? targetIndex : targetIndex + 1;
|
|
1389
|
+
} else {
|
|
1356
1390
|
const constraintType = before ? "before" : "after";
|
|
1357
1391
|
console.warn(`[useFrame] Phase "${before ?? after}" not found for '${constraintType}' constraint`);
|
|
1358
1392
|
}
|
|
@@ -2765,24 +2799,14 @@ function advance(timestamp, runGlobalEffects = true, state, frame) {
|
|
|
2765
2799
|
getScheduler().step(timestamp);
|
|
2766
2800
|
}
|
|
2767
2801
|
|
|
2768
|
-
const version = "10.0.0-alpha.
|
|
2802
|
+
const version = "10.0.0-alpha.2";
|
|
2769
2803
|
const packageData = {
|
|
2770
2804
|
version: version};
|
|
2771
2805
|
|
|
2772
2806
|
function Xb(Tt) {
|
|
2773
2807
|
return Tt && Tt.__esModule && Object.prototype.hasOwnProperty.call(Tt, "default") ? Tt.default : Tt;
|
|
2774
2808
|
}
|
|
2775
|
-
var Rm = { exports: {} }, Og = { exports: {} };
|
|
2776
|
-
/**
|
|
2777
|
-
* @license React
|
|
2778
|
-
* react-reconciler.production.js
|
|
2779
|
-
*
|
|
2780
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2781
|
-
*
|
|
2782
|
-
* This source code is licensed under the MIT license found in the
|
|
2783
|
-
* LICENSE file in the root directory of this source tree.
|
|
2784
|
-
*/
|
|
2785
|
-
var _b;
|
|
2809
|
+
var Rm = { exports: {} }, Og = { exports: {} }, _b;
|
|
2786
2810
|
function Kb() {
|
|
2787
2811
|
return _b || (_b = 1, (function(Tt) {
|
|
2788
2812
|
Tt.exports = function(m) {
|
|
@@ -3854,7 +3878,6 @@ Error generating stack: ` + l.message + `
|
|
|
3854
3878
|
if (J === cl || J === jc) throw J;
|
|
3855
3879
|
var Ge = Yn(29, J, null, P.mode);
|
|
3856
3880
|
return Ge.lanes = H, Ge.return = P, Ge;
|
|
3857
|
-
} finally {
|
|
3858
3881
|
}
|
|
3859
3882
|
};
|
|
3860
3883
|
}
|
|
@@ -4508,7 +4531,6 @@ Error generating stack: ` + l.message + `
|
|
|
4508
4531
|
var h = r.lastRenderedState, y = d(h, a);
|
|
4509
4532
|
if (c.hasEagerState = true, c.eagerState = y, jn(y, h)) return go(t, r, c, 0), Ne === null && Bn(), false;
|
|
4510
4533
|
} catch {
|
|
4511
|
-
} finally {
|
|
4512
4534
|
}
|
|
4513
4535
|
if (a = yo(t, r, c, l), a !== null) return nt(a, t, l), ns(a, r, l), true;
|
|
4514
4536
|
}
|
|
@@ -6929,10 +6951,7 @@ Error generating stack: ` + l.message + `
|
|
|
6929
6951
|
function vr(t, r) {
|
|
6930
6952
|
Sf(t, r), (t = t.alternate) && Sf(t, r);
|
|
6931
6953
|
}
|
|
6932
|
-
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");
|
|
6933
|
-
var gc = Symbol.for("react.activity");
|
|
6934
|
-
var $r = Symbol.for("react.memo_cache_sentinel");
|
|
6935
|
-
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;
|
|
6954
|
+
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;
|
|
6936
6955
|
m.cloneMutableInstance;
|
|
6937
6956
|
var yc = m.appendInitialChild, Kp = m.finalizeInitialChildren, Rs = m.shouldSetTextContent, bc = m.createTextInstance;
|
|
6938
6957
|
m.cloneMutableTextInstance;
|
|
@@ -7301,17 +7320,7 @@ No matching component was found for:
|
|
|
7301
7320
|
}, Tt.exports.default = Tt.exports, Object.defineProperty(Tt.exports, "__esModule", { value: true });
|
|
7302
7321
|
})(Og)), Og.exports;
|
|
7303
7322
|
}
|
|
7304
|
-
var Mg = { exports: {} };
|
|
7305
|
-
/**
|
|
7306
|
-
* @license React
|
|
7307
|
-
* react-reconciler.development.js
|
|
7308
|
-
*
|
|
7309
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7310
|
-
*
|
|
7311
|
-
* This source code is licensed under the MIT license found in the
|
|
7312
|
-
* LICENSE file in the root directory of this source tree.
|
|
7313
|
-
*/
|
|
7314
|
-
var Rb;
|
|
7323
|
+
var Mg = { exports: {} }, Rb;
|
|
7315
7324
|
function e0() {
|
|
7316
7325
|
return Rb || (Rb = 1, (function(Tt) {
|
|
7317
7326
|
process.env.NODE_ENV !== "production" && (Tt.exports = function(m) {
|
|
@@ -13078,10 +13087,7 @@ Check the render method of %s.`, G(di) || "Unknown")), i = zo(n), i.payload = {
|
|
|
13078
13087
|
function Ic() {
|
|
13079
13088
|
return di;
|
|
13080
13089
|
}
|
|
13081
|
-
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");
|
|
13082
|
-
var Ds = Symbol.for("react.activity");
|
|
13083
|
-
var Bh = Symbol.for("react.memo_cache_sentinel");
|
|
13084
|
-
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;
|
|
13090
|
+
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;
|
|
13085
13091
|
m.cloneMutableInstance;
|
|
13086
13092
|
var bn = m.appendInitialChild, Ue = m.finalizeInitialChildren, ue = m.shouldSetTextContent, Do = m.createTextInstance;
|
|
13087
13093
|
m.cloneMutableTextInstance;
|
|
@@ -14049,15 +14055,6 @@ function n0() {
|
|
|
14049
14055
|
var t0 = n0();
|
|
14050
14056
|
const r0 = Xb(t0);
|
|
14051
14057
|
|
|
14052
|
-
/**
|
|
14053
|
-
* @license React
|
|
14054
|
-
* react-reconciler-constants.production.js
|
|
14055
|
-
*
|
|
14056
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14057
|
-
*
|
|
14058
|
-
* This source code is licensed under the MIT license found in the
|
|
14059
|
-
* LICENSE file in the root directory of this source tree.
|
|
14060
|
-
*/
|
|
14061
14058
|
const t = 1, o = 8, r = 32, e = 2;
|
|
14062
14059
|
|
|
14063
14060
|
function createReconciler(config) {
|
|
@@ -14084,10 +14081,11 @@ function extend(objects) {
|
|
|
14084
14081
|
function validateInstance(type, props) {
|
|
14085
14082
|
const name = toPascalCase(type);
|
|
14086
14083
|
const target = catalogue[name];
|
|
14087
|
-
if (type !== "primitive" && !target)
|
|
14084
|
+
if (type !== "primitive" && !target) {
|
|
14088
14085
|
throw new Error(
|
|
14089
14086
|
`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`
|
|
14090
14087
|
);
|
|
14088
|
+
}
|
|
14091
14089
|
if (type === "primitive" && !props.object) throw new Error(`R3F: Primitives without 'object' are invalid!`);
|
|
14092
14090
|
if (props.args !== void 0 && !Array.isArray(props.args)) throw new Error("R3F: The args prop must be an array!");
|
|
14093
14091
|
}
|
|
@@ -14538,14 +14536,14 @@ function createRoot(canvas) {
|
|
|
14538
14536
|
if (!prevRoot) _roots.set(canvas, { fiber, store });
|
|
14539
14537
|
let onCreated;
|
|
14540
14538
|
let lastCamera;
|
|
14541
|
-
|
|
14539
|
+
const lastConfiguredProps = {};
|
|
14542
14540
|
let configured = false;
|
|
14543
14541
|
let pending = null;
|
|
14544
14542
|
return {
|
|
14545
14543
|
async configure(props = {}) {
|
|
14546
14544
|
let resolve;
|
|
14547
14545
|
pending = new Promise((_resolve) => resolve = _resolve);
|
|
14548
|
-
|
|
14546
|
+
const {
|
|
14549
14547
|
gl: glConfig,
|
|
14550
14548
|
renderer: rendererConfig,
|
|
14551
14549
|
size: propsSize,
|
|
@@ -14567,9 +14565,10 @@ function createRoot(canvas) {
|
|
|
14567
14565
|
onDragOverMissed,
|
|
14568
14566
|
onDropMissed,
|
|
14569
14567
|
autoUpdateFrustum = true,
|
|
14570
|
-
occlusion = false
|
|
14568
|
+
occlusion = false,
|
|
14569
|
+
_sizeProps
|
|
14571
14570
|
} = props;
|
|
14572
|
-
|
|
14571
|
+
const state = store.getState();
|
|
14573
14572
|
const defaultGLProps = {
|
|
14574
14573
|
canvas,
|
|
14575
14574
|
powerPreference: "high-performance",
|
|
@@ -14609,8 +14608,9 @@ function createRoot(canvas) {
|
|
|
14609
14608
|
if (!raycaster) state.set({ raycaster: raycaster = new webgpu.Raycaster() });
|
|
14610
14609
|
const { params, ...options } = raycastOptions || {};
|
|
14611
14610
|
if (!is.equ(options, raycaster, shallowLoose)) applyProps(raycaster, { ...options });
|
|
14612
|
-
if (!is.equ(params, raycaster.params, shallowLoose))
|
|
14611
|
+
if (!is.equ(params, raycaster.params, shallowLoose)) {
|
|
14613
14612
|
applyProps(raycaster, { params: { ...raycaster.params, ...params } });
|
|
14613
|
+
}
|
|
14614
14614
|
if (!state.camera || state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose)) {
|
|
14615
14615
|
lastCamera = cameraOptions;
|
|
14616
14616
|
const isCamera = cameraOptions?.isCamera;
|
|
@@ -14661,9 +14661,14 @@ function createRoot(canvas) {
|
|
|
14661
14661
|
wasEnabled = enabled;
|
|
14662
14662
|
});
|
|
14663
14663
|
}
|
|
14664
|
+
if (_sizeProps !== void 0) {
|
|
14665
|
+
state.set({ _sizeProps });
|
|
14666
|
+
}
|
|
14664
14667
|
const size = computeInitialSize(canvas, propsSize);
|
|
14665
|
-
if (!is.equ(size, state.size, shallowLoose)) {
|
|
14668
|
+
if (!state._sizeImperative && !is.equ(size, state.size, shallowLoose)) {
|
|
14669
|
+
const wasImperative = state._sizeImperative;
|
|
14666
14670
|
state.setSize(size.width, size.height, size.top, size.left);
|
|
14671
|
+
if (!wasImperative) state.set({ _sizeImperative: false });
|
|
14667
14672
|
}
|
|
14668
14673
|
if (dpr !== void 0 && !is.equ(dpr, lastConfiguredProps.dpr, shallowLoose)) {
|
|
14669
14674
|
state.setDpr(dpr);
|
|
@@ -14733,20 +14738,22 @@ function createRoot(canvas) {
|
|
|
14733
14738
|
} else if (is.obj(shadows)) {
|
|
14734
14739
|
Object.assign(renderer.shadowMap, shadows);
|
|
14735
14740
|
}
|
|
14736
|
-
if (oldEnabled !== renderer.shadowMap.enabled || oldType !== renderer.shadowMap.type)
|
|
14741
|
+
if (oldEnabled !== renderer.shadowMap.enabled || oldType !== renderer.shadowMap.type) {
|
|
14737
14742
|
renderer.shadowMap.needsUpdate = true;
|
|
14743
|
+
}
|
|
14738
14744
|
}
|
|
14739
14745
|
{
|
|
14740
14746
|
const legacyChanged = legacy !== lastConfiguredProps.legacy;
|
|
14741
14747
|
const linearChanged = linear !== lastConfiguredProps.linear;
|
|
14742
14748
|
const flatChanged = flat !== lastConfiguredProps.flat;
|
|
14743
14749
|
if (legacyChanged) {
|
|
14744
|
-
if (legacy)
|
|
14750
|
+
if (legacy) {
|
|
14745
14751
|
notifyDepreciated({
|
|
14746
14752
|
heading: "Legacy Color Management",
|
|
14747
14753
|
body: "Legacy color management is deprecated and will be removed in a future version.",
|
|
14748
14754
|
link: "https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe"
|
|
14749
14755
|
});
|
|
14756
|
+
}
|
|
14750
14757
|
}
|
|
14751
14758
|
if (legacyChanged) {
|
|
14752
14759
|
webgpu.ColorManagement.enabled = !legacy;
|
|
@@ -14768,8 +14775,9 @@ function createRoot(canvas) {
|
|
|
14768
14775
|
if (state.textureColorSpace !== textureColorSpace) state.set(() => ({ textureColorSpace }));
|
|
14769
14776
|
lastConfiguredProps.textureColorSpace = textureColorSpace;
|
|
14770
14777
|
}
|
|
14771
|
-
if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, renderer, shallowLoose))
|
|
14778
|
+
if (glConfig && !is.fun(glConfig) && !isRenderer(glConfig) && !is.equ(glConfig, renderer, shallowLoose)) {
|
|
14772
14779
|
applyProps(renderer, glConfig);
|
|
14780
|
+
}
|
|
14773
14781
|
if (rendererConfig && !is.fun(rendererConfig) && !isRenderer(rendererConfig) && state.renderer) {
|
|
14774
14782
|
const currentRenderer = state.renderer;
|
|
14775
14783
|
if (!is.equ(rendererConfig, currentRenderer, shallowLoose)) {
|
|
@@ -15037,6 +15045,9 @@ function CanvasImpl({
|
|
|
15037
15045
|
onDragOverMissed,
|
|
15038
15046
|
onDropMissed,
|
|
15039
15047
|
onCreated,
|
|
15048
|
+
hmr,
|
|
15049
|
+
width,
|
|
15050
|
+
height,
|
|
15040
15051
|
...props
|
|
15041
15052
|
}) {
|
|
15042
15053
|
React__namespace.useMemo(() => extend(THREE), []);
|
|
@@ -15057,7 +15068,16 @@ function CanvasImpl({
|
|
|
15057
15068
|
};
|
|
15058
15069
|
}, [resize, hasInitialSizeRef.current]);
|
|
15059
15070
|
const [containerRef, containerRect] = useMeasure__default(measureConfig);
|
|
15060
|
-
|
|
15071
|
+
const effectiveSize = React__namespace.useMemo(
|
|
15072
|
+
() => ({
|
|
15073
|
+
width: width ?? containerRect.width,
|
|
15074
|
+
height: height ?? containerRect.height,
|
|
15075
|
+
top: containerRect.top,
|
|
15076
|
+
left: containerRect.left
|
|
15077
|
+
}),
|
|
15078
|
+
[width, height, containerRect]
|
|
15079
|
+
);
|
|
15080
|
+
if (!hasInitialSizeRef.current && effectiveSize.width > 0 && effectiveSize.height > 0) {
|
|
15061
15081
|
hasInitialSizeRef.current = true;
|
|
15062
15082
|
}
|
|
15063
15083
|
const canvasRef = React__namespace.useRef(null);
|
|
@@ -15076,7 +15096,7 @@ function CanvasImpl({
|
|
|
15076
15096
|
useIsomorphicLayoutEffect(() => {
|
|
15077
15097
|
effectActiveRef.current = true;
|
|
15078
15098
|
const canvas = canvasRef.current;
|
|
15079
|
-
if (
|
|
15099
|
+
if (effectiveSize.width > 0 && effectiveSize.height > 0 && canvas) {
|
|
15080
15100
|
if (!root.current) {
|
|
15081
15101
|
root.current = createRoot(canvas);
|
|
15082
15102
|
notifyAlpha({
|
|
@@ -15110,7 +15130,9 @@ function CanvasImpl({
|
|
|
15110
15130
|
performance,
|
|
15111
15131
|
raycaster,
|
|
15112
15132
|
camera,
|
|
15113
|
-
size:
|
|
15133
|
+
size: effectiveSize,
|
|
15134
|
+
// Store size props for reset functionality
|
|
15135
|
+
_sizeProps: width !== void 0 || height !== void 0 ? { width, height } : null,
|
|
15114
15136
|
// Pass mutable reference to onPointerMissed so it's free to update
|
|
15115
15137
|
onPointerMissed: (...args) => handlePointerMissed.current?.(...args),
|
|
15116
15138
|
onDragOverMissed: (...args) => handleDragOverMissed.current?.(...args),
|
|
@@ -15156,6 +15178,33 @@ function CanvasImpl({
|
|
|
15156
15178
|
};
|
|
15157
15179
|
}
|
|
15158
15180
|
}, []);
|
|
15181
|
+
React__namespace.useEffect(() => {
|
|
15182
|
+
if (hmr === false) return;
|
|
15183
|
+
const canvas = canvasRef.current;
|
|
15184
|
+
if (!canvas) return;
|
|
15185
|
+
const handleHMR = () => {
|
|
15186
|
+
const rootEntry = _roots.get(canvas);
|
|
15187
|
+
if (rootEntry?.store) {
|
|
15188
|
+
rootEntry.store.setState((state) => ({
|
|
15189
|
+
nodes: {},
|
|
15190
|
+
uniforms: {},
|
|
15191
|
+
_hmrVersion: state._hmrVersion + 1
|
|
15192
|
+
}));
|
|
15193
|
+
}
|
|
15194
|
+
};
|
|
15195
|
+
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) {
|
|
15196
|
+
const hot = undefined;
|
|
15197
|
+
hot.on("vite:afterUpdate", handleHMR);
|
|
15198
|
+
return () => hot.dispose?.(() => {
|
|
15199
|
+
});
|
|
15200
|
+
}
|
|
15201
|
+
if (typeof module !== "undefined" && module.hot) {
|
|
15202
|
+
const hot = module.hot;
|
|
15203
|
+
hot.addStatusHandler((status) => {
|
|
15204
|
+
if (status === "idle") handleHMR();
|
|
15205
|
+
});
|
|
15206
|
+
}
|
|
15207
|
+
}, [hmr]);
|
|
15159
15208
|
const pointerEvents = eventSource ? "none" : "auto";
|
|
15160
15209
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15161
15210
|
"div",
|
package/dist/index.d.cts
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.d.mts
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 };
|