@react-three/test-renderer 8.0.10 → 8.0.13
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 +24 -0
- package/dist/declarations/src/createTestCanvas.d.ts +2 -2
- package/dist/declarations/src/createTestInstance.d.ts +20 -20
- package/dist/declarations/src/createWebGLContext.d.ts +18 -18
- package/dist/declarations/src/fireEvent.d.ts +4 -4
- package/dist/declarations/src/helpers/graph.d.ts +3 -3
- package/dist/declarations/src/helpers/is.d.ts +9 -9
- package/dist/declarations/src/helpers/strings.d.ts +2 -2
- package/dist/declarations/src/helpers/testInstance.d.ts +5 -5
- package/dist/declarations/src/helpers/tree.d.ts +3 -3
- package/dist/declarations/src/index.d.ts +8 -8
- package/dist/declarations/src/types/index.d.ts +1 -1
- package/dist/declarations/src/types/internal.d.ts +31 -31
- package/dist/declarations/src/types/public.d.ts +39 -39
- package/dist/react-three-test-renderer.cjs.dev.js +18 -19
- package/dist/react-three-test-renderer.cjs.prod.js +18 -19
- package/dist/react-three-test-renderer.esm.js +18 -19
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @react-three/test-renderer
|
|
2
2
|
|
|
3
|
+
## 8.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4c87bce: fix: attach, devtools, and perf fixes
|
|
8
|
+
- Updated dependencies [4c87bce]
|
|
9
|
+
- @react-three/fiber@8.0.20
|
|
10
|
+
|
|
11
|
+
## 8.0.12
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- c4715d5f: allow invalidate to preempt more than 1 frame
|
|
16
|
+
- Updated dependencies [c4715d5f]
|
|
17
|
+
- @react-three/fiber@8.0.15
|
|
18
|
+
|
|
19
|
+
## 8.0.11
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 5559a119: Add support for recoverable errors
|
|
24
|
+
- Updated dependencies [5559a119]
|
|
25
|
+
- @react-three/fiber@8.0.14
|
|
26
|
+
|
|
3
27
|
## 8.0.10
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CreateCanvasParameters } from './types/internal';
|
|
2
|
-
export declare const createCanvas: ({ beforeReturn, width, height }?: CreateCanvasParameters) => HTMLCanvasElement;
|
|
1
|
+
import type { CreateCanvasParameters } from './types/internal';
|
|
2
|
+
export declare const createCanvas: ({ beforeReturn, width, height }?: CreateCanvasParameters) => HTMLCanvasElement;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Object3D } from 'three';
|
|
2
|
-
import type { MockInstance, MockScene, Obj } from './types/internal';
|
|
3
|
-
export declare class ReactThreeTestInstance<TInstance extends Object3D = Object3D> {
|
|
4
|
-
_fiber: MockInstance;
|
|
5
|
-
constructor(fiber: MockInstance | MockScene);
|
|
6
|
-
get instance(): Object3D;
|
|
7
|
-
get type(): string;
|
|
8
|
-
get props(): Obj;
|
|
9
|
-
get parent(): ReactThreeTestInstance | null;
|
|
10
|
-
get children(): ReactThreeTestInstance[];
|
|
11
|
-
get allChildren(): ReactThreeTestInstance[];
|
|
12
|
-
private getChildren;
|
|
13
|
-
find: (decider: (node: ReactThreeTestInstance) => boolean) => ReactThreeTestInstance;
|
|
14
|
-
findAll: (decider: (node: ReactThreeTestInstance) => boolean) => ReactThreeTestInstance[];
|
|
15
|
-
findByType: (type: string) => ReactThreeTestInstance;
|
|
16
|
-
findAllByType: (type: string) => ReactThreeTestInstance[];
|
|
17
|
-
findByProps: (props: Obj) => ReactThreeTestInstance;
|
|
18
|
-
findAllByProps: (props: Obj) => ReactThreeTestInstance[];
|
|
19
|
-
}
|
|
20
|
-
export declare const wrapFiber: (fiber: MockInstance | MockScene) => ReactThreeTestInstance;
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
import type { MockInstance, MockScene, Obj } from './types/internal';
|
|
3
|
+
export declare class ReactThreeTestInstance<TInstance extends Object3D = Object3D> {
|
|
4
|
+
_fiber: MockInstance;
|
|
5
|
+
constructor(fiber: MockInstance | MockScene);
|
|
6
|
+
get instance(): Object3D;
|
|
7
|
+
get type(): string;
|
|
8
|
+
get props(): Obj;
|
|
9
|
+
get parent(): ReactThreeTestInstance | null;
|
|
10
|
+
get children(): ReactThreeTestInstance[];
|
|
11
|
+
get allChildren(): ReactThreeTestInstance[];
|
|
12
|
+
private getChildren;
|
|
13
|
+
find: (decider: (node: ReactThreeTestInstance) => boolean) => ReactThreeTestInstance;
|
|
14
|
+
findAll: (decider: (node: ReactThreeTestInstance) => boolean) => ReactThreeTestInstance[];
|
|
15
|
+
findByType: (type: string) => ReactThreeTestInstance;
|
|
16
|
+
findAllByType: (type: string) => ReactThreeTestInstance[];
|
|
17
|
+
findByProps: (props: Obj) => ReactThreeTestInstance;
|
|
18
|
+
findAllByProps: (props: Obj) => ReactThreeTestInstance[];
|
|
19
|
+
}
|
|
20
|
+
export declare const wrapFiber: (fiber: MockInstance | MockScene) => ReactThreeTestInstance;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
declare class WebGLRenderingContext {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
constructor(canvas: HTMLCanvasElement);
|
|
4
|
-
getShaderPrecisionFormat: () => {
|
|
5
|
-
rangeMin: number;
|
|
6
|
-
rangeMax: number;
|
|
7
|
-
precision: number;
|
|
8
|
-
};
|
|
9
|
-
private GL_VERSION;
|
|
10
|
-
private SCISSOR_BOX;
|
|
11
|
-
private VIEWPORT;
|
|
12
|
-
getParameter: (paramId: number) => number[] | string[] | undefined;
|
|
13
|
-
getExtension: (ext: string) => any;
|
|
14
|
-
getProgramInfoLog: () => string;
|
|
15
|
-
getShaderInfoLog: () => string;
|
|
16
|
-
}
|
|
17
|
-
export declare const createWebGLContext: (canvas: HTMLCanvasElement) => WebGLRenderingContext;
|
|
18
|
-
export {};
|
|
1
|
+
declare class WebGLRenderingContext {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
constructor(canvas: HTMLCanvasElement);
|
|
4
|
+
getShaderPrecisionFormat: () => {
|
|
5
|
+
rangeMin: number;
|
|
6
|
+
rangeMax: number;
|
|
7
|
+
precision: number;
|
|
8
|
+
};
|
|
9
|
+
private GL_VERSION;
|
|
10
|
+
private SCISSOR_BOX;
|
|
11
|
+
private VIEWPORT;
|
|
12
|
+
getParameter: (paramId: number) => number[] | string[] | undefined;
|
|
13
|
+
getExtension: (ext: string) => any;
|
|
14
|
+
getProgramInfoLog: () => string;
|
|
15
|
+
getShaderInfoLog: () => string;
|
|
16
|
+
}
|
|
17
|
+
export declare const createWebGLContext: (canvas: HTMLCanvasElement) => WebGLRenderingContext;
|
|
18
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ReactReconciler from 'react-reconciler';
|
|
2
|
-
import { ReactThreeTestInstance } from './createTestInstance';
|
|
3
|
-
import type { MockUseStoreState, MockEventData } from './types/internal';
|
|
4
|
-
export declare const createEventFirer: (act: ReactReconciler.Reconciler<unknown, unknown, unknown, unknown, unknown>['act'], store: MockUseStoreState) => (element: ReactThreeTestInstance, eventName: string, data?: MockEventData) => Promise<any>;
|
|
1
|
+
import ReactReconciler from 'react-reconciler';
|
|
2
|
+
import { ReactThreeTestInstance } from './createTestInstance';
|
|
3
|
+
import type { MockUseStoreState, MockEventData } from './types/internal';
|
|
4
|
+
export declare const createEventFirer: (act: ReactReconciler.Reconciler<unknown, unknown, unknown, unknown, unknown>['act'], store: MockUseStoreState) => (element: ReactThreeTestInstance, eventName: string, data?: MockEventData) => Promise<any>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { MockScene, MockSceneChild } from '../types/internal';
|
|
2
|
-
import type { SceneGraphItem } from '../types/public';
|
|
3
|
-
export declare const toGraph: (object: MockScene | MockSceneChild) => SceneGraphItem[];
|
|
1
|
+
import type { MockScene, MockSceneChild } from '../types/internal';
|
|
2
|
+
import type { SceneGraphItem } from '../types/public';
|
|
3
|
+
export declare const toGraph: (object: MockScene | MockSceneChild) => SceneGraphItem[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare const is: {
|
|
2
|
-
obj: (a: any) => boolean;
|
|
3
|
-
fun: (a: any) => boolean;
|
|
4
|
-
str: (a: any) => boolean;
|
|
5
|
-
num: (a: any) => boolean;
|
|
6
|
-
und: (a: any) => boolean;
|
|
7
|
-
arr: (a: any) => boolean;
|
|
8
|
-
equ(a: any, b: any): boolean;
|
|
9
|
-
};
|
|
1
|
+
export declare const is: {
|
|
2
|
+
obj: (a: any) => boolean;
|
|
3
|
+
fun: (a: any) => boolean;
|
|
4
|
+
str: (a: any) => boolean;
|
|
5
|
+
num: (a: any) => boolean;
|
|
6
|
+
und: (a: any) => boolean;
|
|
7
|
+
arr: (a: any) => boolean;
|
|
8
|
+
equ(a: any, b: any): boolean;
|
|
9
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const lowerCaseFirstLetter: (str: string) => string;
|
|
2
|
-
export declare const toEventHandlerName: (eventName: string) => string;
|
|
1
|
+
export declare const lowerCaseFirstLetter: (str: string) => string;
|
|
2
|
+
export declare const toEventHandlerName: (eventName: string) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactThreeTestInstance } from '../createTestInstance';
|
|
2
|
-
import type { Obj } from '../types/internal';
|
|
3
|
-
export declare const expectOne: <TItem>(items: TItem[], msg: string) => TItem;
|
|
4
|
-
export declare const matchProps: (props: Obj, filter: Obj) => boolean;
|
|
5
|
-
export declare const findAll: (root: ReactThreeTestInstance, decider: (node: ReactThreeTestInstance) => boolean) => ReactThreeTestInstance<import("three").Object3D<import("three").Event>>[];
|
|
1
|
+
import { ReactThreeTestInstance } from '../createTestInstance';
|
|
2
|
+
import type { Obj } from '../types/internal';
|
|
3
|
+
export declare const expectOne: <TItem>(items: TItem[], msg: string) => TItem;
|
|
4
|
+
export declare const matchProps: (props: Obj, filter: Obj) => boolean;
|
|
5
|
+
export declare const findAll: (root: ReactThreeTestInstance, decider: (node: ReactThreeTestInstance) => boolean) => ReactThreeTestInstance<import("three").Object3D<import("three").Event>>[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Tree } from '../types/public';
|
|
2
|
-
import type { MockScene } from '../types/internal';
|
|
3
|
-
export declare const toTree: (root: MockScene) => Tree;
|
|
1
|
+
import type { Tree } from '../types/public';
|
|
2
|
+
import type { MockScene } from '../types/internal';
|
|
3
|
+
export declare const toTree: (root: MockScene) => Tree;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { CreateOptions, Renderer, Act } from './types/public';
|
|
3
|
-
export * as ReactThreeTest from './types';
|
|
4
|
-
declare const _default: {
|
|
5
|
-
create: (element: React.ReactNode, options?: Partial<CreateOptions> | undefined) => Promise<Renderer>;
|
|
6
|
-
act: Act;
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { CreateOptions, Renderer, Act } from './types/public';
|
|
3
|
+
export * as ReactThreeTest from './types';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
create: (element: React.ReactNode, options?: Partial<CreateOptions> | undefined) => Promise<Renderer>;
|
|
6
|
+
act: Act;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './public';
|
|
1
|
+
export * from './public';
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import {
|
|
3
|
-
import type { BaseInstance, LocalState, RootState } from '@react-three/fiber';
|
|
4
|
-
export declare type MockUseStoreState =
|
|
5
|
-
export interface MockInstance extends Omit<BaseInstance, '__r3f'> {
|
|
6
|
-
__r3f: Omit<LocalState, 'root' | 'objects' | '
|
|
7
|
-
root: MockUseStoreState;
|
|
8
|
-
objects: MockSceneChild[];
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export interface MockSceneChild extends Omit<MockInstance, 'children'> {
|
|
13
|
-
children: MockSceneChild[];
|
|
14
|
-
}
|
|
15
|
-
export interface MockScene extends Omit<THREE.Scene, 'children'>, Pick<MockInstance, '__r3f'> {
|
|
16
|
-
children: MockSceneChild[];
|
|
17
|
-
}
|
|
18
|
-
export declare type CreateCanvasParameters = {
|
|
19
|
-
beforeReturn?: (canvas: HTMLCanvasElement) => void;
|
|
20
|
-
width?: number;
|
|
21
|
-
height?: number;
|
|
22
|
-
};
|
|
23
|
-
export interface Obj {
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
}
|
|
26
|
-
export declare type MockEventData = {
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
};
|
|
29
|
-
export interface TestInstanceChildOpts {
|
|
30
|
-
exhaustive: boolean;
|
|
31
|
-
}
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { UseBoundStore } from 'zustand';
|
|
3
|
+
import type { BaseInstance, LocalState, RootState } from '@react-three/fiber';
|
|
4
|
+
export declare type MockUseStoreState = UseBoundStore<RootState>;
|
|
5
|
+
export interface MockInstance extends Omit<BaseInstance, '__r3f'> {
|
|
6
|
+
__r3f: Omit<LocalState, 'root' | 'objects' | 'parents'> & {
|
|
7
|
+
root: MockUseStoreState;
|
|
8
|
+
objects: MockSceneChild[];
|
|
9
|
+
parents: MockInstance[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface MockSceneChild extends Omit<MockInstance, 'children'> {
|
|
13
|
+
children: MockSceneChild[];
|
|
14
|
+
}
|
|
15
|
+
export interface MockScene extends Omit<THREE.Scene, 'children'>, Pick<MockInstance, '__r3f'> {
|
|
16
|
+
children: MockSceneChild[];
|
|
17
|
+
}
|
|
18
|
+
export declare type CreateCanvasParameters = {
|
|
19
|
+
beforeReturn?: (canvas: HTMLCanvasElement) => void;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
};
|
|
23
|
+
export interface Obj {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
export declare type MockEventData = {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
export interface TestInstanceChildOpts {
|
|
30
|
+
exhaustive: boolean;
|
|
31
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { Camera, RenderProps } from '@react-three/fiber';
|
|
3
|
-
import { ReactThreeTestInstance } from '../createTestInstance';
|
|
4
|
-
import type { MockEventData, CreateCanvasParameters } from './internal';
|
|
5
|
-
export { ReactThreeTestInstance };
|
|
6
|
-
export declare type MockSyntheticEvent = {
|
|
7
|
-
camera: Camera;
|
|
8
|
-
stopPropagation: () => void;
|
|
9
|
-
target: ReactThreeTestInstance;
|
|
10
|
-
currentTarget: ReactThreeTestInstance;
|
|
11
|
-
sourceEvent: MockEventData;
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
14
|
-
export declare type CreateOptions = CreateCanvasParameters & RenderProps<HTMLCanvasElement>;
|
|
15
|
-
export declare type Act = (cb: () => Promise<any>) => Promise<any>;
|
|
16
|
-
export declare type Renderer = {
|
|
17
|
-
scene: ReactThreeTestInstance;
|
|
18
|
-
unmount: () => Promise<void>;
|
|
19
|
-
getInstance: () => null | unknown;
|
|
20
|
-
update: (el: React.ReactNode) => Promise<void>;
|
|
21
|
-
toTree: () => Tree | undefined;
|
|
22
|
-
toGraph: () => SceneGraph | undefined;
|
|
23
|
-
fireEvent: (element: ReactThreeTestInstance, handler: string, data?: MockEventData) => Promise<any>;
|
|
24
|
-
advanceFrames: (frames: number, delta: number | number[]) => Promise<void>;
|
|
25
|
-
};
|
|
26
|
-
export interface SceneGraphItem {
|
|
27
|
-
type: string;
|
|
28
|
-
name: string;
|
|
29
|
-
children: SceneGraphItem[] | null;
|
|
30
|
-
}
|
|
31
|
-
export declare type SceneGraph = SceneGraphItem[];
|
|
32
|
-
export interface TreeNode {
|
|
33
|
-
type: string;
|
|
34
|
-
props: {
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
};
|
|
37
|
-
children: TreeNode[];
|
|
38
|
-
}
|
|
39
|
-
export declare type Tree = TreeNode[];
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Camera, RenderProps } from '@react-three/fiber';
|
|
3
|
+
import { ReactThreeTestInstance } from '../createTestInstance';
|
|
4
|
+
import type { MockEventData, CreateCanvasParameters } from './internal';
|
|
5
|
+
export { ReactThreeTestInstance };
|
|
6
|
+
export declare type MockSyntheticEvent = {
|
|
7
|
+
camera: Camera;
|
|
8
|
+
stopPropagation: () => void;
|
|
9
|
+
target: ReactThreeTestInstance;
|
|
10
|
+
currentTarget: ReactThreeTestInstance;
|
|
11
|
+
sourceEvent: MockEventData;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
export declare type CreateOptions = CreateCanvasParameters & RenderProps<HTMLCanvasElement>;
|
|
15
|
+
export declare type Act = (cb: () => Promise<any>) => Promise<any>;
|
|
16
|
+
export declare type Renderer = {
|
|
17
|
+
scene: ReactThreeTestInstance;
|
|
18
|
+
unmount: () => Promise<void>;
|
|
19
|
+
getInstance: () => null | unknown;
|
|
20
|
+
update: (el: React.ReactNode) => Promise<void>;
|
|
21
|
+
toTree: () => Tree | undefined;
|
|
22
|
+
toGraph: () => SceneGraph | undefined;
|
|
23
|
+
fireEvent: (element: ReactThreeTestInstance, handler: string, data?: MockEventData) => Promise<any>;
|
|
24
|
+
advanceFrames: (frames: number, delta: number | number[]) => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
export interface SceneGraphItem {
|
|
27
|
+
type: string;
|
|
28
|
+
name: string;
|
|
29
|
+
children: SceneGraphItem[] | null;
|
|
30
|
+
}
|
|
31
|
+
export declare type SceneGraph = SceneGraphItem[];
|
|
32
|
+
export interface TreeNode {
|
|
33
|
+
type: string;
|
|
34
|
+
props: {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
};
|
|
37
|
+
children: TreeNode[];
|
|
38
|
+
}
|
|
39
|
+
export declare type Tree = TreeNode[];
|
|
@@ -610,13 +610,10 @@ class ReactThreeTestInstance {
|
|
|
610
610
|
}
|
|
611
611
|
|
|
612
612
|
get parent() {
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
return parent;
|
|
613
|
+
const parents = this._fiber.__r3f.parents;
|
|
614
|
+
if (!parents.length) return null;
|
|
615
|
+
const parent = parents[parents.length - 1];
|
|
616
|
+
return wrapFiber(parent);
|
|
620
617
|
}
|
|
621
618
|
|
|
622
619
|
get children() {
|
|
@@ -688,22 +685,24 @@ const create = async (element, options) => {
|
|
|
688
685
|
|
|
689
686
|
// this is our root
|
|
690
687
|
const fiber$1 = (_mockRoots$get = fiber._roots.get(_fiber)) == null ? void 0 : _mockRoots$get.fiber;
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
688
|
+
const current = fiber$1 == null ? void 0 : fiber$1.current.child.child;
|
|
689
|
+
|
|
690
|
+
if (current) {
|
|
691
|
+
const root = {
|
|
692
|
+
/**
|
|
693
|
+
* we wrap our child in a Provider component
|
|
694
|
+
* and context.Provider, so do a little
|
|
695
|
+
* artificial dive to get round this and
|
|
696
|
+
* pass context.Provider as if it was the
|
|
697
|
+
* actual react root
|
|
698
|
+
*/
|
|
699
|
+
current
|
|
700
|
+
};
|
|
703
701
|
/**
|
|
704
702
|
* so this actually returns the instance
|
|
705
703
|
* the user has passed through as a Fiber
|
|
706
704
|
*/
|
|
705
|
+
|
|
707
706
|
return fiber.reconciler.getPublicRootInstance(root);
|
|
708
707
|
} else {
|
|
709
708
|
return null;
|
|
@@ -610,13 +610,10 @@ class ReactThreeTestInstance {
|
|
|
610
610
|
}
|
|
611
611
|
|
|
612
612
|
get parent() {
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
return parent;
|
|
613
|
+
const parents = this._fiber.__r3f.parents;
|
|
614
|
+
if (!parents.length) return null;
|
|
615
|
+
const parent = parents[parents.length - 1];
|
|
616
|
+
return wrapFiber(parent);
|
|
620
617
|
}
|
|
621
618
|
|
|
622
619
|
get children() {
|
|
@@ -688,22 +685,24 @@ const create = async (element, options) => {
|
|
|
688
685
|
|
|
689
686
|
// this is our root
|
|
690
687
|
const fiber$1 = (_mockRoots$get = fiber._roots.get(_fiber)) == null ? void 0 : _mockRoots$get.fiber;
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
688
|
+
const current = fiber$1 == null ? void 0 : fiber$1.current.child.child;
|
|
689
|
+
|
|
690
|
+
if (current) {
|
|
691
|
+
const root = {
|
|
692
|
+
/**
|
|
693
|
+
* we wrap our child in a Provider component
|
|
694
|
+
* and context.Provider, so do a little
|
|
695
|
+
* artificial dive to get round this and
|
|
696
|
+
* pass context.Provider as if it was the
|
|
697
|
+
* actual react root
|
|
698
|
+
*/
|
|
699
|
+
current
|
|
700
|
+
};
|
|
703
701
|
/**
|
|
704
702
|
* so this actually returns the instance
|
|
705
703
|
* the user has passed through as a Fiber
|
|
706
704
|
*/
|
|
705
|
+
|
|
707
706
|
return fiber.reconciler.getPublicRootInstance(root);
|
|
708
707
|
} else {
|
|
709
708
|
return null;
|
|
@@ -586,13 +586,10 @@ class ReactThreeTestInstance {
|
|
|
586
586
|
}
|
|
587
587
|
|
|
588
588
|
get parent() {
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
return parent;
|
|
589
|
+
const parents = this._fiber.__r3f.parents;
|
|
590
|
+
if (!parents.length) return null;
|
|
591
|
+
const parent = parents[parents.length - 1];
|
|
592
|
+
return wrapFiber(parent);
|
|
596
593
|
}
|
|
597
594
|
|
|
598
595
|
get children() {
|
|
@@ -664,22 +661,24 @@ const create = async (element, options) => {
|
|
|
664
661
|
|
|
665
662
|
// this is our root
|
|
666
663
|
const fiber = (_mockRoots$get = _roots.get(_fiber)) == null ? void 0 : _mockRoots$get.fiber;
|
|
667
|
-
const
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
664
|
+
const current = fiber == null ? void 0 : fiber.current.child.child;
|
|
665
|
+
|
|
666
|
+
if (current) {
|
|
667
|
+
const root = {
|
|
668
|
+
/**
|
|
669
|
+
* we wrap our child in a Provider component
|
|
670
|
+
* and context.Provider, so do a little
|
|
671
|
+
* artificial dive to get round this and
|
|
672
|
+
* pass context.Provider as if it was the
|
|
673
|
+
* actual react root
|
|
674
|
+
*/
|
|
675
|
+
current
|
|
676
|
+
};
|
|
679
677
|
/**
|
|
680
678
|
* so this actually returns the instance
|
|
681
679
|
* the user has passed through as a Fiber
|
|
682
680
|
*/
|
|
681
|
+
|
|
683
682
|
return reconciler.getPublicRootInstance(root);
|
|
684
683
|
} else {
|
|
685
684
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/test-renderer",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.13",
|
|
4
4
|
"description": "Test Renderer for react-three-fiber",
|
|
5
5
|
"author": "Josh Ellis",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=17.0",
|
|
26
|
-
"@react-three/fiber": ">=8.0.
|
|
26
|
+
"@react-three/fiber": ">=8.0.20",
|
|
27
27
|
"three": ">=0.126"
|
|
28
28
|
}
|
|
29
29
|
}
|