simplesvelte 2.2.23 → 2.4.0

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/Modal.svelte CHANGED
@@ -1,39 +1,39 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte'
3
-
4
- let { open = $bindable(), title, children }: Props = $props()
5
-
6
- let dialogEl: HTMLDialogElement | undefined = $state()
7
- interface Props {
8
- open: boolean
9
- title: string
10
- children?: Snippet
11
- }
12
-
13
- $effect(() => {
14
- if (!dialogEl) return
15
-
16
- if (open) {
17
- dialogEl.showModal()
18
- } else {
19
- dialogEl.close()
20
- }
21
- })
22
- </script>
23
-
24
- <dialog bind:this={dialogEl} onclose={() => (open = false)} class="modal modal-middle overflow-auto">
25
- <div class="modal-box pt-12 md:min-w-[32rem]">
26
- <form method="dialog">
27
- <button
28
- class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
29
- onclick={() => {
30
- open = false
31
- }}>✕</button>
32
- </form>
33
- <h1 class="absolute top-2 text-lg font-semibold text-red-700 uppercase">{title}</h1>
34
-
35
- {#if open}
36
- {@render children?.()}
37
- {/if}
38
- </div>
39
- </dialog>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+
4
+ let { open = $bindable(), title, children }: Props = $props()
5
+
6
+ let dialogEl: HTMLDialogElement | undefined = $state()
7
+ interface Props {
8
+ open: boolean
9
+ title: string
10
+ children?: Snippet
11
+ }
12
+
13
+ $effect(() => {
14
+ if (!dialogEl) return
15
+
16
+ if (open) {
17
+ dialogEl.showModal()
18
+ } else {
19
+ dialogEl.close()
20
+ }
21
+ })
22
+ </script>
23
+
24
+ <dialog bind:this={dialogEl} onclose={() => (open = false)} class="modal modal-middle overflow-auto">
25
+ <div class="modal-box pt-12 md:min-w-[32rem]">
26
+ <form method="dialog">
27
+ <button
28
+ class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
29
+ onclick={() => {
30
+ open = false
31
+ }}>✕</button>
32
+ </form>
33
+ <h1 class="absolute top-2 text-lg font-semibold text-red-700 uppercase">{title}</h1>
34
+
35
+ {#if open}
36
+ {@render children?.()}
37
+ {/if}
38
+ </div>
39
+ </dialog>