gram/packages/playground/index.html

90 lines
4.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GRAM Language Playground</title>
<link rel="stylesheet" href="dist/style.css">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="/favicon.png">
<!-- Highlight.js -->
<!-- Highlight.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.8.0/highlightjs-line-numbers.min.js"></script>
</head>
<body>
<div class="container">
<header>
<div style="display: flex; justify-content: space-between; align-items: center;">
<div>
<h1><span style="color: #52525b">Gram</span> Playground</h1>
</div>
<div style="display: flex; gap: 1rem; align-items: center;">
<select id="examples-select" style="background: var(--card); color: var(--foreground); border: 1px solid var(--border); padding: 0.5rem; border-radius: 0.375rem; font-family: var(--font-sans); cursor: pointer;">
<option value="" disabled selected>Load Example...</option>
<option value="pancakes">Simple Pancakes</option>
<option value="spaghetti">Spaghetti Bolognese</option>
<option value="torture">Torture Test (Syntax)</option>
</select>
<button id="theme-toggle" style="background:none; border:none; cursor:pointer; padding:0.5rem; border-radius: 0.375rem; color: inherit; display: inline-flex; align-items: center; justify-content: center; transition: background-color 0.2s; line-height: 0;">
<!-- Icon inserted by JS -->
</button>
</div>
</div>
</header>
<main class="playground">
<section class="editor-section">
<div class="header-bar">
<h2>Input (.gram)</h2>
</div>
<div class="editor-container">
<div class="backdrop">
<div class="highlights" id="highlights"></div>
</div>
<textarea id="input" spellcheck="false" placeholder="Write your recipe here...">## Pancakes
[Mix] The @flour{200g} with the @milk{300ml}.
[Add] The @eggs{2} and mix well.
[Cook] On a #griddle{} at !{170°C}for ~pancakes{5min}.
</textarea>
</div>
</section>
<section class="result-section">
<div class="header-bar">
<div style="display: flex; gap: 1rem; align-items: center;">
<h2>Output</h2>
<div class="tabs" style="display: flex; gap: 0.25rem; background: var(--secondary); padding: 0.25rem; border-radius: 6px;">
<button class="tab-btn active" data-mode="json">JSON (Text)</button>
<button class="tab-btn" data-mode="json-tree">Tree</button>
<button class="tab-btn" data-mode="markdown">Markdown</button>
<button class="tab-btn" data-mode="preview">Preview</button>
</div>
</div>
<div style="display: flex; gap: 1rem; align-items: center;">
<button id="copy-btn" class="tab-btn" title="Copy to Clipboard" style="display: flex; align-items: center; justify-content: center;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 256 256"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"></path></svg>
</button>
<span id="status" class="status success">Valid</span>
</div>
</div>
<div id="warnings" style="display: none; background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.2); border-radius: 6px; padding: 0.75rem; margin-bottom: 1rem; font-family: monospace; font-size: 0.9rem;"></div>
<div class="code-viewer">
<pre><code id="output"></code></pre>
<div id="preview-output" class="preview-output" style="display: none;"></div>
</div>
</section>
</main>
</div>
<script src="dist/app.js"></script>
</body>
</html>