2020-10-17 20:12:00 +09:00
|
|
|
<template>
|
2021-12-03 22:09:40 +09:00
|
|
|
<div class="gbhvwtnk" :class="{ wallpaper }" :style="`--globalHeaderHeight:${globalHeaderHeight}px`">
|
2021-10-09 12:33:08 +09:00
|
|
|
<XHeaderMenu v-if="showMenuOnTop" v-get-size="(w, h) => globalHeaderHeight = h"/>
|
2021-07-19 11:36:35 +09:00
|
|
|
|
|
|
|
<div class="columns" :class="{ fullView, withGlobalHeader: showMenuOnTop }">
|
2021-12-03 22:09:40 +09:00
|
|
|
<div v-if="!showMenuOnTop" class="sidebar">
|
|
|
|
<XSidebar/>
|
|
|
|
</div>
|
|
|
|
<div v-else ref="widgetsLeft" class="widgets left">
|
2022-12-27 14:55:11 +09:00
|
|
|
<XWidgets place="left" @mounted="attachSticky(widgetsLeft)"/>
|
2021-12-03 22:09:40 +09:00
|
|
|
</div>
|
2021-04-10 12:40:50 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
<main class="main" :style="{ background: pageMetadata?.value?.bg }" @contextmenu.stop="onContextmenu">
|
2021-10-23 23:22:20 +09:00
|
|
|
<div class="content">
|
2022-06-20 17:38:49 +09:00
|
|
|
<RouterView/>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
</main>
|
2020-10-25 01:21:41 +09:00
|
|
|
|
2021-11-19 19:36:12 +09:00
|
|
|
<div v-if="isDesktop" ref="widgetsRight" class="widgets right">
|
2022-12-27 14:55:11 +09:00
|
|
|
<XWidgets :place="showMenuOnTop ? 'right' : null" @mounted="attachSticky(widgetsRight)"/>
|
2021-04-10 12:40:50 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
|
2022-01-25 23:18:21 +09:00
|
|
|
<transition :name="$store.state.animation ? 'tray-back' : ''">
|
2022-06-20 17:38:49 +09:00
|
|
|
<div
|
|
|
|
v-if="widgetsShowing"
|
2021-11-19 19:36:12 +09:00
|
|
|
class="tray-back _modalBg"
|
2020-10-17 20:12:00 +09:00
|
|
|
@click="widgetsShowing = false"
|
|
|
|
@touchstart.passive="widgetsShowing = false"
|
|
|
|
></div>
|
|
|
|
</transition>
|
|
|
|
|
2022-01-25 23:18:21 +09:00
|
|
|
<transition :name="$store.state.animation ? 'tray' : ''">
|
2020-10-17 20:12:00 +09:00
|
|
|
<XWidgets v-if="widgetsShowing" class="tray"/>
|
|
|
|
</transition>
|
|
|
|
|
2021-11-19 19:36:12 +09:00
|
|
|
<iframe v-if="$store.state.aiChanMode" ref="live2d" class="ivnzpscs" src="https://misskey-dev.github.io/mascot-web/?scale=2&y=1.4"></iframe>
|
2021-09-04 17:54:24 +09:00
|
|
|
|
2020-10-25 01:21:41 +09:00
|
|
|
<XCommon/>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { defineAsyncComponent, markRaw, ComputedRef, ref, onMounted, provide } from 'vue';
|
2021-10-24 14:50:00 +09:00
|
|
|
import XSidebar from './classic.sidebar.vue';
|
2020-10-25 01:21:41 +09:00
|
|
|
import XCommon from './_common_/common.vue';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { instanceName } from '@/config';
|
|
|
|
import { StickySidebar } from '@/scripts/sticky-sidebar';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as os from '@/os';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { mainRouter } from '@/router';
|
|
|
|
import { PageMetadata, provideMetadataReceiver, setPageMetadata } from '@/scripts/page-metadata';
|
|
|
|
import { defaultStore } from '@/store';
|
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
const XHeaderMenu = defineAsyncComponent(() => import('./classic.header.vue'));
|
2022-12-27 14:55:11 +09:00
|
|
|
const XWidgets = defineAsyncComponent(() => import('./universal.widgets.vue'));
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
const DESKTOP_THRESHOLD = 1100;
|
|
|
|
|
2022-06-30 00:44:03 +09:00
|
|
|
let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD);
|
2022-06-20 17:38:49 +09:00
|
|
|
|
|
|
|
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
|
2022-07-04 23:22:11 +09:00
|
|
|
let widgetsShowing = $ref(false);
|
|
|
|
let fullView = $ref(false);
|
2022-06-20 17:38:49 +09:00
|
|
|
let globalHeaderHeight = $ref(0);
|
|
|
|
const wallpaper = localStorage.getItem('wallpaper') != null;
|
|
|
|
const showMenuOnTop = $computed(() => defaultStore.state.menuDisplay === 'top');
|
|
|
|
let live2d = $ref<HTMLIFrameElement>();
|
|
|
|
let widgetsLeft = $ref();
|
|
|
|
let widgetsRight = $ref();
|
|
|
|
|
|
|
|
provide('router', mainRouter);
|
|
|
|
provideMetadataReceiver((info) => {
|
|
|
|
pageMetadata = info;
|
|
|
|
if (pageMetadata.value) {
|
|
|
|
document.title = `${pageMetadata.value.title} | ${instanceName}`;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
provide('shouldHeaderThin', showMenuOnTop);
|
|
|
|
provide('shouldSpacerMin', true);
|
|
|
|
|
|
|
|
function attachSticky(el) {
|
|
|
|
const sticky = new StickySidebar(el, defaultStore.state.menuDisplay === 'top' ? 0 : 16, defaultStore.state.menuDisplay === 'top' ? 60 : 0); // TODO: ヘッダーの高さを60pxと決め打ちしているのを直す
|
|
|
|
window.addEventListener('scroll', () => {
|
|
|
|
sticky.calc(window.scrollY);
|
|
|
|
}, { passive: true });
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
function top() {
|
|
|
|
window.scroll({ top: 0, behavior: 'smooth' });
|
|
|
|
}
|
2021-09-04 17:54:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
function onContextmenu(ev: MouseEvent) {
|
|
|
|
const isLink = (el: HTMLElement) => {
|
|
|
|
if (el.tagName === 'A') return true;
|
|
|
|
if (el.parentElement) {
|
|
|
|
return isLink(el.parentElement);
|
2021-09-04 17:54:24 +09:00
|
|
|
}
|
2022-06-20 17:38:49 +09:00
|
|
|
};
|
|
|
|
if (isLink(ev.target)) return;
|
|
|
|
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(ev.target.tagName) || ev.target.attributes['contenteditable']) return;
|
|
|
|
if (window.getSelection().toString() !== '') return;
|
|
|
|
const path = mainRouter.getCurrentPath();
|
|
|
|
os.contextMenu([{
|
|
|
|
type: 'label',
|
|
|
|
text: path,
|
|
|
|
}, {
|
|
|
|
icon: fullView ? 'fas fa-compress' : 'fas fa-expand',
|
|
|
|
text: fullView ? i18n.ts.quitFullView : i18n.ts.fullView,
|
|
|
|
action: () => {
|
|
|
|
fullView = !fullView;
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
2022-06-20 17:38:49 +09:00
|
|
|
}, {
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-window-maximize',
|
2022-06-20 17:38:49 +09:00
|
|
|
text: i18n.ts.openInWindow,
|
|
|
|
action: () => {
|
|
|
|
os.pageWindow(path);
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
2022-06-20 17:38:49 +09:00
|
|
|
}], ev);
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
function onAiClick(ev) {
|
|
|
|
//if (this.live2d) this.live2d.click(ev);
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
if (window.innerWidth < 1024) {
|
|
|
|
localStorage.setItem('ui', 'default');
|
|
|
|
location.reload();
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
document.documentElement.style.overflowY = 'scroll';
|
|
|
|
|
|
|
|
if (defaultStore.state.widgets.length === 0) {
|
|
|
|
defaultStore.set('widgets', [{
|
|
|
|
name: 'calendar',
|
|
|
|
id: 'a', place: null, data: {},
|
|
|
|
}, {
|
|
|
|
name: 'notifications',
|
|
|
|
id: 'b', place: null, data: {},
|
|
|
|
}, {
|
|
|
|
name: 'trends',
|
|
|
|
id: 'c', place: null, data: {},
|
|
|
|
}]);
|
|
|
|
}
|
2021-09-04 17:54:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
onMounted(() => {
|
|
|
|
window.addEventListener('resize', () => {
|
|
|
|
isDesktop = (window.innerWidth >= DESKTOP_THRESHOLD);
|
|
|
|
}, { passive: true });
|
|
|
|
|
|
|
|
if (defaultStore.state.aiChanMode) {
|
|
|
|
const iframeRect = live2d.getBoundingClientRect();
|
|
|
|
window.addEventListener('mousemove', ev => {
|
|
|
|
live2d.contentWindow.postMessage({
|
|
|
|
type: 'moveCursor',
|
|
|
|
body: {
|
|
|
|
x: ev.clientX - iframeRect.left,
|
|
|
|
y: ev.clientY - iframeRect.top,
|
|
|
|
},
|
|
|
|
}, '*');
|
|
|
|
}, { passive: true });
|
|
|
|
window.addEventListener('touchmove', ev => {
|
|
|
|
live2d.contentWindow.postMessage({
|
|
|
|
type: 'moveCursor',
|
|
|
|
body: {
|
|
|
|
x: ev.touches[0].clientX - iframeRect.left,
|
|
|
|
y: ev.touches[0].clientY - iframeRect.top,
|
|
|
|
},
|
|
|
|
}, '*');
|
|
|
|
}, { passive: true });
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.tray-enter-active,
|
|
|
|
.tray-leave-active {
|
|
|
|
opacity: 1;
|
|
|
|
transform: translateX(0);
|
|
|
|
transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1), opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
|
|
}
|
|
|
|
.tray-enter-from,
|
|
|
|
.tray-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
transform: translateX(240px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.tray-back-enter-active,
|
|
|
|
.tray-back-leave-active {
|
|
|
|
opacity: 1;
|
|
|
|
transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
|
|
}
|
|
|
|
.tray-back-enter-from,
|
|
|
|
.tray-back-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2021-12-03 22:09:40 +09:00
|
|
|
.gbhvwtnk {
|
2021-04-10 12:40:50 +09:00
|
|
|
$ui-font-size: 1em;
|
|
|
|
$widgets-hide-threshold: 1200px;
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-11-13 11:43:23 +09:00
|
|
|
min-height: 100dvh;
|
2020-10-17 20:12:00 +09:00
|
|
|
box-sizing: border-box;
|
|
|
|
|
2020-11-28 13:30:09 +09:00
|
|
|
&.wallpaper {
|
|
|
|
background: var(--wallpaperOverlay);
|
2021-08-11 22:34:45 +09:00
|
|
|
//backdrop-filter: var(--blur, blur(4px));
|
2020-11-28 13:30:09 +09:00
|
|
|
}
|
|
|
|
|
2021-04-10 12:40:50 +09:00
|
|
|
> .columns {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
max-width: 100%;
|
2021-04-23 11:31:43 +09:00
|
|
|
//margin: 32px 0;
|
2021-04-10 12:40:50 +09:00
|
|
|
|
2021-04-12 00:05:13 +09:00
|
|
|
&.fullView {
|
|
|
|
margin: 0;
|
|
|
|
|
|
|
|
> .sidebar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .widgets {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
margin: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-10 12:40:50 +09:00
|
|
|
> .main {
|
2021-04-13 01:59:18 +09:00
|
|
|
min-width: 0;
|
2021-04-10 12:40:50 +09:00
|
|
|
width: 750px;
|
|
|
|
margin: 0 16px 0 0;
|
2021-08-05 22:43:14 +09:00
|
|
|
background: var(--panel);
|
2021-08-07 22:06:50 +09:00
|
|
|
border-left: solid 1px var(--divider);
|
|
|
|
border-right: solid 1px var(--divider);
|
2021-04-23 11:31:43 +09:00
|
|
|
border-radius: 0;
|
2022-07-13 21:41:06 +09:00
|
|
|
overflow: clip;
|
2021-04-10 12:40:50 +09:00
|
|
|
--margin: 12px;
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
2020-10-25 01:21:41 +09:00
|
|
|
|
2021-04-10 12:40:50 +09:00
|
|
|
> .widgets {
|
2021-07-27 21:37:32 +09:00
|
|
|
//--panelBorder: none;
|
2021-04-16 15:44:17 +09:00
|
|
|
width: 300px;
|
2021-04-23 11:31:43 +09:00
|
|
|
margin-top: 16px;
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2021-04-10 12:40:50 +09:00
|
|
|
@media (max-width: $widgets-hide-threshold) {
|
|
|
|
display: none;
|
|
|
|
}
|
2021-07-19 11:36:35 +09:00
|
|
|
|
|
|
|
&.left {
|
|
|
|
margin-right: 16px;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
|
|
|
|
2021-04-23 11:31:43 +09:00
|
|
|
> .sidebar {
|
|
|
|
margin-top: 16px;
|
|
|
|
}
|
|
|
|
|
2021-07-19 11:36:35 +09:00
|
|
|
&.withGlobalHeader {
|
|
|
|
> .main {
|
2021-07-27 21:37:32 +09:00
|
|
|
margin-top: 0;
|
2021-08-07 22:06:50 +09:00
|
|
|
border: solid 1px var(--divider);
|
2021-07-19 11:36:35 +09:00
|
|
|
border-radius: var(--radius);
|
2021-10-09 12:33:08 +09:00
|
|
|
--stickyTop: var(--globalHeaderHeight);
|
2021-07-19 11:36:35 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
> .widgets {
|
|
|
|
--stickyTop: var(--globalHeaderHeight);
|
2021-07-27 21:37:32 +09:00
|
|
|
margin-top: 0;
|
2021-07-19 11:36:35 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-10 12:40:50 +09:00
|
|
|
@media (max-width: 850px) {
|
|
|
|
margin: 0;
|
|
|
|
|
|
|
|
> .sidebar {
|
|
|
|
border-right: solid 0.5px var(--divider);
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2021-04-10 12:40:50 +09:00
|
|
|
> .main {
|
|
|
|
margin: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .tray-back {
|
|
|
|
z-index: 1001;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .tray {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 1001;
|
2022-11-13 11:43:23 +09:00
|
|
|
height: 100dvh;
|
2020-10-17 20:12:00 +09:00
|
|
|
padding: var(--margin);
|
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: auto;
|
|
|
|
background: var(--bg);
|
|
|
|
}
|
2021-09-04 17:54:24 +09:00
|
|
|
|
|
|
|
> .ivnzpscs {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
width: 300px;
|
|
|
|
height: 600px;
|
|
|
|
border: none;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
|
|
|
</style>
|