Skip to content

Commit 24780b6

Browse files
committed
Update workflow
1 parent 7ca8c61 commit 24780b6

File tree

261 files changed

+23679
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+23679
-0
lines changed

Diff for: src/.icons/logo.afdesign

30.7 KB
Binary file not shown.

Diff for: src/.icons/logo.svg

+6
Loading

Diff for: src/404.html

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
Copyright (c) 2016-2022 Martin Donath <[email protected]>
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to
6+
deal in the Software without restriction, including without limitation the
7+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8+
sell copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20+
IN THE SOFTWARE.
21+
-->
22+
23+
{% extends "main.html" %}
24+
25+
<!-- Content -->
26+
{% block content %}
27+
<h1>404 - Not found</h1>
28+
{% endblock %}

Diff for: src/__init__.py

Whitespace-only changes.

Diff for: src/assets/images/favicon.png

1.83 KB
Loading

Diff for: src/assets/javascripts/_/index.ts

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
* Copyright (c) 2016-2022 Martin Donath <[email protected]>
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to
6+
* deal in the Software without restriction, including without limitation the
7+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8+
* sell copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20+
* IN THE SOFTWARE.
21+
*/
22+
23+
import { getElement, getLocation } from "~/browser"
24+
25+
/* ----------------------------------------------------------------------------
26+
* Types
27+
* ------------------------------------------------------------------------- */
28+
29+
/**
30+
* Feature flag
31+
*/
32+
export type Flag =
33+
| "content.code.annotate" /* Code annotations */
34+
| "header.autohide" /* Hide header */
35+
| "navigation.expand" /* Automatic expansion */
36+
| "navigation.indexes" /* Section pages */
37+
| "navigation.instant" /* Instant loading */
38+
| "navigation.sections" /* Section navigation */
39+
| "navigation.tabs" /* Tabs navigation */
40+
| "navigation.tabs.sticky" /* Tabs navigation (sticky) */
41+
| "navigation.top" /* Back-to-top button */
42+
| "navigation.tracking" /* Anchor tracking */
43+
| "search.highlight" /* Search highlighting */
44+
| "search.share" /* Search sharing */
45+
| "search.suggest" /* Search suggestions */
46+
| "toc.integrate" /* Integrated table of contents */
47+
48+
/* ------------------------------------------------------------------------- */
49+
50+
/**
51+
* Translation
52+
*/
53+
export type Translation =
54+
| "clipboard.copy" /* Copy to clipboard */
55+
| "clipboard.copied" /* Copied to clipboard */
56+
| "search.config.lang" /* Search language */
57+
| "search.config.pipeline" /* Search pipeline */
58+
| "search.config.separator" /* Search separator */
59+
| "search.placeholder" /* Search */
60+
| "search.result.placeholder" /* Type to start searching */
61+
| "search.result.none" /* No matching documents */
62+
| "search.result.one" /* 1 matching document */
63+
| "search.result.other" /* # matching documents */
64+
| "search.result.more.one" /* 1 more on this page */
65+
| "search.result.more.other" /* # more on this page */
66+
| "search.result.term.missing" /* Missing */
67+
| "select.version.title" /* Version selector */
68+
69+
/**
70+
* Translations
71+
*/
72+
export type Translations = Record<Translation, string>
73+
74+
/* ------------------------------------------------------------------------- */
75+
76+
/**
77+
* Versioning
78+
*/
79+
export interface Versioning {
80+
provider: "mike" /* Version provider */
81+
default?: string /* Default version */
82+
}
83+
84+
/**
85+
* Configuration
86+
*/
87+
export interface Config {
88+
base: string /* Base URL */
89+
features: Flag[] /* Feature flags */
90+
translations: Translations /* Translations */
91+
search: string /* Search worker URL */
92+
version?: Versioning /* Versioning */
93+
}
94+
95+
/* ----------------------------------------------------------------------------
96+
* Data
97+
* ------------------------------------------------------------------------- */
98+
99+
/**
100+
* Retrieve global configuration and make base URL absolute
101+
*/
102+
const script = getElement("#__config")
103+
const config: Config = JSON.parse(script.textContent!)
104+
config.base = `${new URL(config.base, getLocation())}`
105+
106+
/* ----------------------------------------------------------------------------
107+
* Functions
108+
* ------------------------------------------------------------------------- */
109+
110+
/**
111+
* Retrieve global configuration
112+
*
113+
* @returns Global configuration
114+
*/
115+
export function configuration(): Config {
116+
return config
117+
}
118+
119+
/**
120+
* Check whether a feature flag is enabled
121+
*
122+
* @param flag - Feature flag
123+
*
124+
* @returns Test result
125+
*/
126+
export function feature(flag: Flag): boolean {
127+
return config.features.includes(flag)
128+
}
129+
130+
/**
131+
* Retrieve the translation for the given key
132+
*
133+
* @param key - Key to be translated
134+
* @param value - Positional value, if any
135+
*
136+
* @returns Translation
137+
*/
138+
export function translation(
139+
key: Translation, value?: string | number
140+
): string {
141+
return typeof value !== "undefined"
142+
? config.translations[key].replace("#", value.toString())
143+
: config.translations[key]
144+
}

