1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-21 23:55:34 +02:00

enhance(frontend): テーマの適用管理を改善 (#17376)

* wip

* add test

* use themeManager.currentCompiledTheme for obtaining theme variables / reduce getComputedStyle usage

* fix

* fix: better error handling on theme installation

* Update Changelog

* chore: remove frontend-shared builds as it is currently working as a stub package

* fix: broken lockfile

* fix

* fix lint

* fix
This commit is contained in:
かっこかり
2026-05-07 11:42:45 +09:00
committed by GitHub
parent a82ba0d775
commit b528ff9c59
46 changed files with 722 additions and 504 deletions

View File

@@ -5,7 +5,7 @@
import type { Directive } from 'vue';
import { getBgColor } from '@/utility/get-bg-color.js';
import { globalEvents } from '@/events.js';
import { themeManager } from '@/theme.js';
const handlerMap = new WeakMap<HTMLElement, () => void>();
@@ -27,10 +27,10 @@ export const adaptiveBorderDirective = {
calc();
globalEvents.on('themeChanged', calc);
themeManager.on('themeChanged', calc);
},
unmounted(src) {
globalEvents.off('themeChanged', handlerMap.get(src));
themeManager.off('themeChanged', handlerMap.get(src));
},
} as Directive<HTMLElement>;

View File

@@ -4,13 +4,14 @@
*/
import type { Directive } from 'vue';
import { themeManager } from '@/theme.js';
import { getBgColor } from '@/utility/get-bg-color.js';
export const panelDirective = {
mounted(src) {
const parentBg = getBgColor(src.parentElement) ?? 'transparent';
const myBg = getComputedStyle(window.document.documentElement).getPropertyValue('--MI_THEME-panel');
const myBg = themeManager.currentCompiledTheme!.panel;
if (parentBg === myBg) {
src.style.backgroundColor = 'var(--MI_THEME-bg)';