Update editor, themes, menus, backgrounds, and release tooling

This commit is contained in:
Knotty Wyvern
2026-10-14 16:19:51 -07:00
parent f6eaa52949
commit edef2520af
113 changed files with 5722 additions and 386 deletions
+7 -8
View File
@@ -2,6 +2,8 @@ import { StateField, type EditorState, type Range } from "@codemirror/state";
import { Decoration, EditorView, WidgetType, keymap } from "@codemirror/view";
import { codeFolding, foldEffect, foldKeymap, foldedRanges, foldService, syntaxTree, unfoldEffect } from "@codemirror/language";
import { actionIcon } from "../ui/actionIcons";
import { attachTooltip } from "../ui/tooltip";
const tooltipCleanups = new WeakMap<HTMLElement, () => void>();
export type HeadingRange = { start: number; from: number; to: number; level: number; label: string };
@@ -29,12 +31,9 @@ export function headingButton(label: string, collapsed: boolean): HTMLButtonElem
button.setAttribute("aria-expanded", String(!collapsed));
const title = `${collapsed ? "Expand" : "Collapse"} ${label || "heading"}`;
button.setAttribute("aria-label", title);
button.title = title;
tooltipCleanups.set(button, attachTooltip(button, () => button.getAttribute("aria-label") || ""));
const icon = actionIcon("chevron");
const tooltip = document.createElement("span");
tooltip.className = "rs-heading-tooltip";
tooltip.textContent = title;
button.append(icon, tooltip);
button.append(icon);
return button;
}
@@ -55,6 +54,7 @@ class HeadingToggle extends WidgetType {
};
return button;
}
destroy(dom: HTMLElement) { tooltipCleanups.get(dom)?.(); }
ignoreEvent() { return true; }
}
@@ -103,8 +103,7 @@ export function readerHeadingFolding(root: HTMLElement, collapsed: Set<string>)
const label = `${collapsed.has(item.key) ? "Expand" : "Collapse"} ${item.label}`;
button.setAttribute("aria-expanded", String(!collapsed.has(item.key)));
button.setAttribute("aria-label", label);
button.title = label;
button.querySelector(".rs-heading-tooltip")!.textContent = label;
item.heading.classList.toggle("rs-heading-collapsed", collapsed.has(item.key));
}
if (!collapsed.has(item.key)) return;
@@ -137,7 +136,7 @@ export function readerHeadingFolding(root: HTMLElement, collapsed: Set<string>)
},
destroy() {
elements.forEach(element => { element.hidden = false; });
headings.forEach(item => { item.heading.querySelector(".rs-heading-toggle")?.remove(); item.heading.classList.remove("rs-foldable-heading", "rs-heading-collapsed"); });
headings.forEach(item => { const button = item.heading.querySelector<HTMLElement>(".rs-heading-toggle"); if (button) tooltipCleanups.get(button)?.(); button?.remove(); item.heading.classList.remove("rs-foldable-heading", "rs-heading-collapsed"); });
},
};
}