489 lines
12 KiB
HTML
489 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Simplex Optimizer</title>
|
|
<style>
|
|
/* --- Light Theme (default) --- */
|
|
html,
|
|
body {
|
|
height: 100%;
|
|
margin: 0;
|
|
}
|
|
|
|
.big-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 100vh;
|
|
/* ensures container is at least full viewport height */
|
|
}
|
|
|
|
|
|
body {
|
|
margin: 0;
|
|
font-family: Arial, sans-serif;
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100vh;
|
|
background: #f8f9fa;
|
|
color: #212529;
|
|
transition: background 0.3s, color 0.3s;
|
|
}
|
|
|
|
/* Header */
|
|
.header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 15px 20px;
|
|
background: #ffffff;
|
|
border-bottom: 1px solid #dee2e6;
|
|
transition: background 0.3s, color 0.3s;
|
|
}
|
|
|
|
.header h1 {
|
|
margin: 0;
|
|
font-size: 1.5rem;
|
|
color: #212529;
|
|
}
|
|
|
|
/* Theme toggle button */
|
|
.theme-btn {
|
|
background: none;
|
|
border: none;
|
|
font-size: 1.5rem;
|
|
cursor: pointer;
|
|
transition: transform 0.2s;
|
|
}
|
|
|
|
.theme-btn:hover {
|
|
transform: rotate(20deg);
|
|
}
|
|
|
|
.container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
}
|
|
|
|
/* Top input section */
|
|
.input-section {
|
|
display: flex;
|
|
flex: 1;
|
|
padding: 20px;
|
|
gap: 20px;
|
|
background: #ffffff;
|
|
border-bottom: 2px solid #dee2e6;
|
|
transition: background 0.3s, border-color 0.3s;
|
|
}
|
|
|
|
.input-box {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: #f1f3f5;
|
|
border-radius: 10px;
|
|
padding: 15px;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
|
|
overflow-y: auto;
|
|
transition: background 0.3s;
|
|
}
|
|
|
|
.input-box h2 {
|
|
margin: 0 0 10px 0;
|
|
font-size: 1.2rem;
|
|
color: #343a40;
|
|
transition: color 0.3s;
|
|
}
|
|
|
|
.sub-section {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.sub-section h3 {
|
|
margin: 0 0 8px 0;
|
|
font-size: 1rem;
|
|
color: #495057;
|
|
transition: color 0.3s;
|
|
}
|
|
|
|
.input-row {
|
|
display: flex;
|
|
gap: 8px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.input-row input {
|
|
flex: 1;
|
|
padding: 8px;
|
|
border: 1px solid #ced4da;
|
|
border-radius: 5px;
|
|
font-size: 0.9rem;
|
|
background: #ffffff;
|
|
color: #212529;
|
|
transition: background 0.3s, color 0.3s, border-color 0.3s;
|
|
}
|
|
|
|
.input-row button {
|
|
padding: 8px 12px;
|
|
background: #007bff;
|
|
border: none;
|
|
color: white;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-size: 0.9rem;
|
|
transition: background 0.3s;
|
|
}
|
|
|
|
.input-row button:hover {
|
|
background: #0056b3;
|
|
}
|
|
|
|
ul {
|
|
list-style: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
li {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
background: #ffffff;
|
|
padding: 6px 10px;
|
|
margin-bottom: 6px;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 5px;
|
|
font-size: 0.9rem;
|
|
transition: background 0.3s, border-color 0.3s, color 0.3s;
|
|
}
|
|
|
|
.remove-btn {
|
|
background: #dc3545;
|
|
border: none;
|
|
color: white;
|
|
padding: 4px 8px;
|
|
font-size: 0.75rem;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
transition: background 0.3s;
|
|
}
|
|
|
|
.remove-btn:hover {
|
|
background: #b02a37;
|
|
}
|
|
|
|
/* Right side objective */
|
|
.objective {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.objective input {
|
|
margin-bottom: 10px;
|
|
padding: 8px;
|
|
border: 1px solid #ced4da;
|
|
border-radius: 5px;
|
|
font-size: 0.9rem;
|
|
background: #ffffff;
|
|
color: #212529;
|
|
transition: background 0.3s, color 0.3s, border-color 0.3s;
|
|
}
|
|
|
|
.objective button {
|
|
padding: 10px;
|
|
background: #28a745;
|
|
border: none;
|
|
color: white;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-size: 0.95rem;
|
|
transition: background 0.3s;
|
|
}
|
|
|
|
.objective button:hover {
|
|
background: #1e7e34;
|
|
}
|
|
|
|
/* Bottom output section */
|
|
.output-section {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 20px;
|
|
background: #fdfdfd;
|
|
overflow-y: auto;
|
|
transition: background 0.3s;
|
|
}
|
|
|
|
.steps {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 15px;
|
|
background: #f8f9fa;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 8px;
|
|
margin-bottom: 15px;
|
|
transition: background 0.3s, border-color 0.3s;
|
|
}
|
|
|
|
.steps h3 {
|
|
margin-top: 0;
|
|
color: #495057;
|
|
transition: color 0.3s;
|
|
}
|
|
|
|
.steps ul {
|
|
padding-left: 20px;
|
|
}
|
|
|
|
.final-result {
|
|
background: #e9f7ef;
|
|
border: 1px solid #c3e6cb;
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
font-weight: bold;
|
|
color: #155724;
|
|
transition: background 0.3s, color 0.3s, border-color 0.3s;
|
|
}
|
|
|
|
/* --- Dark Theme --- */
|
|
.big-container.dark-theme {
|
|
background: #121212;
|
|
color: #e9ecef;
|
|
}
|
|
|
|
.big-container.dark-theme .header {
|
|
background: #1e1e1e;
|
|
border-bottom: 1px solid #343a40;
|
|
}
|
|
|
|
.big-container.dark-theme .header h1 {
|
|
color: #f8f9fa;
|
|
}
|
|
|
|
|
|
.big-container.dark-theme .input-section {
|
|
background: #1e1e1e;
|
|
border-bottom: 2px solid #343a40;
|
|
}
|
|
|
|
.big-container.dark-theme .input-box {
|
|
background: #2a2a2a;
|
|
}
|
|
|
|
.big-container.dark-theme .input-box h2,
|
|
.big-container.dark-theme .sub-section h3 {
|
|
color: #f8f9fa;
|
|
}
|
|
|
|
.big-container.dark-theme .input-row input,
|
|
.big-container.dark-theme .objective input {
|
|
background: #343a40;
|
|
color: #e9ecef;
|
|
border: 1px solid #495057;
|
|
}
|
|
|
|
.big-container.dark-theme li {
|
|
background: #1e1e1e;
|
|
border: 1px solid #495057;
|
|
color: #e9ecef;
|
|
}
|
|
|
|
.big-container.dark-theme .output-section {
|
|
background: #1a1a1a;
|
|
}
|
|
|
|
.big-container.dark-theme .steps {
|
|
background: #2a2a2a;
|
|
border: 1px solid #495057;
|
|
}
|
|
|
|
.big-container.dark-theme .steps h3 {
|
|
color: #f8f9fa;
|
|
}
|
|
|
|
.big-container.dark-theme .final-result {
|
|
background: #1e3d2d;
|
|
border: 1px solid #155724;
|
|
color: #a8e6a3;
|
|
}
|
|
|
|
.big-container.dark-theme .input-row button {
|
|
background: #0d6efd;
|
|
}
|
|
|
|
.big-container.dark-theme .input-row button:hover {
|
|
background: #084298;
|
|
}
|
|
|
|
.big-container.dark-theme .objective button {
|
|
background: #198754;
|
|
}
|
|
|
|
.big-container.dark-theme .objective button:hover {
|
|
background: #145c32;
|
|
}
|
|
|
|
.big-container.dark-theme .remove-btn {
|
|
background: #dc3545;
|
|
}
|
|
|
|
.big-container.dark-theme .remove-btn:hover {
|
|
background: #b02a37;
|
|
}
|
|
</style>
|
|
|
|
<link rel="modulepreload" href="/simplex_web-678e6d27fa09c665.js" crossorigin="anonymous" integrity="sha384-jLsG/i5rhprifngulT1z1YIwB1qvFSKIPhhIlTBchM7UuLGFmxeYIgWRGtZRQMqL"><link rel="preload" href="/simplex_web-678e6d27fa09c665_bg.wasm" crossorigin="anonymous" integrity="sha384-waSdPUoWT1KI3EIzZeCg71qrYUKlVW0ZumxbfGJa5lVaTig8XWxlR1wYaxRF2Nk3" as="fetch" type="application/wasm"></head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
<script type="module">
|
|
import init, * as bindings from '/simplex_web-678e6d27fa09c665.js';
|
|
const wasm = await init({ module_or_path: '/simplex_web-678e6d27fa09c665_bg.wasm' });
|
|
|
|
|
|
window.wasmBindings = bindings;
|
|
|
|
|
|
dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}}));
|
|
|
|
</script><script>"use strict";
|
|
|
|
(function () {
|
|
|
|
const address = '{{__TRUNK_ADDRESS__}}';
|
|
const base = '{{__TRUNK_WS_BASE__}}';
|
|
let protocol = '';
|
|
protocol =
|
|
protocol
|
|
? protocol
|
|
: window.location.protocol === 'https:'
|
|
? 'wss'
|
|
: 'ws';
|
|
const url = protocol + '://' + address + base + '.well-known/trunk/ws';
|
|
|
|
class Overlay {
|
|
constructor() {
|
|
// create an overlay
|
|
this._overlay = document.createElement("div");
|
|
const style = this._overlay.style;
|
|
style.height = "100vh";
|
|
style.width = "100vw";
|
|
style.position = "fixed";
|
|
style.top = "0";
|
|
style.left = "0";
|
|
style.backgroundColor = "rgba(222, 222, 222, 0.5)";
|
|
style.fontFamily = "sans-serif";
|
|
// not sure that's the right approach
|
|
style.zIndex = "1000000";
|
|
style.backdropFilter = "blur(1rem)";
|
|
|
|
const container = document.createElement("div");
|
|
// center it
|
|
container.style.position = "absolute";
|
|
container.style.top = "30%";
|
|
container.style.left = "15%";
|
|
container.style.maxWidth = "85%";
|
|
|
|
this._title = document.createElement("div");
|
|
this._title.innerText = "Build failure";
|
|
this._title.style.paddingBottom = "2rem";
|
|
this._title.style.fontSize = "2.5rem";
|
|
|
|
this._message = document.createElement("div");
|
|
this._message.style.whiteSpace = "pre-wrap";
|
|
|
|
const icon= document.createElement("div");
|
|
icon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" fill="#dc3545" viewBox="0 0 16 16"><path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/></svg>';
|
|
this._title.prepend(icon);
|
|
|
|
container.append(this._title, this._message);
|
|
this._overlay.append(container);
|
|
|
|
this._inject();
|
|
window.setInterval(() => {
|
|
this._inject();
|
|
}, 250);
|
|
}
|
|
|
|
set reason(reason) {
|
|
this._message.textContent = reason;
|
|
}
|
|
|
|
_inject() {
|
|
if (!this._overlay.isConnected) {
|
|
// prepend it
|
|
document.body?.prepend(this._overlay);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
class Client {
|
|
constructor(url) {
|
|
this.url = url;
|
|
this.poll_interval = 5000;
|
|
this._overlay = null;
|
|
}
|
|
|
|
start() {
|
|
const ws = new WebSocket(this.url);
|
|
ws.onmessage = (ev) => {
|
|
const msg = JSON.parse(ev.data);
|
|
switch (msg.type) {
|
|
case "reload":
|
|
this.reload();
|
|
break;
|
|
case "buildFailure":
|
|
this.buildFailure(msg.data)
|
|
break;
|
|
}
|
|
};
|
|
ws.onclose = () => this.onclose();
|
|
}
|
|
|
|
onclose() {
|
|
window.setTimeout(
|
|
() => {
|
|
// when we successfully reconnect, we'll force a
|
|
// reload (since we presumably lost connection to
|
|
// trunk due to it being killed, so it will have
|
|
// rebuilt on restart)
|
|
const ws = new WebSocket(this.url);
|
|
ws.onopen = () => window.location.reload();
|
|
ws.onclose = () => this.onclose();
|
|
},
|
|
this.poll_interval);
|
|
}
|
|
|
|
reload() {
|
|
window.location.reload();
|
|
}
|
|
|
|
buildFailure({reason}) {
|
|
// also log the console
|
|
console.error("Build failed:", reason);
|
|
|
|
console.debug("Overlay", this._overlay);
|
|
|
|
if (!this._overlay) {
|
|
this._overlay = new Overlay();
|
|
}
|
|
this._overlay.reason = reason;
|
|
}
|
|
}
|
|
|
|
new Client(url).start();
|
|
|
|
})()
|
|
</script></body>
|
|
|
|
</html> |