@tresjs/core 5.5.0 → 5.6.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v5.5.0
3
+ * version: v5.6.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/)
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v5.5.0
3
+ * version: v5.6.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/)
package/dist/tres.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v5.5.0
3
+ * version: v5.6.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 * as vue10 from "vue";
8
+ import * as vue15 from "vue";
9
9
  import { App, ComputedRef, DefineComponent, MaybeRef, MaybeRefOrGetter, Reactive, Ref, ShallowRef, VNode, VNodeRef } from "vue";
10
10
  import * as THREE from "three";
11
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";
@@ -321,11 +321,11 @@ declare function useRendererManager({
321
321
  onRender: _vueuse_core0.EventHookOn<TresRenderer>;
322
322
  onError: _vueuse_core0.EventHookOn<TresRendererError>;
323
323
  invalidate: (amountOfFramesToInvalidate?: number) => void;
324
- canBeInvalidated: vue10.ComputedRef<boolean>;
324
+ canBeInvalidated: vue15.ComputedRef<boolean>;
325
325
  mode: "always" | "on-demand" | "manual" | undefined;
326
326
  replaceRenderFunction: (fn: RenderFunction) => void;
327
- isInitialized: vue10.Ref<boolean, boolean>;
328
- error: vue10.Ref<TresRendererError | null, TresRendererError | null>;
327
+ isInitialized: vue15.Ref<boolean, boolean>;
328
+ error: vue15.Ref<TresRendererError | null, TresRendererError | null>;
329
329
  };
330
330
  type UseRendererManagerReturn = ReturnType<typeof useRendererManager>;
331
331
  //#endregion
@@ -372,7 +372,7 @@ type PointerEventHandlers = { [key in SupportedVuePointerEvent]: (event: TresPoi
372
372
  //#region src/types/index.d.ts
373
373
  type AttachFnType = (parent: any, self: TresInstance) => () => void;
374
374
  type AttachType = string | AttachFnType;
375
- type DisposeType = ((self: TresInstance) => void) | boolean | 'default';
375
+ type DisposeType = ((self: TresInstance) => void) | boolean | 'default' | null;
376
376
  type ConstructorRepresentation = new (...args: any[]) => any;
377
377
  type NonFunctionKeys<P> = { [K in keyof P]-?: P[K] extends ((...args: any[]) => any) ? never : K }[keyof P];
378
378
  type Overwrite<P, O> = Omit<P, NonFunctionKeys<O>> & O;
@@ -512,7 +512,7 @@ declare function buildGraph(object: Object3D | TresObject): TresObjectMap;
512
512
  //#endregion
513
513
  //#region src/composables/useLoader/component.vue.d.ts
514
514
  declare const __VLS_export$2: <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<{
515
- props: vue10.PublicProps & __VLS_PrettifyLocal<{
515
+ props: vue15.PublicProps & __VLS_PrettifyLocal<{
516
516
  /**
517
517
  * The THREE.js loader to use
518
518
  */
@@ -535,20 +535,20 @@ declare const __VLS_export$2: <T extends TresObjectMap>(__VLS_props: NonNullable
535
535
  attrs: any;
536
536
  slots: {
537
537
  default?: (props: {
538
- state: vue10.UnwrapRef<T>;
538
+ state: vue15.UnwrapRef<T>;
539
539
  isLoading: boolean;
540
540
  error: unknown;
541
541
  }) => any;
542
542
  };
543
543
  emit: ((evt: "error", error: unknown) => void) & ((evt: "loaded", result: T) => void);
544
- }>) => vue10.VNode & {
544
+ }>) => vue15.VNode & {
545
545
  __ctx?: Awaited<typeof __VLS_setup>;
546
546
  };
547
547
  declare const _default$2: typeof __VLS_export$2;
548
548
  type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
549
549
  //#endregion
550
550
  //#region src/composables/useGraph/index.d.ts
551
- declare const useGraph: (object: MaybeRef$1<TresObject | undefined>) => vue10.ComputedRef<TresObjectMap | undefined>;
551
+ declare const useGraph: (object: MaybeRef$1<TresObject | undefined>) => vue15.ComputedRef<TresObjectMap | undefined>;
552
552
  //#endregion
553
553
  //#region src/utils/createPriorityEventHook.d.ts
554
554
  type Callback<T> = Parameters<EventHookOff<T>>[0];
@@ -599,7 +599,7 @@ type LoopContext = RafLoopContext & TresPartialContext;
599
599
  declare const useLoop: () => {
600
600
  stop: () => void;
601
601
  start: () => void;
602
- isActive: Readonly<vue10.ShallowRef<boolean>>;
602
+ isActive: Readonly<vue15.ShallowRef<boolean>>;
603
603
  onBeforeRender: PriorityEventHookOn<LoopContext>;
604
604
  onRender: PriorityEventHookOn<LoopContext>;
605
605
  render: (fn: RenderFunction) => void;
@@ -701,10 +701,10 @@ type __VLS_Props = ContextProps & {
701
701
  type __VLS_Slots$1 = {
702
702
  default: () => any;
703
703
  };
704
- declare const __VLS_base$1: vue10.DefineComponent<__VLS_Props, {
705
- context: vue10.ShallowRef<TresContext, TresContext>;
704
+ declare const __VLS_base$1: vue15.DefineComponent<__VLS_Props, {
705
+ context: vue15.ShallowRef<TresContext, TresContext>;
706
706
  dispose: () => void;
707
- }, {}, {}, {}, vue10.ComponentOptionsMixin, vue10.ComponentOptionsMixin, {
707
+ }, {}, {}, {}, vue15.ComponentOptionsMixin, vue15.ComponentOptionsMixin, {
708
708
  click: (event: TresPointerEvent) => any;
709
709
  contextmenu: (event: TresPointerEvent) => any;
710
710
  pointermove: (event: TresPointerEvent) => any;
@@ -724,7 +724,7 @@ declare const __VLS_base$1: vue10.DefineComponent<__VLS_Props, {
724
724
  render: (context: TresContext) => any;
725
725
  beforeLoop: (context: TresContextWithClock) => any;
726
726
  loop: (context: TresContextWithClock) => any;
727
- }, string, vue10.PublicProps, Readonly<__VLS_Props> & Readonly<{
727
+ }, string, vue15.PublicProps, Readonly<__VLS_Props> & Readonly<{
728
728
  onClick?: ((event: TresPointerEvent) => any) | undefined;
729
729
  onContextmenu?: ((event: TresPointerEvent) => any) | undefined;
730
730
  onPointermove?: ((event: TresPointerEvent) => any) | undefined;
@@ -744,7 +744,7 @@ declare const __VLS_base$1: vue10.DefineComponent<__VLS_Props, {
744
744
  onRender?: ((context: TresContext) => any) | undefined;
745
745
  onBeforeLoop?: ((context: TresContextWithClock) => any) | undefined;
746
746
  onLoop?: ((context: TresContextWithClock) => any) | undefined;
747
- }>, {}, {}, {}, {}, string, vue10.ComponentProvideOptions, false, {}, any>;
747
+ }>, {}, {}, {}, {}, string, vue15.ComponentProvideOptions, false, {}, any>;
748
748
  declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
749
749
  declare const _default$1: typeof __VLS_export$1;
750
750
  type __VLS_WithSlots$1<T, S> = T & {
@@ -763,7 +763,7 @@ interface TresCanvasInstance {
763
763
  type __VLS_Slots = {
764
764
  default: () => any;
765
765
  };
766
- declare const __VLS_base: vue10.DefineComponent<ContextProps, TresCanvasInstance, {}, {}, {}, vue10.ComponentOptionsMixin, vue10.ComponentOptionsMixin, {
766
+ declare const __VLS_base: vue15.DefineComponent<ContextProps, TresCanvasInstance, {}, {}, {}, vue15.ComponentOptionsMixin, vue15.ComponentOptionsMixin, {
767
767
  click: (event: TresPointerEvent) => any;
768
768
  contextmenu: (event: TresPointerEvent) => any;
769
769
  pointermove: (event: TresPointerEvent) => any;
@@ -783,7 +783,7 @@ declare const __VLS_base: vue10.DefineComponent<ContextProps, TresCanvasInstance
783
783
  render: (context: TresContext) => any;
784
784
  beforeLoop: (context: TresContextWithClock) => any;
785
785
  loop: (context: TresContextWithClock) => any;
786
- }, string, vue10.PublicProps, Readonly<ContextProps> & Readonly<{
786
+ }, string, vue15.PublicProps, Readonly<ContextProps> & Readonly<{
787
787
  onClick?: ((event: TresPointerEvent) => any) | undefined;
788
788
  onContextmenu?: ((event: TresPointerEvent) => any) | undefined;
789
789
  onPointermove?: ((event: TresPointerEvent) => any) | undefined;
@@ -820,7 +820,7 @@ declare const __VLS_base: vue10.DefineComponent<ContextProps, TresCanvasInstance
820
820
  shadowMapType: THREE.ShadowMapType;
821
821
  useLegacyLights: boolean;
822
822
  renderMode: "always" | "on-demand" | "manual";
823
- }, {}, {}, {}, string, vue10.ComponentProvideOptions, false, {}, any>;
823
+ }, {}, {}, {}, string, vue15.ComponentProvideOptions, false, {}, any>;
824
824
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
825
825
  declare const _default: typeof __VLS_export;
826
826
  type __VLS_WithSlots<T, S> = T & {
@@ -1033,7 +1033,7 @@ declare const isMaterial: (value: unknown) => value is Material;
1033
1033
  * }
1034
1034
  * ```
1035
1035
  */
1036
- declare const isLight: (value: unknown) => value is Light<THREE.LightShadow<Camera> | undefined>;
1036
+ declare const isLight: (value: unknown) => value is Light;
1037
1037
  /**
1038
1038
  * Type guard to check if a value is a Three.js Fog
1039
1039
  * @param value - The value to check
@@ -1065,7 +1065,7 @@ declare const isFog: (value: unknown) => value is Fog;
1065
1065
  * }
1066
1066
  * ```
1067
1067
  */
1068
- declare const isScene: (value: unknown) => value is Scene<THREE.Object3DEventMap>;
1068
+ declare const isScene: (value: unknown) => value is Scene;
1069
1069
  /**
1070
1070
  * Type guard to check if a value is a Three.js Group
1071
1071
  * @param value - The value to check
package/dist/tres.js CHANGED
@@ -1,20 +1,20 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v5.5.0
3
+ * version: v5.6.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
8
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createRenderer, defineComponent, getCurrentInstance, h, isRef, mergeProps, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, provide, reactive, readonly, ref, renderSlot, shallowRef, toValue, unref, useSlots, watch, watchEffect, withCtx } from "vue";
9
9
  import * as THREE from "three";
10
- import { ACESFilmicToneMapping, ArrowHelper, BackSide, BufferAttribute, BufferGeometry, Clock, Color, DirectionalLightHelper, DoubleSide, Float32BufferAttribute, HemisphereLightHelper, Layers, Line, LineBasicMaterial, Material, MathUtils, Mesh, MeshBasicMaterial, PCFSoftShadowMap, PerspectiveCamera, PointLightHelper, Scene, SpotLightHelper, Vector3, WebGLRenderer } from "three";
10
+ import { ACESFilmicToneMapping, ArrowHelper, BackSide, BufferAttribute, BufferGeometry, Color, DirectionalLightHelper, DoubleSide, Float32BufferAttribute, HemisphereLightHelper, Layers, Line, LineBasicMaterial, Material, MathUtils, Mesh, MeshBasicMaterial, PCFSoftShadowMap, PerspectiveCamera, PointLightHelper, Scene, SpotLightHelper, Timer, Vector3, WebGLRenderer } from "three";
11
11
  import { createEventHook, createInjectionState, promiseTimeout, refDebounced, tryOnScopeDispose, unrefElement, useAsyncState, useDevicePixelRatio, useElementSize, useFps, useMemory, useRafFn, useTimeout, useWindowSize, whenever } from "@vueuse/core";
12
12
  import { camel, isEqual, isFunction, isNumber, isObject, isString, isUndefined } from "radashi";
13
13
  import { forwardHtmlEvents, getVoidObject } from "@pmndrs/pointer-events";
14
14
  import { setupDevtoolsPlugin } from "@vue/devtools-api";
15
15
 
16
16
  //#region package.json
17
- var version = "5.5.0";
17
+ var version = "5.6.0";
18
18
 
19
19
  //#endregion
20
20
  //#region src/utils/makeMap.ts
@@ -722,26 +722,27 @@ const setPixelRatio = (renderer, systemDpr, userDpr) => {
722
722
  * @param cycleFn the function that is called before the after event hook is triggered and after the before event hook is triggered.
723
723
  */
724
724
  const useCreateRafLoop = (cycleFn) => {
725
- const clock = new Clock();
725
+ const timer = new Timer();
726
726
  const eventHooks = {
727
727
  before: createEventHook(),
728
728
  after: createEventHook()
729
729
  };
730
730
  const { pause, resume, isActive } = useRafFn(() => {
731
+ timer.update();
731
732
  const context = {
732
- delta: clock.getDelta(),
733
- elapsed: clock.elapsedTime
733
+ delta: timer.getDelta(),
734
+ elapsed: timer.getElapsed()
734
735
  };
735
736
  eventHooks.before.trigger(context);
736
737
  cycleFn();
737
738
  eventHooks.after.trigger(context);
738
739
  }, { immediate: false });
739
740
  const start = () => {
740
- clock.start();
741
+ if (typeof document !== "undefined") timer.connect(document);
741
742
  resume();
742
743
  };
743
744
  const stop = () => {
744
- clock.stop();
745
+ timer.disconnect();
745
746
  pause();
746
747
  };
747
748
  return {
@@ -2427,7 +2428,7 @@ const vDistanceTo = {
2427
2428
  };
2428
2429
 
2429
2430
  //#endregion
2430
- //#region ../../node_modules/.pnpm/three-stdlib@2.36.1_three@0.182.0/node_modules/three-stdlib/helpers/RectAreaLightHelper.js
2431
+ //#region ../../node_modules/.pnpm/three-stdlib@2.36.1_three@0.183.1/node_modules/three-stdlib/helpers/RectAreaLightHelper.js
2431
2432
  var RectAreaLightHelper = class extends Line {
2432
2433
  constructor(light, color) {
2433
2434
  const positions = [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tresjs/core",
3
3
  "type": "module",
4
- "version": "5.5.0",
4
+ "version": "5.6.0",
5
5
  "description": "Declarative ThreeJS using Vue Components",
6
6
  "author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
7
7
  "license": "MIT",
@@ -51,7 +51,7 @@
51
51
  "radashi": "^12.6.2"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/three": "^0.182.0",
54
+ "@types/three": "^0.183.0",
55
55
  "@typescript-eslint/eslint-plugin": "^8.42.0",
56
56
  "@typescript-eslint/parser": "^8.42.0",
57
57
  "@vitejs/plugin-vue": "^6.0.1",
@@ -66,7 +66,7 @@
66
66
  "rollup-plugin-analyzer": "^4.0.0",
67
67
  "rollup-plugin-copy": "^3.5.0",
68
68
  "rollup-plugin-visualizer": "^6.0.3",
69
- "three": "^0.182.0",
69
+ "three": "^0.183.0",
70
70
  "tsdown": "0.18.3",
71
71
  "typescript": "^5.8.3",
72
72
  "vite": "^7.1.9",
@@ -86,6 +86,7 @@
86
86
  },
87
87
  "scripts": {
88
88
  "build": "tsdown",
89
+ "build:analyze": "ANALYZE=true tsdown",
89
90
  "test": "vitest",
90
91
  "test:ci": "vitest run",
91
92
  "test:ui": "vitest --ui --coverage.enabled=true",