@gradio/downloadbutton 0.4.15 → 0.4.16

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @gradio/downloadbutton
2
2
 
3
+ ## 0.4.16
4
+
5
+ ### Fixes
6
+
7
+ - [#12689](https://github.com/gradio-app/gradio/pull/12689) [`be89f8c`](https://github.com/gradio-app/gradio/commit/be89f8c4272a2d2c3da9345c3e26df5505307428) - Migrate DownloadButton to Svelte 5. Thanks @dawoodkhan82!
8
+ - [#12681](https://github.com/gradio-app/gradio/pull/12681) [`ba46c2d`](https://github.com/gradio-app/gradio/commit/ba46c2df1405c11e495304af8f91acfdf69d0b18) - Migrate Button to Svelte 5. Thanks @freddyaboulton!
9
+
10
+ ### Dependency updates
11
+
12
+ - @gradio/utils@0.11.1
13
+ - @gradio/button@0.6.2
14
+ - @gradio/client@2.0.2
15
+
3
16
  ## 0.4.15
4
17
 
5
18
  ### Dependency updates
package/Index.svelte CHANGED
@@ -22,7 +22,7 @@
22
22
  min_width={gradio.shared.min_width}
23
23
  visible={gradio.shared.visible}
24
24
  disabled={!gradio.shared.interactive}
25
- on:click={() => gradio.dispatch("click")}
25
+ on_click={() => gradio.dispatch("click")}
26
26
  >
27
27
  {gradio.shared.label ?? ""}
28
28
  </DownloadButton>
package/dist/Index.svelte CHANGED
@@ -22,7 +22,7 @@
22
22
  min_width={gradio.shared.min_width}
23
23
  visible={gradio.shared.visible}
24
24
  disabled={!gradio.shared.interactive}
25
- on:click={() => gradio.dispatch("click")}
25
+ on_click={() => gradio.dispatch("click")}
26
26
  >
27
27
  {gradio.shared.label ?? ""}
28
28
  </DownloadButton>
@@ -1,22 +1,38 @@
1
1
  <script lang="ts">
2
- import { createEventDispatcher } from "svelte";
3
2
  import { type FileData } from "@gradio/client";
4
3
  import { BaseButton } from "@gradio/button";
4
+ import { type Snippet } from "svelte";
5
5
 
6
- export let elem_id = "";
7
- export let elem_classes: string[] = [];
8
- export let visible: boolean | "hidden" = true;
9
- export let variant: "primary" | "secondary" | "stop" = "secondary";
10
- export let size: "sm" | "md" | "lg" = "lg";
11
- export let value: null | FileData;
12
- export let icon: null | FileData;
13
- export let disabled = false;
14
- export let scale: number | null = null;
15
- export let min_width: number | undefined = undefined;
16
- const dispatch = createEventDispatcher();
6
+ let {
7
+ elem_id = "",
8
+ elem_classes = [],
9
+ visible = true,
10
+ variant = "secondary",
11
+ size = "lg",
12
+ value,
13
+ icon,
14
+ disabled = false,
15
+ scale = null,
16
+ min_width = undefined,
17
+ on_click,
18
+ children
19
+ }: {
20
+ elem_id?: string;
21
+ elem_classes?: string[];
22
+ visible?: boolean | "hidden";
23
+ variant?: "primary" | "secondary" | "stop";
24
+ size?: "sm" | "md" | "lg";
25
+ value: FileData | null;
26
+ icon: FileData | null;
27
+ disabled?: boolean;
28
+ scale?: number | null;
29
+ min_width?: number | undefined;
30
+ on_click?: () => void;
31
+ children?: Snippet;
32
+ } = $props();
17
33
 
18
34
  function download_file(): void {
19
- dispatch("click");
35
+ on_click?.();
20
36
  if (!value?.url) {
21
37
  return;
22
38
  }
@@ -43,7 +59,7 @@
43
59
  {elem_id}
44
60
  {elem_classes}
45
61
  {visible}
46
- on:click={download_file}
62
+ onclick={download_file}
47
63
  {scale}
48
64
  {min_width}
49
65
  {disabled}
@@ -51,7 +67,9 @@
51
67
  {#if icon}
52
68
  <img class="button-icon" src={icon.url} alt={`${value} icon`} />
53
69
  {/if}
54
- <slot />
70
+ {#if children}
71
+ {@render children()}
72
+ {/if}
55
73
  </BaseButton>
56
74
 
57
75
  <style>
@@ -1,41 +1,19 @@
1
1
  import { type FileData } from "@gradio/client";
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
16
- default: any;
17
- } ? Props extends Record<string, never> ? any : {
18
- children?: any;
19
- } : {});
20
- declare const DownloadButton: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
2
+ import { type Snippet } from "svelte";
3
+ type $$ComponentProps = {
21
4
  elem_id?: string;
22
5
  elem_classes?: string[];
23
6
  visible?: boolean | "hidden";
24
7
  variant?: "primary" | "secondary" | "stop";
25
8
  size?: "sm" | "md" | "lg";
26
- value: null | FileData;
27
- icon: null | FileData;
9
+ value: FileData | null;
10
+ icon: FileData | null;
28
11
  disabled?: boolean;
29
12
  scale?: number | null;
30
13
  min_width?: number | undefined;
31
- }, {
32
- default: {};
33
- }>, {
34
- click: CustomEvent<any>;
35
- } & {
36
- [evt: string]: CustomEvent<any>;
37
- }, {
38
- default: {};
39
- }, {}, string>;
40
- type DownloadButton = InstanceType<typeof DownloadButton>;
14
+ on_click?: () => void;
15
+ children?: Snippet;
16
+ };
17
+ declare const DownloadButton: import("svelte").Component<$$ComponentProps, {}, "">;
18
+ type DownloadButton = ReturnType<typeof DownloadButton>;
41
19
  export default DownloadButton;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@gradio/downloadbutton",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
7
7
  "license": "ISC",
8
8
  "private": false,
9
9
  "dependencies": {
10
- "@gradio/client": "^2.0.1",
11
- "@gradio/utils": "^0.11.0",
12
- "@gradio/button": "^0.6.1"
10
+ "@gradio/button": "^0.6.2",
11
+ "@gradio/client": "^2.0.2",
12
+ "@gradio/utils": "^0.11.1"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@gradio/preview": "^0.15.1"
@@ -1,22 +1,38 @@
1
1
  <script lang="ts">
2
- import { createEventDispatcher } from "svelte";
3
2
  import { type FileData } from "@gradio/client";
4
3
  import { BaseButton } from "@gradio/button";
4
+ import { type Snippet } from "svelte";
5
5
 
6
- export let elem_id = "";
7
- export let elem_classes: string[] = [];
8
- export let visible: boolean | "hidden" = true;
9
- export let variant: "primary" | "secondary" | "stop" = "secondary";
10
- export let size: "sm" | "md" | "lg" = "lg";
11
- export let value: null | FileData;
12
- export let icon: null | FileData;
13
- export let disabled = false;
14
- export let scale: number | null = null;
15
- export let min_width: number | undefined = undefined;
16
- const dispatch = createEventDispatcher();
6
+ let {
7
+ elem_id = "",
8
+ elem_classes = [],
9
+ visible = true,
10
+ variant = "secondary",
11
+ size = "lg",
12
+ value,
13
+ icon,
14
+ disabled = false,
15
+ scale = null,
16
+ min_width = undefined,
17
+ on_click,
18
+ children
19
+ }: {
20
+ elem_id?: string;
21
+ elem_classes?: string[];
22
+ visible?: boolean | "hidden";
23
+ variant?: "primary" | "secondary" | "stop";
24
+ size?: "sm" | "md" | "lg";
25
+ value: FileData | null;
26
+ icon: FileData | null;
27
+ disabled?: boolean;
28
+ scale?: number | null;
29
+ min_width?: number | undefined;
30
+ on_click?: () => void;
31
+ children?: Snippet;
32
+ } = $props();
17
33
 
18
34
  function download_file(): void {
19
- dispatch("click");
35
+ on_click?.();
20
36
  if (!value?.url) {
21
37
  return;
22
38
  }
@@ -43,7 +59,7 @@
43
59
  {elem_id}
44
60
  {elem_classes}
45
61
  {visible}
46
- on:click={download_file}
62
+ onclick={download_file}
47
63
  {scale}
48
64
  {min_width}
49
65
  {disabled}
@@ -51,7 +67,9 @@
51
67
  {#if icon}
52
68
  <img class="button-icon" src={icon.url} alt={`${value} icon`} />
53
69
  {/if}
54
- <slot />
70
+ {#if children}
71
+ {@render children()}
72
+ {/if}
55
73
  </BaseButton>
56
74
 
57
75
  <style>