@soffits/dsh-card-board 0.11.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,14 @@
|
|
|
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
|
+
|
|
7
|
+
## 0.12.0
|
|
8
|
+
|
|
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.
|
|
10
|
+
- New `ask` field, a boolean on a card (all its rows) or on a row: `false` leaves the default button out. The card's corner button is unchanged.
|
|
11
|
+
|
|
3
12
|
## 0.11.0
|
|
4
13
|
|
|
5
14
|
- Each person can arrange a board for themselves: drag a card (mouse: by the handle on hover; touch: press and hold the head), or use its menu (Pin to top, Move up, Move down; Alt+↑/↓ on the menu button). Pinned cards come first, and **Reset order** goes back to the board's `order`, which stays the default. The arrangement is stored once by the plugin per person (`<dataDir>/.arrange/`, the same identity as who sees what), follows them across devices and reaches their other open pages through the events stream (`{ "type": "arrange" }`). A card the person never placed goes where the board's order puts it.
|
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
|
|
|
@@ -289,7 +289,7 @@ On a chart, hovering or tapping shows the value and date of the point under the
|
|
|
289
289
|
|
|
290
290
|
## Actions
|
|
291
291
|
|
|
292
|
-
A card, a list row or a status row can carry up to six buttons:
|
|
292
|
+
A card, a list row or a status row can carry up to six buttons (a list or status row also gets the Ask button below):
|
|
293
293
|
|
|
294
294
|
```json
|
|
295
295
|
"actions": [
|
|
@@ -302,7 +302,7 @@ A card, a list row or a status row can carry up to six buttons:
|
|
|
302
302
|
]
|
|
303
303
|
```
|
|
304
304
|
|
|
305
|
-
- `chat` opens a new conversation (or the session named in `payload.session`) with a draft that quotes the card or row and carries its ids as JSON, after `payload.prompt` if you gave one. Nothing is sent until the person sends it, so the message comes from them like any other. Every card also has a chat button in its corner without declaring one ("Chat about this");
|
|
305
|
+
- `chat` opens a new conversation (or the session named in `payload.session`) with a draft that quotes the card or row and carries its ids as JSON, after `payload.prompt` if you gave one. Nothing is sent until the person sends it, so the message comes from them like any other. Every card also has a chat button in its corner without declaring one ("Chat about this"), and every list and status row has one at the end of its buttons ("Ask"), about that row and its card; a row that declares a `chat` action keeps its own, and one with six buttons already gets none. Set `ask: false` on a row, or on a card for all its rows, where asking makes no sense (a row that only says "nothing else today"). When the board names an `assistant` the buttons say who they ask ("Ask Robin"). A `label` and `payload.prompt` can be text in several languages.
|
|
306
306
|
- `step` is a suggested next step the assistant starts on one tap (on a row it sits with the row's other buttons, "Start" for instance): the label says the step plainly ("Renew the books online") and the tap is the person's go-ahead for exactly that. The press is recorded on the server like `done`, then the page sends the step (`payload.prompt` when it needs more words than the label, never more than it authorises; otherwise the label) with the card or row into a new session (or `payload.session`) as the person, with no draft to confirm, and the button links to that session. At most 3 steps per card or row; add one only where the data has a clear next step. The label (up to 80 characters) is required.
|
|
307
307
|
- `done`, `snooze` and `event` are pressed on the server. A snooze without `payload.until` asks: in 3 hours, tomorrow at 9:00, or a time.
|
|
308
308
|
- `link` opens `payload.url`.
|
package/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @soffits/dsh-card-board 0.
|
|
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)}
|
|
@@ -966,6 +987,15 @@ function doneState(row, latest) {
|
|
|
966
987
|
}
|
|
967
988
|
var withKept = (kept = [], entry) => [...kept.filter((other) => other.id !== entry.id), entry];
|
|
968
989
|
|
|
990
|
+
// src/client/ask.js
|
|
991
|
+
var MAX_ACTIONS = 6;
|
|
992
|
+
function rowButtons(row, cardAsk) {
|
|
993
|
+
const own = row.actions ?? [];
|
|
994
|
+
if (row.ask === false || cardAsk === false) return own;
|
|
995
|
+
if (own.some((action) => action.kind === "chat") || own.length >= MAX_ACTIONS) return own;
|
|
996
|
+
return [...own, { kind: "chat", id: "_ask" }];
|
|
997
|
+
}
|
|
998
|
+
|
|
969
999
|
// src/client/cards.js
|
|
970
1000
|
var STATE_OF_TONE = { ok: "done", warn: "warning", bad: "error" };
|
|
971
1001
|
var DIRECTION_ICON = { up: "trending-up", down: "trending-down" };
|
|
@@ -975,11 +1005,14 @@ function EasedNumber({ value, locale }) {
|
|
|
975
1005
|
const decimals = Math.min(3, (String(value).split(".")[1] ?? "").length);
|
|
976
1006
|
return formatNumber(shown === value ? value : Number(shown.toFixed(decimals)), locale);
|
|
977
1007
|
}
|
|
978
|
-
function StatBlock({ data, locale, compact, wash }) {
|
|
1008
|
+
function StatBlock({ data, locale, compact, wash, tone }) {
|
|
979
1009
|
const kit = useKit();
|
|
980
|
-
|
|
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)(
|
|
981
1013
|
item.link ? "a" : "div",
|
|
982
|
-
{ key: i, className:
|
|
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" }),
|
|
983
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)),
|
|
984
1017
|
(0, import_react6.createElement)(
|
|
985
1018
|
"div",
|
|
@@ -1027,7 +1060,7 @@ function RowWhen({ row, locale, t }) {
|
|
|
1027
1060
|
}
|
|
1028
1061
|
return row.date ? (0, import_react6.createElement)("span", { className: "cb-when" }, (0, import_react6.createElement)(kit.RelativeDay, { date: row.date })) : null;
|
|
1029
1062
|
}
|
|
1030
|
-
function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fresh, rowActions, className, onOpenRow }) {
|
|
1063
|
+
function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fresh, rowActions, ask, className, onOpenRow }) {
|
|
1031
1064
|
const kit = useKit();
|
|
1032
1065
|
const now = kit.useNow();
|
|
1033
1066
|
const wash = kit.useWash(washCount, row.key);
|
|
@@ -1049,6 +1082,7 @@ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fres
|
|
|
1049
1082
|
}
|
|
1050
1083
|
}
|
|
1051
1084
|
};
|
|
1085
|
+
const buttons = rowActions && rowButtons(row, ask);
|
|
1052
1086
|
return (0, import_react6.createElement)(
|
|
1053
1087
|
"li",
|
|
1054
1088
|
{ className: ["cb-row", className, isActive(row.active, now) && "cb-rowNow", go && "cb-rowOpens", wash].filter(Boolean).join(" "), ...opens },
|
|
@@ -1063,11 +1097,11 @@ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fres
|
|
|
1063
1097
|
meta,
|
|
1064
1098
|
value,
|
|
1065
1099
|
// The row's own buttons on the right: its steps first (a step starts the work on one tap), then the others.
|
|
1066
|
-
|
|
1100
|
+
buttons?.length > 0 && (0, import_react6.createElement)(
|
|
1067
1101
|
"span",
|
|
1068
1102
|
{ className: "cb-rowActions" },
|
|
1069
|
-
|
|
1070
|
-
rowActions(index,
|
|
1103
|
+
buttons.some((action) => action.kind === "step") && rowActions(index, buttons, "steps"),
|
|
1104
|
+
rowActions(index, buttons, "buttons")
|
|
1071
1105
|
)
|
|
1072
1106
|
);
|
|
1073
1107
|
}
|
|
@@ -1090,7 +1124,7 @@ function DoneBox({ row, index, done, rowControls, t }) {
|
|
|
1090
1124
|
);
|
|
1091
1125
|
}
|
|
1092
1126
|
var rowLive = (live, row) => ({ washCount: live.rows?.[row.key] ?? 0, fresh: row.key !== void 0 && live.freshRows.has(row.key) });
|
|
1093
|
-
function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, rowControls }) {
|
|
1127
|
+
function ListCard({ data, live, locale, t, rowActions, ask, all = false, onOpenRow, rowControls }) {
|
|
1094
1128
|
const kit = useKit();
|
|
1095
1129
|
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
1096
1130
|
const listed = keepTicked(data.rows, rowControls?.kept);
|
|
@@ -1125,6 +1159,7 @@ function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, r
|
|
|
1125
1159
|
index: data.rows.indexOf(row),
|
|
1126
1160
|
row: doneOf(row) && rowControls ? { ...row, actions: row.actions.filter((a) => a.kind !== "done") } : row,
|
|
1127
1161
|
rowActions: data.rows.includes(row) ? rowActions : void 0,
|
|
1162
|
+
ask,
|
|
1128
1163
|
onOpenRow,
|
|
1129
1164
|
className: [i >= LIST_ROWS && "cb-rowLate", ticked(row) && "cb-done"].filter(Boolean).join(" ") || void 0,
|
|
1130
1165
|
...rowLive(live, row),
|
|
@@ -1148,13 +1183,14 @@ function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, r
|
|
|
1148
1183
|
)
|
|
1149
1184
|
);
|
|
1150
1185
|
}
|
|
1151
|
-
function StatusCard({ data, live, locale, rowActions, onOpenRow }) {
|
|
1186
|
+
function StatusCard({ data, live, locale, rowActions, ask, onOpenRow }) {
|
|
1152
1187
|
const kit = useKit();
|
|
1153
1188
|
return (0, import_react6.createElement)("ul", { className: "cb-rows" }, data.rows.map((row, i) => (0, import_react6.createElement)(Row, {
|
|
1154
1189
|
key: row.key ?? i,
|
|
1155
1190
|
index: i,
|
|
1156
1191
|
row,
|
|
1157
1192
|
rowActions,
|
|
1193
|
+
ask,
|
|
1158
1194
|
onOpenRow,
|
|
1159
1195
|
...rowLive(live, row),
|
|
1160
1196
|
className: "cb-statusRow",
|
|
@@ -1195,6 +1231,7 @@ function CountdownBody({ card, locale }) {
|
|
|
1195
1231
|
(0, import_react6.createElement)(
|
|
1196
1232
|
"div",
|
|
1197
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" }),
|
|
1198
1235
|
(0, import_react6.createElement)(kit.Countdown, { to: data.to }),
|
|
1199
1236
|
(0, import_react6.createElement)(
|
|
1200
1237
|
"div",
|
|
@@ -1426,11 +1463,11 @@ function Body({ card, live, wash, locale, t, rowActions, all, onOpenRow, rowCont
|
|
|
1426
1463
|
const data = card.data;
|
|
1427
1464
|
switch (card.type) {
|
|
1428
1465
|
case "stat":
|
|
1429
|
-
return (0, import_react10.createElement)(StatBlock, { data, locale, wash });
|
|
1466
|
+
return (0, import_react10.createElement)(StatBlock, { data, locale, wash, tone: card.tone });
|
|
1430
1467
|
case "list":
|
|
1431
|
-
return (0, import_react10.createElement)(ListCard, { data, live, locale, t, rowActions, all, onOpenRow, rowControls });
|
|
1468
|
+
return (0, import_react10.createElement)(ListCard, { data, live, locale, t, rowActions, ask: card.ask, all, onOpenRow, rowControls });
|
|
1432
1469
|
case "status":
|
|
1433
|
-
return (0, import_react10.createElement)(StatusCard, { data, live, locale, rowActions, onOpenRow });
|
|
1470
|
+
return (0, import_react10.createElement)(StatusCard, { data, live, locale, rowActions, ask: card.ask, onOpenRow });
|
|
1434
1471
|
case "countdown":
|
|
1435
1472
|
return (0, import_react10.createElement)(CountdownBody, { card, locale });
|
|
1436
1473
|
default: {
|
|
@@ -1536,7 +1573,7 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1536
1573
|
(0, import_react10.createElement)("div", { className: "cb-summaryAside" }, live.fresh && (0, import_react10.createElement)(kit.NewDot), chat)
|
|
1537
1574
|
);
|
|
1538
1575
|
}
|
|
1539
|
-
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 });
|
|
1540
1577
|
const body = (0, import_react10.createElement)(Body, { card, live, wash: wash !== "", locale, t, rowActions, all: sheet, onOpenRow, rowControls });
|
|
1541
1578
|
return (0, import_react10.createElement)(
|
|
1542
1579
|
"section",
|
|
@@ -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.
|
|
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
|
|
@@ -425,10 +428,11 @@ function listData(c, data, path) {
|
|
|
425
428
|
if (c.array(data.rows, join(path, 'rows'), { max: 100 }))
|
|
426
429
|
data.rows.forEach((row, i) => {
|
|
427
430
|
const p = join(join(path, 'rows'), i)
|
|
428
|
-
if (!c.object(row, p, ['title'], ['sub', 'chip', 'checked', 'date', 'actions', 'icon', 'tone', 'key', 'active', 'link', 'detail'])) return
|
|
431
|
+
if (!c.object(row, p, ['title'], ['sub', 'chip', 'checked', 'date', 'actions', 'icon', 'tone', 'key', 'active', 'link', 'detail', 'ask'])) return
|
|
429
432
|
rowOpen(c, row, p)
|
|
430
433
|
rowLook(c, row, p, keys)
|
|
431
434
|
c.optional(row, 'actions', v => actions(c, v, join(p, 'actions')))
|
|
435
|
+
c.optional(row, 'ask', v => c.boolean(v, join(p, 'ask')))
|
|
432
436
|
c.label(row.title, join(p, 'title'))
|
|
433
437
|
c.optional(row, 'sub', v => c.label(v, join(p, 'sub')))
|
|
434
438
|
c.optional(row, 'checked', v => c.boolean(v, join(p, 'checked')))
|
|
@@ -488,7 +492,7 @@ function statusData(c, data, path) {
|
|
|
488
492
|
const keys = new Set()
|
|
489
493
|
data.rows.forEach((row, i) => {
|
|
490
494
|
const p = join(join(path, 'rows'), i)
|
|
491
|
-
if (!c.object(row, p, ['label', 'value', 'tone'], ['sub', 'spark', 'actions', 'icon', 'key', 'active', 'link', 'detail'])) return
|
|
495
|
+
if (!c.object(row, p, ['label', 'value', 'tone'], ['sub', 'spark', 'actions', 'icon', 'key', 'active', 'link', 'detail', 'ask'])) return
|
|
492
496
|
rowOpen(c, row, p)
|
|
493
497
|
rowLook(c, row, p, keys, { toneRequired: true })
|
|
494
498
|
c.optional(row, 'actions', v => actions(c, v, join(p, 'actions')))
|
|
@@ -520,8 +524,9 @@ function summaryData(c, data, path) {
|
|
|
520
524
|
}
|
|
521
525
|
|
|
522
526
|
function countdownData(c, data, path) {
|
|
523
|
-
if (!c.object(data, path, ['to', 'label'], ['sub', 'steps', 'expiresAt'])) return
|
|
527
|
+
if (!c.object(data, path, ['to', 'label'], ['sub', 'icon', 'steps', 'expiresAt'])) return
|
|
524
528
|
const toOk = c.dateTime(data.to, join(path, 'to'))
|
|
529
|
+
icon(c, data, path)
|
|
525
530
|
c.label(data.label, join(path, 'label'))
|
|
526
531
|
c.optional(data, 'sub', v => c.label(v, join(path, 'sub')))
|
|
527
532
|
c.optional(data, 'expiresAt', v => {
|
|
@@ -568,7 +573,8 @@ export function isSafeLink(value) {
|
|
|
568
573
|
/** Problems with one card file's parsed content. */
|
|
569
574
|
export function checkCard(card) {
|
|
570
575
|
const c = new Check()
|
|
571
|
-
if (!c.object(card, '', ['type', 'title', 'updatedAt', 'data'], ['staleAfter', 'link', 'stat', 'actions', 'icon', 'tone', 'detail', 'raise'])) return c.problems
|
|
576
|
+
if (!c.object(card, '', ['type', 'title', 'updatedAt', 'data'], ['staleAfter', 'link', 'stat', 'actions', 'icon', 'tone', 'detail', 'raise', 'ask'])) return c.problems
|
|
577
|
+
c.optional(card, 'ask', v => c.boolean(v, 'ask'))
|
|
572
578
|
c.optional(card, 'raise', v => raiseWindow(c, v, 'raise'))
|
|
573
579
|
c.optional(card, 'detail', v => checkDetail(c, v, 'detail'))
|
|
574
580
|
if (!c.oneOf(card.type, 'type', CARD_TYPES)) return c.problems
|