mirror of
https://github.com/mileswolfallen2/gelectron.git
synced 2026-09-08 12:43:16 +00:00
296 lines
7.1 KiB
HTML
296 lines
7.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Gelectron Demo</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
background: #0f0f1a;
|
|
color: #e0e0e0;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
header {
|
|
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
border-bottom: 1px solid #2a2a4a;
|
|
padding: 24px 32px;
|
|
}
|
|
|
|
header h1 {
|
|
font-size: 28px;
|
|
font-weight: 700;
|
|
background: linear-gradient(90deg, #7b68ee, #00d4ff);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
}
|
|
|
|
header p {
|
|
margin-top: 6px;
|
|
color: #8888aa;
|
|
font-size: 14px;
|
|
}
|
|
|
|
main {
|
|
flex: 1;
|
|
padding: 32px;
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 24px;
|
|
align-content: start;
|
|
}
|
|
|
|
.card {
|
|
background: #1a1a2e;
|
|
border: 1px solid #2a2a4a;
|
|
border-radius: 12px;
|
|
padding: 24px;
|
|
}
|
|
|
|
.card h2 {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: #7b68ee;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.card p, .card li {
|
|
font-size: 14px;
|
|
line-height: 1.7;
|
|
color: #b0b0cc;
|
|
}
|
|
|
|
.card ul {
|
|
list-style: none;
|
|
padding: 0;
|
|
}
|
|
|
|
.card ul li::before {
|
|
content: '\2713';
|
|
color: #00d4ff;
|
|
margin-right: 8px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.counter {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.counter button {
|
|
background: #2a2a4a;
|
|
color: #e0e0e0;
|
|
border: 1px solid #3a3a6a;
|
|
border-radius: 8px;
|
|
padding: 10px 20px;
|
|
font-size: 18px;
|
|
cursor: pointer;
|
|
transition: background 0.15s, transform 0.1s;
|
|
}
|
|
|
|
.counter button:hover { background: #3a3a6a; }
|
|
.counter button:active { transform: scale(0.95); }
|
|
|
|
.counter .value {
|
|
font-size: 36px;
|
|
font-weight: 700;
|
|
color: #00d4ff;
|
|
min-width: 60px;
|
|
text-align: center;
|
|
}
|
|
|
|
.canvas-wrap {
|
|
margin-top: 12px;
|
|
}
|
|
|
|
canvas {
|
|
background: #12121f;
|
|
border: 1px solid #2a2a4a;
|
|
border-radius: 8px;
|
|
display: block;
|
|
width: 100%;
|
|
height: 200px;
|
|
}
|
|
|
|
.color-bar {
|
|
display: flex;
|
|
gap: 8px;
|
|
margin-top: 12px;
|
|
}
|
|
|
|
.color-bar span {
|
|
flex: 1;
|
|
height: 32px;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
#clock {
|
|
font-size: 32px;
|
|
font-weight: 300;
|
|
color: #00d4ff;
|
|
font-variant-numeric: tabular-nums;
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.env-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.env-table td {
|
|
padding: 6px 0;
|
|
font-size: 13px;
|
|
border-bottom: 1px solid #1f1f35;
|
|
}
|
|
|
|
.env-table td:first-child {
|
|
color: #7b68ee;
|
|
font-weight: 600;
|
|
width: 40%;
|
|
}
|
|
|
|
.env-table td:last-child {
|
|
color: #b0b0cc;
|
|
font-family: 'SF Mono', Menlo, monospace;
|
|
}
|
|
|
|
footer {
|
|
padding: 16px 32px;
|
|
border-top: 1px solid #2a2a4a;
|
|
text-align: center;
|
|
font-size: 12px;
|
|
color: #555577;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Gelectron Demo</h1>
|
|
<p>HTML + CSS + JavaScript rendering via Gecko / Servo engine</p>
|
|
</header>
|
|
|
|
<main>
|
|
<div class="card">
|
|
<h2>Interactive Counter</h2>
|
|
<p>Proof that JavaScript runs and DOM updates work.</p>
|
|
<div class="counter">
|
|
<button onclick="dec()">\u2212</button>
|
|
<div class="value" id="count">0</div>
|
|
<button onclick="inc()">+</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>Live Clock</h2>
|
|
<p>requestAnimationFrame-driven rendering.</p>
|
|
<div id="clock">--:--:--</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>Canvas 2D</h2>
|
|
<p>Animated canvas with moving shapes.</p>
|
|
<div class="canvas-wrap">
|
|
<canvas id="scene" width="400" height="200"></canvas>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>Runtime Info</h2>
|
|
<p>Environment details from the gelectron shim.</p>
|
|
<table class="env-table">
|
|
<tr><td>Platform</td><td id="env-platform"></td></tr>
|
|
<tr><td>Arch</td><td id="env-arch"></td></tr>
|
|
<tr><td>Node.js</td><td id="env-node"></td></tr>
|
|
<tr><td>User Agent</td><td id="env-ua"></td></tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="card" style="grid-column: 1 / -1;">
|
|
<h2>CSS Features</h2>
|
|
<p>Grid, gradients, border-radius, transitions, flexbox, backdrop styling.</p>
|
|
<div class="color-bar">
|
|
<span style="background: #7b68ee;"></span>
|
|
<span style="background: #00d4ff;"></span>
|
|
<span style="background: #ff6b9d;"></span>
|
|
<span style="background: #ffd93d;"></span>
|
|
<span style="background: #6bcb77;"></span>
|
|
<span style="background: #ee5a24;"></span>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer>Gelectron v0.1.0 — Electron API compatibility layer powered by Gecko/Servo</footer>
|
|
|
|
<script>
|
|
// Counter
|
|
var count = 0;
|
|
var countEl = document.getElementById('count');
|
|
function inc() { countEl.textContent = ++count; }
|
|
function dec() { countEl.textContent = --count; }
|
|
|
|
// Live clock
|
|
function tick() {
|
|
var now = new Date();
|
|
var h = String(now.getHours()).padStart(2, '0');
|
|
var m = String(now.getMinutes()).padStart(2, '0');
|
|
var s = String(now.getSeconds()).padStart(2, '0');
|
|
document.getElementById('clock').textContent = h + ':' + m + ':' + s;
|
|
requestAnimationFrame(tick);
|
|
}
|
|
tick();
|
|
|
|
// Canvas animation
|
|
var canvas = document.getElementById('scene');
|
|
var ctx = canvas.getContext('2d');
|
|
var t = 0;
|
|
function drawFrame() {
|
|
t += 0.02;
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// bouncing ball
|
|
var bx = 50 + Math.sin(t) * 150;
|
|
var by = 100 + Math.cos(t * 1.3) * 60;
|
|
ctx.beginPath();
|
|
ctx.arc(bx, by, 18, 0, Math.PI * 2);
|
|
ctx.fillStyle = '#7b68ee';
|
|
ctx.fill();
|
|
|
|
// second ball
|
|
var bx2 = 200 + Math.cos(t * 0.7) * 120;
|
|
var by2 = 80 + Math.sin(t * 1.1) * 70;
|
|
ctx.beginPath();
|
|
ctx.arc(bx2, by2, 14, 0, Math.PI * 2);
|
|
ctx.fillStyle = '#00d4ff';
|
|
ctx.fill();
|
|
|
|
// trailing line
|
|
ctx.beginPath();
|
|
ctx.moveTo(0, 100 + Math.sin(t) * 40);
|
|
for (var x = 0; x < canvas.width; x += 4) {
|
|
ctx.lineTo(x, 100 + Math.sin(t + x * 0.03) * 40);
|
|
}
|
|
ctx.strokeStyle = 'rgba(123,104,238,0.3)';
|
|
ctx.lineWidth = 2;
|
|
ctx.stroke();
|
|
|
|
requestAnimationFrame(drawFrame);
|
|
}
|
|
drawFrame();
|
|
|
|
// Runtime info
|
|
document.getElementById('env-platform').textContent = navigator.platform || 'unknown';
|
|
document.getElementById('env-arch').textContent = 'unknown (browser sandbox)';
|
|
document.getElementById('env-node').textContent = 'N/A in renderer';
|
|
document.getElementById('env-ua').textContent = navigator.userAgent;
|
|
</script>
|
|
</body>
|
|
</html>
|