@soffits/dsh-card-board 0.7.0 → 0.8.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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0
4
+
5
+ - Cards keep their own height: the board packs them like masonry (no card stretches to match a neighbour), and fills gaps with shorter cards.
6
+ - Breaking: a board's `layout` gives each card a `size` (`small`, `medium`, `large`, `wide`) instead of `w` and `h`. Without it, a card takes its type's default (summary and timeline wide, countdown large, stat small, the rest medium).
7
+ - A list longer than six rows shows six, then "N more", which opens the rest in place; rows that are new or just changed stay visible.
8
+
9
+ ## 0.7.1
10
+
11
+ - A countdown step in another zone shows the wall-clock time of its own offset (`…T14:20:00-07:00` reads 14:20), and the zone's short name only when the browser's zone data agrees; otherwise it shows the offset ("GMT−7"). A browser with older zone rules no longer moves a ticket's time by an hour.
12
+
3
13
  ## 0.7.0
4
14
 
5
15
  - The board is live: changes arrive over a Server-Sent Events route (`/api/card-board/events`), the page fetches only the card that changed, and a card or row that changes in front of you gets a short wash and "just now". Polling stays as the fallback while the stream is down.
package/README.md CHANGED
@@ -77,12 +77,12 @@ Board and card ids are lowercase letters, digits, `-` and `_`, up to 64 characte
77
77
  "title": "Home",
78
78
  "viewers": ["alex", "sam"],
79
79
  "order": ["weather", "savings", "energy"],
80
- "layout": { "next-weeks": { "w": 2, "h": 1 } },
80
+ "layout": { "weather": { "size": "small" }, "energy": { "size": "wide" } },
81
81
  "assistant": "Robin"
82
82
  }
83
83
  ```
84
84
 
85
- `order` lists cards to put first; the rest follow by id. `layout` sets a card's width and height in grid cells (1 to 3). The grid has four columns on a very wide screen, three on a wide one, two on a medium one and one on a phone; a wide card shrinks to fit. `assistant` is optional: the name the chat buttons ask ("Ask Robin" instead of "Ask"). `title` can be [text in several languages](#languages).
85
+ `order` lists cards to put first; the rest follow by id. `layout` sets how wide a card is: `small` (a third of a wide screen), `medium` (a half), `large` (two thirds) or `wide` (all of it). Without it a card takes its type's default: `summary` and `timeline` are wide, `countdown` large, `stat` small, the rest medium; a summary is always wide. On a tablet small and medium cards take half the width and large and wide ones all of it; on a phone every card is full width. Heights are the cards' own: the board packs them like masonry, so a long card never stretches its neighbours and short ones fill the space beside it. A list longer than six rows shows six, then "N more", which opens the rest in place (a row that is new or just changed always shows). `assistant` is optional: the name the chat buttons ask ("Ask Robin" instead of "Ask"). `title` can be [text in several languages](#languages).
86
86
 
87
87
  A card:
88
88
 
@@ -152,7 +152,7 @@ A big ticking number until `to`, and the stops on the way with the next one mark
152
152
  "expiresAt": "2026-03-04T10:50:00+01:00" }
153
153
  ```
154
154
 
155
- A step's time shows in its `zone` (an IANA name) when it has one, with the zone's short name when it isn't the viewer's.
155
+ 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.
156
156
 
157
157
  ### stat
158
158
 
