@gradio/imageslider 0.2.14 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @gradio/imageslider
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Features
6
+
7
+ - [#11858](https://github.com/gradio-app/gradio/pull/11858) [`3f8ea13`](https://github.com/gradio-app/gradio/commit/3f8ea13a8ca92abf0ad34392e403a449fda3c6c2) - remove lite. Thanks @pngwn!
8
+
9
+ ### Fixes
10
+
11
+ - [#11784](https://github.com/gradio-app/gradio/pull/11784) [`d9dd3f5`](https://github.com/gradio-app/gradio/commit/d9dd3f54b7fb34cf7118e549d39fc63937ca3489) - Add "hidden" option to component's `visible` kwarg to render but visually hide the component. Thanks @pngwn!
12
+
13
+ ### Dependency updates
14
+
15
+ - @gradio/statustracker@0.11.1
16
+ - @gradio/atoms@0.18.0
17
+ - @gradio/client@1.19.0
18
+ - @gradio/upload@0.17.0
19
+
3
20
  ## 0.2.14
4
21
 
5
22
  ### Dependency updates
package/Index.svelte CHANGED
@@ -17,7 +17,7 @@
17
17
  export let value_is_output = false;
18
18
  export let elem_id = "";
19
19
  export let elem_classes: string[] = [];
20
- export let visible = true;
20
+ export let visible: boolean | "hidden" = true;
21
21
  export let value: [FileData | null, FileData | null] = [null, null];
22
22
  let old_value: [FileData | null, FileData | null] = [null, null];
23
23
  export let label: string;
@@ -7,7 +7,7 @@ declare const __propDef: {
7
7
  value_is_output?: boolean;
8
8
  elem_id?: string;
9
9
  elem_classes?: string[];
10
- visible?: boolean;
10
+ visible?: boolean | "hidden";
11
11
  value?: [FileData | null, FileData | null];
12
12
  label: string;
13
13
  show_label: boolean;
@@ -62,12 +62,12 @@ export default class Index extends SvelteComponent<IndexProps, IndexEvents, Inde
62
62
  get elem_classes(): string[] | undefined;
63
63
  /**accessor*/
64
64
  set elem_classes(_: string[] | undefined);
65
- get visible(): boolean | undefined;
65
+ get visible(): boolean | "hidden" | undefined;
66
66
  /**accessor*/
67
- set visible(_: boolean | undefined);
68
- get value(): [FileData | null, FileData | null] | undefined;
67
+ set visible(_: boolean | "hidden" | undefined);
68
+ get value(): [any, any] | undefined;
69
69
  /**accessor*/
70
- set value(_: [FileData | null, FileData | null] | undefined);
70
+ set value(_: [any, any] | undefined);
71
71
  get label(): string;
72
72
  /**accessor*/
73
73
  set label(_: string);
@@ -1,13 +1,12 @@
1
1
  <script>import Slider from "./Slider.svelte";
2
2
  import { createEventDispatcher, tick } from "svelte";
3
- import { BlockLabel, Empty, IconButton } from "@gradio/atoms";
3
+ import { BlockLabel, Empty, IconButton, DownloadLink } from "@gradio/atoms";
4
4
  import { Download } from "@gradio/icons";
5
5
  import { Image } from "@gradio/icons";
6
6
  import {} from "@gradio/utils";
7
7
  import ClearImage from "./ClearImage.svelte";
8
8
  import ImageEl from "./ImageEl.svelte";
9
9
  import { Upload } from "@gradio/upload";
10
- import { DownloadLink } from "@gradio/wasm/svelte";
11
10
  import {} from "@gradio/client";
12
11
  export let value;
13
12
  export let label = void 0;
@@ -24,7 +24,7 @@ declare const __propDef: {
24
24
  edit: CustomEvent<undefined>;
25
25
  clear: CustomEvent<undefined>;
26
26
  drag: CustomEvent<boolean>;
27
- upload: CustomEvent<[FileData | null, FileData | null]>;
27
+ upload: CustomEvent<[any, any]>;
28
28
  select: CustomEvent<SelectData>;
29
29
  } & {
30
30
  [evt: string]: CustomEvent<any>;
@@ -1,25 +1,12 @@
1
1
  <script>import { createEventDispatcher, onMount, tick } from "svelte";
2
- import { resolve_wasm_src } from "@gradio/wasm/svelte";
3
2
  export let src = void 0;
4
3
  export let fullscreen = false;
5
- let resolved_src;
6
4
  export let fixed = false;
7
5
  export let transform = "translate(0px, 0px) scale(1)";
8
6
  export let img_el = null;
9
7
  export let hidden = false;
10
8
  export let variant = "upload";
11
9
  export let max_height = 500;
12
- let latest_src;
13
- $: {
14
- resolved_src = src;
15
- latest_src = src;
16
- const resolving_src = src;
17
- resolve_wasm_src(resolving_src).then((s) => {
18
- if (latest_src === resolving_src) {
19
- resolved_src = s;
20
- }
21
- });
22
- }
23
10
  const dispatch = createEventDispatcher();
24
11
  function get_image_size(img) {
25
12
  if (!img) return { top: 0, left: 0, width: 0, height: 0 };
@@ -60,7 +47,7 @@ onMount(() => {
60
47
 
61
48
  <!-- svelte-ignore a11y-missing-attribute -->
62
49
  <img
63
- src={resolved_src}
50
+ {src}
64
51
  {...$$restProps}
65
52
  class:fixed
66
53
  style:transform
@@ -5,11 +5,11 @@ import {
5
5
  Empty,
6
6
  IconButton,
7
7
  IconButtonWrapper,
8
- FullscreenButton
8
+ FullscreenButton,
9
+ DownloadLink
9
10
  } from "@gradio/atoms";
10
11
  import { Image, Download, Undo, Clear } from "@gradio/icons";
11
12
  import {} from "@gradio/client";
12
- import { DownloadLink } from "@gradio/wasm/svelte";
13
13
  import { ZoomableImage } from "./zoom";
14
14
  import { onMount } from "svelte";
15
15
  import { tweened } from "svelte/motion";
@@ -20,7 +20,7 @@ declare const __propDef: {
20
20
  edit: CustomEvent<undefined>;
21
21
  clear: CustomEvent<undefined>;
22
22
  stream: CustomEvent<string | null>;
23
- upload: CustomEvent<[FileData | null, FileData | null]>;
23
+ upload: CustomEvent<[any, any]>;
24
24
  select: CustomEvent<import("@gradio/utils").SelectData>;
25
25
  share: CustomEvent<any>;
26
26
  } & {
@@ -36,15 +36,15 @@ export type SliderUploadProps = typeof __propDef.props;
36
36
  export type SliderUploadEvents = typeof __propDef.events;
37
37
  export type SliderUploadSlots = typeof __propDef.slots;
38
38
  export default class SliderUpload extends SvelteComponent<SliderUploadProps, SliderUploadEvents, SliderUploadSlots> {
39
- get value(): [FileData | null, FileData | null] | undefined;
39
+ get value(): [any, any] | undefined;
40
40
  /**accessor*/
41
- set value(_: [FileData | null, FileData | null] | undefined);
42
- get upload(): (file_data: FileData[], root_url: string, upload_id?: string, max_file_size?: number) => Promise<(FileData | null)[] | null>;
41
+ set value(_: [any, any] | undefined);
42
+ get upload(): Client;
43
43
  /**accessor*/
44
- set upload(_: (file_data: FileData[], root_url: string, upload_id?: string, max_file_size?: number) => Promise<(FileData | null)[] | null>);
45
- get stream_handler(): (url: URL) => EventSource;
44
+ set upload(_: Client);
45
+ get stream_handler(): Client;
46
46
  /**accessor*/
47
- set stream_handler(_: (url: URL) => EventSource);
47
+ set stream_handler(_: Client);
48
48
  get label(): string;
49
49
  /**accessor*/
50
50
  set label(_: string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/imageslider",
3
- "version": "0.2.14",
3
+ "version": "0.3.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -11,13 +11,12 @@
11
11
  "@types/d3-selection": "^3.0.11",
12
12
  "d3-drag": "^3.0.0",
13
13
  "d3-selection": "^3.0.0",
14
- "@gradio/atoms": "^0.17.0",
15
- "@gradio/client": "^1.18.0",
14
+ "@gradio/atoms": "^0.18.0",
15
+ "@gradio/client": "^1.19.0",
16
+ "@gradio/statustracker": "^0.11.1",
16
17
  "@gradio/icons": "^0.14.0",
17
- "@gradio/statustracker": "^0.11.0",
18
- "@gradio/utils": "^0.10.2",
19
- "@gradio/upload": "^0.16.17",
20
- "@gradio/wasm": "^0.18.1"
18
+ "@gradio/upload": "^0.17.0",
19
+ "@gradio/utils": "^0.10.2"
21
20
  },
22
21
  "exports": {
23
22
  ".": {
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import Slider from "./Slider.svelte";
3
3
  import { createEventDispatcher, tick } from "svelte";
4
- import { BlockLabel, Empty, IconButton } from "@gradio/atoms";
4
+ import { BlockLabel, Empty, IconButton, DownloadLink } from "@gradio/atoms";
5
5
  import { Download } from "@gradio/icons";
6
6
  import { Image } from "@gradio/icons";
7
7
  import { type SelectData, type I18nFormatter } from "@gradio/utils";
@@ -9,7 +9,6 @@
9
9
  import ImageEl from "./ImageEl.svelte";
10
10
 
11
11
  import { Upload } from "@gradio/upload";
12
- import { DownloadLink } from "@gradio/wasm/svelte";
13
12
 
14
13
  import { type FileData, type Client } from "@gradio/client";
15
14
 
@@ -13,39 +13,15 @@
13
13
  }
14
14
  type $$Props = Props;
15
15
 
16
- import { resolve_wasm_src } from "@gradio/wasm/svelte";
17
-
18
16
  export let src: HTMLImgAttributes["src"] = undefined;
19
17
  export let fullscreen = false;
20
18
 
21
- let resolved_src: typeof src;
22
-
23
19
  export let fixed = false;
24
20
  export let transform = "translate(0px, 0px) scale(1)";
25
21
  export let img_el: HTMLImageElement | null = null;
26
22
  export let hidden = false;
27
23
  export let variant = "upload";
28
24
  export let max_height = 500;
29
- // The `src` prop can be updated before the Promise from `resolve_wasm_src` is resolved.
30
- // In such a case, the resolved value for the old `src` has to be discarded,
31
- // This variable `latest_src` is used to pick up only the value resolved for the latest `src` prop.
32
- let latest_src: typeof src;
33
- $: {
34
- // In normal (non-Wasm) Gradio, the `<img>` element should be rendered with the passed `src` props immediately
35
- // without waiting for `resolve_wasm_src()` to resolve.
36
- // If it waits, a blank image is displayed until the async task finishes
37
- // and it leads to undesirable flickering.
38
- // So set `src` to `resolved_src` here.
39
- resolved_src = src;
40
-
41
- latest_src = src;
42
- const resolving_src = src;
43
- resolve_wasm_src(resolving_src).then((s) => {
44
- if (latest_src === resolving_src) {
45
- resolved_src = s;
46
- }
47
- });
48
- }
49
25
 
50
26
  const dispatch = createEventDispatcher<{
51
27
  load: {
@@ -108,7 +84,7 @@
108
84
 
109
85
  <!-- svelte-ignore a11y-missing-attribute -->
110
86
  <img
111
- src={resolved_src}
87
+ {src}
112
88
  {...$$restProps}
113
89
  class:fixed
114
90
  style:transform
@@ -6,12 +6,12 @@
6
6
  Empty,
7
7
  IconButton,
8
8
  IconButtonWrapper,
9
- FullscreenButton
9
+ FullscreenButton,
10
+ DownloadLink
10
11
  } from "@gradio/atoms";
11
12
  import { Image, Download, Undo, Clear } from "@gradio/icons";
12
13
  import { type FileData } from "@gradio/client";
13
14
  import type { I18nFormatter } from "@gradio/utils";
14
- import { DownloadLink } from "@gradio/wasm/svelte";
15
15
  import { ZoomableImage } from "./zoom";
16
16
  import { onMount } from "svelte";
17
17
  import { tweened, type Tweened } from "svelte/motion";