@react-three/fiber 8.7.3 → 8.8.0
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 +12 -0
- package/dist/declarations/src/core/events.d.ts +1 -1
- package/dist/declarations/src/core/utils.d.ts +13 -0
- package/dist/{index-407f3d70.cjs.dev.js → index-a38b08b7.cjs.dev.js} +91 -3
- package/dist/{index-05f8627d.esm.js → index-f01196c6.esm.js} +90 -4
- package/dist/{index-5350eaac.cjs.prod.js → index-fb8e3829.cjs.prod.js} +91 -3
- package/dist/react-three-fiber.cjs.dev.js +9 -5
- package/dist/react-three-fiber.cjs.prod.js +9 -5
- package/dist/react-three-fiber.esm.js +10 -6
- package/native/dist/react-three-fiber-native.cjs.dev.js +9 -5
- package/native/dist/react-three-fiber-native.cjs.prod.js +9 -5
- package/native/dist/react-three-fiber-native.esm.js +10 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -62,7 +62,7 @@ export interface PointerCaptureTarget {
|
|
|
62
62
|
intersection: Intersection;
|
|
63
63
|
target: Element;
|
|
64
64
|
}
|
|
65
|
-
export declare function getEventPriority(): 1 |
|
|
65
|
+
export declare function getEventPriority(): 1 | 16 | 4;
|
|
66
66
|
export declare function removeInteractivity(store: UseBoundStore<RootState>, object: THREE.Object3D): void;
|
|
67
67
|
export declare function createEvents(store: UseBoundStore<RootState>): {
|
|
68
68
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
@@ -2,11 +2,24 @@ import * as THREE from 'three';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { AttachType, Instance, InstanceProps, LocalState } from './renderer';
|
|
4
4
|
import { Dpr, RootState, Size } from './store';
|
|
5
|
+
import type { Fiber } from 'react-reconciler';
|
|
5
6
|
export declare type Camera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
|
|
6
7
|
export declare const isOrthographicCamera: (def: Camera) => def is THREE.OrthographicCamera;
|
|
7
8
|
export declare const isRef: (obj: any) => obj is React.MutableRefObject<unknown>;
|
|
8
9
|
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
9
10
|
export declare function useMutableCallback<T>(fn: T): React.MutableRefObject<T>;
|
|
11
|
+
export declare type ContextBridge = React.FC<{
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function useContextBridge(fiber?: Fiber): ContextBridge;
|
|
15
|
+
export declare class FiberProvider extends React.Component<{
|
|
16
|
+
setFiber: React.Dispatch<Fiber>;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}> {
|
|
19
|
+
private _reactInternals;
|
|
20
|
+
componentDidMount(): void;
|
|
21
|
+
render(): React.ReactNode;
|
|
22
|
+
}
|
|
10
23
|
export declare type SetBlock = false | Promise<null> | null;
|
|
11
24
|
export declare type UnblockProps = {
|
|
12
25
|
set: React.Dispatch<React.SetStateAction<SetBlock>>;
|
|
@@ -56,6 +56,87 @@ function useMutableCallback(fn) {
|
|
|
56
56
|
useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]);
|
|
57
57
|
return ref;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Traverses up or down a {@link Fiber}, return `true` to stop and select a node.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
function traverseFiber(fiber, ascending, selector) {
|
|
64
|
+
if (selector(fiber) === true) return fiber;
|
|
65
|
+
let child = ascending ? fiber.return : fiber.child;
|
|
66
|
+
|
|
67
|
+
while (child) {
|
|
68
|
+
const match = traverseFiber(child, ascending, selector);
|
|
69
|
+
if (match) return match;
|
|
70
|
+
child = child.sibling;
|
|
71
|
+
}
|
|
72
|
+
} // Active contexts
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
const contexts = [];
|
|
76
|
+
/**
|
|
77
|
+
* Represents a react-context bridge provider component.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* React Context currently cannot be shared across [React renderers](https://reactjs.org/docs/codebase-overview.html#renderers) but explicitly forwarded between providers (see [react#17275](https://github.com/facebook/react/issues/17275)). This hook returns a {@link ContextBridge} of live context providers to pierce Context across renderers.
|
|
82
|
+
*
|
|
83
|
+
* Pass {@link ContextBridge} as a component to a secondary renderer to enable context-sharing within its children.
|
|
84
|
+
*/
|
|
85
|
+
function useContextBridge(fiber) {
|
|
86
|
+
if (fiber) {
|
|
87
|
+
traverseFiber(fiber, true, node => {
|
|
88
|
+
var _node$type;
|
|
89
|
+
|
|
90
|
+
const context = (_node$type = node.type) == null ? void 0 : _node$type._context;
|
|
91
|
+
if (!context || contexts.includes(context)) return; // In development, React will warn about using contexts between renderers because
|
|
92
|
+
// of the above issue. We'll hide the warning because this hook works as expected
|
|
93
|
+
// https://github.com/facebook/react/pull/12779
|
|
94
|
+
|
|
95
|
+
Object.defineProperties(context, {
|
|
96
|
+
_currentRenderer: {
|
|
97
|
+
get() {
|
|
98
|
+
return null;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
set() {}
|
|
102
|
+
|
|
103
|
+
},
|
|
104
|
+
_currentRenderer2: {
|
|
105
|
+
get() {
|
|
106
|
+
return null;
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
set() {}
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
contexts.push(context);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return contexts.reduce((Prev, context) => {
|
|
118
|
+
var _SECRET_INTERNALS_DO;
|
|
119
|
+
|
|
120
|
+
const value = (_SECRET_INTERNALS_DO = React__namespace.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current) == null ? void 0 : _SECRET_INTERNALS_DO.readContext(context);
|
|
121
|
+
return props => /*#__PURE__*/React__namespace.createElement(Prev, null, /*#__PURE__*/React__namespace.createElement(context.Provider, { ...props,
|
|
122
|
+
value
|
|
123
|
+
}));
|
|
124
|
+
}, props => /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, props));
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Exposes the current react-internal {@link Fiber}.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
class FiberProvider extends React__namespace.Component {
|
|
131
|
+
componentDidMount() {
|
|
132
|
+
this.props.setFiber(this._reactInternals);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
render() {
|
|
136
|
+
return this.props.children;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
}
|
|
59
140
|
function Block({
|
|
60
141
|
set
|
|
61
142
|
}) {
|
|
@@ -90,7 +171,8 @@ ErrorBoundary.getDerivedStateFromError = () => ({
|
|
|
90
171
|
const DEFAULT = '__default';
|
|
91
172
|
const isDiffSet = def => def && !!def.memoized && !!def.changes;
|
|
92
173
|
function calculateDpr(dpr) {
|
|
93
|
-
|
|
174
|
+
const target = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
175
|
+
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
94
176
|
}
|
|
95
177
|
/**
|
|
96
178
|
* Returns instance root state
|
|
@@ -443,9 +525,13 @@ function makeId(event) {
|
|
|
443
525
|
|
|
444
526
|
|
|
445
527
|
function getEventPriority() {
|
|
446
|
-
var
|
|
528
|
+
var _globalScope$event;
|
|
447
529
|
|
|
448
|
-
|
|
530
|
+
// Get a handle to the current global scope in window and worker contexts if able
|
|
531
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2493
|
|
532
|
+
const globalScope = typeof self !== 'undefined' && self || typeof window !== 'undefined' && window;
|
|
533
|
+
if (!globalScope) return constants.DefaultEventPriority;
|
|
534
|
+
const name = (_globalScope$event = globalScope.event) == null ? void 0 : _globalScope$event.type;
|
|
449
535
|
|
|
450
536
|
switch (name) {
|
|
451
537
|
case 'click':
|
|
@@ -2162,6 +2248,7 @@ const act = React__namespace.unstable_act;
|
|
|
2162
2248
|
|
|
2163
2249
|
exports.Block = Block;
|
|
2164
2250
|
exports.ErrorBoundary = ErrorBoundary;
|
|
2251
|
+
exports.FiberProvider = FiberProvider;
|
|
2165
2252
|
exports.act = act;
|
|
2166
2253
|
exports.addAfterEffect = addAfterEffect;
|
|
2167
2254
|
exports.addEffect = addEffect;
|
|
@@ -2182,6 +2269,7 @@ exports.render = render;
|
|
|
2182
2269
|
exports.roots = roots;
|
|
2183
2270
|
exports.threeTypes = threeTypes;
|
|
2184
2271
|
exports.unmountComponentAtNode = unmountComponentAtNode;
|
|
2272
|
+
exports.useContextBridge = useContextBridge;
|
|
2185
2273
|
exports.useFrame = useFrame;
|
|
2186
2274
|
exports.useGraph = useGraph;
|
|
2187
2275
|
exports.useInstanceHandle = useInstanceHandle;
|
|
@@ -29,6 +29,87 @@ function useMutableCallback(fn) {
|
|
|
29
29
|
useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]);
|
|
30
30
|
return ref;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Traverses up or down a {@link Fiber}, return `true` to stop and select a node.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
function traverseFiber(fiber, ascending, selector) {
|
|
37
|
+
if (selector(fiber) === true) return fiber;
|
|
38
|
+
let child = ascending ? fiber.return : fiber.child;
|
|
39
|
+
|
|
40
|
+
while (child) {
|
|
41
|
+
const match = traverseFiber(child, ascending, selector);
|
|
42
|
+
if (match) return match;
|
|
43
|
+
child = child.sibling;
|
|
44
|
+
}
|
|
45
|
+
} // Active contexts
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const contexts = [];
|
|
49
|
+
/**
|
|
50
|
+
* Represents a react-context bridge provider component.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* React Context currently cannot be shared across [React renderers](https://reactjs.org/docs/codebase-overview.html#renderers) but explicitly forwarded between providers (see [react#17275](https://github.com/facebook/react/issues/17275)). This hook returns a {@link ContextBridge} of live context providers to pierce Context across renderers.
|
|
55
|
+
*
|
|
56
|
+
* Pass {@link ContextBridge} as a component to a secondary renderer to enable context-sharing within its children.
|
|
57
|
+
*/
|
|
58
|
+
function useContextBridge(fiber) {
|
|
59
|
+
if (fiber) {
|
|
60
|
+
traverseFiber(fiber, true, node => {
|
|
61
|
+
var _node$type;
|
|
62
|
+
|
|
63
|
+
const context = (_node$type = node.type) == null ? void 0 : _node$type._context;
|
|
64
|
+
if (!context || contexts.includes(context)) return; // In development, React will warn about using contexts between renderers because
|
|
65
|
+
// of the above issue. We'll hide the warning because this hook works as expected
|
|
66
|
+
// https://github.com/facebook/react/pull/12779
|
|
67
|
+
|
|
68
|
+
Object.defineProperties(context, {
|
|
69
|
+
_currentRenderer: {
|
|
70
|
+
get() {
|
|
71
|
+
return null;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
set() {}
|
|
75
|
+
|
|
76
|
+
},
|
|
77
|
+
_currentRenderer2: {
|
|
78
|
+
get() {
|
|
79
|
+
return null;
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
set() {}
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
contexts.push(context);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return contexts.reduce((Prev, context) => {
|
|
91
|
+
var _SECRET_INTERNALS_DO;
|
|
92
|
+
|
|
93
|
+
const value = (_SECRET_INTERNALS_DO = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current) == null ? void 0 : _SECRET_INTERNALS_DO.readContext(context);
|
|
94
|
+
return props => /*#__PURE__*/React.createElement(Prev, null, /*#__PURE__*/React.createElement(context.Provider, { ...props,
|
|
95
|
+
value
|
|
96
|
+
}));
|
|
97
|
+
}, props => /*#__PURE__*/React.createElement(React.Fragment, props));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Exposes the current react-internal {@link Fiber}.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
class FiberProvider extends React.Component {
|
|
104
|
+
componentDidMount() {
|
|
105
|
+
this.props.setFiber(this._reactInternals);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
render() {
|
|
109
|
+
return this.props.children;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
}
|
|
32
113
|
function Block({
|
|
33
114
|
set
|
|
34
115
|
}) {
|
|
@@ -63,7 +144,8 @@ ErrorBoundary.getDerivedStateFromError = () => ({
|
|
|
63
144
|
const DEFAULT = '__default';
|
|
64
145
|
const isDiffSet = def => def && !!def.memoized && !!def.changes;
|
|
65
146
|
function calculateDpr(dpr) {
|
|
66
|
-
|
|
147
|
+
const target = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
148
|
+
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
67
149
|
}
|
|
68
150
|
/**
|
|
69
151
|
* Returns instance root state
|
|
@@ -416,9 +498,13 @@ function makeId(event) {
|
|
|
416
498
|
|
|
417
499
|
|
|
418
500
|
function getEventPriority() {
|
|
419
|
-
var
|
|
501
|
+
var _globalScope$event;
|
|
420
502
|
|
|
421
|
-
|
|
503
|
+
// Get a handle to the current global scope in window and worker contexts if able
|
|
504
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2493
|
|
505
|
+
const globalScope = typeof self !== 'undefined' && self || typeof window !== 'undefined' && window;
|
|
506
|
+
if (!globalScope) return DefaultEventPriority;
|
|
507
|
+
const name = (_globalScope$event = globalScope.event) == null ? void 0 : _globalScope$event.type;
|
|
422
508
|
|
|
423
509
|
switch (name) {
|
|
424
510
|
case 'click':
|
|
@@ -2133,4 +2219,4 @@ reconciler.injectIntoDevTools({
|
|
|
2133
2219
|
});
|
|
2134
2220
|
const act = React.unstable_act;
|
|
2135
2221
|
|
|
2136
|
-
export {
|
|
2222
|
+
export { useFrame as A, Block as B, useGraph as C, useLoader as D, ErrorBoundary as E, FiberProvider as F, useMutableCallback as a, createRoot as b, createEvents as c, useIsomorphicLayoutEffect as d, extend as e, unmountComponentAtNode as f, context as g, createPortal as h, isRef as i, reconciler as j, applyProps as k, dispose as l, invalidate as m, advance as n, addEffect as o, addAfterEffect as p, addTail as q, render as r, getRootState as s, threeTypes as t, useContextBridge as u, act as v, roots as w, useInstanceHandle as x, useStore as y, useThree as z };
|
|
@@ -56,6 +56,87 @@ function useMutableCallback(fn) {
|
|
|
56
56
|
useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]);
|
|
57
57
|
return ref;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Traverses up or down a {@link Fiber}, return `true` to stop and select a node.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
function traverseFiber(fiber, ascending, selector) {
|
|
64
|
+
if (selector(fiber) === true) return fiber;
|
|
65
|
+
let child = ascending ? fiber.return : fiber.child;
|
|
66
|
+
|
|
67
|
+
while (child) {
|
|
68
|
+
const match = traverseFiber(child, ascending, selector);
|
|
69
|
+
if (match) return match;
|
|
70
|
+
child = child.sibling;
|
|
71
|
+
}
|
|
72
|
+
} // Active contexts
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
const contexts = [];
|
|
76
|
+
/**
|
|
77
|
+
* Represents a react-context bridge provider component.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* React Context currently cannot be shared across [React renderers](https://reactjs.org/docs/codebase-overview.html#renderers) but explicitly forwarded between providers (see [react#17275](https://github.com/facebook/react/issues/17275)). This hook returns a {@link ContextBridge} of live context providers to pierce Context across renderers.
|
|
82
|
+
*
|
|
83
|
+
* Pass {@link ContextBridge} as a component to a secondary renderer to enable context-sharing within its children.
|
|
84
|
+
*/
|
|
85
|
+
function useContextBridge(fiber) {
|
|
86
|
+
if (fiber) {
|
|
87
|
+
traverseFiber(fiber, true, node => {
|
|
88
|
+
var _node$type;
|
|
89
|
+
|
|
90
|
+
const context = (_node$type = node.type) == null ? void 0 : _node$type._context;
|
|
91
|
+
if (!context || contexts.includes(context)) return; // In development, React will warn about using contexts between renderers because
|
|
92
|
+
// of the above issue. We'll hide the warning because this hook works as expected
|
|
93
|
+
// https://github.com/facebook/react/pull/12779
|
|
94
|
+
|
|
95
|
+
Object.defineProperties(context, {
|
|
96
|
+
_currentRenderer: {
|
|
97
|
+
get() {
|
|
98
|
+
return null;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
set() {}
|
|
102
|
+
|
|
103
|
+
},
|
|
104
|
+
_currentRenderer2: {
|
|
105
|
+
get() {
|
|
106
|
+
return null;
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
set() {}
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
contexts.push(context);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return contexts.reduce((Prev, context) => {
|
|
118
|
+
var _SECRET_INTERNALS_DO;
|
|
119
|
+
|
|
120
|
+
const value = (_SECRET_INTERNALS_DO = React__namespace.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current) == null ? void 0 : _SECRET_INTERNALS_DO.readContext(context);
|
|
121
|
+
return props => /*#__PURE__*/React__namespace.createElement(Prev, null, /*#__PURE__*/React__namespace.createElement(context.Provider, { ...props,
|
|
122
|
+
value
|
|
123
|
+
}));
|
|
124
|
+
}, props => /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, props));
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Exposes the current react-internal {@link Fiber}.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
class FiberProvider extends React__namespace.Component {
|
|
131
|
+
componentDidMount() {
|
|
132
|
+
this.props.setFiber(this._reactInternals);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
render() {
|
|
136
|
+
return this.props.children;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
}
|
|
59
140
|
function Block({
|
|
60
141
|
set
|
|
61
142
|
}) {
|
|
@@ -90,7 +171,8 @@ ErrorBoundary.getDerivedStateFromError = () => ({
|
|
|
90
171
|
const DEFAULT = '__default';
|
|
91
172
|
const isDiffSet = def => def && !!def.memoized && !!def.changes;
|
|
92
173
|
function calculateDpr(dpr) {
|
|
93
|
-
|
|
174
|
+
const target = typeof window !== 'undefined' ? window.devicePixelRatio : 1;
|
|
175
|
+
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
|
|
94
176
|
}
|
|
95
177
|
/**
|
|
96
178
|
* Returns instance root state
|
|
@@ -443,9 +525,13 @@ function makeId(event) {
|
|
|
443
525
|
|
|
444
526
|
|
|
445
527
|
function getEventPriority() {
|
|
446
|
-
var
|
|
528
|
+
var _globalScope$event;
|
|
447
529
|
|
|
448
|
-
|
|
530
|
+
// Get a handle to the current global scope in window and worker contexts if able
|
|
531
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2493
|
|
532
|
+
const globalScope = typeof self !== 'undefined' && self || typeof window !== 'undefined' && window;
|
|
533
|
+
if (!globalScope) return constants.DefaultEventPriority;
|
|
534
|
+
const name = (_globalScope$event = globalScope.event) == null ? void 0 : _globalScope$event.type;
|
|
449
535
|
|
|
450
536
|
switch (name) {
|
|
451
537
|
case 'click':
|
|
@@ -2162,6 +2248,7 @@ const act = React__namespace.unstable_act;
|
|
|
2162
2248
|
|
|
2163
2249
|
exports.Block = Block;
|
|
2164
2250
|
exports.ErrorBoundary = ErrorBoundary;
|
|
2251
|
+
exports.FiberProvider = FiberProvider;
|
|
2165
2252
|
exports.act = act;
|
|
2166
2253
|
exports.addAfterEffect = addAfterEffect;
|
|
2167
2254
|
exports.addEffect = addEffect;
|
|
@@ -2182,6 +2269,7 @@ exports.render = render;
|
|
|
2182
2269
|
exports.roots = roots;
|
|
2183
2270
|
exports.threeTypes = threeTypes;
|
|
2184
2271
|
exports.unmountComponentAtNode = unmountComponentAtNode;
|
|
2272
|
+
exports.useContextBridge = useContextBridge;
|
|
2185
2273
|
exports.useFrame = useFrame;
|
|
2186
2274
|
exports.useGraph = useGraph;
|
|
2187
2275
|
exports.useInstanceHandle = useInstanceHandle;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-a38b08b7.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -146,6 +146,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
146
146
|
// This will include the entire THREE namespace by default, users can extend
|
|
147
147
|
// their own elements by using the createRoot API instead
|
|
148
148
|
React__namespace.useMemo(() => index.extend(THREE__namespace), []);
|
|
149
|
+
const [fiber, setFiber] = React__namespace.useState(null);
|
|
150
|
+
const Bridge = index.useContextBridge(fiber);
|
|
149
151
|
const [containerRef, containerRect] = useMeasure__default["default"]({
|
|
150
152
|
scroll: true,
|
|
151
153
|
debounce: {
|
|
@@ -204,13 +206,13 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
204
206
|
onCreated == null ? void 0 : onCreated(state);
|
|
205
207
|
}
|
|
206
208
|
});
|
|
207
|
-
root.current.render( /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
209
|
+
root.current.render( /*#__PURE__*/React__namespace.createElement(Bridge, null, /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
208
210
|
set: setError
|
|
209
211
|
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
210
212
|
fallback: /*#__PURE__*/React__namespace.createElement(index.Block, {
|
|
211
213
|
set: setBlock
|
|
212
214
|
})
|
|
213
|
-
}, children)));
|
|
215
|
+
}, children))));
|
|
214
216
|
}
|
|
215
217
|
|
|
216
218
|
index.useIsomorphicLayoutEffect(() => {
|
|
@@ -222,7 +224,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
222
224
|
// Or else the canvas will block events from reaching the event source
|
|
223
225
|
|
|
224
226
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
225
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
227
|
+
return /*#__PURE__*/React__namespace.createElement(index.FiberProvider, {
|
|
228
|
+
setFiber: setFiber
|
|
229
|
+
}, /*#__PURE__*/React__namespace.createElement("div", _extends({
|
|
226
230
|
ref: divRef,
|
|
227
231
|
style: {
|
|
228
232
|
position: 'relative',
|
|
@@ -243,7 +247,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
243
247
|
style: {
|
|
244
248
|
display: 'block'
|
|
245
249
|
}
|
|
246
|
-
}, fallback)));
|
|
250
|
+
}, fallback))));
|
|
247
251
|
});
|
|
248
252
|
|
|
249
253
|
exports.ReactThreeFiber = index.threeTypes;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-fb8e3829.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -146,6 +146,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
146
146
|
// This will include the entire THREE namespace by default, users can extend
|
|
147
147
|
// their own elements by using the createRoot API instead
|
|
148
148
|
React__namespace.useMemo(() => index.extend(THREE__namespace), []);
|
|
149
|
+
const [fiber, setFiber] = React__namespace.useState(null);
|
|
150
|
+
const Bridge = index.useContextBridge(fiber);
|
|
149
151
|
const [containerRef, containerRect] = useMeasure__default["default"]({
|
|
150
152
|
scroll: true,
|
|
151
153
|
debounce: {
|
|
@@ -204,13 +206,13 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
204
206
|
onCreated == null ? void 0 : onCreated(state);
|
|
205
207
|
}
|
|
206
208
|
});
|
|
207
|
-
root.current.render( /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
209
|
+
root.current.render( /*#__PURE__*/React__namespace.createElement(Bridge, null, /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
208
210
|
set: setError
|
|
209
211
|
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
210
212
|
fallback: /*#__PURE__*/React__namespace.createElement(index.Block, {
|
|
211
213
|
set: setBlock
|
|
212
214
|
})
|
|
213
|
-
}, children)));
|
|
215
|
+
}, children))));
|
|
214
216
|
}
|
|
215
217
|
|
|
216
218
|
index.useIsomorphicLayoutEffect(() => {
|
|
@@ -222,7 +224,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
222
224
|
// Or else the canvas will block events from reaching the event source
|
|
223
225
|
|
|
224
226
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
225
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
227
|
+
return /*#__PURE__*/React__namespace.createElement(index.FiberProvider, {
|
|
228
|
+
setFiber: setFiber
|
|
229
|
+
}, /*#__PURE__*/React__namespace.createElement("div", _extends({
|
|
226
230
|
ref: divRef,
|
|
227
231
|
style: {
|
|
228
232
|
position: 'relative',
|
|
@@ -243,7 +247,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function Canvas({
|
|
|
243
247
|
style: {
|
|
244
248
|
display: 'block'
|
|
245
249
|
}
|
|
246
|
-
}, fallback)));
|
|
250
|
+
}, fallback))));
|
|
247
251
|
});
|
|
248
252
|
|
|
249
253
|
exports.ReactThreeFiber = index.threeTypes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as
|
|
2
|
-
export { t as ReactThreeFiber,
|
|
1
|
+
import { c as createEvents, e as extend, u as useContextBridge, a as useMutableCallback, b as createRoot, i as isRef, E as ErrorBoundary, B as Block, d as useIsomorphicLayoutEffect, f as unmountComponentAtNode, F as FiberProvider } from './index-f01196c6.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, p as addAfterEffect, o as addEffect, q as addTail, n as advance, k as applyProps, g as context, c as createEvents, h as createPortal, b as createRoot, l as dispose, e as extend, s as getRootState, m as invalidate, j as reconciler, r as render, f as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from './index-f01196c6.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';
|
|
@@ -119,6 +119,8 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
119
119
|
// This will include the entire THREE namespace by default, users can extend
|
|
120
120
|
// their own elements by using the createRoot API instead
|
|
121
121
|
React.useMemo(() => extend(THREE), []);
|
|
122
|
+
const [fiber, setFiber] = React.useState(null);
|
|
123
|
+
const Bridge = useContextBridge(fiber);
|
|
122
124
|
const [containerRef, containerRect] = useMeasure({
|
|
123
125
|
scroll: true,
|
|
124
126
|
debounce: {
|
|
@@ -177,13 +179,13 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
177
179
|
onCreated == null ? void 0 : onCreated(state);
|
|
178
180
|
}
|
|
179
181
|
});
|
|
180
|
-
root.current.render( /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
182
|
+
root.current.render( /*#__PURE__*/React.createElement(Bridge, null, /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
181
183
|
set: setError
|
|
182
184
|
}, /*#__PURE__*/React.createElement(React.Suspense, {
|
|
183
185
|
fallback: /*#__PURE__*/React.createElement(Block, {
|
|
184
186
|
set: setBlock
|
|
185
187
|
})
|
|
186
|
-
}, children)));
|
|
188
|
+
}, children))));
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -195,7 +197,9 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
195
197
|
// Or else the canvas will block events from reaching the event source
|
|
196
198
|
|
|
197
199
|
const pointerEvents = eventSource ? 'none' : 'auto';
|
|
198
|
-
return /*#__PURE__*/React.createElement(
|
|
200
|
+
return /*#__PURE__*/React.createElement(FiberProvider, {
|
|
201
|
+
setFiber: setFiber
|
|
202
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
199
203
|
ref: divRef,
|
|
200
204
|
style: {
|
|
201
205
|
position: 'relative',
|
|
@@ -216,7 +220,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(function Canvas({
|
|
|
216
220
|
style: {
|
|
217
221
|
display: 'block'
|
|
218
222
|
}
|
|
219
|
-
}, fallback)));
|
|
223
|
+
}, fallback))));
|
|
220
224
|
});
|
|
221
225
|
|
|
222
226
|
export { Canvas, createPointerEvents as events };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-a38b08b7.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -258,6 +258,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
258
258
|
// This will include the entire THREE namespace by default, users can extend
|
|
259
259
|
// their own elements by using the createRoot API instead
|
|
260
260
|
React__namespace.useMemo(() => index.extend(THREE__namespace), []);
|
|
261
|
+
const [fiber, setFiber] = React__namespace.useState(null);
|
|
262
|
+
const Bridge = index.useContextBridge(fiber);
|
|
261
263
|
const [{
|
|
262
264
|
width,
|
|
263
265
|
height,
|
|
@@ -354,13 +356,13 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
354
356
|
return onCreated == null ? void 0 : onCreated(state);
|
|
355
357
|
}
|
|
356
358
|
});
|
|
357
|
-
root.current.render( /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
359
|
+
root.current.render( /*#__PURE__*/React__namespace.createElement(Bridge, null, /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
358
360
|
set: setError
|
|
359
361
|
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
360
362
|
fallback: /*#__PURE__*/React__namespace.createElement(index.Block, {
|
|
361
363
|
set: setBlock
|
|
362
364
|
})
|
|
363
|
-
}, children)));
|
|
365
|
+
}, children))));
|
|
364
366
|
}
|
|
365
367
|
|
|
366
368
|
React__namespace.useEffect(() => {
|
|
@@ -368,7 +370,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
368
370
|
return () => index.unmountComponentAtNode(canvas);
|
|
369
371
|
}
|
|
370
372
|
}, [canvas]);
|
|
371
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
373
|
+
return /*#__PURE__*/React__namespace.createElement(index.FiberProvider, {
|
|
374
|
+
setFiber: setFiber
|
|
375
|
+
}, /*#__PURE__*/React__namespace.createElement(reactNative.View, _extends({}, props, {
|
|
372
376
|
ref: viewRef,
|
|
373
377
|
onLayout: onLayout,
|
|
374
378
|
style: {
|
|
@@ -378,7 +382,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
378
382
|
}, bind), width > 0 && /*#__PURE__*/React__namespace.createElement(expoGl.GLView, {
|
|
379
383
|
onContextCreate: onContextCreate,
|
|
380
384
|
style: reactNative.StyleSheet.absoluteFill
|
|
381
|
-
}));
|
|
385
|
+
})));
|
|
382
386
|
});
|
|
383
387
|
|
|
384
388
|
exports.ReactThreeFiber = index.threeTypes;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('../../dist/index-
|
|
5
|
+
var index = require('../../dist/index-fb8e3829.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -258,6 +258,8 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
258
258
|
// This will include the entire THREE namespace by default, users can extend
|
|
259
259
|
// their own elements by using the createRoot API instead
|
|
260
260
|
React__namespace.useMemo(() => index.extend(THREE__namespace), []);
|
|
261
|
+
const [fiber, setFiber] = React__namespace.useState(null);
|
|
262
|
+
const Bridge = index.useContextBridge(fiber);
|
|
261
263
|
const [{
|
|
262
264
|
width,
|
|
263
265
|
height,
|
|
@@ -354,13 +356,13 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
354
356
|
return onCreated == null ? void 0 : onCreated(state);
|
|
355
357
|
}
|
|
356
358
|
});
|
|
357
|
-
root.current.render( /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
359
|
+
root.current.render( /*#__PURE__*/React__namespace.createElement(Bridge, null, /*#__PURE__*/React__namespace.createElement(index.ErrorBoundary, {
|
|
358
360
|
set: setError
|
|
359
361
|
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
360
362
|
fallback: /*#__PURE__*/React__namespace.createElement(index.Block, {
|
|
361
363
|
set: setBlock
|
|
362
364
|
})
|
|
363
|
-
}, children)));
|
|
365
|
+
}, children))));
|
|
364
366
|
}
|
|
365
367
|
|
|
366
368
|
React__namespace.useEffect(() => {
|
|
@@ -368,7 +370,9 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
368
370
|
return () => index.unmountComponentAtNode(canvas);
|
|
369
371
|
}
|
|
370
372
|
}, [canvas]);
|
|
371
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
373
|
+
return /*#__PURE__*/React__namespace.createElement(index.FiberProvider, {
|
|
374
|
+
setFiber: setFiber
|
|
375
|
+
}, /*#__PURE__*/React__namespace.createElement(reactNative.View, _extends({}, props, {
|
|
372
376
|
ref: viewRef,
|
|
373
377
|
onLayout: onLayout,
|
|
374
378
|
style: {
|
|
@@ -378,7 +382,7 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(({
|
|
|
378
382
|
}, bind), width > 0 && /*#__PURE__*/React__namespace.createElement(expoGl.GLView, {
|
|
379
383
|
onContextCreate: onContextCreate,
|
|
380
384
|
style: reactNative.StyleSheet.absoluteFill
|
|
381
|
-
}));
|
|
385
|
+
})));
|
|
382
386
|
});
|
|
383
387
|
|
|
384
388
|
exports.ReactThreeFiber = index.threeTypes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createEvents, e as extend, u as
|
|
2
|
-
export { t as ReactThreeFiber,
|
|
1
|
+
import { c as createEvents, e as extend, u as useContextBridge, a as useMutableCallback, b as createRoot, E as ErrorBoundary, B as Block, f as unmountComponentAtNode, F as FiberProvider } from '../../dist/index-f01196c6.esm.js';
|
|
2
|
+
export { t as ReactThreeFiber, w as _roots, v as act, p as addAfterEffect, o as addEffect, q as addTail, n as advance, k as applyProps, g as context, h as createPortal, b as createRoot, l as dispose, e as extend, s as getRootState, m as invalidate, j as reconciler, r as render, f as unmountComponentAtNode, A as useFrame, C as useGraph, x as useInstanceHandle, D as useLoader, y as useStore, z as useThree } from '../../dist/index-f01196c6.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';
|
|
@@ -231,6 +231,8 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
231
231
|
// This will include the entire THREE namespace by default, users can extend
|
|
232
232
|
// their own elements by using the createRoot API instead
|
|
233
233
|
React.useMemo(() => extend(THREE), []);
|
|
234
|
+
const [fiber, setFiber] = React.useState(null);
|
|
235
|
+
const Bridge = useContextBridge(fiber);
|
|
234
236
|
const [{
|
|
235
237
|
width,
|
|
236
238
|
height,
|
|
@@ -327,13 +329,13 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
327
329
|
return onCreated == null ? void 0 : onCreated(state);
|
|
328
330
|
}
|
|
329
331
|
});
|
|
330
|
-
root.current.render( /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
332
|
+
root.current.render( /*#__PURE__*/React.createElement(Bridge, null, /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
331
333
|
set: setError
|
|
332
334
|
}, /*#__PURE__*/React.createElement(React.Suspense, {
|
|
333
335
|
fallback: /*#__PURE__*/React.createElement(Block, {
|
|
334
336
|
set: setBlock
|
|
335
337
|
})
|
|
336
|
-
}, children)));
|
|
338
|
+
}, children))));
|
|
337
339
|
}
|
|
338
340
|
|
|
339
341
|
React.useEffect(() => {
|
|
@@ -341,7 +343,9 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
341
343
|
return () => unmountComponentAtNode(canvas);
|
|
342
344
|
}
|
|
343
345
|
}, [canvas]);
|
|
344
|
-
return /*#__PURE__*/React.createElement(
|
|
346
|
+
return /*#__PURE__*/React.createElement(FiberProvider, {
|
|
347
|
+
setFiber: setFiber
|
|
348
|
+
}, /*#__PURE__*/React.createElement(View, _extends({}, props, {
|
|
345
349
|
ref: viewRef,
|
|
346
350
|
onLayout: onLayout,
|
|
347
351
|
style: {
|
|
@@ -351,7 +355,7 @@ const Canvas = /*#__PURE__*/React.forwardRef(({
|
|
|
351
355
|
}, bind), width > 0 && /*#__PURE__*/React.createElement(GLView, {
|
|
352
356
|
onContextCreate: onContextCreate,
|
|
353
357
|
style: StyleSheet.absoluteFill
|
|
354
|
-
}));
|
|
358
|
+
})));
|
|
355
359
|
});
|
|
356
360
|
|
|
357
361
|
export { Canvas, createTouchEvents as events };
|