add licenses to frontend

This commit is contained in:
Yeicor
2024-02-24 11:44:53 +01:00
parent 5701aaad27
commit 4d529aec66
10 changed files with 4350 additions and 25 deletions

10
.generatelicensefile.json Normal file
View File

@@ -0,0 +1,10 @@
{
"append": [
"assets/fox.glb.license",
"LICENSE"
],
"replace": {
"bare-path@2.1.0": "./node_modules/bare-path/LICENSE",
"rc@1.2.8": "./node_modules/rc/LICENSE.MIT"
}
}

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Yeicor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2960
assets/licenses.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,8 @@
"author": "Yeicor",
"scripts": {
"start": "parcel src/index.html",
"build": "parcel build src/index.html --reporter @parcel/reporter-bundle-analyzer --detailed-report"
"build": "yarn update-licenses && parcel build src/index.html --reporter @parcel/reporter-bundle-analyzer --detailed-report",
"update-licenses": "generate-license-file --input package.json --output assets/licenses.txt --overwrite"
},
"dependencies": {
"@gltf-transform/core": "^3.10.0",
@@ -29,6 +30,7 @@
"@types/node": "^20.11.17",
"@types/three": "^0.160.0",
"buffer": "^5.5.0||^6.0.0",
"generate-license-file": "^3.0.1",
"parcel": "^2.11.0"
}
}

View File

@@ -16,21 +16,21 @@ const openIcon = props.side === 'left' ? mdiChevronRight : mdiChevronLeft;
</script>
<template>
<v-btn icon="" @click="opened = !opened" class="open-button" :class="side">
<v-btn icon @click="opened = !opened" class="open-button" :class="side">
<svg-icon type="mdi" :path="openIcon"/>
</v-btn>
<v-navigation-drawer v-model="opened" permanent :location="side" :width="props.width">
<v-toolbar density="compact">
<v-toolbar-items v-if="side == 'right'">
<slot name="toolbar-items"></slot>
<v-btn icon="" @click="opened = !opened">
<v-btn icon @click="opened = !opened">
<svg-icon type="mdi" :path="mdiClose"/>
</v-btn>
</v-toolbar-items>
<slot name="toolbar"></slot>
<v-toolbar-items v-if="side == 'left'">
<slot name="toolbar-items"></slot>
<v-btn icon="" @click="opened = !opened">
<v-btn icon @click="opened = !opened">
<svg-icon type="mdi" :path="mdiClose"/>
</v-btn>
</v-toolbar-items>

View File

