gradio-pr-bot commited on
Commit
98efb6e
·
verified ·
1 Parent(s): 1e15c00

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. 6.4.0/markdown/Index.svelte +27 -2
6.4.0/markdown/Index.svelte CHANGED
@@ -4,16 +4,39 @@
4
  </script>
5
 
6
  <script lang="ts">
7
- import { Gradio } from "@gradio/utils";
 
8
  import Markdown from "./shared/Markdown.svelte";
9
 
10
  import { StatusTracker } from "@gradio/statustracker";
11
- import { Block } from "@gradio/atoms";
12
 
13
  import type { MarkdownProps, MarkdownEvents } from "./types";
14
 
15
  let props = $props();
16
  const gradio = new Gradio<MarkdownEvents, MarkdownProps>(props);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  </script>
18
 
19
  <Block
@@ -37,6 +60,7 @@
37
  gradio.dispatch("clear_status", gradio.shared.loading_status)}
38
  />
39
  <div
 
40
  class:padding={gradio.props.padding}
41
  class:pending={gradio.shared.loading_status?.status === "pending"}
42
  >
@@ -56,6 +80,7 @@
56
  theme_mode={gradio.shared.theme_mode}
57
  />
58
  </div>
 
59
  </Block>
60
 
61
  <style>
 
4
  </script>
5
 
6
  <script lang="ts">
7
+ import { tick } from "svelte";
8
+ import { Gradio, should_show_scroll_fade } from "@gradio/utils";
9
  import Markdown from "./shared/Markdown.svelte";
10
 
11
  import { StatusTracker } from "@gradio/statustracker";
12
+ import { Block, ScrollFade } from "@gradio/atoms";
13
 
14
  import type { MarkdownProps, MarkdownEvents } from "./types";
15
 
16
  let props = $props();
17
  const gradio = new Gradio<MarkdownEvents, MarkdownProps>(props);
18
+
19
+ let wrapper: HTMLDivElement;
20
+ let show_fade = $state(false);
21
+
22
+ function update_fade(): void {
23
+ if (!gradio.props.height) return;
24
+ show_fade = should_show_scroll_fade(
25
+ wrapper?.closest(".block") as HTMLElement | null
26
+ );
27
+ }
28
+
29
+ $effect(() => {
30
+ const container = wrapper?.closest(".block") as HTMLElement | null;
31
+ if (!container || !gradio.props.height) return;
32
+ container.addEventListener("scroll", update_fade);
33
+ tick().then(update_fade);
34
+ return () => container.removeEventListener("scroll", update_fade);
35
+ });
36
+
37
+ $effect(() => {
38
+ if (gradio.props.value !== undefined) tick().then(update_fade);
39
+ });
40
  </script>
41
 
42
  <Block
 
60
  gradio.dispatch("clear_status", gradio.shared.loading_status)}
61
  />
62
  <div
63
+ bind:this={wrapper}
64
  class:padding={gradio.props.padding}
65
  class:pending={gradio.shared.loading_status?.status === "pending"}
66
  >
 
80
  theme_mode={gradio.shared.theme_mode}
81
  />
82
  </div>
83
+ <ScrollFade visible={show_fade} />
84
  </Block>
85
 
86
  <style>