update to svelte 5
All checks were successful
delpoy / build-and-deploy (push) Successful in 35s

This commit is contained in:
2024-12-02 00:28:43 +01:00
parent abffa440a1
commit 95968148a6
53 changed files with 2199 additions and 2002 deletions

View File

@@ -1,13 +1,11 @@
<script lang="ts">
import { onMount, tick } from 'svelte';
import { onMount, type Snippet, tick } from 'svelte';
export let onUpdate: () => Promise<any> = Promise.resolve;
let { children, onUpdate }: { children: Snippet; onUpdate: () => Promise<any> } = $props();
let bodyElem: HTMLTableSectionElement;
let intersectionElem: HTMLElement;
let intersectionObserver: IntersectionObserver;
let intersectionElement: HTMLElement;
async function getIntersectionElement(): Promise<HTMLElement> {
if (!bodyElem.lastElementChild) {
await new Promise<void>((resolve) => {
@@ -26,10 +24,10 @@
await onUpdate();
await tick();
intersectionObserver = new IntersectionObserver(
const intersectionObserver = new IntersectionObserver(
async (entries, observer) => {
if (entries.filter((e) => e.isIntersecting).length === 0 || !entries) return;
observer.unobserve(intersectionElement);
observer.unobserve(intersectionElem);
const rows = bodyElem.rows.length;
@@ -37,7 +35,7 @@
await tick();
if (rows === bodyElem.rows.length) return;
observer.observe((intersectionElement = await getIntersectionElement()));
observer.observe((intersectionElem = await getIntersectionElement()));
},
{ threshold: 0.25 }
);
@@ -51,14 +49,14 @@
return;
}
if (intersectionElement) intersectionObserver.unobserve(intersectionElement);
intersectionObserver.observe((intersectionElement = await getIntersectionElement()));
if (intersectionElem) intersectionObserver.unobserve(intersectionElem);
intersectionObserver.observe((intersectionElem = await getIntersectionElement()));
}).observe(bodyElem, { childList: true });
intersectionObserver.observe((intersectionElement = await getIntersectionElement()));
intersectionObserver.observe((intersectionElem = await getIntersectionElement()));
});
</script>
<tbody bind:this={bodyElem}>
<slot />
{@render children()}
</tbody>