@@ -11,20 +11,20 @@ let io = new WebIO();
* Remember to call mergeFinalize after all models have been merged (slower required operations).
*/
export async function mergePartial(glb: Uint8Array, name: string, document: Document): Promise<Document> {
// Load the new document
let newDoc = await io.readBinary(glb);
// Remove any previous model with the same name and ensure consistent names
// noinspection TypeScriptValidateJSTypes
await newDoc.transform(dropByName(name), setNames(name));
let merged = document.merge(newDoc);
// noinspection TypeScriptValidateJSTypes
return await merged.transform(mergeScenes()); // Single scene & buffer required!
// Merge the new document into the current one
return document.merge(newDoc);
}
export async function mergeFinalize(document: Document): Promise<Document> {
return await document.transform(unpartition());
// Single scene & buffer required before loading & rendering
return await document.transform(mergeScenes(), unpartition());
}
export async function toBuffer(doc: Document): Promise<Uint8Array> {

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
// License text for all dependencies, only downloaded when/if needed
// @ts-ignore
const licenseText = await import("bundle-text:../../assets/licenses.txt");
</script>
<template>
<pre class="license-text" v-html="licenseText"/>
</template>
<style scoped>
.license-text {
white-space: pre-wrap;
}
</style>

View File

@@ -128,7 +128,7 @@ function toggleSelection() {
<template>
<div class="select-parent">
<v-btn icon="" @click="toggleSelection" :variant="selectionEnabled ? 'tonal' : 'elevated'">
<v-btn icon @click="toggleSelection" :variant="selectionEnabled ? 'tonal' : 'elevated'">
<svg-icon type="mdi" :path="mdiCursorDefaultClick"/>
</v-btn>
<v-select class="select-only" variant="underlined" :items="['Faces', 'Edges', 'Vertices']" v-model="selectFilter"/>

View File

@@ -1,16 +1,26 @@
<script setup lang="ts">
import {VBtn, VDivider} from "vuetify/lib/components";
import {
VBtn,
VCard,
VCardText,
VDialog,
VDivider,
VSpacer,
VToolbar,
VToolbarTitle
} from "vuetify/lib/components";
import {Ref, ref, Suspense} from "vue";
import OrientationGizmo from "./OrientationGizmo.vue";
import type {PerspectiveCamera} from "three/src/cameras/PerspectiveCamera";
import {OrthographicCamera} from "three/src/cameras/OrthographicCamera";
import {mdiCrosshairsGps, mdiDownload, mdiGithub, mdiProjector} from '@mdi/js'
import {mdiClose, mdiCrosshairsGps, mdiDownload, mdiGithub, mdiLicense, mdiProjector} from '@mdi/js'
import SvgIcon from '@jamescoyle/vue-icon/lib/svg-icon.vue';
import {SceneMgrRefData} from "../misc/scene";
import type {ModelViewerElement} from '@google/model-viewer';
import type {Intersection} from "three";
import type {MObject3D} from "./Selection.vue";
import Selection from "./Selection.vue";
import LicensesDialogContent from "./LicensesDialogContent.vue";
let props = defineProps<{ refSData: SceneMgrRefData }>();
@@ -77,10 +87,10 @@ async function openGithub() {
<orientation-gizmo :scene="props.refSData.viewerScene" v-if="props.refSData.viewerScene !== null"/>
<v-divider/>
<h5>Camera</h5>
<v-btn icon="" @click="toggleProjection"><span class="icon-detail">{{ toggleProjectionText }}</span>
<v-btn icon @click="toggleProjection"><span class="icon-detail">{{ toggleProjectionText }}</span>
<svg-icon type="mdi" :path="mdiProjector"></svg-icon>
</v-btn>
<v-btn icon="" @click="centerCamera">
<v-btn icon @click="centerCamera">
<svg-icon type="mdi" :path="mdiCrosshairsGps"/>
</v-btn>
<v-divider/>
@@ -90,11 +100,37 @@ async function openGithub() {
<template #fallback>Loading...</template>
</Suspense>
<v-divider/>
<v-spacer></v-spacer>
<h5>Extras</h5>
<v-btn icon="" @click="downloadSceneGlb">
<v-btn icon @click="downloadSceneGlb">
<svg-icon type="mdi" :path="mdiDownload"/>
</v-btn>
<v-btn icon="" @click="openGithub">
<v-dialog id="licenses-dialog" fullscreen>
<template v-slot:activator="{ props }">
<v-btn icon v-bind="props">
<svg-icon type="mdi" :path="mdiLicense"/>
</v-btn>
</template>
<template v-slot:default="{ isActive }">
<v-card>
<v-toolbar>
<v-toolbar-title>Licenses</v-toolbar-title>
<v-spacer>
</v-spacer>
<v-btn icon @click="isActive.value = false">
<svg-icon type="mdi" :path="mdiClose"/>
</v-btn>
</v-toolbar>
<v-card-text>
<Suspense>
<licenses-dialog-content/>
<template #fallback>Loading...</template>
</Suspense>
</v-card-text>
</v-card>
</template>
</v-dialog>
<v-btn icon @click="openGithub">
<svg-icon type="mdi" :path="mdiGithub"/>
</v-btn>
<!-- TODO: Licenses button -->

1297
yarn.lock

File diff suppressed because it is too large Load Diff