@tresjs/core 4.2.10 → 4.3.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.
- package/dist/src/components/TresCanvas.vue.d.ts +17 -11
- package/dist/src/composables/index.d.ts +8 -5
- package/dist/src/composables/useCamera/index.d.ts +1 -1
- package/dist/src/composables/useLoader/component.vue.d.ts +25 -0
- package/dist/src/composables/useRaycaster/index.d.ts +1 -1
- package/dist/src/composables/useRenderer/index.d.ts +3 -4
- package/dist/src/composables/useTexture/component.vue.d.ts +28 -0
- package/dist/src/composables/useTresContextProvider/index.d.ts +4 -5
- package/dist/src/composables/useTresEventManager/index.d.ts +1 -1
- package/dist/src/core/loop.d.ts +2 -2
- package/dist/src/core/nodeOps.d.ts +1 -1
- package/dist/src/directives/index.d.ts +3 -3
- package/dist/src/index.d.ts +5 -5
- package/dist/src/types/index.d.ts +4 -3
- package/dist/src/utils/index.d.ts +2 -2
- package/dist/src/utils/is.d.ts +1 -1
- package/dist/tres.js +928 -893
- package/dist/tres.umd.cjs +2 -2
- package/package.json +22 -23
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ColorSpace, ShadowMapType, ToneMapping, WebGLRendererParameters } from 'three';
|
|
2
|
-
import { TresContext } from '../composables';
|
|
3
2
|
import { RendererPresetsType } from '../composables/useRenderer/const';
|
|
4
3
|
import { TresCamera } from '../types/';
|
|
4
|
+
import { TresContext } from '../composables';
|
|
5
5
|
export interface TresCanvasProps extends Omit<WebGLRendererParameters, 'canvas'> {
|
|
6
6
|
shadows?: boolean;
|
|
7
7
|
clearColor?: string;
|
|
@@ -15,13 +15,20 @@ export interface TresCanvasProps extends Omit<WebGLRendererParameters, 'canvas'>
|
|
|
15
15
|
camera?: TresCamera;
|
|
16
16
|
preset?: RendererPresetsType;
|
|
17
17
|
windowSize?: boolean;
|
|
18
|
-
|
|
18
|
+
enableProvideBridge?: boolean;
|
|
19
19
|
}
|
|
20
|
-
declare function __VLS_template():
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
declare function __VLS_template(): {
|
|
21
|
+
slots: Readonly<{
|
|
22
|
+
default: () => any;
|
|
23
|
+
}> & {
|
|
24
|
+
default: () => any;
|
|
25
|
+
};
|
|
26
|
+
refs: {
|
|
27
|
+
canvas: HTMLCanvasElement;
|
|
28
|
+
};
|
|
29
|
+
attrs: Partial<{}>;
|
|
24
30
|
};
|
|
31
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
25
32
|
declare const __VLS_component: import('vue').DefineComponent<TresCanvasProps, {
|
|
26
33
|
context: import('vue').ShallowRef<TresContext | null>;
|
|
27
34
|
dispose: () => void;
|
|
@@ -40,7 +47,7 @@ declare const __VLS_component: import('vue').DefineComponent<TresCanvasProps, {
|
|
|
40
47
|
"pointer-over": (...args: any[]) => void;
|
|
41
48
|
"pointer-out": (...args: any[]) => void;
|
|
42
49
|
"pointer-missed": (...args: any[]) => void;
|
|
43
|
-
}, string, import('vue').PublicProps, Readonly<TresCanvasProps & {
|
|
50
|
+
}, string, import('vue').PublicProps, Readonly<TresCanvasProps> & Readonly<{
|
|
44
51
|
onRender?: ((...args: any[]) => any) | undefined;
|
|
45
52
|
onClick?: ((...args: any[]) => any) | undefined;
|
|
46
53
|
onWheel?: ((...args: any[]) => any) | undefined;
|
|
@@ -67,11 +74,10 @@ declare const __VLS_component: import('vue').DefineComponent<TresCanvasProps, {
|
|
|
67
74
|
useLegacyLights: boolean;
|
|
68
75
|
windowSize: boolean;
|
|
69
76
|
renderMode: "always" | "on-demand" | "manual";
|
|
70
|
-
|
|
71
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}>;
|
|
72
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component,
|
|
77
|
+
enableProvideBridge: boolean;
|
|
78
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
79
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
73
80
|
export default _default;
|
|
74
|
-
|
|
75
81
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
76
82
|
new (): {
|
|
77
83
|
$slots: S;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { default as UseLoader } from './useLoader/component.vue';
|
|
2
|
+
import { default as UseTexture } from './useTexture/component.vue';
|
|
1
3
|
export * from './useCamera/';
|
|
2
|
-
export * from './useRenderLoop';
|
|
3
|
-
export * from './useRenderer/';
|
|
4
4
|
export * from './useLoader';
|
|
5
|
-
export * from './useTexture';
|
|
6
|
-
export * from './useRaycaster';
|
|
7
5
|
export * from './useLogger';
|
|
6
|
+
export * from './useLoop';
|
|
7
|
+
export * from './useRaycaster';
|
|
8
|
+
export * from './useRenderer/';
|
|
9
|
+
export * from './useRenderLoop';
|
|
8
10
|
export * from './useSeek';
|
|
11
|
+
export * from './useTexture';
|
|
9
12
|
export * from './useTresContextProvider';
|
|
10
|
-
export * from './useLoop';
|
|
11
13
|
export * from './useTresEventManager';
|
|
12
14
|
export { onTresReady } from './useTresReady';
|
|
15
|
+
export { UseLoader, UseTexture };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Camera } from 'three';
|
|
2
1
|
import { TresScene } from '../../types';
|
|
3
2
|
import { TresContext } from '../useTresContextProvider';
|
|
3
|
+
import { Camera } from 'three';
|
|
4
4
|
export declare const useCamera: ({ sizes }: Pick<TresContext, "sizes"> & {
|
|
5
5
|
scene: TresScene;
|
|
6
6
|
}) => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LoaderProto } from './index';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
slots: {
|
|
4
|
+
default?(_: {
|
|
5
|
+
data: unknown;
|
|
6
|
+
}): any;
|
|
7
|
+
};
|
|
8
|
+
refs: {};
|
|
9
|
+
attrs: Partial<{}>;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
+
declare const __VLS_component: import('vue').DefineComponent<{
|
|
13
|
+
loader: LoaderProto<unknown>;
|
|
14
|
+
url: string | string[];
|
|
15
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
16
|
+
loader: LoaderProto<unknown>;
|
|
17
|
+
url: string | string[];
|
|
18
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { TresEvent, TresInstance } from 'src/types';
|
|
1
2
|
import { Intersection, Object3D, Object3DEventMap } from 'three';
|
|
2
3
|
import { ShallowRef } from 'vue';
|
|
3
|
-
import { TresEvent, TresInstance } from 'src/types';
|
|
4
4
|
import { TresContext } from '../useTresContextProvider';
|
|
5
5
|
export declare const useRaycaster: (objectsWithEvents: ShallowRef<TresInstance[]>, ctx: TresContext) => {
|
|
6
6
|
intersects: ShallowRef<Intersection<Object3D<Object3DEventMap>>[]>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MaybeRef } from 'vue';
|
|
3
|
-
import { MaybeRefOrGetter } from '@vueuse/core';
|
|
1
|
+
import { ColorSpace, Scene, ShadowMapType, ToneMapping, WebGLRendererParameters, WebGLRenderer } from 'three';
|
|
4
2
|
import { EmitEventFn, TresColor } from '../../types';
|
|
5
3
|
import { TresContext } from '../useTresContextProvider';
|
|
6
4
|
import { RendererPresetsType } from './const';
|
|
5
|
+
import { MaybeRefOrGetter } from '@vueuse/core';
|
|
6
|
+
import { MaybeRef } from 'vue';
|
|
7
7
|
type TransformToMaybeRefOrGetter<T> = {
|
|
8
8
|
[K in keyof T]: MaybeRefOrGetter<T[K]> | MaybeRefOrGetter<T[K]>;
|
|
9
9
|
};
|
|
@@ -84,7 +84,6 @@ export declare function useRenderer({ canvas, options, contextParts: { sizes, re
|
|
|
84
84
|
invalidate: () => void;
|
|
85
85
|
advance: () => void;
|
|
86
86
|
};
|
|
87
|
-
disableRender: MaybeRefOrGetter<boolean>;
|
|
88
87
|
}): {
|
|
89
88
|
renderer: import('vue').ShallowRef<WebGLRenderer>;
|
|
90
89
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PBRUseTextureMap } from './index';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
slots: {
|
|
4
|
+
default?(_: {
|
|
5
|
+
textures: {
|
|
6
|
+
map: import('three').Texture;
|
|
7
|
+
displacementMap: import('three').Texture;
|
|
8
|
+
normalMap: import('three').Texture;
|
|
9
|
+
roughnessMap: import('three').Texture;
|
|
10
|
+
metalnessMap: import('three').Texture;
|
|
11
|
+
aoMap: import('three').Texture;
|
|
12
|
+
alphaMap: import('three').Texture;
|
|
13
|
+
matcap: import('three').Texture;
|
|
14
|
+
};
|
|
15
|
+
}): any;
|
|
16
|
+
};
|
|
17
|
+
refs: {};
|
|
18
|
+
attrs: Partial<{}>;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
21
|
+
declare const __VLS_component: import('vue').DefineComponent<PBRUseTextureMap, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PBRUseTextureMap> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Camera, WebGLRenderer, Raycaster } from 'three';
|
|
2
2
|
import { ComputedRef, DeepReadonly, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { RendererLoop } from '../../core/loop';
|
|
4
4
|
import { EmitEventFn, TresControl, TresObject, TresScene } from '../../types';
|
|
5
|
-
import {
|
|
5
|
+
import { UseRendererOptions } from '../useRenderer';
|
|
6
6
|
import { SizesType } from '../useSizes';
|
|
7
|
-
import {
|
|
7
|
+
import { TresEventManager } from '../useTresEventManager';
|
|
8
8
|
export interface InternalState {
|
|
9
9
|
priority: Ref<number>;
|
|
10
10
|
frames: Ref<number>;
|
|
@@ -63,11 +63,10 @@ export interface TresContext {
|
|
|
63
63
|
registerBlockingObjectAtPointerEventHandler?: (object: TresObject) => void;
|
|
64
64
|
deregisterBlockingObjectAtPointerEventHandler?: (object: TresObject) => void;
|
|
65
65
|
}
|
|
66
|
-
export declare function useTresContextProvider({ scene, canvas, windowSize,
|
|
66
|
+
export declare function useTresContextProvider({ scene, canvas, windowSize, rendererOptions, emit, }: {
|
|
67
67
|
scene: TresScene;
|
|
68
68
|
canvas: MaybeRef<HTMLCanvasElement>;
|
|
69
69
|
windowSize: MaybeRefOrGetter<boolean>;
|
|
70
|
-
disableRender: MaybeRefOrGetter<boolean>;
|
|
71
70
|
rendererOptions: UseRendererOptions;
|
|
72
71
|
emit: EmitEventFn;
|
|
73
72
|
}): TresContext;
|
package/dist/src/core/loop.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
import { Camera, EventDispatcher, Raycaster, Scene, WebGLRenderer, Clock } from 'three';
|
|
3
1
|
import { Fn } from '@vueuse/core';
|
|
2
|
+
import { Camera, EventDispatcher, Raycaster, Scene, WebGLRenderer, Clock } from 'three';
|
|
3
|
+
import { Ref } from 'vue';
|
|
4
4
|
export type LoopStage = 'before' | 'render' | 'after';
|
|
5
5
|
export interface LoopCallback {
|
|
6
6
|
delta: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RendererOptions } from 'vue';
|
|
2
1
|
import { TresContext } from '../composables';
|
|
3
2
|
import { TresObject } from '../types';
|
|
3
|
+
import { RendererOptions } from 'vue';
|
|
4
4
|
export declare const nodeOps: (context: TresContext) => RendererOptions<TresObject, TresObject | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vLog } from './vLog';
|
|
2
|
-
import { vLightHelper } from './vLightHelper';
|
|
3
1
|
import { vDistanceTo } from './vDistanceTo';
|
|
4
|
-
|
|
2
|
+
import { vLightHelper } from './vLightHelper';
|
|
3
|
+
import { vLog } from './vLog';
|
|
4
|
+
export { vDistanceTo, vLightHelper, vLog };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
+
import { disposeObject3D as dispose } from './utils';
|
|
2
3
|
import { normalizeColor, normalizeVectorFlexibleParam } from './utils/normalize';
|
|
3
4
|
import { default as templateCompilerOptions } from './utils/template-compiler-options';
|
|
4
|
-
|
|
5
|
+
export * from './components';
|
|
5
6
|
export * from './composables';
|
|
6
7
|
export * from './core/catalogue';
|
|
7
|
-
export * from './components';
|
|
8
|
-
export * from './types';
|
|
9
|
-
export * from './directives';
|
|
10
8
|
export * from './core/loop';
|
|
9
|
+
export * from './directives';
|
|
10
|
+
export * from './types';
|
|
11
11
|
export interface TresOptions {
|
|
12
12
|
extends?: Record<string, unknown>;
|
|
13
13
|
}
|
|
@@ -17,5 +17,5 @@ export interface TresPlugin {
|
|
|
17
17
|
}
|
|
18
18
|
declare const plugin: TresPlugin;
|
|
19
19
|
export default plugin;
|
|
20
|
-
export { normalizeColor, normalizeVectorFlexibleParam, templateCompilerOptions,
|
|
20
|
+
export { dispose, normalizeColor, normalizeVectorFlexibleParam, templateCompilerOptions, };
|
|
21
21
|
export type { VectorFlexibleParams } from './utils/normalize';
|
|
@@ -6,7 +6,7 @@ export type AttachType = string | AttachFnType;
|
|
|
6
6
|
export type DisposeType = ((self: TresInstance) => void) | boolean | 'default';
|
|
7
7
|
export type ConstructorRepresentation = new (...args: any[]) => any;
|
|
8
8
|
export type NonFunctionKeys<P> = {
|
|
9
|
-
[K in keyof P]-?: P[K] extends
|
|
9
|
+
[K in keyof P]-?: P[K] extends (...args: any[]) => any ? never : K;
|
|
10
10
|
}[keyof P];
|
|
11
11
|
export type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O;
|
|
12
12
|
export type Properties<T> = Pick<T, NonFunctionKeys<T>>;
|
|
@@ -31,6 +31,7 @@ export interface InstanceProps<T = any, P = any> {
|
|
|
31
31
|
object?: T;
|
|
32
32
|
visible?: boolean;
|
|
33
33
|
dispose?: null;
|
|
34
|
+
attach?: AttachType;
|
|
34
35
|
}
|
|
35
36
|
interface TresBaseObject {
|
|
36
37
|
removeFromParent?: () => void;
|
|
@@ -158,7 +159,7 @@ export type TresEuler = THREE.Euler;
|
|
|
158
159
|
export type TresControl = THREE.EventDispatcher & {
|
|
159
160
|
enabled: boolean;
|
|
160
161
|
};
|
|
161
|
-
type WithMathProps<P> = {
|
|
162
|
+
export type WithMathProps<P> = {
|
|
162
163
|
[K in keyof P]: P[K] extends MathRepresentation | THREE.Euler ? MathType<P[K]> : P[K];
|
|
163
164
|
};
|
|
164
165
|
interface RaycastableRepresentation {
|
|
@@ -170,7 +171,7 @@ export interface VueProps {
|
|
|
170
171
|
ref?: VNodeRef;
|
|
171
172
|
key?: string | number | symbol;
|
|
172
173
|
}
|
|
173
|
-
type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<Overwrite<P, WithMathProps<P> & VueProps & EventProps<P>>>;
|
|
174
|
+
export type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<Overwrite<P, WithMathProps<P> & VueProps & EventProps<P>>>;
|
|
174
175
|
export type ThreeElement<T extends ConstructorRepresentation> = Mutable<Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>>;
|
|
175
176
|
type ThreeExports = typeof THREE;
|
|
176
177
|
type ThreeInstancesImpl = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Material, Mesh, MeshBasicMaterial, Scene, Vector3 } from 'three';
|
|
2
|
-
import { AttachType, LocalState, TresInstance, TresObject, TresPrimitive } from 'src/types';
|
|
3
1
|
import { nodeOps } from 'src/core/nodeOps';
|
|
2
|
+
import { AttachType, LocalState, TresInstance, TresObject, TresPrimitive } from 'src/types';
|
|
3
|
+
import { Material, Mesh, MeshBasicMaterial, Scene, Vector3 } from 'three';
|
|
4
4
|
import { TresContext } from '../composables/useTresContextProvider';
|
|
5
5
|
export declare function toSetMethodName(key: string): string;
|
|
6
6
|
export declare const merge: (target: any, source: any) => any;
|
package/dist/src/utils/is.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function arr(u: unknown): u is any[];
|
|
|
5
5
|
export declare function num(u: unknown): u is number;
|
|
6
6
|
export declare function str(u: unknown): u is string;
|
|
7
7
|
export declare function bool(u: unknown): u is boolean;
|
|
8
|
-
export declare function fun(u: unknown): u is
|
|
8
|
+
export declare function fun(u: unknown): u is (...args: any[]) => any;
|
|
9
9
|
export declare function obj(u: unknown): u is Record<string | number | symbol, unknown>;
|
|
10
10
|
export declare function object3D(u: unknown): u is Object3D;
|
|
11
11
|
export declare function camera(u: unknown): u is Camera;
|