@marver-design/marver 0.25.1 → 0.26.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 +116 -0
- package/README.md +5 -3
- package/dist/{anchor-DVV732zR.mjs → anchor-5H1vnoLu.mjs} +6 -1
- package/dist/{anchor-check-DGZnYviN.mjs → anchor-check-l-ny3UzH.mjs} +1 -1
- package/dist/audio-Dw1lfMdb.mjs +443 -0
- package/dist/{auth-DdUKeVKt.mjs → auth-Dix8wrXV.mjs} +1 -1
- package/dist/{bake-BpxMZfij.mjs → bake-C-awKgLA.mjs} +1 -1
- package/dist/{boards-Csxj2WJn.mjs → boards-DYG22tOe.mjs} +2 -2
- package/dist/{build-DKaGhoVN.mjs → build-BDRiO_mP.mjs} +16 -9
- package/dist/capture-vadKjuCo.mjs +730 -0
- package/dist/cli.mjs +24 -18
- package/dist/{collab-gqNdScUE.mjs → collab-Dxg2trOK.mjs} +4 -3
- package/dist/{comments-Zoch254k.mjs → comments-0BSbb04K.mjs} +14 -3
- package/dist/{comments-pTLlhjh4.mjs → comments-BqXua-XL.mjs} +7 -7
- package/dist/{config-cKgZBRj0.mjs → config-Cf7EjAMf.mjs} +12 -1
- package/dist/{context-D2ugHqwO.mjs → context-HQ4Giw58.mjs} +1 -1
- package/dist/daemon-DL6Fwq6D.mjs +2569 -0
- package/dist/{dev-Diqx1Rt8.mjs → dev-Bw_qYWWq.mjs} +202 -18
- package/dist/dev-lock-DWSpa6nj.mjs +179 -0
- package/dist/{events-DnK_AnrW.mjs → events-CLH4ijKP.mjs} +14 -4
- package/dist/{init-DO4DhUt_.mjs → init-D8DtrK_F.mjs} +2 -2
- package/dist/{ledger-BNXW14Xw.mjs → ledger-D54iROST.mjs} +17 -1
- package/dist/{link-C-qUIuKU.mjs → link-BNzLvdhI.mjs} +2 -2
- package/dist/live-Cgzsicwi.mjs +4 -0
- package/dist/{manifest-DnAte_fB.mjs → manifest-Nl3KSVOk.mjs} +1 -1
- package/dist/{marks-koRsbHfe.mjs → marks-CKgzucHZ.mjs} +2 -2
- package/dist/{marks-DFuintmJ.mjs → marks-DyWMv_Z1.mjs} +23 -5
- package/dist/{marver-id-gate-DGANtVyC.mjs → marver-id-gate-BjF6v4bT.mjs} +4 -4
- package/dist/perf-C75MZ73h.mjs +167 -0
- package/dist/{perf-CCisg-ny.mjs → perf-DPbLGhhO.mjs} +1 -1
- package/dist/perf-jam-BU3TVrZu.mjs +239 -0
- package/dist/{plugin-dTF5reck.mjs → plugin-DkGmZs_r.mjs} +298 -38
- package/dist/{poster-D-zjYpgk.mjs → poster-BdtSKMDm.mjs} +2 -1
- package/dist/{profile-Do0nGkXO.mjs → profile-WU9qcbIo.mjs} +1 -1
- package/dist/{publish-bakes-C_9VZ-Mq.mjs → publish-bakes-9RzRToXV.mjs} +3 -3
- package/dist/queue-29ok5_eZ.mjs +1319 -0
- package/dist/reserve-BURNQ2Y3.mjs +53 -0
- package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-8H4AJuhK.mjs} +1 -0
- package/dist/{serve-wv2QWdxB.mjs → serve-C8rVheYk.mjs} +12 -12
- package/dist/session-BAaJsK5c.mjs +191 -0
- package/dist/{share-ScamJcks.mjs → share--oFJ1bCI.mjs} +2 -2
- package/dist/{shot-CUlmkqFX.mjs → shot-DQeR_Pfn.mjs} +339 -20
- package/dist/shot-XQV7HC9A.mjs +139 -0
- package/dist/speech-models-DomiLQcY.mjs +299 -0
- package/dist/speech-worker.mjs +354 -0
- package/dist/{summary-CrW88e3q.mjs → summary-Y8MY1Wuc.mjs} +2 -2
- package/dist/{sync-C3035OnJ.mjs → sync-DKk-yT1V.mjs} +9 -8
- package/dist/{work-GE88wb_3.mjs → work-F5u-twpJ.mjs} +28 -5
- package/dist/{work-CpJn1gwY.mjs → work-VvX_JIgl.mjs} +2 -2
- package/docs/jam-session.md +194 -0
- package/docs/live-jam.md +29 -3
- package/package.json +7 -1
- package/src/client/frame-host/bridge.js +20 -2
- package/src/client/frame-host/inspect.d.ts +4 -0
- package/src/client/frame-host/inspect.js +96 -6
- package/src/client/frame-host/keys.d.ts +6 -0
- package/src/client/frame-host/keys.js +59 -0
- package/src/client/frame-host/trail.d.ts +7 -0
- package/src/client/frame-host/trail.js +204 -0
- package/src/client/shell/App.tsx +52 -8
- package/src/client/shell/Comments.tsx +20 -6
- package/src/client/shell/JamSurface.tsx +346 -0
- package/src/client/shell/Play.tsx +32 -9
- package/src/client/shell/Tip.tsx +8 -3
- package/src/client/shell/Toolbar.tsx +5 -4
- package/src/client/shell/canvas/Canvas.tsx +12 -2
- package/src/client/shell/canvas/FrameNode.tsx +14 -4
- package/src/client/shell/comments-store.ts +23 -16
- package/src/client/shell/icons.tsx +17 -0
- package/src/client/shell/jam-capture.ts +1005 -0
- package/src/client/shell/jam-keys.ts +358 -0
- package/src/client/shell/jam-lane.tsx +249 -0
- package/src/client/shell/jam-lines.ts +115 -0
- package/src/client/shell/jam-panel.tsx +556 -0
- package/src/client/shell/jam-queue.ts +126 -0
- package/src/client/shell/jam-session.tsx +389 -0
- package/src/client/shell/jam-state.ts +103 -0
- package/src/client/shell/jam-surface-parts.tsx +106 -0
- package/src/client/shell/jam-ui.tsx +104 -0
- package/src/client/shell/jam-voice.ts +479 -0
- package/src/client/shell/sound.ts +22 -0
- package/src/client/shell/stage-size.ts +11 -0
- package/src/client/shell/store.ts +47 -17
- package/src/client/shell/styles.css +564 -2
- package/src/client/stage/main.tsx +18 -2
- package/src/shared/capture-frames.ts +41 -0
- package/src/shared/events.ts +19 -4
- package/src/shared/speech.ts +16 -0
- package/templates/AGENTS-embedded.md +10 -2
- package/templates/AGENTS-studio.md +10 -2
- package/templates/instructions/iterate.md +8 -6
- package/templates/instructions/jam.md +131 -59
- package/dist/daemon-Cl8KXGW4.mjs +0 -1523
- package/dist/perf-QJIWtTw1.mjs +0 -68
- package/dist/shot-jdO_B6Qw.mjs +0 -86
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The one key guard (spec 27, "The keys, everywhere") - shared by canvas frames (bridge.js), the
|
|
2
|
+
// play stage (stage/main.tsx) and the shell's own play handler (Play.tsx).
|
|
3
|
+
//
|
|
4
|
+
// A key typed into a field is the field's: never from an input, textarea, select, contenteditable
|
|
5
|
+
// element, or an IME composition. The shell mirrors which keys it owns right now into every frame
|
|
6
|
+
// (`sh:keys { owned }`); a frame consumes an owned key itself - preventDefault() before the browser
|
|
7
|
+
// presses a focused button on Enter, and no handler of the frame sees it - and forwards it up as
|
|
8
|
+
// `sh:key { key, shift, alt, meta, ctrl, code }`. A key not owned behaves as it always did.
|
|
9
|
+
//
|
|
10
|
+
// Key descriptors: `[Ctrl+][Meta+][Alt+][Shift+]key`, a single character lowercased ('e', 's'),
|
|
11
|
+
// any other key by its DOM name ('Enter', 'Escape', 'ArrowLeft', 'Backspace'):
|
|
12
|
+
// 'Shift+Enter', 'Meta+Enter', 'Alt+ArrowLeft'. 'Shift+s' is not 's'.
|
|
13
|
+
|
|
14
|
+
const FIELD = 'input, textarea, select, [contenteditable]:not([contenteditable="false"])'
|
|
15
|
+
|
|
16
|
+
/** Is this event's target a field, or inside one (a contenteditable region counts)? */
|
|
17
|
+
export const inField = (t) => t instanceof Element && (t.isContentEditable || !!t.closest(FIELD))
|
|
18
|
+
|
|
19
|
+
/** Mid-composition (an IME is building a character): every key is the composition's. */
|
|
20
|
+
export const composing = (e) => !!e.isComposing || e.keyCode === 229
|
|
21
|
+
|
|
22
|
+
/** May a shortcut take this key at all? Not from a field, not mid-composition. */
|
|
23
|
+
export const keyAllowed = (e) => !composing(e) && !inField(e.target)
|
|
24
|
+
|
|
25
|
+
/** A key's name: a single character lowercased, else its name - and with Alt, a letter named by the key pressed
|
|
26
|
+
* (Option on a Mac types a symbol: ⌥L is "¬"). */
|
|
27
|
+
export const keyName = (e) => (e.altKey && /^Key[A-Z]$/.test(e.code ?? '') ? e.code.slice(3).toLowerCase() : e.key && e.key.length === 1 ? e.key.toLowerCase() : e.key)
|
|
28
|
+
|
|
29
|
+
/** The descriptor `sh:keys` speaks. */
|
|
30
|
+
export function keyDescriptor(e) {
|
|
31
|
+
const k = keyName(e)
|
|
32
|
+
return [e.ctrlKey && 'Ctrl', e.metaKey && 'Meta', e.altKey && 'Alt', e.shiftKey && 'Shift', k].filter(Boolean).join('+')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Listen for `sh:keys` from the shell and consume + forward the keys it owns. Installs a
|
|
36
|
+
* capture-phase keydown on the window - ahead of every handler the frame has - and returns
|
|
37
|
+
* { owns(e), dispose() }. `trusted(e)` checks a message really is the shell's. */
|
|
38
|
+
export function createKeys({ post, trusted }) {
|
|
39
|
+
let owned = new Set()
|
|
40
|
+
const onMessage = (e) => {
|
|
41
|
+
if (!trusted(e)) return
|
|
42
|
+
const m = e.data
|
|
43
|
+
if (m && m.type === 'sh:keys' && Array.isArray(m.owned)) owned = new Set(m.owned.filter((k) => typeof k === 'string'))
|
|
44
|
+
}
|
|
45
|
+
const owns = (e) => owned.size > 0 && keyAllowed(e) && owned.has(keyDescriptor(e))
|
|
46
|
+
const onKey = (e) => {
|
|
47
|
+
if (!owns(e)) return
|
|
48
|
+
e.preventDefault()
|
|
49
|
+
e.stopImmediatePropagation()
|
|
50
|
+
const key = keyName(e)
|
|
51
|
+
post({ type: 'sh:key', key, code: e.code, shift: e.shiftKey, alt: e.altKey, meta: e.metaKey, ctrl: e.ctrlKey })
|
|
52
|
+
}
|
|
53
|
+
window.addEventListener('message', onMessage)
|
|
54
|
+
window.addEventListener('keydown', onKey, true)
|
|
55
|
+
return {
|
|
56
|
+
owns,
|
|
57
|
+
dispose() { window.removeEventListener('message', onMessage); window.removeEventListener('keydown', onKey, true) },
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Types for trail.js (plain JS: it serves into frames like bridge.js).
|
|
2
|
+
export function createRecorder(opts: {
|
|
3
|
+
post: (msg: Record<string, unknown>) => void
|
|
4
|
+
getFrame: () => string
|
|
5
|
+
mode: 'interact' | 'play'
|
|
6
|
+
trusted: (e: MessageEvent) => boolean
|
|
7
|
+
}): { pick: (el: Element, e: MouseEvent) => boolean; screen: (to: string) => void; dispose: () => void }
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// The capture recorder (spec 27, "One recorder, one clock") - one small module shared by canvas
|
|
2
|
+
// frames (bridge.js) and the play stage (stage/main.tsx). It does nothing while no capture is open.
|
|
3
|
+
//
|
|
4
|
+
// shell -> frame : sh:capture { id, on } · sh:capture-hello { nonce } · sh:probe { id, req, x, y }
|
|
5
|
+
// sh:focus-at { x, y }
|
|
6
|
+
// frame -> shell : sh:capture-hello { nonce, captureDoc } · sh:probe { id, req, captureDoc, bundle, field }
|
|
7
|
+
// sh:trail { id, captureDoc, frame, seq, at, event, mode, ...payload }
|
|
8
|
+
// sh:capture-flushed { id, captureDoc, seq }
|
|
9
|
+
//
|
|
10
|
+
// `captureDoc` is a nonce drawn once per document load - the shell's load-bound handshake learns it,
|
|
11
|
+
// and drops anything from a document it did not bind. `at` is when the thing happened, on the one
|
|
12
|
+
// clock every document on this machine shares (timeOrigin + now); `seq` numbers this document's
|
|
13
|
+
// messages; `frame` is the frame it happened in, taken WHEN it happened (the stage swaps frames in one
|
|
14
|
+
// document, so a field changed on screen A and blurred on B is A's). Every element goes out through
|
|
15
|
+
// safeBundle, a field's value through fieldValue - interact and play are no exception. The clipboard
|
|
16
|
+
// is never read, keys outside fields are never recorded.
|
|
17
|
+
import { fieldValue, safeBundle } from './inspect.js'
|
|
18
|
+
import { inField } from './keys.js'
|
|
19
|
+
|
|
20
|
+
const FIELD_IDLE_MS = 600
|
|
21
|
+
const HOVER_MS = 800
|
|
22
|
+
const HOVER_EVERY_MS = 2000
|
|
23
|
+
const HOVER_SLOP = 4
|
|
24
|
+
const SCROLL_SETTLE_MS = 400
|
|
25
|
+
|
|
26
|
+
const now = () => performance.timeOrigin + performance.now()
|
|
27
|
+
/** The element whose contenteditable makes `el` editable - the outermost editable ancestor. */
|
|
28
|
+
const editingHost = (el) => {
|
|
29
|
+
if (!el.isContentEditable) return null
|
|
30
|
+
let h = el
|
|
31
|
+
while (h.parentElement && h.parentElement.isContentEditable) h = h.parentElement
|
|
32
|
+
return h
|
|
33
|
+
}
|
|
34
|
+
const nonce = () => (crypto.randomUUID ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`)
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* createRecorder({ post, getFrame, mode, trusted })
|
|
38
|
+
* post(msg) send to the shell
|
|
39
|
+
* getFrame() the frame showing now (static on canvas, the current screen in play)
|
|
40
|
+
* mode 'interact' (a canvas frame - the shell's overlay keeps canvas-mode clicks, so a
|
|
41
|
+
* click that reaches the frame is interact) or 'play' (the stage)
|
|
42
|
+
* trusted(e) is this message the shell's?
|
|
43
|
+
* returns { pick(el, e) -> boolean, screen(to), dispose() }
|
|
44
|
+
*/
|
|
45
|
+
/** One per document load (spec 27): a recorder created again in the same document keeps it, so the
|
|
46
|
+
* shell's binding to this document holds. */
|
|
47
|
+
const captureDoc = nonce()
|
|
48
|
+
|
|
49
|
+
export function createRecorder({ post, getFrame, mode, trusted }) {
|
|
50
|
+
let captureId = null
|
|
51
|
+
let seq = 0
|
|
52
|
+
// fields changed and not sent yet: element -> { id, frame, at, timer }
|
|
53
|
+
const pending = new Map()
|
|
54
|
+
const removers = []
|
|
55
|
+
const on = (target, type, fn, opts) => { target.addEventListener(type, fn, opts); removers.push(() => target.removeEventListener(type, fn, opts)) }
|
|
56
|
+
// the page's listeners go on with the first capture the shell opens here - a published canvas never
|
|
57
|
+
// opens one, so nothing listens there; every handler does nothing without a capture anyway
|
|
58
|
+
const armers = []
|
|
59
|
+
const onArmed = (...args) => { armers.push(() => on(...args)) }
|
|
60
|
+
let armed = false
|
|
61
|
+
const arm = () => { if (armed) return; armed = true; for (const a of armers) a() }
|
|
62
|
+
|
|
63
|
+
const send = (id, event, payload, frame = getFrame(), at = now()) => {
|
|
64
|
+
if (!id) return
|
|
65
|
+
post({ type: 'sh:trail', id, captureDoc, frame, seq: ++seq, at, event, mode, ...payload })
|
|
66
|
+
}
|
|
67
|
+
const record = (event, payload, frame, at) => send(captureId, event, payload, frame, at)
|
|
68
|
+
|
|
69
|
+
// ---- fields: sent when focus leaves the field, or after 600 ms idle --------------------------
|
|
70
|
+
const sendField = (el) => {
|
|
71
|
+
const p = pending.get(el)
|
|
72
|
+
if (!p) return
|
|
73
|
+
clearTimeout(p.timer)
|
|
74
|
+
pending.delete(el)
|
|
75
|
+
send(p.id, 'field', { bundle: safeBundle(el), value: fieldValue(el) }, p.frame, p.at)
|
|
76
|
+
}
|
|
77
|
+
const flushFields = (id) => { for (const [el, p] of [...pending]) if (!id || p.id === id) sendField(el) }
|
|
78
|
+
const onField = (e) => {
|
|
79
|
+
const el = e.target
|
|
80
|
+
if (!captureId || !(el instanceof Element) || !el.matches('input, textarea, select')) return
|
|
81
|
+
const was = pending.get(el)
|
|
82
|
+
if (was && was.id !== captureId) sendField(el) // a change from the capture before stays there
|
|
83
|
+
const p = pending.get(el) ?? { id: captureId, frame: getFrame(), at: now(), timer: 0 }
|
|
84
|
+
p.at = now()
|
|
85
|
+
clearTimeout(p.timer)
|
|
86
|
+
p.timer = setTimeout(() => sendField(el), FIELD_IDLE_MS)
|
|
87
|
+
pending.set(el, p)
|
|
88
|
+
}
|
|
89
|
+
onArmed(document, 'input', onField, true)
|
|
90
|
+
onArmed(document, 'change', onField, true)
|
|
91
|
+
onArmed(document, 'focusout', (e) => { if (e.target instanceof Element) sendField(e.target) }, true)
|
|
92
|
+
|
|
93
|
+
// ---- clicks: passive - the click still happens; never while a pick mode is on -----------------
|
|
94
|
+
let lastClickAt = 0
|
|
95
|
+
onArmed(window, 'click', (e) => {
|
|
96
|
+
lastClickAt = Date.now()
|
|
97
|
+
cancelHover()
|
|
98
|
+
if (!captureId || window.__mvPick) return
|
|
99
|
+
const el = e.target instanceof Element ? e.target : null
|
|
100
|
+
if (!el) return
|
|
101
|
+
record('click', { bundle: safeBundle(el, { x: e.clientX, y: e.clientY }), point: { x: e.clientX, y: e.clientY } })
|
|
102
|
+
}, { capture: true, passive: true })
|
|
103
|
+
|
|
104
|
+
// ---- hovers: held still 0.8 s without a click, at most one per 2 s ----------------------------
|
|
105
|
+
let hoverTimer = 0
|
|
106
|
+
let hoverFrom = null
|
|
107
|
+
let lastHoverAt = 0
|
|
108
|
+
const cancelHover = () => { clearTimeout(hoverTimer); hoverTimer = 0; hoverFrom = null }
|
|
109
|
+
onArmed(document, 'mousemove', (e) => {
|
|
110
|
+
if (!captureId || window.__mvPick) { cancelHover(); return }
|
|
111
|
+
if (hoverFrom && Math.hypot(e.clientX - hoverFrom.x, e.clientY - hoverFrom.y) <= HOVER_SLOP) return
|
|
112
|
+
cancelHover()
|
|
113
|
+
hoverFrom = { x: e.clientX, y: e.clientY }
|
|
114
|
+
const frame = getFrame()
|
|
115
|
+
hoverTimer = setTimeout(() => {
|
|
116
|
+
const from = hoverFrom
|
|
117
|
+
hoverTimer = 0
|
|
118
|
+
if (!captureId || !from || Date.now() - lastHoverAt < HOVER_EVERY_MS || Date.now() - lastClickAt < HOVER_MS) return
|
|
119
|
+
const el = document.elementFromPoint(from.x, from.y)
|
|
120
|
+
if (!el || el === document.documentElement || el === document.body) return
|
|
121
|
+
lastHoverAt = Date.now()
|
|
122
|
+
record('hover', { bundle: safeBundle(el, from), point: from }, frame)
|
|
123
|
+
}, HOVER_MS)
|
|
124
|
+
}, true)
|
|
125
|
+
onArmed(document, 'mousedown', cancelHover, true)
|
|
126
|
+
onArmed(document, 'mouseleave', cancelHover)
|
|
127
|
+
|
|
128
|
+
// ---- the final scroll ---------------------------------------------------------------------
|
|
129
|
+
// the settle wait keeps the capture, frame, time and position it began with: `E` (or `S` -> `S`)
|
|
130
|
+
// inside the wait sends it with the capture's flush, before `sh:capture-flushed` - never lost
|
|
131
|
+
let scrollTimer = 0
|
|
132
|
+
let pendingScroll = null
|
|
133
|
+
const sendScroll = (id) => {
|
|
134
|
+
if (!pendingScroll || (id && pendingScroll.id !== id)) return
|
|
135
|
+
const p = pendingScroll
|
|
136
|
+
pendingScroll = null
|
|
137
|
+
clearTimeout(scrollTimer)
|
|
138
|
+
send(p.id, 'scroll', { y: p.y }, p.frame, p.at)
|
|
139
|
+
}
|
|
140
|
+
onArmed(window, 'scroll', () => {
|
|
141
|
+
if (!captureId) return
|
|
142
|
+
clearTimeout(scrollTimer)
|
|
143
|
+
pendingScroll = { id: captureId, frame: getFrame(), at: performance.timeOrigin + performance.now(), y: Math.round(window.scrollY) }
|
|
144
|
+
scrollTimer = setTimeout(() => sendScroll(), SCROLL_SETTLE_MS)
|
|
145
|
+
}, { capture: true, passive: true })
|
|
146
|
+
|
|
147
|
+
// ---- the shell ------------------------------------------------------------------------------
|
|
148
|
+
on(window, 'message', (e) => {
|
|
149
|
+
if (!trusted(e)) return
|
|
150
|
+
const m = e.data
|
|
151
|
+
if (!m || typeof m !== 'object') return
|
|
152
|
+
if (m.type === 'sh:capture-hello' && typeof m.nonce === 'string') post({ type: 'sh:capture-hello', nonce: m.nonce, captureDoc })
|
|
153
|
+
else if (m.type === 'sh:capture' && typeof m.id === 'string') {
|
|
154
|
+
if (m.on) {
|
|
155
|
+
arm()
|
|
156
|
+
if (captureId && captureId !== m.id) { flushFields(captureId); sendScroll(captureId) } // `S` -> `S`: the first keeps its own
|
|
157
|
+
captureId = m.id
|
|
158
|
+
} else {
|
|
159
|
+
// `E`: what this capture holds goes first, then the last seq - the shell seals after
|
|
160
|
+
flushFields(m.id)
|
|
161
|
+
sendScroll(m.id)
|
|
162
|
+
if (captureId === m.id) { captureId = null; cancelHover() }
|
|
163
|
+
post({ type: 'sh:capture-flushed', id: m.id, captureDoc, seq })
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else if (m.type === 'sh:probe' && typeof m.req !== 'undefined' && Number.isFinite(m.x) && Number.isFinite(m.y)) {
|
|
167
|
+
// what is at this point, as a canvas-mode click would have hit it - nothing is clicked
|
|
168
|
+
const el = document.elementFromPoint(m.x, m.y)
|
|
169
|
+
const hit = el && el !== document.documentElement ? el : null
|
|
170
|
+
// a field there: the shell makes the frame interactive and puts the caret in it, so what you type
|
|
171
|
+
// next is the field's - never a capture key
|
|
172
|
+
post({ type: 'sh:probe', id: m.id, req: m.req, captureDoc, bundle: hit ? safeBundle(hit, { x: m.x, y: m.y }) : null, field: !!hit && inField(hit) })
|
|
173
|
+
}
|
|
174
|
+
else if (m.type === 'sh:focus-at' && Number.isFinite(m.x) && Number.isFinite(m.y)) {
|
|
175
|
+
const el = document.elementFromPoint(m.x, m.y)
|
|
176
|
+
// the field itself - for rich text, its editing host (a span inside it is not focusable)
|
|
177
|
+
const f = el && (el.closest('input, textarea, select') ?? editingHost(el))
|
|
178
|
+
if (f && typeof f.focus === 'function') {
|
|
179
|
+
f.focus({ preventScroll: true })
|
|
180
|
+
// the caret at the end of what is there, as a click at the end of the text would leave it
|
|
181
|
+
try {
|
|
182
|
+
if (typeof f.value === 'string' && typeof f.setSelectionRange === 'function') f.setSelectionRange(f.value.length, f.value.length)
|
|
183
|
+
else if (f.isContentEditable) { const r = document.createRange(); r.selectNodeContents(f); r.collapse(false); const sel = getSelection(); sel?.removeAllRanges(); sel?.addRange(r) }
|
|
184
|
+
} catch { /* a type without a selection (email, number) */ }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
/** A laser click: inside a capture it is the capture's pick (true); outside, inspect copies the path. */
|
|
191
|
+
pick(el, e) {
|
|
192
|
+
if (!captureId) return false
|
|
193
|
+
record('pick', { bundle: safeBundle(el, { x: e.clientX, y: e.clientY }), point: { x: e.clientX, y: e.clientY } })
|
|
194
|
+
return true
|
|
195
|
+
},
|
|
196
|
+
/** The stage moved to another screen. */
|
|
197
|
+
screen(to) { record('screen', { to }, to) },
|
|
198
|
+
dispose() {
|
|
199
|
+
removers.forEach((f) => f())
|
|
200
|
+
for (const p of pending.values()) clearTimeout(p.timer)
|
|
201
|
+
pending.clear(); cancelHover(); clearTimeout(scrollTimer)
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
}
|
package/src/client/shell/App.tsx
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { frameReady, onFrameMessage, recordCopy } from './jam-capture.ts'
|
|
2
|
+
import { jamKey } from './jam-keys.ts'
|
|
3
|
+
import { letGoOfTile } from './jam-state.ts'
|
|
4
|
+
import { JamSurface, useLaneLift } from './JamSurface.tsx'
|
|
5
|
+
import { JamButton } from './jam-session.tsx'
|
|
6
|
+
import { useJamCapture } from './jam-capture.ts'
|
|
7
|
+
import { useJamQueue } from './jam-queue.ts'
|
|
1
8
|
import { Component, useEffect, useRef, useState, type MouseEvent as ReactMouseEvent, type ReactNode } from 'react'
|
|
2
9
|
import { useStore, CONFIG, CANVAS_NAME, LOCKED_SHELL, PUBLISHED, SOURCE_REVEALED, logReload, takeReloadCause, addToBoard, boardLabel, cap, humanize, fetchBoardNames, landingBoard, tabTitle, hydrateBoardPolicy, landingMode, playsAsSlides, sceneLabel, type FrameEntry } from './store.ts'
|
|
3
10
|
import { AddToBoard, BoardList } from './BoardList.tsx'
|
|
@@ -189,6 +196,7 @@ function SelectionBar() {
|
|
|
189
196
|
onClick={() => {
|
|
190
197
|
const brd = useStore.getState().board
|
|
191
198
|
const text = selectedFrames().map((f) => framePath(brd, f)).join('\n')
|
|
199
|
+
for (const f of selectedFrames()) recordCopy('path', f.id)
|
|
192
200
|
navigator.clipboard.writeText(text).then(
|
|
193
201
|
() => { toast(multi ? `${selection.length} paths copied` : 'path copied'); useStore.getState().pulsePath() },
|
|
194
202
|
() => toast('copy blocked - click the canvas first'))
|
|
@@ -338,6 +346,11 @@ export function App() {
|
|
|
338
346
|
const manifest = useStore((s) => s.manifest)
|
|
339
347
|
const nodes = useStore((s) => s.nodes)
|
|
340
348
|
const panelOpen = useStore((s) => s.panelOpen)
|
|
349
|
+
const laneLift = useLaneLift()
|
|
350
|
+
// the collapsed toolbar keeps the dot - while a capture records, and for a whole Jam session
|
|
351
|
+
const capturing = useJamCapture((st) => !!st.current)
|
|
352
|
+
const inSession = useJamQueue((st) => !!st.session)
|
|
353
|
+
const recording = capturing || inSession
|
|
341
354
|
const toasts = useStore((s) => s.toasts)
|
|
342
355
|
const selection = useStore((s) => s.selection)
|
|
343
356
|
const laser = useStore((s) => s.laser)
|
|
@@ -566,6 +579,11 @@ export function App() {
|
|
|
566
579
|
// Live Jam reply delivery: the daemon just wrote to a board's log - fetch it NOW instead of
|
|
567
580
|
// waiting out the 30s comment poll, so the reply + notification land within a second.
|
|
568
581
|
import.meta.hot.on('sh:jam-comment', (m: any) => { if (typeof m?.board === 'string') useComments.getState().poke(m.board) })
|
|
582
|
+
// the jam queue (spec 27): the status icon by each tag's time, and a failure's one notice
|
|
583
|
+
import.meta.hot.on('sh:jam-queue', (m: any) => { void import('./jam-queue.ts').then(({ useJamQueue }) => useJamQueue.getState().apply(m)) })
|
|
584
|
+
void import('./jam-queue.ts').then(({ useJamQueue }) => useJamQueue.getState().load())
|
|
585
|
+
// captures sealed in an earlier page that never reached the server
|
|
586
|
+
void import('./jam-capture.ts').then(({ resendSealed }) => resendSealed())
|
|
569
587
|
// A7 controlled HMR: a frame file changed. Reload exactly the affected frames through the
|
|
570
588
|
// lease-aware path (idle frames now, leased ones deferred to a safe point) - never a shell
|
|
571
589
|
// reload, never a React Fast Refresh yanking a frame the user is in.
|
|
@@ -600,6 +618,9 @@ export function App() {
|
|
|
600
618
|
if (!reg) return
|
|
601
619
|
const { key: nodeKey, iframe: el } = reg
|
|
602
620
|
const s = useStore.getState()
|
|
621
|
+
// Jam (spec 27): a capture's trail, handshake, probes and flushes; a key the shell owns
|
|
622
|
+
if (onFrameMessage(nodeKey, data)) return
|
|
623
|
+
if (data.type === 'sh:key') { if (typeof data.key === 'string') jamKey({ key: data.key, shift: !!data.shift, alt: !!data.alt, meta: !!data.meta, ctrl: !!data.ctrl }); return }
|
|
603
624
|
|
|
604
625
|
if (data.type === 'sh:ready') {
|
|
605
626
|
// a WindowProxy survives navigation, so a ready queued by a SUPERSEDED document (one the
|
|
@@ -611,6 +632,7 @@ export function App() {
|
|
|
611
632
|
// sleeping override of the previous document must not be trusted for this one
|
|
612
633
|
if (s.nodes.find((n) => n.key === nodeKey)?.status === 'ready') s.bumpRev(nodeKey)
|
|
613
634
|
s.setStatus(nodeKey, 'ready')
|
|
635
|
+
frameReady(nodeKey)
|
|
614
636
|
// the revision this document was served with (spec 26): a look counts up to it, and one older
|
|
615
637
|
// than the frame's last edit reloads
|
|
616
638
|
const before = s.nodes.find((n) => n.key === nodeKey)?.shown
|
|
@@ -654,6 +676,7 @@ export function App() {
|
|
|
654
676
|
// them so an open thread card dismisses modal-style from anywhere
|
|
655
677
|
const c = commentsStore()
|
|
656
678
|
if (c.active) c.setActive(null)
|
|
679
|
+
letGoOfTile() // and a lane tile selected with nothing open for it, as a canvas click does
|
|
657
680
|
} else if (data.type === 'sh:picked') {
|
|
658
681
|
// comment mode: the frame reports the picked element - stage the draft on
|
|
659
682
|
// that node (picking while a thread is open replaces it, modal-style);
|
|
@@ -704,6 +727,10 @@ export function App() {
|
|
|
704
727
|
if (e.isComposing) return
|
|
705
728
|
const s = useStore.getState()
|
|
706
729
|
if (s.play) return // play mode owns the keyboard (Play.tsx)
|
|
730
|
+
// Jam's keys first (spec 27): the first state that takes the key; the rest falls through
|
|
731
|
+
// with Option a Mac types a symbol (⌥L is "¬"): an Alt shortcut is named by the key pressed
|
|
732
|
+
const key = e.altKey && /^Key[A-Z]$/.test(e.code) ? e.code.slice(3).toLowerCase() : e.key
|
|
733
|
+
if (!e.repeat && jamKey({ key, shift: e.shiftKey, alt: e.altKey, meta: e.metaKey, ctrl: e.ctrlKey })) { e.preventDefault(); return }
|
|
707
734
|
if ((e.metaKey || e.ctrlKey) && e.key === '\\') { e.preventDefault(); togglePanel(); return }
|
|
708
735
|
if ((e.metaKey || e.ctrlKey) && e.key === '/') { e.preventDefault(); setPillOpen((o) => !o); return }
|
|
709
736
|
if ((e.metaKey || e.ctrlKey) && e.key === 'a') { e.preventDefault(); s.selectAll(); return }
|
|
@@ -723,9 +750,11 @@ export function App() {
|
|
|
723
750
|
if (e.key === 't') { animateLayout(); runTidy() }
|
|
724
751
|
// laser and comment mode are one-at-a-time: comment mode already highlights
|
|
725
752
|
// what you'd click, so stacking the full rainbow on top only adds noise
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
753
|
+
// L: the pointer laser (the element under the cursor); ⌥L: inspect (every element outlined)
|
|
754
|
+
if (key === 'l' && !e.shiftKey && SOURCE_REVEALED) {
|
|
755
|
+
e.preventDefault()
|
|
756
|
+
commentsStore().setMode(false)
|
|
757
|
+
s.toggleLaser(e.altKey)
|
|
729
758
|
}
|
|
730
759
|
// C = comment mode (the Figma/Miro convention) · Shift+C = hide/show
|
|
731
760
|
// pins · Shift+P = copy file path(s) (P alone is play; D6, changelog 0.4.0)
|
|
@@ -764,6 +793,7 @@ export function App() {
|
|
|
764
793
|
.filter((p): p is string => !!p)
|
|
765
794
|
if (paths.length) {
|
|
766
795
|
// pulse the toolbar icon into a check ONLY on a real copy success
|
|
796
|
+
for (const k of s.selection) { const f = s.frameFor(s.nodes.find((x) => x.key === k)!); if (f) recordCopy('path', f.id) }
|
|
767
797
|
navigator.clipboard.writeText(paths.join('\n')).then(
|
|
768
798
|
() => { toast(paths.length > 1 ? `${paths.length} paths copied` : 'path copied'); s.pulsePath() },
|
|
769
799
|
() => toast('copy blocked - click the canvas first'))
|
|
@@ -850,7 +880,7 @@ export function App() {
|
|
|
850
880
|
}
|
|
851
881
|
|
|
852
882
|
return (
|
|
853
|
-
<div ref={appRef} tabIndex={-1} className={`sh-app${dark ? ' dark' : ''}${interacting ? ' interacting' : ''}`}>
|
|
883
|
+
<div ref={appRef} tabIndex={-1} className={`sh-app${dark ? ' dark' : ''}${interacting ? ' interacting' : ''}${laneLift}`}>
|
|
854
884
|
<Canvas />
|
|
855
885
|
<SelectionBar />
|
|
856
886
|
|
|
@@ -925,7 +955,7 @@ export function App() {
|
|
|
925
955
|
if (!shift) canvasCtl.fitNode(n.key)
|
|
926
956
|
}
|
|
927
957
|
const frameMenu = (fr: FrameEntry): MenuItem[] => [
|
|
928
|
-
{ label: 'Copy path', icon: <SignpostIcon size={15} />, onClick: () => copyToClipboard(framePath(useStore.getState().board, fr), 'path copied') },
|
|
958
|
+
{ label: 'Copy path', icon: <SignpostIcon size={15} />, onClick: () => { recordCopy('path', fr.id); copyToClipboard(framePath(useStore.getState().board, fr), 'path copied') } },
|
|
929
959
|
// the Not on a board view (spec 26): put the frame where it belongs
|
|
930
960
|
...(useStore.getState().board === UNPLACED ? [{ label: 'Add to board…', icon: <PlusIcon size={15} />, panel: (close: () => void) => <AddToBoard frame={fr.id} close={close} /> }] : []),
|
|
931
961
|
]
|
|
@@ -1003,6 +1033,8 @@ export function App() {
|
|
|
1003
1033
|
{/* far-left section: actions - comment mode, laser, tidy */}
|
|
1004
1034
|
<CommentButton />
|
|
1005
1035
|
<LaserButton />
|
|
1036
|
+
{/* Jam V2 (spec 27 Part 5): the session - between Laser and Tidy */}
|
|
1037
|
+
{!PUBLISHED && CONFIG.jam && <JamButton />}
|
|
1006
1038
|
<Tip side="bottom" label={<><b>Tidy layout</b><span>T</span></>}>
|
|
1007
1039
|
<button className="sh-pill-btn" onClick={() => { animateLayout(); runTidy() }}><ColumnsIcon size={16} /></button>
|
|
1008
1040
|
</Tip>
|
|
@@ -1025,7 +1057,7 @@ export function App() {
|
|
|
1025
1057
|
</nav>
|
|
1026
1058
|
<Tip side="bottom" label={<><b>Open toolbar</b><span>⌘/</span></>}>
|
|
1027
1059
|
<button className={`sh-pill-fab${pillOpen ? ' hidden' : ''}`} onClick={() => setPillOpen(true)}
|
|
1028
|
-
aria-hidden={pillOpen} tabIndex={pillOpen ? -1 : 0}><PanelHollowIcon size={18} style={{ transform: 'rotate(90deg)' }}
|
|
1060
|
+
aria-hidden={pillOpen} tabIndex={pillOpen ? -1 : 0}><PanelHollowIcon size={18} style={{ transform: 'rotate(90deg)' }} />{recording && <i className="jm-live-dot jm-fab-dot" />}</button>
|
|
1029
1061
|
</Tip>
|
|
1030
1062
|
|
|
1031
1063
|
<PlayOverlay />
|
|
@@ -1037,6 +1069,8 @@ export function App() {
|
|
|
1037
1069
|
: CONFIG.noTheme && !contentOnly(manifest?.frames ?? []) && <div className="sh-banner">no theme configured - frames render unstyled. Create design/theme.css importing your app's stylesheet (or set theme in design/config.ts)</div>}
|
|
1038
1070
|
<UpdatePill />
|
|
1039
1071
|
|
|
1072
|
+
{/* Jam V2 (spec 27): the lane, the focus panel, the notes card, the recording ring */}
|
|
1073
|
+
{!PUBLISHED && <JamSurface sidebarRight={panelOpen ? 236 + 2 * 10 : 10} />}
|
|
1040
1074
|
<JamToasts toasts={toasts} />
|
|
1041
1075
|
</div>
|
|
1042
1076
|
)
|
|
@@ -1104,6 +1138,15 @@ async function viewNote(note: import('./store.ts').JamNote, dismiss: () => void)
|
|
|
1104
1138
|
}
|
|
1105
1139
|
}
|
|
1106
1140
|
|
|
1141
|
+
/** Retry a batch's failed jam cards from their notice - each one still failed (a newer change wins). */
|
|
1142
|
+
async function retryNote(failed: { card: string; rev: number }[]) {
|
|
1143
|
+
const { useJamQueue } = await import('./jam-queue.ts')
|
|
1144
|
+
for (const f of failed) {
|
|
1145
|
+
const card = useJamQueue.getState().cards?.find((c) => c.id === f.card)
|
|
1146
|
+
if (card && card.state === 'failed') await useJamQueue.getState().act(card, 'retry')
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1107
1150
|
/** One jam pill, frame-first: row 1 = intent icon + FRAME TITLE (blue) · age; row 2 = Marver · preview.
|
|
1108
1151
|
* `badge` shows the +N deck count (replacing View); `inert` disables inner clicks (the deck handles it). */
|
|
1109
1152
|
function JamToast({ id, note, badge, inert }: { id: number; note: import('./store.ts').JamNote; badge?: number; inert?: boolean }) {
|
|
@@ -1121,13 +1164,14 @@ function JamToast({ id, note, badge, inert }: { id: number; note: import('./stor
|
|
|
1121
1164
|
? <b className="sh-jam-frame"><span className="t">{note.author!.name ?? 'Someone'}</span> <span className="v">{note.kind === 'mention' ? 'mentioned you' : 'replied'}</span></b>
|
|
1122
1165
|
: note.stack?.length
|
|
1123
1166
|
? <b className="sh-jam-frame"><span className="t">{note.board === ALL_SCENES ? note.frameTitle ?? note.frame ?? '' : boardLabel(note.board)}</span> <span className="v">· {note.stack.length + 1} replies</span></b>
|
|
1124
|
-
: <b className="sh-jam-frame"><span className="t">{note.frameTitle ?? note.board}</span
|
|
1167
|
+
: <b className="sh-jam-frame"><span className="t">{note.frameTitle ?? note.board}</span>{note.failed && <span className="v"> · failed</span>}</b>}
|
|
1125
1168
|
<span className="sh-jam-prev">{note.preview}</span>
|
|
1126
1169
|
</div>
|
|
1127
1170
|
{badge != null
|
|
1128
1171
|
? <span className="sh-jam-badge">+{badge}</span>
|
|
1129
1172
|
: !inert && <>
|
|
1130
|
-
<button className="sh-jam-view" onClick={() => void
|
|
1173
|
+
{note.failed && <button className="sh-jam-view" onClick={() => { void retryNote(note.failed!); dismiss() }}>Retry</button>}
|
|
1174
|
+
{note.threadId && <button className="sh-jam-view" onClick={() => void viewNote(note, () => useStore.getState().advanceToast(id))}>View</button>}
|
|
1131
1175
|
<button className="sh-jam-x" aria-label="Dismiss" onClick={dismiss}><XIcon size={13} /></button>
|
|
1132
1176
|
</>}
|
|
1133
1177
|
</div>
|
|
@@ -17,6 +17,9 @@ import { bootHash, buildHash, parseHash, writeHash } from './hash.ts'
|
|
|
17
17
|
import { isLegacyLink } from './legacy-links.ts'
|
|
18
18
|
import { ArrowUpIcon, CheckIcon, CheckSquareOffsetIcon, LinkIcon, ParallelogramFillIcon, PencilSimpleIcon, PlusIcon, XIcon } from './icons.tsx'
|
|
19
19
|
import { Tip } from './Tip.tsx'
|
|
20
|
+
import { TagStatus } from './jam-ui.tsx'
|
|
21
|
+
import { CaptureBlock } from './jam-panel.tsx'
|
|
22
|
+
import { useJamQueue } from './jam-queue.ts'
|
|
20
23
|
import { mentionAlerts, mentionPeople, mentionQueryAt, parseBody, type MentionPerson } from './mentions.ts'
|
|
21
24
|
import { ROUTE, slideSize, stageFit } from '../const.ts'
|
|
22
25
|
import type { AgentMeta, Thread } from '../../shared/events.ts'
|
|
@@ -136,6 +139,8 @@ export function Pins({ threads, placed, orphans, inv, active, alertIds }: {
|
|
|
136
139
|
inv: number; active: string | null; alertIds?: Set<string>
|
|
137
140
|
}) {
|
|
138
141
|
const { setActive } = useComments.getState()
|
|
142
|
+
// a pin wears the thin Marver-blue working ring while the agent works on its thread (spec 27)
|
|
143
|
+
const working = useJamQueue((s) => s.cards)?.filter((c) => c.state === 'working').map((c) => c.thread) ?? []
|
|
139
144
|
return (
|
|
140
145
|
<>
|
|
141
146
|
{threads.map((t) => {
|
|
@@ -143,7 +148,7 @@ export function Pins({ threads, placed, orphans, inv, active, alertIds }: {
|
|
|
143
148
|
const orphan = orphans.has(t.id)
|
|
144
149
|
return [
|
|
145
150
|
p.lead && <i key={`${t.id}-lead`} data-lead={t.id} className="cm-lead" aria-hidden style={{ left: p.lead.x, top: p.lead.y, height: p.y - MARKER.h * inv - p.lead.y }} />,
|
|
146
|
-
<div key={t.id} data-thread={t.id} className={`cm-pin sh-no-pan${t.id === active ? ' on' : ''}${orphan ? ' orphan' : ''}${alertIds?.has(t.id) ? ' mention' : ''}`}
|
|
151
|
+
<div key={t.id} data-thread={t.id} className={`cm-pin sh-no-pan${t.id === active ? ' on' : ''}${orphan ? ' orphan' : ''}${alertIds?.has(t.id) ? ' mention' : ''}${working.includes(t.id) ? ' working' : ''}`}
|
|
147
152
|
style={{ left: p.x, top: p.y, ...hueVars(anchorHue(t.anchor)) }}
|
|
148
153
|
onPointerDown={(e) => e.stopPropagation()}
|
|
149
154
|
onClick={(e) => { e.stopPropagation(); setActive(t.id === active ? null : t.id) }}
|
|
@@ -423,7 +428,7 @@ function CommentBody({ body, owner }: { body?: string; owner: boolean }) {
|
|
|
423
428
|
)
|
|
424
429
|
}
|
|
425
430
|
|
|
426
|
-
const HARNESS: Record<string, string> = { claude: 'Claude Code', codex: 'Codex', cursor: 'Cursor', opencode: 'opencode', droid: 'Factory Droid', grok: 'Grok', pi: 'pi' }
|
|
431
|
+
export const HARNESS: Record<string, string> = { claude: 'Claude Code', codex: 'Codex', cursor: 'Cursor', opencode: 'opencode', droid: 'Factory Droid', grok: 'Grok', pi: 'pi' }
|
|
427
432
|
/** claude-opus-5 → Opus 5; gpt-5.1-codex → Gpt 5.1 Codex; unknown → as-is. */
|
|
428
433
|
function prettyModel(m: string): string {
|
|
429
434
|
const cleaned = m.replace(/^claude-/, '').replace(/-/g, ' ')
|
|
@@ -453,7 +458,7 @@ function AgentMetaTip({ meta }: { meta?: AgentMeta }) {
|
|
|
453
458
|
* human messages keep their avatar + name. While the dev profile is still UNSET, every own
|
|
454
459
|
* message avatar invites editing on hover (discoverability); once set, only the composer's
|
|
455
460
|
* avatar is the door. */
|
|
456
|
-
function MessageHead({ author, agent, agentMeta, ts }: { author?: Thread['author']; agent?: boolean; agentMeta?: AgentMeta; ts: number }) {
|
|
461
|
+
function MessageHead({ author, agent, agentMeta, ts, board, eventId }: { author?: Thread['author']; agent?: boolean; agentMeta?: AgentMeta; ts: number; board?: string; eventId?: string }) {
|
|
457
462
|
const me = useComments((s) => s.me)
|
|
458
463
|
const local = useComments((s) => s.local)
|
|
459
464
|
const connected = useComments((s) => s.connected)
|
|
@@ -476,6 +481,7 @@ function MessageHead({ author, agent, agentMeta, ts }: { author?: Thread['author
|
|
|
476
481
|
{unset && own ? <EditableAvatar author={author} size={24} /> : <Avatar author={author} size={24} />}
|
|
477
482
|
<b>{shown?.name ?? 'Someone'}</b>
|
|
478
483
|
<span className="dim">{rel(ts)}</span>
|
|
484
|
+
<TagStatus board={board} eventId={eventId} harness={HARNESS} />
|
|
479
485
|
</header>
|
|
480
486
|
)
|
|
481
487
|
}
|
|
@@ -662,6 +668,9 @@ export function ThreadCard({ thread, at, bounds, nodeKey, side = 'r', flank, sta
|
|
|
662
668
|
// without a profile, local writes are the owner.
|
|
663
669
|
const isOwner = (a?: { email?: string; id?: string }) =>
|
|
664
670
|
me?.id && a?.id ? a.id === me.id : me?.email ? a?.email === me.email : local
|
|
671
|
+
// the event behind each message - a tag's card names its events, the status icon finds it by them
|
|
672
|
+
const events = useComments((s) => s.events)
|
|
673
|
+
const eventOf = (msg: string) => events.find((e) => (e.type === 'create' || e.type === 'reply') && e.commentId === msg && (!e.board || !thread.board || e.board === thread.board))?.id
|
|
665
674
|
const [text, setText] = useState('')
|
|
666
675
|
const [copied, setCopied] = useState(false)
|
|
667
676
|
const copyTimer = useRef<ReturnType<typeof setTimeout>>(undefined)
|
|
@@ -796,13 +805,18 @@ export function ThreadCard({ thread, at, bounds, nodeKey, side = 'r', flank, sta
|
|
|
796
805
|
{/* "there is more": the scroller MASKS its own content at the overflowing edge - a soft fade
|
|
797
806
|
of the text itself, not a paint layer over the glass */}
|
|
798
807
|
<div className={`cm-scroll${shadows.top ? ' fade-top' : ''}${shadows.bot ? ' fade-bot' : ''}`} ref={scrollRef} onScroll={syncShadows}>
|
|
799
|
-
<MessageHead author={thread.author} agent={thread.agent} agentMeta={thread.agentMeta} ts={thread.ts} />
|
|
800
|
-
|
|
808
|
+
<MessageHead author={thread.author} agent={thread.agent} agentMeta={thread.agentMeta} ts={thread.ts} board={thread.board} eventId={eventOf(thread.id)} />
|
|
809
|
+
{/* a capture's comment reads as a capture: a labelled block, never a typed comment (spec 27) */}
|
|
810
|
+
{thread.capture
|
|
811
|
+
? <CaptureBlock id={thread.capture} facts={thread.facts} words={thread.body ?? ''} />
|
|
812
|
+
: <CommentBody body={thread.body} owner={isOwner(thread.author)} />}
|
|
801
813
|
{/* replies repeat the root's exact message shape (Figma's pattern) - only the icons differ */}
|
|
802
814
|
{thread.replies.map((r) => (
|
|
803
815
|
<div key={r.id} className="cm-msg">
|
|
804
|
-
<MessageHead author={r.author} agent={r.agent} agentMeta={r.agentMeta} ts={r.ts} />
|
|
816
|
+
<MessageHead author={r.author} agent={r.agent} agentMeta={r.agentMeta} ts={r.ts} board={thread.board} eventId={eventOf(r.id)} />
|
|
805
817
|
<CommentBody body={r.body} owner={isOwner(r.author)} />
|
|
818
|
+
{/* a jam job changed a shared file it was not given: one line, so the reply says it (spec 27) */}
|
|
819
|
+
{r.agent && r.alsoChanged?.length ? <div className="cm-also">Also changed {r.alsoChanged.map((f) => f.split('/').pop()).join(', ')}</div> : null}
|
|
806
820
|
</div>
|
|
807
821
|
))}
|
|
808
822
|
</div>
|