feat: sync WRNexusJS component showcase 0.5.0
This commit is contained in:
+16
-4
@@ -58,10 +58,21 @@
|
||||
|
||||
let design = storedDesign();
|
||||
applyDesign(design, false);
|
||||
for (const link of document.querySelectorAll(".docs-directory a[href]")) {
|
||||
const target = new URL(link.href, window.location.origin);
|
||||
if (target.pathname === window.location.pathname) link.setAttribute("aria-current", "page");
|
||||
|
||||
function updateActiveNavigation() {
|
||||
for (const link of document.querySelectorAll(".docs-directory a[href]")) {
|
||||
const target = new URL(link.href, window.location.origin);
|
||||
if (target.pathname === window.location.pathname) {
|
||||
link.setAttribute("aria-current", "page");
|
||||
} else {
|
||||
link.removeAttribute("aria-current");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateActiveNavigation();
|
||||
window.addEventListener("wrnexus:navigated", updateActiveNavigation);
|
||||
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
||||
if (design.mode === "system") applyDesign(design);
|
||||
});
|
||||
@@ -293,7 +304,8 @@
|
||||
const links = [...document.querySelectorAll("[data-docs-component-link]")];
|
||||
let visible = 0;
|
||||
for (const link of links) {
|
||||
const matches = !query || link.textContent.toLowerCase().includes(query);
|
||||
const label = link.querySelector("[data-docs-component-name]")?.textContent || "";
|
||||
const matches = !query || label.toLowerCase().includes(query);
|
||||
link.hidden = !matches;
|
||||
if (matches) visible++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user