package/client.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @soffits/dsh-card-board 0.7.0: built by scripts/build.mjs from src/client/. Do not edit. */
1
+ /* @soffits/dsh-card-board 0.8.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) => {
@@ -41,7 +41,8 @@ var CSS = `
41
41
  .cb-heading h1{margin:0;font-size:20px;font-weight:500;line-height:28px}
42
42
  .cb-sub{margin-top:4px;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:20px}
43
43
  .cb-tabs{display:flex;flex-wrap:wrap;gap:6px 8px;margin:0 0 18px}
44
- .cb-grid{display:grid;gap:14px;grid-auto-flow:row dense;align-items:stretch}
44
+ .cb-grid{display:grid;row-gap:0;grid-auto-flow:row dense;align-items:start}
45
+ .cb-more{align-self:flex-start;margin-top:2px}
45
46
  .cb-card{container-type:inline-size;box-sizing:border-box;min-width:0;display:flex;flex-direction:column;gap:12px;padding:16px 18px 18px;border-radius:16px;background:var(--dsw-alias-bg-base);box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l2)}
46
47
  .cb-cardHead{display:flex;align-items:center;gap:10px;min-height:28px}
47
48
  .cb-cardHead h3{flex:1;min-width:0;margin:0;font-size:15px;font-weight:600;line-height:22px}
@@ -101,9 +102,12 @@ h3.cb-truncOpen{overflow:visible}
101
102
  .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}
102
103
  .cb-strip b{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500}
103
104
  .cb-strip li[data-on=true],.cb-strip li[data-on=true] b{color:var(--dsw-alias-state-business-primary)}
105
+ /* a narrow card shows the first hours that fit: 6 under 360 px, 8 under 480 px */
106
+ @container (width<480px){.cb-strip li:nth-child(n+9){display:none}}
107
+ @container (width<360px){.cb-strip li:nth-child(n+7){display:none}}
104
108
  /* a chart card with headline numbers: side by side when there is room */
105
109
  .cb-split{display:flex;flex-direction:column;gap:12px}
106
- @container (width>=640px){.cb-split{display:grid;grid-template-columns:minmax(0,max-content) minmax(0,1fr);align-items:center;gap:28px}.cb-split .cb-stats{display:grid;grid-template-columns:repeat(2,max-content);gap:14px 40px}}
110
+ @container (width>=640px){.cb-split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:center;gap:28px}.cb-split .cb-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 24px}}
107
111
 
108
112
  /* rows of lists and status cards */
109
113
  .cb-list{display:flex;flex-direction:column;gap:10px}
