New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tresjs/core

Package Overview
Dependencies
Maintainers
0
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tresjs/core - npm Package Compare versions

Comparing version 4.3.0 to 4.3.1

4

dist/src/components/TresCanvas.vue.d.ts

@@ -33,3 +33,3 @@ import { ColorSpace, ShadowMapType, ToneMapping, WebGLRendererParameters } from 'three';

declare const __VLS_component: import('vue').DefineComponent<TresCanvasProps, {
context: import('vue').ShallowRef<TresContext | null>;
context: import('vue').ShallowRef<TresContext | null, TresContext | null>;
dispose: () => void;

@@ -72,4 +72,4 @@ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {

depth: boolean;
failIfMajorPerformanceCaveat: boolean;
logarithmicDepthBuffer: boolean;
failIfMajorPerformanceCaveat: boolean;
shadows: boolean;

@@ -76,0 +76,0 @@ useLegacyLights: boolean;

@@ -88,5 +88,5 @@ import { ColorSpace, Scene, ShadowMapType, ToneMapping, WebGLRendererParameters, WebGLRenderer } from 'three';

}): {
renderer: import('vue').ShallowRef<WebGLRenderer>;
renderer: import('vue').ShallowRef<WebGLRenderer, WebGLRenderer>;
};
export type UseRendererReturn = ReturnType<typeof useRenderer>;
export {};
/**
* name: @tresjs/core
* version: v4.3.0
* version: v4.3.1
* (c) 2024

@@ -11,7 +11,7 @@ * description: Declarative ThreeJS using Vue Components

var he = (e, t, n) => Tt(e, typeof t != "symbol" ? t + "" : t, n);
import { defineComponent as fe, withAsyncContext as nt, reactive as Se, renderSlot as rt, unref as W, ref as I, computed as J, watchEffect as xe, onUnmounted as K, shallowRef as $, watch as ae, readonly as we, provide as le, inject as St, isRef as xt, useSlots as At, getCurrentInstance as He, onMounted as kt, openBlock as Lt, createElementBlock as Ot, normalizeClass as Rt, normalizeStyle as Dt, createRenderer as jt, h as Ue, Fragment as Bt } from "vue";
import { defineComponent as fe, withAsyncContext as nt, reactive as Se, renderSlot as rt, unref as W, ref as I, computed as K, watchEffect as xe, onUnmounted as J, shallowRef as $, watch as ae, readonly as we, provide as le, inject as St, isRef as xt, useSlots as At, getCurrentInstance as He, onMounted as kt, openBlock as Lt, createElementBlock as Rt, normalizeClass as Ot, normalizeStyle as Dt, createRenderer as jt, h as Ue, Fragment as Bt } from "vue";
import * as ot from "three";
import { Scene as st, Vector3 as Ae, MathUtils as it, MeshBasicMaterial as at, DoubleSide as It, TextureLoader as $t, PerspectiveCamera as be, Camera as Ht, Clock as lt, REVISION as Ut, Color as Z, SRGBColorSpace as Ft, ACESFilmicToneMapping as ct, PCFSoftShadowMap as Wt, NoToneMapping as Nt, WebGLRenderer as ge, Vector2 as ve, Raycaster as zt, BufferAttribute as Gt, Object3D as Vt, ArrowHelper as Yt, Line as qt, BufferGeometry as Fe, Float32BufferAttribute as We, LineBasicMaterial as Jt, Mesh as Kt, BackSide as Qt, DirectionalLightHelper as Xt, PointLightHelper as Zt, SpotLightHelper as en, HemisphereLightHelper as tn } from "three";
import { Scene as st, Vector3 as Ae, MathUtils as it, MeshBasicMaterial as at, DoubleSide as It, TextureLoader as $t, PerspectiveCamera as be, Camera as Ht, Clock as lt, REVISION as Ut, Color as Z, SRGBColorSpace as Ft, ACESFilmicToneMapping as ct, PCFSoftShadowMap as Wt, NoToneMapping as Nt, WebGLRenderer as ge, Vector2 as ve, Raycaster as zt, BufferAttribute as Gt, Object3D as Vt, ArrowHelper as Yt, Line as qt, BufferGeometry as Fe, Float32BufferAttribute as We, LineBasicMaterial as Kt, Mesh as Jt, BackSide as Qt, DirectionalLightHelper as Xt, PointLightHelper as Zt, SpotLightHelper as en, HemisphereLightHelper as tn } from "three";
import { tryOnScopeDispose as nn, toValue as x, unrefElement as rn, useDevicePixelRatio as on, useWindowSize as sn, useElementSize as an, refDebounced as Ne, usePointer as ln, useElementBounding as cn, createEventHook as D, useFps as un, useMemory as fn, useRafFn as ut } from "@vueuse/core";
const pn = "@tresjs/core", dn = "module", mn = "4.3.0", hn = "pnpm@9.1.4", gn = "Declarative ThreeJS using Vue Components", vn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", yn = "MIT", _n = {
const dn = "@tresjs/core", pn = "module", mn = "4.3.1", hn = "pnpm@9.1.4", gn = "Declarative ThreeJS using Vue Components", vn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", yn = "MIT", _n = {
type: "git",

@@ -73,24 +73,24 @@ url: "git+https://github.com/Tresjs/tres.git"

}, Ln = {
"@release-it/conventional-changelog": "^8.0.2",
"@release-it/conventional-changelog": "^9.0.0",
"@stackblitz/sdk": "^1.11.0",
"@tresjs/cientos": "4.0.2",
"@tresjs/eslint-config": "^1.3.1",
"@types/three": "^0.168.0",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"@vitejs/plugin-vue": "^5.1.3",
"@tresjs/cientos": "4.0.3",
"@tresjs/eslint-config": "^1.4.0",
"@types/three": "^0.169.0",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@vitejs/plugin-vue": "^5.1.4",
"@vitest/coverage-c8": "^0.33.0",
"@vitest/coverage-v8": "^2.1.1",
"@vitest/ui": "^2.1.1",
"@vitest/coverage-v8": "^2.1.2",
"@vitest/ui": "^2.1.2",
"@vue/test-utils": "^2.4.6",
eslint: "^9.10.0",
"eslint-plugin-vue": "^9.28.0",
esno: "^4.7.0",
eslint: "^9.12.0",
"eslint-plugin-vue": "^9.29.0",
esno: "^4.8.0",
gsap: "^3.12.5",
husky: "^9.1.6",
jsdom: "^25.0.0",
jsdom: "^25.0.1",
kolorist: "^1.8.0",
ohmyfetch: "^0.4.21",
pathe: "^1.1.2",
"release-it": "^17.5.0",
"release-it": "^17.8.2",
"rollup-plugin-analyzer": "^4.0.0",

@@ -100,19 +100,19 @@ "rollup-plugin-copy": "^3.5.0",

sponsorkit: "^0.15.5",
three: "^0.168.0",
unocss: "^0.62.4",
three: "^0.169.0",
unocss: "^0.63.4",
unplugin: "^1.14.1",
"unplugin-vue-components": "^0.27.4",
vite: "^5.4.6",
vite: "^5.4.8",
"vite-plugin-banner": "^0.8.0",
"vite-plugin-dts": "4.2.1",
"vite-plugin-dts": "4.2.4",
"vite-plugin-inspect": "^0.8.7",
"vite-plugin-require-transform": "^1.0.21",
"vite-svg-loader": "^5.1.0",
vitepress: "1.3.4",
vitest: "^2.1.1",
vue: "3.5.6",
vitepress: "1.4.0",
vitest: "^2.1.2",
vue: "3.5.12",
"vue-demi": "^0.14.10"
}, On = {
name: pn,
type: dn,
}, Rn = {
name: dn,
type: pn,
version: mn,

@@ -137,3 +137,3 @@ packageManager: hn,

};
function Rn(e) {
function On(e) {
const t = { nodes: {}, materials: {} };

@@ -151,3 +151,3 @@ return e && e.traverse((n) => {

const f = o;
f.scene && Object.assign(f, Rn(f.scene)), a(f);
f.scene && Object.assign(f, On(f.scene)), a(f);
},

@@ -161,3 +161,3 @@ r,

}
const qr = /* @__PURE__ */ fe({
const Yr = /* @__PURE__ */ fe({
__name: "component",

@@ -189,3 +189,3 @@ props: {

}
function pe(e) {
function de(e) {
return Array.isArray(e);

@@ -203,3 +203,3 @@ }

function H(e) {
return e === Object(e) && !pe(e) && !G(e);
return e === Object(e) && !de(e) && !G(e);
}

@@ -233,5 +233,5 @@ function N(e) {

}
const pt = (e, t) => {
const dt = (e, t) => {
for (const n of Object.keys(t))
t[n] instanceof Object && Object.assign(t[n], pt(e[n], t[n]));
t[n] instanceof Object && Object.assign(t[n], dt(e[n], t[n]));
return Object.assign(e || {}, t), e;

@@ -264,3 +264,3 @@ }, Nn = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", zn = /* @__PURE__ */ Yn(Nn);

};
function dt(e, t) {
function pt(e, t) {
if (Ge(e) && Ge(t)) {

@@ -278,15 +278,15 @@ const s = e.attributes, l = t.attributes;

for (const s of n)
if (!r.includes(s) || !dt(e[s], t[s]))
if (!r.includes(s) || !pt(e[s], t[s]))
return !1;
return !0;
}
function Jn(e, t) {
function Kn(e, t) {
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
return !1;
for (let n = 0; n < e.length; n++)
if (!dt(e[n], t[n]))
if (!pt(e[n], t[n]))
return !1;
return !0;
}
const Kn = Array.isArray;
const Jn = Array.isArray;
function Qn(e, t, n, r) {

@@ -368,7 +368,7 @@ const s = (c) => {

}
const Je = /-\d+$/;
const Ke = /-\d+$/;
function nr(e, t, n) {
if (ft(n)) {
if (Je.test(n)) {
const l = n.replace(Je, ""), { target: i, key: a } = Pe(e, l);
if (Ke.test(n)) {
const l = n.replace(Ke, ""), { target: i, key: a } = Pe(e, l);
if (!Array.isArray(i[a])) {

@@ -419,3 +419,3 @@ const c = i[a], o = [];

let r = 0;
if (pe(n) && n.length >= 2) {
if (de(n) && n.length >= 2) {
const [l, i] = n;

@@ -468,3 +468,3 @@ r = it.clamp(t, l, i);

});
if (Kn(e)) {
if (Jn(e)) {
const s = await Promise.all(e.map((l) => r(l)));

@@ -495,3 +495,3 @@ return e.length > 1 ? s : s[0];

}
const Jr = /* @__PURE__ */ fe({
const qr = /* @__PURE__ */ fe({
__name: "component",

@@ -514,3 +514,3 @@ props: {

}), ar = ({ sizes: e }) => {
const t = I([]), n = J(
const t = I([]), n = K(
() => t.value[0]

@@ -540,3 +540,3 @@ ), r = (i) => {

});
}), K(() => {
}), J(() => {
t.value = [];

@@ -554,8 +554,8 @@ }), {

}
const Kr = !0, de = "[TresJS ▲ ■ ●] ";
const Kr = !0, pe = "[TresJS ▲ ■ ●] ";
function cr(...e) {
typeof e[0] == "string" ? e[0] = de + e[0] : e.unshift(de), console.error(...e);
typeof e[0] == "string" ? e[0] = pe + e[0] : e.unshift(pe), console.error(...e);
}
function ur(...e) {
typeof e[0] == "string" ? e[0] = de + e[0] : e.unshift(de), console.warn(...e);
typeof e[0] == "string" ? e[0] = pe + e[0] : e.unshift(pe), console.warn(...e);
}

@@ -598,3 +598,3 @@ function fr(e, t) {

}
function pr() {
function dr() {
let e = !0, t = !0, n = !1;

@@ -606,3 +606,3 @@ const r = new lt(!1), s = I(r.running), l = I(!1);

const o = ye(), f = ye(), y = ye();
P();
E();
let u = {};

@@ -612,25 +612,25 @@ function v(M) {

}
function h(M, A, d = 0) {
function h(M, A, p = 0) {
switch (A) {
case "before":
return o.on(M, d);
return o.on(M, p);
case "render":
return c || (c = M), f.dispose(), f.on(M);
case "after":
return y.on(M, d);
return y.on(M, p);
}
}
function g() {
t && (t = !1, P(), b());
t && (t = !1, E(), b());
}
function p() {
t = !0, P(), cancelAnimationFrame(i);
function d() {
t = !0, E(), cancelAnimationFrame(i);
}
function _() {
n = !1, P();
n = !1, E();
}
function P() {
n = !0, E();
}
function C() {
n = !0, P();
}
function E() {
l.value = !0;

@@ -646,3 +646,3 @@ }

}
const M = r.getDelta(), A = r.getElapsedTime(), d = {
const M = r.getDelta(), A = r.getElapsedTime(), p = {
camera: W(u.camera),

@@ -655,6 +655,6 @@ scene: W(u.scene),

advance: u.advance
}, w = { delta: M, elapsed: A, clock: r, ...d };
}, w = { delta: M, elapsed: A, clock: r, ...p };
s.value && o.trigger(w), l.value || (f.count ? f.trigger(w) : c && c(w)), s.value && y.trigger(w), i = requestAnimationFrame(b);
}
function P() {
function E() {
const M = !t && !n;

@@ -665,8 +665,8 @@ r.running !== M && (r.running ? r.stop() : r.start()), s.value = r.running;

loopId: a,
register: (M, A, d) => h(M, A, d),
register: (M, A, p) => h(M, A, p),
start: g,
stop: p,
pause: C,
stop: d,
pause: P,
resume: _,
pauseRender: E,
pauseRender: C,
resumeRender: T,

@@ -688,7 +688,7 @@ isRenderPaused: l,

}
function dr(e) {
function pr(e) {
return (e / 1024).toFixed(2);
}
const mr = Number.parseInt(Ut.replace("dev", ""));
function Qr(e) {
function Jr(e) {
return typeof e == "number" ? [e, e, e] : e instanceof Ae ? [e.x, e.y, e.z] : e;

@@ -721,3 +721,3 @@ }

}) {
const i = J(() => ({
const i = K(() => ({
alpha: x(t.alpha) ?? !0,

@@ -762,14 +762,14 @@ depth: x(t.depth),

const h = x(t.preset);
h && (h in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`), pt(a.value, se[h])), or(a.value, o.value, x(t.dpr)), v === "always" && (r.frames.value = Math.max(1, r.frames.value));
const g = (C, E) => {
const T = x(C), b = () => {
h && (h in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`), dt(a.value, se[h])), or(a.value, o.value, x(t.dpr)), v === "always" && (r.frames.value = Math.max(1, r.frames.value));
const g = (P, C) => {
const T = x(P), b = () => {
if (h)
return Ve(se[h], E);
return Ve(se[h], C);
};
if (T !== void 0)
return T;
const P = b();
return P !== void 0 ? P : Ve(u, E);
}, p = (C, E) => qn(a.value, E, g(C, E));
p(t.shadows, "shadowMap.enabled"), p(t.toneMapping ?? ct, "toneMapping"), p(t.shadowMapType, "shadowMap.type"), mr < 150 && p(!t.useLegacyLights, "physicallyCorrectLights"), p(t.outputColorSpace, "outputColorSpace"), p(t.toneMappingExposure, "toneMappingExposure");
const E = b();
return E !== void 0 ? E : Ve(u, C);
}, d = (P, C) => qn(a.value, C, g(P, C));
d(t.shadows, "shadowMap.enabled"), d(t.toneMapping ?? ct, "toneMapping"), d(t.shadowMapType, "shadowMap.type"), mr < 150 && d(!t.useLegacyLights, "physicallyCorrectLights"), d(t.outputColorSpace, "outputColorSpace"), d(t.toneMappingExposure, "toneMappingExposure");
const _ = g(t.clearColor, "clearColor");

@@ -780,3 +780,3 @@ _ && a.value.setClearColor(

);
}), K(() => {
}), J(() => {
a.value.dispose(), a.value.forceContextLoss();

@@ -788,3 +788,3 @@ }), {

function vr(e, t, n = 10) {
const r = x(e) ? sn() : an(J(() => x(t).parentElement)), s = we(Ne(r.width, n)), l = we(Ne(r.height, n)), i = J(() => s.value / l.value);
const r = x(e) ? sn() : an(K(() => x(t).parentElement)), s = we(Ne(r.width, n)), l = we(Ne(r.height, n)), i = K(() => s.value / l.value);
return {

@@ -797,3 +797,3 @@ height: l,

const yr = (e, t) => {
const n = J(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = ln({ target: n });
const n = K(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = ln({ target: n });
let i = 0;

@@ -815,4 +815,4 @@ const { width: a, height: c, top: o, left: f } = cn(n), y = ({ x: m, y: S }) => {

return S ? u(S) || [] : [];
}, h = D(), g = D(), p = D(), _ = D(), C = D(), E = D(), T = D(), b = D();
function P(m) {
}, h = D(), g = D(), d = D(), _ = D(), P = D(), C = D(), T = D(), b = D();
function E(m) {
const S = {};

@@ -825,3 +825,3 @@ for (const U in m)

var Be, Ie, $e;
const U = P(S), ne = new Ae(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Be = t.camera) == null ? void 0 : Be.value);
const U = E(S), ne = new Ae(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Be = t.camera) == null ? void 0 : Be.value);
m.trigger({

@@ -840,8 +840,8 @@ ...U,

let A;
const d = (m) => {
v(m), M(p, m), A = m;
const p = (m) => {
v(m), M(d, m), A = m;
}, w = () => {
A && d(A);
A && p(A);
};
let k, L, O;
let k, L, R;
const j = (m) => {

@@ -852,16 +852,16 @@ var S;

(m == null ? void 0 : m.clientY) ?? l.value
), M(C, m);
), M(P, m);
};
let R, Y = !1;
const Oe = (m) => {
let O, Y = !1;
const Re = (m) => {
var S, U, ne;
m instanceof PointerEvent && (r.value.length === 0 && M(E, m), k === ((S = r.value[0]) == null ? void 0 : S.object) && (O = new ve(
m instanceof PointerEvent && (r.value.length === 0 && M(C, m), k === ((S = r.value[0]) == null ? void 0 : S.object) && (R = new ve(
(m == null ? void 0 : m.clientX) ?? s.value,
(m == null ? void 0 : m.clientY) ?? l.value
), i = L == null ? void 0 : L.distanceTo(O), m.button === 0 ? (M(h, m), R === ((U = r.value[0]) == null ? void 0 : U.object) ? Y = !0 : (R = (ne = r.value[0]) == null ? void 0 : ne.object, Y = !1)) : m.button === 2 && M(T, m)), M(_, m));
}, Re = (m) => {
Y && (M(g, m), R = void 0, Y = !1);
}, De = (m) => M(p, m), je = (m) => M(b, m);
return n.value.addEventListener("pointerup", Oe), n.value.addEventListener("pointerdown", j), n.value.addEventListener("pointermove", d), n.value.addEventListener("pointerleave", De), n.value.addEventListener("dblclick", Re), n.value.addEventListener("wheel", je), K(() => {
n != null && n.value && (n.value.removeEventListener("pointerup", Oe), n.value.removeEventListener("pointerdown", j), n.value.removeEventListener("pointermove", d), n.value.removeEventListener("pointerleave", De), n.value.removeEventListener("dblclick", Re), n.value.removeEventListener("wheel", je));
), i = L == null ? void 0 : L.distanceTo(R), m.button === 0 ? (M(h, m), O === ((U = r.value[0]) == null ? void 0 : U.object) ? Y = !0 : (O = (ne = r.value[0]) == null ? void 0 : ne.object, Y = !1)) : m.button === 2 && M(T, m)), M(_, m));
}, Oe = (m) => {
Y && (M(g, m), O = void 0, Y = !1);
}, De = (m) => M(d, m), je = (m) => M(b, m);
return n.value.addEventListener("pointerup", Re), n.value.addEventListener("pointerdown", j), n.value.addEventListener("pointermove", p), n.value.addEventListener("pointerleave", De), n.value.addEventListener("dblclick", Oe), n.value.addEventListener("wheel", je), J(() => {
n != null && n.value && (n.value.removeEventListener("pointerup", Re), n.value.removeEventListener("pointerdown", j), n.value.removeEventListener("pointermove", p), n.value.removeEventListener("pointerleave", De), n.value.removeEventListener("dblclick", Oe), n.value.removeEventListener("wheel", je));
}), {

@@ -872,6 +872,6 @@ intersects: r,

onContextMenu: (m) => T.on(m).off,
onPointerMove: (m) => p.on(m).off,
onPointerMove: (m) => d.on(m).off,
onPointerUp: (m) => _.on(m).off,
onPointerDown: (m) => C.on(m).off,
onPointerMissed: (m) => E.on(m).off,
onPointerDown: (m) => P.on(m).off,
onPointerMissed: (m) => C.on(m).off,
onWheel: (m) => b.on(m).off,

@@ -891,23 +891,23 @@ forceUpdate: w

e && (r.value = e), t && (s.value = t);
const l = (d) => {
const l = (p) => {
var w;
return ((w = d.__tres) == null ? void 0 : w.eventCount) > 0;
}, i = (d) => {
return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
}, i = (p) => {
var w;
return ((w = d.children) == null ? void 0 : w.some((k) => i(k))) || l(d);
return ((w = p.children) == null ? void 0 : w.some((k) => i(k))) || l(p);
}, a = $(((A = r.value) == null ? void 0 : A.children).filter(i) || []);
function c(d, w) {
function c(p, w) {
const k = [], L = () => w.stopPropagating = !0;
w.stopPropagation = L;
for (const O of w == null ? void 0 : w.intersections) {
for (const R of w == null ? void 0 : w.intersections) {
if (w.stopPropagating)
return;
w = { ...w, ...O };
const { object: j } = O;
w.eventObject = j, _e(j[d], w), k.push(j);
let R = j.parent;
for (; R !== null && !w.stopPropagating && !k.includes(R); )
w.eventObject = R, _e(R[d], w), k.push(R), R = R.parent;
const Y = Vn(d.slice(2));
n(Y, { intersection: O, event: w });
w = { ...w, ...R };
const { object: j } = R;
w.eventObject = j, _e(j[p], w), k.push(j);
let O = j.parent;
for (; O !== null && !w.stopPropagating && !k.includes(O); )
w.eventObject = O, _e(O[p], w), k.push(O), O = O.parent;
const Y = Vn(p.slice(2));
n(Y, { intersection: R, event: w });
}

@@ -923,38 +923,38 @@ }

onPointerMissed: g,
onWheel: p,
onWheel: d,
forceUpdate: _
} = yr(a, t);
h((d) => c("onPointerUp", d)), v((d) => c("onPointerDown", d)), o((d) => c("onClick", d)), f((d) => c("onDoubleClick", d)), y((d) => c("onContextMenu", d)), p((d) => c("onWheel", d));
let C = [];
u((d) => {
const w = d.intersections.map(({ object: L }) => L), k = d.intersections;
C.forEach(({ object: L }) => {
w.includes(L) || (d.intersections = C, c("onPointerLeave", d), c("onPointerOut", d));
}), d.intersections = k, d.intersections.forEach(({ object: L }) => {
C.includes(L) || (c("onPointerEnter", d), c("onPointerOver", d));
}), c("onPointerMove", d), C = d.intersections;
h((p) => c("onPointerUp", p)), v((p) => c("onPointerDown", p)), o((p) => c("onClick", p)), f((p) => c("onDoubleClick", p)), y((p) => c("onContextMenu", p)), d((p) => c("onWheel", p));
let P = [];
u((p) => {
const w = p.intersections.map(({ object: L }) => L), k = p.intersections;
P.forEach(({ object: L }) => {
w.includes(L) || (p.intersections = P, c("onPointerLeave", p), c("onPointerOut", p));
}), p.intersections = k, p.intersections.forEach(({ object: L }) => {
P.includes(L) || (c("onPointerEnter", p), c("onPointerOver", p));
}), c("onPointerMove", p), P = p.intersections;
});
const E = [];
g((d) => {
const w = () => d.stopPropagating = !0;
d.stopPropagation = w, E.forEach((k) => {
d.stopPropagating || (d.eventObject = k, _e(k.onPointerMissed, d));
}), n("pointer-missed", { event: d });
const C = [];
g((p) => {
const w = () => p.stopPropagating = !0;
p.stopPropagation = w, C.forEach((k) => {
p.stopPropagating || (p.eventObject = k, _e(k.onPointerMissed, p));
}), n("pointer-missed", { event: p });
});
function T(d) {
re(d) && N(d) && a.value.push(d);
function T(p) {
re(p) && N(p) && a.value.push(p);
}
function b(d) {
if (re(d) && N(d)) {
const w = a.value.indexOf(d);
function b(p) {
if (re(p) && N(p)) {
const w = a.value.indexOf(p);
w > -1 && a.value.splice(w, 1);
}
}
function P(d) {
re(d) && N(d) && d.onPointerMissed && E.push(d);
function E(p) {
re(p) && N(p) && p.onPointerMissed && C.push(p);
}
function M(d) {
if (re(d) && N(d)) {
const w = E.indexOf(d);
w > -1 && E.splice(w, 1);
function M(p) {
if (re(p) && N(p)) {
const w = C.indexOf(p);
w > -1 && C.splice(w, 1);
}

@@ -966,3 +966,3 @@ }

deregisterObject: b,
registerPointerMissedObject: P,
registerPointerMissedObject: E,
deregisterPointerMissedObject: M

@@ -973,3 +973,3 @@ }, {

deregisterObject: b,
registerPointerMissedObject: P,
registerPointerMissedObject: E,
deregisterPointerMissedObject: M

@@ -1021,3 +1021,3 @@ };

}
function Xr(e) {
function Qr(e) {
const t = me();

@@ -1045,6 +1045,6 @@ if (t)

maxFrames: 60,
canBeInvalidated: J(() => u.mode.value === "on-demand" && u.frames.value === 0)
canBeInvalidated: K(() => u.mode.value === "on-demand" && u.frames.value === 0)
};
function v(O = 1) {
r.renderMode === "on-demand" && (u.frames.value = Math.min(u.maxFrames, u.frames.value + O));
function v(R = 1) {
r.renderMode === "on-demand" && (u.frames.value = Math.min(u.maxFrames, u.frames.value + R));
}

@@ -1063,3 +1063,3 @@ function h() {

}
), p = {
), d = {
sizes: i,

@@ -1091,27 +1091,27 @@ scene: l,

deregisterCamera: f,
loop: pr()
loop: dr()
};
le("useTres", p), p.scene.value.__tres = {
root: p
}, p.loop.register(() => {
a.value && u.frames.value > 0 && (g.value.render(e, a.value), s("render", p.renderer.value)), u.priority.value = 0, u.mode.value === "always" ? u.frames.value = 1 : u.frames.value = Math.max(0, u.frames.value - 1);
le("useTres", d), d.scene.value.__tres = {
root: d
}, d.loop.register(() => {
a.value && u.frames.value > 0 && (g.value.render(e, a.value), s("render", d.renderer.value)), u.priority.value = 0, u.mode.value === "always" ? u.frames.value = 1 : u.frames.value = Math.max(0, u.frames.value - 1);
}, "render");
const { on: _, cancel: C } = yt(p);
p.loop.setReady(!1), p.loop.start(), _(() => {
s("ready", p), p.loop.setReady(!0), _r(e, p, s);
}), K(() => {
C(), p.loop.stop();
const { on: _, cancel: P } = yt(d);
d.loop.setReady(!1), d.loop.start(), _(() => {
s("ready", d), d.loop.setReady(!0), _r(e, d, s);
}), J(() => {
P(), d.loop.stop();
});
const E = 100, T = un({ every: E }), { isSupported: b, memory: P } = fn({ interval: E }), M = 160;
const C = 100, T = un({ every: C }), { isSupported: b, memory: E } = fn({ interval: C }), M = 160;
let A = performance.now();
const d = ({ timestamp: O }) => {
p.scene.value && (p.perf.memory.allocatedMem = ke(p.scene.value)), O - A >= E && (A = O, p.perf.fps.accumulator.push(T.value), p.perf.fps.accumulator.length > M && p.perf.fps.accumulator.shift(), p.perf.fps.value = T.value, b.value && P.value && (p.perf.memory.accumulator.push(P.value.usedJSHeapSize / 1024 / 1024), p.perf.memory.accumulator.length > M && p.perf.memory.accumulator.shift(), p.perf.memory.currentMem = p.perf.memory.accumulator.reduce((j, R) => j + R, 0) / p.perf.memory.accumulator.length));
const p = ({ timestamp: R }) => {
d.scene.value && (d.perf.memory.allocatedMem = ke(d.scene.value)), R - A >= C && (A = R, d.perf.fps.accumulator.push(T.value), d.perf.fps.accumulator.length > M && d.perf.fps.accumulator.shift(), d.perf.fps.value = T.value, b.value && E.value && (d.perf.memory.accumulator.push(E.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > M && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((j, O) => j + O, 0) / d.perf.memory.accumulator.length));
};
let w = 0;
const k = 1, { pause: L } = ut(({ delta: O }) => {
window.__TRES__DEVTOOLS__ && (d({ timestamp: performance.now() }), w += O, w >= k && (window.__TRES__DEVTOOLS__.cb(p), w = 0));
const k = 1, { pause: L } = ut(({ delta: R }) => {
window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += R, w >= k && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
}, { immediate: !0 });
return K(() => {
return J(() => {
L();
}), p;
}), d;
}

@@ -1124,4 +1124,4 @@ function me() {

}
const Zr = me;
function eo() {
const Xr = me;
function Zr() {
const {

@@ -1168,3 +1168,3 @@ camera: e,

let ce = 0, ue = 0;
const { pause: Mr, resume: Ke, isActive: Pr } = ut(
const { pause: Mr, resume: Je, isActive: Pr } = ut(
() => {

@@ -1179,3 +1179,3 @@ _t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }), Le.trigger({ delta: ce, elapsed: ue, clock: te });

let Qe = !1;
const to = () => (Qe || (Qe = !0, Ke()), {
const eo = () => (Qe || (Qe = !0, Je()), {
onBeforeLoop: _t.on,

@@ -1185,6 +1185,6 @@ onLoop: wt.on,

pause: Mr,
resume: Ke,
resume: Je,
isActive: Pr
});
function no() {
function to() {
const { logWarning: e } = V();

@@ -1269,4 +1269,4 @@ function t(l, i, a) {

{
object: (_, C, E, T) => {
sr(_, E, T, { patchProp: l, remove: s, insert: r }, e);
object: (_, P, C, T) => {
sr(_, C, T, { patchProp: l, remove: s, insert: r }, e);
},

@@ -1302,10 +1302,10 @@ __tres: (_) => {

function s(o, f) {
var h, g, p, _;
var h, g, d, _;
if (!o)
return;
o != null && o.__tres && ((h = o.__tres) == null ? void 0 : h.eventCount) > 0 && ((g = e.eventManager) == null || g.deregisterObject(o)), f = Me(f) ? "default" : f;
const y = (p = o.__tres) == null ? void 0 : p.dispose;
const y = (d = o.__tres) == null ? void 0 : d.dispose;
Me(y) || (y === null ? f = !1 : f = y);
const u = (_ = o.__tres) == null ? void 0 : _.primitive, v = f === "default" ? !u : !!f;
if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((C) => s(C, f)), v && o.children && [...o.children].forEach((C) => s(C, f)), gt(o, e), vt(o, e), v && !Fn(o)) {
if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((P) => s(P, f)), v && o.children && [...o.children].forEach((P) => s(P, f)), gt(o, e), vt(o, e), v && !Fn(o)) {
if (G(f))

@@ -1322,3 +1322,3 @@ f(o);

function l(o, f, y, u) {
var C, E;
var P, C;
if (!o)

@@ -1328,3 +1328,3 @@ return;

if (o.__tres && (o.__tres.memoizedProps[f] = u), f === "attach") {
const T = ((C = o.__tres) == null ? void 0 : C.parent) || o.parent;
const T = ((P = o.__tres) == null ? void 0 : P.parent) || o.parent;
s(o), z(o, { attach: u }, e), T && r(o, T);

@@ -1342,6 +1342,6 @@ return;

Ze.includes(f) && o.__tres && (o.__tres.eventCount += 1);
let g = oe(h), p = v == null ? void 0 : v[g];
let g = oe(h), d = v == null ? void 0 : v[g];
if (h === "args") {
const T = o, b = y ?? [], P = u ?? [], M = ((E = o.__tres) == null ? void 0 : E.type) || o.type;
M && b.length && !Jn(b, P) && (v = Object.assign(
const T = o, b = y ?? [], E = u ?? [], M = ((C = o.__tres) == null ? void 0 : C.type) || o.type;
M && b.length && !Kn(b, E) && (v = Object.assign(
T,

@@ -1361,12 +1361,12 @@ new Ce.value[M](...u)

}
if (h.includes("-") && p === void 0) {
if (h.includes("-") && d === void 0) {
const T = h.split("-");
p = T.reduce((b, P) => b[oe(P)], v), h = T.pop(), g = h, p != null && p.set || (v = T.reduce((b, P) => b[oe(P)], v));
d = T.reduce((b, E) => b[oe(E)], v), h = T.pop(), g = h, d != null && d.set || (v = T.reduce((b, E) => b[oe(E)], v));
}
let _ = u;
if (_ === "" && (_ = !0), G(p)) {
Ze.includes(f) || (pe(_) ? o[g](..._) : o[g](_)), g.startsWith("on") && G(_) && (v[g] = _);
if (_ === "" && (_ = !0), G(d)) {
Ze.includes(f) || (de(_) ? o[g](..._) : o[g](_)), g.startsWith("on") && G(_) && (v[g] = _);
return;
}
!(p != null && p.set) && !G(p) ? v[g] = _ : p.constructor === _.constructor && (p != null && p.copy) ? p == null || p.copy(_) : pe(_) ? p.set(..._) : !p.isColor && p.setScalar ? p.setScalar(_) : p.set(_), ht(o);
!(d != null && d.set) && !G(d) ? v[g] = _ : d.constructor === _.constructor && (d != null && d.copy) ? d == null || d.copy(_) : de(_) ? d.set(..._) : !d.isColor && d.setScalar ? d.setScalar(_) : d.set(_), ht(o);
}

@@ -1418,3 +1418,3 @@ function i(o) {

}
class Or {
class Rr {
constructor(t, n) {

@@ -1481,3 +1481,3 @@ this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;

}
function Rr(e, t) {
function Or(e, t) {
const n = e, r = bt(), s = Tr(), l = Sr && n.enableEarlyProxy;

@@ -1487,3 +1487,3 @@ if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))

else {
const i = l ? new Or(n, s) : null;
const i = l ? new Rr(n, s) : null;
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({

@@ -1517,3 +1517,3 @@ pluginDescriptor: n,

return n > 0 && t.tags.push({
label: `${dr(n)} KB`,
label: `${pr(n)} KB`,
textColor: 15707189,

@@ -1556,3 +1556,3 @@ backgroundColor: 16775644,

function Ir(e, t) {
Rr(
Or(
{

@@ -1638,3 +1638,2 @@ id: "dev.esm.tres",

context: {},
precision: {},
alpha: { type: Boolean, default: void 0 },

@@ -1647,4 +1646,6 @@ premultipliedAlpha: { type: Boolean },

depth: { type: Boolean, default: void 0 },
failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 },
precision: {},
logarithmicDepthBuffer: { type: Boolean, default: void 0 },
failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 }
reverseDepthBuffer: { type: Boolean }
},

@@ -1670,3 +1671,3 @@ emits: [

Ee(ot);
const f = (g, p = !1) => fe({
const f = (g, d = !1) => fe({
setup() {

@@ -1676,15 +1677,15 @@ var T;

_ && (_.app = o == null ? void 0 : o.appContext.app);
const C = {};
function E(b) {
b && (b.parent && E(b.parent), b.provides && Object.assign(C, b.provides));
const P = {};
function C(b) {
b && (b.parent && C(b.parent), b.provides && Object.assign(P, b.provides));
}
return o != null && o.parent && r.enableProvideBridge && (E(o.parent), Object.entries(C).forEach(([b, P]) => {
le(b, P);
})), le("useTres", g), le("extend", Ee), typeof window < "u" && Ir(_ == null ? void 0 : _.app, g), () => Ue(Bt, null, p ? [] : l.default());
return o != null && o.parent && r.enableProvideBridge && (C(o.parent), Reflect.ownKeys(P).forEach((b) => {
le(b, P[b]);
})), le("useTres", g), le("extend", Ee), typeof window < "u" && Ir(_ == null ? void 0 : _.app, g), () => Ue(Bt, null, d ? [] : l.default());
}
}), y = (g, p = !1) => {
const _ = f(g, p), { render: C } = jt(Er(g));
C(Ue(_), c.value);
}, u = (g, p = !1) => {
mt(g.scene.value), p && (g.renderer.value.dispose(), g.renderer.value.renderLists.dispose(), g.renderer.value.forceContextLoss()), c.value.__tres = {
}), y = (g, d = !1) => {
const _ = f(g, d), { render: P } = jt(Er(g));
P(Ue(_), c.value);
}, u = (g, d = !1) => {
mt(g.scene.value), d && (g.renderer.value.dispose(), g.renderer.value.renderLists.dispose(), g.renderer.value.forceContextLoss()), c.value.__tres = {
root: g

@@ -1706,3 +1707,3 @@ };

});
const { registerCamera: p, camera: _, cameras: C, deregisterCamera: E } = v.value;
const { registerCamera: d, camera: _, cameras: P, deregisterCamera: C } = v.value;
y(v.value);

@@ -1716,5 +1717,5 @@ const T = () => {

);
b.position.set(3, 3, 3), b.lookAt(0, 0, 0), p(b);
const P = xe(() => {
C.value.length >= 2 && (b.removeFromParent(), E(b), P == null || P());
b.position.set(3, 3, 3), b.lookAt(0, 0, 0), d(b);
const E = xe(() => {
P.value.length >= 2 && (b.removeFromParent(), C(b), E == null || E());
});

@@ -1724,4 +1725,4 @@ };

() => r.camera,
(b, P) => {
b && p(b), P && (P.removeFromParent(), E(P));
(b, E) => {
b && d(b), E && (E.removeFromParent(), C(E));
},

@@ -1734,8 +1735,8 @@ {

), T());
}), K(h), (g, p) => (Lt(), Ot("canvas", {
}), J(h), (g, d) => (Lt(), Rt("canvas", {
ref_key: "canvas",
ref: a,
"data-scene": c.value.uuid,
class: Rt(g.$attrs.class),
"data-tres": `tresjs ${W(On).version}`,
class: Ot(g.$attrs.class),
"data-tres": `tresjs ${W(Rn).version}`,
style: Dt({

@@ -1758,3 +1759,3 @@ display: "block",

"TresScene"
], Fr = {
], no = {
template: {

@@ -1765,5 +1766,5 @@ compilerOptions: {

}
}, ro = Fr, { logWarning: Wr } = V();
}, { logWarning: Fr } = V();
let B = null;
const oo = {
const ro = {
updated: (e, t) => {

@@ -1773,3 +1774,3 @@ var s;

if (!n) {
Wr(`v-distance-to: problem with binding value: ${t.value}`);
Fr(`v-distance-to: problem with binding value: ${t.value}`);
return;

@@ -1795,6 +1796,6 @@ }

s.setAttribute("position", new We(r, 3)), s.computeBoundingSphere();
const l = new Jt({ fog: !1 });
const l = new Kt({ fog: !1 });
super(s, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Fe();
a.setAttribute("position", new We(i, 3)), a.computeBoundingSphere(), this.add(new Kt(a, new at({ side: Qt, fog: !1 })));
a.setAttribute("position", new We(i, 3)), a.computeBoundingSphere(), this.add(new Jt(a, new at({ side: Qt, fog: !1 })));
}

@@ -1817,3 +1818,3 @@ updateMatrixWorld() {

let ie, F;
const Nr = {
const Wr = {
DirectionalLight: Xt,

@@ -1824,3 +1825,3 @@ PointLight: Zt,

RectAreaLight: Ct
}, so = {
}, oo = {
mounted: (e) => {

@@ -1831,3 +1832,3 @@ if (!e.isLight) {

}
ie = Nr[e.type], e.parent.add(new ie(e, 1, e.color.getHex()));
ie = Wr[e.type], e.parent.add(new ie(e, 1, e.color.getHex()));
},

@@ -1844,3 +1845,3 @@ updated: (e) => {

}
}, io = {
}, so = {
mounted: (e, t) => {

@@ -1853,3 +1854,3 @@ if (t.arg) {

}
}, ao = {
}, io = {
install(e) {

@@ -1861,7 +1862,7 @@ e.component("TresCanvas", Hr);

Hr as TresCanvas,
qr as UseLoader,
Jr as UseTexture,
Yr as UseLoader,
qr as UseTexture,
Ce as catalogue,
pr as createRenderLoop,
ao as default,
dr as createRenderLoop,
io as default,
mt as dispose,

@@ -1871,22 +1872,22 @@ Ee as extend,

hr as normalizeColor,
Qr as normalizeVectorFlexibleParam,
Xr as onTresReady,
ro as templateCompilerOptions,
Rn as trasverseObjects,
Jr as normalizeVectorFlexibleParam,
Qr as onTresReady,
no as templateCompilerOptions,
On as trasverseObjects,
ar as useCamera,
Dn as useLoader,
V as useLogger,
eo as useLoop,
Zr as useLoop,
yr as useRaycaster,
to as useRenderLoop,
eo as useRenderLoop,
gr as useRenderer,
no as useSeek,
to as useSeek,
ir as useTexture,
Zr as useTres,
Xr as useTres,
me as useTresContext,
br as useTresContextProvider,
_r as useTresEventManager,
oo as vDistanceTo,
so as vLightHelper,
io as vLog
ro as vDistanceTo,
oo as vLightHelper,
so as vLog
};
{
"name": "@tresjs/core",
"type": "module",
"version": "4.3.0",
"version": "4.3.1",
"packageManager": "pnpm@9.1.4",

@@ -78,24 +78,24 @@ "description": "Declarative ThreeJS using Vue Components",

"devDependencies": {
"@release-it/conventional-changelog": "^8.0.2",
"@release-it/conventional-changelog": "^9.0.0",
"@stackblitz/sdk": "^1.11.0",
"@tresjs/cientos": "4.0.2",
"@tresjs/eslint-config": "^1.3.1",
"@types/three": "^0.168.0",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"@vitejs/plugin-vue": "^5.1.3",
"@tresjs/cientos": "4.0.3",
"@tresjs/eslint-config": "^1.4.0",
"@types/three": "^0.169.0",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"@vitejs/plugin-vue": "^5.1.4",
"@vitest/coverage-c8": "^0.33.0",
"@vitest/coverage-v8": "^2.1.1",
"@vitest/ui": "^2.1.1",
"@vitest/coverage-v8": "^2.1.2",
"@vitest/ui": "^2.1.2",
"@vue/test-utils": "^2.4.6",
"eslint": "^9.10.0",
"eslint-plugin-vue": "^9.28.0",
"esno": "^4.7.0",
"eslint": "^9.12.0",
"eslint-plugin-vue": "^9.29.0",
"esno": "^4.8.0",
"gsap": "^3.12.5",
"husky": "^9.1.6",
"jsdom": "^25.0.0",
"jsdom": "^25.0.1",
"kolorist": "^1.8.0",
"ohmyfetch": "^0.4.21",
"pathe": "^1.1.2",
"release-it": "^17.5.0",
"release-it": "^17.8.2",
"rollup-plugin-analyzer": "^4.0.0",

@@ -105,17 +105,17 @@ "rollup-plugin-copy": "^3.5.0",

"sponsorkit": "^0.15.5",
"three": "^0.168.0",
"unocss": "^0.62.4",
"three": "^0.169.0",
"unocss": "^0.63.4",
"unplugin": "^1.14.1",
"unplugin-vue-components": "^0.27.4",
"vite": "^5.4.6",
"vite": "^5.4.8",
"vite-plugin-banner": "^0.8.0",
"vite-plugin-dts": "4.2.1",
"vite-plugin-dts": "4.2.4",
"vite-plugin-inspect": "^0.8.7",
"vite-plugin-require-transform": "^1.0.21",
"vite-svg-loader": "^5.1.0",
"vitepress": "1.3.4",
"vitest": "^2.1.1",
"vue": "3.5.6",
"vitepress": "1.4.0",
"vitest": "^2.1.2",
"vue": "3.5.12",
"vue-demi": "^0.14.10"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc