<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>noyalib-wasm — browser demo</title>
<style>
body { font-family: monospace; max-width: 720px; margin: 2rem auto; padding: 0 1rem; }
textarea { width: 100%; height: 12rem; font-family: monospace; font-size: 0.95rem; }
pre { background: #f3f4f6; padding: 0.75rem; border-radius: 4px; }
.row { margin: 1rem 0; }
.ok { color: #059669; }
.err { color: #dc2626; }
</style>
</head>
<body>
<h1>noyalib-wasm</h1>
<p>Edit the YAML below; the parser runs in-browser via WASM.</p>
<div class="row">
<textarea id="input">host: api.example.com
port: 8080
features:
- auth
- api
</textarea>
</div>
<div class="row">
<strong>Status:</strong> <span id="status">…</span>
</div>
<div class="row">
<strong>Parsed JSON:</strong>
<pre id="output"></pre>
</div>
<script type="module">
import init, { parse } from "../../pkg/noyalib_wasm.js";
const input = document.getElementById("input");
const status = document.getElementById("status");
const output = document.getElementById("output");
await init();
const refresh = () => {
try {
const obj = parse(input.value);
status.textContent = "valid ✓";
status.className = "ok";
output.textContent = JSON.stringify(obj, null, 2);
} catch (e) {
status.textContent = "parse error: " + e.message;
status.className = "err";
output.textContent = "";
}
};
input.addEventListener("input", refresh);
refresh();
</script>
</body>
</html>