intelliwaketssveltekitv25 0.1.135 → 0.1.138
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/TabHeader.svelte +26 -3
- package/dist/TabHref.svelte +26 -3
- package/package.json +1 -1
package/dist/TabHeader.svelte
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { DeepEqual, SortCompare } from '@solidbasisventures/intelliwaketsfoundation'
|
|
4
4
|
import Icon from './Icon.svelte'
|
|
5
5
|
import { cubicInOut } from 'svelte/easing'
|
|
6
|
-
import { tick } from 'svelte'
|
|
6
|
+
import { onMount, tick } from 'svelte'
|
|
7
7
|
import { fly } from 'svelte/transition'
|
|
8
8
|
|
|
9
9
|
let {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
let openedKeys = $state<string[]>([])
|
|
18
18
|
let controlElement = $state<HTMLDivElement | null>(null)
|
|
19
|
+
let isVisible = $state(false)
|
|
19
20
|
|
|
20
21
|
let visibleItems = $derived(tabItems.filter(tabItem => !tabItem.hidden))
|
|
21
22
|
|
|
@@ -47,9 +48,31 @@
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
onMount(() => {
|
|
52
|
+
const observer = new IntersectionObserver(
|
|
53
|
+
(entries) => {
|
|
54
|
+
entries.forEach(entry => {
|
|
55
|
+
isVisible = entry.isIntersecting
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
{ threshold: 0 }
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
if (controlElement) {
|
|
62
|
+
observer.observe(controlElement)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return () => {
|
|
66
|
+
if (controlElement) {
|
|
67
|
+
observer.unobserve(controlElement)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
50
72
|
$effect(() => {
|
|
51
|
-
if (currentKey) {
|
|
52
|
-
setIndicatorStyle().then(() => {
|
|
73
|
+
if (currentKey && isVisible) {
|
|
74
|
+
setIndicatorStyle().then(() => {
|
|
75
|
+
})
|
|
53
76
|
}
|
|
54
77
|
})
|
|
55
78
|
|
package/dist/TabHref.svelte
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { browser } from '$app/environment'
|
|
6
6
|
import { afterNavigate, goto } from '$app/navigation'
|
|
7
7
|
import { CoalesceFalsey, ReplaceAll } from '@solidbasisventures/intelliwaketsfoundation'
|
|
8
|
-
import { tick } from 'svelte'
|
|
8
|
+
import { onMount, tick } from 'svelte'
|
|
9
9
|
import Icon from './Icon.svelte'
|
|
10
10
|
import { cubicInOut } from 'svelte/easing'
|
|
11
11
|
import { fly } from 'svelte/transition'
|
|
@@ -43,9 +43,31 @@
|
|
|
43
43
|
let noDigitsBasePath = $derived((basePath ?? '').replace(/\d+/g, ''))
|
|
44
44
|
let basePathDigits = $derived((basePath ?? '').match(/\d+/g)?.join('') ?? '')
|
|
45
45
|
let controlElement = $state<HTMLDivElement | null>(null)
|
|
46
|
+
let isVisible = $state(false)
|
|
46
47
|
|
|
47
48
|
let pathAnalyzer = $derived((basePath && browser) ? new PathAnalyzer(page, basePath) : null)
|
|
48
49
|
|
|
50
|
+
onMount(() => {
|
|
51
|
+
const observer = new IntersectionObserver(
|
|
52
|
+
(entries) => {
|
|
53
|
+
entries.forEach(entry => {
|
|
54
|
+
isVisible = entry.isIntersecting
|
|
55
|
+
})
|
|
56
|
+
},
|
|
57
|
+
{ threshold: 0 }
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
if (controlElement) {
|
|
61
|
+
observer.observe(controlElement)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return () => {
|
|
65
|
+
if (controlElement) {
|
|
66
|
+
observer.unobserve(controlElement)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
|
|
49
71
|
function getSlug(tabItem: ITabHref | null | undefined): string | null | undefined {
|
|
50
72
|
return !tabItem ? null : (tabItem.href ?? `${tabPrefix}${ReplaceAll(' ', '', tabItem.key)}`)
|
|
51
73
|
}
|
|
@@ -191,8 +213,9 @@
|
|
|
191
213
|
}
|
|
192
214
|
|
|
193
215
|
$effect(() => {
|
|
194
|
-
if (pathAnalyzer?.activePageSlug) {
|
|
195
|
-
setIndicatorStyle().then(() => {
|
|
216
|
+
if (pathAnalyzer?.activePageSlug && isVisible) {
|
|
217
|
+
setIndicatorStyle().then(() => {
|
|
218
|
+
})
|
|
196
219
|
}
|
|
197
220
|
})
|
|
198
221
|
|