@react-three/fiber 8.15.7 → 8.15.8

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,11 @@
1
1
  # @react-three/fiber
2
2
 
3
+ ## 8.15.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 70680832: fix: revert stable sort
8
+
3
9
  ## 8.15.7
4
10
 
5
11
  ### 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');
@@ -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');
@@ -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-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';
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.8",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",