@gradio/imageslider 0.5.0 → 0.7.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.
@@ -1,24 +1,48 @@
1
1
  <svelte:options accessors={true} />
2
2
 
3
3
  <script lang="ts">
4
+ import type { Snippet } from "svelte";
4
5
  import type { I18nFormatter } from "@gradio/utils";
5
6
  import Image from "./Image.svelte";
6
7
  import { type Client } from "@gradio/client";
7
8
 
8
9
  import type { FileData } from "@gradio/client";
9
10
 
10
- export let value: [FileData | null, FileData | null] = [null, null];
11
- export let upload: Client["upload"];
12
- export let stream_handler: Client["stream"];
13
- export let label: string;
14
- export let show_label: boolean;
15
- export let i18n: I18nFormatter;
16
- export let root: string;
17
- export let upload_count = 1;
18
- export let dragging: boolean;
19
- export let max_height: number;
20
- export let max_file_size: number | null = null;
21
- export let upload_promise: Promise<any> | null = null;
11
+ let {
12
+ value = $bindable<[FileData | null, FileData | null]>([null, null]),
13
+ upload,
14
+ stream_handler,
15
+ label,
16
+ show_label,
17
+ i18n,
18
+ root,
19
+ upload_count = 1,
20
+ dragging = $bindable(false),
21
+ max_height,
22
+ max_file_size = null,
23
+ upload_promise = $bindable(),
24
+ onclear,
25
+ ondrag,
26
+ onupload,
27
+ children
28
+ }: {
29
+ value?: [FileData | null, FileData | null];
30
+ upload: Client["upload"];
31
+ stream_handler: Client["stream"];
32
+ label: string;
33
+ show_label: boolean;
34
+ i18n: I18nFormatter;
35
+ root: string;
36
+ upload_count?: number;
37
+ dragging?: boolean;
38
+ max_height: number;
39
+ max_file_size?: number | null;
40
+ upload_promise?: Promise<any>;
41
+ onclear?: () => void;
42
+ ondrag?: (dragging: boolean) => void;
43
+ onupload?: (value: [FileData | null, FileData | null]) => void;
44
+ children?: Snippet;
45
+ } = $props();
22
46
  </script>
23
47
 
24
48
  <Image
@@ -28,13 +52,12 @@
28
52
  bind:value
29
53
  bind:dragging
30
54
  {root}
31
- on:edit
32
- on:clear
33
- on:stream
34
- on:drag={({ detail }) => (dragging = detail)}
35
- on:upload
36
- on:select
37
- on:share
55
+ {onclear}
56
+ ondrag={(detail) => {
57
+ dragging = detail;
58
+ ondrag?.(detail);
59
+ }}
60
+ {onupload}
38
61
  {label}
39
62
  {show_label}
40
63
  {upload_count}
@@ -44,5 +67,5 @@
44
67
  {max_height}
45
68
  {i18n}
46
69
  >
47
- <slot />
70
+ {#if children}{@render children()}{/if}
48
71
  </Image>
package/types.ts CHANGED
@@ -4,7 +4,7 @@ import type {
4
4
  ShareData,
5
5
  CustomButton
6
6
  } from "@gradio/utils";
7
- import type { LoadingStatus } from "@gradio/statustracker";
7
+ import type { ILoadingStatus as LoadingStatus } from "@gradio/statustracker";
8
8
  import type { FileData } from "@gradio/client";
9
9
 
10
10
  export interface ImageSliderEvents {