Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.
TypeScript ai-meeting-assistantai-notetakerelectrongranola-alternativelinuxllama-cpplocal-ailocal-firstmacosmcpmeeting-minutesmeeting-notesoffline-firstopen-sourceprivacyspeech-to-texttranscriptionwhisperwhisper-cppwindows
Ask: a cited sentence is a soft highlight that opens its source on hover; one citing several meetings gets a tab for each
Eric Brownroutc73969942f50
diff --git a/app/e2e/askContext.spec.ts b/app/e2e/askContext.spec.tsindex ad25c9b6..9051a466 100644--- a/app/e2e/askContext.spec.ts+++ b/app/e2e/askContext.spec.ts@@ -26,6 +26,8 @@ test('Ask shares meeting history and drafts, and Command-J starts the right contawait input.press('Enter')await expect(page.getByTestId('chat-turn')).toHaveAttribute('data-status', 'done', { timeout: 15_000 })await expect(page.locator('.chat-answer-scope')).toHaveText('Searched Design review')+ // This path reads the whole meeting and does not yet emit numbered sources.+ await expect(page.getByTestId('source-citation')).toHaveCount(0)await expect(page.getByTestId('ask-scope')).toHaveCount(1)await expect(page.getByTestId('ask-thread-context')).toHaveCount(0)await input.fill('Keep this question for later')@@ -90,6 +92,11 @@ test('the note panel and full conversation expose Rename and a single Delete conawait expect(card).toBeVisible()const popup = await card.boundingBox()expect(popup).not.toBeNull()+ const bounds = await page.getByTestId('chat-panel').boundingBox()+ expect(popup!.x).toBeGreaterThanOrEqual(bounds!.x + 11)+ expect(popup!.y).toBeGreaterThanOrEqual(bounds!.y + 11)+ expect(popup!.x + popup!.width).toBeLessThanOrEqual(bounds!.x + bounds!.width - 11)+ expect(popup!.y + popup!.height).toBeLessThanOrEqual(bounds!.y + bounds!.height - 11)// Travel diagonally through the gap into the card, then leave both surfaces.await page.mouse.move(popup!.x + popup!.width - 20, popup!.y + popup!.height / 2, { steps: 12 })await expect(card).toBeVisible()diff --git a/app/e2e/libraryChat.spec.ts b/app/e2e/libraryChat.spec.tsindex be215fe9..387d0bf1 100644--- a/app/e2e/libraryChat.spec.ts+++ b/app/e2e/libraryChat.spec.ts@@ -36,9 +36,9 @@ test('asking across meetings from Chat: the answer streams in with sources thatawait expect(page.getByTestId('chat-page-answer').locator('.fw').first()).toBeVisible()await expect(turn).toHaveAttribute('data-status', 'done', { timeout: 15_000 })await expect(page.getByTestId('chat-page-answer')).toContainText('Pricing call')- // Meeting pills reveal the supporting quote without leaving the answer.+ // The cited sentence reveals its supporting quote without leaving the answer.const chip = page.getByTestId('source-citation').first()- await expect(chip).toHaveText('Pricing call')+ await expect(chip).toHaveText('In Pricing call, it was discussed.')await expect(chip).toHaveAccessibleName(/Pricing call/)await chip.hover()await expect(page.getByTestId('citation-excerpt')).toContainText('How much would fifty seats be?')@@ -68,7 +68,7 @@ test('asking across meetings from Chat: the answer streams in with sources thatawait expect(page.getByTestId('chat-page-turn')).toHaveAttribute('data-status', 'done')await page.reload()await expect(page.getByTestId('chat-page-answer')).toContainText('Pricing call')- await expect(page.getByTestId('source-citation').first()).toHaveText('Pricing call')+ await expect(page.getByTestId('source-citation').first()).toHaveText('In Pricing call, it was discussed.')await page.keyboard.press('Tab')await page.getByTestId('source-citation').first().focus()await expect(page.getByTestId('citation-excerpt')).toContainText('How much would fifty seats be?')@@ -111,7 +111,7 @@ test('a follow-up stays in the chat; New chat starts another; chats can be renamawait page.getByTestId('chat-page-input').press('Enter')await expect(page.getByTestId('chat-page-turn')).toHaveAttribute('data-status', 'done', { timeout: 15_000 })// The compact preview leads with the meeting and the supporting quote.- await expect(page.getByTestId('source-citation').first()).toHaveText('Pricing call')+ await expect(page.getByTestId('source-citation').first()).toHaveText('In Pricing call, it was discussed.')await expect(page.getByTestId('source-citation').first()).toHaveAccessibleName(/Pricing call/)await page.getByTestId('source-citation').first().hover()await expect(page.locator('.citation-heading')).toContainText('Pricing call')diff --git a/app/src/renderer/src/citationHover.ts b/app/src/renderer/src/citationHover.tsnew file mode 100644index 00000000..556ced99--- /dev/null+++ b/app/src/renderer/src/citationHover.ts@@ -0,0 +1,29 @@+import { motion } from './motion'++/** One exit path for plain text and another citation; the next card never keeps the previous one open. */+export function citationHover(d: {+ state: () => { open: boolean; pinned: string | null; triggerId: string | null }+ show: (id: string) => void+ close: () => void+ valid: (id: string) => boolean+ resuming: (id: string) => boolean+}) {+ let timer: ReturnType<typeof setTimeout> | undefined, last = '', warmUntil = 0+ const cancel = (cold = false) => { clearTimeout(timer); timer = undefined; if (cold) warmUntil = 0 }+ const show = (id: string) => { last = id; warmUntil = performance.now() + 1000; d.show(id) }+ return {+ cancel,+ move(id: string | null, adjacent = false) {+ cancel()+ const state = d.state()+ if (state.pinned) return+ if (state.open && state.triggerId === id) return+ if (state.open) d.close()+ if (!id) return+ if (d.resuming(id)) { d.show(id); return }+ const warm = adjacent && last && performance.now() < warmUntil+ // The warm delay outlasts the 150 ms exit, so two sources never overlap.+ timer = setTimeout(() => { timer = undefined; if (d.valid(id)) show(id) }, warm ? motion.base : 600)+ },+ }+}diff --git a/app/src/renderer/src/components/AnswerText.tsx b/app/src/renderer/src/components/AnswerText.tsxindex a6769c13..26593a9f 100644--- a/app/src/renderer/src/components/AnswerText.tsx+++ b/app/src/renderer/src/components/AnswerText.tsx@@ -3,9 +3,12 @@ import { Popover } from '@base-ui/react/popover'import type { LibrarySource } from '../../../shared/types'import type { PMNode } from '../../../shared/markdown'import { citationDoc, type CitationMark } from '../../../shared/citations'+import { citationHighlights } from '../../../shared/citationHighlights'import { t } from '../../../shared/i18n'import { dayLabel } from '../dates'+import { clock } from '../../../shared/transcript'import { SourceCitationCard } from './SourceCitation'+import { useCitationIntent } from '../useCitationIntent'import { InlineText } from './InlineText'/** The shared streamed/saved Markdown answer. Word and citation keys stay stable as the answer grows. */@@ -17,35 +20,40 @@ export function AnswerText({ md, live, sources, onSource }: {const [pinned, setPinned] = useState<string | null>(null)const suppressed = useRef<string | null>(null)const actions = useRef<Popover.Root.Actions>(null)+ const intent = useCitationIntent({ owner: id, enabled: sources.length > 0, open, pinned, triggerId, show: (next, pin) => { setTriggerId(next); setPinned(pin ? next : null); setOpen(true) }, close: () => { setPinned(null); setOpen(false) } })const doc = useMemo(() => {- const doc = citationDoc(md, sources, live)+ const doc = citationHighlights(citationDoc(md, sources, live, false))const prepare = (node: PMNode) => {// Base UI stores trigger payloads; their identity must survive popover state updates.- if (node.type === 'citation') node.attrs!.payloads = (node.attrs!.marks as CitationMark[]).map(mark => ({ source: sources.find(s => s.n === mark.source)!, sentence: String(node.attrs!.sentence ?? '') }))+ if (node.type === 'citationPassageTrigger') {+ const cited = (node.attrs!.marks as CitationMark[]).map(mark => sources.find(s => s.n === mark.source)!)+ node.attrs!.payload = { source: cited[0], sources: cited, sentence: String(node.attrs!.sentence ?? '') }+ }node.content?.forEach(prepare)}prepare(doc)return doc}, [md, sources, live])useLayoutEffect(() => {- // A later streamed citation can replace the pill that owns the current preview.+ // A later streamed citation can replace the highlight that owns the current preview.if (triggerId && !document.getElementById(triggerId)) {setPinned(null)if (open) actions.current?.close()else { actions.current?.unmount(); setTriggerId(null) }}}, [doc, open, triggerId])- const ctx: Ctx = { live, at: { n: 0 }, id, sources, pinned, focus: (element) => {+ const ctx: Ctx = { intent, live, at: { n: 0 }, id, sources, pinned, focus: (element) => {if (!element.matches(':focus-visible')) returnif (suppressed.current === element.id) { suppressed.current = null; return }- setPinned(null); setTriggerId(element.id); setOpen(true)+ intent.focus(element)}, blur: () => { suppressed.current = null },dismiss: element => {if (!open || triggerId !== element.id) return false- setPinned(null); setOpen(false)+ intent.cancel(true); setPinned(null); setOpen(false)return true} }- return <Popover.Root<{ source: LibrarySource; sentence: string }> actionsRef={actions} open={open} triggerId={triggerId} onOpenChange={(next, details) => {+ return <Popover.Root<{ source: LibrarySource; sources?: LibrarySource[]; sentence: string }> actionsRef={actions} open={open} triggerId={triggerId} onOpenChange={(next, details) => {+ if (!next) intent.cancel(details.reason === 'escape-key')const trigger = triggerId ? document.getElementById(triggerId) : nullconst popup = document.getElementById(trigger?.getAttribute('aria-controls') ?? '')const focused = open && (trigger === document.activeElement || !!popup?.contains(document.activeElement))@@ -68,32 +76,31 @@ export function AnswerText({ md, live, sources, onSource }: {setOpen(next)}}>{({ payload }) => { ctx.at.n = 0; return <>{(doc.content ?? []).map(n => render(n, ctx))}- {payload && <SourceCitationCard key={triggerId} source={payload.source} sentence={payload.sentence} triggerId={triggerId} animate onOpen={(match, atMs) => { setPinned(null); setOpen(false); onSource(atMs == null ? payload.source : { ...payload.source, atMs }, match) }} />}+ {payload && <SourceCitationCard key={triggerId} source={payload.source} additionalSources={payload.sources?.slice(1)} sentence={payload.sentence} triggerId={triggerId} open={open} animate onOpen={(match, source, atMs) => { setPinned(null); setOpen(false); onSource(atMs == null ? source : { ...source, atMs }, match) }} />}</> }}</Popover.Root>}-type Ctx = { live: boolean; at: { n: number }; id: string; sources: LibrarySource[]; pinned: string | null; focus: (element: HTMLElement) => void; blur: () => void; dismiss: (element: HTMLElement) => boolean }+type Ctx = { intent: ReturnType<typeof useCitationIntent>; live: boolean; at: { n: number }; id: string; sources: LibrarySource[]; pinned: string | null; focus: (element: HTMLElement) => void; blur: () => void; dismiss: (element: HTMLElement) => boolean }function render(node: PMNode, c: Ctx): ReactNode {const key = `${node.type}-${c.at.n}`- if (node.type === 'citation') {- c.at.n += Number(node.attrs?.length ?? 0)- if (!(node.attrs!.marks as CitationMark[]).length) return null- return <span className="citation-group" data-gap={node.attrs!.gap || undefined} data-single={(node.attrs!.marks as CitationMark[]).length === 1 || undefined} key={key}>{(node.attrs!.marks as CitationMark[]).map((mark, i) => {- const source = c.sources.find(s => s.n === mark.source)!- const title = source.title || t('Untitled')- const id = `${c.id}-${key}-${mark.source}`- return <Popover.Trigger key={mark.source} id={id} payload={(node.attrs!.payloads as Array<{ source: LibrarySource; sentence: string }>)[i]} openOnHover delay={120} closeDelay={180} aria-pressed={c.pinned === id}- className="source-citation" data-testid="source-citation" data-meeting={source.meetingId} data-at={source.atMs ?? undefined}- aria-label={`${title} · ${dayLabel(source.startedAt)}`} onFocus={e => c.focus(e.currentTarget)} onBlur={c.blur} onKeyDown={e => {- // Consume Escape before the containing note panel handles it.- if (e.key === 'Escape' && c.dismiss(e.currentTarget)) { e.preventDefault(); e.stopPropagation() }- }}>- <span className="source-name">{title}</span>- </Popover.Trigger>- })}</span>+ if (node.type === 'citationPassageTrigger') {+ const payload = node.attrs!.payload as { source: LibrarySource; sources: LibrarySource[]; sentence: string }+ const id = `${c.id}-${key}-passage`+ const kids = (node.content ?? []).map(n => render(n, c))+ return <Popover.Trigger key={key} id={id} render={<span />} nativeButton={false} payload={payload}+ className="citation-passage" data-intent-owner={c.id} data-testid="source-citation" data-sources={payload.sources.map(s => s.meetingId).join(',')} aria-pressed={c.pinned === id}+ aria-label={`${payload.sentence} ${payload.sources.map(s => t('Open {source}', { source: `${s.title || t('Untitled')} · ${s.atMs !== null ? clock(s.atMs) + ' · ' : ''}${dayLabel(s.startedAt)}` })).join('; ')}`}+ onFocus={e => c.focus(e.currentTarget)} onBlur={c.blur}+ onClick={e => { e.preventBaseUIHandler(); c.intent.activate(e.currentTarget, e.detail === 0) }}+ onKeyDown={e => {+ if (e.key === 'Escape' && c.dismiss(e.currentTarget)) { e.preventBaseUIHandler(); e.preventDefault(); e.stopPropagation() }+ if (e.key === 'Enter' || e.key === ' ') { e.preventBaseUIHandler(); e.preventDefault(); if (!e.repeat) c.intent.activate(e.currentTarget, true) }+ }} onKeyUp={e => { if (e.key === ' ') { e.preventBaseUIHandler(); e.preventDefault() } }}>++ {kids}+ </Popover.Trigger>}- if (node.type === 'citationAnchor') return <span key={key} className="citation-anchor">{node.content!.map(n => render(n, c))}</span>if (node.type === 'text') {const text = node.text ?? ''const out = words(text, c.at.n, c.live)diff --git a/app/src/renderer/src/components/SourceCitation.tsx b/app/src/renderer/src/components/SourceCitation.tsxindex 8162c823..879ea247 100644--- a/app/src/renderer/src/components/SourceCitation.tsx+++ b/app/src/renderer/src/components/SourceCitation.tsx@@ -1,22 +1,31 @@-import { useId, useLayoutEffect, useRef, type CSSProperties } from 'react'+import { useId, useLayoutEffect, useRef, useState, type CSSProperties } from 'react'import { Popover } from '@base-ui/react/popover'import { ArrowUpRight } from 'lucide-react'import type { LibrarySource } from '../../../shared/types'import { language, t } from '../../../shared/i18n'-import { surfaceMotion, useReducedMotion } from '../motion'+import { motion, surfaceMotion, useReducedMotion } from '../motion'+import { clock } from '../../../shared/transcript'import { citationCardPassage } from '../../../shared/citationCard'/** Only the decorative mass is filtered. The excerpt is the retrieved text, never generated by the answer. */-export function SourceCitationCard({ source, sentence, triggerId, animate, onOpen }: {- source: LibrarySource; sentence: string; triggerId: string | null; animate: boolean; onOpen: (match: string, atMs?: number) => void+export function SourceCitationCard({ source, sentence, triggerId, open, animate, onOpen, additionalSources = [] }: {+ source: LibrarySource; sentence: string; triggerId: string | null; open: boolean; animate: boolean; additionalSources?: LibrarySource[]; onOpen: (match: string, source: LibrarySource, atMs?: number) => void}) {const filterId = useId().replace(/:/g, ''), popup = useRef<HTMLDivElement>(null)- const preview = citationCardPassage(source, sentence)const reduced = useReducedMotion()const anchor = triggerId ? document.getElementById(triggerId) : null- const title = source.title || t('Untitled')- const date = new Date(source.startedAt)- const fullDate = date.toLocaleDateString(language(), { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' })+ const boundary = anchor?.closest('[data-citation-boundary], .ask-thread, .note-reading-frame') ?? anchor?.closest('.chat-panel')+ const sources = [source, ...additionalSources]+ const [selected, setSelected] = useState(0), tabsId = useId()+ // Keep every cited source reachable without growing the strip past three tabs.+ const groups = sources.length > 3 ? [[sources[0]], [sources[1]], sources.slice(2)] : sources.map(item => [item])+ const active = Math.min(selected, groups.length - 1)+ const sameMeeting = sources.every(item => item.meetingId === source.meetingId)+ const select = (index: number) => {+ setSelected(index)+ popup.current?.querySelectorAll('.citation-tab-panel').forEach(panel => { panel.scrollTop = 0 })+ }+ const title = sources.map(s => s.title || t('Untitled')).join(', ')useLayoutEffect(() => {if (!animate || reduced) returnlet timer = 0@@ -34,23 +43,44 @@ export function SourceCitationCard({ source, sentence, triggerId, animate, onOpe})return () => { cancelAnimationFrame(frame); clearTimeout(timer); if (popup.current) delete popup.current.dataset.morph }}, [anchor, animate, reduced])+ const renderSource = (item: LibrarySource, index: number, showTitle = true) => {+ const preview = citationCardPassage(item, sentence), title = item.title || t('Untitled'), date = new Date(item.startedAt)+ return <section className="citation-source" data-source={item.meetingId} key={`${item.n}-${index}`}>+ <div className="citation-heading">{showTitle && <><h3 className="citation-title" title={title}>{title}</h3><span aria-hidden="true">·</span></>}<time className="citation-date" dateTime={date.toISOString()} title={date.toLocaleDateString(language(), { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' })}>{date.toLocaleDateString(language(), { month: 'short', day: 'numeric' })}</time>+ {item.atMs !== null && <><span aria-hidden="true">·</span><time className="citation-moment">{clock(preview.match.atMs ?? item.atMs)}</time></>}+ </div>+ {preview.match.text && <blockquote className="citation-quote" data-testid="citation-excerpt" dir="auto"><q>{preview.before.text && <span className="citation-context">{preview.before.text} </span>}<span className="citation-match">{preview.match.text}</span>{preview.after.text && <span className="citation-context"> {preview.after.text}</span>}</q></blockquote>}+ <div className="citation-footer"><button className="ghost-btn" data-testid="citation-open" aria-label={t('Open {source}', { source: title })} onClick={() => onOpen(preview.match.text, item, preview.match.atMs)}>{item.atMs !== null ? t('Open in transcript') : t('Open note')}<ArrowUpRight size={12} aria-hidden="true" /></button></div>+ </section>+ }return <Popover.Portal container={anchor?.closest('dialog') ?? undefined}>- <Popover.Positioner side="top" align="center" sideOffset={8} collisionPadding={12} positionMethod="fixed" className="citation-positioner">- <Popover.Popup ref={popup} className="citation-card" data-testid="citation-card" data-animate={animate && !reduced} initialFocus={false} finalFocus={false} aria-label={title}>+ <Popover.Positioner side="top" align="center" sideOffset={8} collisionBoundary={boundary ?? undefined} collisionPadding={12} collisionAvoidance={{ side: 'flip', align: 'shift', fallbackAxisSide: 'none' }} positionMethod="fixed" className="citation-positioner">+ <Popover.Popup ref={popup} className="citation-card" data-testid="citation-card" data-closing={!open} style={{ '--citation-exit': `${motion.askExit}ms` } as CSSProperties} data-animate={animate && !reduced} initialFocus={false} finalFocus={false} aria-label={title}><svg width="0" height="0" className="citation-filter" aria-hidden="true"><defs><filter id={filterId} x="-50%" y="-50%" width="200%" height="200%" colorInterpolationFilters="sRGB"><feGaussianBlur in="SourceGraphic" stdDeviation="2.4" /><feColorMatrix type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -8.5" /></filter></defs></svg><div className="citation-liquid" style={{ '--citation-filter': `url(#${filterId})` } as CSSProperties} aria-hidden="true"><div className="citation-mass" /></div><div className="citation-edge" aria-hidden="true" />- <div className="citation-content">- <div className="citation-heading">- <Popover.Title className="citation-title" title={title}>{title}</Popover.Title>- <span aria-hidden="true">·</span><time className="citation-date" dateTime={date.toISOString()} title={fullDate}>{date.toLocaleDateString(language(), { month: 'short', day: 'numeric' })}</time>- </div>- {preview.match.text && <blockquote className="citation-quote" data-testid="citation-excerpt" dir="auto"><q>{preview.before.text && <span className="citation-context">{preview.before.text} </span>}<span className="citation-match">{preview.match.text}</span>{preview.after.text && <span className="citation-context"> {preview.after.text}</span>}</q></blockquote>}- <div className="citation-footer">- <button className="ghost-btn" data-testid="citation-open" aria-label={t('Open {source}', { source: title })} onClick={() => onOpen(preview.match.text, preview.match.atMs)}>{t('Open')}<ArrowUpRight size={12} aria-hidden="true" /></button>- </div>+ <div className="citation-content" data-tabbed={sources.length > 1}>+ {sources.length === 1 ? renderSource(source, 0) : <>+ <div className="citation-tabs" role="tablist" aria-label={title}>+ {groups.map((group, index) => {+ const item = group[0], fullName = group.map(s => s.title || t('Untitled')).join(', ')+ const moment = sameMeeting && item.atMs !== null ? clock(citationCardPassage(item, sentence).match.atMs ?? item.atMs) : null+ const label = group.length > 1 ? `+${group.length}` : moment ?? fullName+ const name = group.length > 1 ? `${t('{count} more', { count: group.length })} · ${fullName}` : moment ? `${fullName} · ${moment}` : fullName+ return <button key={index} type="button" role="tab" id={`${tabsId}-tab-${index}`} aria-controls={`${tabsId}-panel-${index}`} aria-selected={active === index} tabIndex={active === index ? 0 : -1} title={name} aria-label={name} data-overflow={group.length > 1} onClick={() => select(index)} onKeyDown={event => {+ const direction = document.documentElement.dir === 'rtl' ? -1 : 1+ const next = event.key === 'Home' ? 0 : event.key === 'End' ? groups.length - 1 : event.key === 'ArrowRight' ? (index + direction + groups.length) % groups.length : event.key === 'ArrowLeft' ? (index - direction + groups.length) % groups.length : -1+ if (next < 0) return+ event.preventDefault(); select(next); document.getElementById(`${tabsId}-tab-${next}`)?.focus()+ }}>{label}</button>+ })}+ </div>+ <div className="citation-tab-panels">{groups.map((group, index) => <div key={index} role="tabpanel" id={`${tabsId}-panel-${index}`} aria-labelledby={`${tabsId}-tab-${index}`} aria-hidden={active !== index} inert={active !== index} data-current={active === index} className="citation-tab-panel">+ {group.map((item, sourceIndex) => renderSource(item, sourceIndex, sameMeeting || group.length > 1))}+ </div>)}</div>+ </>}</div></Popover.Popup></Popover.Positioner>diff --git a/app/src/renderer/src/useCitationIntent.ts b/app/src/renderer/src/useCitationIntent.tsnew file mode 100644index 00000000..a55a0cb6--- /dev/null+++ b/app/src/renderer/src/useCitationIntent.ts@@ -0,0 +1,111 @@+import { useEffect, useRef } from 'react'+import { citationHover } from './citationHover'++export function selectionIn(element: HTMLElement) {+ const selection = element.ownerDocument.getSelection()+ if (!selection || selection.isCollapsed) return false+ for (let i = 0; i < selection.rangeCount; i++) if (selection.getRangeAt(i).intersectsNode(element)) return true+ return false+}++type Options = { owner: string; enabled: boolean; open: boolean; pinned: string | null; triggerId: string | null; show: (id: string, pin: boolean) => void; close: () => void }+/** Hover intent never takes precedence over selection, a press, scrolling or a pinned card. */+export function useCitationIntent(options: Options) {+ const current = useRef(options); current.current = options+ const state = useRef({ popup: null as HTMLElement | null, candidate: null as HTMLElement | null, buttons: 0, scrollUntil: 0, suppressed: '', press: null as { x: number; y: number; moved: boolean } | null })+ const hover = useRef<ReturnType<typeof citationHover> | null>(null)+ const cancel = (suppress = false) => {+ const s = state.current+ hover.current?.cancel(suppress)+ if (suppress) s.suppressed = current.current.triggerId ?? ''+ }+ const reveal = (element: HTMLElement, pin: boolean) => {+ cancel()+ current.current.show(element.id, pin)+ }+ const activate = (element: HTMLElement, keyboard = false) => {+ const s = state.current+ if (selectionIn(element) || !keyboard && s.press?.moved) { cancel(); return }+ s.press = null+ if (current.current.open && current.current.pinned === element.id) { cancel(true); current.current.close() }+ else reveal(element, true)+ }+ const focus = (element: HTMLElement) => {+ if (selectionIn(element) || state.current.buttons) return+ cancel(); current.current.show(element.id, false)+ }+ useEffect(() => {+ if (!options.enabled) return+ const s = state.current+ const passage = (target: EventTarget | null) => {+ const e = target instanceof Element ? target.closest<HTMLElement>('.citation-passage') : null+ return e?.dataset.intentOwner === options.owner ? e : null+ }+ const popup = () => {+ const trigger = document.getElementById(current.current.triggerId ?? '')+ const element = document.getElementById(trigger?.getAttribute('aria-controls') ?? '')+ if (element) s.popup = element+ return s.popup?.isConnected ? s.popup : null+ }+ const focused = () => {+ const active = document.activeElement+ return !!active && (popup()?.contains(active) || active.id === current.current.triggerId && active.matches(':focus-visible'))+ }+ const closeHover = () => { if (current.current.open && !current.current.pinned) { popup(); current.current.close() } }+ const valid = (element: HTMLElement) => !s.buttons && performance.now() >= s.scrollUntil && !selectionIn(element) && s.suppressed !== element.id+ hover.current = citationHover({+ state: () => current.current,+ show: id => current.current.show(id, false),+ close: closeHover,+ valid: id => { const e = document.getElementById(id); return !!e && valid(e) && e.matches(':hover') && !current.current.pinned },+ resuming: id => current.current.triggerId === id && !!popup() && !current.current.open,+ })+ const leave = () => { s.candidate = null; if (!focused()) hover.current?.move(null) }+ const move = (event: PointerEvent) => {+ if (event.pointerType === 'touch') return+ if (s.press && event.buttons && Math.hypot(event.clientX - s.press.x, event.clientY - s.press.y) > 3) s.press.moved = true+ s.buttons = event.buttons+ if (event.buttons) { cancel(); return }+ if (event.target instanceof Node && popup()?.contains(event.target)) {+ cancel()+ const trigger = document.getElementById(current.current.triggerId ?? '')+ if (!current.current.open && trigger && valid(trigger)) current.current.show(trigger.id, false)+ return+ }+ const element = passage(event.target)+ if (!element) { s.suppressed = ''; leave(); return }+ if (s.candidate !== element) { s.suppressed = s.suppressed === element.id ? s.suppressed : ''; s.candidate = element }+ cancel()+ if (current.current.pinned || focused() || !valid(element)) return+ const peers = [...document.querySelectorAll<HTMLElement>('.citation-passage')].filter(e => e.dataset.intentOwner === options.owner)+ const previous = peers.findIndex(e => e.id === current.current.triggerId), next = peers.indexOf(element)+ hover.current?.move(element.id, previous >= 0 && Math.abs(previous - next) === 1)+ }+ const down = (event: PointerEvent) => {+ s.buttons = event.buttons; s.press = passage(event.target) ? { x: event.clientX, y: event.clientY, moved: false } : null+ cancel(); if (!(event.target instanceof Node && popup()?.contains(event.target))) closeHover()+ }+ const up = () => { s.buttons = 0 }+ const pointerCancel = () => { s.buttons = 0; if (s.press) s.press.moved = true; cancel() }+ const scroll = (event: Event) => {+ s.scrollUntil = performance.now() + 250; hover.current?.cancel(true)+ if (!(event.target instanceof Node && popup()?.contains(event.target))) closeHover()+ }+ const selection = () => {+ const active = document.getElementById(current.current.triggerId ?? '')+ if (s.candidate && selectionIn(s.candidate) || active && selectionIn(active)) { hover.current?.cancel(true); if (current.current.open) current.current.close() }+ }+ const outside = (event: PointerEvent) => { if (!event.relatedTarget) { s.suppressed = ''; leave() } }+ document.addEventListener('pointermove', move, true); document.addEventListener('pointerdown', down, true)+ document.addEventListener('pointerup', up, true); document.addEventListener('pointercancel', pointerCancel, true)+ document.addEventListener('pointerout', outside, true); document.addEventListener('scroll', scroll, true)+ document.addEventListener('wheel', scroll, { capture: true, passive: true }); document.addEventListener('selectionchange', selection)+ return () => {+ cancel(); document.removeEventListener('pointermove', move, true); document.removeEventListener('pointerdown', down, true)+ document.removeEventListener('pointerup', up, true); document.removeEventListener('pointercancel', pointerCancel, true)+ document.removeEventListener('pointerout', outside, true); document.removeEventListener('scroll', scroll, true)+ document.removeEventListener('wheel', scroll, true); document.removeEventListener('selectionchange', selection)+ }+ }, [options.owner, options.enabled])+ return { activate, focus, cancel }+}diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.cssindex c95e144e..5fa850fb 100644--- a/app/src/renderer/src/workspace.css+++ b/app/src/renderer/src/workspace.css@@ -273,35 +273,45 @@.app-toast-title { min-width:0;flex:1;font-size:13px;line-height:19px;font-weight:500; }.app-toast button:focus-visible { outline:2px solid var(--focus);outline-offset:2px; }-/* Meeting source pills, with only the preview surface joining through goo. */-.citation-anchor { white-space:nowrap; }-.citation-group { display:inline-flex;align-items:baseline;gap:4px;position:relative;vertical-align:baseline;line-height:1;margin-inline:2px 0;white-space:nowrap; }-/* The folder-chip shape fits inside the answer line; its invisible target stays 24px high. */-.source-citation { display:inline-flex;align-items:center;justify-content:center;position:relative;height:18px;max-width:180px;padding:0 7px;border:1px solid var(--line);border-radius:999px;background:var(--card);color:var(--written);font-size:13px;font-weight:400;line-height:16px;letter-spacing:0; }-.source-name { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }-.source-citation::before { content:"";position:absolute;top:50%;left:50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%); }-.citation-anchor:has(.citation-group:not([data-single])) { white-space:normal; }-.citation-group:not([data-single]) { display:inline;white-space:normal; }-/* Focus guards may sit between triggers; their insertion must not change the gap. */-.citation-group:not([data-single]) .source-citation~.source-citation { margin-inline-start:4px; }-.source-citation:hover,.source-citation[aria-expanded=true] { background:var(--accent-soft);border-color:color-mix(in srgb,var(--accent) 20%,var(--line));color:var(--ink); }-.source-citation:focus-visible { outline:2px solid var(--focus);outline-offset:1px; }+/* The cited passage remains selectable text and keeps the same line boxes in every state. */+.citation-passage { display:inline;color:inherit;font:inherit;letter-spacing:inherit;text-align:inherit;white-space:normal;padding:1px 0;margin-inline:2px;border-radius:3px;box-decoration-break:clone;-webkit-box-decoration-break:clone;text-decoration-line:underline;text-decoration-style:dotted;text-decoration-color:color-mix(in srgb,var(--accent) 60%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;text-decoration-skip-ink:auto;transition:background-color var(--dur-micro) ease,text-decoration-color var(--dur-micro) ease; }+.citation-passage,.citation-passage * { user-select:text;-webkit-user-select:text;cursor:text; }+.citation-passage:is(:hover,:focus-visible,[aria-expanded=true]) { background:var(--accent-soft);text-decoration-color:var(--accent); }+.citation-passage:focus-visible { outline:2px solid var(--focus);outline-offset:1px; }.citation-positioner { z-index:100; }.citation-positioner[data-anchor-hidden] { visibility:hidden;pointer-events:none; }-.citation-card { position:relative;isolation:isolate;width:fit-content;min-width:min(280px,calc(100vw - 24px));max-width:min(400px,calc(100vw - 24px));color:var(--ink);text-align:start;font-size:14px;line-height:1.5;letter-spacing:-.012em;transition:opacity 160ms ease-out;outline:none; }+/* Keep the fading surface reachable so pointer return can reverse its exit. */+.citation-card { pointer-events:auto;position:relative;isolation:isolate;width:fit-content;min-width:min(280px,var(--available-width));max-width:min(400px,var(--available-width));max-height:var(--available-height);color:var(--ink);text-align:start;font-size:14px;line-height:1.5;letter-spacing:-.012em;transition:opacity var(--dur-base) var(--ease-out);outline:none; }.citation-card[data-animate=false] { transition:none; }-.citation-card[data-ending-style] { opacity:0; }+.citation-card[data-closing=true] { opacity:0;transition-duration:var(--citation-exit);transition-timing-function:ease-in; }+.citation-card[data-closing=false] { opacity:1; }.citation-filter { position:absolute;pointer-events:none; }-.citation-liquid,.citation-edge { position:absolute;inset:0;z-index:-1;pointer-events:none; }+.citation-liquid,.citation-edge { position:absolute;inset:0;z-index:-1;pointer-events:none;transform-origin:var(--transform-origin);transition:transform var(--dur-base) var(--ease-out); }+.citation-card[data-closing=true] :is(.citation-liquid,.citation-edge) { transform:scale(.98);transition-duration:var(--citation-exit);transition-timing-function:ease-in; }.citation-mass { position:absolute;inset:0;border-radius:12px;background:var(--float);transform-origin:0 0; }.citation-edge { border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-soft); }-.citation-content { padding:12px 14px; }-.citation-heading { display:flex;align-items:baseline;justify-content:flex-start;gap:6px;min-width:0;color:var(--muted);font-size:12px;line-height:18px; }-.citation-title { flex:0 1 auto;min-width:0;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0;color:var(--muted);font-size:12px;line-height:18px;font-weight:400; }+.citation-content { padding:14px 16px;max-height:var(--available-height);overflow:auto;clip-path:inset(0 round 12px); }+/* Source tabs share the quote card's available height, including the overflow group. */+.citation-content[data-tabbed=true] { display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden; }+.citation-tabs { display:flex;gap:2px;padding:2px;background:var(--control);border-radius:6px;margin-bottom:12px;min-width:0; }+.citation-tabs button { flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:5px 7px;border-radius:4px;font-size:12px;line-height:18px;color:var(--muted);font-weight:600; }+.citation-tabs button[aria-selected=true] { color:var(--ink);background:var(--float);box-shadow:var(--shadow-soft); }+.citation-tabs button[data-overflow=true] { flex:0 0 38px; }+.citation-tabs button:focus-visible { outline:2px solid var(--focus);outline-offset:1px; }+.citation-tab-panels { display:grid;min-height:0;overflow:hidden; }+.citation-tab-panel { grid-area:1/1;min-width:0;min-height:0;overflow:auto;scrollbar-gutter:stable;opacity:0;visibility:hidden;pointer-events:none;transition:opacity var(--dur-micro) var(--ease-out),visibility 0s linear var(--dur-micro); }+.citation-tab-panel[data-current=true] { opacity:1;visibility:visible;pointer-events:auto;transition-delay:0s; }+@media (prefers-reduced-motion:reduce) { .citation-tab-panel { transition:none; } }+.citation-source+.citation-source { border-top:1px solid var(--line);padding-top:12px;margin-top:12px; }+.citation-moment { white-space:nowrap;font-size:12px;font-variant-numeric:tabular-nums; }+.citation-heading { display:flex;align-items:baseline;justify-content:flex-start;gap:5px;min-width:0;color:var(--muted);font-size:12px;line-height:18px; }+.citation-title { flex:0 1 auto;min-width:0;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0;color:var(--ink);font-size:13px;line-height:18px;font-weight:600; }.citation-date { flex:none;font-size:12px;line-height:18px;white-space:nowrap; }-.citation-quote { margin:8px 0;color:var(--ink);font-size:14px;line-height:21px;font-weight:400;letter-spacing:0;overflow-wrap:anywhere;max-height:min(320px,calc(100vh - 160px));overflow:auto; }-.citation-context { color:var(--written); }-.citation-footer { display:flex;align-items:center;justify-content:flex-end;margin:4px 0 0;font-size:11px;color:var(--muted); }+.citation-quote { margin:10px 0 8px;color:var(--ink);font-size:14px;line-height:21px;font-weight:400;letter-spacing:0;overflow-wrap:anywhere; }+.citation-context { color:var(--muted);font-weight:400; }+.citation-match { color:var(--ink);font-weight:500; }+.citation-footer { display:flex;align-items:center;justify-content:flex-end;margin:12px 0 0;font-size:12px;color:var(--muted); }+.citation-footer .ghost-btn { font-size:12px; }.citation-card[data-morph=true] .citation-liquid { filter:var(--citation-filter); }.citation-card[data-morph=true] .citation-mass { animation:citation-pull 280ms linear both; }.citation-card[data-morph=true] .citation-content { animation:citation-in 130ms ease-out 90ms both,citation-crop 280ms linear backwards; }@@ -318,7 +328,7 @@72% { clip-path:inset(-2px .8% calc(2px - 1.8%) 0 round 14px);animation-timing-function:cubic-bezier(.2,0,.25,1); }100% { clip-path:inset(0 round 12px); }}-@media(prefers-reduced-motion:reduce) { .citation-card { transition:none; }.citation-card * { animation:none!important; }.citation-liquid { filter:none!important; } }+@media(prefers-reduced-motion:reduce) { .citation-card,.citation-liquid,.citation-edge,.citation-passage { transition:none; }.citation-card[data-closing=true] :is(.citation-liquid,.citation-edge) { transform:none; }.citation-card * { animation:none!important; }.citation-liquid { filter:none!important; } }::highlight(citation-target) { background:color-mix(in srgb,var(--accent-soft) 70%,transparent); }[data-focused] { background:color-mix(in srgb,var(--accent-soft) 70%,transparent); }@container (max-width:700px) { .native-home { grid-template-columns:minmax(0,1fr) 235px; }.native-library { padding:24px 18px; }.native-agenda { padding-block:25px;--agenda-inset:15px; }.meeting-description strong { font-size:13px; }.meeting-meta { font-size:10px; } }diff --git a/app/src/shared/citationHighlights.ts b/app/src/shared/citationHighlights.tsnew file mode 100644index 00000000..004a9593--- /dev/null+++ b/app/src/shared/citationHighlights.ts@@ -0,0 +1,29 @@+import type { PMNode } from './markdown'++/** Wrap only the exact sentence attached to a citation, preserving inline formatting. */+export function citationHighlights(node: PMNode): PMNode {+ if (!node.content) return node+ const children = node.content.map(citationHighlights)+ if (node.type !== 'paragraph' && node.type !== 'heading') return { ...node, content: children }+ const flat = children.flatMap(n => n.type === 'citationAnchor' ? n.content ?? [] : [n])+ const out: PMNode[] = []+ for (const n of flat) {+ if (n.type !== 'citation') { out.push(n); continue }+ const sentence = String(n.attrs?.sentence ?? '')+ if (!sentence || !(n.attrs?.marks as unknown[])?.length) continue+ const tail: PMNode[] = []+ for (let i = out.length - 1; i >= 0 && out[i].type === 'text'; i--) tail.unshift(out[i])+ // Never attach a source to a guessed or partial text range.+ if (!tail.map(t => t.text ?? '').join('').endsWith(sentence)) continue+ let remaining = sentence.length+ const content: PMNode[] = []+ while (remaining) {+ const text = out.pop()!, value = text.text ?? '', take = Math.min(remaining, value.length)+ content.unshift({ ...text, text: value.slice(value.length - take) })+ if (take < value.length) out.push({ ...text, text: value.slice(0, -take) })+ remaining -= take+ }+ out.push({ type: 'citationPassageTrigger', attrs: { ...n.attrs }, content })+ }+ return { ...node, content: out }+}diff --git a/app/src/shared/citations.ts b/app/src/shared/citations.tsindex bc1fe9bb..c9b0f51c 100644--- a/app/src/shared/citations.ts+++ b/app/src/shared/citations.ts@@ -110,7 +110,7 @@ function placeCitations(nodes: PMNode[], pending: boolean, meetings?: Map<number}/** Keep passage IDs intact; each paragraph retains its last supporting mark per meeting. */-export function citationDoc(answer: string, sources: Array<{ n: number; meetingId: string }>, live = false): PMNode {+export function citationDoc(answer: string, sources: Array<{ n: number; meetingId: string }>, live = false, collapseParagraph = true): PMNode {const text = tidyCitations(live ? answer.replace(/\[[\d,\s]*$/, '') : answer, sources)const doc = mdToDoc(text.replace(/\n{2,}/g, '\n'), { streaming: live })const meetingOf = new Map(sources.map(s => [s.n, s.meetingId]))@@ -121,7 +121,7 @@ export function citationDoc(answer: string, sources: Array<{ n: number; meetingIif (node.type !== 'text') {if (!node.content) return [node]const content = node.content.flatMap(transform)- return [{ ...node, content: node.type === 'paragraph' || node.type === 'heading' ? placeCitations(content, node === pending, node.type === 'paragraph' ? meetingOf : undefined) : content }]+ return [{ ...node, content: node.type === 'paragraph' || node.type === 'heading' ? placeCitations(content, node === pending, node.type === 'paragraph' && collapseParagraph ? meetingOf : undefined) : content }]}const text = node.text ?? '', parts: PMNode[] = []let last = 0diff --git a/app/src/shared/locales/ar.json b/app/src/shared/locales/ar.jsonindex 01554593..37f59eeb 100644--- a/app/src/shared/locales/ar.json+++ b/app/src/shared/locales/ar.json@@ -1,4 +1,6 @@{+ "Open in transcript": "فتح في النص المفرّغ",+ "Open note": "فتح الملاحظة","Other people": "أشخاص آخرون","No events": "لا أحداث","Go to {date}": "انتقل إلى {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "لا توجد اجتماعات مطابقة مع {name} في {date}.","Meetings with {name}": "اجتماعات مع {name}","Hide checklist": "إخفاء قائمة التحقق",- "Open": "فتح","Next day": "اليوم التالي","Previous day": "اليوم السابق","Yogurt couldn't update the calendar link. Try again.": "تعذّر على Yogurt تحديث رابط التقويم. حاول مرة أخرى.",diff --git a/app/src/shared/locales/bn.json b/app/src/shared/locales/bn.jsonindex 3b6c1fa8..89d1aca1 100644--- a/app/src/shared/locales/bn.json+++ b/app/src/shared/locales/bn.json@@ -1,4 +1,6 @@{+ "Open in transcript": "ট্রান্সক্রিপ্টে খুলুন",+ "Open note": "নোট খুলুন","Other people": "অন্যান্য ব্যক্তি","No events": "কোনো ইভেন্ট নেই","Go to {date}": "{date} তারিখে যান",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "{date} তারিখে {name}-এর সঙ্গে মিলে যাওয়া কোনো মিটিং নেই।","Meetings with {name}": "{name}-এর সঙ্গে মিটিং","Hide checklist": "চেকলিস্ট লুকান",- "Open": "খুলুন","Next day": "পরের দিন","Previous day": "আগের দিন","Yogurt couldn't update the calendar link. Try again.": "Yogurt ক্যালেন্ডারের লিংক আপডেট করতে পারেনি। আবার চেষ্টা করুন।",diff --git a/app/src/shared/locales/cs.json b/app/src/shared/locales/cs.jsonindex 9326568c..d4726f85 100644--- a/app/src/shared/locales/cs.json+++ b/app/src/shared/locales/cs.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Otevřít v přepisu",+ "Open note": "Otevřít poznámku","Other people": "Ostatní lidé","No events": "Žádné události","Go to {date}": "Přejít na {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Žádné odpovídající schůzky s {name} dne {date}.","Meetings with {name}": "Schůzky s {name}","Hide checklist": "Skrýt kontrolní seznam",- "Open": "Otevřít","Next day": "Další den","Previous day": "Předchozí den","Yogurt couldn't update the calendar link. Try again.": "Yogurt nemohl aktualizovat propojení s kalendářem. Zkuste to znovu.",diff --git a/app/src/shared/locales/da.json b/app/src/shared/locales/da.jsonindex 4d0c3d11..3c3483a8 100644--- a/app/src/shared/locales/da.json+++ b/app/src/shared/locales/da.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Åbn i transskriptionen",+ "Open note": "Åbn note","Other people": "Andre personer","No events": "Ingen begivenheder","Go to {date}": "Gå til {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Ingen matchende møder med {name} den {date}.","Meetings with {name}": "Møder med {name}","Hide checklist": "Skjul tjekliste",- "Open": "Åbn","Next day": "Næste dag","Previous day": "Forrige dag","Yogurt couldn't update the calendar link. Try again.": "Yogurt kunne ikke opdatere koblingen til kalenderen. Prøv igen.",diff --git a/app/src/shared/locales/de.json b/app/src/shared/locales/de.jsonindex 4f435c03..d2ba475b 100644--- a/app/src/shared/locales/de.json+++ b/app/src/shared/locales/de.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Im Transkript öffnen",+ "Open note": "Notiz öffnen","Other people": "Weitere Personen","No events": "Keine Termine","Go to {date}": "Zum {date} springen",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Keine passenden Besprechungen mit {name} am {date}.","Meetings with {name}": "Besprechungen mit {name}","Hide checklist": "Checkliste ausblenden",- "Open": "Öffnen","Next day": "Nächster Tag","Previous day": "Vorheriger Tag","Yogurt couldn't update the calendar link. Try again.": "Yogurt konnte die Kalenderverknüpfung nicht aktualisieren. Versuch es noch einmal.",diff --git a/app/src/shared/locales/el.json b/app/src/shared/locales/el.jsonindex 8b63b443..d576b9f5 100644--- a/app/src/shared/locales/el.json+++ b/app/src/shared/locales/el.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Άνοιγμα στην απομαγνητοφώνηση",+ "Open note": "Άνοιγμα σημείωσης","Other people": "Άλλα άτομα","No events": "Κανένα συμβάν","Go to {date}": "Μετάβαση στις {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Δεν βρέθηκαν συναντήσεις που να ταιριάζουν με {name} στις {date}.","Meetings with {name}": "Συναντήσεις με {name}","Hide checklist": "Απόκρυψη λίστας ελέγχου",- "Open": "Άνοιγμα","Next day": "Επόμενη ημέρα","Previous day": "Προηγούμενη ημέρα","Yogurt couldn't update the calendar link. Try again.": "Το Yogurt δεν μπόρεσε να ενημερώσει τη σύνδεση με το ημερολόγιο. Δοκιμάστε ξανά.",diff --git a/app/src/shared/locales/en.json b/app/src/shared/locales/en.jsonindex b5ed3d64..cb1664ef 100644--- a/app/src/shared/locales/en.json+++ b/app/src/shared/locales/en.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Open in transcript",+ "Open note": "Open note","Other people": "Other people","Reading the transcript…": "Reading the transcript…","No events": "No events",diff --git a/app/src/shared/locales/es.json b/app/src/shared/locales/es.jsonindex a2c7b090..99b51cdc 100644--- a/app/src/shared/locales/es.json+++ b/app/src/shared/locales/es.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Abrir en la transcripción",+ "Open note": "Abrir nota","Other people": "Otras personas","No events": "No hay eventos","Go to {date}": "Ir al {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "No hay reuniones coincidentes con {name} el {date}.","Meetings with {name}": "Reuniones con {name}","Hide checklist": "Ocultar lista de verificación",- "Open": "Abrir","Next day": "Día siguiente","Previous day": "Día anterior","Yogurt couldn't update the calendar link. Try again.": "Yogurt no pudo actualizar el vínculo con el calendario. Inténtalo de nuevo.",diff --git a/app/src/shared/locales/fi.json b/app/src/shared/locales/fi.jsonindex a4c56b47..676b5787 100644--- a/app/src/shared/locales/fi.json+++ b/app/src/shared/locales/fi.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Avaa litteroinnissa",+ "Open note": "Avaa muistiinpano","Other people": "Muut henkilöt","No events": "Ei tapahtumia","Go to {date}": "Siirry päivään {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Ei vastaavia kokouksia henkilön {name} kanssa päivänä {date}.","Meetings with {name}": "Kokoukset henkilön {name} kanssa","Hide checklist": "Piilota tarkistuslista",- "Open": "Avaa","Next day": "Seuraava päivä","Previous day": "Edellinen päivä","Yogurt couldn't update the calendar link. Try again.": "Yogurt ei voinut päivittää kalenterilinkkiä. Yritä uudelleen.",diff --git a/app/src/shared/locales/fil.json b/app/src/shared/locales/fil.jsonindex 10096177..0ba4e21f 100644--- a/app/src/shared/locales/fil.json+++ b/app/src/shared/locales/fil.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Buksan sa transcript",+ "Open note": "Buksan ang tala","Other people": "Iba pang tao","No events": "Walang event","Go to {date}": "Pumunta sa {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Walang tumutugmang pulong kasama si {name} sa {date}.","Meetings with {name}": "Mga pulong kasama si {name}","Hide checklist": "Itago ang checklist",- "Open": "Buksan","Next day": "Susunod na araw","Previous day": "Nakaraang araw","Yogurt couldn't update the calendar link. Try again.": "Hindi ma-update ng Yogurt ang link sa calendar. Subukan ulit.",diff --git a/app/src/shared/locales/fr.json b/app/src/shared/locales/fr.jsonindex b49a1eb2..8c25d599 100644--- a/app/src/shared/locales/fr.json+++ b/app/src/shared/locales/fr.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Ouvrir dans la transcription",+ "Open note": "Ouvrir la note","Other people": "Autres personnes","No events": "Aucun événement","Go to {date}": "Aller au {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Aucune réunion correspondante avec {name} le {date}.","Meetings with {name}": "Réunions avec {name}","Hide checklist": "Masquer la liste de contrôle",- "Open": "Ouvrir","Next day": "Jour suivant","Previous day": "Jour précédent","Yogurt couldn't update the calendar link. Try again.": "Yogurt n’a pas pu mettre à jour le lien avec le calendrier. Réessayez.",diff --git a/app/src/shared/locales/he.json b/app/src/shared/locales/he.jsonindex cb7acc50..d5d68561 100644--- a/app/src/shared/locales/he.json+++ b/app/src/shared/locales/he.json@@ -1,4 +1,6 @@{+ "Open in transcript": "פתיחה בתמלול",+ "Open note": "פתיחת ההערה","Other people": "אנשים אחרים","No events": "אין אירועים","Go to {date}": "מעבר אל {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "אין פגישות תואמות עם {name} בתאריך {date}.","Meetings with {name}": "פגישות עם {name}","Hide checklist": "הסתרת רשימת הבדיקה",- "Open": "פתיחה","Next day": "היום הבא","Previous day": "היום הקודם","Yogurt couldn't update the calendar link. Try again.": "Yogurt לא הצליח לעדכן את הקישור ליומן. כדאי לנסות שוב.",diff --git a/app/src/shared/locales/hi.json b/app/src/shared/locales/hi.jsonindex bea56657..481d07a2 100644--- a/app/src/shared/locales/hi.json+++ b/app/src/shared/locales/hi.json@@ -1,4 +1,6 @@{+ "Open in transcript": "ट्रांसक्रिप्ट में खोलें",+ "Open note": "नोट खोलें","Other people": "अन्य लोग","No events": "कोई इवेंट नहीं","Go to {date}": "{date} पर जाएँ",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "{date} को {name} के साथ कोई मेल खाती मीटिंग नहीं मिली।","Meetings with {name}": "{name} के साथ मीटिंग","Hide checklist": "चेकलिस्ट छिपाएँ",- "Open": "खोलें","Next day": "अगला दिन","Previous day": "पिछला दिन","Yogurt couldn't update the calendar link. Try again.": "Yogurt कैलेंडर लिंक अपडेट नहीं कर सका। फिर से कोशिश करें।",diff --git a/app/src/shared/locales/hu.json b/app/src/shared/locales/hu.jsonindex 74c9fc9f..05f45d3d 100644--- a/app/src/shared/locales/hu.json+++ b/app/src/shared/locales/hu.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Megnyitás az átiratban",+ "Open note": "Jegyzet megnyitása","Other people": "Más résztvevők","No events": "Nincs esemény","Go to {date}": "Ugrás erre a napra: {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Nincs megfelelő megbeszélés vele: {name}, ekkor: {date}.","Meetings with {name}": "Megbeszélések vele: {name}","Hide checklist": "Ellenőrzőlista elrejtése",- "Open": "Megnyitás","Next day": "Következő nap","Previous day": "Előző nap","Yogurt couldn't update the calendar link. Try again.": "A Yogurt nem tudta frissíteni a naptárkapcsolatot. Próbáld újra.",diff --git a/app/src/shared/locales/id.json b/app/src/shared/locales/id.jsonindex 75380c55..4cdde089 100644--- a/app/src/shared/locales/id.json+++ b/app/src/shared/locales/id.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Buka di transkrip",+ "Open note": "Buka catatan","Other people": "Orang lain","No events": "Tidak ada acara","Go to {date}": "Buka tanggal {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Tidak ada rapat yang cocok dengan {name} pada {date}.","Meetings with {name}": "Rapat dengan {name}","Hide checklist": "Sembunyikan daftar periksa",- "Open": "Buka","Next day": "Hari berikutnya","Previous day": "Hari sebelumnya","Yogurt couldn't update the calendar link. Try again.": "Yogurt tidak bisa memperbarui tautan kalender. Coba lagi.",diff --git a/app/src/shared/locales/it.json b/app/src/shared/locales/it.jsonindex 0e0f7db3..e637e8a0 100644--- a/app/src/shared/locales/it.json+++ b/app/src/shared/locales/it.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Apri nella trascrizione",+ "Open note": "Apri nota","Other people": "Altre persone","No events": "Nessun evento","Go to {date}": "Vai al {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Nessuna riunione corrispondente con {name} in data {date}.","Meetings with {name}": "Riunioni con {name}","Hide checklist": "Nascondi checklist",- "Open": "Apri","Next day": "Giorno successivo","Previous day": "Giorno precedente","Yogurt couldn't update the calendar link. Try again.": "Yogurt non è riuscito ad aggiornare il collegamento al calendario. Riprova.",diff --git a/app/src/shared/locales/ja.json b/app/src/shared/locales/ja.jsonindex d7ea4362..3c56fadb 100644--- a/app/src/shared/locales/ja.json+++ b/app/src/shared/locales/ja.json@@ -1,4 +1,6 @@{+ "Open in transcript": "文字起こしで開く",+ "Open note": "ノートを開く","Other people": "その他の参加者","No events": "予定はありません","Go to {date}": "{date}に移動",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "{date}の{name}との一致する会議はありません。","Meetings with {name}": "{name} との会議","Hide checklist": "チェックリストを非表示",- "Open": "開く","Next day": "次の日","Previous day": "前の日","Yogurt couldn't update the calendar link. Try again.": "Yogurtはカレンダーとのリンクを更新できませんでした。もう一度お試しください。",diff --git a/app/src/shared/locales/ko.json b/app/src/shared/locales/ko.jsonindex 6de2491d..2dde34f5 100644--- a/app/src/shared/locales/ko.json+++ b/app/src/shared/locales/ko.json@@ -1,4 +1,6 @@{+ "Open in transcript": "대화록에서 열기",+ "Open note": "노트 열기","Other people": "기타 참석자","No events": "일정 없음","Go to {date}": "{date}로 이동",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "{date}에 {name}님과의 일치하는 회의가 없습니다.","Meetings with {name}": "{name} 님과의 회의","Hide checklist": "체크리스트 숨기기",- "Open": "열기","Next day": "다음 날","Previous day": "이전 날","Yogurt couldn't update the calendar link. Try again.": "Yogurt가 캘린더 연결을 업데이트하지 못했어요. 다시 시도하세요.",diff --git a/app/src/shared/locales/ms.json b/app/src/shared/locales/ms.jsonindex 09df7e95..ed9221ad 100644--- a/app/src/shared/locales/ms.json+++ b/app/src/shared/locales/ms.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Buka dalam transkrip",+ "Open note": "Buka nota","Other people": "Orang lain","No events": "Tiada acara","Go to {date}": "Pergi ke {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Tiada mesyuarat yang sepadan dengan {name} pada {date}.","Meetings with {name}": "Mesyuarat dengan {name}","Hide checklist": "Sembunyikan senarai semak",- "Open": "Buka","Next day": "Hari seterusnya","Previous day": "Hari sebelumnya","Yogurt couldn't update the calendar link. Try again.": "Yogurt tidak dapat mengemas kini pautan kalendar. Cuba lagi.",diff --git a/app/src/shared/locales/nb.json b/app/src/shared/locales/nb.jsonindex 17bc8b63..e4ff544a 100644--- a/app/src/shared/locales/nb.json+++ b/app/src/shared/locales/nb.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Åpne i transkripsjonen",+ "Open note": "Åpne notat","Other people": "Andre personer","No events": "Ingen hendelser","Go to {date}": "Gå til {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Ingen samsvarende møter med {name} den {date}.","Meetings with {name}": "Møter med {name}","Hide checklist": "Skjul sjekkliste",- "Open": "Åpne","Next day": "Neste dag","Previous day": "Forrige dag","Yogurt couldn't update the calendar link. Try again.": "Yogurt kunne ikke oppdatere koblingen til kalenderen. Prøv igjen.",diff --git a/app/src/shared/locales/nl.json b/app/src/shared/locales/nl.jsonindex cb62d21e..82e8e1c3 100644--- a/app/src/shared/locales/nl.json+++ b/app/src/shared/locales/nl.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Openen in transcript",+ "Open note": "Notitie openen","Other people": "Andere personen","No events": "Geen afspraken","Go to {date}": "Ga naar {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Geen overeenkomende vergaderingen met {name} op {date}.","Meetings with {name}": "Vergaderingen met {name}","Hide checklist": "Checklist verbergen",- "Open": "Openen","Next day": "Volgende dag","Previous day": "Vorige dag","Yogurt couldn't update the calendar link. Try again.": "Yogurt kon de koppeling met de agenda niet bijwerken. Probeer het opnieuw.",diff --git a/app/src/shared/locales/pl.json b/app/src/shared/locales/pl.jsonindex 4ae16f69..6a50da22 100644--- a/app/src/shared/locales/pl.json+++ b/app/src/shared/locales/pl.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Otwórz w transkrypcji",+ "Open note": "Otwórz notatkę","Other people": "Inne osoby","No events": "Brak wydarzeń","Go to {date}": "Przejdź do {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Brak pasujących spotkań z {name} w dniu {date}.","Meetings with {name}": "Spotkania z {name}","Hide checklist": "Ukryj listę kontrolną",- "Open": "Otwórz","Next day": "Następny dzień","Previous day": "Poprzedni dzień","Yogurt couldn't update the calendar link. Try again.": "Yogurt nie mógł zaktualizować połączenia z kalendarzem. Spróbuj ponownie.",diff --git a/app/src/shared/locales/pt-BR.json b/app/src/shared/locales/pt-BR.jsonindex f9e95578..81eefe12 100644--- a/app/src/shared/locales/pt-BR.json+++ b/app/src/shared/locales/pt-BR.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Abrir na transcrição",+ "Open note": "Abrir nota","Other people": "Outras pessoas","No events": "Nenhum evento","Go to {date}": "Ir para {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Nenhuma reunião correspondente com {name} em {date}.","Meetings with {name}": "Reuniões com {name}","Hide checklist": "Ocultar lista de verificação",- "Open": "Abrir","Next day": "Próximo dia","Previous day": "Dia anterior","Yogurt couldn't update the calendar link. Try again.": "O Yogurt não conseguiu atualizar o vínculo com o calendário. Tente de novo.",diff --git a/app/src/shared/locales/ro.json b/app/src/shared/locales/ro.jsonindex 70c94d58..8727a8e2 100644--- a/app/src/shared/locales/ro.json+++ b/app/src/shared/locales/ro.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Deschide în transcriere",+ "Open note": "Deschide nota","Other people": "Alte persoane","No events": "Niciun eveniment","Go to {date}": "Mergi la {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Nicio întâlnire corespunzătoare cu {name} pe {date}.","Meetings with {name}": "Întâlniri cu {name}","Hide checklist": "Ascunde lista de verificare",- "Open": "Deschide","Next day": "Ziua următoare","Previous day": "Ziua precedentă","Yogurt couldn't update the calendar link. Try again.": "Yogurt nu a putut actualiza legătura cu calendarul. Încercați din nou.",diff --git a/app/src/shared/locales/ru.json b/app/src/shared/locales/ru.jsonindex 26f9e8aa..8be35c18 100644--- a/app/src/shared/locales/ru.json+++ b/app/src/shared/locales/ru.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Открыть в расшифровке",+ "Open note": "Открыть заметку","Other people": "Другие участники","No events": "Нет событий","Go to {date}": "Перейти к {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Нет подходящих встреч с {name} на {date}.","Meetings with {name}": "Встречи с {name}","Hide checklist": "Скрыть контрольный список",- "Open": "Открыть","Next day": "Следующий день","Previous day": "Предыдущий день","Yogurt couldn't update the calendar link. Try again.": "Yogurt не смог обновить связь с календарём. Попробуйте снова.",diff --git a/app/src/shared/locales/sv.json b/app/src/shared/locales/sv.jsonindex daed5221..56ed2483 100644--- a/app/src/shared/locales/sv.json+++ b/app/src/shared/locales/sv.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Öppna i transkriptionen",+ "Open note": "Öppna anteckning","Other people": "Andra personer","No events": "Inga händelser","Go to {date}": "Gå till {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Inga matchande möten med {name} den {date}.","Meetings with {name}": "Möten med {name}","Hide checklist": "Dölj checklista",- "Open": "Öppna","Next day": "Nästa dag","Previous day": "Föregående dag","Yogurt couldn't update the calendar link. Try again.": "Yogurt kunde inte uppdatera kopplingen till kalendern. Försök igen.",diff --git a/app/src/shared/locales/th.json b/app/src/shared/locales/th.jsonindex db40c83b..50852b51 100644--- a/app/src/shared/locales/th.json+++ b/app/src/shared/locales/th.json@@ -1,4 +1,6 @@{+ "Open in transcript": "เปิดในข้อความถอดเสียง",+ "Open note": "เปิดบันทึก","Other people": "บุคคลอื่น","No events": "ไม่มีกิจกรรม","Go to {date}": "ไปที่ {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "ไม่มีการประชุมที่ตรงกันกับ {name} ในวันที่ {date}","Meetings with {name}": "การประชุมกับ {name}","Hide checklist": "ซ่อนรายการตรวจสอบ",- "Open": "เปิด","Next day": "วันถัดไป","Previous day": "วันก่อนหน้า","Yogurt couldn't update the calendar link. Try again.": "Yogurt อัปเดตลิงก์ปฏิทินไม่ได้ ลองอีกครั้ง",diff --git a/app/src/shared/locales/tr.json b/app/src/shared/locales/tr.jsonindex e9ac0115..da4cbb60 100644--- a/app/src/shared/locales/tr.json+++ b/app/src/shared/locales/tr.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Dökümde aç",+ "Open note": "Notu aç","Other people": "Diğer kişiler","No events": "Etkinlik yok","Go to {date}": "Şu tarihe git: {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "{date} tarihinde {name} ile eşleşen toplantı yok.","Meetings with {name}": "{name} ile toplantılar","Hide checklist": "Kontrol listesini gizle",- "Open": "Aç","Next day": "Sonraki gün","Previous day": "Önceki gün","Yogurt couldn't update the calendar link. Try again.": "Yogurt takvim bağlantısını güncelleyemedi. Yeniden deneyin.",diff --git a/app/src/shared/locales/uk.json b/app/src/shared/locales/uk.jsonindex 3a78a5aa..9900a57e 100644--- a/app/src/shared/locales/uk.json+++ b/app/src/shared/locales/uk.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Відкрити в транскрипції",+ "Open note": "Відкрити нотатку","Other people": "Інші учасники","No events": "Немає подій","Go to {date}": "Перейти до {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Немає відповідних зустрічей з {name} на {date}.","Meetings with {name}": "Зустрічі з {name}","Hide checklist": "Приховати контрольний список",- "Open": "Відкрити","Next day": "Наступний день","Previous day": "Попередній день","Yogurt couldn't update the calendar link. Try again.": "Yogurt не зміг оновити зв’язок із календарем. Спробуйте ще раз.",diff --git a/app/src/shared/locales/vi.json b/app/src/shared/locales/vi.jsonindex b7a323b0..bc5b42a2 100644--- a/app/src/shared/locales/vi.json+++ b/app/src/shared/locales/vi.json@@ -1,4 +1,6 @@{+ "Open in transcript": "Mở trong bản chép lời",+ "Open note": "Mở ghi chú","Other people": "Những người khác","No events": "Không có sự kiện","Go to {date}": "Đi đến {date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "Không có cuộc họp phù hợp với {name} vào {date}.","Meetings with {name}": "Cuộc họp với {name}","Hide checklist": "Ẩn danh sách kiểm tra",- "Open": "Mở","Next day": "Ngày tiếp theo","Previous day": "Ngày trước","Yogurt couldn't update the calendar link. Try again.": "Yogurt không cập nhật được liên kết lịch. Hãy thử lại.",diff --git a/app/src/shared/locales/zh-CN.json b/app/src/shared/locales/zh-CN.jsonindex 0e5686de..63bd9acc 100644--- a/app/src/shared/locales/zh-CN.json+++ b/app/src/shared/locales/zh-CN.json@@ -1,4 +1,6 @@{+ "Open in transcript": "在转录中打开",+ "Open note": "打开笔记","Other people": "其他人","No events": "没有活动","Go to {date}": "转到{date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "{date}没有与{name}的匹配会议。","Meetings with {name}": "与 {name} 的会议","Hide checklist": "隐藏检查清单",- "Open": "打开","Next day": "后一天","Previous day": "前一天","Yogurt couldn't update the calendar link. Try again.": "Yogurt 无法更新日历链接。请重试。",diff --git a/app/src/shared/locales/zh-TW.json b/app/src/shared/locales/zh-TW.jsonindex b4c15100..7fb4d4d0 100644--- a/app/src/shared/locales/zh-TW.json+++ b/app/src/shared/locales/zh-TW.json@@ -1,4 +1,6 @@{+ "Open in transcript": "在逐字稿中開啟",+ "Open note": "開啟筆記","Other people": "其他人","No events": "沒有活動","Go to {date}": "前往{date}",@@ -12,7 +14,6 @@"No matching meetings with {name} on {date}.": "{date}沒有與{name}的相符會議。","Meetings with {name}": "與 {name} 的會議","Hide checklist": "隱藏檢查清單",- "Open": "開啟","Next day": "後一天","Previous day": "前一天","Yogurt couldn't update the calendar link. Try again.": "Yogurt 無法更新行事曆連結。請再試一次。",diff --git a/app/test/citationHighlights.test.ts b/app/test/citationHighlights.test.tsnew file mode 100644index 00000000..4751b153--- /dev/null+++ b/app/test/citationHighlights.test.ts@@ -0,0 +1,21 @@+import { it } from 'vitest'+import assert from 'node:assert/strict'+import { citationDoc } from '../src/shared/citations'+import { citationHighlights } from '../src/shared/citationHighlights'+import type { PMNode } from '../src/shared/markdown'+const sources=[{n:1,meetingId:'release'},{n:2,meetingId:'planning'},{n:3,meetingId:'budget'}]+const nodes=(n:PMNode):PMNode[]=>[n,...(n.content??[]).flatMap(nodes)]+const plain=(n:PMNode):string=>n.text??(n.content??[]).map(plain).join('')+function passages(text:string){return nodes(citationHighlights(citationDoc(text,sources,false,false))).filter(n=>n.type==='citationPassageTrigger')}+it('keeps exact sentence ranges, multiple sources, formatting and unsupported text intact', () => {+assert.deepEqual(passages('An uncited opening. The pilot launches Thursday. [1] Research writes the survey. [2] Nothing was said about costs.').map(plain),['The pilot launches Thursday.','Research writes the survey.'])+const multi=passages('The survey and budget are settled. [2, 3]');assert.equal(multi.length,1);assert.deepEqual(multi[0].attrs!.marks,[{source:2,number:1},{source:3,number:2}])+assert.deepEqual(passages('**The pilot** launches Thursday. [1]').map(plain),['The pilot launches Thursday.']);assert.equal(nodes(passages('**The pilot** launches Thursday. [1]')[0]).find(n=>n.type==='text')?.marks?.[0].type,'bold')+assert.equal(passages('First statement is supported. [1] Second statement is supported. [1]').length,2)+assert.equal(nodes(citationDoc('First statement is supported. [1] Second statement is supported. [1]',sources)).filter(n=>n.type==='citation'&&(n.attrs!.marks as unknown[]).length).length,1)+assert.equal(passages('Unknown reference stays plain. [99]').length,0)+assert.equal(passages('- A cited bullet wraps over several lines. [1]\n- An unsupported bullet.').length,1)+assert.equal(passages('Use the **Thursday** release, after review [1].').length,1)+const forged:PMNode={type:'paragraph',content:[{type:'text',text:'Actual sentence.'},{type:'citation',attrs:{sentence:'Different sentence.',marks:[{source:1,number:1}]}}]};assert.equal(nodes(citationHighlights(forged)).filter(n=>n.type==='citationPassageTrigger').length,0)++})diff --git a/app/test/citationHover.test.ts b/app/test/citationHover.test.tsnew file mode 100644index 00000000..336100c1--- /dev/null+++ b/app/test/citationHover.test.ts@@ -0,0 +1,61 @@+import { afterEach, beforeEach, expect, it, vi } from 'vitest'+import { citationHover } from '../src/renderer/src/citationHover'++beforeEach(() => vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'performance'] }))+afterEach(() => vi.useRealTimers())++function fixture() {+ let state = { open: false, pinned: null as string | null, triggerId: null as string | null }, until = 0, eligible = true+ const events: Array<{ action: string; id: string | null; at: number }> = []+ const hover = citationHover({+ state: () => state,+ show: id => { state = { ...state, open: true, triggerId: id }; events.push({ action: 'show', id, at: performance.now() }) },+ close: () => { state = { ...state, open: false }; until = performance.now() + 150; events.push({ action: 'close', id: state.triggerId, at: performance.now() }) },+ valid: () => eligible && !state.pinned,+ resuming: id => id === state.triggerId && performance.now() < until,+ })+ return { hover, events, state: () => state, eligible: (value: boolean) => { eligible = value }, pin: () => { state.pinned = state.triggerId } }+}++it('waits for 600 ms at rest, restarting when the pointer moves', () => {+ const f = fixture()+ f.hover.move('a'); vi.advanceTimersByTime(599); expect(f.events).toEqual([])+ f.hover.move('a'); vi.advanceTimersByTime(599); expect(f.events).toEqual([])+ vi.advanceTimersByTime(1); expect(f.state().open).toBe(true)+})++it.each(['text', 'fast', 'slow', 'card'] as const)('starts the same immediate exit from A to %s, before considering B', sequence => {+ const f = fixture()+ f.hover.move('a'); vi.advanceTimersByTime(600)+ if (sequence === 'card') { f.hover.cancel(); vi.advanceTimersByTime(100) }+ const left = performance.now()+ f.hover.move(sequence === 'text' ? null : 'b', true)+ expect(f.events.at(-1)).toEqual({ action: 'close', id: 'a', at: left })+ expect(f.state().open).toBe(false)+ if (sequence === 'slow') { vi.advanceTimersByTime(80); f.hover.move('b', true) }+ vi.advanceTimersByTime(179); expect(f.state().open).toBe(false)+ vi.advanceTimersByTime(1)+ expect(f.state().open).toBe(sequence !== 'text')+ if (sequence !== 'text') expect(f.state().triggerId).toBe('b')+ const opened = f.events.filter(e => e.action === 'show' && e.id === 'b')[0]+ if (opened) expect(opened.at - left).toBeGreaterThanOrEqual(180)+})++it('reverses an unfinished exit immediately and keeps a pin when moving away', () => {+ const f = fixture()+ f.hover.move('a'); vi.advanceTimersByTime(600); f.hover.move(null); vi.advanceTimersByTime(70)+ f.hover.move('a'); expect(f.state().open).toBe(true)+ expect(f.events.at(-1)?.at).toBe(670)+ f.pin(); f.hover.move('b', true); vi.advanceTimersByTime(1000)+ expect(f.state()).toEqual({ open: true, pinned: 'a', triggerId: 'a' })+})++it('expires warm intent, clears it after scrolling or selection, and rechecks eligibility before opening', () => {+ const f = fixture()+ f.hover.move('a'); vi.advanceTimersByTime(600); f.hover.move(null); vi.advanceTimersByTime(1100)+ f.hover.move('b', true); vi.advanceTimersByTime(180); expect(f.state().open).toBe(false)+ vi.advanceTimersByTime(420); expect(f.state().triggerId).toBe('b')+ f.hover.cancel(true); f.hover.move('a', true); vi.advanceTimersByTime(180); expect(f.state().open).toBe(false)+ f.eligible(false); vi.advanceTimersByTime(420); expect(f.state().open).toBe(false)+ f.hover.move('a'); f.hover.cancel(); vi.advanceTimersByTime(1000); expect(f.state().open).toBe(false)+})diff --git a/app/test/citationInteraction.test.ts b/app/test/citationInteraction.test.tsindex 14096f07..2423ffa4 100644--- a/app/test/citationInteraction.test.ts+++ b/app/test/citationInteraction.test.ts@@ -1,9 +1,9 @@-import { useId, useLayoutEffect, useMemo, useRef, useState, type ReactElement } from 'react'+import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState, type ReactElement } from 'react'import { afterEach, expect, it, vi } from 'vitest'import { AnswerText } from '../src/renderer/src/components/AnswerText'import type { Popover } from '@base-ui/react/popover'-vi.mock('react', async original => ({ ...await original<typeof import('react')>(), useId: vi.fn(), useLayoutEffect: vi.fn(), useMemo: vi.fn(), useRef: vi.fn(), useState: vi.fn() }))+vi.mock('react', async original => ({ ...await original<typeof import('react')>(), useEffect: vi.fn(), useId: vi.fn(), useLayoutEffect: vi.fn(), useMemo: vi.fn(), useRef: vi.fn(), useState: vi.fn() }))afterEach(() => { vi.clearAllMocks(); vi.unstubAllGlobals() })function harness() {diff --git a/app/test/citationNavigation.test.ts b/app/test/citationNavigation.test.tsnew file mode 100644index 00000000..05d3d92f--- /dev/null+++ b/app/test/citationNavigation.test.ts@@ -0,0 +1,25 @@+import { Children, isValidElement, type ReactElement, type ReactNode } from 'react'+import { expect, it, vi } from 'vitest'+import { SourceCitationCard } from '../src/renderer/src/components/SourceCitation'+import { AUDIO_SPEAKER } from '../src/shared/audioUpload'+import type { LibrarySource } from '../src/shared/types'++vi.mock('react', async original => ({ ...await original<typeof import('react')>(), useId: () => 'card', useState: (value: unknown) => [value, vi.fn()], useRef: () => ({ current: null }), useLayoutEffect: vi.fn() }))+vi.mock('../src/renderer/src/motion', async original => ({ ...await original<typeof import('../src/renderer/src/motion')>(), useReducedMotion: () => true }))++function elements(node: ReactNode): ReactElement<Record<string, unknown>>[] {+ return Children.toArray(node).flatMap(child => isValidElement(child)+ ? [child as ReactElement<Record<string, unknown>>, ...elements((child.props as { children?: ReactNode }).children)] : [])+}++it('opens each source at the supporting uploaded-audio line, including a zero timestamp', () => {+ const sentence = 'The export is limited to forty accounts.'+ const make = (n: number, atMs: number): LibrarySource => ({ n, meetingId: `meeting-${n}`, title: 'Release review', startedAt: 1, atMs: 300000,+ excerpt: `Audio: ${sentence}`, transcript: { speakers: [], lines: [{ text: sentence, startMs: atMs, track: 'them', speaker: AUDIO_SPEAKER }] } })+ const first = make(1, 90000), second = make(2, 0), onOpen = vi.fn()+ const card = SourceCitationCard({ source: first, additionalSources: [second], sentence, triggerId: null, open: true, animate: false, onOpen })+ const buttons = elements(card).filter(e => e.props['data-testid'] === 'citation-open')+ expect(buttons).toHaveLength(2)+ for (const button of buttons) (button.props.onClick as () => void)()+ expect(onOpen.mock.calls).toEqual([[sentence, first, 90000], [sentence, second, 0]])+})diff --git a/app/test/citationTabs.test.ts b/app/test/citationTabs.test.tsnew file mode 100644index 00000000..dae7f5cc--- /dev/null+++ b/app/test/citationTabs.test.ts@@ -0,0 +1,40 @@+import { Children, isValidElement, type ReactElement, type ReactNode } from 'react'+import { describe, expect, it, vi } from 'vitest'+import { SourceCitationCard } from '../src/renderer/src/components/SourceCitation'+import type { LibrarySource } from '../src/shared/types'++vi.mock('react', async original => ({ ...await original<typeof import('react')>(), useId: () => 'card', useState: (value: unknown) => [value, vi.fn()], useRef: () => ({ current: null }), useLayoutEffect: vi.fn() }))+vi.mock('../src/renderer/src/motion', async original => ({ ...await original<typeof import('../src/renderer/src/motion')>(), useReducedMotion: () => true }))+function elements(node: ReactNode): ReactElement<Record<string, unknown>>[] {+ return Children.toArray(node).flatMap(child => isValidElement(child) ? [child as ReactElement<Record<string, unknown>>, ...elements((child.props as { children?: ReactNode }).children)] : [])+}+const source = (n: number): LibrarySource => ({ n, meetingId: `meeting-${n}`, title: `Quarterly release planning and budget review ${n}`, startedAt: 1, atMs: n * 60000, excerpt: 'The pilot will launch Thursday.' })+const render = (sources: LibrarySource[]) => elements(SourceCitationCard({ source: sources[0], additionalSources: sources.slice(1), sentence: 'The pilot will launch Thursday.', triggerId: null, open: true, animate: false, onOpen: vi.fn() }))+describe('source tabs', () => {+ it.each([1, 2, 3, 5])('keeps all %i sources with no more than three tabs', count => {+ const sources = Array.from({ length: count }, (_, i) => source(i + 1)), tree = render(sources)+ const tabs = tree.filter(e => e.props.role === 'tab'), panels = tree.filter(e => e.props.role === 'tabpanel')+ expect(tabs).toHaveLength(count === 1 ? 0 : Math.min(count, 3))+ expect(tree.filter(e => e.props['data-testid'] === 'citation-open')).toHaveLength(count)+ if (count === 1) return+ expect(tabs.map(e => e.props.tabIndex)).toEqual(count === 2 ? [0, -1] : [0, -1, -1])+ expect(panels.map(e => e.props.inert)).toEqual(count === 2 ? [false, true] : [false, true, true])+ for (const [i, tab] of tabs.entries()) {+ expect(tab.props['aria-controls']).toEqual(panels[i].props.id)+ expect(panels[i].props['aria-labelledby']).toEqual(tab.props.id)+ expect(tab.props.title).toEqual(tab.props['aria-label'])+ }+ if (count === 5) {+ expect(tabs[2].props.children).toBe('+3')+ expect(tabs[2].props['data-overflow']).toBe(true)+ expect(elements(panels[2]).filter(e => e.props['data-testid'] === 'citation-open')).toHaveLength(3)+ for (const s of sources.slice(2)) expect(tabs[2].props['aria-label']).toContain(s.title)+ } else expect(tabs.map(e => e.props['aria-label'])).toEqual(sources.map(s => s.title))+ })+ it('uses moment labels for multiple moments of the same meeting and retains its full name', () => {+ const first = source(1), second = { ...source(2), meetingId: first.meetingId, title: first.title }+ const tabs = render([first, second]).filter(e => e.props.role === 'tab')+ expect(tabs.map(e => e.props.children)).toEqual(['1:00', '2:00'])+ expect(tabs[1].props['aria-label']).toBe(`${first.title} · 2:00`)+ })+})diff --git a/app/test/i18n-tables.test.ts b/app/test/i18n-tables.test.tsindex 0ed0d6fd..0cd0aee8 100644--- a/app/test/i18n-tables.test.ts+++ b/app/test/i18n-tables.test.ts@@ -308,3 +308,13 @@ it('translates transcript match counts and navigation in every locale', () => {}}})+++it('translates both citation destinations in every locale', () => {+ for (const { id } of LOCALES) for (const key of ['Open in transcript', 'Open note']) {+ expect(keys).toContain(key)+ expect(load(id)[key]).toBeTypeOf('string')+ expect(load(id)[key]).not.toBe('')+ if (id !== 'en') expect(load(id)[key]).not.toBe(key)+ }+})