@brillout/docpress 0.4.13 → 0.4.15
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/dist/index.d.ts +1 -1
- package/dist/index.js +10 -7
- package/dist/renderer/_default.page.client.css +22 -12
- package/dist/renderer/_default.page.client.js +29 -21
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -152,7 +152,7 @@ declare function Sponsors(): JSX.Element;
|
|
|
152
152
|
|
|
153
153
|
declare function CodeBlock({ children, lineBreak }: {
|
|
154
154
|
children: any;
|
|
155
|
-
lineBreak?:
|
|
155
|
+
lineBreak?: 'white-space' | 'break-word';
|
|
156
156
|
}): JSX.Element;
|
|
157
157
|
|
|
158
158
|
export { CodeBlock, Config, Construction, Emoji, EmojiName, HeadingDefinition, HeadingDetachedDefinition, HorizontalLine, ImportMeta, Info, Link, Note, P, ReadingRecommendation, RepoLink, Sponsor, Sponsors, Warning, assert, assertUsage, assertWarning, crawlAllFiles, determineSectionTitle, determineSectionUrlHash, filter, isBrowser, isRepoLink, jsxToTextContent, objectAssign };
|
package/dist/index.js
CHANGED
|
@@ -585,15 +585,18 @@ function isIndividual(sponsor) {
|
|
|
585
585
|
// src/components/CodeBlock.tsx
|
|
586
586
|
import React9 from "react";
|
|
587
587
|
function CodeBlock({ children, lineBreak }) {
|
|
588
|
-
assert(
|
|
588
|
+
assert(
|
|
589
|
+
lineBreak === "white-space" || lineBreak === "break-word",
|
|
590
|
+
"`lineBreak` is currently the only use case for <CodeBlock>"
|
|
591
|
+
);
|
|
589
592
|
const style = {};
|
|
590
593
|
if (lineBreak) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
}
|
|
594
|
+
style.whiteSpace = "break-spaces";
|
|
595
|
+
style.paddingRight = "16px !important";
|
|
596
|
+
if (lineBreak === "break-word") {
|
|
597
|
+
style.wordWrap = "break-word";
|
|
598
|
+
style.wordBreak = "break-all";
|
|
599
|
+
}
|
|
597
600
|
}
|
|
598
601
|
return /* @__PURE__ */ React9.createElement("pre", null, /* @__PURE__ */ React9.createElement("code", {
|
|
599
602
|
style
|
|
@@ -36,29 +36,39 @@ iframe {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/* src/css/heading.css */
|
|
39
|
+
.doc-page h2,
|
|
40
|
+
.doc-page h3 {
|
|
41
|
+
margin-bottom: 16px;
|
|
42
|
+
}
|
|
39
43
|
.doc-page h2 {
|
|
40
44
|
margin-top: 50px;
|
|
45
|
+
}
|
|
46
|
+
.doc-page h3 {
|
|
47
|
+
margin-top: 40px;
|
|
48
|
+
}
|
|
49
|
+
.doc-page h1 + h2,
|
|
50
|
+
.doc-page h1 + h3,
|
|
51
|
+
.doc-page h2 + h3 {
|
|
52
|
+
margin-top: 0;
|
|
53
|
+
}
|
|
54
|
+
.doc-page h4 {
|
|
55
|
+
margin-top: 32px;
|
|
41
56
|
margin-bottom: 16px;
|
|
42
57
|
}
|
|
43
|
-
.doc-page h2[id]
|
|
58
|
+
.doc-page h2[id],
|
|
59
|
+
.doc-page h3[id] {
|
|
44
60
|
cursor: pointer;
|
|
45
61
|
position: relative;
|
|
46
|
-
padding-left:
|
|
47
|
-
margin-left: -
|
|
62
|
+
padding-left: 26px;
|
|
63
|
+
margin-left: -26px;
|
|
48
64
|
}
|
|
49
|
-
.doc-page h2[id]:hover::before
|
|
65
|
+
.doc-page h2[id]:hover::before,
|
|
66
|
+
.doc-page h3[id]:hover::before {
|
|
50
67
|
content: "#";
|
|
51
68
|
position: absolute;
|
|
52
|
-
left: calc(-1 * (0.75em -
|
|
69
|
+
left: calc(-1 * (0.75em - 23px));
|
|
53
70
|
color: #aaa;
|
|
54
71
|
}
|
|
55
|
-
.doc-page h1 + h2 {
|
|
56
|
-
margin-top: 0;
|
|
57
|
-
}
|
|
58
|
-
.doc-page h4 {
|
|
59
|
-
margin-top: 32px;
|
|
60
|
-
margin-bottom: 16px;
|
|
61
|
-
}
|
|
62
72
|
|
|
63
73
|
/* src/css/button.css */
|
|
64
74
|
button,
|
|
@@ -29,29 +29,31 @@ function installSectionUrlHashs() {
|
|
|
29
29
|
assert(window.location.pathname === "/");
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
window.location.hash = urlHash;
|
|
43
|
-
jumpToSection();
|
|
44
|
-
};
|
|
45
|
-
});
|
|
32
|
+
const headings = [...Array.from(document.querySelectorAll("h2")), ...Array.from(document.querySelectorAll("h3"))];
|
|
33
|
+
headings.forEach((heading) => {
|
|
34
|
+
if (!heading.id)
|
|
35
|
+
return;
|
|
36
|
+
const urlHash = "#" + heading.id;
|
|
37
|
+
assertNavLink(urlHash, heading);
|
|
38
|
+
heading.onclick = () => {
|
|
39
|
+
window.location.hash = urlHash;
|
|
40
|
+
jumpToSection();
|
|
41
|
+
};
|
|
46
42
|
});
|
|
47
43
|
}
|
|
48
|
-
function assertNavLink(
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
function assertNavLink(urlHash, heading) {
|
|
45
|
+
const navigationEl = getNavigationEl();
|
|
46
|
+
{
|
|
47
|
+
const parentNavLinkMatch = Array.from(navigationEl.querySelectorAll(`a[href="${window.location.pathname}"]`));
|
|
48
|
+
assert(parentNavLinkMatch.length === 1);
|
|
49
|
+
}
|
|
50
|
+
{
|
|
51
|
+
const navLinks = Array.from(navigationEl.querySelectorAll(`a[href="${urlHash}"]`));
|
|
52
|
+
const { tagName } = heading;
|
|
53
|
+
assert(tagName.startsWith("H"));
|
|
54
|
+
const lengthExpected = tagName === "H2" ? 1 : 0;
|
|
55
|
+
assert(navLinks.length === lengthExpected, { urlHash });
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
function jumpToSection() {
|
|
57
59
|
const { hash } = window.location;
|
|
@@ -65,6 +67,12 @@ function jumpToSection() {
|
|
|
65
67
|
}
|
|
66
68
|
target.scrollIntoView();
|
|
67
69
|
}
|
|
70
|
+
function getNavigationEl() {
|
|
71
|
+
const elems = Array.from(document.querySelectorAll("#navigation-container"));
|
|
72
|
+
assert(elems.length === 1);
|
|
73
|
+
const navigationEl = elems[0];
|
|
74
|
+
return navigationEl;
|
|
75
|
+
}
|
|
68
76
|
|
|
69
77
|
// src/navigation/navigation-fullscreen/initNavigationFullscreen.ts
|
|
70
78
|
var scrollPositionBeforeToggle = 0;
|