hearald 0.1.1 → 0.1.2

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
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.2] - 2026-10-26
11
+
12
+ ### Fixed
13
+
14
+ - The dashboard crashed (`Cannot read properties of undefined (reading 'map')`) on a `ui` layout written
15
+ the way the README showed it, `{ title, fields }`. Sections now accept `title` or `menuName` and
16
+ `fields` or `stats`, and a section with neither renders empty.
17
+
18
+ ### Changed
19
+
20
+ - The README now documents the `ui` layout (sections, tiles, `chartContexts`).
21
+
10
22
  ## [0.1.1] - 2026-10-09
11
23
 
12
24
  ### Fixed
package/README.md CHANGED
@@ -113,6 +113,11 @@ const statDefinitions = {
113
113
  };
114
114
  ```
115
115
 
116
+ `ui` sets the dashboard layout. Each section has a `title` (or `menuName`; `""` for no heading) and a
117
+ list of tiles in `fields` (or `stats`); a tile is `{ key, label, type }` with `type` one of `number`,
118
+ `percent` or `histogram`, and an optional `span`. `chartContexts` (`[{ id, menuName }]`) fills the chart's
119
+ "Context" menu. Both are optional; a dashboard with no `ui` shows only the chart.
120
+
116
121
  Names with dots become nested objects in the result. `hidden: true` leaves a metric out of the output
117
122
  (useful for sets that only feed a computed metric). A computed metric that names a formula that does
118
123
  not exist is an error; one whose inputs are missing is simply left out.
@@ -881,7 +881,7 @@ th {
881
881
  !chartData.loading &&
882
882
  m`
883
883
  <div class="bar-chart__scale">${chartData.max}</div>
884
- ${chartData.data.map(
884
+ ${(chartData.data || []).map(
885
885
  (v) =>
886
886
  m`
887
887
  <div
@@ -900,15 +900,15 @@ th {
900
900
  </div>
901
901
  </section>
902
902
  ${(UI.sections || []).map((statsSection) => {
903
+ const sectionTitle =
904
+ statsSection.menuName ?? statsSection.title ?? "";
903
905
  return m`
904
906
  <section class="analytics analytics--${statsSection.id}">
905
- ${statsSection.menuName !== "" &&
907
+ ${sectionTitle !== "" &&
906
908
  m`
907
- <h2 class="analytics__title">
908
- ${statsSection.menuName}
909
- </h2>
909
+ <h2 class="analytics__title">${sectionTitle}</h2>
910
910
  `}
911
- ${statsSection.stats.map((f) => {
911
+ ${(statsSection.stats || statsSection.fields || []).map((f) => {
912
912
  return m`
913
913
  <${Tile}
914
914
  title="${f.label}"
package/dist/index.js CHANGED
@@ -483,7 +483,7 @@
483
483
  !chartData.loading &&
484
484
  m`
485
485
  <div class="bar-chart__scale">${chartData.max}</div>
486
- ${chartData.data.map(
486
+ ${(chartData.data || []).map(
487
487
  (v) =>
488
488
  m`
489
489
  <div
@@ -502,15 +502,15 @@
502
502
  </div>
503
503
  </section>
504
504
  ${(UI.sections || []).map((statsSection) => {
505
+ const sectionTitle =
506
+ statsSection.menuName ?? statsSection.title ?? "";
505
507
  return m`
506
508
  <section class="analytics analytics--${statsSection.id}">
507
- ${statsSection.menuName !== "" &&
509
+ ${sectionTitle !== "" &&
508
510
  m`
509
- <h2 class="analytics__title">
510
- ${statsSection.menuName}
511
- </h2>
511
+ <h2 class="analytics__title">${sectionTitle}</h2>
512
512
  `}
513
- ${statsSection.stats.map((f) => {
513
+ ${(statsSection.stats || statsSection.fields || []).map((f) => {
514
514
  return m`
515
515
  <${Tile}
516
516
  title="${f.label}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hearald",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A single server drop-in file system based metrics and analytics library.",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -269,7 +269,7 @@ class App extends Component {
269
269
  !chartData.loading &&
270
270
  html`
271
271
  <div class="bar-chart__scale">${chartData.max}</div>
272
- ${chartData.data.map(
272
+ ${(chartData.data || []).map(
273
273
  (v) =>
274
274
  html`
275
275
  <div
@@ -288,15 +288,15 @@ class App extends Component {
288
288
  </div>
289
289
  </section>
290
290
  ${(UI.sections || []).map((statsSection) => {
291
+ const sectionTitle =
292
+ statsSection.menuName ?? statsSection.title ?? "";
291
293
  return html`
292
294
  <section class="analytics analytics--${statsSection.id}">
293
- ${statsSection.menuName !== "" &&
295
+ ${sectionTitle !== "" &&
294
296
  html`
295
- <h2 class="analytics__title">
296
- ${statsSection.menuName}
297
- </h2>
297
+ <h2 class="analytics__title">${sectionTitle}</h2>
298
298
  `}
299
- ${statsSection.stats.map((f) => {
299
+ ${(statsSection.stats || statsSection.fields || []).map((f) => {
300
300
  return html`
301
301
  <${Tile}
302
302
  title="${f.label}"