@react-three/test-renderer 9.0.0-rc.0 → 9.0.0-rc.10

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,23 @@
1
1
  # @react-three/test-renderer
2
2
 
3
+ ## 8.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - dec2cb28: fix(test-renderer): include types in output
8
+
9
+ ## 8.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 2007c19b: fix: republish with types
14
+
15
+ ## 8.2.2
16
+
17
+ ### Patch Changes
18
+
19
+ - ff1a16f1: fix: narrow React peer dep range
20
+
3
21
  ## 8.2.1
4
22
 
5
23
  ### Patch Changes
@@ -0,0 +1,22 @@
1
+ import type * as THREE from 'three';
2
+ import type { Instance } from '@react-three/fiber';
3
+ import type { Obj } from "./types/internal.js";
4
+ export declare class ReactThreeTestInstance<TObject extends THREE.Object3D = THREE.Object3D> {
5
+ _fiber: Instance<TObject>;
6
+ constructor(fiber: Instance<TObject>);
7
+ get fiber(): Instance<TObject>;
8
+ get instance(): TObject;
9
+ get type(): string;
10
+ get props(): Obj;
11
+ get parent(): ReactThreeTestInstance | null;
12
+ get children(): ReactThreeTestInstance[];
13
+ get allChildren(): ReactThreeTestInstance[];
14
+ private getChildren;
15
+ findAll: (decider: (node: ReactThreeTestInstance) => boolean) => ReactThreeTestInstance[];
16
+ find: (decider: (node: ReactThreeTestInstance) => boolean) => ReactThreeTestInstance;
17
+ findByType: (type: string) => ReactThreeTestInstance;
18
+ findAllByType: (type: string) => ReactThreeTestInstance[];
19
+ findByProps: (props: Obj) => ReactThreeTestInstance;
20
+ findAllByProps: (props: Obj) => ReactThreeTestInstance[];
21
+ }
22
+ export declare const wrapFiber: (fiber: Instance) => ReactThreeTestInstance;
@@ -0,0 +1,5 @@
1
+ export interface WaitOptions {
2
+ interval?: number;
3
+ timeout?: number;
4
+ }
5
+ export declare function waitFor(callback: () => boolean | void, { interval, timeout }?: WaitOptions): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import { act } from '@react-three/fiber';
3
+ import type { CreateOptions, Renderer } from "./types/public.js";
4
+ import { waitFor, WaitOptions } from "./helpers/waitFor.js";
5
+ declare const create: (element: React.ReactNode, options?: Partial<CreateOptions>) => Promise<Renderer>;
6
+ export { create, act, waitFor };
7
+ export type { WaitOptions };
8
+ export * as ReactThreeTest from "./types/index.js";
9
+ declare const _default: {
10
+ create: (element: React.ReactNode, options?: Partial<CreateOptions> | undefined) => Promise<Renderer>;
11
+ act: import("@react-three/fiber").Act;
12
+ waitFor: typeof waitFor;
13
+ };
14
+ export default _default;
@@ -0,0 +1 @@
1
+ export * from "./public.js";
@@ -0,0 +1,20 @@
1
+ export type CreateCanvasParameters = {
2
+ beforeReturn?: (canvas: HTMLCanvasElement) => void;
3
+ width?: number;
4
+ height?: number;
5
+ };
6
+ export interface Obj {
7
+ [key: string]: any;
8
+ }
9
+ /**
10
+ * this is an empty object of any,
11
+ * the data is passed to a new event
12
+ * and subsequently passed to the
13
+ * event handler you're calling
14
+ */
15
+ export type MockEventData = {
16
+ [key: string]: any;
17
+ };
18
+ export interface TestInstanceChildOpts {
19
+ exhaustive: boolean;
20
+ }
@@ -0,0 +1,38 @@
1
+ import type { Camera, RenderProps } from '@react-three/fiber';
2
+ import { ReactThreeTestInstance } from "../createTestInstance.js";
3
+ import type { MockEventData, CreateCanvasParameters } from "./internal.js";
4
+ export { ReactThreeTestInstance };
5
+ export type MockSyntheticEvent = {
6
+ camera: Camera;
7
+ stopPropagation: () => void;
8
+ target: ReactThreeTestInstance;
9
+ currentTarget: ReactThreeTestInstance;
10
+ sourceEvent: MockEventData;
11
+ [key: string]: any;
12
+ };
13
+ export type CreateOptions = CreateCanvasParameters & RenderProps<HTMLCanvasElement>;
14
+ export type Renderer = {
15
+ scene: ReactThreeTestInstance;
16
+ unmount: () => Promise<void>;
17
+ getInstance: () => null | unknown;
18
+ update: (el: React.ReactNode) => Promise<void>;
19
+ toTree: () => Tree | undefined;
20
+ toGraph: () => SceneGraph | undefined;
21
+ fireEvent: (element: ReactThreeTestInstance, handler: string, data?: MockEventData) => Promise<any>;
22
+ advanceFrames: (frames: number, delta: number | number[]) => Promise<void>;
23
+ };
24
+ export interface SceneGraphItem {
25
+ type: string;
26
+ name: string;
27
+ children: SceneGraphItem[] | null;
28
+ }
29
+ export type SceneGraph = SceneGraphItem[];
30
+ export interface TreeNode {
31
+ type: string;
32
+ props: {
33
+ [key: string]: any;
34
+ };
35
+ children: TreeNode[];
36
+ }
37
+ export type Tree = TreeNode[];
38
+ export type { Act } from '@react-three/fiber';
@@ -758,7 +758,8 @@ fiber.extend(THREE__namespace);
758
758
  const create = async (element, options) => {
759
759
  var _options$width, _options$height;
760
760
  const canvas = createCanvas(options);
761
- const _root = fiber.createRoot(canvas).configure({
761
+ const _root = fiber.createRoot(canvas);
762
+ await _root.configure({
762
763
  frameloop: 'never',
763
764
  // TODO: remove and use default behavior
764
765
  size: {
@@ -758,7 +758,8 @@ fiber.extend(THREE__namespace);
758
758
  const create = async (element, options) => {
759
759
  var _options$width, _options$height;
760
760
  const canvas = createCanvas(options);
761
- const _root = fiber.createRoot(canvas).configure({
761
+ const _root = fiber.createRoot(canvas);
762
+ await _root.configure({
762
763
  frameloop: 'never',
763
764
  // TODO: remove and use default behavior
764
765
  size: {
@@ -735,7 +735,8 @@ extend(THREE);
735
735
  const create = async (element, options) => {
736
736
  var _options$width, _options$height;
737
737
  const canvas = createCanvas(options);
738
- const _root = createRoot(canvas).configure({
738
+ const _root = createRoot(canvas);
739
+ await _root.configure({
739
740
  frameloop: 'never',
740
741
  // TODO: remove and use default behavior
741
742
  size: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/test-renderer",
3
- "version": "9.0.0-rc.0",
3
+ "version": "9.0.0-rc.10",
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": ">=19.0",
26
- "@react-three/fiber": "9.0.0-rc.0",
27
- "three": ">=0.141"
25
+ "react": "^19.0.0",
26
+ "@react-three/fiber": ">=9.0.0",
27
+ "three": ">=0.156"
28
28
  }
29
29
  }