@tresjs/core 3.7.0-next.0 → 3.8.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.
Files changed (42) hide show
  1. package/dist/index.d.ts +3 -18
  2. package/dist/{components → src/components}/TresCanvas.vue.d.ts +11 -9
  3. package/dist/src/components/index.d.ts +3 -0
  4. package/dist/{composables → src/composables}/useCamera/index.d.ts +472 -433
  5. package/dist/{composables → src/composables}/useLogger.d.ts +5 -2
  6. package/dist/{composables → src/composables}/usePointerEventHandler/index.d.ts +4 -3
  7. package/dist/{composables → src/composables}/useRenderLoop/index.d.ts +3 -2
  8. package/dist/{composables → src/composables}/useRenderer/index.d.ts +8 -8
  9. package/dist/src/composables/useSizes/index.d.ts +12 -0
  10. package/dist/{composables → src/composables}/useTexture/index.d.ts +2 -1
  11. package/dist/{composables → src/composables}/useTresContextProvider/index.d.ts +6 -9
  12. package/dist/{core → src/core}/catalogue.d.ts +3 -2
  13. package/dist/src/core/nodeOps.d.ts +4 -0
  14. package/dist/{core → src/core}/renderer.d.ts +1 -1
  15. package/dist/src/devtools/highlight.d.ts +7 -0
  16. package/dist/src/devtools/index.d.ts +1 -0
  17. package/dist/src/devtools/plugin.d.ts +16 -0
  18. package/dist/src/devtools/utils.d.ts +7 -0
  19. package/dist/src/directives/index.d.ts +6 -0
  20. package/dist/src/directives/vAlwaysLookAt.d.ts +7 -0
  21. package/dist/src/directives/vDistanceTo.d.ts +7 -0
  22. package/dist/src/directives/vLightHelper.d.ts +7 -0
  23. package/dist/src/directives/vLog.d.ts +7 -0
  24. package/dist/src/index.d.ts +19 -0
  25. package/dist/{types → src/types}/index.d.ts +3 -2
  26. package/dist/{utils → src/utils}/index.d.ts +8 -8
  27. package/dist/{utils → src/utils}/normalize.d.ts +2 -2
  28. package/dist/{utils → src/utils}/perf.d.ts +3 -2
  29. package/dist/src/utils/test-utils.d.ts +1 -0
  30. package/dist/tres.js +999 -462
  31. package/dist/tres.umd.cjs +3 -3
  32. package/package.json +14 -13
  33. package/dist/components/index.d.ts +0 -2
  34. package/dist/composables/useLoader/index.d.ts +0 -44
  35. package/dist/composables/useRaycaster/index.d.ts +0 -18
  36. package/dist/composables/useSeek/index.d.ts +0 -19
  37. package/dist/core/nodeOps.d.ts +0 -3
  38. package/dist/utils/test-utils.d.ts +0 -1
  39. /package/dist/{composables → src/composables}/index.d.ts +0 -0
  40. /package/dist/{composables → src/composables}/useRenderer/const.d.ts +0 -0
  41. /package/dist/{core → src/core}/revision.d.ts +0 -0
  42. /package/dist/{utils → src/utils}/template-compiler-options.d.ts +0 -0
@@ -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: (message: string, error?: Error | ErrorEvent) => void;
4
- logWarning: (message: string) => void;
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 type { Intersection, Event, Object3D } from 'three';
2
- import type { TresScene } from 'src/types';
3
- import type { TresContext } from '../useTresContextProvider';
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,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 { WebGLRenderer } from 'three';
2
- import { type MaybeRef } from 'vue';
3
- import { type MaybeRefOrGetter } from '@vueuse/core';
4
- import type { Scene, ToneMapping, ColorSpace, ShadowMapType, WebGLRendererParameters } from 'three';
5
- import type { TresColor } from '../../types';
6
- import type { TresContext } from '../useTresContextProvider';
7
- import type { RendererPresetsType } from './const';
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("vue").Ref<WebGLRenderer> | import("vue").ShallowRef<WebGLRenderer>;
86
+ renderer: import('vue').ShallowRef<WebGLRenderer>;
87
87
  };
88
88
  export type UseRendererReturn = ReturnType<typeof useRenderer>;
89
89
  export {};
