@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,556 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jam V2's panels (spec 27 Parts 1-3): the focus panel the review and the capture detail open in, the
|
|
3
|
+
* read-back, the review detail, the notes card, how a capture's comment reads in its thread, and the
|
|
4
|
+
* capture's marks on the canvas (the teal edge ring, numbered points).
|
|
5
|
+
*
|
|
6
|
+
* Presentational only: every component takes what it shows and calls back what was chosen. The shell
|
|
7
|
+
* (jam-capture.ts, App) owns state, keys and the API.
|
|
8
|
+
*/
|
|
9
|
+
import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react'
|
|
10
|
+
import { JamStateIcon } from './jam-ui.tsx'
|
|
11
|
+
import type { TimelineLine } from './jam-lines.ts'
|
|
12
|
+
import { speechLines } from '../../shared/speech.ts'
|
|
13
|
+
import {
|
|
14
|
+
ArrowBendUpLeftIcon, ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, CopyIcon, CursorClickIcon, CursorIcon, EyeIcon, FileCodeIcon,
|
|
15
|
+
FrameRectIcon, ImagesSquareIcon, LaserIcon, MicrophoneIcon, MoonIcon, PencilSimpleIcon, SignpostIcon, SunIcon, TextboxIcon,
|
|
16
|
+
ParallelogramFillIcon, WarningIcon, WaveformIcon, XIcon, deviceIcon,
|
|
17
|
+
} from './icons.tsx'
|
|
18
|
+
import { LANE_H } from './jam-lane.tsx'
|
|
19
|
+
import { Tip } from './Tip.tsx'
|
|
20
|
+
import { useJamQueue } from './jam-queue.ts'
|
|
21
|
+
|
|
22
|
+
/** A heading cut short by its ellipsis: its tooltip shows it whole (one that fits shows none). */
|
|
23
|
+
const cutShort = (el: HTMLElement) => el.scrollWidth > el.clientWidth + 1
|
|
24
|
+
|
|
25
|
+
/** Marver's mark, as the thread draws it (Comments.tsx MarverAvatar) - drawn here from the same classes
|
|
26
|
+
* so the panels never import the comments module (which will import these panels). */
|
|
27
|
+
export const Marver = ({ size = 20 }: { size?: number }) => (
|
|
28
|
+
<span className="cm-avatar cm-marver" style={{ width: size, height: size }} aria-label="Marver"><ParallelogramFillIcon size={Math.round(size * 0.5)} /></span>
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
// ---- the focus panel ---------------------------------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
/** The one place a detail opens (v9): its top level with the sidebar's and the toolbar's tops, its
|
|
34
|
+
* bottom just above the lane, its left edge at `left` (the sidebar's right edge plus an inset - the
|
|
35
|
+
* shell passes it), `width` px wide (520 at least). The panel inside fills it; its middle scrolls and
|
|
36
|
+
* its footer stays in view. `onClose` adds a quiet close button in its corner. */
|
|
37
|
+
export function FocusPanel({ children, left, width = 580, onClose }: { children: ReactNode; left: number; width?: number; onClose?: () => void }) {
|
|
38
|
+
// the window's width is the last word: follow it as it changes
|
|
39
|
+
const [, setTick] = useState(0)
|
|
40
|
+
useEffect(() => { const on = () => setTick((n) => n + 1); window.addEventListener('resize', on); return () => window.removeEventListener('resize', on) }, [])
|
|
41
|
+
// 580: the footer's "For Claude Code" and its four actions on one line; never wider than the window allows
|
|
42
|
+
// the window is the last word: a narrow one gets a narrower panel, never one past its edge
|
|
43
|
+
const room = (typeof window !== 'undefined' ? window.innerWidth : 1400) - left - 12
|
|
44
|
+
const w = Math.min(room, Math.max(360, Math.max(580, width)))
|
|
45
|
+
return (
|
|
46
|
+
<div className="jm-focus" data-jam-focus="" style={{ left, width: w, bottom: `calc(var(--edge) + ${LANE_H + 2}px)` }}>
|
|
47
|
+
{children}
|
|
48
|
+
{onClose && <button className="jm-iconbtn jm-focus-x" aria-label="Close" onClick={onClose}><XIcon size={13} /></button>}
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ---- the timeline --------------------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
/** More work words not sent yet, by card - they survive the panel closing on a click elsewhere. */
|
|
56
|
+
const moreDrafts = new Map<string, string>()
|
|
57
|
+
export const clearMoreDraft = (id: string) => { moreDrafts.delete(id) }
|
|
58
|
+
export const moreDraftOf = (id: string): string => moreDrafts.get(id) ?? ''
|
|
59
|
+
export const setMoreDraft = (id: string, t: string) => { if (t) moreDrafts.set(id, t); else moreDrafts.delete(id) }
|
|
60
|
+
|
|
61
|
+
const unquote = (s: string) => s.replace(/^"(.*)"$/s, '$1')
|
|
62
|
+
const DEVICE: Record<string, string> = { phone: 'mobile', mobile: 'mobile', tablet: 'tablet', laptop: 'laptop', desktop: 'monitor', monitor: 'monitor', tv: 'tv' }
|
|
63
|
+
|
|
64
|
+
/** One line: time | glyph | what happened (the read-back's merged timeline, jam-lines.ts). */
|
|
65
|
+
function LineRow({ l }: { l: TimelineLine }) {
|
|
66
|
+
const ui = (s: string) => <b className="ui">{s}</b>
|
|
67
|
+
const code = l.source ? <code>{l.source.split('/').pop()}</code> : null
|
|
68
|
+
let glyph: ReactNode = null, body: ReactNode = l.text
|
|
69
|
+
switch (l.kind) {
|
|
70
|
+
case 'words': glyph = <MicrophoneIcon size={13} />; body = <span className="words">“{unquote(l.text)}”</span>; break
|
|
71
|
+
case 'note': glyph = <PencilSimpleIcon size={13} />; body = <span className="words">{unquote(l.text)}</span>; break
|
|
72
|
+
case 'view': glyph = <EyeIcon size={13} />; break
|
|
73
|
+
case 'pick': glyph = <LaserIcon size={13} />; body = <>{l.point != null && <span className="pt pick">{l.point}</span>}{l.text}{code}</>; break
|
|
74
|
+
case 'click': glyph = <CursorClickIcon size={13} />; body = <>{l.point != null && <span className="pt click">{l.point}</span>}{l.text}{code}</>; break
|
|
75
|
+
case 'hover': glyph = <CursorIcon size={13} />; body = <>{l.text}{code}</>; break
|
|
76
|
+
case 'field': glyph = <TextboxIcon size={13} />; body = <>{l.text}{code}</>; break
|
|
77
|
+
case 'screen': glyph = <ArrowRightIcon size={13} />; break
|
|
78
|
+
case 'scroll': glyph = <ArrowUpIcon size={13} style={{ transform: 'rotate(180deg)' }} />; break
|
|
79
|
+
case 'select': glyph = <FrameRectIcon size={13} />; body = <>selected {ui(l.text)}</>; break
|
|
80
|
+
case 'device': {
|
|
81
|
+
const name = (l.text.split(' · ')[1] ?? '').split(' ')[0].toLowerCase()
|
|
82
|
+
glyph = deviceIcon(DEVICE[name] ?? null, 13); body = <>viewed at {ui(l.text.split(' · ').slice(1).join(' · ') || l.text)}</>; break
|
|
83
|
+
}
|
|
84
|
+
case 'theme': glyph = l.text === 'dark' ? <MoonIcon size={13} /> : <SunIcon size={13} />; body = <>switched to {ui(l.text)}</>; break
|
|
85
|
+
case 'copied': {
|
|
86
|
+
const [what, of] = l.text.split(' of ')
|
|
87
|
+
glyph = what === 'path' ? <SignpostIcon size={13} /> : <CopyIcon size={13} />; body = <>copied the {what} of {ui(of ?? '')}</>; break
|
|
88
|
+
}
|
|
89
|
+
case 'interact': glyph = <CursorClickIcon size={13} />; body = <>interactive mode {ui(l.text)}</>; break
|
|
90
|
+
case 'picture': glyph = <ImagesSquareIcon size={13} />; body = <>picture {l.point} · {l.text}</>; break
|
|
91
|
+
case 'missing': glyph = <WarningIcon size={13} />; body = <span className="miss">{l.text}</span>; break
|
|
92
|
+
}
|
|
93
|
+
return <div data-kind={l.kind}><span className="ts">{l.t}</span><span className="g">{glyph}</span><span>{body}</span></div>
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** The merged timeline: words and notes among every step, each at its moment. */
|
|
97
|
+
export const Lines = ({ lines }: { lines: TimelineLine[] }) => <div className="jm-lines">{lines.map((l, i) => <LineRow key={i} l={l} />)}</div>
|
|
98
|
+
|
|
99
|
+
const newNoteId = () => `n-${Math.random().toString(36).slice(2, 12).padEnd(8, '0')}`
|
|
100
|
+
|
|
101
|
+
/** Notes written in a read-back after the capture ended: under a divider, in the timeline's own rows, then a
|
|
102
|
+
* clean field and Add note (⏎). What you type is never a capture key. */
|
|
103
|
+
function AddedNotes({ added, onAdd }: { added: { at: number; text: string }[]; onAdd?: (text: string, id: string) => Promise<boolean> }) {
|
|
104
|
+
const [text, setText] = useState('')
|
|
105
|
+
const [busy, setBusy] = useState(false)
|
|
106
|
+
// the note in the field: one id until it saves (a failed one sent again is the same note)
|
|
107
|
+
const nid = useRef(newNoteId())
|
|
108
|
+
const add = async () => {
|
|
109
|
+
const t = text.trim()
|
|
110
|
+
if (!t || busy || !onAdd) return
|
|
111
|
+
setBusy(true)
|
|
112
|
+
const ok = await onAdd(t, nid.current)
|
|
113
|
+
setBusy(false)
|
|
114
|
+
if (ok) { setText(''); nid.current = newNoteId() }
|
|
115
|
+
}
|
|
116
|
+
return (
|
|
117
|
+
<div className="jm-added" data-jam-added="">
|
|
118
|
+
{added.length > 0 && <>
|
|
119
|
+
<div className="jm-added-rule"><span>Added after</span></div>
|
|
120
|
+
<div className="jm-lines">{added.map((a, i) => (
|
|
121
|
+
<div key={i} data-jam-added-note=""><span className="ts">{new Date(a.at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</span><span className="g"><PencilSimpleIcon size={12} /></span><span className="words">{a.text}</span></div>
|
|
122
|
+
))}</div>
|
|
123
|
+
</>}
|
|
124
|
+
{onAdd && (
|
|
125
|
+
<div className="jm-addnote">
|
|
126
|
+
{/* read-only while it saves (never disabled: a disabled field lets its focus go, and the next ⏎ would
|
|
127
|
+
reach the read-back's own keys) */}
|
|
128
|
+
<input value={text} placeholder="Add a note..." data-jam-addnote="" readOnly={busy}
|
|
129
|
+
onChange={(e) => setText(e.target.value)}
|
|
130
|
+
onKeyDown={(e) => {
|
|
131
|
+
e.stopPropagation()
|
|
132
|
+
if ((e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) return
|
|
133
|
+
if (e.key === 'Enter') { e.preventDefault(); void add() }
|
|
134
|
+
else if (e.key === 'Escape') { e.preventDefault(); setText(''); (e.target as HTMLInputElement).blur() }
|
|
135
|
+
}} />
|
|
136
|
+
<button className="jm-btn" disabled={!text.trim() || busy} onClick={() => void add()}>Add note</button>
|
|
137
|
+
</div>
|
|
138
|
+
)}
|
|
139
|
+
</div>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** A picture, or the dashed "No picture" where a shot failed. */
|
|
144
|
+
export function Shot({ url, cap, alt, onSize }: { url?: string; cap?: ReactNode; alt?: string; onSize?: (w: number, h: number) => void }) {
|
|
145
|
+
// a picture that cannot load (gone, refused) is "No picture" too - never a broken image
|
|
146
|
+
const [failed, setFailed] = useState<string | null>(null)
|
|
147
|
+
const ok = !!url && failed !== url
|
|
148
|
+
return (
|
|
149
|
+
<div className="jm-shot">
|
|
150
|
+
{ok ? <div className="pic"><img src={url} alt={alt ?? ''} draggable={false} onError={() => setFailed(url!)}
|
|
151
|
+
onLoad={onSize ? (e) => onSize(e.currentTarget.naturalWidth, e.currentTarget.naturalHeight) : undefined} /></div>
|
|
152
|
+
: <div className="pic none"><ImagesSquareIcon size={13} />No picture</div>}
|
|
153
|
+
{cap && <span className="cap">{cap}</span>}
|
|
154
|
+
</div>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** "1 of 3" with its arrows - the walk's ends disable the arrow that has nowhere to go. */
|
|
159
|
+
const Walk = ({ of, onPrev, onNext }: { of?: [number, number]; onPrev?: () => void; onNext?: () => void }) => of ? (
|
|
160
|
+
<>
|
|
161
|
+
<span className="dim">{of[0]} of {of[1]}</span>
|
|
162
|
+
<button className="jm-iconbtn" disabled={of[0] <= 1 || !onPrev} onClick={onPrev} aria-label="Previous"><ArrowLeftIcon size={13} /></button>
|
|
163
|
+
<button className="jm-iconbtn" disabled={of[0] >= of[1] || !onNext} onClick={onNext} aria-label="Next"><ArrowRightIcon size={13} /></button>
|
|
164
|
+
</>
|
|
165
|
+
) : null
|
|
166
|
+
|
|
167
|
+
const Meta = ({ items }: { items: ReactNode[] }) => (
|
|
168
|
+
<div className="meta">{items.map((m, i) => <span key={i} style={{ display: 'contents' }}>{i > 0 && <i />}<span>{m}</span></span>)}</div>
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
// ---- the read-back --------------------------------------------------------------------------------------
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* A capture's detail (the read-back of a draft; read-only once confirmed). Head: its first words and
|
|
175
|
+
* "1 of N". Then a line of meta (length, frames, points, pictures, notes, steps), the pictures large
|
|
176
|
+
* (two to a row), and the merged timeline. Click the timeline to edit the words (a field; saved on blur
|
|
177
|
+
* through `onEdit`). A draft's footer names the agent: Drop (esc), Keep (K), Add to queue (⏎). Read-only
|
|
178
|
+
* shows Open thread instead.
|
|
179
|
+
*
|
|
180
|
+
* `edited` = your edit so far (the field opens on it; else on the words of `lines`); `editing` opens
|
|
181
|
+
* the field from outside (it is also opened by a click); `follows` = the reviewed card's title for a
|
|
182
|
+
* capture made during a review; `err` = a confirm that failed closed; `warn` = degraded content
|
|
183
|
+
* ("words may be incomplete").
|
|
184
|
+
*/
|
|
185
|
+
export function ReadBack({ title, head, of, onPrev, onNext, meta, lines, pictures, edited, pending, editing, onEdit, onRetry, onConfirm, onKeep, onDrop, onResume, agent, follows, readOnly, locked, onOpenThread, added, onAddNote, autoNamed, err, warn, style }: {
|
|
186
|
+
title: string
|
|
187
|
+
/** beside the title: the Review | Capture switch (a capture under review) */
|
|
188
|
+
head?: ReactNode
|
|
189
|
+
of?: [number, number]
|
|
190
|
+
onPrev?: () => void
|
|
191
|
+
onNext?: () => void
|
|
192
|
+
meta: ReactNode[]
|
|
193
|
+
lines: TimelineLine[]
|
|
194
|
+
pictures: { id: string; url: string; caption: ReactNode }[]
|
|
195
|
+
edited?: string
|
|
196
|
+
/** words written that have not saved yet - they win over `edited` */
|
|
197
|
+
pending?: string
|
|
198
|
+
/** a failed capture: its Retry (with Drop beside it) in the read-only footer */
|
|
199
|
+
onRetry?: () => void
|
|
200
|
+
editing?: boolean
|
|
201
|
+
onEdit?: (text: string) => void
|
|
202
|
+
onConfirm?: () => void
|
|
203
|
+
onKeep?: () => void
|
|
204
|
+
onDrop?: () => void
|
|
205
|
+
/** ended too soon: recording goes on where it stopped (R) */
|
|
206
|
+
onResume?: () => void
|
|
207
|
+
agent?: string | null
|
|
208
|
+
follows?: string
|
|
209
|
+
readOnly?: boolean
|
|
210
|
+
/** the words cannot be edited for now (its Resume is starting) - the rest stays as it is */
|
|
211
|
+
locked?: boolean
|
|
212
|
+
onOpenThread?: () => void
|
|
213
|
+
/** notes written here after it ended - under a divider, as the timeline shows its own */
|
|
214
|
+
added?: { at: number; text: string }[]
|
|
215
|
+
/** the title came from Claude Haiku (jam.names): its tooltip says so, and where the words went */
|
|
216
|
+
autoNamed?: boolean
|
|
217
|
+
/** a note added from here (a draft): resolves whether it saved */
|
|
218
|
+
onAddNote?: (text: string, id: string) => Promise<boolean>
|
|
219
|
+
err?: ReactNode
|
|
220
|
+
warn?: ReactNode
|
|
221
|
+
style?: CSSProperties
|
|
222
|
+
}) {
|
|
223
|
+
const [open, setOpen] = useState(!!editing)
|
|
224
|
+
useEffect(() => { if (editing) setOpen(true) }, [editing])
|
|
225
|
+
// the words and the notes, in time order - what the capture says (server captureWords)
|
|
226
|
+
const words = speechLines(lines.flatMap((l) => (l.kind === 'words' || l.kind === 'note' ? [{ kind: l.kind, text: unquote(l.text) }] : [])))
|
|
227
|
+
const [text, setText] = useState(pending ?? edited ?? words)
|
|
228
|
+
// the field follows the saved edit only while you are not writing and nothing newer waits to save
|
|
229
|
+
// (`pending`): an older save's answer never overwrites newer words, and a failed one never loses them
|
|
230
|
+
useEffect(() => { if (!open) setText(pending ?? edited ?? words) }, [edited, words, pending])
|
|
231
|
+
const field = useRef<HTMLTextAreaElement>(null)
|
|
232
|
+
useEffect(() => { if (open) { const el = field.current; if (el) { el.focus(); el.setSelectionRange(el.value.length, el.value.length) } } }, [open])
|
|
233
|
+
// compared with what is meant now - a pending save included: going back to the saved words while a
|
|
234
|
+
// newer save is out is a save of its own, queued after it
|
|
235
|
+
const lastSent = useRef<string | undefined>(undefined)
|
|
236
|
+
const save = () => {
|
|
237
|
+
setOpen(false)
|
|
238
|
+
if (text !== (lastSent.current ?? pending ?? edited ?? words)) { lastSent.current = text; onEdit?.(text) }
|
|
239
|
+
}
|
|
240
|
+
// once the saved edit is what was last sent, the intent is settled
|
|
241
|
+
useEffect(() => { if (lastSent.current !== undefined && edited === lastSent.current && pending === undefined) lastSent.current = undefined }, [edited, pending])
|
|
242
|
+
return (
|
|
243
|
+
<div className="jm-panel jm-readback" data-jam-readback="" style={style}>
|
|
244
|
+
<div className="top">
|
|
245
|
+
<span className="jm-capglyph"><WaveformIcon size={14} /></span>
|
|
246
|
+
<Tip side="bottom" label={<span className="jm-tip-title">{title}{autoNamed && <><br /><small>Named by Claude Haiku from its words, sent to Anthropic through Claude Code - <code>jam.names: false</code> turns it off</small></>}</span>} only={autoNamed ? undefined : cutShort}><h3>{title || 'Capture'}</h3></Tip>
|
|
247
|
+
{head}
|
|
248
|
+
<Walk of={of} onPrev={onPrev} onNext={onNext} />
|
|
249
|
+
</div>
|
|
250
|
+
<Meta items={meta} />
|
|
251
|
+
<div className="jm-body">
|
|
252
|
+
{follows && <div className="note-line info"><ArrowBendUpLeftIcon size={14} /><span>Follows <b style={{ color: 'var(--glass-ink)' }}>{follows}</b> - confirming sends that review back as more work</span></div>}
|
|
253
|
+
{err && <div className="note-line err"><WarningIcon size={14} /><span>{err}</span></div>}
|
|
254
|
+
{warn && <div className="note-line warn"><WarningIcon size={14} /><span>{warn}</span></div>}
|
|
255
|
+
{pictures.length > 0 && <div className="jm-thumbs">{pictures.map((p) => <Shot key={p.id} url={p.url} cap={p.caption} />)}</div>}
|
|
256
|
+
{open && !readOnly && !locked ? (
|
|
257
|
+
<textarea ref={field} className="jm-edit" value={text} rows={Math.min(10, Math.max(3, Math.ceil(text.length / 60)))}
|
|
258
|
+
onChange={(e) => setText(e.target.value)} onBlur={save}
|
|
259
|
+
onKeyDown={(e) => { e.stopPropagation(); if (e.key === 'Escape') { setText(edited ?? words); setOpen(false) } }} />
|
|
260
|
+
) : (
|
|
261
|
+
<div className={readOnly || locked ? undefined : 'jm-editable'} title={readOnly || locked ? undefined : 'Click to edit the words'} onClick={readOnly || locked ? undefined : () => setOpen(true)}>
|
|
262
|
+
{edited !== undefined && !readOnly && <div className="jm-edited"><PencilSimpleIcon size={12} />Your edit</div>}
|
|
263
|
+
<Lines lines={lines} />
|
|
264
|
+
</div>
|
|
265
|
+
)}
|
|
266
|
+
{(added?.length || (onAddNote && !readOnly)) ? <AddedNotes added={added ?? []} onAdd={readOnly || locked ? undefined : onAddNote} /> : null}
|
|
267
|
+
</div>
|
|
268
|
+
<div className="rule" />
|
|
269
|
+
<div className="actions">
|
|
270
|
+
{readOnly ? (
|
|
271
|
+
<><span className="sp" />{onOpenThread && <button className="jm-btn" onClick={onOpenThread}>Open thread</button>}
|
|
272
|
+
{onRetry && <><button className="jm-btn ghost" onClick={onDrop}>Drop</button><button className="jm-btn primary" onClick={onRetry}>Retry</button></>}</>
|
|
273
|
+
) : (
|
|
274
|
+
<>
|
|
275
|
+
<span className="dim">{agent ? <>For <b style={{ color: 'var(--glass-ink-2)', fontWeight: 600 }}>{agent}</b></> : 'No agent yet - it waits in the queue'}</span>
|
|
276
|
+
<span className="sp" />
|
|
277
|
+
{onResume && <button className="jm-btn ghost" onClick={onResume}>Resume <kbd>R</kbd></button>}
|
|
278
|
+
<button className="jm-btn ghost" onClick={onDrop}>Drop <kbd>esc</kbd></button>
|
|
279
|
+
<button className="jm-btn ghost" onClick={onKeep}>Keep <kbd>K</kbd></button>
|
|
280
|
+
<button className="jm-btn primary" onClick={onConfirm}>Add to queue <kbd>⏎</kbd></button>
|
|
281
|
+
</>
|
|
282
|
+
)}
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// ---- the review --------------------------------------------------------------------------------------
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* A capture's review (v9): one big picture at a time at the panel's width - frame tabs when several
|
|
292
|
+
* frames changed, a Before | After switch (B; it opens on After), a dashed "No picture" where a shot
|
|
293
|
+
* failed. Above it the agent's reply and "Open thread"; below it the verdicts - Looks good (⏎), More
|
|
294
|
+
* work (⇧⏎), Later (→). `more` turns the verdict row into a composer whose ⏎ (or Send) calls
|
|
295
|
+
* `onMore(text)`; esc (or `onMoreOpen(false)`) closes it.
|
|
296
|
+
*
|
|
297
|
+
* `shots` are picture URLs per frame (`frames` names the tabs; it defaults to the shots' frames);
|
|
298
|
+
* `alsoChanged` = shared files the job changed anyway.
|
|
299
|
+
*/
|
|
300
|
+
export function ReviewDetail({ title, head, of, onPrev, onNext, frames, active, onTab, view, onFlip, onFit, reply, shots, alsoChanged, agent, when, more, onMore, onMoreOpen, onGood, onLater, onOpenThread, style, draftKey }: {
|
|
301
|
+
title: string
|
|
302
|
+
/** beside the title: the Review | Capture switch */
|
|
303
|
+
head?: ReactNode
|
|
304
|
+
of?: [number, number]
|
|
305
|
+
onPrev?: () => void
|
|
306
|
+
onNext?: () => void
|
|
307
|
+
frames?: string[]
|
|
308
|
+
active: number
|
|
309
|
+
onTab(i: number): void
|
|
310
|
+
view: 'both' | 'before' | 'after'
|
|
311
|
+
onFlip(view: 'both' | 'before' | 'after'): void
|
|
312
|
+
/** the panel width the pictures need (0.26.1): both at once, as big as the panel's height allows; undefined: the default */
|
|
313
|
+
onFit?(width: number | undefined): void
|
|
314
|
+
reply: ReactNode
|
|
315
|
+
/** `new`: a frame the run made - nothing before it */
|
|
316
|
+
shots: { frame: string; before?: string; after?: string; new?: boolean }[]
|
|
317
|
+
alsoChanged?: string[]
|
|
318
|
+
agent?: string
|
|
319
|
+
when?: string
|
|
320
|
+
more?: boolean
|
|
321
|
+
onMore(text: string): void
|
|
322
|
+
onMoreOpen(open: boolean): void
|
|
323
|
+
onGood(): void
|
|
324
|
+
onLater(): void
|
|
325
|
+
onOpenThread?: () => void
|
|
326
|
+
/** the card the More work words belong to (kept across the panel closing) */
|
|
327
|
+
draftKey?: string
|
|
328
|
+
style?: CSSProperties
|
|
329
|
+
}) {
|
|
330
|
+
const names = frames ?? shots.map((s) => s.frame)
|
|
331
|
+
const shot = shots[active] ?? shots.find((s) => s.frame === names[active])
|
|
332
|
+
const isNew = (f: string) => !!shots.find((s) => s.frame === f)?.new
|
|
333
|
+
// the frame's shape, from its pictures as they load (After's, else Before's): taller than wide (or square) side by
|
|
334
|
+
// side, wider than tall stacked - and the panel as wide as that needs (0.26.1, the owner's first real session)
|
|
335
|
+
const [sizes, setSizes] = useState<Record<string, number>>({})
|
|
336
|
+
const sized = (url?: string) => (url ? (w: number, h: number) => { if (w > 0 && h > 0) setSizes((m) => (m[url] === w / h ? m : { ...m, [url]: w / h })) } : undefined)
|
|
337
|
+
const aspect = (shot?.after && sizes[shot.after]) || (shot?.before && sizes[shot.before]) || undefined
|
|
338
|
+
// both slots whenever the frame has a before at all (either may read "No picture") - a missing After never hides a Before
|
|
339
|
+
const both = view === 'both' && !!shot && !shot.new && !!(shot.before || shot.after)
|
|
340
|
+
const side = (aspect ?? 1.6) <= 1.1
|
|
341
|
+
const big = useRef<HTMLDivElement>(null)
|
|
342
|
+
useLayoutEffect(() => {
|
|
343
|
+
const el = big.current
|
|
344
|
+
if (!el || !onFit) return
|
|
345
|
+
// no picture of this one measured yet (loading, or none loads): the default width - never the last tab's
|
|
346
|
+
if (!aspect) { onFit(undefined); return }
|
|
347
|
+
const ask = () => {
|
|
348
|
+
const panel = el.closest('.jm-panel') as HTMLElement | null
|
|
349
|
+
if (!panel) return
|
|
350
|
+
// the chrome around the pictures: the panel's width minus the well's; the well's height is what they get
|
|
351
|
+
const chrome = panel.getBoundingClientRect().width - el.getBoundingClientRect().width
|
|
352
|
+
const h = el.getBoundingClientRect().height - 20 // the well's padding
|
|
353
|
+
const CAP = 18, GAP = 10
|
|
354
|
+
let well: number
|
|
355
|
+
if (both && side) well = 2 * (h - CAP) * aspect + GAP // side by side: each the whole height
|
|
356
|
+
else if (both) well = ((h - GAP - 2 * CAP) / 2) * aspect // stacked: each half of it
|
|
357
|
+
else well = h * aspect // one picture
|
|
358
|
+
const want = Math.round(chrome + well + 20)
|
|
359
|
+
onFit(Math.round(want / 8) * 8)
|
|
360
|
+
}
|
|
361
|
+
ask()
|
|
362
|
+
const ro = new ResizeObserver(ask)
|
|
363
|
+
ro.observe(el)
|
|
364
|
+
return () => ro.disconnect()
|
|
365
|
+
}, [aspect, both, side, onFit])
|
|
366
|
+
const label = (f: string) => f.split('/').pop() ?? f
|
|
367
|
+
// the More work words outlive the panel: a click elsewhere closes it, and the words wait for its return -
|
|
368
|
+
// they go only when sent, or when you leave the composer yourself (Esc)
|
|
369
|
+
const [text, setTextState] = useState(() => (draftKey ? moreDrafts.get(draftKey) ?? '' : ''))
|
|
370
|
+
const setText = (t: string) => { setTextState(t); if (draftKey) { if (t) moreDrafts.set(draftKey, t); else moreDrafts.delete(draftKey) } }
|
|
371
|
+
const field = useRef<HTMLTextAreaElement>(null)
|
|
372
|
+
useEffect(() => { if (draftKey && moreDrafts.get(draftKey) && !more) onMoreOpen(true) }, []) // back with words waiting: the composer is open
|
|
373
|
+
// left on purpose (Esc cleared its words from the map): the composer's words go too; closed by a click
|
|
374
|
+
// elsewhere, the map still holds them
|
|
375
|
+
useEffect(() => { if (more) field.current?.focus(); else if (draftKey && !moreDrafts.has(draftKey)) setTextState('') }, [more])
|
|
376
|
+
const send = () => { if (text.trim()) onMore(text.trim()) }
|
|
377
|
+
return (
|
|
378
|
+
<div className="jm-panel jm-review" data-jam-review="" style={style}>
|
|
379
|
+
<div className="top">
|
|
380
|
+
<JamStateIcon state="review" />
|
|
381
|
+
<Tip side="bottom" label={<span className="jm-tip-title">{title}</span>} only={cutShort}><h3>{title}</h3></Tip>
|
|
382
|
+
{head}
|
|
383
|
+
<Walk of={of} onPrev={onPrev} onNext={onNext} />
|
|
384
|
+
</div>
|
|
385
|
+
<Meta items={[...names.map((f) => <span key={f} className="jm-flink"><FrameRectIcon size={11} />{label(f)}</span>), ...(agent ? [agent] : []), ...(when ? [when] : [])]} />
|
|
386
|
+
<div className="jm-reply">
|
|
387
|
+
<Marver size={20} />
|
|
388
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, minWidth: 0 }}>
|
|
389
|
+
<p>{reply}</p>
|
|
390
|
+
{onOpenThread && <button className="jm-link" onClick={onOpenThread}>Open thread</button>}
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
{names.length > 0 && (
|
|
394
|
+
<div className="jm-fbar">
|
|
395
|
+
{names.length > 1
|
|
396
|
+
? <div className="jm-ftabs" role="tablist">{names.map((f, i) => <button key={f} role="tab" aria-selected={i === active} className={i === active ? 'on' : undefined} onClick={() => onTab(i)}><FrameRectIcon size={12} />{label(f)}{isNew(f) && <span className="jm-newtag">New</span>}</button>)}</div>
|
|
397
|
+
: <span className="jm-framehd"><FrameRectIcon size={12} />{label(names[0])}{isNew(names[0]) && <span className="jm-newtag">New</span>}</span>}
|
|
398
|
+
<span className="sp" />
|
|
399
|
+
{/* a frame the run made has nothing before it: no switch */}
|
|
400
|
+
{shot?.new ? <span className="dim" data-jam-new="">New frame</span> : (
|
|
401
|
+
<Tip side="bottom" label={<span>Both / Before / After<kbd style={{ marginLeft: 8 }}>B</kbd></span>}>
|
|
402
|
+
<div className="jm-ftabs" data-jam-flip="">{(['both', 'before', 'after'] as const).map((v) => <button key={v} className={v === view ? 'on' : undefined} aria-pressed={v === view} onClick={() => onFlip(v)}>{v === 'both' ? 'Both' : v === 'before' ? 'Before' : 'After'}</button>)}</div>
|
|
403
|
+
</Tip>
|
|
404
|
+
)}
|
|
405
|
+
</div>
|
|
406
|
+
)}
|
|
407
|
+
<div ref={big} className={`jm-big${both ? ` pair ${side ? 'side' : 'stack'}` : ''}`} data-jam-pair={both ? (side ? 'side' : 'stack') : 'one'}>
|
|
408
|
+
{both
|
|
409
|
+
? <><Shot key={`b-${shot!.before ?? 'none'}`} url={shot!.before} cap="Before" alt={`${label(names[active] ?? '')} before`} onSize={sized(shot!.before)} /><Shot key={`a-${shot!.after ?? 'none'}`} url={shot!.after} cap="After" alt={`${label(names[active] ?? '')} after`} onSize={sized(shot!.after)} /></>
|
|
410
|
+
: <Shot url={view === 'before' && !shot?.new ? shot?.before : shot?.after} alt={`${label(names[active] ?? '')} ${shot?.new ? 'new' : view}`}
|
|
411
|
+
onSize={sized(view === 'before' && !shot?.new ? shot?.before : shot?.after)} />}
|
|
412
|
+
</div>
|
|
413
|
+
{alsoChanged && alsoChanged.length > 0 && (
|
|
414
|
+
<div className="jm-file"><FileCodeIcon size={14} /><span>Also changed {alsoChanged.map((f, i) => <span key={f}>{i > 0 && ', '}<code>{f.split('/').pop()}</code></span>)}</span></div>
|
|
415
|
+
)}
|
|
416
|
+
<div className="rule" />
|
|
417
|
+
{more ? (
|
|
418
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 7 }}>
|
|
419
|
+
<div className="jm-more">
|
|
420
|
+
<span className="at">@marver</span>
|
|
421
|
+
<textarea ref={field} className="txt" rows={1} value={text} placeholder="What else should change?"
|
|
422
|
+
onChange={(e) => setText(e.target.value)}
|
|
423
|
+
onKeyDown={(e) => {
|
|
424
|
+
e.stopPropagation()
|
|
425
|
+
if (e.key === 'Escape') { e.preventDefault(); setText(''); onMoreOpen(false) }
|
|
426
|
+
else if (e.key === 'Enter' && !e.shiftKey && !(e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) { e.preventDefault(); send() }
|
|
427
|
+
}} />
|
|
428
|
+
<button className="jm-send" disabled={!text.trim()} onClick={send}>Send <kbd>⏎</kbd></button>
|
|
429
|
+
</div>
|
|
430
|
+
<span className="dim" style={{ paddingLeft: 4 }}>Back to the agent, next in line - the tile keeps its place · esc to cancel</span>
|
|
431
|
+
</div>
|
|
432
|
+
) : (
|
|
433
|
+
<div className="actions">
|
|
434
|
+
<button className="jm-btn primary" onClick={onGood}>Looks good <kbd>⏎</kbd></button>
|
|
435
|
+
<button className="jm-btn" onClick={() => onMoreOpen(true)}>More work <kbd>⇧⏎</kbd></button>
|
|
436
|
+
<button className="jm-btn ghost" onClick={onLater}>Later <kbd>→</kbd></button>
|
|
437
|
+
<span className="sp" /><kbd>esc</kbd>
|
|
438
|
+
</div>
|
|
439
|
+
)}
|
|
440
|
+
</div>
|
|
441
|
+
)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// ---- notes --------------------------------------------------------------------------------------------
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* The notes card (v9): opened by the capture tile's Note button (or N), floating one lane up over the
|
|
448
|
+
* tile (the shell positions it with `style`). The notes added so far, each with its time in the
|
|
449
|
+
* capture, then a field for the next one. ⏎ calls `onAdd` (the shell adds the note step at that
|
|
450
|
+
* moment and clears `draft`); esc calls `onClose`. The field swallows its keys so no Jam key fires
|
|
451
|
+
* while you type (E, S, L and I type letters). The capture keeps recording throughout.
|
|
452
|
+
*/
|
|
453
|
+
export function NotesCard({ notes, draft, onDraft, onAdd, onClose, style }: {
|
|
454
|
+
notes: { t: string; text: string }[]
|
|
455
|
+
draft: string
|
|
456
|
+
onDraft(text: string): void
|
|
457
|
+
onAdd(): void
|
|
458
|
+
onClose(): void
|
|
459
|
+
style?: CSSProperties
|
|
460
|
+
}) {
|
|
461
|
+
const field = useRef<HTMLTextAreaElement>(null)
|
|
462
|
+
useEffect(() => { field.current?.focus() }, [])
|
|
463
|
+
return (
|
|
464
|
+
<div className="jm-panel jm-notes" data-jam-notes="" style={style}>
|
|
465
|
+
<div className="top"><PencilSimpleIcon size={14} style={{ color: 'var(--glass-ink-3)' }} /><h3>Notes</h3><span className="dim">in the timeline</span></div>
|
|
466
|
+
{notes.length > 0 && <div className="jm-notelist">{notes.map((n, i) => <div key={i}><span className="ts">{n.t}</span><span>{n.text}</span></div>)}</div>}
|
|
467
|
+
<textarea ref={field} className="jm-notefield" rows={2} value={draft} placeholder="Write a note…"
|
|
468
|
+
onChange={(e) => onDraft(e.target.value)}
|
|
469
|
+
onKeyDown={(e) => {
|
|
470
|
+
e.stopPropagation()
|
|
471
|
+
if ((e.nativeEvent as unknown as { isComposing?: boolean }).isComposing) return
|
|
472
|
+
if (e.key === 'Escape') { e.preventDefault(); onClose() }
|
|
473
|
+
else if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); if (draft.trim()) onAdd() }
|
|
474
|
+
}} />
|
|
475
|
+
<div className="foot"><span>⏎ add</span><span>esc close</span></div>
|
|
476
|
+
</div>
|
|
477
|
+
)
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/** The words, streaming above the capture tile (spec 27 Part 4): the earlier ones dim, the newest in ink;
|
|
481
|
+
* a dropped phrase reads "[words lost]". */
|
|
482
|
+
export const Caption = ({ old, live, style }: { old?: string; live?: string; style?: CSSProperties }) => (
|
|
483
|
+
<div className="jm-caption" data-jam-caption="" style={style}>
|
|
484
|
+
<span className="jm-bars"><i /><i /><i /><i /></span>
|
|
485
|
+
<span>{old && <span className="old">{old} </span>}{live}</span>
|
|
486
|
+
</div>
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
/** The one question words need (first `S` on a canvas), then the model's download if it is missing:
|
|
490
|
+
* a header that says what is happening, a line on why, then what the model is (trial 3: "Words on this
|
|
491
|
+
* Mac" said neither). */
|
|
492
|
+
export function VoiceAsk({ step, mb, progress, error, onYes, onNo, onDownload, style }: {
|
|
493
|
+
step: 'ask' | 'download' | 'downloading' | 'checking' | 'failed' | 'unavailable'
|
|
494
|
+
mb: number
|
|
495
|
+
progress?: number
|
|
496
|
+
error?: string
|
|
497
|
+
onYes(): void; onNo(): void; onDownload(): void
|
|
498
|
+
style?: CSSProperties
|
|
499
|
+
}) {
|
|
500
|
+
const pct = Math.round((progress ?? 0) * 100)
|
|
501
|
+
const title = {
|
|
502
|
+
ask: 'Say it instead of typing?',
|
|
503
|
+
download: 'Add voice to Jam',
|
|
504
|
+
downloading: 'Downloading the voice model',
|
|
505
|
+
checking: 'Almost ready',
|
|
506
|
+
failed: 'The download stopped',
|
|
507
|
+
unavailable: 'Voice is not available here',
|
|
508
|
+
}[step]
|
|
509
|
+
return (
|
|
510
|
+
<div className="jm-panel jm-voiceask" data-jam-voiceask={step} style={style}>
|
|
511
|
+
<div className="top"><MicrophoneIcon size={14} style={{ color: 'var(--jm-rec)' }} /><h3>{title}</h3></div>
|
|
512
|
+
{step === 'ask' && <p className="dim">While a capture records, what you say becomes words in it - transcribed on this Mac. The audio is never kept or sent anywhere.</p>}
|
|
513
|
+
{step === 'download' && <>
|
|
514
|
+
<p className="lead">Jam needs a speech-to-text model to turn what you say into words in each capture.</p>
|
|
515
|
+
<p className="dim">It is NVIDIA's Parakeet v3: small, fast and accurate, and it runs on this Mac, so your audio never leaves it. One {mb}{'\u00a0'}MB download, shared by every canvas.</p>
|
|
516
|
+
</>}
|
|
517
|
+
{step === 'downloading' && <p className="dim">{pct}% of {mb}{'\u00a0'}MB. Keep going: this capture records as usual, and your words start with the next one.</p>}
|
|
518
|
+
{step === 'checking' && <p className="dim">Checking the download, then voice is on.</p>}
|
|
519
|
+
{step === 'failed' && <p className="dim">{error ?? 'Unknown error'}. Try again, or keep going with typed notes.</p>}
|
|
520
|
+
{step === 'unavailable' && <p className="dim">{error ?? 'The speech engine could not start. Captures keep typed notes.'}</p>}
|
|
521
|
+
{step === 'downloading' && <div className="jm-progress"><i style={{ width: `${pct}%` }} /></div>}
|
|
522
|
+
{step === 'checking' && <div className="jm-progress busy"><i /></div>}
|
|
523
|
+
<div className="actions">
|
|
524
|
+
<span className="sp" />
|
|
525
|
+
{step === 'ask' && <><button className="jm-btn ghost" onClick={onNo}>Not now</button><button className="jm-btn primary" onClick={onYes}>Use the microphone</button></>}
|
|
526
|
+
{(step === 'download' || step === 'failed') && <><button className="jm-btn ghost" onClick={onNo}>Not now</button><button className="jm-btn primary" onClick={onDownload}>{step === 'failed' ? 'Try again' : `Download ${mb} MB`}</button></>}
|
|
527
|
+
{step === 'unavailable' && <><button className="jm-btn ghost" onClick={onNo}>Typed notes only</button><button className="jm-btn primary" onClick={onYes}>Try again</button></>}
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
)
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// ---- in a thread, and on the canvas ---------------------------------------------------------------
|
|
534
|
+
|
|
535
|
+
/** A capture's comment in its thread (round 3): labelled as a capture - a teal waveform, "Capture"
|
|
536
|
+
* with its short id and facts - then its words. Where its card stands is the status icon in the
|
|
537
|
+
* message header, not here. */
|
|
538
|
+
export const CaptureBlock = ({ id, facts, words }: { id: string; facts?: string; words: ReactNode }) => {
|
|
539
|
+
// its name, once it has one (yours, or the one a small model gave it) - else "Capture" and its short id
|
|
540
|
+
const name = useJamQueue((s) => s.cards?.find((c) => c.id === id)?.name)
|
|
541
|
+
return (
|
|
542
|
+
<span className="jm-capcm" data-capture={id}>
|
|
543
|
+
<span className="hd"><WaveformIcon size={13} /><span>{name ?? `Capture ${id.replace(/^cap-\d+-/, '')}`}</span>{facts && <span className="dim">· {facts}</span>}</span>
|
|
544
|
+
<span className="w">{words}</span>
|
|
545
|
+
</span>
|
|
546
|
+
)
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/** The thin teal ring round the canvas edge (or the play stage) while a capture records. */
|
|
550
|
+
export const EdgeRing = ({ style }: { style?: CSSProperties }) => <div className="jm-edge" data-jam-edge="" style={style} />
|
|
551
|
+
|
|
552
|
+
/** A capture's numbered point: `pick` (filled teal), `click` (teal ring), `hover` (dashed, no
|
|
553
|
+
* number). Screen-constant inside a world (it scales by --sh-inv). */
|
|
554
|
+
export const CapturePoint = ({ x, y, n, type = 'pick' }: { x: number; y: number; n?: number; type?: 'pick' | 'click' | 'hover' }) => (
|
|
555
|
+
<span className={`jm-pt ${type}`} style={{ left: x, top: y }}>{type === 'hover' ? null : n}</span>
|
|
556
|
+
)
|