@marver-design/marver 0.23.1 → 0.24.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +2 -0
  3. package/dist/{bake-DQtnDB8-.mjs → bake-ZhXq-X9f.mjs} +1 -1
  4. package/dist/{build-_ndp_dXn.mjs → build-ckcinlWH.mjs} +4 -4
  5. package/dist/cli.mjs +7 -7
  6. package/dist/{comments-BlqyZh3D.mjs → comments-Dx1hCVOT.mjs} +1 -1
  7. package/dist/{context-CdkNiKdJ.mjs → context-BncTXjLB.mjs} +1 -1
  8. package/dist/{daemon-BvMPdQ3k.mjs → daemon-CQv73-jM.mjs} +1 -1
  9. package/dist/{dev-Cf-4eqaC.mjs → dev-gv4NS6Fk.mjs} +5 -5
  10. package/dist/{init-hfZV7TwY.mjs → init--3Moc4J7.mjs} +1 -1
  11. package/dist/{link-BodAbIQz.mjs → link-vXjxMHTG.mjs} +1 -1
  12. package/dist/{manifest-TpfDWldB.mjs → manifest-cyG3kbhk.mjs} +1 -1
  13. package/dist/{plugin-DoXql0ZZ.mjs → plugin-Sa08E7wO.mjs} +182 -12
  14. package/dist/{poster-XBmUvQiL.mjs → poster-B2QPvKOq.mjs} +1 -1
  15. package/dist/{publish-bakes-KKTHWqq3.mjs → publish-bakes-BJR3huhu.mjs} +2 -2
  16. package/dist/{shot-DOD8v6fJ.mjs → shot-Cw96h5Kk.mjs} +2 -2
  17. package/dist/{work-ClFFq0Qh.mjs → work-CBUfsOOT.mjs} +1 -1
  18. package/docs/boards-and-folders.md +25 -0
  19. package/docs/live-jam.md +4 -1
  20. package/package.json +1 -1
  21. package/src/client/shell/App.tsx +35 -11
  22. package/src/client/shell/BoardList.tsx +22 -7
  23. package/src/client/shell/Play.tsx +2 -0
  24. package/src/client/shell/canvas/Canvas.tsx +2 -0
  25. package/src/client/shell/canvas/FrameNode.tsx +6 -1
  26. package/src/client/shell/comments-store.ts +2 -0
  27. package/src/client/shell/marks-ui.tsx +119 -0
  28. package/src/client/shell/store.ts +91 -1
  29. package/src/client/shell/styles.css +22 -0
  30. package/src/shared/marks.ts +65 -0
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Sidebar marks (spec 25 "what is new, what needs you", variant B - one slot). Pure: the shell and
3
+ * the tests read the same rules.
4
+ *
5
+ * Two signals. NEW: a frame changed since you looked (blue). NEEDS YOU: an open Marver question on
6
+ * a frame (orange). A row keeps ONE slot at its right edge; what fills it, first match wins: a
7
+ * question (the bubble with how many), then the row's own count or status, then a frame's dot.
8
+ */
9
+ import type { Thread } from './events.ts'
10
+
11
+ /** What the dev server says: when each frame last changed, when you last looked, and the line
12
+ * before which everything counts as seen (the day marks first ran). */
13
+ export interface Marks {
14
+ changed: Record<string, number>
15
+ seen: Record<string, number>
16
+ baseline: number
17
+ /** each board's frames - a board you are not on rolls up over these */
18
+ boards: Record<string, string[]>
19
+ }
20
+
21
+ export const isNew = (m: Marks | null, id: string): boolean =>
22
+ !!m && (m.changed[id] ?? 0) > Math.max(m.seen[id] ?? 0, m.baseline)
23
+
24
+ /** A question's state is read from its thread - nobody sets it. Open with Marver's word last:
25
+ * needs you. Open with yours last, after Marver spoke: answered, waiting on the agent. */
26
+ export type Ask = { ask: number; answered: number }
27
+ export function questions(threads: readonly Thread[]): Map<string, Ask> {
28
+ const out = new Map<string, Ask>()
29
+ for (const t of threads) {
30
+ if (t.resolved || !t.frame) continue
31
+ const last = t.replies.length ? t.replies[t.replies.length - 1] : t
32
+ const marver = !!t.agent || t.replies.some((r) => r.agent)
33
+ if (!marver) continue
34
+ const q = out.get(t.frame) ?? { ask: 0, answered: 0 }
35
+ if (last.agent) q.ask++
36
+ else q.answered++
37
+ out.set(t.frame, q)
38
+ }
39
+ return out
40
+ }
41
+
42
+ /** A single frame's mark. */
43
+ export type FrameMark = { kind: 'ask' | 'answered'; n: number } | { kind: 'new' } | null
44
+ export function frameMark(m: Marks | null, q: Map<string, Ask>, id: string): FrameMark {
45
+ const a = q.get(id)
46
+ if (a?.ask) return { kind: 'ask', n: a.ask }
47
+ if (a?.answered) return { kind: 'answered', n: a.answered }
48
+ return isNew(m, id) ? { kind: 'new' } : null
49
+ }
50
+
51
+ /** A row that stands for many frames (a board you are not on, a folder, a folded scene). */
52
+ export function rollup(m: Marks | null, q: Map<string, Ask>, ids: Iterable<string>): { asks: number; fresh: number } {
53
+ let asks = 0, fresh = 0
54
+ for (const id of new Set(ids)) { asks += q.get(id)?.ask ?? 0; if (isNew(m, id)) fresh++ }
55
+ return { asks, fresh }
56
+ }
57
+
58
+ /** `U`: the next frame that needs you, else the next new one - after `from` in reading order,
59
+ * wrapping. `order` is the board's frames top-to-bottom, left-to-right. */
60
+ export function nextToLook(m: Marks | null, q: Map<string, Ask>, order: readonly string[], from: string | null): string | null {
61
+ const i = from ? order.indexOf(from) : -1
62
+ const ring = [...order.slice(i + 1), ...order.slice(0, i + 1)]
63
+ // an answered frame waits on the agent, not on you: U skips it even when it is also new
64
+ return ring.find((id) => (q.get(id)?.ask ?? 0) > 0) ?? ring.find((id) => isNew(m, id) && !q.get(id)?.answered) ?? null
65
+ }