Skip to content

Commit

Permalink
fix: 83 trescanvas component is missing template or render function a…
Browse files Browse the repository at this point in the history
…fter 3100 (#84)

* chore: update to v3.10.0

* chore: better playground

* chore: update all and test removing the server placeholder and some properties

* fix: replace TresCanvas with runtime SSR version

* chore: expose TresCanvas client and server + ssr build variants

* chore: remove v-bind

* chore: expose tres canvas core types

* chore: revert back client/server TresCanvas and include dts

* chore: remove extra client registration on ssr

* chore: remove promise.all

* chore: revert back ssr pair components and remove comment

* chore: simplify components registration

---------

Co-authored-by: userquin <userquin@gmail.com>
  • Loading branch information
alvarosabu and userquin authored Feb 7, 2024
1 parent f54128b commit faca608
Show file tree
Hide file tree
Showing 15 changed files with 1,989 additions and 2,531 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
},
"dependencies": {
"@nuxt/devtools-kit": "^1.0.8",
"@nuxt/kit": "^3.9.3",
"@nuxt/kit": "^3.10.0",
"@nuxt/ui": "^2.13.0",
"@tresjs/core": "3.7.0",
"@tresjs/nuxt": "2.0.2",
"@tresjs/nuxt": "2.1.0",
"@types/three": "^0.160.0",
"@unocss/nuxt": "^0.58.4",
"defu": "^6.1.4",
Expand All @@ -63,22 +63,22 @@
"@alvarosabu/eslint-config-vue": "^0.4.0",
"@iconify-json/carbon": "^1.1.28",
"@iconify-json/file-icons": "^1.1.8",
"@iconify-json/iconoir": "^1.1.39",
"@iconify-json/iconoir": "^1.1.40",
"@iconify-json/ph": "^1.1.10",
"@nuxt/devtools-ui-kit": "^1.0.8",
"@nuxt/eslint-config": "^0.2.0",
"@nuxt/module-builder": "^0.5.5",
"@nuxt/schema": "^3.9.3",
"@nuxt/schema": "^3.10.0",
"@nuxt/test-utils": "^3.11.0",
"@release-it/conventional-changelog": "^8.0.1",
"@types/node": "^20.11.10",
"@types/node": "^20.11.13",
"changelogen": "^0.5.5",
"eslint": "^8.56.0",
"nuxt": "^3.9.3",
"nuxt": "^3.10.0",
"nuxt-icon": "^0.6.8",
"playwright": "^1.41.1",
"release-it": "^17.0.3",
"three": "^0.160.1",
"three": "^0.161.0",
"vitest": "^1.2.2"
},
"build": {
Expand Down
51 changes: 4 additions & 47 deletions playground/app.vue
Original file line number Diff line number Diff line change
@@ -1,48 +1,5 @@
<script setup lang="ts">
import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'
const gl = reactive({
clearColor: '#18181B',
shadows: true,
alpha: false,
shadowMapType: BasicShadowMap,
outputColorSpace: SRGBColorSpace,
toneMapping: NoToneMapping,
})
const showCube = ref(false)
setTimeout(() => {
showCube.value = true
}, 5000)
</script>

<template>
<div style="height: 100vh">
<TresCanvas v-bind="gl">
<TresPerspectiveCamera
:position="[-5.3, 8.3, 10.6]"
:look-at="[0, 0, 0]"
/>
<OrbitControls />
<TresAmbientLight
:color="0xffffff"
:intensity="0.5"
/>
<Suspense>
<NuxtStones v-if="showCube" />
</Suspense>
<ShaderBall />
</TresCanvas>
</div>
</template>

<style>
html,
body {
background: "#18181B";
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</template>
44 changes: 44 additions & 0 deletions playground/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script setup lang="ts">
</script>

<template>
<div>
<header class="menu">
<div>
<NuxtLink to="/">
Home
</NuxtLink>
</div>
<div>
<NuxtLink
to="/page1"
:prefetch="false"
>
page1
</NuxtLink>
</div>
<div>
<a href="/page2">
page2
</a>
</div>
</header>
<slot />
</div>
</template>

<style>
.menu {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 3rem;
color: #fff;
display: flex;
justify-content: space-around;
align-items: center;
z-index: 100;
}
</style>
12 changes: 12 additions & 0 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
export default defineNuxtConfig({
ssr: true,
modules: ['../src/module', '@nuxt/devtools'],
// for testing purposes
// imports: {
// autoImport: false,
// },
tres: {
// for testing purposes, and so we test both deduplication + auto-detection capabilities
modules: ['@tresjs/cientos'],
devtools: true,
glsl: true,
},
// for testing purposes: include some nuxt build tests
nitro: {
routeRules: {
'/page1': { ssr: false }, // <== client rendered page
'/page2': { prerender: true }, // <== server SSG page + payload
},
},
})
8 changes: 4 additions & 4 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"generate": "nuxi generate"
},
"devDependencies": {
"@nuxt/devtools": "1.0.4",
"@tresjs/cientos": "^3.6.0",
"@nuxt/devtools": "1.0.8",
"@tresjs/cientos": "^3.7.0",
"@tresjs/post-processing": "^0.7.0",
"nuxt": "^3.8.2",
"nuxt": "^3.10.0",
"postprocessing": "^6.33.4",
"tweakpane": "^4.0.1"
"tweakpane": "^4.0.3"
}
}
14 changes: 14 additions & 0 deletions playground/pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
// for testing purposes with auto-import disabled
// import { TresCanvas } from '#components'
</script>

<template>
<TresCanvas window-size>
<TresPerspectiveCamera />
<TresMesh>
<TresTorusGeometry :args="[1, 0.5, 16, 32]" />
<TresMeshBasicMaterial color="orange" />
</TresMesh>
</TresCanvas>
</template>
24 changes: 24 additions & 0 deletions playground/pages/page1.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script setup lang="ts">
// for testing purposes with auto-import disabled
// import { TresCanvas } from '#components'
// import { onMounted, useRenderLoop } from '#imports'
const { resume } = useRenderLoop()
onMounted(() => {
resume()
})
</script>

<template>
<TresCanvas
:window-size="true"
clear-color="#82CDef"
>
<TresPerspectiveCamera />
<TresMesh>
<TresTorusGeometry :args="[1, 0.5, 16, 32]" />
<TresMeshBasicMaterial color="blue" />
</TresMesh>
</TresCanvas>
</template>
14 changes: 14 additions & 0 deletions playground/pages/page2.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
// for testing purposes with auto-import disabled
// import { TresCanvas } from '#components'
</script>

<template>
<TresCanvas window-size>
<TresPerspectiveCamera />
<TresMesh>
<TresTorusGeometry :args="[1, 0.5, 16, 32]" />
<TresMeshBasicMaterial color="pink" />
</TresMesh>
</TresCanvas>
</template>
Loading

0 comments on commit faca608

Please sign in to comment.