@tresjs/core
Advanced tools
Comparing version 0.3.0 to 0.4.0
export declare const isProd: boolean; | ||
interface LoggerComposition { | ||
logError: (message: string, error: Error) => void; | ||
logError: (message: string, error?: Error | ErrorEvent) => void; | ||
logWarning: (message: string) => void; | ||
@@ -5,0 +5,0 @@ logMessage: (name: string, value: any) => void; |
@@ -1,9 +0,9 @@ | ||
export * from './useCamera/useCamera'; | ||
export * from './useCatalog/useCatalog'; | ||
export * from './useInstanceCreator/useInstanceCreator'; | ||
export * from './useLoop/useLoop'; | ||
export * from './useRenderer/useRenderer'; | ||
export * from './useScene/useScene'; | ||
export * from './useLoader/useLoader'; | ||
export * from './useTexture/useTexture'; | ||
export * from './useCamera'; | ||
export * from './useCatalog'; | ||
export * from './useInstanceCreator'; | ||
export * from './useRenderLoop/'; | ||
export * from './useRenderer/'; | ||
export * from './useScene/'; | ||
export * from './useLoader'; | ||
export * from './useTexture'; | ||
export * from './useTres'; |
import { App } from 'vue'; | ||
export * from './core'; | ||
export * as TresCanvas from './components/TresCanvas.vue'; | ||
export * from './keys'; | ||
@@ -5,0 +4,0 @@ export interface TresPlugin { |
505
dist/tres.js
/** | ||
* name: @tresjs/core | ||
* version: v0.3.0 | ||
* version: v0.4.0 | ||
* (c) 2022 | ||
@@ -8,23 +8,23 @@ * description: Declarative ThreeJS using Vue Components | ||
*/ | ||
import { computed as v, watch as F, ref as L, defineComponent as J, reactive as ee, toRefs as te, useSlots as re, useAttrs as ne, provide as ae, onMounted as oe, onBeforeUnmount as se, openBlock as _, createElementBlock as j, normalizeStyle as V, unref as U, createElementVNode as ce, createBlock as ie, Suspense as le, withCtx as ue, renderSlot as W, createCommentVNode as D, Fragment as fe } from "vue"; | ||
import * as pe from "three"; | ||
import { PerspectiveCamera as B, OrthographicCamera as de, Vector3 as me, Color as A, Scene as ge, Clock as he, LoadingManager as we, TextureLoader as ye, WebGLRenderer as Ce, PCFSoftShadowMap as Me, sRGBEncoding as Se } from "three"; | ||
import { useWindowSize as K } from "@vueuse/core"; | ||
var E = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(E || {}); | ||
const R = { | ||
import { computed as F, watch as R, inject as Q, defineComponent as _, shallowRef as $, ref as O, reactive as le, toRefs as fe, provide as T, onBeforeUnmount as me, h as G } from "vue"; | ||
import { useWindowSize as X, createEventHook as U, useRafFn as de, useElementSize as ge, useDevicePixelRatio as he, unrefElement as A, resolveUnref as v } from "@vueuse/core"; | ||
import * as we from "three"; | ||
import { PerspectiveCamera as I, OrthographicCamera as Ce, Color as z, Vector3 as ve, Clock as Me, Scene as Se, LoadingManager as Y, TextureLoader as ye, PCFShadowMap as xe, LinearEncoding as Ee, NoToneMapping as Pe, WebGLRenderer as Le } from "three"; | ||
var Re = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Re || {}); | ||
const P = { | ||
cameras: [] | ||
}, xe = 45; | ||
let x; | ||
function z() { | ||
const { width: e, height: t } = K(); | ||
function u(o = "Perspective", a) { | ||
if (o === "Perspective") { | ||
const { near: p, far: g, fov: f } = a || { | ||
}, Te = 45; | ||
let y; | ||
function Z() { | ||
const { width: e, height: t } = X(); | ||
function a(s = "Perspective", i) { | ||
if (s === "Perspective") { | ||
const { near: l, far: d, fov: m } = i || { | ||
near: 0.1, | ||
far: 1e3, | ||
fov: xe | ||
fov: Te | ||
}; | ||
x = new B(f, r.value, p, g), R.cameras.push(x); | ||
y = new I(m, r.value, l, d), P.cameras.push(y); | ||
} else { | ||
const { left: p, right: g, top: f, bottom: w, near: S, far: h } = a || { | ||
const { left: l, right: d, top: m, bottom: h, near: M, far: S } = i || { | ||
left: -100, | ||
@@ -37,40 +37,42 @@ right: 100, | ||
}; | ||
x = new de(p, g, f, w, S, h), R.cameras.push(x); | ||
y = new Ce(l, d, m, h, M, S), P.cameras.push(y); | ||
} | ||
return R.cameras.push(x), x; | ||
return P.cameras.push(y), y; | ||
} | ||
const r = v(() => e.value / t.value), n = v(() => R.cameras[0]); | ||
function s() { | ||
n.value instanceof B && (n.value.aspect = r.value), n.value.updateProjectionMatrix(); | ||
const r = F(() => e.value / t.value), n = F(() => P.cameras[0]); | ||
function o() { | ||
n.value instanceof I && (n.value.aspect = r.value), n.value.updateProjectionMatrix(); | ||
} | ||
function c(o) { | ||
R.cameras.push(o), o instanceof B && (o.aspect = r.value), o.updateProjectionMatrix(); | ||
function p(s) { | ||
const i = Q("camera"); | ||
s && i && (i.value = s), P.cameras.push(s), s instanceof I && (s.aspect = r.value), s.updateProjectionMatrix(); | ||
} | ||
return F(r, s), { | ||
return R(r, o), { | ||
activeCamera: n, | ||
createCamera: u, | ||
updateCamera: s, | ||
pushCamera: c | ||
createCamera: a, | ||
updateCamera: o, | ||
pushCamera: p | ||
}; | ||
} | ||
let I = { ...pe }; | ||
function Re() { | ||
let b = { ...we }; | ||
delete b.Scene; | ||
function be() { | ||
return { | ||
extend: (t) => { | ||
I = Object.assign(I, t); | ||
b = Object.assign(b, t); | ||
}, | ||
catalogue: I | ||
catalogue: b | ||
}; | ||
} | ||
const Pe = (e) => typeof e < "u", Q = (e) => !!e && e.constructor === Array; | ||
function X(e) { | ||
return typeof e == "number" ? [e, e, e] : e instanceof me ? [e.x, e.y, e.z] : e; | ||
const Oe = (e) => typeof e < "u", k = (e) => !!e && e.constructor === Array; | ||
function je(e) { | ||
return typeof e == "number" ? [e, e, e] : e instanceof ve ? [e.x, e.y, e.z] : e; | ||
} | ||
function Ee(e) { | ||
return e instanceof A ? e : Array.isArray(e) ? new A(...e) : new A(e); | ||
function J(e) { | ||
return e instanceof z ? e : Array.isArray(e) ? new z(...e) : new z(e); | ||
} | ||
const q = "[TresJS \u25B2 \u25A0 \u25CF] "; | ||
function $() { | ||
function ee() { | ||
function e(r, n) { | ||
console.error(`${q} ${r}`, n); | ||
console.error(`${q} ${r}`, n || ""); | ||
} | ||
@@ -80,3 +82,3 @@ function t(r) { | ||
} | ||
function u(r, n) { | ||
function a(r, n) { | ||
} | ||
@@ -86,66 +88,54 @@ return { | ||
logWarning: t, | ||
logMessage: u | ||
logMessage: a | ||
}; | ||
} | ||
const P = new ge(), k = L(!1); | ||
function b() { | ||
const { logMessage: e } = $(); | ||
function t() { | ||
P == null || P.clear(), k.value = !k.value, e("clear Scene", P); | ||
} | ||
return { | ||
isSceneReset: k, | ||
clearScene: t, | ||
scene: P | ||
}; | ||
} | ||
const Te = ["rotation", "scale", "position"]; | ||
function Le() { | ||
const { catalogue: e } = Re(), { logMessage: t, logError: u } = $(); | ||
const Be = ["rotation", "scale", "position"]; | ||
function Ae() { | ||
const { catalogue: e } = be(), { logMessage: t, logError: a } = ee(); | ||
function r() { | ||
return Object.entries(e).filter(([n, s]) => { | ||
var c, o; | ||
return (o = (c = s == null ? void 0 : s.prototype) == null ? void 0 : c.constructor) == null ? void 0 : o.toString().includes("class"); | ||
}).map(([n, s]) => { | ||
const c = J({ | ||
return Object.entries(e).filter(([n, o]) => { | ||
var p, s; | ||
return (s = (p = o == null ? void 0 : o.prototype) == null ? void 0 : p.constructor) == null ? void 0 : s.toString().includes("class"); | ||
}).map(([n, o]) => { | ||
const p = _({ | ||
name: n, | ||
setup(o, { slots: a, attrs: p, ...g }) { | ||
setup(s, { slots: i, attrs: l, ...d }) { | ||
t(n, { | ||
props: o, | ||
slots: a, | ||
attrs: p, | ||
ctx: g | ||
props: s, | ||
slots: i, | ||
attrs: l, | ||
ctx: d | ||
}); | ||
let f; | ||
const { scene: w } = b(), { pushCamera: S } = z(); | ||
function h() { | ||
if ((a == null ? void 0 : a.default) && (a == null ? void 0 : a.default())) { | ||
const M = a.default().map((i) => { | ||
var m; | ||
let y; | ||
return (m = i == null ? void 0 : i.props) != null && m.args ? y = new e[i.type.name](...i.props.args) : y = new e[i.type.name](), i != null && i.props && d(i.props, y), y; | ||
let m; | ||
const { scene: h } = oe(), { pushCamera: M } = Z(); | ||
function S() { | ||
if ((i == null ? void 0 : i.default) && (i == null ? void 0 : i.default())) { | ||
const C = i.default().map((c) => { | ||
var f; | ||
let w; | ||
return (f = c == null ? void 0 : c.props) != null && f.args ? w = new e[c.type.name](...c.props.args) : w = new e[c.type.name](), c != null && c.props && x(c.props, w), w; | ||
}); | ||
f = new s(...M); | ||
m = new o(...C); | ||
} else | ||
p.args ? f = new s(...p.args) : f = new s(); | ||
d(p, f), n === "PerspectiveCamera" || n === "OrtographicCamera" ? S(f) : w == null || w.add(f), t("Instance added", w), g.expose(f); | ||
l.args ? m = new o(...l.args) : m = new o(); | ||
x(l, m), n === "PerspectiveCamera" || n === "OrtographicCamera" ? M(m) : h == null || h.value.add(m), t("Instance added", h), d.expose(m); | ||
} | ||
function d(M, i) { | ||
Object.entries(M).forEach(([y, m]) => { | ||
const C = y.replace(/(-\w)/g, (O) => O[1].toUpperCase()); | ||
if (!(C === "args" || m === void 0)) { | ||
Te.includes(y) && m && (m = X(m)); | ||
function x(C, c) { | ||
Object.entries(C).forEach(([w, f]) => { | ||
const g = w.replace(/(-\w)/g, (E) => E[1].toUpperCase()); | ||
if (!(g === "args" || f === void 0)) { | ||
Be.includes(w) && f && (f = je(f)); | ||
try { | ||
i[C] && Pe(i[C].set) ? Q(m) ? i[C].set(...m) : i[C].set(m) : (m === "" && (m = !0), i[C] = m); | ||
} catch (O) { | ||
u(`There was an error setting ${C} property`, O); | ||
c[g] && Oe(c[g].set) ? k(f) ? c[g].set(...f) : c[g].set(f) : (f === "" && (f = !0), c[g] = f); | ||
} catch (E) { | ||
a(`There was an error setting ${g} property`, E); | ||
} | ||
} | ||
}), M.ref && (M.ref = i); | ||
}), C.ref && (C.ref = c); | ||
} | ||
return h(), () => { | ||
return S(), () => { | ||
}; | ||
} | ||
}); | ||
return [n, c]; | ||
return [n, p]; | ||
}); | ||
@@ -157,57 +147,66 @@ } | ||
} | ||
let G; | ||
function N(e, t, u) { | ||
const r = new he(), { scene: n } = b(), s = () => { | ||
const o = r.getElapsedTime(), a = r.getDelta(); | ||
n && (t && t(a, o), e(a, o), u && u(a, o)), G = requestAnimationFrame(s); | ||
const te = U(), ne = U(), re = U(), K = new Me(), { pause: Ie, resume: ze, isActive: De } = de( | ||
() => { | ||
const e = K.getElapsedTime(), t = K.getDelta(); | ||
te.trigger({ delta: t, elapsed: e }), ne.trigger({ delta: t, elapsed: e }), re.trigger({ delta: t, elapsed: e }); | ||
}, | ||
{ immediate: !1 } | ||
); | ||
function ae() { | ||
return { | ||
onBeforeLoop: te.on, | ||
onLoop: ne.on, | ||
onAfterLoop: re.on, | ||
pause: Ie, | ||
resume: ze, | ||
isActive: De | ||
}; | ||
s(); | ||
function c() { | ||
cancelAnimationFrame(G); | ||
} | ||
} | ||
const Fe = $(new Se()); | ||
function oe() { | ||
return { | ||
disposeLoop: c | ||
scene: Fe | ||
}; | ||
} | ||
function be() { | ||
const e = new we(), t = L(e); | ||
function Ne() { | ||
const e = new Y(), t = O(e); | ||
return { loadingManager: e, loadingManagerRef: t }; | ||
} | ||
async function Ie(e) { | ||
const { loadingManager: t } = be(), u = new ye(t), r = (n) => new Promise((s, c) => { | ||
u.load( | ||
async function Ge(e) { | ||
const t = new Y(), a = new ye(t), r = (n) => new Promise((o, p) => { | ||
a.load( | ||
n, | ||
(o) => s(o), | ||
(s) => o(s), | ||
() => null, | ||
() => { | ||
c(new Error("[useTextures] - Failed to load texture")); | ||
p(new Error("[useTextures] - Failed to load texture")); | ||
} | ||
); | ||
}); | ||
if (Q(e)) { | ||
const n = await Promise.all(e.map((s) => r(s))); | ||
if (k(e)) { | ||
const n = await Promise.all(e.map((o) => r(o))); | ||
return e.length > 1 ? n : n[0]; | ||
} else { | ||
const { map: n, displacementMap: s, normalMap: c, roughnessMap: o, metalnessMap: a, aoMap: p } = e; | ||
const { map: n, displacementMap: o, normalMap: p, roughnessMap: s, metalnessMap: i, aoMap: l } = e; | ||
return { | ||
map: n ? await r(n) : null, | ||
displacementMap: s ? await r(s) : null, | ||
normalMap: c ? await r(c) : null, | ||
roughnessMap: o ? await r(o) : null, | ||
metalnessMap: a ? await r(a) : null, | ||
aoMap: p ? await r(p) : null | ||
displacementMap: o ? await r(o) : null, | ||
normalMap: p ? await r(p) : null, | ||
roughnessMap: s ? await r(s) : null, | ||
metalnessMap: i ? await r(i) : null, | ||
aoMap: l ? await r(l) : null | ||
}; | ||
} | ||
} | ||
const T = ee({}); | ||
function Y() { | ||
function e(u) { | ||
return T[u]; | ||
const L = le({}); | ||
function Je() { | ||
function e(a) { | ||
return L[a]; | ||
} | ||
function t(u, r) { | ||
T[u] = r; | ||
function t(a, r) { | ||
L[a] = r; | ||
} | ||
return { | ||
state: T, | ||
...te(T), | ||
state: L, | ||
...fe(L), | ||
getState: e, | ||
@@ -217,131 +216,128 @@ setState: t | ||
} | ||
let l, H; | ||
function Oe(e, t) { | ||
const { width: u, height: r } = K(), { logMessage: n } = $(), s = v(() => u.value / r.value), { scene: c } = b(), { activeCamera: o } = z(), { setState: a } = Y(); | ||
a("scene", c), a("camera", o); | ||
function p() { | ||
l && (l.shadowMap.enabled = !0, l.shadowMap.type = Me); | ||
} | ||
function g() { | ||
l && (l.setSize(u.value, r.value), l.setPixelRatio(Math.min(window.devicePixelRatio, 2))); | ||
} | ||
function f() { | ||
l && (l.dispose(), l = null), n("disposeRenderer", l), H(); | ||
} | ||
F(s, g); | ||
function w() { | ||
if (n("Render init", { | ||
renderer: l, | ||
canvas: e, | ||
scene: c | ||
}), !l && e.value && c) { | ||
const h = { | ||
canvas: e.value, | ||
...t | ||
}; | ||
t != null && t.context && (h.context = t.context), l = new Ce(h), t != null && t.shadows && p(), l.physicallyCorrectLights = (t == null ? void 0 : t.physicallyCorrectLights) || !1, t != null && t.outputEncoding && (l.outputEncoding = t.outputEncoding), t != null && t.toneMapping && (l.toneMapping = t.toneMapping, l.toneMappingExposure = 1), g(), l.render(c, o.value), a("renderer", l), H = N(() => { | ||
c && l && l.render(c, o.value); | ||
}).disposeLoop; | ||
} | ||
a("loop", N); | ||
} | ||
function S(h) { | ||
l && l.setClearColor(Ee(h)); | ||
} | ||
return w(), { | ||
renderer: l, | ||
setClearColor: S, | ||
updateRenderer: g, | ||
disposeRenderer: f | ||
const u = $(), D = O(!1); | ||
function _e(e, t, a) { | ||
const { | ||
alpha: r = !1, | ||
antialias: n, | ||
depth: o, | ||
logarithmicDepthBuffer: p, | ||
failIfMajorPerformanceCaveat: s, | ||
precision: i, | ||
premultipliedAlpha: l, | ||
stencil: d, | ||
shadows: m = !1, | ||
shadowMapType: h = xe, | ||
physicallyCorrectLights: M = !1, | ||
outputEncoding: S = Ee, | ||
toneMapping: x = Pe, | ||
toneMappingExposure: C = 1, | ||
context: c = void 0, | ||
powerPreference: w = "default", | ||
preserveDrawingBuffer: f = !1, | ||
clearColor: g = J("#000000"), | ||
windowSize: E = !1 | ||
} = a, { width: j, height: B } = E ? X() : ge(t), { pixelRatio: V } = he(), { pause: se, resume: ie } = ae(), ce = F(() => j.value / B.value), W = () => { | ||
!u.value || (u.value.setSize(j.value, B.value), u.value.setPixelRatio(V.value)); | ||
}, H = () => { | ||
!u.value || (u.value.shadowMap.enabled = v(m), u.value.outputEncoding = v(S), u.value.shadowMap.type = v(h), u.value.physicallyCorrectLights = v(M), u.value.toneMapping = v(x), u.value.toneMappingExposure = v(C), u.value.setClearColor(J(v(g)))); | ||
}, ue = () => { | ||
const N = A(e); | ||
u.value || !N || (u.value = new Le({ | ||
canvas: N, | ||
alpha: r, | ||
antialias: n, | ||
context: c, | ||
depth: o, | ||
failIfMajorPerformanceCaveat: s, | ||
logarithmicDepthBuffer: p, | ||
powerPreference: w, | ||
precision: i, | ||
stencil: d, | ||
preserveDrawingBuffer: f, | ||
premultipliedAlpha: l | ||
}), H(), W(), ie(), D.value = !0); | ||
}, pe = () => { | ||
!u.value || (u.value.dispose(), u.value = void 0, D.value = !1, se()); | ||
}; | ||
return R([j, B, V], W), R( | ||
() => [ | ||
m, | ||
h, | ||
S, | ||
M, | ||
x, | ||
C, | ||
g | ||
], | ||
H | ||
), R( | ||
() => [e, t], | ||
() => { | ||
A(e) && A(t) && ue(); | ||
}, | ||
{ immediate: !0, deep: !0 } | ||
), { | ||
renderer: u, | ||
isReady: D, | ||
dispose: pe, | ||
aspectRatio: ce | ||
}; | ||
} | ||
const Z = /* @__PURE__ */ J({ | ||
__name: "TresCanvas", | ||
const $e = _({ | ||
name: "TresCanvas", | ||
props: { | ||
camera: null, | ||
ortographic: { type: Boolean }, | ||
gl: null, | ||
shadows: { type: Boolean, default: !1 }, | ||
physicallyCorrectLights: { type: Boolean, default: !1 }, | ||
outputEncoding: { default: Se }, | ||
alpha: { type: Boolean, default: !1 }, | ||
background: null, | ||
async: { type: Boolean, default: !1 } | ||
shadows: Boolean, | ||
shadowMapType: Object, | ||
physicallyCorrectLights: Boolean, | ||
outputEncoding: Object, | ||
toneMapping: Object, | ||
toneMappingExposure: Number, | ||
context: Object, | ||
powerPreference: Object, | ||
preserveDrawingBuffer: Boolean, | ||
clearColor: String, | ||
windowSize: Boolean | ||
}, | ||
setup(e) { | ||
const t = e; | ||
let u, r = () => { | ||
}; | ||
const n = L(), s = L(!0), { scene: c, clearScene: o } = b(), a = re(), p = ne(), { createCamera: g } = z(); | ||
let f; | ||
const w = Y(); | ||
ae("UseTresState", w.state); | ||
const S = a.default ? a == null ? void 0 : a.default().some( | ||
setup(e, { slots: t, attrs: a }) { | ||
const { logError: r } = ee(), n = O(), o = O(), { renderer: p, dispose: s, aspectRatio: i } = _e(n, o, e), l = $(); | ||
return T("camera", l), T("renderer", p), T("aspect-ratio", i), t.default && !t.default().some((d) => d.type.name === "Scene") && r("TresCanvas must contain a Scene component."), t.default && !t.default().some( | ||
(d) => d.type.name === "PerspectiveCamera" || d.type.name === "OrtographicCamera" | ||
) : !1; | ||
if (c && !S) | ||
if (t.camera) { | ||
const { position: d, ...M } = t.camera; | ||
if (f = g(t.ortographic === !0 ? E.Orthographic : E.Perspective, M || {}), d) { | ||
const i = X(d); | ||
f.position.set(i[0], i[1], i[2]); | ||
} | ||
c.add(f); | ||
} else | ||
f = g(t.ortographic === !0 ? E.Orthographic : E.Perspective, {}), f.position.set(5, 5, 5), c.add(f); | ||
F(t, () => { | ||
u && (r(), o(), h()); | ||
}); | ||
function h() { | ||
const d = Oe(n, { | ||
antialias: !0, | ||
physicallyCorrectLights: t.physicallyCorrectLights, | ||
shadows: t.shadows, | ||
context: t.gl || null, | ||
alpha: t.alpha | ||
}); | ||
u = d.renderer, r = d.disposeRenderer, t.background && d.setClearColor(t.background); | ||
} | ||
return oe(() => { | ||
h(); | ||
}), se(() => { | ||
o(), r(); | ||
}), (d, M) => { | ||
var i, y, m, C; | ||
return _(), j("div", { | ||
id: "tres-container", | ||
style: V({ | ||
position: "relative", | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
overflow: "hidden", | ||
width: ((y = (i = U(p)) == null ? void 0 : i.style) == null ? void 0 : y.width) || "100%", | ||
height: "100%" | ||
}) | ||
}, [ | ||
ce("canvas", { | ||
ref_key: "canvasRef", | ||
ref: n, | ||
style: V({ width: ((C = (m = U(p)) == null ? void 0 : m.style) == null ? void 0 : C.width) || "100%", height: "100%", overflow: "hidden" }) | ||
}, null, 4), | ||
e.async ? (_(), ie(le, { key: 0 }, { | ||
default: ue(() => [ | ||
s.value ? W(d.$slots, "default", { key: 0 }) : D("", !0) | ||
]), | ||
_: 3 | ||
})) : (_(), j(fe, { key: 1 }, [ | ||
s.value ? W(d.$slots, "default", { key: 0 }) : D("", !0) | ||
], 64)) | ||
], 4); | ||
) && r("Scene must contain a Camera component."), me(() => s()), () => { | ||
if (t.default) | ||
return G( | ||
"div", | ||
{ | ||
ref: o, | ||
style: { | ||
position: "relative", | ||
width: "100%", | ||
height: "100vh", | ||
...a.style | ||
} | ||
}, | ||
[ | ||
G("canvas", { | ||
ref: n, | ||
style: { width: "100%", height: "100%", position: "absolute", top: 0, left: 0 } | ||
}), | ||
t.default() | ||
] | ||
); | ||
}; | ||
} | ||
}), ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
default: Z | ||
}, Symbol.toStringTag, { value: "Module" })), ve = Symbol("UseTresState"), Fe = { | ||
}), Ue = _({ | ||
name: "Scene", | ||
setup(e, { slots: t }) { | ||
const { scene: a } = oe(), r = Q("renderer"), { activeCamera: n } = Z(), { onLoop: o } = ae(); | ||
return T("local-scene", a), o(() => { | ||
(r == null ? void 0 : r.value) && (n == null ? void 0 : n.value) && (a == null ? void 0 : a.value) && r.value.render(a == null ? void 0 : a.value, n.value); | ||
}), () => { | ||
if (t.default) | ||
return t.default(); | ||
}; | ||
} | ||
}), qe = Symbol("UseTresState"), Ke = { | ||
install(e) { | ||
e.component("TresCanvas", Z); | ||
const { createComponentInstances: t } = Le(); | ||
e.component("TresCanvas", $e), e.component("Scene", Ue); | ||
const { createComponentInstances: t } = Ae(); | ||
t().forEach(([r, n]) => { | ||
@@ -353,15 +349,14 @@ e.component(r, n); | ||
export { | ||
E as CameraType, | ||
ke as TresCanvas, | ||
ve as UseTresStateSymbol, | ||
Fe as default, | ||
z as useCamera, | ||
Re as useCatalog, | ||
Le as useInstanceCreator, | ||
be as useLoadingManager, | ||
N as useLoop, | ||
Oe as useRenderer, | ||
b as useScene, | ||
Ie as useTexture, | ||
Y as useTres | ||
Re as CameraType, | ||
qe as UseTresStateSymbol, | ||
Ke as default, | ||
Z as useCamera, | ||
be as useCatalog, | ||
Ae as useInstanceCreator, | ||
Ne as useLoadingManager, | ||
ae as useRenderLoop, | ||
_e as useRenderer, | ||
oe as useScene, | ||
Ge as useTexture, | ||
Je as useTres | ||
}; |
{ | ||
"name": "@tresjs/core", | ||
"description": "Declarative ThreeJS using Vue Components", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"type": "module", | ||
@@ -41,3 +41,3 @@ "author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", | ||
"@histoire/plugin-vue": "0.11.7", | ||
"@tresjs/cientos": "^0.2.0", | ||
"@tresjs/cientos": "^0.3.0", | ||
"@vitejs/plugin-vue": "^3.2.0", | ||
@@ -44,0 +44,0 @@ "@vitest/coverage-c8": "^0.25.1", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2146560
36
686