@react-three/test-renderer 8.0.16 → 8.0.17

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/test-renderer
2
2
 
3
+ ## 8.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 786ccb46: fix: restore RTTR version
8
+
3
9
  ## 8.0.16
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -38,7 +38,7 @@ import ReactThreeTestRenderer from '@react-three/test-renderer'
38
38
 
39
39
  const renderer = await ReactThreeTestRenderer.create(
40
40
  <mesh>
41
- <boxBufferGeometry args={[2, 2]} />
41
+ <boxGeometry args={[2, 2]} />
42
42
  <meshStandardMaterial
43
43
  args={[
44
44
  {
@@ -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 @@
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
+ export declare const createWebGLContext: (canvas: HTMLCanvasElement) => RenderingContext;
@@ -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 { 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
+ 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,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[];
@@ -655,12 +655,15 @@ const create = async (element, options) => {
655
655
  width: options == null ? void 0 : options.width,
656
656
  height: options == null ? void 0 : options.height,
657
657
  beforeReturn: canvas => {
658
- //@ts-ignore
659
- canvas.getContext = type => {
660
- if (type === 'webgl' || type === 'webgl2') {
658
+ function getContext(contextId) {
659
+ if (contextId === 'webgl' || contextId === 'webgl2') {
661
660
  return createWebGLContext(canvas);
662
661
  }
663
- };
662
+
663
+ return null;
664
+ }
665
+
666
+ canvas.getContext = getContext;
664
667
  }
665
668
  });
666
669
  const _fiber = canvas;
@@ -655,12 +655,15 @@ const create = async (element, options) => {
655
655
  width: options == null ? void 0 : options.width,
656
656
  height: options == null ? void 0 : options.height,
657
657
  beforeReturn: canvas => {
658
- //@ts-ignore
659
- canvas.getContext = type => {
660
- if (type === 'webgl' || type === 'webgl2') {
658
+ function getContext(contextId) {
659
+ if (contextId === 'webgl' || contextId === 'webgl2') {
661
660
  return createWebGLContext(canvas);
662
661
  }
663
- };
662
+
663
+ return null;
664
+ }
665
+
666
+ canvas.getContext = getContext;
664
667
  }
665
668
  });
666
669
  const _fiber = canvas;
@@ -631,12 +631,15 @@ const create = async (element, options) => {
631
631
  width: options == null ? void 0 : options.width,
632
632
  height: options == null ? void 0 : options.height,
633
633
  beforeReturn: canvas => {
634
- //@ts-ignore
635
- canvas.getContext = type => {
636
- if (type === 'webgl' || type === 'webgl2') {
634
+ function getContext(contextId) {
635
+ if (contextId === 'webgl' || contextId === 'webgl2') {
637
636
  return createWebGLContext(canvas);
638
637
  }
639
- };
638
+
639
+ return null;
640
+ }
641
+
642
+ canvas.getContext = getContext;
640
643
  }
641
644
  });
642
645
  const _fiber = canvas;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/test-renderer",
3
- "version": "8.0.16",
3
+ "version": "8.0.17",
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",
26
+ "@react-three/fiber": ">=8.0.0",
27
27
  "three": ">=0.126"
28
28
  }
29
29
  }