134 lines
3.9 KiB
HTML
134 lines
3.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>Toggle - Conditional Rendering - 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;
|
||
}
|
||
#app {
|
||
max-width: 800px;
|
||
margin: 50px auto;
|
||
padding: 40px;
|
||
background: white;
|
||
border-radius: 12px;
|
||
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
|
||
}
|
||
.toggle-app {
|
||
text-align: center;
|
||
}
|
||
.toggle-app h1 {
|
||
color: #667eea;
|
||
margin-bottom: 10px;
|
||
}
|
||
.toggle-app .info {
|
||
color: #666;
|
||
font-size: 14px;
|
||
margin-bottom: 30px;
|
||
}
|
||
.toggle-app .controls {
|
||
margin: 30px 0;
|
||
}
|
||
.toggle-app button {
|
||
font-size: 18px;
|
||
padding: 15px 40px;
|
||
background: #667eea;
|
||
color: white;
|
||
border: none;
|
||
border-radius: 8px;
|
||
cursor: pointer;
|
||
transition: all 0.2s;
|
||
font-weight: 600;
|
||
}
|
||
.toggle-app button:hover {
|
||
background: #5568d3;
|
||
transform: translateY(-2px);
|
||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
|
||
}
|
||
.toggle-app button:active {
|
||
transform: translateY(0);
|
||
}
|
||
.toggle-app .display {
|
||
margin-top: 40px;
|
||
min-height: 150px;
|
||
}
|
||
.toggle-app .high,
|
||
.toggle-app .low {
|
||
padding: 30px;
|
||
border-radius: 8px;
|
||
animation: fadeIn 0.3s;
|
||
}
|
||
.toggle-app .high {
|
||
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
||
color: white;
|
||
}
|
||
.toggle-app .low {
|
||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||
color: white;
|
||
}
|
||
.toggle-app .high p,
|
||
.toggle-app .low p {
|
||
margin: 10px 0;
|
||
font-size: 18px;
|
||
}
|
||
.toggle-app .count {
|
||
font-size: 36px;
|
||
font-weight: bold;
|
||
margin-top: 20px;
|
||
}
|
||
@keyframes fadeIn {
|
||
from { opacity: 0; transform: scale(0.95); }
|
||
to { opacity: 1; transform: scale(1); }
|
||
}
|
||
</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>Toggle.py (Conditional Rendering)</pre>
|
||
</div>
|
||
<div class="debug-section">
|
||
<h4>Features</h4>
|
||
<pre>✓ if/else statements in WASM
|
||
✓ Comparison operators (>)
|
||
✓ Conditional DOM rendering
|
||
✓ Signal-based conditions</pre>
|
||
</div>
|
||
<div class="debug-section">
|
||
<h4>Console Commands</h4>
|
||
<pre>ritzRuntime.getLog()
|
||
ritzInstance.exports.get_count()
|
||
ritzInstance.exports.increment()</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('Toggle.wasm', 'Toggle');
|
||
});
|
||
} else {
|
||
new RitzLoader().load('Toggle.wasm', 'Toggle');
|
||
}
|
||
</script>
|
||
</body>
|
||
</html>
|