This commit is contained in:
syuilo
2025-03-18 17:31:25 +09:00
parent 0a295e1bb0
commit d609f41f61
20 changed files with 324 additions and 73 deletions

View File

@@ -33,13 +33,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref, shallowRef, watch, nextTick } from 'vue';
import { computed, onMounted, onUnmounted, ref, shallowRef, watch, nextTick, inject } from 'vue';
import tinycolor from 'tinycolor2';
import { scrollToTop } from '@@/js/scroll.js';
import { popupMenu } from '@/os.js';
import MkButton from '@/components/MkButton.vue';
import { globalEvents } from '@/events.js';
import { injectReactiveMetadata } from '@/page.js';
import { DI } from '@/di.js';
type Tab = {
key?: string | null;
@@ -66,7 +66,7 @@ const emit = defineEmits<{
(ev: 'update:tab', key: string);
}>();
const pageMetadata = injectReactiveMetadata();
const pageMetadata = inject(DI.pageMetadata);
const el = shallowRef<HTMLElement>(null);
const tabRefs = {};
@@ -119,7 +119,7 @@ function onTabClick(tab: Tab, ev: MouseEvent): void {
}
const calcBg = () => {
const rawBg = pageMetadata.value?.bg ?? 'var(--MI_THEME-bg)';
const rawBg = pageMetadata.value.bg ?? 'var(--MI_THEME-bg)';
const tinyBg = tinycolor(rawBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawBg.slice(4, -1)) : rawBg);
tinyBg.setAlpha(0.85);
bg.value = tinyBg.toRgbString();