@dashspec/renderer 0.1.10 → 0.1.12

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,40 @@ under the new version.
14
14
 
15
15
  ## [Unreleased]
16
16
 
17
+ ## [0.1.12] - 2026-11-18
18
+
19
+ ### Added
20
+
21
+ - Breakdown `items`: fixed `{ label, value, tone }` items (values can be templates) instead of data
22
+ rows; `label` / `value` default to "label" / "value".
23
+ - Tiles `stretch: false`: a few tiles keep their column width instead of stretching across the row.
24
+
25
+ ### Fixed
26
+
27
+ - A `fit` card also shrinks when its content does (it measured its stretched height before, so it
28
+ kept blank space after, e.g., a filter change left fewer tiles).
29
+ - A panel loads every datasource its templates read (title, `meta`, Breakdown `items`…), not only
30
+ the one it binds with `data`.
31
+
32
+ ## [0.1.11] - 2026-11-18
33
+
34
+ ### Added
35
+
36
+ - Table `pagination.layout: "simple"` ("Showing 1–25 of 223 rows", Previous, "Page 1 of 9",
37
+ Next) and `pagination.sizes: false` to hide the rows-per-page picker.
38
+ - Tiles `captionInline`: the caption right after the number ("12 passed"); a template `value` that
39
+ resolves to `""` draws no number.
40
+ - `fmt.date(v, { weekday, day, month, … })`: format a date with the parts you want.
41
+
42
+ ### Changed
43
+
44
+ - Charts replay their grow-in animation when the categories change completely (a drill-down, the
45
+ next week) instead of jumping to the new bars.
46
+
47
+ ### Fixed
48
+
49
+ - Tiles show hover feedback only when they do something (selectable, or the panel has `on.click`).
50
+
17
51
  ## [0.1.10] - 2026-11-18
18
52
 
19
53
  ### Added
@@ -199,7 +233,9 @@ First public release.
199
233
  never reach object prototypes, values inserted into Markdown are escaped, and custom
200
234
  code runs in the sandbox by default. See [docs/security.md](docs/security.md).
201
235
 
202
- [Unreleased]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.10...HEAD
236
+ [Unreleased]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.12...HEAD
237
+ [0.1.12]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.11...v0.1.12
238
+ [0.1.11]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.10...v0.1.11
203
239
  [0.1.10]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.9...v0.1.10
204
240
  [0.1.9]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.8...v0.1.9
205
241
  [0.1.8]: https://github.com/vaskar-nowpurchase/dashspec-renderer/compare/v0.1.7...v0.1.8
@@ -406,11 +406,12 @@ function createHelpers(t = {}) {
406
406
  if (m) return s ? `${m} min ${s} sec` : `${m} min`;
407
407
  return `${s} sec`;
408
408
  },
409
+ /** `style` is "date" | "datetime" | "time", or Intl options, e.g. { weekday: 'short', day: 'numeric', month: 'short' }. */
409
410
  date: (v, style = "date") => {
410
411
  if (v === null || v === void 0 || v === "") return "";
411
412
  const d = new Date(typeof v === "number" ? v : String(v));
412
413
  if (Number.isNaN(d.getTime())) return String(v);
413
- const opts = style === "time" ? { timeStyle: "short" } : style === "datetime" ? { dateStyle: "medium", timeStyle: "short" } : { dateStyle: "medium" };
414
+ const opts = typeof style === "object" && style !== null ? pickDateOptions(style) : style === "time" ? { timeStyle: "short" } : style === "datetime" ? { dateStyle: "medium", timeStyle: "short" } : { dateStyle: "medium" };
414
415
  return new Intl.DateTimeFormat(locale, { ...opts, ...t.timeZone ? { timeZone: t.timeZone } : {} }).format(d);
415
416
  },
416
417
  /** "just now", "2 min ago", "3 hr ago", "4 days ago". */
@@ -466,6 +467,23 @@ function createHelpers(t = {}) {
466
467
  t: translator(t.translations, locale)
467
468
  };
468
469
  }
470
+ var DATE_KEYS = [
471
+ "weekday",
472
+ "era",
473
+ "year",
474
+ "month",
475
+ "day",
476
+ "hour",
477
+ "minute",
478
+ "second",
479
+ "hour12",
480
+ "timeZoneName"
481
+ ];
482
+ function pickDateOptions(o) {
483
+ const out = {};
484
+ for (const k of DATE_KEYS) if (Object.hasOwn(o, k)) out[k] = o[k];
485
+ return out;
486
+ }
469
487
 
470
488
  // src/core/expr/references.ts
