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: the glow starts on the left, turns the corner and settles at the bottom
Eric Brownrout77db3c1f0c63
diff --git a/app/src/renderer/src/askTracer.ts b/app/src/renderer/src/askTracer.tsindex 39d06d66..93268f52 100644--- a/app/src/renderer/src/askTracer.ts+++ b/app/src/renderer/src/askTracer.ts@@ -1,7 +1,8 @@import { createTracerSchedule, TRACER_LAP_MS } from '../../shared/askTracer'-/** One unhurried lap: eases in as the composer settles and eases out before it fades. */-const TRACER_EASING = 'cubic-bezier(.37,0,.63,1)'+const GATHER_MS = 48+const SETTLE_MS = 60+const OUT_CUBIC = 'cubic-bezier(.29,.79,.62,1)'/** Decorative SVG only: input, focus and submission stay with the composer. */export function attachAskTracer(box: HTMLFormElement) {@@ -10,22 +11,29 @@ export function attachAskTracer(box: HTMLFormElement) {const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')svg.setAttribute('class', 'ask-tracer')svg.setAttribute('aria-hidden', 'true')- const segments = Array.from({ length: 20 }, (_, i) => {- const segment = document.createElementNS(svg.namespaceURI, 'rect') as SVGRectElement- for (const [key, value] of Object.entries({ x: 1, y: 1, rx: 11, pathLength: 100 })) segment.setAttribute(key, String(value))- segment.style.strokeDashoffset = String(-i)- segment.style.opacity = String(Math.sin(Math.PI * (i + .5) / 20) ** 2)+ const light = window.matchMedia('(prefers-color-scheme: light)')+ const segments = Array.from({ length: 20 }, () => {+ const segment = document.createElementNS('http://www.w3.org/2000/svg', 'path')+ segment.setAttribute('pathLength', '100')svg.append(segment)return segment})box.append(svg)+ let fraction = 0.75, gather = 0const resize = () => {const { width, height } = box.getBoundingClientRect()svg.setAttribute('viewBox', `0 0 ${width} ${height}`)- for (const segment of segments) {- segment.setAttribute('width', String(Math.max(0, width - 2)))- segment.setAttribute('height', String(Math.max(0, height - 2)))- }+ const w = Math.max(0, width - 2), h = Math.max(0, height - 2)+ const r = Math.min(11, w / 2, h / 2)+ const right = 1 + w, bottom = 1 + h, middle = 1 + w / 2+ const perimeter = 2 * (w + h - 4 * r) + 2 * Math.PI * r+ const start = Math.max(r, h / 3)+ const path = `M 1 ${1 + start} V ${1 + r} A ${r} ${r} 0 0 1 ${1 + r} 1 H ${right - r} A ${r} ${r} 0 0 1 ${right} ${1 + r} V ${bottom - r} A ${r} ${r} 0 0 1 ${right - r} ${bottom} H ${middle}`+ // From the left midpoint to the bottom midpoint clockwise is three quarters of a lap.+ fraction = 0.75 + (perimeter ? (start - h / 2) / perimeter : 0)+ const distance = fraction * perimeter+ gather = distance ? 100 * Math.min(3, (start - r) / 2) / distance : 0+ for (const segment of segments) segment.setAttribute('d', path)}resize()const observer = new ResizeObserver(resize)@@ -34,9 +42,34 @@ export function attachAskTracer(box: HTMLFormElement) {const stop = () => { animations.forEach(animation => animation.cancel()); animations = [] }const play = () => {stop()- const timing = { duration: TRACER_LAP_MS, easing: 'linear' }- animations = [svg.animate([{ opacity: 0 }, { opacity: 1, offset: .2 }, { opacity: 1, offset: .8 }, { opacity: 0 }], timing),- ...segments.map((segment, i) => segment.animate([{ strokeDashoffset: String(-i), easing: TRACER_EASING }, { strokeDashoffset: String(-i - 100) }], timing))]+ const smooth = light.matches+ const peak = smooth ? 0.2 : 0.4+ const duration = Math.round(TRACER_LAP_MS * fraction)+ const arrive = 1 - SETTLE_MS / duration+ const opacity = svg.animate([+ { opacity: 0, easing: 'cubic-bezier(.18,.67,.46,1)' },+ { opacity: peak, offset: 64 / duration },+ { opacity: peak, offset: 1 - 120 / duration, easing: 'cubic-bezier(.36,.02,.67,1)' },+ { opacity: 0 },+ ], duration)+ let previous = 0+ animations = [opacity, ...segments.map((segment, i) => {+ // The open path reveals the tail behind the head. Nested light strokes avoid seams on white.+ const behind = (segments.length - i) / fraction+ const length = smooth ? behind : Math.min(1.05 / fraction, behind)+ const alpha = Math.sin(Math.PI * (i + .5) / (2 * segments.length)) ** 2+ segment.style.opacity = String(smooth ? (alpha - previous) / (1 - previous) : alpha)+ previous = alpha+ const dash = `${length} ${200 - length}`+ const tip = length * .04+ return segment.animate([+ { strokeDashoffset: String(behind), strokeDasharray: dash, easing: 'cubic-bezier(.37,.12,.70,1)' },+ { strokeDashoffset: String(behind - gather), offset: GATHER_MS / duration, easing: OUT_CUBIC },+ { strokeDashoffset: String(behind - 100), strokeDasharray: dash, offset: arrive, easing: OUT_CUBIC },+ { strokeDashoffset: String(behind * .04 - 100), strokeDasharray: `${tip} ${200 - tip}` },+ ], duration)+ })]+ return duration}// A pointer resting where the panel opened isn't hovering; only movement inside the box counts.let moved = false@@ -53,6 +86,7 @@ export function attachAskTracer(box: HTMLFormElement) {box.addEventListener('focusout', blur)document.addEventListener('visibilitychange', update)reduced.addEventListener('change', update)+ light.addEventListener('change', stop)return {update,dispose() {@@ -63,6 +97,7 @@ export function attachAskTracer(box: HTMLFormElement) {box.removeEventListener('focusout', blur)document.removeEventListener('visibilitychange', update)reduced.removeEventListener('change', update)+ light.removeEventListener('change', stop)},}}diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.cssindex c35a0927..ed6d70ee 100644--- a/app/src/renderer/src/workspace.css+++ b/app/src/renderer/src/workspace.css@@ -475,7 +475,7 @@ body:has(.chat-panel[open]) .app-toast-viewport:dir(rtl) { --toast-x:440px; }.ask-box { position:relative;min-width:0;border:1px solid var(--line);border-radius:12px;background:var(--float); }/* Composers are never lit; a short tapered flare invites typing instead. */.ask-tracer { position:absolute;inset:-1px;width:calc(100% + 2px);height:calc(100% + 2px);overflow:visible;pointer-events:none;opacity:0;fill:none;stroke:var(--primary);stroke-width:3;stroke-linecap:round;filter:drop-shadow(0 0 4px color-mix(in srgb,var(--primary) 70%,transparent)) drop-shadow(0 0 10px color-mix(in srgb,var(--primary) 35%,transparent)); }-.ask-tracer rect { stroke-dasharray:1.05 98.95; }+.ask-box:dir(rtl) > .ask-tracer { transform:scaleX(-1);transform-origin:center; }@media (prefers-reduced-motion:reduce) { .ask-tracer { display:none; } }.ask-field { padding:12px; }.ask-box textarea { display:block;width:100%;field-sizing:content;min-height:38px;max-height:160px;resize:none;background:transparent;outline:none;color:var(--ink);font-size:14px;line-height:22px; }diff --git a/app/src/shared/askTracer.ts b/app/src/shared/askTracer.tsindex e9f75e69..3965816f 100644--- a/app/src/shared/askTracer.ts+++ b/app/src/shared/askTracer.ts@@ -1,4 +1,4 @@-export const TRACER_LAP_MS = 1200+export const TRACER_LAP_MS = 750// The ⌘J panel finishes opening in 180ms; the flare starts a short beat after it settles.export const TRACER_DELAY_MS = 300export const TRACER_CADENCE_MS = 8000@@ -6,7 +6,7 @@ export const TRACER_CADENCE_MS = 8000export type TracerState = { focused: boolean; hovered: boolean; hasText: boolean; reduced: boolean; hidden: boolean }/** One scheduler per panel opening; only the opening lap may ignore autofocus. */-export function createTracerSchedule(initial: TracerState, play: () => void, stop: () => void) {+export function createTracerSchedule(initial: TracerState, play: () => number, stop: () => void) {let state = initial, opening = true, running = false, disposed = falselet timer: ReturnType<typeof setTimeout> | undefined// The opening lap plays the same however the panel opened: a pointer on the box (as after clicking Ask) only skips idle laps.@@ -14,11 +14,12 @@ export function createTracerSchedule(initial: TracerState, play: () => void, stoconst cancel = () => { clearTimeout(timer); timer = undefined; running = false; stop() }const schedule = (delay: number) => {timer = setTimeout(() => {- running = true; play()+ running = true+ const duration = play()timer = setTimeout(() => {stop(); timer = undefined; running = false; opening = false- if (allowed()) schedule(TRACER_CADENCE_MS - TRACER_LAP_MS)- }, TRACER_LAP_MS)+ if (allowed()) schedule(TRACER_CADENCE_MS - duration)+ }, duration)}, delay)}const update = (next: TracerState) => {diff --git a/app/test/askTracer.test.ts b/app/test/askTracer.test.tsindex b8668ba9..49a4da05 100644--- a/app/test/askTracer.test.ts+++ b/app/test/askTracer.test.ts@@ -5,7 +5,7 @@ beforeEach(() => vi.useFakeTimers())afterEach(() => vi.useRealTimers())const idle: TracerState = { focused: false, hovered: false, hasText: false, reduced: false, hidden: false }const setup = (initial = idle) => {- const play = vi.fn(), stop = vi.fn()+ const play = vi.fn(() => TRACER_LAP_MS), stop = vi.fn()const schedule = createTracerSchedule(initial, play, stop)return { ...schedule, play, stop }}@@ -142,3 +142,16 @@ it.each([false, true])('finishes the original lap through typing, clearing, focuexpect(s.play).toHaveBeenCalledTimes(plays)s.dispose()})++it('finishes each selected duration and keeps the eight-second start cadence when the route changes', () => {+ const s = setup()+ s.play.mockReturnValueOnce(500).mockReturnValueOnce(750)+ vi.advanceTimersByTime(TRACER_DELAY_MS + 500)+ expect(s.stop).toHaveBeenCalledOnce()+ vi.advanceTimersByTime(8000 - 500 - 1)+ expect(s.play).toHaveBeenCalledOnce()+ vi.advanceTimersByTime(1 + 750)+ expect(s.play).toHaveBeenCalledTimes(2)+ expect(s.stop).toHaveBeenCalledTimes(2)+ s.dispose()+})diff --git a/app/test/askTracerDom.test.ts b/app/test/askTracerDom.test.tsindex a4be7ee7..460734db 100644--- a/app/test/askTracerDom.test.ts+++ b/app/test/askTracerDom.test.ts@@ -1,32 +1,37 @@+import { readFileSync } from 'node:fs'import { afterEach, expect, it, vi } from 'vitest'import { attachAskTracer } from '../src/renderer/src/askTracer'-import { TRACER_DELAY_MS, TRACER_LAP_MS } from '../src/shared/askTracer'+import { TRACER_CADENCE_MS, TRACER_DELAY_MS, TRACER_LAP_MS } from '../src/shared/askTracer'afterEach(() => { vi.useRealTimers(); vi.unstubAllGlobals() })-it('animates explicit dash offsets, follows the composer size, and finishes through native input and cleans up', () => {+it.each([+ { width: 394, light: true, duration: 550 },+ { width: 720, light: false, duration: 555 },+])('lights the left edge, turns the corner and settles at bottom centre ($width px, $duration ms)', ({ width, light, duration }) => {vi.useFakeTimers()- const node = () => {+ const node = (tag: string) => {const element = {- namespaceURI: 'http://www.w3.org/2000/svg', style: {}, attrs: new Map<string, string>(),+ tag, style: {}, attrs: new Map<string, string>(),setAttribute(key: string, value: string) { this.attrs.set(key, value) },- append: vi.fn(), remove: vi.fn(), animate: vi.fn(() => ({ cancel: vi.fn() })),+ append: vi.fn(), remove: vi.fn(), animate: vi.fn((_frames: Keyframe[], _duration: number) => ({ cancel: vi.fn() })),}return element}const nodes: ReturnType<typeof node>[] = []const field = { value: '' }const doc = Object.assign(new EventTarget(), { activeElement: field, hidden: false,- createElementNS: () => { const element = node(); nodes.push(element); return element } })+ createElementNS: (_ns: string, tag: string) => { const element = node(tag); nodes.push(element); return element } })const media = Object.assign(new EventTarget(), { matches: false })- let bounds = { width: 400, height: 100 }, resize = () => {}+ let bounds = { width, height: 100 }, resize = () => {}const disconnect = vi.fn()const box = Object.assign(new EventTarget(), {querySelector: () => field, append: vi.fn(), matches: () => false,- contains: (element: unknown) => element === field, getBoundingClientRect: () => bounds,+ contains: (element: unknown) => element === field, getBoundingClientRect: () => ({ ...bounds, left: 0, top: 0 }),})vi.stubGlobal('document', doc)- vi.stubGlobal('window', { matchMedia: () => media })+ const appearance = Object.assign(new EventTarget(), { matches: light })+ vi.stubGlobal('window', { matchMedia: (query: string) => query.includes('color-scheme') ? appearance : media })vi.stubGlobal('ResizeObserver', class {constructor(callback: () => void) { resize = callback }observe() {}@@ -35,19 +40,56 @@ it('animates explicit dash offsets, follows the composer size, and finishes throconst tracer = attachAskTracer(box as unknown as HTMLFormElement)expect(nodes).toHaveLength(21)expect(nodes[0].attrs.get('aria-hidden')).toBe('true')- expect(nodes[0].attrs.get('viewBox')).toBe('0 0 400 100')- expect(nodes[1].attrs.get('width')).toBe('398')- bounds = { width: 350, height: 160 }; resize()- expect(nodes[1].attrs.get('width')).toBe('348')- expect(nodes[1].attrs.get('height')).toBe('158')- vi.advanceTimersByTime(TRACER_DELAY_MS)- for (let i = 0; i < 20; i++) expect(nodes[i + 1].animate).toHaveBeenCalledWith(- [{ strokeDashoffset: String(-i), easing: 'cubic-bezier(.37,0,.63,1)' }, { strokeDashoffset: String(-i - 100) }], { duration: TRACER_LAP_MS, easing: 'linear' })+ expect([TRACER_DELAY_MS, TRACER_LAP_MS, TRACER_CADENCE_MS]).toEqual([300, 750, 8000])+ vi.advanceTimersByTime(299)+ expect(nodes[0].animate).not.toHaveBeenCalled()+ vi.advanceTimersByTime(1)+ const startY = 1 + 98 / 3+ const path = `M 1 ${startY} V 12 A 11 11 0 0 1 12 1 H ${width - 12} A 11 11 0 0 1 ${width - 1} 12 V 88 A 11 11 0 0 1 ${width - 12} 99 H ${width / 2}`+ const peak = light ? 0.2 : 0.4+ expect(nodes[0].animate).toHaveBeenCalledWith([+ { opacity: 0, easing: 'cubic-bezier(.18,.67,.46,1)' }, { opacity: peak, offset: 64 / duration },+ { opacity: peak, offset: 1 - 120 / duration, easing: 'cubic-bezier(.36,.02,.67,1)' }, { opacity: 0 },+ ], duration)+ const bodyCurve = 'cubic-bezier(.29,.79,.62,1)'+ const routePx = startY - 12 + (width - 24) + 76 + (width / 2 - 12) + 3 * Math.PI * 11 / 2+ let composite = 0+ for (const [i, segment] of nodes.slice(1).entries()) {+ expect(segment.attrs.get('d')).toBe(path)+ expect(segment.attrs.get('pathLength')).toBe('100')+ const [[frames, ms]] = segment.animate.mock.calls+ expect(ms).toBe(duration)+ const [start, leave, arrive, end] = frames+ expect(leave).toMatchObject({ offset: 48 / ms, easing: bodyCurve })+ expect(arrive).toMatchObject({ offset: 1 - 60 / ms, easing: 'cubic-bezier(.29,.79,.62,1)' })+ const [length, gap] = String(start.strokeDasharray).split(' ').map(Number)+ const tail = Number(start.strokeDashoffset)+ expect(length + gap).toBeCloseTo(200)+ expect(arrive.strokeDasharray).toBe(start.strokeDasharray)+ expect((tail - Number(leave.strokeDashoffset)) * routePx / 100).toBeCloseTo(3)+ expect(tail - Number(arrive.strokeDashoffset)).toBeCloseTo(100)+ expect(100 + Number(end.strokeDashoffset)).toBeCloseTo(tail * .04)+ const [tip, finalGap] = String(end.strokeDasharray).split(' ').map(Number)+ expect(tip + finalGap).toBeCloseTo(200)+ expect(tip).toBeCloseTo(length * .04)+ if (light || i === 19) {+ expect(length - tail).toBeCloseTo(0)+ expect(tip - Number(end.strokeDashoffset)).toBeCloseTo(100)+ }+ const alpha = Number((segment.style as CSSStyleDeclaration).opacity)+ composite = light ? composite + (1 - composite) * alpha : alpha+ expect(composite).toBeCloseTo(Math.sin(Math.PI * (i + .5) / 40) ** 2, 8)+ }vi.advanceTimersByTime(200)field.value = 'Draft'; box.dispatchEvent(new Event('input')); tracer.update()bounds = { width: 350, height: 190 }; resize()+ expect(nodes[0].attrs.get('viewBox')).toBe('0 0 350 190')+ expect(nodes[1].attrs.get('d')).toMatch(/ 189 H 175$/)+ expect(nodes[1].attrs.get('pathLength')).toBe('100')for (const element of nodes) expect(element.animate.mock.results[0].value.cancel).not.toHaveBeenCalled()- vi.advanceTimersByTime(TRACER_LAP_MS - 200)+ vi.advanceTimersByTime(duration - 201)+ expect(nodes[0].animate.mock.results[0].value.cancel).not.toHaveBeenCalled()+ vi.advanceTimersByTime(1)for (const element of nodes) expect(element.animate.mock.results[0].value.cancel).toHaveBeenCalledOnce()vi.advanceTimersByTime(24000)expect(nodes[0].animate).toHaveBeenCalledOnce()@@ -59,6 +101,11 @@ it('animates explicit dash offsets, follows the composer size, and finishes throexpect(vi.getTimerCount()).toBe(0)})+it('mirrors only the painted route around the centre of an RTL composer', () => {+ const css = readFileSync(new URL('../src/renderer/src/workspace.css', import.meta.url), 'utf8')+ expect(css).toMatch(/\.ask-box:dir\(rtl\) > \.ask-tracer \{ transform:scaleX\(-1\);transform-origin:center;/)+})+it('plays the opening under a resting or a moving pointer, as after a click', () => {vi.useFakeTimers()const nodes: { animate: ReturnType<typeof vi.fn> }[] = []