A React Scaffold That Turns Dashboard Assembly into Drag-and-Drop Configuration
Visualization dashboards for smart cities, factories, and ops centers share the same repetitive engineering: layout, scaling, routing, and config persistence. A framework that standardizes these layers means teams stop rewriting the same glue code and start treating dashboards as assembled configurations rather than bespoke pages.
Dashboard projects quickly outgrow hardcoded layouts. `@lius1314/visual-dashboard-scaffold` provides an assembly layer where chart blocks, 3D maps, and business components are registered once and then arranged via drag-and-drop in a visual editor. Pixel-based coordinates match design handoff directly, while autofit.js handles proportional scaling across 16:9, 21:9, 32:9, and portrait screens.
The scaffold handles multi-page routing with parameter merging, a scoped EventBus for cross-component communication, and a hybrid persistence strategy that splits small metadata into localStorage and page details into IndexedDB to avoid lag during frequent drag operations. Themes, backgrounds, card decorations, and fonts ship as built-in assets with a selector panel, and custom assets can be injected at runtime.
Configuration export produces a JSON snapshot that can be loaded as an initial config in production. The edit-mode UI stays usable because only the content canvas scales, not the tool panels. A built-in action system maps clicks on headers, footers, and chart blocks to page switches, event emissions, or custom handler calls registered by the host application.
Pixel-based layout is a deliberate rejection of responsive grid systems for dashboards. Designers hand off exact coordinates, and converting them to grid fractions adds friction without benefit when the final output is a fixed-canvas screen.
Hybrid persistence (localStorage + IndexedDB) is an underappreciated pattern. Dumping a large JSON blob into localStorage on every drag event guarantees jank; splitting metadata from page bodies and throttling writes solves this without introducing a backend.
Scaling only the content canvas in edit mode, not the entire viewport, is a small detail that determines whether a visual editor is actually usable. Shrinking tool panels alongside the canvas makes precise adjustments impossible.
Making initialConfig a one-time default rather than a persistent override protects non-technical users who tweak layouts in production. It acknowledges that the exported JSON is a starting point, not a source of truth.
The action system's `custom` handler type creates an extension point that keeps the scaffold agnostic about what happens when a user clicks something. Host applications own the business logic; the scaffold only routes the click.