@brillout/docpress 0.4.12 → 0.4.14
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.js
CHANGED
|
@@ -217,7 +217,7 @@ function Note({
|
|
|
217
217
|
className
|
|
218
218
|
}, /* @__PURE__ */ React5.createElement("div", {
|
|
219
219
|
style: { marginBottom: 20 }
|
|
220
|
-
}), icon, /* @__PURE__ */ React5.createElement("div", {
|
|
220
|
+
}), icon, " ", /* @__PURE__ */ React5.createElement("div", {
|
|
221
221
|
className: "blockquote-content"
|
|
222
222
|
}, children), /* @__PURE__ */ React5.createElement("div", {
|
|
223
223
|
style: { marginTop: 20 }
|
|
@@ -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,
|
|
@@ -277,6 +287,9 @@ blockquote.warning {
|
|
|
277
287
|
204,
|
|
278
288
|
50;
|
|
279
289
|
}
|
|
290
|
+
.blockquote-content {
|
|
291
|
+
display: inline;
|
|
292
|
+
}
|
|
280
293
|
blockquote.custom-icon > .blockquote-content > :first-child {
|
|
281
294
|
display: inline;
|
|
282
295
|
}
|
|
@@ -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;
|