@react-three/fiber 9.0.0-rc.3 → 9.0.0-rc.5
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 +1076 -1076
- package/dist/declarations/src/core/events.d.ts +91 -91
- package/dist/declarations/src/core/hooks.d.ts +51 -50
- package/dist/declarations/src/core/index.d.ts +13 -13
- package/dist/declarations/src/core/loop.d.ts +31 -31
- package/dist/declarations/src/core/reconciler.d.ts +52 -52
- package/dist/declarations/src/core/renderer.d.ts +89 -87
- package/dist/declarations/src/core/store.d.ts +130 -130
- package/dist/declarations/src/core/utils.d.ts +186 -185
- package/dist/declarations/src/index.d.ts +6 -6
- package/dist/declarations/src/native/Canvas.d.ts +13 -13
- package/dist/declarations/src/native/events.d.ts +4 -4
- package/dist/declarations/src/native.d.ts +6 -6
- package/dist/declarations/src/three-types.d.ts +62 -62
- package/dist/declarations/src/web/Canvas.d.ts +23 -23
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/dist/declarations/src/web/use-measure.d.ts +34 -34
- package/dist/{events-484fb9c5.cjs.prod.js → events-60ed2d7b.cjs.prod.js} +150 -134
- package/dist/{events-64d1e225.esm.js → events-a7b08b1a.esm.js} +151 -134
- package/dist/{events-c2452172.cjs.dev.js → events-b4061ace.cjs.dev.js} +150 -134
- package/dist/react-three-fiber.cjs.dev.js +51 -49
- package/dist/react-three-fiber.cjs.prod.js +51 -49
- package/dist/react-three-fiber.esm.js +52 -49
- package/native/package.json +5 -5
- package/package.json +88 -88
- package/readme.md +253 -253
- package/native/dist/react-three-fiber-native.cjs.d.ts +0 -2
- package/native/dist/react-three-fiber-native.cjs.dev.js +0 -550
- package/native/dist/react-three-fiber-native.cjs.js +0 -7
- package/native/dist/react-three-fiber-native.cjs.prod.js +0 -550
- package/native/dist/react-three-fiber-native.esm.js +0 -497
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var events = require('./events-
|
|
5
|
+
var events = require('./events-60ed2d7b.cjs.prod.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var THREE = require('three');
|
|
8
8
|
var createDebounce = require('debounce');
|
|
@@ -286,52 +286,55 @@ function CanvasImpl({
|
|
|
286
286
|
const canvas = canvasRef.current;
|
|
287
287
|
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
288
288
|
if (!root.current) root.current = events.createRoot(canvas);
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
289
|
+
async function run() {
|
|
290
|
+
await root.current.configure({
|
|
291
|
+
gl,
|
|
292
|
+
scene,
|
|
293
|
+
events: events$1,
|
|
294
|
+
shadows,
|
|
295
|
+
linear,
|
|
296
|
+
flat,
|
|
297
|
+
legacy,
|
|
298
|
+
orthographic,
|
|
299
|
+
frameloop,
|
|
300
|
+
dpr,
|
|
301
|
+
performance,
|
|
302
|
+
raycaster,
|
|
303
|
+
camera,
|
|
304
|
+
size: containerRect,
|
|
305
|
+
// Pass mutable reference to onPointerMissed so it's free to update
|
|
306
|
+
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
307
|
+
onCreated: state => {
|
|
308
|
+
// Connect to event source
|
|
309
|
+
state.events.connect == null ? void 0 : state.events.connect(eventSource ? events.isRef(eventSource) ? eventSource.current : eventSource : divRef.current);
|
|
310
|
+
// Set up compute function
|
|
311
|
+
if (eventPrefix) {
|
|
312
|
+
state.setEvents({
|
|
313
|
+
compute: (event, state) => {
|
|
314
|
+
const x = event[eventPrefix + 'X'];
|
|
315
|
+
const y = event[eventPrefix + 'Y'];
|
|
316
|
+
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
317
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
// Call onCreated callback
|
|
322
|
+
onCreated == null ? void 0 : onCreated(state);
|
|
319
323
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}),
|
|
331
|
-
children: children
|
|
324
|
+
});
|
|
325
|
+
root.current.render( /*#__PURE__*/jsxRuntime.jsx(Bridge, {
|
|
326
|
+
children: /*#__PURE__*/jsxRuntime.jsx(events.ErrorBoundary, {
|
|
327
|
+
set: setError,
|
|
328
|
+
children: /*#__PURE__*/jsxRuntime.jsx(React__namespace.Suspense, {
|
|
329
|
+
fallback: /*#__PURE__*/jsxRuntime.jsx(events.Block, {
|
|
330
|
+
set: setBlock
|
|
331
|
+
}),
|
|
332
|
+
children: children
|
|
333
|
+
})
|
|
332
334
|
})
|
|
333
|
-
})
|
|
334
|
-
}
|
|
335
|
+
}));
|
|
336
|
+
}
|
|
337
|
+
run();
|
|
335
338
|
}
|
|
336
339
|
});
|
|
337
340
|
React__namespace.useEffect(() => {
|
|
@@ -370,9 +373,9 @@ function CanvasImpl({
|
|
|
370
373
|
});
|
|
371
374
|
}
|
|
372
375
|
|
|
373
|
-
/**
|
|
374
|
-
* A DOM canvas which accepts threejs elements as children.
|
|
375
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
376
|
+
/**
|
|
377
|
+
* A DOM canvas which accepts threejs elements as children.
|
|
378
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
376
379
|
*/
|
|
377
380
|
function Canvas(props) {
|
|
378
381
|
return /*#__PURE__*/jsxRuntime.jsx(itsFine.FiberProvider, {
|
|
@@ -402,7 +405,6 @@ exports.flushGlobalEffects = events.flushGlobalEffects;
|
|
|
402
405
|
exports.getRootState = events.getRootState;
|
|
403
406
|
exports.invalidate = events.invalidate;
|
|
404
407
|
exports.reconciler = events.reconciler;
|
|
405
|
-
exports.render = events.render;
|
|
406
408
|
exports.unmountComponentAtNode = events.unmountComponentAtNode;
|
|
407
409
|
exports.useFrame = events.useFrame;
|
|
408
410
|
exports.useGraph = events.useGraph;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as extend, u as useBridge, a as useMutableCallback, b as useIsomorphicLayoutEffect, c as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents } from './events-
|
|
2
|
-
export { t as ReactThreeFiber, _ as _roots,
|
|
1
|
+
import { e as extend, u as useBridge, a as useMutableCallback, b as useIsomorphicLayoutEffect, c as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as unmountComponentAtNode, f as createPointerEvents } from './events-a7b08b1a.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, _ as _roots, w as act, k as addAfterEffect, j as addEffect, l as addTail, n as advance, q as applyProps, x as buildGraph, p as context, g as createEvents, o as createPortal, c as createRoot, v as dispose, f as events, e as extend, h as flushGlobalEffects, s as getRootState, m as invalidate, r as reconciler, d as unmountComponentAtNode, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './events-a7b08b1a.esm.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
@@ -260,52 +260,55 @@ function CanvasImpl({
|
|
|
260
260
|
const canvas = canvasRef.current;
|
|
261
261
|
if (containerRect.width > 0 && containerRect.height > 0 && canvas) {
|
|
262
262
|
if (!root.current) root.current = createRoot(canvas);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
263
|
+
async function run() {
|
|
264
|
+
await root.current.configure({
|
|
265
|
+
gl,
|
|
266
|
+
scene,
|
|
267
|
+
events,
|
|
268
|
+
shadows,
|
|
269
|
+
linear,
|
|
270
|
+
flat,
|
|
271
|
+
legacy,
|
|
272
|
+
orthographic,
|
|
273
|
+
frameloop,
|
|
274
|
+
dpr,
|
|
275
|
+
performance,
|
|
276
|
+
raycaster,
|
|
277
|
+
camera,
|
|
278
|
+
size: containerRect,
|
|
279
|
+
// Pass mutable reference to onPointerMissed so it's free to update
|
|
280
|
+
onPointerMissed: (...args) => handlePointerMissed.current == null ? void 0 : handlePointerMissed.current(...args),
|
|
281
|
+
onCreated: state => {
|
|
282
|
+
// Connect to event source
|
|
283
|
+
state.events.connect == null ? void 0 : state.events.connect(eventSource ? isRef(eventSource) ? eventSource.current : eventSource : divRef.current);
|
|
284
|
+
// Set up compute function
|
|
285
|
+
if (eventPrefix) {
|
|
286
|
+
state.setEvents({
|
|
287
|
+
compute: (event, state) => {
|
|
288
|
+
const x = event[eventPrefix + 'X'];
|
|
289
|
+
const y = event[eventPrefix + 'Y'];
|
|
290
|
+
state.pointer.set(x / state.size.width * 2 - 1, -(y / state.size.height) * 2 + 1);
|
|
291
|
+
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
// Call onCreated callback
|
|
296
|
+
onCreated == null ? void 0 : onCreated(state);
|
|
293
297
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}),
|
|
305
|
-
children: children
|
|
298
|
+
});
|
|
299
|
+
root.current.render( /*#__PURE__*/jsx(Bridge, {
|
|
300
|
+
children: /*#__PURE__*/jsx(ErrorBoundary, {
|
|
301
|
+
set: setError,
|
|
302
|
+
children: /*#__PURE__*/jsx(React.Suspense, {
|
|
303
|
+
fallback: /*#__PURE__*/jsx(Block, {
|
|
304
|
+
set: setBlock
|
|
305
|
+
}),
|
|
306
|
+
children: children
|
|
307
|
+
})
|
|
306
308
|
})
|
|
307
|
-
})
|
|
308
|
-
}
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
311
|
+
run();
|
|
309
312
|
}
|
|
310
313
|
});
|
|
311
314
|
React.useEffect(() => {
|
|
@@ -344,9 +347,9 @@ function CanvasImpl({
|
|
|
344
347
|
});
|
|
345
348
|
}
|
|
346
349
|
|
|
347
|
-
/**
|
|
348
|
-
* A DOM canvas which accepts threejs elements as children.
|
|
349
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
350
|
+
/**
|
|
351
|
+
* A DOM canvas which accepts threejs elements as children.
|
|
352
|
+
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
350
353
|
*/
|
|
351
354
|
function Canvas(props) {
|
|
352
355
|
return /*#__PURE__*/jsx(FiberProvider, {
|
package/native/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"main": "dist/react-three-fiber-native.cjs.js",
|
|
3
|
-
"module": "dist/react-three-fiber-native.esm.js",
|
|
4
|
-
"types": "dist/react-three-fiber-native.cjs.d.ts"
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"main": "dist/react-three-fiber-native.cjs.js",
|
|
3
|
+
"module": "dist/react-three-fiber-native.esm.js",
|
|
4
|
+
"types": "dist/react-three-fiber-native.cjs.d.ts"
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@react-three/fiber",
|
|
3
|
-
"version": "9.0.0-rc.
|
|
4
|
-
"description": "A React renderer for Threejs",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"react",
|
|
7
|
-
"renderer",
|
|
8
|
-
"fiber",
|
|
9
|
-
"three",
|
|
10
|
-
"threejs"
|
|
11
|
-
],
|
|
12
|
-
"author": "Paul Henschel (https://github.com/drcmda)",
|
|
13
|
-
"license": "MIT",
|
|
14
|
-
"maintainers": [
|
|
15
|
-
"Josh Ellis (https://github.com/joshuaellis)",
|
|
16
|
-
"Cody Bennett (https://github.com/codyjasonbennett)"
|
|
17
|
-
],
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/pmndrs/react-three-fiber/issues"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://github.com/pmndrs/react-three-fiber#readme",
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/pmndrs/react-three-fiber.git"
|
|
25
|
-
},
|
|
26
|
-
"collective": {
|
|
27
|
-
"type": "opencollective",
|
|
28
|
-
"url": "https://opencollective.com/react-three-fiber"
|
|
29
|
-
},
|
|
30
|
-
"main": "dist/react-three-fiber.cjs.js",
|
|
31
|
-
"module": "dist/react-three-fiber.esm.js",
|
|
32
|
-
"types": "dist/react-three-fiber.cjs.d.ts",
|
|
33
|
-
"react-native": "native/dist/react-three-fiber-native.cjs.js",
|
|
34
|
-
"sideEffects": false,
|
|
35
|
-
"preconstruct": {
|
|
36
|
-
"entrypoints": [
|
|
37
|
-
"index.tsx",
|
|
38
|
-
"native.tsx"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"prebuild": "cp ../../readme.md readme.md"
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"@babel/runtime": "^7.17.8",
|
|
46
|
-
"@types/debounce": "^1.2.1",
|
|
47
|
-
"@types/react-reconciler": "^0.28.8",
|
|
48
|
-
"@types/webxr": "*",
|
|
49
|
-
"base64-js": "^1.5.1",
|
|
50
|
-
"buffer": "^6.0.3",
|
|
51
|
-
"debounce": "^1.2.1",
|
|
52
|
-
"its-fine": "^1.2.5",
|
|
53
|
-
"react-reconciler": "0.31.0",
|
|
54
|
-
"scheduler": "0.25.0",
|
|
55
|
-
"suspend-react": "^0.1.3",
|
|
56
|
-
"zustand": "^4.1.2"
|
|
57
|
-
},
|
|
58
|
-
"peerDependencies": {
|
|
59
|
-
"expo": ">=43.0",
|
|
60
|
-
"expo-asset": ">=8.4",
|
|
61
|
-
"expo-gl": ">=11.0",
|
|
62
|
-
"expo-file-system": ">=11.0",
|
|
63
|
-
"react": "^19.0.0",
|
|
64
|
-
"react-dom": "^19.0.0",
|
|
65
|
-
"react-native": ">=0.
|
|
66
|
-
"three": ">=0.156"
|
|
67
|
-
},
|
|
68
|
-
"peerDependenciesMeta": {
|
|
69
|
-
"react-dom": {
|
|
70
|
-
"optional": true
|
|
71
|
-
},
|
|
72
|
-
"react-native": {
|
|
73
|
-
"optional": true
|
|
74
|
-
},
|
|
75
|
-
"expo": {
|
|
76
|
-
"optional": true
|
|
77
|
-
},
|
|
78
|
-
"expo-asset": {
|
|
79
|
-
"optional": true
|
|
80
|
-
},
|
|
81
|
-
"expo-file-system": {
|
|
82
|
-
"optional": true
|
|
83
|
-
},
|
|
84
|
-
"expo-gl": {
|
|
85
|
-
"optional": true
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-three/fiber",
|
|
3
|
+
"version": "9.0.0-rc.5",
|
|
4
|
+
"description": "A React renderer for Threejs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"renderer",
|
|
8
|
+
"fiber",
|
|
9
|
+
"three",
|
|
10
|
+
"threejs"
|
|
11
|
+
],
|
|
12
|
+
"author": "Paul Henschel (https://github.com/drcmda)",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"maintainers": [
|
|
15
|
+
"Josh Ellis (https://github.com/joshuaellis)",
|
|
16
|
+
"Cody Bennett (https://github.com/codyjasonbennett)"
|
|
17
|
+
],
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/pmndrs/react-three-fiber/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/pmndrs/react-three-fiber#readme",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/pmndrs/react-three-fiber.git"
|
|
25
|
+
},
|
|
26
|
+
"collective": {
|
|
27
|
+
"type": "opencollective",
|
|
28
|
+
"url": "https://opencollective.com/react-three-fiber"
|
|
29
|
+
},
|
|
30
|
+
"main": "dist/react-three-fiber.cjs.js",
|
|
31
|
+
"module": "dist/react-three-fiber.esm.js",
|
|
32
|
+
"types": "dist/react-three-fiber.cjs.d.ts",
|
|
33
|
+
"react-native": "native/dist/react-three-fiber-native.cjs.js",
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"preconstruct": {
|
|
36
|
+
"entrypoints": [
|
|
37
|
+
"index.tsx",
|
|
38
|
+
"native.tsx"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"prebuild": "cp ../../readme.md readme.md"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@babel/runtime": "^7.17.8",
|
|
46
|
+
"@types/debounce": "^1.2.1",
|
|
47
|
+
"@types/react-reconciler": "^0.28.8",
|
|
48
|
+
"@types/webxr": "*",
|
|
49
|
+
"base64-js": "^1.5.1",
|
|
50
|
+
"buffer": "^6.0.3",
|
|
51
|
+
"debounce": "^1.2.1",
|
|
52
|
+
"its-fine": "^1.2.5",
|
|
53
|
+
"react-reconciler": "0.31.0",
|
|
54
|
+
"scheduler": "0.25.0",
|
|
55
|
+
"suspend-react": "^0.1.3",
|
|
56
|
+
"zustand": "^4.1.2"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"expo": ">=43.0",
|
|
60
|
+
"expo-asset": ">=8.4",
|
|
61
|
+
"expo-gl": ">=11.0",
|
|
62
|
+
"expo-file-system": ">=11.0",
|
|
63
|
+
"react": "^19.0.0",
|
|
64
|
+
"react-dom": "^19.0.0",
|
|
65
|
+
"react-native": ">=0.78",
|
|
66
|
+
"three": ">=0.156"
|
|
67
|
+
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"react-dom": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"react-native": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"expo": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"expo-asset": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"expo-file-system": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"expo-gl": {
|
|
85
|
+
"optional": true
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|