@tresjs/core 5.9.2 → 5.10.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/tres.d.ts CHANGED
@@ -1,1223 +1,9 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v5.9.2
3
+ * version: v5.10.0
4
4
  * (c) 2026
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- import { App, ComputedRef, DefineComponent, MaybeRef, MaybeRefOrGetter, Reactive, Ref, ShallowRef, VNode, VNodeRef } from "vue";
9
- import * as THREE from "three";
10
- import { BufferGeometry, Camera, Color, ColorRepresentation, ColorSpace, Event, Fog, Group, Layers, Light, Loader, LoadingManager, Material, Mesh, Object3D, Object3DEventMap, OrthographicCamera, PerspectiveCamera, Scene, ShadowMapType, ToneMapping, Vector3, WebGLRenderer } from "three";
11
- import { EventHookOff, UseAsyncStateOptions, UseAsyncStateReturn } from "@vueuse/core";
12
- import { PointerEvent, PointerEventsMap } from "@pmndrs/pointer-events";
13
- import { Renderer } from "three/webgpu";
14
- //#region src/composables/useLoader/index.d.ts
15
- export interface LoaderMethods {
16
- setDRACOLoader: (dracoLoader: any) => void;
17
- setMeshoptDecoder: (meshoptDecoder: any) => void;
18
- setKTX2Loader: (ktx2Loader: any) => void;
19
- }
20
- export type TresLoader<T> = Loader & Partial<LoaderMethods> & {
21
- load: (url: string, onLoad: (result: T) => void, onProgress?: (event: ProgressEvent<EventTarget>) => void, onError?: (err: unknown) => void) => void;
22
- loadAsync: (url: string, onProgress?: (event: ProgressEvent) => void) => Promise<T>;
23
- };
24
- export type LoaderProto<T> = new (manager?: LoadingManager) => TresLoader<T>;
25
- export interface TresLoaderOptions<T, Shallow extends boolean> {
26
- manager?: LoadingManager;
27
- extensions?: (loader: TresLoader<T>) => void;
28
- initialValue?: T;
29
- asyncOptions?: UseAsyncStateOptions<Shallow, any | null>;
30
- }
31
- /**
32
- * Return type for the useLoader composable
33
- * @template T - The type of the loaded asset (e.g., GLTF, Texture, etc.)
34
- * @template Shallow - Whether to use shallow reactivity for better performance
35
- * @extends {UseAsyncStateReturn<T, [string], Shallow>} - Extends VueUse's useAsyncState return type
36
- */
37
- export type UseLoaderReturn<T, Shallow extends boolean> = UseAsyncStateReturn<T, [string], Shallow> & {
38
- /**
39
- * Loads a new asset from the given path
40
- * @param path - The URL or path to the asset to load
41
- */
42
- load: (path: string) => void;
43
- /**
44
- * Progress of the loading process
45
- * @property loaded - The number of bytes loaded
46
- * @property total - The total number of bytes to load
47
- * @property percentage - The percentage of the loading process
48
- */
49
- progress: {
50
- loaded: number;
51
- total: number;
52
- percentage: number;
53
- };
54
- };
55
- /**
56
- * Vue composable for loading 3D models using Three.js loaders
57
- * @param Loader - The Three.js loader constructor
58
- * @param path - The path to the model file
59
- * @param options - Optional configuration for the loader
60
- * @returns UseAsyncState composable with the loaded model
61
- */
62
- export declare function useLoader<T, Shallow extends boolean = true>(Loader: LoaderProto<T>, path: MaybeRef<string>, options?: TresLoaderOptions<T, Shallow>): UseLoaderReturn<T, Shallow>;
63
- //#endregion
64
- //#region src/composables/useCreateRafLoop/index.d.ts
65
- interface RafLoopContext {
66
- delta: number;
67
- elapsed: number;
68
- }
69
- //#endregion
70
- //#region src/composables/useSizes/index.d.ts
71
- interface SizesType {
72
- width: Readonly<Ref<number>>;
73
- height: Readonly<Ref<number>>;
74
- pixelRatio: Readonly<Ref<number>>;
75
- aspectRatio: ComputedRef<number>;
76
- }
77
- //#endregion
78
- //#region src/composables/useCamera/index.d.ts
79
- /**
80
- * Interface for the return value of the useCamera composable
81
- */
82
- export interface UseCameraReturn {
83
- activeCamera: ComputedRef<TresCamera>;
84
- /**
85
- * The list of cameras
86
- */
87
- cameras: ShallowRef<TresCamera[]>;
88
- /**
89
- * Register a camera
90
- * @param camera - The camera to register
91
- * @param active - Whether to set the camera as active
92
- */
93
- registerCamera: (camera: TresCamera, active?: boolean) => void;
94
- /**
95
- * Deregister a camera
96
- * @param camera - The camera to deregister
97
- */
98
- deregisterCamera: (camera: TresCamera) => void;
99
- /**
100
- * Set the active camera
101
- * @param cameraOrUuid - The camera or its UUID to set as active
102
- */
103
- setActiveCamera: (cameraOrUuid: string | TresCamera) => void;
104
- }
105
- /**
106
- * Interface for the parameters of the useCamera composable
107
- */
108
- interface UseCameraParams {
109
- sizes: TresContext['sizes'];
110
- }
111
- /**
112
- * Composable for managing cameras in a Three.js scene
113
- * @param params - The parameters for the composable
114
- * @param params.sizes - The sizes object containing window dimensions
115
- * @returns The camera management functions and state
116
- */
117
- export declare const useCameraManager: ({ sizes }: UseCameraParams) => UseCameraReturn;
118
- //#endregion
119
- //#region src/utils/error.d.ts
120
- export type TresRendererErrorCode = 'INITIALIZATION_FAILED';
121
- export declare class TresRendererError extends Error {
122
- readonly code: TresRendererErrorCode;
123
- readonly name = "TresRendererError";
124
- constructor(message: string, code: TresRendererErrorCode, options?: ErrorOptions);
125
- }
126
- //#endregion
127
- //#region src/composables/useRenderer/useRendererManager.d.ts
128
- /**
129
- * If set to 'on-demand', the scene will only be rendered when the current frame is invalidated
130
- * If set to 'manual', the scene will only be rendered when advance() is called
131
- * If set to 'always', the scene will be rendered every frame
132
- */
133
- export type RenderMode = 'always' | 'on-demand' | 'manual';
134
- export type RenderFunction = (notifySuccess: () => void) => void;
135
- export type TresRenderer = WebGLRenderer | Renderer;
136
- export interface RendererOptions {
137
- /**
138
- * WebGL Context options (Readonly because they are passed to the renderer constructor)
139
- * They can't be changed after the renderer is created because they are passed to the canvas context
140
- */
141
- antialias?: boolean;
142
- /**
143
- * Enables stencil buffer with 8 bits.
144
- * Required for stencil-based operations like shadow volumes or post-processing effects.
145
- * @readonly
146
- * @default true
147
- */
148
- stencil?: boolean;
149
- /**
150
- * Enables depth buffer with at least 16 bits.
151
- * Required for proper 3D rendering and depth testing.
152
- * @readonly
153
- * @default true
154
- */
155
- depth?: boolean;
156
- /**
157
- * Sets the shader precision of the renderer.
158
- * @see {@link https://threejs.org/docs/#api/en/renderers/WebGLRenderer}
159
- * @default 'highp'
160
- */
161
- precision?: 'highp' | 'mediump' | 'lowp';
162
- /**
163
- * Enables logarithmic depth buffer. Useful for scenes with large differences in scale.
164
- * Helps prevent z-fighting in scenes with objects very close and very far from the camera.
165
- * @readonly
166
- * @default false
167
- */
168
- logarithmicDepthBuffer?: boolean;
169
- /**
170
- * Preserves the buffers until manually cleared or overwritten.
171
- * Needed for screenshots or when reading pixels from the canvas.
172
- * Warning: This may impact performance.
173
- * @readonly
174
- * @default false
175
- */
176
- preserveDrawingBuffer?: boolean;
177
- /**
178
- * Power preference for the renderer.
179
- * Power preference for the renderer.
180
- * - `default`: Automatically chooses the most suitable power setting.
181
- * - `high-performance`: Prioritizes rendering performance.
182
- * - `low-power`: Tries to reduce power usage.
183
- * @see {@link https://threejs.org/docs/#api/en/renderers/WebGLRenderer}
184
- * @default 'default'
185
- * @readonly
186
- */
187
- powerPreference?: WebGLPowerPreference;
188
- /**
189
- * Whether to create the WebGL context with an alpha buffer.
190
- * This is a WebGL context option that must be set during context creation and cannot be changed later.
191
- * When true, the canvas can be transparent, showing content behind it.
192
- * @readonly
193
- * @default false
194
- */
195
- alpha?: boolean;
196
- /**
197
- * Whether to premultiply the alpha of the canvas.
198
- * @see {@link https://threejs.org/docs/#api/en/renderers/WebGLRenderer}
199
- * @default true
200
- */
201
- premultipliedAlpha?: boolean;
202
- /**
203
- * Whether to fail if the major performance caveat is detected.
204
- * @see {@link https://threejs.org/docs/#api/en/renderers/WebGLRenderer}
205
- * @default false
206
- */
207
- failIfMajorPerformanceCaveat?: boolean;
208
- /**
209
- * WebGL options with set methods
210
- * @see {@link https://threejs.org/docs/#api/en/renderers/WebGLRenderer}
211
- */
212
- /**
213
- * Clear color for the canvas
214
- * Can include alpha value (e.g. '#00808000' for fully transparent teal)
215
- */
216
- clearColor?: ColorRepresentation;
217
- /**
218
- * The opacity of the clear color (0-1)
219
- * Controls the transparency of the clear color
220
- * @default 1
221
- */
222
- clearAlpha?: number;
223
- /**
224
- * Enable shadow rendering in the scene
225
- * @default false
226
- */
227
- shadows?: boolean;
228
- /**
229
- * Tone mapping technique to use for the scene
230
- * - `NoToneMapping`: No tone mapping is applied.
231
- * - `LinearToneMapping`: Linear tone mapping.
232
- * - `ReinhardToneMapping`: Reinhard tone mapping.
233
- * - `CineonToneMapping`: Cineon tone mapping.
234
- * - `ACESFilmicToneMapping`: ACES Filmic tone mapping.
235
- * - `AgXToneMapping`: AgX tone mapping.
236
- * - `NeutralToneMapping`: Neutral tone mapping.
237
- * @see {@link https://threejs.org/docs/#api/en/constants/Renderer}
238
- * @default ACESFilmicToneMapping (Opinionated default by TresJS)
239
- */
240
- toneMapping?: ToneMapping;
241
- /**
242
- * Type of shadow map to use for shadow calculations
243
- * - `BasicShadowMap`: Basic shadow map.
244
- * - `PCFShadowMap`: Percentage-Closer Filtering shadow map.
245
- * - `PCFSoftShadowMap`: Deprecated on WebGL, three falls back to `PCFShadowMap`. Still supported on WebGPU.
246
- * - `VSMShadowMap`: Variance shadow map.
247
- * @see {@link https://threejs.org/docs/#api/en/constants/Renderer}
248
- * @default PCFShadowMap on WebGL, PCFSoftShadowMap on WebGPU (Opinionated default by TresJS)
249
- */
250
- shadowMapType?: ShadowMapType;
251
- /**
252
- * Whether to use legacy lights system instead of the new one
253
- * @deprecated Use `useLegacyLights: false` for the new lighting system
254
- */
255
- useLegacyLights?: boolean;
256
- /**
257
- * Color space for the output render
258
- * @see {@link https://threejs.org/docs/#api/en/constants/Renderer}
259
- */
260
- outputColorSpace?: ColorSpace;
261
- /**
262
- * Exposure level of tone mapping
263
- * @default 1
264
- */
265
- toneMappingExposure?: number;
266
- /**
267
- * Rendering mode for the canvas
268
- * - 'always': Renders every frame
269
- * - 'on-demand': Renders only when changes are detected
270
- * - 'manual': Renders only when explicitly called
271
- * @default 'always'
272
- */
273
- renderMode?: 'always' | 'on-demand' | 'manual';
274
- /**
275
- * Device Pixel Ratio for the renderer
276
- * Can be a single number or a tuple defining a range [min, max]
277
- */
278
- dpr?: number | [number, number];
279
- /**
280
- * Custom WebGL renderer instance
281
- * Allows using a pre-configured renderer instead of creating a new one
282
- */
283
- renderer?: (ctx: TresRendererSetupContext) => TresRenderer;
284
- }
285
- export interface TresRendererSetupContext {
286
- sizes: SizesType;
287
- scene: ShallowRef<TresScene>;
288
- camera: UseCameraReturn;
289
- canvas: MaybeRef<HTMLCanvasElement>;
290
- }
291
- export interface UseRendererOptions {
292
- scene: ShallowRef<TresScene>;
293
- canvas: MaybeRef<HTMLCanvasElement>;
294
- options: Reactive<RendererOptions>;
295
- fpsLimit?: MaybeRefOrGetter<number>;
296
- contextParts: Pick<TresContext, 'sizes' | 'camera'>;
297
- }
298
- export declare function useRendererManager({ scene, canvas, options, fpsLimit, contextParts: { sizes, camera } }: UseRendererOptions): {
299
- loop: {
300
- start: () => void;
301
- stop: () => void;
302
- isActive: Readonly<ShallowRef<boolean>>;
303
- onBeforeLoop: import("@vueuse/core").EventHookOn<RafLoopContext>;
304
- onLoop: import("@vueuse/core").EventHookOn<RafLoopContext>;
305
- };
306
- instance: TresRenderer;
307
- advance: () => void;
308
- onReady: import("@vueuse/core").EventHookOn<TresRenderer>;
309
- onRender: import("@vueuse/core").EventHookOn<TresRenderer>;
310
- onError: import("@vueuse/core").EventHookOn<TresRendererError>;
311
- invalidate: (amountOfFramesToInvalidate?: number) => void;
312
- canBeInvalidated: import("vue").ComputedRef<boolean>;
313
- mode: "always" | "on-demand" | "manual" | undefined;
314
- replaceRenderFunction: (fn: RenderFunction) => void;
315
- isInitialized: import("vue").Ref<boolean, boolean>;
316
- error: import("vue").Ref<TresRendererError | null, TresRendererError | null>;
317
- };
318
- export type UseRendererManagerReturn = ReturnType<typeof useRendererManager>;
319
- //#endregion
320
- //#region src/composables/useEventManager/index.d.ts
321
- declare function useEventManager({ canvas, contextParts: { scene, camera, renderer } }: {
322
- canvas: MaybeRef<HTMLCanvasElement>;
323
- contextParts: Pick<TresContext, 'scene' | 'camera' | 'renderer'>;
324
- }): {
325
- onPointerMissed: import("@vueuse/core").EventHookOn<TresPointerEvent & Event<"click", Object3D<Object3DEventMap & PointerEventsMap>>>;
326
- };
327
- //#endregion
328
- //#region src/composables/useTresContextProvider/index.d.ts
329
- interface TresContext {
330
- scene: ShallowRef<TresScene>;
331
- sizes: SizesType;
332
- extend: (objects: any) => void;
333
- camera: UseCameraReturn;
334
- controls: Ref<TresControl | null>;
335
- renderer: UseRendererManagerReturn;
336
- /**
337
- * Whether the active renderer is a Three.js WebGPU `Renderer` (as opposed to a
338
- * `WebGLRenderer`). Reactive so downstream components can branch on it without
339
- * re-deriving it from `renderer.instance`.
340
- *
341
- * Note: this reflects the renderer instance, not the active backend — a
342
- * `WebGPURenderer` running on its WebGL2 fallback still reports `true`.
343
- */
344
- isWebGPU: ComputedRef<boolean>;
345
- events: ReturnType<typeof useEventManager>;
346
- }
347
- export declare const INJECTION_KEY = "useTres";
348
- declare const useTresContextProvider: (args_0: {
349
- scene: TresScene;
350
- canvas: MaybeRef<HTMLCanvasElement>;
351
- fpsLimit?: MaybeRefOrGetter<number>;
352
- windowSize: MaybeRefOrGetter<boolean>;
353
- rendererOptions: RendererOptions;
354
- }) => TresContext;
355
- declare const useTresContext: () => TresContext;
356
- //#endregion
357
- //#region src/utils/pointerEvents.d.ts
358
- declare const supportedPointerEvents: readonly ["onClick", "onContextmenu", "onPointermove", "onPointerenter", "onPointerleave", "onPointerover", "onPointerout", "onDblclick", "onPointerdown", "onPointerup", "onPointercancel", "onLostpointercapture", "onWheel"];
359
- type SupportedVuePointerEvent = typeof supportedPointerEvents[number];
360
- type TresPointerEventName = 'click' | 'contextmenu' | 'pointermove' | 'pointerenter' | 'pointerleave' | 'pointerover' | 'pointerout' | 'dblclick' | 'pointerdown' | 'pointerup' | 'pointercancel' | 'lostpointercapture' | 'wheel';
361
- type TresPointerEvent = PointerEvent<MouseEvent>;
362
- type PointerEventHandlers = { [key in SupportedVuePointerEvent]: (event: TresPointerEvent) => void; };
363
- //#endregion
364
- //#region src/types/index.d.ts
365
- export type AttachFnType = (parent: any, self: TresInstance) => () => void;
366
- export type AttachType = string | AttachFnType;
367
- export type DisposeType = ((self: TresInstance) => void) | boolean | 'default' | null;
368
- export type ConstructorRepresentation = new (...args: any[]) => any;
369
- export type NonFunctionKeys<P> = { [K in keyof P]-?: P[K] extends ((...args: any[]) => any) ? never : K; }[keyof P];
370
- export type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O;
371
- export type Properties<T> = Pick<T, NonFunctionKeys<T>>;
372
- export type Mutable<P> = { [K in keyof P]: P[K] | Readonly<P[K]>; };
373
- export type Args<T> = T extends ConstructorRepresentation ? ConstructorParameters<T> : any[];
374
- export interface TresCatalogue {
375
- [name: string]: ConstructorRepresentation;
376
- }
377
- export type TresCamera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
378
- /**
379
- * Represents the properties of an instance.
380
- *
381
- * @template T - The type of the object.
382
- * @template P - The type of the arguments.
383
- */
384
- export interface InstanceProps<T = any, P = any> {
385
- args?: Args<P>;
386
- object?: T;
387
- visible?: boolean;
388
- dispose?: null;
389
- attach?: AttachType;
390
- }
391
- interface TresBaseObject {
392
- removeFromParent?: () => void;
393
- dispose?: () => void;
394
- [prop: string]: any;
395
- }
396
- export interface LocalState {
397
- type: string;
398
- root: TresContext;
399
- memoizedProps: {
400
- [key: string]: any;
401
- };
402
- objects: TresObject[];
403
- parent: TresObject | null;
404
- primitive?: boolean;
405
- dispose?: DisposeType;
406
- attach?: AttachType;
407
- previousAttach: any;
408
- }
409
- export interface TresObject3D extends THREE.Object3D<THREE.Object3DEventMap> {
410
- geometry?: THREE.BufferGeometry & TresBaseObject;
411
- material?: THREE.Material & TresBaseObject;
412
- }
413
- export type TresObject = TresBaseObject & (TresObject3D | THREE.BufferGeometry | THREE.Material | THREE.Fog) & {
414
- __tres?: LocalState;
415
- };
416
- /**
417
- * Union type covering all common Three.js material types
418
- * This provides better TypeScript intellisense and type checking
419
- * when accessing specific material properties
420
- */
421
- export type TresMaterial = THREE.MeshBasicMaterial | THREE.MeshStandardMaterial | THREE.MeshPhysicalMaterial | THREE.MeshLambertMaterial | THREE.MeshPhongMaterial | THREE.MeshToonMaterial | THREE.MeshNormalMaterial | THREE.MeshMatcapMaterial | THREE.MeshDepthMaterial | THREE.MeshDistanceMaterial | THREE.LineBasicMaterial | THREE.LineDashedMaterial | THREE.PointsMaterial | THREE.SpriteMaterial | THREE.ShaderMaterial | THREE.RawShaderMaterial | THREE.ShadowMaterial | THREE.Material;
422
- export type TresInstance = TresObject & {
423
- __tres: LocalState;
424
- };
425
- export type TresPrimitive = TresInstance & {
426
- object: TresInstance;
427
- isPrimitive: true;
428
- };
429
- export interface TresScene extends THREE.Scene {
430
- __tres: {
431
- root: TresContext;
432
- objects: TresObject[];
433
- isUnmounting: boolean;
434
- };
435
- }
436
- interface MathRepresentation {
437
- set(...args: number[]): any;
438
- }
439
- interface VectorRepresentation extends MathRepresentation {
440
- setScalar(s: number): any;
441
- }
442
- type MathTypes = MathRepresentation | THREE.Euler | THREE.Color;
443
- export interface VectorCoordinates {
444
- x: number;
445
- y: number;
446
- z: number;
447
- }
448
- export type MathType<T extends MathTypes> = T extends THREE.Color ? ConstructorParameters<typeof THREE.Color> | THREE.ColorRepresentation : T extends VectorRepresentation | THREE.Layers | THREE.Euler ? T | Parameters<T['set']> | number | VectorCoordinates : T | Parameters<T['set']>;
449
- type VectorLike$1<VectorClass extends THREE.Vector2 | THREE.Vector3 | THREE.Vector4> = VectorClass | Parameters<VectorClass['set']> | Readonly<Parameters<VectorClass['set']>> | Parameters<VectorClass['setScalar']>[0];
450
- export type TresVector2 = VectorLike$1<THREE.Vector2>;
451
- export type TresVector3 = VectorLike$1<THREE.Vector3>;
452
- export type TresVector4 = VectorLike$1<THREE.Vector4>;
453
- export type TresColor = ConstructorParameters<typeof THREE.Color> | THREE.Color | number | string;
454
- export type TresColorArray = typeof THREE.Color | [color: THREE.ColorRepresentation];
455
- export type TresLayers = THREE.Layers | Parameters<THREE.Layers['set']>[0];
456
- export type TresQuaternion = THREE.Quaternion | Parameters<THREE.Quaternion['set']>;
457
- export type TresEuler = THREE.Euler;
458
- export type TresControl = THREE.EventDispatcher & {
459
- enabled: boolean;
460
- };
461
- export type TresContextWithClock = TresContext & {
462
- delta: number;
463
- elapsed: number;
464
- };
465
- export type WithMathProps<P> = { [K in keyof P]: P[K] extends MathTypes ? MathType<P[K]> : P[K]; };
466
- interface RaycastableRepresentation {
467
- raycast: (raycaster: THREE.Raycaster, intersects: THREE.Intersection[]) => void;
468
- }
469
- type EventProps<P> = P extends RaycastableRepresentation ? Partial<PointerEventHandlers> : unknown;
470
- export interface VueProps {
471
- children?: VNode[];
472
- ref?: VNodeRef;
473
- key?: string | number | symbol;
474
- }
475
- export type ElementProps<T extends ConstructorRepresentation, P = InstanceType<T>> = Partial<Overwrite<P, WithMathProps<P> & VueProps & EventProps<P>>>;
476
- export type ThreeElement<T extends ConstructorRepresentation> = Mutable<Overwrite<ElementProps<T>, Omit<InstanceProps<InstanceType<T>, T>, 'object'>>>;
477
- type ThreeExports = typeof THREE;
478
- type ThreeInstancesImpl = { [K in keyof ThreeExports as Uncapitalize<K>]: ThreeExports[K] extends ConstructorRepresentation ? ThreeElement<ThreeExports[K]> : never; };
479
- export interface ThreeInstances extends ThreeInstancesImpl {
480
- primitive: Omit<ThreeElement<any>, 'args'> & {
481
- object: object;
482
- };
483
- }
484
- export type TresComponents = { [K in keyof ThreeInstances as `Tres${Capitalize<string & K>}`]: DefineComponent<ThreeInstances[K]>; };
485
- declare module 'vue' {
486
- interface GlobalComponents extends TresComponents {
487
- primitive: DefineComponent<TresPrimitive>;
488
- }
489
- }
490
- //#endregion
491
- //#region src/utils/graph.d.ts
492
- export interface TresObjectMap {
493
- nodes: {
494
- [name: string]: TresObject;
495
- };
496
- materials: {
497
- [name: string]: TresMaterial;
498
- };
499
- meshes: {
500
- [name: string]: Mesh;
501
- };
502
- scene?: Scene;
503
- }
504
- export declare function buildGraph(object: Object3D | TresObject): TresObjectMap;
505
- //#endregion
506
- //#region src/composables/useLoader/component.vue.d.ts
507
- declare const __VLS_export$3: <T extends TresObjectMap>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
508
- props: import("vue").PublicProps & __VLS_PrettifyLocal<{
509
- /**
510
- * The THREE.js loader to use
511
- */
512
- loader: LoaderProto<T>;
513
- /**
514
- * Path to resource
515
- */
516
- path: string;
517
- /**
518
- * Optional THREE.js LoadingManager
519
- */
520
- manager?: LoadingManager;
521
- extensions?: (res: T) => void;
522
- } & {
523
- onError?: ((error: unknown) => any) | undefined;
524
- onLoaded?: ((result: T) => any) | undefined;
525
- }> & (typeof globalThis extends {
526
- __VLS_PROPS_FALLBACK: infer P;
527
- } ? P : {});
528
- expose: (exposed: {}) => void;
529
- attrs: any;
530
- slots: {
531
- default?: (props: {
532
- state: T;
533
- isLoading: boolean;
534
- error: unknown;
535
- }) => any;
536
- };
537
- emit: ((evt: "error", error: unknown) => void) & ((evt: "loaded", result: T) => void);
538
- }>) => import("vue").VNode & {
539
- __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
540
- };
541
- declare const _default$3: typeof __VLS_export$3;
542
- type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
543
- //#endregion
544
- //#region src/composables/useGraph/index.d.ts
545
- export declare const useGraph: (object: MaybeRef<TresObject | undefined>) => import("vue").ComputedRef<TresObjectMap | undefined>;
546
- //#endregion
547
- //#region src/utils/createPriorityEventHook.d.ts
548
- type Callback<T> = Parameters<EventHookOff<T>>[0];
549
- type PriorityEventHookOn<T> = (fn: Callback<T>, priority?: number) => {
550
- off: () => void;
551
- };
552
- //#endregion
553
- //#region src/composables/useTres/index.d.ts
554
- export interface TresPartialContext extends Omit<TresContext, 'renderer' | 'camera'> {
555
- /**
556
- * The renderer instance
557
- *
558
- * @type {TresRenderer}
559
- * @memberof TresPartialContext
560
- */
561
- renderer: TresRenderer;
562
- /**
563
- * The current active camera
564
- *
565
- * @type {ComputedRef<Camera | undefined>}
566
- * @memberof TresPartialContext
567
- */
568
- camera: ComputedRef<Camera | undefined>;
569
- /**
570
- * Marks the scene as needing an update in the next frame.
571
- * This is used in on-demand rendering mode to schedule a render.
572
- *
573
- * @type {() => void}
574
- * @memberof TresPartialContext
575
- */
576
- invalidate: () => void;
577
- /**
578
- * Manually advances the render loop by one frame.
579
- * This is particularly useful in manual rendering mode where you want explicit control over when frames are rendered.
580
- *
581
- * @type {() => void}
582
- * @memberof TresPartialContext
583
- */
584
- advance: () => void;
585
- }
586
- export declare function useTres(): TresPartialContext;
587
- //#endregion
588
- //#region src/composables/useLoop/index.d.ts
589
- export type LoopContext = RafLoopContext & TresPartialContext;
590
- /**
591
- * Composable that provides control over the render loop and animation lifecycle.
592
- */
593
- export declare const useLoop: () => {
594
- stop: () => void;
595
- start: () => void;
596
- isActive: Readonly<import("vue").ShallowRef<boolean>>;
597
- onBeforeRender: PriorityEventHookOn<LoopContext>;
598
- onRender: PriorityEventHookOn<LoopContext>;
599
- render: (fn: RenderFunction) => void;
600
- };
601
- //#endregion
602
- //#region src/core/nodeOps.d.ts
603
- interface TresCustomRendererOptions {
604
- primitivePrefix?: string;
605
- }
606
- //#endregion
607
- //#region src/utils/logger.d.ts
608
- /**
609
- * Logger utility for TresJS
610
- * @module logger
611
- */
612
- export declare const isProd: boolean;
613
- type OneOrMore<T> = {
614
- 0: T;
615
- } & Array<T>;
616
- /**
617
- * Logs an error message with the TresJS prefix
618
- * @param args - Arguments to log
619
- */
620
- export declare function logError(...args: OneOrMore<any>): void;
621
- /**
622
- * Logs a warning message with the TresJS prefix
623
- * @param args - Arguments to log
624
- */
625
- export declare function logWarning(...args: OneOrMore<any>): void;
626
- /**
627
- * Logs a message with the TresJS prefix (only in development mode)
628
- * @param name - Name of the message
629
- * @param value - Value to log
630
- */
631
- export declare function logMessage(name: string, value: any): void;
632
- //#endregion
633
- //#region src/utils/index.d.ts
634
- declare function disposeObject3D(object: TresObject): void;
635
- //#endregion
636
- //#region src/utils/normalize.d.ts
637
- interface Vector2PropInterface {
638
- x?: number;
639
- y?: number;
640
- width?: number;
641
- height?: number;
642
- }
643
- interface Vector3PropInterface extends Vector2PropInterface {
644
- z?: number;
645
- }
646
- type VectorFlexibleParams = Vector3 | number[] | Vector3PropInterface | number;
647
- export declare function normalizeVectorFlexibleParam(value: VectorFlexibleParams): Array<number>;
648
- export declare function normalizeColor(value: Color | Array<number> | string | number | ColorRepresentation): Color;
649
- //#endregion
650
- //#region src/utils/template-compiler-options.d.ts
651
- declare const templateCompilerOptions: {
652
- template: {
653
- compilerOptions: {
654
- isCustomElement: (tag: string) => boolean;
655
- };
656
- };
657
- };
658
- //#endregion
659
- //#region src/components/Context.vue.d.ts
660
- interface ContextProps extends RendererOptions {
661
- /**
662
- * Custom camera instance to use as main camera
663
- * If not provided, a default PerspectiveCamera will be created
664
- */
665
- camera?: TresCamera;
666
- /**
667
- * Whether the canvas should be sized to the window
668
- * When true, canvas will be fixed positioned and full viewport size
669
- * @default false
670
- */
671
- windowSize?: boolean;
672
- /**
673
- * The maximum number of frames per second to render
674
- * @default undefined
675
- */
676
- fpsLimit?: number;
677
- /**
678
- * Whether to enable the provide/inject bridge between Vue and TresJS
679
- * When true, Vue's provide/inject will work across the TresJS boundary
680
- * @default true
681
- */
682
- enableProvideBridge?: boolean;
683
- /**
684
- * Options for the TresJS custom renderer
685
- *
686
- */
687
- customRendererOptions?: TresCustomRendererOptions;
688
- }
689
- type ContextEmits = {
690
- ready: [context: TresContext];
691
- error: [error: Error];
692
- pointermissed: [event: TresPointerEvent];
693
- render: [context: TresContext];
694
- beforeLoop: [context: TresContextWithClock];
695
- loop: [context: TresContextWithClock];
696
- } & { [key in TresPointerEventName]: [event: TresPointerEvent]; };
697
- type __VLS_Props$1 = ContextProps & {
698
- canvas: HTMLCanvasElement;
699
- };
700
- type __VLS_Slots$2 = {
701
- default: () => any;
702
- };
703
- declare const __VLS_base$2: import("vue").DefineComponent<__VLS_Props$1, {
704
- context: import("vue").ShallowRef<TresContext, TresContext>;
705
- dispose: () => void;
706
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
707
- render: (context: TresContext) => any;
708
- click: (event: TresPointerEvent) => any;
709
- contextmenu: (event: TresPointerEvent) => any;
710
- pointermove: (event: TresPointerEvent) => any;
711
- pointerenter: (event: TresPointerEvent) => any;
712
- pointerleave: (event: TresPointerEvent) => any;
713
- pointerover: (event: TresPointerEvent) => any;
714
- pointerout: (event: TresPointerEvent) => any;
715
- dblclick: (event: TresPointerEvent) => any;
716
- pointerdown: (event: TresPointerEvent) => any;
717
- pointerup: (event: TresPointerEvent) => any;
718
- pointercancel: (event: TresPointerEvent) => any;
719
- lostpointercapture: (event: TresPointerEvent) => any;
720
- wheel: (event: TresPointerEvent) => any;
721
- ready: (context: TresContext) => any;
722
- error: (error: Error) => any;
723
- pointermissed: (event: TresPointerEvent) => any;
724
- beforeLoop: (context: TresContextWithClock) => any;
725
- loop: (context: TresContextWithClock) => any;
726
- }, string, import("vue").PublicProps, Readonly<__VLS_Props$1> & Readonly<{
727
- onRender?: ((context: TresContext) => any) | undefined;
728
- onClick?: ((event: TresPointerEvent) => any) | undefined;
729
- onContextmenu?: ((event: TresPointerEvent) => any) | undefined;
730
- onPointermove?: ((event: TresPointerEvent) => any) | undefined;
731
- onPointerenter?: ((event: TresPointerEvent) => any) | undefined;
732
- onPointerleave?: ((event: TresPointerEvent) => any) | undefined;
733
- onPointerover?: ((event: TresPointerEvent) => any) | undefined;
734
- onPointerout?: ((event: TresPointerEvent) => any) | undefined;
735
- onDblclick?: ((event: TresPointerEvent) => any) | undefined;
736
- onPointerdown?: ((event: TresPointerEvent) => any) | undefined;
737
- onPointerup?: ((event: TresPointerEvent) => any) | undefined;
738
- onPointercancel?: ((event: TresPointerEvent) => any) | undefined;
739
- onLostpointercapture?: ((event: TresPointerEvent) => any) | undefined;
740
- onWheel?: ((event: TresPointerEvent) => any) | undefined;
741
- onReady?: ((context: TresContext) => any) | undefined;
742
- onError?: ((error: Error) => any) | undefined;
743
- onPointermissed?: ((event: TresPointerEvent) => any) | undefined;
744
- onBeforeLoop?: ((context: TresContextWithClock) => any) | undefined;
745
- onLoop?: ((context: TresContextWithClock) => any) | undefined;
746
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
747
- declare const __VLS_export$2: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
748
- declare const _default$1: typeof __VLS_export$2;
749
- type __VLS_WithSlots$2<T, S> = T & {
750
- new (): {
751
- $slots: S;
752
- };
753
- };
754
- //#endregion
755
- //#region src/components/TresCanvas.vue.d.ts
756
- type TresCanvasEmits = ContextEmits;
757
- type TresCanvasProps = ContextProps;
758
- interface TresCanvasInstance {
759
- get context(): TresContext | undefined;
760
- dispose: () => void;
761
- }
762
- type __VLS_Slots$1 = {
763
- default: () => any;
764
- };
765
- declare const __VLS_base$1: import("vue").DefineComponent<ContextProps, TresCanvasInstance, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
766
- render: (context: TresContext) => any;
767
- click: (event: TresPointerEvent) => any;
768
- contextmenu: (event: TresPointerEvent) => any;
769
- pointermove: (event: TresPointerEvent) => any;
770
- pointerenter: (event: TresPointerEvent) => any;
771
- pointerleave: (event: TresPointerEvent) => any;
772
- pointerover: (event: TresPointerEvent) => any;
773
- pointerout: (event: TresPointerEvent) => any;
774
- dblclick: (event: TresPointerEvent) => any;
775
- pointerdown: (event: TresPointerEvent) => any;
776
- pointerup: (event: TresPointerEvent) => any;
777
- pointercancel: (event: TresPointerEvent) => any;
778
- lostpointercapture: (event: TresPointerEvent) => any;
779
- wheel: (event: TresPointerEvent) => any;
780
- ready: (context: TresContext) => any;
781
- error: (error: Error) => any;
782
- pointermissed: (event: TresPointerEvent) => any;
783
- beforeLoop: (context: TresContextWithClock) => any;
784
- loop: (context: TresContextWithClock) => any;
785
- }, string, import("vue").PublicProps, Readonly<ContextProps> & Readonly<{
786
- onRender?: ((context: TresContext) => any) | undefined;
787
- onClick?: ((event: TresPointerEvent) => any) | undefined;
788
- onContextmenu?: ((event: TresPointerEvent) => any) | undefined;
789
- onPointermove?: ((event: TresPointerEvent) => any) | undefined;
790
- onPointerenter?: ((event: TresPointerEvent) => any) | undefined;
791
- onPointerleave?: ((event: TresPointerEvent) => any) | undefined;
792
- onPointerover?: ((event: TresPointerEvent) => any) | undefined;
793
- onPointerout?: ((event: TresPointerEvent) => any) | undefined;
794
- onDblclick?: ((event: TresPointerEvent) => any) | undefined;
795
- onPointerdown?: ((event: TresPointerEvent) => any) | undefined;
796
- onPointerup?: ((event: TresPointerEvent) => any) | undefined;
797
- onPointercancel?: ((event: TresPointerEvent) => any) | undefined;
798
- onLostpointercapture?: ((event: TresPointerEvent) => any) | undefined;
799
- onWheel?: ((event: TresPointerEvent) => any) | undefined;
800
- onReady?: ((context: TresContext) => any) | undefined;
801
- onError?: ((error: Error) => any) | undefined;
802
- onPointermissed?: ((event: TresPointerEvent) => any) | undefined;
803
- onBeforeLoop?: ((context: TresContextWithClock) => any) | undefined;
804
- onLoop?: ((context: TresContextWithClock) => any) | undefined;
805
- }>, {
806
- alpha: boolean;
807
- logarithmicDepthBuffer: boolean;
808
- toneMapping: import("three").ToneMapping;
809
- depth: boolean;
810
- stencil: boolean;
811
- clearColor: import("three").ColorRepresentation;
812
- windowSize: boolean;
813
- enableProvideBridge: boolean;
814
- customRendererOptions: TresCustomRendererOptions;
815
- antialias: boolean;
816
- preserveDrawingBuffer: boolean;
817
- failIfMajorPerformanceCaveat: boolean;
818
- clearAlpha: number;
819
- shadows: boolean;
820
- shadowMapType: import("three").ShadowMapType;
821
- useLegacyLights: boolean;
822
- renderMode: "always" | "on-demand" | "manual";
823
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
824
- declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
825
- declare const _default: typeof __VLS_export$1;
826
- type __VLS_WithSlots$1<T, S> = T & {
827
- new (): {
828
- $slots: S;
829
- };
830
- };
831
- //#endregion
832
- //#region src/components/TresPortal.vue.d.ts
833
- type __VLS_Props = {
834
- /** Target Object3D/Scene to reparent children into. */
835
- to: Object3D;
836
- /** When true, children render in place (main scene) instead of the target. */
837
- disabled?: boolean;
838
- };
839
- declare var __VLS_7: {};
840
- type __VLS_Slots = {} & {
841
- default?: (props: typeof __VLS_7) => any;
842
- };
843
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
844
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
845
- declare const _default$2: typeof __VLS_export;
846
- type __VLS_WithSlots<T, S> = T & {
847
- new (): {
848
- $slots: S;
849
- };
850
- };
851
- //#endregion
852
- //#region src/core/catalogue.d.ts
853
- export declare const catalogue: Ref<TresCatalogue>;
854
- export declare const extend: (objects: any) => any;
855
- //#endregion
856
- //#region src/devtools/DevtoolsMessenger.d.ts
857
- export type DevtoolsMessageType = 'performance' | 'context' | 'asset-load';
858
- export interface AssetLoadData {
859
- url: string;
860
- type: string;
861
- loaded: boolean;
862
- size: number;
863
- asset: HTMLImageElement | HTMLScriptElement | HTMLLinkElement | Blob | ArrayBuffer | null;
864
- }
865
- export interface DevtoolsMessage<T = any> {
866
- type: DevtoolsMessageType;
867
- data: T;
868
- timestamp?: number;
869
- }
870
- export type DevtoolsSubscriber = (message: DevtoolsMessage) => void;
871
- /**
872
- * Messenger class for communicating with Tres DevTools
873
- * This class will be attached to window.__TRES__DEVTOOLS__
874
- */
875
- export declare class DevtoolsMessenger {
876
- private subscribers;
877
- private messageQueue;
878
- private maxQueueSize;
879
- /**
880
- * Send a message to devtools subscribers
881
- * If no subscribers are available, only queueable message types are queued
882
- */
883
- send<T>(type: DevtoolsMessageType, data: T): void;
884
- /**
885
- * Queue a message for later delivery
886
- */
887
- private queueMessage;
888
- /**
889
- * Flush all queued messages to current subscribers
890
- */
891
- private flushQueue;
892
- /**
893
- * Subscribe to devtools messages
894
- * When a new subscriber is added, all queued messages (asset-load events) are immediately delivered
895
- */
896
- subscribe(subscriber: DevtoolsSubscriber): () => void;
897
- /**
898
- * Check if there are any subscribers
899
- */
900
- get hasSubscribers(): boolean;
901
- /**
902
- * Get the current queue size
903
- */
904
- get queueSize(): number;
905
- /**
906
- * Clear all queued messages
907
- */
908
- clearQueue(): void;
909
- }
910
- //#endregion
911
- //#region src/devtools/plugin.d.ts
912
- export declare function registerTresDevtools(app: App, tres: TresContext): void;
913
- //#endregion
914
- //#region src/directives/vDistanceTo.d.ts
915
- export declare const vDistanceTo: {
916
- updated: (el: TresObject, binding: Ref<TresObject>) => void;
917
- unmounted: (el: TresObject) => void;
918
- };
919
- //#endregion
920
- //#region src/directives/vLightHelper.d.ts
921
- export declare const vLightHelper: {
922
- mounted: (el: TresObject) => void;
923
- updated: (el: TresObject) => void;
924
- unmounted: (el: TresObject) => void;
925
- };
926
- //#endregion
927
- //#region src/directives/vLog.d.ts
928
- export declare const vLog: {
929
- mounted: (el: TresObject, binding: {
930
- arg: string;
931
- }) => void;
932
- };
933
- //#endregion
934
- //#region src/utils/createTimer.d.ts
935
- export interface TresTimer {
936
- getDelta: () => number;
937
- getElapsed: () => number;
938
- update: () => void;
939
- start: () => void;
940
- stop: () => void;
941
- }
942
- /**
943
- * Creates a unified timer abstraction that uses `Timer` on Three.js r179+
944
- * and falls back to `Clock` on older versions.
945
- *
946
- * - On r179+: uses `Timer` with its Page Visibility API support (`connect`/`disconnect`).
947
- * - On older versions: uses `Clock` with `start`/`stop`.
948
- *
949
- */
950
- export declare function createTimer(): TresTimer;
951
- //#endregion
952
- //#region src/utils/is/three.d.ts
953
- /**
954
- * Type guard to check if a value is a Three.js Object3D
955
- * @param value - The value to check
956
- * @returns True if the value is a Three.js Object3D instance, false otherwise
957
- * @example
958
- * ```ts
959
- * const value = new THREE.Object3D()
960
- * if (isObject3D(value)) {
961
- * // TypeScript knows value is Object3D here
962
- * value.position // OK
963
- * value.rotation // OK
964
- * value.scale // OK
965
- * }
966
- * ```
967
- */
968
- export declare const isObject3D: (value: unknown) => value is Object3D<import("three").Object3DEventMap>;
969
- /**
970
- * Type guard to check if a value is a Three.js Mesh
971
- * @param value - The value to check
972
- * @returns True if the value is a Three.js Mesh instance, false otherwise
973
- * @example
974
- * ```ts
975
- * const value = new THREE.Mesh()
976
- * if (isMesh(value)) {
977
- * // TypeScript knows value is Mesh here
978
- * value.geometry // OK
979
- */
980
- export declare const isMesh: (value: unknown) => value is Mesh<BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, Material<import("three").MaterialEventMap> | Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap>;
981
- /**
982
- * Type guard to check if a value is a Three.js Camera
983
- * @param value - The value to check
984
- * @returns True if the value is a Three.js Camera instance, false otherwise
985
- * @example
986
- * ```ts
987
- * const value = new THREE.PerspectiveCamera()
988
- * if (isCamera(value)) {
989
- * // TypeScript knows value is Camera here
990
- * value.fov // OK
991
- * value.near // OK
992
- * value.far // OK
993
- * }
994
- * ```
995
- */
996
- export declare const isCamera: (value: unknown) => value is Camera;
997
- /**
998
- * Type guard to check if a value is a Three.js OrthographicCamera
999
- * @param value - The value to check
1000
- * @returns True if the value is a Three.js OrthographicCamera instance, false otherwise
1001
- */
1002
- export declare const isOrthographicCamera: (value: unknown) => value is OrthographicCamera;
1003
- /**
1004
- * Type guard to check if a value is a Three.js PerspectiveCamera
1005
- * @param value - The value to check
1006
- * @returns True if the value is a Three.js PerspectiveCamera instance, false otherwise
1007
- */
1008
- export declare const isPerspectiveCamera: (value: unknown) => value is PerspectiveCamera;
1009
- /**
1010
- * Type guard to check if a value is a Three.js Color
1011
- * @param value - The value to check
1012
- * @returns True if the value is a Three.js Color instance, false otherwise
1013
- */
1014
- export declare const isColor: (value: unknown) => value is Color;
1015
- /**
1016
- * Type guard to check if a value is a Three.js ColorRepresentation
1017
- * @param value - The value to check
1018
- * @returns True if the value is a Three.js ColorRepresentation instance, false otherwise
1019
- */
1020
- export declare const isColorRepresentation: (value: unknown) => value is ColorRepresentation;
1021
- /**
1022
- * Type guard to check if a value is a Three.js Layers
1023
- * @param value - The value to check
1024
- * @returns True if the value is a Three.js Layers instance, false otherwise
1025
- */
1026
- export declare const isLayers: (value: unknown) => value is Layers;
1027
- /**
1028
- * Type guard to check if a value is a Three.js BufferGeometry
1029
- * @param value - The value to check
1030
- * @returns True if the value is a Three.js BufferGeometry instance, false otherwise
1031
- * @example
1032
- * ```ts
1033
- * const value = new THREE.BufferGeometry()
1034
- * if (isBufferGeometry(value)) {
1035
- * // TypeScript knows value is BufferGeometry here
1036
- * value.attributes // OK
1037
- * value.index // OK
1038
- * value.computeVertexNormals() // OK
1039
- * }
1040
- * ```
1041
- */
1042
- export declare const isBufferGeometry: (value: unknown) => value is BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>;
1043
- /**
1044
- * Type guard to check if a value is a Three.js Material
1045
- * @param value - The value to check
1046
- * @returns True if the value is a Three.js Material instance, false otherwise
1047
- * @example
1048
- * ```ts
1049
- * const value = new THREE.MeshStandardMaterial()
1050
- * if (isMaterial(value)) {
1051
- * // TypeScript knows value is Material here
1052
- * value.color // OK
1053
- * value.metalness // OK
1054
- * value.roughness // OK
1055
- * }
1056
- * ```
1057
- */
1058
- export declare const isMaterial: (value: unknown) => value is Material<import("three").MaterialEventMap>;
1059
- /**
1060
- * Type guard to check if a value is a Three.js Light
1061
- * @param value - The value to check
1062
- * @returns True if the value is a Three.js Light instance, false otherwise
1063
- * @example
1064
- * ```ts
1065
- * const value = new THREE.DirectionalLight()
1066
- * if (isLight(value)) {
1067
- * // TypeScript knows value is Light here
1068
- * value.intensity // OK
1069
- * value.color // OK
1070
- * value.position // OK
1071
- * }
1072
- * ```
1073
- */
1074
- export declare const isLight: (value: unknown) => value is Light;
1075
- /**
1076
- * Type guard to check if a value is a Three.js Fog
1077
- * @param value - The value to check
1078
- * @returns True if the value is a Three.js Fog instance, false otherwise
1079
- * @example
1080
- * ```ts
1081
- * const value = new THREE.Fog(0x000000, 1, 1000)
1082
- * if (isFog(value)) {
1083
- * // TypeScript knows value is Fog here
1084
- * value.color // OK
1085
- * value.near // OK
1086
- * value.far // OK
1087
- * }
1088
- * ```
1089
- */
1090
- export declare const isFog: (value: unknown) => value is Fog;
1091
- /**
1092
- * Type guard to check if a value is a Three.js Scene
1093
- * @param value - The value to check
1094
- * @returns True if the value is a Three.js Scene instance, false otherwise
1095
- * @example
1096
- * ```ts
1097
- * const value = new THREE.Scene()
1098
- * if (isScene(value)) {
1099
- * // TypeScript knows value is Scene here
1100
- * value.children // OK
1101
- * value.add(new THREE.Object3D()) // OK
1102
- * value.remove(new THREE.Object3D()) // OK
1103
- * }
1104
- * ```
1105
- */
1106
- export declare const isScene: (value: unknown) => value is Scene<import("three").Object3DEventMap>;
1107
- /**
1108
- * Type guard to check if a value is a Three.js Group
1109
- * @param value - The value to check
1110
- * @returns True if the value is a Three.js Group instance, false otherwise
1111
- * ```
1112
- */
1113
- export declare const isGroup: (value: unknown) => value is Group<import("three").Object3DEventMap>;
1114
- //#endregion
1115
- //#region src/utils/is/tres.d.ts
1116
- interface VectorLike {
1117
- set: (...args: any[]) => void;
1118
- constructor?: (...args: any[]) => any;
1119
- }
1120
- export declare const isVectorLike: (value: unknown) => value is VectorLike;
1121
- interface Copyable {
1122
- copy: (...args: any[]) => void;
1123
- constructor?: (...args: any[]) => any;
1124
- }
1125
- export declare const isCopyable: (value: unknown) => value is Copyable;
1126
- interface ClassInstance {
1127
- constructor?: (...args: any[]) => any;
1128
- }
1129
- export declare const isClassInstance: (object: unknown) => object is ClassInstance;
1130
- /**
1131
- * Type guard to check if a value is a TresCamera
1132
- * @param value - The value to check
1133
- * @returns True if the value is a TresCamera instance, false otherwise
1134
- */
1135
- export declare const isTresCamera: (value: unknown) => value is TresCamera;
1136
- /**
1137
- * Type guard to check if a value is a TresObject
1138
- * @param value - The value to check
1139
- * @returns True if the value is a TresObject (Object3D | BufferGeometry | Material | Fog), false otherwise
1140
- * @example
1141
- * ```ts
1142
- * const value = new THREE.Mesh()
1143
- * if (isTresObject(value)) {
1144
- * // TypeScript knows value is TresObject here
1145
- * // You can use common properties and methods shared by all TresObjects
1146
- * }
1147
- * ```
1148
- * @remarks
1149
- * TresObject is a union type that represents the core Three.js objects that can be used in TresJS.
1150
- * This includes Object3D, BufferGeometry, Material, and Fog instances.
1151
- */
1152
- export declare const isTresObject: (value: unknown) => value is TresObject;
1153
- /**
1154
- * Type guard to check if a value is a TresPrimitive
1155
- * @param value - The value to check
1156
- * @returns True if the value is a TresPrimitive instance, false otherwise
1157
- * @example
1158
- * ```ts
1159
- * const value = { isPrimitive: true }
1160
- * if (isTresPrimitive(value)) {
1161
- * // TypeScript knows value is TresPrimitive here
1162
- * // You can use properties and methods specific to TresPrimitives
1163
- * }
1164
- * ```
1165
- * @remarks
1166
- * TresPrimitive is a special type in TresJS that represents primitive objects
1167
- * that can be used directly in the scene without needing to be wrapped in a Three.js object.
1168
- */
1169
- export declare const isTresPrimitive: (value: unknown) => value is TresPrimitive;
1170
- /**
1171
- * Type guard to check if a value is a TresInstance (has __tres property)
1172
- * @param value - The value to check
1173
- * @returns True if the value is a TresInstance (has __tres property), false otherwise
1174
- * @example
1175
- * ```ts
1176
- * const value = new THREE.Mesh()
1177
- * if (isTresInstance(value)) {
1178
- * // TypeScript knows value is TresInstance here
1179
- * // You can safely access value.__tres
1180
- * }
1181
- * ```
1182
- */
1183
- export declare const isTresInstance: (value: unknown) => value is TresInstance;
1184
- /**
1185
- * Type guard to check if a value is a Three.js WebGPU `Renderer`.
1186
- *
1187
- * Identifies the renderer *instance*, not the active backend: a `WebGPURenderer`
1188
- * can run on a WebGPU **or** a WebGL2 fallback backend, and this returns `true`
1189
- * for both. That is the right granularity for branching on capabilities —
1190
- * `NodeMaterial` works on either backend, while a GLSL `ShaderMaterial` works on
1191
- * neither under the WebGPU renderer.
1192
- * @param value - The value to check
1193
- * @returns True if the value is a WebGPU `Renderer` instance, false otherwise
1194
- * @example
1195
- * ```ts
1196
- * const { renderer } = useTresContext()
1197
- * if (isWebGPURenderer(renderer.instance)) {
1198
- * // TypeScript knows renderer.instance is a WebGPU Renderer here
1199
- * }
1200
- * ```
1201
- */
1202
- export declare const isWebGPURenderer: (value: unknown) => value is Renderer;
1203
- /**
1204
- * Type guard to check if a value is a Three.js `WebGLRenderer`.
1205
- * @param value - The value to check
1206
- * @returns True if the value is a `WebGLRenderer` instance, false otherwise
1207
- * @see {@link isWebGPURenderer}
1208
- */
1209
- export declare const isWebGLRenderer: (value: unknown) => value is WebGLRenderer & {
1210
- isWebGLRenderer: true;
1211
- };
1212
- //#endregion
1213
- //#region src/index.d.ts
1214
- export interface TresOptions {
1215
- extends?: Record<string, unknown>;
1216
- }
1217
- export interface TresPlugin {
1218
- [key: string]: any;
1219
- install: (app: App, options?: TresOptions) => void;
1220
- }
1221
- declare const plugin: TresPlugin;
1222
- //#endregion
1223
- export { _default as TresCanvas, _default$1 as TresCanvasContext, type TresCanvasEmits, type TresCanvasInstance, type TresCanvasProps, type TresContext, type TresCustomRendererOptions, type TresPointerEvent, _default$2 as TresPortal, _default$3 as UseLoader, type VectorFlexibleParams, plugin as default, disposeObject3D as dispose, templateCompilerOptions, useTresContext, useTresContextProvider };
8
+ import { $ as isProd, $t as TresPointerEvent, A as createTimer, At as TresCamera, B as catalogue, Bt as TresLayers, C as isNode, Ct as Mutable, D as isPerspectiveCamera, Dt as ThreeElement, E as isOrthographicCamera, Et as Properties, F as AssetLoadData, Ft as TresComponentsOf, G as TresCanvasEmits, Gt as TresQuaternion, H as _default$2, Ht as TresObject, I as DevtoolsMessage, It as TresContextWithClock, J as templateCompilerOptions, Jt as TresVector3, K as TresCanvasInstance, Kt as TresScene, L as DevtoolsMessageType, Lt as TresControl, M as vLightHelper, Mt as TresColor, N as vDistanceTo, Nt as TresColorArray, O as isScene, Ot as ThreeInstances, P as registerTresDevtools, Pt as TresComponents, Q as disposeObject3D, Qt as WithMathProps, R as DevtoolsMessenger, Rt as TresEuler, S as isMesh, St as MathType, T as isObject3D, Tt as Overwrite, U as _default$1, Ut as TresObject3D, V as extend, Vt as TresMaterial, W as _default, Wt as TresPrimitive, X as normalizeColor, Xt as VectorCoordinates, Y as VectorFlexibleParams, Yt as TresVector4, Z as normalizeVectorFlexibleParam, Zt as VueProps, _ as isFog, _n as LoaderProto, _t as ConstructorRepresentation, a as isCopyable, an as RenderMode, at as useLoop, b as isLight, bn as UseLoaderReturn, bt as InstanceProps, c as isTresObject, cn as TresRendererSetupContext, ct as useGraph, d as isWebGLRenderer, dn as TresRendererError, dt as _default$3, en as INJECTION_KEY, et as logError, f as isWebGPURenderer, fn as TresRendererErrorCode, ft as TresObjectMap, g as isColorRepresentation, gn as LoaderMethods, gt as AttachType, h as isColor, ht as AttachFnType, i as isClassInstance, in as RenderFunction, it as LoopContext, j as vLog, jt as TresCatalogue, k as TresTimer, kt as ThreeInstancesOf, l as isTresPrimitive, ln as UseRendererManagerReturn, lt as useRendererManager, m as isCamera, mn as useCameraManager, mt as Args, n as TresPlugin, nt as logWarning, o as isTresCamera, on as RendererOptions, ot as TresPartialContext, p as isBufferGeometry, pn as UseCameraReturn, pt as buildGraph, q as TresCanvasProps, qt as TresVector2, r as plugin, rn as useTresContext, rt as TresCustomRendererOptions, s as isTresInstance, sn as TresRenderer, st as useTres, t as TresOptions, tn as TresContext, tt as logMessage, u as isVectorLike, un as UseRendererOptions, ut as useTresContextProvider, v as isGroup, vn as TresLoader, vt as DisposeType, w as isNodeMaterial, wt as NonFunctionKeys, x as isMaterial, xn as useLoader, xt as LocalState, y as isLayers, yn as TresLoaderOptions, yt as ElementProps, z as DevtoolsSubscriber, zt as TresInstance } from "./index-CbIRI9tI.js";
9
+ export { Args, AssetLoadData, AttachFnType, AttachType, ConstructorRepresentation, DevtoolsMessage, DevtoolsMessageType, DevtoolsMessenger, DevtoolsSubscriber, DisposeType, ElementProps, INJECTION_KEY, InstanceProps, LoaderMethods, LoaderProto, LocalState, LoopContext, MathType, Mutable, NonFunctionKeys, Overwrite, Properties, type RenderFunction, type RenderMode, type RendererOptions, ThreeElement, ThreeInstances, ThreeInstancesOf, TresCamera, _default as TresCanvas, _default$1 as TresCanvasContext, type TresCanvasEmits, type TresCanvasInstance, type TresCanvasProps, TresCatalogue, TresColor, TresColorArray, TresComponents, TresComponentsOf, type TresContext, TresContextWithClock, TresControl, type TresCustomRendererOptions, TresEuler, TresInstance, TresLayers, TresLoader, TresLoaderOptions, TresMaterial, TresObject, TresObject3D, TresObjectMap, TresOptions, TresPartialContext, TresPlugin, type TresPointerEvent, _default$2 as TresPortal, TresPrimitive, TresQuaternion, type TresRenderer, TresRendererError, TresRendererErrorCode, type TresRendererSetupContext, TresScene, TresTimer, TresVector2, TresVector3, TresVector4, UseCameraReturn, _default$3 as UseLoader, UseLoaderReturn, type UseRendererManagerReturn, type UseRendererOptions, VectorCoordinates, type VectorFlexibleParams, VueProps, WithMathProps, buildGraph, catalogue, createTimer, plugin as default, disposeObject3D as dispose, extend, isBufferGeometry, isCamera, isClassInstance, isColor, isColorRepresentation, isCopyable, isFog, isGroup, isLayers, isLight, isMaterial, isMesh, isNode, isNodeMaterial, isObject3D, isOrthographicCamera, isPerspectiveCamera, isProd, isScene, isTresCamera, isTresInstance, isTresObject, isTresPrimitive, isVectorLike, isWebGLRenderer, isWebGPURenderer, logError, logMessage, logWarning, normalizeColor, normalizeVectorFlexibleParam, registerTresDevtools, templateCompilerOptions, useCameraManager, useGraph, useLoader, useLoop, useRendererManager, useTres, useTresContext, useTresContextProvider, vDistanceTo, vLightHelper, vLog };