feat: apply rollup 🚀 (#20)

Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
JellyBrick
2023-10-04 17:51:39 +09:00
committed by GitHub
parent 2c337953eb
commit 40745d3946
42 changed files with 1752 additions and 1339 deletions

View File

@ -1,9 +1,9 @@
import path from 'node:path';
import { app, BrowserWindow, ipcMain } from 'electron';
import { setOptions as setPluginOptions } from '../../config/plugins';
import style from './style.css';
import { injectCSS } from '../utils';
import { setOptions as setPluginOptions } from '../../config/plugins';
import type { ConfigType } from '../../config/dynamic';
@ -102,7 +102,7 @@ export default (_win: BrowserWindow, _options: PiPOptions) => {
options ??= _options;
win ??= _win;
setLocalOptions({ isInPiP });
injectCSS(win.webContents, path.join(__dirname, 'style.css'));
injectCSS(win.webContents, style);
ipcMain.on('picture-in-picture', () => {
togglePiP();
});

View File

@ -2,9 +2,11 @@ import { ipcRenderer } from 'electron';
import { toKeyEvent } from 'keyboardevent-from-electron-accelerator';
import keyEventAreEqual from 'keyboardevents-areequal';
import pipHTML from './templates/picture-in-picture.html';
import { getSongMenu } from '../../providers/dom-elements';
import { ElementFromFile, templatePath } from '../utils';
import { ElementFromHtml } from '../utils';
import type { ConfigType } from '../../config/dynamic';
@ -16,9 +18,7 @@ function $<E extends Element = Element>(selector: string) {
let useNativePiP = false;
let menu: Element | null = null;
const pipButton = ElementFromFile(
templatePath(__dirname, 'picture-in-picture.html'),
);
const pipButton = ElementFromHtml(pipHTML);
// Will also clone
function replaceButton(query: string, button: Element) {