471
489
  var ROOTS = ["datasources", "panels", "filters", "state", "modal", "context", "event", "drill", "panel"];
@@ -1808,7 +1826,7 @@ function migrateDocument(input, widgets = []) {
1808
1826
  import { z as z10 } from "zod";
1809
1827
 
1810
1828
  // src/version.ts
1811
- var RENDERER_VERSION = "0.1.10";
1829
+ var RENDERER_VERSION = "0.1.12";
1812
1830
  var parse2 = (v) => {
1813
1831
  const m = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(v.trim());
1814
1832
  return m ? [Number(m[1]), Number(m[2] ?? 0), Number(m[3] ?? 0)] : void 0;
@@ -2595,8 +2613,20 @@ var BreakdownContract = {
2595
2613
  version: 1,
2596
2614
  schema: z13.object({
2597
2615
  ...Common2,
2598
- label: z13.string(),
2599
- value: z13.string(),
2616
+ /** Fields for the label and value of each data row (default "label" / "value"). */
2617
+ label: z13.string().default("label"),
2618
+ value: z13.string().default("value"),
2619
+ /**
2620
+ * Fixed items instead of data rows: `{ label, value, tone? }`, where `value` can be a template, e.g.
2621
+ * { "label": "Rejected", "value": "${datasources.q.data.overall.rejected}", "tone": "bad" }.
2622
+ */
2623
+ items: z13.array(
2624
+ z13.object({
2625
+ label: z13.string(),
2626
+ value: z13.union([z13.number(), z13.string()]),
2627
+ tone: z13.enum(["good", "warn", "bad", "info", "neutral"]).optional()
2628
+ }).strict()
2629
+ ).optional(),
2600
2630
  mode: z13.enum(["meters", "segmented", "donut"]).default("meters"),
2601
2631
  /** Adds a remainder item up to `total`, e.g. "Unaccounted". */
2602
2632
  remainder: z13.object({ label: z13.string(), total: z13.union([z13.number(), z13.string()]) }).strict().optional(),
@@ -2924,7 +2954,11 @@ var schema = z25.object({
2924
2954
  mode: z25.enum(["client", "server"]).default("client"),
2925
2955
  pageSize: z25.number().int().min(1).max(500).default(20),
2926
2956
  pageSizes: z25.array(z25.number().int().min(1)).default([10, 20, 50, 100]),
2927
- totalPath: z25.string().optional()
2957
+ totalPath: z25.string().optional(),
2958
+ /** "pages" (default): numbered pages. "simple": "Showing 1–25 of 223 rows", Previous, "Page 1 of 9", Next. */
2959
+ layout: z25.enum(["pages", "simple"]).default("pages"),
2960
+ /** Show the rows-per-page picker. */
2961
+ sizes: z25.boolean().default(true)
2928
2962
  }).strict().optional(),
2929
2963
  /** A search box. "server": writes `ui.search` (debounced) for the datasource; "client": matches row text. */
2930
2964
  search: z25.union([
@@ -2973,6 +3007,8 @@ var TilesContract = {
2973
3007
  value: z26.string(),
2974
3008
  /** Small text under the number: plain ("heats") or per row ("of ${row.total} pending"). */
2975
3009
  caption: z26.string().optional(),
3010
+ /** Put the caption on the number's line, right after it ("12 passed"). */
3011
+ captionInline: z26.boolean().default(false),
2976
3012
  /** Optional status dot per tile. */
2977
3013
  status: z26.string().optional(),
2978
3014
  statusMap: ToneMap.optional(),
@@ -2987,6 +3023,8 @@ var TilesContract = {
2987
3023
  columns: z26.number().int().min(1).max(12).optional(),
2988
3024
  /** Narrowest a tile gets, in px, before the row wraps (or scrolls when wrap is off). */
2989
3025
  minTileWidth: z26.number().int().min(60).max(600).default(128),
3026
+ /** Few tiles stretch to fill the row (default). false: tiles keep their column width (`columns`). */
3027
+ stretch: z26.boolean().default(true),
2990
3028
  /** Wrap onto new lines when the row is full; off = one row that scrolls sideways. */
2991
3029
  wrap: z26.boolean().default(true),
2992
3030
  /** Tags under the caption: `{ text, tone, when }` over the tile's `row`. */
@@ -3447,4 +3485,4 @@ export {
3447
3485
  RepeaterContract,
3448
3486
  builtInWidgetChecks
3449
3487
  };
3450
- //# sourceMappingURL=chunk-TAOP57T2.js.map
3488
+ //# sourceMappingURL=chunk-2Y6SJ7MU.js.map