math-tasks/assets/themes/sonic/components/diamond/diamond.editor.html

72 lines
3.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Component Editor — sonic-diamond</title>
<style>
:root {
--bg: #f5f5f7;
--panel: #ffffff;
--line: #e5e5ea;
--text: #1c1c1e;
--muted: #8e8e93;
--accent: #0a84ff;
--invalid: #fafafa;
}
* { box-sizing: border-box; }
body { margin: 0; font: 13px/1.4 -apple-system, system-ui, sans-serif;
background: var(--bg); color: var(--text); }
header { position: sticky; top: 0; z-index: 10;
background: var(--panel); border-bottom: 1px solid var(--line);
padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
header h1 { margin: 0; font-size: 15px; font-weight: 600; }
header .meta { color: var(--muted); font-size: 12px; }
header button { font: inherit; padding: 6px 14px;
background: var(--accent); color: white;
border: none; border-radius: 6px; cursor: pointer; }
header button:hover { opacity: 0.9; }
main { padding: 20px; }
section { margin-bottom: 32px; }
section > h2 { margin: 0 0 12px; font-size: 13px; font-weight: 600;
color: var(--muted); text-transform: uppercase;
letter-spacing: 0.5px; }
.grid { display: grid; gap: 12px; background: var(--panel);
padding: 16px; border-radius: 10px; border: 1px solid var(--line); }
.cell { display: flex; flex-direction: column; align-items: center;
gap: 6px; padding: 12px; border: 1px solid var(--line);
border-radius: 8px; background: white; min-height: 110px;
justify-content: center; }
.cell.invalid { background: var(--invalid); opacity: 0.4; }
.cell .preview { position: relative; width: 24mm; height: 24mm;
display: flex; align-items: center; justify-content: center; }
/* Stage component absolutely inside preview, centered. The component
uses absolute positioning, so we offset to center it visually. */
.cell .preview sonic-diamond { position: absolute !important;
left: 50% !important; top: 50% !important;
transform: translate(-50%, -50%) !important; }
.cell .label { font-size: 10px; color: var(--muted);
text-align: center; line-height: 1.3; }
.cell .key { font-family: ui-monospace, Menlo, monospace;
font-size: 9px; color: var(--text); }
#toast { position: fixed; bottom: 20px; left: 50%;
transform: translateX(-50%); padding: 10px 20px;
background: var(--text); color: white; border-radius: 8px;
opacity: 0; pointer-events: none; transition: opacity 0.2s;
font-size: 12px; }
#toast.show { opacity: 1; }
</style>
<script type="module" src="./diamond.mjs"></script>
</head>
<body>
<header>
<h1>sonic-diamond</h1>
<span class="meta" id="meta"></span>
<span style="flex: 1"></span>
<button id="btn-copy">Copy snapshot</button>
</header>
<main id="main"></main>
<div id="toast">Snapshot copied</div>
<script type="module" src="./diamond.editor.mjs"></script>
</body>
</html>