Skip to content

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.

summary writes in gooey ink; a shimmering bar waits and resolves into the first heading

Eric Brownrout6fcb081aa2d2
diff --git a/app/src/renderer/src/components/Editor.tsx b/app/src/renderer/src/components/Editor.tsx
index 5b41f65a..c6cf7e54 100644
--- a/app/src/renderer/src/components/Editor.tsx
+++ b/app/src/renderer/src/components/Editor.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useLayoutEffect, useRef } from 'react'
+import { useEffect, useId, useLayoutEffect, useRef } from 'react'
import { EditorContent, useEditor } from '@tiptap/react'
import { Mark } from '@tiptap/core'
import StarterKit from '@tiptap/starter-kit'
@@ -6,6 +6,8 @@ import Placeholder from '@tiptap/extension-placeholder'
import { docToMd, mdToDoc } from '../../../shared/markdown'
import { citationTargetIndex } from '../../../shared/citations'
import { EditorToolbar } from './EditorToolbar'
+import { inkKey, StreamingInk } from '../streamingInk'
+import { useReducedMotion } from '../motion'
/** The person's own words inside the enhanced notes: shown darker. Typing next to them is not theirs-marked. */
const Mine = Mark.create({
@@ -32,6 +34,8 @@ export function Editor(p: {
testId: string
className?: string
}) {
+ const inkId = useId()
+ const reduced = useReducedMotion()
const onChange = useRef(p.onChange)
const onBlur = useRef(p.onBlur)
onChange.current = p.onChange
@@ -49,6 +53,7 @@ export function Editor(p: {
}),
Placeholder.configure({ placeholder: p.placeholder ?? '' }),
Mine,
+ StreamingInk,
],
content: mdToDoc(p.markdown, { streaming: p.streaming }),
editable: p.editable ?? true,
@@ -71,9 +76,12 @@ export function Editor(p: {
useLayoutEffect(() => {
if (!editor || editor.isDestroyed) return
last.current = p.markdown
- if (docToMd(editor.getJSON() as Parameters<typeof docToMd>[0]) === p.markdown && !p.streaming) return
- editor.commands.setContent(mdToDoc(p.markdown, { streaming: p.streaming }), { emitUpdate: false })
- }, [editor, p.markdown, p.streaming])
+ const update = editor.chain().setMeta(inkKey, { live: !!p.streaming, reduced })
+ if (docToMd(editor.getJSON() as Parameters<typeof docToMd>[0]) !== p.markdown || p.streaming) {
+ update.setContent(mdToDoc(p.markdown, { streaming: p.streaming }), { emitUpdate: false })
+ }
+ update.run()
+ }, [editor, p.markdown, p.streaming, reduced])
useEffect(() => {
if (!editor || editor.isDestroyed || !p.focus?.match) return
@@ -95,7 +103,16 @@ export function Editor(p: {
useEffect(() => { if (editor && !editor.isDestroyed) editor.setEditable(p.editable ?? true, false) }, [editor, p.editable])
- return <><EditorContent editor={editor} />
+ return <><div className="summary-surface" data-streaming={!!p.streaming}>
+ <svg className="summary-ink-layer" aria-hidden="true">
+ <defs><filter id={inkId} x="-30%" y="-80%" width="160%" height="260%" colorInterpolationFilters="sRGB">
+ <feGaussianBlur stdDeviation=".9" /><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -8.5" />
+ </filter></defs>
+ <g className="summary-wash" />
+ </svg>
+ <EditorContent editor={editor} />
+ <i className="summary-heading-bar" aria-hidden="true" hidden />
+ </div>
{editor && p.editable !== false && !p.streaming && <EditorToolbar editor={editor} />}
</>
}
diff --git a/app/src/renderer/src/screens/Note.tsx b/app/src/renderer/src/screens/Note.tsx
index f8651523..3c9e4248 100644
--- a/app/src/renderer/src/screens/Note.tsx
+++ b/app/src/renderer/src/screens/Note.tsx
@@ -499,11 +499,10 @@ function Enhanced({ notes, disabled, onChange, onBlur, onRetry, focus }: { focus
<NotesModelWait downloading={(percent) => (
<p data-testid="note-enhanced-model-download" role="status" className="text-[15px] text-muted">{percent ? t('Yogurt is still downloading its AI model. Your notes will be ready in a few minutes. ({percent})', { percent }) : t('Yogurt is still downloading its AI model. Your notes will be ready in a few minutes.')}</p>
)}>
- <div data-testid="note-enhanced-waiting" aria-live="polite">
- <p className="writing-label mb-5 text-[15px] text-muted">{status === 'writing' && notes.part ? t('Reading a long meeting, part {part} of {of}…', { part: notes.part.part, of: notes.part.of }) : t('Generating notes…')}</p>
- <div className="flex flex-col gap-3" aria-hidden="true">
- {[42, 88, 76, 64, 0, 36, 82, 70].map((w, i) => (w ? <span key={i} className="skeleton h-3 rounded-md" style={{ width: `${w}%`, animationDelay: `${i * 90}ms` }} /> : <span key={i} className="h-3" />))}
- </div>
+ <div data-testid="note-enhanced-waiting" className="summary-waiting" aria-live="polite">
+ <i className="summary-heading-bar" aria-hidden="true" />
+ {/* the shimmering bar says it's working; words only for a wait worth explaining (a long meeting read in parts) */}
+ <p className={status === 'writing' && notes.part ? 'pt-9 text-[15px] text-muted' : 'sr-only'}>{status === 'writing' && notes.part ? t('Reading a long meeting, part {part} of {of}…', { part: notes.part.part, of: notes.part.of }) : t('Generating notes…')}</p>
</div>
</NotesModelWait>
)
diff --git a/app/src/renderer/src/streamingInk.ts b/app/src/renderer/src/streamingInk.ts
new file mode 100644
index 00000000..a2456d2b
--- /dev/null
+++ b/app/src/renderer/src/streamingInk.ts
@@ -0,0 +1,111 @@
+import { Extension } from '@tiptap/core'
+import { Plugin, PluginKey } from '@tiptap/pm/state'
+import { Decoration, DecorationSet } from '@tiptap/pm/view'
+import { cubicBezier } from 'motion'
+import { InkArrival } from '../../shared/inkArrival'
+
+export const inkKey = new PluginKey<{ live: boolean; reduced: boolean; decorations: DecorationSet }>('streamingInk')
+const clamp = (n: number) => Math.max(0, Math.min(1, n))
+const pull = cubicBezier(.18, .8, .25, 1)
+
+export const StreamingInk = Extension.create({
+ name: 'streamingInk',
+ addProseMirrorPlugins() {
+ const arrivals = new InkArrival()
+ return [new Plugin({
+ key: inkKey,
+ state: {
+ init: () => ({ live: false, reduced: false, decorations: DecorationSet.empty }),
+ apply(tr, previous) {
+ const mode = tr.getMeta(inkKey) ?? previous
+ if (!mode.live) {
+ arrivals.update('', 0)
+ return { ...mode, decorations: DecorationSet.empty }
+ }
+ if (!tr.docChanged && mode.live === previous.live && mode.reduced === previous.reduced) return previous
+ let text = ''
+ const pieces: { from: number; to: number; pos: number }[] = []
+ tr.doc.descendants((node, pos) => {
+ if (node.isTextblock) text += '\n'
+ if (node.isText) {
+ pieces.push({ from: text.length, to: text.length + node.text!.length, pos })
+ text += node.text
+ }
+ })
+ const now = performance.now(), decorations: Decoration[] = []
+ let piece = 0
+ for (const word of arrivals.update(text, now)) {
+ while (piece < pieces.length && pieces[piece].to <= word.from) piece++
+ if (mode.reduced || now - word.born >= 420) continue
+ for (let i = piece; i < pieces.length && pieces[i].from < word.to; i++) {
+ const p = pieces[i]
+ decorations.push(Decoration.inline(p.pos + Math.max(0, word.from - p.from), p.pos + Math.min(p.to, word.to) - p.from,
+ { class: 'summary-ink', 'data-ink-born': String(word.born) }))
+ }
+ }
+ return { ...mode, decorations: DecorationSet.create(tr.doc, decorations) }
+ },
+ },
+ props: { decorations: state => inkKey.getState(state)!.decorations },
+ view(view) {
+ let frame = 0, first: number | undefined, headingWidth = 142
+ const draw = (now: number) => {
+ cancelAnimationFrame(frame)
+ const surface = view.dom.closest<HTMLElement>('.summary-surface')
+ if (!surface) return
+ const layer = surface.querySelector<SVGGElement>('.summary-wash')!
+ const bar = surface.querySelector<HTMLElement>('.summary-heading-bar')!
+ const { live, reduced } = inkKey.getState(view.state)!
+ const waiting = live && !view.state.doc.textContent.trim()
+ surface.dataset.waiting = String(waiting)
+ layer.replaceChildren()
+ if (!live || waiting) first = undefined
+ if (live && !waiting && first === undefined) first = now
+ if (live && !waiting && now - first! < 260) {
+ const heading = view.dom.querySelector('h1,h2,h3')
+ if (heading) {
+ const range = document.createRange()
+ range.selectNodeContents(heading)
+ headingWidth = range.getBoundingClientRect().width
+ } else headingWidth = 142
+ }
+ const progress = waiting ? 0 : !live || reduced ? 1 : clamp((now - (first ?? now)) / 260)
+ const ease = 1 - (1 - progress) ** 3
+ view.dom.style.opacity = String(waiting || !live || reduced ? 1 : ease)
+ bar.hidden = !live || (!waiting && progress === 1)
+ bar.style.width = `${142 + (headingWidth - 142) * pull(progress)}px`
+ bar.style.transform = `scaleY(${1 - .72 * pull(progress)})`
+ bar.style.opacity = String(waiting ? 1 : 1 - ease)
+ let active = live && !waiting && progress < 1
+ if (live && !reduced) {
+ const origin = surface.getBoundingClientRect()
+ const filter = surface.querySelector('filter')!.id
+ for (const word of view.dom.querySelectorAll<HTMLElement>('[data-ink-born]')) {
+ const age = now - Number(word.dataset.inkBorn)
+ word.style.setProperty('--ink-fresh', `${(1 - clamp(age / 420)) * 100}%`)
+ if (age >= 420) continue
+ active = true
+ // Only the wash is filtered; ranges follow wrapping text without changing its layout.
+ const range = document.createRange()
+ range.selectNodeContents(word)
+ for (const box of range.getClientRects()) {
+ const g = document.createElementNS('http://www.w3.org/2000/svg', 'g')
+ const width = box.width + 4, scale = pull(clamp(age / 260))
+ g.setAttribute('transform', `translate(${box.left - origin.left - 2 + width * .12 * (1 - scale)} ${box.top - origin.top}) scale(${scale} 1)`)
+ g.setAttribute('opacity', String(.11 * (1 - clamp((age - 160) / 260)) * ease))
+ g.setAttribute('filter', `url(#${filter})`)
+ g.innerHTML = `<rect y="6" width="${width * .82}" height="12" rx="8"/><circle cx="${width - 4}" cy="12" r="4"/>`
+ layer.append(g)
+ }
+ }
+ }
+ if (active) frame = requestAnimationFrame(draw)
+ }
+ return {
+ update: () => draw(performance.now()),
+ destroy: () => cancelAnimationFrame(frame),
+ }
+ },
+ })]
+ },
+})
diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.css
index 18ea7384..a739b4f4 100644
--- a/app/src/renderer/src/styles.css
+++ b/app/src/renderer/src/styles.css
@@ -314,6 +314,26 @@ html.widget { --pill:#232326;--pill-ink:#F7F7FA;--accent:#B780FF;--pill-accent:v
@media (prefers-reduced-motion:reduce) { .swap>*,.swap-in,.follow-arrow { transition:none;animation:none; } }
/* before the first word the summary is one empty paragraph, whose placeholder line break would push the dot down a line */
.streaming .note-prose > :last-child > br.ProseMirror-trailingBreak:only-child { display: none; }
+.summary-surface, .summary-waiting { position: relative; }
+.summary-surface[data-streaming=true] { isolation: isolate; }
+.summary-surface[data-streaming=true] .note-prose { position: relative; z-index: 1; }
+.summary-ink-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; fill: var(--accent); }
+.summary-surface:not([data-streaming=true]) > .summary-ink-layer { display: none; }
+.summary-ink { color: color-mix(in srgb, var(--accent) var(--ink-fresh, 0%), var(--ink-target)); }
+.enhanced { --ink-target: var(--written); }
+.enhanced :is(h1,h2,h3) { --ink-target: var(--heading); }
+.enhanced :is(strong,.mine) { --ink-target: var(--ink); }
+.enhanced a { --ink-target: var(--accent); }
+.summary-waiting { min-height: 22px; }
+.summary-heading-bar { position: absolute; inset-inline-start: 0; top: 5px; width: 142px; max-width: 100%; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--line) 0%, color-mix(in srgb, var(--line) 40%, var(--card)) 50%, var(--line) 100%); background-size: 200% 100%; pointer-events: none; transform-origin: left center; }
+/* the same soft shimmer as the app's other skeletons */
+.summary-waiting > .summary-heading-bar, .summary-surface[data-waiting=true] > .summary-heading-bar { animation: shimmer 1.6s ease-in-out infinite; }
+.summary-surface[data-waiting=true] .note-prose::after, .summary-surface[data-waiting=true] .note-prose *::after { content: none; }
+@media (prefers-reduced-motion: reduce) {
+ .summary-heading-bar { animation: none !important; }
+ .summary-ink { color: inherit; }
+ .summary-ink-layer { display: none; }
+}
.chat-answer > * + * { margin-top: 0.45em; }
@media (prefers-reduced-motion: reduce) { .chat-in, .fw { animation: none; transition: none; } .stream-caret::after, .stream-caret *::after, .streaming .note-prose::after, .streaming .note-prose *::after { animation: none; } }
diff --git a/app/src/shared/inkArrival.ts b/app/src/shared/inkArrival.ts
new file mode 100644
index 00000000..e82cd85f
--- /dev/null
+++ b/app/src/shared/inkArrival.ts
@@ -0,0 +1,18 @@
+/** Visible text owns its clock, not the editor nodes replaced by setContent. */
+export class InkArrival {
+ private text = ''
+ private times: number[] = []
+
+ update(text: string, now: number) {
+ let head = 0, tail = 0
+ while (head < this.text.length && head < text.length && this.text[head] === text[head]) head++
+ while (tail < this.text.length - head && tail < text.length - head && this.text[this.text.length - 1 - tail] === text[text.length - 1 - tail]) tail++
+ this.times = [
+ ...this.times.slice(0, head),
+ ...Array<number>(text.length - head - tail).fill(now),
+ ...(tail ? this.times.slice(-tail) : []),
+ ]
+ this.text = text
+ return [...text.matchAll(/\S+/g)].map(m => ({ from: m.index, to: m.index + m[0].length, born: this.times[m.index] }))
+ }
+}
diff --git a/app/test/inkArrival.test.ts b/app/test/inkArrival.test.ts
new file mode 100644
index 00000000..7be30c01
--- /dev/null
+++ b/app/test/inkArrival.test.ts
@@ -0,0 +1,12 @@
+import { expect, it } from 'vitest'
+import { InkArrival } from '../src/shared/inkArrival'
+
+it('keeps word ages across redraws, growing words and corrected text', () => {
+ const ink = new InkArrival()
+ expect(ink.update('First wor', 100).map(w => w.born)).toEqual([100, 100])
+ expect(ink.update('First word next', 200).map(w => w.born)).toEqual([100, 100, 200])
+ expect(ink.update('First word next', 300).map(w => 300 - w.born)).toEqual([200, 200, 100])
+ expect(ink.update('First new word next', 400).map(w => w.born)).toEqual([100, 400, 100, 200])
+ ink.update('', 500)
+ expect(ink.update('First', 600)).toEqual([{ from: 0, to: 5, born: 600 }])
+})