@tekkare/auriga 0.1.133 → 0.1.135
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/module.json
CHANGED
|
@@ -36,7 +36,8 @@ import {
|
|
|
36
36
|
onMounted,
|
|
37
37
|
ref,
|
|
38
38
|
computed,
|
|
39
|
-
defineComponent
|
|
39
|
+
defineComponent,
|
|
40
|
+
onUnmounted
|
|
40
41
|
} from "vue";
|
|
41
42
|
export default defineComponent({
|
|
42
43
|
name: "argChaptersNav",
|
|
@@ -86,8 +87,11 @@ export default defineComponent({
|
|
|
86
87
|
});
|
|
87
88
|
} else {
|
|
88
89
|
scrollChapters();
|
|
89
|
-
document.addEventListener("scroll", scrollChapters);
|
|
90
90
|
}
|
|
91
|
+
document.addEventListener("scroll", scrollChapters);
|
|
92
|
+
});
|
|
93
|
+
onUnmounted(() => {
|
|
94
|
+
document.removeEventListener("scroll", scrollChapters);
|
|
91
95
|
});
|
|
92
96
|
function scrollChapters() {
|
|
93
97
|
getChaptersInPage.value.forEach((elem) => {
|
|
@@ -112,25 +116,14 @@ export default defineComponent({
|
|
|
112
116
|
const rect = element.getBoundingClientRect();
|
|
113
117
|
return rect.top <= getElementPosition("chapter_menu") + 10;
|
|
114
118
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
window.scrollTo({ top: targetPosition, behavior: "smooth" });
|
|
124
|
-
}
|
|
125
|
-
resolve();
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
async function selectChapter(index, anchorId) {
|
|
129
|
-
await removeEvent(index, anchorId).then(() => {
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
document.addEventListener("scroll", scrollChapters);
|
|
132
|
-
}, 1200);
|
|
133
|
-
});
|
|
119
|
+
function selectChapter(index, anchorId) {
|
|
120
|
+
activeChapter.value = index;
|
|
121
|
+
setBarPosition();
|
|
122
|
+
const targetElement = document.getElementById(anchorId);
|
|
123
|
+
if (targetElement) {
|
|
124
|
+
const targetPosition = targetElement.offsetTop - headerHeight.value;
|
|
125
|
+
window.scrollTo({ top: targetPosition, behavior: "smooth" });
|
|
126
|
+
}
|
|
134
127
|
}
|
|
135
128
|
function setBarPosition() {
|
|
136
129
|
const selector = document?.getElementById(`chapters_nav_bar`);
|
|
@@ -17,7 +17,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
17
17
|
value: null;
|
|
18
18
|
};
|
|
19
19
|
}, {
|
|
20
|
-
selectChapter: (index: number, anchorId: string) =>
|
|
20
|
+
selectChapter: (index: number, anchorId: string) => void;
|
|
21
21
|
activeChapter: import("vue").Ref<any>;
|
|
22
22
|
headerHeight: import("vue").Ref<number>;
|
|
23
23
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClose"[], "onClose", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|