From 172ab88b335ccd6ee8fc748d49ed5f87370d643e Mon Sep 17 00:00:00 2001 From: Frederic Cabassut Date: Sun, 22 Mar 2026 20:09:32 +0100 Subject: [PATCH] feat: custom tooltip action replacing native title attributes Add a reusable `use:tooltip` Svelte action as a drop-in replacement for native title attributes. Styled to match the retro parchment theme with JetBrains Mono font, dark background, and 400ms hover delay. Replace all title attributes in NoteEditor, NoteCard, and NotesView with the custom tooltip. The action supports top/bottom positioning and auto-clamps to viewport edges. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/app.css | 21 +++++++ src/lib/components/NoteCard.svelte | 17 +++--- src/lib/components/NoteEditor.svelte | 13 +++-- src/lib/components/NotesView.svelte | 3 +- src/lib/utils/tooltip.ts | 83 ++++++++++++++++++++++++++++ 5 files changed, 122 insertions(+), 15 deletions(-) create mode 100644 src/lib/utils/tooltip.ts diff --git a/src/app.css b/src/app.css index b426d9f..1eca55f 100644 --- a/src/app.css +++ b/src/app.css @@ -203,3 +203,24 @@ body::before { .prose ul.task-list li p { margin: 0; } + +/* Custom tooltips */ +.tooltip-popup { + position: fixed; + z-index: 9999; + padding: 0.25rem 0.5rem; + font-family: 'JetBrains Mono', monospace; + font-size: 0.7rem; + line-height: 1.2; + color: var(--bg-surface); + background: var(--text); + border-radius: 2px; + pointer-events: none; + white-space: nowrap; + opacity: 0; + transition: opacity 100ms ease-out; +} + +.tooltip-visible { + opacity: 1; +} diff --git a/src/lib/components/NoteCard.svelte b/src/lib/components/NoteCard.svelte index a87c0a9..112f6ab 100644 --- a/src/lib/components/NoteCard.svelte +++ b/src/lib/components/NoteCard.svelte @@ -12,6 +12,7 @@ import Archive from 'lucide-svelte/icons/archive'; import ArchiveRestore from 'lucide-svelte/icons/archive-restore'; import UserMinus from 'lucide-svelte/icons/user-minus'; + import { tooltip } from '$lib/utils/tooltip.js'; interface ChecklistItem { text: string; @@ -117,7 +118,7 @@ {:else if isShared} - + {/if} @@ -464,7 +465,7 @@