|
4 | 4 | import LucideLoaderCircle from "~icons/lucide/loader-circle"; |
5 | 5 | import LucideSearch from "~icons/lucide/search"; |
6 | 6 | 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"; |
9 | 9 |
|
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 | + } |
12 | 18 |
|
13 | 19 | let dialog = $state<HTMLDialogElement>(); |
14 | 20 | let resultsList = $state<HTMLUListElement>(); |
|
33 | 39 | ); |
34 | 40 |
|
35 | 41 | // 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. |
37 | 43 | // See https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent |
38 | 44 | // and https://github.com/sveltejs/svelte/issues/4723. |
39 | 45 | useMutationObserver( |
|
119 | 125 | <svelte:window onkeydown={handleWindowKeydown} /> |
120 | 126 |
|
121 | 127 | <!-- 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]"> |
123 | 129 | <div class="modal-box max-w-2xl [transition:unset]"> |
124 | 130 | <form method="dialog"> |
125 | 131 | <button class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"> |
|
0 commit comments