2020-10-17 13:12:00 +02:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<div
|
|
|
|
class="gbhvwtnk"
|
|
|
|
:class="{ wallpaper }"
|
|
|
|
:style="`--globalHeaderHeight:${globalHeaderHeight}px`"
|
|
|
|
>
|
|
|
|
<XHeaderMenu
|
|
|
|
v-if="showMenuOnTop"
|
|
|
|
v-get-size="(w, h) => (globalHeaderHeight = h)"
|
|
|
|
/>
|
2021-07-19 04:36:35 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
<div
|
|
|
|
class="columns"
|
|
|
|
:class="{ fullView, withGlobalHeader: showMenuOnTop }"
|
|
|
|
>
|
2023-05-12 01:46:42 +02:00
|
|
|
<XSidebar v-if="!showMenuOnTop"/>
|
2023-04-08 02:01:42 +02:00
|
|
|
<div v-else ref="widgetsLeft" class="widgets left">
|
|
|
|
<XWidgets
|
|
|
|
:place="'left'"
|
|
|
|
@mounted="attachSticky(widgetsLeft)"
|
|
|
|
/>
|
2020-10-17 13:12:00 +02:00
|
|
|
</div>
|
2020-10-24 18:21:41 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
<main
|
|
|
|
class="main"
|
|
|
|
:style="{ background: pageMetadata?.value?.bg }"
|
|
|
|
@contextmenu.stop="onContextmenu"
|
|
|
|
>
|
|
|
|
<div class="content">
|
|
|
|
<RouterView />
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
|
|
|
|
<div v-if="isDesktop" ref="widgetsRight" class="widgets right">
|
|
|
|
<XWidgets :place="null" @mounted="attachSticky(widgetsRight)" />
|
|
|
|
</div>
|
2021-04-10 05:40:50 +02:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
<transition :name="$store.state.animation ? 'tray-back' : ''">
|
|
|
|
<div
|
|
|
|
v-if="widgetsShowing"
|
|
|
|
class="tray-back _modalBg"
|
|
|
|
@click="widgetsShowing = false"
|
|
|
|
@touchstart.passive="widgetsShowing = false"
|
|
|
|
></div>
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
<transition :name="$store.state.animation ? 'tray' : ''">
|
|
|
|
<XWidgets v-if="widgetsShowing" class="tray" />
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
<XCommon />
|
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
import { defineAsyncComponent, markRaw, ref, onMounted, provide } from "vue";
|
2023-05-12 01:46:42 +02:00
|
|
|
import XSidebar from "./_common_/navbar.vue";
|
2023-04-08 02:01:42 +02:00
|
|
|
import XCommon from "./_common_/common.vue";
|
|
|
|
import type { ComputedRef } from "vue";
|
|
|
|
import type { PageMetadata } from "@/scripts/page-metadata";
|
|
|
|
import { instanceName } from "@/config";
|
|
|
|
import { StickySidebar } from "@/scripts/sticky-sidebar";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { mainRouter } from "@/router";
|
|
|
|
import {
|
|
|
|
provideMetadataReceiver,
|
|
|
|
setPageMetadata,
|
|
|
|
} from "@/scripts/page-metadata";
|
|
|
|
import { defaultStore } from "@/store";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
const XHeaderMenu = defineAsyncComponent(() => import("./classic.header.vue"));
|
2023-05-12 00:34:44 +02:00
|
|
|
const XWidgets = defineAsyncComponent(() => import("./universal.widgets.vue"));
|
2020-10-17 13:12:00 +02:00
|
|
|
|
|
|
|
const DESKTOP_THRESHOLD = 1100;
|
|
|
|
|
2022-06-29 17:44:03 +02:00
|
|
|
let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
|
2022-07-04 16:22:11 +02:00
|
|
|
let widgetsShowing = $ref(false);
|
|
|
|
let fullView = $ref(false);
|
2022-06-20 10:38:49 +02:00
|
|
|
let globalHeaderHeight = $ref(0);
|
2023-04-08 02:01:42 +02:00
|
|
|
const wallpaper = localStorage.getItem("wallpaper") != null;
|
|
|
|
const showMenuOnTop = $computed(() => defaultStore.state.menuDisplay === "top");
|
2022-06-20 10:38:49 +02:00
|
|
|
let live2d = $ref<HTMLIFrameElement>();
|
|
|
|
let widgetsLeft = $ref();
|
|
|
|
let widgetsRight = $ref();
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
provide("router", mainRouter);
|
2022-06-20 10:38:49 +02:00
|
|
|
provideMetadataReceiver((info) => {
|
|
|
|
pageMetadata = info;
|
|
|
|
if (pageMetadata.value) {
|
|
|
|
document.title = `${pageMetadata.value.title} | ${instanceName}`;
|
|
|
|
}
|
|
|
|
});
|
2023-04-08 02:01:42 +02:00
|
|
|
provide("shouldHeaderThin", showMenuOnTop);
|
|
|
|
provide("shouldSpacerMin", true);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
function attachSticky(el) {
|
2023-04-08 02:01:42 +02:00
|
|
|
const sticky = new StickySidebar(
|
|
|
|
el,
|
2023-05-12 00:34:44 +02:00
|
|
|
defaultStore.state.menuDisplay === 0,
|
2023-04-08 02:01:42 +02:00
|
|
|
defaultStore.state.menuDisplay === "top" ? 60 : 0
|
|
|
|
); // TODO: ヘッダーの高さを60pxと決め打ちしているのを直す
|
|
|
|
window.addEventListener(
|
|
|
|
"scroll",
|
|
|
|
() => {
|
|
|
|
sticky.calc(window.scrollY);
|
|
|
|
},
|
|
|
|
{ passive: true }
|
|
|
|
);
|
2022-06-20 10:38:49 +02:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
function top() {
|
2023-04-08 02:01:42 +02:00
|
|
|
window.scroll({ top: 0, behavior: "smooth" });
|
2022-06-20 10:38:49 +02:00
|
|
|
}
|
2021-09-04 10:54:24 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
function onContextmenu(ev: MouseEvent) {
|
|
|
|
const isLink = (el: HTMLElement) => {
|
2023-04-08 02:01:42 +02:00
|
|
|
if (el.tagName === "A") return true;
|
2022-06-20 10:38:49 +02:00
|
|
|
if (el.parentElement) {
|
|
|
|
return isLink(el.parentElement);
|
2021-09-04 10:54:24 +02:00
|
|
|
}
|
2022-06-20 10:38:49 +02:00
|
|
|
};
|
|
|
|
if (isLink(ev.target)) return;
|
2023-04-08 02:01:42 +02:00
|
|
|
if (
|
|
|
|
["INPUT", "TEXTAREA", "IMG", "VIDEO", "CANVAS"].includes(
|
|
|
|
ev.target.tagName
|
|
|
|
) ||
|
|
|
|
ev.target.attributes["contenteditable"]
|
|
|
|
)
|
|
|
|
return;
|
|
|
|
if (window.getSelection().toString() !== "") return;
|
2022-06-20 10:38:49 +02:00
|
|
|
const path = mainRouter.getCurrentPath();
|
2023-04-08 02:01:42 +02:00
|
|
|
os.contextMenu(
|
|
|
|
[
|
|
|
|
{
|
|
|
|
type: "label",
|
|
|
|
text: path,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: fullView
|
|
|
|
? "ph-arrows-in-simple ph-bold ph-lg"
|
|
|
|
: "ph-arrows-out-simple ph-bold ph-lg",
|
|
|
|
text: fullView ? i18n.ts.quitFullView : i18n.ts.fullView,
|
|
|
|
action: () => {
|
|
|
|
fullView = !fullView;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: "ph-browser ph-bold ph-lg",
|
|
|
|
text: i18n.ts.openInWindow,
|
|
|
|
action: () => {
|
|
|
|
os.pageWindow(path);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
ev
|
|
|
|
);
|
2022-06-20 10:38:49 +02:00
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
if (window.innerWidth < 1024) {
|
2023-04-08 02:01:42 +02:00
|
|
|
localStorage.setItem("ui", "default");
|
2022-06-20 10:38:49 +02:00
|
|
|
location.reload();
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
document.documentElement.style.overflowY = "scroll";
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
if (defaultStore.state.widgets.length === 0) {
|
2023-04-08 02:01:42 +02:00
|
|
|
defaultStore.set("widgets", [
|
|
|
|
{
|
|
|
|
name: "calendar",
|
|
|
|
id: "a",
|
|
|
|
place: null,
|
|
|
|
data: {},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "notifications",
|
|
|
|
id: "b",
|
|
|
|
place: null,
|
|
|
|
data: {},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "trends",
|
|
|
|
id: "c",
|
|
|
|
place: null,
|
|
|
|
data: {},
|
|
|
|
},
|
|
|
|
]);
|
2022-06-20 10:38:49 +02:00
|
|
|
}
|
2021-09-04 10:54:24 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
onMounted(() => {
|
2023-04-08 02:01:42 +02:00
|
|
|
window.addEventListener(
|
|
|
|
"resize",
|
|
|
|
() => {
|
|
|
|
isDesktop = window.innerWidth >= DESKTOP_THRESHOLD;
|
|
|
|
},
|
|
|
|
{ passive: true }
|
|
|
|
);
|
2020-10-17 13:12:00 +02:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.tray-enter-active,
|
|
|
|
.tray-leave-active {
|
|
|
|
opacity: 1;
|
|
|
|
transform: translateX(0);
|
2023-04-08 02:01:42 +02:00
|
|
|
transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
|
|
opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
.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 14:09:40 +01:00
|
|
|
.gbhvwtnk {
|
2023-04-29 05:18:01 +02:00
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
2021-04-10 05:40:50 +02:00
|
|
|
$ui-font-size: 1em;
|
|
|
|
$widgets-hide-threshold: 1200px;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
|
|
|
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
|
|
min-height: calc(var(--vh, 1vh) * 100);
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
2023-05-12 01:46:42 +02:00
|
|
|
--navBg: transparent;
|
|
|
|
--X14: var(--acrylicBg);
|
|
|
|
|
2020-11-28 05:30:09 +01:00
|
|
|
&.wallpaper {
|
|
|
|
background: var(--wallpaperOverlay);
|
2023-05-12 02:38:54 +02:00
|
|
|
:deep(main) {
|
|
|
|
background: var(--acrylicBg) !important;
|
|
|
|
backdrop-filter: blur(12px);
|
|
|
|
}
|
|
|
|
:deep(.tl), :deep(.notes) {
|
|
|
|
background: none !important;
|
|
|
|
}
|
2020-11-28 05:30:09 +01:00
|
|
|
}
|
|
|
|
|
2021-04-10 05:40:50 +02:00
|
|
|
> .columns {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
max-width: 100%;
|
2021-04-23 04:31:43 +02:00
|
|
|
//margin: 32px 0;
|
2021-04-10 05:40:50 +02:00
|
|
|
|
2021-04-11 17:05:13 +02:00
|
|
|
&.fullView {
|
|
|
|
margin: 0;
|
2023-04-08 02:01:42 +02:00
|
|
|
|
2023-05-12 01:46:42 +02:00
|
|
|
> :deep(.sidebar) {
|
2021-04-11 17:05:13 +02:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .widgets {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
margin: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-12 01:46:42 +02:00
|
|
|
> :deep(.sidebar) {
|
|
|
|
margin-left: -200px;
|
|
|
|
padding-left: 200px;
|
|
|
|
box-sizing: content-box;
|
|
|
|
.banner {
|
|
|
|
pointer-events: none;
|
|
|
|
mask: radial-gradient(farthest-side at top, hsl(0, 0%, 0%) 0%,
|
|
|
|
hsla(0, 0%, 0%, 0.987) 0.3%,
|
|
|
|
hsla(0, 0%, 0%, 0.951) 1.4%,
|
|
|
|
hsla(0, 0%, 0%, 0.896) 3.2%,
|
|
|
|
hsla(0, 0%, 0%, 0.825) 5.8%,
|
|
|
|
hsla(0, 0%, 0%, 0.741) 9.3%,
|
|
|
|
hsla(0, 0%, 0%, 0.648) 13.6%,
|
|
|
|
hsla(0, 0%, 0%, 0.55) 18.9%,
|
|
|
|
hsla(0, 0%, 0%, 0.45) 25.1%,
|
|
|
|
hsla(0, 0%, 0%, 0.352) 32.4%,
|
|
|
|
hsla(0, 0%, 0%, 0.259) 40.7%,
|
|
|
|
hsla(0, 0%, 0%, 0.175) 50.2%,
|
|
|
|
hsla(0, 0%, 0%, 0.104) 60.8%,
|
|
|
|
hsla(0, 0%, 0%, 0.049) 72.6%,
|
|
|
|
hsla(0, 0%, 0%, 0.013) 85.7%,
|
|
|
|
hsla(0, 0%, 0%, 0) 100%) !important;
|
|
|
|
-webkit-mask: radial-gradient(farthest-side at top, hsl(0, 0%, 0%) 0%,
|
|
|
|
hsla(0, 0%, 0%, 0.987) 0.3%,
|
|
|
|
hsla(0, 0%, 0%, 0.951) 1.4%,
|
|
|
|
hsla(0, 0%, 0%, 0.896) 3.2%,
|
|
|
|
hsla(0, 0%, 0%, 0.825) 5.8%,
|
|
|
|
hsla(0, 0%, 0%, 0.741) 9.3%,
|
|
|
|
hsla(0, 0%, 0%, 0.648) 13.6%,
|
|
|
|
hsla(0, 0%, 0%, 0.55) 18.9%,
|
|
|
|
hsla(0, 0%, 0%, 0.45) 25.1%,
|
|
|
|
hsla(0, 0%, 0%, 0.352) 32.4%,
|
|
|
|
hsla(0, 0%, 0%, 0.259) 40.7%,
|
|
|
|
hsla(0, 0%, 0%, 0.175) 50.2%,
|
|
|
|
hsla(0, 0%, 0%, 0.104) 60.8%,
|
|
|
|
hsla(0, 0%, 0%, 0.049) 72.6%,
|
|
|
|
hsla(0, 0%, 0%, 0.013) 85.7%,
|
|
|
|
hsla(0, 0%, 0%, 0) 100%) !important;
|
|
|
|
width: 125% !important;
|
|
|
|
left: -12.5% !important;
|
|
|
|
height: 125% !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-10 05:40:50 +02:00
|
|
|
> .main {
|
2021-04-12 18:59:18 +02:00
|
|
|
min-width: 0;
|
2021-04-10 05:40:50 +02:00
|
|
|
width: 750px;
|
|
|
|
margin: 0 16px 0 0;
|
2021-08-05 15:43:14 +02:00
|
|
|
background: var(--panel);
|
2021-08-07 15:06:50 +02:00
|
|
|
border-left: solid 1px var(--divider);
|
|
|
|
border-right: solid 1px var(--divider);
|
2021-04-23 04:31:43 +02:00
|
|
|
border-radius: 0;
|
2022-07-13 14:41:06 +02:00
|
|
|
overflow: clip;
|
2021-04-10 05:40:50 +02:00
|
|
|
--margin: 12px;
|
2023-01-06 21:21:14 +01:00
|
|
|
background: var(--bg);
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2020-10-24 18:21:41 +02:00
|
|
|
|
2021-04-10 05:40:50 +02:00
|
|
|
> .widgets {
|
2021-07-27 14:37:32 +02:00
|
|
|
//--panelBorder: none;
|
2021-04-16 08:44:17 +02:00
|
|
|
width: 300px;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2021-04-10 05:40:50 +02:00
|
|
|
@media (max-width: $widgets-hide-threshold) {
|
|
|
|
display: none;
|
|
|
|
}
|
2021-07-19 04:36:35 +02:00
|
|
|
|
|
|
|
&.left {
|
|
|
|
margin-right: 16px;
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
|
2021-07-19 04:36:35 +02:00
|
|
|
&.withGlobalHeader {
|
|
|
|
> .main {
|
2021-07-27 14:37:32 +02:00
|
|
|
margin-top: 0;
|
2021-08-07 15:06:50 +02:00
|
|
|
border: solid 1px var(--divider);
|
2021-07-19 04:36:35 +02:00
|
|
|
border-radius: var(--radius);
|
2021-10-09 05:33:08 +02:00
|
|
|
--stickyTop: var(--globalHeaderHeight);
|
2021-07-19 04:36:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
> .widgets {
|
|
|
|
--stickyTop: var(--globalHeaderHeight);
|
2021-07-27 14:37:32 +02:00
|
|
|
margin-top: 0;
|
2021-07-19 04:36:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-10 05:40:50 +02:00
|
|
|
@media (max-width: 850px) {
|
|
|
|
margin: 0;
|
|
|
|
|
2023-05-12 01:46:42 +02:00
|
|
|
> :deep(.sidebar) {
|
2021-04-10 05:40:50 +02:00
|
|
|
border-right: solid 0.5px var(--divider);
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2021-04-10 05:40:50 +02:00
|
|
|
> .main {
|
|
|
|
margin: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .tray-back {
|
|
|
|
z-index: 1001;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .tray {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 1001;
|
|
|
|
// ほんとは単に 100vh と書きたいところだが... https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
|
|
height: calc(var(--vh, 1vh) * 100);
|
|
|
|
padding: var(--margin);
|
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: auto;
|
|
|
|
background: var(--bg);
|
|
|
|
}
|
2021-09-04 10:54:24 +02:00
|
|
|
|
|
|
|
> .ivnzpscs {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
width: 300px;
|
|
|
|
height: 600px;
|
|
|
|
border: none;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
|
|
|
</style>
|