Initial commit: code playground with multi-framework support

Express + SQLite backend with Monaco editor frontend.
Supports HTML/CSS/JS, TypeScript, React (JSX/TSX), Vue SFC,
and Svelte with live preview, console output, save/fork/share.

Includes CSS preprocessors (SCSS, Less), framework-specific
compilation (Babel, TypeScript, Svelte compiler), and
CDN-loaded runtime libraries for preview rendering.
This commit is contained in:
root
2026-02-26 08:12:39 -06:00
commit 463b563423
14 changed files with 2550 additions and 0 deletions

148
public/css/style.css Normal file
View File

@@ -0,0 +1,148 @@
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #1e1e1e;
--surface: #252526;
--border: #3c3c3c;
--text: #cccccc;
--text-dim: #888;
--accent: #0078d4;
--accent-hover: #1a8ceb;
--toolbar-h: 44px;
--tab-h: 32px;
--label-h: 26px;
}
html, body { height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }
/* Toolbar */
.toolbar {
height: var(--toolbar-h);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12px;
background: var(--surface);
border-bottom: 1px solid var(--border);
gap: 8px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.logo { font-weight: 700; font-size: 16px; color: var(--accent); text-decoration: none; }
#title-input {
background: transparent; border: 1px solid transparent; color: var(--text);
padding: 4px 8px; border-radius: 4px; font-size: 13px; width: 180px;
}
#title-input:hover, #title-input:focus { border-color: var(--border); outline: none; }
#framework-mode {
background: var(--bg); color: var(--text); border: 1px solid var(--border);
padding: 4px 6px; border-radius: 4px; font-size: 12px; cursor: pointer;
}
button {
background: var(--accent); color: #fff; border: none; padding: 5px 14px;
border-radius: 4px; font-size: 12px; cursor: pointer; font-weight: 500;
}
button:hover { background: var(--accent-hover); }
.btn-small {
background: transparent; color: var(--text-dim); padding: 2px 6px; font-size: 11px;
}
.btn-small:hover { color: var(--text); background: var(--border); }
/* Grid layout — 2 columns: editor | preview+console */
.grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
height: calc(100vh - var(--toolbar-h));
}
.panel { position: relative; border: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; }
.panel-label {
height: var(--label-h); line-height: var(--label-h);
padding: 0 10px; font-size: 11px; font-weight: 600;
text-transform: uppercase; color: var(--text-dim);
background: var(--surface); border-bottom: 1px solid var(--border);
display: flex; align-items: center; justify-content: space-between;
flex-shrink: 0;
}
/* Editor panel — full left column */
.panel-editor { grid-column: 1; grid-row: 1 / 3; display: flex; flex-direction: column; }
.panel-preview { grid-column: 2; grid-row: 1; }
.panel-console { grid-column: 2; grid-row: 2; }
/* Tab bar */
.tab-bar {
height: var(--tab-h);
display: flex;
align-items: stretch;
background: var(--surface);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
gap: 0;
overflow-x: auto;
}
.tab-btn {
background: transparent;
color: var(--text-dim);
border: none;
border-bottom: 2px solid transparent;
padding: 0 14px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
border-radius: 0;
white-space: nowrap;
display: flex;
align-items: center;
gap: 6px;
}
.tab-btn:hover {
color: var(--text);
background: rgba(255,255,255,0.04);
}
.tab-btn.active {
color: var(--text);
border-bottom-color: var(--accent);
background: rgba(255,255,255,0.06);
}
/* CSS type selector inside tab bar */
.tab-css-type {
background: var(--bg);
color: var(--text-dim);
border: 1px solid var(--border);
padding: 1px 4px;
border-radius: 3px;
font-size: 10px;
cursor: pointer;
}
/* Editor area — holds all editor containers, only one visible at a time */
.editor-area { flex: 1; min-height: 0; position: relative; }
.editor-container {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
display: none;
}
.editor-container.active { display: block; }
#preview-frame { flex: 1; border: none; background: #fff; width: 100%; }
/* Console */
#console-output {
flex: 1; overflow-y: auto; padding: 6px 10px; font-family: 'Cascadia Code', 'Fira Code', monospace;
font-size: 12px; line-height: 1.6; background: var(--bg);
}
.console-line { padding: 1px 0; border-bottom: 1px solid #2a2a2a; white-space: pre-wrap; word-break: break-all; }
.console-log { color: var(--text); }
.console-warn { color: #cca700; }
.console-error { color: #f44747; }
.console-info { color: #3dc9b0; }
.console-debug { color: #888; }
/* Toast */
.toast {
position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
background: var(--accent); color: #fff; padding: 8px 18px; border-radius: 6px;
font-size: 13px; z-index: 999; transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }