@dashspec/renderer 0.1.9 → 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 CHANGED
@@ -14,6 +14,15 @@ 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
+
17
26
  ## [0.1.9] - 2026-11-18
18
27
 
19
28
  ### Added
@@ -190,7 +199,8 @@ First public release.
190
199
  never reach object prototypes, values inserted into Markdown are escaped, and custom
191
200
  code runs in the sandbox by default. See [docs/security.md](docs/security.md).
192
201
 
193
- [Unreleased]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.9...HEAD
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
194
204
  [0.1.9]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.8...v0.1.9
195
205
  [0.1.8]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.7...v0.1.8
196
206
  [0.1.7]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.6...v0.1.7
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
- - **30 built-in widgets**: KPIs, charts, tables, tiles, status, layout containers and
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.9";
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(", ")}`);
@@ -3017,6 +3017,8 @@ var ICONS = {
3017
3017
  alert: "M12 3 2 20h20zM12 10v4M12 17h.01",
3018
3018
  up: "M7 14l5-5 5 5",
3019
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",
3020
3022
  gauge: "M4 18a8 8 0 1 1 16 0M12 18l4-6",
3021
3023
  box: "M3 7l9-4 9 4v10l-9 4-9-4zM3 7l9 4 9-4M12 11v10",
3022
3024
  user: "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",
@@ -3103,6 +3105,25 @@ var DividerContract = {
3103
3105
  dashed: z27.boolean().default(false)
3104
3106
  }).strict()
3105
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
+ };
3106
3127
 
3107
3128
  // src/widgets/schemas/charts.ts
3108
3129
  import { z as z28 } from "zod";
@@ -3302,7 +3323,8 @@ var builtInWidgetContracts = [
3302
3323
  ValueContract,
3303
3324
  ProgressContract,
3304
3325
  IconContract,
3305
- DividerContract
3326
+ DividerContract,
3327
+ ButtonContract
3306
3328
  ];
3307
3329
  var builtInWidgetChecks = contractChecks(builtInWidgetContracts);
3308
3330
 
@@ -3411,6 +3433,7 @@ export {
3411
3433
  ProgressContract,
3412
3434
  IconContract,
3413
3435
  DividerContract,
3436
+ ButtonContract,
3414
3437
  BarChartContract,
3415
3438
  LineChartContract,
3416
3439
  PieChartContract,
@@ -3424,4 +3447,4 @@ export {
3424
3447
  RepeaterContract,
3425
3448
  builtInWidgetChecks
3426
3449
  };
3427
- //# sourceMappingURL=chunk-5EYC4E5K.js.map
3450
+ //# sourceMappingURL=chunk-TAOP57T2.js.map