@tresjs/core 3.7.0 → 3.8.1
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/README.md +1 -0
- package/components.d.ts +1 -1
- package/composables.d.ts +1 -1
- package/dist/src/components/TresCanvas.vue.d.ts +7 -6
- package/dist/src/components/index.d.ts +2 -1
- package/dist/src/composables/useCamera/index.d.ts +472 -433
- package/dist/src/composables/useLoader/index.d.ts +3 -2
- package/dist/src/composables/useLogger.d.ts +5 -2
- package/dist/src/composables/usePointerEventHandler/index.d.ts +4 -3
- package/dist/src/composables/useRaycaster/index.d.ts +7 -6
- package/dist/src/composables/useRenderLoop/index.d.ts +3 -2
- package/dist/src/composables/useRenderer/index.d.ts +8 -8
- package/dist/src/composables/useSeek/index.d.ts +6 -4
- package/dist/src/composables/useSizes/index.d.ts +12 -0
- package/dist/src/composables/useTexture/index.d.ts +2 -1
- package/dist/src/composables/useTresContextProvider/index.d.ts +6 -9
- package/dist/src/core/catalogue.d.ts +3 -2
- package/dist/src/core/nodeOps.d.ts +3 -2
- package/dist/src/core/renderer.d.ts +1 -1
- package/dist/src/devtools/plugin.d.ts +3 -2
- package/dist/src/directives/index.d.ts +4 -3
- package/dist/src/directives/vAlwaysLookAt.d.ts +4 -3
- package/dist/src/directives/vDistanceTo.d.ts +3 -2
- package/dist/src/directives/vLightHelper.d.ts +2 -1
- package/dist/src/directives/vLog.d.ts +2 -1
- package/dist/src/index.d.ts +3 -2
- package/dist/src/types/index.d.ts +3 -2
- package/dist/src/utils/index.d.ts +2 -2
- package/dist/src/utils/normalize.d.ts +2 -2
- package/dist/src/utils/perf.d.ts +3 -2
- package/dist/src/utils/test-utils.d.ts +1 -1
- package/dist/tres.js +573 -578
- package/dist/tres.umd.cjs +2 -2
- package/package.json +18 -17
- package/types.d.ts +1 -1
- package/utils.d.ts +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Loader, Object3D } from 'three';
|
|
2
|
+
|
|
3
|
+
export interface TresLoader<T> extends Loader {
|
|
3
4
|
load(url: string, onLoad?: (result: T) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): unknown;
|
|
4
5
|
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<T>;
|
|
5
6
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export declare const isProd: boolean;
|
|
2
|
+
type OneOrMore<T> = {
|
|
3
|
+
0: T;
|
|
4
|
+
} & Array<T>;
|
|
2
5
|
interface LoggerComposition {
|
|
3
|
-
logError: (
|
|
4
|
-
logWarning: (
|
|
6
|
+
logError: (...args: OneOrMore<any>) => void;
|
|
7
|
+
logWarning: (...args: OneOrMore<any>) => void;
|
|
5
8
|
logMessage: (name: string, value: any) => void;
|
|
6
9
|
}
|
|
7
10
|
export declare function useLogger(): LoggerComposition;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { TresContext } from '../useTresContextProvider';
|
|
2
|
+
import { TresScene } from 'src/types';
|
|
3
|
+
import { Intersection, Event, Object3D } from 'three';
|
|
4
|
+
|
|
4
5
|
type CallbackFn = (intersection: Intersection<Object3D<Event>>, event: PointerEvent) => void;
|
|
5
6
|
type CallbackFnPointerLeave = (object: Object3D<Event>, event: PointerEvent) => void;
|
|
6
7
|
export interface EventProps {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { TresContext } from '../useTresContextProvider';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { Object3D, Intersection, Object3DEventMap } from 'three';
|
|
4
|
+
|
|
5
|
+
export type Intersects = Intersection<Object3D<Object3DEventMap>>[];
|
|
5
6
|
interface PointerMoveEventPayload {
|
|
6
7
|
intersects?: Intersects;
|
|
7
8
|
event: PointerEvent;
|
|
@@ -10,8 +11,8 @@ interface PointerClickEventPayload {
|
|
|
10
11
|
intersects: Intersects;
|
|
11
12
|
event: PointerEvent;
|
|
12
13
|
}
|
|
13
|
-
export declare const useRaycaster: (objects: Ref<
|
|
14
|
-
intersects: import(
|
|
14
|
+
export declare const useRaycaster: (objects: Ref<Object3D[]>, { renderer, camera, raycaster }: Pick<TresContext, 'renderer' | 'camera' | 'raycaster'>) => {
|
|
15
|
+
intersects: import('vue').ComputedRef<Intersects>;
|
|
15
16
|
onClick: (fn: (value: PointerClickEventPayload) => void) => () => void;
|
|
16
17
|
onPointerMove: (fn: (value: PointerMoveEventPayload) => void) => () => void;
|
|
17
18
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { EventHookOn, Fn } from '@vueuse/core';
|
|
2
|
-
import type { Ref } from 'vue';
|
|
3
1
|
import { Clock } from 'three';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { EventHookOn, Fn } from '@vueuse/core';
|
|
4
|
+
|
|
4
5
|
export interface RenderLoop {
|
|
5
6
|
delta: number;
|
|
6
7
|
elapsed: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { RendererPresetsType } from './const';
|
|
2
|
+
import { TresContext } from '../useTresContextProvider';
|
|
3
|
+
import { TresColor } from '../../types';
|
|
4
|
+
import { MaybeRefOrGetter } from '@vueuse/core';
|
|
5
|
+
import { MaybeRef } from 'vue';
|
|
6
|
+
import { WebGLRenderer, Scene, ToneMapping, ColorSpace, ShadowMapType, WebGLRendererParameters } from 'three';
|
|
7
|
+
|
|
8
8
|
type TransformToMaybeRefOrGetter<T> = {
|
|
9
9
|
[K in keyof T]: MaybeRefOrGetter<T[K]> | MaybeRefOrGetter<T[K]>;
|
|
10
10
|
};
|
|
@@ -83,7 +83,7 @@ export declare function useRenderer({ scene, canvas, options, disableRender, con
|
|
|
83
83
|
contextParts: Pick<TresContext, 'sizes' | 'camera'>;
|
|
84
84
|
disableRender: MaybeRefOrGetter<boolean>;
|
|
85
85
|
}): {
|
|
86
|
-
renderer: import(
|
|
86
|
+
renderer: import('vue').ShallowRef<WebGLRenderer>;
|
|
87
87
|
};
|
|
88
88
|
export type UseRendererReturn = ReturnType<typeof useRenderer>;
|
|
89
89
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Scene, Object3D } from 'three';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Seek composable return type
|
|
3
5
|
*
|
|
@@ -5,10 +7,10 @@
|
|
|
5
7
|
* @interface UseSeekReturn
|
|
6
8
|
*/
|
|
7
9
|
export interface UseSeekReturn {
|
|
8
|
-
seek: (parent:
|
|
9
|
-
seekByName: (parent:
|
|
10
|
-
seekAll: (parent:
|
|
11
|
-
seekAllByName: (parent:
|
|
10
|
+
seek: (parent: Scene | Object3D, property: string, value: string) => Object3D | null;
|
|
11
|
+
seekByName: (parent: Scene | Object3D, value: string) => Object3D | null;
|
|
12
|
+
seekAll: (parent: Scene | Object3D, property: string, value: string) => Object3D[];
|
|
13
|
+
seekAllByName: (parent: Scene | Object3D, value: string) => Object3D[];
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* Composable that provides utilities to easily traverse and navigate through complex scenes and object children graphs
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, MaybeRef, ComputedRef, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface SizesType {
|
|
4
|
+
height: Readonly<Ref<number>>;
|
|
5
|
+
width: Readonly<Ref<number>>;
|
|
6
|
+
aspectRatio: ComputedRef<number>;
|
|
7
|
+
}
|
|
8
|
+
export default function useSizes(windowSize: MaybeRefOrGetter<boolean>, canvas: MaybeRef<HTMLCanvasElement>, debounceMs?: number): {
|
|
9
|
+
height: Readonly<Ref<number>>;
|
|
10
|
+
width: Readonly<Ref<number>>;
|
|
11
|
+
aspectRatio: ComputedRef<number>;
|
|
12
|
+
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { SizesType } from '../useSizes';
|
|
2
|
+
import { UseRendererOptions } from '../useRenderer';
|
|
3
|
+
import { ComputedRef, DeepReadonly, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef } from 'vue';
|
|
4
|
+
import { Camera, EventDispatcher, Scene, WebGLRenderer, Raycaster } from 'three';
|
|
5
|
+
|
|
5
6
|
export interface TresContext {
|
|
6
7
|
scene: ShallowRef<Scene>;
|
|
7
|
-
sizes:
|
|
8
|
-
height: Ref<number>;
|
|
9
|
-
width: Ref<number>;
|
|
10
|
-
aspectRatio: ComputedRef<number>;
|
|
11
|
-
};
|
|
8
|
+
sizes: SizesType;
|
|
12
9
|
extend: (objects: any) => void;
|
|
13
10
|
camera: ComputedRef<Camera | undefined>;
|
|
14
11
|
cameras: DeepReadonly<Ref<Camera[]>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { TresCatalogue } from '../types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
|
|
3
4
|
export declare const catalogue: Ref<TresCatalogue>;
|
|
4
5
|
export declare const extend: (objects: any) => any;
|
|
5
6
|
declare const _default: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { TresContext } from '../composables';
|
|
2
|
+
import { App as DevtoolsApp } from '@vue/devtools-api';
|
|
3
|
+
|
|
3
4
|
export interface Tags {
|
|
4
5
|
label: string;
|
|
5
6
|
textColor: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { vLog } from './vLog';
|
|
2
|
-
import { vLightHelper } from './vLightHelper';
|
|
3
|
-
import { vAlwaysLookAt } from './vAlwaysLookAt';
|
|
4
1
|
import { vDistanceTo } from './vDistanceTo';
|
|
2
|
+
import { vAlwaysLookAt } from './vAlwaysLookAt';
|
|
3
|
+
import { vLightHelper } from './vLightHelper';
|
|
4
|
+
import { vLog } from './vLog';
|
|
5
|
+
|
|
5
6
|
export { vLog, vLightHelper, vAlwaysLookAt, vDistanceTo };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { TresVector3 } from '../types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { Object3D } from 'three';
|
|
4
|
+
|
|
4
5
|
export declare const vAlwaysLookAt: {
|
|
5
6
|
updated: (el: Object3D, binding: Ref<TresVector3>) => void;
|
|
6
7
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { TresObject } from '../types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
|
|
3
4
|
export declare const vDistanceTo: {
|
|
4
5
|
updated: (el: TresObject, binding: Ref<TresObject>) => void;
|
|
5
6
|
unmounted: (el: TresObject) => void;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { default as templateCompilerOptions } from './utils/template-compiler-options';
|
|
2
2
|
import { normalizeColor, normalizeVectorFlexibleParam } from './utils/normalize';
|
|
3
|
-
import
|
|
3
|
+
import { App } from 'vue';
|
|
4
|
+
|
|
4
5
|
export * from './composables';
|
|
5
6
|
export * from './core/catalogue';
|
|
6
7
|
export * from './components';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EventProps as PointerEventHandlerEventProps } from '../composables/usePointerEventHandler';
|
|
2
|
+
import { DefineComponent, VNode, VNodeRef } from 'vue';
|
|
3
|
+
|
|
2
4
|
import type * as THREE from 'three';
|
|
3
|
-
import type { EventProps as PointerEventHandlerEventProps } from '../composables/usePointerEventHandler';
|
|
4
5
|
export type AttachFnType<O = any> = (parent: any, self: O) => () => void;
|
|
5
6
|
export type AttachType<O = any> = string | AttachFnType<O>;
|
|
6
7
|
export type ConstructorRepresentation = new (...args: any[]) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MeshBasicMaterial, Vector3 } from 'three';
|
|
2
|
-
|
|
1
|
+
import { MeshBasicMaterial, Vector3, Mesh, Scene, Object3D } from 'three';
|
|
2
|
+
|
|
3
3
|
export declare function toSetMethodName(key: string): string;
|
|
4
4
|
export declare const merge: (target: any, source: any) => any;
|
|
5
5
|
export declare const isHTMLTag: (key: string) => boolean;
|
package/dist/src/utils/perf.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { TresObject } from './../types';
|
|
2
|
+
import { Scene } from 'three';
|
|
3
|
+
|
|
3
4
|
export declare function calculateMemoryUsage(object: TresObject | Scene): number;
|
|
4
5
|
export declare function bytesToKB(bytes: number): string;
|
|
5
6
|
export declare function bytesToMB(bytes: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function withSetup(composable: any): (import(
|
|
1
|
+
export declare function withSetup(composable: any): (import('vue').App<Element> | undefined)[];
|