gradio-themer 0.1.0__py3-none-any.whl
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.
- gradio_themer/__init__.py +3 -0
- gradio_themer/generate_theme_template.py +169 -0
- gradio_themer/gradio_themer.py +336 -0
- gradio_themer/gradio_themer.pyi +490 -0
- gradio_themer/templates/component/index.js +1256 -0
- gradio_themer/templates/component/style.css +1 -0
- gradio_themer/templates/example/index.js +103 -0
- gradio_themer/templates/example/style.css +1 -0
- gradio_themer-0.1.0.dist-info/METADATA +405 -0
- gradio_themer-0.1.0.dist-info/RECORD +11 -0
- gradio_themer-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1 @@
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap";@import"https://cdn.jsdelivr.net/npm/daisyui@4.12.10/dist/full.css";@import"https://cdn.jsdelivr.net/npm/tailwindcss@3.4.4/base.min.css";.gradio-component{width:100%!important;height:100%!important;min-height:100vh;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}body,html{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.gradio-component *{box-sizing:border-box}[data-theme]{transition:all .2s ease-in-out}html[data-theme],body[data-theme],.gradio-container[data-theme],.app[data-theme],#root[data-theme],.gradio-app,.gradio-interface,main{background-color:hsl(var(--b1))!important;color:hsl(var(--bc))!important;transition:background-color .2s ease,color .2s ease}.gradio-container,.gradio-app,.gradio-interface,main,#root{background-color:hsl(var(--b1))!important}.gradio-container *{transition:background-color .2s ease,color .2s ease,border-color .2s ease}.gradio-component .input,.gradio-component .textarea,.gradio-component .select{color:inherit!important;background-color:inherit!important}.gradio-component .btn{border:none!important;outline:none!important}.color-picker{width:40px;height:40px;border-radius:.5rem;border:2px solid hsl(var(--bc) / .2);cursor:pointer;transition:all .3s ease;position:relative}.color-picker:hover{border-color:hsl(var(--bc) / .5);transform:scale(1.05);box-shadow:0 4px 12px #00000026}.color-picker.ring-4{box-shadow:0 0 0 4px hsl(var(--p)),0 0 0 6px #ffffff80;transform:scale(1.1)}.theme-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1.5rem;padding:1rem}.theme-grid-compact{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:.75rem;padding:.5rem}.theme-card{border-radius:1rem;padding:0;margin:.5rem;transition:all .3s cubic-bezier(.4,0,.2,1);overflow:hidden;position:relative;min-height:120px;display:flex;align-items:center;justify-content:center}.theme-card-compact{border-radius:.75rem;padding:0;transition:all .2s cubic-bezier(.4,0,.2,1);overflow:hidden;position:relative;min-height:80px;display:flex;align-items:center;justify-content:center;font-family:inherit}.btn:hover{transform:scale(1.05);transition:transform .2s ease}.btn:active{transform:scale(.98)}.theme-selector-buttons .btn{margin:2px;min-width:60px}@media (max-width: 640px){.theme-selector-buttons .btn{margin:1px;min-width:50px;font-size:.625rem}}.theme-card:hover{transform:translateY(-4px);box-shadow:0 10px 25px #00000026}.theme-card-compact:hover{transform:translateY(-2px);box-shadow:0 6px 20px #0000001a}.theme-card.border-primary{box-shadow:0 0 0 3px hsl(var(--p) / .3),0 8px 25px #00000026}.theme-card.scale-105{transform:scale(1.02) translateY(-2px)}*{transition:color .2s ease,background-color .2s ease,border-color .2s ease}.gradio-component{color:hsl(var(--bc));background-color:hsl(var(--b1))}*,*:before,*:after{box-sizing:border-box}[data-theme]{color-scheme:light}[data-theme=dark]{color-scheme:dark}.textarea,.input,.select{background-color:hsl(var(--b1))!important;color:hsl(var(--bc))!important;border-color:hsl(var(--b3))!important}.textarea::-moz-placeholder,.input::-moz-placeholder{color:hsl(var(--bc) / .6)!important}.textarea::placeholder,.input::placeholder{color:hsl(var(--bc) / .6)!important}.card{background-color:hsl(var(--b2));color:hsl(var(--bc))}input,textarea,select{color:#1f2937!important;background-color:#fff!important;border:1px solid #d1d5db;border-radius:.375rem;padding:.5rem;font-family:inherit}input::-moz-placeholder,textarea::-moz-placeholder,select::-moz-placeholder{color:#9ca3af!important}input::placeholder,textarea::placeholder,select::placeholder{color:#9ca3af!important}.dark input,.dark textarea,.dark select{color:#f9fafb!important;background-color:#374151!important;border-color:#4b5563}.dark input::-moz-placeholder,.dark textarea::-moz-placeholder,.dark select::-moz-placeholder{color:#9ca3af!important}.dark input::placeholder,.dark textarea::placeholder,.dark select::placeholder{color:#9ca3af!important}button{font-family:inherit;cursor:pointer}.gradio-component,.gradio-component *{color:inherit!important}.textarea{color:#1f2937!important;background-color:#fff!important}.textarea::-moz-placeholder{color:#9ca3af!important}.textarea::placeholder{color:#9ca3af!important}.textarea:focus{color:#1f2937!important;background-color:#fff!important}.btn,.card,.card-title{color:inherit!important}input,select,textarea{color:#1f2937!important;background-color:#fff!important}input::-moz-placeholder,select::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af!important}input::placeholder,select::placeholder,textarea::placeholder{color:#9ca3af!important}.tabs .tab{transition:all .2s ease}.tabs .tab-active{font-weight:600}.sticky{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.badge{font-weight:500}.font-inter{font-family:Inter,sans-serif}.form-control .select{font-weight:500}.steps .step{transition:all .3s ease}.steps .step-primary{color:hsl(var(--pc))}.card:hover{transform:translateY(-2px);transition:transform .2s ease}.mockup-code{border-radius:.75rem}.mockup-code pre{font-family:JetBrains Mono,Fira Code,Consolas,monospace}.table{border-radius:.75rem;overflow:hidden}.btn:hover{transform:translateY(-1px);transition:transform .2s ease}.progress{border-radius:9999px;height:.75rem}.alert{border-radius:.75rem;font-weight:500}.stats{border-radius:1rem}.stat-title{font-weight:500;opacity:.8}.stat-value{font-weight:700}.checkbox{border-radius:.375rem}@media (max-width: 768px){.theme-grid{grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:1rem;padding:.5rem}.theme-card{margin:.25rem;min-height:100px}}@keyframes theme-select{0%{transform:scale(1)}50%{transform:scale(1.05)}to{transform:scale(1.02)}}.theme-card.border-primary{animation:theme-select .3s ease-out}.btn:disabled{opacity:.6;cursor:not-allowed}html{scroll-behavior:smooth}.theme-card:focus{outline:2px solid hsl(var(--p));outline-offset:2px}.color-picker:focus{outline:2px solid hsl(var(--p));outline-offset:2px}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
const {
|
2
|
+
SvelteComponent: f,
|
3
|
+
append_hydration: r,
|
4
|
+
attr: u,
|
5
|
+
children: o,
|
6
|
+
claim_element: h,
|
7
|
+
claim_text: g,
|
8
|
+
detach: d,
|
9
|
+
element: v,
|
10
|
+
init: m,
|
11
|
+
insert_hydration: y,
|
12
|
+
noop: _,
|
13
|
+
safe_not_equal: b,
|
14
|
+
set_data: w,
|
15
|
+
text: E,
|
16
|
+
toggle_class: s
|
17
|
+
} = window.__gradio__svelte__internal;
|
18
|
+
function q(a) {
|
19
|
+
let e, n;
|
20
|
+
return {
|
21
|
+
c() {
|
22
|
+
e = v("div"), n = E(
|
23
|
+
/*value*/
|
24
|
+
a[0]
|
25
|
+
), this.h();
|
26
|
+
},
|
27
|
+
l(t) {
|
28
|
+
e = h(t, "DIV", { class: !0 });
|
29
|
+
var l = o(e);
|
30
|
+
n = g(
|
31
|
+
l,
|
32
|
+
/*value*/
|
33
|
+
a[0]
|
34
|
+
), l.forEach(d), this.h();
|
35
|
+
},
|
36
|
+
h() {
|
37
|
+
u(e, "class", "svelte-1gecy8w"), s(
|
38
|
+
e,
|
39
|
+
"table",
|
40
|
+
/*type*/
|
41
|
+
a[1] === "table"
|
42
|
+
), s(
|
43
|
+
e,
|
44
|
+
"gallery",
|
45
|
+
/*type*/
|
46
|
+
a[1] === "gallery"
|
47
|
+
), s(
|
48
|
+
e,
|
49
|
+
"selected",
|
50
|
+
/*selected*/
|
51
|
+
a[2]
|
52
|
+
);
|
53
|
+
},
|
54
|
+
m(t, l) {
|
55
|
+
y(t, e, l), r(e, n);
|
56
|
+
},
|
57
|
+
p(t, [l]) {
|
58
|
+
l & /*value*/
|
59
|
+
1 && w(
|
60
|
+
n,
|
61
|
+
/*value*/
|
62
|
+
t[0]
|
63
|
+
), l & /*type*/
|
64
|
+
2 && s(
|
65
|
+
e,
|
66
|
+
"table",
|
67
|
+
/*type*/
|
68
|
+
t[1] === "table"
|
69
|
+
), l & /*type*/
|
70
|
+
2 && s(
|
71
|
+
e,
|
72
|
+
"gallery",
|
73
|
+
/*type*/
|
74
|
+
t[1] === "gallery"
|
75
|
+
), l & /*selected*/
|
76
|
+
4 && s(
|
77
|
+
e,
|
78
|
+
"selected",
|
79
|
+
/*selected*/
|
80
|
+
t[2]
|
81
|
+
);
|
82
|
+
},
|
83
|
+
i: _,
|
84
|
+
o: _,
|
85
|
+
d(t) {
|
86
|
+
t && d(e);
|
87
|
+
}
|
88
|
+
};
|
89
|
+
}
|
90
|
+
function C(a, e, n) {
|
91
|
+
let { value: t } = e, { type: l } = e, { selected: c = !1 } = e;
|
92
|
+
return a.$$set = (i) => {
|
93
|
+
"value" in i && n(0, t = i.value), "type" in i && n(1, l = i.type), "selected" in i && n(2, c = i.selected);
|
94
|
+
}, [t, l, c];
|
95
|
+
}
|
96
|
+
class D extends f {
|
97
|
+
constructor(e) {
|
98
|
+
super(), m(this, e, C, q, b, { value: 0, type: 1, selected: 2 });
|
99
|
+
}
|
100
|
+
}
|
101
|
+
export {
|
102
|
+
D as default
|
103
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
.gallery.svelte-1gecy8w{padding:var(--size-1) var(--size-2)}
|
@@ -0,0 +1,405 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: gradio_themer
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: User-configurable themes for Gradio applications - unlimited custom themes via JSON configuration
|
5
|
+
Author-email: Eldar Syzdykov <eldar@utexas.edu>
|
6
|
+
License-Expression: MIT
|
7
|
+
Keywords: gradio-custom-component,gradio-styling,gradio-themes,ui-themes,user-configurable
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
9
|
+
Classifier: Operating System :: OS Independent
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
19
|
+
Requires-Python: >=3.8
|
20
|
+
Requires-Dist: gradio<6.0,>=4.0
|
21
|
+
Provides-Extra: dev
|
22
|
+
Requires-Dist: build; extra == 'dev'
|
23
|
+
Requires-Dist: twine; extra == 'dev'
|
24
|
+
Description-Content-Type: text/markdown
|
25
|
+
|
26
|
+
|
27
|
+
# `gradio_themer`
|
28
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.1.0%20-%20orange">
|
29
|
+
|
30
|
+
User-configurable themes for Gradio applications - unlimited custom themes via JSON configuration
|
31
|
+
|
32
|
+
## Installation
|
33
|
+
|
34
|
+
```bash
|
35
|
+
pip install gradio_themer
|
36
|
+
```
|
37
|
+
|
38
|
+
## Usage
|
39
|
+
|
40
|
+
```python
|
41
|
+
"""
|
42
|
+
Gradio Themer - MCP Server Entry Point
|
43
|
+
Clean entry point that exposes only the 4 intended MCP tools.
|
44
|
+
"""
|
45
|
+
|
46
|
+
import os
|
47
|
+
import gradio as gr
|
48
|
+
|
49
|
+
# CRITICAL: Enable MCP server mode (as per GRADIO_MCP_HF_SPACES_GUIDE.md)
|
50
|
+
os.environ["GRADIO_MCP_SERVER"] = "True"
|
51
|
+
|
52
|
+
# Import the 4 MCP tools - these will be exposed by the MCP server
|
53
|
+
from mcp_tools import (
|
54
|
+
setup_package,
|
55
|
+
generate_theme,
|
56
|
+
convert_css_to_theme,
|
57
|
+
generate_app_code,
|
58
|
+
)
|
59
|
+
|
60
|
+
if __name__ == "__main__":
|
61
|
+
try:
|
62
|
+
import page
|
63
|
+
|
64
|
+
# Add hidden MCP endpoints to the existing demo
|
65
|
+
with page.demo:
|
66
|
+
# Add hidden MCP tool endpoints (invisible to users, visible to MCP)
|
67
|
+
|
68
|
+
# Hidden setup_package endpoint
|
69
|
+
setup_btn = gr.Button("Setup Package", visible=False)
|
70
|
+
setup_output = gr.JSON(visible=False)
|
71
|
+
setup_btn.click(
|
72
|
+
fn=setup_package, outputs=setup_output, api_name="setup_package"
|
73
|
+
)
|
74
|
+
|
75
|
+
# Hidden generate_theme endpoint
|
76
|
+
theme_name_input = gr.Textbox(visible=False)
|
77
|
+
primary_color_input = gr.Textbox(visible=False, value="#3b82f6")
|
78
|
+
theme_style_input = gr.Textbox(visible=False, value="light")
|
79
|
+
accent_color_input = gr.Textbox(visible=False, value="")
|
80
|
+
generate_theme_btn = gr.Button("Generate Theme", visible=False)
|
81
|
+
generate_theme_output = gr.JSON(visible=False)
|
82
|
+
generate_theme_btn.click(
|
83
|
+
fn=generate_theme,
|
84
|
+
inputs=[
|
85
|
+
theme_name_input,
|
86
|
+
primary_color_input,
|
87
|
+
theme_style_input,
|
88
|
+
accent_color_input,
|
89
|
+
],
|
90
|
+
outputs=generate_theme_output,
|
91
|
+
api_name="generate_theme",
|
92
|
+
)
|
93
|
+
|
94
|
+
# Hidden convert_css_to_theme endpoint
|
95
|
+
css_input = gr.Textbox(visible=False)
|
96
|
+
convert_theme_name_input = gr.Textbox(
|
97
|
+
visible=False, value="converted_theme"
|
98
|
+
)
|
99
|
+
user_token_input = gr.Textbox(visible=False, value="")
|
100
|
+
model_choice_input = gr.Textbox(visible=False, value="qwen")
|
101
|
+
convert_css_btn = gr.Button("Convert CSS", visible=False)
|
102
|
+
convert_css_output = gr.Textbox(visible=False)
|
103
|
+
convert_css_btn.click(
|
104
|
+
fn=convert_css_to_theme,
|
105
|
+
inputs=[
|
106
|
+
css_input,
|
107
|
+
convert_theme_name_input,
|
108
|
+
user_token_input,
|
109
|
+
model_choice_input,
|
110
|
+
],
|
111
|
+
outputs=convert_css_output,
|
112
|
+
api_name="convert_css_to_theme",
|
113
|
+
)
|
114
|
+
|
115
|
+
# Hidden generate_app_code endpoint
|
116
|
+
app_theme_names_input = gr.Textbox(
|
117
|
+
visible=False, value="ocean_breeze,sunset_orange"
|
118
|
+
)
|
119
|
+
app_title_input = gr.Textbox(visible=False, value="My Themed App")
|
120
|
+
include_components_input = gr.Textbox(
|
121
|
+
visible=False, value="button,textbox,slider"
|
122
|
+
)
|
123
|
+
generate_app_btn = gr.Button("Generate App", visible=False)
|
124
|
+
generate_app_output = gr.Textbox(visible=False)
|
125
|
+
generate_app_btn.click(
|
126
|
+
fn=generate_app_code,
|
127
|
+
inputs=[
|
128
|
+
app_theme_names_input,
|
129
|
+
app_title_input,
|
130
|
+
include_components_input,
|
131
|
+
],
|
132
|
+
outputs=generate_app_output,
|
133
|
+
api_name="generate_app_code",
|
134
|
+
)
|
135
|
+
|
136
|
+
# Launch the demo with MCP server enabled
|
137
|
+
page.demo.launch(
|
138
|
+
mcp_server=True, # CRITICAL: Enable MCP server functionality
|
139
|
+
server_name="0.0.0.0",
|
140
|
+
server_port=7860,
|
141
|
+
share=False,
|
142
|
+
debug=True,
|
143
|
+
allowed_paths=["./"],
|
144
|
+
)
|
145
|
+
|
146
|
+
except ImportError as e:
|
147
|
+
print(f"❌ Error importing demo interface: {e}")
|
148
|
+
print("Make sure page.py exists and contains the 'demo' variable")
|
149
|
+
exit(1)
|
150
|
+
except AttributeError as e:
|
151
|
+
print(f"❌ Error accessing demo object: {e}")
|
152
|
+
print("Make sure page.py contains a 'demo' variable")
|
153
|
+
exit(1)
|
154
|
+
|
155
|
+
```
|
156
|
+
|
157
|
+
## `GradioThemer`
|
158
|
+
|
159
|
+
### Initialization
|
160
|
+
|
161
|
+
<table>
|
162
|
+
<thead>
|
163
|
+
<tr>
|
164
|
+
<th align="left">name</th>
|
165
|
+
<th align="left" style="width: 25%;">type</th>
|
166
|
+
<th align="left">default</th>
|
167
|
+
<th align="left">description</th>
|
168
|
+
</tr>
|
169
|
+
</thead>
|
170
|
+
<tbody>
|
171
|
+
<tr>
|
172
|
+
<td align="left"><code>value</code></td>
|
173
|
+
<td align="left" style="width: 25%;">
|
174
|
+
|
175
|
+
```python
|
176
|
+
typing.Union[
|
177
|
+
typing.Dict[str, typing.Any], typing.Callable, NoneType
|
178
|
+
][
|
179
|
+
typing.Dict[str, typing.Any][str, typing.Any],
|
180
|
+
Callable,
|
181
|
+
None,
|
182
|
+
]
|
183
|
+
```
|
184
|
+
|
185
|
+
</td>
|
186
|
+
<td align="left"><code>None</code></td>
|
187
|
+
<td align="left">Default theme configuration. Should be a dict with 'themeInput', 'themeConfig', and 'generatedCSS' keys.</td>
|
188
|
+
</tr>
|
189
|
+
|
190
|
+
<tr>
|
191
|
+
<td align="left"><code>theme_config_path</code></td>
|
192
|
+
<td align="left" style="width: 25%;">
|
193
|
+
|
194
|
+
```python
|
195
|
+
typing.Optional[str][str, None]
|
196
|
+
```
|
197
|
+
|
198
|
+
</td>
|
199
|
+
<td align="left"><code>None</code></td>
|
200
|
+
<td align="left">Path to user themes configuration file (JSON). If None, searches for common filenames.</td>
|
201
|
+
</tr>
|
202
|
+
|
203
|
+
<tr>
|
204
|
+
<td align="left"><code>label</code></td>
|
205
|
+
<td align="left" style="width: 25%;">
|
206
|
+
|
207
|
+
```python
|
208
|
+
str | None
|
209
|
+
```
|
210
|
+
|
211
|
+
</td>
|
212
|
+
<td align="left"><code>None</code></td>
|
213
|
+
<td align="left">The label for this component, displayed above the component if `show_label` is `True`.</td>
|
214
|
+
</tr>
|
215
|
+
|
216
|
+
<tr>
|
217
|
+
<td align="left"><code>every</code></td>
|
218
|
+
<td align="left" style="width: 25%;">
|
219
|
+
|
220
|
+
```python
|
221
|
+
float | None
|
222
|
+
```
|
223
|
+
|
224
|
+
</td>
|
225
|
+
<td align="left"><code>None</code></td>
|
226
|
+
<td align="left">Continously calls `value` to recalculate it if `value` is a function.</td>
|
227
|
+
</tr>
|
228
|
+
|
229
|
+
<tr>
|
230
|
+
<td align="left"><code>inputs</code></td>
|
231
|
+
<td align="left" style="width: 25%;">
|
232
|
+
|
233
|
+
```python
|
234
|
+
typing.Union[
|
235
|
+
gradio.components.base.FormComponent,
|
236
|
+
typing.Sequence[gradio.components.base.FormComponent],
|
237
|
+
set[gradio.components.base.FormComponent],
|
238
|
+
NoneType,
|
239
|
+
][
|
240
|
+
gradio.components.base.FormComponent,
|
241
|
+
typing.Sequence[gradio.components.base.FormComponent][
|
242
|
+
gradio.components.base.FormComponent
|
243
|
+
],
|
244
|
+
set[gradio.components.base.FormComponent],
|
245
|
+
None,
|
246
|
+
]
|
247
|
+
```
|
248
|
+
|
249
|
+
</td>
|
250
|
+
<td align="left"><code>None</code></td>
|
251
|
+
<td align="left">Components that are used as inputs to calculate `value` if `value` is a function.</td>
|
252
|
+
</tr>
|
253
|
+
|
254
|
+
<tr>
|
255
|
+
<td align="left"><code>show_label</code></td>
|
256
|
+
<td align="left" style="width: 25%;">
|
257
|
+
|
258
|
+
```python
|
259
|
+
bool | None
|
260
|
+
```
|
261
|
+
|
262
|
+
</td>
|
263
|
+
<td align="left"><code>None</code></td>
|
264
|
+
<td align="left">If True, will display label.</td>
|
265
|
+
</tr>
|
266
|
+
|
267
|
+
<tr>
|
268
|
+
<td align="left"><code>scale</code></td>
|
269
|
+
<td align="left" style="width: 25%;">
|
270
|
+
|
271
|
+
```python
|
272
|
+
int | None
|
273
|
+
```
|
274
|
+
|
275
|
+
</td>
|
276
|
+
<td align="left"><code>None</code></td>
|
277
|
+
<td align="left">Relative size compared to adjacent Components.</td>
|
278
|
+
</tr>
|
279
|
+
|
280
|
+
<tr>
|
281
|
+
<td align="left"><code>min_width</code></td>
|
282
|
+
<td align="left" style="width: 25%;">
|
283
|
+
|
284
|
+
```python
|
285
|
+
int
|
286
|
+
```
|
287
|
+
|
288
|
+
</td>
|
289
|
+
<td align="left"><code>160</code></td>
|
290
|
+
<td align="left">Minimum pixel width.</td>
|
291
|
+
</tr>
|
292
|
+
|
293
|
+
<tr>
|
294
|
+
<td align="left"><code>interactive</code></td>
|
295
|
+
<td align="left" style="width: 25%;">
|
296
|
+
|
297
|
+
```python
|
298
|
+
bool | None
|
299
|
+
```
|
300
|
+
|
301
|
+
</td>
|
302
|
+
<td align="left"><code>None</code></td>
|
303
|
+
<td align="left">If True, will be rendered as an editable component.</td>
|
304
|
+
</tr>
|
305
|
+
|
306
|
+
<tr>
|
307
|
+
<td align="left"><code>visible</code></td>
|
308
|
+
<td align="left" style="width: 25%;">
|
309
|
+
|
310
|
+
```python
|
311
|
+
bool
|
312
|
+
```
|
313
|
+
|
314
|
+
</td>
|
315
|
+
<td align="left"><code>True</code></td>
|
316
|
+
<td align="left">If False, component will be hidden.</td>
|
317
|
+
</tr>
|
318
|
+
|
319
|
+
<tr>
|
320
|
+
<td align="left"><code>elem_id</code></td>
|
321
|
+
<td align="left" style="width: 25%;">
|
322
|
+
|
323
|
+
```python
|
324
|
+
str | None
|
325
|
+
```
|
326
|
+
|
327
|
+
</td>
|
328
|
+
<td align="left"><code>None</code></td>
|
329
|
+
<td align="left">An optional string that is assigned as the id of this component in the HTML DOM.</td>
|
330
|
+
</tr>
|
331
|
+
|
332
|
+
<tr>
|
333
|
+
<td align="left"><code>elem_classes</code></td>
|
334
|
+
<td align="left" style="width: 25%;">
|
335
|
+
|
336
|
+
```python
|
337
|
+
list[str] | str | None
|
338
|
+
```
|
339
|
+
|
340
|
+
</td>
|
341
|
+
<td align="left"><code>None</code></td>
|
342
|
+
<td align="left">An optional list of strings that are assigned as the classes of this component in the HTML DOM.</td>
|
343
|
+
</tr>
|
344
|
+
|
345
|
+
<tr>
|
346
|
+
<td align="left"><code>render</code></td>
|
347
|
+
<td align="left" style="width: 25%;">
|
348
|
+
|
349
|
+
```python
|
350
|
+
bool
|
351
|
+
```
|
352
|
+
|
353
|
+
</td>
|
354
|
+
<td align="left"><code>True</code></td>
|
355
|
+
<td align="left">If False, component will not render be rendered in the Blocks context.</td>
|
356
|
+
</tr>
|
357
|
+
|
358
|
+
<tr>
|
359
|
+
<td align="left"><code>key</code></td>
|
360
|
+
<td align="left" style="width: 25%;">
|
361
|
+
|
362
|
+
```python
|
363
|
+
int | str | None
|
364
|
+
```
|
365
|
+
|
366
|
+
</td>
|
367
|
+
<td align="left"><code>None</code></td>
|
368
|
+
<td align="left">A unique key for this component.</td>
|
369
|
+
</tr>
|
370
|
+
</tbody></table>
|
371
|
+
|
372
|
+
|
373
|
+
### Events
|
374
|
+
|
375
|
+
| name | description |
|
376
|
+
|:-----|:------------|
|
377
|
+
| `change` | Triggered when the value of the GradioThemer changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
|
378
|
+
| `input` | This listener is triggered when the user changes the value of the GradioThemer. |
|
379
|
+
| `submit` | This listener is triggered when the user presses the Enter key while the GradioThemer is focused. |
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
### User function
|
384
|
+
|
385
|
+
The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
|
386
|
+
|
387
|
+
- When used as an Input, the component only impacts the input signature of the user function.
|
388
|
+
- When used as an output, the component only impacts the return signature of the user function.
|
389
|
+
|
390
|
+
The code snippet below is accurate in cases where the component is used as both an input and an output.
|
391
|
+
|
392
|
+
- **As output:** Is passed, passes the theme configuration as a dict into the function.
|
393
|
+
- **As input:** Should return, expects a dict with theme configuration data.
|
394
|
+
|
395
|
+
```python
|
396
|
+
def predict(
|
397
|
+
value: typing.Optional[typing.Dict[str, typing.Any]][
|
398
|
+
typing.Dict[str, typing.Any][str, typing.Any], None
|
399
|
+
]
|
400
|
+
) -> typing.Optional[typing.Dict[str, typing.Any]][
|
401
|
+
typing.Dict[str, typing.Any][str, typing.Any], None
|
402
|
+
]:
|
403
|
+
return value
|
404
|
+
```
|
405
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
gradio_themer/__init__.py,sha256=dtBIhGqr26fxR5Tc84-jctIp1ilg_3HK5IpdUVWrtiA,68
|
2
|
+
gradio_themer/generate_theme_template.py,sha256=YN5wDU9Ci4JvXdR_gfJ9BqH0NVsxBh46ZdDKqzb1xNg,5640
|
3
|
+
gradio_themer/gradio_themer.py,sha256=V6ygLNns4xpeVOGNOgEesZTyeLbPZ8jZNxyHaUIjqVs,13599
|
4
|
+
gradio_themer/gradio_themer.pyi,sha256=ZHXvWZ83EFAFybnkfBeBast3_2RLltkHRkuFMMxauuw,31565
|
5
|
+
gradio_themer/templates/component/index.js,sha256=7ZFR0aV_QthrxGNn1Yv07TR0jhjWD31n8rlPiZ0qycI,60396
|
6
|
+
gradio_themer/templates/component/style.css,sha256=_N14vViGQ8RfAZKsscJcvStcVMRZcwqbvOMgOKEjwF4,6084
|
7
|
+
gradio_themer/templates/example/index.js,sha256=S0rQhEVCiO6TrKOl5wSmmKeYSD4WufxrYzuLtpfb-fo,1818
|
8
|
+
gradio_themer/templates/example/style.css,sha256=Aj4k-S41TV83pot-J9j9Fi2UonrXHFC1Jl4Zb1xaYo4,61
|
9
|
+
gradio_themer-0.1.0.dist-info/METADATA,sha256=_MUa3fS4TWsy6bly6POmoSSuK19OzcP_E7IYl1laJpk,11343
|
10
|
+
gradio_themer-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
11
|
+
gradio_themer-0.1.0.dist-info/RECORD,,
|