Parser: Support multiple components in one file, change args to params with defaults

This commit is contained in:
Aaron Sinclair committed 2025-11-15 03:25:13 -08:00
1 parent 635d466874
commit 81d51d5617
38 files changed
+2151 -455

No files matched your search

+249
View File
@@ -0,0 +1,249 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tabs - Multi-Panel Switcher - Ritz Framework</title>
<link rel="stylesheet" href="../runtime/ritz-debug.css">
<style>
body {
font-family: system-ui, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
margin: 0;
}
#app {
max-width: 900px;
margin: 50px auto;
padding: 0;
background: white;
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
overflow: hidden;
}
.tabs-container {
padding: 40px;
}
.tabs-container h1 {
color: #667eea;
margin: 0 0 10px 0;
text-align: center;
}
.subtitle {
color: #666;
font-size: 14px;
margin: 0 0 30px 0;
text-align: center;
}
/* Tab Menu - ul/li structure */
.tab-menu {
list-style: none;
padding: 0;
margin: 0 0 20px 0;
display: flex;
gap: 0;
border-bottom: 2px solid #e0e0e0;
}
.tab-menu .tab {
flex: 1;
}
.tab-menu .tab button {
width: 100%;
padding: 15px 20px;
background: transparent;
border: none;
border-bottom: 3px solid transparent;
cursor: pointer;
font-size: 16px;
font-weight: 600;
color: #666;
transition: all 0.2s;
}
.tab-menu .tab button:hover {
background: #f5f5f5;
color: #667eea;
}
.tab-menu .tab.active button {
color: #667eea;
border-bottom-color: #667eea;
background: #f8f9ff;
}
/* Tab Content */
.tab-content {
min-height: 300px;
padding: 30px;
background: #f8f9ff;
border-radius: 8px;
}
.tab-pane h2 {
margin: 0 0 20px 0;
color: #667eea;
font-size: 28px;
}
.tab-pane p {
margin: 10px 0;
color: #444;
line-height: 1.6;
}
.tab-pane ul {
margin: 20px 0;
padding-left: 20px;
}
.tab-pane li {
margin: 8px 0;
color: #555;
}
/* Specific pane styles */
.tab-pane.home {
border-left: 4px solid #667eea;
}
.tab-pane.profile {
border-left: 4px solid #764ba2;
}
.tab-pane.settings {
border-left: 4px solid #f093fb;
}
.tab-pane.error {
border-left: 4px solid #f5576c;
background: #fff5f5;
}
.profile-info {
background: white;
padding: 20px;
border-radius: 8px;
margin-top: 15px;
}
.profile-info p {
margin: 10px 0;
padding: 8px 0;
border-bottom: 1px solid #e0e0e0;
}
.profile-info p:last-child {
border-bottom: none;
}
/* Debug footer */
.debug-footer {
margin-top: 30px;
padding: 15px;
background: #e8ebff;
border-radius: 8px;
text-align: center;
}
.debug-footer p {
margin: 0;
font-family: monospace;
color: #667eea;
font-size: 14px;
}
/* Vertical Tabs (nested inside Settings) */
.vertical-tabs {
display: flex;
gap: 20px;
margin-top: 20px;
background: white;
padding: 20px;
border-radius: 8px;
}
.vertical-tab-menu {
display: flex;
flex-direction: column;
gap: 10px;
min-width: 150px;
}
.vertical-tab {
padding: 12px 20px;
background: #f0f0f0;
border: none;
border-left: 3px solid transparent;
cursor: pointer;
text-align: left;
font-size: 14px;
font-weight: 500;
color: #666;
transition: all 0.2s;
}
.vertical-tab:hover {
background: #e8ebff;
color: #667eea;
}
.vertical-tab.active {
background: #f8f9ff;
border-left-color: #667eea;
color: #667eea;
font-weight: 600;
}
.vertical-tab-content {
flex: 1;
padding: 10px;
}
.setting-pane h3 {
margin: 0 0 15px 0;
color: #667eea;
}
.setting-pane p {
margin: 8px 0;
padding: 8px;
background: #f8f9ff;
border-radius: 4px;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.tab-pane {
animation: fadeIn 0.3s ease-out;
}
</style>
</head>
<body>
<div id="app"></div>
<div id="ritz-debug" class="ritz-debug hidden">
<div class="debug-header">
<h3>🎭 Ritz Debug</h3>
<button onclick="ritzDebug.toggle()">×</button>
</div>
<div id="status" class="status">Loading...</div>
<div class="debug-content">
<div class="debug-section">
<h4>Component</h4>
<pre>Tabs.py (Multi-Panel Switcher)</pre>
</div>
<div class="debug-section">
<h4>Features</h4>
<pre>✓ Python match/case in WASM
✓ Beautiful ul/li tab structure
✓ Conditional CSS classes (active state)
✓ Component composition
✓ All logic in WASM</pre>
</div>
<div class="debug-section">
<h4>Console Commands</h4>
<pre>ritzRuntime.getLog()
ritzInstance.exports.get_active_tab()
ritzInstance.exports.go_home()</pre>
</div>
</div>
</div>
<script src="../runtime/ritz-runtime.js"></script>
<script src="../runtime/ritz-debug.js"></script>
<script>
// Wait for DOM to be ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
new RitzLoader().load('Tabs.wasm', 'Tabs', { orientation: 0 });
});
} else {
new RitzLoader().load('Tabs.wasm', 'Tabs', { orientation: 0 });
}
</script>
</body>
</html>