-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cf3abd
commit d53007e
Showing
13 changed files
with
203 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import DesktopInteractiveArea from '../src/components/Layouts/DesktopInteractiveArea.vue' | ||
import Stage from '../src/components/Widgets/Stage.vue' | ||
const dragDelay = ref(0) | ||
const isDragging = ref(false) | ||
function handleMouseDown() { | ||
dragDelay.value = window.setTimeout(() => { | ||
isDragging.value = true | ||
}, 500) | ||
} | ||
function handleMouseUp() { | ||
clearTimeout(dragDelay.value) | ||
isDragging.value = false | ||
} | ||
function handleMouseMove(event: MouseEvent) { | ||
if (isDragging.value) { | ||
window.electron.ipcRenderer.send('move-window', event.movementX, event.movementY) | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div relative max-h="[100vh]" max-w="[100vw]" p="2" flex="~ col" z-2 h-full overflow-hidden @mousedown="handleMouseDown" @mouseup="handleMouseUp" @mousemove="handleMouseMove"> | ||
<div relative h-full w-full items-end gap-2 class="view"> | ||
<Stage h-full w-full flex-1 mb="<md:18" /> | ||
<DesktopInteractiveArea class="interaction-area block" pointer-events-none absolute bottom-0 w-full opacity-0 transition="opacity duration-250" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="less" scoped> | ||
.view { | ||
&:hover { | ||
.interaction-area { | ||
opacity: 1; | ||
pointer-events: auto; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
import { app } from '../src/app' | ||
import { autoAnimatePlugin } from '@formkit/auto-animate/vue' | ||
import Tres from '@tresjs/core' | ||
import { MotionPlugin } from '@vueuse/motion' | ||
import { createPinia } from 'pinia' | ||
import { createApp } from 'vue' | ||
import { i18n } from '../src/modules/i18n' | ||
import App from './App.vue' | ||
|
||
import '@unocss/reset/tailwind.css' | ||
import 'uno.css' | ||
import './main.css' | ||
|
||
app.mount('#app') | ||
const pinia = createPinia() | ||
|
||
createApp(App) | ||
.use(MotionPlugin) | ||
.use(autoAnimatePlugin) | ||
.use(pinia) | ||
.use(i18n) | ||
.use(Tres) | ||
.mount('#app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,52 @@ | ||
import { app } from './app' | ||
import '@unocss/reset/tailwind.css' | ||
import './styles/main.css' | ||
import type { Router } from 'vue-router' | ||
import { autoAnimatePlugin } from '@formkit/auto-animate/vue' | ||
import Tres from '@tresjs/core' | ||
import { MotionPlugin } from '@vueuse/motion' | ||
import NProgress from 'nprogress' | ||
import { createPinia } from 'pinia' | ||
import { setupLayouts } from 'virtual:generated-layouts' | ||
import { createApp } from 'vue' | ||
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router' | ||
|
||
import 'uno.css' | ||
import { routes } from 'vue-router/auto-routes' | ||
|
||
app.mount('#app') | ||
import App from './App.vue' | ||
import { i18n } from './modules/i18n' | ||
|
||
const pinia = createPinia() | ||
const routeRecords = setupLayouts(routes) | ||
|
||
let router: Router | ||
if (import.meta.env.VITE_APP_TARGET_HUGGINGFACE_SPACE) | ||
router = createRouter({ routes: routeRecords, history: createWebHashHistory() }) | ||
else | ||
router = createRouter({ routes: routeRecords, history: createWebHistory() }) | ||
|
||
router.beforeEach((to, from) => { | ||
if (to.path !== from.path) | ||
NProgress.start() | ||
}) | ||
|
||
router.afterEach(() => { | ||
NProgress.done() | ||
}) | ||
|
||
router.isReady() | ||
.then(async () => { | ||
if (import.meta.env.VITE_APP_TARGET_HUGGINGFACE_SPACE) { | ||
return | ||
} | ||
|
||
const { registerSW } = await import('virtual:pwa-register') | ||
registerSW({ immediate: true }) | ||
}) | ||
.catch(() => {}) | ||
|
||
createApp(App) | ||
.use(MotionPlugin) | ||
.use(autoAnimatePlugin) | ||
.use(router) | ||
.use(pinia) | ||
.use(i18n) | ||
.use(Tres) | ||
.mount('#app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import JSZip from 'jszip' | ||
import { ZipLoader } from 'pixi-live2d-display/cubism4' | ||
|
||
ZipLoader.zipReader = (data: Blob, _url: string) => JSZip.loadAsync(data) | ||
|
||
ZipLoader.readText = (jsZip: JSZip, path: string) => { | ||
const file = jsZip.file(path) | ||
|
||
if (!file) { | ||
throw new Error(`Cannot find file: ${path}`) | ||
} | ||
|
||
return file.async('text') | ||
} | ||
|
||
ZipLoader.getFilePaths = (jsZip: JSZip) => { | ||
const paths: string[] = [] | ||
|
||
jsZip.forEach(relativePath => paths.push(relativePath)) | ||
|
||
return Promise.resolve(paths) | ||
} | ||
|
||
ZipLoader.getFiles = (jsZip: JSZip, paths: string[]) => | ||
Promise.all(paths.map( | ||
async (path) => { | ||
const fileName = path.slice(path.lastIndexOf('/') + 1) | ||
|
||
const blob = await jsZip.file(path)!.async('blob') | ||
|
||
return new File([blob], fileName) | ||
}, | ||
)) |
Oops, something went wrong.