Nuked editor

This commit is contained in:
2023-11-12 19:53:18 -06:00
parent 9131947511
commit 5d3adb3013
23 changed files with 0 additions and 352 deletions

@ -1,11 +0,0 @@
import vnscene from './vnscene';
export const API_HANDLERS:{
[key:string]:(...args:any)=>any
} = {};
const addHandlers = (handlers:{[key:string]:(...args:any)=>any}) => {
Object.keys(handlers).forEach(key => API_HANDLERS[key] = handlers[key]);
}
addHandlers(vnscene);

@ -1,6 +0,0 @@
export default {
"vnscene:test": (bruh1:string, bruh2:string) => {
console.log("vnscene:test", bruh1, bruh2);
return 'test?';
}
};

@ -1,64 +0,0 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import * as path from 'path';
import installExtension, { REACT_DEVELOPER_TOOLS } from "electron-devtools-installer";
import { API_HANDLERS } from './api/handlers';
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
// contextIsolation: false,
preload: path.join(__dirname, 'preload.js')
}
})
if (app.isPackaged) {
// 'build/index.html'
win.loadURL(`file://${__dirname}/../index.html`);
} else {
win.loadURL('http://localhost:3000/index.html');
win.webContents.openDevTools();
// Hot Reloading on 'node_modules/.bin/electronPath'
require('electron-reload')(__dirname, {
electron: path.join(__dirname,
'..',
'..',
'node_modules',
'.bin',
'electron' + (process.platform === "win32" ? ".cmd" : "")),
forceHardReset: true,
hardResetMethod: 'exit'
});
}
}
app.whenReady().then(() => {
// DevTools
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
// Add API Handlers
Object.entries(API_HANDLERS).forEach(entry => {
ipcMain.handle(entry[0], (event:any, ...args:any) => {
return entry[1](...args);
});
})
});

@ -1,13 +0,0 @@
import { contextBridge, ipcRenderer } from 'electron';
const API_HANDLERS = [
"vnscene:test"
];
contextBridge.exposeInMainWorld(
'dawnapi',
API_HANDLERS.reduce((acc, key) => {
acc[key] = (...args:any) => ipcRenderer.invoke(key, ...args);
return acc;
}, {} as {[key:string]:()=>any})
);

@ -1,14 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"strict": true,
"outDir": "../build",
"rootDir": "../",
"noEmitOnError": true,
"typeRoots": [
"node_modules/@types"
]
}
}

@ -1,63 +0,0 @@
{
"main": "build/electron/main.js",
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/electron-devtools-installer": "^2.2.2",
"@types/jest": "^29.4.0",
"@types/node": "^18.13.0",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"electron-devtools-installer": "^3.2.0",
"electron-reload": "^1.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^3.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"postinstall": "electron-builder install-app-deps",
"electron:dev": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://127.0.0.1:3000 && tsc -p electron -w\" \"wait-on http://127.0.0.1:3000 && tsc -p electron && electron .\"",
"electron:build": "yarn build && tsc -p electron && electron-builder",
"eject": "react-scripts eject"
},
"build": {
"extends": null,
"files": [
"build/**/*"
],
"directories": {
"buildResources": "assets"
}
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"concurrently": "^7.6.0",
"cross-env": "^7.0.3",
"electron": "^23.1.0",
"electron-builder": "^23.6.0",
"wait-on": "^7.0.1"
}
}

Binary file not shown.

Before

Width: 64px  |  Height: 64px  |  Size: 22 KiB

@ -1,43 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

Binary file not shown.

Before

(image error) Size: 8.4 KiB

Binary file not shown.

Before

(image error) Size: 22 KiB

@ -1,25 +0,0 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

@ -1,2 +0,0 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *

@ -1,19 +0,0 @@
import { VNSceneEditor } from "./views/VNSceneEditor";
export const App = () => {
return (
<>
<header>
Header
</header>
<main>
<VNSceneEditor />
</main>
<footer>
Footer
</footer>
</>
);
}

@ -1,4 +0,0 @@
//@ts-ignore
const wdawnapi = (globalThis['dawnapi'] as any);
export const API_BASE = wdawnapi;

@ -1 +0,0 @@
export * from './vnscene';

@ -1,3 +0,0 @@
import { API_BASE } from "./base";
export const doVnTest = API_BASE['vnscene:test'] as (bruh1:string, bruh2:string) => Promise<string>;

@ -1,4 +0,0 @@
html,body {
margin: 0;
padding: 0;
}

@ -1,17 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { App } from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root')!);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

@ -1 +0,0 @@
/// <reference types="react-scripts" />

@ -1,15 +0,0 @@
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

@ -1,16 +0,0 @@
import React, { useState } from 'react';
import { doVnTest } from '../api';
export const VNSceneEditor = () => {
const [ test, setTest ] = useState('');
return (
<div>
VN Scene Editor
<button onClick={() => {
doVnTest('bruh1', 'bruh2').then(e => console.log(e)).catch(e => console.error(e));
}}>Clicky</button>
</div>
);
}

@ -1,26 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}