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