Spaces:
Runtime error
Runtime error
v0.0.9
Browse files- src/README.md +27 -11
- src/backend/gradio_highlightedtextbox/highlightedtextbox.py +4 -0
- src/backend/gradio_highlightedtextbox/highlightedtextbox.pyi +46 -0
- src/backend/gradio_highlightedtextbox/templates/component/index.js +0 -0
- src/backend/gradio_highlightedtextbox/templates/component/style.css +1 -1
- src/demo/app.py +13 -11
- src/demo/space.py +14 -12
- src/frontend/Copy.svelte +68 -0
- src/frontend/HighlightedTextbox.svelte +41 -69
- src/frontend/Index.svelte +4 -0
- src/frontend/RemoveTags.svelte +27 -0
- src/frontend/Widgets.svelte +47 -0
- src/pyproject.toml +3 -3
src/README.md
CHANGED
@@ -51,14 +51,14 @@ def show_info(
|
|
51 |
)
|
52 |
|
53 |
|
54 |
-
initial_text = "It is not something to be ashamed of: it is no different from the <
|
55 |
|
56 |
with gr.Blocks() as demo:
|
57 |
gr.Markdown("### Parameters to control the highlighted textbox:")
|
58 |
with gr.Row():
|
59 |
tag_id = gr.Dropdown(
|
60 |
-
choices=["
|
61 |
-
value=["
|
62 |
multiselect=True,
|
63 |
allow_custom_value=True,
|
64 |
label="Tag ID",
|
@@ -66,8 +66,8 @@ with gr.Blocks() as demo:
|
|
66 |
info="Insert one or more tag IDs to use in the highlighted textbox.",
|
67 |
)
|
68 |
tag_open = gr.Dropdown(
|
69 |
-
choices=["<
|
70 |
-
value=["<
|
71 |
multiselect=True,
|
72 |
allow_custom_value=True,
|
73 |
label="Tag open",
|
@@ -75,8 +75,8 @@ with gr.Blocks() as demo:
|
|
75 |
info="Insert one or more tags to mark the beginning of a highlighted section.",
|
76 |
)
|
77 |
tag_close = gr.Dropdown(
|
78 |
-
choices=["</
|
79 |
-
value=["</
|
80 |
multiselect=True,
|
81 |
allow_custom_value=True,
|
82 |
label="Tag close",
|
@@ -113,6 +113,8 @@ Highlights will disappear if the highlighted text is edited. Modals will appear
|
|
113 |
show_label=True,
|
114 |
legend_label="Legend:",
|
115 |
show_legend_label=True,
|
|
|
|
|
116 |
)
|
117 |
|
118 |
# Functions
|
@@ -132,14 +134,14 @@ Highlights will disappear if the highlighted text is edited. Modals will appear
|
|
132 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
|
133 |
outputs=None,
|
134 |
)
|
135 |
-
high.
|
136 |
fn=show_info,
|
137 |
-
inputs=[high, tag_id, tag_open, tag_close, gr.State("
|
138 |
outputs=None,
|
139 |
)
|
140 |
-
high.
|
141 |
fn=show_info,
|
142 |
-
inputs=[high, tag_id, tag_open, tag_close, gr.State("
|
143 |
outputs=None,
|
144 |
)
|
145 |
|
@@ -447,6 +449,19 @@ bool
|
|
447 |
<td align="left"><code>False</code></td>
|
448 |
<td align="left">If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.</td>
|
449 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
</tbody></table>
|
451 |
|
452 |
|
@@ -460,6 +475,7 @@ bool
|
|
460 |
| `submit` | This listener is triggered when the user presses the Enter key while the HighlightedTextbox is focused. |
|
461 |
| `focus` | This listener is triggered when the HighlightedTextbox is focused. |
|
462 |
| `blur` | This listener is triggered when the HighlightedTextbox is unfocused/blurred. |
|
|
|
463 |
|
464 |
|
465 |
|
|
|
51 |
)
|
52 |
|
53 |
|
54 |
+
initial_text = "It is not something to be ashamed of: it is no different from the <a>personal fears</a> and <b>dislikes</b> of other things that <c>manny peopl</c> have."
|
55 |
|
56 |
with gr.Blocks() as demo:
|
57 |
gr.Markdown("### Parameters to control the highlighted textbox:")
|
58 |
with gr.Row():
|
59 |
tag_id = gr.Dropdown(
|
60 |
+
choices=["Error A", "Error B", "Error C"],
|
61 |
+
value=["Error A", "Error B", "Error C"],
|
62 |
multiselect=True,
|
63 |
allow_custom_value=True,
|
64 |
label="Tag ID",
|
|
|
66 |
info="Insert one or more tag IDs to use in the highlighted textbox.",
|
67 |
)
|
68 |
tag_open = gr.Dropdown(
|
69 |
+
choices=["<a>", "<b>", "<c>"],
|
70 |
+
value=["<a>", "<b>", "<c>"],
|
71 |
multiselect=True,
|
72 |
allow_custom_value=True,
|
73 |
label="Tag open",
|
|
|
75 |
info="Insert one or more tags to mark the beginning of a highlighted section.",
|
76 |
)
|
77 |
tag_close = gr.Dropdown(
|
78 |
+
choices=["</a>", "</b>", "</c>"],
|
79 |
+
value=["</a>", "</b>", "</c>"],
|
80 |
multiselect=True,
|
81 |
allow_custom_value=True,
|
82 |
label="Tag close",
|
|
|
113 |
show_label=True,
|
114 |
legend_label="Legend:",
|
115 |
show_legend_label=True,
|
116 |
+
show_remove_tags_button=True,
|
117 |
+
show_copy_button=False,
|
118 |
)
|
119 |
|
120 |
# Functions
|
|
|
134 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
|
135 |
outputs=None,
|
136 |
)
|
137 |
+
high.blur(
|
138 |
fn=show_info,
|
139 |
+
inputs=[high, tag_id, tag_open, tag_close, gr.State("Blur")],
|
140 |
outputs=None,
|
141 |
)
|
142 |
+
high.clear(
|
143 |
fn=show_info,
|
144 |
+
inputs=[high, tag_id, tag_open, tag_close, gr.State("Remove tags")],
|
145 |
outputs=None,
|
146 |
)
|
147 |
|
|
|
449 |
<td align="left"><code>False</code></td>
|
450 |
<td align="left">If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.</td>
|
451 |
</tr>
|
452 |
+
|
453 |
+
<tr>
|
454 |
+
<td align="left"><code>show_remove_tags_button</code></td>
|
455 |
+
<td align="left" style="width: 25%;">
|
456 |
+
|
457 |
+
```python
|
458 |
+
bool
|
459 |
+
```
|
460 |
+
|
461 |
+
</td>
|
462 |
+
<td align="left"><code>False</code></td>
|
463 |
+
<td align="left">If True, includes a button to remove all tags from the text.</td>
|
464 |
+
</tr>
|
465 |
</tbody></table>
|
466 |
|
467 |
|
|
|
475 |
| `submit` | This listener is triggered when the user presses the Enter key while the HighlightedTextbox is focused. |
|
476 |
| `focus` | This listener is triggered when the HighlightedTextbox is focused. |
|
477 |
| `blur` | This listener is triggered when the HighlightedTextbox is unfocused/blurred. |
|
478 |
+
| `clear` | This listener is triggered when the user clears the HighlightedTextbox using the X button for the component. |
|
479 |
|
480 |
|
481 |
|
src/backend/gradio_highlightedtextbox/highlightedtextbox.py
CHANGED
@@ -33,6 +33,7 @@ class HighlightedTextbox(FormComponent):
|
|
33 |
Events.submit,
|
34 |
Events.focus,
|
35 |
Events.blur,
|
|
|
36 |
]
|
37 |
data_model = HighlightedTextData
|
38 |
|
@@ -61,6 +62,7 @@ class HighlightedTextbox(FormComponent):
|
|
61 |
elem_classes: list[str] | str | None = None,
|
62 |
render: bool = True,
|
63 |
show_copy_button: bool = False,
|
|
|
64 |
):
|
65 |
"""
|
66 |
Parameters:
|
@@ -89,6 +91,7 @@ class HighlightedTextbox(FormComponent):
|
|
89 |
rtl: If True and `type` is "text", sets the direction of the text to right-to-left (cursor appears on the left of the text). Default is False, which renders cursor on the right.
|
90 |
show_copy_button: If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.
|
91 |
autoscroll: If True, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes.
|
|
|
92 |
"""
|
93 |
self.color_map = color_map
|
94 |
self.show_legend = show_legend
|
@@ -99,6 +102,7 @@ class HighlightedTextbox(FormComponent):
|
|
99 |
self.show_copy_button = show_copy_button
|
100 |
self.autofocus = autofocus
|
101 |
self.autoscroll = autoscroll
|
|
|
102 |
super().__init__(
|
103 |
label=label,
|
104 |
info=info,
|
|
|
33 |
Events.submit,
|
34 |
Events.focus,
|
35 |
Events.blur,
|
36 |
+
Events.clear,
|
37 |
]
|
38 |
data_model = HighlightedTextData
|
39 |
|
|
|
62 |
elem_classes: list[str] | str | None = None,
|
63 |
render: bool = True,
|
64 |
show_copy_button: bool = False,
|
65 |
+
show_remove_tags_button: bool = False,
|
66 |
):
|
67 |
"""
|
68 |
Parameters:
|
|
|
91 |
rtl: If True and `type` is "text", sets the direction of the text to right-to-left (cursor appears on the left of the text). Default is False, which renders cursor on the right.
|
92 |
show_copy_button: If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.
|
93 |
autoscroll: If True, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes.
|
94 |
+
show_remove_tags_button: If True, includes a button to remove all tags from the text.
|
95 |
"""
|
96 |
self.color_map = color_map
|
97 |
self.show_legend = show_legend
|
|
|
102 |
self.show_copy_button = show_copy_button
|
103 |
self.autofocus = autofocus
|
104 |
self.autoscroll = autoscroll
|
105 |
+
self.show_remove_tags_button = show_remove_tags_button
|
106 |
super().__init__(
|
107 |
label=label,
|
108 |
info=info,
|
src/backend/gradio_highlightedtextbox/highlightedtextbox.pyi
CHANGED
@@ -34,6 +34,7 @@ class HighlightedTextbox(FormComponent):
|
|
34 |
Events.submit,
|
35 |
Events.focus,
|
36 |
Events.blur,
|
|
|
37 |
]
|
38 |
data_model = HighlightedTextData
|
39 |
|
@@ -62,6 +63,7 @@ class HighlightedTextbox(FormComponent):
|
|
62 |
elem_classes: list[str] | str | None = None,
|
63 |
render: bool = True,
|
64 |
show_copy_button: bool = False,
|
|
|
65 |
):
|
66 |
"""
|
67 |
Parameters:
|
@@ -90,6 +92,7 @@ class HighlightedTextbox(FormComponent):
|
|
90 |
rtl: If True and `type` is "text", sets the direction of the text to right-to-left (cursor appears on the left of the text). Default is False, which renders cursor on the right.
|
91 |
show_copy_button: If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.
|
92 |
autoscroll: If True, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes.
|
|
|
93 |
"""
|
94 |
self.color_map = color_map
|
95 |
self.show_legend = show_legend
|
@@ -100,6 +103,7 @@ class HighlightedTextbox(FormComponent):
|
|
100 |
self.show_copy_button = show_copy_button
|
101 |
self.autofocus = autofocus
|
102 |
self.autoscroll = autoscroll
|
|
|
103 |
super().__init__(
|
104 |
label=label,
|
105 |
info=info,
|
@@ -495,6 +499,48 @@ class HighlightedTextbox(FormComponent):
|
|
495 |
...
|
496 |
|
497 |
def blur(self,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
fn: Callable | None,
|
499 |
inputs: Component | Sequence[Component] | set[Component] | None = None,
|
500 |
outputs: Component | Sequence[Component] | None = None,
|
|
|
34 |
Events.submit,
|
35 |
Events.focus,
|
36 |
Events.blur,
|
37 |
+
Events.clear,
|
38 |
]
|
39 |
data_model = HighlightedTextData
|
40 |
|
|
|
63 |
elem_classes: list[str] | str | None = None,
|
64 |
render: bool = True,
|
65 |
show_copy_button: bool = False,
|
66 |
+
show_remove_tags_button: bool = False,
|
67 |
):
|
68 |
"""
|
69 |
Parameters:
|
|
|
92 |
rtl: If True and `type` is "text", sets the direction of the text to right-to-left (cursor appears on the left of the text). Default is False, which renders cursor on the right.
|
93 |
show_copy_button: If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.
|
94 |
autoscroll: If True, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes.
|
95 |
+
show_remove_tags_button: If True, includes a button to remove all tags from the text.
|
96 |
"""
|
97 |
self.color_map = color_map
|
98 |
self.show_legend = show_legend
|
|
|
103 |
self.show_copy_button = show_copy_button
|
104 |
self.autofocus = autofocus
|
105 |
self.autoscroll = autoscroll
|
106 |
+
self.show_remove_tags_button = show_remove_tags_button
|
107 |
super().__init__(
|
108 |
label=label,
|
109 |
info=info,
|
|
|
499 |
...
|
500 |
|
501 |
def blur(self,
|
502 |
+
fn: Callable | None,
|
503 |
+
inputs: Component | Sequence[Component] | set[Component] | None = None,
|
504 |
+
outputs: Component | Sequence[Component] | None = None,
|
505 |
+
api_name: str | None | Literal[False] = None,
|
506 |
+
scroll_to_output: bool = False,
|
507 |
+
show_progress: Literal["full", "minimal", "hidden"] = "full",
|
508 |
+
queue: bool | None = None,
|
509 |
+
batch: bool = False,
|
510 |
+
max_batch_size: int = 4,
|
511 |
+
preprocess: bool = True,
|
512 |
+
postprocess: bool = True,
|
513 |
+
cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
|
514 |
+
every: float | None = None,
|
515 |
+
trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
|
516 |
+
js: str | None = None,
|
517 |
+
concurrency_limit: int | None | Literal["default"] = "default",
|
518 |
+
concurrency_id: str | None = None,
|
519 |
+
show_api: bool = True) -> Dependency:
|
520 |
+
"""
|
521 |
+
Parameters:
|
522 |
+
fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
|
523 |
+
inputs: List of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
|
524 |
+
outputs: List of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
|
525 |
+
api_name: Defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
|
526 |
+
scroll_to_output: If True, will scroll to output component on completion
|
527 |
+
show_progress: If True, will show progress animation while pending
|
528 |
+
queue: If True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
|
529 |
+
batch: If True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
|
530 |
+
max_batch_size: Maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
|
531 |
+
preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
|
532 |
+
postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
|
533 |
+
cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
|
534 |
+
every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
|
535 |
+
trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
|
536 |
+
js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
|
537 |
+
concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
|
538 |
+
concurrency_id: If set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
|
539 |
+
show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps to use this event. If fn is None, show_api will automatically be set to False.
|
540 |
+
"""
|
541 |
+
...
|
542 |
+
|
543 |
+
def clear(self,
|
544 |
fn: Callable | None,
|
545 |
inputs: Component | Sequence[Component] | set[Component] | None = None,
|
546 |
outputs: Component | Sequence[Component] | None = None,
|
src/backend/gradio_highlightedtextbox/templates/component/index.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
src/backend/gradio_highlightedtextbox/templates/component/style.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
span.has-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs)}span.svelte-vm3q5z:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-vm3q5z{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-vm3q5z{display:none!important}.category-legend.svelte-vm3q5z{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);color:#000}.category-label.svelte-vm3q5z{border-radius:var(--radius-xs);padding-right:var(--size-2);padding-left:var(--size-2);font-weight:var(--weight-semibold)}.category-label.has-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs)}.category-label.svelte-vm3q5z:not(.has-info){margin-bottom:var(--spacing-lg)}.title-container.svelte-vm3q5z{display:flex}.legend-separator.svelte-vm3q5z{margin:0 var(--spacing-md) 0 var(--spacing-md)}.title-with-highlights-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}.dropdown-arrow.svelte-145leq6{fill:currentColor}label.svelte-40uavx{display:block;width:100%}button.svelte-40uavx{display:flex;position:absolute;top:var(--block-label-margin);right:var(--block-label-margin);align-items:center;box-shadow:var(--shadow-drop);border:1px solid var(--color-border-primary);border-top:none;border-right:none;border-radius:var(--block-label-right-radius);background:var(--block-label-background-fill);padding:5px;width:22px;height:22px;overflow:hidden;color:var(--block-label-color);font:var(--font-sans);font-size:var(--button-small-text-size)}.container.svelte-40uavx{display:flex;flex-direction:column;gap:var(--spacing-sm)}.textfield.svelte-40uavx{box-sizing:border-box;outline:none!important;box-shadow:var(--input-shadow);padding:var(--input-padding);border-radius:var(--radius-md);background:var(--input-background-fill);background-color:transparent;font-weight:var(--input-text-weight);font-size:var(--input-text-size);width:100%;line-height:var(--line-sm);word-break:break-word;border:var(--input-border-width) solid var(--input-border-color);cursor:text;white-space:break-spaces}.textfield.svelte-40uavx:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}mark{border-radius:3px}.block.svelte-1t38q2d{position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm)}.block.border_focus.svelte-1t38q2d{border-color:var(--color-accent)}.padded.svelte-1t38q2d{padding:var(--block-padding)}.hidden.svelte-1t38q2d{display:none}.hide-container.svelte-1t38q2d{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-lpi64a{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-lpi64a{opacity:.5;box-shadow:none}button[disabled].svelte-lpi64a:hover{cursor:not-allowed}.padded.svelte-lpi64a{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-lpi64a:hover,button.highlight.svelte-lpi64a{cursor:pointer;color:var(--color-accent)}.padded.svelte-lpi64a:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-lpi64a{padding:0 1px;font-size:10px}div.svelte-lpi64a{padding:2px;display:flex;align-items:flex-end}.small.svelte-lpi64a{width:14px;height:14px}.large.svelte-lpi64a{width:22px;height:22px}.pending.svelte-lpi64a{animation:svelte-lpi64a-flash .5s infinite}@keyframes svelte-lpi64a-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-lpi64a{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-ipfyu7{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;padding-bottom:var(--spacing-xl);color:var(--block-label-text-color);flex-shrink:0;width:95%}.show_border.svelte-ipfyu7{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-1jp3vgd{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto}.icon.svelte-1jp3vgd{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-1jp3vgd{color:var(--color-accent)}.icon.svelte-1jp3vgd:hover,.icon.svelte-1jp3vgd:focus{color:var(--color-accent)}svg.svelte-43sxxs.svelte-43sxxs{width:var(--size-20);height:var(--size-20)}svg.svelte-43sxxs path.svelte-43sxxs{fill:var(--loader-color)}div.svelte-43sxxs.svelte-43sxxs{z-index:var(--layer-2)}.margin.svelte-43sxxs.svelte-43sxxs{margin:var(--size-4)}.wrap.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-top);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden;pointer-events:none}.wrap.center.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;left:0}.wrap.default.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;bottom:0;left:0}.hide.svelte-1txqlrd.svelte-1txqlrd{opacity:0;pointer-events:none}.generating.svelte-1txqlrd.svelte-1txqlrd{animation:svelte-1txqlrd-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent}.translucent.svelte-1txqlrd.svelte-1txqlrd{background:none}@keyframes svelte-1txqlrd-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1txqlrd.svelte-1txqlrd{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1txqlrd.svelte-1txqlrd{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1txqlrd.svelte-1txqlrd{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1txqlrd.svelte-1txqlrd{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1txqlrd.svelte-1txqlrd{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1txqlrd.svelte-1txqlrd{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1txqlrd.svelte-1txqlrd{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-1txqlrd .progress-text.svelte-1txqlrd{background:var(--block-background-fill)}.border.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary)}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}
|
|
|
1 |
+
span.has-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs)}span.svelte-vm3q5z:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-vm3q5z{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-vm3q5z{display:none!important}.category-legend.svelte-vm3q5z{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);color:#000}.category-label.svelte-vm3q5z{border-radius:var(--radius-xs);padding-right:var(--size-2);padding-left:var(--size-2);font-weight:var(--weight-semibold)}.category-label.has-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs)}.category-label.svelte-vm3q5z:not(.has-info){margin-bottom:var(--spacing-lg)}.title-container.svelte-vm3q5z{display:flex}.legend-separator.svelte-vm3q5z{margin:0 var(--spacing-md) 0 var(--spacing-md)}.title-with-highlights-info.svelte-vm3q5z{margin-bottom:var(--spacing-xs);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}.dropdown-arrow.svelte-145leq6{fill:currentColor}button.svelte-qjb524{position:relative;cursor:pointer;padding:5px;width:22px;height:22px}.check.svelte-qjb524{position:absolute;top:0;right:0;z-index:var(--layer-top);background:var(--background-fill-primary);padding:var(--size-1);width:100%;height:100%;color:var(--body-text-color)}button.svelte-1ga0gmr{position:relative;cursor:pointer;padding:5px;width:22px;height:22px;background-color:green}div.svelte-1bqqv16{display:flex;position:absolute;top:var(--block-label-margin);right:var(--block-label-margin);align-items:center;z-index:var(--layer-2);transition:.15s;box-shadow:var(--shadow-drop);border:1px solid var(--border-color-primary);border-top:none;border-right:none;border-radius:var(--block-label-right-radius);background:var(--block-label-background-fill);overflow:hidden;color:var(--block-label-text-color);font:var(--font);font-size:var(--button-small-text-size)}label.svelte-1atky07{display:block;width:100%}.container.svelte-1atky07{display:flex;flex-direction:column;gap:var(--spacing-sm)}.textfield.svelte-1atky07{box-sizing:border-box;outline:none!important;box-shadow:var(--input-shadow);padding:var(--input-padding);border-radius:var(--radius-md);background:var(--input-background-fill);background-color:transparent;font-weight:var(--input-text-weight);font-size:var(--input-text-size);width:100%;line-height:var(--line-sm);word-break:break-word;border:var(--input-border-width) solid var(--input-border-color);cursor:text;white-space:break-spaces}.textfield.svelte-1atky07:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}mark{border-radius:3px}.block.svelte-1t38q2d{position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm)}.block.border_focus.svelte-1t38q2d{border-color:var(--color-accent)}.padded.svelte-1t38q2d{padding:var(--block-padding)}.hidden.svelte-1t38q2d{display:none}.hide-container.svelte-1t38q2d{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-lpi64a{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-lpi64a{opacity:.5;box-shadow:none}button[disabled].svelte-lpi64a:hover{cursor:not-allowed}.padded.svelte-lpi64a{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-lpi64a:hover,button.highlight.svelte-lpi64a{cursor:pointer;color:var(--color-accent)}.padded.svelte-lpi64a:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-lpi64a{padding:0 1px;font-size:10px}div.svelte-lpi64a{padding:2px;display:flex;align-items:flex-end}.small.svelte-lpi64a{width:14px;height:14px}.large.svelte-lpi64a{width:22px;height:22px}.pending.svelte-lpi64a{animation:svelte-lpi64a-flash .5s infinite}@keyframes svelte-lpi64a-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-lpi64a{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-ipfyu7{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;padding-bottom:var(--spacing-xl);color:var(--block-label-text-color);flex-shrink:0;width:95%}.show_border.svelte-ipfyu7{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-1jp3vgd{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto}.icon.svelte-1jp3vgd{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-1jp3vgd{color:var(--color-accent)}.icon.svelte-1jp3vgd:hover,.icon.svelte-1jp3vgd:focus{color:var(--color-accent)}svg.svelte-43sxxs.svelte-43sxxs{width:var(--size-20);height:var(--size-20)}svg.svelte-43sxxs path.svelte-43sxxs{fill:var(--loader-color)}div.svelte-43sxxs.svelte-43sxxs{z-index:var(--layer-2)}.margin.svelte-43sxxs.svelte-43sxxs{margin:var(--size-4)}.wrap.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-top);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden;pointer-events:none}.wrap.center.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;left:0}.wrap.default.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;bottom:0;left:0}.hide.svelte-1txqlrd.svelte-1txqlrd{opacity:0;pointer-events:none}.generating.svelte-1txqlrd.svelte-1txqlrd{animation:svelte-1txqlrd-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent}.translucent.svelte-1txqlrd.svelte-1txqlrd{background:none}@keyframes svelte-1txqlrd-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1txqlrd.svelte-1txqlrd{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1txqlrd.svelte-1txqlrd{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1txqlrd.svelte-1txqlrd{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1txqlrd.svelte-1txqlrd{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1txqlrd.svelte-1txqlrd{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1txqlrd.svelte-1txqlrd{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1txqlrd.svelte-1txqlrd{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-1txqlrd .progress-text.svelte-1txqlrd{background:var(--block-background-fill)}.border.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary)}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}
|
src/demo/app.py
CHANGED
@@ -36,14 +36,14 @@ def show_info(
|
|
36 |
)
|
37 |
|
38 |
|
39 |
-
initial_text = "It is not something to be ashamed of: it is no different from the <
|
40 |
|
41 |
with gr.Blocks() as demo:
|
42 |
gr.Markdown("### Parameters to control the highlighted textbox:")
|
43 |
with gr.Row():
|
44 |
tag_id = gr.Dropdown(
|
45 |
-
choices=["
|
46 |
-
value=["
|
47 |
multiselect=True,
|
48 |
allow_custom_value=True,
|
49 |
label="Tag ID",
|
@@ -51,8 +51,8 @@ with gr.Blocks() as demo:
|
|
51 |
info="Insert one or more tag IDs to use in the highlighted textbox.",
|
52 |
)
|
53 |
tag_open = gr.Dropdown(
|
54 |
-
choices=["<
|
55 |
-
value=["<
|
56 |
multiselect=True,
|
57 |
allow_custom_value=True,
|
58 |
label="Tag open",
|
@@ -60,8 +60,8 @@ with gr.Blocks() as demo:
|
|
60 |
info="Insert one or more tags to mark the beginning of a highlighted section.",
|
61 |
)
|
62 |
tag_close = gr.Dropdown(
|
63 |
-
choices=["</
|
64 |
-
value=["</
|
65 |
multiselect=True,
|
66 |
allow_custom_value=True,
|
67 |
label="Tag close",
|
@@ -98,6 +98,8 @@ Highlights will disappear if the highlighted text is edited. Modals will appear
|
|
98 |
show_label=True,
|
99 |
legend_label="Legend:",
|
100 |
show_legend_label=True,
|
|
|
|
|
101 |
)
|
102 |
|
103 |
# Functions
|
@@ -117,14 +119,14 @@ Highlights will disappear if the highlighted text is edited. Modals will appear
|
|
117 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
|
118 |
outputs=None,
|
119 |
)
|
120 |
-
high.
|
121 |
fn=show_info,
|
122 |
-
inputs=[high, tag_id, tag_open, tag_close, gr.State("
|
123 |
outputs=None,
|
124 |
)
|
125 |
-
high.
|
126 |
fn=show_info,
|
127 |
-
inputs=[high, tag_id, tag_open, tag_close, gr.State("
|
128 |
outputs=None,
|
129 |
)
|
130 |
|
|
|
36 |
)
|
37 |
|
38 |
|
39 |
+
initial_text = "It is not something to be ashamed of: it is no different from the <a>personal fears</a> and <b>dislikes</b> of other things that <c>manny peopl</c> have."
|
40 |
|
41 |
with gr.Blocks() as demo:
|
42 |
gr.Markdown("### Parameters to control the highlighted textbox:")
|
43 |
with gr.Row():
|
44 |
tag_id = gr.Dropdown(
|
45 |
+
choices=["Error A", "Error B", "Error C"],
|
46 |
+
value=["Error A", "Error B", "Error C"],
|
47 |
multiselect=True,
|
48 |
allow_custom_value=True,
|
49 |
label="Tag ID",
|
|
|
51 |
info="Insert one or more tag IDs to use in the highlighted textbox.",
|
52 |
)
|
53 |
tag_open = gr.Dropdown(
|
54 |
+
choices=["<a>", "<b>", "<c>"],
|
55 |
+
value=["<a>", "<b>", "<c>"],
|
56 |
multiselect=True,
|
57 |
allow_custom_value=True,
|
58 |
label="Tag open",
|
|
|
60 |
info="Insert one or more tags to mark the beginning of a highlighted section.",
|
61 |
)
|
62 |
tag_close = gr.Dropdown(
|
63 |
+
choices=["</a>", "</b>", "</c>"],
|
64 |
+
value=["</a>", "</b>", "</c>"],
|
65 |
multiselect=True,
|
66 |
allow_custom_value=True,
|
67 |
label="Tag close",
|
|
|
98 |
show_label=True,
|
99 |
legend_label="Legend:",
|
100 |
show_legend_label=True,
|
101 |
+
show_remove_tags_button=True,
|
102 |
+
show_copy_button=False,
|
103 |
)
|
104 |
|
105 |
# Functions
|
|
|
119 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
|
120 |
outputs=None,
|
121 |
)
|
122 |
+
high.blur(
|
123 |
fn=show_info,
|
124 |
+
inputs=[high, tag_id, tag_open, tag_close, gr.State("Blur")],
|
125 |
outputs=None,
|
126 |
)
|
127 |
+
high.clear(
|
128 |
fn=show_info,
|
129 |
+
inputs=[high, tag_id, tag_open, tag_close, gr.State("Remove tags")],
|
130 |
outputs=None,
|
131 |
)
|
132 |
|
src/demo/space.py
CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
|
|
3 |
from app import demo as app
|
4 |
import os
|
5 |
|
6 |
-
_docs = {'HighlightedTextbox': {'description': 'Creates a textarea for user to enter string input or display string output where some\nelements are highlighted.\n (1) "text" whose value is the complete text, and\n (2) "highlights", which is a list of dictionaries, each of which have the keys:\n "highlight_type" (consisting of the highlight label),\n "start" (the character index where the label starts), and\n "end" (the character index where the label ends).\n Highlights should not overlap.', 'members': {'__init__': {'value': {'type': 'list[tuple[str, str | None]] | Callable | None', 'default': '""', 'description': 'default text to provide in textbox. If callable, the function will be called whenever the app loads to set the initial value of the component.'}, 'color_map': {'type': 'dict[str, str] | None', 'default': 'None', 'description': 'dictionary mapping labels to colors.'}, 'show_legend': {'type': 'bool', 'default': 'False', 'description': 'if True, will display legend.'}, 'show_legend_label': {'type': 'bool', 'default': 'False', 'description': 'if True, will display legend label.'}, 'legend_label': {'type': 'str', 'default': '""', 'description': 'label to display above legend.'}, 'combine_adjacent': {'type': 'bool', 'default': 'False', 'description': 'if True, will combine adjacent spans with the same label.'}, 'adjacent_separator': {'type': 'str', 'default': '""', 'description': 'separator to use when combining adjacent spans.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'component name in interface.'}, 'info': {'type': 'str | None', 'default': 'None', 'description': None}, 'every': {'type': 'float | None', 'default': 'None', 'description': "If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute."}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'autofocus': {'type': 'bool', 'default': 'False', 'description': None}, 'autoscroll': {'type': 'bool', 'default': 'True', 'description': 'If True, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes.'}, 'interactive': {'type': 'bool', 'default': 'True', 'description': 'if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}, 'show_copy_button': {'type': 'bool', 'default': 'False', 'description': 'If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.'}}, 'postprocess': {'y': {'type': 'list[tuple[str, str | None]] | dict | None', 'description': 'List of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.'}, 'value': {'type': 'list[tuple[str, str | None]] | dict | None', 'description': 'List of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.'}}, 'preprocess': {'return': {'type': 'dict', 'description': None}, 'value': None}}, 'events': {'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the HighlightedTextbox 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.'}, 'input': {'type': None, 'default': None, 'description': 'This listener is triggered when the user changes the value of the HighlightedTextbox.'}, 'select': {'type': None, 'default': None, 'description': 'Event listener for when the user selects or deselects the HighlightedTextbox. Uses event data gradio.SelectData to carry `value` referring to the label of the HighlightedTextbox, and `selected` to refer to state of the HighlightedTextbox. See EventData documentation on how to use this event data'}, 'submit': {'type': None, 'default': None, 'description': 'This listener is triggered when the user presses the Enter key while the HighlightedTextbox is focused.'}, 'focus': {'type': None, 'default': None, 'description': 'This listener is triggered when the HighlightedTextbox is focused.'}, 'blur': {'type': None, 'default': None, 'description': 'This listener is triggered when the HighlightedTextbox is unfocused/blurred.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'HighlightedTextbox': []}}}
|
7 |
|
8 |
abs_path = os.path.join(os.path.dirname(__file__), "css.css")
|
9 |
|
@@ -76,14 +76,14 @@ def show_info(
|
|
76 |
)
|
77 |
|
78 |
|
79 |
-
initial_text = "It is not something to be ashamed of: it is no different from the <
|
80 |
|
81 |
with gr.Blocks() as demo:
|
82 |
gr.Markdown("### Parameters to control the highlighted textbox:")
|
83 |
with gr.Row():
|
84 |
tag_id = gr.Dropdown(
|
85 |
-
choices=["
|
86 |
-
value=["
|
87 |
multiselect=True,
|
88 |
allow_custom_value=True,
|
89 |
label="Tag ID",
|
@@ -91,8 +91,8 @@ with gr.Blocks() as demo:
|
|
91 |
info="Insert one or more tag IDs to use in the highlighted textbox.",
|
92 |
)
|
93 |
tag_open = gr.Dropdown(
|
94 |
-
choices=["<
|
95 |
-
value=["<
|
96 |
multiselect=True,
|
97 |
allow_custom_value=True,
|
98 |
label="Tag open",
|
@@ -100,8 +100,8 @@ with gr.Blocks() as demo:
|
|
100 |
info="Insert one or more tags to mark the beginning of a highlighted section.",
|
101 |
)
|
102 |
tag_close = gr.Dropdown(
|
103 |
-
choices=["</
|
104 |
-
value=["</
|
105 |
multiselect=True,
|
106 |
allow_custom_value=True,
|
107 |
label="Tag close",
|
@@ -138,6 +138,8 @@ Highlights will disappear if the highlighted text is edited. Modals will appear
|
|
138 |
show_label=True,
|
139 |
legend_label="Legend:",
|
140 |
show_legend_label=True,
|
|
|
|
|
141 |
)
|
142 |
|
143 |
# Functions
|
@@ -157,14 +159,14 @@ Highlights will disappear if the highlighted text is edited. Modals will appear
|
|
157 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
|
158 |
outputs=None,
|
159 |
)
|
160 |
-
high.
|
161 |
fn=show_info,
|
162 |
-
inputs=[high, tag_id, tag_open, tag_close, gr.State("
|
163 |
outputs=None,
|
164 |
)
|
165 |
-
high.
|
166 |
fn=show_info,
|
167 |
-
inputs=[high, tag_id, tag_open, tag_close, gr.State("
|
168 |
outputs=None,
|
169 |
)
|
170 |
|
|
|
3 |
from app import demo as app
|
4 |
import os
|
5 |
|
6 |
+
_docs = {'HighlightedTextbox': {'description': 'Creates a textarea for user to enter string input or display string output where some\nelements are highlighted.\n (1) "text" whose value is the complete text, and\n (2) "highlights", which is a list of dictionaries, each of which have the keys:\n "highlight_type" (consisting of the highlight label),\n "start" (the character index where the label starts), and\n "end" (the character index where the label ends).\n Highlights should not overlap.', 'members': {'__init__': {'value': {'type': 'list[tuple[str, str | None]] | Callable | None', 'default': '""', 'description': 'default text to provide in textbox. If callable, the function will be called whenever the app loads to set the initial value of the component.'}, 'color_map': {'type': 'dict[str, str] | None', 'default': 'None', 'description': 'dictionary mapping labels to colors.'}, 'show_legend': {'type': 'bool', 'default': 'False', 'description': 'if True, will display legend.'}, 'show_legend_label': {'type': 'bool', 'default': 'False', 'description': 'if True, will display legend label.'}, 'legend_label': {'type': 'str', 'default': '""', 'description': 'label to display above legend.'}, 'combine_adjacent': {'type': 'bool', 'default': 'False', 'description': 'if True, will combine adjacent spans with the same label.'}, 'adjacent_separator': {'type': 'str', 'default': '""', 'description': 'separator to use when combining adjacent spans.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'component name in interface.'}, 'info': {'type': 'str | None', 'default': 'None', 'description': None}, 'every': {'type': 'float | None', 'default': 'None', 'description': "If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute."}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'autofocus': {'type': 'bool', 'default': 'False', 'description': None}, 'autoscroll': {'type': 'bool', 'default': 'True', 'description': 'If True, will automatically scroll to the bottom of the textbox when the value changes, unless the user scrolls up. If False, will not scroll to the bottom of the textbox when the value changes.'}, 'interactive': {'type': 'bool', 'default': 'True', 'description': 'if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}, 'show_copy_button': {'type': 'bool', 'default': 'False', 'description': 'If True, includes a copy button to copy the text in the textbox. Only applies if show_label is True.'}, 'show_remove_tags_button': {'type': 'bool', 'default': 'False', 'description': 'If True, includes a button to remove all tags from the text.'}}, 'postprocess': {'y': {'type': 'list[tuple[str, str | None]] | dict | None', 'description': 'List of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.'}, 'value': {'type': 'list[tuple[str, str | None]] | dict | None', 'description': 'List of (word, category) tuples, or a dictionary of two keys: "id", and "data", which is a list of (word, category) tuples.'}}, 'preprocess': {'return': {'type': 'dict', 'description': None}, 'value': None}}, 'events': {'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the HighlightedTextbox 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.'}, 'input': {'type': None, 'default': None, 'description': 'This listener is triggered when the user changes the value of the HighlightedTextbox.'}, 'select': {'type': None, 'default': None, 'description': 'Event listener for when the user selects or deselects the HighlightedTextbox. Uses event data gradio.SelectData to carry `value` referring to the label of the HighlightedTextbox, and `selected` to refer to state of the HighlightedTextbox. See EventData documentation on how to use this event data'}, 'submit': {'type': None, 'default': None, 'description': 'This listener is triggered when the user presses the Enter key while the HighlightedTextbox is focused.'}, 'focus': {'type': None, 'default': None, 'description': 'This listener is triggered when the HighlightedTextbox is focused.'}, 'blur': {'type': None, 'default': None, 'description': 'This listener is triggered when the HighlightedTextbox is unfocused/blurred.'}, 'clear': {'type': None, 'default': None, 'description': 'This listener is triggered when the user clears the HighlightedTextbox using the X button for the component.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'HighlightedTextbox': []}}}
|
7 |
|
8 |
abs_path = os.path.join(os.path.dirname(__file__), "css.css")
|
9 |
|
|
|
76 |
)
|
77 |
|
78 |
|
79 |
+
initial_text = "It is not something to be ashamed of: it is no different from the <a>personal fears</a> and <b>dislikes</b> of other things that <c>manny peopl</c> have."
|
80 |
|
81 |
with gr.Blocks() as demo:
|
82 |
gr.Markdown("### Parameters to control the highlighted textbox:")
|
83 |
with gr.Row():
|
84 |
tag_id = gr.Dropdown(
|
85 |
+
choices=["Error A", "Error B", "Error C"],
|
86 |
+
value=["Error A", "Error B", "Error C"],
|
87 |
multiselect=True,
|
88 |
allow_custom_value=True,
|
89 |
label="Tag ID",
|
|
|
91 |
info="Insert one or more tag IDs to use in the highlighted textbox.",
|
92 |
)
|
93 |
tag_open = gr.Dropdown(
|
94 |
+
choices=["<a>", "<b>", "<c>"],
|
95 |
+
value=["<a>", "<b>", "<c>"],
|
96 |
multiselect=True,
|
97 |
allow_custom_value=True,
|
98 |
label="Tag open",
|
|
|
100 |
info="Insert one or more tags to mark the beginning of a highlighted section.",
|
101 |
)
|
102 |
tag_close = gr.Dropdown(
|
103 |
+
choices=["</a>", "</b>", "</c>"],
|
104 |
+
value=["</a>", "</b>", "</c>"],
|
105 |
multiselect=True,
|
106 |
allow_custom_value=True,
|
107 |
label="Tag close",
|
|
|
138 |
show_label=True,
|
139 |
legend_label="Legend:",
|
140 |
show_legend_label=True,
|
141 |
+
show_remove_tags_button=True,
|
142 |
+
show_copy_button=False,
|
143 |
)
|
144 |
|
145 |
# Functions
|
|
|
159 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Focus")],
|
160 |
outputs=None,
|
161 |
)
|
162 |
+
high.blur(
|
163 |
fn=show_info,
|
164 |
+
inputs=[high, tag_id, tag_open, tag_close, gr.State("Blur")],
|
165 |
outputs=None,
|
166 |
)
|
167 |
+
high.clear(
|
168 |
fn=show_info,
|
169 |
+
inputs=[high, tag_id, tag_open, tag_close, gr.State("Remove tags")],
|
170 |
outputs=None,
|
171 |
)
|
172 |
|
src/frontend/Copy.svelte
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script lang="ts">
|
2 |
+
import { onDestroy } from "svelte";
|
3 |
+
import { fade } from "svelte/transition";
|
4 |
+
import { Copy, Check } from "@gradio/icons";
|
5 |
+
|
6 |
+
let copied = false;
|
7 |
+
export let value: string;
|
8 |
+
let timer: ReturnType<typeof setTimeout>;;
|
9 |
+
|
10 |
+
function copy_feedback(): void {
|
11 |
+
copied = true;
|
12 |
+
if (timer) clearTimeout(timer);
|
13 |
+
timer = setTimeout(() => {
|
14 |
+
copied = false;
|
15 |
+
}, 2000);
|
16 |
+
}
|
17 |
+
|
18 |
+
async function handle_copy(): Promise<void> {
|
19 |
+
if ("clipboard" in navigator) {
|
20 |
+
await navigator.clipboard.writeText(value);
|
21 |
+
copy_feedback();
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
onDestroy(() => {
|
26 |
+
if (timer) clearTimeout(timer);
|
27 |
+
});
|
28 |
+
</script>
|
29 |
+
|
30 |
+
<button
|
31 |
+
on:click={handle_copy}
|
32 |
+
title="Copy text to clipboard"
|
33 |
+
class:copied
|
34 |
+
aria-roledescription="Copy value"
|
35 |
+
aria-label="Copy"
|
36 |
+
>
|
37 |
+
<Copy />
|
38 |
+
{#if copied}
|
39 |
+
<span
|
40 |
+
class="check"
|
41 |
+
transition:fade
|
42 |
+
aria-roledescription="Value copied"
|
43 |
+
aria-label="Copied"><Check /></span
|
44 |
+
>
|
45 |
+
{/if}
|
46 |
+
</button>
|
47 |
+
|
48 |
+
<style>
|
49 |
+
button {
|
50 |
+
position: relative;
|
51 |
+
cursor: pointer;
|
52 |
+
padding: 5px;
|
53 |
+
width: 22px;
|
54 |
+
height: 22px;
|
55 |
+
}
|
56 |
+
|
57 |
+
.check {
|
58 |
+
position: absolute;
|
59 |
+
top: 0;
|
60 |
+
right: 0;
|
61 |
+
z-index: var(--layer-top);
|
62 |
+
background: var(--background-fill-primary);
|
63 |
+
padding: var(--size-1);
|
64 |
+
width: 100%;
|
65 |
+
height: 100%;
|
66 |
+
color: var(--body-text-color);
|
67 |
+
}
|
68 |
+
</style>
|
src/frontend/HighlightedTextbox.svelte
CHANGED
@@ -5,8 +5,7 @@
|
|
5 |
createEventDispatcher,
|
6 |
} from "svelte";
|
7 |
import BlockTitleWithHighlights from "./BlockTitleWithHighlights.svelte";
|
8 |
-
import
|
9 |
-
import { fade } from "svelte/transition";
|
10 |
import type { SelectData } from "@gradio/utils";
|
11 |
import { get_next_color } from "@gradio/utils";
|
12 |
import { correct_color_map, getParentCursorPosition, getNodeAndOffset } from "./utils";
|
@@ -23,6 +22,7 @@
|
|
23 |
export let container = true;
|
24 |
export let color_map: Record<string, string> = {};
|
25 |
export let show_copy_button = false;
|
|
|
26 |
export let disabled: boolean;
|
27 |
|
28 |
let el: HTMLDivElement;
|
@@ -32,8 +32,10 @@
|
|
32 |
let current_color_map: Record<string, string> = !color_map || Object.keys(color_map).length === 0 ? {} : color_map;
|
33 |
let _color_map: Record<string, { primary: string; secondary: string }> = {};
|
34 |
let copied = false;
|
|
|
35 |
let timer: ReturnType<typeof setTimeout>;
|
36 |
let can_scroll: boolean;
|
|
|
37 |
|
38 |
function set_color_map(): void {
|
39 |
// if a label in the color map is not in the value, remove it from the color map
|
@@ -63,6 +65,13 @@
|
|
63 |
return text;
|
64 |
}
|
65 |
}).join("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
}
|
68 |
|
@@ -76,6 +85,7 @@
|
|
76 |
blur: undefined;
|
77 |
select: SelectData;
|
78 |
focus: undefined;
|
|
|
79 |
}>();
|
80 |
|
81 |
beforeUpdate(() => {
|
@@ -134,19 +144,11 @@
|
|
134 |
value = new_value;
|
135 |
}
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
}
|
143 |
-
|
144 |
-
function copy_feedback(): void {
|
145 |
-
copied = true;
|
146 |
-
if (timer) clearTimeout(timer);
|
147 |
-
timer = setTimeout(() => {
|
148 |
-
copied = false;
|
149 |
-
}, 1000);
|
150 |
}
|
151 |
|
152 |
// Method to remove highlight if cursor is inside
|
@@ -176,26 +178,14 @@
|
|
176 |
}
|
177 |
</script>
|
178 |
|
179 |
-
|
180 |
-
<!-- svelte-ignore a11y-click-events-have-key-events-->
|
181 |
-
<label class:container>
|
182 |
<BlockTitleWithHighlights {show_label} {show_legend} {show_legend_label} {legend_label} {_color_map} {info}>{label}</BlockTitleWithHighlights>
|
183 |
-
|
184 |
-
{
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
>
|
190 |
-
{:else}
|
191 |
-
<button
|
192 |
-
on:click={handle_copy}
|
193 |
-
aria-label="Copy"
|
194 |
-
aria-roledescription="Copy text"><Copy /></button
|
195 |
-
>
|
196 |
-
{/if}
|
197 |
-
{/if}
|
198 |
-
|
199 |
{#if disabled}
|
200 |
<div
|
201 |
class="textfield"
|
@@ -206,21 +196,23 @@
|
|
206 |
bind:innerHTML={marked_el_text}
|
207 |
/>
|
208 |
{:else}
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
|
224 |
{/if}
|
225 |
</label>
|
226 |
|
@@ -230,26 +222,6 @@
|
|
230 |
width: 100%;
|
231 |
}
|
232 |
|
233 |
-
button {
|
234 |
-
display: flex;
|
235 |
-
position: absolute;
|
236 |
-
top: var(--block-label-margin);
|
237 |
-
right: var(--block-label-margin);
|
238 |
-
align-items: center;
|
239 |
-
box-shadow: var(--shadow-drop);
|
240 |
-
border: 1px solid var(--color-border-primary);
|
241 |
-
border-top: none;
|
242 |
-
border-right: none;
|
243 |
-
border-radius: var(--block-label-right-radius);
|
244 |
-
background: var(--block-label-background-fill);
|
245 |
-
padding: 5px;
|
246 |
-
width: 22px;
|
247 |
-
height: 22px;
|
248 |
-
overflow: hidden;
|
249 |
-
color: var(--block-label-color);
|
250 |
-
font: var(--font-sans);
|
251 |
-
font-size: var(--button-small-text-size);
|
252 |
-
}
|
253 |
.container {
|
254 |
display: flex;
|
255 |
flex-direction: column;
|
|
|
5 |
createEventDispatcher,
|
6 |
} from "svelte";
|
7 |
import BlockTitleWithHighlights from "./BlockTitleWithHighlights.svelte";
|
8 |
+
import Widgets from "./Widgets.svelte";
|
|
|
9 |
import type { SelectData } from "@gradio/utils";
|
10 |
import { get_next_color } from "@gradio/utils";
|
11 |
import { correct_color_map, getParentCursorPosition, getNodeAndOffset } from "./utils";
|
|
|
22 |
export let container = true;
|
23 |
export let color_map: Record<string, string> = {};
|
24 |
export let show_copy_button = false;
|
25 |
+
export let show_remove_tags_button = false;
|
26 |
export let disabled: boolean;
|
27 |
|
28 |
let el: HTMLDivElement;
|
|
|
32 |
let current_color_map: Record<string, string> = !color_map || Object.keys(color_map).length === 0 ? {} : color_map;
|
33 |
let _color_map: Record<string, { primary: string; secondary: string }> = {};
|
34 |
let copied = false;
|
35 |
+
let tags_removed = false;
|
36 |
let timer: ReturnType<typeof setTimeout>;
|
37 |
let can_scroll: boolean;
|
38 |
+
let tagged_text: string = "";
|
39 |
|
40 |
function set_color_map(): void {
|
41 |
// if a label in the color map is not in the value, remove it from the color map
|
|
|
65 |
return text;
|
66 |
}
|
67 |
}).join("");
|
68 |
+
tagged_text = value.map(([text, category]) => {
|
69 |
+
if (category !== null) {
|
70 |
+
return `<${category}>${text}</${category}>`;
|
71 |
+
} else {
|
72 |
+
return text;
|
73 |
+
}
|
74 |
+
}).join("");
|
75 |
}
|
76 |
}
|
77 |
|
|
|
85 |
blur: undefined;
|
86 |
select: SelectData;
|
87 |
focus: undefined;
|
88 |
+
clear: undefined;
|
89 |
}>();
|
90 |
|
91 |
beforeUpdate(() => {
|
|
|
144 |
value = new_value;
|
145 |
}
|
146 |
|
147 |
+
function handle_remove_tags(): void {
|
148 |
+
marked_el_text = el_text;
|
149 |
+
handle_change();
|
150 |
+
tags_removed = true;
|
151 |
+
dispatch("clear");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
|
154 |
// Method to remove highlight if cursor is inside
|
|
|
178 |
}
|
179 |
</script>
|
180 |
|
181 |
+
<label class:container for="highlighted-textbox">
|
|
|
|
|
182 |
<BlockTitleWithHighlights {show_label} {show_legend} {show_legend_label} {legend_label} {_color_map} {info}>{label}</BlockTitleWithHighlights>
|
183 |
+
<Widgets
|
184 |
+
{show_copy_button}
|
185 |
+
show_remove_tags_button={show_remove_tags_button && !tags_removed}
|
186 |
+
value={tagged_text}
|
187 |
+
on:removeTags={handle_remove_tags}
|
188 |
+
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
{#if disabled}
|
190 |
<div
|
191 |
class="textfield"
|
|
|
196 |
bind:innerHTML={marked_el_text}
|
197 |
/>
|
198 |
{:else}
|
199 |
+
<div
|
200 |
+
class="textfield"
|
201 |
+
data-testid="highlighted-textbox"
|
202 |
+
contenteditable="true"
|
203 |
+
role="textbox"
|
204 |
+
tabindex="0"
|
205 |
+
bind:this={el}
|
206 |
+
bind:textContent={el_text}
|
207 |
+
bind:innerHTML={marked_el_text}
|
208 |
+
on:blur
|
209 |
+
on:keypress
|
210 |
+
on:select
|
211 |
+
on:scroll
|
212 |
+
on:input={handle_change}
|
213 |
+
on:focus
|
214 |
+
on:change={handle_change}
|
215 |
+
/>
|
216 |
{/if}
|
217 |
</label>
|
218 |
|
|
|
222 |
width: 100%;
|
223 |
}
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
.container {
|
226 |
display: flex;
|
227 |
flex-direction: column;
|
src/frontend/Index.svelte
CHANGED
@@ -15,6 +15,7 @@
|
|
15 |
select: SelectData;
|
16 |
focus: never;
|
17 |
blur: never;
|
|
|
18 |
}>;
|
19 |
|
20 |
export let label = "Highlighted Textbox";
|
@@ -32,6 +33,7 @@
|
|
32 |
export let scale: number | null = null;
|
33 |
export let min_width: number | undefined = undefined;
|
34 |
export let show_copy_button: boolean = false;
|
|
|
35 |
export let loading_status: LoadingStatus | undefined = undefined;
|
36 |
export let value_is_output: boolean = false;
|
37 |
export let combine_adjacent: boolean = false;
|
@@ -76,6 +78,7 @@
|
|
76 |
{legend_label}
|
77 |
{color_map}
|
78 |
{show_copy_button}
|
|
|
79 |
{container}
|
80 |
disabled={!interactive}
|
81 |
on:change={() => gradio.dispatch("change")}
|
@@ -84,5 +87,6 @@
|
|
84 |
on:blur={() => gradio.dispatch("blur")}
|
85 |
on:select={(e) => gradio.dispatch("select", e.detail)}
|
86 |
on:focus={() => gradio.dispatch("focus")}
|
|
|
87 |
/>
|
88 |
</Block>
|
|
|
15 |
select: SelectData;
|
16 |
focus: never;
|
17 |
blur: never;
|
18 |
+
clear: never;
|
19 |
}>;
|
20 |
|
21 |
export let label = "Highlighted Textbox";
|
|
|
33 |
export let scale: number | null = null;
|
34 |
export let min_width: number | undefined = undefined;
|
35 |
export let show_copy_button: boolean = false;
|
36 |
+
export let show_remove_tags_button: boolean = false;
|
37 |
export let loading_status: LoadingStatus | undefined = undefined;
|
38 |
export let value_is_output: boolean = false;
|
39 |
export let combine_adjacent: boolean = false;
|
|
|
78 |
{legend_label}
|
79 |
{color_map}
|
80 |
{show_copy_button}
|
81 |
+
{show_remove_tags_button}
|
82 |
{container}
|
83 |
disabled={!interactive}
|
84 |
on:change={() => gradio.dispatch("change")}
|
|
|
87 |
on:blur={() => gradio.dispatch("blur")}
|
88 |
on:select={(e) => gradio.dispatch("select", e.detail)}
|
89 |
on:focus={() => gradio.dispatch("focus")}
|
90 |
+
on:clear={function (){ console.log("test"); gradio.dispatch("clear");}}
|
91 |
/>
|
92 |
</Block>
|
src/frontend/RemoveTags.svelte
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script lang="ts">
|
2 |
+
import { fade } from "svelte/transition";
|
3 |
+
import { Check } from "@gradio/icons";
|
4 |
+
import { createEventDispatcher } from 'svelte';
|
5 |
+
|
6 |
+
const dispatch = createEventDispatcher()
|
7 |
+
</script>
|
8 |
+
|
9 |
+
<button
|
10 |
+
on:click={() => dispatch('click')}
|
11 |
+
title="Remove highlights"
|
12 |
+
aria-roledescription="Remove highlights"
|
13 |
+
aria-label="Remove highlights"
|
14 |
+
>
|
15 |
+
<Check />
|
16 |
+
</button>
|
17 |
+
|
18 |
+
<style>
|
19 |
+
button {
|
20 |
+
position: relative;
|
21 |
+
cursor: pointer;
|
22 |
+
padding: 5px;
|
23 |
+
width: 22px;
|
24 |
+
height: 22px;
|
25 |
+
background-color: green;
|
26 |
+
}
|
27 |
+
</style>
|
src/frontend/Widgets.svelte
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script lang="ts">
|
2 |
+
import Copy from "./Copy.svelte";
|
3 |
+
import RemoveTags from "./RemoveTags.svelte";
|
4 |
+
import { createEventDispatcher } from 'svelte';
|
5 |
+
|
6 |
+
export let value: string;
|
7 |
+
export let show_copy_button: boolean = false;
|
8 |
+
export let show_remove_tags_button: boolean = false;
|
9 |
+
|
10 |
+
const dispatch = createEventDispatcher()
|
11 |
+
|
12 |
+
function removeTags() {
|
13 |
+
dispatch('removeTags');
|
14 |
+
}
|
15 |
+
</script>
|
16 |
+
|
17 |
+
<div>
|
18 |
+
{#if show_remove_tags_button}
|
19 |
+
<RemoveTags on:click={removeTags} />
|
20 |
+
{/if}
|
21 |
+
{#if show_copy_button}
|
22 |
+
<Copy {value} />
|
23 |
+
{/if}
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<style>
|
27 |
+
div {
|
28 |
+
display: flex;
|
29 |
+
position: absolute;
|
30 |
+
top: var(--block-label-margin);
|
31 |
+
right: var(--block-label-margin);
|
32 |
+
align-items: center;
|
33 |
+
|
34 |
+
z-index: var(--layer-2);
|
35 |
+
transition: 150ms;
|
36 |
+
box-shadow: var(--shadow-drop);
|
37 |
+
border: 1px solid var(--border-color-primary);
|
38 |
+
border-top: none;
|
39 |
+
border-right: none;
|
40 |
+
border-radius: var(--block-label-right-radius);
|
41 |
+
background: var(--block-label-background-fill);
|
42 |
+
overflow: hidden;
|
43 |
+
color: var(--block-label-text-color);
|
44 |
+
font: var(--font);
|
45 |
+
font-size: var(--button-small-text-size);
|
46 |
+
}
|
47 |
+
</style>
|
src/pyproject.toml
CHANGED
@@ -8,10 +8,10 @@ build-backend = "hatchling.build"
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_highlightedtextbox"
|
11 |
-
version = "0.0.
|
12 |
description = "Editable Gradio textarea supporting highlighting"
|
13 |
readme = "README.md"
|
14 |
-
license = "
|
15 |
requires-python = ">=3.8"
|
16 |
authors = [{ name = "Gabriele Sarti", email = "[email protected]" }]
|
17 |
keywords = ["gradio-custom-component", "gradio-template-SimpleTextbox", "highlight", "textbox", "editing", "color"]
|
@@ -39,7 +39,7 @@ dev = ["build", "twine"]
|
|
39 |
space = "https://huggingface.co/spaces/gsarti/gradio_highlightedtextbox"
|
40 |
|
41 |
[tool.hatch.build]
|
42 |
-
artifacts = ["/backend/gradio_highlightedtextbox/templates", "*.pyi", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "Users/gsarti/Documents/projects/highlightedtextbox/backend/gradio_highlightedtextbox/templates", "Users/gsarti/Documents/projects/highlightedtextbox/backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates"]
|
43 |
|
44 |
[tool.hatch.build.targets.wheel]
|
45 |
packages = ["/backend/gradio_highlightedtextbox"]
|
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_highlightedtextbox"
|
11 |
+
version = "0.0.9"
|
12 |
description = "Editable Gradio textarea supporting highlighting"
|
13 |
readme = "README.md"
|
14 |
+
license = "MIT"
|
15 |
requires-python = ">=3.8"
|
16 |
authors = [{ name = "Gabriele Sarti", email = "[email protected]" }]
|
17 |
keywords = ["gradio-custom-component", "gradio-template-SimpleTextbox", "highlight", "textbox", "editing", "color"]
|
|
|
39 |
space = "https://huggingface.co/spaces/gsarti/gradio_highlightedtextbox"
|
40 |
|
41 |
[tool.hatch.build]
|
42 |
+
artifacts = ["/backend/gradio_highlightedtextbox/templates", "*.pyi", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "Users/gsarti/Documents/projects/highlightedtextbox/backend/gradio_highlightedtextbox/templates", "Users/gsarti/Documents/projects/highlightedtextbox/backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates"]
|
43 |
|
44 |
[tool.hatch.build.targets.wheel]
|
45 |
packages = ["/backend/gradio_highlightedtextbox"]
|