From 46d6ac787c8e1d6d532e8dd8d0710f90c337665c Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.net>
Date: Fri, 8 May 2026 07:43:09 +0000
Subject: feat(scroll): add global smooth scrolling via Lenis

---
 src/routes/+layout.svelte | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src/routes/+layout.svelte')

diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 78e08016..7f962884 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -39,6 +39,8 @@ import { toolsAsCommandPaletteActions } from "$lib/Tools/tools";
 import localforage from "localforage";
 import { dev } from "$app/environment";
 import { injectAnalytics } from "@vercel/analytics/sveltekit";
+import Lenis from "lenis";
+import "lenis/dist/lenis.css";
 import type { LayoutData } from "./$types";
 
 injectSpeedInsights();
@@ -50,6 +52,7 @@ let isHeaderVisible = true;
 let previousScrollPosition = 0;
 let notificationInterval: ReturnType<typeof setInterval> | undefined =
 	undefined;
+let lenis: Lenis | undefined = undefined;
 
 addMessages("en", english as unknown as LocaleDictionary);
 addMessages("ja", japanese as unknown as LocaleDictionary);
@@ -94,6 +97,8 @@ const handleScroll = () => {
 
 onMount(async () => {
 	if (browser) {
+		lenis = new Lenis({ autoRaf: true });
+
 		if (await localforage.getItem("redirect")) {
 			window.location.href = (await localforage.getItem("redirect")) ?? "/";
 
@@ -162,6 +167,8 @@ onDestroy(() => {
 	if (browser) window.removeEventListener("scroll", handleScroll);
 
 	if (notificationInterval) clearInterval(notificationInterval);
+
+	lenis?.destroy();
 });
 
 $: {
-- 
cgit v1.2.3

