@react-three/fiber 8.14.3 → 8.14.4
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 +94 -94
- package/dist/declarations/src/index.d.ts +12 -12
- package/dist/declarations/src/native/Canvas.d.ts +10 -10
- 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 +334 -334
- package/dist/declarations/src/web/Canvas.d.ts +13 -13
- package/dist/declarations/src/web/events.d.ts +4 -4
- package/native/dist/react-three-fiber-native.cjs.dev.js +46 -15
- package/native/dist/react-three-fiber-native.cjs.prod.js +46 -15
- package/native/dist/react-three-fiber-native.esm.js +47 -16
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Options as ResizeOptions } from 'react-use-measure';
|
|
3
|
-
import { RenderProps } from '../core';
|
|
4
|
-
export interface CanvasProps 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 interface Props extends CanvasProps {
|
|
12
|
-
}
|
|
13
|
-
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 CanvasProps 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 interface Props extends CanvasProps {
|
|
12
|
+
}
|
|
13
|
+
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>;
|
|
@@ -282,21 +282,6 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(p
|
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
function polyfills() {
|
|
285
|
-
// Patch Blob for ArrayBuffer if unsupported
|
|
286
|
-
try {
|
|
287
|
-
new Blob([new ArrayBuffer(4)]);
|
|
288
|
-
} catch (_) {
|
|
289
|
-
global.Blob = class extends Blob {
|
|
290
|
-
constructor(parts, options) {
|
|
291
|
-
super(parts == null ? void 0 : parts.map(part => {
|
|
292
|
-
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
293
|
-
part = base64Js.fromByteArray(new Uint8Array(part));
|
|
294
|
-
}
|
|
295
|
-
return part;
|
|
296
|
-
}), options);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
285
|
function uuidv4() {
|
|
301
286
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
302
287
|
const r = Math.random() * 16 | 0,
|
|
@@ -304,6 +289,52 @@ function polyfills() {
|
|
|
304
289
|
return v.toString(16);
|
|
305
290
|
});
|
|
306
291
|
}
|
|
292
|
+
|
|
293
|
+
// Patch Blob for ArrayBuffer if unsupported
|
|
294
|
+
if (reactNative.Platform.OS !== 'web') {
|
|
295
|
+
try {
|
|
296
|
+
new Blob([new ArrayBuffer(4)]);
|
|
297
|
+
} catch (_) {
|
|
298
|
+
const BlobManager = require('react-native/Libraries/Blob/BlobManager.js');
|
|
299
|
+
BlobManager.createFromParts = function createFromParts(parts, options) {
|
|
300
|
+
const blobId = uuidv4();
|
|
301
|
+
const items = parts.map(part => {
|
|
302
|
+
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
303
|
+
const data = base64Js.fromByteArray(new Uint8Array(part));
|
|
304
|
+
return {
|
|
305
|
+
data,
|
|
306
|
+
type: 'string'
|
|
307
|
+
};
|
|
308
|
+
} else if (part instanceof Blob) {
|
|
309
|
+
return {
|
|
310
|
+
data: part.data,
|
|
311
|
+
type: 'blob'
|
|
312
|
+
};
|
|
313
|
+
} else {
|
|
314
|
+
return {
|
|
315
|
+
data: String(part),
|
|
316
|
+
type: 'string'
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
const size = items.reduce((acc, curr) => {
|
|
321
|
+
if (curr.type === 'string') {
|
|
322
|
+
return acc + global.unescape(encodeURI(curr.data)).length;
|
|
323
|
+
} else {
|
|
324
|
+
return acc + curr.data.size;
|
|
325
|
+
}
|
|
326
|
+
}, 0);
|
|
327
|
+
reactNative.NativeModules.BlobModule.createFromParts(items, blobId);
|
|
328
|
+
return BlobManager.createFromOptions({
|
|
329
|
+
blobId,
|
|
330
|
+
offset: 0,
|
|
331
|
+
size,
|
|
332
|
+
type: options ? options.type : '',
|
|
333
|
+
lastModified: options ? options.lastModified : Date.now()
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
307
338
|
async function getAsset(input) {
|
|
308
339
|
if (typeof input === 'string') {
|
|
309
340
|
// Don't process storage or data uris
|
|
@@ -282,21 +282,6 @@ const Canvas = /*#__PURE__*/React__namespace.forwardRef(function CanvasWrapper(p
|
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
function polyfills() {
|
|
285
|
-
// Patch Blob for ArrayBuffer if unsupported
|
|
286
|
-
try {
|
|
287
|
-
new Blob([new ArrayBuffer(4)]);
|
|
288
|
-
} catch (_) {
|
|
289
|
-
global.Blob = class extends Blob {
|
|
290
|
-
constructor(parts, options) {
|
|
291
|
-
super(parts == null ? void 0 : parts.map(part => {
|
|
292
|
-
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
293
|
-
part = base64Js.fromByteArray(new Uint8Array(part));
|
|
294
|
-
}
|
|
295
|
-
return part;
|
|
296
|
-
}), options);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
285
|
function uuidv4() {
|
|
301
286
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
302
287
|
const r = Math.random() * 16 | 0,
|
|
@@ -304,6 +289,52 @@ function polyfills() {
|
|
|
304
289
|
return v.toString(16);
|
|
305
290
|
});
|
|
306
291
|
}
|
|
292
|
+
|
|
293
|
+
// Patch Blob for ArrayBuffer if unsupported
|
|
294
|
+
if (reactNative.Platform.OS !== 'web') {
|
|
295
|
+
try {
|
|
296
|
+
new Blob([new ArrayBuffer(4)]);
|
|
297
|
+
} catch (_) {
|
|
298
|
+
const BlobManager = require('react-native/Libraries/Blob/BlobManager.js');
|
|
299
|
+
BlobManager.createFromParts = function createFromParts(parts, options) {
|
|
300
|
+
const blobId = uuidv4();
|
|
301
|
+
const items = parts.map(part => {
|
|
302
|
+
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
303
|
+
const data = base64Js.fromByteArray(new Uint8Array(part));
|
|
304
|
+
return {
|
|
305
|
+
data,
|
|
306
|
+
type: 'string'
|
|
307
|
+
};
|
|
308
|
+
} else if (part instanceof Blob) {
|
|
309
|
+
return {
|
|
310
|
+
data: part.data,
|
|
311
|
+
type: 'blob'
|
|
312
|
+
};
|
|
313
|
+
} else {
|
|
314
|
+
return {
|
|
315
|
+
data: String(part),
|
|
316
|
+
type: 'string'
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
const size = items.reduce((acc, curr) => {
|
|
321
|
+
if (curr.type === 'string') {
|
|
322
|
+
return acc + global.unescape(encodeURI(curr.data)).length;
|
|
323
|
+
} else {
|
|
324
|
+
return acc + curr.data.size;
|
|
325
|
+
}
|
|
326
|
+
}, 0);
|
|
327
|
+
reactNative.NativeModules.BlobModule.createFromParts(items, blobId);
|
|
328
|
+
return BlobManager.createFromOptions({
|
|
329
|
+
blobId,
|
|
330
|
+
offset: 0,
|
|
331
|
+
size,
|
|
332
|
+
type: options ? options.type : '',
|
|
333
|
+
lastModified: options ? options.lastModified : Date.now()
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
307
338
|
async function getAsset(input) {
|
|
308
339
|
if (typeof input === 'string') {
|
|
309
340
|
// Don't process storage or data uris
|
|
@@ -3,7 +3,7 @@ export { t as ReactThreeFiber, w as _roots, v as act, o as addAfterEffect, n as
|
|
|
3
3
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
|
-
import { PanResponder, PixelRatio, View, StyleSheet, Image } from 'react-native';
|
|
6
|
+
import { PanResponder, PixelRatio, View, StyleSheet, Platform, NativeModules, Image } from 'react-native';
|
|
7
7
|
import { GLView } from 'expo-gl';
|
|
8
8
|
import { FiberProvider, useContextBridge } from 'its-fine';
|
|
9
9
|
import { Asset } from 'expo-asset';
|
|
@@ -257,21 +257,6 @@ const Canvas = /*#__PURE__*/React.forwardRef(function CanvasWrapper(props, ref)
|
|
|
257
257
|
});
|
|
258
258
|
|
|
259
259
|
function polyfills() {
|
|
260
|
-
// Patch Blob for ArrayBuffer if unsupported
|
|
261
|
-
try {
|
|
262
|
-
new Blob([new ArrayBuffer(4)]);
|
|
263
|
-
} catch (_) {
|
|
264
|
-
global.Blob = class extends Blob {
|
|
265
|
-
constructor(parts, options) {
|
|
266
|
-
super(parts == null ? void 0 : parts.map(part => {
|
|
267
|
-
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
268
|
-
part = fromByteArray(new Uint8Array(part));
|
|
269
|
-
}
|
|
270
|
-
return part;
|
|
271
|
-
}), options);
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
260
|
function uuidv4() {
|
|
276
261
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
277
262
|
const r = Math.random() * 16 | 0,
|
|
@@ -279,6 +264,52 @@ function polyfills() {
|
|
|
279
264
|
return v.toString(16);
|
|
280
265
|
});
|
|
281
266
|
}
|
|
267
|
+
|
|
268
|
+
// Patch Blob for ArrayBuffer if unsupported
|
|
269
|
+
if (Platform.OS !== 'web') {
|
|
270
|
+
try {
|
|
271
|
+
new Blob([new ArrayBuffer(4)]);
|
|
272
|
+
} catch (_) {
|
|
273
|
+
const BlobManager = require('react-native/Libraries/Blob/BlobManager.js');
|
|
274
|
+
BlobManager.createFromParts = function createFromParts(parts, options) {
|
|
275
|
+
const blobId = uuidv4();
|
|
276
|
+
const items = parts.map(part => {
|
|
277
|
+
if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
|
|
278
|
+
const data = fromByteArray(new Uint8Array(part));
|
|
279
|
+
return {
|
|
280
|
+
data,
|
|
281
|
+
type: 'string'
|
|
282
|
+
};
|
|
283
|
+
} else if (part instanceof Blob) {
|
|
284
|
+
return {
|
|
285
|
+
data: part.data,
|
|
286
|
+
type: 'blob'
|
|
287
|
+
};
|
|
288
|
+
} else {
|
|
289
|
+
return {
|
|
290
|
+
data: String(part),
|
|
291
|
+
type: 'string'
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
const size = items.reduce((acc, curr) => {
|
|
296
|
+
if (curr.type === 'string') {
|
|
297
|
+
return acc + global.unescape(encodeURI(curr.data)).length;
|
|
298
|
+
} else {
|
|
299
|
+
return acc + curr.data.size;
|
|
300
|
+
}
|
|
301
|
+
}, 0);
|
|
302
|
+
NativeModules.BlobModule.createFromParts(items, blobId);
|
|
303
|
+
return BlobManager.createFromOptions({
|
|
304
|
+
blobId,
|
|
305
|
+
offset: 0,
|
|
306
|
+
size,
|
|
307
|
+
type: options ? options.type : '',
|
|
308
|
+
lastModified: options ? options.lastModified : Date.now()
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}
|
|
282
313
|
async function getAsset(input) {
|
|
283
314
|
if (typeof input === 'string') {
|
|
284
315
|
// Don't process storage or data uris
|