mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 06:55:15 +00:00
New docs template
This commit is contained in:
parent
8f2ff5158d
commit
11e736f3e8
3 changed files with 556 additions and 480 deletions
|
@ -1,107 +1,112 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
<head>
|
||||||
<!-- Page title -->
|
<meta charset="utf-8" />
|
||||||
<!-- <meta name="description" content="TODO populate this based on the module's description"> -->
|
<!-- Page title -->
|
||||||
<meta name="viewport" content="width=device-width" />
|
<!-- <meta name="description" content="TODO populate this based on the module's description"> -->
|
||||||
<base href="<!-- base -->" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<script type="text/javascript" src="search.js" defer></script>
|
<base href="<!-- base -->" />
|
||||||
<link rel="stylesheet" href="styles.css" />
|
<script type="text/javascript" src="search.js" defer></script>
|
||||||
<link rel="icon" href="/favicon.svg" />
|
<link rel="stylesheet" href="styles.css" />
|
||||||
<!-- Safari ignores rel="icon" and only respects rel="mask-icon". It will render the SVG with
|
<link rel="icon" href="/favicon.svg" />
|
||||||
|
<!-- Safari ignores rel="icon" and only respects rel="mask-icon". It will render the SVG with
|
||||||
fill="#000" unless this `color` attribute here is hardcoded (not a CSS `var()`) to override it.
|
fill="#000" unless this `color` attribute here is hardcoded (not a CSS `var()`) to override it.
|
||||||
-->
|
-->
|
||||||
<link rel="mask-icon" href="/favicon.svg" color="#7d59dd" />
|
<link rel="mask-icon" href="/favicon.svg" color="#7d59dd" />
|
||||||
<!-- Prefetch links -->
|
<!-- Prefetch links -->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav id="sidebar-nav">
|
<nav id="sidebar-nav">
|
||||||
<div class="module-links">
|
<div class="pkg-and-logo">
|
||||||
<!-- Module links -->
|
<a class="logo" href="/" aria-labelledby="logo-link">
|
||||||
</div>
|
<svg viewBox="0 -6 51 58" fill="none" xmlns="http://www.w3.org/2000/svg" aria-labelledby="logo-link"
|
||||||
</nav>
|
role="img">
|
||||||
<div class="header-start-extension">
|
<title id="logo-link">Return to Roc packages</title>
|
||||||
<!-- if the window gets big, this extends the purple bar on the top header to the left edge of the window -->
|
<polygon role="presentation"
|
||||||
|
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<!-- Package Name -->
|
||||||
|
<button class="menu-toggle">
|
||||||
|
<svg viewBox="0 0 72 72" id="emoji" xmlns="http://www.w3.org/2000/svg" fill="currentcolor">
|
||||||
|
<g id="SVGRepo_iconCarrier">
|
||||||
|
<g id="color"></g>
|
||||||
|
<g id="hair"></g>
|
||||||
|
<g id="skin"></g>
|
||||||
|
<g id="skin-shadow"></g>
|
||||||
|
<g id="line">
|
||||||
|
<line x1="16" x2="56" y1="26" y2="26" fill="none" stroke="currentColor"
|
||||||
|
stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2">
|
||||||
|
</line>
|
||||||
|
<line x1="16" x2="56" y1="36" y2="36" fill="none" stroke="currentColor"
|
||||||
|
stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2">
|
||||||
|
</line>
|
||||||
|
<line x1="16" x2="56" y1="46" y2="46" fill="none" stroke="currentColor"
|
||||||
|
stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2">
|
||||||
|
</line>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<header class="top-header">
|
<div class="module-links">
|
||||||
<div class="pkg-and-logo">
|
<!-- Module links -->
|
||||||
<a class="logo" href="/" aria-labelledby="logo-link">
|
</div>
|
||||||
<svg
|
</nav>
|
||||||
viewBox="0 -6 51 58"
|
<main>
|
||||||
fill="none"
|
<form id="module-search-form">
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<button class="menu-toggle">
|
||||||
aria-labelledby="logo-link"
|
<svg viewBox="0 0 72 72" id="emoji" xmlns="http://www.w3.org/2000/svg" fill="currentcolor">
|
||||||
role="img"
|
<g id="SVGRepo_iconCarrier">
|
||||||
>
|
<g id="color"></g>
|
||||||
<title id="logo-link">Return to Roc packages</title>
|
<g id="hair"></g>
|
||||||
<polygon
|
<g id="skin"></g>
|
||||||
role="presentation"
|
<g id="skin-shadow"></g>
|
||||||
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086"
|
<g id="line">
|
||||||
/>
|
<line x1="16" x2="56" y1="26" y2="26" fill="none" stroke="currentColor"
|
||||||
</svg>
|
stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2">
|
||||||
</a>
|
</line>
|
||||||
<!-- Package Name -->
|
<line x1="16" x2="56" y1="36" y2="36" fill="none" stroke="currentColor"
|
||||||
</div>
|
stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2">
|
||||||
<form id="module-search-form">
|
</line>
|
||||||
<input
|
<line x1="16" x2="56" y1="46" y2="46" fill="none" stroke="currentColor"
|
||||||
id="module-search"
|
stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2">
|
||||||
aria-labelledby="search-label"
|
</line>
|
||||||
type="text"
|
</g>
|
||||||
placeholder="Search"
|
</g>
|
||||||
role="combobox"
|
</svg>
|
||||||
aria-autocomplete="list"
|
</button>
|
||||||
aria-expanded="false"
|
<input id="module-search" aria-labelledby="search-label" type="text"
|
||||||
aria-controls="search-type-ahead"
|
placeholder="Search <!-- Package Name String -->" role="combobox" aria-autocomplete="list"
|
||||||
/>
|
aria-expanded="false" aria-controls="search-type-ahead" />
|
||||||
<label for="module-search" id="search-label"
|
<label for="module-search" id="search-label">(press
|
||||||
>(press
|
<span id="search-shortcut-key" aria-hidden="true">s</span>)</label>
|
||||||
<span id="search-shortcut-key" aria-hidden="true">s</span
|
<!-- Magnifying Glass icon -->
|
||||||
>)</label
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" class="search-icon"
|
||||||
>
|
xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 512 512"
|
||||||
<!-- Magnifying Glass icon -->
|
xml:space="preserve">
|
||||||
<svg
|
<g>
|
||||||
version="1.1"
|
<path d="M449.803,62.197C408.443,20.807,353.85-0.037,299.646-0.006C245.428-0.037,190.85,20.807,149.49,62.197
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="search-icon"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
width="24px"
|
|
||||||
height="24px"
|
|
||||||
viewBox="0 0 512 512"
|
|
||||||
xml:space="preserve"
|
|
||||||
>
|
|
||||||
<g>
|
|
||||||
<path
|
|
||||||
d="M449.803,62.197C408.443,20.807,353.85-0.037,299.646-0.006C245.428-0.037,190.85,20.807,149.49,62.197
|
|
||||||
C108.1,103.557,87.24,158.15,87.303,212.338c-0.047,37.859,10.359,75.766,30.547,109.359L15.021,424.525
|
C108.1,103.557,87.24,158.15,87.303,212.338c-0.047,37.859,10.359,75.766,30.547,109.359L15.021,424.525
|
||||||
c-20.016,20.016-20.016,52.453,0,72.469c20,20.016,52.453,20.016,72.453,0L190.318,394.15
|
c-20.016,20.016-20.016,52.453,0,72.469c20,20.016,52.453,20.016,72.453,0L190.318,394.15
|
||||||
c33.578,20.203,71.5,30.594,109.328,30.547c54.203,0.047,108.797-20.797,150.156-62.188
|
c33.578,20.203,71.5,30.594,109.328,30.547c54.203,0.047,108.797-20.797,150.156-62.188
|
||||||
c41.375-41.359,62.234-95.938,62.188-150.172C512.053,158.15,491.178,103.557,449.803,62.197z M391.818,304.541
|
c41.375-41.359,62.234-95.938,62.188-150.172C512.053,158.15,491.178,103.557,449.803,62.197z M391.818,304.541
|
||||||
c-25.547,25.531-58.672,38.125-92.172,38.188c-33.5-0.063-66.609-12.656-92.188-38.188c-25.531-25.578-38.125-58.688-38.188-92.203
|
c-25.547,25.531-58.672,38.125-92.172,38.188c-33.5-0.063-66.609-12.656-92.188-38.188c-25.531-25.578-38.125-58.688-38.188-92.203
|
||||||
c0.063-33.484,12.656-66.609,38.188-92.172c25.578-25.531,58.688-38.125,92.188-38.188c33.5,0.063,66.625,12.656,92.188,38.188
|
c0.063-33.484,12.656-66.609,38.188-92.172c25.578-25.531,58.688-38.125,92.188-38.188c33.5,0.063,66.625,12.656,92.188,38.188
|
||||||
c25.531,25.563,38.125,58.688,38.188,92.172C429.959,245.854,417.365,278.963,391.818,304.541z"
|
c25.531,25.563,38.125,58.688,38.188,92.172C429.959,245.854,417.365,278.963,391.818,304.541z"></path>
|
||||||
></path>
|
</g>
|
||||||
</g>
|
</svg>
|
||||||
</svg>
|
<ul id="search-type-ahead" role="listbox" aria-label="Search Results" class="hidden">
|
||||||
<ul
|
<!-- Search Type Ahead -->
|
||||||
id="search-type-ahead"
|
</ul>
|
||||||
role="listbox"
|
</form>
|
||||||
aria-label="Search Results"
|
<!-- Module Docs -->
|
||||||
class="hidden"
|
|
||||||
>
|
|
||||||
<!-- Search Type Ahead -->
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
</header>
|
|
||||||
<div class="header-end-extension">
|
|
||||||
<!-- if the window gets big, this extends the purple bar on the top header to the right edge of the window -->
|
|
||||||
</div>
|
|
||||||
<main>
|
|
||||||
<!-- Module Docs -->
|
|
||||||
</main>
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>Made by people who like to make nice things.</p>
|
<p>Made by people who like to make nice things.</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</main>
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,231 +1,270 @@
|
||||||
(() => {
|
(() => {
|
||||||
let sidebar = document.getElementById("sidebar-nav");
|
let sidebar = document.getElementById("sidebar-nav");
|
||||||
|
|
||||||
if (sidebar != null) {
|
if (sidebar != null) {
|
||||||
// Un-hide everything
|
// Un-hide everything
|
||||||
sidebar
|
sidebar
|
||||||
.querySelectorAll(".sidebar-entry a")
|
.querySelectorAll(".sidebar-entry a")
|
||||||
.forEach((entry) => entry.classList.remove("hidden"));
|
.forEach((entry) => entry.classList.remove("hidden"));
|
||||||
|
|
||||||
// Re-hide all the sub-entries except for those of the current module
|
// Re-hide all the sub-entries except for those of the current module
|
||||||
let currentModuleName = document.querySelector(".module-name").textContent;
|
let currentModuleName = document.querySelector(".module-name").textContent;
|
||||||
|
|
||||||
sidebar.querySelectorAll(".sidebar-entry").forEach((entry) => {
|
sidebar.querySelectorAll(".sidebar-entry").forEach((entry) => {
|
||||||
let entryName = entry.querySelector(".sidebar-module-link").textContent;
|
let entryName = entry.querySelector(".sidebar-module-link").textContent;
|
||||||
if (currentModuleName === entryName) {
|
if (currentModuleName === entryName) {
|
||||||
entry.firstChild.classList.add("active");
|
entry.firstChild.classList.add("active");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
entry
|
||||||
|
.querySelectorAll(".sidebar-sub-entries a")
|
||||||
|
.forEach((subEntry) => subEntry.classList.add("hidden"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let searchTypeAhead = document.getElementById("search-type-ahead");
|
||||||
|
let searchBox = document.getElementById("module-search");
|
||||||
|
let searchForm = document.getElementById("module-search-form");
|
||||||
|
let topSearchResultListItem = undefined;
|
||||||
|
|
||||||
|
// Hide the results whenever anyone clicks outside the search results.
|
||||||
|
window.addEventListener("click", function (event) {
|
||||||
|
if (!searchForm?.contains(event.target)) {
|
||||||
|
searchTypeAhead.classList.add("hidden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (searchBox != null) {
|
||||||
|
function searchKeyDown(event) {
|
||||||
|
switch (event.key) {
|
||||||
|
case "ArrowDown": {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const focused = document.querySelector(
|
||||||
|
"#search-type-ahead > li:not([class*='hidden']) > a:focus",
|
||||||
|
);
|
||||||
|
|
||||||
|
// Find the next element to focus.
|
||||||
|
let nextToFocus = focused?.parentElement?.nextElementSibling;
|
||||||
|
|
||||||
|
while (
|
||||||
|
nextToFocus != null &&
|
||||||
|
nextToFocus.classList.contains("hidden")
|
||||||
|
) {
|
||||||
|
nextToFocus = nextToFocus.nextElementSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextToFocus == null) {
|
||||||
|
// If none of the links were focused, focus the first one.
|
||||||
|
// Also if we've reached the last one in the list, wrap around to the first.
|
||||||
|
document
|
||||||
|
.querySelector(
|
||||||
|
"#search-type-ahead > li:not([class*='hidden']) > a",
|
||||||
|
)
|
||||||
|
?.focus();
|
||||||
|
} else {
|
||||||
|
nextToFocus.querySelector("a").focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
entry
|
case "ArrowUp": {
|
||||||
.querySelectorAll(".sidebar-sub-entries a")
|
event.preventDefault();
|
||||||
.forEach((subEntry) => subEntry.classList.add("hidden"));
|
|
||||||
});
|
const focused = document.querySelector(
|
||||||
|
"#search-type-ahead > li:not([class*='hidden']) > a:focus",
|
||||||
|
);
|
||||||
|
|
||||||
|
// Find the next element to focus.
|
||||||
|
let nextToFocus = focused?.parentElement?.previousElementSibling;
|
||||||
|
while (
|
||||||
|
nextToFocus != null &&
|
||||||
|
nextToFocus.classList.contains("hidden")
|
||||||
|
) {
|
||||||
|
nextToFocus = nextToFocus.previousElementSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextToFocus == null) {
|
||||||
|
// If none of the links were focused, or we're at the first one, focus the search box again.
|
||||||
|
searchBox?.focus();
|
||||||
|
} else {
|
||||||
|
// If one of the links was focused, focus the previous one
|
||||||
|
nextToFocus.querySelector("a").focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let searchTypeAhead = document.getElementById("search-type-ahead");
|
searchForm.addEventListener("keydown", searchKeyDown);
|
||||||
let searchBox = document.getElementById("module-search");
|
|
||||||
let searchForm = document.getElementById("module-search-form");
|
|
||||||
let topSearchResultListItem = undefined;
|
|
||||||
|
|
||||||
// Hide the results whenever anyone clicks outside the search results.
|
function search() {
|
||||||
window.addEventListener("click", function(event) {
|
topSearchResultListItem = undefined;
|
||||||
if (!searchForm?.contains(event.target)) {
|
let text = searchBox.value.toLowerCase(); // Search is case-insensitive.
|
||||||
searchTypeAhead.classList.add("hidden");
|
|
||||||
|
if (text === "") {
|
||||||
|
searchTypeAhead.classList.add("hidden");
|
||||||
|
} else {
|
||||||
|
let totalResults = 0;
|
||||||
|
// Firsttype-ahead-signature", show/hide all the sub-entries within each module (top-level functions etc.)
|
||||||
|
searchTypeAhead.querySelectorAll("li").forEach((entry) => {
|
||||||
|
const entryModule = entry
|
||||||
|
.querySelector(".type-ahead-module-name")
|
||||||
|
.textContent.toLowerCase();
|
||||||
|
const entryName = entry
|
||||||
|
.querySelector(".type-ahead-def-name")
|
||||||
|
.textContent.toLowerCase();
|
||||||
|
const entrySignature = entry
|
||||||
|
.querySelector(".type-ahead-signature")
|
||||||
|
?.textContent?.toLowerCase()
|
||||||
|
?.replace(/\s+/g, "");
|
||||||
|
|
||||||
|
const qualifiedEntryName = `${entryModule}.${entryName}`;
|
||||||
|
|
||||||
|
if (
|
||||||
|
qualifiedEntryName.includes(text) ||
|
||||||
|
entrySignature?.includes(text.replace(/\s+/g, ""))
|
||||||
|
) {
|
||||||
|
totalResults++;
|
||||||
|
entry.classList.remove("hidden");
|
||||||
|
if (topSearchResultListItem === undefined) {
|
||||||
|
topSearchResultListItem = entry;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
entry.classList.add("hidden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (totalResults < 1) {
|
||||||
|
searchTypeAhead.classList.add("hidden");
|
||||||
|
} else {
|
||||||
|
searchTypeAhead.classList.remove("hidden");
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (searchBox != null) {
|
searchBox.addEventListener("input", search);
|
||||||
function searchKeyDown(event) {
|
|
||||||
switch (event.key) {
|
|
||||||
case "ArrowDown": {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const focused = document.querySelector("#search-type-ahead > li:not([class*='hidden']) > a:focus");
|
search();
|
||||||
|
|
||||||
// Find the next element to focus.
|
function searchSubmit(e) {
|
||||||
let nextToFocus = focused?.parentElement?.nextElementSibling;
|
// pick the top result if the user submits search form
|
||||||
|
e.preventDefault();
|
||||||
|
if (topSearchResultListItem !== undefined) {
|
||||||
|
let topSearchResultListItemAnchor =
|
||||||
|
topSearchResultListItem.querySelector("a");
|
||||||
|
if (topSearchResultListItemAnchor !== null) {
|
||||||
|
topSearchResultListItemAnchor.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
searchForm.addEventListener("submit", searchSubmit);
|
||||||
|
|
||||||
while (nextToFocus != null && nextToFocus.classList.contains("hidden")) {
|
// Capture '/' keypress for quick search
|
||||||
nextToFocus = nextToFocus.nextElementSibling;
|
window.addEventListener("keyup", (e) => {
|
||||||
}
|
if (e.key === "s" && document.activeElement !== searchBox) {
|
||||||
|
e.preventDefault();
|
||||||
|
searchBox.focus();
|
||||||
|
searchBox.value = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (nextToFocus == null) {
|
if (e.key === "Escape") {
|
||||||
// If none of the links were focused, focus the first one.
|
if (document.activeElement === searchBox) {
|
||||||
// Also if we've reached the last one in the list, wrap around to the first.
|
// De-focus and clear input box
|
||||||
document.querySelector("#search-type-ahead > li:not([class*='hidden']) > a")?.focus();
|
searchBox.value = "";
|
||||||
} else {
|
searchBox.blur();
|
||||||
nextToFocus.querySelector("a").focus();
|
} else {
|
||||||
}
|
// Hide the search results
|
||||||
|
searchTypeAhead.classList.add("hidden");
|
||||||
|
|
||||||
break;
|
if (searchTypeAhead.contains(document.activeElement)) {
|
||||||
}
|
searchBox.focus();
|
||||||
case "ArrowUp": {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const focused = document.querySelector("#search-type-ahead > li:not([class*='hidden']) > a:focus");
|
|
||||||
|
|
||||||
// Find the next element to focus.
|
|
||||||
let nextToFocus = focused?.parentElement?.previousElementSibling;
|
|
||||||
while (nextToFocus != null && nextToFocus.classList.contains("hidden")) {
|
|
||||||
nextToFocus = nextToFocus.previousElementSibling;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextToFocus == null) {
|
|
||||||
// If none of the links were focused, or we're at the first one, focus the search box again.
|
|
||||||
searchBox?.focus();
|
|
||||||
} else {
|
|
||||||
// If one of the links was focused, focus the previous one
|
|
||||||
nextToFocus.querySelector("a").focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
searchForm.addEventListener("keydown", searchKeyDown);
|
|
||||||
|
|
||||||
function search() {
|
|
||||||
topSearchResultListItem = undefined;
|
|
||||||
let text = searchBox.value.toLowerCase(); // Search is case-insensitive.
|
|
||||||
|
|
||||||
if (text === "") {
|
|
||||||
searchTypeAhead.classList.add("hidden");
|
|
||||||
} else {
|
|
||||||
let totalResults = 0;
|
|
||||||
// Firsttype-ahead-signature", show/hide all the sub-entries within each module (top-level functions etc.)
|
|
||||||
searchTypeAhead.querySelectorAll("li").forEach((entry) => {
|
|
||||||
const entryModule = entry
|
|
||||||
.querySelector(".type-ahead-module-name")
|
|
||||||
.textContent.toLowerCase()
|
|
||||||
const entryName = entry
|
|
||||||
.querySelector(".type-ahead-def-name")
|
|
||||||
.textContent.toLowerCase();
|
|
||||||
const entrySignature = entry
|
|
||||||
.querySelector(".type-ahead-signature")
|
|
||||||
?.textContent?.toLowerCase()
|
|
||||||
?.replace(/\s+/g, "");
|
|
||||||
|
|
||||||
const qualifiedEntryName = `${entryModule}.${entryName}`
|
|
||||||
|
|
||||||
if ((qualifiedEntryName.includes(text) || entrySignature?.includes(text.replace(/\s+/g, "")))) {
|
|
||||||
totalResults++;
|
|
||||||
entry.classList.remove("hidden");
|
|
||||||
if (topSearchResultListItem === undefined) {
|
|
||||||
topSearchResultListItem = entry;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
entry.classList.add("hidden");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (totalResults < 1) {
|
|
||||||
searchTypeAhead.classList.add("hidden");
|
|
||||||
} else {
|
|
||||||
searchTypeAhead.classList.remove("hidden");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
searchBox.addEventListener("input", search);
|
|
||||||
|
|
||||||
search();
|
|
||||||
|
|
||||||
function searchSubmit(e) {
|
|
||||||
// pick the top result if the user submits search form
|
|
||||||
e.preventDefault();
|
|
||||||
if (topSearchResultListItem !== undefined) {
|
|
||||||
let topSearchResultListItemAnchor =
|
|
||||||
topSearchResultListItem.querySelector("a");
|
|
||||||
if (topSearchResultListItemAnchor !== null) {
|
|
||||||
topSearchResultListItemAnchor.click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
searchForm.addEventListener("submit", searchSubmit);
|
|
||||||
|
|
||||||
// Capture '/' keypress for quick search
|
|
||||||
window.addEventListener("keyup", (e) => {
|
|
||||||
if (e.key === "s" && document.activeElement !== searchBox) {
|
|
||||||
e.preventDefault();
|
|
||||||
searchBox.focus();
|
|
||||||
searchBox.value = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.key === "Escape") {
|
|
||||||
if (document.activeElement === searchBox) {
|
|
||||||
// De-focus and clear input box
|
|
||||||
searchBox.value = "";
|
|
||||||
searchBox.blur();
|
|
||||||
} else {
|
|
||||||
// Hide the search results
|
|
||||||
searchTypeAhead.classList.add("hidden");
|
|
||||||
|
|
||||||
if (searchTypeAhead.contains(document.activeElement)) {
|
|
||||||
searchBox.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const isTouchSupported = () => {
|
|
||||||
try {
|
|
||||||
document.createEvent("TouchEvent");
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Select all <samp> elements that are children of <pre> elements
|
|
||||||
const codeBlocks = document.querySelectorAll("pre > samp");
|
|
||||||
|
|
||||||
// Iterate over each code block
|
|
||||||
codeBlocks.forEach((codeBlock) => {
|
|
||||||
// Create a "Copy" button
|
|
||||||
const copyButton = document.createElement("button");
|
|
||||||
copyButton.classList.add("copy-button");
|
|
||||||
copyButton.textContent = "Copy";
|
|
||||||
|
|
||||||
// Add event listener to copy button
|
|
||||||
copyButton.addEventListener("click", () => {
|
|
||||||
const codeText = codeBlock.innerText;
|
|
||||||
navigator.clipboard.writeText(codeText);
|
|
||||||
copyButton.textContent = "Copied!";
|
|
||||||
copyButton.classList.add("copy-button-copied");
|
|
||||||
copyButton.addEventListener("mouseleave", () => {
|
|
||||||
copyButton.textContent = "Copy";
|
|
||||||
copyButton.classList.remove("copy-button-copied");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a container for the copy button and append it to the document
|
|
||||||
const buttonContainer = document.createElement("div");
|
|
||||||
buttonContainer.classList.add("button-container");
|
|
||||||
buttonContainer.appendChild(copyButton);
|
|
||||||
codeBlock.parentNode.insertBefore(buttonContainer, codeBlock);
|
|
||||||
|
|
||||||
// Hide the button container by default
|
|
||||||
buttonContainer.style.display = "none";
|
|
||||||
|
|
||||||
if (isTouchSupported()) {
|
|
||||||
// Show the button container on click for touch support (e.g. mobile)
|
|
||||||
document.addEventListener("click", (event) => {
|
|
||||||
if (event.target.closest("pre > samp") !== codeBlock) {
|
|
||||||
buttonContainer.style.display = "none";
|
|
||||||
} else {
|
|
||||||
buttonContainer.style.display = "block";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Show the button container on hover for non-touch support (e.g. desktop)
|
|
||||||
codeBlock.parentNode.addEventListener("mouseenter", () => {
|
|
||||||
buttonContainer.style.display = "block";
|
|
||||||
});
|
|
||||||
|
|
||||||
codeBlock.parentNode.addEventListener("mouseleave", () => {
|
|
||||||
buttonContainer.style.display = "none";
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const isTouchSupported = () => {
|
||||||
|
try {
|
||||||
|
document.createEvent("TouchEvent");
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Select all <samp> elements that are children of <pre> elements
|
||||||
|
const codeBlocks = document.querySelectorAll("pre > samp");
|
||||||
|
|
||||||
|
// Iterate over each code block
|
||||||
|
codeBlocks.forEach((codeBlock) => {
|
||||||
|
// Create a "Copy" button
|
||||||
|
const copyButton = document.createElement("button");
|
||||||
|
copyButton.classList.add("copy-button");
|
||||||
|
copyButton.textContent = "Copy";
|
||||||
|
|
||||||
|
// Add event listener to copy button
|
||||||
|
copyButton.addEventListener("click", () => {
|
||||||
|
const codeText = codeBlock.innerText;
|
||||||
|
navigator.clipboard.writeText(codeText);
|
||||||
|
copyButton.textContent = "Copied!";
|
||||||
|
copyButton.classList.add("copy-button-copied");
|
||||||
|
copyButton.addEventListener("mouseleave", () => {
|
||||||
|
copyButton.textContent = "Copy";
|
||||||
|
copyButton.classList.remove("copy-button-copied");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create a container for the copy button and append it to the document
|
||||||
|
const buttonContainer = document.createElement("div");
|
||||||
|
buttonContainer.classList.add("button-container");
|
||||||
|
buttonContainer.appendChild(copyButton);
|
||||||
|
codeBlock.parentNode.insertBefore(buttonContainer, codeBlock);
|
||||||
|
|
||||||
|
// Hide the button container by default
|
||||||
|
buttonContainer.style.display = "none";
|
||||||
|
|
||||||
|
if (isTouchSupported()) {
|
||||||
|
// Show the button container on click for touch support (e.g. mobile)
|
||||||
|
document.addEventListener("click", (event) => {
|
||||||
|
if (event.target.closest("pre > samp") !== codeBlock) {
|
||||||
|
buttonContainer.style.display = "none";
|
||||||
|
} else {
|
||||||
|
buttonContainer.style.display = "block";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Show the button container on hover for non-touch support (e.g. desktop)
|
||||||
|
codeBlock.parentNode.addEventListener("mouseenter", () => {
|
||||||
|
buttonContainer.style.display = "block";
|
||||||
|
});
|
||||||
|
|
||||||
|
codeBlock.parentNode.addEventListener("mouseleave", () => {
|
||||||
|
buttonContainer.style.display = "none";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
let body = document.body;
|
||||||
|
const sidebarOpen = "sidebar-open";
|
||||||
|
const removeOpenClass = () => {
|
||||||
|
body.classList.remove(sidebarOpen);
|
||||||
|
document.body
|
||||||
|
.querySelector("main")
|
||||||
|
.removeEventListener("click", removeOpenClass);
|
||||||
|
};
|
||||||
|
Array.from(document.body.querySelectorAll(".menu-toggle")).forEach(
|
||||||
|
(menuToggle) => {
|
||||||
|
menuToggle.addEventListener("click", (e) => {
|
||||||
|
body.classList.toggle(sidebarOpen);
|
||||||
|
e.stopPropagation();
|
||||||
|
if (body.classList.contains(sidebarOpen)) {
|
||||||
|
document.body.addEventListener("click", removeOpenClass);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -63,26 +63,30 @@ table tr td {
|
||||||
.pkg-full-name {
|
.pkg-full-name {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 32px;
|
font-size: 24px;
|
||||||
margin: 0 8px;
|
margin: 0 8px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry-name {
|
.entry-name {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
font-size: 18px;
|
font-size: 16px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: var(--violet);
|
background-color: var(--violet-bg);
|
||||||
|
color: white;
|
||||||
width: auto;
|
width: auto;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
padding: 8px 16px;
|
padding: 12px 16px;
|
||||||
border-left: 2px solid var(--violet);
|
border: 2px solid var(--violet);
|
||||||
|
}
|
||||||
|
|
||||||
|
.entry-name strong {
|
||||||
|
color: var(--violet);
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry-name a {
|
.entry-name a {
|
||||||
|
@ -109,6 +113,9 @@ table tr td {
|
||||||
.pkg-full-name a {
|
.pkg-full-name a {
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
@ -124,8 +131,12 @@ a:hover code {
|
||||||
min-width: 0; /* necessary for text-overflow: ellipsis to work in descendants */
|
min-width: 0; /* necessary for text-overflow: ellipsis to work in descendants */
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100%;
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
background-color: var(--violet-bg);
|
background-color: var(--violet-bg);
|
||||||
|
padding-block: 16px;
|
||||||
|
position: sticky;
|
||||||
|
top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pkg-and-logo a,
|
.pkg-and-logo a,
|
||||||
|
@ -154,36 +165,48 @@ a:hover code {
|
||||||
body {
|
body {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns:
|
grid-template-columns:
|
||||||
[before-sidebar] 1fr [sidebar] var(--sidebar-width)
|
[sidebar] var(--sidebar-width)
|
||||||
[main-content] fit-content(calc(1280px - var(--sidebar-width)))
|
[main-content] 1fr
|
||||||
[end] 1fr;
|
[content-end];
|
||||||
grid-template-rows: [top-header] var(--top-header-height) [above-footer] auto [footer] auto;
|
grid-template-rows: 1fr;
|
||||||
|
height: 100dvh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: var(--font-sans);
|
font-family: var(--font-sans);
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
background-color: var(--body-bg-color);
|
background-color: var(--body-bg-color);
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
grid-column-start: main-content;
|
grid-column-start: main-content;
|
||||||
grid-column-end: main-content;
|
grid-column-end: content-end;
|
||||||
grid-row-start: above-footer;
|
|
||||||
grid-row-end: above-footer;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 18px;
|
font-size: 16px;
|
||||||
line-height: 1.85em;
|
line-height: 1.85em;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
padding: 48px;
|
padding: 16px;
|
||||||
max-width: 740px;
|
padding-top: 0px;
|
||||||
/* necessary for text-overflow: ellipsis to work in descendants */
|
/* necessary for text-overflow: ellipsis to work in descendants */
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
/* fixes issues with horizonatal scroll in cases where word is too long,
|
/* fixes issues with horizonatal scroll in cases where word is too long,
|
||||||
like in one of the examples at https://www.roc-lang.org/builtins/Num#Dec */
|
like in one of the examples at https://www.roc-lang.org/builtins/Num#Dec */
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
|
overflow-y: auto;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: [main-start] 1fr [main-content-start] 60ch [main-content-end] 1fr [main-end];
|
||||||
|
grid-template-rows: auto;
|
||||||
|
flex-direction: column;
|
||||||
|
scrollbar-color: var(--violet) var(--body-bg-color);
|
||||||
|
scrollbar-gutter: stable both-edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
main > * {
|
||||||
|
grid-column-start: main-content-start;
|
||||||
|
grid-column-end: main-content-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Module links on the package index page (/index.html) */
|
/* Module links on the package index page (/index.html) */
|
||||||
|
@ -195,7 +218,7 @@ main {
|
||||||
|
|
||||||
section {
|
section {
|
||||||
padding: 0px 0px 16px 0px;
|
padding: 0px 0px 16px 0px;
|
||||||
margin: 72px 0px;
|
margin: 36px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
section blockquote {
|
section blockquote {
|
||||||
|
@ -229,33 +252,19 @@ padding: 0px 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-nav {
|
#sidebar-nav {
|
||||||
grid-column-start: sidebar;
|
grid-column-start: sidebar;
|
||||||
grid-column-end: sidebar;
|
grid-column-end: main-content;
|
||||||
grid-row-start: above-footer;
|
position: relative;
|
||||||
grid-row-end: above-footer;
|
display: flex;
|
||||||
position: relative;
|
flex-direction: column;
|
||||||
display: flex;
|
box-sizing: border-box;
|
||||||
flex-direction: column;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
background-color: var(--violet-bg);
|
||||||
padding-left: 56px;
|
overflow-y: auto;
|
||||||
padding-top: 6px;
|
scrollbar-color: var(--violet) var(--violet-bg);
|
||||||
width: 100%;
|
scrollbar-gutter: stable both-edges;
|
||||||
}
|
view-transition-name: sidebar;
|
||||||
|
transition: 1s linear;
|
||||||
.header-start-extension {
|
|
||||||
grid-column-start: before-sidebar;
|
|
||||||
grid-column-end: sidebar;
|
|
||||||
grid-row-start: top-header;
|
|
||||||
grid-row-end: top-header;
|
|
||||||
background-color: var(--violet-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-end-extension {
|
|
||||||
grid-column-start: end;
|
|
||||||
grid-column-end: end;
|
|
||||||
grid-row-start: top-header;
|
|
||||||
grid-row-end: top-header;
|
|
||||||
background-color: var(--violet-bg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-header {
|
.top-header {
|
||||||
|
@ -269,7 +278,7 @@ padding: 0px 16px;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-family: var(--font-sans);
|
font-family: var(--font-sans);
|
||||||
font-size: 24px;
|
font-size: 20px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: var(--violet-bg);
|
background-color: var(--violet-bg);
|
||||||
/* min-width must be set to something (even 0) for text-overflow: ellipsis to work in descendants, but we want this anyway. */
|
/* min-width must be set to something (even 0) for text-overflow: ellipsis to work in descendants, but we want this anyway. */
|
||||||
|
@ -282,10 +291,6 @@ p {
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
grid-column-start: main-content;
|
|
||||||
grid-column-end: main-content;
|
|
||||||
grid-row-start: footer;
|
|
||||||
grid-row-end: footer;
|
|
||||||
max-width: var(--main-content-max-width);
|
max-width: var(--main-content-max-width);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -312,9 +317,9 @@ footer p {
|
||||||
|
|
||||||
.sidebar-entry a {
|
.sidebar-entry a {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
min-height: 48px;
|
min-height: 40px;
|
||||||
min-width: 48px;
|
min-width: 48px;
|
||||||
padding: 12px 16px;
|
padding: 8px 16px;
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +328,10 @@ footer p {
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-sub-entries {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar-sub-entries a {
|
.sidebar-sub-entries a {
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
|
@ -332,14 +341,15 @@ footer p {
|
||||||
margin-left: 14px;
|
margin-left: 14px;
|
||||||
padding-left: 26px;
|
padding-left: 26px;
|
||||||
border-left: 2px solid var(--violet);
|
border-left: 2px solid var(--violet);
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-name {
|
.module-name {
|
||||||
font-size: 56px;
|
font-size: 28px;
|
||||||
line-height: 1em;
|
line-height: 1em;
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-top: 18px;
|
margin-top: 48px;
|
||||||
margin-bottom: 48px;
|
margin-bottom: 48px;
|
||||||
color: var(--violet);
|
color: var(--violet);
|
||||||
}
|
}
|
||||||
|
@ -355,7 +365,7 @@ color: inherit;
|
||||||
|
|
||||||
.sidebar-module-link {
|
.sidebar-module-link {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-size: 18px;
|
font-size: 16px;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -446,11 +456,17 @@ pre>samp {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: var(--violet-bg);
|
position: sticky;
|
||||||
position: relative;
|
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0px var(--module-search-form-padding-width);
|
padding-top: 16px;
|
||||||
|
background-color: var(--body-bg-color);
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-toggle {
|
||||||
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#module-search,
|
#module-search,
|
||||||
|
@ -467,12 +483,13 @@ pre>samp {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-size: 18px;
|
font-size: 16px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
border: none;
|
border: none;
|
||||||
color: var(--faded-color);
|
color: var(--faded-color);
|
||||||
background-color: var(--body-bg-color);
|
background-color: var(--body-bg-color);
|
||||||
font-family: var(--font-serif);
|
font-family: var(--font-serif);
|
||||||
|
border: 2px solid var(--violet-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#module-search::placeholder {
|
#module-search::placeholder {
|
||||||
|
@ -481,7 +498,7 @@ pre>samp {
|
||||||
}
|
}
|
||||||
|
|
||||||
#module-search:focus, #module-search:hover {
|
#module-search:focus, #module-search:hover {
|
||||||
outline: 2px solid var(--faded-color);
|
outline: 2px solid var(--violet);
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-type-ahead {
|
#search-type-ahead {
|
||||||
|
@ -563,13 +580,9 @@ pre>samp {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 18px;
|
|
||||||
padding: 12px 16px;
|
|
||||||
height: 48px;
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 12px;
|
right: 72px;
|
||||||
left: 96px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-shortcut-key {
|
#search-shortcut-key {
|
||||||
|
@ -602,7 +615,6 @@ pre>samp {
|
||||||
|
|
||||||
.module-name {
|
.module-name {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
|
@ -637,143 +649,163 @@ pre>samp {
|
||||||
|
|
||||||
@media only screen and (max-device-width: 480px) and (orientation: portrait) {
|
@media only screen and (max-device-width: 480px) and (orientation: portrait) {
|
||||||
body {
|
body {
|
||||||
grid-template-areas:
|
display: block;
|
||||||
"header"
|
overflow-y: auto;
|
||||||
"main"
|
overflow-x: hidden;
|
||||||
"sidebar"
|
|
||||||
"footer";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-nav {
|
#sidebar-nav {
|
||||||
grid-area: sidebar;
|
display: none;
|
||||||
|
left: calc(-1 * var(--sidebar-width));
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 2;
|
||||||
|
transition: 1s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.sidebar-open #sidebar-nav {
|
||||||
|
display: block;
|
||||||
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
grid-area: main;
|
display: block;
|
||||||
|
margin: 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--top-header-height: 160px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#search-shortcut-key, .header-start-extension, .header-end-extension, #search-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#module-search-form {
|
||||||
|
padding: 16px 16px;
|
||||||
|
height: auto;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
grid-column-start: main-content-start;
|
||||||
|
grid-column-end: main-content-end;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-toggle {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 8px;
|
||||||
|
appearance: none;
|
||||||
|
background-color: transparent;
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-color);
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-toggle svg {
|
||||||
|
height: 48px;
|
||||||
|
width: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide the Copy Link button on mobile. */
|
||||||
|
.entry-name a:first-of-type {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
display: block; /* This is only visible in mobile. */
|
||||||
|
top: calc(1lh / 2 + 16px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-header {
|
.top-header {
|
||||||
grid-area: header;
|
flex-direction: column;
|
||||||
|
height: auto;
|
||||||
|
justify-content: space-between;
|
||||||
|
/* min-width must be set to something (even 0) for text-overflow: ellipsis to work in descendants. */
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
.pkg-full-name {
|
||||||
grid-area: footer;
|
font-size: 20px;
|
||||||
|
padding-bottom: 14px;
|
||||||
}
|
}
|
||||||
:root {
|
|
||||||
--top-header-height: 160px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#search-shortcut-key, .header-start-extension, .header-end-extension, #search-label {
|
.pkg-full-name a {
|
||||||
display: none;
|
vertical-align: middle;
|
||||||
}
|
padding: 18px 0;
|
||||||
|
}
|
||||||
|
|
||||||
#module-search-form {
|
.logo {
|
||||||
padding: 0 16px;
|
width: 50px;
|
||||||
width: 100%;
|
height: 54px;
|
||||||
height: auto;
|
}
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hide the Copy Link button on mobile. */
|
.version {
|
||||||
.entry-name a:first-of-type {
|
margin: 0;
|
||||||
display: none;
|
font-weight: normal;
|
||||||
}
|
font-size: 18px;
|
||||||
|
padding-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.search-button {
|
.module-name {
|
||||||
display: block; /* This is only visible in mobile. */
|
font-size: 24px;
|
||||||
}
|
margin-top: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
.top-header {
|
main {
|
||||||
flex-direction: column;
|
padding: 18px;
|
||||||
height: auto;
|
font-size: 16px;
|
||||||
justify-content: space-between;
|
padding-top: calc(16px + 16px + 1lh + 16px);
|
||||||
/* min-width must be set to something (even 0) for text-overflow: ellipsis to work in descendants. */
|
}
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pkg-full-name {
|
#sidebar-nav {
|
||||||
margin-left: 8px;
|
margin-top: 0;
|
||||||
margin-right: 12px;
|
padding-left: 0;
|
||||||
font-size: 24px;
|
width: var(--sidebar-width);
|
||||||
padding-bottom: 14px;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.pkg-full-name a {
|
#sidebar-heading {
|
||||||
vertical-align: middle;
|
font-size: 24px;
|
||||||
padding: 18px 0;
|
margin: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
h3 {
|
||||||
padding-left: 2px;
|
font-size: 18px;
|
||||||
width: 50px;
|
margin: 0;
|
||||||
height: 54px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version {
|
h4 {
|
||||||
margin: 0;
|
font-size: 16px;
|
||||||
font-weight: normal;
|
}
|
||||||
font-size: 18px;
|
|
||||||
padding-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.module-name {
|
body {
|
||||||
font-size: 36px;
|
margin: 0;
|
||||||
margin-top: 8px;
|
min-width: 320px;
|
||||||
margin-bottom: 8px;
|
max-width: 100dvw;
|
||||||
overflow: hidden;
|
}
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
.top-header-triangle {
|
||||||
padding: 18px;
|
display: none;
|
||||||
font-size: 16px;
|
}
|
||||||
max-width: 480px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar-nav {
|
.pkg-and-logo {
|
||||||
margin-top: 0;
|
width: 100%;
|
||||||
padding-left: 0;
|
}
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar-heading {
|
.pkg-full-name {
|
||||||
font-size: 24px;
|
flex-grow: 1;
|
||||||
margin: 16px;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
.pkg-full-name a {
|
||||||
font-size: 18px;
|
padding-top: 24px;
|
||||||
margin: 0;
|
padding-bottom: 12px;
|
||||||
padding: 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
grid-template-columns: auto;
|
|
||||||
margin: 0;
|
|
||||||
min-width: 320px;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-header-triangle {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pkg-and-logo {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pkg-full-name {
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pkg-full-name a {
|
|
||||||
padding-top: 24px;
|
|
||||||
padding-bottom: 12px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Comments `#` and Documentation comments `##` */
|
/* Comments `#` and Documentation comments `##` */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue