mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-08 09:11:46 +00:00
fix preload
This commit is contained in:
@ -1,13 +1,12 @@
|
||||
import { render } from 'solid-js/web';
|
||||
|
||||
import style from './style.css?inline';
|
||||
import { IconChevronLeft } from '@mdui/icons/chevron-left.js';
|
||||
import { IconChevronRight } from '@mdui/icons/chevron-right.js';
|
||||
|
||||
import { createPlugin } from '@/utils';
|
||||
|
||||
import { t } from '@/i18n';
|
||||
|
||||
import '@mdui/icons/chevron-left.js';
|
||||
import '@mdui/icons/chevron-right.js';
|
||||
|
||||
export default createPlugin({
|
||||
name: () => t('plugins.navigation.name'),
|
||||
description: () => t('plugins.navigation.description'),
|
||||
@ -18,6 +17,9 @@ export default createPlugin({
|
||||
renderer: {
|
||||
buttonContainer: document.createElement('div'),
|
||||
start() {
|
||||
const doNotTreeShake = [IconChevronLeft, IconChevronRight];
|
||||
((a) => {})(doNotTreeShake);
|
||||
|
||||
if (!this.buttonContainer) {
|
||||
this.buttonContainer = document.createElement('div');
|
||||
}
|
||||
|
||||
@ -15,6 +15,14 @@ import {
|
||||
|
||||
import * as z from 'zod';
|
||||
|
||||
import { IconChevronLeft } from '@mdui/icons/chevron-left.js';
|
||||
import { IconChevronRight } from '@mdui/icons/chevron-right.js';
|
||||
import { IconCheckCircle } from '@mdui/icons/check-circle.js';
|
||||
import { IconWarning } from '@mdui/icons/warning.js';
|
||||
import { IconError } from '@mdui/icons/error.js';
|
||||
import { IconStar } from '@mdui/icons/star.js';
|
||||
import { IconStarBorder } from '@mdui/icons/star-border.js';
|
||||
|
||||
import {
|
||||
type ProviderName,
|
||||
ProviderNames,
|
||||
@ -26,14 +34,6 @@ import { currentLyrics, lyricsStore, setLyricsStore } from '../store';
|
||||
import { _ytAPI } from '../index';
|
||||
import { config } from '../renderer';
|
||||
|
||||
import '@mdui/icons/chevron-left.js';
|
||||
import '@mdui/icons/chevron-right.js';
|
||||
import '@mdui/icons/check-circle.js';
|
||||
import '@mdui/icons/warning.js';
|
||||
import '@mdui/icons/error.js';
|
||||
import '@mdui/icons/star.js';
|
||||
import '@mdui/icons/star-border.js';
|
||||
|
||||
import type { PlayerAPIEvents } from '@/types/player-api-events';
|
||||
|
||||
const LocalStorageSchema = z.object({
|
||||
@ -82,6 +82,17 @@ const [hasManuallySwitchedProvider, setHasManuallySwitchedProvider] =
|
||||
export const LyricsPicker = (props: {
|
||||
setStickRef: Setter<HTMLElement | null>;
|
||||
}) => {
|
||||
const doNotTreeShake = [
|
||||
IconChevronLeft,
|
||||
IconChevronRight,
|
||||
IconCheckCircle,
|
||||
IconWarning,
|
||||
IconError,
|
||||
IconStar,
|
||||
IconStarBorder,
|
||||
];
|
||||
((a) => {})(doNotTreeShake);
|
||||
|
||||
const [videoId, setVideoId] = createSignal<string | null>(null);
|
||||
const [starredProvider, setStarredProvider] =
|
||||
createSignal<ProviderName | null>(null);
|
||||
|
||||
@ -8,18 +8,18 @@ import is from 'electron-is';
|
||||
|
||||
import * as config from './config';
|
||||
|
||||
import mduiStyleSheet from '@assets/mdui.css?inline';
|
||||
import {
|
||||
forceLoadPreloadPlugin,
|
||||
forceUnloadPreloadPlugin,
|
||||
loadAllPreloadPlugins,
|
||||
} from './loader/preload';
|
||||
import { loadI18n, setLanguage } from '@/i18n';
|
||||
|
||||
contextBridge.exposeInMainWorld(
|
||||
'litIssuedWarnings',
|
||||
new Set([
|
||||
'Lit is in dev mode. Not recommended for production! See https://lit.dev/msg/dev-mode for more information.',
|
||||
'Shadow DOM is being polyfilled via `ShadyDOM` but the `polyfill-support` module has not been loaded. See https://lit.dev/msg/polyfill-support-missing for more information.',
|
||||
]),
|
||||
);
|
||||
// @ts-expect-error dummy
|
||||
globalThis.customElements = { define() {} };
|
||||
|
||||
new MutationObserver((mutations, observer) => {
|
||||
outer: for (const mutation of mutations) {
|
||||
for (const mutation of mutations) {
|
||||
for (const node of mutation.addedNodes) {
|
||||
const elem = node as HTMLElement;
|
||||
if (elem.tagName !== 'SCRIPT') continue;
|
||||
@ -32,23 +32,12 @@ new MutationObserver((mutations, observer) => {
|
||||
|
||||
script.remove();
|
||||
|
||||
const styleSheet = new CSSStyleSheet();
|
||||
styleSheet.replaceSync(mduiStyleSheet);
|
||||
document.adoptedStyleSheets.push(styleSheet);
|
||||
|
||||
observer.disconnect();
|
||||
break outer;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}).observe(document, { subtree: true, childList: true });
|
||||
|
||||
import {
|
||||
forceLoadPreloadPlugin,
|
||||
forceUnloadPreloadPlugin,
|
||||
loadAllPreloadPlugins,
|
||||
} from './loader/preload';
|
||||
import { loadI18n, setLanguage } from '@/i18n';
|
||||
|
||||
loadI18n().then(async () => {
|
||||
await setLanguage(config.get('options.language') ?? 'en');
|
||||
await loadAllPreloadPlugins();
|
||||
|
||||
@ -5,9 +5,9 @@ import { fileURLToPath } from 'node:url';
|
||||
import {
|
||||
Project,
|
||||
ts,
|
||||
ObjectLiteralExpression,
|
||||
VariableDeclarationKind,
|
||||
Node,
|
||||
type ObjectLiteralExpression,
|
||||
type Node,
|
||||
type ObjectLiteralElementLike,
|
||||
} from 'ts-morph';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user