@tresjs/core 5.0.0-next.2 → 5.0.0-next.3
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.
|
@@ -183,5 +183,6 @@ export declare function useRendererManager({ scene, canvas, options, contextPart
|
|
|
183
183
|
invalidate: (amountOfFramesToInvalidate?: number) => void;
|
|
184
184
|
canBeInvalidated: import('vue').ComputedRef<boolean>;
|
|
185
185
|
frames: import('vue').Ref<number, number>;
|
|
186
|
+
mode: "always" | "on-demand" | "manual" | undefined;
|
|
186
187
|
};
|
|
187
188
|
export type UseRendererManagerReturn = ReturnType<typeof useRendererManager>;
|
package/dist/tres.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/core
|
|
3
|
-
* version: v5.0.0-next.
|
|
3
|
+
* version: v5.0.0-next.3
|
|
4
4
|
* (c) 2025
|
|
5
5
|
* description: Declarative ThreeJS using Vue Components
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
var ki = Object.defineProperty;
|
|
9
9
|
var xi = (e, t, n) => t in e ? ki(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
10
10
|
var C = (e, t, n) => xi(e, typeof t != "symbol" ? t + "" : t, n);
|
|
11
|
-
import { reactive as Ri, toValue as x, watch as Dt, onUnmounted as ne, defineComponent as ct, renderSlot as Fi, unref as X, ref as re, computed as te, watchEffect as W, readonly as Gt, shallowRef as ft, provide as
|
|
11
|
+
import { reactive as Ri, toValue as x, watch as Dt, onUnmounted as ne, defineComponent as ct, renderSlot as Fi, unref as X, ref as re, computed as te, watchEffect as W, readonly as Gt, shallowRef as ft, provide as Le, inject as Mi, isRef as Ce, useSlots as Li, getCurrentInstance as Yt, onMounted as Ni, createElementBlock as Vi, openBlock as Bi, normalizeStyle as Ui, normalizeClass as Hi, createRenderer as $i, h as qt, Fragment as zi } from "vue";
|
|
12
12
|
import * as br from "three";
|
|
13
13
|
import { Layers as Ki, Scene as Tr, MathUtils as Or, Vector3 as k, MeshBasicMaterial as Sr, DoubleSide as ji, Clock as Pr, WebGLRenderer as Ir, Mesh as Ge, Material as Wi, Vector2 as Q, Ray as dt, SphereGeometry as Gi, Object3D as Ye, Matrix4 as Ie, BufferAttribute as Dr, Triangle as kr, Line3 as Yi, Plane as qe, Raycaster as qi, Quaternion as pt, Sphere as Xi, Color as Ne, PCFSoftShadowMap as Zi, ACESFilmicToneMapping as Qi, PerspectiveCamera as Ji, ArrowHelper as eo, Line as to, BufferGeometry as Xt, Float32BufferAttribute as Zt, LineBasicMaterial as no, BackSide as ro, HemisphereLightHelper as io, SpotLightHelper as oo, PointLightHelper as so, DirectionalLightHelper as uo } from "three";
|
|
14
14
|
import { useAsyncState as ao, whenever as Qt, tryOnScopeDispose as lo, createEventHook as le, useDevicePixelRatio as co, unrefElement as fo, useWindowSize as po, useElementSize as ho, refDebounced as Jt, useRafFn as xr, useFps as _o, useMemory as mo } from "@vueuse/core";
|
|
15
|
-
const go = "@tresjs/core", Eo = "module", vo = "5.0.0-next.
|
|
15
|
+
const go = "@tresjs/core", Eo = "module", vo = "5.0.0-next.3", yo = "pnpm@10.6.3", Co = "Declarative ThreeJS using Vue Components", Ao = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", wo = "MIT", bo = { type: "git", url: "git+https://github.com/Tresjs/tres.git" }, To = ["vue", "3d", "threejs", "three", "threejs-vue"], Oo = !1, So = { ".": { types: "./dist/index.d.ts", import: "./dist/tres.js" }, "./components": { types: "./dist/src/components/index.d.ts" }, "./composables": { types: "./dist/src/composables/index.d.ts" }, "./types": { types: "./dist/src/types/index.d.ts" }, "./utils": { types: "./dist/src/utils/index.d.ts" }, "./*": "./*" }, Po = "./dist/tres.js", Io = "./dist/tres.js", Do = "./dist/index.d.ts", ko = ["*.d.ts", "dist"], xo = { access: "public" }, Ro = { dev: "pnpm --filter='./playground/vue' dev", "dev:nuxt": "pnpm --filter='./playground/nuxt' dev", build: "vite build", test: "vitest", "test:ci": "vitest run", "test:ui": "vitest --ui --coverage.enabled=true", release: "release-it", coverage: "vitest run --coverage", lint: "eslint .", "lint:fix": "eslint . --fix", typecheck: "vue-tsc --noEmit", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", "docs:serve": "vitepress serve docs", "docs:preview": "vitepress preview docs", "docs:contributors": "esno scripts/update-contributors.ts" }, Fo = { three: ">=0.133", vue: ">=3.4" }, Mo = { "@alvarosabu/utils": "^3.2.0", "@pmndrs/pointer-events": "^6.6.17", "@vue/devtools-api": "^7.7.2", "@vueuse/core": "^12.5.0" }, Lo = { "@release-it/conventional-changelog": "^10.0.0", "@stackblitz/sdk": "^1.11.0", "@tresjs/cientos": "5.0.0-next.0", "@tresjs/eslint-config": "^1.4.0", "@types/three": "^0.173.0", "@typescript-eslint/eslint-plugin": "^8.23.0", "@typescript-eslint/parser": "^8.23.0", "@vitejs/plugin-vue": "^5.2.1", "@vitest/coverage-c8": "^0.33.0", "@vitest/coverage-v8": "^3.0.5", "@vitest/ui": "^3.0.5", "@vue/test-utils": "^2.4.6", eslint: "^9.19.0", "eslint-plugin-vue": "^9.32.0", esno: "^4.8.0", gsap: "^3.12.7", jsdom: "^26.0.0", kolorist: "^1.8.0", ohmyfetch: "^0.4.21", pathe: "^2.0.2", "release-it": "^18.1.2", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-visualizer": "^5.14.0", sponsorkit: "^16.3.0", three: "^0.173.0", unocss: "^65.4.3", unplugin: "^2.1.2", "unplugin-vue-components": "^28.0.0", vite: "^6.1.0", "vite-plugin-banner": "^0.8.0", "vite-plugin-dts": "4.5.0", "vite-plugin-inspect": "^10.1.0", "vite-plugin-require-transform": "^1.0.21", "vite-svg-loader": "^5.1.0", vitepress: "1.6.3", vitest: "3.0.5", vue: "3.5.13", "vue-demi": "^0.14.10", "vue-tsc": "^2.2.0" }, No = {
|
|
16
16
|
name: go,
|
|
17
17
|
type: Eo,
|
|
18
18
|
version: vo,
|
|
@@ -31,8 +31,8 @@ const go = "@tresjs/core", Eo = "module", vo = "5.0.0-next.2", yo = "pnpm@10.6.3
|
|
|
31
31
|
publishConfig: xo,
|
|
32
32
|
scripts: Ro,
|
|
33
33
|
peerDependencies: Fo,
|
|
34
|
-
dependencies:
|
|
35
|
-
devDependencies:
|
|
34
|
+
dependencies: Mo,
|
|
35
|
+
devDependencies: Lo
|
|
36
36
|
};
|
|
37
37
|
class Vo extends br.Mesh {
|
|
38
38
|
constructor(...n) {
|
|
@@ -70,11 +70,11 @@ function _t(e) {
|
|
|
70
70
|
function ae(e) {
|
|
71
71
|
return U(e) && !!e.isCamera;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Mr(e) {
|
|
74
74
|
return U(e) && !!e.isColor;
|
|
75
75
|
}
|
|
76
76
|
function Uo(e) {
|
|
77
|
-
return e != null && (typeof e == "string" || typeof e == "number" ||
|
|
77
|
+
return e != null && (typeof e == "string" || typeof e == "number" || Mr(e));
|
|
78
78
|
}
|
|
79
79
|
function mt(e) {
|
|
80
80
|
return e !== null && typeof e == "object" && "set" in e && typeof e.set == "function";
|
|
@@ -137,7 +137,7 @@ function es(e, t) {
|
|
|
137
137
|
n[r[i]] = !0;
|
|
138
138
|
return t ? (i) => !!n[i.toLowerCase()] : (i) => !!n[i];
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function Lr(e, t) {
|
|
141
141
|
if (nn(e) && nn(t)) {
|
|
142
142
|
const i = e.attributes, o = t.attributes;
|
|
143
143
|
return i.length !== o.length ? !1 : Array.from(i).every(({ name: s, value: a }) => t.getAttribute(s) === a);
|
|
@@ -150,7 +150,7 @@ function Mr(e, t) {
|
|
|
150
150
|
if (n.length !== r.length)
|
|
151
151
|
return !1;
|
|
152
152
|
for (const i of n)
|
|
153
|
-
if (!r.includes(i) || !
|
|
153
|
+
if (!r.includes(i) || !Lr(e[i], t[i]))
|
|
154
154
|
return !1;
|
|
155
155
|
return !0;
|
|
156
156
|
}
|
|
@@ -158,7 +158,7 @@ function ts(e, t) {
|
|
|
158
158
|
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
|
|
159
159
|
return !1;
|
|
160
160
|
for (let n = 0; n < e.length; n++)
|
|
161
|
-
if (!
|
|
161
|
+
if (!Lr(e[n], t[n]))
|
|
162
162
|
return !1;
|
|
163
163
|
return !0;
|
|
164
164
|
}
|
|
@@ -470,7 +470,7 @@ function hs() {
|
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
function E() {
|
|
473
|
-
t && (t = !1, v(),
|
|
473
|
+
t && (t = !1, v(), M());
|
|
474
474
|
}
|
|
475
475
|
function d() {
|
|
476
476
|
t = !0, v(), cancelAnimationFrame(s);
|
|
@@ -487,10 +487,10 @@ function hs() {
|
|
|
487
487
|
function S() {
|
|
488
488
|
o.value = !1;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function M() {
|
|
491
491
|
var F;
|
|
492
492
|
if (!e) {
|
|
493
|
-
s = requestAnimationFrame(
|
|
493
|
+
s = requestAnimationFrame(M);
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
496
|
const A = r.getDelta(), O = r.getElapsedTime(), T = {
|
|
@@ -502,7 +502,7 @@ function hs() {
|
|
|
502
502
|
invalidate: f.invalidate,
|
|
503
503
|
advance: f.advance
|
|
504
504
|
}, D = { delta: A, elapsed: O, clock: r, ...T };
|
|
505
|
-
i.value && u.trigger(D), o.value || (l.count ? l.trigger(D) : c && c(D)), i.value && p.trigger(D), s = requestAnimationFrame(
|
|
505
|
+
i.value && u.trigger(D), o.value || (l.count ? l.trigger(D) : c && c(D)), i.value && p.trigger(D), s = requestAnimationFrame(M);
|
|
506
506
|
}
|
|
507
507
|
function v() {
|
|
508
508
|
const A = !t && !n;
|
|
@@ -563,7 +563,7 @@ function _s({
|
|
|
563
563
|
}), x(n.renderMode) === "on-demand" && f(), x(n.renderMode) === "manual" && setTimeout(() => {
|
|
564
564
|
_();
|
|
565
565
|
}, 100);
|
|
566
|
-
const
|
|
566
|
+
const M = te(() => {
|
|
567
567
|
const v = x(n.clearColor), A = x(n.clearAlpha), O = typeof v == "string" && v.length === 9 && v.startsWith("#");
|
|
568
568
|
return O && A !== void 0 && ze(`clearColor with alpha (e.g. ${v}) and clearAlpha cannot both be set, using clearColor as source of truth`), O ? {
|
|
569
569
|
alpha: Number.parseInt(v.slice(7, 9), 16) / 255,
|
|
@@ -574,7 +574,7 @@ function _s({
|
|
|
574
574
|
};
|
|
575
575
|
});
|
|
576
576
|
return W(() => {
|
|
577
|
-
const v =
|
|
577
|
+
const v = M.value;
|
|
578
578
|
v.color === void 0 || v.alpha === void 0 || a.setClearColor(v.color, v.alpha);
|
|
579
579
|
}), W(() => {
|
|
580
580
|
const v = n.toneMapping;
|
|
@@ -600,7 +600,8 @@ function _s({
|
|
|
600
600
|
onReady: b.on,
|
|
601
601
|
invalidate: f,
|
|
602
602
|
canBeInvalidated: l,
|
|
603
|
-
frames: c
|
|
603
|
+
frames: c,
|
|
604
|
+
mode: x(n.renderMode)
|
|
604
605
|
};
|
|
605
606
|
}
|
|
606
607
|
function ms(e, t, n = 10) {
|
|
@@ -719,7 +720,7 @@ class gs {
|
|
|
719
720
|
}
|
|
720
721
|
}
|
|
721
722
|
const nt = new k();
|
|
722
|
-
class
|
|
723
|
+
class L extends gs {
|
|
723
724
|
constructor(n, r, i, o, s, a, c = s.object, u = c, l = {
|
|
724
725
|
stopped: !r,
|
|
725
726
|
stoppedImmediate: !1
|
|
@@ -861,10 +862,10 @@ class M extends gs {
|
|
|
861
862
|
* for internal use
|
|
862
863
|
*/
|
|
863
864
|
retarget(n) {
|
|
864
|
-
return new
|
|
865
|
+
return new L(this.type, this.bubbles, this.nativeEvent, this.internalPointer, this.intersection, this.camera, n, this.target, this.propagationState);
|
|
865
866
|
}
|
|
866
867
|
}
|
|
867
|
-
class je extends
|
|
868
|
+
class je extends L {
|
|
868
869
|
get deltaX() {
|
|
869
870
|
return this.nativeEvent.deltaX;
|
|
870
871
|
}
|
|
@@ -1100,20 +1101,20 @@ class Is {
|
|
|
1100
1101
|
commit(t, n) {
|
|
1101
1102
|
var c;
|
|
1102
1103
|
const r = this.getCamera(), i = this.prevEnabled ? this.prevIntersection : void 0, o = this.enabled ? this.intersection : void 0;
|
|
1103
|
-
i != null && i.object != (o == null ? void 0 : o.object) && V(new
|
|
1104
|
+
i != null && i.object != (o == null ? void 0 : o.object) && V(new L("pointerout", !0, t, this, i, r));
|
|
1104
1105
|
const s = this.pointerEntered;
|
|
1105
1106
|
this.pointerEntered = [], this.pointerEnteredHelper.length = 0, Kr(o == null ? void 0 : o.object, this.pointerEntered, s, this.pointerEnteredHelper);
|
|
1106
1107
|
const a = s.length;
|
|
1107
1108
|
for (let u = 0; u < a; u++) {
|
|
1108
1109
|
const l = s[u];
|
|
1109
|
-
V(new
|
|
1110
|
+
V(new L("pointerleave", !1, t, this, i, r, l));
|
|
1110
1111
|
}
|
|
1111
|
-
o != null && (i == null ? void 0 : i.object) != o.object && V(new
|
|
1112
|
+
o != null && (i == null ? void 0 : i.object) != o.object && V(new L("pointerover", !0, t, this, o, r));
|
|
1112
1113
|
for (let u = this.pointerEnteredHelper.length - 1; u >= 0; u--) {
|
|
1113
1114
|
const l = this.pointerEnteredHelper[u];
|
|
1114
|
-
V(new
|
|
1115
|
+
V(new L("pointerenter", !1, t, this, o, r, l));
|
|
1115
1116
|
}
|
|
1116
|
-
if (n && o != null && V(new
|
|
1117
|
+
if (n && o != null && V(new L("pointermove", !0, t, this, o, r)), this.prevIntersection = this.intersection, this.prevEnabled = this.enabled, !this.wasMoved && this.intersector.isReady()) {
|
|
1117
1118
|
this.wasMoved = !0;
|
|
1118
1119
|
const u = this.onFirstMove.length;
|
|
1119
1120
|
for (let l = 0; l < u; l++)
|
|
@@ -1133,7 +1134,7 @@ class Is {
|
|
|
1133
1134
|
* just emitting a move event to the current intersection
|
|
1134
1135
|
*/
|
|
1135
1136
|
emitMove(t) {
|
|
1136
|
-
this.intersection != null && V(new
|
|
1137
|
+
this.intersection != null && V(new L("pointermove", !0, t, this, this.intersection, this.getCamera()));
|
|
1137
1138
|
}
|
|
1138
1139
|
down(t) {
|
|
1139
1140
|
if (this.buttonsDown.add(t.button), !this.enabled)
|
|
@@ -1144,7 +1145,7 @@ class Is {
|
|
|
1144
1145
|
}
|
|
1145
1146
|
if (this.intersection == null)
|
|
1146
1147
|
return;
|
|
1147
|
-
V(new
|
|
1148
|
+
V(new L("pointerdown", !0, t, this, this.intersection, this.getCamera()));
|
|
1148
1149
|
const { object: n } = this.intersection;
|
|
1149
1150
|
n[Ee] ?? (n[Ee] = /* @__PURE__ */ new Map()), n[Ee].set(t.button, t.timeStamp), this.buttonsDownTime.set(t.button, t.timeStamp);
|
|
1150
1151
|
}
|
|
@@ -1160,15 +1161,15 @@ class Is {
|
|
|
1160
1161
|
const { clickThesholdMs: n, contextMenuButton: r = 2, dblClickThresholdMs: i = 500, clickThresholdMs: o = n ?? 300 } = this.options;
|
|
1161
1162
|
this.pointerCapture = void 0;
|
|
1162
1163
|
const s = Ds(this.buttonsDownTime, this.intersection.object[Ee], t.button, t.timeStamp, o), a = this.getCamera();
|
|
1163
|
-
if (s && t.button === r && V(new
|
|
1164
|
+
if (s && t.button === r && V(new L("contextmenu", !0, t, this, this.intersection, a)), V(new L("pointerup", !0, t, this, this.intersection, a)), !s || t.button === r)
|
|
1164
1165
|
return;
|
|
1165
|
-
V(new
|
|
1166
|
+
V(new L("click", !0, t, this, this.intersection, a));
|
|
1166
1167
|
const { object: c } = this.intersection, u = c[it] ?? (c[it] = /* @__PURE__ */ new Map()), l = u.get(t.button);
|
|
1167
1168
|
if (l == null || t.timeStamp - l > i) {
|
|
1168
1169
|
u.set(t.button, t.timeStamp);
|
|
1169
1170
|
return;
|
|
1170
1171
|
}
|
|
1171
|
-
V(new
|
|
1172
|
+
V(new L("dblclick", !0, t, this, this.intersection, a)), u.delete(t.button);
|
|
1172
1173
|
}
|
|
1173
1174
|
cancel(t) {
|
|
1174
1175
|
if (this.enabled) {
|
|
@@ -1176,7 +1177,7 @@ class Is {
|
|
|
1176
1177
|
this.onFirstMove.push(this.cancel.bind(this, t));
|
|
1177
1178
|
return;
|
|
1178
1179
|
}
|
|
1179
|
-
this.intersection != null && V(new
|
|
1180
|
+
this.intersection != null && V(new L("pointercancel", !0, t, this, this.intersection, this.getCamera()));
|
|
1180
1181
|
}
|
|
1181
1182
|
}
|
|
1182
1183
|
wheel(t, n, r = !1) {
|
|
@@ -1255,8 +1256,8 @@ new k(0, 0, 0), new k(0, 0, 1);
|
|
|
1255
1256
|
const pn = new Ie(), Fs = new k();
|
|
1256
1257
|
new k(0, 0, -1);
|
|
1257
1258
|
new qe();
|
|
1258
|
-
const hn = new Q(),
|
|
1259
|
-
class
|
|
1259
|
+
const hn = new Q(), Ms = new k();
|
|
1260
|
+
class Ls {
|
|
1260
1261
|
constructor(t, n) {
|
|
1261
1262
|
C(this, "prepareTransformation");
|
|
1262
1263
|
C(this, "options");
|
|
@@ -1302,7 +1303,7 @@ class Ms {
|
|
|
1302
1303
|
}
|
|
1303
1304
|
startIntersection(t) {
|
|
1304
1305
|
const n = this.prepareTransformation(t, this.coords);
|
|
1305
|
-
return n == null ? !1 : (n.updateWorldMatrix(!0, !1), n.matrixWorld.decompose(this.fromPosition, this.fromQuaternion, Fs), this.raycaster.setFromCamera(this.coords, n), this.viewPlane.setFromNormalAndCoplanarPoint(n.getWorldDirection(
|
|
1306
|
+
return n == null ? !1 : (n.updateWorldMatrix(!0, !1), n.matrixWorld.decompose(this.fromPosition, this.fromQuaternion, Fs), this.raycaster.setFromCamera(this.coords, n), this.viewPlane.setFromNormalAndCoplanarPoint(n.getWorldDirection(Ms), this.raycaster.ray.origin), !0);
|
|
1306
1307
|
}
|
|
1307
1308
|
executeIntersection(t, n) {
|
|
1308
1309
|
const r = this.intersects.length;
|
|
@@ -1371,7 +1372,7 @@ function Us(e, t, n, r) {
|
|
|
1371
1372
|
function Hs(e, t, n, r, i, o, s = {}) {
|
|
1372
1373
|
const a = (s == null ? void 0 : s.forwardPointerCapture) ?? !0, c = /* @__PURE__ */ new Map(), u = s.pointerTypePrefix ?? "forward-", l = (A, O) => {
|
|
1373
1374
|
let T = c.get(A.pointerId);
|
|
1374
|
-
return T != null || (T = new Is(Vs(), `${u}${A.pointerType}`, A.pointerState, new
|
|
1375
|
+
return T != null || (T = new Is(Vs(), `${u}${A.pointerType}`, A.pointerState, new Ls((D, F) => (r(D, F), t()), s), t, void 0, a ? i.bind(null, A.pointerId) : void 0, a ? o.bind(null, A.pointerId) : void 0, s), O != "move" && O != "wheel" && (T.setIntersection(T.computeIntersection("pointer", n, A)), T.commit(A, !1)), c.set(A.pointerId, T)), T;
|
|
1375
1376
|
}, p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), _ = [], h = [], E = (A, O, T) => {
|
|
1376
1377
|
switch (A) {
|
|
1377
1378
|
case "move":
|
|
@@ -1400,10 +1401,10 @@ function Hs(e, t, n, r, i, o, s = {}) {
|
|
|
1400
1401
|
}, d = (A, O) => {
|
|
1401
1402
|
const T = l(O, A);
|
|
1402
1403
|
A === "move" && f.set(T, O), A === "wheel" && p.set(T, O), s.batchEvents ?? !0 ? h.push({ type: A, event: O }) : E(A, O, T);
|
|
1403
|
-
}, m = d.bind(null, "move"), b = d.bind(null, "cancel"), w = d.bind(null, "down"), S = d.bind(null, "up"),
|
|
1404
|
-
return e.addEventListener("pointermove", m), e.addEventListener("pointercancel", b), e.addEventListener("pointerdown", w), e.addEventListener("pointerup", S), e.addEventListener("wheel",
|
|
1404
|
+
}, m = d.bind(null, "move"), b = d.bind(null, "cancel"), w = d.bind(null, "down"), S = d.bind(null, "up"), M = d.bind(null, "wheel"), v = d.bind(null, "exit");
|
|
1405
|
+
return e.addEventListener("pointermove", m), e.addEventListener("pointercancel", b), e.addEventListener("pointerdown", w), e.addEventListener("pointerup", S), e.addEventListener("wheel", M), e.addEventListener("pointerleave", v), {
|
|
1405
1406
|
destroy() {
|
|
1406
|
-
e.removeEventListener("pointermove", m), e.removeEventListener("pointercancel", b), e.removeEventListener("pointerdown", w), e.removeEventListener("pointerup", S), e.removeEventListener("wheel",
|
|
1407
|
+
e.removeEventListener("pointermove", m), e.removeEventListener("pointercancel", b), e.removeEventListener("pointerdown", w), e.removeEventListener("pointerup", S), e.removeEventListener("wheel", M), e.removeEventListener("pointerleave", v), f.clear(), p.clear();
|
|
1407
1408
|
},
|
|
1408
1409
|
update() {
|
|
1409
1410
|
const A = h.length;
|
|
@@ -1466,7 +1467,7 @@ function zs({
|
|
|
1466
1467
|
loop: a,
|
|
1467
1468
|
events: u
|
|
1468
1469
|
};
|
|
1469
|
-
return
|
|
1470
|
+
return Le("useTres", l), l.scene.value.__tres = {
|
|
1470
1471
|
root: l
|
|
1471
1472
|
}, l.loop.setReady(!1), l.loop.start(), c.onReady(() => {
|
|
1472
1473
|
l.loop.setReady(!0);
|
|
@@ -1475,7 +1476,7 @@ function zs({
|
|
|
1475
1476
|
}), l;
|
|
1476
1477
|
}
|
|
1477
1478
|
function jr() {
|
|
1478
|
-
const e =
|
|
1479
|
+
const e = Mi("useTres");
|
|
1479
1480
|
if (!e)
|
|
1480
1481
|
throw new Error("useTresContext must be used together with useTresContextProvider");
|
|
1481
1482
|
return e;
|
|
@@ -1683,8 +1684,8 @@ const Gs = [
|
|
|
1683
1684
|
En(l) && q(f) && u.addEventListener(Ys[l], f);
|
|
1684
1685
|
let E = et(h), d = _ == null ? void 0 : _[E];
|
|
1685
1686
|
if (h === "args") {
|
|
1686
|
-
const S = u,
|
|
1687
|
-
if (A &&
|
|
1687
|
+
const S = u, M = p ?? [], v = f ?? [], A = ((w = u.__tres) == null ? void 0 : w.type) || u.type;
|
|
1688
|
+
if (A && M.length && !ts(M, v)) {
|
|
1688
1689
|
const O = new Et.value[A](...f), T = Object.getOwnPropertyDescriptors(O);
|
|
1689
1690
|
Object.entries(T).forEach(([D, F]) => {
|
|
1690
1691
|
if (!(!F.writable && !F.set) && D in S)
|
|
@@ -1716,7 +1717,7 @@ const Gs = [
|
|
|
1716
1717
|
En(l) || (Rr(m) ? u[E](...m) : u[E](m)), E.startsWith("on") && q(m) && (_[E] = m);
|
|
1717
1718
|
return;
|
|
1718
1719
|
}
|
|
1719
|
-
en(d) && en(m) ? d.mask = m.mask :
|
|
1720
|
+
en(d) && en(m) ? d.mask = m.mask : Mr(d) && Uo(m) ? d.set(m) : Ho(d) && $o(m) && d.constructor === m.constructor ? d.copy(m) : mt(d) && Array.isArray(m) ? "fromArray" in d && typeof d.fromArray == "function" ? d.fromArray(m) : d.set(...m) : mt(d) && typeof m == "number" ? "setScalar" in d && typeof d.setScalar == "function" ? d.setScalar(m) : d.set(m) : _[E] = m, ae(u) && u.updateProjectionMatrix(), Nr(u);
|
|
1720
1721
|
}
|
|
1721
1722
|
function s(u) {
|
|
1722
1723
|
var l;
|
|
@@ -3426,11 +3427,11 @@ var gu = Object.create, Qr = Object.defineProperty, Eu = Object.getOwnPropertyDe
|
|
|
3426
3427
|
"¤": "tien te"
|
|
3427
3428
|
}
|
|
3428
3429
|
}, c = [";", "?", ":", "@", "&", "=", "+", "$", ",", "/"].join(""), u = [";", "?", ":", "@", "&", "=", "+", "$", ","].join(""), l = [".", "!", "~", "*", "'", "(", ")"].join(""), p = function(d, m) {
|
|
3429
|
-
var b = "-", w = "", S = "",
|
|
3430
|
+
var b = "-", w = "", S = "", M = !0, v = {}, A, O, T, D, F, ke, me, oe, jt, K, P, xe, $, se, G = "";
|
|
3430
3431
|
if (typeof d != "string")
|
|
3431
3432
|
return "";
|
|
3432
3433
|
if (typeof m == "string" && (b = m), me = a.en, oe = s.en, typeof m == "object") {
|
|
3433
|
-
A = m.maintainCase || !1, v = m.custom && typeof m.custom == "object" ? m.custom : v, T = +m.truncate > 1 && m.truncate || !1, D = m.uric || !1, F = m.uricNoSlash || !1, ke = m.mark || !1,
|
|
3434
|
+
A = m.maintainCase || !1, v = m.custom && typeof m.custom == "object" ? m.custom : v, T = +m.truncate > 1 && m.truncate || !1, D = m.uric || !1, F = m.uricNoSlash || !1, ke = m.mark || !1, M = !(m.symbols === !1 || m.lang === !1), b = m.separator || b, D && (G += c), F && (G += u), ke && (G += l), me = m.lang && a[m.lang] && M ? a[m.lang] : M ? a.en : {}, oe = m.lang && s[m.lang] ? s[m.lang] : m.lang === !1 || m.lang === !0 ? {} : s.en, m.titleCase && typeof m.titleCase.length == "number" && Array.prototype.toString.call(m.titleCase) ? (m.titleCase.forEach(function(H) {
|
|
3434
3435
|
v[H + ""] = H + "";
|
|
3435
3436
|
}), O = !0) : O = !!m.titleCase, m.custom && typeof m.custom.length == "number" && Array.prototype.toString.call(m.custom) && m.custom.forEach(function(H) {
|
|
3436
3437
|
v[H + ""] = H + "";
|
|
@@ -3499,7 +3500,7 @@ function Su(e) {
|
|
|
3499
3500
|
function Cn(e, t) {
|
|
3500
3501
|
return e.type.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ = t, t;
|
|
3501
3502
|
}
|
|
3502
|
-
function
|
|
3503
|
+
function Mt(e) {
|
|
3503
3504
|
if (e.__VUE_DEVTOOLS_NEXT_APP_RECORD__)
|
|
3504
3505
|
return e.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
|
|
3505
3506
|
if (e.root)
|
|
@@ -3507,7 +3508,7 @@ function Lt(e) {
|
|
|
3507
3508
|
}
|
|
3508
3509
|
function ei(e) {
|
|
3509
3510
|
var t, n;
|
|
3510
|
-
const r = (t = e.subTree) == null ? void 0 : t.type, i =
|
|
3511
|
+
const r = (t = e.subTree) == null ? void 0 : t.type, i = Mt(e);
|
|
3511
3512
|
return i ? ((n = i == null ? void 0 : i.types) == null ? void 0 : n.Fragment) === r : !1;
|
|
3512
3513
|
}
|
|
3513
3514
|
function Xe(e) {
|
|
@@ -3586,7 +3587,7 @@ function ie(e) {
|
|
|
3586
3587
|
return typeof window > "u" ? An : ei(e) ? ku(e.subTree) : (t == null ? void 0 : t.nodeType) === 1 ? t == null ? void 0 : t.getBoundingClientRect() : e.subTree.component ? ie(e.subTree.component) : An;
|
|
3587
3588
|
}
|
|
3588
3589
|
g();
|
|
3589
|
-
function
|
|
3590
|
+
function Lt(e) {
|
|
3590
3591
|
return ei(e) ? Ru(e.subTree) : e.subTree ? [e.subTree.el] : [];
|
|
3591
3592
|
}
|
|
3592
3593
|
function Ru(e) {
|
|
@@ -3594,7 +3595,7 @@ function Ru(e) {
|
|
|
3594
3595
|
return [];
|
|
3595
3596
|
const t = [];
|
|
3596
3597
|
return e.children.forEach((n) => {
|
|
3597
|
-
n.component ? t.push(...
|
|
3598
|
+
n.component ? t.push(...Lt(n.component)) : n != null && n.el && t.push(n.el);
|
|
3598
3599
|
}), t;
|
|
3599
3600
|
}
|
|
3600
3601
|
var ti = "__vue-devtools-component-inspector__", ni = "__vue-devtools-component-inspector__card__", ri = "__vue-devtools-component-inspector__name__", ii = "__vue-devtools-component-inspector__indicator__", oi = {
|
|
@@ -3619,7 +3620,7 @@ var ti = "__vue-devtools-component-inspector__", ni = "__vue-devtools-component-
|
|
|
3619
3620
|
lineHeight: "24px",
|
|
3620
3621
|
backgroundColor: "#42b883",
|
|
3621
3622
|
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)"
|
|
3622
|
-
},
|
|
3623
|
+
}, Mu = {
|
|
3623
3624
|
display: "inline-block",
|
|
3624
3625
|
fontWeight: 400,
|
|
3625
3626
|
fontStyle: "normal",
|
|
@@ -3629,7 +3630,7 @@ var ti = "__vue-devtools-component-inspector__", ni = "__vue-devtools-component-
|
|
|
3629
3630
|
function he() {
|
|
3630
3631
|
return document.getElementById(ti);
|
|
3631
3632
|
}
|
|
3632
|
-
function
|
|
3633
|
+
function Lu() {
|
|
3633
3634
|
return document.getElementById(ni);
|
|
3634
3635
|
}
|
|
3635
3636
|
function Nu() {
|
|
@@ -3662,10 +3663,10 @@ function Vt(e) {
|
|
|
3662
3663
|
const i = document.createElement("span");
|
|
3663
3664
|
i.id = ri, i.innerHTML = `<${e.name}> `;
|
|
3664
3665
|
const o = document.createElement("i");
|
|
3665
|
-
return o.id = ii, o.innerHTML = `${Math.round(e.bounds.width * 100) / 100} x ${Math.round(e.bounds.height * 100) / 100}`, Object.assign(o.style,
|
|
3666
|
+
return o.id = ii, o.innerHTML = `${Math.round(e.bounds.width * 100) / 100} x ${Math.round(e.bounds.height * 100) / 100}`, Object.assign(o.style, Mu), r.appendChild(i), r.appendChild(o), n.appendChild(r), document.body.appendChild(n), n;
|
|
3666
3667
|
}
|
|
3667
3668
|
function Bt(e) {
|
|
3668
|
-
const t = he(), n =
|
|
3669
|
+
const t = he(), n = Lu(), r = Vu(), i = Nu();
|
|
3669
3670
|
t && (Object.assign(t.style, {
|
|
3670
3671
|
...oi,
|
|
3671
3672
|
...Nt(e.bounds)
|
|
@@ -3720,7 +3721,7 @@ function $u() {
|
|
|
3720
3721
|
function zu(e) {
|
|
3721
3722
|
const t = Ct(N.value, e.id);
|
|
3722
3723
|
if (t) {
|
|
3723
|
-
const [n] =
|
|
3724
|
+
const [n] = Lt(t);
|
|
3724
3725
|
if (typeof n.scrollIntoView == "function")
|
|
3725
3726
|
n.scrollIntoView({
|
|
3726
3727
|
behavior: "smooth"
|
|
@@ -3894,7 +3895,7 @@ function Ju(e, t) {
|
|
|
3894
3895
|
R.timelineLayersState[t.id] = !1, Qu.push({
|
|
3895
3896
|
...e,
|
|
3896
3897
|
descriptorId: t.id,
|
|
3897
|
-
appRecord:
|
|
3898
|
+
appRecord: Mt(t.app)
|
|
3898
3899
|
});
|
|
3899
3900
|
}
|
|
3900
3901
|
var Sn, Pn;
|
|
@@ -3915,7 +3916,7 @@ function ea(e, t) {
|
|
|
3915
3916
|
stateFilterPlaceholder: (r = e.stateFilterPlaceholder) != null ? r : "Search state...",
|
|
3916
3917
|
treeFilter: "",
|
|
3917
3918
|
selectedNodeId: "",
|
|
3918
|
-
appRecord:
|
|
3919
|
+
appRecord: Mt(t.app)
|
|
3919
3920
|
}), ai();
|
|
3920
3921
|
}
|
|
3921
3922
|
function li() {
|
|
@@ -4037,8 +4038,8 @@ var kn, xn;
|
|
|
4037
4038
|
(xn = (kn = y).__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__) != null || (kn.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD__ = {});
|
|
4038
4039
|
var Rn, Fn;
|
|
4039
4040
|
(Fn = (Rn = y).__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__) != null || (Rn.__VUE_DEVTOOLS_KIT_ACTIVE_APP_RECORD_ID__ = "");
|
|
4040
|
-
var
|
|
4041
|
-
(
|
|
4041
|
+
var Mn, Ln;
|
|
4042
|
+
(Ln = (Mn = y).__VUE_DEVTOOLS_KIT_CUSTOM_TABS__) != null || (Mn.__VUE_DEVTOOLS_KIT_CUSTOM_TABS__ = []);
|
|
4042
4043
|
var Nn, Vn;
|
|
4043
4044
|
(Vn = (Nn = y).__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__) != null || (Nn.__VUE_DEVTOOLS_KIT_CUSTOM_COMMANDS__ = []);
|
|
4044
4045
|
var ee = "__VUE_DEVTOOLS_KIT_GLOBAL_STATE__";
|
|
@@ -4548,7 +4549,7 @@ function wa(e) {
|
|
|
4548
4549
|
inspectDOM(t) {
|
|
4549
4550
|
const n = Ct(N.value, t);
|
|
4550
4551
|
if (n) {
|
|
4551
|
-
const [r] =
|
|
4552
|
+
const [r] = Lt(n);
|
|
4552
4553
|
r && (y.__VUE_DEVTOOLS_INSPECT_DOM_TARGET__ = r);
|
|
4553
4554
|
}
|
|
4554
4555
|
},
|
|
@@ -4706,7 +4707,7 @@ var Da = class {
|
|
|
4706
4707
|
};
|
|
4707
4708
|
g();
|
|
4708
4709
|
g();
|
|
4709
|
-
var ka = (e) => Object.prototype.toString.call(e).slice(8, -1), _i = (e) => typeof e > "u", xa = (e) => e === null, Te = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, Tt = (e) => Te(e) && Object.keys(e).length === 0, Z = (e) => Array.isArray(e), Ra = (e) => typeof e == "string", Fa = (e) => typeof e == "number" && !isNaN(e),
|
|
4710
|
+
var ka = (e) => Object.prototype.toString.call(e).slice(8, -1), _i = (e) => typeof e > "u", xa = (e) => e === null, Te = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, Tt = (e) => Te(e) && Object.keys(e).length === 0, Z = (e) => Array.isArray(e), Ra = (e) => typeof e == "string", Fa = (e) => typeof e == "number" && !isNaN(e), Ma = (e) => typeof e == "boolean", La = (e) => e instanceof RegExp, Oe = (e) => e instanceof Map, Se = (e) => e instanceof Set, mi = (e) => ka(e) === "Symbol", Na = (e) => e instanceof Date && !isNaN(e.valueOf()), Va = (e) => e instanceof Error, ur = (e) => typeof e == "number" && isNaN(e), Ba = (e) => Ma(e) || xa(e) || _i(e) || Fa(e) || Ra(e) || mi(e), Ua = (e) => typeof e == "bigint", Ha = (e) => e === 1 / 0 || e === -1 / 0, $a = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), za = (e) => e instanceof URL;
|
|
4710
4711
|
g();
|
|
4711
4712
|
var gi = (e) => e.replace(/\./g, "\\."), lt = (e) => e.map(String).map(gi).join("."), we = (e) => {
|
|
4712
4713
|
const t = [];
|
|
@@ -4754,7 +4755,7 @@ var Ei = [
|
|
|
4754
4755
|
n[r] = e[r];
|
|
4755
4756
|
}), n;
|
|
4756
4757
|
}),
|
|
4757
|
-
z(
|
|
4758
|
+
z(La, "regexp", (e) => "" + e, (e) => {
|
|
4758
4759
|
const t = e.slice(1, e.lastIndexOf("/")), n = e.slice(e.lastIndexOf("/") + 1);
|
|
4759
4760
|
return new RegExp(t, n);
|
|
4760
4761
|
}),
|
|
@@ -5467,7 +5468,7 @@ const ll = ["data-scene", "data-tres"], cl = /* @__PURE__ */ ct({
|
|
|
5467
5468
|
},
|
|
5468
5469
|
emits: ["ready", "render", "pointermissed", "click", "contextmenu", "pointermove", "pointerenter", "pointerleave", "pointerover", "pointerout", "dblclick", "pointerdown", "pointerup", "pointercancel", "lostpointercapture", "wheel"],
|
|
5469
5470
|
setup(e, { expose: t, emit: n }) {
|
|
5470
|
-
const r = e, i = n, o =
|
|
5471
|
+
const r = e, i = n, o = Li(), s = re(), a = ft(new Tr()), c = Yt();
|
|
5471
5472
|
vt(br);
|
|
5472
5473
|
const u = (h, E = !1) => ct({
|
|
5473
5474
|
setup() {
|
|
@@ -5479,8 +5480,8 @@ const ll = ["data-scene", "data-tres"], cl = /* @__PURE__ */ ct({
|
|
|
5479
5480
|
S && (S.parent && b(S.parent), S.provides && Object.assign(m, S.provides));
|
|
5480
5481
|
}
|
|
5481
5482
|
return c != null && c.parent && r.enableProvideBridge && (b(c.parent), Reflect.ownKeys(m).forEach((S) => {
|
|
5482
|
-
|
|
5483
|
-
})),
|
|
5483
|
+
Le(S, m[S]);
|
|
5484
|
+
})), Le("useTres", h), Le("extend", vt), typeof window < "u" && (d != null && d.app) && al(d == null ? void 0 : d.app, h), () => qt(zi, null, E ? [] : o.default());
|
|
5484
5485
|
}
|
|
5485
5486
|
}), l = (h, E = !1) => {
|
|
5486
5487
|
const d = u(h, E), { render: m } = $i(qs(h));
|
|
@@ -5504,7 +5505,7 @@ const ll = ["data-scene", "data-tres"], cl = /* @__PURE__ */ ct({
|
|
|
5504
5505
|
});
|
|
5505
5506
|
const { camera: E, renderer: d } = f.value, { registerCamera: m, cameras: b, activeCamera: w, deregisterCamera: S } = E;
|
|
5506
5507
|
l(f.value);
|
|
5507
|
-
const
|
|
5508
|
+
const M = () => {
|
|
5508
5509
|
const v = new Ji(
|
|
5509
5510
|
45,
|
|
5510
5511
|
window.innerWidth / window.innerHeight,
|
|
@@ -5526,7 +5527,7 @@ const ll = ["data-scene", "data-tres"], cl = /* @__PURE__ */ ct({
|
|
|
5526
5527
|
{
|
|
5527
5528
|
immediate: !0
|
|
5528
5529
|
}
|
|
5529
|
-
), w.value ||
|
|
5530
|
+
), w.value || M(), d.onRender((v) => {
|
|
5530
5531
|
i("render", v);
|
|
5531
5532
|
}), d.onReady(() => {
|
|
5532
5533
|
i("ready", f.value);
|
|
@@ -5614,7 +5615,7 @@ class Di extends to {
|
|
|
5614
5615
|
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
|
|
5615
5616
|
}
|
|
5616
5617
|
}
|
|
5617
|
-
let
|
|
5618
|
+
let Me, Y;
|
|
5618
5619
|
const dl = {
|
|
5619
5620
|
DirectionalLight: uo,
|
|
5620
5621
|
PointLight: so,
|
|
@@ -5627,17 +5628,17 @@ const dl = {
|
|
|
5627
5628
|
ze(`${e.type} is not a light`);
|
|
5628
5629
|
return;
|
|
5629
5630
|
}
|
|
5630
|
-
|
|
5631
|
+
Me = dl[e.type], e.parent.add(new Me(e, 1, e.color.getHex()));
|
|
5631
5632
|
},
|
|
5632
5633
|
updated: (e) => {
|
|
5633
|
-
Y = e.parent.children.find((t) => t instanceof
|
|
5634
|
+
Y = e.parent.children.find((t) => t instanceof Me), !(Y instanceof Di) && Y.update();
|
|
5634
5635
|
},
|
|
5635
5636
|
unmounted: (e) => {
|
|
5636
5637
|
if (!e.isLight) {
|
|
5637
5638
|
ze(`${e.type} is not a light`);
|
|
5638
5639
|
return;
|
|
5639
5640
|
}
|
|
5640
|
-
Y = e.parent.children.find((t) => t instanceof
|
|
5641
|
+
Y = e.parent.children.find((t) => t instanceof Me), Y && Y.dispose && Y.dispose(), e.parent && e.parent.remove(Y);
|
|
5641
5642
|
}
|
|
5642
5643
|
}, Il = {
|
|
5643
5644
|
mounted: (e, t) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tresjs/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.0-next.
|
|
4
|
+
"version": "5.0.0-next.3",
|
|
5
5
|
"packageManager": "pnpm@10.6.3",
|
|
6
6
|
"description": "Declarative ThreeJS using Vue Components",
|
|
7
7
|
"author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
|