@react-three/fiber 8.11.7 → 8.11.8
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/CHANGELOG.md +6 -0
- package/dist/{index-947d20f1.esm.js → index-648b7c70.esm.js} +1 -1
- package/dist/react-three-fiber.cjs.dev.js +48 -48
- package/dist/react-three-fiber.cjs.prod.js +48 -48
- package/dist/react-three-fiber.esm.js +50 -50
- package/native/dist/react-three-fiber-native.esm.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2106,4 +2106,4 @@ reconciler.injectIntoDevTools({
|
|
|
2106
2106
|
});
|
|
2107
2107
|
const act = React.unstable_act;
|
|
2108
2108
|
|
|
2109
|
-
export { useFrame as A, Block as B, useGraph as C, useLoader as D, ErrorBoundary as E,
|
|
2109
|
+
export { useFrame as A, Block as B, useGraph as C, useLoader as D, ErrorBoundary as E, useIsomorphicLayoutEffect as a, createRoot as b, createEvents as c, unmountComponentAtNode as d, extend as e, context as f, createPortal as g, reconciler as h, isRef as i, applyProps as j, dispose as k, invalidate as l, advance as m, addEffect as n, addAfterEffect as o, addTail as p, flushGlobalEffects as q, render as r, getRootState as s, threeTypes as t, useMutableCallback as u, act as v, roots as w, useInstanceHandle as x, useStore as y, useThree as z };
|
|
@@ -160,7 +160,6 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
160
160
|
});
|
|
161
161
|
const canvasRef = React__namespace.useRef(null);
|
|
162
162
|
const divRef = React__namespace.useRef(null);
|
|
163
|
-
const [canvas, setCanvas] = React__namespace.useState(null);
|
|
164
163
|
React__namespace.useImperativeHandle(forwardedRef, () => canvasRef.current);
|
|
165
164
|
const handlePointerMissed = index.useMutableCallback(onPointerMissed);
|
|
166
165
|
const [block, setBlock] = React__namespace.useState(false);
|
|
@@ -171,56 +170,57 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
171
170
|
// Throw exception outwards if anything within canvas throws
|
|
172
171
|
if (error) throw error;
|
|
173
172
|
const root = React__namespace.useRef(null);
|
|
174
|
-
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
175
|
-
if (!root.current) root.current = index.createRoot(canvas);
|
|
176
|
-
root.current.configure({
|
|
177
|
-
gl,
|
|
178
|
-
events,
|
|
179
|
-
shadows,
|
|
180
|
-
linear,
|
|
181
|
-
flat,
|
|
182
|
-
legacy,
|
|
183
|
-
orthographic,
|
|
184
|
-
frameloop,
|
|
185
|
-
dpr,
|
|
186
|
-
performance,
|
|
187
|
-
raycaster,
|
|
188
|
-
camera,
|
|
189
|
-
size: containerRect,
|
|
190
|
-
// Pass mutable reference to onPointerMissed so it's free to update
|
|
191
|
-
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
192
|
-
onCreated: state => {
|
|
193
|
-
// Connect to event source
|
|
194
|
-
state.events.connect == null ? void 0 : state.events.connect(eventSource ? index.isRef(eventSource) ? eventSource.current : eventSource : divRef.current);
|
|
195
|
-
// Set up compute function
|
|
196
|
-
if (eventPrefix) {
|
|
197
|
-
state.setEvents({
|
|
198
|
-
compute: (event, state) => {
|
|
199
|
-
const x = event[eventPrefix + 'X'];
|
|
200
|
-
const y = event[eventPrefix + 'Y'];
|
|
201
|
-
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
202
|
-
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
// Call onCreated callback
|
|
207
|
-
onCreated == null ? void 0 : onCreated(state);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
root.current.render( /*#__PURE__*/React__namespace.createElement(Bridge, null, /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
211
|
-
set: setError
|
|
212
|
-
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
213
|
-
fallback: /*#__PURE__*/React__namespace.createElement(index.Block, {
|
|
214
|
-
set: setBlock
|
|
215
|
-
})
|
|
216
|
-
}, children))));
|
|
217
|
-
}
|
|
218
173
|
index.useIsomorphicLayoutEffect(() => {
|
|
219
|
-
|
|
220
|
-
|
|
174
|
+
const canvas = canvasRef.current;
|
|
175
|
+
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
176
|
+
if (!root.current) root.current = index.createRoot(canvas);
|
|
177
|
+
root.current.configure({
|
|
178
|
+
gl,
|
|
179
|
+
events,
|
|
180
|
+
shadows,
|
|
181
|
+
linear,
|
|
182
|
+
flat,
|
|
183
|
+
legacy,
|
|
184
|
+
orthographic,
|
|
185
|
+
frameloop,
|
|
186
|
+
dpr,
|
|
187
|
+
performance,
|
|
188
|
+
raycaster,
|
|
189
|
+
camera,
|
|
190
|
+
size: containerRect,
|
|
191
|
+
// Pass mutable reference to onPointerMissed so it's free to update
|
|
192
|
+
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
193
|
+
onCreated: state => {
|
|
194
|
+
// Connect to event source
|
|
195
|
+
state.events.connect == null ? void 0 : state.events.connect(eventSource ? index.isRef(eventSource) ? eventSource.current : eventSource : divRef.current);
|
|
196
|
+
// Set up compute function
|
|
197
|
+
if (eventPrefix) {
|
|
198
|
+
state.setEvents({
|
|
199
|
+
compute: (event, state) => {
|
|
200
|
+
const x = event[eventPrefix + 'X'];
|
|
201
|
+
const y = event[eventPrefix + 'Y'];
|
|
202
|
+
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
203
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
// Call onCreated callback
|
|
208
|
+
onCreated == null ? void 0 : onCreated(state);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
root.current.render( /*#__PURE__*/React__namespace.createElement(Bridge, null, /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
212
|
+
set: setError
|
|
213
|
+
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
214
|
+
fallback: /*#__PURE__*/React__namespace.createElement(index.Block, {
|
|
215
|
+
set: setBlock
|
|
216
|
+
})
|
|
217
|
+
}, children))));
|
|
218
|
+
}
|
|
219
|
+
});
|
|
221
220
|
React__namespace.useEffect(() => {
|
|
221
|
+
const canvas = canvasRef.current;
|
|
222
222
|
if (canvas) return () => index.unmountComponentAtNode(canvas);
|
|
223
|
-
}, [
|
|
223
|
+
}, []);
|
|
224
224
|
|
|
225
225
|
// When the event source is not this div, we need to set pointer-events to none
|
|
226
226
|
// Or else the canvas will block events from reaching the event source
|
|
@@ -160,7 +160,6 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
160
160
|
});
|
|
161
161
|
const canvasRef = React__namespace.useRef(null);
|
|
162
162
|
const divRef = React__namespace.useRef(null);
|
|
163
|
-
const [canvas, setCanvas] = React__namespace.useState(null);
|
|
164
163
|
React__namespace.useImperativeHandle(forwardedRef, () => canvasRef.current);
|
|
165
164
|
const handlePointerMissed = index.useMutableCallback(onPointerMissed);
|
|
166
165
|
const [block, setBlock] = React__namespace.useState(false);
|
|
@@ -171,56 +170,57 @@ const CanvasImpl = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
171
170
|
// Throw exception outwards if anything within canvas throws
|
|
172
171
|
if (error) throw error;
|
|
173
172
|
const root = React__namespace.useRef(null);
|
|
174
|
-
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
175
|
-
if (!root.current) root.current = index.createRoot(canvas);
|
|
176
|
-
root.current.configure({
|
|
177
|
-
gl,
|
|
178
|
-
events,
|
|
179
|
-
shadows,
|
|
180
|
-
linear,
|
|
181
|
-
flat,
|
|
182
|
-
legacy,
|
|
183
|
-
orthographic,
|
|
184
|
-
frameloop,
|
|
185
|
-
dpr,
|
|
186
|
-
performance,
|
|
187
|
-
raycaster,
|
|
188
|
-
camera,
|
|
189
|
-
size: containerRect,
|
|
190
|
-
// Pass mutable reference to onPointerMissed so it's free to update
|
|
191
|
-
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
192
|
-
onCreated: state => {
|
|
193
|
-
// Connect to event source
|
|
194
|
-
state.events.connect == null ? void 0 : state.events.connect(eventSource ? index.isRef(eventSource) ? eventSource.current : eventSource : divRef.current);
|
|
195
|
-
// Set up compute function
|
|
196
|
-
if (eventPrefix) {
|
|
197
|
-
state.setEvents({
|
|
198
|
-
compute: (event, state) => {
|
|
199
|
-
const x = event[eventPrefix + 'X'];
|
|
200
|
-
const y = event[eventPrefix + 'Y'];
|
|
201
|
-
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
202
|
-
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
// Call onCreated callback
|
|
207
|
-
onCreated == null ? void 0 : onCreated(state);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
root.current.render( /*#__PURE__*/React__namespace.createElement(Bridge, null, /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
211
|
-
set: setError
|
|
212
|
-
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
213
|
-
fallback: /*#__PURE__*/React__namespace.createElement(index.Block, {
|
|
214
|
-
set: setBlock
|
|
215
|
-
})
|
|
216
|
-
}, children))));
|
|
217
|
-
}
|
|
218
173
|
index.useIsomorphicLayoutEffect(() => {
|
|
219
|
-
|
|
220
|
-
|
|
174
|
+
const canvas = canvasRef.current;
|
|
175
|
+
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
176
|
+
if (!root.current) root.current = index.createRoot(canvas);
|
|
177
|
+
root.current.configure({
|
|
178
|
+
gl,
|
|
179
|
+
events,
|
|
180
|
+
shadows,
|
|
181
|
+
linear,
|
|
182
|
+
flat,
|
|
183
|
+
legacy,
|
|
184
|
+
orthographic,
|
|
185
|
+
frameloop,
|
|
186
|
+
dpr,
|
|
187
|
+
performance,
|
|
188
|
+
raycaster,
|
|
189
|
+
camera,
|
|
190
|
+
size: containerRect,
|
|
191
|
+
// Pass mutable reference to onPointerMissed so it's free to update
|
|
192
|
+
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
193
|
+
onCreated: state => {
|
|
194
|
+
// Connect to event source
|
|
195
|
+
state.events.connect == null ? void 0 : state.events.connect(eventSource ? index.isRef(eventSource) ? eventSource.current : eventSource : divRef.current);
|
|
196
|
+
// Set up compute function
|
|
197
|
+
if (eventPrefix) {
|
|
198
|
+
state.setEvents({
|
|
199
|
+
compute: (event, state) => {
|
|
200
|
+
const x = event[eventPrefix + 'X'];
|
|
201
|
+
const y = event[eventPrefix + 'Y'];
|
|
202
|
+
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
203
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
// Call onCreated callback
|
|
208
|
+
onCreated == null ? void 0 : onCreated(state);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
root.current.render( /*#__PURE__*/React__namespace.createElement(Bridge, null, /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
212
|
+
set: setError
|
|
213
|
+
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
214
|
+
fallback: /*#__PURE__*/React__namespace.createElement(index.Block, {
|
|
215
|
+
set: setBlock
|
|
216
|
+
})
|
|
217
|
+
}, children))));
|
|
218
|
+
}
|
|
219
|
+
});
|
|
221
220
|
React__namespace.useEffect(() => {
|
|
221
|
+
const canvas = canvasRef.current;
|
|
222
222
|
if (canvas) return () => index.unmountComponentAtNode(canvas);
|
|
223
|
-
}, [
|
|
223
|
+
}, []);
|
|
224
224
|
|
|
225
225
|
// When the event source is not this div, we need to set pointer-events to none
|
|
226
226
|
// Or else the canvas will block events from reaching the event source
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback, a as createRoot, i as isRef, E as ErrorBoundary, B as Block,
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal,
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, a as useIsomorphicLayoutEffect, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from './index-648b7c70.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from './index-648b7c70.esm.js';
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
@@ -133,7 +133,6 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
133
133
|
});
|
|
134
134
|
const canvasRef = React.useRef(null);
|
|
135
135
|
const divRef = React.useRef(null);
|
|
136
|
-
const [canvas, setCanvas] = React.useState(null);
|
|
137
136
|
React.useImperativeHandle(forwardedRef, () => canvasRef.current);
|
|
138
137
|
const handlePointerMissed = useMutableCallback(onPointerMissed);
|
|
139
138
|
const [block, setBlock] = React.useState(false);
|
|
@@ -144,56 +143,57 @@ const CanvasImpl = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
144
143
|
// Throw exception outwards if anything within canvas throws
|
|
145
144
|
if (error) throw error;
|
|
146
145
|
const root = React.useRef(null);
|
|
147
|
-
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
148
|
-
if (!root.current) root.current = createRoot(canvas);
|
|
149
|
-
root.current.configure({
|
|
150
|
-
gl,
|
|
151
|
-
events,
|
|
152
|
-
shadows,
|
|
153
|
-
linear,
|
|
154
|
-
flat,
|
|
155
|
-
legacy,
|
|
156
|
-
orthographic,
|
|
157
|
-
frameloop,
|
|
158
|
-
dpr,
|
|
159
|
-
performance,
|
|
160
|
-
raycaster,
|
|
161
|
-
camera,
|
|
162
|
-
size: containerRect,
|
|
163
|
-
// Pass mutable reference to onPointerMissed so it's free to update
|
|
164
|
-
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
165
|
-
onCreated: state => {
|
|
166
|
-
// Connect to event source
|
|
167
|
-
state.events.connect == null ? void 0 : state.events.connect(eventSource ? isRef(eventSource) ? eventSource.current : eventSource : divRef.current);
|
|
168
|
-
// Set up compute function
|
|
169
|
-
if (eventPrefix) {
|
|
170
|
-
state.setEvents({
|
|
171
|
-
compute: (event, state) => {
|
|
172
|
-
const x = event[eventPrefix + 'X'];
|
|
173
|
-
const y = event[eventPrefix + 'Y'];
|
|
174
|
-
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
175
|
-
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
// Call onCreated callback
|
|
180
|
-
onCreated == null ? void 0 : onCreated(state);
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
root.current.render( /*#__PURE__*/React.createElement(Bridge, null, /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
184
|
-
set: setError
|
|
185
|
-
}, /*#__PURE__*/React.createElement(React.Suspense, {
|
|
186
|
-
fallback: /*#__PURE__*/React.createElement(Block, {
|
|
187
|
-
set: setBlock
|
|
188
|
-
})
|
|
189
|
-
}, children))));
|
|
190
|
-
}
|
|
191
146
|
useIsomorphicLayoutEffect(() => {
|
|
192
|
-
|
|
193
|
-
|
|
147
|
+
const canvas = canvasRef.current;
|
|
148
|
+
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
149
|
+
if (!root.current) root.current = createRoot(canvas);
|
|
150
|
+
root.current.configure({
|
|
151
|
+
gl,
|
|
152
|
+
events,
|
|
153
|
+
shadows,
|
|
154
|
+
linear,
|
|
155
|
+
flat,
|
|
156
|
+
legacy,
|
|
157
|
+
orthographic,
|
|
158
|
+
frameloop,
|
|
159
|
+
dpr,
|
|
160
|
+
performance,
|
|
161
|
+
raycaster,
|
|
162
|
+
camera,
|
|
163
|
+
size: containerRect,
|
|
164
|
+
// Pass mutable reference to onPointerMissed so it's free to update
|
|
165
|
+
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
166
|
+
onCreated: state => {
|
|
167
|
+
// Connect to event source
|
|
168
|
+
state.events.connect == null ? void 0 : state.events.connect(eventSource ? isRef(eventSource) ? eventSource.current : eventSource : divRef.current);
|
|
169
|
+
// Set up compute function
|
|
170
|
+
if (eventPrefix) {
|
|
171
|
+
state.setEvents({
|
|
172
|
+
compute: (event, state) => {
|
|
173
|
+
const x = event[eventPrefix + 'X'];
|
|
174
|
+
const y = event[eventPrefix + 'Y'];
|
|
175
|
+
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
176
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
// Call onCreated callback
|
|
181
|
+
onCreated == null ? void 0 : onCreated(state);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
root.current.render( /*#__PURE__*/React.createElement(Bridge, null, /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
185
|
+
set: setError
|
|
186
|
+
}, /*#__PURE__*/React.createElement(React.Suspense, {
|
|
187
|
+
fallback: /*#__PURE__*/React.createElement(Block, {
|
|
188
|
+
set: setBlock
|
|
189
|
+
})
|
|
190
|
+
}, children))));
|
|
191
|
+
}
|
|
192
|
+
});
|
|
194
193
|
React.useEffect(() => {
|
|
194
|
+
const canvas = canvasRef.current;
|
|
195
195
|
if (canvas) return () => unmountComponentAtNode(canvas);
|
|
196
|
-
}, [
|
|
196
|
+
}, []);
|
|
197
197
|
|
|
198
198
|
// When the event source is not this div, we need to set pointer-events to none
|
|
199
199
|
// Or else the canvas will block events from reaching the event source
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as useMutableCallback,
|
|
2
|
-
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal,
|
|
1
|
+
import { c as createEvents, e as extend, u as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, d as unmountComponentAtNode } from '../../dist/index-648b7c70.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, f as context, c as createEvents, g as createPortal, b as createRoot, k as dispose, e as extend, q as flushGlobalEffects, s as getRootState, l as invalidate, h as reconciler, r as render, d as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-648b7c70.esm.js';
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|