@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,358 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jam's keys (spec 27, Part 3, "The keys, everywhere") - the table, in one place. For each key the
|
|
3
|
+
* first state below that is on AND handles that key takes it; a key no state lists falls through to
|
|
4
|
+
* the shell's own keys, unchanged (`J` during a capture, `S` during a review still work):
|
|
5
|
+
*
|
|
6
|
+
* a read-back open ⏎ confirm · K keep · R resume (it ended too soon) · Esc drop
|
|
7
|
+
* the notes card open Esc closes the card · N puts the focus back in its field
|
|
8
|
+
* a capture open E end · S says to end it first · N notes card · I picture · Esc drop
|
|
9
|
+
* a review open ⏎ looks good · ⇧⏎ more work · → later / next · ← back · B before/after ·
|
|
10
|
+
* ⌥← ⌥→ frame tabs · Esc leave
|
|
11
|
+
* the lane has the keys ← → move · ⏎ open · ⌘⏎ do next · K keep · ⌫ drop · Esc leave
|
|
12
|
+
* a session sheet open ⏎ start (the start sheet) · Esc close it
|
|
13
|
+
* always S start a capture · J the session (start it, or end it) · Q the lane · V next capture to review
|
|
14
|
+
*
|
|
15
|
+
* The same table says which keys the shell owns right now; they are mirrored into every frame (a
|
|
16
|
+
* frame consumes an owned key - before a focused button sees ⏎ - and forwards it). `Tab` is never
|
|
17
|
+
* owned. A tag's card never reaches `Q`, `V`, `K` or `⌘⏎`: it lives in its thread.
|
|
18
|
+
*/
|
|
19
|
+
import { useJamCapture, setOwnedKeys } from './jam-capture.ts'
|
|
20
|
+
import { changedShots, useJamQueue, type JamCard } from './jam-queue.ts'
|
|
21
|
+
import { DONE_CLOSE, DONE_GROUP, doneFold, useJamUi } from './jam-state.ts'
|
|
22
|
+
import { pressJ, startSession, wrapWrite } from './jam-session.tsx'
|
|
23
|
+
import { clearMoreDraft } from './jam-panel.tsx'
|
|
24
|
+
import { CONFIG, PUBLISHED, SOURCE_REVEALED, useStore } from './store.ts'
|
|
25
|
+
|
|
26
|
+
export interface KeyIn { key: string; shift?: boolean; alt?: boolean; meta?: boolean; ctrl?: boolean }
|
|
27
|
+
/** `[Ctrl+][Meta+][Alt+][Shift+]key`, a letter lowercase - the frames' descriptor (keys.js). */
|
|
28
|
+
export const descriptor = (k: KeyIn): string =>
|
|
29
|
+
`${k.ctrl ? 'Ctrl+' : ''}${k.meta ? 'Meta+' : ''}${k.alt ? 'Alt+' : ''}${k.shift ? 'Shift+' : ''}${k.key.length === 1 ? k.key.toLowerCase() : k.key}`
|
|
30
|
+
|
|
31
|
+
/** The lane's captures (and a wrap-up), in the order made - the run when one lasts. */
|
|
32
|
+
export function laneCards(cards: JamCard[] | null, run: { since: number } | null): JamCard[] {
|
|
33
|
+
if (!cards) return []
|
|
34
|
+
// a dropped capture leaves the lane at once (done and kept ones stay in their run)
|
|
35
|
+
return cards.filter((c) => (c.kind === 'capture' || c.kind === 'wrapup') && c.state !== 'dropped' && (run ? c.made >= run.since : c.state !== 'done' && c.state !== 'kept'))
|
|
36
|
+
.sort((a, b) => a.made - b.made)
|
|
37
|
+
}
|
|
38
|
+
/** The lane as shown: a draft being resumed steps aside (the recording stands for it) while it is a draft. */
|
|
39
|
+
export function shownLane(cards: JamCard[] | null, run: { since: number } | null, resuming: string[]): JamCard[] {
|
|
40
|
+
return laneCards(cards, run).filter((c) => !(c.state === 'draft' && resuming.includes(c.id)))
|
|
41
|
+
}
|
|
42
|
+
const lane = () => shownLane(useJamQueue.getState().cards, useJamQueue.getState().run, useJamCapture.getState().resuming)
|
|
43
|
+
const toReview = () => lane().filter((c) => c.state === 'review')
|
|
44
|
+
const cardById = (id: string | null | undefined) => (id ? useJamQueue.getState().cards?.find((c) => c.id === id) : undefined)
|
|
45
|
+
|
|
46
|
+
// ---- deciding a draft: one path for the buttons and the keys ---------------------------------------
|
|
47
|
+
|
|
48
|
+
/** Per card: the last save in flight, the words you meant until they saved, and which save is the
|
|
49
|
+
* latest (an earlier save finishing late never clears a newer edit). */
|
|
50
|
+
const saving = new Map<string, Promise<boolean>>()
|
|
51
|
+
const unsaved = new Map<string, string>()
|
|
52
|
+
const latest = new Map<string, number>()
|
|
53
|
+
let gen = 0
|
|
54
|
+
/** The words written for a card that have not saved yet - the read-back keeps showing them. */
|
|
55
|
+
export const pendingEdit = (id: string): string | undefined => unsaved.get(id)
|
|
56
|
+
/** Save the read-back's edit (the text stays where it is if the save fails - see `decideDraft`). */
|
|
57
|
+
export function saveEdit(c: JamCard, text: string) {
|
|
58
|
+
const g = ++gen
|
|
59
|
+
latest.set(c.id, g)
|
|
60
|
+
unsaved.set(c.id, text)
|
|
61
|
+
const before = saving.get(c.id) ?? Promise.resolve(true)
|
|
62
|
+
// saves of one card run in order, each at the card's rev as the one before left it
|
|
63
|
+
saving.set(c.id, before.then(() => {
|
|
64
|
+
const fresh = useJamQueue.getState().cards?.find((x) => x.id === c.id) ?? c
|
|
65
|
+
return useJamQueue.getState().act(fresh, 'edit', text)
|
|
66
|
+
}).then((ok) => { if (ok && latest.get(c.id) === g) unsaved.delete(c.id); return ok }))
|
|
67
|
+
}
|
|
68
|
+
/** Notes added in a read-back not saved yet, per card: each with its own id - one on its way, or one that failed
|
|
69
|
+
* and waits to be sent again. Sent again (from the field, or before a decision) it keeps its id: the server
|
|
70
|
+
* keeps a note once, whatever answer was lost; a different note never takes a failed one's place. */
|
|
71
|
+
type PendingNote = { id: string; text: string; failed: boolean; order: number }
|
|
72
|
+
const unsavedNotes = new Map<string, PendingNote[]>()
|
|
73
|
+
const sendNote = (c: JamCard, n: PendingNote): Promise<boolean> => {
|
|
74
|
+
n.failed = false
|
|
75
|
+
const before = saving.get(c.id) ?? Promise.resolve(true)
|
|
76
|
+
const p = before.then(() => {
|
|
77
|
+
const fresh = useJamQueue.getState().cards?.find((x) => x.id === c.id) ?? c
|
|
78
|
+
return useJamQueue.getState().act(fresh, 'note', JSON.stringify({ id: n.id, text: n.text, order: n.order }))
|
|
79
|
+
}).then((ok) => {
|
|
80
|
+
const list = unsavedNotes.get(c.id) ?? []
|
|
81
|
+
if (ok) { const left = list.filter((x) => x !== n); if (left.length) unsavedNotes.set(c.id, left); else unsavedNotes.delete(c.id) } else n.failed = true
|
|
82
|
+
return ok
|
|
83
|
+
}, () => { n.failed = true; return false })
|
|
84
|
+
saving.set(c.id, p.then(() => true))
|
|
85
|
+
return p
|
|
86
|
+
}
|
|
87
|
+
/** Add a note to a draft from its read-back: in line with its edits (a decision or a Resume waits for it). The
|
|
88
|
+
* same `id` again is that note's retry (its words as the field holds them now). */
|
|
89
|
+
export function addNote(c: JamCard, text: string, id: string): Promise<boolean> {
|
|
90
|
+
// written when it was first sent: a retry keeps its place among the notes
|
|
91
|
+
const was = (unsavedNotes.get(c.id) ?? []).find((x) => x.id === id)
|
|
92
|
+
const n: PendingNote = { id, text, failed: false, order: was?.order ?? Date.now() }
|
|
93
|
+
unsavedNotes.set(c.id, [...(unsavedNotes.get(c.id) ?? []).filter((x) => x.id !== id), n])
|
|
94
|
+
return sendNote(c, n)
|
|
95
|
+
}
|
|
96
|
+
/** Every note added to a draft saved (a failed one sent again, once): before it is sent, kept or resumed. */
|
|
97
|
+
async function notesSaved(id: string): Promise<boolean> {
|
|
98
|
+
await saving.get(id)
|
|
99
|
+
const c = useJamQueue.getState().cards?.find((x) => x.id === id)
|
|
100
|
+
for (const n of [...(unsavedNotes.get(id) ?? [])]) if (n.failed && c) await sendNote(c, n)
|
|
101
|
+
await saving.get(id)
|
|
102
|
+
return !(unsavedNotes.get(id) ?? []).length
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Confirm or keep a draft AFTER its edit has saved - an edit that failed is saved again first, and
|
|
106
|
+
* nothing is sent while it still fails; at the card's new rev; the panel closes once the decision
|
|
107
|
+
* took, and a refusal says why. */
|
|
108
|
+
export async function decideDraft(id: string, action: 'confirm' | 'keep' | 'drop') {
|
|
109
|
+
await saving.get(id)
|
|
110
|
+
if (action !== 'drop' && unsaved.has(id)) {
|
|
111
|
+
const c = useJamQueue.getState().cards?.find((x) => x.id === id)
|
|
112
|
+
if (c) saveEdit(c, unsaved.get(id)!)
|
|
113
|
+
await saving.get(id)
|
|
114
|
+
if (unsaved.has(id)) { useStore.getState().toast('your edit could not be saved - look at it again before you send it'); return }
|
|
115
|
+
}
|
|
116
|
+
// a note added in its read-back goes with it: one that did not save is sent again, and nothing is sent without it
|
|
117
|
+
if (action !== 'drop' && unsavedNotes.has(id) && !(await notesSaved(id))) { useStore.getState().toast('your note could not be added - try again before you send it'); return }
|
|
118
|
+
if (action === 'drop') { unsaved.delete(id); unsavedNotes.delete(id) }
|
|
119
|
+
const fresh = useJamQueue.getState().cards?.find((c) => c.id === id)
|
|
120
|
+
if (!fresh) return
|
|
121
|
+
if (await useJamQueue.getState().act(fresh, action)) useJamUi.getState().close()
|
|
122
|
+
else useStore.getState().toast(`the capture could not be ${action === 'confirm' ? 'queued' : action === 'keep' ? 'kept' : 'dropped'} - look again`)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Leave a field in the open panel (its words save on blur) - before anything takes the panel away. */
|
|
126
|
+
const leavePanelField = () => { const a = document.activeElement; if (a instanceof HTMLElement && a.closest('.jm-focus')) a.blur() }
|
|
127
|
+
|
|
128
|
+
/** Resume a draft that ended too soon: its edit saves first (the resumed capture carries it on), the
|
|
129
|
+
* read-back closes, and recording goes on where it stopped. */
|
|
130
|
+
export async function resumeDraft(id: string) {
|
|
131
|
+
const cap = useJamCapture.getState()
|
|
132
|
+
if (cap.current) { useStore.getState().toast('a capture is recording - press E to end it first'); return }
|
|
133
|
+
if (cap.settling || cardById(id)?.state !== 'draft') return
|
|
134
|
+
// first, at once: leave the editor (its words start saving) and lock the words - from here on nothing
|
|
135
|
+
// typed can race the start; the lock holds through every wait and is let go at the end
|
|
136
|
+
if (useJamUi.getState().panel?.id === id) leavePanelField()
|
|
137
|
+
useJamCapture.setState({ settling: id })
|
|
138
|
+
try {
|
|
139
|
+
// every edit of the draft saved - before the record loads and again after - and it is still a draft
|
|
140
|
+
const settled = async (): Promise<boolean> => {
|
|
141
|
+
for (let i = 0; i < 3 && saving.get(id); i++) { const p = saving.get(id); await p; if (saving.get(id) === p) break }
|
|
142
|
+
if (unsaved.has(id)) { useStore.getState().toast('your edit could not be saved - look at it again before you resume'); return false }
|
|
143
|
+
// its notes added after too: the resumed capture carries them on
|
|
144
|
+
if (unsavedNotes.has(id) && !(await notesSaved(id))) { useStore.getState().toast('your note could not be added - try again before you resume'); return false }
|
|
145
|
+
return cardById(id)?.state === 'draft'
|
|
146
|
+
}
|
|
147
|
+
if (!(await settled())) return
|
|
148
|
+
if (await useJamCapture.getState().resume(id, settled)) {
|
|
149
|
+
// as the UI is NOW (another panel may have opened meanwhile): only what points at it
|
|
150
|
+
const ui = useJamUi.getState()
|
|
151
|
+
if (ui.panel?.id === id) ui.close()
|
|
152
|
+
// its tile has stepped aside: nothing points at it, and the lane gives its keys back
|
|
153
|
+
if (ui.selected === id) { ui.select(null); ui.setLaneKeys(false) }
|
|
154
|
+
}
|
|
155
|
+
} finally { useJamCapture.setState({ settling: null }) }
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** What clicking a tile (or ⏎ on it) does: a review opens the review detail, a card that asks opens
|
|
159
|
+
* its thread, any other capture its detail - the read-back for a draft. */
|
|
160
|
+
export function openTile(id: string) {
|
|
161
|
+
const c = cardById(id)
|
|
162
|
+
const ui = useJamUi.getState()
|
|
163
|
+
if (!c) return
|
|
164
|
+
if (c.state === 'asks' && c.thread) {
|
|
165
|
+
ui.select(id)
|
|
166
|
+
openThread(c)
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
ui.open({ kind: c.state === 'review' ? 'review' : c.kind === 'wrapup' ? 'wrapup' : 'capture', id })
|
|
170
|
+
reveal(c)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Open a card's thread - on another board, its link opens that board, then the thread (as a
|
|
174
|
+
* notification's does). */
|
|
175
|
+
export function openThread(c: JamCard) {
|
|
176
|
+
if (!c.thread) return
|
|
177
|
+
if (c.board !== useStore.getState().board) { location.hash = `#/b/${encodeURIComponent(c.board)}?c=${encodeURIComponent(c.thread)}`; return }
|
|
178
|
+
void import('./comments-store.ts').then(({ useComments }) => useComments.getState().setActive(c.thread!))
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Bring a card's frames into view beside the panel - on its own board (a frame link lands there). */
|
|
182
|
+
export function reveal(c: JamCard) {
|
|
183
|
+
const s = useStore.getState()
|
|
184
|
+
if (!c.frames.length) return
|
|
185
|
+
if (c.board !== s.board) { location.hash = `#/b/${encodeURIComponent(c.board)}?f=${c.frames.map(encodeURIComponent).join(',')}`; return }
|
|
186
|
+
const keys = s.nodes.filter((n) => c.frames.includes(n.frame)).map((n) => n.key)
|
|
187
|
+
// after the panel has drawn, so the fit measures it and lands the frames in the space right of it
|
|
188
|
+
if (keys.length) void import('./canvas/ctl.ts').then(({ canvasCtl }) => requestAnimationFrame(() => requestAnimationFrame(() => canvasCtl.fitNodes(keys))))
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The next capture to review after `from` (or the oldest), walking the lane left to right. */
|
|
192
|
+
function nextReview(from?: string, step = 1) {
|
|
193
|
+
const list = toReview()
|
|
194
|
+
if (!list.length) return null
|
|
195
|
+
const i = from ? list.findIndex((c) => c.id === from) : -1
|
|
196
|
+
return list[i < 0 ? 0 : Math.min(list.length - 1, Math.max(0, i + step))] ?? null
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const act = (c: JamCard | undefined, action: Parameters<ReturnType<typeof useJamQueue.getState>['act']>[1], body?: string) =>
|
|
200
|
+
c ? useJamQueue.getState().act(c, action, body) : Promise.resolve(false)
|
|
201
|
+
|
|
202
|
+
interface Row { on(): boolean; keys: Record<string, () => void> }
|
|
203
|
+
|
|
204
|
+
/** The run on screen, when a review is open: a capture started now binds it. */
|
|
205
|
+
function reviewNow(): { card: string; batch: string; rev: number } | undefined {
|
|
206
|
+
const ui = useJamUi.getState()
|
|
207
|
+
const c = cardById(ui.panel?.id)
|
|
208
|
+
// a capture's review only: a session record is improved through its own More work, never by a capture
|
|
209
|
+
return ui.panel?.kind === 'review' && c?.kind === 'capture' && c.batch ? { card: c.id, batch: c.batch, rev: c.rev } : undefined
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Esc while a laser (pointer or inspect) is on turns it off, and that is all it does. */
|
|
213
|
+
const laserOff = (): boolean => { const st = useStore.getState(); if (!st.laser) return false; st.setLaser(false); return true }
|
|
214
|
+
|
|
215
|
+
/** Start a capture, as S does: one made while a capture's review is open follows that review (its run).
|
|
216
|
+
* `session`: the session it belongs to when the queue may not show it yet (a session's Start). */
|
|
217
|
+
export const startCapture = (session?: string) => useJamCapture.getState().start(reviewNow(), session)
|
|
218
|
+
|
|
219
|
+
/** A laser on (pointer or inspect): its keys come first - Esc turns it off before it closes, drops or leaves anything -
|
|
220
|
+
* and are owned, so they work from inside a frame too (a laser click puts the focus there). The one row a published
|
|
221
|
+
* canvas has (where its source is revealed - the only place a laser exists there). */
|
|
222
|
+
const laserRow: Row = {
|
|
223
|
+
on: () => useStore.getState().laser,
|
|
224
|
+
keys: {
|
|
225
|
+
l: () => useStore.getState().toggleLaser(false),
|
|
226
|
+
'Alt+l': () => useStore.getState().toggleLaser(true),
|
|
227
|
+
Escape: () => useStore.getState().setLaser(false),
|
|
228
|
+
},
|
|
229
|
+
}
|
|
230
|
+
const rowsNow = (): Row[] => (PUBLISHED ? (SOURCE_REVEALED ? [laserRow] : []) : rows())
|
|
231
|
+
|
|
232
|
+
const rows = (): Row[] => {
|
|
233
|
+
const cap = useJamCapture.getState()
|
|
234
|
+
const ui = useJamUi.getState()
|
|
235
|
+
const panelCard = cardById(ui.panel?.id)
|
|
236
|
+
return [
|
|
237
|
+
laserRow,
|
|
238
|
+
{ // a session sheet open: the start sheet's ⏎ starts; Esc closes either (the wrap-up's field keeps its own keys)
|
|
239
|
+
on: () => ui.sheet === 'start' || ui.sheet === 'wrap',
|
|
240
|
+
keys: {
|
|
241
|
+
Enter: () => { if (ui.sheet === 'start') void startSession(); else wrapWrite.current?.() },
|
|
242
|
+
Escape: () => ui.setSheet(null),
|
|
243
|
+
// over the wrap-up, no new capture starts (it would miss the record): close the sheet first
|
|
244
|
+
...(ui.sheet === 'wrap' ? { s: () => useStore.getState().toast('the session is wrapping up - close the sheet (Esc) to capture again') } : {}),
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{ // a read-back open
|
|
248
|
+
on: () => ui.panel?.kind === 'capture' && panelCard?.state === 'draft',
|
|
249
|
+
keys: {
|
|
250
|
+
Enter: () => void decideDraft(panelCard!.id, 'confirm'),
|
|
251
|
+
k: () => void decideDraft(panelCard!.id, 'keep'),
|
|
252
|
+
r: () => void resumeDraft(panelCard!.id),
|
|
253
|
+
// a laser on: Esc turns it off first - never a drop by the way
|
|
254
|
+
Escape: () => { if (laserOff()) return; void decideDraft(panelCard!.id, 'drop') },
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
{ // the notes card open (in its field, the field handles its own keys)
|
|
258
|
+
on: () => cap.noteOpen,
|
|
259
|
+
keys: {
|
|
260
|
+
Escape: () => cap.setNoteOpen(false),
|
|
261
|
+
n: () => window.dispatchEvent(new CustomEvent('mv-jam-note-focus')),
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{ // a capture open
|
|
265
|
+
on: () => !!cap.current,
|
|
266
|
+
keys: {
|
|
267
|
+
e: () => cap.end(),
|
|
268
|
+
s: () => cap.start(), // one at a time: it says to end this one first
|
|
269
|
+
// L: laser picks - a pick inside a capture is its pick (frames forward it while interacting)
|
|
270
|
+
// L: the pointer laser; ⌥L: inspect - a laser click inside a capture is its pick either way
|
|
271
|
+
l: () => { void import('./comments-store.ts').then(({ useComments }) => useComments.getState().setMode(false)); useStore.getState().toggleLaser(false) },
|
|
272
|
+
'Alt+l': () => { void import('./comments-store.ts').then(({ useComments }) => useComments.getState().setMode(false)); useStore.getState().toggleLaser(true) },
|
|
273
|
+
n: () => { cap.setNoteOpen(true); window.dispatchEvent(new CustomEvent('mv-jam-note-focus')) },
|
|
274
|
+
i: () => cap.picture(),
|
|
275
|
+
// a laser on: Esc turns it off first - the recording goes on
|
|
276
|
+
Escape: () => { if (laserOff()) return; cap.drop() },
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
{ // a review open
|
|
280
|
+
on: () => ui.panel?.kind === 'review' && !!panelCard,
|
|
281
|
+
keys: {
|
|
282
|
+
Enter: () => { if (ui.moreOpen) return; void act(panelCard, 'good'); const n = nextReview(panelCard!.id); if (n && n.id !== panelCard!.id) { ui.open({ kind: 'review', id: n.id }); reveal(n) } else ui.close() },
|
|
283
|
+
'Shift+Enter': () => ui.setMoreOpen(true),
|
|
284
|
+
ArrowRight: () => { void act(panelCard, 'later'); const n = nextReview(panelCard!.id); if (n) { ui.open({ kind: 'review', id: n.id }); reveal(n); ui.follow() } },
|
|
285
|
+
ArrowLeft: () => { const n = nextReview(panelCard!.id, -1); if (n) { ui.open({ kind: 'review', id: n.id }); reveal(n) } },
|
|
286
|
+
b: () => ui.flip(),
|
|
287
|
+
'Alt+ArrowLeft': () => ui.setTab(Math.max(0, ui.tab - 1)),
|
|
288
|
+
'Alt+ArrowRight': () => ui.setTab(Math.min(Math.max(1, changedShots(panelCard?.shots).length) - 1, ui.tab + 1)),
|
|
289
|
+
Escape: () => { if (ui.moreOpen) { clearMoreDraft(panelCard!.id); ui.setMoreOpen(false) } else ui.close() }, // Esc leaves the composer: its words go
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
{ // the lane has the keyboard
|
|
293
|
+
on: () => ui.laneKeys,
|
|
294
|
+
keys: (() => {
|
|
295
|
+
const list = lane()
|
|
296
|
+
// the stops as the lane shows them: done tiles folded into one group (two or more), or led by the collapse tile
|
|
297
|
+
const { stops, done } = doneFold(list, ui.doneOpen)
|
|
298
|
+
// acting keys act only on the tile you can see selected - never on a fallback
|
|
299
|
+
const i = ui.selected ? stops.indexOf(ui.selected) : -1
|
|
300
|
+
const sel = i >= 0 ? list.find((c) => c.id === stops[i]) : undefined
|
|
301
|
+
const move = (d: number) => { const n = i < 0 ? stops[stops.length - 1] : stops[Math.min(stops.length - 1, Math.max(0, i + d))]; if (n) ui.select(n) }
|
|
302
|
+
return {
|
|
303
|
+
ArrowLeft: () => move(-1), ArrowRight: () => move(1),
|
|
304
|
+
Enter: () => {
|
|
305
|
+
if (stops[i] === DONE_GROUP) ui.setDoneOpen(true, done.map((c) => c.id))
|
|
306
|
+
else if (stops[i] === DONE_CLOSE) ui.setDoneOpen(false, done.map((c) => c.id))
|
|
307
|
+
else if (sel) openTile(sel.id)
|
|
308
|
+
},
|
|
309
|
+
'Meta+Enter': () => { if (sel?.state === 'queued') void act(sel, 'first') },
|
|
310
|
+
k: () => { if (sel?.state === 'draft') void decideDraft(sel.id, 'keep'); else if (sel?.state === 'queued') void act(sel, 'keep') },
|
|
311
|
+
Backspace: () => { if (sel) void act(sel, 'drop') },
|
|
312
|
+
Escape: () => ui.setLaneKeys(false),
|
|
313
|
+
}
|
|
314
|
+
})(),
|
|
315
|
+
},
|
|
316
|
+
{ // always (no field focused) - only where Jam runs: with `jam: false` or no agent the server takes no
|
|
317
|
+
// capture, and the toolbar shows no Jam button either
|
|
318
|
+
on: () => !PUBLISHED && !!CONFIG.jam,
|
|
319
|
+
keys: {
|
|
320
|
+
s: () => startCapture(),
|
|
321
|
+
j: () => pressJ(),
|
|
322
|
+
q: () => { const list = lane(); if (!list.length) return; ui.setLaneKeys(!ui.laneKeys); if (!ui.selected) ui.select(list[list.length - 1].id) },
|
|
323
|
+
v: () => { const n = nextReview(); if (n) { ui.open({ kind: 'review', id: n.id }); reveal(n); ui.follow() } else useStore.getState().toast('nothing to review') },
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** Apply Jam's key if a state takes it. True when it did - the caller stops there. */
|
|
330
|
+
export function jamKey(k: KeyIn): boolean {
|
|
331
|
+
const d = descriptor(k)
|
|
332
|
+
for (const row of rowsNow()) {
|
|
333
|
+
if (!row.on()) continue
|
|
334
|
+
const f = row.keys[d] ?? (d.length === 1 ? row.keys[d] : undefined)
|
|
335
|
+
if (f) { f(); syncOwned(); return true }
|
|
336
|
+
}
|
|
337
|
+
return false
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Mirror the keys owned right now into the frames. Called whenever a state may have changed. */
|
|
341
|
+
export function syncOwned() {
|
|
342
|
+
const owned = new Set<string>()
|
|
343
|
+
for (const row of rowsNow()) if (row.on()) for (const k of Object.keys(row.keys)) owned.add(k)
|
|
344
|
+
setOwnedKeys([...owned])
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (typeof window !== 'undefined' && (import.meta as any).env?.DEV) void import('./canvas/ctl.ts').then(({ canvasCtl }) => { (window as any).__mvJamCanvas = canvasCtl })
|
|
348
|
+
|
|
349
|
+
if (typeof window !== 'undefined') {
|
|
350
|
+
if (!PUBLISHED) {
|
|
351
|
+
// the states live in three stores: any change may change what is owned
|
|
352
|
+
useJamCapture.subscribe(syncOwned)
|
|
353
|
+
useJamUi.subscribe(syncOwned)
|
|
354
|
+
useJamQueue.subscribe(syncOwned)
|
|
355
|
+
}
|
|
356
|
+
// and the laser (its keys are owned while it is on - on a published canvas too)
|
|
357
|
+
useStore.subscribe((s, p) => { if (s.laser !== p.laser || s.laserInspect !== p.laserInspect) syncOwned() })
|
|
358
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lane (spec 27 Part 1): the run's captures along the bottom of the canvas, in the order they
|
|
3
|
+
* were made - oldest at the left, the capture recording now always the last tile, at the right end,
|
|
4
|
+
* never cut. No bar behind it: every item is its own floating frosted tile, two lines, 44 px. Full,
|
|
5
|
+
* it scrolls sideways and keeps the newest in view; earlier tiles scroll away under the left fade.
|
|
6
|
+
* A tile never moves: a state change rewrites its status line in place. Colour lives only in the
|
|
7
|
+
* glyph; the selected tile alone wears the accent ring. Every tile is one width - selecting one never
|
|
8
|
+
* resizes it; a title cut short shows whole in a tooltip, and a right-click opens the tile's menu.
|
|
9
|
+
*
|
|
10
|
+
* Presentational only - the shell decides what is on it (jam-capture.ts and App mount it).
|
|
11
|
+
*/
|
|
12
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
13
|
+
import { JamStateIcon, type JamGlyph } from './jam-ui.tsx'
|
|
14
|
+
import { Tip } from './Tip.tsx'
|
|
15
|
+
import { DONE_CLOSE, DONE_GROUP, doneFold, doneLine } from './jam-state.ts'
|
|
16
|
+
import { ArrowsInLineHorizontalIcon, CursorClickIcon, FileCodeIcon, ImagesSquareIcon, LaserIcon, MicrophoneIcon, MicrophoneSlashIcon, PencilSimpleIcon } from './icons.tsx'
|
|
17
|
+
|
|
18
|
+
/** The lane's height with its air: the 44 px tile + 12 px. While the lane shows, the sidebar stops
|
|
19
|
+
* above it and everything else on the bottom edge (the Update pill, toasts, notices) rises this much. */
|
|
20
|
+
export const LANE_H = 56
|
|
21
|
+
|
|
22
|
+
export interface LaneTile {
|
|
23
|
+
id: string
|
|
24
|
+
state: JamGlyph
|
|
25
|
+
/** the capture's first words (the whole title is the tooltip) */
|
|
26
|
+
title: string
|
|
27
|
+
/** the status line - jam-lines.ts `laneLine` */
|
|
28
|
+
line: string
|
|
29
|
+
/** an exclusive card wears a file glyph: it changes how the queue runs */
|
|
30
|
+
exclusive?: boolean
|
|
31
|
+
/** a done tile: the frames it changed (not the ones it left as they were) - the Done group counts each frame once */
|
|
32
|
+
frames?: string[]
|
|
33
|
+
/** a session record's tile (the Done group counts records apart from captures) */
|
|
34
|
+
record?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface LaneRecording {
|
|
38
|
+
/** the capture's timer, "0:14" */
|
|
39
|
+
time: string
|
|
40
|
+
/** what it holds so far, drawn as the hi-fi's quiet stats (laser 2 · pictures 1 · steps 3); a
|
|
41
|
+
* picture count shows from the first picture, "12 · max" at the cap. `counts` is a plain-text
|
|
42
|
+
* fallback when the numbers are not known. */
|
|
43
|
+
points?: number
|
|
44
|
+
pictures?: number
|
|
45
|
+
picturesMax?: boolean
|
|
46
|
+
steps?: number
|
|
47
|
+
counts?: string
|
|
48
|
+
/** notes added so far (the count on the Note button) */
|
|
49
|
+
notes: number
|
|
50
|
+
/** the notes card is open */
|
|
51
|
+
noteOn: boolean
|
|
52
|
+
/** after E, waiting for the last words and the frames' flush */
|
|
53
|
+
finishing?: boolean
|
|
54
|
+
/** the microphone: hearing you (`on`), or not (`off` - a click asks again); none when never asked */
|
|
55
|
+
mic?: 'on' | 'off'
|
|
56
|
+
onMic?(): void
|
|
57
|
+
onNote(): void
|
|
58
|
+
onStop(): void
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* `tiles` in time order (the order made); `recording` renders the capture recording now as the LAST
|
|
63
|
+
* tile; `selected` = the tile whose detail is open (the accent ring); `keyboard` = Q has the lane
|
|
64
|
+
* (the selected tile is Q's focus); `onOpen(id)` = a tile was clicked; `followEnd` = any value that
|
|
65
|
+
* changes when a new capture or draft arrives - the lane scrolls back to its right end then (a manual
|
|
66
|
+
* scroll back stays put until the next change).
|
|
67
|
+
*/
|
|
68
|
+
/** The session's length: seconds in its first minute ("42s"), then minutes ("3m"). */
|
|
69
|
+
export const sessionClock = (since: number, t = Date.now()): string => {
|
|
70
|
+
const sec = Math.max(0, Math.floor((t - since) / 1000))
|
|
71
|
+
return sec < 60 ? `${sec}s` : `${Math.floor(sec / 60)}m`
|
|
72
|
+
}
|
|
73
|
+
/** The session's clock, ticking - every second in its first minute, then often enough for the minutes. */
|
|
74
|
+
export function useSessionClock(since: number | undefined): string {
|
|
75
|
+
const [, tick] = useState(0)
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (since === undefined) return
|
|
78
|
+
let t: ReturnType<typeof setTimeout>
|
|
79
|
+
const next = () => { t = setTimeout(() => { tick((n) => n + 1); next() }, Date.now() - since < 60_000 ? 1000 : 5000) }
|
|
80
|
+
next()
|
|
81
|
+
return () => clearTimeout(t)
|
|
82
|
+
}, [since])
|
|
83
|
+
return since === undefined ? '' : sessionClock(since)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** A session between captures: still on - its talk heard - and S starts the next capture. */
|
|
87
|
+
export interface LaneBetween {
|
|
88
|
+
/** when the session began (its clock) */
|
|
89
|
+
since: number
|
|
90
|
+
/** the microphone hears the session's talk */
|
|
91
|
+
mic: boolean
|
|
92
|
+
onCapture(): void
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function Lane({ tiles, recording, between, selected, keyboard, onOpen, onMenu, followEnd, doneOpen = false, onDoneOpen }: {
|
|
96
|
+
tiles: LaneTile[]
|
|
97
|
+
/** two or more done tiles fold into one Done tile (0.26.1): shown open, or folded */
|
|
98
|
+
doneOpen?: boolean
|
|
99
|
+
onDoneOpen?(open: boolean, doneIds: string[]): void
|
|
100
|
+
recording?: LaneRecording
|
|
101
|
+
/** no capture recording in a session: its own tile, last */
|
|
102
|
+
between?: LaneBetween
|
|
103
|
+
selected?: string
|
|
104
|
+
keyboard?: boolean
|
|
105
|
+
onOpen(id: string): void
|
|
106
|
+
/** a right-click on a tile: its menu */
|
|
107
|
+
onMenu?(e: React.MouseEvent, id: string): void
|
|
108
|
+
followEnd?: unknown
|
|
109
|
+
}) {
|
|
110
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
111
|
+
const [fade, setFade] = useState<'' | 'l' | 'r' | 'lr'>('')
|
|
112
|
+
// done tiles: folded into one (two or more), or shown first behind the collapse tile
|
|
113
|
+
const { fold, done, rest } = doneFold(tiles, doneOpen)
|
|
114
|
+
const shown = fold ? (doneOpen ? [...done, ...rest] : rest) : tiles
|
|
115
|
+
const doneFrames = new Set(done.flatMap((t) => t.frames ?? [])).size
|
|
116
|
+
// opening shows the done tiles where they are (the lane's start); folding goes back to the newest end
|
|
117
|
+
const firstOpen = useRef(true)
|
|
118
|
+
useLayoutEffect(() => {
|
|
119
|
+
if (firstOpen.current) { firstOpen.current = false; return }
|
|
120
|
+
const el = ref.current
|
|
121
|
+
// (folding with the group selected: the selection's own scroll shows the group)
|
|
122
|
+
if (el && (doneOpen || selected !== DONE_GROUP)) el.scrollLeft = doneOpen ? 0 : el.scrollWidth
|
|
123
|
+
measure()
|
|
124
|
+
}, [doneOpen])
|
|
125
|
+
const measure = () => {
|
|
126
|
+
const el = ref.current
|
|
127
|
+
if (!el) return
|
|
128
|
+
const left = el.scrollLeft > 1
|
|
129
|
+
const right = el.scrollLeft + el.clientWidth < el.scrollWidth - 1
|
|
130
|
+
setFade(left && right ? 'lr' : left ? 'l' : right ? 'r' : '')
|
|
131
|
+
}
|
|
132
|
+
// a new capture or draft brings the lane back to its right end
|
|
133
|
+
useLayoutEffect(() => {
|
|
134
|
+
const el = ref.current
|
|
135
|
+
if (el) el.scrollLeft = el.scrollWidth
|
|
136
|
+
measure()
|
|
137
|
+
}, [followEnd, tiles.length, !!recording, !!between])
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
const el = ref.current
|
|
140
|
+
if (!el) return
|
|
141
|
+
const ro = new ResizeObserver(measure)
|
|
142
|
+
ro.observe(el)
|
|
143
|
+
return () => ro.disconnect()
|
|
144
|
+
}, [])
|
|
145
|
+
// Q's arrows and Review all move the selection: keep the selected tile in view - only when it
|
|
146
|
+
// MOVES, so a lane that opens with a tile selected still starts at its newest end
|
|
147
|
+
const was = useRef(selected)
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (selected === was.current) return
|
|
150
|
+
was.current = selected
|
|
151
|
+
if (!selected) return
|
|
152
|
+
const el = ref.current?.querySelector<HTMLElement>(`[data-tile="${CSS.escape(selected)}"]`)
|
|
153
|
+
const box = ref.current
|
|
154
|
+
if (!el || !box) return
|
|
155
|
+
// nearest, by hand: scrollIntoView would also scroll the page's ancestors
|
|
156
|
+
const l = el.offsetLeft - box.offsetLeft, r = l + el.offsetWidth
|
|
157
|
+
if (l < box.scrollLeft + 56) box.scrollLeft = Math.max(0, l - 56)
|
|
158
|
+
else if (r > box.scrollLeft + box.clientWidth - 56) box.scrollLeft = r - box.clientWidth + 56
|
|
159
|
+
}, [selected])
|
|
160
|
+
return (
|
|
161
|
+
<div className={`jm-lane${keyboard ? ' keyboard' : ''}`} data-jam-lane="">
|
|
162
|
+
{fade.includes('l') && <span className="jm-lane-edge l" aria-hidden="true" />}
|
|
163
|
+
{fade.includes('r') && <span className="jm-lane-edge r" aria-hidden="true" />}
|
|
164
|
+
<div ref={ref} className="jm-lane-in"
|
|
165
|
+
onScroll={measure}
|
|
166
|
+
onWheel={(e) => { const el = ref.current; if (el && Math.abs(e.deltaY) > Math.abs(e.deltaX)) el.scrollLeft += e.deltaY }}>
|
|
167
|
+
{fold && !doneOpen && (
|
|
168
|
+
<button key={DONE_GROUP} data-tile={DONE_GROUP} data-state="done" data-jam-done="folded"
|
|
169
|
+
className={`jm-card done group${selected === DONE_GROUP ? ' focus' : ''}`}
|
|
170
|
+
onClick={() => onDoneOpen?.(true, done.map((t) => t.id))}>
|
|
171
|
+
<JamStateIcon state="done" />
|
|
172
|
+
<span className="tx">
|
|
173
|
+
<span className="t">Done</span>
|
|
174
|
+
<span className="m">{doneLine(done, doneFrames)}</span>
|
|
175
|
+
</span>
|
|
176
|
+
</button>
|
|
177
|
+
)}
|
|
178
|
+
{fold && doneOpen && (
|
|
179
|
+
<button key={DONE_CLOSE} data-tile={DONE_CLOSE} data-jam-done="open" aria-label="Fold the done captures"
|
|
180
|
+
className={`jm-card close${selected === DONE_CLOSE ? ' focus' : ''}`}
|
|
181
|
+
onClick={() => onDoneOpen?.(false, done.map((t) => t.id))}>
|
|
182
|
+
<ArrowsInLineHorizontalIcon size={15} /><span className="t">Done</span>
|
|
183
|
+
</button>
|
|
184
|
+
)}
|
|
185
|
+
{shown.map((t) => (
|
|
186
|
+
<button key={t.id} data-tile={t.id} data-state={t.state}
|
|
187
|
+
className={`jm-card ${t.state}${selected === t.id ? ' focus' : ''}${fold && t.state === 'done' ? ' unfold' : ''}`}
|
|
188
|
+
onClick={() => onOpen(t.id)} onContextMenu={onMenu ? (e) => onMenu(e, t.id) : undefined}>
|
|
189
|
+
<JamStateIcon state={t.state} />
|
|
190
|
+
<span className="tx">
|
|
191
|
+
{/* the whole title, in the shell's own tooltip - only when the tile cuts it short */}
|
|
192
|
+
<Tip label={<span className="jm-tip-title">{t.title}</span>} only={(el) => el.scrollWidth > el.clientWidth + 1}><span className="t">{t.title}</span></Tip>
|
|
193
|
+
<span className="m">{t.line}</span>
|
|
194
|
+
</span>
|
|
195
|
+
{t.exclusive && <span className="x" aria-label="changes a shared file"><FileCodeIcon size={13} /></span>}
|
|
196
|
+
</button>
|
|
197
|
+
))}
|
|
198
|
+
{recording ? <CaptureTile {...recording} /> : between ? <BetweenTile {...between} /> : null}
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** The session between captures: the same pulsing dot, "Jam on" and its clock, what it hears - then Capture (S). */
|
|
205
|
+
export function BetweenTile({ since, mic, onCapture }: LaneBetween) {
|
|
206
|
+
const time = useSessionClock(since)
|
|
207
|
+
return (
|
|
208
|
+
<div className="jm-chip between" data-tile="between">
|
|
209
|
+
<i className="jm-live-dot" />
|
|
210
|
+
<span className="tx">
|
|
211
|
+
<span className="lead">Jam on<span className="time">{time}</span></span>
|
|
212
|
+
<span className="stats">{mic ? <><MicrophoneIcon size={12} />Listening between captures</> : <><MicrophoneSlashIcon size={12} />Between captures</>}</span>
|
|
213
|
+
</span>
|
|
214
|
+
<i className="sep" />
|
|
215
|
+
<button className="go" onClick={onCapture}>Capture<kbd>S</kbd></button>
|
|
216
|
+
</div>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** The capture recording now: a pulsing teal dot, "Capturing" and the timer over what it holds so far,
|
|
221
|
+
* then the Note button (N, with the count) and Stop (E). After E it reads "Finishing". */
|
|
222
|
+
export function CaptureTile({ time, points, pictures = 0, picturesMax, steps, counts, notes, noteOn, finishing, mic, onMic, onNote, onStop }: LaneRecording) {
|
|
223
|
+
return (
|
|
224
|
+
<div className={`jm-chip${finishing ? ' finishing' : ''}`} data-tile="capturing">
|
|
225
|
+
{finishing ? <JamStateIcon state="confirming" /> : <i className="jm-live-dot" />}
|
|
226
|
+
{mic && !finishing && (
|
|
227
|
+
<Tip label={mic === 'on' ? 'Hearing you - words on this Mac' : 'Microphone off - click to use it'}>
|
|
228
|
+
<button className={`mic${mic === 'off' ? ' off' : ''}`} data-jam-mic={mic} onClick={onMic} aria-label={mic === 'on' ? 'Microphone on' : 'Microphone off'}>
|
|
229
|
+
{mic === 'on' ? <MicrophoneIcon size={13} /> : <MicrophoneSlashIcon size={13} />}
|
|
230
|
+
</button>
|
|
231
|
+
</Tip>
|
|
232
|
+
)}
|
|
233
|
+
<span className="tx">
|
|
234
|
+
<span className="lead">{finishing ? 'Finishing' : 'Capturing'}{!finishing && <span className="time">{time}</span>}</span>
|
|
235
|
+
<span className="stats">
|
|
236
|
+
{points != null && <span className="stat" title="points"><LaserIcon size={12} />{points}</span>}
|
|
237
|
+
{(pictures > 0 || picturesMax) && <span className={`stat${picturesMax ? ' warn' : ''}`} title="pictures"><ImagesSquareIcon size={12} />{picturesMax ? '12 · max' : pictures}</span>}
|
|
238
|
+
{steps != null && <span className="stat" title="UI steps"><CursorClickIcon size={11} />{steps}</span>}
|
|
239
|
+
{points == null && counts && <span className="stat">{counts}</span>}
|
|
240
|
+
</span>
|
|
241
|
+
</span>
|
|
242
|
+
<i className="sep" />
|
|
243
|
+
<button className={`notebtn${noteOn ? ' on' : ''}`} onClick={onNote} disabled={finishing} aria-pressed={noteOn}>
|
|
244
|
+
<PencilSimpleIcon size={13} />Note{notes ? <b>{notes}</b> : null}<kbd>N</kbd>
|
|
245
|
+
</button>
|
|
246
|
+
<button className="stop" onClick={onStop} disabled={finishing}>Stop<kbd>E</kbd></button>
|
|
247
|
+
</div>
|
|
248
|
+
)
|
|
249
|
+
}
|