global: snapshot

This commit is contained in:
nym21
2026-02-13 16:54:09 +01:00
parent d18c872072
commit dfcb04484b
17 changed files with 485 additions and 265 deletions

View File

@@ -9,6 +9,7 @@ import {
} from "./panes/chart.js";
import { initSearch } from "./panes/search.js";
import { replaceHistory } from "./utils/url.js";
import { idle } from "./utils/timing.js";
import { removeStored, writeToStorage } from "./utils/storage.js";
import {
asideElement,
@@ -194,7 +195,7 @@ function initSelected() {
}
initSelected();
requestIdleCallback(() => options.setParent(navElement));
idle(() => options.setParent(navElement));
onFirstIntersection(navElement, () => {
options.setParent(navElement);

View File

@@ -389,10 +389,6 @@ export function initOptions() {
const onSelectedPath = isOnSelectedPath(node.path);
if (onSelectedPath) {
li.dataset.highlight = "";
}
if (node.type === "group") {
const details = window.document.createElement("details");
details.dataset.name = node.serName;
@@ -439,6 +435,7 @@ export function initOptions() {
if (parentEl) return;
parentEl = el;
buildTreeDOM(processedTree, el);
updateHighlight(selected.value);
}
if (!selected.value) {

View File

@@ -11,6 +11,15 @@ export function next() {
return sleep(0);
}
/**
* @param {() => void} callback
*/
export function idle(callback) {
("requestIdleCallback" in window ? requestIdleCallback : setTimeout)(
callback,
);
}
/**
*
* @template {(...args: any[]) => any} F