e.stopPropagation()}
- onkeydown={(e) => {
- if (e.key === 'Escape') close();
- e.stopPropagation();
- }}
- role="dialog"
- aria-modal="true"
- tabindex="-1"
- >
-
+
- {#each results as result, index (result.href)}
+
+{#snippet searchContent()}
+
+
+ {#if query.trim() && results.length > 0}
+
+ {#each results as result, index (result.href)}
+
+ {/each}
+
+ {:else if query.trim()}
+
+
+ No results found for "{query}"
+
+ {:else}
+
+
+
+ Search for tools, calculators, and diagnostics
+
+
+
+ Use ↑↓ to navigate, Enter to select
+
+
+
+ {#if $bookmarks.length > 0}
+
+
+
+ {#each $bookmarks.slice(0, 6) as bookmark, _index (bookmark.href)}
+ {/if}
- {#if $bookmarks.length > 0}
-
-
-
- {#each $bookmarks.slice(0, 6) as bookmark, _index (bookmark.href)}
-
- {/each}
-
-
- {/if}
+ {#if $frequentlyUsedTools.length > 0}
+
+
+
+ {#each $frequentlyUsedTools.slice(0, 12) as tool, _index (tool.href)}
+
+ {/each}
+
+
+ {/if}
+ {/if}
+{/snippet}
- {#if $frequentlyUsedTools.length > 0}
-
-
-
- {#each $frequentlyUsedTools.slice(0, 12) as tool, _index (tool.href)}
-
- {/each}
-
-
- {/if}
- {/if}
+
+{#if isOpen}
+ {#if embedded}
+
+
+ {@render searchContent()}
-
+ {:else}
+
+
{
+ if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ') close();
+ }}
+ role="button"
+ tabindex="-1"
+ aria-label="Close search"
+ >
+
e.stopPropagation()}
+ onkeydown={(e) => {
+ if (e.key === 'Escape') close();
+ e.stopPropagation();
+ }}
+ role="dialog"
+ aria-modal="true"
+ tabindex="-1"
+ >
+ {@render searchContent()}
+
+
+ {/if}
{/if}
diff --git a/src/lib/components/global/ToolCard.svelte b/src/lib/components/global/ToolCard.svelte
index 5c19227..d26debe 100644
--- a/src/lib/components/global/ToolCard.svelte
+++ b/src/lib/components/global/ToolCard.svelte
@@ -463,7 +463,7 @@
h3 {
font-size: var(--font-size-sm);
- font-weight: 500;
+ font-weight: normal;
margin: 0;
line-height: 1.2;
text-overflow: ellipsis;
@@ -480,6 +480,7 @@
height: 1.75rem;
transition: all 0.25s;
filter: saturate(0.9);
+ padding: var(--spacing-md);
}
&:hover {
diff --git a/src/lib/components/global/ToolsGrid.svelte b/src/lib/components/global/ToolsGrid.svelte
index cb2f454..533190c 100644
--- a/src/lib/components/global/ToolsGrid.svelte
+++ b/src/lib/components/global/ToolsGrid.svelte
@@ -35,5 +35,8 @@
grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min-col-width, 280px)), 1fr));
gap: var(--spacing-md);
margin-bottom: var(--spacing-xl);
+ &.compact {
+ gap: calc(var(--spacing-md) - 0.25rem);
+ }
}
diff --git a/src/lib/components/home/HomepageCategories.svelte b/src/lib/components/home/HomepageCategories.svelte
index acdd811..2fb28ab 100644
--- a/src/lib/components/home/HomepageCategories.svelte
+++ b/src/lib/components/home/HomepageCategories.svelte
@@ -1,11 +1,12 @@
-
+
- {site.title}
- {site.heroDescription}
+
+
+
{site.title}
+
{site.heroDescription}
+
@@ -202,15 +193,39 @@
diff --git a/src/lib/components/home/HomepageMinimal.svelte b/src/lib/components/home/HomepageMinimal.svelte
index b3a5758..f68927d 100644
--- a/src/lib/components/home/HomepageMinimal.svelte
+++ b/src/lib/components/home/HomepageMinimal.svelte
@@ -3,6 +3,7 @@
import type { NavItem } from '$lib/constants/nav';
import ToolsGrid from '$lib/components/global/ToolsGrid.svelte';
import SearchFilter from '$lib/components/furniture/SearchFilter.svelte';
+ import { useToolSearch } from '$lib/composables/useToolSearch.svelte';
interface Props {
toolPages: NavItem[];
@@ -11,24 +12,8 @@
let { toolPages, referencePages }: Props = $props();
- let filteredTools: NavItem[] = $state([...toolPages, ...referencePages]);
- let searchQuery: string = $state('');
-
- // Update filtered items when search changes
- $effect(() => {
- const allPages = [...toolPages, ...referencePages];
- if (searchQuery.trim() === '') {
- filteredTools = allPages;
- } else {
- const query = searchQuery.toLowerCase().trim();
- filteredTools = allPages.filter(
- (tool) =>
- tool.label.toLowerCase().includes(query) ||
- tool.description?.toLowerCase().includes(query) ||
- tool.keywords?.some((keyword) => keyword.toLowerCase().includes(query)),
- );
- }
- });
+ const allPages = $derived([...toolPages, ...referencePages]);
+ const search = useToolSearch(allPages);
@@ -37,10 +22,10 @@
-
+
-
+
diff --git a/src/lib/components/home/HomepageSmallIcons.svelte b/src/lib/components/home/HomepageSmallIcons.svelte
index 176e13d..665e851 100644
--- a/src/lib/components/home/HomepageSmallIcons.svelte
+++ b/src/lib/components/home/HomepageSmallIcons.svelte
@@ -19,12 +19,19 @@
let gridElement: HTMLDivElement;
let iconHues: number[] = $state([]);
+ let gridCols: number = $state(1);
+
+ // Memoized function to get grid column count
+ function updateGridCols() {
+ if (!gridElement) return;
+ const gridStyle = window.getComputedStyle(gridElement);
+ gridCols = gridStyle.gridTemplateColumns.split(' ').length;
+ }
function updateIconColors() {
if (!gridElement) return;
- const gridStyle = window.getComputedStyle(gridElement);
- const gridCols = gridStyle.gridTemplateColumns.split(' ').length;
+ updateGridCols();
iconHues = toolPages.map((_, index) => {
const row = Math.floor(index / gridCols);
@@ -34,6 +41,13 @@
});
}
+ function getAnimDelay(index: number): number {
+ if (!gridElement || gridCols === 0) return 0;
+ const row = Math.floor(index / gridCols);
+ const col = index % gridCols;
+ return (row + col) * 0.03; // 30ms per diagonal step
+ }
+
onMount(() => {
bookmarks.init();
updateIconColors();
@@ -64,10 +78,11 @@
recentTools: $recentlyUsedTools,
})}
{@const hue = iconHues[index] ?? 0}
+ {@const animDelay = getAnimDelay(index)}
handleToolContextMenu(e, tool)}
>
@@ -153,6 +168,8 @@
cursor: pointer;
position: relative;
overflow: hidden;
+ opacity: 0;
+ animation: iconFadeIn 0.5s ease-out var(--anim-delay, 0s) forwards;
transition:
transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
box-shadow 0.3s ease,
@@ -207,4 +224,15 @@
transform: scale(1.08) translateY(-1px) rotate(1deg);
}
}
+
+ @keyframes iconFadeIn {
+ from {
+ opacity: 0;
+ transform: translateY(10px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+ }
diff --git a/src/lib/composables/useToolSearch.svelte.ts b/src/lib/composables/useToolSearch.svelte.ts
new file mode 100644
index 0000000..31c1479
--- /dev/null
+++ b/src/lib/composables/useToolSearch.svelte.ts
@@ -0,0 +1,30 @@
+import type { NavItem } from '$lib/constants/nav';
+
+/**
+ * Composable for searching and filtering tools
+ * @param tools Array of tools to search through
+ * @returns Object with query and filtered state that can be bound
+ */
+export function useToolSearch(tools: NavItem[]) {
+ const state = $state({
+ query: '',
+ filtered: tools,
+ });
+
+ // Update filtered whenever query or tools change
+ $effect(() => {
+ if (!state.query.trim()) {
+ state.filtered = tools;
+ } else {
+ const normalizedQuery = state.query.toLowerCase().trim();
+ state.filtered = tools.filter(
+ (tool) =>
+ tool.label.toLowerCase().includes(normalizedQuery) ||
+ tool.description?.toLowerCase().includes(normalizedQuery) ||
+ tool.keywords?.some((keyword) => keyword.toLowerCase().includes(normalizedQuery)),
+ );
+ }
+ });
+
+ return state;
+}
diff --git a/src/lib/stores/homepageLayout.ts b/src/lib/stores/homepageLayout.ts
index 9002e91..4bd022f 100644
--- a/src/lib/stores/homepageLayout.ts
+++ b/src/lib/stores/homepageLayout.ts
@@ -1,7 +1,16 @@
import { writable } from 'svelte/store';
import { browser } from '$app/environment';
-export type HomepageLayoutMode = 'default' | 'minimal' | 'carousel' | 'categories' | 'bookmarks' | 'small-icons' | 'list';
+export type HomepageLayoutMode =
+ | 'default'
+ | 'minimal'
+ | 'carousel'
+ | 'categories'
+ | 'bookmarks'
+ | 'small-icons'
+ | 'list'
+ | 'search'
+ | 'empty';
export interface HomepageLayoutOption {
id: HomepageLayoutMode;
@@ -28,11 +37,21 @@ export const homepageLayoutOptions: HomepageLayoutOption[] = [
name: 'List',
description: 'Hierarchical tree view of all tools and pages',
},
+ {
+ id: 'empty',
+ name: 'Noting',
+ description: 'Show nothing',
+ },
{
id: 'bookmarks',
name: 'Bookmarks',
description: 'Show only your bookmarked tools',
},
+ {
+ id: 'search',
+ name: 'Search',
+ description: 'Search-focused layout with instant tool discovery',
+ },
// {
// id: 'minimal',
// name: 'Tiles',
diff --git a/src/lib/utils/debounce.ts b/src/lib/utils/debounce.ts
new file mode 100644
index 0000000..2a3e23c
--- /dev/null
+++ b/src/lib/utils/debounce.ts
@@ -0,0 +1,23 @@
+/**
+ * Debounce a function call
+ * @param fn Function to debounce
+ * @param delay Delay in milliseconds
+ * @returns Debounced function
+ */
+export function debounce unknown>(
+ fn: T,
+ delay: number,
+): (...args: Parameters) => void {
+ let timeoutId: ReturnType | null = null;
+
+ return (...args: Parameters) => {
+ if (timeoutId) {
+ clearTimeout(timeoutId);
+ }
+
+ timeoutId = setTimeout(() => {
+ fn(...args);
+ timeoutId = null;
+ }, delay);
+ };
+}
diff --git a/src/lib/utils/nav.ts b/src/lib/utils/nav.ts
new file mode 100644
index 0000000..cba1dc6
--- /dev/null
+++ b/src/lib/utils/nav.ts
@@ -0,0 +1,18 @@
+import type { NavItem, NavGroup } from '$lib/constants/nav';
+
+/**
+ * Extract NavItems from a mixed array of NavItems and NavGroups
+ * @param items Array of NavItems and/or NavGroups
+ * @returns Flattened array of NavItems
+ */
+export function extractNavItems(items: (NavItem | NavGroup)[]): NavItem[] {
+ const navItems: NavItem[] = [];
+ for (const item of items) {
+ if ('href' in item) {
+ navItems.push(item);
+ } else if ('title' in item && 'items' in item) {
+ navItems.push(...item.items);
+ }
+ }
+ return navItems;
+}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index edede22..467317e 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -10,6 +10,8 @@
import HomepageBookmarks from '$lib/components/home/HomepageBookmarks.svelte';
import HomepageSmallIcons from '$lib/components/home/HomepageSmallIcons.svelte';
import SiteMapList from '$lib/components/home/SiteMapList.svelte';
+ import HomepageSearch from '$lib/components/home/HomepageSearch.svelte';
+ import HomepageEmpty from '$lib/components/home/HomepageEmpty.svelte';
// Helper function to extract nav items from mixed structure
function extractNavItems(items: (NavItem | NavGroup)[]): NavItem[] {
@@ -50,6 +52,10 @@
{:else if $currentLayout === 'list'}
+{:else if $currentLayout === 'search'}
+
+{:else if $currentLayout === 'empty'}
+
{:else}
{/if}
diff --git a/src/styles/variables.scss b/src/styles/variables.scss
index 8efc4f5..61872ef 100644
--- a/src/styles/variables.scss
+++ b/src/styles/variables.scss
@@ -71,6 +71,31 @@
--transition-fast: 0.15s ease;
--transition-normal: 0.2s ease;
--transition-slow: 0.3s ease;
+
+ /* Animation durations */
+ --anim-duration-fast: 0.3s;
+ --anim-duration-normal: 0.5s;
+ --anim-duration-slow: 0.8s;
+}
+
+/* Respect user's motion preferences */
+@media (prefers-reduced-motion: reduce) {
+ :root {
+ --transition-fast: 0.01s ease;
+ --transition-normal: 0.01s ease;
+ --transition-slow: 0.01s ease;
+ --anim-duration-fast: 0.01s;
+ --anim-duration-normal: 0.01s;
+ --anim-duration-slow: 0.01s;
+ }
+
+ *,
+ *::before,
+ *::after {
+ animation-duration: 0.01s !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 0.01s !important;
+ }
}
.theme-ocean,