Initial commit
Build, test, deploy / site (push) Failing after 15m13s

This commit is contained in:
alexm committed 2026-11-12 22:24:02 -05:00
commit e092cb029c
252 files changed
+35037

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
// SPDX-FileCopyrightText: 2026 Scientific Computing Studio, LLC
// SPDX-License-Identifier: Apache-2.0
/** One shared tooltip for hover explanations, positioned near the pointer. */
import { el, clear, add } from './dom.js';
class Tooltip {
private node: HTMLElement | null = null;
private ensure(): HTMLElement {
if (!this.node) { this.node = el('div', { class: 'tip', role: 'tooltip', style: { display: 'none' } }); document.body.appendChild(this.node); }
return this.node;
}
show(x: number, y: number, info: { title: string; body: string; where?: string }): void {
const n = this.ensure();
clear(n);
add(n, el('div', { class: 'tip-title' }, el('code', {}, info.title), info.where ? el('span', { class: 'tip-where' }, info.where) : null), el('div', { class: 'tip-body' }, info.body));
n.style.display = '';
const w = Math.min(380, window.innerWidth - 24);
n.style.maxWidth = `${w}px`;
const left = Math.min(x + 14, window.innerWidth - w - 12);
n.style.left = `${Math.max(8, left)}px`;
n.style.top = `${y + 18}px`;
const r = n.getBoundingClientRect();
if (r.bottom > window.innerHeight - 8) n.style.top = `${Math.max(8, y - r.height - 10)}px`;
}
hide(): void { if (this.node) this.node.style.display = 'none'; }
}
export const tooltip = new Tooltip();