chore: make folder names match crate name

This commit is contained in:
rvcas
2022-12-21 17:42:53 -05:00
committed by Lucas
parent 5694cac1a5
commit 42204d2d71
93 changed files with 7 additions and 7 deletions

View File

@@ -0,0 +1,262 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>{{ page_title }}</title>
<meta name="theme-color" content="#eff1f5" media="(prefers-color-scheme: light)"/>
<meta name="theme-color" content="#1e1e2e" media="(prefers-color-scheme: dark)"/>
<link rel="icon" type="image/svg+xml" sizes="any" href="{{ breadcrumbs }}/favicon.svg"/>
<link rel="stylesheet" href="{{ breadcrumbs }}/css/index.css?v={{ aiken_version }}" type="text/css"/>
<link id="syntax-theme" rel="stylesheet" href="{{ breadcrumbs }}/css/atom-one-light.min.css?v={{ aiken_version }}"/>
</head>
<body class="prewrap-off theme-light drawer-closed">
<script>
"use strict";
window.breadcrumbs = '{{ breadcrumbs }}';
const aikenConfig = {
theme: {
values: (() => {
const dark = {
value: "dark",
label: "Switch to light mode",
icons: ["moon"],
};
const light = {
value: "light",
label: "Switch to dark mode",
icons: ["sun"],
};
return (
window.matchMedia("(prefers-color-scheme: dark)").matches
? [dark, light]
: [light, dark]
).map((item, index) => {
item.icons.push(`toggle-${0 === index ? "left" : "right"}`);
return item;
});
})(),
update: () => "light" === Aiken.getProperty("theme") ? "dark" : "light",
callback: function(value) {
const syntaxThemes = {
dark: "atom-one-dark",
light: "atom-one-light",
};
const syntaxTheme = document.querySelector("#syntax-theme");
const hrefParts = syntaxTheme.href.match(
/^(.*?)([^/\\#?]+?)((?:\.min)?\.css.*)$/i
);
if (syntaxThemes[value] !== hrefParts[2]) {
hrefParts[2] = syntaxThemes[value];
hrefParts.shift();
syntaxTheme.href = hrefParts.join("");
}
},
},
prewrap: {
values: [
{
value: "off",
label: "Switch to line-wrapped snippets",
icons: ["more-horizontal", "toggle-left"],
},
{
value: "on",
label: "Switch to non-wrapped snippets",
icons: ["more-vertical", "toggle-right"],
},
],
update: () => "off" === Aiken.getProperty("prewrap") ? "on" : "off",
},
};
</script>
<script>
"use strict";
/* Initialise options before any content loads */
void function() {
for (const property in aikenConfig) {
const name = `Aiken.${property}`;
let value;
try {
value = localStorage.getItem(name);
if (value.startsWith('"') && value.endsWith('"')) {
localStorage.setItem(name, value.slice(1, value.length - 1));
}
}
catch (_error) {}
const defaultValue = aikenConfig[property].values[0].value;
try {
value = localStorage.getItem(name);
}
catch(_error) {}
if (-1 < [null, undefined].indexOf(value)) {
value = defaultValue;
}
const bodyClasses = document.body.classList;
bodyClasses.remove(`${property}-${defaultValue}`);
bodyClasses.add(`${property}-${value}`);
try {
aikenConfig[property].callback(value);
}
catch(_error) {}
}
}();
</script>
<header class="page-header">
<button class="sidebar-toggle" tabindex="0">
<svg class="label label-closed icon icon-menu" alt="Open Menu" title="Open Menu"><use xlink:href="#icon-menu"></use></svg>
<svg class="label label-open icon icon-x-circle" alt="Close Menu" title="Close Menu"><use xlink:href="#icon-x-circle"></use></svg>
</button>
<h2>
<a href="{{ breadcrumbs }}/">{{ project_name }}</a>
<span id="project-version">
<span>v{{ project_version }} </span>
</span>
<script>
"use strict";
if ("undefined" !== typeof versionNodes) {
const currentVersion = "v{{ project_version }}";
if (! versionNodes.find(element => element.version === currentVersion)) {
versionNodes.unshift({ version: currentVersion, url: "#" });
}
document.querySelector("#project-version").innerHTML =
versionNodes.reduce(
(acc, element) => {
const status =
currentVersion === element.version ? "selected disabled" : "";
return `
${acc}
<option value="${element.url}" ${status}>
${element.version}
</option>
`;
},
`
<form autocomplete="off">
<select onchange="window.location.href = this.value">
`
) + `
</select>
<svg class="icon icon-chevrons-down"><use xlink:href="#icon-chevrons-down"></use></svg>
</form>
`;
}
</script>
</h2>
<div class="search">
<div class="search-input-wrap">
<input type="text" id="search-input" class="search-input" tabindex="0" aria-label="Search {{ project_name }}" autocomplete="off">
<label for="search-input" class="search-label"><svg viewBox="0 0 24 24" class="search-icon"><use xlink:href="#icon-svg-search"></use></svg></label>
</div>
<div id="search-results" class="search-results"></div>
</div>
<button class="search-nav-button" id="search-nav-button" tabindex="0">
<svg class="label icon icon-x-circle" alt="Open Search" title="Open Search"><use xlink:href="#icon-svg-search"></use></svg>
</button>
</header>
<div class="page">
<nav class="sidebar">
<button class="sidebar-toggle" tabindex="1">
<svg class="label icon icon-x-circle" alt="Close Menu" title="Close Menu"><use xlink:href="#icon-x-circle"></use></svg>
</button>
{% if !source.is_empty() %}
<h2>Source code</h2>
<ul>
<li><a href="{{ source.path }}">{{ source.name }}</a></li>
</ul>
{% endif %}
<h2>Modules</h2>
{% if !modules_prefix.is_empty() %}
<h3 class="modules-prefix">{{ modules_prefix }}/</h3>
{% endif %}
<ul>
{% for module in modules %}
<li><a href="{{ breadcrumbs }}/{{ module.path }}">
{% if self.is_current_module(module) %}
<strong>{{ module.name }}</strong>
{% else %}
{{ module.name }}
{% endif %}
</a></li>
{% endfor %}
</ul>
{% block sidebar_content %}{% endblock %}
</nav>
<main class="content">
{% block content %}{% endblock %}
</main>
<div class="search-overlay"></div>
</div>
<svg class="svg-lib" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-chevrons-down" viewBox="0 0 24 24"><path d="M6.293 13.707l5 5c0.391 0.391 1.024 0.391 1.414 0l5-5c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-4.293 4.293-4.293-4.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414zM6.293 6.707l5 5c0.391 0.391 1.024 0.391 1.414 0l5-5c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-4.293 4.293-4.293-4.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z"></path></symbol>
<symbol id="icon-menu" viewBox="0 0 24 24"><path d="M3 13h18c0.552 0 1-0.448 1-1s-0.448-1-1-1h-18c-0.552 0-1 0.448-1 1s0.448 1 1 1zM3 7h18c0.552 0 1-0.448 1-1s-0.448-1-1-1h-18c-0.552 0-1 0.448-1 1s0.448 1 1 1zM3 19h18c0.552 0 1-0.448 1-1s-0.448-1-1-1h-18c-0.552 0-1 0.448-1 1s0.448 1 1 1z"></path></symbol>
<symbol id="icon-moon" viewBox="0 0 24 24"><path d="M21.996 12.882c0.022-0.233-0.038-0.476-0.188-0.681-0.325-0.446-0.951-0.544-1.397-0.219-0.95 0.693-2.060 1.086-3.188 1.162-1.368 0.092-2.765-0.283-3.95-1.158-1.333-0.985-2.139-2.415-2.367-3.935s0.124-3.124 1.109-4.456c0.142-0.191 0.216-0.435 0.191-0.691-0.053-0.55-0.542-0.952-1.092-0.898-2.258 0.22-4.314 1.18-5.895 2.651-1.736 1.615-2.902 3.847-3.137 6.386-0.254 2.749 0.631 5.343 2.266 7.311s4.022 3.313 6.772 3.567 5.343-0.631 7.311-2.266 3.313-4.022 3.567-6.772zM19.567 14.674c-0.49 1.363-1.335 2.543-2.416 3.441-1.576 1.309-3.648 2.016-5.848 1.813s-4.108-1.278-5.417-2.854-2.016-3.648-1.813-5.848c0.187-2.032 1.117-3.814 2.507-5.106 0.782-0.728 1.71-1.3 2.731-1.672-0.456 1.264-0.577 2.606-0.384 3.899 0.303 2.023 1.38 3.934 3.156 5.247 1.578 1.167 3.448 1.668 5.272 1.545 0.752-0.050 1.496-0.207 2.21-0.465z"></path></symbol>
<symbol id="icon-more-horizontal" viewBox="0 0 24 24"><path d="M14 12c0-0.552-0.225-1.053-0.586-1.414s-0.862-0.586-1.414-0.586-1.053 0.225-1.414 0.586-0.586 0.862-0.586 1.414 0.225 1.053 0.586 1.414 0.862 0.586 1.414 0.586 1.053-0.225 1.414-0.586 0.586-0.862 0.586-1.414zM21 12c0-0.552-0.225-1.053-0.586-1.414s-0.862-0.586-1.414-0.586-1.053 0.225-1.414 0.586-0.586 0.862-0.586 1.414 0.225 1.053 0.586 1.414 0.862 0.586 1.414 0.586 1.053-0.225 1.414-0.586 0.586-0.862 0.586-1.414zM7 12c0-0.552-0.225-1.053-0.586-1.414s-0.862-0.586-1.414-0.586-1.053 0.225-1.414 0.586-0.586 0.862-0.586 1.414 0.225 1.053 0.586 1.414 0.862 0.586 1.414 0.586 1.053-0.225 1.414-0.586 0.586-0.862 0.586-1.414z"></path></symbol>
<symbol id="icon-more-vertical" viewBox="0 0 24 24"><path d="M14 12c0-0.552-0.225-1.053-0.586-1.414s-0.862-0.586-1.414-0.586-1.053 0.225-1.414 0.586-0.586 0.862-0.586 1.414 0.225 1.053 0.586 1.414 0.862 0.586 1.414 0.586 1.053-0.225 1.414-0.586 0.586-0.862 0.586-1.414zM14 5c0-0.552-0.225-1.053-0.586-1.414s-0.862-0.586-1.414-0.586-1.053 0.225-1.414 0.586-0.586 0.862-0.586 1.414 0.225 1.053 0.586 1.414 0.862 0.586 1.414 0.586 1.053-0.225 1.414-0.586 0.586-0.862 0.586-1.414zM14 19c0-0.552-0.225-1.053-0.586-1.414s-0.862-0.586-1.414-0.586-1.053 0.225-1.414 0.586-0.586 0.862-0.586 1.414 0.225 1.053 0.586 1.414 0.862 0.586 1.414 0.586 1.053-0.225 1.414-0.586 0.586-0.862 0.586-1.414z"></path></symbol>
<symbol id="icon-star" viewBox="0 0 24 24"><path d="M12.897 1.557c-0.092-0.189-0.248-0.352-0.454-0.454-0.495-0.244-1.095-0.041-1.339 0.454l-2.858 5.789-6.391 0.935c-0.208 0.029-0.411 0.127-0.571 0.291-0.386 0.396-0.377 1.029 0.018 1.414l4.623 4.503-1.091 6.362c-0.036 0.207-0.006 0.431 0.101 0.634 0.257 0.489 0.862 0.677 1.351 0.42l5.714-3.005 5.715 3.005c0.186 0.099 0.408 0.139 0.634 0.101 0.544-0.093 0.91-0.61 0.817-1.155l-1.091-6.362 4.623-4.503c0.151-0.146 0.259-0.344 0.292-0.572 0.080-0.546-0.298-1.054-0.845-1.134l-6.39-0.934zM12 4.259l2.193 4.444c0.151 0.305 0.436 0.499 0.752 0.547l4.906 0.717-3.549 3.457c-0.244 0.238-0.341 0.569-0.288 0.885l0.837 4.883-4.386-2.307c-0.301-0.158-0.647-0.148-0.931 0l-4.386 2.307 0.837-4.883c0.058-0.336-0.059-0.661-0.288-0.885l-3.549-3.457 4.907-0.718c0.336-0.049 0.609-0.26 0.752-0.546z"></path></symbol>
<symbol id="icon-sun" viewBox="0 0 24 24"><path d="M18 12c0-1.657-0.673-3.158-1.757-4.243s-2.586-1.757-4.243-1.757-3.158 0.673-4.243 1.757-1.757 2.586-1.757 4.243 0.673 3.158 1.757 4.243 2.586 1.757 4.243 1.757 3.158-0.673 4.243-1.757 1.757-2.586 1.757-4.243zM16 12c0 1.105-0.447 2.103-1.172 2.828s-1.723 1.172-2.828 1.172-2.103-0.447-2.828-1.172-1.172-1.723-1.172-2.828 0.447-2.103 1.172-2.828 1.723-1.172 2.828-1.172 2.103 0.447 2.828 1.172 1.172 1.723 1.172 2.828zM11 1v2c0 0.552 0.448 1 1 1s1-0.448 1-1v-2c0-0.552-0.448-1-1-1s-1 0.448-1 1zM11 21v2c0 0.552 0.448 1 1 1s1-0.448 1-1v-2c0-0.552-0.448-1-1-1s-1 0.448-1 1zM3.513 4.927l1.42 1.42c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-1.42-1.42c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414zM17.653 19.067l1.42 1.42c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-1.42-1.42c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414zM1 13h2c0.552 0 1-0.448 1-1s-0.448-1-1-1h-2c-0.552 0-1 0.448-1 1s0.448 1 1 1zM21 13h2c0.552 0 1-0.448 1-1s-0.448-1-1-1h-2c-0.552 0-1 0.448-1 1s0.448 1 1 1zM4.927 20.487l1.42-1.42c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-1.42 1.42c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0zM19.067 6.347l1.42-1.42c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-1.42 1.42c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0z"></path></symbol>
<symbol id="icon-toggle-left" viewBox="0 0 24 24"><path d="M8 4c-2.209 0-4.21 0.897-5.657 2.343s-2.343 3.448-2.343 5.657 0.897 4.21 2.343 5.657 3.448 2.343 5.657 2.343h8c2.209 0 4.21-0.897 5.657-2.343s2.343-3.448 2.343-5.657-0.897-4.21-2.343-5.657-3.448-2.343-5.657-2.343zM8 6h8c1.657 0 3.156 0.67 4.243 1.757s1.757 2.586 1.757 4.243-0.67 3.156-1.757 4.243-2.586 1.757-4.243 1.757h-8c-1.657 0-3.156-0.67-4.243-1.757s-1.757-2.586-1.757-4.243 0.67-3.156 1.757-4.243 2.586-1.757 4.243-1.757zM12 12c0-1.104-0.449-2.106-1.172-2.828s-1.724-1.172-2.828-1.172-2.106 0.449-2.828 1.172-1.172 1.724-1.172 2.828 0.449 2.106 1.172 2.828 1.724 1.172 2.828 1.172 2.106-0.449 2.828-1.172 1.172-1.724 1.172-2.828zM10 12c0 0.553-0.223 1.051-0.586 1.414s-0.861 0.586-1.414 0.586-1.051-0.223-1.414-0.586-0.586-0.861-0.586-1.414 0.223-1.051 0.586-1.414 0.861-0.586 1.414-0.586 1.051 0.223 1.414 0.586 0.586 0.861 0.586 1.414z"></path></symbol>
<symbol id="icon-toggle-right" viewBox="0 0 24 24"><path d="M8 4c-2.209 0-4.21 0.897-5.657 2.343s-2.343 3.448-2.343 5.657 0.897 4.21 2.343 5.657 3.448 2.343 5.657 2.343h8c2.209 0 4.21-0.897 5.657-2.343s2.343-3.448 2.343-5.657-0.897-4.21-2.343-5.657-3.448-2.343-5.657-2.343zM8 6h8c1.657 0 3.156 0.67 4.243 1.757s1.757 2.586 1.757 4.243-0.67 3.156-1.757 4.243-2.586 1.757-4.243 1.757h-8c-1.657 0-3.156-0.67-4.243-1.757s-1.757-2.586-1.757-4.243 0.67-3.156 1.757-4.243 2.586-1.757 4.243-1.757zM20 12c0-1.104-0.449-2.106-1.172-2.828s-1.724-1.172-2.828-1.172-2.106 0.449-2.828 1.172-1.172 1.724-1.172 2.828 0.449 2.106 1.172 2.828 1.724 1.172 2.828 1.172 2.106-0.449 2.828-1.172 1.172-1.724 1.172-2.828zM18 12c0 0.553-0.223 1.051-0.586 1.414s-0.861 0.586-1.414 0.586-1.051-0.223-1.414-0.586-0.586-0.861-0.586-1.414 0.223-1.051 0.586-1.414 0.861-0.586 1.414-0.586 1.051 0.223 1.414 0.586 0.586 0.861 0.586 1.414z"></path></symbol>
<symbol id="icon-x-circle" viewBox="0 0 24 24"><path d="M23 12c0-3.037-1.232-5.789-3.222-7.778s-4.741-3.222-7.778-3.222-5.789 1.232-7.778 3.222-3.222 4.741-3.222 7.778 1.232 5.789 3.222 7.778 4.741 3.222 7.778 3.222 5.789-1.232 7.778-3.222 3.222-4.741 3.222-7.778zM21 12c0 2.486-1.006 4.734-2.636 6.364s-3.878 2.636-6.364 2.636-4.734-1.006-6.364-2.636-2.636-3.878-2.636-6.364 1.006-4.734 2.636-6.364 3.878-2.636 6.364-2.636 4.734 1.006 6.364 2.636 2.636 3.878 2.636 6.364zM8.293 9.707l2.293 2.293-2.293 2.293c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0l2.293-2.293 2.293 2.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-2.293-2.293 2.293-2.293c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-2.293 2.293-2.293-2.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z"></path></symbol>
<symbol id="icon-svg-search" viewBox="0 0 24 24">
<title>Search</title>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search">
<circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</symbol>
<symbol id="icon-svg-doc" viewBox="0 0 24 24">
<title>Document</title>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file">
<path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline>
</svg>
</symbol>
</defs>
</svg>
<script src="{{ breadcrumbs }}/js/highlight.min.js?v={{ aiken_version }}"></script>
<script src="{{ breadcrumbs }}/js/highlightjs-aiken.js?v={{ aiken_version }}"></script>
<script>
document.querySelectorAll("pre code").forEach((elem) => {
if (elem.className === "") {
elem.classList.add("aiken");
}
});
hljs.highlightAll();
</script>
<script src="{{ breadcrumbs }}/js/lunr.min.js?v={{ aiken_version }}"></script>
<script src="{{ breadcrumbs }}/js/index.js?v={{ timestamp }}"></script>
<!-- Load the search index using JSONP to avoid CORS issues -->
<script src="{{ breadcrumbs }}/search-data.js?v={{ timestamp }}"></script>
</body>
</html>

View File

@@ -0,0 +1 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#abb2bf;background:#282c34}.hljs-comment,.hljs-quote{color:#5c6370;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword,.hljs-operator{color:#c678dd}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e06c75}.hljs-literal{color:#56b6c2}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string,.hljs-number{color:#98c379}.hljs-attr,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#d19a66}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-title{color:#61aeee}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_,.hljs-title.function_,.hljs-title.invoke__{color:#e6c07b}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}

View File

@@ -0,0 +1 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#383a42;background:#fafafa}.hljs-comment,.hljs-quote{color:#a0a1a7;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword,.hljs-operator{color:#a626a4}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e45649}.hljs-literal{color:#0184bb}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string,.hljs-number{color:#50a14f}.hljs-attr,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#986801}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-title{color:#4078f2}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_,.hljs-title.function_,.hljs-title.invoke__{color:#c18401}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}

View File

@@ -0,0 +1,992 @@
@import url("https://fonts.googleapis.com/css2?family=Nunito+Sans&family=Ubuntu+Mono&display=swap");
:root {
/* Sizes */
--search-width: 680px;
--header-height: 60px;
--hash-offset: calc(var(--header-height) * 1.67);
--sidebar-width: 240px;
--gap: 24px;
--small-gap: calc(var(--gap) / 2);
--tiny-gap: calc(var(--small-gap) / 2);
--large-gap: calc(var(--gap) * 2);
--sidebar-toggle-size: 33px;
--search-height: 4rem;
/* Colors */
--color-text: #4c4f69;
--color-text-accent: #e6e9ef;
--color-inline-code: #ea76cb;
--color-link: #dc8a78;
--color-link-accent: #dd7878;
--color-background: #eff1f5;
--color-background-sidebar: #e6e9ef;
--color-background-accent: #8839ef;
--color-border-accent: #ea76cb;
--color-table-header-background: #bcc0cc;
--color-table-header-text: #4c4f69;
--color-table-background: #e6e9ef;
--color-table-border: #ea76cb;
--color-code-background: #dce0e8;
/* etc */
--nav-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
--shadow:
0 0 0 1px rgba(50, 50, 93, 0.075),
0 0 1px #e9ecef,
0 2px 4px -2px rgba(138, 141, 151, 0.6);
}
* {
box-sizing: border-box;
}
body,
html {
padding: 0;
margin: 0;
font-family: "Nunito Sans", sans-serif;
font-size: 17px;
line-height: 1.4;
position: relative;
min-height: 100vh;
word-break: break-word;
background-color: var(--color-background);
color: var(--color-text);
}
html {
/* This is necessary so hash targets appear below the fixed header */
scroll-padding-top: var(--hash-offset);
}
a,
a:visited {
color: var(--color-link);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
button,
select {
background: transparent;
border: 0 none;
cursor: pointer;
font-family: inherit;
font-size: 100%;
line-height: 1.15;
margin: 0;
text-transform: none;
}
button::-moz-focus-inner {
border-style: none;
padding: 0;
}
button:-moz-focusring {
outline: 1px dotted ButtonText;
}
button {
-webkit-appearance: button;
line-height: 1;
margin: 0;
overflow: visible;
padding: 0;
}
button:active,
select:active {
outline: 0 none;
}
li {
margin-bottom: 4px;
}
p {
margin: var(--small-gap) 0;
}
.rendered-markdown h1,
.rendered-markdown h2,
.rendered-markdown h3,
.rendered-markdown h4,
.rendered-markdown h5 {
font-size: 1.3rem;
}
/* Code */
pre,
code {
font-family: "Ubuntu Mono", monospace;
line-height: 1.2;
background-color: var(--color-code-background);
}
pre {
margin: var(--gap) 0;
border-radius: 1px;
overflow: auto;
box-shadow: var(--shadow);
}
pre > code,
code.hljs {
padding: var(--small-gap) var(--gap);
background: transparent;
}
td code,
p code {
margin: 0 2px;
border-radius: 3px;
padding: 0 0.2em;
color: var(--color-inline-code);
}
/* Page layout */
.page {
display: flex;
}
.content {
margin-left: var(--sidebar-width);
padding: calc(var(--header-height) + var(--gap)) var(--gap) 0 var(--gap);
width: calc(100% - var(--sidebar-width));
max-width: 100%;
}
.content img {
max-width: 100%;
}
/* Page header */
.page-header {
box-shadow: var(--nav-shadow);
height: var(--header-height);
color: var(--color-text-accent);
background-color: var(--color-background-accent);
display: flex;
padding: var(--small-gap) var(--gap);
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 300;
}
.page-header h2 {
align-items: baseline;
display: flex;
margin: 0;
width: var(--sidebar-width);
}
.page-header a,
.page-header a:visited {
color: var(--color-text-accent);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.sidebar-toggle {
display: none;
font-size: var(--sidebar-toggle-size);
opacity: 0;
transition: opacity 1s ease;
}
.search-nav-button {
display: none;
font-size: var(--sidebar-toggle-size);
opacity: 0;
transition: opacity 1s ease;
}
.page-header .sidebar-toggle {
color: var(--color-background);
margin: 0 var(--small-gap) 0 0;
}
.page-header .search-nav-button {
color: var(--color-background);
margin: 0 var(--small-gap) 0 0;
}
/* Version selector */
#project-version {
--half-small-gap: calc(var(--small-gap) / 2);
--icon-size: 0.75em;
flex-shrink: 0;
font-size: 0.9rem;
font-weight: normal;
margin-left: var(--half-small-gap);
}
#project-version > span {
padding-left: var(--half-small-gap);
}
#project-version form {
align-items: center;
display: inline-flex;
justify-content: flex-end;
}
#project-version select {
appearance: none;
-webkit-appearance: none;
padding: 0.6rem calc(1.3 * var(--icon-size)) 0.6rem var(--half-small-gap);
position: relative;
z-index: 1;
}
#project-version option {
background-color: var(--code-background);
}
#project-version .icon {
font-size: var(--icon-size);
margin-left: calc(-1.65 * var(--icon-size));
}
/* Module doc */
.module-name > a,
.module-member-kind > a {
color: inherit;
}
.module-name > a:hover,
.module-member-kind > a:hover {
text-decoration: none;
}
.module-name {
color: var(--color-text);
margin: 0 0 var(--gap);
font-weight: 700;
}
/* Sidebar */
.sidebar {
background-color: var(--color-background-sidebar);
font-size: 0.95rem;
max-height: calc(100vh - var(--header-height));
overflow-y: auto;
overscroll-behavior: contain;
padding-top: var(--gap);
padding-bottom: var(--gap);
padding-left: var(--gap);
position: fixed;
top: var(--header-height);
transition: transform 0.5s ease;
width: var(--sidebar-width);
z-index: 100;
height: 100%;
display: flex;
flex-direction: column;
}
.sidebar h2 {
margin: 0;
color: var(--color-link-accent);
}
.sidebar h3.modules-prefix {
color: var(--color-link);
margin-bottom: 0;
}
.sidebar ul {
list-style: none;
margin: var(--small-gap) 0;
padding: 0;
}
.sidebar h3.modules-prefix + ul {
margin-left: var(--tiny-gap);
}
.sidebar li {
line-height: 1.2;
margin-bottom: 4px;
}
.sidebar ul li a > strong {
font-weight: 900;
color: var(--color-link);
}
.sidebar ul li a > strong::before {
font-size: 0.75em;
content: 'ᐅ ';
padding-right: 0.1rem;
}
.sidebar .sidebar-toggle {
color: var(--color-link);
font-size: calc(0.8 * var(--sidebar-toggle-size));
}
body.drawer-closed .label-open,
body.drawer-open .label-closed {
display: none;
}
.display-controls {
display: flex;
margin-top: auto;
}
.display-controls svg.icon {
color: var(--color-text);
}
.display-controls .control {
margin: 0.5rem 0;
}
.display-controls .control:not(:first-child) {
margin-left: 1rem;
}
.toggle {
align-items: center;
display: flex;
font-size: 0.96rem;
}
.toggle-0 .label:not(.label-0),
.toggle-1 .label:not(.label-1) {
display: none;
}
.label {
display: flex;
}
.label .icon + .icon {
margin-left: 0.5rem;
}
/* Module members (types, functions) */
.module-members {
margin-top: var(--large-gap);
}
.module-member-kind {
font-size: 2rem;
color: var(--color-text);
}
.member {
margin: var(--large-gap) 0;
padding-bottom: var(--gap);
}
.member-name {
display: flex;
align-items: center;
justify-content: space-between;
border-left: 4px solid var(--color-border-accent);
padding: var(--small-gap) var(--gap);
color: var(--color-text-accent);
background-color: var(--color-background-accent);
}
.member-name h2 {
display: flex;
font-size: 1.5rem;
margin: 0;
}
.member-name h2 a {
color: var(--color-text-accent);
}
.member-source {
align-self: baseline;
flex-shrink: 0;
line-height: calc(1.4 * 1.5rem);
margin: 0 0 0 var(--small-gap);
}
/* Custom type constructors */
.constructor-list {
list-style: none;
padding: 0;
}
.constructor-row {
align-items: center;
display: flex;
}
.constructor-item {
margin-bottom: var(--small-gap);
}
.constructor-argument-item {
display: flex;
}
.constructor-argument-label {
flex-shrink: 0;
}
.constructor-argument-doc {
margin-left: var(--gap);
}
.constructor-argument-list {
margin-bottom: var(--small-gap);
}
.constructor-item-docs {
margin-left: var(--large-gap);
margin-bottom: var(--gap);
}
.constructor-item .icon {
flex-shrink: 0;
font-size: 0.7rem;
margin: 0 0.88rem;
}
.constructor-name {
box-shadow: unset;
margin: 0;
}
.constructor-name > code {
padding: var(--small-gap);
}
/* Tables */
table {
border-spacing: 0;
border-collapse: collapse;
}
table td,
table th {
padding: 6px 13px;
border: 1px solid var(--color-table-border);
}
table th {
background-color: var(--color-table-header-background);
color: var(--color-table-header-text);
}
table tr:nth-child(2n) {
background-color: var(--color-table-background);
}
/* Icons */
.svg-lib {
height: 0;
overflow: hidden;
position: absolute;
width: 0;
}
.icon {
display: inline-block;
fill: currentColor;
height: 1em;
stroke: currentColor;
stroke-width: 0;
width: 1em;
}
/* Pre-Wrap Option */
body.prewrap-on code,
body.prewrap-on pre {
white-space: pre-wrap;
}
/* Dark Theme Option */
body.theme-dark {
/* Colors */
--color-text: #cdd6f4;
--color-text-accent: #11111b;
--color-inline-code: #f5c2e7;
--color-link: #f5e0dc;
--color-link-accent: #f2cdcd;
--color-background: #1e1e2e;
--color-background-sidebar: #313244;
--color-background-accent: #cba6f7;
--color-border-accent: #f5c2e7;
--color-table-header-background: #11111b;
--color-table-header-text: #cdd6f4;
--color-table-background: #181825;
--color-table-border: #6c7086;
--color-code-background: #11111b;
/* etc */
--nav-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.1);
--shadow:
0 0 0 1px rgba(50, 50, 93, 0.075),
0 0 1px var(--fg-shade-3),
0 2px 4px -2px rgba(138, 141, 151, 0.2);
}
/* Medium and larger displays */
@media (min-width: 680px) {
#prewrap-toggle {
display: none;
}
}
/* Small displays */
@media (max-width: 920px) {
.page-header {
padding-left: var(--small-gap);
padding-right: var(--small-gap);
}
.page-header h2 {
width: calc(
100% - var(--sidebar-toggle-size) - var(--small-gap) -
var(--sidebar-toggle-size) - var(--small-gap)
);
}
.content {
width: 100%;
max-width: unset;
margin-left: unset;
}
.sidebar {
box-shadow: var(--nav-shadow);
height: 100vh;
max-height: unset;
top: 0;
transform: translate(calc(-10px - var(--sidebar-width)));
z-index: 500;
}
body.drawer-open .sidebar {
transform: translate(0);
}
.sidebar-toggle {
display: block;
opacity: 1;
}
.search-nav-button {
display: block;
opacity: 1;
}
.sidebar .sidebar-toggle {
height: var(--sidebar-toggle-size);
position: absolute;
right: var(--small-gap);
top: var(--small-gap);
width: var(--sidebar-toggle-size);
}
}
/* Search */
.search {
display: none;
position: relative;
z-index: 2;
flex-grow: 1;
height: var(--search-height);
padding: 0.5rem;
transition: padding linear 200ms;
}
@media (min-width: 919px) {
.search {
margin-left: var(--small-gap);
display: block;
position: relative !important;
width: auto !important;
height: 100% !important;
padding: 0;
transition: none;
}
}
.search-input-wrap {
position: relative;
z-index: 1;
height: 3rem;
overflow: hidden;
border-radius: 4px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
transition: height linear 200ms;
}
@media (min-width: 919px) {
.search-input-wrap {
position: absolute;
width: 100%;
max-width: calc(var(--search-width) - var(--gap) - var(--gap));
height: 100% !important;
border-radius: 0;
box-shadow: none;
transition: width ease 400ms;
}
}
.search-input {
position: absolute;
width: 100%;
height: 100%;
padding: 0.5rem 1rem;
font-size: 16px;
background-color: transparent;
color: var(--color-text);
border-top: 0;
border-right: 0;
border-bottom: 0;
border-left: 0;
border-radius: 0;
}
@media (min-width: 919px) {
.search-input {
padding: 1rem;
font-size: 14px;
background-color: var(--color-background);
transition: padding-left linear 200ms;
}
}
.search-input:focus {
outline: 0;
}
.search-label {
position: absolute;
right: 0;
display: flex;
height: 100%;
padding-right: 1rem;
cursor: pointer;
}
@media (min-width: 919px) {
.search-label {
padding-right: 0.6rem;
transition: padding-left linear 200ms;
}
}
.search-label .search-icon {
width: 1.2rem;
height: 1.2rem;
align-self: center;
color: var(--color-text);
}
.search-results {
position: absolute;
left: 0;
display: none;
width: 100%;
max-height: calc(100% - var(--search-height));
overflow-y: auto;
color: var(--color-text);
background-color: var(--color-background);
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
}
@media (min-width: 919px) {
.search-results {
top: 100%;
width: calc(var(--search-width) - var(--gap) - var(--gap));
max-height: calc(100vh - 200%) !important;
}
}
.search-results-list {
padding-left: 0;
margin-bottom: 0.25rem;
list-style: none;
font-size: 14px !important;
}
@media (min-width: 31.25rem) {
.search-results-list {
font-size: 16px !important;
}
}
@media (min-width: 919px) {
.search-results-list {
font-size: 12px !important;
}
}
@media (min-width: 919px) and (min-width: 31.25rem) {
.search-results-list {
font-size: 14px !important;
}
}
.search-results-list-item {
padding: 0;
margin: 0;
}
.search-result {
display: block;
padding-top: 0.25rem;
padding-right: 0.75rem;
padding-bottom: 0.25rem;
padding-left: 0.75rem;
}
.search-result:hover,
.search-result.active {
background-color: var(--code-background);
}
.search-result-title {
display: block;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
@media (min-width: 31.25rem) {
.search-result-title {
display: inline-block;
width: 40%;
padding-right: 0.5rem;
vertical-align: top;
}
}
.search-result-doc {
display: flex;
align-items: center;
word-wrap: break-word;
}
.search-result-doc.search-result-doc-parent {
opacity: 0.5;
font-size: 12px !important;
}
@media (min-width: 31.25rem) {
.search-result-doc.search-result-doc-parent {
font-size: 14px !important;
}
}
@media (min-width: 919px) {
.search-result-doc.search-result-doc-parent {
font-size: 11px !important;
}
}
@media (min-width: 919px) and (min-width: 31.25rem) {
.search-result-doc.search-result-doc-parent {
font-size: 12px !important;
}
}
.search-result-doc .search-result-icon {
width: 1rem;
height: 1rem;
margin-right: 0.5rem;
color: var(--color-link-accent);
flex-shrink: 0;
}
.search-result-doc .search-result-doc-title {
overflow: auto;
color: var(--color-link-accent);
}
.search-result-section {
margin-left: 1.5rem;
word-wrap: break-word;
color: var(--color-link-accent)
}
.search-result-rel-url {
display: block;
margin-left: 1.5rem;
overflow: hidden;
color: var(--color-text);
text-overflow: ellipsis;
white-space: nowrap;
font-size: 9px !important;
}
@media (min-width: 31.25rem) {
.search-result-rel-url {
font-size: 10px !important;
}
}
.search-result-previews {
display: block;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
padding-left: 1rem;
margin-left: 0.5rem;
color: var(--color-text);
word-wrap: break-word;
border-left: 1px solid;
border-left-color: #eeebee;
font-size: 11px !important;
/* TODO: fix it by not adding at the parent? */
white-space: initial !important;
}
@media (min-width: 31.25rem) {
.search-result-previews {
font-size: 12px !important;
}
}
@media (min-width: 31.25rem) {
.search-result-previews {
display: inline-block;
width: 60%;
padding-left: 0.5rem;
margin-left: 0;
vertical-align: top;
}
}
.search-result-preview + .search-result-preview {
margin-top: 0.25rem;
}
.search-result-highlight {
font-weight: bold;
}
.search-no-result {
padding-top: 0.5rem;
padding-right: 0.75rem;
padding-bottom: 0.5rem;
padding-left: 0.75rem;
font-size: 12px !important;
}
@media (min-width: 31.25rem) {
.search-no-result {
font-size: 14px !important;
}
}
.search-button {
position: fixed;
right: 1rem;
bottom: 1rem;
display: flex;
width: 3.5rem;
height: 3.5rem;
background-color: var(--color-background);
border: 1px solid rgba(114, 83, 237, 0.3);
border-radius: 1.75rem;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
align-items: center;
justify-content: center;
}
.search-overlay {
position: fixed;
top: 0;
left: 0;
z-index: 101;
width: 0;
height: 0;
background-color: rgba(0, 0, 0, 0.3);
opacity: 0;
transition: opacity ease 400ms, width 0s 400ms, height 0s 400ms;
}
.search-active .search {
display: block;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 0;
}
.search-active .search-input-wrap {
height: var(--search-height);
border-radius: 0;
}
@media (min-width: 919px) {
.search-active .search-input-wrap {
width: calc(var(--search-width) - var(--gap) - var(--gap));
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
}
}
.search-active .search-input {
background-color: var(--color-background);
}
@media (min-width: 919px) {
.search-active .search-label {
padding-left: 0.6rem;
}
}
.search-active .search-results {
display: block;
}
.search-active .search-overlay {
width: 100%;
height: 100%;
opacity: 1;
transition: opacity ease 400ms, width 0s, height 0s;
}
@media (min-width: 919px) {
.search-active .main {
position: fixed;
right: 0;
left: 0;
}
}
.search-active .main-header {
padding-top: var(--search-height);
}
@media (min-width: 919px) {
.search-active .main-header {
padding-top: 0;
}
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 95 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,126 @@
hljs.registerLanguage("aiken", function (hljs) {
const KEYWORDS =
"as assert when is const fn if let use opaque pub assert check todo type";
const COMMAS = {
scope: "ponctuation",
begin: "[, ]+",
relevance: 0,
};
const NUMBER = {
scope: "number",
variants: [
{
// binary
begin: "\\b0[bB](?:_?[01]+)+",
},
{
// octal
begin: "\\b0[oO](?:_?[0-7]+)+",
},
{
// hex
begin: "\\b0[xX](?:_?[0-9a-fA-F]+)+",
},
{
// dec, float
begin: "\\b\\d(?:_?\\d+)*(?:\\.(?:\\d(?:_?\\d+)*)*)?",
},
],
relevance: 0,
};
const STRING = {
scope: "string",
variants: [{ begin: /"/, end: /"/ }],
contains: [hljs.BACKSLASH_ESCAPE],
relevance: 0,
};
const BYTE_STRING = {
scope: "string",
variants: [{ begin: /#\[/, end: /\]/ }],
contains: [
{ ...NUMBER, scope: "string" },
COMMAS,
],
relevance: 0,
};
const IMPORTS = {
scope: "title",
variants: [{ begin: "/\.{/", end: "}" }],
contains: [
{
scope: "title",
begin: "[A-Za-z][A-Za-z0-9_]*\\w*",
relevance: 0,
},
COMMAS,
],
relevance: 0,
};
const NAME = {
scope: "variable",
begin: "\\b[a-z][a-z0-9_]*\\b",
relevance: 0,
};
const LABEL = {
begin: [/\b[a-z][a-z0-9_]*/, ":"],
beginScope: { 1: "symbol", 2: "operator" },
relevance: 1,
};
const DISCARD_NAME = {
scope: "comment",
begin: "\\b_[a-z][a-z0-9_]*\\b",
relevance: 0,
};
return {
name: "Aiken",
aliases: ["aiken"],
contains: [
hljs.C_LINE_COMMENT_MODE,
STRING,
BYTE_STRING,
{
scope: "function",
beginKeywords: "fn",
end: "\\(",
excludeEnd: true,
contains: [
{
scope: "title.function",
begin: "[a-z][a-z0-9_]*\\w*",
relevance: 0,
},
],
},
{
begin: [/[a-z][a-z0-9_]*/, /[ ]*\(/],
beginScope: { 1: "title.function.invoke", 2: "ponctuation" },
},
{
scope: "keyword",
beginKeywords: "use",
end: " ",
excludeEnd: true,
contains: [],
},
{
scope: "keyword",
beginKeywords: KEYWORDS,
},
{
scope: "title",
begin: "\\b[A-Z][A-Za-z0-9]*\\b",
relevance: 0,
},
{
scope: "operator",
begin: "[+\\-*/%!=<>&|.]+",
relevance: 0,
},
IMPORTS,
LABEL,
DISCARD_NAME,
NUMBER,
],
};
});

View File

@@ -0,0 +1,609 @@
"use strict";
window.Aiken = (function () {
/* Global Object */
const self = {};
/* Public Properties */
self.hashOffset = undefined;
/* Public Methods */
self.getProperty = function (property) {
let value;
try {
value = localStorage.getItem(`Aiken.${property}`);
} catch (_error) {}
if (-1 < [null, undefined].indexOf(value)) {
return aikenConfig[property].values[0].value;
}
return value;
};
self.icons = function () {
return Array.from(arguments).reduce(
(acc, name) =>
`${acc}
<svg class="icon icon-${name}"><use xlink:href="#icon-${name}"></use></svg>`,
""
);
};
self.scrollToHash = function () {
const locationHash = arguments[0] || window.location.hash;
const query = locationHash ? locationHash : "body";
const hashTop = document.querySelector(query).offsetTop;
window.scrollTo(0, hashTop - self.hashOffset);
return locationHash;
};
self.toggleSidebar = function () {
const previousState = bodyClasses.contains("drawer-open")
? "open"
: "closed";
let state;
if (0 < arguments.length) {
state = false === arguments[0] ? "closed" : "open";
} else {
state = "open" === previousState ? "closed" : "open";
}
bodyClasses.remove(`drawer-${previousState}`);
bodyClasses.add(`drawer-${state}`);
if ("open" === state) {
document.addEventListener("click", closeSidebar, false);
}
};
/* Private Properties */
const html = document.documentElement;
const body = document.body;
const bodyClasses = body.classList;
const sidebar = document.querySelector(".sidebar");
const sidebarToggles = document.querySelectorAll(".sidebar-toggle");
const displayControls = document.createElement("div");
displayControls.classList.add("display-controls");
sidebar.appendChild(displayControls);
/* Private Methods */
const initProperty = function (property) {
const config = aikenConfig[property];
displayControls.insertAdjacentHTML(
"beforeend",
config.values.reduce(
(acc, item, index) => {
const tooltip = item.label
? `alt="${item.label}" title="${item.label}"`
: "";
let inner;
if (item.icons) {
inner = self.icons(...item.icons);
} else if (item.label) {
inner = item.label;
} else {
inner = "";
}
return `
${acc}
<span class="label label-${index}" ${tooltip}>
${inner}
</span>
`;
},
`<button
id="${property}-toggle"
class="control control-${property} toggle toggle-0">
`
) +
`
</button>
`
);
setProperty(null, property, function () {
return self.getProperty(property);
});
};
const setProperty = function (_event, property) {
const previousValue = self.getProperty(property);
const update =
2 < arguments.length ? arguments[2] : aikenConfig[property].update;
const value = update();
try {
localStorage.setItem("Aiken." + property, value);
} catch (_error) {}
bodyClasses.remove(`${property}-${previousValue}`);
bodyClasses.add(`${property}-${value}`);
const isDefault = value === aikenConfig[property].values[0].value;
const toggleClasses = document.querySelector(
`#${property}-toggle`
).classList;
toggleClasses.remove(`toggle-${isDefault ? 1 : 0}`);
toggleClasses.add(`toggle-${isDefault ? 0 : 1}`);
try {
aikenConfig[property].callback(value);
} catch (_error) {}
return value;
};
const setHashOffset = function () {
const el = document.createElement("div");
el.style.cssText = `
height: var(--hash-offset);
pointer-events: none;
position: absolute;
visibility: hidden;
width: 0;
`;
body.appendChild(el);
self.hashOffset = parseInt(
getComputedStyle(el).getPropertyValue("height") || "0"
);
body.removeChild(el);
};
const closeSidebar = function (event) {
if (!event.target.closest(".sidebar-toggle")) {
document.removeEventListener("click", closeSidebar, false);
self.toggleSidebar(false);
}
};
const addEvent = function (el, type, handler) {
if (el.attachEvent) el.attachEvent("on" + type, handler);
else el.addEventListener(type, handler);
};
const searchLoaded = function (index, docs) {
const preview_words_after = 10;
const preview_words_before = 5;
const previews = 3;
const searchInput = document.getElementById("search-input");
const searchNavButton = document.getElementById("search-nav-button");
const searchResults = document.getElementById("search-results");
let currentInput;
let currentSearchIndex = 0;
function showSearch() {
document.documentElement.classList.add("search-active");
}
searchNavButton.addEventListener("click", function (e) {
e.stopPropagation();
showSearch();
setTimeout(function () {
searchInput.focus();
}, 0);
});
function hideSearch() {
document.documentElement.classList.remove("search-active");
}
function update() {
currentSearchIndex++;
const input = searchInput.value;
showSearch();
if (input === currentInput) {
return;
}
currentInput = input;
searchResults.innerHTML = "";
if (input === "") {
return;
}
let results = index.query(function (query) {
const tokens = lunr.tokenizer(input);
query.term(tokens, {
boost: 10,
});
query.term(tokens, {
wildcard: lunr.Query.wildcard.TRAILING,
});
});
if (results.length == 0 && input.length > 2) {
const tokens = lunr.tokenizer(input).filter(function (token, i) {
return token.str.length < 20;
});
if (tokens.length > 0) {
results = index.query(function (query) {
query.term(tokens, {
editDistance: Math.round(Math.sqrt(input.length / 2 - 1)),
});
});
}
}
if (results.length == 0) {
const noResultsDiv = document.createElement("div");
noResultsDiv.classList.add("search-no-result");
noResultsDiv.innerText = "No results found";
searchResults.appendChild(noResultsDiv);
} else {
const resultsList = document.createElement("ul");
resultsList.classList.add("search-results-list");
searchResults.appendChild(resultsList);
addResults(resultsList, results, 0, 10, 100, currentSearchIndex);
}
function addResults(
resultsList,
results,
start,
batchSize,
batchMillis,
searchIndex
) {
if (searchIndex != currentSearchIndex) {
return;
}
for (let i = start; i < start + batchSize; i++) {
if (i == results.length) {
return;
}
addResult(resultsList, results[i]);
}
setTimeout(function () {
addResults(
resultsList,
results,
start + batchSize,
batchSize,
batchMillis,
searchIndex
);
}, batchMillis);
}
function addResult(resultsList, result) {
const doc = docs[result.ref];
const resultsListItem = document.createElement("li");
resultsListItem.classList.add("search-results-list-item");
resultsList.appendChild(resultsListItem);
const resultLink = document.createElement("a");
resultLink.classList.add("search-result");
resultLink.setAttribute("href", `${window.breadcrumbs}/${doc.url}`);
resultsListItem.appendChild(resultLink);
const resultTitle = document.createElement("div");
resultTitle.classList.add("search-result-title");
resultLink.appendChild(resultTitle);
const resultDoc = document.createElement("div");
resultDoc.classList.add("search-result-doc");
resultDoc.innerHTML =
'<svg viewBox="0 0 24 24" class="search-result-icon"><use xlink:href="#icon-svg-doc"></use></svg>';
resultTitle.appendChild(resultDoc);
const resultDocTitle = document.createElement("div");
resultDocTitle.classList.add("search-result-doc-title");
resultDocTitle.innerHTML = doc.doc;
resultDoc.appendChild(resultDocTitle);
let resultDocOrSection = resultDocTitle;
if (doc.doc != doc.title) {
resultDoc.classList.add("search-result-doc-parent");
const resultSection = document.createElement("div");
resultSection.classList.add("search-result-section");
resultSection.innerHTML = doc.title;
resultTitle.appendChild(resultSection);
resultDocOrSection = resultSection;
}
const metadata = result.matchData.metadata;
const titlePositions = [];
const contentPositions = [];
for (let j in metadata) {
const meta = metadata[j];
if (meta.title) {
const positions = meta.title.position;
for (let k in positions) {
titlePositions.push(positions[k]);
}
}
if (meta.content) {
const positions = meta.content.position;
for (let k in positions) {
const position = positions[k];
let previewStart = position[0];
let previewEnd = position[0] + position[1];
let ellipsesBefore = true;
let ellipsesAfter = true;
for (let k = 0; k < preview_words_before; k++) {
const nextSpace = doc.content.lastIndexOf(
" ",
previewStart - 2
);
const nextDot = doc.content.lastIndexOf(". ", previewStart - 2);
if (nextDot >= 0 && nextDot > nextSpace) {
previewStart = nextDot + 1;
ellipsesBefore = false;
break;
}
if (nextSpace < 0) {
previewStart = 0;
ellipsesBefore = false;
break;
}
previewStart = nextSpace + 1;
}
for (let k = 0; k < preview_words_after; k++) {
const nextSpace = doc.content.indexOf(" ", previewEnd + 1);
const nextDot = doc.content.indexOf(". ", previewEnd + 1);
if (nextDot >= 0 && nextDot < nextSpace) {
previewEnd = nextDot;
ellipsesAfter = false;
break;
}
if (nextSpace < 0) {
previewEnd = doc.content.length;
ellipsesAfter = false;
break;
}
previewEnd = nextSpace;
}
contentPositions.push({
highlight: position,
previewStart: previewStart,
previewEnd: previewEnd,
ellipsesBefore: ellipsesBefore,
ellipsesAfter: ellipsesAfter,
});
}
}
}
if (titlePositions.length > 0) {
titlePositions.sort(function (p1, p2) {
return p1[0] - p2[0];
});
resultDocOrSection.innerHTML = "";
addHighlightedText(
resultDocOrSection,
doc.title,
0,
doc.title.length,
titlePositions
);
}
if (contentPositions.length > 0) {
contentPositions.sort(function (p1, p2) {
return p1.highlight[0] - p2.highlight[0];
});
let contentPosition = contentPositions[0];
let previewPosition = {
highlight: [contentPosition.highlight],
previewStart: contentPosition.previewStart,
previewEnd: contentPosition.previewEnd,
ellipsesBefore: contentPosition.ellipsesBefore,
ellipsesAfter: contentPosition.ellipsesAfter,
};
const previewPositions = [previewPosition];
for (let j = 1; j < contentPositions.length; j++) {
contentPosition = contentPositions[j];
if (previewPosition.previewEnd < contentPosition.previewStart) {
previewPosition = {
highlight: [contentPosition.highlight],
previewStart: contentPosition.previewStart,
previewEnd: contentPosition.previewEnd,
ellipsesBefore: contentPosition.ellipsesBefore,
ellipsesAfter: contentPosition.ellipsesAfter,
};
previewPositions.push(previewPosition);
} else {
previewPosition.highlight.push(contentPosition.highlight);
previewPosition.previewEnd = contentPosition.previewEnd;
previewPosition.ellipsesAfter = contentPosition.ellipsesAfter;
}
}
const resultPreviews = document.createElement("div");
resultPreviews.classList.add("search-result-previews");
resultLink.appendChild(resultPreviews);
const content = doc.content;
for (
let j = 0;
j < Math.min(previewPositions.length, previews);
j++
) {
const position = previewPositions[j];
const resultPreview = document.createElement("div");
resultPreview.classList.add("search-result-preview");
resultPreviews.appendChild(resultPreview);
if (position.ellipsesBefore) {
resultPreview.appendChild(document.createTextNode("... "));
}
addHighlightedText(
resultPreview,
content,
position.previewStart,
position.previewEnd,
position.highlight
);
if (position.ellipsesAfter) {
resultPreview.appendChild(document.createTextNode(" ..."));
}
}
}
const resultRelUrl = document.createElement("span");
resultRelUrl.classList.add("search-result-rel-url");
resultRelUrl.innerText = doc.url;
resultTitle.appendChild(resultRelUrl);
}
function addHighlightedText(parent, text, start, end, positions) {
let index = start;
for (let i in positions) {
const position = positions[i];
const span = document.createElement("span");
span.innerHTML = text.substring(index, position[0]);
parent.appendChild(span);
index = position[0] + position[1];
const highlight = document.createElement("span");
highlight.classList.add("search-result-highlight");
highlight.innerHTML = text.substring(position[0], index);
parent.appendChild(highlight);
}
const span = document.createElement("span");
span.innerHTML = text.substring(index, end);
parent.appendChild(span);
}
}
addEvent(searchInput, "focus", function () {
setTimeout(update, 0);
});
addEvent(searchInput, "keyup", function (e) {
switch (e.keyCode) {
case 27: // When esc key is pressed, hide the results and clear the field
searchInput.value = "";
break;
case 38: // arrow up
case 40: // arrow down
case 13: // enter
e.preventDefault();
return;
}
update();
});
addEvent(searchInput, "keydown", function (e) {
let active;
switch (e.keyCode) {
case 38: // arrow up
e.preventDefault();
active = document.querySelector(".search-result.active");
if (active) {
active.classList.remove("active");
if (active.parentElement.previousSibling) {
const previous =
active.parentElement.previousSibling.querySelector(
".search-result"
);
previous.classList.add("active");
}
}
return;
case 40: // arrow down
e.preventDefault();
active = document.querySelector(".search-result.active");
if (active) {
if (active.parentElement.nextSibling) {
const next =
active.parentElement.nextSibling.querySelector(
".search-result"
);
active.classList.remove("active");
next.classList.add("active");
}
} else {
const next = document.querySelector(".search-result");
if (next) {
next.classList.add("active");
}
}
return;
case 13: // enter
e.preventDefault();
active = document.querySelector(".search-result.active");
if (active) {
active.click();
} else {
const first = document.querySelector(".search-result");
if (first) {
first.click();
}
}
return;
}
});
addEvent(document, "click", function (e) {
if (e.target != searchInput) {
hideSearch();
}
});
};
self.initSearch = function initSeach(docs) {
// enable support for hyphenated search words
lunr.tokenizer.separator = /[\s/]+/;
const index = lunr(function () {
this.ref("id");
this.field("title", { boost: 200 });
this.field("content", { boost: 2 });
this.field("url");
this.metadataWhitelist = ["position"];
for (let [i, entry] of docs.entries()) {
this.add({
id: i,
title: entry.title,
content: entry.content,
url: `${window.breadcrumbs}/${entry.url}`,
});
}
});
searchLoaded(index, docs);
};
const init = function () {
for (let property in aikenConfig) {
initProperty(property);
const toggle = document.querySelector(`#${property}-toggle`);
toggle.addEventListener("click", function (event) {
setProperty(event, property);
});
}
sidebarToggles.forEach(function (sidebarToggle) {
sidebarToggle.addEventListener("click", function (event) {
event.preventDefault();
self.toggleSidebar();
});
});
setHashOffset();
window.addEventListener("load", function (_event) {
self.scrollToHash();
});
window.addEventListener("hashchange", function (_event) {
self.scrollToHash();
});
document
.querySelectorAll(
`
.module-name > a,
.member-name a[href^='#']
`
)
.forEach(function (title) {
title.innerHTML = title.innerHTML.replace(
/([A-Z])|([_/])/g,
"$2<wbr>$1"
);
});
};
/* Initialise */
init();
return self;
})();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,165 @@
{% extends "_layout.html" %}
{% block sidebar_content %}
{% if !types.is_empty() %}
<h2>Types</h2>
<ul>
{% for type_info in types %}
<li><a href="#{{ type_info.name }}">{{ type_info.name }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% if !constants.is_empty() %}
<h2>Constants</h2>
<ul>
{% for constant in constants %}
<li><a href="#{{ constant.name }}">{{ constant.name }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% if !functions.is_empty() %}
<h2>Functions</h2>
<ul>
{% for function in functions %}
<li><a href="#{{ function.name }}">{{ function.name }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
{% block content %}
<h1 id="module-name" class="module-name">
<a href="#module-name">{{ module_name }}</a>
</h1>
{{ documentation|safe }}
{% if !types.is_empty() %}
<section class="module-members">
<h1 id="module-types" class="module-member-kind">
<a href="#module-types">Types</a>
</h1>
{% for type_info in types %}
<div class="member">
<div class="member-name">
<h2 id="{{ type_info.name }}">
<a href="#{{ type_info.name }}">
{{ type_info.name }}
</a>
</h2>
{% if !type_info.source_url.is_empty() %}
<!-- TODO: support source linking
<a class="member-source" alt="View Source" title="View Source" href="{{ type_info.source_url|safe }}">
&lt;/&gt;
</a>
-->
{% endif %}
</div>
<div class="custom-type-constructors">
<div class="rendered-markdown">{{ type_info.documentation|safe }}</div>
<pre><code class="hljs aiken">{{ type_info.definition }}</code></pre>
{% if !type_info.constructors.is_empty() %}
<h3>
Constructors
</h3>
<ul class="constructor-list">
{% for constructor in type_info.constructors %}
<li class="constructor-item">
<div class="constructor-row">
<svg class="icon icon-star"><use xlink:href="#icon-star"></use></svg>
<pre class="constructor-name"><code class="hljs aiken">{{ constructor.definition }}</code></pre>
</div>
<div class="constructor-item-docs">
{{ constructor.documentation|safe }}
{% if !constructor.arguments.is_empty() %}
<h4>
Arguments
</h4>
<ul class="constructor-argument-list">
{% for argument in constructor.arguments %}
<li>
<div class="constructor-argument-item">
<p class="constructor-argument-label">
<i>{{ argument.label }}</i>
</p>
<div class="constructor-argument-doc">
{{ argument.documentation|safe }}
</div>
</div>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endfor %}
</section>
{% endif %}
{% if !constants.is_empty() %}
<section class="module-members">
<h1 id="module-constants" class="module-member-kind">
<a href="#module-constants">Constants</a>
</h1>
{% for constant in constants %}
<div class="member">
<div class="member-name">
<h2 id="{{ constant.name }}">
<a href="#{{ constant.name }}">
{{ constant.name }}
</a>
</h2>
{% if !constant.source_url.is_empty() %}
<!-- TODO: support source linking
<a class="member-source" alt="View Source" title="View Source" href="{{ constant.source_url|safe }}">
&lt;/&gt;
</a>
-->
{% endif %}
</div>
<pre><code class="hljs aiken">{{ constant.definition }}</code></pre>
<div class="rendered-markdown">{{ constant.documentation|safe }}</div>
</div>
{% endfor %}
</section>
{% endif %}
{% if !functions.is_empty() %}
<section class="module-members">
<h1 id="module-functions" class="module-member-kind">
<a href="#module-functions">Functions</a>
</h1>
{% for function in functions %}
<div class="member">
<div class="member-name">
<h2 id="{{ function.name }}">
<a href="#{{ function.name }}">
{{ function.name }}
</a>
</h2>
{% if !function.source_url.is_empty() %}
<!-- TODO: support source linking
<a class="member-source" alt="View Source" title="View Source" href="{{ function.source_url|safe }}">
&lt;/&gt;
</a>
-->
{% endif %}
</div>
<pre><code class="hljs aiken">{{ function.signature }}</code></pre>
<div class="rendered-markdown">{{ function.documentation|safe }}</div>
</div>
{% endfor %}
</section>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,9 @@
{% extends "_layout.html" %}
{% block title %}
{{ title }} - {{ project_name }}
{% endblock %}
{% block content %}
{{ content|safe }}
{% endblock %}