@soffits/dsh-card-board 0.12.0 → 0.13.0

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
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0
4
+
5
+ A stat item can carry an `icon`: a big tinted tile beside its label and number, like a Home Assistant tile, coloured with `iconTone`, the item's `tone` or the card's. A stat block with icons lays its numbers out in an even grid, and on a phone, where two numbers share a row, each tile sits above its words so the numbers keep their width. A countdown's `data.icon` sits the same way before the big number. The tile is 48 px (44 above a chart or rows, 40–42 on a phone). Needs dsh-ui-kit 0.5.0 for `trophy`, `medal`, `weight` and the high and low thermometers.
6
+
3
7
  ## 0.12.0
4
8
 
5
9
  - Every list and status row now has an Ask button without declaring one, the way every card has its chat button: it opens a new conversation with that row and its card attached ("Ask Robin" when the board names an `assistant`). A row that declares its own `chat` action keeps it, and a row with all six buttons taken gets none. Rows without a `key` get it too: the chat names the row by its place in the card.
package/README.md CHANGED
@@ -146,7 +146,7 @@ A chip with `to` (an ISO time) gets a ticking "in 1d 19h" after its text.
146
146
  A big ticking number until `to`, and the stops on the way with the next one marked. After `to` it says "now"; after `expiresAt` the card hides itself, so whoever writes it needn't remove it on time.
147
147
 
148
148
  ```json
149
- { "to": "2026-03-04T07:40:00+01:00", "label": "until the train leaves", "sub": "3 h 10 m, one change",
149
+ { "to": "2026-03-04T07:40:00+01:00", "label": "until the train leaves", "sub": "3 h 10 m, one change", "icon": "luggage",
150
150
  "steps": [
151
151
  { "at": "2026-03-04T07:15:00+01:00", "label": "At the station" },
152
152
  { "at": "2026-03-04T10:50:00+01:00", "label": "Arrive in Marseille", "sub": "14° and sunny", "zone": "Europe/Paris" }
@@ -154,7 +154,7 @@ A big ticking number until `to`, and the stops on the way with the next one mark
154
154
  "expiresAt": "2026-03-04T10:50:00+01:00" }
155
155
  ```
156
156
 
157
- A step with a `zone` (an IANA name) other than the viewer's shows the wall-clock time of its own offset, so write the local time from the ticket with its offset; the zone's short name follows when the browser's zone data agrees, the offset ("GMT−7") when it doesn't.
157
+ `icon` puts a big tile, tinted with the card's `tone`, before the number. A step with a `zone` (an IANA name) other than the viewer's shows the wall-clock time of its own offset, so write the local time from the ticket with its offset; the zone's short name follows when the browser's zone data agrees, the offset ("GMT−7") when it doesn't.
158
158
 
159
159
  ### stat
160
160
 
@@ -162,7 +162,7 @@ One to six big numbers.
162
162
 
163
163
  ```json
164
164
  { "items": [
165
- { "label": "Temperature", "value": 4.5, "unit": "°C", "sub": "feels like 1 °C",
165
+ { "label": "Temperature", "value": 4.5, "unit": "°C", "icon": "thermometer", "sub": "feels like 1 °C",
166
166
  "delta": { "text": "2.1° colder than yesterday", "tone": "accent", "dir": "down" },
167
167
  "strip": [{ "label": "11", "value": 5.6, "icon": "sun" }, { "label": "12", "value": 6.2, "icon": "sun", "on": true }] },
168
168
  { "label": "Spent this month", "value": 3423, "unit": "of 4,310", "progress": { "value": 3423, "max": 4310, "text": "on pace for 4,286" } },
@@ -170,7 +170,7 @@ One to six big numbers.
170
170
  ] }
171
171
  ```
172
172
 
