From 79d192ade02c9f20edfa28e195c25d5dc7ddc9d3 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 10 Dec 2024 20:40:03 +0000 Subject: [PATCH] deploy: d6cb4e097382cefa54097a0eb49a2f60ab0e75b5 --- index.xhtml | 2 +- options.html | 7 +++--- quirks.html | 2 +- release-notes.html | 2 +- script/search.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++ style.css | 33 ++++++++++++++++++++++++++ 6 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 script/search.js diff --git a/index.xhtml b/index.xhtml index 8948f32c..56a87634 100644 --- a/index.xhtml +++ b/index.xhtml @@ -6,7 +6,7 @@ nvf manual - + diff --git a/options.html b/options.html index 175a2742..75517560 100644 --- a/options.html +++ b/options.html @@ -6,7 +6,7 @@ Appendix B. Neovim Flake Configuration Options - + @@ -103,8 +103,9 @@ boolean

-

Whether to enable [official documentation]: https://neovim.io/doc/user/lua.html#vim.loader.enable()

the experimental Lua module loader to speed up the start up process

If true, this will enable the experimental Lua module loader which:

  • overrides loadfile

  • adds the lua loader using the byte-compilation cache

  • adds the libs loader

  • removes the default Neovim loader

Note

This is disabled by default. Before setting this option, please -take a look at the [official documentation].

.

+

the experimental Lua module loader to speed up the start up process

If true, this will enable the experimental Lua module loader which:

  • overrides loadfile

  • adds the lua loader using the byte-compilation cache

  • adds the libs loader

  • removes the default Neovim loader

Note

The Lua module loader is disabled by default. Before setting this option, please +take a look at the official documentation. This option may be enabled by +default in the future.

Type: boolean

diff --git a/quirks.html b/quirks.html index 5a52ce94..4ff1fa95 100644 --- a/quirks.html +++ b/quirks.html @@ -6,7 +6,7 @@ Appendix A. Known Issues and Quirks - + diff --git a/release-notes.html b/release-notes.html index a17e1321..b581e62c 100644 --- a/release-notes.html +++ b/release-notes.html @@ -6,7 +6,7 @@ Appendix C. Release Notes - + diff --git a/script/search.js b/script/search.js new file mode 100644 index 00000000..e20c2314 --- /dev/null +++ b/script/search.js @@ -0,0 +1,58 @@ +document.addEventListener("DOMContentLoaded", () => { + if (!window.location.pathname.endsWith("options.html")) return; + + const searchDiv = document.createElement("div"); + searchDiv.id = "search-bar"; + searchDiv.innerHTML = ` + +
+ `; + document.body.prepend(searchDiv); + + const dtElements = Array.from(document.querySelectorAll("dt")); + const ddElements = Array.from(document.querySelectorAll("dd")); + const dtOptionIds = dtElements.map( + (dt) => dt.querySelector("a")?.id.toLowerCase() || "", + ); + + if (dtElements.length === 0 || ddElements.length === 0) { + console.warn("Something went wrong, page may be loaded incorrectly."); + return; + } + + const dtElementsData = dtElements.map((dt, index) => ({ + element: dt, + id: dtOptionIds[index], + ddElement: ddElements[index], + })); + + const hiddenClass = "hidden"; + const hiddenStyle = document.createElement("style"); + hiddenStyle.innerHTML = `.${hiddenClass} { display: none; }`; + document.head.appendChild(hiddenStyle); + + let debounceTimeout; + document.getElementById("search-input").addEventListener("input", (event) => { + clearTimeout(debounceTimeout); + debounceTimeout = setTimeout(() => { + const query = event.target.value.toLowerCase(); + + const matches = []; + const nonMatches = []; + + dtElementsData.forEach(({ element, id, ddElement }) => { + const isMatch = id.includes(query); + if (isMatch) { + matches.push(element, ddElement); + } else { + nonMatches.push(element, ddElement); + } + }); + + requestAnimationFrame(() => { + matches.forEach((el) => el?.classList.remove(hiddenClass)); + nonMatches.forEach((el) => el?.classList.add(hiddenClass)); + }); + }, 200); + }); +}); diff --git a/style.css b/style.css index 9376c288..2ec4c76b 100644 --- a/style.css +++ b/style.css @@ -437,10 +437,14 @@ th:last-child { dt { margin: 1.2rem 0 0.8rem; + content-visibility: auto; + contain-intrinsic-size: auto 42px; } dd { margin-left: 2rem; + content-visibility: auto; + contain-intrinsic-size: auto 500px; } ul { @@ -494,6 +498,35 @@ li:last-child { text-decoration: none; } +#search-bar { + position: sticky; + top: 0; + background: white; + padding: 10px; + border-bottom: 1px solid #e5e7eb; + z-index: 1000; +} +@media (prefers-color-scheme: dark) { + #search-bar { + background: #111827; + color: #f9fafb; + border-bottom: 1px solid black; + } +} + +#search-input { + width: 100%; + padding: 8px; + border: 1px solid #ccc; + border-radius: 4px; + background: inherit; + color: inherit; +} + +.hidden { + display: none; +} + div.titlepage { margin: 40px 0; }