@@ -490,9 +494,9 @@ function BarChart({ data, locale, height }) {
490
494
  let base = 0;
491
495
  parts = keys.map((key, k) => {
492
496
  const v = Math.max(0, bar.values?.[key] ?? 0);
493
- const part = { y0: base, y1: base + v, color: toneColor(void 0, k), x: cx - barW / 2, w: barW };
497
+ const part2 = { y0: base, y1: base + v, color: toneColor(void 0, k), x: cx - barW / 2, w: barW };
494
498
  base += v;
495
- return part;
499
+ return part2;
496
500
  });
497
501
  } else {
498
502
  const each = barW / keys.length;
@@ -652,6 +656,60 @@ function Timeline({ data, locale }) {
652
656
  // src/client/cards.js
653
657
  var import_react5 = require("react");
654
658
  var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
659
+
660
+ // src/client/steps.js
661
+ function ownOffset(at) {
662
+ const m = /(?:([+-])(\d{2}):?(\d{2})|Z)$/.exec(String(at));
663
+ if (!m) return null;
664
+ return m[1] ? (m[1] === "-" ? -1 : 1) * (Number(m[2]) * 60 + Number(m[3])) : 0;
665
+ }
666
+ function part(locale, zone, time, style) {
667
+ const parts = new Intl.DateTimeFormat(locale, { timeZone: zone, timeZoneName: style }).formatToParts(time);
668
+ return parts.find((p) => p.type === "timeZoneName")?.value ?? "";
669
+ }
670
+ function browserOffset(zone, time) {
671
+ const m = /([+-])(\d{1,2})(?::(\d{2}))?/.exec(part("und", zone, time, "shortOffset"));
672
+ return m ? (m[1] === "-" ? -1 : 1) * (Number(m[2]) * 60 + Number(m[3] ?? 0)) : 0;
673
+ }
674
+ function offsetName(offset) {
675
+ const abs = Math.abs(offset);
676
+ return `GMT${offset < 0 ? "\u2212" : "+"}${Math.floor(abs / 60)}${abs % 60 ? `:${String(abs % 60).padStart(2, "0")}` : ""}`;
677
+ }
678
+ function stepTimes(steps, locale, here = Intl.DateTimeFormat().resolvedOptions().timeZone) {
679
+ let lastDay = null;
680
+ return steps.map((step) => {
681
+ const time = new Date(step.at);
682
+ const away = Boolean(step.zone) && step.zone !== here;
683
+ const offset = away ? ownOffset(step.at) : null;
684
+ const shown = offset === null ? time : new Date(time.getTime() + offset * 6e4);
685
+ const zone = offset === null ? away ? step.zone : here : "UTC";
686
+ const day = new Intl.DateTimeFormat("en-CA", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit" }).format(shown);
687
+ const showDay = day !== lastDay;
688
+ lastDay = day;
689
+ let text = new Intl.DateTimeFormat(locale, { timeZone: zone, hour: "2-digit", minute: "2-digit", ...showDay ? { weekday: "short" } : {} }).format(shown);
690
+ if (away) {
691
+ text += " " + (offset === null || browserOffset(step.zone, time) === offset ? part(locale, step.zone, time, "short") : offsetName(offset));
692
+ }
693
+ return { time, text };
694
+ });
695
+ }
696
+
697
+ // src/client/layout.js
698
+ var DEFAULT_SIZE = { summary: "wide", countdown: "large", timeline: "wide", stat: "small" };
699
+ var SPAN = { 6: { small: 2, medium: 3, large: 4, wide: 6 }, 2: { small: 1, medium: 1, large: 2, wide: 2 }, 1: {} };
700
+ var ROW = 4;
701
+ var GAP = 14;
702
+ function spanOf(type, size, tracks) {
703
+ const chosen = type === "summary" ? "wide" : size ?? DEFAULT_SIZE[type] ?? "medium";
704
+ return SPAN[tracks]?.[chosen] ?? 1;
705
+ }
706
+ var LIST_ROWS = 6;
707
+ function shownRows(rows, open, limit, live) {
708
+ if (open || rows.length <= limit + 1) return rows;
709
+ return rows.filter((row, i) => i < limit || row.key !== void 0 && (live?.freshRows?.has(row.key) || live?.rows?.[row.key] > 0));
710
+ }
711
+
712
+ // src/client/cards.js
655
713
  var STATE_OF_TONE = { ok: "done", warn: "warning", bad: "error" };
656
714
  var DIRECTION_ICON = { up: "trending-up", down: "trending-down" };
657
715
  function StatBlock({ data, locale, compact, wash }) {
@@ -723,6 +781,9 @@ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fres
723
781
  var rowLive = (live, row) => ({ washCount: live.rows?.[row.key] ?? 0, fresh: row.key !== void 0 && live.freshRows.has(row.key) });
724
782
  function ListCard({ data, live, locale, t, rowActions }) {
725
783
  const kit = useKit();
784
+ const [open, setOpen] = (0, import_react5.useState)(false);
785
+ const rows = shownRows(data.rows, open, LIST_ROWS, live);
786
+ const hidden = data.rows.length - rows.length;
726
787
  const checkable = data.rows.some((row) => "checked" in row);
727
788
  const progress = data.progress;
728
789
  return (0, import_react5.createElement)(
@@ -744,7 +805,7 @@ function ListCard({ data, live, locale, t, rowActions }) {
744
805
  progress.sub && (0, import_react5.createElement)("div", { className: "cb-rowSub" }, progress.sub)
745
806
  )
746
807
  ),
747
- data.rows.length === 0 ? (0, import_react5.createElement)("p", { className: "cb-muted" }, data.empty ?? t("listEmpty")) : (0, import_react5.createElement)("ul", { className: "cb-rows" }, data.rows.map((row, i) => (0, import_react5.createElement)(Row, {
808
+ data.rows.length === 0 ? (0, import_react5.createElement)("p", { className: "cb-muted" }, data.empty ?? t("listEmpty")) : (0, import_react5.createElement)("ul", { className: "cb-rows" }, rows.map((row, i) => (0, import_react5.createElement)(Row, {
748
809
  key: row.key ?? i,
749
810
  index: i,
750
811
  row,
@@ -762,7 +823,12 @@ function ListCard({ data, live, locale, t, rowActions }) {
762
823
  row.chip && (0, import_react5.createElement)(import_dsh_client_ui_primitives2.Tag, { tone: kit.tagTone(row.chip.tone ?? "muted") }, row.chip.text),
763
824
  (0, import_react5.createElement)(RowWhen, { row, locale, t })
764
825
  )
765
- })))
826
+ }))),
827
+ (hidden > 0 || open) && data.rows.length > LIST_ROWS + 1 && (0, import_react5.createElement)(
828
+ import_dsh_client_ui_primitives2.Button,
829
+ { variant: "ghost", size: "sm", className: "cb-more", onClick: () => setOpen((value) => !value) },
830
+ open ? t("showFewer") : t("showMore", { n: hidden })
831
+ )
766
832
  );
767
833
  }
768
834
  function StatusCard({ data, live, locale, rowActions }) {
@@ -784,8 +850,8 @@ function StatusCard({ data, live, locale, rowActions }) {
784
850
  var PARTS = [[5, "dayPart.morning"], [12, "dayPart.afternoon"], [18, "dayPart.evening"], [22, "dayPart.night"]];
785
851
  function dayLine(now, locale, t) {
786
852
  const hour = new Date(now).getHours();
787
- const part = [...PARTS].reverse().find(([from]) => hour >= from)?.[1] ?? "dayPart.night";
788
- return { text: t("dayLine", { day: new Intl.DateTimeFormat(locale, { weekday: "long" }).format(now), part: t(part) }), dark: part === "dayPart.night" || part === "dayPart.evening" };
853
+ const part2 = [...PARTS].reverse().find(([from]) => hour >= from)?.[1] ?? "dayPart.night";
854
+ return { text: t("dayLine", { day: new Intl.DateTimeFormat(locale, { weekday: "long" }).format(now), part: t(part2) }), dark: part2 === "dayPart.night" || part2 === "dayPart.evening" };
789
855
  }
790
856
  function SummaryBody({ card, locale, t, wash }) {
791
857
  const kit = useKit();
@@ -799,19 +865,6 @@ function SummaryBody({ card, locale, t, wash }) {
799
865
  card.data.chips?.length > 0 && (0, import_react5.createElement)("div", { className: "cb-chips" }, card.data.chips.map((chip, i) => (0, import_react5.createElement)(kit.Chip, { key: i, icon: chip.icon, tone: chip.tone ?? "muted", to: chip.to }, chip.text)))
800
866
  );
801
867
  }
802
- function stepTimes(steps, locale) {
803
- const here = Intl.DateTimeFormat().resolvedOptions().timeZone;
804
- let lastDay = null;
805
- return steps.map((step) => {
806
- const time = toTime(step.at);
807
- const zone = step.zone ?? here;
808
- const day = new Intl.DateTimeFormat("en-CA", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit" }).format(time);
809
- const showDay = day !== lastDay;
810
- lastDay = day;
811
- const text = new Intl.DateTimeFormat(locale, { timeZone: zone, hour: "2-digit", minute: "2-digit", ...showDay ? { weekday: "short" } : {}, ...zone !== here ? { timeZoneName: "short" } : {} }).format(time);
812
- return { time, text };
813
- });
814
- }
815
868
  function CountdownBody({ card, locale }) {
816
869
  const kit = useKit();
817
870
  const now = kit.useNow();
@@ -961,15 +1014,28 @@ function useActiveLocale() {
961
1014
  }
962
1015
 
963
1016
  // src/client/card.js
964
- var CHART_HEIGHT = { 1: 150, 2: 360, 3: 560 };
965
- var CHART_HEIGHT_NARROW = { 1: 150, 2: 220, 3: 260 };
1017
+ var CHART_HEIGHT = 150;
1018
+ function useRowSpan() {
1019
+ const ref = (0, import_react7.useRef)(null);
1020
+ const [rows, setRows] = (0, import_react7.useState)(0);
1021
+ (0, import_react7.useLayoutEffect)(() => {
1022
+ const el = ref.current;
1023
+ if (!el || typeof ResizeObserver === "undefined") return void 0;
1024
+ const measure = () => setRows(Math.ceil((el.getBoundingClientRect().height + GAP) / ROW));
1025
+ measure();
1026
+ const observer = new ResizeObserver(measure);
1027
+ observer.observe(el);
1028
+ return () => observer.disconnect();
1029
+ }, []);
1030
+ return [ref, rows];
1031
+ }
966
1032
  var CHARTS = { line: LineChart, bar: BarChart, donut: Donut, timeline: Timeline };
967
1033
  function statesOf(presses, row) {
968
1034
  const states = {};
969
1035
  for (const press of presses ?? []) if (press.row === row) states[press.id] = press.state;
970
1036
  return states;
971
1037
  }
972
- function Body({ card, size, narrow, live, wash, locale, t, rowActions }) {
1038
+ function Body({ card, live, wash, locale, t, rowActions }) {
973
1039
  const data = card.data;
974
1040
  switch (card.type) {
975
1041
  case "stat":
@@ -983,23 +1049,21 @@ function Body({ card, size, narrow, live, wash, locale, t, rowActions }) {
983
1049
  default: {
984
1050
  const Chart = CHARTS[card.type];
985
1051
  if (Chart === void 0) return null;
986
- const height = (narrow ? CHART_HEIGHT_NARROW : CHART_HEIGHT)[size.h];
987
- return (0, import_react7.createElement)(Chart, { data, locale, height: card.type === "bar" ? Math.min(height, 130 + (size.h - 1) * 200) : card.type === "donut" ? Math.max(height, 160) : height });
1052
+ return (0, import_react7.createElement)(Chart, { data, locale, height: card.type === "bar" ? 130 : card.type === "donut" ? 160 : CHART_HEIGHT });
988
1053
  }
989
1054
  }
990
1055
  }
991
- function Card({ entry, live, boardId, assistant, columns, active, locale, t, press }) {
1056
+ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, press }) {
992
1057
  const kit = useKit();
993
1058
  const actions = useButtons();
994
1059
  const now = kit.useNow();
995
1060
  const wash = kit.useWash(live.wash, entry.id);
996
- const full = entry.card?.type === "summary";
997
- const size = { w: full ? columns : Math.min(entry.w ?? 1, columns), h: entry.h ?? 1 };
998
- const style = { gridColumn: `span ${size.w}`, gridRow: size.h > 1 && columns > 1 && !full ? `span ${size.h}` : void 0 };
1061
+ const [ref, rows] = useRowSpan();
1062
+ const style = { gridColumn: `span ${spanOf(entry.card?.type, entry.size, tracks)}`, gridRowEnd: rows > 0 ? `span ${rows}` : void 0 };
999
1063
  if (!entry.card) {
1000
1064
  return (0, import_react7.createElement)(
1001
1065
  "section",
1002
- { className: "cb-card cb-cardError", style },
1066
+ { ref, className: "cb-card cb-cardError", style },
1003
1067
  (0, import_react7.createElement)("header", { className: "cb-cardHead" }, (0, import_react7.createElement)("h3", { title: entry.id }, entry.id)),
1004
1068
  (0, import_react7.createElement)("p", { className: "cb-errorText" }, t("cardError")),
1005
1069
  (0, import_react7.createElement)("ul", { className: "cb-problems" }, (entry.problems ?? []).map((p, i) => (0, import_react7.createElement)("li", { key: i }, p)))
@@ -1021,9 +1085,9 @@ function Card({ entry, live, boardId, assistant, columns, active, locale, t, pre
1021
1085
  const askName = assistant ? t("action.chatNamed", { name: assistant }) : void 0;
1022
1086
  const named = (list) => assistant ? list?.map((action) => action.kind === "chat" && action.label === void 0 ? { ...action, label: askName } : action) : list;
1023
1087
  const onPress = (target) => (action, extra) => press(action, extra, { card: entry.id, ...target });
1024
- const rowActions = actions && ((row, list, part) => (0, import_react7.createElement)(actions.ActionBar, {
1088
+ const rowActions = actions && ((row, list, part2) => (0, import_react7.createElement)(actions.ActionBar, {
1025
1089
  actions: named(list),
1026
- part,
1090
+ part: part2,
1027
1091
  states: statesOf(entry.presses, row),
1028
1092
  compact: true,
1029
1093
  about: about(row, rowLine(row)),
@@ -1043,16 +1107,16 @@ function Card({ entry, live, boardId, assistant, columns, active, locale, t, pre
1043
1107
  if (card.type === "summary") {
1044
1108
  return (0, import_react7.createElement)(
1045
1109
  "section",
1046
- { className, style, "data-type": card.type },
1110
+ { ref, className, style, "data-type": card.type },
1047
1111
  (0, import_react7.createElement)("div", { className: "cb-summaryMain" }, (0, import_react7.createElement)(SummaryBody, { card, locale, t, wash: wash !== "" }), steps, footer),
1048
1112
  (0, import_react7.createElement)("div", { className: "cb-summaryAside" }, live.fresh && (0, import_react7.createElement)(kit.NewDot), chat)
1049
1113
  );
1050
1114
  }
1051
1115
  const statBlock = card.stat && (0, import_react7.createElement)(StatBlock, { data: card.stat, locale, compact: true, wash: wash !== "" });
1052
- const body = (0, import_react7.createElement)(Body, { card, size, narrow: columns === 1, live, wash: wash !== "", locale, t, rowActions });
1116
+ const body = (0, import_react7.createElement)(Body, { card, live, wash: wash !== "", locale, t, rowActions });
1053
1117
  return (0, import_react7.createElement)(
1054
1118
  "section",
1055
- { className, style, "data-type": card.type },
1119
+ { ref, className, style, "data-type": card.type },
1056
1120
  (0, import_react7.createElement)(
1057
1121
  "header",
1058
1122
  { className: "cb-cardHead" },
@@ -1126,9 +1190,9 @@ async function getJson(path, etag) {
1126
1190
  }
1127
1191
  var ERROR_KEYS = { 403: "error.forbidden", 404: "error.notFound", 409: "error.gone", 503: "error.noProvider" };
1128
1192
  var errorText = (error, t) => error.status === void 0 ? error.message : t(ERROR_KEYS[error.status] ?? "error.http", { status: error.status });
1129
- function useColumns() {
1193
+ function useTracks() {
1130
1194
  const [ref, width] = useWidth();
1131
- return [ref, width >= 1400 ? 4 : width >= 980 ? 3 : width >= 620 ? 2 : 1];
1195
+ return [ref, width >= 900 ? 6 : width >= 560 ? 2 : 1];
1132
1196
  }
1133
1197
  var visible = () => document.visibilityState === "visible";
1134
1198
  function BoardsPage() {
@@ -1147,7 +1211,7 @@ function BoardsPage() {
1147
1211
  const [boardError, setBoardError] = (0, import_react8.useState)(null);
1148
1212
  const [pollSeconds, setPollSeconds] = (0, import_react8.useState)(30);
1149
1213
  const etag = (0, import_react8.useRef)(null);
1150
- const [gridRef, columns] = useColumns();
1214
+ const [gridRef, tracks] = useTracks();
1151
1215
  const currentRef = (0, import_react8.useRef)(null);
1152
1216
  const translateRef = (0, import_react8.useRef)(t);
1153
1217
  translateRef.current = t;
@@ -1295,8 +1359,8 @@ function BoardsPage() {
1295
1359
  board.cards.length === 0 && (0, import_react8.createElement)("p", { className: "cb-muted" }, t("noCards")),
1296
1360
  (0, import_react8.createElement)(
1297
1361
  "div",
1298
- { className: "cb-grid", style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` } },
1299
- board.cards.map((entry) => (0, import_react8.createElement)(Card, { key: entry.id, entry, live: liveOf(view.live, entry.id), boardId: board.id, assistant: board.assistant, columns, active, locale, t, press }))
1362
+ { className: "cb-grid", style: { gridTemplateColumns: `repeat(${tracks}, minmax(0, 1fr))`, gridAutoRows: `${ROW}px`, columnGap: GAP } },
1363
+ board.cards.map((entry) => (0, import_react8.createElement)(Card, { key: entry.id, entry, live: liveOf(view.live, entry.id), boardId: board.id, assistant: board.assistant, tracks, active, locale, t, press }))
1300
1364
  )
1301
1365
  );
1302
1366
  return (0, import_react8.createElement)(
@@ -19,17 +19,14 @@
19
19
  "house"
20
20
  ],
21
21
  "layout": {
22
- "savings": {
23
- "w": 1,
24
- "h": 1
22
+ "weather": {
23
+ "size": "small"
25
24
  },
26
- "next-weeks": {
27
- "w": 2,
28
- "h": 1
25
+ "energy": {
26
+ "size": "medium"
29
27
  },
30
- "countdown": {
31
- "w": 2,
32
- "h": 1
28
+ "spending": {
29
+ "size": "medium"
33
30
  }
34
31
  }
35
32
  }
package/locale/en.json CHANGED
@@ -34,6 +34,8 @@
34
34
  "dayPart.morning": "morning",
35
35
  "dayPart.afternoon": "afternoon",
36
36
  "dayPart.evening": "evening",
37
- "dayPart.night": "night"
37
+ "dayPart.night": "night",
38
+ "showMore": "{n} more",
39
+ "showFewer": "Show fewer"
38
40
  }
39
41
  }
package/locale/fr.json CHANGED
@@ -34,6 +34,8 @@
34
34
  "dayPart.morning": "matin",
35
35
  "dayPart.afternoon": "après-midi",
36
36
  "dayPart.evening": "soir",
37
- "dayPart.night": "nuit"
37
+ "dayPart.night": "nuit",
38
+ "showMore": "{n} de plus",
39
+ "showFewer": "Afficher moins"
38
40
  }
39
41
  }
package/locale/zh.json CHANGED
@@ -34,6 +34,8 @@
34
34
  "dayPart.morning": "上午",
35
35
  "dayPart.afternoon": "下午",
36
36
  "dayPart.evening": "傍晚",
37
- "dayPart.night": "夜里"
37
+ "dayPart.night": "夜里",
38
+ "showMore": "还有 {n} 项",
39
+ "showFewer": "收起"
38
40
  }
39
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soffits/dsh-card-board",
3
- "version": "0.7.0",
3
+ "version": "0.8.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
@@ -8,6 +8,9 @@
8
8
  * fails at write time instead of quietly not showing.
9
9
  */
10
10
 
11
+ /** How wide a card is on the board: a third, a half, two thirds or the whole width (on a wide screen). */
12
+ export const SIZES = Object.freeze(['small', 'medium', 'large', 'wide'])
13
+
11
14
  export const CARD_TYPES = Object.freeze(['summary', 'countdown', 'stat', 'line', 'bar', 'donut', 'list', 'timeline', 'status'])
12
15
  export const TONES = Object.freeze(['ok', 'warn', 'bad', 'muted', 'accent', 'violet'])
13
16
  /** Icon names: the page draws the ones its icon set has (Lucide names) and nothing for the rest. */
@@ -533,9 +536,8 @@ export function checkBoard(board) {
533
536
  for (const [id, size] of Object.entries(layout)) {
534
537
  const p = join('layout', id)
535
538
  if (!ID_PATTERN.test(id)) c.fail(p, 'is not a card id')
536
- if (!c.object(size, p, [], ['w', 'h'])) continue
537
- c.optional(size, 'w', v => (Number.isInteger(v) && v >= 1 && v <= 3) || c.fail(join(p, 'w'), 'must be 1, 2 or 3'))
538
- c.optional(size, 'h', v => (Number.isInteger(v) && v >= 1 && v <= 3) || c.fail(join(p, 'h'), 'must be 1, 2 or 3'))
539
+ if (!c.object(size, p, [], ['size'])) continue
540
+ c.optional(size, 'size', v => SIZES.includes(v) || c.fail(join(p, 'size'), `must be one of ${SIZES.join(', ')}`))
539
541
  }
540
542
  })
541
543
  return c.problems
package/src/store.js CHANGED
@@ -147,7 +147,7 @@ export async function readCards(root, id, board, only) {
147
147
  const cards = []
148
148
  const ids = await cardFiles(root, id, board?.order)
149
149
  for (const card of only === undefined ? ids : ids.filter(card => card === only)) {
150
- const size = { w: layout[card]?.w ?? 1, h: layout[card]?.h ?? 1 }
150
+ const size = layout[card]?.size ? { size: layout[card].size } : {}
151
151
  const result = await readJson(root, join(root, id, 'cards', `${card}.json`), MAX_CARD_BYTES, checkCard)
152
152
  cards.push(result.problems.length > 0 ? { id: card, ...size, problems: result.problems.slice(0, 5) } : { id: card, ...size, card: result.value })
153
153
  }