173
- `value` is a number or a string (for numbers you've already formatted). `tone` on an item colours its value. Each item may add a `delta` (a change in words, with a tone and a `dir` of `up`, `down` or `flat` for its arrow), a `progress` bar, a `spark` line or a `strip` of small values with icons, like the next hours of weather (`on` marks one).
173
+ `value` is a number or a string (for numbers you've already formatted). `tone` on an item colours its value. `icon` draws a big tile beside the label and number, tinted with `iconTone`, else the item's `tone`, else the card's (a gold coin beside a plain balance: `"icon": "coins", "iconTone": "warn"`). Give it to the numbers a glance should find by picture, not to every item; the reasoning is in [docs/decisions/stat-icons.md](docs/decisions/stat-icons.md). Each item may add a `delta` (a change in words, with a tone and a `dir` of `up`, `down` or `flat` for its arrow), a `progress` bar, a `spark` line or a `strip` of small values with icons, like the next hours of weather (`on` marks one).
174
174
 
175
175
  ### line
176
176
 
package/client.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @soffits/dsh-card-board 0.12.0: built by scripts/build.mjs from src/client/. Do not edit. */
1
+ /* @soffits/dsh-card-board 0.13.0: built by scripts/build.mjs from src/client/. Do not edit. */
2
2
  window.__ModuleLoader__.load({
3
3
  id: "@soffits/dsh-card-board",
4
4
  factory: (require) => {
@@ -98,6 +98,19 @@ h3.cb-truncOpen{overflow:visible}
98
98
  .cb-delta{display:flex;align-items:center;gap:3px;font-size:12px;font-weight:500;line-height:18px}
99
99
  .cb-statSub{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}
100
100
  .cb-statProgress{display:flex;flex-direction:column;gap:4px;min-width:180px;margin-top:4px}
101
+ /* an item with an icon: a big tinted tile beside its label and number, the rest under the words */
102
+ .cb-stats{--cb-statTile:48px}
103
+ .cb-statsCompact{--cb-statTile:44px}
104
+ .cb-statsIcons{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,136px),1fr));gap:16px 24px}
105
+ .cb-statsIcons>.cb-statWide{grid-column:1/-1}
106
+ .cb-statIcon .cb-statProgress{min-width:0}
107
+ .cb-statIcon{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:12px;row-gap:2px;align-content:start}
108
+ .cb-statIcon>*{grid-column:2}
109
+ .cb-statIcon>.cb-statTile{grid-column:1;grid-row:1/span 2;align-self:center}
110
+ .cb-statIcon>.cb-strip{grid-column:1/-1}
111
+ .cb-statTile.uk-tile,.cb-countdownTile.uk-tile{width:var(--cb-statTile);height:var(--cb-statTile);border-radius:calc(var(--cb-statTile) * .3)}
112
+ .cb-statTile svg,.cb-countdownTile svg{width:calc(var(--cb-statTile) * .54);height:calc(var(--cb-statTile) * .54)}
113
+ .cb-countdownHead{--cb-statTile:52px}
101
114
  .cb-strip{display:flex;justify-content:space-between;gap:4px;margin:10px 0 0;padding:0;list-style:none}
102
115
  .cb-strip li{display:flex;flex-direction:column;align-items:center;gap:3px;min-width:0;color:var(--dsw-alias-label-tertiary);font-size:11px;font-variant-numeric:tabular-nums}
103
116
  .cb-strip b{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500}
@@ -193,6 +206,14 @@ h3.cb-truncOpen{overflow:visible}
193
206
  .cb-card-summary{position:relative}
194
207
  .cb-summaryText{font-size:16px;line-height:24px}
195
208
  .cb-statValue{font-size:24px;line-height:30px}
209
+ .cb-stats{--cb-statTile:42px}
210
+ .cb-statsIcons{column-gap:16px}
211
+ .cb-statIcon{column-gap:10px}
212
+ .cb-statsPaired>.cb-statIcon:not(.cb-statWide){grid-template-columns:minmax(0,1fr)}
213
+ .cb-statsPaired>.cb-statIcon:not(.cb-statWide)>*{grid-column:1}
214
+ .cb-statsPaired>.cb-statIcon:not(.cb-statWide)>.cb-statTile{grid-row:auto;align-self:start;margin-bottom:6px}
215
+ .cb-statsCompact{--cb-statTile:40px}
216
+ .cb-countdownHead{--cb-statTile:46px}
196
217
  }
197
218
  /* Touch and pointer: cards and rows answer a hover and a press, in DSH's own interactive colours and motion. */
198
219
  .cb-card{transition:box-shadow var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease),transform var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease)}
