@soffits/dsh-card-board 0.17.1 → 0.17.3

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.js +67 -31
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.3
4
+
5
+ An opened row reads well on a phone. The sheet used to draw it as a list row, so on a narrow screen its title was squeezed into a column a word wide beside its chip and buttons, under a heading that already said the same. Now the heading is the title, and under it come the row's facts on one wrapping line (chip, sub, day), its detail, and every button with its label on a wrapping row: the detail's, the row's own (an unlabelled done as a labelled box), then Ask. List rows on a card keep their layout, but their words no longer shrink below a readable width: what doesn't fit beside them wraps underneath, and in a narrow card the buttons take at most half the row.
6
+
7
+ ## 0.17.2
8
+
9
+ An opened row's detail buttons show their labels (a chat button said nothing but its icon).
10
+
3
11
  ## 0.17.1
4
12
 
5
13
  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.
package/client.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @soffits/dsh-card-board 0.17.1: built by scripts/build.mjs from src/client/. Do not edit. */
1
+ /* @soffits/dsh-card-board 0.17.3: 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) => {
@@ -131,7 +131,7 @@ h3.cb-truncOpen{overflow:visible}
131
131
  .cb-rows .cb-row:first-child{border-top:0}
132
132
  .cb-row+.cb-row{border-top-left-radius:0;border-top-right-radius:0}
133
133
  .cb-rowNow{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 6%,transparent)}
134
- .cb-rowText{flex:1;min-width:0}
134
+ .cb-rowText{flex:1 1 10em;min-width:0}
135
135
  .cb-rowTitle{display:flex;align-items:center;gap:6px;min-width:0;font-size:14px;line-height:20px}
136
136
  .cb-rowSub{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}
137
137
  .cb-done .cb-rowTitle{color:var(--dsw-alias-label-tertiary);text-decoration:line-through}
@@ -182,7 +182,7 @@ h3.cb-truncOpen{overflow:visible}
182
182
 
183
183
  /* narrow cards: meta and buttons move under the words */
184
184
  @container (width<360px){
185
- .cb-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;column-gap:10px}
185
+ .cb-row{display:grid;grid-template-columns:auto minmax(0,1fr) fit-content(50%);align-items:center;column-gap:10px}
186
186
  .cb-row>.cb-rowText{grid-column:2}
187
187
  .cb-row>.cb-rowMeta,.cb-row>.cb-statusSpark{grid-column:2/-1;max-width:none;justify-content:flex-start}
188
188
  .cb-row>.cb-rowActions{grid-column:3;grid-row:1}
@@ -281,7 +281,14 @@ button.cb-cardMore{border:0;background:transparent;padding:0;font:inherit;cursor
281
281
  .cb-facts dd{margin:0;color:var(--dsw-alias-label-primary);overflow-wrap:anywhere}
282
282
  .cb-detailHistory h4{margin:0 0 6px;font-size:12px;font-weight:500;color:var(--dsw-alias-label-tertiary);-webkit-user-select:none;user-select:none}
283
283
  .cb-sheetChat{display:flex;justify-content:flex-end}
284
- .cb-rowSheet{display:flex;flex-direction:column;gap:12px}
284
+ .cb-openRow{display:flex;flex-direction:column;gap:14px;min-width:0}
285
+ .cb-openFacts{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;font-size:13px;line-height:20px}
286
+ .cb-openFacts>*{min-width:0;max-width:100%}
287
+ .cb-openFacts .cb-rowSub{font-size:13px;line-height:20px;overflow-wrap:anywhere}
288
+ .cb-openRow .cb-detail{margin-top:0}
289
+ .cb-openActions{display:flex;flex-direction:column;gap:8px;min-width:0}
290
+ .cb-openButtons{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}
291
+ .cb-doneBoxLabelled{justify-content:flex-start;padding:0 10px 0 6px;border-radius:8px;box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l3);font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
285
292
  /* the opened view shows every word: nothing is cut to a line or two */
286
293
  .cb-sheet .cb-trunc{white-space:normal;display:block;-webkit-line-clamp:unset;overflow:visible;text-overflow:clip}
287
294
  @media (width<=640px){.cb-sheetModal.cb-sheetModal{width:calc(100vw - 16px)}}
@@ -289,6 +296,8 @@ button.cb-cardMore{border:0;background:transparent;padding:0;font:inherit;cursor
289
296
  .cb-cardLink{width:40px;height:40px;margin:-9px 0}
290
297
  .cb-doneBox{min-width:40px;min-height:40px;margin:-6px -6px -6px -10px}
291
298
  .cb-doneBox label{display:inline-flex;align-items:center;justify-content:center;min-width:40px;min-height:40px}
299
+ .cb-doneBoxLabelled{margin:0}
300
+ .cb-doneBoxLabelled label{justify-content:flex-start;gap:6px}
292
301
  .cb-cardChat{margin:-9px -10px -9px 0}
293
302
  .cb-reset{min-height:40px}
294
303
  }
@@ -997,6 +1006,10 @@ function rowButtons(row, cardAsk) {
997
1006
  if (own.some((action) => action.kind === "chat") || own.length >= MAX_ACTIONS) return own;
998
1007
  return [...own, { kind: "chat", id: "_ask" }];
999
1008
  }
1009
+ function openedButtons(row, cardAsk) {
1010
+ const done = doneOf(row);
1011
+ return [...row.detail?.actions ?? [], ...rowButtons(row, cardAsk).filter((action) => action !== done)];
1012
+ }
1000
1013
 
1001
1014
  // src/client/cards.js
1002
1015
  var STATE_OF_TONE = { ok: "done", warn: "warning", bad: "error" };
@@ -1107,17 +1120,17 @@ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fres
1107
1120
  )
