@datastripes/dashboard
v1.3.3
Published
Zero-backend, in-memory dashboard builder (drag-and-drop grid, JSON-driven widgets, ECharts rendering) with drop-in components for React, Vue, Angular, and vanilla Custom Elements, shipped as one package with one subpath per framework.
Readme
@datastripes/dashboard
Zero-backend, in-memory dashboard builder: a 12-column drag-and-drop grid of
JSON-driven widgets (kpi_card, echarts, table, filter_panel,
markdown) rendered with Apache ECharts, with drop-in components for React,
Vue, Angular, and vanilla Custom Elements, in one npm package.
npm install @datastripes/dashboardLive demo · Product page · Docs
| Import path | Contents | Needs |
|---|---|---|
| @datastripes/dashboard | Core engine: DashboardConfig Zod schema, QueryEngine (in-memory today, swappable for a WASM backend later), headless grid engine, DashboardStore, widget logic, licensing client | nothing |
| @datastripes/dashboard/react | DatastripesDashboard component + widget sub-components | react, react-dom ^19 |
| @datastripes/dashboard/vue | DatastripesDashboard SFC | vue ^3.4 |
| @datastripes/dashboard/angular | DatastripesDashboardComponent, Angular Package Format | @angular/core, @angular/common ^18 || ^19 |
| @datastripes/dashboard/elements | <datastripes-dashboard> Custom Element | nothing |
The UI frameworks are optional peer dependencies, so installing the package
never pulls one in. React re-implements the grid/widget rendering as JSX for a
richer idiomatic API; Vue, Angular, and Elements all mount the same
framework-free mountDashboard() DOM renderer from the core. Every framework
entry re-exports the core API, and all entries share one copy of the core
engine at runtime.
From a file to a dashboard
import { mountAutoDashboard } from '@datastripes/dashboard';
const { generated, file } = await mountAutoDashboard(element, droppedFile, { apiKey, locale: 'it-IT' });Takes a File, Blob, ArrayBuffer or text (CSV, TSV, JSON, .xlsx), in any
framework, since it only needs a DOM element. Generation needs a valid license:
on a trial license generated is false and the dashboard mounts empty.
parseDataFile() on its own handles delimiter sniffing, comment lines, title
rows above the header, European numbers, exported report layouts, and a
workbook's data dictionary sheet (used for labels and units).
The generator reads what columns mean before charting them: rows like "World"
are excluded instead of double counted (config.datasetScope), coordinates are
never metrics, levels are averaged rather than summed over time, double-entry
ledgers get a signed result field, budget columns become an actual-vs-budget
bridge, and amounts in per-entity currencies become shares and indexed growth.
Maps, forecasts and what-if scenarios appear only when the data supports them;
disable them with map: false, forecast: false, scenario: false.
Pass columnDescriptions (or a workbook dictionary) to enable the unit checks:
a mix of currencies can't be detected from the numbers alone.
From a file to a story
import { mountAutoStory } from '@datastripes/dashboard';
await mountAutoStory(element, droppedFile, { apiKey, locale: 'it-IT' });Same data understanding, different output: an editorial scrolling article. The
hero stays pinned while its text steps through the opening findings; the decade
chart stays pinned while step cards highlight its peaks; figures count up as
they appear. Sections are chosen by the shape of the data (decades, small
multiples, barcode, longest quiet stretches, stream, event durations, shared
events, month-of-year clock, map), and those with nothing to say are left out.
Prose comes from templates filled with computed figures. Pass
narrate(section, story) to rewrite it with your own LLM; a failed call keeps
the original text. Licensed, like the auto-dashboard.
Every framework component takes the same view prop, 'dashboard' (default)
or 'story', plus storyOptions for locale, tone and title:
<DatastripesDashboard data={rows} apiKey={key} view="story" storyOptions={{ locale: 'it-IT' }} /> // React
<DatastripesDashboard :data="rows" :api-key="key" view="story" :story-options="{ locale: 'it-IT' }" /> <!-- Vue -->
<datastripes-dashboard [data]="rows" [apiKey]="key" view="story" [storyOptions]="{ locale: 'it-IT' }" /> <!-- Angular -->
<datastripes-dashboard view="story" api-key="..."></datastripes-dashboard> <!-- Custom Element -->The rows always go in data, as an array of records or a CSV/JSON string.
Colors and fonts go in storyOptions.colors (or colors for mountAutoStory);
anything left out keeps the default for theme: 'light' | 'dark'. In React the
dashboard theme (palette, primaryColor, fontFamily) applies too.
storyOptions: {
theme: 'light',
colors: { palette: ['#0f766e', '#f59e0b', '#6366f1'], accent: '#0f766e', background: '#fffdf7', text: '#1c1917', muted: '#57534e', displayFont: 'Georgia, serif' }
}Style presets
Twenty ready-made looks set colors, fonts and corners in one go, for both the dashboard
(theme.preset) and the story (storyOptions.colors.preset). Any other field you set wins
over the preset.
| Preset | Look |
|---|---|
| newspaper | White page, black serif headlines, muted blue data |
| financial | Salmon paper, serif type, deep blue and claret |
| blog | Long-form reading: serif body, sans titles, green accent |
| magazine | Feature spread: high-contrast display type, one loud red |
| redline | Clean white with a signature red and calm blues |
| terminal | Trading screen: black, amber, monospace |
| swiss | International style: Helvetica, black, red, square corners |
| midnight | Dark editorial: navy, periwinkle, soft pastels |
| pastel | Warm off-white, terracotta, rounded cards |
| corporate | Neutral grays and one blue, slide-ready |
| sepia | Aged paper: warm browns, serif throughout |
| forest | Dark moss and one fresh green |
| ocean | Pale sea glass with a deep teal |
| sunset | Dusk plum with coral and gold |
| mono | Black on white only, the data carries the page |
| neon | Near-black night city, cyan and magenta |
| blueprint | Engineering drawing: white lines on blue |
| bauhaus | Primary colors on warm paper, square and flat |
| nordic | Cool minimal: frost blues, quiet accents |
| highcontrast | Pure black and white with saturated colors |
<DatastripesDashboard data={rows} theme={{ preset: 'financial' }} />
<DatastripesDashboard data={rows} view="story" storyOptions={{ colors: { preset: 'newspaper' } }} />The list is exported as STYLE_PRESETS.
Anything else counts as empty: the story shows a "no data" message and logs a console warning.
Switching view remounts: edits in the grid live in the host's config, so
keep it there if you switch back and forth. The story is rebuilt from data
and ignores the dashboard's filters.
generateStory() returns the same story as plain JSON. The spiral, barcode,
radial_bars, range_bars, beeswarm and chord chart types also work as
ordinary widgets.
buildSmartNarrative() writes the facts as connected prose in English or
Italian, in a professional, storytelling or executive tone. It is
deterministic, and the dashboard's insights panel and the story's "in brief"
section both use it.
Usage (React)
import { DatastripesDashboard } from '@datastripes/dashboard/react';
import { sampleOrders, sampleDashboardConfig } from '../examples/sample-dataset';
<DatastripesDashboard
data={sampleOrders}
config={sampleDashboardConfig}
mode="edit"
onChange={setConfig}
onSave={saved => persist(saved)}
/>See examples/sample-dataset.ts for a full DashboardConfig example, and
apps/playground for a runnable Vite+React demo (npm run dev).
Data engine
JsQueryEngine (in src/engine/query-engine.ts) implements the product's
@datastripes/engine contract — filter → aggregate/groupBy → sort → paginate
— in plain TypeScript over an in-memory array. It exists behind the
QueryEngine interface specifically so a future WASM/Web-Worker backend can
replace it without touching DashboardStore or any widget.
Build
npm run build (from this folder, or npm run build -w @datastripes/dashboard
from the repo root) wipes dist/ and runs three steps:
build:core,tsup: the root,/react, and/elementsentries (ESM + CJS +.d.ts, with the shared engine split into a common chunk), plus a self-contained IIFE build atdist/elements/index.global.jsfor plain<script>tags.build:vue, Vite library mode with@vitejs/plugin-vueandvite-plugin-dts, intodist/vue/. The Vue sources import the core relatively; the build rewrites that import to@datastripes/dashboardand keeps it external.build:angular,ng-packagronsrc/angular/ng-package.json, intodist/angular/(Ivy partial compilation, FESM2022 bundle atdist/angular/fesm2022/datastripes-dashboard-angular.mjs). It imports the core as@datastripes/dashboard, so it must run after step 1.
Why the Angular entry has its own package.json
ng-packagr derives an entry point's module id from where its ng-package.json
sits relative to the primary package that ng-packagr itself builds, and it
deletes and owns its primary dest. Here the primary entry is built by tsup,
not ng-packagr, so src/angular/ is set up as the ng-packagr project:
src/angular/package.json names it @datastripes/dashboard/angular (private, never
published on its own) and ng-package.json writes to ../../dist/angular.
The result matches APF secondary-entry-point output, and the root
package.json's "./angular" export points at it.
Angular 18.2, ng-packagr 18.2, and TypeScript ~5.4 are pinned as dev dependencies of this package because Angular 18's compiler does not support newer TypeScript.
Checks
npm run lint:vue-tscover everything exceptsrc/angular, thentscoversrc/angularwith the Angular decorator settings.- Tests run from the repo root with
npm test(vitest).
