@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/CHANGELOG.md +20 -0
- package/dist/{chunk-QMNPTVGN.js → chunk-UK4FBI4D.js} +2 -2
- package/dist/{chunk-QMNPTVGN.js.map → chunk-UK4FBI4D.js.map} +1 -1
- package/dist/{core-DIOQeVeG.d.ts → core-CrM2CTkH.d.ts} +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +33 -13
- package/dist/index.js +37 -28
- package/dist/index.js.map +1 -1
- package/docs/theming.md +40 -13
- package/package.json +1 -1
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:
|
|
291
|
-
meta: { font: "
|
|
292
|
-
label: { font: "
|
|
293
|
-
value: { font: "
|
|
294
|
-
unit: {
|
|
295
|
-
caption: {
|
|
296
|
-
empty: {
|
|
297
|
-
tableHead: { size: 12, weight: 600 }, tableCell: {
|
|
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:
|
|
300
|
-
tile: { padding:
|
|
301
|
-
table: { cellPadding: "
|
|
302
|
-
liveDot: { size:
|
|
303
|
-
legend: { gap:
|
|
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
|
+
```
|