refactor(frontend): relocate theme script

This commit is contained in:
syuilo 2025-03-09 14:32:29 +09:00
parent fcd7fa62ba
commit 2918fb2609
12 changed files with 17 additions and 17 deletions

View File

@ -21,7 +21,7 @@ let moduleInitialized = false;
let unobserve = () => {};
let misskeyOS = null;
function loadTheme(applyTheme: typeof import('../src/utility/theme')['applyTheme']) {
function loadTheme(applyTheme: typeof import('../src/theme')['applyTheme']) {
unobserve();
const theme = themes[document.documentElement.dataset.misskeyTheme];
if (theme) {
@ -67,7 +67,7 @@ queueMicrotask(() => {
import('../src/components'),
import('../src/directives'),
import('../src/widgets'),
import('../src/utility/theme'),
import('../src/theme'),
import('../src/preferences'),
import('../src/os'),
]).then(([{ default: components }, { default: directives }, { default: widgets }, { applyTheme }, { prefer }, os]) => {

View File

@ -4,7 +4,7 @@
*/
declare module '@@/themes/*.json5' {
import { Theme } from '@/utility/theme.js';
import { Theme } from '@/theme.js';
const theme: Theme;

View File

@ -12,7 +12,7 @@ import type { App } from 'vue';
import widgets from '@/widgets/index.js';
import directives from '@/directives/index.js';
import components from '@/components/index.js';
import { applyTheme } from '@/utility/theme.js';
import { applyTheme } from '@/theme.js';
import { isDeviceDarkmode } from '@/utility/is-device-darkmode.js';
import { updateI18n, i18n } from '@/i18n.js';
import { $i, refreshAccount, login } from '@/account.js';

View File

@ -56,7 +56,7 @@ import FormSection from '@/components/form/section.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js';
import { parsePluginMeta, installPlugin } from '@/plugin.js';
import { parseThemeCode, installTheme } from '@/utility/theme.js';
import { parseThemeCode, installTheme } from '@/theme.js';
import { unisonReload } from '@/utility/unison-reload.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/utility/page-metadata.js';

View File

@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ref, computed } from 'vue';
import MkCodeEditor from '@/components/MkCodeEditor.vue';
import MkButton from '@/components/MkButton.vue';
import { parseThemeCode, previewTheme, installTheme } from '@/utility/theme.js';
import { parseThemeCode, previewTheme, installTheme } from '@/theme.js';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/utility/page-metadata.js';

View File

@ -37,8 +37,8 @@ import MkTextarea from '@/components/MkTextarea.vue';
import MkSelect from '@/components/MkSelect.vue';
import MkInput from '@/components/MkInput.vue';
import MkButton from '@/components/MkButton.vue';
import { getBuiltinThemesRef } from '@/utility/theme.js';
import type { Theme } from '@/utility/theme.js';
import { getBuiltinThemesRef } from '@/theme.js';
import type { Theme } from '@/theme.js';
import { copyToClipboard } from '@/utility/copy-to-clipboard.js';
import * as os from '@/os.js';
import { getThemes, removeTheme } from '@/theme-store.js';

View File

@ -83,7 +83,7 @@ import MkSelect from '@/components/MkSelect.vue';
import FormSection from '@/components/form/section.vue';
import FormLink from '@/components/form/link.vue';
import MkButton from '@/components/MkButton.vue';
import { getBuiltinThemesRef } from '@/utility/theme.js';
import { getBuiltinThemesRef } from '@/theme.js';
import { selectFile } from '@/utility/select-file.js';
import { isDeviceDarkmode } from '@/utility/is-device-darkmode.js';
import { store } from '@/store.js';

View File

@ -81,13 +81,13 @@ import JSON5 from 'json5';
import lightTheme from '@@/themes/_light.json5';
import darkTheme from '@@/themes/_dark.json5';
import { host } from '@@/js/config.js';
import type { Theme } from '@/utility/theme.js';
import type { Theme } from '@/theme.js';
import MkButton from '@/components/MkButton.vue';
import MkCodeEditor from '@/components/MkCodeEditor.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import MkFolder from '@/components/MkFolder.vue';
import { $i } from '@/account.js';
import { applyTheme } from '@/utility/theme.js';
import { applyTheme } from '@/theme.js';
import * as os from '@/os.js';
import { store } from '@/store.js';
import { addTheme } from '@/theme-store.js';

View File

@ -5,7 +5,7 @@
import * as Misskey from 'misskey-js';
import { hemisphere } from '@@/js/intl-const.js';
import type { Theme } from '@/utility/theme.js';
import type { Theme } from '@/theme.js';
import type { SoundType } from '@/utility/sound.js';
import type { Plugin } from '@/plugin.js';
import { DEFAULT_DEVICE_KIND } from '@/utility/device-kind.js';

View File

@ -3,8 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { Theme } from '@/utility/theme.js';
import { getBuiltinThemes } from '@/utility/theme.js';
import type { Theme } from '@/theme.js';
import { getBuiltinThemes } from '@/theme.js';
import { $i } from '@/account.js';
import { prefer } from '@/preferences.js';

View File

@ -8,8 +8,8 @@ import tinycolor from 'tinycolor2';
import lightTheme from '@@/themes/_light.json5';
import darkTheme from '@@/themes/_dark.json5';
import JSON5 from 'json5';
import { deepClone } from './clone.js';
import type { BundledTheme } from 'shiki/themes';
import { deepClone } from '@/utility/clone.js';
import { globalEvents } from '@/events.js';
import { miLocalStorage } from '@/local-storage.js';
import { addTheme, getThemes } from '@/theme-store.js';

View File

@ -5,8 +5,8 @@
import { v4 as uuid } from 'uuid';
import { themeProps } from './theme.js';
import type { Theme } from './theme.js';
import type { Theme } from '@/theme.js';
import { themeProps } from '@/theme.js';
export type Default = null;
export type Color = string;