@dashspec/renderer 0.1.8 → 0.1.10
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 +31 -1
- package/README.md +1 -1
- package/dist/{chunk-CLT55JEM.js → chunk-TAOP57T2.js} +62 -7
- package/dist/{chunk-CLT55JEM.js.map → chunk-TAOP57T2.js.map} +1 -1
- package/dist/{core-CKNOs-JN.d.ts → core-CYeLBFK9.d.ts} +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +384 -191
- package/dist/index.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/api.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/widgets.md +30 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,34 @@ under the new version.
|
|
|
14
14
|
|
|
15
15
|
## [Unreleased]
|
|
16
16
|
|
|
17
|
+
## [0.1.10] - 2026-11-18
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `Button` atom: `label`, `icon`, `iconAfter`, `variant` (primary / secondary / subtle / link),
|
|
22
|
+
`size`, `disabled`, `ariaLabel`; runs the panel's `on.click`. Icons `arrow-left`, `arrow-right`.
|
|
23
|
+
- A `toolbar` slot on every panel: a row under the title, above the body, for navigation, actions
|
|
24
|
+
or notes (e.g. a drill-down breadcrumb with back and previous / next buttons).
|
|
25
|
+
|
|
26
|
+
## [0.1.9] - 2026-11-18
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Table column options `sub` (second line), `chips` (`{ text, tone, when }` tags), `weight` and
|
|
31
|
+
`valueTone` (an expression returning a tone, `action` or `muted`).
|
|
32
|
+
- Table `columnsFrom.column`: a column pattern for every generated column (`{key}`, `{label}`
|
|
33
|
+
filled in); `columnsFrom.after`: mix generated columns into fixed `columns`.
|
|
34
|
+
- Table `totalsRow: { path, label }`: a total row taken from the data, drawn with the column options.
|
|
35
|
+
- Table `expand: true` with a `detail` slot: a clicked row opens the slot under it (the row is
|
|
36
|
+
`${item.*}`); the open row is in `panels.<id>.ui.expanded` and `ui.expandedRow`.
|
|
37
|
+
- Tiles `chips`, `mutedWhen` (dashed, greyed), `highlightWhen` / `highlightTone` (accent border),
|
|
38
|
+
and a `value` that may be a template over `row`.
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- The ⓘ tooltip fades and slides in when it opens and fades out before it closes (no motion
|
|
43
|
+
with reduced motion).
|
|
44
|
+
|
|
17
45
|
## [0.1.8] - 2026-11-18
|
|
18
46
|
|
|
19
47
|
### Fixed
|
|
@@ -171,7 +199,9 @@ First public release.
|
|
|
171
199
|
never reach object prototypes, values inserted into Markdown are escaped, and custom
|
|
172
200
|
code runs in the sandbox by default. See [docs/security.md](docs/security.md).
|
|
173
201
|
|
|
174
|
-
[Unreleased]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.
|
|
202
|
+
[Unreleased]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.10...HEAD
|
|
203
|
+
[0.1.10]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.9...v0.1.10
|
|
204
|
+
[0.1.9]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.8...v0.1.9
|
|
175
205
|
[0.1.8]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.7...v0.1.8
|
|
176
206
|
[0.1.7]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.6...v0.1.7
|
|
177
207
|
[0.1.6]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.5...v0.1.6
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ You describe a dashboard once as a JSON document (layout, filters, data sources,
|
|
|
10
10
|
what happens on click), and `<DashboardRenderer>` draws it. A new dashboard, or a new
|
|
11
11
|
version of one, is a new document — not new frontend code and not a redeploy.
|
|
12
12
|
|
|
13
|
-
- **
|
|
13
|
+
- **31 built-in widgets**: KPIs, charts, tables, tiles, status, layout containers and
|
|
14
14
|
small building blocks, nestable at any depth.
|
|
15
15
|
- **Data built in**: REST, GraphQL, SSE and WebSocket sources, auth and token refresh,
|
|
16
16
|
caching, polling, transforms.
|
|
@@ -1808,7 +1808,7 @@ function migrateDocument(input, widgets = []) {
|
|
|
1808
1808
|
import { z as z10 } from "zod";
|
|
1809
1809
|
|
|
1810
1810
|
// src/version.ts
|
|
1811
|
-
var RENDERER_VERSION = "0.1.
|
|
1811
|
+
var RENDERER_VERSION = "0.1.10";
|
|
1812
1812
|
var parse2 = (v) => {
|
|
1813
1813
|
const m = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(v.trim());
|
|
1814
1814
|
return m ? [Number(m[1]), Number(m[2] ?? 0), Number(m[3] ?? 0)] : void 0;
|
|
@@ -2227,8 +2227,8 @@ function validateDocument(input, options = {}) {
|
|
|
2227
2227
|
for (const [slot, list2] of Object.entries(p.slots)) {
|
|
2228
2228
|
if (!Array.isArray(list2)) continue;
|
|
2229
2229
|
const ids = list2.filter((c) => typeof c === "string");
|
|
2230
|
-
const rule = slot === "header" || slot === "footer" ? { accepts: "small" } : def?.slots?.[slot];
|
|
2231
|
-
if (def && !rule && !def.openSlots && slot !== "header" && slot !== "footer")
|
|
2230
|
+
const rule = slot === "header" || slot === "footer" || slot === "toolbar" ? { accepts: "small" } : def?.slots?.[slot];
|
|
2231
|
+
if (def && !rule && !def.openSlots && slot !== "header" && slot !== "footer" && slot !== "toolbar")
|
|
2232
2232
|
warn(["spec", "panels", pid, "slots", slot], "unknown-slot", `${String(p.kind)} has no slot "${slot}"`);
|
|
2233
2233
|
if (rule?.max !== void 0 && ids.length > rule.max)
|
|
2234
2234
|
err(["spec", "panels", pid, "slots", slot], "slot-full", `Slot "${slot}" takes at most ${rule.max}`);
|
|
@@ -2243,7 +2243,7 @@ function validateDocument(input, options = {}) {
|
|
|
2243
2243
|
placed.add(c);
|
|
2244
2244
|
const ck = byKind.get(String(child.kind));
|
|
2245
2245
|
const accepts = rule?.accepts ?? "any";
|
|
2246
|
-
if (ck && accepts === "small" && !ck.small && slot !== "footer")
|
|
2246
|
+
if (ck && accepts === "small" && !ck.small && slot !== "footer" && slot !== "toolbar")
|
|
2247
2247
|
err(at, "slot-accepts", `${String(child.kind)} can't go in "${slot}" (it takes badges, atoms and filters)`);
|
|
2248
2248
|
if (Array.isArray(accepts) && !accepts.includes(String(child.kind)))
|
|
2249
2249
|
err(at, "slot-accepts", `Slot "${slot}" takes ${accepts.join(", ")}`);
|
|
@@ -2586,6 +2586,8 @@ var Common2 = {
|
|
|
2586
2586
|
/** Hover group for cross-panel highlight. */
|
|
2587
2587
|
highlight: z12.string().optional()
|
|
2588
2588
|
};
|
|
2589
|
+
var Chip = z12.object({ text: z12.string(), tone: z12.string().optional(), when: z12.string().optional() }).strict();
|
|
2590
|
+
var Chips = z12.array(Chip);
|
|
2589
2591
|
|
|
2590
2592
|
// src/widgets/schemas/Breakdown.ts
|
|
2591
2593
|
var BreakdownContract = {
|
|
@@ -2870,6 +2872,14 @@ var Column = z25.object({
|
|
|
2870
2872
|
max: z25.number().optional(),
|
|
2871
2873
|
width: z25.union([z25.number(), z25.string()]).optional(),
|
|
2872
2874
|
sortable: z25.boolean().optional(),
|
|
2875
|
+
/** A second line under the value (template), e.g. "${row.date} · ${row.shift}". */
|
|
2876
|
+
sub: z25.string().optional(),
|
|
2877
|
+
/** Tags under the value: `{ text, tone, when }`, e.g. a "12 waiting" chip when `row.waiting > 0`. */
|
|
2878
|
+
chips: Chips.optional(),
|
|
2879
|
+
/** Text weight of the value. */
|
|
2880
|
+
weight: z25.enum(["regular", "medium", "semibold", "bold"]).optional(),
|
|
2881
|
+
/** Colour of the value: an expression returning a tone, "action" or "muted", e.g. "value > 0 ? 'bad' : 'muted'". */
|
|
2882
|
+
valueTone: z25.string().optional(),
|
|
2873
2883
|
/** A filter under the header: free text, a choice of values, or a minimum number. */
|
|
2874
2884
|
filter: z25.enum(["text", "select", "min"]).optional(),
|
|
2875
2885
|
/** Choices for a select filter; default: the values in the data (browser mode). */
|
|
@@ -2887,9 +2897,22 @@ var schema = z25.object({
|
|
|
2887
2897
|
key: z25.string().default("key"),
|
|
2888
2898
|
label: z25.string().default("label"),
|
|
2889
2899
|
type: Column.shape.type,
|
|
2890
|
-
format: Format.optional()
|
|
2900
|
+
format: Format.optional(),
|
|
2901
|
+
/**
|
|
2902
|
+
* A column pattern for every generated column: any column option, with `{key}` and `{label}` in its strings
|
|
2903
|
+
* replaced by that column's, e.g. { "key": "groups.{key}.rejected", "chips": [{ "text": "${row.groups.{key}.waiting} waiting" }] }.
|
|
2904
|
+
*/
|
|
2905
|
+
column: z25.record(z25.unknown()).optional(),
|
|
2906
|
+
/** With fixed `columns` too: insert the generated columns after the column with this key (default: at the end). */
|
|
2907
|
+
after: z25.string().optional()
|
|
2891
2908
|
}).strict().optional(),
|
|
2892
2909
|
totals: z25.object({ label: z25.string().default("Total"), columns: z25.record(Agg) }).strict().optional(),
|
|
2910
|
+
/** A total row taken from the data (e.g. the API's own totals) at `path` in the datasource result, drawn with
|
|
2911
|
+
* the columns' own cell options; `label` (template over that row) goes in the first column. */
|
|
2912
|
+
totalsRow: z25.object({ path: z25.string(), label: z25.string().optional() }).strict().optional(),
|
|
2913
|
+
/** Rows open on click to show the `detail` slot under them; the open row is in `panels.<id>.ui.expanded`
|
|
2914
|
+
* (its key) and `ui.expandedRow` (the row), for a datasource to fetch its details. */
|
|
2915
|
+
expand: z25.boolean().optional(),
|
|
2893
2916
|
pivot: z25.object({ rows: z25.union([z25.string(), z25.array(z25.string())]), cols: z25.string(), value: z25.string() }).strict().optional(),
|
|
2894
2917
|
/**
|
|
2895
2918
|
* Pages. "client": the table slices the rows it has. "server": the table writes page, pageSize and offset to
|
|
@@ -2933,6 +2956,7 @@ var schema = z25.object({
|
|
|
2933
2956
|
var TableContract = {
|
|
2934
2957
|
kind: "Table",
|
|
2935
2958
|
version: 1,
|
|
2959
|
+
slots: { detail: { label: "Row detail" } },
|
|
2936
2960
|
schema
|
|
2937
2961
|
};
|
|
2938
2962
|
|
|
@@ -2945,6 +2969,7 @@ var TilesContract = {
|
|
|
2945
2969
|
schema: z26.object({
|
|
2946
2970
|
...Common2,
|
|
2947
2971
|
label: z26.string(),
|
|
2972
|
+
/** A field, or a template over the tile's `row` (e.g. "${row.value ?? row.passed}"). */
|
|
2948
2973
|
value: z26.string(),
|
|
2949
2974
|
/** Small text under the number: plain ("heats") or per row ("of ${row.total} pending"). */
|
|
2950
2975
|
caption: z26.string().optional(),
|
|
@@ -2964,6 +2989,13 @@ var TilesContract = {
|
|
|
2964
2989
|
minTileWidth: z26.number().int().min(60).max(600).default(128),
|
|
2965
2990
|
/** Wrap onto new lines when the row is full; off = one row that scrolls sideways. */
|
|
2966
2991
|
wrap: z26.boolean().default(true),
|
|
2992
|
+
/** Tags under the caption: `{ text, tone, when }` over the tile's `row`. */
|
|
2993
|
+
chips: Chips.optional(),
|
|
2994
|
+
/** A tile shown greyed with a dashed border, e.g. "row.reached == false". */
|
|
2995
|
+
mutedWhen: z26.string().optional(),
|
|
2996
|
+
/** A tile with an accent border, e.g. "row.waiting > 0". `highlightTone` picks the colour (default warn). */
|
|
2997
|
+
highlightWhen: z26.string().optional(),
|
|
2998
|
+
highlightTone: z26.enum(["good", "warn", "bad", "info", "neutral"]).optional(),
|
|
2967
2999
|
selectable: z26.boolean().default(false),
|
|
2968
3000
|
/** The selected tile's label value, e.g. "${filters.stage}". */
|
|
2969
3001
|
selected: z26.unknown().optional()
|
|
@@ -2985,6 +3017,8 @@ var ICONS = {
|
|
|
2985
3017
|
alert: "M12 3 2 20h20zM12 10v4M12 17h.01",
|
|
2986
3018
|
up: "M7 14l5-5 5 5",
|
|
2987
3019
|
down: "M7 10l5 5 5-5",
|
|
3020
|
+
"arrow-left": "M19 12H5M11 6l-6 6 6 6",
|
|
3021
|
+
"arrow-right": "M5 12h14M13 6l6 6-6 6",
|
|
2988
3022
|
gauge: "M4 18a8 8 0 1 1 16 0M12 18l4-6",
|
|
2989
3023
|
box: "M3 7l9-4 9 4v10l-9 4-9-4zM3 7l9 4 9-4M12 11v10",
|
|
2990
3024
|
user: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
|
|
@@ -3071,6 +3105,25 @@ var DividerContract = {
|
|
|
3071
3105
|
dashed: z27.boolean().default(false)
|
|
3072
3106
|
}).strict()
|
|
3073
3107
|
};
|
|
3108
|
+
var ButtonContract = {
|
|
3109
|
+
kind: "Button",
|
|
3110
|
+
version: 1,
|
|
3111
|
+
small: true,
|
|
3112
|
+
schema: z27.object({
|
|
3113
|
+
...Atom,
|
|
3114
|
+
/** Text on the button (template). Leave out for an icon-only button (give it an `ariaLabel`). */
|
|
3115
|
+
label: z27.string().optional(),
|
|
3116
|
+
icon: z27.enum(ICON_NAMES).optional(),
|
|
3117
|
+
/** Put the icon after the label. */
|
|
3118
|
+
iconAfter: z27.boolean().default(false),
|
|
3119
|
+
/** "primary" (filled), "secondary" (outlined), "subtle" (tinted, no border) or "link" (text only). */
|
|
3120
|
+
variant: z27.enum(["primary", "secondary", "subtle", "link"]).default("secondary"),
|
|
3121
|
+
size: z27.enum(["sm", "md"]).default("md"),
|
|
3122
|
+
/** Disabled when true, e.g. "${datasources.trend.data.meta.prev_week == null}". */
|
|
3123
|
+
disabled: z27.boolean().default(false),
|
|
3124
|
+
ariaLabel: z27.string().optional()
|
|
3125
|
+
}).strict()
|
|
3126
|
+
};
|
|
3074
3127
|
|
|
3075
3128
|
// src/widgets/schemas/charts.ts
|
|
3076
3129
|
import { z as z28 } from "zod";
|
|
@@ -3270,7 +3323,8 @@ var builtInWidgetContracts = [
|
|
|
3270
3323
|
ValueContract,
|
|
3271
3324
|
ProgressContract,
|
|
3272
3325
|
IconContract,
|
|
3273
|
-
DividerContract
|
|
3326
|
+
DividerContract,
|
|
3327
|
+
ButtonContract
|
|
3274
3328
|
];
|
|
3275
3329
|
var builtInWidgetChecks = contractChecks(builtInWidgetContracts);
|
|
3276
3330
|
|
|
@@ -3379,6 +3433,7 @@ export {
|
|
|
3379
3433
|
ProgressContract,
|
|
3380
3434
|
IconContract,
|
|
3381
3435
|
DividerContract,
|
|
3436
|
+
ButtonContract,
|
|
3382
3437
|
BarChartContract,
|
|
3383
3438
|
LineChartContract,
|
|
3384
3439
|
PieChartContract,
|
|
@@ -3392,4 +3447,4 @@ export {
|
|
|
3392
3447
|
RepeaterContract,
|
|
3393
3448
|
builtInWidgetChecks
|
|
3394
3449
|
};
|
|
3395
|
-
//# sourceMappingURL=chunk-
|
|
3450
|
+
//# sourceMappingURL=chunk-TAOP57T2.js.map
|