@soffits/dsh-card-board 0.16.1 → 0.17.1
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 +8 -0
- package/README.md +3 -2
- package/client.js +22 -3
- package/examples/boards/home/cards/chores.json +13 -0
- package/package.json +1 -1
- package/src/access.js +1 -0
- package/src/schema.js +20 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.1
|
|
4
|
+
|
|
5
|
+
Tapping a row that has a `detail` opens it again. The row is itself a button (`role=button`), and the check that keeps a tap on one of a row's own buttons from opening it counted the row too, so no row ever opened.
|
|
6
|
+
|
|
7
|
+
## 0.17.0
|
|
8
|
+
|
|
9
|
+
A `detail` can carry `actions`: buttons shown only when its card or row is opened, below the detail, and pressed like any other (the server finds them by id on that card or row). They let a row stay short on the board, a chip and a snooze, while its answers sit under the note that asks the question. View-only viewers get none of them, as with the row's own buttons. Why: `docs/decisions/detail-actions.md`.
|
|
10
|
+
|
|
3
11
|
## 0.16.1
|
|
4
12
|
|
|
5
13
|
Someone who may see a board but isn't an actor no longer gets its declared chat buttons. Those are the board owner's buttons, often a prompt in the owner's own words ("My answer to …:"), so a view-only viewer could still speak for the owner through a conversation. Now only plain `link` buttons survive the filter, plus the page's own "Chat about this" and "Ask", which ask about what the viewer sees in their own new conversation. A row whose chat button is taken away gets the built-in "Ask" back.
|
package/README.md
CHANGED
|
@@ -285,11 +285,12 @@ Tapping a card (anywhere that isn't one of its buttons, links or rows that open
|
|
|
285
285
|
"text": "Three books, due at the branch on Elm Street.",
|
|
286
286
|
"facts": [{ "label": "Renewals left", "value": 1 }, { "label": "Fine per day", "value": "0.25 EUR" }],
|
|
287
287
|
"chart": { "type": "bar", "data": { "bars": [{ "x": "2026-02", "value": 4 }, { "x": "2026-03", "value": 3 }] } },
|
|
288
|
-
"history": [{ "at": "2026-02-20T15:10:00+01:00", "text": "Borrowed" }]
|
|
288
|
+
"history": [{ "at": "2026-02-20T15:10:00+01:00", "text": "Borrowed" }],
|
|
289
|
+
"actions": [{ "kind": "done", "id": "library-books:returned-elm", "label": "Returned at Elm Street" }]
|
|
289
290
|
}
|
|
290
291
|
```
|
|
291
292
|
|
|
292
|
-
Every part is optional: `text`, `facts` (label and value, up to 24), `chart` (a `line` or `bar` card's `data`)
|
|
293
|
+
Every part is optional: `text`, `facts` (label and value, up to 24), `chart` (a `line` or `bar` card's `data`), `history` (newest first, up to 100) and `actions`, buttons shown only in the opened view, below the detail ([Actions](#actions); their ids must differ from the card's or row's own buttons, since a press names its button by id). Buttons that only make sense with the detail in view go there, so the row on the board stays short: a question's answers under the note that asks it, with only a chip and a snooze on the row. A row needs a `key` to carry a `detail`.
|
|
293
294
|
|
|
294
295
|
On a chart, hovering or tapping shows the value and date of the point under the pointer. Cards and rows answer a hover and a press; a row's buttons show on hover with a mouse and are always there on touch. A card that changes settles into place, numbers ease to their new value and rows that a list opens fade in; nothing moves with reduced motion. Buttons, tags, axes and other chrome aren't selectable; titles, notes and numbers are.
|
|
295
296
|
|
package/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @soffits/dsh-card-board 0.
|
|
1
|
+
/* @soffits/dsh-card-board 0.17.1: 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) => {
|
|
@@ -907,7 +907,8 @@ function openLink(link) {
|
|
|
907
907
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
908
908
|
}
|
|
909
909
|
function onControl(event) {
|
|
910
|
-
|
|
910
|
+
const control = event.target?.closest?.("button,a,input,select,textarea,label,[role=button],[role=link],[role=checkbox],[role=menuitem]");
|
|
911
|
+
return Boolean(control) && control !== event.currentTarget;
|
|
911
912
|
}
|
|
912
913
|
|
|
913
914
|
// src/client/steps.js
|
|
@@ -1540,6 +1541,16 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1540
1541
|
about: about(),
|
|
1541
1542
|
onPress: onPress({})
|
|
1542
1543
|
}));
|
|
1544
|
+
const opened = sheet && actions && card.detail?.actions?.length > 0 && [
|
|
1545
|
+
card.detail.actions.some((action) => action.kind === "step") && (0, import_react10.createElement)(kit.Suggested, { key: "steps", actions: card.detail.actions, about: about(), states: statesOf(entry.presses, void 0), onPress: onPress({}) }),
|
|
1546
|
+
(0, import_react10.createElement)("footer", { key: "buttons", className: "cb-cardActions" }, (0, import_react10.createElement)(actions.ActionBar, {
|
|
1547
|
+
actions: named(card.detail.actions.filter((action) => action.kind !== "step")),
|
|
1548
|
+
part: "buttons",
|
|
1549
|
+
states: statesOf(entry.presses, void 0),
|
|
1550
|
+
about: about(),
|
|
1551
|
+
onPress: onPress({})
|
|
1552
|
+
}))
|
|
1553
|
+
];
|
|
1543
1554
|
const openable = !sheet && onOpen && card.type !== "summary";
|
|
1544
1555
|
const className = ["cb-card", `cb-card-${card.type}`, stale && "cb-cardStale", openable && "cb-cardOpenable", sheet && "cb-cardInSheet", raised && "cb-cardRaised", dragging && "cb-cardDragging", wash].filter(Boolean).join(" ");
|
|
1545
1556
|
const openOnTap = openable ? { onClick: (event) => {
|
|
@@ -1550,6 +1561,7 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1550
1561
|
const index = card.data.rows?.findIndex((r) => r.key === openRow) ?? -1;
|
|
1551
1562
|
const target = index >= 0 ? card.data.rows[index] : null;
|
|
1552
1563
|
if (!target) return (0, import_react10.createElement)("p", { className: "cb-muted" }, t("rowGone"));
|
|
1564
|
+
const opened2 = target.detail?.actions ?? [];
|
|
1553
1565
|
return (0, import_react10.createElement)(
|
|
1554
1566
|
"div",
|
|
1555
1567
|
{ className: "cb-rowSheet" },
|
|
@@ -1563,7 +1575,13 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1563
1575
|
all: true,
|
|
1564
1576
|
rowControls: { ...rowControls, kept: [], press: (_, action) => rowControls.press(index, action), state: (_, id) => rowControls.state(index, id), latest: (_, id) => rowControls.latest(index, id) }
|
|
1565
1577
|
}),
|
|
1566
|
-
(0, import_react10.createElement)(DetailParts, { detail: target.detail, locale, t })
|
|
1578
|
+
(0, import_react10.createElement)(DetailParts, { detail: target.detail, locale, t }),
|
|
1579
|
+
rowActions && opened2.length > 0 && (0, import_react10.createElement)(
|
|
1580
|
+
"footer",
|
|
1581
|
+
{ className: "cb-cardActions" },
|
|
1582
|
+
opened2.some((action) => action.kind === "step") && rowActions(index, opened2, "steps"),
|
|
1583
|
+
rowActions(index, opened2, "buttons")
|
|
1584
|
+
)
|
|
1567
1585
|
);
|
|
1568
1586
|
}
|
|
1569
1587
|
if (card.type === "summary") {
|
|
@@ -1601,6 +1619,7 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1601
1619
|
),
|
|
1602
1620
|
statBlock && ["line", "bar", "donut"].includes(card.type) ? (0, import_react10.createElement)("div", { className: "cb-split" }, statBlock, (0, import_react10.createElement)("div", { className: "cb-cardBody" }, body)) : [statBlock && (0, import_react10.createElement)("div", { key: "stat" }, statBlock), (0, import_react10.createElement)("div", { key: "body", className: "cb-cardBody" }, body)],
|
|
1603
1621
|
sheet && (0, import_react10.createElement)(DetailParts, { detail: card.detail, locale, t }),
|
|
1622
|
+
opened,
|
|
1604
1623
|
steps,
|
|
1605
1624
|
footer,
|
|
1606
1625
|
sheet && chat && (0, import_react10.createElement)("div", { className: "cb-sheetChat" }, chat)
|
|
@@ -87,6 +87,19 @@
|
|
|
87
87
|
"at": "2026-02-20T15:10:00+01:00",
|
|
88
88
|
"text": "Borrowed"
|
|
89
89
|
}
|
|
90
|
+
],
|
|
91
|
+
"actions": [
|
|
92
|
+
{
|
|
93
|
+
"kind": "done",
|
|
94
|
+
"id": "library-books:returned-elm",
|
|
95
|
+
"label": {
|
|
96
|
+
"en": "Returned at Elm Street",
|
|
97
|
+
"zh": "在榆树街还了"
|
|
98
|
+
},
|
|
99
|
+
"payload": {
|
|
100
|
+
"branch": "elm"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
90
103
|
]
|
|
91
104
|
}
|
|
92
105
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soffits/dsh-card-board",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
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/access.js
CHANGED
|
@@ -122,6 +122,7 @@ export function withoutActions(card) {
|
|
|
122
122
|
const trimmed = holder => {
|
|
123
123
|
const { actions, ...rest } = holder
|
|
124
124
|
const kept = (actions ?? []).filter(action => action.kind === 'link')
|
|
125
|
+
if (Array.isArray(rest.detail?.actions)) rest.detail = trimmed(rest.detail)
|
|
125
126
|
return kept.length > 0 ? { ...rest, actions: kept } : rest
|
|
126
127
|
}
|
|
127
128
|
const rows = card.data?.rows
|
package/src/schema.js
CHANGED
|
@@ -245,11 +245,13 @@ function actions(c, list, path) {
|
|
|
245
245
|
|
|
246
246
|
/**
|
|
247
247
|
* The more a card or a row shows when it is opened: some text, facts (label and value), a chart (a line or bar card's
|
|
248
|
-
* data)
|
|
249
|
-
*
|
|
248
|
+
* data), a history, newest first, and buttons that only make sense with all of that in view. Every part is optional;
|
|
249
|
+
* the opened view also shows the whole body and all actions. `own` is the holder's own actions: an opened button's
|
|
250
|
+
* id must differ from them, since a press names its button by id. Exported so other row shapes can check theirs the
|
|
251
|
+
* same way.
|
|
250
252
|
*/
|
|
251
|
-
export function checkDetail(c, detail, path) {
|
|
252
|
-
if (!c.object(detail, path, [], ['text', 'facts', 'chart', 'history'])) return
|
|
253
|
+
export function checkDetail(c, detail, path, own = []) {
|
|
254
|
+
if (!c.object(detail, path, [], ['text', 'facts', 'chart', 'history', 'actions'])) return
|
|
253
255
|
c.optional(detail, 'text', v => c.label(v, join(path, 'text'), { max: 2000 }))
|
|
254
256
|
c.optional(detail, 'facts', facts => {
|
|
255
257
|
if (!c.array(facts, join(path, 'facts'), { max: 24 })) return
|
|
@@ -266,6 +268,12 @@ export function checkDetail(c, detail, path) {
|
|
|
266
268
|
if (!c.oneOf(chart.type, join(cp, 'type'), ['line', 'bar'])) return
|
|
267
269
|
DATA[chart.type](c, chart.data, join(cp, 'data'))
|
|
268
270
|
})
|
|
271
|
+
c.optional(detail, 'actions', list => {
|
|
272
|
+
const ap = join(path, 'actions')
|
|
273
|
+
actions(c, list, ap)
|
|
274
|
+
const taken = new Set((Array.isArray(own) ? own : []).map(action => action?.id))
|
|
275
|
+
if (Array.isArray(list)) list.forEach((action, i) => { if (taken.has(action?.id)) c.fail(join(join(ap, i), 'id'), 'repeats one of the buttons it opens from') })
|
|
276
|
+
})
|
|
269
277
|
c.optional(detail, 'history', history => {
|
|
270
278
|
if (!c.array(history, join(path, 'history'), { max: 100 })) return
|
|
271
279
|
history.forEach((entry, i) => {
|
|
@@ -281,7 +289,7 @@ export function checkDetail(c, detail, path) {
|
|
|
281
289
|
function rowOpen(c, row, path) {
|
|
282
290
|
c.optional(row, 'link', v => isSafeLink(v) || c.fail(join(path, 'link'), 'must be an http(s) URL or a path starting with /'))
|
|
283
291
|
c.optional(row, 'detail', v => {
|
|
284
|
-
checkDetail(c, v, join(path, 'detail'))
|
|
292
|
+
checkDetail(c, v, join(path, 'detail'), row.actions)
|
|
285
293
|
if (row.key === undefined) c.fail(join(path, 'key'), 'is required on a row with a detail: it is how the row is opened')
|
|
286
294
|
})
|
|
287
295
|
}
|
|
@@ -578,7 +586,7 @@ export function checkCard(card) {
|
|
|
578
586
|
if (!c.object(card, '', ['type', 'title', 'updatedAt', 'data'], ['staleAfter', 'link', 'stat', 'actions', 'icon', 'tone', 'detail', 'raise', 'ask'])) return c.problems
|
|
579
587
|
c.optional(card, 'ask', v => c.boolean(v, 'ask'))
|
|
580
588
|
c.optional(card, 'raise', v => raiseWindow(c, v, 'raise'))
|
|
581
|
-
c.optional(card, 'detail', v => checkDetail(c, v, 'detail'))
|
|
589
|
+
c.optional(card, 'detail', v => checkDetail(c, v, 'detail', card.actions))
|
|
582
590
|
if (!c.oneOf(card.type, 'type', CARD_TYPES)) return c.problems
|
|
583
591
|
c.label(card.title, 'title', { max: 120 })
|
|
584
592
|
c.dateTime(card.updatedAt, 'updatedAt')
|
|
@@ -597,12 +605,14 @@ export function checkCard(card) {
|
|
|
597
605
|
|
|
598
606
|
/**
|
|
599
607
|
* The action a press names, looked up in the card as written: on the card
|
|
600
|
-
* itself, or on row `row` of a list or status card
|
|
601
|
-
*
|
|
608
|
+
* itself, or on row `row` of a list or status card, among its own buttons and
|
|
609
|
+
* those its detail shows when opened. Undefined when there is no such action,
|
|
610
|
+
* so a browser can only press what the data offers.
|
|
602
611
|
*/
|
|
603
612
|
export function findAction(card, actionId, row) {
|
|
604
|
-
const
|
|
605
|
-
|
|
613
|
+
const holder = row === undefined ? card : card?.data?.rows?.[row]
|
|
614
|
+
const list = [holder?.actions, holder?.detail?.actions].flatMap(value => (Array.isArray(value) ? value : []))
|
|
615
|
+
return list.find(action => action?.id === actionId)
|
|
606
616
|
}
|
|
607
617
|
|
|
608
618
|
/** Problems with a board.json's parsed content. */
|