@gradio/code 0.14.6 → 0.14.7

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,11 @@
1
1
  # @gradio/code
2
2
 
3
+ ## 0.14.7
4
+
5
+ ### Features
6
+
7
+ - [#11380](https://github.com/gradio-app/gradio/pull/11380) [`0b2b6cb`](https://github.com/gradio-app/gradio/commit/0b2b6cbd44562a2f5843af872fe6761c5f255185) - Truncate textbox examples to 70 chars. Thanks @hannahblair!
8
+
3
9
  ## 0.14.6
4
10
 
5
11
  ### Dependency updates
package/Example.svelte CHANGED
@@ -2,12 +2,19 @@
2
2
  export let value: string | null;
3
3
  export let type: "gallery" | "table";
4
4
  export let selected = false;
5
+
6
+ function truncate_text(text: string | null, max_length = 60): string {
7
+ if (!text) return "";
8
+ const str = String(text);
9
+ if (str.length <= max_length) return str;
10
+ return str.slice(0, max_length) + "...";
11
+ }
5
12
  </script>
6
13
 
7
14
  <pre
8
15
  class:table={type === "table"}
9
16
  class:gallery={type === "gallery"}
10
- class:selected>{value ? value : ""}</pre>
17
+ class:selected>{truncate_text(value)}</pre>
11
18
 
12
19
  <style>
13
20
  pre {
@@ -1,12 +1,20 @@
1
1
  <script>export let value;
2
2
  export let type;
3
3
  export let selected = false;
4
+ function truncate_text(text, max_length = 60) {
5
+ if (!text)
6
+ return "";
7
+ const str = String(text);
8
+ if (str.length <= max_length)
9
+ return str;
10
+ return str.slice(0, max_length) + "...";
11
+ }
4
12
  </script>
5
13
 
6
14
  <pre
7
15
  class:table={type === "table"}
8
16
  class:gallery={type === "gallery"}
9
- class:selected>{value ? value : ""}</pre>
17
+ class:selected>{truncate_text(value)}</pre>
10
18
 
11
19
  <style>
12
20
  pre {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/code",
3
- "version": "0.14.6",
3
+ "version": "0.14.7",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -28,11 +28,11 @@
28
28
  "cm6-theme-basic-light": "^0.2.0",
29
29
  "codemirror": "^6.0.1",
30
30
  "@gradio/atoms": "^0.16.1",
31
- "@gradio/statustracker": "^0.10.12",
31
+ "@gradio/icons": "^0.12.0",
32
32
  "@gradio/upload": "^0.16.7",
33
+ "@gradio/statustracker": "^0.10.12",
33
34
  "@gradio/utils": "^0.10.2",
34
- "@gradio/wasm": "^0.18.1",
35
- "@gradio/icons": "^0.12.0"
35
+ "@gradio/wasm": "^0.18.1"
36
36
  },
37
37
  "main_changeset": true,
38
38
  "main": "./Index.svelte",