@react-three/fiber 8.11.9 → 8.11.10
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/declarations/src/core/events.d.ts +71 -71
- package/dist/declarations/src/core/hooks.d.ts +29 -29
- package/dist/declarations/src/core/index.d.ts +57 -57
- package/dist/declarations/src/core/loop.d.ts +14 -14
- package/dist/declarations/src/core/renderer.d.ts +58 -58
- package/dist/declarations/src/core/store.d.ts +95 -95
- package/dist/declarations/src/core/utils.d.ts +89 -89
- package/dist/declarations/src/index.d.ts +12 -12
- package/dist/declarations/src/native/Canvas.d.ts +8 -8
- package/dist/declarations/src/native/events.d.ts +4 -4
- package/dist/declarations/src/native/polyfills.d.ts +1 -1
- package/dist/declarations/src/native.d.ts +12 -12
- package/dist/declarations/src/three-types.d.ts +335 -335
- package/dist/declarations/src/web/Canvas.d.ts +11 -11
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/dist/{index-6b130504.esm.js → index-9cc932ed.esm.js} +26 -3
- package/dist/{index-a47b404f.cjs.prod.js → index-c5f9584c.cjs.prod.js} +26 -3
- package/dist/{index-4073a042.cjs.dev.js → index-cf981775.cjs.dev.js} +26 -3
- package/dist/react-three-fiber.cjs.dev.js +1 -1
- package/dist/react-three-fiber.cjs.prod.js +1 -1
- package/dist/react-three-fiber.esm.js +2 -2
- package/native/dist/react-three-fiber-native.cjs.dev.js +1 -1
- package/native/dist/react-three-fiber-native.cjs.prod.js +1 -1
- package/native/dist/react-three-fiber-native.esm.js +2 -2
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
-
import { RenderProps } from '../core';
|
|
4
|
-
export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
fallback?: React.ReactNode;
|
|
7
|
-
resize?: ResizeOptions;
|
|
8
|
-
eventSource?: HTMLElement | React.MutableRefObject<HTMLElement>;
|
|
9
|
-
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
10
|
-
}
|
|
11
|
-
export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
+
import { RenderProps } from '../core';
|
|
4
|
+
export interface Props extends Omit<RenderProps<HTMLCanvasElement>, 'size'>, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
fallback?: React.ReactNode;
|
|
7
|
+
resize?: ResizeOptions;
|
|
8
|
+
eventSource?: HTMLElement | React.MutableRefObject<HTMLElement>;
|
|
9
|
+
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen';
|
|
10
|
+
}
|
|
11
|
+
export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLCanvasElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseBoundStore } from 'zustand';
|
|
2
|
-
import { RootState } from '../core/store';
|
|
3
|
-
import { EventManager } from '../core/events';
|
|
4
|
-
export declare function createPointerEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
|
|
1
|
+
import { UseBoundStore } from 'zustand';
|
|
2
|
+
import { RootState } from '../core/store';
|
|
3
|
+
import { EventManager } from '../core/events';
|
|
4
|
+
export declare function createPointerEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
|
|
@@ -1066,9 +1066,16 @@ function createEvents(store) {
|
|
|
1066
1066
|
} = store.getState();
|
|
1067
1067
|
if ('pointerId' in event && internal.capturedMap.has(event.pointerId)) {
|
|
1068
1068
|
// If the object event interface had onLostPointerCapture, we'd call it here on every
|
|
1069
|
-
// object that's getting removed.
|
|
1070
|
-
|
|
1071
|
-
|
|
1069
|
+
// object that's getting removed. We call it on the next frame because onLostPointerCapture
|
|
1070
|
+
// fires before onPointerUp. Otherwise pointerUp would never be called if the event didn't
|
|
1071
|
+
// happen in the object it originated from, leaving components in a in-between state.
|
|
1072
|
+
requestAnimationFrame(() => {
|
|
1073
|
+
// Only release if pointer-up didn't do it already
|
|
1074
|
+
if (internal.capturedMap.has(event.pointerId)) {
|
|
1075
|
+
internal.capturedMap.delete(event.pointerId);
|
|
1076
|
+
cancelPointer([]);
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1072
1079
|
}
|
|
1073
1080
|
};
|
|
1074
1081
|
}
|
|
@@ -1113,6 +1120,22 @@ function createEvents(store) {
|
|
|
1113
1120
|
|
|
1114
1121
|
// Check presence of handlers
|
|
1115
1122
|
if (!(instance != null && instance.eventCount)) return;
|
|
1123
|
+
|
|
1124
|
+
/*
|
|
1125
|
+
MAYBE TODO, DELETE IF NOT:
|
|
1126
|
+
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1127
|
+
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1128
|
+
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1129
|
+
|
|
1130
|
+
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1131
|
+
if (pointerId !== undefined) {
|
|
1132
|
+
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1133
|
+
if (capturedMeshSet) {
|
|
1134
|
+
const captured = capturedMeshSet.get(eventObject)
|
|
1135
|
+
if (captured && captured.localState.stopped) return
|
|
1136
|
+
}
|
|
1137
|
+
}*/
|
|
1138
|
+
|
|
1116
1139
|
if (isPointerMove) {
|
|
1117
1140
|
// Move event ...
|
|
1118
1141
|
if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {
|
|
@@ -1093,9 +1093,16 @@ function createEvents(store) {
|
|
|
1093
1093
|
} = store.getState();
|
|
1094
1094
|
if ('pointerId' in event && internal.capturedMap.has(event.pointerId)) {
|
|
1095
1095
|
// If the object event interface had onLostPointerCapture, we'd call it here on every
|
|
1096
|
-
// object that's getting removed.
|
|
1097
|
-
|
|
1098
|
-
|
|
1096
|
+
// object that's getting removed. We call it on the next frame because onLostPointerCapture
|
|
1097
|
+
// fires before onPointerUp. Otherwise pointerUp would never be called if the event didn't
|
|
1098
|
+
// happen in the object it originated from, leaving components in a in-between state.
|
|
1099
|
+
requestAnimationFrame(() => {
|
|
1100
|
+
// Only release if pointer-up didn't do it already
|
|
1101
|
+
if (internal.capturedMap.has(event.pointerId)) {
|
|
1102
|
+
internal.capturedMap.delete(event.pointerId);
|
|
1103
|
+
cancelPointer([]);
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1099
1106
|
}
|
|
1100
1107
|
};
|
|
1101
1108
|
}
|
|
@@ -1140,6 +1147,22 @@ function createEvents(store) {
|
|
|
1140
1147
|
|
|
1141
1148
|
// Check presence of handlers
|
|
1142
1149
|
if (!(instance != null && instance.eventCount)) return;
|
|
1150
|
+
|
|
1151
|
+
/*
|
|
1152
|
+
MAYBE TODO, DELETE IF NOT:
|
|
1153
|
+
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1154
|
+
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1155
|
+
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1156
|
+
|
|
1157
|
+
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1158
|
+
if (pointerId !== undefined) {
|
|
1159
|
+
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1160
|
+
if (capturedMeshSet) {
|
|
1161
|
+
const captured = capturedMeshSet.get(eventObject)
|
|
1162
|
+
if (captured && captured.localState.stopped) return
|
|
1163
|
+
}
|
|
1164
|
+
}*/
|
|
1165
|
+
|
|
1143
1166
|
if (isPointerMove) {
|
|
1144
1167
|
// Move event ...
|
|
1145
1168
|
if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {
|
|
@@ -1093,9 +1093,16 @@ function createEvents(store) {
|
|
|
1093
1093
|
} = store.getState();
|
|
1094
1094
|
if ('pointerId' in event && internal.capturedMap.has(event.pointerId)) {
|
|
1095
1095
|
// If the object event interface had onLostPointerCapture, we'd call it here on every
|
|
1096
|
-
// object that's getting removed.
|
|
1097
|
-
|
|
1098
|
-
|
|
1096
|
+
// object that's getting removed. We call it on the next frame because onLostPointerCapture
|
|
1097
|
+
// fires before onPointerUp. Otherwise pointerUp would never be called if the event didn't
|
|
1098
|
+
// happen in the object it originated from, leaving components in a in-between state.
|
|
1099
|
+
requestAnimationFrame(() => {
|
|
1100
|
+
// Only release if pointer-up didn't do it already
|
|
1101
|
+
if (internal.capturedMap.has(event.pointerId)) {
|
|
1102
|
+
internal.capturedMap.delete(event.pointerId);
|
|
1103
|
+
cancelPointer([]);
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1099
1106
|
}
|
|
1100
1107
|
};
|
|
1101
1108
|
}
|
|
@@ -1140,6 +1147,22 @@ function createEvents(store) {
|
|
|
1140
1147
|
|
|
1141
1148
|
// Check presence of handlers
|
|
1142
1149
|
if (!(instance != null && instance.eventCount)) return;
|
|
1150
|
+
|
|
1151
|
+
/*
|
|
1152
|
+
MAYBE TODO, DELETE IF NOT:
|
|
1153
|
+
Check if the object is captured, captured events should not have intersects running in parallel
|
|
1154
|
+
But wouldn't it be better to just replace capturedMap with a single entry?
|
|
1155
|
+
Also, are we OK with straight up making picking up multiple objects impossible?
|
|
1156
|
+
|
|
1157
|
+
const pointerId = (data as ThreeEvent<PointerEvent>).pointerId
|
|
1158
|
+
if (pointerId !== undefined) {
|
|
1159
|
+
const capturedMeshSet = internal.capturedMap.get(pointerId)
|
|
1160
|
+
if (capturedMeshSet) {
|
|
1161
|
+
const captured = capturedMeshSet.get(eventObject)
|
|
1162
|
+
if (captured && captured.localState.stopped) return
|
|
1163
|
+
}
|
|
1164
|
+
}*/
|
|
1165
|
+
|
|
1143
1166
|
if (isPointerMove) {
|
|
1144
1167
|
// Move event ...
|
|
1145
1168
|
if (handlers.onPointerOver || handlers.onPointerEnter || handlers.onPointerOut || handlers.onPointerLeave) {
|
|
@@ -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-cf981775.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -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-c5f9584c.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-
|
|
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-9cc932ed.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-9cc932ed.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';
|
|
@@ -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-cf981775.cjs.dev.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -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-c5f9584c.cjs.prod.js');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var THREE = require('three');
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-
|
|
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-9cc932ed.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-9cc932ed.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';
|