@brillout/docpress 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src/css/Inter-Var.ttf → dist/Inter-Var-IOAEQULN.ttf} +0 -0
- package/{src/components/Sponsors/companyLogos/ccoli.svg → dist/ccoli-CHW3TQKS.svg} +0 -0
- package/{src/icons/changelog.svg → dist/changelog-IPI5F42D.svg} +0 -0
- package/{src/navigation/navigation-fullscreen/chevron.svg → dist/chevron-K3WPYLOP.svg} +0 -0
- package/{src/components/features/chevron.svg → dist/chevron-R2IYJD62.svg} +0 -0
- package/dist/chunk-3NFN2KUH.js +1 -0
- package/dist/chunk-3NFN2KUH.js.map +1 -0
- package/dist/chunk-G2KXEHNF.js +56 -0
- package/dist/chunk-G2KXEHNF.js.map +1 -0
- package/dist/{cli/chunk-KZROB63P.js → chunk-G6OTZHVA.js} +2 -1
- package/dist/chunk-G6OTZHVA.js.map +1 -0
- package/dist/chunk-JKLALMFU.js +103 -0
- package/dist/chunk-JKLALMFU.js.map +1 -0
- package/dist/chunk-OEVBWUR6.js +92 -0
- package/dist/chunk-OEVBWUR6.js.map +1 -0
- package/dist/chunk-TTLAZ2T2.js +8 -0
- package/dist/chunk-TTLAZ2T2.js.map +1 -0
- package/dist/chunk-UCY72YQS.js +178 -0
- package/dist/chunk-UCY72YQS.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +4 -2
- package/dist/cli/index.js.map +1 -0
- package/{src/navigation/navigation-fullscreen/close.svg → dist/close-IQXTDOHV.svg} +0 -0
- package/{src/utils/Emoji/compass.svg → dist/compass-2RWQU3E4.svg} +0 -0
- package/{src/components/Sponsors/companyLogos/contra.svg → dist/contra-WLZBOPBV.svg} +0 -0
- package/dist/{cli/devServer.js → devServer-UEJORYCC.js} +3 -1
- package/dist/devServer-UEJORYCC.js.map +1 -0
- package/{src/icons/discord.svg → dist/discord-JD33TUSF.svg} +0 -0
- package/{src/utils/Emoji/engine.png → dist/engine-6Q6VSCVA.png} +0 -0
- package/{src/icons/github.svg → dist/github-P5ZSKN2N.svg} +0 -0
- package/{src/icons/heart.svg → dist/heart-OINVKOXO.svg} +0 -0
- package/dist/index.css +121 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +488 -0
- package/dist/index.js.map +1 -0
- package/{src/components/Sponsors/label.svg → dist/label-MP75CTIA.svg} +0 -0
- package/{src/utils/Emoji/mechanical-arm.svg → dist/mechanical-arm-TR7IQQMG.svg} +0 -0
- package/{src/components/Sponsors/medalBronze.svg → dist/medalBronze-CO4CTUR4.svg} +0 -0
- package/{src/components/Sponsors/medalGold.svg → dist/medalGold-UP6A73FL.svg} +0 -0
- package/{src/components/Sponsors/medalSilver.svg → dist/medalSilver-FAPGGOBN.svg} +0 -0
- package/{src/components/Sponsors/companyLogos/mfqs.svg → dist/mfqs-2EAEE7N6.svg} +0 -0
- package/{src/utils/Emoji/road-fork.svg → dist/road-fork-3WZLW3HB.svg} +0 -0
- package/{src/utils/Emoji/shield.svg → dist/shield-CU45RG5C.svg} +0 -0
- package/{src → dist/src}/components/features/FeatureList.css +2 -7
- package/dist/src/components/features/FeatureList.css.map +1 -0
- package/dist/src/components/features/FeatureList.d.ts +13 -0
- package/dist/src/components/features/FeatureList.js +8 -0
- package/dist/src/components/features/FeatureList.js.map +1 -0
- package/dist/src/components/features/initFeatureList.d.ts +3 -0
- package/dist/src/components/features/initFeatureList.js +60 -0
- package/dist/src/components/features/initFeatureList.js.map +1 -0
- package/dist/src/renderer/_default.page.client.css +272 -0
- package/dist/src/renderer/_default.page.client.css.map +1 -0
- package/dist/src/renderer/_default.page.client.d.ts +1 -0
- package/dist/src/renderer/_default.page.client.js +182 -0
- package/dist/src/renderer/_default.page.client.js.map +1 -0
- package/dist/src/renderer/_default.page.server.css +312 -0
- package/dist/src/renderer/_default.page.server.css.map +1 -0
- package/dist/src/renderer/_default.page.server.d.ts +22 -0
- package/dist/src/renderer/_default.page.server.js +602 -0
- package/dist/src/renderer/_default.page.server.js.map +1 -0
- package/{src/icons/twitter.svg → dist/twitter-I7DXDN3J.svg} +0 -0
- package/{src/utils/Emoji/typescript.svg → dist/typescript-ALIPKLRM.svg} +0 -0
- package/package.json +25 -17
- package/vite.config.ts +10 -4
- package/cli.mjs +0 -2
- package/dist/cli/configFile.js +0 -6
- package/src/MobileHeader.tsx +0 -68
- package/src/PageLayout.css +0 -41
- package/src/PageLayout.tsx +0 -37
- package/src/algolia/DocSearch.css +0 -29
- package/src/algolia/DocSearch.ts +0 -37
- package/src/autoScrollNav.ts +0 -22
- package/src/components/CodeBlock.tsx +0 -22
- package/src/components/DocLink.tsx +0 -108
- package/src/components/EditPageNote.tsx +0 -18
- package/src/components/HorizontalLine.tsx +0 -20
- package/src/components/ImportMeta.tsx +0 -11
- package/src/components/Info.tsx +0 -12
- package/src/components/Link.tsx +0 -18
- package/src/components/Note.tsx +0 -31
- package/src/components/P.css +0 -8
- package/src/components/P.tsx +0 -8
- package/src/components/ReadingRecommendation.tsx +0 -53
- package/src/components/RepoLink.tsx +0 -24
- package/src/components/Sponsors/companyLogos/ccoli-logo.svg +0 -1
- package/src/components/Sponsors/companyLogos/ccoli-text.svg +0 -1
- package/src/components/Sponsors/label.draft.svg +0 -108
- package/src/components/Sponsors.tsx +0 -243
- package/src/components/features/FeatureList.tsx +0 -114
- package/src/components/features/initFeatureList.ts +0 -66
- package/src/components/index.ts +0 -13
- package/src/config/Config.ts +0 -30
- package/src/config/getConfig.ts +0 -18
- package/src/config/resolveConfig/resolveHeading.ts +0 -0
- package/src/config/resolvePageContext.ts +0 -157
- package/src/css/button.css +0 -7
- package/src/css/code/block.css +0 -36
- package/src/css/code/inline.css +0 -27
- package/src/css/code.css +0 -20
- package/src/css/colorize-on-hover.css +0 -29
- package/src/css/font.css +0 -19
- package/src/css/heading.css +0 -25
- package/src/css/index.css +0 -10
- package/src/css/link.css +0 -17
- package/src/css/note.css +0 -26
- package/src/css/reset.css +0 -12
- package/src/css/table.css +0 -14
- package/src/css/tooltip.css +0 -11
- package/src/headings.ts +0 -201
- package/src/index.ts +0 -3
- package/src/installSectionUrlHashs.ts +0 -50
- package/src/navigation/Navigation-highlight.css +0 -41
- package/src/navigation/Navigation-items.css +0 -122
- package/src/navigation/Navigation-layout.css +0 -118
- package/src/navigation/Navigation.client.old.ts +0 -303
- package/src/navigation/Navigation.client.ts +0 -19
- package/src/navigation/Navigation.css +0 -12
- package/src/navigation/Navigation.tsx +0 -229
- package/src/navigation/NavigationHeader.tsx +0 -97
- package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.css +0 -32
- package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +0 -44
- package/src/navigation/navigation-fullscreen/initNavigationFullscreen.ts +0 -115
- package/src/parseEmojis.ts +0 -33
- package/src/renderer/_default.page.client.ts +0 -7
- package/src/renderer/_default.page.server.tsx +0 -69
- package/src/renderer/usePageContext.tsx +0 -25
- package/src/types.ts +0 -2
- package/src/utils/Emoji/Emoji.ts +0 -216
- package/src/utils/Emoji/assets.ts +0 -9
- package/src/utils/Emoji/index.ts +0 -1
- package/src/utils/Emoji/mountain.svg +0 -1
- package/src/utils/assert.ts +0 -39
- package/src/utils/determineSectionUrlHash.ts +0 -35
- package/src/utils/filter.ts +0 -12
- package/src/utils/index.ts +0 -6
- package/src/utils/isBrowser.ts +0 -5
- package/src/utils/jsxToTextContent.ts +0 -11
- package/src/utils/objectAssign.ts +0 -9
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assert
|
|
3
|
+
} from "../../../chunk-JKLALMFU.js";
|
|
4
|
+
import "../../../chunk-TTLAZ2T2.js";
|
|
5
|
+
|
|
6
|
+
// src/components/features/initFeatureList.ts
|
|
7
|
+
addTwitterWidgets();
|
|
8
|
+
addFeatureClickHandlers();
|
|
9
|
+
window.__docpress_hydrationFinished = true;
|
|
10
|
+
function addTwitterWidgets() {
|
|
11
|
+
loadScript("https://platform.twitter.com/widgets.js");
|
|
12
|
+
}
|
|
13
|
+
function addFeatureClickHandlers() {
|
|
14
|
+
const featureEls = Array.from(
|
|
15
|
+
document.getElementById("features").querySelectorAll(".feature.has-learn-more")
|
|
16
|
+
);
|
|
17
|
+
featureEls.forEach((featureEl) => {
|
|
18
|
+
featureEl.onclick = () => {
|
|
19
|
+
expandLearnMore(featureEl);
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function expandLearnMore(featureEl) {
|
|
24
|
+
const featureId = featureEl.id;
|
|
25
|
+
assert(featureId.startsWith("feature-"), { featureId });
|
|
26
|
+
const featureName = featureId.slice("feature-".length);
|
|
27
|
+
const selectedClass = "selected";
|
|
28
|
+
const learnId = "learn-more-" + featureName;
|
|
29
|
+
const learnEl = document.getElementById(learnId);
|
|
30
|
+
assert(learnEl, { learnId });
|
|
31
|
+
const isExpanded = featureEl.classList.contains(selectedClass);
|
|
32
|
+
if (!isExpanded) {
|
|
33
|
+
const rowEl = featureEl.parentNode;
|
|
34
|
+
if (getComputedStyle(rowEl, "display") === "grid") {
|
|
35
|
+
;
|
|
36
|
+
[
|
|
37
|
+
...rowEl.querySelectorAll(".learn-more"),
|
|
38
|
+
...rowEl.querySelectorAll(".feature")
|
|
39
|
+
].forEach((el) => {
|
|
40
|
+
el.classList.remove(selectedClass);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
;
|
|
45
|
+
[featureEl, learnEl].forEach((el) => {
|
|
46
|
+
el.classList.toggle(selectedClass);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function loadScript(scriptUrl) {
|
|
50
|
+
assert(scriptUrl.startsWith("https://"));
|
|
51
|
+
const scriptEl = document.createElement("script");
|
|
52
|
+
scriptEl.src = scriptUrl;
|
|
53
|
+
scriptEl.async = true;
|
|
54
|
+
scriptEl.setAttribute("charset", "utf-8");
|
|
55
|
+
document.getElementsByTagName("head")[0].appendChild(scriptEl);
|
|
56
|
+
}
|
|
57
|
+
function getComputedStyle(el, styleProp) {
|
|
58
|
+
return window.document.defaultView.getComputedStyle(el).getPropertyValue(styleProp);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=initFeatureList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/features/initFeatureList.ts"],"sourcesContent":["import { assert } from '../../utils'\n\naddTwitterWidgets()\naddFeatureClickHandlers()\nwindow.__docpress_hydrationFinished = true\n\nfunction addTwitterWidgets() {\n loadScript('https://platform.twitter.com/widgets.js')\n}\n\nfunction addFeatureClickHandlers() {\n const featureEls: HTMLElement[] = Array.from(\n document.getElementById('features')!.querySelectorAll('.feature.has-learn-more')\n )\n featureEls.forEach((featureEl) => {\n featureEl.onclick = () => {\n expandLearnMore(featureEl)\n }\n })\n}\n\nfunction expandLearnMore(featureEl: HTMLElement) {\n const featureId = featureEl.id\n assert(featureId.startsWith('feature-'), { featureId })\n const featureName = featureId.slice('feature-'.length)\n\n const selectedClass = 'selected'\n const learnId = 'learn-more-' + featureName\n const learnEl = document.getElementById(learnId)\n assert(learnEl, { learnId })\n\n const isExpanded = featureEl.classList.contains(selectedClass)\n\n if (!isExpanded) {\n const rowEl = featureEl.parentNode as HTMLElement\n if (getComputedStyle(rowEl, 'display') === 'grid') {\n ;[\n ...(rowEl.querySelectorAll('.learn-more') as any as HTMLElement[]),\n ...(rowEl.querySelectorAll('.feature') as any as HTMLElement[])\n ].forEach((el) => {\n el.classList.remove(selectedClass)\n })\n }\n }\n\n ;[featureEl, learnEl].forEach((el) => {\n el.classList.toggle(selectedClass)\n })\n}\n\nfunction loadScript(scriptUrl: string): void {\n assert(scriptUrl.startsWith('https://'))\n const scriptEl = document.createElement('script')\n scriptEl.src = scriptUrl\n scriptEl.async = true\n scriptEl.setAttribute('charset', 'utf-8')\n document.getElementsByTagName('head')[0].appendChild(scriptEl)\n}\n\nfunction getComputedStyle(el: HTMLElement, styleProp: string) {\n return window.document.defaultView!.getComputedStyle(el).getPropertyValue(styleProp)\n}\n\ndeclare global {\n var __docpress_hydrationFinished: undefined | true\n}\n"],"mappings":";;;;;;AAEA,kBAAkB;AAClB,wBAAwB;AACxB,OAAO,+BAA+B;AAEtC,SAAS,oBAAoB;AAC3B,aAAW,yCAAyC;AACtD;AAEA,SAAS,0BAA0B;AACjC,QAAM,aAA4B,MAAM;AAAA,IACtC,SAAS,eAAe,UAAU,EAAG,iBAAiB,yBAAyB;AAAA,EACjF;AACA,aAAW,QAAQ,CAAC,cAAc;AAChC,cAAU,UAAU,MAAM;AACxB,sBAAgB,SAAS;AAAA,IAC3B;AAAA,EACF,CAAC;AACH;AAEA,SAAS,gBAAgB,WAAwB;AAC/C,QAAM,YAAY,UAAU;AAC5B,SAAO,UAAU,WAAW,UAAU,GAAG,EAAE,UAAU,CAAC;AACtD,QAAM,cAAc,UAAU,MAAM,WAAW,MAAM;AAErD,QAAM,gBAAgB;AACtB,QAAM,UAAU,gBAAgB;AAChC,QAAM,UAAU,SAAS,eAAe,OAAO;AAC/C,SAAO,SAAS,EAAE,QAAQ,CAAC;AAE3B,QAAM,aAAa,UAAU,UAAU,SAAS,aAAa;AAE7D,MAAI,CAAC,YAAY;AACf,UAAM,QAAQ,UAAU;AACxB,QAAI,iBAAiB,OAAO,SAAS,MAAM,QAAQ;AACjD;AAAC;AAAA,QACC,GAAI,MAAM,iBAAiB,aAAa;AAAA,QACxC,GAAI,MAAM,iBAAiB,UAAU;AAAA,MACvC,EAAE,QAAQ,CAAC,OAAO;AAChB,WAAG,UAAU,OAAO,aAAa;AAAA,MACnC,CAAC;AAAA,IACH;AAAA,EACF;AAEA;AAAC,GAAC,WAAW,OAAO,EAAE,QAAQ,CAAC,OAAO;AACpC,OAAG,UAAU,OAAO,aAAa;AAAA,EACnC,CAAC;AACH;AAEA,SAAS,WAAW,WAAyB;AAC3C,SAAO,UAAU,WAAW,UAAU,CAAC;AACvC,QAAM,WAAW,SAAS,cAAc,QAAQ;AAChD,WAAS,MAAM;AACf,WAAS,QAAQ;AACjB,WAAS,aAAa,WAAW,OAAO;AACxC,WAAS,qBAAqB,MAAM,EAAE,GAAG,YAAY,QAAQ;AAC/D;AAEA,SAAS,iBAAiB,IAAiB,WAAmB;AAC5D,SAAO,OAAO,SAAS,YAAa,iBAAiB,EAAE,EAAE,iBAAiB,SAAS;AACrF;","names":[]}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
@import "balloon-css";
|
|
2
|
+
|
|
3
|
+
/* src/css/reset.css */
|
|
4
|
+
* {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
body {
|
|
8
|
+
margin: 0;
|
|
9
|
+
}
|
|
10
|
+
iframe {
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* src/css/colorize-on-hover.css */
|
|
15
|
+
.colorize-on-hover,
|
|
16
|
+
.colorize-on-hover [class^=decolorize-],
|
|
17
|
+
.colorize-on-hover [class*=" decolorize-"] {
|
|
18
|
+
transition: filter 0.3s ease-in-out;
|
|
19
|
+
}
|
|
20
|
+
.colorize-on-hover:hover,
|
|
21
|
+
.colorize-on-hover:hover [class^=decolorize-],
|
|
22
|
+
.colorize-on-hover:hover [class*=" decolorize-"] {
|
|
23
|
+
filter: grayscale(0) opacity(1) !important;
|
|
24
|
+
}
|
|
25
|
+
.decolorize-7 {
|
|
26
|
+
filter: grayscale(1) opacity(0.7);
|
|
27
|
+
}
|
|
28
|
+
.decolorize-6 {
|
|
29
|
+
filter: grayscale(1) opacity(0.6);
|
|
30
|
+
}
|
|
31
|
+
.decolorize-5 {
|
|
32
|
+
filter: grayscale(1) opacity(0.5);
|
|
33
|
+
}
|
|
34
|
+
.decolorize-4 {
|
|
35
|
+
filter: grayscale(1) opacity(0.4);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* src/css/heading.css */
|
|
39
|
+
.doc-page h2 {
|
|
40
|
+
margin-top: 50px;
|
|
41
|
+
margin-bottom: 16px;
|
|
42
|
+
}
|
|
43
|
+
.doc-page h2[id] {
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
position: relative;
|
|
46
|
+
padding-left: 20px;
|
|
47
|
+
margin-left: -20px;
|
|
48
|
+
}
|
|
49
|
+
.doc-page h2[id]:hover::before {
|
|
50
|
+
content: "#";
|
|
51
|
+
position: absolute;
|
|
52
|
+
left: calc(-1 * (0.75em - 20px));
|
|
53
|
+
color: #aaa;
|
|
54
|
+
}
|
|
55
|
+
.doc-page h1 + h2 {
|
|
56
|
+
margin-top: 0;
|
|
57
|
+
}
|
|
58
|
+
.doc-page h4 {
|
|
59
|
+
margin-top: 32px;
|
|
60
|
+
margin-bottom: 16px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* src/css/button.css */
|
|
64
|
+
button,
|
|
65
|
+
a.button {
|
|
66
|
+
background-color: #fafafa;
|
|
67
|
+
border: 1px solid #aaa;
|
|
68
|
+
border-radius: 5px;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* src/css/link.css */
|
|
73
|
+
a {
|
|
74
|
+
color: #4747ff;
|
|
75
|
+
text-decoration: none;
|
|
76
|
+
}
|
|
77
|
+
a > button {
|
|
78
|
+
color: var(--color-text);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* src/css/font.css */
|
|
82
|
+
body {
|
|
83
|
+
font-family: "Inter";
|
|
84
|
+
}
|
|
85
|
+
button {
|
|
86
|
+
font-family: inherit;
|
|
87
|
+
}
|
|
88
|
+
body {
|
|
89
|
+
--color-text: #323d48;
|
|
90
|
+
color: var(--color-text);
|
|
91
|
+
line-height: 1.5;
|
|
92
|
+
}
|
|
93
|
+
@font-face {
|
|
94
|
+
font-family: "Inter";
|
|
95
|
+
font-weight: 100 900;
|
|
96
|
+
font-stretch: 75% 125%;
|
|
97
|
+
font-style: oblique 0deg 12deg;
|
|
98
|
+
src: url(/assets/Inter-Var-IOAEQULN.ttf) format("truetype-variations");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* src/css/code/inline.css */
|
|
102
|
+
code {
|
|
103
|
+
padding: 2px 5px;
|
|
104
|
+
}
|
|
105
|
+
code {
|
|
106
|
+
display: inline-block;
|
|
107
|
+
}
|
|
108
|
+
@media screen and (max-width: 500px) {
|
|
109
|
+
code {
|
|
110
|
+
word-break: break-word;
|
|
111
|
+
display: inline;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
.inline-code-break code {
|
|
115
|
+
display: inline;
|
|
116
|
+
word-break: break-word;
|
|
117
|
+
}
|
|
118
|
+
code.long {
|
|
119
|
+
word-break: break-word;
|
|
120
|
+
display: inline;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* src/css/code/block.css */
|
|
124
|
+
pre > code {
|
|
125
|
+
padding: 16px !important;
|
|
126
|
+
}
|
|
127
|
+
@media screen and (max-width: 900px) {
|
|
128
|
+
pre > code {
|
|
129
|
+
font-size: 0.7em;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
pre {
|
|
133
|
+
display: grid;
|
|
134
|
+
}
|
|
135
|
+
pre > code {
|
|
136
|
+
padding-right: 0px !important;
|
|
137
|
+
overflow-x: auto;
|
|
138
|
+
}
|
|
139
|
+
@media screen and (max-width: 1139px) {
|
|
140
|
+
pre > code {
|
|
141
|
+
font-size: 0.95em;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
@media screen and (max-width: 1040px) {
|
|
145
|
+
pre > code {
|
|
146
|
+
font-size: 0.8em;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
@media screen and (max-width: 940px) {
|
|
150
|
+
pre > code {
|
|
151
|
+
font-size: 0.7em;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
pre > code {
|
|
155
|
+
display: reset;
|
|
156
|
+
word-break: reset;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* src/css/code.css */
|
|
160
|
+
code {
|
|
161
|
+
background-color: rgba(0, 0, 0, 0.043137255);
|
|
162
|
+
border-radius: 4px;
|
|
163
|
+
}
|
|
164
|
+
code {
|
|
165
|
+
font-size: 1.1em;
|
|
166
|
+
}
|
|
167
|
+
pre > code {
|
|
168
|
+
font-size: 1em;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* src/css/note.css */
|
|
172
|
+
blockquote {
|
|
173
|
+
--color:
|
|
174
|
+
0,
|
|
175
|
+
0,
|
|
176
|
+
0;
|
|
177
|
+
--color-strengh-bg: 0.7;
|
|
178
|
+
--color-strengh-border: 1.5;
|
|
179
|
+
border-left: 8px solid rgba(var(--color), calc(0.06 * var(--color-strengh-border)));
|
|
180
|
+
background-color: rgba(var(--color), calc(0.03 * var(--color-strengh-bg)));
|
|
181
|
+
margin-left: 0;
|
|
182
|
+
padding: 4px 16px;
|
|
183
|
+
}
|
|
184
|
+
blockquote.error {
|
|
185
|
+
--color-strengh-bg: 1.7;
|
|
186
|
+
--color-strengh-border: 6;
|
|
187
|
+
--color:
|
|
188
|
+
190,
|
|
189
|
+
25,
|
|
190
|
+
49;
|
|
191
|
+
}
|
|
192
|
+
blockquote.warning {
|
|
193
|
+
--color-strengh-bg: 4;
|
|
194
|
+
--color-strengh-border: 8;
|
|
195
|
+
--color:
|
|
196
|
+
255,
|
|
197
|
+
204,
|
|
198
|
+
50;
|
|
199
|
+
}
|
|
200
|
+
blockquote > p:first-child::before,
|
|
201
|
+
blockquote > div.paragraph:first-child::before {
|
|
202
|
+
font-family: emoji;
|
|
203
|
+
content: "\2139\fe0f";
|
|
204
|
+
margin-right: 4px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* src/css/table.css */
|
|
208
|
+
table th {
|
|
209
|
+
background-color: #f7f7f7;
|
|
210
|
+
}
|
|
211
|
+
table {
|
|
212
|
+
border-collapse: collapse;
|
|
213
|
+
}
|
|
214
|
+
table td,
|
|
215
|
+
table th {
|
|
216
|
+
padding: 8px;
|
|
217
|
+
border: 1px solid #ccc;
|
|
218
|
+
}
|
|
219
|
+
table th {
|
|
220
|
+
text-align: left;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* src/css/tooltip.css */
|
|
224
|
+
:root {
|
|
225
|
+
--balloon-color: #444;
|
|
226
|
+
--balloon-move: 2px;
|
|
227
|
+
--balloon-font-size: 14px;
|
|
228
|
+
--balloon-border-radius: 5px;
|
|
229
|
+
}
|
|
230
|
+
[aria-label][data-balloon-pos]:after {
|
|
231
|
+
font-family: "Inter";
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* src/css/index.css */
|
|
235
|
+
|
|
236
|
+
/* src/components/P.css */
|
|
237
|
+
div.paragraph {
|
|
238
|
+
display: block;
|
|
239
|
+
margin-block-start: 1em;
|
|
240
|
+
margin-block-end: 1em;
|
|
241
|
+
margin-inline-start: 0px;
|
|
242
|
+
margin-inline-end: 0px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* src/algolia/DocSearch.css */
|
|
246
|
+
#docsearch-desktop {
|
|
247
|
+
max-width: 110px !important;
|
|
248
|
+
}
|
|
249
|
+
#docsearch-desktop .DocSearch-Button-Placeholder {
|
|
250
|
+
display: none;
|
|
251
|
+
padding: 0 !important;
|
|
252
|
+
}
|
|
253
|
+
#docsearch-desktop .DocSearch-Search-Icon {
|
|
254
|
+
margin-right: 6px !important;
|
|
255
|
+
}
|
|
256
|
+
#docsearch-desktop .DocSearch-Button {
|
|
257
|
+
margin-right: 3px !important;
|
|
258
|
+
margin-left: 1px !important;
|
|
259
|
+
}
|
|
260
|
+
#docsearch-mobile {
|
|
261
|
+
margin-left: auto !important;
|
|
262
|
+
padding-right: 20px !important;
|
|
263
|
+
}
|
|
264
|
+
#docsearch-mobile .DocSearch-Button {
|
|
265
|
+
margin-left: 0px !important;
|
|
266
|
+
}
|
|
267
|
+
@media screen and (max-width: 339px) {
|
|
268
|
+
#docsearch-mobile {
|
|
269
|
+
padding-right: 6px !important;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/*# sourceMappingURL=_default.page.client.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/css/reset.css","../../../src/css/colorize-on-hover.css","../../../src/css/heading.css","../../../src/css/button.css","../../../src/css/link.css","../../../src/css/font.css","../../../src/css/code/inline.css","../../../src/css/code/block.css","../../../src/css/code.css","../../../src/css/note.css","../../../src/css/table.css","../../../src/css/tooltip.css","../../../src/components/P.css","../../../src/algolia/DocSearch.css"],"sourcesContent":["* {\n box-sizing: border-box;\n}\nbody {\n margin: 0;\n}\n\n/* Avoid tweet embeds to overflow the body width.\n * Settings `overflow: hidden` to a container doesn't work (This is a CSS bug?) */\niframe {\n max-width: 100%;\n}\n",".colorize-on-hover,\n.colorize-on-hover [class^='decolorize-'],\n.colorize-on-hover [class*=' decolorize-'] {\n transition: filter 0.3s ease-in-out;\n}\n.colorize-on-hover:hover,\n.colorize-on-hover:hover [class^='decolorize-'],\n.colorize-on-hover:hover [class*=' decolorize-'] {\n filter: grayscale(0) opacity(1) !important;\n}\n\n.decolorize-7 {\n filter: grayscale(1) opacity(0.7);\n}\n.decolorize-6 {\n filter: grayscale(1) opacity(0.6);\n}\n.decolorize-5 {\n filter: grayscale(1) opacity(0.5);\n}\n.decolorize-4 {\n filter: grayscale(1) opacity(0.4);\n}\n\n/*\n * Twitter opacity(0.7): #ababab > #868686\n * == Following computation does NOT work ==\n * Discord opacity(0.7): #6c6c6c > (0.7 * (#fff - #ababab) = #868686 = x * (#fff - #6c6c6c) <=> x = 0.7 * ((#fff - #ababab) / (#fff - #6c6c6c)) = 0.7 * ((255 - 171) / (255 - 108)) = 0.4)\n */\n",".doc-page h2 {\n margin-top: 50px;\n margin-bottom: 16px;\n}\n.doc-page h2[id] {\n cursor: pointer;\n position: relative;\n padding-left: 20px;\n margin-left: -20px;\n}\n.doc-page h2[id]:hover::before {\n content: '#';\n position: absolute;\n left: calc(-1 * (0.75em - 20px));\n color: #aaa;\n}\n\n.doc-page h1 + h2 {\n margin-top: 0;\n}\n\n.doc-page h4 {\n margin-top: 32px;\n margin-bottom: 16px;\n}\n","button,\na.button {\n background-color: #fafafa;\n border: 1px solid #aaa;\n border-radius: 5px;\n cursor: pointer;\n}\n","/*\n:root {\n --link-color: #4747ff;\n}\n*/\n\na {\n /*\n color: inherit;\n color: var(--link-color);\n */\n color: #4747ff;\n text-decoration: none;\n}\na > button {\n color: var(--color-text);\n}\n","body {\n font-family: 'Inter';\n}\nbutton {\n font-family: inherit;\n}\nbody {\n --color-text: #323d48;\n color: var(--color-text);\n line-height: 1.5;\n}\n\n@font-face {\n font-family: 'Inter';\n font-weight: 100 900;\n font-stretch: 75% 125%;\n font-style: oblique 0deg 12deg;\n src: url('./Inter-Var.ttf') format('truetype-variations');\n}\n","code {\n padding: 2px 5px;\n}\n\n/*\n * Line breaks in `<code>`:\n * - Avoid them on desktop\n * - Allow them on mobile\n * - Allo them for `<code long>`\n */\ncode {\n display: inline-block;\n}\n@media screen and (max-width: 500px) {\n code {\n word-break: break-word;\n display: inline;\n }\n}\n.inline-code-break code {\n display: inline;\n word-break: break-word;\n}\ncode.long {\n word-break: break-word;\n display: inline;\n}\n","pre > code {\n padding: 16px !important;\n}\n@media screen and (max-width: 900px) {\n pre > code {\n font-size: 0.7em;\n }\n}\npre {\n display: grid;\n}\npre > code {\n padding-right: 0px !important;\n overflow-x: auto;\n}\n\n@media screen and (max-width: 1139px) {\n pre > code {\n font-size: 0.95em;\n }\n}\n@media screen and (max-width: 1040px) {\n pre > code {\n font-size: 0.8em;\n }\n}\n@media screen and (max-width: 940px) {\n pre > code {\n font-size: 0.7em;\n }\n}\n\npre > code {\n display: reset;\n word-break: reset;\n}\n","@import './code/inline.css';\n@import './code/block.css';\n\ncode {\n /*\n background-color: #f4f4f4;\n 0.043137255 = 1 - (#f4 / #ff)\n */\n background-color: rgba(0, 0, 0, 0.043137255);\n border-radius: 4px;\n}\n\n/* Inline */\ncode {\n font-size: 1.1em;\n}\n/* Block */\npre > code {\n font-size: 1em;\n}\n","blockquote {\n --color: 0, 0, 0;\n --color-strengh-bg: 0.7;\n --color-strengh-border: 1.5;\n border-left: 8px solid rgba(var(--color), calc(0.06 * var(--color-strengh-border)));\n background-color: rgba(var(--color), calc(0.03 * var(--color-strengh-bg)));\n margin-left: 0;\n padding: 4px 16px;\n}\nblockquote.error {\n --color-strengh-bg: 1.7;\n --color-strengh-border: 6;\n --color: 190, 25, 49;\n}\nblockquote.warning {\n --color-strengh-bg: 4;\n --color-strengh-border: 8;\n --color: 255, 204, 50;\n}\nblockquote > p:first-child::before,\n/* blockquote > p:first-of-type::before, */\nblockquote > div.paragraph:first-child::before {\n font-family: emoji;\n content: 'ℹ️';\n margin-right: 4px;\n}\n","table th {\n background-color: #f7f7f7;\n}\ntable {\n border-collapse: collapse;\n}\ntable td,\ntable th {\n padding: 8px;\n border: 1px solid #ccc;\n}\ntable th {\n text-align: left;\n}\n","@import 'balloon-css';\n\n:root {\n --balloon-color: #444;\n --balloon-move: 2px;\n --balloon-font-size: 14px;\n --balloon-border-radius: 5px;\n}\n[aria-label][data-balloon-pos]:after {\n font-family: 'Inter';\n}\n","/* Copied from Chrome's user agent stylesheet */\ndiv.paragraph {\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n}\n","#docsearch-desktop {\n max-width: 110px !important;\n}\n#docsearch-desktop .DocSearch-Button-Placeholder {\n display: none;\n padding: 0 !important;\n}\n#docsearch-desktop .DocSearch-Search-Icon {\n margin-right: 6px !important;\n}\n#docsearch-desktop .DocSearch-Button {\n margin-right: 3px !important;\n margin-left: 1px !important;\n}\n\n#docsearch-mobile {\n margin-left: auto !important;\n padding-right: 20px !important;\n}\n\n#docsearch-mobile .DocSearch-Button {\n margin-left: 0px !important;\n}\n\n@media screen and (max-width: 339px) {\n #docsearch-mobile {\n padding-right: 6px !important;\n }\n}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AAA;;;ACNF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAEF;AACE;AAAA;AAEF;AACE;AACA;AAAA;AAGF;AACE;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AACE;AACE;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import "../../chunk-3NFN2KUH.js";
|
|
2
|
+
import "../../chunk-G2KXEHNF.js";
|
|
3
|
+
import {
|
|
4
|
+
assert
|
|
5
|
+
} from "../../chunk-JKLALMFU.js";
|
|
6
|
+
import "../../chunk-TTLAZ2T2.js";
|
|
7
|
+
|
|
8
|
+
// src/autoScrollNav.ts
|
|
9
|
+
autoScrollNav();
|
|
10
|
+
function autoScrollNav() {
|
|
11
|
+
const navigationEl = document.getElementById("navigation-content");
|
|
12
|
+
assert(navigationEl);
|
|
13
|
+
const href = window.location.pathname;
|
|
14
|
+
const navLinks = Array.from(navigationEl.querySelectorAll(`a[href="${href}"]`));
|
|
15
|
+
assert(navLinks.length <= 1, { navLinks, href });
|
|
16
|
+
const navLink = navLinks[0];
|
|
17
|
+
if (!navLink)
|
|
18
|
+
return;
|
|
19
|
+
navLink.scrollIntoView({
|
|
20
|
+
behavior: "auto",
|
|
21
|
+
block: "center",
|
|
22
|
+
inline: "center"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/installSectionUrlHashs.ts
|
|
27
|
+
installSectionUrlHashs();
|
|
28
|
+
function installSectionUrlHashs() {
|
|
29
|
+
const pageContainer = document.querySelector(".doc-page #page-container");
|
|
30
|
+
if (!pageContainer) {
|
|
31
|
+
assert(window.location.pathname === "/");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const navigationEl = document.getElementById("navigation-content");
|
|
35
|
+
assert(navigationEl);
|
|
36
|
+
const docSections = Array.from(document.querySelectorAll("h2"));
|
|
37
|
+
docSections.forEach((docSection) => {
|
|
38
|
+
const docTitle = docSection.textContent;
|
|
39
|
+
assert(docTitle);
|
|
40
|
+
assert(docSection.id, { docSection });
|
|
41
|
+
const urlHash = "#" + docSection.id;
|
|
42
|
+
assertNavLink(navigationEl, urlHash);
|
|
43
|
+
docSection.onclick = () => {
|
|
44
|
+
window.location.hash = urlHash;
|
|
45
|
+
jumpToSection();
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function assertNavLink(navigationEl, urlHash) {
|
|
50
|
+
const parentNavLinkMatch = Array.from(navigationEl.querySelectorAll(`a[href="${window.location.pathname}"]`));
|
|
51
|
+
assert(parentNavLinkMatch.length <= 1);
|
|
52
|
+
if (parentNavLinkMatch.length === 0)
|
|
53
|
+
return;
|
|
54
|
+
const navLinks = Array.from(navigationEl.querySelectorAll(`a[href="${urlHash}"]`));
|
|
55
|
+
assert(navLinks.length === 1, { urlHash });
|
|
56
|
+
}
|
|
57
|
+
function jumpToSection() {
|
|
58
|
+
const { hash } = window.location;
|
|
59
|
+
if (hash === "" || hash === "#") {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
assert(hash.startsWith("#"));
|
|
63
|
+
const target = document.getElementById(hash.slice(1));
|
|
64
|
+
if (!target) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
target.scrollIntoView();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/navigation/navigation-fullscreen/initNavigationFullscreen.ts
|
|
71
|
+
var scrollPositionBeforeToggle = 0;
|
|
72
|
+
function initNavigationFullscreen() {
|
|
73
|
+
updateColumnWidth();
|
|
74
|
+
window.addEventListener("resize", updateColumnWidth, { passive: true });
|
|
75
|
+
document.getElementById("navigation-fullscreen-button").onclick = toggleNavExpend;
|
|
76
|
+
document.getElementById("navigation-fullscreen-close").onclick = toggleNavExpend;
|
|
77
|
+
document.addEventListener(
|
|
78
|
+
"keydown",
|
|
79
|
+
(ev) => {
|
|
80
|
+
if (ev.key === "Escape")
|
|
81
|
+
toggleNavExpend();
|
|
82
|
+
},
|
|
83
|
+
false
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function toggleNavExpend() {
|
|
87
|
+
const navContainer = document.getElementById("navigation-container");
|
|
88
|
+
const scrollPos = navContainer.scrollTop;
|
|
89
|
+
document.documentElement.classList.toggle("navigation-fullscreen");
|
|
90
|
+
if (scrollPositionBeforeToggle !== void 0) {
|
|
91
|
+
navContainer.scrollTop = scrollPositionBeforeToggle;
|
|
92
|
+
}
|
|
93
|
+
scrollPositionBeforeToggle = scrollPos;
|
|
94
|
+
}
|
|
95
|
+
function updateColumnWidth() {
|
|
96
|
+
const navMinWidth = 299;
|
|
97
|
+
const navH1Groups = Array.from(document.querySelectorAll(".nav-h1-group"));
|
|
98
|
+
const numberOfColumnsMax = navH1Groups.length;
|
|
99
|
+
const widthAvailable = getViewportWidth();
|
|
100
|
+
const numberOfColumns = Math.max(1, Math.min(numberOfColumnsMax, Math.floor(widthAvailable / navMinWidth)));
|
|
101
|
+
let columns = navH1Groups.map((navH1Group) => {
|
|
102
|
+
const column = [
|
|
103
|
+
{
|
|
104
|
+
element: navH1Group,
|
|
105
|
+
elementHeight: navH1Group.children.length
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
return column;
|
|
109
|
+
});
|
|
110
|
+
mergeColumns(columns, numberOfColumns);
|
|
111
|
+
const navContent = document.getElementById("navigation-content");
|
|
112
|
+
Array.from(navContent.children).forEach((child) => {
|
|
113
|
+
assert(child.className === "nav-column");
|
|
114
|
+
});
|
|
115
|
+
navContent.innerHTML = "";
|
|
116
|
+
columns.forEach((column) => {
|
|
117
|
+
const columnEl = document.createElement("div");
|
|
118
|
+
columnEl.className = "nav-column";
|
|
119
|
+
column.forEach(({ element }) => {
|
|
120
|
+
columnEl.appendChild(element);
|
|
121
|
+
});
|
|
122
|
+
navContent.appendChild(columnEl);
|
|
123
|
+
});
|
|
124
|
+
const navItemMaxWidth = 350;
|
|
125
|
+
navContent.style.maxWidth = `${numberOfColumns * navItemMaxWidth}px`;
|
|
126
|
+
}
|
|
127
|
+
function getViewportWidth() {
|
|
128
|
+
return document.documentElement.clientWidth;
|
|
129
|
+
}
|
|
130
|
+
function mergeColumns(columns, maxNumberOfColumns) {
|
|
131
|
+
assert(columns.length > 0);
|
|
132
|
+
assert(maxNumberOfColumns > 0);
|
|
133
|
+
if (columns.length <= maxNumberOfColumns) {
|
|
134
|
+
return columns;
|
|
135
|
+
}
|
|
136
|
+
let mergeCandidate = {
|
|
137
|
+
i: -1,
|
|
138
|
+
mergeHeight: Infinity
|
|
139
|
+
};
|
|
140
|
+
for (let i = 0; i <= columns.length - 2; i++) {
|
|
141
|
+
const column1 = columns[i + 0];
|
|
142
|
+
const column2 = columns[i + 1];
|
|
143
|
+
const column1Height = sum(column1.map((c) => c.elementHeight));
|
|
144
|
+
const column2Height = sum(column2.map((c) => c.elementHeight));
|
|
145
|
+
const mergeHeight = column1Height + column2Height;
|
|
146
|
+
if (mergeCandidate.mergeHeight > mergeHeight) {
|
|
147
|
+
mergeCandidate = {
|
|
148
|
+
i,
|
|
149
|
+
mergeHeight
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
{
|
|
154
|
+
const { i } = mergeCandidate;
|
|
155
|
+
assert(-1 < i && i < columns.length - 1, { i, columnsLength: columns.length, maxNumberOfColumns });
|
|
156
|
+
columns[i] = [...columns[i], ...columns[i + 1]];
|
|
157
|
+
columns.splice(i + 1, 1);
|
|
158
|
+
}
|
|
159
|
+
mergeColumns(columns, maxNumberOfColumns);
|
|
160
|
+
}
|
|
161
|
+
function sum(arr) {
|
|
162
|
+
let total = 0;
|
|
163
|
+
arr.forEach((n) => total += n);
|
|
164
|
+
return total;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/navigation/Navigation.client.ts
|
|
168
|
+
activateNavigationMask();
|
|
169
|
+
activateMenuToggle();
|
|
170
|
+
initNavigationFullscreen();
|
|
171
|
+
function activateMenuToggle() {
|
|
172
|
+
const menuToggle = document.getElementById("menu-toggle");
|
|
173
|
+
menuToggle.onclick = toggleNavigation;
|
|
174
|
+
}
|
|
175
|
+
function activateNavigationMask() {
|
|
176
|
+
const navigationMask = document.getElementById("navigation-mask");
|
|
177
|
+
navigationMask.onclick = toggleNavigation;
|
|
178
|
+
}
|
|
179
|
+
function toggleNavigation() {
|
|
180
|
+
document.body.classList.toggle("show-menu");
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=_default.page.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/autoScrollNav.ts","../../../src/installSectionUrlHashs.ts","../../../src/navigation/navigation-fullscreen/initNavigationFullscreen.ts","../../../src/navigation/Navigation.client.ts"],"sourcesContent":["import { assert } from './utils'\n\nautoScrollNav()\n\nfunction autoScrollNav() {\n const navigationEl = document.getElementById('navigation-content')\n assert(navigationEl)\n const href = window.location.pathname\n const navLinks: HTMLElement[] = Array.from(navigationEl.querySelectorAll(`a[href=\"${href}\"]`))\n assert(navLinks.length <= 1, { navLinks, href })\n const navLink = navLinks[0]\n if (!navLink) return\n navLink.scrollIntoView({\n /*\n behavior: 'smooth',\n /*/\n behavior: 'auto',\n //*/\n block: 'center',\n inline: 'center'\n })\n}\n","import { assert } from './utils'\n\ninstallSectionUrlHashs()\n/* Let browser restore previous scroll\njumpToSection()\n*/\n\nfunction installSectionUrlHashs() {\n const pageContainer = document.querySelector('.doc-page #page-container')\n if (!pageContainer) {\n assert(window.location.pathname === '/')\n return\n }\n const navigationEl = document.getElementById('navigation-content')\n assert(navigationEl)\n const docSections = Array.from(document.querySelectorAll('h2'))\n docSections.forEach((docSection) => {\n const docTitle = docSection.textContent\n assert(docTitle)\n assert(docSection.id, { docSection })\n const urlHash = '#' + docSection.id\n assertNavLink(navigationEl, urlHash)\n docSection.onclick = () => {\n window.location.hash = urlHash\n // The browser doesn't jump if hash doesn't change\n jumpToSection()\n }\n })\n}\n\nfunction assertNavLink(navigationEl: HTMLElement, urlHash: string) {\n const parentNavLinkMatch = Array.from(navigationEl.querySelectorAll(`a[href=\"${window.location.pathname}\"]`))\n assert(parentNavLinkMatch.length <= 1)\n if (parentNavLinkMatch.length === 0) return\n const navLinks: HTMLElement[] = Array.from(navigationEl.querySelectorAll(`a[href=\"${urlHash}\"]`))\n assert(navLinks.length === 1, { urlHash })\n}\n\nfunction jumpToSection() {\n const { hash } = window.location\n if (hash === '' || hash === '#') {\n return\n }\n assert(hash.startsWith('#'))\n const target = document.getElementById(hash.slice(1))\n if (!target) {\n return\n }\n target.scrollIntoView()\n}\n","export { initNavigationFullscreen }\n\nimport { assert } from '../../utils'\n\nlet scrollPositionBeforeToggle: number = 0\n\nfunction initNavigationFullscreen() {\n updateColumnWidth()\n window.addEventListener('resize', updateColumnWidth, { passive: true })\n document.getElementById('navigation-fullscreen-button')!.onclick = toggleNavExpend\n document.getElementById('navigation-fullscreen-close')!.onclick = toggleNavExpend\n document.addEventListener(\n // We don't use keydown to not interfere with user pressing `<Esc>` for closing the browser's `<Ctrl-F>` search diablog, see https://stackoverflow.com/questions/66595035/how-to-detect-escape-key-if-search-bar-of-browser-is-open\n 'keydown',\n (ev) => {\n if (ev.key === 'Escape') toggleNavExpend()\n },\n false\n )\n}\n\nfunction toggleNavExpend() {\n const navContainer = document.getElementById('navigation-container')!\n const scrollPos = navContainer.scrollTop\n document.documentElement.classList.toggle('navigation-fullscreen')\n if (scrollPositionBeforeToggle !== undefined) {\n navContainer.scrollTop = scrollPositionBeforeToggle\n }\n scrollPositionBeforeToggle = scrollPos\n}\n\nfunction updateColumnWidth() {\n const navMinWidth = 299\n const navH1Groups = Array.from(document.querySelectorAll('.nav-h1-group'))\n const numberOfColumnsMax = navH1Groups.length\n\n const widthAvailable = getViewportWidth()\n const numberOfColumns = Math.max(1, Math.min(numberOfColumnsMax, Math.floor(widthAvailable / navMinWidth)))\n\n let columns = navH1Groups.map((navH1Group) => {\n const column = [\n {\n element: navH1Group,\n elementHeight: navH1Group.children.length\n }\n ]\n return column\n })\n\n mergeColumns(columns, numberOfColumns)\n\n const navContent = document.getElementById('navigation-content')!\n\n Array.from(navContent.children).forEach((child) => {\n assert(child.className === 'nav-column')\n })\n navContent.innerHTML = ''\n\n columns.forEach((column) => {\n const columnEl = document.createElement('div')\n columnEl.className = 'nav-column'\n column.forEach(({ element }) => {\n columnEl.appendChild(element)\n })\n navContent.appendChild(columnEl)\n })\n\n const navItemMaxWidth = 350\n navContent.style.maxWidth = `${numberOfColumns * navItemMaxWidth}px`\n}\nfunction getViewportWidth(): number {\n // `window.innerWidth` inlcudes scrollbar width: https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n return document.documentElement.clientWidth\n}\n\nfunction mergeColumns<T>(columns: { element: T; elementHeight: number }[][], maxNumberOfColumns: number) {\n assert(columns.length > 0)\n assert(maxNumberOfColumns > 0)\n if (columns.length <= maxNumberOfColumns) {\n return columns\n }\n\n let mergeCandidate = {\n i: -1,\n mergeHeight: Infinity\n }\n for (let i = 0; i <= columns.length - 2; i++) {\n const column1 = columns[i + 0]\n const column2 = columns[i + 1]\n const column1Height = sum(column1.map((c) => c.elementHeight))\n const column2Height = sum(column2.map((c) => c.elementHeight))\n const mergeHeight = column1Height + column2Height\n if (mergeCandidate.mergeHeight > mergeHeight) {\n mergeCandidate = {\n i,\n mergeHeight\n }\n }\n }\n\n {\n const { i } = mergeCandidate\n assert(-1 < i && i < columns.length - 1, { i, columnsLength: columns.length, maxNumberOfColumns })\n columns[i] = [...columns[i], ...columns[i + 1]]\n columns.splice(i + 1, 1)\n }\n\n mergeColumns(columns, maxNumberOfColumns)\n}\n\nfunction sum(arr: number[]): number {\n let total = 0\n arr.forEach((n) => (total += n))\n return total\n}\n","import { initNavigationFullscreen } from './navigation-fullscreen/initNavigationFullscreen'\n\nactivateNavigationMask()\nactivateMenuToggle()\ninitNavigationFullscreen()\n\nfunction activateMenuToggle() {\n const menuToggle = document.getElementById('menu-toggle')!\n menuToggle.onclick = toggleNavigation\n}\n\nfunction activateNavigationMask() {\n const navigationMask = document.getElementById('navigation-mask')!\n navigationMask.onclick = toggleNavigation\n}\n\nfunction toggleNavigation() {\n document.body.classList.toggle('show-menu')\n}\n"],"mappings":";;;;;;;;AAEA,cAAc;AAEd,SAAS,gBAAgB;AACvB,QAAM,eAAe,SAAS,eAAe,oBAAoB;AACjE,SAAO,YAAY;AACnB,QAAM,OAAO,OAAO,SAAS;AAC7B,QAAM,WAA0B,MAAM,KAAK,aAAa,iBAAiB,WAAW,QAAQ,CAAC;AAC7F,SAAO,SAAS,UAAU,GAAG,EAAE,UAAU,KAAK,CAAC;AAC/C,QAAM,UAAU,SAAS;AACzB,MAAI,CAAC;AAAS;AACd,UAAQ,eAAe;AAAA,IAIrB,UAAU;AAAA,IAEV,OAAO;AAAA,IACP,QAAQ;AAAA,EACV,CAAC;AACH;;;ACnBA,uBAAuB;AAKvB,SAAS,yBAAyB;AAChC,QAAM,gBAAgB,SAAS,cAAc,2BAA2B;AACxE,MAAI,CAAC,eAAe;AAClB,WAAO,OAAO,SAAS,aAAa,GAAG;AACvC;AAAA,EACF;AACA,QAAM,eAAe,SAAS,eAAe,oBAAoB;AACjE,SAAO,YAAY;AACnB,QAAM,cAAc,MAAM,KAAK,SAAS,iBAAiB,IAAI,CAAC;AAC9D,cAAY,QAAQ,CAAC,eAAe;AAClC,UAAM,WAAW,WAAW;AAC5B,WAAO,QAAQ;AACf,WAAO,WAAW,IAAI,EAAE,WAAW,CAAC;AACpC,UAAM,UAAU,MAAM,WAAW;AACjC,kBAAc,cAAc,OAAO;AACnC,eAAW,UAAU,MAAM;AACzB,aAAO,SAAS,OAAO;AAEvB,oBAAc;AAAA,IAChB;AAAA,EACF,CAAC;AACH;AAEA,SAAS,cAAc,cAA2B,SAAiB;AACjE,QAAM,qBAAqB,MAAM,KAAK,aAAa,iBAAiB,WAAW,OAAO,SAAS,YAAY,CAAC;AAC5G,SAAO,mBAAmB,UAAU,CAAC;AACr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