@adminforth/agent 1.24.8 → 1.24.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/build.log CHANGED
@@ -38,5 +38,5 @@ custom/skills/fetch_data/SKILL.md
38
38
  custom/skills/mutate_data/
39
39
  custom/skills/mutate_data/SKILL.md
40
40
 
41
- sent 201,443 bytes received 566 bytes 404,018.00 bytes/sec
42
- total size is 199,169 speedup is 0.99
41
+ sent 201,337 bytes received 558 bytes 403,790.00 bytes/sec
42
+ total size is 199,037 speedup is 0.99
@@ -11,7 +11,7 @@
11
11
  </template>
12
12
 
13
13
  <script setup lang="ts">
14
- import { ref, onMounted, onUnmounted, nextTick } from 'vue'
14
+ import { ref, onMounted, onUnmounted, nextTick, watch } from 'vue'
15
15
  import CustomScrollbar from 'custom-vue-scrollbar';
16
16
  import 'custom-vue-scrollbar/dist/style.css';
17
17
  import { useAgentStore } from './composables/useAgentStore';
@@ -50,7 +50,6 @@ function scrollToBottom(force = false): void {
50
50
  if (!container) return
51
51
 
52
52
  if (isUserScrolledUp.value && !force) return
53
-
54
53
  container.scrollTo({
55
54
  top: container.scrollHeight,
56
55
  behavior: props.behavior
@@ -65,7 +64,7 @@ function hasScrollbar(): boolean {
65
64
  }
66
65
 
67
66
 
68
- function handleScroll(): void {
67
+ function handleScroll(detectScrollDown = true): void {
69
68
  const container = containerRef.value.scrollEl
70
69
  if (!container) return
71
70
 
@@ -80,12 +79,10 @@ function handleScroll(): void {
80
79
  isUserScrolledUp.value = false
81
80
  } else {
82
81
  const isScrollingUp = scrollTop < lastScrollTop
83
- const isScrollingDown = scrollTop > lastScrollTop
82
+ const isScrollingDown = detectScrollDown ? scrollTop > lastScrollTop : false
84
83
  const isContentUnchanged = scrollHeight === lastScrollHeight
85
84
  if ((isScrollingUp || isScrollingDown) && isContentUnchanged) {
86
85
  isUserScrolledUp.value = true
87
- } else if (!isNearBottom()) {
88
- isUserScrolledUp.value = true
89
86
  }
90
87
  }
91
88
  lastScrollTop = scrollTop
@@ -110,7 +107,6 @@ onMounted(() => {
110
107
  }
111
108
 
112
109
  lastScrollHeight = containerRef.value.scrollEl.scrollHeight
113
-
114
110
  if (props.enabled && !isUserScrolledUp.value) {
115
111
  scrollToBottom()
116
112
  }
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <SessionsHistory
3
3
  :class="agentStore.isSessionHistoryOpen ? 'translate-x-0' : '-translate-x-full'"
4
- @recalculateScroll="recalculateScroll"
5
4
  />
6
5
  <div
7
6
  v-if="agentStore.isSessionHistoryOpen"
@@ -83,12 +82,11 @@ const showScrollToBottomButton = ref(false);
83
82
  const innerScrollContainerRef = ref(null);
84
83
  const agentStore = useAgentStore();
85
84
  const agentTransitions = useAgentTransitions();
86
- const clicks = ref(0);
87
85
  const showScrollContainer = ref(true);
88
86
 
89
87
  function recalculateScroll() {
90
88
  if (scrollContainer.value) {
91
- scrollContainer.value.handleScroll();
89
+ scrollContainer.value.handleScroll(false);
92
90
  const isScrolledUp = scrollContainer.value.isUserScrolledUp();
93
91
  showScrollToBottomButton.value = !!isScrolledUp;
94
92
  }
@@ -121,9 +119,6 @@ watch(scrollContainer, () => {
121
119
  }
122
120
  })
123
121
 
124
- watch(clicks, () => {
125
- recalculateScroll();
126
- })
127
122
 
128
123
 
129
124
  </script>
@@ -11,7 +11,7 @@
11
11
  </template>
12
12
 
13
13
  <script setup lang="ts">
14
- import { ref, onMounted, onUnmounted, nextTick } from 'vue'
14
+ import { ref, onMounted, onUnmounted, nextTick, watch } from 'vue'
15
15
  import CustomScrollbar from 'custom-vue-scrollbar';
16
16
  import 'custom-vue-scrollbar/dist/style.css';
17
17
  import { useAgentStore } from './composables/useAgentStore';
@@ -50,7 +50,6 @@ function scrollToBottom(force = false): void {
50
50
  if (!container) return
51
51
 
52
52
  if (isUserScrolledUp.value && !force) return
53
-
54
53
  container.scrollTo({
55
54
  top: container.scrollHeight,
56
55
  behavior: props.behavior
@@ -65,7 +64,7 @@ function hasScrollbar(): boolean {
65
64
  }
66
65
 
67
66
 
68
- function handleScroll(): void {
67
+ function handleScroll(detectScrollDown = true): void {
69
68
  const container = containerRef.value.scrollEl
70
69
  if (!container) return
71
70
 
@@ -80,12 +79,10 @@ function handleScroll(): void {
80
79
  isUserScrolledUp.value = false
81
80
  } else {
82
81
  const isScrollingUp = scrollTop < lastScrollTop
83
- const isScrollingDown = scrollTop > lastScrollTop
82
+ const isScrollingDown = detectScrollDown ? scrollTop > lastScrollTop : false
84
83
  const isContentUnchanged = scrollHeight === lastScrollHeight
85
84
  if ((isScrollingUp || isScrollingDown) && isContentUnchanged) {
86
85
  isUserScrolledUp.value = true
87
- } else if (!isNearBottom()) {
88
- isUserScrolledUp.value = true
89
86
  }
90
87
  }
91
88
  lastScrollTop = scrollTop
@@ -110,7 +107,6 @@ onMounted(() => {
110
107
  }
111
108
 
112
109
  lastScrollHeight = containerRef.value.scrollEl.scrollHeight
113
-
114
110
  if (props.enabled && !isUserScrolledUp.value) {
115
111
  scrollToBottom()
116
112
  }
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <SessionsHistory
3
3
  :class="agentStore.isSessionHistoryOpen ? 'translate-x-0' : '-translate-x-full'"
4
- @recalculateScroll="recalculateScroll"
5
4
  />
6
5
  <div
7
6
  v-if="agentStore.isSessionHistoryOpen"
@@ -83,12 +82,11 @@ const showScrollToBottomButton = ref(false);
83
82
  const innerScrollContainerRef = ref(null);
84
83
  const agentStore = useAgentStore();
85
84
  const agentTransitions = useAgentTransitions();
86
- const clicks = ref(0);
87
85
  const showScrollContainer = ref(true);
88
86
 
89
87
  function recalculateScroll() {
90
88
  if (scrollContainer.value) {
91
- scrollContainer.value.handleScroll();
89
+ scrollContainer.value.handleScroll(false);
92
90
  const isScrolledUp = scrollContainer.value.isUserScrolledUp();
93
91
  showScrollToBottomButton.value = !!isScrolledUp;
94
92
  }
@@ -121,9 +119,6 @@ watch(scrollContainer, () => {
121
119
  }
122
120
  })
123
121
 
124
- watch(clicks, () => {
125
- recalculateScroll();
126
- })
127
122
 
128
123
 
129
124
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "1.24.8",
3
+ "version": "1.24.10",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",