Add Electron test harness with example plugin
This commit is contained in:
225
test/electron/index.html
Normal file
225
test/electron/index.html
Normal file
@@ -0,0 +1,225 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>@paarrot/plugin-manager — Electron Test</title>
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
body {
|
||||
font-family: 'Segoe UI', system-ui, sans-serif;
|
||||
font-size: 13px;
|
||||
background: #1a1a2e;
|
||||
color: #e0e0e0;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
header {
|
||||
padding: 10px 16px;
|
||||
background: #16213e;
|
||||
border-bottom: 1px solid #0f3460;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
header h1 { font-size: 14px; font-weight: 600; color: #e94560; }
|
||||
|
||||
#status-badge {
|
||||
font-size: 11px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
background: #333;
|
||||
color: #888;
|
||||
}
|
||||
#status-badge.loaded { background: #1a4a2e; color: #4caf50; }
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
gap: 1px;
|
||||
background: #0f3460;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: #1a1a2e;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.panel-header {
|
||||
padding: 8px 12px;
|
||||
background: #16213e;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: #7986cb;
|
||||
border-bottom: 1px solid #0f3460;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.panel-body {
|
||||
flex: 1;
|
||||
padding: 12px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* Inputs / buttons */
|
||||
input[type="text"], select {
|
||||
background: #0f3460;
|
||||
border: 1px solid #233a6e;
|
||||
color: #e0e0e0;
|
||||
padding: 6px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
width: 100%;
|
||||
outline: none;
|
||||
}
|
||||
input[type="text"]:focus, select:focus { border-color: #7986cb; }
|
||||
|
||||
button {
|
||||
padding: 6px 14px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
background: #0f3460;
|
||||
color: #e0e0e0;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
button:hover { background: #1a4a8e; }
|
||||
button.primary { background: #e94560; color: #fff; }
|
||||
button.primary:hover { background: #c73652; }
|
||||
|
||||
.row { display: flex; gap: 8px; align-items: center; }
|
||||
.row input { flex: 1; }
|
||||
|
||||
/* Command list */
|
||||
#cmd-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
|
||||
#cmd-list li { font-size: 12px; color: #aaa; }
|
||||
#cmd-list code { color: #e94560; font-size: 12px; }
|
||||
|
||||
/* Message result */
|
||||
#msg-result {
|
||||
background: #0f3460;
|
||||
border: 1px solid #233a6e;
|
||||
border-radius: 4px;
|
||||
padding: 8px;
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
white-space: pre-wrap;
|
||||
min-height: 52px;
|
||||
color: #b0bec5;
|
||||
}
|
||||
|
||||
/* Settings */
|
||||
.setting-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 6px 0;
|
||||
border-bottom: 1px solid #12244a;
|
||||
}
|
||||
.setting-row label { flex: 1; color: #b0bec5; font-size: 12px; }
|
||||
.setting-row input[type="checkbox"] { width: auto; }
|
||||
.setting-row input[type="text"], .setting-row select { width: 140px; flex: none; }
|
||||
|
||||
/* Log */
|
||||
#log {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
font-family: monospace;
|
||||
font-size: 11px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.log-entry { padding: 2px 0; }
|
||||
.log-log { color: #90a4ae; }
|
||||
.log-info { color: #7986cb; }
|
||||
.log-success { color: #4caf50; }
|
||||
.log-error { color: #e94560; }
|
||||
.log-warn { color: #ffb300; }
|
||||
|
||||
/* Theme section */
|
||||
.theme-row { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>@paarrot/plugin-manager</h1>
|
||||
<span id="status-badge">Loading…</span>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<!-- Top-left: Commands -->
|
||||
<div class="panel">
|
||||
<div class="panel-header">Commands</div>
|
||||
<div class="panel-body">
|
||||
<div>
|
||||
<div style="font-size:11px;color:#7986cb;margin-bottom:6px;">Registered commands:</div>
|
||||
<ul id="cmd-list"><li style="color:#555">Loading…</li></ul>
|
||||
</div>
|
||||
<div class="row">
|
||||
<input type="text" id="cmd-input" placeholder="/hello World" />
|
||||
<button class="primary" id="cmd-run">Run</button>
|
||||
</div>
|
||||
<div id="cmd-result" style="font-family:monospace;font-size:12px;color:#4caf50;min-height:20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Top-right: Message Interceptor -->
|
||||
<div class="panel">
|
||||
<div class="panel-header">Message Interceptor</div>
|
||||
<div class="panel-body">
|
||||
<div style="font-size:11px;color:#7986cb;">
|
||||
Type a message. The plugin will expand abbreviations like <code style="color:#e94560">brb</code>, <code style="color:#e94560">omw</code>, <code style="color:#e94560">afk</code>.
|
||||
</div>
|
||||
<textarea id="msg-input" rows="3"
|
||||
style="background:#0f3460;border:1px solid #233a6e;color:#e0e0e0;padding:8px;border-radius:4px;font-size:13px;resize:none;width:100%;outline:none;"
|
||||
placeholder="Type something… try 'brb' or 'omw'"></textarea>
|
||||
<button class="primary" id="msg-send">Process Message</button>
|
||||
<pre id="msg-result"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bottom-left: Settings + Theme -->
|
||||
<div class="panel">
|
||||
<div class="panel-header">Settings & Theme</div>
|
||||
<div class="panel-body">
|
||||
<div style="font-size:11px;color:#7986cb;margin-bottom:4px;">Plugin settings (persisted to localStorage):</div>
|
||||
<div id="settings-container"></div>
|
||||
<div style="margin-top:8px;font-size:11px;color:#7986cb;">Plugin Themes:</div>
|
||||
<div class="theme-row">
|
||||
<button id="theme-apply">Apply Ocean Blue</button>
|
||||
<button id="theme-reset">Reset Theme</button>
|
||||
</div>
|
||||
<div style="margin-top:8px;font-size:11px;color:#7986cb;">Events:</div>
|
||||
<button id="event-fire">Fire test-event</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bottom-right: Log -->
|
||||
<div class="panel">
|
||||
<div class="panel-header">Log</div>
|
||||
<div class="panel-body" style="padding:8px;">
|
||||
<div id="log"></div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user