1108
1121
  );
1109
1122
  }
1110
- function DoneBox({ row, index, done, rowControls, t }) {
1123
+ function DoneBox({ row, index, done, rowControls, t, labelled = false }) {
1111
1124
  const { checked, undo } = doneState(row, rowControls.latest(index, done.id));
1112
1125
  const label = t(checked ? undo ? "markNotDone" : "checked" : "markDone");
1113
1126
  return (0, import_react6.createElement)(
1114
1127
  "span",
1115
- { className: "cb-doneBox", onClick: (event) => event.stopPropagation() },
1128
+ { className: `cb-doneBox${labelled ? " cb-doneBoxLabelled" : ""}`, onClick: (event) => event.stopPropagation() },
1116
1129
  (0, import_react6.createElement)(import_dsh_client_ui_primitives.Checkbox, {
1117
1130
  checked,
1118
1131
  disabled: checked ? undo === void 0 : index < 0,
1119
1132
  title: label,
1120
- label: (0, import_react6.createElement)("span", { className: "cb-visuallyHidden" }, label),
1133
+ label: (0, import_react6.createElement)("span", { className: labelled ? void 0 : "cb-visuallyHidden" }, label),
1121
1134
  onChange: (value) => {
1122
1135
  if (value) rowControls.press(index, done);
1123
1136
  else if (undo) rowControls.undo(undo);
@@ -1185,6 +1198,39 @@ function ListCard({ data, live, locale, t, rowActions, ask, all = false, onOpenR
1185
1198
  )
1186
1199
  );
1187
1200
  }
1201
+ function OpenedRow({ row, kind, index, live, locale, t, rowActions, ask, rowControls, detail }) {
1202
+ const kit = useKit();
1203
+ const wash = kit.useWash(live.rows?.[row.key] ?? 0, row.key);
1204
+ const status = kind === "status";
1205
+ const done = doneOf(row);
1206
+ const buttons = rowActions ? openedButtons(row, ask) : [];
1207
+ const facts = [
1208
+ row.icon && (0, import_react6.createElement)(kit.Tile, { key: "tile", icon: row.icon, tone: row.tone ?? "muted", size: 24 }),
1209
+ status && !row.icon && (0, import_react6.createElement)(import_dsh_client_ui_primitives.StateDot, { key: "dot", state: STATE_OF_TONE[row.tone] ?? "idle" }),
1210
+ !status && row.chip && (0, import_react6.createElement)(import_dsh_client_ui_primitives.Tag, { key: "chip", tone: kit.tagTone(row.chip.tone ?? "muted") }, row.chip.text),
1211
+ status && (0, import_react6.createElement)("span", { key: "value", className: "cb-statusValue", style: row.tone === "bad" || row.tone === "warn" ? { color: kit.toneColor(row.tone) } : void 0 }, formatNumber(row.value, locale)),
1212
+ status && row.spark && (0, import_react6.createElement)("span", { key: "spark", className: "cb-statusSpark" }, (0, import_react6.createElement)(kit.Spark, { values: row.spark, tone: row.tone === "ok" ? "ok" : row.tone, height: 22 })),
1213
+ row.sub && (0, import_react6.createElement)("span", { key: "sub", className: "cb-rowSub" }, row.sub),
1214
+ !status && (0, import_react6.createElement)(RowWhen, { key: "when", row, locale, t })
1215
+ ].filter(Boolean);
1216
+ return (0, import_react6.createElement)(
1217
+ "div",
1218
+ { className: ["cb-openRow", wash].filter(Boolean).join(" ") },
1219
+ facts.length > 0 && (0, import_react6.createElement)("div", { className: "cb-openFacts" }, facts),
1220
+ detail,
1221
+ (buttons.length > 0 || done && rowControls) && (0, import_react6.createElement)(
1222
+ "footer",
1223
+ { className: "cb-openActions" },
1224
+ buttons.some((action) => action.kind === "step") && rowActions(index, buttons, "steps", false),
1225
+ (0, import_react6.createElement)(
1226
+ "div",
1227
+ { className: "cb-openButtons" },
1228
+ done && rowControls && (0, import_react6.createElement)(DoneBox, { row, index, done, rowControls, t, labelled: true }),
1229
+ buttons.some((action) => action.kind !== "step") && rowActions(index, buttons, "buttons", false)
1230
+ )
1231
+ )
1232
+ );
1233
+ }
1188
1234
  function StatusCard({ data, live, locale, rowActions, ask, onOpenRow }) {
1189
1235
  const kit = useKit();
1190
1236
  return (0, import_react6.createElement)("ul", { className: "cb-rows" }, data.rows.map((row, i) => (0, import_react6.createElement)(Row, {
@@ -1516,11 +1562,11 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
1516
1562
  const askName = assistant ? t("action.chatNamed", { name: assistant }) : void 0;
1517
1563
  const named = (list) => assistant ? list?.map((action) => action.kind === "chat" && action.label === void 0 ? { ...action, label: askName } : action) : list;
1518
1564
  const onPress = (target) => (action, extra) => press(action, extra, { card: entry.id, ...target }, target.row === void 0 ? void 0 : card.data.rows?.[target.row]);
1519
- const rowActions = actions && ((row, list, part2) => (0, import_react10.createElement)(actions.ActionBar, {
1565
+ const rowActions = actions && ((row, list, part2, compact = true) => (0, import_react10.createElement)(actions.ActionBar, {
1520
1566
  actions: named(list),
1521
1567
  part: part2,
1522
1568
  states: statesOf(entry.presses, row),
1523
- compact: true,
1569
+ compact,
1524
1570
  about: about(row, rowLine(row)),
1525
1571
  onPress: onPress({ row })
1526
1572
  }));
@@ -1561,28 +1607,18 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
1561
1607
  const index = card.data.rows?.findIndex((r) => r.key === openRow) ?? -1;
1562
1608
  const target = index >= 0 ? card.data.rows[index] : null;
1563
1609
  if (!target) return (0, import_react10.createElement)("p", { className: "cb-muted" }, t("rowGone"));
1564
- const opened2 = target.detail?.actions ?? [];
1565
- return (0, import_react10.createElement)(
1566
- "div",
1567
- { className: "cb-rowSheet" },
1568
- (0, import_react10.createElement)(Body, {
1569
- card: { ...card, data: { ...card.data, rows: [target], progress: void 0 } },
1570
- live,
1571
- wash: false,
1572
- locale,
1573
- t,
1574
- rowActions: rowActions && ((_, list, part2) => rowActions(index, list, part2)),
1575
- all: true,
1576
- rowControls: { ...rowControls, kept: [], press: (_, action) => rowControls.press(index, action), state: (_, id) => rowControls.state(index, id), latest: (_, id) => rowControls.latest(index, id) }
1577
- }),
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
- )
1585
- );
1610
+ return (0, import_react10.createElement)(OpenedRow, {
1611
+ row: target,
1612
+ kind: card.type,
1613
+ index,
1614
+ live,
1615
+ locale,
1616
+ t,
1617
+ rowActions,
1618
+ ask: card.ask,
1619
+ rowControls,
1620
+ detail: (0, import_react10.createElement)(DetailParts, { detail: target.detail, locale, t })
1621
+ });
1586
1622
  }
1587
1623
  if (card.type === "summary") {
1588
1624
  return (0, import_react10.createElement)(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soffits/dsh-card-board",
3
- "version": "0.17.1",
3
+ "version": "0.17.3",
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",