@dashspec/renderer 0.1.38 → 0.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/theming.md CHANGED
@@ -287,23 +287,50 @@ out keeps DashSpec's look.
287
287
  createTheme({
288
288
  scale: {
289
289
  parts: {
290
- title: { font: "heading", size: 14, weight: 700, color: "#0d0d0d" },
291
- meta: { font: "heading", size: 12, color: "#666666" }, // header side text, live badge, legends, pagers
292
- label: { font: "heading", size: 12, color: "#666666" }, // KPI and tile labels
293
- value: { font: "body", size: 28, weight: 700, lineHeight: 32 },
294
- unit: { font: "heading", size: 10, color: "#808080" },
295
- caption: { font: "heading", size: 12, color: "#808080" },
296
- empty: { font: "heading", size: 12, color: "#808080", padding: "24px 0" },
297
- tableHead: { size: 12, weight: 600 }, tableCell: { font: "heading", size: 12 },
290
+ title: { font: "heading", size: 15, weight: 600, color: "#111827" },
291
+ meta: { font: "body", size: 12, color: "#6b7280" }, // header side text, live badge, legends, pagers
292
+ label: { font: "body", size: 12, color: "#6b7280" }, // KPI and tile labels
293
+ value: { font: "data", size: 30, weight: 700, lineHeight: 36 },
294
+ unit: { size: 11, color: "#9ca3af" },
295
+ caption: { size: 12, color: "#9ca3af" },
296
+ empty: { size: 13, color: "#9ca3af", padding: "16px 0" },
297
+ tableHead: { size: 12, weight: 600 }, tableCell: { size: 13 },
298
298
  header: { align: "start" },
299
- kpiCard: { padding: 14, radius: 12, gap: 8, minHeight: 112 },
300
- tile: { padding: 14, radius: 10, gap: 8, spacing: 16, border: "#cccccc", activeLabel: { weight: 700 } },
301
- table: { cellPadding: "14px 16px", rowBorder: "#eeeeee", footBackground: "#f2f2f2", footWeight: 700 },
302
- liveDot: { size: 6, color: "#2ba24c" },
303
- legend: { gap: 16, swatch: 8, swatchRadius: 2 },
299
+ kpiCard: { padding: 16, radius: 8, gap: 6, minHeight: 120 },
300
+ tile: { padding: 12, radius: 8, gap: 6, spacing: 12, border: "#e5e7eb", activeLabel: { weight: 600 } },
301
+ table: { cellPadding: "10px 12px", rowBorder: "#f3f4f6", footBackground: "#f9fafb", footWeight: 600 },
302
+ liveDot: { size: 8, color: "#16a34a" },
303
+ legend: { gap: 12, swatch: 10, swatchRadius: 3 },
304
+ filterBar: { padding: "12px", radius: 12 },
304
305
  },
305
306
  },
306
307
  });
307
308
  ```
308
309
 
309
310
  Use `widgets` css only for what is specific to one kind or variant of your dashboards.
311
+
312
+
313
+ ## Light and dark
314
+
315
+ Every theme has both colour sets (`light` and `dark`), and every built-in widget reads only theme tokens, so all of
316
+ them work in both modes. Who decides the mode, strongest first:
317
+
318
+ 1. The host: `colorMode="light" | "dark" | "auto"` on `DashSpecProvider` or `DashboardRenderer` (e.g. your app's
319
+ dark-mode switch). `auto` follows the viewer's system setting.
320
+ 2. The document: `"display": { "theme": "dark" }`.
321
+ 3. The theme's own `mode`.
322
+
323
+ ```tsx
324
+ <DashSpecProvider themes={{ acme: acmeTheme }} colorMode={isDark ? "dark" : "light"}>
325
+ ```
326
+
327
+ Your own values per mode:
328
+
329
+ ```ts
330
+ createTheme({
331
+ light: { surface: { card: "#ffffff" }, text: { primary: "#1a1a1a" } },
332
+ dark: { surface: { card: "#1e1e1e" }, text: { primary: "#f2f2f2" } },
333
+ scale: { parts: { title: { color: { light: "#0d0d0d", dark: "#f5f5f5" } } } }, // any part colour
334
+ widgets: { Kpi: { css: "…", dark: { css: "…" } } }, // dark-only additions
335
+ });
336
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashspec/renderer",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "description": "Draws a dashboard from DashSpec JSON: widgets, data, events, state.",
5
5
  "keywords": [
6
6
  "dashboard",