Remove built files

This commit is contained in:
Jonatan Heyman 2023-01-13 01:45:22 +01:00
parent 1852ea7a03
commit f70098fde9
4 changed files with 0 additions and 160 deletions

View File

@ -1,79 +0,0 @@
"use strict";
const electron = require("electron");
const node_os = require("node:os");
const node_path = require("node:path");
process.env.DIST_ELECTRON = node_path.join(__dirname, "..");
process.env.DIST = node_path.join(process.env.DIST_ELECTRON, "../dist");
process.env.PUBLIC = process.env.VITE_DEV_SERVER_URL ? node_path.join(process.env.DIST_ELECTRON, "../public") : process.env.DIST;
if (node_os.release().startsWith("6.1"))
electron.app.disableHardwareAcceleration();
if (process.platform === "win32")
electron.app.setAppUserModelId(electron.app.getName());
if (!electron.app.requestSingleInstanceLock()) {
electron.app.quit();
process.exit(0);
}
let win = null;
const preload = node_path.join(__dirname, "../preload/index.js");
const url = process.env.VITE_DEV_SERVER_URL;
const indexHtml = node_path.join(process.env.DIST, "index.html");
async function createWindow() {
win = new electron.BrowserWindow({
title: "Main window",
icon: node_path.join(process.env.PUBLIC, "favicon.ico"),
webPreferences: {
preload,
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
win.loadURL(url);
} else {
win.loadFile(indexHtml);
}
win.webContents.on("did-finish-load", () => {
win == null ? void 0 : win.webContents.send("main-process-message", new Date().toLocaleString());
});
win.webContents.setWindowOpenHandler(({ url: url2 }) => {
if (url2.startsWith("https:"))
electron.shell.openExternal(url2);
return { action: "deny" };
});
}
electron.app.whenReady().then(createWindow);
electron.app.on("window-all-closed", () => {
win = null;
if (process.platform !== "darwin")
electron.app.quit();
});
electron.app.on("second-instance", () => {
if (win) {
if (win.isMinimized())
win.restore();
win.focus();
}
});
electron.app.on("activate", () => {
const allWindows = electron.BrowserWindow.getAllWindows();
if (allWindows.length) {
allWindows[0].focus();
} else {
createWindow();
}
});
electron.ipcMain.handle("open-win", (_, arg) => {
const childWindow = new electron.BrowserWindow({
webPreferences: {
preload,
nodeIntegration: true,
contextIsolation: false
}
});
if (process.env.VITE_DEV_SERVER_URL) {
childWindow.loadURL(`${url}#${arg}`);
} else {
childWindow.loadFile(indexHtml, { hash: arg });
}
});
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,79 +0,0 @@
"use strict";
function domReady(condition = ["complete", "interactive"]) {
return new Promise((resolve) => {
if (condition.includes(document.readyState)) {
resolve(true);
} else {
document.addEventListener("readystatechange", () => {
if (condition.includes(document.readyState)) {
resolve(true);
}
});
}
});
}
const safeDOM = {
append(parent, child) {
if (!Array.from(parent.children).find((e) => e === child)) {
return parent.appendChild(child);
}
},
remove(parent, child) {
if (Array.from(parent.children).find((e) => e === child)) {
return parent.removeChild(child);
}
}
};
function useLoading() {
const className = `loaders-css__square-spin`;
const styleContent = `
@keyframes square-spin {
25% { transform: perspective(100px) rotateX(180deg) rotateY(0); }
50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg); }
75% { transform: perspective(100px) rotateX(0) rotateY(180deg); }
100% { transform: perspective(100px) rotateX(0) rotateY(0); }
}
.${className} > div {
animation-fill-mode: both;
width: 50px;
height: 50px;
background: #fff;
animation: square-spin 3s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite;
}
.app-loading-wrap {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #282c34;
z-index: 9;
}
`;
const oStyle = document.createElement("style");
const oDiv = document.createElement("div");
oStyle.id = "app-loading-style";
oStyle.innerHTML = styleContent;
oDiv.className = "app-loading-wrap";
oDiv.innerHTML = `<div class="${className}"><div></div></div>`;
return {
appendLoading() {
safeDOM.append(document.head, oStyle);
safeDOM.append(document.body, oDiv);
},
removeLoading() {
safeDOM.remove(document.head, oStyle);
safeDOM.remove(document.body, oDiv);
}
};
}
const { appendLoading, removeLoading } = useLoading();
domReady().then(appendLoading);
window.onmessage = (ev) => {
ev.data.payload === "removeLoading" && removeLoading();
};
setTimeout(removeLoading, 4999);
//# sourceMappingURL=index.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"index.js","sources":["../../electron/preload/index.ts"],"sourcesContent":["function domReady(condition: DocumentReadyState[] = ['complete', 'interactive']) {\n return new Promise((resolve) => {\n if (condition.includes(document.readyState)) {\n resolve(true)\n } else {\n document.addEventListener('readystatechange', () => {\n if (condition.includes(document.readyState)) {\n resolve(true)\n }\n })\n }\n })\n}\n\nconst safeDOM = {\n append(parent: HTMLElement, child: HTMLElement) {\n if (!Array.from(parent.children).find(e => e === child)) {\n return parent.appendChild(child)\n }\n },\n remove(parent: HTMLElement, child: HTMLElement) {\n if (Array.from(parent.children).find(e => e === child)) {\n return parent.removeChild(child)\n }\n },\n}\n\n/**\n * https://tobiasahlin.com/spinkit\n * https://connoratherton.com/loaders\n * https://projects.lukehaas.me/css-loaders\n * https://matejkustec.github.io/SpinThatShit\n */\nfunction useLoading() {\n const className = `loaders-css__square-spin`\n const styleContent = `\n@keyframes square-spin {\n 25% { transform: perspective(100px) rotateX(180deg) rotateY(0); }\n 50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg); }\n 75% { transform: perspective(100px) rotateX(0) rotateY(180deg); }\n 100% { transform: perspective(100px) rotateX(0) rotateY(0); }\n}\n.${className} > div {\n animation-fill-mode: both;\n width: 50px;\n height: 50px;\n background: #fff;\n animation: square-spin 3s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite;\n}\n.app-loading-wrap {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #282c34;\n z-index: 9;\n}\n `\n const oStyle = document.createElement('style')\n const oDiv = document.createElement('div')\n\n oStyle.id = 'app-loading-style'\n oStyle.innerHTML = styleContent\n oDiv.className = 'app-loading-wrap'\n oDiv.innerHTML = `<div class=\"${className}\"><div></div></div>`\n\n return {\n appendLoading() {\n safeDOM.append(document.head, oStyle)\n safeDOM.append(document.body, oDiv)\n },\n removeLoading() {\n safeDOM.remove(document.head, oStyle)\n safeDOM.remove(document.body, oDiv)\n },\n }\n}\n\n// ----------------------------------------------------------------------\n\nconst { appendLoading, removeLoading } = useLoading()\ndomReady().then(appendLoading)\n\nwindow.onmessage = (ev) => {\n ev.data.payload === 'removeLoading' && removeLoading()\n}\n\nsetTimeout(removeLoading, 4999)\n"],"names":[],"mappings":";AAAA,SAAS,SAAS,YAAkC,CAAC,YAAY,aAAa,GAAG;AACxE,SAAA,IAAI,QAAQ,CAAC,YAAY;AAC9B,QAAI,UAAU,SAAS,SAAS,UAAU,GAAG;AAC3C,cAAQ,IAAI;AAAA,IAAA,OACP;AACI,eAAA,iBAAiB,oBAAoB,MAAM;AAClD,YAAI,UAAU,SAAS,SAAS,UAAU,GAAG;AAC3C,kBAAQ,IAAI;AAAA,QACd;AAAA,MAAA,CACD;AAAA,IACH;AAAA,EAAA,CACD;AACH;AAEA,MAAM,UAAU;AAAA,EACd,OAAO,QAAqB,OAAoB;AAC1C,QAAA,CAAC,MAAM,KAAK,OAAO,QAAQ,EAAE,KAAK,CAAA,MAAK,MAAM,KAAK,GAAG;AAChD,aAAA,OAAO,YAAY,KAAK;AAAA,IACjC;AAAA,EACF;AAAA,EACA,OAAO,QAAqB,OAAoB;AAC1C,QAAA,MAAM,KAAK,OAAO,QAAQ,EAAE,KAAK,CAAA,MAAK,MAAM,KAAK,GAAG;AAC/C,aAAA,OAAO,YAAY,KAAK;AAAA,IACjC;AAAA,EACF;AACF;AAQA,SAAS,aAAa;AACpB,QAAM,YAAY;AAClB,QAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAOpB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBK,QAAA,SAAS,SAAS,cAAc,OAAO;AACvC,QAAA,OAAO,SAAS,cAAc,KAAK;AAEzC,SAAO,KAAK;AACZ,SAAO,YAAY;AACnB,OAAK,YAAY;AACjB,OAAK,YAAY,eAAe;AAEzB,SAAA;AAAA,IACL,gBAAgB;AACN,cAAA,OAAO,SAAS,MAAM,MAAM;AAC5B,cAAA,OAAO,SAAS,MAAM,IAAI;AAAA,IACpC;AAAA,IACA,gBAAgB;AACN,cAAA,OAAO,SAAS,MAAM,MAAM;AAC5B,cAAA,OAAO,SAAS,MAAM,IAAI;AAAA,IACpC;AAAA,EAAA;AAEJ;AAIA,MAAM,EAAE,eAAe,kBAAkB;AACzC,WAAW,KAAK,aAAa;AAE7B,OAAO,YAAY,CAAC,OAAO;AACtB,KAAA,KAAK,YAAY,mBAAmB,cAAc;AACvD;AAEA,WAAW,eAAe,IAAI;"}