Diff for: src/assets/javascripts/browser/document/index.ts

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2016-2022 Martin Donath <[email protected]>
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to
6+
* deal in the Software without restriction, including without limitation the
7+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8+
* sell copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20+
* IN THE SOFTWARE.
21+
*/
22+
23+
import {
24+
ReplaySubject,
25+
Subject,
26+
fromEvent
27+
} from "rxjs"
28+
29+
/* ----------------------------------------------------------------------------
30+
* Functions
31+
* ------------------------------------------------------------------------- */
32+
33+
/**
34+
* Watch document
35+
*
36+
* Documents are implemented as subjects, so all downstream observables are
37+
* automatically updated when a new document is emitted.
38+
*
39+
* @returns Document subject
40+
*/
41+
export function watchDocument(): Subject<Document> {
42+
const document$ = new ReplaySubject<Document>(1)
43+
fromEvent(document, "DOMContentLoaded", { once: true })
44+
.subscribe(() => document$.next(document))
45+
46+
/* Return document */
47+
return document$
48+
}

Diff for: src/assets/javascripts/browser/element/_/.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"jsdoc/require-jsdoc": "off"
4+
}
5+
}

Diff for: src/assets/javascripts/browser/element/_/index.ts

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
* Copyright (c) 2016-2022 Martin Donath <[email protected]>
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to
6+
* deal in the Software without restriction, including without limitation the
7+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8+
* sell copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20+
* IN THE SOFTWARE.
21+
*/
22+
23+
/* ----------------------------------------------------------------------------
24+
* Functions
25+
* ------------------------------------------------------------------------- */
26+
27+
/**
28+
* Retrieve all elements matching the query selector
29+
*
30+
* @template T - Element type
31+
*
32+
* @param selector - Query selector
33+
* @param node - Node of reference
34+
*
35+
* @returns Elements
36+
*/
37+
export function getElements<T extends keyof HTMLElementTagNameMap>(
38+
selector: T, node?: ParentNode
39+
): HTMLElementTagNameMap[T][]
40+
41+
export function getElements<T extends HTMLElement>(
42+
selector: string, node?: ParentNode
43+
): T[]
44+
45+
export function getElements<T extends HTMLElement>(
46+
selector: string, node: ParentNode = document
47+
): T[] {
48+
return Array.from(node.querySelectorAll<T>(selector))
49+
}
50+
51+
/**
52+
* Retrieve an element matching a query selector or throw a reference error
53+
*
54+
* Note that this function assumes that the element is present. If unsure if an
55+
* element is existent, use the `getOptionalElement` function instead.
56+
*
57+
* @template T - Element type
58+
*
59+
* @param selector - Query selector
60+
* @param node - Node of reference
61+
*
62+
* @returns Element
63+
*/
64+
export function getElement<T extends keyof HTMLElementTagNameMap>(
65+
selector: T, node?: ParentNode
66+
): HTMLElementTagNameMap[T]
67+
68+
export function getElement<T extends HTMLElement>(
69+
selector: string, node?: ParentNode
70+
): T
71+
72+
export function getElement<T extends HTMLElement>(
73+
selector: string, node: ParentNode = document
74+
): T {
75+
const el = getOptionalElement<T>(selector, node)
76+
if (typeof el === "undefined")
77+
throw new ReferenceError(
78+
`Missing element: expected "${selector}" to be present`
79+
)
80+
81+
/* Return element */
82+
return el
83+
}
84+
85+
/* ------------------------------------------------------------------------- */
86+
87+
/**
88+
* Retrieve an optional element matching the query selector
89+
*
90+
* @template T - Element type
91+
*
92+
* @param selector - Query selector
93+
* @param node - Node of reference
94+
*
95+
* @returns Element or nothing
96+
*/
97+
export function getOptionalElement<T extends keyof HTMLElementTagNameMap>(
98+
selector: T, node?: ParentNode
99+
): HTMLElementTagNameMap[T] | undefined
100+
101+
export function getOptionalElement<T extends HTMLElement>(
102+
selector: string, node?: ParentNode
103+
): T | undefined
104+
105+
export function getOptionalElement<T extends HTMLElement>(
106+
selector: string, node: ParentNode = document
107+
): T | undefined {
108+
return node.querySelector<T>(selector) || undefined
109+
}
110+
111+
/**
112+
* Retrieve the currently active element
113+
*
114+
* @returns Element or nothing
115+
*/
116+
export function getActiveElement(): HTMLElement | undefined {
117+
return document.activeElement instanceof HTMLElement
118+
? document.activeElement || undefined
119+
: undefined
120+
}

0 commit comments

Comments
 (0)