@tresjs/core 3.8.1 → 3.9.0

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.
@@ -1,8 +1,8 @@
1
1
  import { Loader, Object3D } from 'three';
2
2
 
3
3
  export interface TresLoader<T> extends Loader {
4
- load(url: string, onLoad?: (result: T) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): unknown;
5
- loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<T>;
4
+ load: (url: string, onLoad?: (result: T) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) => unknown;
5
+ loadAsync: (url: string, onProgress?: (event: ProgressEvent) => void) => Promise<T>;
6
6
  }
7
7
  export type LoaderProto<T> = new (...args: any) => TresLoader<T extends unknown ? any : T>;
8
8
  export type LoaderReturnType<T, L extends LoaderProto<T>> = T extends unknown ? Awaited<ReturnType<InstanceType<L>['loadAsync']>> : T;
@@ -1,6 +1,6 @@
1
1
  import { TresContext } from '../useTresContextProvider';
2
2
  import { TresScene } from 'src/types';
3
- import { Intersection, Event, Object3D } from 'three';
3
+ import { Event, Intersection, Object3D } from 'three';
4
4
 
5
5
  type CallbackFn = (intersection: Intersection<Object3D<Event>>, event: PointerEvent) => void;
6
6
  type CallbackFnPointerLeave = (object: Object3D<Event>, event: PointerEvent) => void;
@@ -1,6 +1,6 @@
1
1
  import { TresContext } from '../useTresContextProvider';
2
2
  import { Ref } from 'vue';
3
- import { Object3D, Intersection, Object3DEventMap } from 'three';
3
+ import { Intersection, Object3D, Object3DEventMap } from 'three';
4
4
 
5
5
  export type Intersects = Intersection<Object3D<Object3DEventMap>>[];
6
6
  interface PointerMoveEventPayload {
@@ -3,7 +3,7 @@ import { TresContext } from '../useTresContextProvider';
3
3
  import { TresColor } from '../../types';
4
4
  import { MaybeRefOrGetter } from '@vueuse/core';
5
5
  import { MaybeRef } from 'vue';
6
- import { WebGLRenderer, Scene, ToneMapping, ColorSpace, ShadowMapType, WebGLRendererParameters } from 'three';
6
+ import { WebGLRenderer, ColorSpace, Scene, ShadowMapType, ToneMapping, WebGLRendererParameters } from 'three';
7
7
 
8
8
  type TransformToMaybeRefOrGetter<T> = {
9
9
  [K in keyof T]: MaybeRefOrGetter<T[K]> | MaybeRefOrGetter<T[K]>;
@@ -70,12 +70,6 @@ export interface UseRendererOptions extends TransformToMaybeRefOrGetter<WebGLRen
70
70
  windowSize?: MaybeRefOrGetter<boolean | string>;
71
71
  preset?: MaybeRefOrGetter<RendererPresetsType>;
72
72
  }
73
- /**
74
- * Reactive three.js WebGLRenderer instance
75
- *
76
- * @param canvas
77
- * @param {UseRendererOptions} [options]
78
- */
79
73
  export declare function useRenderer({ scene, canvas, options, disableRender, contextParts: { sizes, camera }, }: {
80
74
  canvas: MaybeRef<HTMLCanvasElement>;
81
75
  scene: Scene;
@@ -1,4 +1,4 @@
1
- import { Scene, Object3D } from 'three';
1
+ import { Object3D, Scene } from 'three';
2
2
 
3
3
  /**
4
4
  * Seek composable return type
@@ -1,4 +1,4 @@
1
- import { MaybeRefOrGetter, MaybeRef, ComputedRef, Ref } from 'vue';
1
+ import { ComputedRef, MaybeRef, MaybeRefOrGetter, Ref } from 'vue';
2
2
 
3
3
  export interface SizesType {
4
4
  height: Readonly<Ref<number>>;
@@ -1,4 +1,4 @@
1
- export declare const render: import('vue').RootRenderFunction<import("src").TresObject>;
1
+ export declare const render: import('vue').RootRenderFunction<import('..').TresObject>;
2
2
  declare const _default: {
3
3
  extend: (objects: any) => any;
4
4
  };
@@ -1,6 +1,7 @@
1
+ import { vRotate } from './vRotate';
1
2
  import { vDistanceTo } from './vDistanceTo';
2
3
  import { vAlwaysLookAt } from './vAlwaysLookAt';
3
4
  import { vLightHelper } from './vLightHelper';
4
5
  import { vLog } from './vLog';
5
6
 
6
- export { vLog, vLightHelper, vAlwaysLookAt, vDistanceTo };
7
+ export { vLog, vLightHelper, vAlwaysLookAt, vDistanceTo, vRotate };
@@ -0,0 +1,13 @@
1
+ import { TresObject } from '../types';
2
+
3
+ export declare const vRotate: {
4
+ mounted: (el: TresObject, binding: {
5
+ arg: 'x' | 'y' | 'z';
6
+ value: number;
7
+ modifiers: Partial<{
8
+ x: boolean;
9
+ y: boolean;
10
+ z: boolean;
11
+ }>;
12
+ }) => void;
13
+ };
@@ -108,10 +108,10 @@ export interface EventHandlers {
108
108
  onWheel?: (event: ThreeEvent<WheelEvent>) => void;
109
109
  }
110
110
  interface MathRepresentation {
111
- set(...args: number[] | [THREE.ColorRepresentation]): any;
111
+ set: (...args: number[] | [THREE.ColorRepresentation]) => any;
112
112
  }
113
113
  interface VectorRepresentation extends MathRepresentation {
114
- setScalar(s: number): any;
114
+ setScalar: (s: number) => any;
115
115
  }
116
116
  export interface VectorCoordinates {
117
117
  x: number;
@@ -130,11 +130,11 @@ type WithMathProps<P> = {
130
130
  [K in keyof P]: P[K] extends MathRepresentation | THREE.Euler ? MathType<P[K]> : P[K];
131
131
  };
132
132
  interface RaycastableRepresentation {
133
- raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
133
+ raycast: (raycaster: THREE.Raycaster, intersects: THREE.Intersection[]) => void;
134
134
  }
135
135
  type EventProps<P> = P extends RaycastableRepresentation ? Partial<EventHandlers> : unknown;
136
136
  export interface VueProps<P> {
137
- children?: VNode[];
137
+ children?: VNode<P>[];
138
138
  ref?: VNodeRef;
139
139
  key?: string | number | symbol;
140
140
  }
@@ -1,4 +1,4 @@
1
- import { MeshBasicMaterial, Vector3, Mesh, Scene, Object3D } from 'three';
1
+ import { MeshBasicMaterial, Vector3, Mesh, Object3D, Scene } from 'three';
2
2
 
3
3
  export declare function toSetMethodName(key: string): string;
4
4
  export declare const merge: (target: any, source: any) => any;
@@ -1,4 +1,4 @@
1
- import { ColorRepresentation, Vector3, Color } from 'three';
1
+ import { ColorRepresentation, Color, Vector3 } from 'three';
2
2
 
3
3
  export type SizeFlexibleParams = number[] | {
4
4
  width: number;