@tresjs/core 5.3.0 → 5.3.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.
- package/dist/template-compiler-options.d.mts +1 -1
- package/dist/template-compiler-options.mjs +1 -1
- package/dist/tres.d.ts +11 -11
- package/dist/tres.js +23 -77
- package/package.json +1 -1
package/dist/tres.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v5.3.
|
|
3
|
+
* version: v5.3.1
|
|
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
|
|
8
|
+
import * as vue9 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";
|
|
@@ -312,7 +312,7 @@ declare function useRendererManager({
|
|
|
312
312
|
onReady: _vueuse_core0.EventHookOn<TresRenderer>;
|
|
313
313
|
onRender: _vueuse_core0.EventHookOn<TresRenderer>;
|
|
314
314
|
invalidate: (amountOfFramesToInvalidate?: number) => void;
|
|
315
|
-
canBeInvalidated:
|
|
315
|
+
canBeInvalidated: vue9.ComputedRef<boolean>;
|
|
316
316
|
mode: "always" | "on-demand" | "manual" | undefined;
|
|
317
317
|
replaceRenderFunction: (fn: RenderFunction) => void;
|
|
318
318
|
};
|
|
@@ -499,7 +499,7 @@ declare function buildGraph(object: Object3D | TresObject): TresObjectMap;
|
|
|
499
499
|
//#endregion
|
|
500
500
|
//#region src/composables/useLoader/component.vue.d.ts
|
|
501
501
|
declare const __VLS_export$1: <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<{
|
|
502
|
-
props:
|
|
502
|
+
props: vue9.PublicProps & __VLS_PrettifyLocal<{
|
|
503
503
|
/**
|
|
504
504
|
* The THREE.js loader to use
|
|
505
505
|
*/
|
|
@@ -522,20 +522,20 @@ declare const __VLS_export$1: <T extends TresObjectMap>(__VLS_props: NonNullable
|
|
|
522
522
|
attrs: any;
|
|
523
523
|
slots: {
|
|
524
524
|
default?: (props: {
|
|
525
|
-
state:
|
|
525
|
+
state: vue9.UnwrapRef<T>;
|
|
526
526
|
isLoading: boolean;
|
|
527
527
|
error: unknown;
|
|
528
528
|
}) => any;
|
|
529
529
|
};
|
|
530
530
|
emit: ((evt: "loaded", result: T) => void) & ((evt: "error", error: unknown) => void);
|
|
531
|
-
}>) =>
|
|
531
|
+
}>) => vue9.VNode & {
|
|
532
532
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
533
533
|
};
|
|
534
534
|
declare const _default$1: typeof __VLS_export$1;
|
|
535
535
|
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
|
|
536
536
|
//#endregion
|
|
537
537
|
//#region src/composables/useGraph/index.d.ts
|
|
538
|
-
declare const useGraph: (object: MaybeRef$1<TresObject | undefined>) =>
|
|
538
|
+
declare const useGraph: (object: MaybeRef$1<TresObject | undefined>) => vue9.ComputedRef<TresObjectMap | undefined>;
|
|
539
539
|
//#endregion
|
|
540
540
|
//#region src/utils/createPriorityEventHook.d.ts
|
|
541
541
|
type Callback<T> = Parameters<EventHookOff<T>>[0];
|
|
@@ -586,7 +586,7 @@ type LoopContext = RafLoopContext & TresPartialContext;
|
|
|
586
586
|
declare const useLoop: () => {
|
|
587
587
|
stop: () => void;
|
|
588
588
|
start: () => void;
|
|
589
|
-
isActive: Readonly<
|
|
589
|
+
isActive: Readonly<vue9.ShallowRef<boolean>>;
|
|
590
590
|
onBeforeRender: PriorityEventHookOn<LoopContext>;
|
|
591
591
|
onRender: PriorityEventHookOn<LoopContext>;
|
|
592
592
|
render: (fn: RenderFunction) => void;
|
|
@@ -692,7 +692,7 @@ interface TresCanvasInstance {
|
|
|
692
692
|
type __VLS_Slots = {
|
|
693
693
|
default: () => any;
|
|
694
694
|
};
|
|
695
|
-
declare const __VLS_base:
|
|
695
|
+
declare const __VLS_base: vue9.DefineComponent<ContextProps, TresCanvasInstance, {}, {}, {}, vue9.ComponentOptionsMixin, vue9.ComponentOptionsMixin, {
|
|
696
696
|
click: (event: TresPointerEvent) => any;
|
|
697
697
|
contextmenu: (event: TresPointerEvent) => any;
|
|
698
698
|
pointermove: (event: TresPointerEvent) => any;
|
|
@@ -711,7 +711,7 @@ declare const __VLS_base: vue8.DefineComponent<ContextProps, TresCanvasInstance,
|
|
|
711
711
|
render: (context: TresContext) => any;
|
|
712
712
|
beforeLoop: (context: TresContextWithClock) => any;
|
|
713
713
|
loop: (context: TresContextWithClock) => any;
|
|
714
|
-
}, string,
|
|
714
|
+
}, string, vue9.PublicProps, Readonly<ContextProps> & Readonly<{
|
|
715
715
|
onClick?: ((event: TresPointerEvent) => any) | undefined;
|
|
716
716
|
onContextmenu?: ((event: TresPointerEvent) => any) | undefined;
|
|
717
717
|
onPointermove?: ((event: TresPointerEvent) => any) | undefined;
|
|
@@ -747,7 +747,7 @@ declare const __VLS_base: vue8.DefineComponent<ContextProps, TresCanvasInstance,
|
|
|
747
747
|
shadowMapType: THREE.ShadowMapType;
|
|
748
748
|
useLegacyLights: boolean;
|
|
749
749
|
renderMode: "always" | "on-demand" | "manual";
|
|
750
|
-
}, {}, {}, {}, string,
|
|
750
|
+
}, {}, {}, {}, string, vue9.ComponentProvideOptions, false, {}, any>;
|
|
751
751
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
752
752
|
declare const _default: typeof __VLS_export;
|
|
753
753
|
type __VLS_WithSlots<T, S> = T & {
|
package/dist/tres.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v5.3.
|
|
3
|
+
* version: v5.3.1
|
|
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 { Fragment,
|
|
8
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createRenderer, defineComponent, getCurrentInstance, h, isRef, mergeProps, 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
10
|
import { ACESFilmicToneMapping, ArrowHelper, BackSide, BufferAttribute, BufferGeometry, Clock, Color, DirectionalLightHelper, DoubleSide, Float32BufferAttribute, HemisphereLightHelper, Layers, Line, LineBasicMaterial, Material, MathUtils, Mesh, MeshBasicMaterial, Object3D, PCFSoftShadowMap, PerspectiveCamera, PointLightHelper, Scene, SpotLightHelper, 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";
|
|
@@ -14,7 +14,7 @@ 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.3.
|
|
17
|
+
var version = "5.3.1";
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/utils/makeMap.ts
|
|
@@ -2065,78 +2065,6 @@ var Context_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
2065
2065
|
//#region src/components/Context.vue
|
|
2066
2066
|
var Context_default = Context_vue_vue_type_script_setup_true_lang_default;
|
|
2067
2067
|
|
|
2068
|
-
//#endregion
|
|
2069
|
-
//#region src/composables/useForwardProps/index.ts
|
|
2070
|
-
/**
|
|
2071
|
-
* The `useForwardProps` function in TypeScript takes in a set of props and returns a computed value
|
|
2072
|
-
* that combines default props with assigned props from the current instance.
|
|
2073
|
-
* @param {T} props - The `props` parameter is an object that represents the props passed to a
|
|
2074
|
-
* component.
|
|
2075
|
-
* @returns computed value that combines the default props, preserved props, and assigned props.
|
|
2076
|
-
*/
|
|
2077
|
-
const useForwardProps = (props) => {
|
|
2078
|
-
const vm = getCurrentInstance();
|
|
2079
|
-
const defaultProps = Object.keys(vm?.type.props ?? {}).reduce((prev, curr) => {
|
|
2080
|
-
const defaultValue = (vm?.type.props[curr]).default;
|
|
2081
|
-
if (defaultValue !== void 0) prev[curr] = defaultValue;
|
|
2082
|
-
return prev;
|
|
2083
|
-
}, {});
|
|
2084
|
-
const refProps = toRef(props);
|
|
2085
|
-
return computed(() => {
|
|
2086
|
-
const preservedProps = {};
|
|
2087
|
-
const assignedProps = vm?.vnode.props ?? {};
|
|
2088
|
-
Object.keys(assignedProps).forEach((key) => {
|
|
2089
|
-
preservedProps[camelize(key)] = assignedProps[key];
|
|
2090
|
-
});
|
|
2091
|
-
return Object.keys({
|
|
2092
|
-
...defaultProps,
|
|
2093
|
-
...preservedProps
|
|
2094
|
-
}).reduce((prev, curr) => {
|
|
2095
|
-
if (refProps.value[curr] !== void 0) prev[curr] = refProps.value[curr];
|
|
2096
|
-
return prev;
|
|
2097
|
-
}, {});
|
|
2098
|
-
});
|
|
2099
|
-
};
|
|
2100
|
-
/**
|
|
2101
|
-
* The `useEmitAsProps` function is a TypeScript utility that converts emitted events into props for a
|
|
2102
|
-
* Vue component.
|
|
2103
|
-
* @param emit - The `emit` parameter is a function that is used to emit events from a component. It
|
|
2104
|
-
* takes two parameters: `name` which is the name of the event to be emitted, and `...args` which are
|
|
2105
|
-
* the arguments to be passed along with the event.
|
|
2106
|
-
* @returns The function `useEmitAsProps` returns an object that maps event names to functions that
|
|
2107
|
-
* call the `emit` function with the corresponding event name and arguments.
|
|
2108
|
-
*/
|
|
2109
|
-
const useEmitAsProps = (emit) => {
|
|
2110
|
-
const vm = getCurrentInstance();
|
|
2111
|
-
const events = vm?.type.emits;
|
|
2112
|
-
const result = {};
|
|
2113
|
-
if (!events?.length) console.warn(`No emitted event found. Please check component: ${vm?.type.__name}`);
|
|
2114
|
-
events?.forEach((ev) => {
|
|
2115
|
-
result[toHandlerKey(camelize(ev))] = (...arg) => emit(ev, ...arg);
|
|
2116
|
-
});
|
|
2117
|
-
return result;
|
|
2118
|
-
};
|
|
2119
|
-
/**
|
|
2120
|
-
* The function `useForwardPropsEmits` takes in props and an optional emit function, and returns a
|
|
2121
|
-
* computed object that combines the parsed props and emits as props.
|
|
2122
|
-
* @param {T} props - The `props` parameter is of type `T`, which is a generic type that extends the
|
|
2123
|
-
* parameters of the `useForwardProps` function. It represents the props object that is passed to the
|
|
2124
|
-
* `useForwardProps` function.
|
|
2125
|
-
* @param [emit] - The `emit` parameter is a function that can be used to emit events. It takes two
|
|
2126
|
-
* arguments: `name`, which is the name of the event to be emitted, and `args`, which are the arguments
|
|
2127
|
-
* to be passed along with the event.
|
|
2128
|
-
* @returns a computed property that combines the parsed
|
|
2129
|
-
* props and emits as props.
|
|
2130
|
-
*/
|
|
2131
|
-
const useForwardPropsEmits = (props, emit) => {
|
|
2132
|
-
const parsedProps = useForwardProps(props);
|
|
2133
|
-
const emitsAsProps = emit ? useEmitAsProps(emit) : {};
|
|
2134
|
-
return computed(() => ({
|
|
2135
|
-
...parsedProps.value,
|
|
2136
|
-
...emitsAsProps
|
|
2137
|
-
}));
|
|
2138
|
-
};
|
|
2139
|
-
|
|
2140
2068
|
//#endregion
|
|
2141
2069
|
//#region src/components/TresCanvas.vue?vue&type=script&setup=true&lang.ts
|
|
2142
2070
|
const _hoisted_1 = ["data-scene", "data-tres"];
|
|
@@ -2295,7 +2223,6 @@ var TresCanvas_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
2295
2223
|
},
|
|
2296
2224
|
dispose: () => contextRef.value?.dispose()
|
|
2297
2225
|
});
|
|
2298
|
-
const forwardedPropsEmits = useForwardPropsEmits(props, emit);
|
|
2299
2226
|
return (_ctx, _cache) => {
|
|
2300
2227
|
return openBlock(), createElementBlock("canvas", {
|
|
2301
2228
|
ref_key: "canvasRef",
|
|
@@ -2319,7 +2246,26 @@ var TresCanvas_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
2319
2246
|
ref_key: "contextRef",
|
|
2320
2247
|
ref: contextRef,
|
|
2321
2248
|
canvas: canvasRef.value
|
|
2322
|
-
},
|
|
2249
|
+
}, props, {
|
|
2250
|
+
onReady: _cache[0] || (_cache[0] = ($event) => emit("ready", $event)),
|
|
2251
|
+
onPointermissed: _cache[1] || (_cache[1] = ($event) => emit("pointermissed", $event)),
|
|
2252
|
+
onRender: _cache[2] || (_cache[2] = ($event) => emit("render", $event)),
|
|
2253
|
+
onBeforeLoop: _cache[3] || (_cache[3] = ($event) => emit("beforeLoop", $event)),
|
|
2254
|
+
onLoop: _cache[4] || (_cache[4] = ($event) => emit("loop", $event)),
|
|
2255
|
+
onClick: _cache[5] || (_cache[5] = ($event) => emit("click", $event)),
|
|
2256
|
+
onContextmenu: _cache[6] || (_cache[6] = ($event) => emit("contextmenu", $event)),
|
|
2257
|
+
onPointermove: _cache[7] || (_cache[7] = ($event) => emit("pointermove", $event)),
|
|
2258
|
+
onPointerenter: _cache[8] || (_cache[8] = ($event) => emit("pointerenter", $event)),
|
|
2259
|
+
onPointerleave: _cache[9] || (_cache[9] = ($event) => emit("pointerleave", $event)),
|
|
2260
|
+
onPointerover: _cache[10] || (_cache[10] = ($event) => emit("pointerover", $event)),
|
|
2261
|
+
onPointerout: _cache[11] || (_cache[11] = ($event) => emit("pointerout", $event)),
|
|
2262
|
+
onDblclick: _cache[12] || (_cache[12] = ($event) => emit("dblclick", $event)),
|
|
2263
|
+
onPointerdown: _cache[13] || (_cache[13] = ($event) => emit("pointerdown", $event)),
|
|
2264
|
+
onPointerup: _cache[14] || (_cache[14] = ($event) => emit("pointerup", $event)),
|
|
2265
|
+
onPointercancel: _cache[15] || (_cache[15] = ($event) => emit("pointercancel", $event)),
|
|
2266
|
+
onLostpointercapture: _cache[16] || (_cache[16] = ($event) => emit("lostpointercapture", $event)),
|
|
2267
|
+
onWheel: _cache[17] || (_cache[17] = ($event) => emit("wheel", $event))
|
|
2268
|
+
}), {
|
|
2323
2269
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
2324
2270
|
_: 3
|
|
2325
2271
|
}, 16, ["canvas"])) : createCommentVNode("v-if", true)], 14, _hoisted_1);
|
package/package.json
CHANGED