@tekkare/auriga 0.1.133 → 0.1.134

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
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.1.133"
7
+ "version": "0.1.134"
8
8
  }
@@ -86,8 +86,8 @@ export default defineComponent({
86
86
  });
87
87
  } else {
88
88
  scrollChapters();
89
- document.addEventListener("scroll", scrollChapters);
90
89
  }
90
+ document.addEventListener("scroll", scrollChapters);
91
91
  });
92
92
  function scrollChapters() {
93
93
  getChaptersInPage.value.forEach((elem) => {
@@ -112,25 +112,14 @@ export default defineComponent({
112
112
  const rect = element.getBoundingClientRect();
113
113
  return rect.top <= getElementPosition("chapter_menu") + 10;
114
114
  }
115
- function removeEvent(index, anchor, callback) {
116
- return new Promise((resolve) => {
117
- document.removeEventListener("scroll", scrollChapters);
118
- activeChapter.value = index;
119
- setBarPosition();
120
- const targetElement = document.getElementById(anchor);
121
- if (targetElement) {
122
- const targetPosition = targetElement.offsetTop - headerHeight.value;
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
- });
115
+ function selectChapter(index, anchorId) {
116
+ activeChapter.value = index;
117
+ setBarPosition();
118
+ const targetElement = document.getElementById(anchorId);
119
+ if (targetElement) {
120
+ const targetPosition = targetElement.offsetTop - headerHeight.value;
121
+ window.scrollTo({ top: targetPosition, behavior: "smooth" });
122
+ }
134
123
  }
135
124
  function setBarPosition() {
136
125
  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) => Promise<void>;
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<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/auriga",
3
- "version": "0.1.133",
3
+ "version": "0.1.134",
4
4
  "description": "Aurgia is a UI kit developped by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",