Skip to content

Commit cc31f14

Browse files
committed
feat: update NpmPackageSearch
1 parent c950ae2 commit cc31f14

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/components/NpmPackageSearch.svelte

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
import LucideLoaderCircle from "~icons/lucide/loader-circle";
55
import LucideSearch from "~icons/lucide/search";
66
import LucideX from "~icons/lucide/x";
7-
import { mod } from "../../lib/mod";
8-
import { scrollIntoView } from "../../lib/scroll-into-view";
7+
import { mod } from "../../lib/client/mod";
8+
import { scrollIntoView } from "../../lib/client/scroll-into-view";
99
10-
type NpmPackage = { name: string; description: string };
11-
type NpmSearchResponse = { objects: { package: { name: string; description?: string } }[] };
10+
interface NpmPackage {
11+
name: string;
12+
description: string;
13+
}
14+
15+
interface NpmSearchResponse {
16+
objects: { package: { name: string; description?: string } }[];
17+
}
1218
1319
let dialog = $state<HTMLDialogElement>();
1420
let resultsList = $state<HTMLUListElement>();
@@ -33,7 +39,7 @@
3339
);
3440
3541
// Track when the dialog is opened or closed.
36-
// Workaround as the ToggleEvent is not supported for dialogs in Safari.
42+
// Workaround as the ToggleEvent is not supported for dialog in Safari.
3743
// See https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent
3844
// and https://github.com/sveltejs/svelte/issues/4723.
3945
useMutationObserver(
@@ -119,7 +125,7 @@
119125
<svelte:window onkeydown={handleWindowKeydown} />
120126

121127
<!-- Remove transition to let search input autofocus; see https://github.com/saadeghi/daisyui/issues/3440 -->
122-
<dialog bind:this={dialog} class="modal [transition:unset]">
128+
<dialog id="npm-search-dialog" bind:this={dialog} class="modal [transition:unset]">
123129
<div class="modal-box max-w-2xl [transition:unset]">
124130
<form method="dialog">
125131
<button class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2">

0 commit comments

Comments
 (0)