mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Ran latest prettier
This commit is contained in:
parent
4b50cc7bc1
commit
4880102b5d
1 changed files with 12 additions and 7 deletions
|
|
@ -188,8 +188,9 @@ class NavigationSearch extends HTMLElement {
|
||||||
setupEventListeners() {
|
setupEventListeners() {
|
||||||
const dialog = this.shadowRoot.querySelector("dialog");
|
const dialog = this.shadowRoot.querySelector("dialog");
|
||||||
const input = this.shadowRoot.querySelector(".search-input");
|
const input = this.shadowRoot.querySelector(".search-input");
|
||||||
const resultsContainer =
|
const resultsContainer = this.shadowRoot.querySelector(
|
||||||
this.shadowRoot.querySelector(".results-container");
|
".results-container"
|
||||||
|
);
|
||||||
|
|
||||||
// Global keyboard listener for "/"
|
// Global keyboard listener for "/"
|
||||||
document.addEventListener("keydown", (e) => {
|
document.addEventListener("keydown", (e) => {
|
||||||
|
|
@ -303,7 +304,7 @@ class NavigationSearch extends HTMLElement {
|
||||||
this.matches = (this.allItems || []).filter(
|
this.matches = (this.allItems || []).filter(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.name.toLowerCase().includes(lowerQuery) ||
|
item.name.toLowerCase().includes(lowerQuery) ||
|
||||||
item.url.toLowerCase().includes(lowerQuery),
|
item.url.toLowerCase().includes(lowerQuery)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.selectedIndex = this.matches.length > 0 ? 0 : -1;
|
this.selectedIndex = this.matches.length > 0 ? 0 : -1;
|
||||||
|
|
@ -326,17 +327,21 @@ class NavigationSearch extends HTMLElement {
|
||||||
.map(
|
.map(
|
||||||
(match, index) => `
|
(match, index) => `
|
||||||
<div
|
<div
|
||||||
class="result-item ${index === this.selectedIndex ? "selected" : ""}"
|
class="result-item ${
|
||||||
|
index === this.selectedIndex ? "selected" : ""
|
||||||
|
}"
|
||||||
data-index="${index}"
|
data-index="${index}"
|
||||||
role="option"
|
role="option"
|
||||||
aria-selected="${index === this.selectedIndex}"
|
aria-selected="${index === this.selectedIndex}"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div class="result-name">${this.escapeHtml(match.name)}</div>
|
<div class="result-name">${this.escapeHtml(
|
||||||
|
match.name
|
||||||
|
)}</div>
|
||||||
<div class="result-url">${this.escapeHtml(match.url)}</div>
|
<div class="result-url">${this.escapeHtml(match.url)}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`
|
||||||
)
|
)
|
||||||
.join("");
|
.join("");
|
||||||
|
|
||||||
|
|
@ -372,7 +377,7 @@ class NavigationSearch extends HTMLElement {
|
||||||
detail: match,
|
detail: match,
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
composed: true,
|
composed: true,
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Navigate to URL
|
// Navigate to URL
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue