Update to svelte 5

This commit is contained in:
Pixeldrain-Server committed 2025-10-13 16:05:50 +02:00
1 parent f936e4c0f2
commit 6d89c5ddd9
129 files changed
+2443 -2180

No files matched your search

+27 -14
View File
@@ -1,14 +1,10 @@
<script>
// Whether the Expandable is expanded by default
export let expanded = false
<script lang="ts">
import { stopPropagation } from 'svelte/legacy';
export const toggle = () => {
expanded = !expanded
}
// Allow the user to expand the Expandable by clicking the title. Use
// stopPropagation if you want to use other interactive elements in the title
// bar
export let click_expand = false
const header_click = () => {
if (click_expand) {
toggle()
@@ -23,8 +19,25 @@ const keypress = e => {
}
}
// Highlight the title bar if the user moves their mouse over it
export let highlight = false
let {
expanded = $bindable(false),
click_expand = false,
highlight = false,
header,
children
}: {
// Whether the Expandable is expanded by default
expanded?: boolean;
// Allow the user to expand the Expandable by clicking the title. Use
// stopPropagation if you want to use other interactive elements in the
// title bar
click_expand?: boolean;
// Highlight the title bar if the user moves their mouse over it
highlight?: boolean;
header?: import('svelte').Snippet;
children?: import('svelte').Snippet;
} = $props();
</script>
<div class="expandable">
@@ -34,14 +47,14 @@ export let highlight = false
class:highlight
role="button"
tabindex="0"
on:click={header_click}
on:keypress={keypress}
onclick={header_click}
onkeypress={keypress}
>
<div class="title">
<slot name="header"></slot>
{@render header?.()}
</div>
<button class="bucket_expand" on:click|stopPropagation={toggle}>
<button class="bucket_expand" onclick={stopPropagation(toggle)}>
{#if expanded}
<i class="icon">expand_less</i>
{:else}
@@ -51,7 +64,7 @@ export let highlight = false
</div>
{#if expanded}
<div class="body">
<slot></slot>
{@render children?.()}
</div>
{/if}
</div>