feat: introduce citation components from tool-ui with hover popover functionality and schema validation for enhanced citation management

This commit is contained in:
Anish Sarkar 2026-03-30 01:38:00 +05:30
parent 0e3f5d804c
commit 9eab427b56
14 changed files with 1168 additions and 0 deletions

View file

@ -0,0 +1,23 @@
import { sanitizeHref } from "./sanitize-href";
export function resolveSafeNavigationHref(
...candidates: Array<string | null | undefined>
): string | undefined {
for (const candidate of candidates) {
const safeHref = sanitizeHref(candidate ?? undefined);
if (safeHref) {
return safeHref;
}
}
return undefined;
}
export function openSafeNavigationHref(href: string | undefined): boolean {
if (!href || typeof window === "undefined") {
return false;
}
window.open(href, "_blank", "noopener,noreferrer");
return true;
}