@react-three/test-renderer 8.2.0 → 8.2.2
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 +446 -434
- package/README.md +61 -61
- package/dist/react-three-test-renderer.cjs.dev.js +14 -5
- package/dist/react-three-test-renderer.cjs.prod.js +14 -5
- package/dist/react-three-test-renderer.esm.js +14 -5
- package/package.json +4 -4
- package/dist/declarations/src/WebGL2RenderingContext.d.ts +0 -16
- package/dist/declarations/src/createTestCanvas.d.ts +0 -2
- package/dist/declarations/src/createTestInstance.d.ts +0 -20
- package/dist/declarations/src/fireEvent.d.ts +0 -4
- package/dist/declarations/src/helpers/graph.d.ts +0 -3
- package/dist/declarations/src/helpers/is.d.ts +0 -9
- package/dist/declarations/src/helpers/strings.d.ts +0 -2
- package/dist/declarations/src/helpers/testInstance.d.ts +0 -5
- package/dist/declarations/src/helpers/tree.d.ts +0 -3
- package/dist/declarations/src/helpers/waitFor.d.ts +0 -5
- package/dist/declarations/src/index.d.ts +0 -14
- package/dist/declarations/src/types/index.d.ts +0 -1
- package/dist/declarations/src/types/internal.d.ts +0 -31
- package/dist/declarations/src/types/public.d.ts +0 -38
package/README.md
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
# React Three Test Renderer ⚛️🔼🧪
|
|
2
|
-
|
|
3
|
-
[](https://npmjs.com/package/@react-three/test-renderer)
|
|
4
|
-
[](https://npmjs.com/package/@react-three/test-renderer)
|
|
5
|
-
[](https://twitter.com/pmndrs)
|
|
6
|
-
[](https://twitter.com/_josh_ellis_)
|
|
7
|
-
[](https://discord.gg/ZZjjNvJ)
|
|
8
|
-
|
|
9
|
-
`@react-three/test-renderer` is a React testing <a href="https://reactjs.org/docs/codebase-overview.html#renderers">renderer</a> for threejs in node.
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
yarn add @react-three/fiber three
|
|
13
|
-
yarn add -D @react-three/test-renderer
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## The problem
|
|
19
|
-
|
|
20
|
-
You've written a complex and amazing webgl experience using [`@react-three/fiber`](https://github.com/pmndrs/react-three-fiber) and you want to test it to make sure it works even after you add even more features.
|
|
21
|
-
|
|
22
|
-
You go to use `react-dom` but hang on, `THREE` elements aren't in the DOM! You decide to use `@react-three/test-renderer` you can see the container & the canvas but you can't see the tree for the scene!? That's because `@react-three/fiber` renders to a different react root with it's own reconciler.
|
|
23
|
-
|
|
24
|
-
## The solution
|
|
25
|
-
|
|
26
|
-
You use `@react-three/test-renderer` ⚛️-🔼-🧪, an experimental React renderer using `@react-three/fiber` under the hood to expose the scene graph wrapped in a test instance providing helpful utilities to test with.
|
|
27
|
-
|
|
28
|
-
Essentially, this package makes it easy to grab a snapshot of the Scene Graph rendered by `three` without the need for webgl & browser.
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Usage
|
|
33
|
-
|
|
34
|
-
RTTR is testing library agnostic, so we hope that it works with libraries such as [`jest`](https://jestjs.io/), [`jasmine`](https://jasmine.github.io/) etc.
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
import ReactThreeTestRenderer from '@react-three/test-renderer'
|
|
38
|
-
|
|
39
|
-
const renderer = await ReactThreeTestRenderer.create(
|
|
40
|
-
<mesh>
|
|
41
|
-
<boxGeometry args={[2, 2]} />
|
|
42
|
-
<meshStandardMaterial
|
|
43
|
-
args={[
|
|
44
|
-
{
|
|
45
|
-
color: 0x0000ff,
|
|
46
|
-
},
|
|
47
|
-
]}
|
|
48
|
-
/>
|
|
49
|
-
</mesh>,
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
// assertions using the TestInstance & Scene Graph
|
|
53
|
-
console.log(renderer.toGraph())
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## API
|
|
59
|
-
|
|
60
|
-
- [React Three Test Renderer API](/packages/test-renderer/markdown/rttr.md)
|
|
61
|
-
- [React Three Test Instance API](/packages/test-renderer/markdown/rttr-instance.md)
|
|
1
|
+
# React Three Test Renderer ⚛️🔼🧪
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.com/package/@react-three/test-renderer)
|
|
4
|
+
[](https://npmjs.com/package/@react-three/test-renderer)
|
|
5
|
+
[](https://twitter.com/pmndrs)
|
|
6
|
+
[](https://twitter.com/_josh_ellis_)
|
|
7
|
+
[](https://discord.gg/ZZjjNvJ)
|
|
8
|
+
|
|
9
|
+
`@react-three/test-renderer` is a React testing <a href="https://reactjs.org/docs/codebase-overview.html#renderers">renderer</a> for threejs in node.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
yarn add @react-three/fiber three
|
|
13
|
+
yarn add -D @react-three/test-renderer
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## The problem
|
|
19
|
+
|
|
20
|
+
You've written a complex and amazing webgl experience using [`@react-three/fiber`](https://github.com/pmndrs/react-three-fiber) and you want to test it to make sure it works even after you add even more features.
|
|
21
|
+
|
|
22
|
+
You go to use `react-dom` but hang on, `THREE` elements aren't in the DOM! You decide to use `@react-three/test-renderer` you can see the container & the canvas but you can't see the tree for the scene!? That's because `@react-three/fiber` renders to a different react root with it's own reconciler.
|
|
23
|
+
|
|
24
|
+
## The solution
|
|
25
|
+
|
|
26
|
+
You use `@react-three/test-renderer` ⚛️-🔼-🧪, an experimental React renderer using `@react-three/fiber` under the hood to expose the scene graph wrapped in a test instance providing helpful utilities to test with.
|
|
27
|
+
|
|
28
|
+
Essentially, this package makes it easy to grab a snapshot of the Scene Graph rendered by `three` without the need for webgl & browser.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
RTTR is testing library agnostic, so we hope that it works with libraries such as [`jest`](https://jestjs.io/), [`jasmine`](https://jasmine.github.io/) etc.
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import ReactThreeTestRenderer from '@react-three/test-renderer'
|
|
38
|
+
|
|
39
|
+
const renderer = await ReactThreeTestRenderer.create(
|
|
40
|
+
<mesh>
|
|
41
|
+
<boxGeometry args={[2, 2]} />
|
|
42
|
+
<meshStandardMaterial
|
|
43
|
+
args={[
|
|
44
|
+
{
|
|
45
|
+
color: 0x0000ff,
|
|
46
|
+
},
|
|
47
|
+
]}
|
|
48
|
+
/>
|
|
49
|
+
</mesh>,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
// assertions using the TestInstance & Scene Graph
|
|
53
|
+
console.log(renderer.toGraph())
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## API
|
|
59
|
+
|
|
60
|
+
- [React Three Test Renderer API](/packages/test-renderer/markdown/rttr.md)
|
|
61
|
+
- [React Three Test Instance API](/packages/test-renderer/markdown/rttr-instance.md)
|
|
@@ -629,9 +629,9 @@ const createCanvas = ({
|
|
|
629
629
|
}
|
|
630
630
|
beforeReturn == null ? void 0 : beforeReturn(canvas);
|
|
631
631
|
class WebGLRenderingContext extends WebGL2RenderingContext {}
|
|
632
|
-
// @ts-
|
|
632
|
+
// @ts-expect-error
|
|
633
633
|
(_globalThis$WebGLRend = globalThis.WebGLRenderingContext) != null ? _globalThis$WebGLRend : globalThis.WebGLRenderingContext = WebGLRenderingContext;
|
|
634
|
-
// @ts-
|
|
634
|
+
// @ts-expect-error
|
|
635
635
|
(_globalThis$WebGL2Ren = globalThis.WebGL2RenderingContext) != null ? _globalThis$WebGL2Ren : globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
636
636
|
return canvas;
|
|
637
637
|
};
|
|
@@ -713,9 +713,9 @@ class ReactThreeTestInstance {
|
|
|
713
713
|
exhaustive: false
|
|
714
714
|
}) => {
|
|
715
715
|
if (opts.exhaustive) {
|
|
716
|
-
/**
|
|
717
|
-
* this will return objects like
|
|
718
|
-
* color or effects etc.
|
|
716
|
+
/**
|
|
717
|
+
* this will return objects like
|
|
718
|
+
* color or effects etc.
|
|
719
719
|
*/
|
|
720
720
|
return [...(fiber.children || []).map(fib => wrapFiber(fib)), ...fiber.__r3f.objects.map(fib => wrapFiber(fib))];
|
|
721
721
|
} else {
|
|
@@ -790,9 +790,18 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
790
790
|
fiber.extend(THREE__namespace);
|
|
791
791
|
const act = fiber.act;
|
|
792
792
|
const create = async (element, options) => {
|
|
793
|
+
var _options$width, _options$height;
|
|
793
794
|
const canvas = createCanvas(options);
|
|
794
795
|
const _root = fiber.createRoot(canvas).configure({
|
|
795
796
|
frameloop: 'never',
|
|
797
|
+
// TODO: remove and use default behavior
|
|
798
|
+
size: {
|
|
799
|
+
width: (_options$width = options == null ? void 0 : options.width) != null ? _options$width : 1280,
|
|
800
|
+
height: (_options$height = options == null ? void 0 : options.height) != null ? _options$height : 800,
|
|
801
|
+
top: 0,
|
|
802
|
+
left: 0,
|
|
803
|
+
updateStyle: typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement
|
|
804
|
+
},
|
|
796
805
|
...options,
|
|
797
806
|
events: undefined
|
|
798
807
|
});
|
|
@@ -629,9 +629,9 @@ const createCanvas = ({
|
|
|
629
629
|
}
|
|
630
630
|
beforeReturn == null ? void 0 : beforeReturn(canvas);
|
|
631
631
|
class WebGLRenderingContext extends WebGL2RenderingContext {}
|
|
632
|
-
// @ts-
|
|
632
|
+
// @ts-expect-error
|
|
633
633
|
(_globalThis$WebGLRend = globalThis.WebGLRenderingContext) != null ? _globalThis$WebGLRend : globalThis.WebGLRenderingContext = WebGLRenderingContext;
|
|
634
|
-
// @ts-
|
|
634
|
+
// @ts-expect-error
|
|
635
635
|
(_globalThis$WebGL2Ren = globalThis.WebGL2RenderingContext) != null ? _globalThis$WebGL2Ren : globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
636
636
|
return canvas;
|
|
637
637
|
};
|
|
@@ -713,9 +713,9 @@ class ReactThreeTestInstance {
|
|
|
713
713
|
exhaustive: false
|
|
714
714
|
}) => {
|
|
715
715
|
if (opts.exhaustive) {
|
|
716
|
-
/**
|
|
717
|
-
* this will return objects like
|
|
718
|
-
* color or effects etc.
|
|
716
|
+
/**
|
|
717
|
+
* this will return objects like
|
|
718
|
+
* color or effects etc.
|
|
719
719
|
*/
|
|
720
720
|
return [...(fiber.children || []).map(fib => wrapFiber(fib)), ...fiber.__r3f.objects.map(fib => wrapFiber(fib))];
|
|
721
721
|
} else {
|
|
@@ -790,9 +790,18 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
790
790
|
fiber.extend(THREE__namespace);
|
|
791
791
|
const act = fiber.act;
|
|
792
792
|
const create = async (element, options) => {
|
|
793
|
+
var _options$width, _options$height;
|
|
793
794
|
const canvas = createCanvas(options);
|
|
794
795
|
const _root = fiber.createRoot(canvas).configure({
|
|
795
796
|
frameloop: 'never',
|
|
797
|
+
// TODO: remove and use default behavior
|
|
798
|
+
size: {
|
|
799
|
+
width: (_options$width = options == null ? void 0 : options.width) != null ? _options$width : 1280,
|
|
800
|
+
height: (_options$height = options == null ? void 0 : options.height) != null ? _options$height : 800,
|
|
801
|
+
top: 0,
|
|
802
|
+
left: 0,
|
|
803
|
+
updateStyle: typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement
|
|
804
|
+
},
|
|
796
805
|
...options,
|
|
797
806
|
events: undefined
|
|
798
807
|
});
|
|
@@ -604,9 +604,9 @@ const createCanvas = ({
|
|
|
604
604
|
}
|
|
605
605
|
beforeReturn == null ? void 0 : beforeReturn(canvas);
|
|
606
606
|
class WebGLRenderingContext extends WebGL2RenderingContext {}
|
|
607
|
-
// @ts-
|
|
607
|
+
// @ts-expect-error
|
|
608
608
|
(_globalThis$WebGLRend = globalThis.WebGLRenderingContext) != null ? _globalThis$WebGLRend : globalThis.WebGLRenderingContext = WebGLRenderingContext;
|
|
609
|
-
// @ts-
|
|
609
|
+
// @ts-expect-error
|
|
610
610
|
(_globalThis$WebGL2Ren = globalThis.WebGL2RenderingContext) != null ? _globalThis$WebGL2Ren : globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
611
611
|
return canvas;
|
|
612
612
|
};
|
|
@@ -688,9 +688,9 @@ class ReactThreeTestInstance {
|
|
|
688
688
|
exhaustive: false
|
|
689
689
|
}) => {
|
|
690
690
|
if (opts.exhaustive) {
|
|
691
|
-
/**
|
|
692
|
-
* this will return objects like
|
|
693
|
-
* color or effects etc.
|
|
691
|
+
/**
|
|
692
|
+
* this will return objects like
|
|
693
|
+
* color or effects etc.
|
|
694
694
|
*/
|
|
695
695
|
return [...(fiber.children || []).map(fib => wrapFiber(fib)), ...fiber.__r3f.objects.map(fib => wrapFiber(fib))];
|
|
696
696
|
} else {
|
|
@@ -765,9 +765,18 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
765
765
|
extend(THREE);
|
|
766
766
|
const act = act$2;
|
|
767
767
|
const create = async (element, options) => {
|
|
768
|
+
var _options$width, _options$height;
|
|
768
769
|
const canvas = createCanvas(options);
|
|
769
770
|
const _root = createRoot(canvas).configure({
|
|
770
771
|
frameloop: 'never',
|
|
772
|
+
// TODO: remove and use default behavior
|
|
773
|
+
size: {
|
|
774
|
+
width: (_options$width = options == null ? void 0 : options.width) != null ? _options$width : 1280,
|
|
775
|
+
height: (_options$height = options == null ? void 0 : options.height) != null ? _options$height : 800,
|
|
776
|
+
top: 0,
|
|
777
|
+
left: 0,
|
|
778
|
+
updateStyle: typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement
|
|
779
|
+
},
|
|
771
780
|
...options,
|
|
772
781
|
events: undefined
|
|
773
782
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/test-renderer",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.2",
|
|
4
4
|
"description": "Test Renderer for react-three-fiber",
|
|
5
5
|
"author": "Josh Ellis",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"react": ">=
|
|
26
|
-
"@react-three/fiber": ">=8
|
|
27
|
-
"three": ">=0.
|
|
25
|
+
"react": ">=18 <19",
|
|
26
|
+
"@react-three/fiber": ">=8 < 9",
|
|
27
|
+
"three": ">=0.133"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare class WebGL2RenderingContext {
|
|
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): string[] | number[] | undefined;
|
|
13
|
-
getExtension(ext: string): any;
|
|
14
|
-
getProgramInfoLog: () => string;
|
|
15
|
-
getShaderInfoLog: () => string;
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
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,4 +0,0 @@
|
|
|
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,5 +0,0 @@
|
|
|
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,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { CreateOptions, Renderer, Act } from './types/public';
|
|
3
|
-
import { waitFor, WaitOptions } from './helpers/waitFor';
|
|
4
|
-
declare const act: Act;
|
|
5
|
-
declare const create: (element: React.ReactNode, options?: Partial<CreateOptions> | undefined) => Promise<Renderer>;
|
|
6
|
-
export { create, act, waitFor };
|
|
7
|
-
export type { WaitOptions };
|
|
8
|
-
export * as ReactThreeTest from './types';
|
|
9
|
-
declare const _default: {
|
|
10
|
-
create: (element: React.ReactNode, options?: Partial<CreateOptions> | undefined) => Promise<Renderer>;
|
|
11
|
-
act: Act;
|
|
12
|
-
waitFor: typeof waitFor;
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './public';
|
|
@@ -1,31 +0,0 @@
|
|
|
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' | 'parent'> & {
|
|
7
|
-
root: MockUseStoreState;
|
|
8
|
-
objects: MockSceneChild[];
|
|
9
|
-
parent: 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,38 +0,0 @@
|
|
|
1
|
-
import type { Camera, RenderProps } from '@react-three/fiber';
|
|
2
|
-
import { ReactThreeTestInstance } from '../createTestInstance';
|
|
3
|
-
import type { MockEventData, CreateCanvasParameters } from './internal';
|
|
4
|
-
export { ReactThreeTestInstance };
|
|
5
|
-
export declare type MockSyntheticEvent = {
|
|
6
|
-
camera: Camera;
|
|
7
|
-
stopPropagation: () => void;
|
|
8
|
-
target: ReactThreeTestInstance;
|
|
9
|
-
currentTarget: ReactThreeTestInstance;
|
|
10
|
-
sourceEvent: MockEventData;
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
};
|
|
13
|
-
export declare type CreateOptions = CreateCanvasParameters & RenderProps<HTMLCanvasElement>;
|
|
14
|
-
export declare type Act = (cb: () => Promise<any>) => Promise<any>;
|
|
15
|
-
export declare type Renderer = {
|
|
16
|
-
scene: ReactThreeTestInstance;
|
|
17
|
-
unmount: () => Promise<void>;
|
|
18
|
-
getInstance: () => null | unknown;
|
|
19
|
-
update: (el: React.ReactNode) => Promise<void>;
|
|
20
|
-
toTree: () => Tree | undefined;
|
|
21
|
-
toGraph: () => SceneGraph | undefined;
|
|
22
|
-
fireEvent: (element: ReactThreeTestInstance, handler: string, data?: MockEventData) => Promise<any>;
|
|
23
|
-
advanceFrames: (frames: number, delta: number | number[]) => Promise<void>;
|
|
24
|
-
};
|
|
25
|
-
export interface SceneGraphItem {
|
|
26
|
-
type: string;
|
|
27
|
-
name: string;
|
|
28
|
-
children: SceneGraphItem[] | null;
|
|
29
|
-
}
|
|
30
|
-
export declare type SceneGraph = SceneGraphItem[];
|
|
31
|
-
export interface TreeNode {
|
|
32
|
-
type: string;
|
|
33
|
-
props: {
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
};
|
|
36
|
-
children: TreeNode[];
|
|
37
|
-
}
|
|
38
|
-
export declare type Tree = TreeNode[];
|