@react-three/fiber 7.0.24 → 7.0.25

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
+ ## 7.0.25
4
+
5
+ ### Patch Changes
6
+
7
+ - 8698734: Release latest patches
8
+
3
9
  ## 7.0.24
4
10
 
5
11
  ### Patch Changes
@@ -27,7 +27,10 @@ export interface NodeProps<T, P> {
27
27
  key?: React.Key;
28
28
  onUpdate?: (self: T) => void;
29
29
  }
30
- export declare type Node<T, P> = Overwrite<Partial<T>, NodeProps<T, P>>;
30
+ export declare type ExtendedColors<T> = {
31
+ [K in keyof T]: T[K] extends THREE.Color | undefined ? Color : T[K];
32
+ };
33
+ export declare type Node<T, P> = ExtendedColors<Overwrite<Partial<T>, NodeProps<T, P>>>;
31
34
  export declare type Object3DNode<T, P> = Overwrite<Node<T, P>, {
32
35
  position?: Vector3;
33
36
  up?: Vector3;
@@ -38,13 +41,9 @@ export declare type Object3DNode<T, P> = Overwrite<Node<T, P>, {
38
41
  layers?: Layers;
39
42
  dispose?: (() => void) | null;
40
43
  }> & EventHandlers;
41
- export declare type BufferGeometryNode<T extends THREE.BufferGeometry, P> = Overwrite<Node<T, P>, {}>;
42
- export declare type MaterialNode<T extends THREE.Material, P> = Overwrite<Node<T, P>, {
43
- color?: Color;
44
- }>;
45
- export declare type LightNode<T extends THREE.Light, P> = Overwrite<Object3DNode<T, P>, {
46
- color?: Color;
47
- }>;
44
+ export declare type BufferGeometryNode<T extends THREE.BufferGeometry, P> = Node<T, P>;
45
+ export declare type MaterialNode<T extends THREE.Material, P> = Node<T, P>;
46
+ export declare type LightNode<T extends THREE.Light, P> = Object3DNode<T, P>;
48
47
  export declare type AudioListenerProps = Object3DNode<THREE.AudioListener, typeof THREE.AudioListener>;
49
48
  export declare type PositionalAudioProps = Object3DNode<THREE.PositionalAudio, typeof THREE.PositionalAudio>;
50
49
  export declare type MeshProps = Object3DNode<THREE.Mesh, typeof THREE.Mesh>;
@@ -75,19 +74,16 @@ export declare type ExtrudeBufferGeometryProps = BufferGeometryNode<THREE.Extrud
75
74
  export declare type IcosahedronBufferGeometryProps = BufferGeometryNode<THREE.IcosahedronBufferGeometry, typeof THREE.IcosahedronBufferGeometry>;
76
75
  export declare type LatheBufferGeometryProps = BufferGeometryNode<THREE.LatheBufferGeometry, typeof THREE.LatheBufferGeometry>;
77
76
  export declare type OctahedronBufferGeometryProps = BufferGeometryNode<THREE.OctahedronBufferGeometry, typeof THREE.OctahedronBufferGeometry>;
78
- export declare type ParametricBufferGeometryProps = BufferGeometryNode<THREE.ParametricBufferGeometry, typeof THREE.ParametricBufferGeometry>;
79
77
  export declare type PlaneBufferGeometryProps = BufferGeometryNode<THREE.PlaneBufferGeometry, typeof THREE.PlaneBufferGeometry>;
80
78
  export declare type PolyhedronBufferGeometryProps = BufferGeometryNode<THREE.PolyhedronBufferGeometry, typeof THREE.PolyhedronBufferGeometry>;
81
79
  export declare type RingBufferGeometryProps = BufferGeometryNode<THREE.RingBufferGeometry, typeof THREE.RingBufferGeometry>;
82
80
  export declare type ShapeBufferGeometryProps = BufferGeometryNode<THREE.ShapeBufferGeometry, typeof THREE.ShapeBufferGeometry>;
83
81
  export declare type SphereBufferGeometryProps = BufferGeometryNode<THREE.SphereBufferGeometry, typeof THREE.SphereBufferGeometry>;
84
82
  export declare type TetrahedronBufferGeometryProps = BufferGeometryNode<THREE.TetrahedronBufferGeometry, typeof THREE.TetrahedronBufferGeometry>;
85
- export declare type TextBufferGeometryProps = BufferGeometryNode<THREE.TextBufferGeometry, typeof THREE.TextBufferGeometry>;
86
83
  export declare type TorusBufferGeometryProps = BufferGeometryNode<THREE.TorusBufferGeometry, typeof THREE.TorusBufferGeometry>;
87
84
  export declare type TorusKnotBufferGeometryProps = BufferGeometryNode<THREE.TorusKnotBufferGeometry, typeof THREE.TorusKnotBufferGeometry>;
88
85
  export declare type TubeBufferGeometryProps = BufferGeometryNode<THREE.TubeBufferGeometry, typeof THREE.TubeBufferGeometry>;
89
86
  export declare type WireframeGeometryProps = BufferGeometryNode<THREE.WireframeGeometry, typeof THREE.WireframeGeometry>;
90
- export declare type ParametricGeometryProps = BufferGeometryNode<THREE.ParametricGeometry, typeof THREE.ParametricGeometry>;
91
87
  export declare type TetrahedronGeometryProps = BufferGeometryNode<THREE.TetrahedronGeometry, typeof THREE.TetrahedronGeometry>;
92
88
  export declare type OctahedronGeometryProps = BufferGeometryNode<THREE.OctahedronGeometry, typeof THREE.OctahedronGeometry>;
93
89
  export declare type IcosahedronGeometryProps = BufferGeometryNode<THREE.IcosahedronGeometry, typeof THREE.IcosahedronGeometry>;
@@ -96,7 +92,6 @@ export declare type PolyhedronGeometryProps = BufferGeometryNode<THREE.Polyhedro
96
92
  export declare type TubeGeometryProps = BufferGeometryNode<THREE.TubeGeometry, typeof THREE.TubeGeometry>;
97
93
  export declare type TorusKnotGeometryProps = BufferGeometryNode<THREE.TorusKnotGeometry, typeof THREE.TorusKnotGeometry>;
98
94
  export declare type TorusGeometryProps = BufferGeometryNode<THREE.TorusGeometry, typeof THREE.TorusGeometry>;
99
- export declare type TextGeometryProps = BufferGeometryNode<THREE.TextGeometry, typeof THREE.TextGeometry>;
100
95
  export declare type SphereGeometryProps = BufferGeometryNode<THREE.SphereGeometry, typeof THREE.SphereGeometry>;
101
96
  export declare type RingGeometryProps = BufferGeometryNode<THREE.RingGeometry, typeof THREE.RingGeometry>;
102
97
  export declare type PlaneGeometryProps = BufferGeometryNode<THREE.PlaneGeometry, typeof THREE.PlaneGeometry>;
@@ -213,19 +208,16 @@ declare global {
213
208
  icosahedronBufferGeometry: IcosahedronBufferGeometryProps;
214
209
  latheBufferGeometry: LatheBufferGeometryProps;
215
210
  octahedronBufferGeometry: OctahedronBufferGeometryProps;
216
- parametricBufferGeometry: ParametricBufferGeometryProps;
217
211
  planeBufferGeometry: PlaneBufferGeometryProps;
218
212
  polyhedronBufferGeometry: PolyhedronBufferGeometryProps;
219
213
  ringBufferGeometry: RingBufferGeometryProps;
220
214
  shapeBufferGeometry: ShapeBufferGeometryProps;
221
215
  sphereBufferGeometry: SphereBufferGeometryProps;
222
216
  tetrahedronBufferGeometry: TetrahedronBufferGeometryProps;
223
- textBufferGeometry: TextBufferGeometryProps;
224
217
  torusBufferGeometry: TorusBufferGeometryProps;
225
218
  torusKnotBufferGeometry: TorusKnotBufferGeometryProps;
226
219
  tubeBufferGeometry: TubeBufferGeometryProps;
227
220
  wireframeGeometry: WireframeGeometryProps;
228
- parametricGeometry: ParametricGeometryProps;
229
221
  tetrahedronGeometry: TetrahedronGeometryProps;
230
222
  octahedronGeometry: OctahedronGeometryProps;
231
223
  icosahedronGeometry: IcosahedronGeometryProps;
@@ -234,7 +226,6 @@ declare global {
234
226
  tubeGeometry: TubeGeometryProps;
235
227
  torusKnotGeometry: TorusKnotGeometryProps;
236
228
  torusGeometry: TorusGeometryProps;
237
- textGeometry: TextGeometryProps;
238
229
  sphereGeometry: SphereGeometryProps;
239
230
  ringGeometry: RingGeometryProps;
240
231
  planeGeometry: PlaneGeometryProps;
@@ -588,6 +588,8 @@ function createRenderer(roots) {
588
588
 
589
589
  if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
590
590
  changes.forEach(([key, value, isEvent, keys]) => {
591
+ var _rootState$gl;
592
+
591
593
  let currentInstance = instance;
592
594
  let targetProp = currentInstance[key]; // Revolve dashed props
593
595
 
@@ -618,8 +620,9 @@ function createRenderer(roots) {
618
620
 
619
621
  if (defaultClassCall.dispose) defaultClassCall.dispose(); // instance does not have constructor, just set it to 0
620
622
  } else value = 0;
621
- } // Deal with pointer events ...
623
+ }
622
624
 
625
+ const isLinear = (rootState == null ? void 0 : (_rootState$gl = rootState.gl) == null ? void 0 : _rootState$gl.outputEncoding) === THREE__namespace.LinearEncoding; // Deal with pointer events ...
623
626
 
624
627
  if (isEvent) {
625
628
  if (value) localState.handlers[key] = value;else delete localState.handlers[key];
@@ -640,14 +643,14 @@ function createRenderer(roots) {
640
643
  else targetProp.set(value); // Auto-convert sRGB colors, for now ...
641
644
  // https://github.com/pmndrs/react-three-fiber/issues/344
642
645
 
643
- if (!rootState.linear && isColor) targetProp.convertSRGBToLinear();
646
+ if (!isLinear && isColor) targetProp.convertSRGBToLinear();
644
647
  } // Else, just overwrite the value
645
648
 
646
649
  } else {
647
650
  currentInstance[key] = value; // Auto-convert sRGB textures, for now ...
648
651
  // https://github.com/pmndrs/react-three-fiber/issues/344
649
652
 
650
- if (!rootState.linear && currentInstance[key] instanceof THREE__namespace.Texture) currentInstance[key].encoding = THREE__namespace.sRGBEncoding;
653
+ if (!isLinear && currentInstance[key] instanceof THREE__namespace.Texture) currentInstance[key].encoding = THREE__namespace.sRGBEncoding;
651
654
  }
652
655
 
653
656
  invalidateInstance(instance);
@@ -924,10 +927,13 @@ function createRenderer(roots) {
924
927
 
925
928
  instance.__r3f.objects = [];
926
929
  removeChild(parent, instance);
927
- appendChild(parent, newInstance) // This evil hack switches the react-internal fiber node
928
- // https://github.com/facebook/react/issues/14983
929
- // https://github.com/facebook/react/pull/15021
930
- ;
930
+ appendChild(parent, newInstance); // Re-bind event handlers
931
+
932
+ if (newInstance.raycast && newInstance.__r3f.eventCount) {
933
+ const rootState = newInstance.__r3f.root.getState();
934
+
935
+ rootState.internal.interaction.push(newInstance);
936
+ } // This evil hack switches the react-internal fiber node
931
937
  [fiber, fiber.alternate].forEach(fiber => {
932
938
  if (fiber !== null) {
933
939
  fiber.stateNode = newInstance;
@@ -588,6 +588,8 @@ function createRenderer(roots) {
588
588
 
589
589
  if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
590
590
  changes.forEach(([key, value, isEvent, keys]) => {
591
+ var _rootState$gl;
592
+
591
593
  let currentInstance = instance;
592
594
  let targetProp = currentInstance[key]; // Revolve dashed props
593
595
 
@@ -618,8 +620,9 @@ function createRenderer(roots) {
618
620
 
619
621
  if (defaultClassCall.dispose) defaultClassCall.dispose(); // instance does not have constructor, just set it to 0
620
622
  } else value = 0;
621
- } // Deal with pointer events ...
623
+ }
622
624
 
625
+ const isLinear = (rootState == null ? void 0 : (_rootState$gl = rootState.gl) == null ? void 0 : _rootState$gl.outputEncoding) === THREE__namespace.LinearEncoding; // Deal with pointer events ...
623
626
 
624
627
  if (isEvent) {
625
628
  if (value) localState.handlers[key] = value;else delete localState.handlers[key];
@@ -640,14 +643,14 @@ function createRenderer(roots) {
640
643
  else targetProp.set(value); // Auto-convert sRGB colors, for now ...
641
644
  // https://github.com/pmndrs/react-three-fiber/issues/344
642
645
 
643
- if (!rootState.linear && isColor) targetProp.convertSRGBToLinear();
646
+ if (!isLinear && isColor) targetProp.convertSRGBToLinear();
644
647
  } // Else, just overwrite the value
645
648
 
646
649
  } else {
647
650
  currentInstance[key] = value; // Auto-convert sRGB textures, for now ...
648
651
  // https://github.com/pmndrs/react-three-fiber/issues/344
649
652
 
650
- if (!rootState.linear && currentInstance[key] instanceof THREE__namespace.Texture) currentInstance[key].encoding = THREE__namespace.sRGBEncoding;
653
+ if (!isLinear && currentInstance[key] instanceof THREE__namespace.Texture) currentInstance[key].encoding = THREE__namespace.sRGBEncoding;
651
654
  }
652
655
 
653
656
  invalidateInstance(instance);
@@ -924,10 +927,13 @@ function createRenderer(roots) {
924
927
 
925
928
  instance.__r3f.objects = [];
926
929
  removeChild(parent, instance);
927
- appendChild(parent, newInstance) // This evil hack switches the react-internal fiber node
928
- // https://github.com/facebook/react/issues/14983
929
- // https://github.com/facebook/react/pull/15021
930
- ;
930
+ appendChild(parent, newInstance); // Re-bind event handlers
931
+
932
+ if (newInstance.raycast && newInstance.__r3f.eventCount) {
933
+ const rootState = newInstance.__r3f.root.getState();
934
+
935
+ rootState.internal.interaction.push(newInstance);
936
+ } // This evil hack switches the react-internal fiber node
931
937
  [fiber, fiber.alternate].forEach(fiber => {
932
938
  if (fiber !== null) {
933
939
  fiber.stateNode = newInstance;
@@ -555,6 +555,8 @@ function createRenderer(roots) {
555
555
 
556
556
  if (instance.__r3f) instance.__r3f.memoizedProps = memoized;
557
557
  changes.forEach(([key, value, isEvent, keys]) => {
558
+ var _rootState$gl;
559
+
558
560
  let currentInstance = instance;
559
561
  let targetProp = currentInstance[key]; // Revolve dashed props
560
562
 
@@ -585,8 +587,9 @@ function createRenderer(roots) {
585
587
 
586
588
  if (defaultClassCall.dispose) defaultClassCall.dispose(); // instance does not have constructor, just set it to 0
587
589
  } else value = 0;
588
- } // Deal with pointer events ...
590
+ }
589
591
 
592
+ const isLinear = (rootState == null ? void 0 : (_rootState$gl = rootState.gl) == null ? void 0 : _rootState$gl.outputEncoding) === THREE.LinearEncoding; // Deal with pointer events ...
590
593
 
591
594
  if (isEvent) {
592
595
  if (value) localState.handlers[key] = value;else delete localState.handlers[key];
@@ -607,14 +610,14 @@ function createRenderer(roots) {
607
610
  else targetProp.set(value); // Auto-convert sRGB colors, for now ...
608
611
  // https://github.com/pmndrs/react-three-fiber/issues/344
609
612
 
610
- if (!rootState.linear && isColor) targetProp.convertSRGBToLinear();
613
+ if (!isLinear && isColor) targetProp.convertSRGBToLinear();
611
614
  } // Else, just overwrite the value
612
615
 
613
616
  } else {
614
617
  currentInstance[key] = value; // Auto-convert sRGB textures, for now ...
615
618
  // https://github.com/pmndrs/react-three-fiber/issues/344
616
619
 
617
- if (!rootState.linear && currentInstance[key] instanceof THREE.Texture) currentInstance[key].encoding = THREE.sRGBEncoding;
620
+ if (!isLinear && currentInstance[key] instanceof THREE.Texture) currentInstance[key].encoding = THREE.sRGBEncoding;
618
621
  }
619
622
 
620
623
  invalidateInstance(instance);
@@ -891,10 +894,13 @@ function createRenderer(roots) {
891
894
 
892
895
  instance.__r3f.objects = [];
893
896
  removeChild(parent, instance);
894
- appendChild(parent, newInstance) // This evil hack switches the react-internal fiber node
895
- // https://github.com/facebook/react/issues/14983
896
- // https://github.com/facebook/react/pull/15021
897
- ;
897
+ appendChild(parent, newInstance); // Re-bind event handlers
898
+
899
+ if (newInstance.raycast && newInstance.__r3f.eventCount) {
900
+ const rootState = newInstance.__r3f.root.getState();
901
+
902
+ rootState.internal.interaction.push(newInstance);
903
+ } // This evil hack switches the react-internal fiber node
898
904
  [fiber, fiber.alternate].forEach(fiber => {
899
905
  if (fiber !== null) {
900
906
  fiber.stateNode = newInstance;
@@ -1 +1,11 @@
1
- export * from "../../dist/declarations/src/native";
1
+ // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
+ // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
+
4
+ // curious why you need to?
5
+ // this file exists so that you can import from the entrypoint normally
6
+ // except that it points to your source file and you don't need to run build constantly
7
+ // which means we need to re-export all of the modules from your source file
8
+ // and since export * doesn't include default exports, we need to read your source file
9
+ // to check for a default export and re-export it if it exists
10
+ // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
+ export * from "../../src/native";
@@ -1,7 +1,16 @@
1
- 'use strict';
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
2
9
 
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./react-three-fiber-native.cjs.prod.js");
5
- } else {
6
- module.exports = require("./react-three-fiber-native.cjs.dev.js");
7
- }
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../../node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../..", "../..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../../src/native.tsx");
15
+
16
+ unregister();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/fiber",
3
- "version": "7.0.24",
3
+ "version": "7.0.25",
4
4
  "description": "A React renderer for Threejs",
5
5
  "keywords": [
6
6
  "react",
@@ -55,7 +55,7 @@
55
55
  "peerDependencies": {
56
56
  "react": ">=17.0",
57
57
  "react-dom": ">=17.0",
58
- "three": ">=0.126"
58
+ "three": ">=0.133"
59
59
  },
60
60
  "peerDependenciesMeta": {
61
61
  "react-dom": {