feat: add StorageManager, VisualizationManager, UIManager, EditorManager, and update PanelResizer for improved snippet handling and visualization

This commit is contained in:
2025-01-19 03:46:25 +02:00
parent 9bb476c135
commit 811d981ab9
6 changed files with 208 additions and 142 deletions

View File

@@ -0,0 +1,22 @@
export class VisualizationManager {
constructor(containerId = 'vis') {
this.containerId = containerId;
}
async updateVisualization(spec) {
try {
const parsedSpec = typeof spec === 'string' ? JSON.parse(spec) : spec;
parsedSpec.width = parsedSpec.width || 'container';
parsedSpec.height = parsedSpec.height || 'container';
await vegaEmbed(`#${this.containerId}`, parsedSpec, {
actions: true,
theme: 'light'
});
} catch (err) {
console.error('Error rendering visualization:', err);
document.getElementById(this.containerId).innerHTML =
`<div style="color: red; padding: 1rem;">Error rendering visualization: ${err.message}</div>`;
}
}
}