@@ -984,11 +1005,14 @@ function EasedNumber({ value, locale }) {
984
1005
  const decimals = Math.min(3, (String(value).split(".")[1] ?? "").length);
985
1006
  return formatNumber(shown === value ? value : Number(shown.toFixed(decimals)), locale);
986
1007
  }
987
- function StatBlock({ data, locale, compact, wash }) {
1008
+ function StatBlock({ data, locale, compact, wash, tone }) {
988
1009
  const kit = useKit();
989
- return (0, import_react6.createElement)("div", { className: `cb-stats${compact ? " cb-statsCompact" : ""}` }, data.items.map((item, i) => (0, import_react6.createElement)(
1010
+ const iconic = data.items.some((item) => item.icon);
1011
+ const paired = iconic && data.items.filter((item) => !item.strip).length > 1;
1012
+ return (0, import_react6.createElement)("div", { className: ["cb-stats", compact && "cb-statsCompact", iconic && "cb-statsIcons", paired && "cb-statsPaired"].filter(Boolean).join(" ") }, data.items.map((item, i) => (0, import_react6.createElement)(
990
1013
  item.link ? "a" : "div",
991
- { key: i, className: `cb-stat${item.strip ? " cb-statWide" : ""}${item.link ? " cb-statLink" : ""}`, ...item.link ? linkProps(item.link) : {} },
1014
+ { key: i, className: ["cb-stat", item.strip && "cb-statWide", item.link && "cb-statLink", item.icon && "cb-statIcon"].filter(Boolean).join(" "), ...item.link ? linkProps(item.link) : {} },
1015
+ item.icon && (0, import_react6.createElement)(kit.Tile, { icon: item.icon, tone: item.iconTone ?? item.tone ?? tone ?? "muted", size: compact ? 44 : 48, className: "cb-statTile" }),
992
1016
  (0, import_react6.createElement)("div", { className: "cb-statLabel" }, (0, import_react6.createElement)(Trunc, { as: "span", text: item.label }), i === 0 && wash && (0, import_react6.createElement)(kit.JustNow)),
993
1017
  (0, import_react6.createElement)(
994
1018
  "div",
@@ -1207,6 +1231,7 @@ function CountdownBody({ card, locale }) {
1207
1231
  (0, import_react6.createElement)(
1208
1232
  "div",
1209
1233
  { className: "cb-countdownHead" },
1234
+ data.icon && (0, import_react6.createElement)(kit.Tile, { icon: data.icon, tone: card.tone ?? "muted", size: 52, className: "cb-countdownTile" }),
1210
1235
  (0, import_react6.createElement)(kit.Countdown, { to: data.to }),
1211
1236
  (0, import_react6.createElement)(
1212
1237
  "div",
@@ -1438,7 +1463,7 @@ function Body({ card, live, wash, locale, t, rowActions, all, onOpenRow, rowCont
1438
1463
  const data = card.data;
1439
1464
  switch (card.type) {
1440
1465
  case "stat":
1441
- return (0, import_react10.createElement)(StatBlock, { data, locale, wash });
1466
+ return (0, import_react10.createElement)(StatBlock, { data, locale, wash, tone: card.tone });
1442
1467
  case "list":
1443
1468
  return (0, import_react10.createElement)(ListCard, { data, live, locale, t, rowActions, ask: card.ask, all, onOpenRow, rowControls });
1444
1469
  case "status":
@@ -1548,7 +1573,7 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
1548
1573
  (0, import_react10.createElement)("div", { className: "cb-summaryAside" }, live.fresh && (0, import_react10.createElement)(kit.NewDot), chat)
1549
1574
  );
1550
1575
  }
1551
- const statBlock = card.stat && (0, import_react10.createElement)(StatBlock, { data: card.stat, locale, compact: true, wash: wash !== "" });
1576
+ const statBlock = card.stat && (0, import_react10.createElement)(StatBlock, { data: card.stat, locale, compact: true, wash: wash !== "", tone: card.tone });
1552
1577
  const body = (0, import_react10.createElement)(Body, { card, live, wash: wash !== "", locale, t, rowActions, all: sheet, onOpenRow, rowControls });
1553
1578
  return (0, import_react10.createElement)(
1554
1579
  "section",
@@ -17,6 +17,7 @@
17
17
  "en": "3 h 10 m, one change",
18
18
  "zh": "3 小时 10 分,换乘一次"
19
19
  },
20
+ "icon": "luggage",
20
21
  "steps": [
21
22
  {
22
23
  "at": "2026-03-04T07:15:00+01:00",
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "value": "18,240",
17
17
  "unit": "EUR",
18
+ "icon": "piggy-bank",
18
19
  "sub": {
19
20
  "en": "up 2,140 since October",
20
21
  "zh": "比十月多了 2,140"
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "value": 4.5,
17
17
  "unit": "°C",
18
+ "icon": "cloud-sun",
18
19
  "delta": {
19
20
  "text": {
20
21
  "en": "2.1° colder than yesterday",
@@ -68,7 +69,8 @@
68
69
  "zh": "湿度"
69
70
  },
70
71
  "value": 71,
71
- "unit": "%"
72
+ "unit": "%",
73
+ "icon": "droplets"
72
74
  }
73
75
  ]
74
76
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soffits/dsh-card-board",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "A data-driven card board for DeepSeek Harness: scripts write small JSON cards, the Web UI shows each person the boards they may see.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/schema.js CHANGED
@@ -289,13 +289,16 @@ function statData(c, data, path) {
289
289
  if (!c.array(data.items, join(path, 'items'), { min: 1, max: 6 })) return
290
290
  data.items.forEach((item, i) => {
291
291
  const p = join(join(path, 'items'), i)
292
- if (!c.object(item, p, ['label', 'value'], ['unit', 'delta', 'sub', 'tone', 'spark', 'progress', 'strip', 'link'])) return
292
+ if (!c.object(item, p, ['label', 'value'], ['unit', 'delta', 'sub', 'tone', 'icon', 'iconTone', 'spark', 'progress', 'strip', 'link'])) return
293
293
  c.optional(item, 'link', v => isSafeLink(v) || c.fail(join(p, 'link'), 'must be an http(s) URL or a path starting with /'))
294
294
  c.label(item.label, join(p, 'label'))
295
295
  c.labelOrNumber(item.value, join(p, 'value'))
296
296
  c.optional(item, 'unit', v => c.label(v, join(p, 'unit'), { max: 20 }))
297
297
  c.optional(item, 'sub', v => c.label(v, join(p, 'sub')))
298
298
  tone(c, item, p)
299
+ icon(c, item, p)
300
+ c.optional(item, 'iconTone', v => c.oneOf(v, join(p, 'iconTone'), TONES))
301
+ if (item.iconTone !== undefined && item.icon === undefined) c.fail(join(p, 'iconTone'), 'needs an icon')
299
302
  c.optional(item, 'delta', delta => {
300
303
  const dp = join(p, 'delta')
301
304
  if (!c.object(delta, dp, ['text'], ['tone', 'dir'])) return
@@ -521,8 +524,9 @@ function summaryData(c, data, path) {
521
524
  }
522
525
 
523
526
  function countdownData(c, data, path) {
524
- if (!c.object(data, path, ['to', 'label'], ['sub', 'steps', 'expiresAt'])) return
527
+ if (!c.object(data, path, ['to', 'label'], ['sub', 'icon', 'steps', 'expiresAt'])) return
525
528
  const toOk = c.dateTime(data.to, join(path, 'to'))
529
+ icon(c, data, path)
526
530
  c.label(data.label, join(path, 'label'))
527
531
  c.optional(data, 'sub', v => c.label(v, join(path, 'sub')))
528
532
  c.optional(data, 'expiresAt', v => {