@@ -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,4 +1,5 @@
1
- import type { Texture } from 'three';
1
+ import { Texture } from 'three';
2
+
2
3
  export interface PBRMaterialOptions {
3
4
  /**
4
5
  * List of texture maps to load.
@@ -1,14 +1,11 @@
1
- import type { Camera, EventDispatcher, Scene, WebGLRenderer } from 'three';
2
- import { Raycaster } from 'three';
3
- import type { ComputedRef, DeepReadonly, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef } from 'vue';
4
- import type { UseRendererOptions } from '../useRenderer';
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 type { Ref } from 'vue';
2
- import type { TresCatalogue } from '../types';
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: {
@@ -0,0 +1,4 @@
1
+ import { TresObject } from '../types';
2
+ import { RendererOptions } from 'vue';
3
+
4
+ export declare const nodeOps: RendererOptions<TresObject, TresObject>;
@@ -1,4 +1,4 @@
1
- export declare const render: import("vue").RootRenderFunction<import("..").TresObject>;
1
+ export declare const render: import('vue').RootRenderFunction<import("src").TresObject>;
2
2
  declare const _default: {
3
3
  extend: (objects: any) => any;
4
4
  };
@@ -0,0 +1,7 @@
1
+ import * as THREE from 'three';
2
+ export declare class HightlightMesh extends THREE.Mesh {
3
+ type: string;
4
+ createTime: number;
5
+ constructor(...args: THREE.Mesh['args']);
6
+ onBeforeRender(): void;
7
+ }
@@ -0,0 +1 @@
1
+ export { registerTresDevtools } from './plugin';
@@ -0,0 +1,16 @@
1
+ import { TresContext } from '../composables';
2
+ import { App as DevtoolsApp } from '@vue/devtools-api';
3
+
4
+ export interface Tags {
5
+ label: string;
6
+ textColor: number;
7
+ backgroundColor: number;
8
+ tooltip?: string;
9
+ }
10
+ export interface SceneGraphObject {
11
+ id: string;
12
+ label: string;
13
+ children: SceneGraphObject[];
14
+ tags: Tags[];
15
+ }
16
+ export declare function registerTresDevtools(app: DevtoolsApp, tres: TresContext): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shows a toast or console.log
3
+ *
4
+ * @param message - message to log
5
+ * @param type - different color of the tooltip
6
+ */
7
+ export declare function toastMessage(message: string, type?: 'normal' | 'error' | 'warn' | undefined): void;
@@ -0,0 +1,6 @@
1
+ import { vDistanceTo } from './vDistanceTo';
2
+ import { vAlwaysLookAt } from './vAlwaysLookAt';
3
+ import { vLightHelper } from './vLightHelper';
4
+ import { vLog } from './vLog';
5
+
6
+ export { vLog, vLightHelper, vAlwaysLookAt, vDistanceTo };
@@ -0,0 +1,7 @@
1
+ import { TresVector3 } from '../types';
2
+ import { Ref } from 'vue';
3
+ import { Object3D } from 'three';
4
+
5
+ export declare const vAlwaysLookAt: {
6
+ updated: (el: Object3D, binding: Ref<TresVector3>) => void;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { TresObject } from '../types';
2
+ import { Ref } from 'vue';
3
+
4
+ export declare const vDistanceTo: {
5
+ updated: (el: TresObject, binding: Ref<TresObject>) => void;
6
+ unmounted: (el: TresObject) => void;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { TresObject } from '../types';
2
+
3
+ export declare const vLightHelper: {
4
+ mounted: (el: TresObject) => void;
5
+ updated: (el: TresObject) => void;
6
+ unmounted: (el: TresObject) => void;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { TresObject } from '../types';
2
+
3
+ export declare const vLog: {
4
+ mounted: (el: TresObject, binding: {
5
+ arg: string;
6
+ }) => void;
7
+ };
@@ -0,0 +1,19 @@
1
+ import { default as templateCompilerOptions } from './utils/template-compiler-options';
2
+ import { normalizeColor, normalizeVectorFlexibleParam } from './utils/normalize';
3
+ import { App } from 'vue';
4
+
5
+ export * from './composables';
6
+ export * from './core/catalogue';
7
+ export * from './components';
8
+ export * from './types';
9
+ export * from './directives';
10
+ export interface TresOptions {
11
+ extends?: Record<string, unknown>;
12
+ }
13
+ export interface TresPlugin {
14
+ [key: string]: any;
15
+ install: (app: App, options?: TresOptions) => void;
16
+ }
17
+ declare const plugin: TresPlugin;
18
+ export default plugin;
19
+ export { normalizeColor, normalizeVectorFlexibleParam, templateCompilerOptions, };
@@ -1,6 +1,7 @@
1
- import type { DefineComponent, VNode, VNodeRef } from 'vue';
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,4 +1,5 @@
1
- import { Object3D } from 'three';
1
+ import { MeshBasicMaterial, Vector3, Mesh, Scene, Object3D } from 'three';
2
+
2
3
  export declare function toSetMethodName(key: string): string;
3
4
  export declare const merge: (target: any, source: any) => any;
4
5
  export declare const isHTMLTag: (key: string) => boolean;
@@ -14,10 +15,9 @@ export declare function deepArrayEqual(arr1: any[], arr2: any[]): boolean;
14
15
  * TypeSafe version of Array.isArray
15
16
  */
16
17
  export declare const isArray: (a: any) => a is any[] | readonly any[];
17
- export declare function dispose<TresObj extends {
18
- dispose?: () => void;
19
- type?: string;
20
- [key: string]: any;
21
- }>(obj: TresObj): void;
22
- export declare function disposeObject3D(object: Object3D): void;
23
- export default disposeObject3D;
18
+ export declare function editSceneObject(scene: Scene, objectUuid: string, propertyPath: string[], value: any): void;
19
+ export declare function createHighlightMaterial(): MeshBasicMaterial;
20
+ export declare function animateHighlight(highlightMesh: Mesh, startTime: number): void;
21
+ export declare function stopHighlightAnimation(): void;
22
+ export declare function createHighlightMesh(object: Object3D): Mesh;
23
+ export declare function extractBindingPosition(binding: any): Vector3;
@@ -1,5 +1,5 @@
1
- import type { ColorRepresentation } from 'three';
2
- import { Vector3, Color } from 'three';
1
+ import { ColorRepresentation, Vector3, Color } from 'three';
2
+
3
3
  export type SizeFlexibleParams = number[] | {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,6 @@
1
- import type { Scene } from 'three';
2
- import type { TresObject } from './../types';
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;
@@ -0,0 +1 @@
1
+ export declare function withSetup(composable: any): (import('vue').App<Element> | undefined)[];