Skip to content

Instantly share code, notes, and snippets.

@thisismatu
thisismatu / Tooltip.svelte
Created January 11, 2025 11:42
Simple viewport awrare tooltip in Svelte 5
<script lang="ts">
import DOMPurify from 'dompurify';
import { onMount, type Snippet } from 'svelte';
const { content, children }: { content: string; children?: Snippet } = $props();
let triggerEl: HTMLSpanElement | undefined = undefined;
let isHovered = $state(false);
let tooltipWidth = $state(0);
let tooltipHeight = $state(0);
@thisismatu
thisismatu / html.json
Last active November 12, 2024 12:14
.config/zed/snippets/html.json
{
"HTML document": {
"prefix": "html",
"body": ["<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n\t<meta charset=\"UTF-8\">\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t<title>Document</title>\n</head>\n<body>\n$1\n</body>\n</html>", "$0"],
"description": "HTML document"
}
}