From e9b24fd333539fea727f8e9af4e57f9b596d6f97 Mon Sep 17 00:00:00 2001 From: Yeicor <4929005+Yeicor@users.noreply.github.com> Date: Sat, 10 Feb 2024 19:20:05 +0100 Subject: [PATCH] optimize build size 2 --- package.json | 7 +------ src/App.vue | 7 +++++-- src/ModelViewer.vue | 18 ------------------ src/ModelViewerOverlay.vue | 2 +- src/OrientationGizmo.vue | 2 +- src/Tools.vue | 1 + src/index.html | 1 - src/index.ts | 6 ++++-- src/shims.d.ts | 5 ++++- 9 files changed, 17 insertions(+), 32 deletions(-) delete mode 100644 src/ModelViewer.vue diff --git a/package.json b/package.json index d0a988b..fe8e9ee 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,5 @@ "@types/three": "^0.160.0", "buffer": "^5.5.0||^6.0.0", "parcel": "^2.11.0" - }, - "browserslist": [ - "> 0.5%", - "last 2 versions", - "not dead" - ] + } } diff --git a/src/App.vue b/src/App.vue index 511d87f..57783ec 100644 --- a/src/App.vue +++ b/src/App.vue @@ -35,7 +35,7 @@ let modelViewerInfo: Ref = ref(null); console.log('Model-Viewer finished loading:', args) modelViewerInfo = args }"/> - + @@ -63,8 +63,11 @@ let modelViewerInfo: Ref = ref(null); diff --git a/src/ModelViewer.vue b/src/ModelViewer.vue deleted file mode 100644 index 4c2390d..0000000 --- a/src/ModelViewer.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/ModelViewerOverlay.vue b/src/ModelViewerOverlay.vue index 8d359d4..6b9875f 100644 --- a/src/ModelViewerOverlay.vue +++ b/src/ModelViewerOverlay.vue @@ -26,7 +26,7 @@ top: 0; left: 0; width: 100%; - height: 100vh; + height: 100dvh; pointer-events: none; } diff --git a/src/OrientationGizmo.vue b/src/OrientationGizmo.vue index 3a57a30..58f68a7 100644 --- a/src/OrientationGizmo.vue +++ b/src/OrientationGizmo.vue @@ -59,7 +59,7 @@ function updateGizmo() { let reinstall = () => { if (gizmo) container.value.removeChild(gizmo); - gizmo = createGizmo(container.value, props.scene) as typeof gizmo; + gizmo = createGizmo(container.value, props.scene as ModelScene) as typeof gizmo; container.value.appendChild(gizmo); requestIdleCallback(updateGizmo); // Low priority updates } diff --git a/src/Tools.vue b/src/Tools.vue index bcb393c..d3b54ac 100644 --- a/src/Tools.vue +++ b/src/Tools.vue @@ -8,6 +8,7 @@ const props = defineProps({ function toggleProjection() { if (!props.modelViewerInfo) return; + console.log('Toggling projection', props.modelViewerInfo); } diff --git a/src/index.html b/src/index.html index 4f3526c..b292e5e 100644 --- a/src/index.html +++ b/src/index.html @@ -7,6 +7,5 @@ -
\ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 9f8a499..ce6d3cd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,8 +8,6 @@ import {createApp} from 'vue' import App from './App.vue' import {createVuetify} from 'vuetify'; -import 'vuetify/lib/styles/main.sass'; -import '@mdi/font/css/materialdesignicons.css' import * as directives from 'vuetify/lib/directives'; const vuetify = createVuetify({ @@ -23,3 +21,7 @@ const app = createApp(App) app.use(vuetify) // noinspection JSUnresolvedReference app.mount('body') + +// Start non-blocking loading of Vuetify and icon styles +import('vuetify/lib/styles/main.sass'); +import('@mdi/font/css/materialdesignicons.css'); \ No newline at end of file diff --git a/src/shims.d.ts b/src/shims.d.ts index f911e13..a6ea82d 100644 --- a/src/shims.d.ts +++ b/src/shims.d.ts @@ -1,3 +1,6 @@ // Avoids typescript error when importing files declare module '*.vue' -declare module 'three-orientation-gizmo/src/OrientationGizmo' \ No newline at end of file +declare module 'three-orientation-gizmo/src/OrientationGizmo' +declare module 'vuetify/lib/styles/main.sass' +declare module '@mdi/font/css/materialdesignicons.css' +declare module 'vuetify/lib/directives' \ No newline at end of file