@soffits/dsh-card-board 0.4.0 → 0.4.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
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2
4
+
5
+ - List rows on narrow cards (a phone) keep their buttons beside the title, with the date and chip underneath, instead of putting the buttons on a line of their own: a long list takes about a third less height.
6
+
7
+ ## 0.4.1
8
+
9
+ - A chat button's `payload.prompt` can be text in several languages like any other text; the other payload fields stay as written.
10
+
3
11
  ## 0.4.0
4
12
 
5
13
  - Languages: any text on a card or board can be a string or a map of language id to text (`{ "en": "Today", "fr": "Aujourd’hui" }`, `en` required), and the page shows the one for DSH's active language, falling back from the exact tag to its primary language to `en`. Numbers, dates, ages and units are formatted with `Intl` in that language.
package/README.md CHANGED
@@ -225,7 +225,7 @@ A card, a list row or a status row can carry up to six buttons:
225
225
  ]
226
226
  ```
227
227
 
228
- - `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; when the board names an `assistant` the button says who it asks. A `label` can be text in several languages.
228
+ - `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; when the board names an `assistant` the button says who it asks. A `label` and `payload.prompt` can be text in several languages.
229
229
  - `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.
230
230
  - `link` opens `payload.url`.
231
231
 
package/client.js CHANGED
@@ -52,12 +52,14 @@ window.__ModuleLoader__.load({
52
52
 
53
53
  /** A card copy whose texts are resolved: walks the whole tree, so every component sees plain strings. */
54
54
  function pickCard(card, active) {
55
+ const withPrompt = payload => (payload && 'prompt' in payload ? { ...payload, prompt: pickText(payload.prompt, active) } : payload)
55
56
  const walk = value => {
56
57
  if (Array.isArray(value)) return value.map(walk)
57
58
  if (typeof value !== 'object' || value === null) return value
58
59
  const keys = Object.keys(value)
59
60
  if (keys.length > 0 && 'en' in value && keys.every(key => /^[a-z]{2,3}(-[a-z0-9]{2,8})*$/.test(key)) && keys.every(key => typeof value[key] === 'string')) return pickText(value, active)
60
- return Object.fromEntries(keys.map(key => [key, key === 'payload' ? value[key] : walk(value[key])]))
61
+ // An action's payload is data for handlers, except the words a chat starts with.
62
+ return Object.fromEntries(keys.map(key => [key, key === 'payload' ? withPrompt(value[key]) : walk(value[key])]))
61
63
  }
62
64
  return walk(card)
63
65
  }
@@ -490,8 +492,9 @@ window.__ModuleLoader__.load({
490
492
  h('div', { className: 'cb-listText' },
491
493
  h(Trunc, { className: 'cb-listTitle', lines: 2, text: row.title }),
492
494
  row.sub && h(Trunc, { className: 'cb-listSub', lines: 2, text: row.sub })),
493
- row.date && h('span', { className: 'cb-listDate' }, formatDay(toTime(row.date), locale, 0)),
494
- row.chip && h(Chip, row.chip),
495
+ (row.date || row.chip) && h('span', { className: 'cb-listMeta' },
496
+ row.date && h('span', { className: 'cb-listDate' }, formatDay(toTime(row.date), locale, 0)),
497
+ row.chip && h(Chip, row.chip)),
495
498
  row.actions && rowActions && h('span', { className: 'cb-rowActions' }, rowActions(i, row.actions, listRowLine(row))))))
496
499
  if (!data.progress) return rows
497
500
  // Beside the rows when there is room for both, else a small ring with its count above them.
@@ -986,6 +989,7 @@ h3.cb-truncOpen{overflow:visible}
986
989
  .cb-list li:first-child{border-top:0}
987
990
  .cb-listText{flex:1;min-width:0}
988
991
  .cb-listSub{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}
992
+ .cb-listMeta{display:flex;align-items:center;gap:10px;min-width:0}
989
993
  .cb-listDate{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px;font-variant-numeric:tabular-nums}
990
994
  .cb-done .cb-listTitle{color:var(--dsw-alias-label-tertiary)}
991
995
  .cb-checkBox{flex:none;display:inline-flex}
@@ -1008,9 +1012,11 @@ h3.cb-truncOpen{overflow:visible}
1008
1012
  .cb-statusValue small{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:16px}
1009
1013
  .cb-spark{min-width:0}
1010
1014
  @container (width<380px){
1011
- .cb-list li{flex-wrap:wrap}
1012
- .cb-list li .cb-listText{flex:1 1 9em}
1013
- .cb-list li .cb-rowActions{flex:1 0 100%;justify-content:flex-start;padding-left:28px}
1015
+ .cb-list li{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:0}
1016
+ .cb-list li .cb-checkBox{grid-column:1;grid-row:1;margin-right:10px}
1017
+ .cb-list li .cb-listText{grid-column:2;grid-row:1}
1018
+ .cb-list li .cb-rowActions{grid-column:3;grid-row:1;margin-left:8px}
1019
+ .cb-list li .cb-listMeta{grid-column:2/-1;grid-row:2;margin-top:2px}
1014
1020
  }
1015
1021
  @container (width<380px){
1016
1022
  .cb-status,.cb-statusSparks,.cb-statusActions,.cb-statusSparks.cb-statusActions{grid-template-columns:8px minmax(0,1fr) auto}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soffits/dsh-card-board",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
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
@@ -168,7 +168,7 @@ function actions(c, list, path) {
168
168
  if (action.kind === 'snooze' && payload !== undefined && 'until' in payload) c.dateTime(payload.until, join(join(p, 'payload'), 'until'))
169
169
  if (action.kind === 'chat' && payload !== undefined) {
170
170
  const pp = join(p, 'payload')
171
- if ('prompt' in payload) c.text(payload.prompt, join(pp, 'prompt'), { max: 2000 })
171
+ if ('prompt' in payload) c.label(payload.prompt, join(pp, 'prompt'), { max: 2000 })
172
172
  if ('session' in payload) c.text(payload.session, join(pp, 'session'), { max: 200 })
173
173
  }
174
174
  })