@react-three/fiber 8.15.7 → 8.15.9

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @react-three/fiber
2
2
 
3
+ ## 8.15.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 4cbc5530: fix(native): deopt iOS blob URI path
8
+
9
+ ## 8.15.8
10
+
11
+ ### Patch Changes
12
+
13
+ - 70680832: fix: revert stable sort
14
+
3
15
  ## 8.15.7
4
16
 
5
17
  ### Patch Changes
@@ -86,7 +86,7 @@ export interface PointerCaptureTarget {
86
86
  intersection: Intersection;
87
87
  target: Element;
88
88
  }
89
- export declare function getEventPriority(): 1 | 4 | 16;
89
+ export declare function getEventPriority(): 1 | 16 | 4;
90
90
  export declare function removeInteractivity(store: UseBoundStore<RootState>, object: THREE.Object3D): void;
91
91
  export declare function createEvents(store: UseBoundStore<RootState>): {
92
92
  handlePointer: (name: string) => (event: DomEvent) => void;
@@ -10,7 +10,7 @@ export declare type _XRFrame = THREE.WebGLRenderTargetOptions extends {
10
10
  /**
11
11
  * Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
12
12
  */
13
- export declare const hasColorSpace: <T extends object | THREE.Texture | Renderer, P = T extends Renderer ? {
13
+ export declare const hasColorSpace: <T extends object | Renderer | THREE.Texture, P = T extends Renderer ? {
14
14
  outputColorSpace: string;
15
15
  } : {
16
16
  colorSpace: string;
@@ -100,11 +100,7 @@ function createRenderer(_roots, _getEventPriority) {
100
100
  parentInstance.children = [...restSiblings.slice(0, index), child, ...restSiblings.slice(index)];
101
101
  added = true;
102
102
  }
103
- const objects = (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects;
104
- if (!added && objects) {
105
- const index = objects.indexOf(beforeChild);
106
- if (index !== -1) objects.splice(index, 0, child);else objects.push(child);
107
- }
103
+ if (!added) (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects.push(child);
108
104
  if (!child.__r3f) prepare(child, {});
109
105
  child.__r3f.parent = parentInstance;
110
106
  updateInstance(child);
@@ -120,11 +116,7 @@ function createRenderer(_roots, _getEventPriority) {
120
116
  // Clear the parent reference
121
117
  if (child.__r3f) child.__r3f.parent = null;
122
118
  // Remove child from the parents objects
123
- const objects = (_parentInstance$__r3f3 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f3.objects;
124
- if (objects) {
125
- const index = objects.indexOf(child);
126
- if (index !== -1) objects.splice(index, 1);
127
- }
119
+ if ((_parentInstance$__r3f3 = parentInstance.__r3f) != null && _parentInstance$__r3f3.objects) parentInstance.__r3f.objects = parentInstance.__r3f.objects.filter(x => x !== child);
128
120
  // Remove attachment
129
121
  if ((_child$__r3f3 = child.__r3f) != null && _child$__r3f3.attach) {
130
122
  detach(parentInstance, child, child.__r3f.attach);
@@ -190,14 +182,13 @@ function createRenderer(_roots, _getEventPriority) {
190
182
  }
191
183
  instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
192
184
  instance.__r3f.objects = [];
193
- const autoRemovedBeforeAppend = !!newInstance.parent;
194
185
  if (!instance.__r3f.autoRemovedBeforeAppend) {
195
- insertBefore(parent, newInstance, instance);
196
186
  removeChild(parent, instance);
197
- } else {
198
- appendChild(parent, newInstance);
199
187
  }
200
- newInstance.__r3f.autoRemovedBeforeAppend = autoRemovedBeforeAppend;
188
+ if (newInstance.parent) {
189
+ newInstance.__r3f.autoRemovedBeforeAppend = true;
190
+ }
191
+ appendChild(parent, newInstance);
201
192
 
202
193
  // Re-bind event handlers
203
194
  if (newInstance.raycast && newInstance.__r3f.eventCount) {
@@ -127,11 +127,7 @@ function createRenderer(_roots, _getEventPriority) {
127
127
  parentInstance.children = [...restSiblings.slice(0, index), child, ...restSiblings.slice(index)];
128
128
  added = true;
129
129
  }
130
- const objects = (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects;
131
- if (!added && objects) {
132
- const index = objects.indexOf(beforeChild);
133
- if (index !== -1) objects.splice(index, 0, child);else objects.push(child);
134
- }
130
+ if (!added) (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects.push(child);
135
131
  if (!child.__r3f) prepare(child, {});
136
132
  child.__r3f.parent = parentInstance;
137
133
  updateInstance(child);
@@ -147,11 +143,7 @@ function createRenderer(_roots, _getEventPriority) {
147
143
  // Clear the parent reference
148
144
  if (child.__r3f) child.__r3f.parent = null;
149
145
  // Remove child from the parents objects
150
- const objects = (_parentInstance$__r3f3 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f3.objects;
151
- if (objects) {
152
- const index = objects.indexOf(child);
153
- if (index !== -1) objects.splice(index, 1);
154
- }
146
+ if ((_parentInstance$__r3f3 = parentInstance.__r3f) != null && _parentInstance$__r3f3.objects) parentInstance.__r3f.objects = parentInstance.__r3f.objects.filter(x => x !== child);
155
147
  // Remove attachment
156
148
  if ((_child$__r3f3 = child.__r3f) != null && _child$__r3f3.attach) {
157
149
  detach(parentInstance, child, child.__r3f.attach);
@@ -217,14 +209,13 @@ function createRenderer(_roots, _getEventPriority) {
217
209
  }
218
210
  instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
219
211
  instance.__r3f.objects = [];
220
- const autoRemovedBeforeAppend = !!newInstance.parent;
221
212
  if (!instance.__r3f.autoRemovedBeforeAppend) {
222
- insertBefore(parent, newInstance, instance);
223
213
  removeChild(parent, instance);
224
- } else {
225
- appendChild(parent, newInstance);
226
214
  }
227
- newInstance.__r3f.autoRemovedBeforeAppend = autoRemovedBeforeAppend;
215
+ if (newInstance.parent) {
216
+ newInstance.__r3f.autoRemovedBeforeAppend = true;
217
+ }
218
+ appendChild(parent, newInstance);
228
219
 
229
220
  // Re-bind event handlers
230
221
  if (newInstance.raycast && newInstance.__r3f.eventCount) {
@@ -127,11 +127,7 @@ function createRenderer(_roots, _getEventPriority) {
127
127
  parentInstance.children = [...restSiblings.slice(0, index), child, ...restSiblings.slice(index)];
128
128
  added = true;
129
129
  }
130
- const objects = (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects;
131
- if (!added && objects) {
132
- const index = objects.indexOf(beforeChild);
133
- if (index !== -1) objects.splice(index, 0, child);else objects.push(child);
134
- }
130
+ if (!added) (_parentInstance$__r3f2 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f2.objects.push(child);
135
131
  if (!child.__r3f) prepare(child, {});
136
132
  child.__r3f.parent = parentInstance;
137
133
  updateInstance(child);
@@ -147,11 +143,7 @@ function createRenderer(_roots, _getEventPriority) {
147
143
  // Clear the parent reference
148
144
  if (child.__r3f) child.__r3f.parent = null;
149
145
  // Remove child from the parents objects
150
- const objects = (_parentInstance$__r3f3 = parentInstance.__r3f) == null ? void 0 : _parentInstance$__r3f3.objects;
151
- if (objects) {
152
- const index = objects.indexOf(child);
153
- if (index !== -1) objects.splice(index, 1);
154
- }
146
+ if ((_parentInstance$__r3f3 = parentInstance.__r3f) != null && _parentInstance$__r3f3.objects) parentInstance.__r3f.objects = parentInstance.__r3f.objects.filter(x => x !== child);
155
147
  // Remove attachment
156
148
  if ((_child$__r3f3 = child.__r3f) != null && _child$__r3f3.attach) {
157
149
  detach(parentInstance, child, child.__r3f.attach);
@@ -217,14 +209,13 @@ function createRenderer(_roots, _getEventPriority) {
217
209
  }
218
210
  instance.__r3f.objects.forEach(child => appendChild(newInstance, child));
219
211
  instance.__r3f.objects = [];
220
- const autoRemovedBeforeAppend = !!newInstance.parent;
221
212
  if (!instance.__r3f.autoRemovedBeforeAppend) {
222
- insertBefore(parent, newInstance, instance);
223
213
  removeChild(parent, instance);
224
- } else {
225
- appendChild(parent, newInstance);
226
214
  }
227
- newInstance.__r3f.autoRemovedBeforeAppend = autoRemovedBeforeAppend;
215
+ if (newInstance.parent) {
216
+ newInstance.__r3f.autoRemovedBeforeAppend = true;
217
+ }
218
+ appendChild(parent, newInstance);
228
219
 
229
220
  // Re-bind event handlers
230
221
  if (newInstance.raycast && newInstance.__r3f.eventCount) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-9bf2e8aa.cjs.dev.js');
5
+ var index = require('./index-d26c5c57.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-66b6e976.cjs.prod.js');
5
+ var index = require('./index-e6d64601.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-a2103d81.esm.js';
2
- export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, 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, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-a2103d81.esm.js';
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-594193f5.esm.js';
2
+ export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, 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, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from './index-594193f5.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-9bf2e8aa.cjs.dev.js');
5
+ var index = require('../../dist/index-d26c5c57.cjs.dev.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -363,7 +363,6 @@ function polyfills() {
363
363
  };
364
364
  const createFromParts = BlobManager.createFromParts;
365
365
  BlobManager.createFromParts = function (parts, options) {
366
- var _NativeModules$BlobMo2;
367
366
  parts = parts.map(part => {
368
367
  if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
369
368
  part = base64Js.fromByteArray(new Uint8Array(part));
@@ -371,13 +370,17 @@ function polyfills() {
371
370
  return part;
372
371
  });
373
372
  const blob = createFromParts(parts, options);
374
- if (!((_NativeModules$BlobMo2 = reactNative.NativeModules.BlobModule) != null && _NativeModules$BlobMo2.BLOB_URI_SCHEME)) {
375
- blob.data._base64 = '';
376
- for (const part of parts) {
377
- var _data$_base, _data;
378
- blob.data._base64 += (_data$_base = (_data = part.data) == null ? void 0 : _data._base64) != null ? _data$_base : part;
379
- }
373
+
374
+ // Always enable slow but safe path for iOS (previously for Android unauth)
375
+ // https://github.com/pmndrs/react-three-fiber/issues/3075
376
+ // if (!NativeModules.BlobModule?.BLOB_URI_SCHEME) {
377
+ blob.data._base64 = '';
378
+ for (const part of parts) {
379
+ var _data$_base, _data;
380
+ blob.data._base64 += (_data$_base = (_data = part.data) == null ? void 0 : _data._base64) != null ? _data$_base : part;
380
381
  }
382
+ // }
383
+
381
384
  return blob;
382
385
  };
383
386
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../dist/index-66b6e976.cjs.prod.js');
5
+ var index = require('../../dist/index-e6d64601.cjs.prod.js');
6
6
  var _extends = require('@babel/runtime/helpers/extends');
7
7
  var React = require('react');
8
8
  var THREE = require('three');
@@ -363,7 +363,6 @@ function polyfills() {
363
363
  };
364
364
  const createFromParts = BlobManager.createFromParts;
365
365
  BlobManager.createFromParts = function (parts, options) {
366
- var _NativeModules$BlobMo2;
367
366
  parts = parts.map(part => {
368
367
  if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
369
368
  part = base64Js.fromByteArray(new Uint8Array(part));
@@ -371,13 +370,17 @@ function polyfills() {
371
370
  return part;
372
371
  });
373
372
  const blob = createFromParts(parts, options);
374
- if (!((_NativeModules$BlobMo2 = reactNative.NativeModules.BlobModule) != null && _NativeModules$BlobMo2.BLOB_URI_SCHEME)) {
375
- blob.data._base64 = '';
376
- for (const part of parts) {
377
- var _data$_base, _data;
378
- blob.data._base64 += (_data$_base = (_data = part.data) == null ? void 0 : _data._base64) != null ? _data$_base : part;
379
- }
373
+
374
+ // Always enable slow but safe path for iOS (previously for Android unauth)
375
+ // https://github.com/pmndrs/react-three-fiber/issues/3075
376
+ // if (!NativeModules.BlobModule?.BLOB_URI_SCHEME) {
377
+ blob.data._base64 = '';
378
+ for (const part of parts) {
379
+ var _data$_base, _data;
380
+ blob.data._base64 += (_data$_base = (_data = part.data) == null ? void 0 : _data._base64) != null ? _data$_base : part;
380
381
  }
382
+ // }
383
+
381
384
  return blob;
382
385
  };
383
386
  }
@@ -1,9 +1,9 @@
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-a2103d81.esm.js';
2
- export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, 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, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/index-a2103d81.esm.js';
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-594193f5.esm.js';
2
+ export { t as ReactThreeFiber, x as _roots, v as act, o as addAfterEffect, n as addEffect, p as addTail, m as advance, j as applyProps, w as buildGraph, 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, C as useFrame, D as useGraph, y as useInstanceHandle, F as useLoader, z as useStore, A as useThree } from '../../dist/index-594193f5.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';
6
- import { PanResponder, PixelRatio, View, StyleSheet, Platform, NativeModules, Image } from 'react-native';
6
+ import { PanResponder, PixelRatio, View, StyleSheet, Platform, Image, NativeModules } 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';
@@ -338,7 +338,6 @@ function polyfills() {
338
338
  };
339
339
  const createFromParts = BlobManager.createFromParts;
340
340
  BlobManager.createFromParts = function (parts, options) {
341
- var _NativeModules$BlobMo2;
342
341
  parts = parts.map(part => {
343
342
  if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
344
343
  part = fromByteArray(new Uint8Array(part));
@@ -346,13 +345,17 @@ function polyfills() {
346
345
  return part;
347
346
  });
348
347
  const blob = createFromParts(parts, options);
349
- if (!((_NativeModules$BlobMo2 = NativeModules.BlobModule) != null && _NativeModules$BlobMo2.BLOB_URI_SCHEME)) {
350
- blob.data._base64 = '';
351
- for (const part of parts) {
352
- var _data$_base, _data;
353
- blob.data._base64 += (_data$_base = (_data = part.data) == null ? void 0 : _data._base64) != null ? _data$_base : part;
354
- }
348
+
349
+ // Always enable slow but safe path for iOS (previously for Android unauth)
350
+ // https://github.com/pmndrs/react-three-fiber/issues/3075
351
+ // if (!NativeModules.BlobModule?.BLOB_URI_SCHEME) {
352
+ blob.data._base64 = '';
353
+ for (const part of parts) {
354
+ var _data$_base, _data;
355
+ blob.data._base64 += (_data$_base = (_data = part.data) == null ? void 0 : _data._base64) != null ? _data$_base : part;
355
356
  }
357
+ // }
358
+
356
359
  return blob;
357
360
  };
358
361
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "8.15.7",
3
+ "version": "8.15.9",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",