2023-07-27 05:31:52 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
<template>
|
2021-12-03 13:09:40 +00:00
|
|
|
<div class="gbhvwtnk" :class="{ wallpaper }" :style="`--globalHeaderHeight:${globalHeaderHeight}px`">
|
2021-10-09 03:33:08 +00:00
|
|
|
<XHeaderMenu v-if="showMenuOnTop" v-get-size="(w, h) => globalHeaderHeight = h"/>
|
2021-07-19 02:36:35 +00:00
|
|
|
|
|
|
|
<div class="columns" :class="{ fullView, withGlobalHeader: showMenuOnTop }">
|
2021-12-03 13:09:40 +00:00
|
|
|
<div v-if="!showMenuOnTop" class="sidebar">
|
|
|
|
<XSidebar/>
|
|
|
|
</div>
|
2023-12-08 04:06:42 +00:00
|
|
|
<div v-else-if="!pageMetadata?.needWideArea" ref="widgetsLeft" class="widgets left">
|
2023-05-19 11:52:15 +00:00
|
|
|
<XWidgets place="left" :marginTop="'var(--margin)'" @mounted="attachSticky(widgetsLeft)"/>
|
2021-12-03 13:09:40 +00:00
|
|
|
</div>
|
2021-04-10 03:40:50 +00:00
|
|
|
|
2023-05-15 07:25:44 +00:00
|
|
|
<main class="main" @contextmenu.stop="onContextmenu">
|
2022-12-28 09:02:11 +00:00
|
|
|
<div class="content" style="container-type: inline-size;">
|
2022-06-20 08:38:49 +00:00
|
|
|
<RouterView/>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
|
|
|
</main>
|
2020-10-24 16:21:41 +00:00
|
|
|
|
2023-12-08 04:06:42 +00:00
|
|
|
<div v-if="isDesktop && !pageMetadata?.needWideArea" ref="widgetsRight" class="widgets right">
|
2023-05-19 11:52:15 +00:00
|
|
|
<XWidgets :place="showMenuOnTop ? 'right' : null" :marginTop="showMenuOnTop ? '0' : 'var(--margin)'" @mounted="attachSticky(widgetsRight)"/>
|
2021-04-10 03:40:50 +00:00
|
|
|
</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
|
|
|
|
2023-04-01 04:42:40 +00:00
|
|
|
<Transition :name="defaultStore.state.animation ? 'tray-back' : ''">
|
2022-06-20 08:38:49 +00:00
|
|
|
<div
|
|
|
|
v-if="widgetsShowing"
|
2021-11-19 10:36:12 +00:00
|
|
|
class="tray-back _modalBg"
|
2020-10-17 11:12:00 +00:00
|
|
|
@click="widgetsShowing = false"
|
|
|
|
@touchstart.passive="widgetsShowing = false"
|
|
|
|
></div>
|
2022-12-30 04:37:14 +00:00
|
|
|
</Transition>
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2023-04-01 04:42:40 +00:00
|
|
|
<Transition :name="defaultStore.state.animation ? 'tray' : ''">
|
2020-10-17 11:12:00 +00:00
|
|
|
<XWidgets v-if="widgetsShowing" class="tray"/>
|
2022-12-30 04:37:14 +00:00
|
|
|
</Transition>
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2023-04-01 04:42:40 +00:00
|
|
|
<iframe v-if="defaultStore.state.aiChanMode" ref="live2d" class="ivnzpscs" src="https://misskey-dev.github.io/mascot-web/?scale=2&y=1.4"></iframe>
|
2021-09-04 08:54:24 +00:00
|
|
|
|
2020-10-24 16:21:41 +00:00
|
|
|
<XCommon/>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
<script lang="ts" setup>
|
2023-12-21 02:36:45 +00:00
|
|
|
import { defineAsyncComponent, onMounted, provide, ref, computed, shallowRef } from 'vue';
|
2021-10-24 05:50:00 +00:00
|
|
|
import XSidebar from './classic.sidebar.vue';
|
2020-10-24 16:21:41 +00:00
|
|
|
import XCommon from './_common_/common.vue';
|
2023-09-19 07:37:43 +00:00
|
|
|
import { instanceName } from '@/config.js';
|
|
|
|
import { StickySidebar } from '@/scripts/sticky-sidebar.js';
|
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { PageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
|
|
|
|
import { defaultStore } from '@/store.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { miLocalStorage } from '@/local-storage.js';
|
2024-01-08 05:44:43 +00:00
|
|
|
import { mainRouter } from '@/global/router/main.js';
|
2022-06-20 08:38:49 +00:00
|
|
|
const XHeaderMenu = defineAsyncComponent(() => import('./classic.header.vue'));
|
2022-12-27 05:55:11 +00:00
|
|
|
const XWidgets = defineAsyncComponent(() => import('./universal.widgets.vue'));
|
2020-10-17 11:12:00 +00:00
|
|
|
|
|
|
|
const DESKTOP_THRESHOLD = 1100;
|
|
|
|
|
2023-12-07 05:42:09 +00:00
|
|
|
const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD);
|
2022-06-20 08:38:49 +00:00
|
|
|
|
2023-12-08 04:06:42 +00:00
|
|
|
const pageMetadata = ref<null | PageMetadata>();
|
2023-12-07 05:42:09 +00:00
|
|
|
const widgetsShowing = ref(false);
|
|
|
|
const fullView = ref(false);
|
|
|
|
const globalHeaderHeight = ref(0);
|
2023-01-07 01:13:02 +00:00
|
|
|
const wallpaper = miLocalStorage.getItem('wallpaper') != null;
|
2023-12-07 05:42:09 +00:00
|
|
|
const showMenuOnTop = computed(() => defaultStore.state.menuDisplay === 'top');
|
|
|
|
const live2d = shallowRef<HTMLIFrameElement>();
|
2023-12-26 05:19:35 +00:00
|
|
|
const widgetsLeft = ref<HTMLElement>();
|
|
|
|
const widgetsRight = ref<HTMLElement>();
|
2022-06-20 08:38:49 +00:00
|
|
|
|
|
|
|
provide('router', mainRouter);
|
|
|
|
provideMetadataReceiver((info) => {
|
2023-12-08 04:06:42 +00:00
|
|
|
pageMetadata.value = info.value;
|
2022-06-20 08:38:49 +00:00
|
|
|
if (pageMetadata.value) {
|
|
|
|
document.title = `${pageMetadata.value.title} | ${instanceName}`;
|
|
|
|
}
|
|
|
|
});
|
2023-12-07 05:42:09 +00:00
|
|
|
provide('shouldHeaderThin', showMenuOnTop.value);
|
2023-01-03 01:46:56 +00:00
|
|
|
provide('forceSpacerMin', true);
|
2022-06-20 08:38:49 +00:00
|
|
|
|
2023-12-26 05:19:35 +00:00
|
|
|
function attachSticky(el: HTMLElement) {
|
2023-01-10 02:15:29 +00:00
|
|
|
const sticky = new StickySidebar(el, 0, defaultStore.state.menuDisplay === 'top' ? 60 : 0); // TODO: ヘッダーの高さを60pxと決め打ちしているのを直す
|
2022-06-20 08:38:49 +00:00
|
|
|
window.addEventListener('scroll', () => {
|
|
|
|
sticky.calc(window.scrollY);
|
|
|
|
}, { passive: true });
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
function top() {
|
|
|
|
window.scroll({ top: 0, behavior: 'smooth' });
|
|
|
|
}
|
2021-09-04 08:54:24 +00:00
|
|
|
|
2022-06-20 08:38:49 +00: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 08:54:24 +00:00
|
|
|
}
|
2022-06-20 08:38:49 +00: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,
|
|
|
|
}, {
|
2023-12-23 01:09:23 +00:00
|
|
|
icon: fullView.value ? 'ph-arrows-in-simple ph-bold ph-lg' : 'ph-frame-corners ph-bold ph-lg',
|
2023-12-07 05:42:09 +00:00
|
|
|
text: fullView.value ? i18n.ts.quitFullView : i18n.ts.fullView,
|
2022-06-20 08:38:49 +00:00
|
|
|
action: () => {
|
2023-12-07 05:42:09 +00:00
|
|
|
fullView.value = !fullView.value;
|
2020-10-17 11:12:00 +00:00
|
|
|
},
|
2022-06-20 08:38:49 +00:00
|
|
|
}, {
|
2023-09-30 22:46:42 +00:00
|
|
|
icon: 'ph-frame-corners ph-bold ph-lg',
|
2022-06-20 08:38:49 +00:00
|
|
|
text: i18n.ts.openInWindow,
|
|
|
|
action: () => {
|
|
|
|
os.pageWindow(path);
|
2020-10-17 11:12:00 +00:00
|
|
|
},
|
2022-06-20 08:38:49 +00:00
|
|
|
}], ev);
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
function onAiClick(ev) {
|
|
|
|
//if (this.live2d) this.live2d.click(ev);
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
if (window.innerWidth < 1024) {
|
2023-02-17 01:56:23 +00:00
|
|
|
const currentUI = miLocalStorage.getItem('ui');
|
2023-02-22 06:28:17 +00:00
|
|
|
miLocalStorage.setItem('ui_temp', currentUI ?? 'default');
|
2023-01-07 01:13:02 +00:00
|
|
|
miLocalStorage.setItem('ui', 'default');
|
2022-06-20 08:38:49 +00:00
|
|
|
location.reload();
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
document.documentElement.style.overflowY = 'scroll';
|
|
|
|
|
2023-02-02 07:43:56 +00:00
|
|
|
defaultStore.loaded.then(() => {
|
2023-01-02 07:02:42 +00:00
|
|
|
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 08:54:24 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
onMounted(() => {
|
|
|
|
window.addEventListener('resize', () => {
|
2023-12-07 05:42:09 +00:00
|
|
|
isDesktop.value = (window.innerWidth >= DESKTOP_THRESHOLD);
|
2022-06-20 08:38:49 +00:00
|
|
|
}, { passive: true });
|
|
|
|
|
|
|
|
if (defaultStore.state.aiChanMode) {
|
2023-12-07 05:42:09 +00:00
|
|
|
const iframeRect = live2d.value.getBoundingClientRect();
|
2022-06-20 08:38:49 +00:00
|
|
|
window.addEventListener('mousemove', ev => {
|
2023-12-07 05:42:09 +00:00
|
|
|
live2d.value.contentWindow.postMessage({
|
2022-06-20 08:38:49 +00:00
|
|
|
type: 'moveCursor',
|
|
|
|
body: {
|
|
|
|
x: ev.clientX - iframeRect.left,
|
|
|
|
y: ev.clientY - iframeRect.top,
|
|
|
|
},
|
|
|
|
}, '*');
|
|
|
|
}, { passive: true });
|
|
|
|
window.addEventListener('touchmove', ev => {
|
2023-12-07 05:42:09 +00:00
|
|
|
live2d.value.contentWindow.postMessage({
|
2022-06-20 08:38:49 +00:00
|
|
|
type: 'moveCursor',
|
|
|
|
body: {
|
|
|
|
x: ev.touches[0].clientX - iframeRect.left,
|
|
|
|
y: ev.touches[0].clientY - iframeRect.top,
|
|
|
|
},
|
|
|
|
}, '*');
|
|
|
|
}, { passive: true });
|
2020-10-17 11:12:00 +00: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 13:09:40 +00:00
|
|
|
.gbhvwtnk {
|
2021-04-10 03:40:50 +00:00
|
|
|
$ui-font-size: 1em;
|
|
|
|
$widgets-hide-threshold: 1200px;
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-11-13 02:43:23 +00:00
|
|
|
min-height: 100dvh;
|
2020-10-17 11:12:00 +00:00
|
|
|
box-sizing: border-box;
|
|
|
|
|
2020-11-28 04:30:09 +00:00
|
|
|
&.wallpaper {
|
|
|
|
background: var(--wallpaperOverlay);
|
2021-08-11 13:34:45 +00:00
|
|
|
//backdrop-filter: var(--blur, blur(4px));
|
2020-11-28 04:30:09 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 03:40:50 +00:00
|
|
|
> .columns {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
max-width: 100%;
|
2021-04-23 02:31:43 +00:00
|
|
|
//margin: 32px 0;
|
2021-04-10 03:40:50 +00:00
|
|
|
|
2021-04-11 15:05:13 +00:00
|
|
|
&.fullView {
|
|
|
|
margin: 0;
|
2023-07-07 22:08:16 +00:00
|
|
|
|
2021-04-11 15:05:13 +00:00
|
|
|
> .sidebar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .widgets {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
margin: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-10 03:40:50 +00:00
|
|
|
> .main {
|
2021-04-12 16:59:18 +00:00
|
|
|
min-width: 0;
|
2021-04-10 03:40:50 +00:00
|
|
|
width: 750px;
|
|
|
|
margin: 0 16px 0 0;
|
2021-08-07 13:06:50 +00:00
|
|
|
border-left: solid 1px var(--divider);
|
|
|
|
border-right: solid 1px var(--divider);
|
2021-04-23 02:31:43 +00:00
|
|
|
border-radius: 0;
|
2022-07-13 12:41:06 +00:00
|
|
|
overflow: clip;
|
2021-04-10 03:40:50 +00:00
|
|
|
--margin: 12px;
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
2020-10-24 16:21:41 +00:00
|
|
|
|
2021-04-10 03:40:50 +00:00
|
|
|
> .widgets {
|
2023-11-28 11:38:34 +00:00
|
|
|
position: sticky;
|
|
|
|
top: 0;
|
2021-04-16 06:44:17 +00:00
|
|
|
width: 300px;
|
2023-11-28 11:38:34 +00:00
|
|
|
height: 100%;
|
|
|
|
padding-top: 16px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: auto;
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2021-04-10 03:40:50 +00:00
|
|
|
@media (max-width: $widgets-hide-threshold) {
|
|
|
|
display: none;
|
|
|
|
}
|
2021-07-19 02:36:35 +00:00
|
|
|
|
|
|
|
&.left {
|
|
|
|
margin-right: 16px;
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
|
|
|
|
2021-04-23 02:31:43 +00:00
|
|
|
> .sidebar {
|
|
|
|
margin-top: 16px;
|
|
|
|
}
|
|
|
|
|
2021-07-19 02:36:35 +00:00
|
|
|
&.withGlobalHeader {
|
|
|
|
> .main {
|
2021-07-27 12:37:32 +00:00
|
|
|
margin-top: 0;
|
2021-08-07 13:06:50 +00:00
|
|
|
border: solid 1px var(--divider);
|
2021-07-19 02:36:35 +00:00
|
|
|
border-radius: var(--radius);
|
2021-10-09 03:33:08 +00:00
|
|
|
--stickyTop: var(--globalHeaderHeight);
|
2021-07-19 02:36:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
> .widgets {
|
|
|
|
--stickyTop: var(--globalHeaderHeight);
|
2021-07-27 12:37:32 +00:00
|
|
|
margin-top: 0;
|
2021-07-19 02:36:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-10 03:40:50 +00:00
|
|
|
@media (max-width: 850px) {
|
|
|
|
margin: 0;
|
|
|
|
|
|
|
|
> .sidebar {
|
|
|
|
border-right: solid 0.5px var(--divider);
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2021-04-10 03:40:50 +00:00
|
|
|
> .main {
|
|
|
|
margin: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .tray-back {
|
|
|
|
z-index: 1001;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .tray {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 1001;
|
2022-11-13 02:43:23 +00:00
|
|
|
height: 100dvh;
|
2023-04-10 17:11:44 +00:00
|
|
|
padding: var(--margin) var(--margin) calc(var(--margin) + env(safe-area-inset-bottom, 0px));
|
2020-10-17 11:12:00 +00:00
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: auto;
|
|
|
|
background: var(--bg);
|
|
|
|
}
|
2021-09-04 08:54:24 +00:00
|
|
|
|
|
|
|
> .ivnzpscs {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
width: 300px;
|
|
|
|
height: 600px;
|
|
|
|
border: none;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
|
|
|
</style>
|