Parser: Support multiple components in one file, change args to params with defaults
This commit is contained in:
1 parent
635d466874
commit
81d51d5617
38 files changed
+2151
-455
No files matched your search
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Ritz Debug Bar Controller
|
||||
*/
|
||||
|
||||
class RitzDebug {
|
||||
constructor() {
|
||||
this.debugBar = document.getElementById('ritz-debug');
|
||||
this.isOpen = false;
|
||||
|
||||
// Setup keyboard shortcut (Ctrl+`)
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.ctrlKey && e.key === '`') {
|
||||
e.preventDefault();
|
||||
this.toggle();
|
||||
}
|
||||
});
|
||||
|
||||
// Show hint on first load
|
||||
this.showHint();
|
||||
}
|
||||
|
||||
toggle() {
|
||||
this.isOpen = !this.isOpen;
|
||||
|
||||
if (this.debugBar) {
|
||||
if (this.isOpen) {
|
||||
this.debugBar.classList.remove('hidden');
|
||||
document.body.classList.add('debug-open');
|
||||
} else {
|
||||
this.debugBar.classList.add('hidden');
|
||||
document.body.classList.remove('debug-open');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open() {
|
||||
this.isOpen = true;
|
||||
if (this.debugBar) {
|
||||
this.debugBar.classList.remove('hidden');
|
||||
document.body.classList.add('debug-open');
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
this.isOpen = false;
|
||||
if (this.debugBar) {
|
||||
this.debugBar.classList.add('hidden');
|
||||
document.body.classList.remove('debug-open');
|
||||
}
|
||||
}
|
||||
|
||||
showHint() {
|
||||
// Show toggle hint for 3 seconds
|
||||
const hint = document.createElement('div');
|
||||
hint.className = 'debug-toggle-hint';
|
||||
hint.textContent = 'Press Ctrl+` to toggle debug';
|
||||
document.body.appendChild(hint);
|
||||
|
||||
setTimeout(() => {
|
||||
hint.remove();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
log(message, type = 'info') {
|
||||
const status = document.getElementById('status');
|
||||
if (status) {
|
||||
status.textContent = message;
|
||||
status.className = 'status ' + type;
|
||||
}
|
||||
console.log(`[Ritz] ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize debug controller
|
||||
const ritzDebug = new RitzDebug();
|
||||
|
||||
// Export
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = RitzDebug;
|
||||
} else {
|
||||
window.RitzDebug = RitzDebug;
|
||||
window.ritzDebug = ritzDebug;
|
||||
}
|
||||
Reference in new issue
Block a user