Spaces:
Runtime error
Runtime error
v0.0.10 fix bubbling of clear event
Browse files- README.md +1 -1
- src/README.md +5 -0
- src/backend/gradio_highlightedtextbox/templates/component/index.js +66 -69
- src/demo/space.py +5 -0
- src/frontend/HighlightedTextbox.svelte +1 -1
- src/frontend/RemoveTags.svelte +1 -2
- src/frontend/Widgets.svelte +1 -5
- src/pyproject.toml +2 -2
README.md
CHANGED
@@ -6,7 +6,7 @@ tags:
|
|
6 |
- textbox
|
7 |
- editing
|
8 |
- color
|
9 |
-
title: gradio_highlightedtextbox
|
10 |
colorFrom: indigo
|
11 |
colorTo: green
|
12 |
sdk: docker
|
|
|
6 |
- textbox
|
7 |
- editing
|
8 |
- color
|
9 |
+
title: gradio_highlightedtextbox
|
10 |
colorFrom: indigo
|
11 |
colorTo: green
|
12 |
sdk: docker
|
src/README.md
CHANGED
@@ -144,6 +144,11 @@ Highlights will disappear if the highlighted text is edited. Modals will appear
|
|
144 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Remove tags")],
|
145 |
outputs=None,
|
146 |
)
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
if __name__ == "__main__":
|
149 |
demo.launch()
|
|
|
144 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Remove tags")],
|
145 |
outputs=None,
|
146 |
)
|
147 |
+
high.change(
|
148 |
+
fn=show_info,
|
149 |
+
inputs=[high, tag_id, tag_open, tag_close, gr.State("Change")],
|
150 |
+
outputs=None,
|
151 |
+
)
|
152 |
|
153 |
if __name__ == "__main__":
|
154 |
demo.launch()
|
src/backend/gradio_highlightedtextbox/templates/component/index.js
CHANGED
@@ -6,9 +6,9 @@ const {
|
|
6 |
destroy_each: ql,
|
7 |
detach: fe,
|
8 |
element: de,
|
9 |
-
empty:
|
10 |
ensure_array_like: tt,
|
11 |
-
get_all_dirty_from_scope:
|
12 |
get_slot_changes: Ll,
|
13 |
init: jl,
|
14 |
insert: _e,
|
@@ -190,7 +190,7 @@ function Vl(l) {
|
|
190 |
);
|
191 |
return {
|
192 |
c() {
|
193 |
-
e = de("div"), t = de("span"), _ && _.c(), n = Me(), r && r.c(), o = Me(), u && u.c(), s =
|
194 |
l[0]), V(t, "hide", !/*show_label*/
|
195 |
l[0]), V(
|
196 |
t,
|
@@ -216,7 +216,7 @@ function Vl(l) {
|
|
216 |
c[6],
|
217 |
m,
|
218 |
null
|
219 |
-
) :
|
220 |
/*$$scope*/
|
221 |
c[6]
|
222 |
),
|
@@ -361,10 +361,10 @@ function Ye(l, e, t, n) {
|
|
361 |
function at(l, e = {}) {
|
362 |
const t = Pl(l), { stiffness: n = 0.15, damping: i = 0.8, precision: o = 0.01 } = e;
|
363 |
let s, f, a, _ = l, r = l, u = 1, c = 0, m = !1;
|
364 |
-
function k(
|
365 |
-
r =
|
366 |
const y = a = {};
|
367 |
-
return l == null ||
|
368 |
if (m)
|
369 |
return m = !1, f = null, !1;
|
370 |
u = Math.min(u + c, 1);
|
@@ -383,7 +383,7 @@ function at(l, e = {}) {
|
|
383 |
}
|
384 |
const L = {
|
385 |
set: k,
|
386 |
-
update: (
|
387 |
subscribe: t.subscribe,
|
388 |
stiffness: n,
|
389 |
damping: i,
|
@@ -586,8 +586,8 @@ const {
|
|
586 |
mount_component: yn,
|
587 |
noop: Cn,
|
588 |
safe_not_equal: qn,
|
589 |
-
transition_in:
|
590 |
-
transition_out:
|
591 |
} = window.__gradio__svelte__internal, { createEventDispatcher: Ln } = window.__gradio__svelte__internal;
|
592 |
function jn(l) {
|
593 |
let e, t, n, i, o;
|
@@ -605,10 +605,10 @@ function jn(l) {
|
|
605 |
},
|
606 |
p: Cn,
|
607 |
i(s) {
|
608 |
-
n || (
|
609 |
},
|
610 |
o(s) {
|
611 |
-
|
612 |
},
|
613 |
d(s) {
|
614 |
s && bn(e), hn(t), i = !1, o();
|
@@ -617,7 +617,7 @@ function jn(l) {
|
|
617 |
}
|
618 |
function Fn(l) {
|
619 |
const e = Ln();
|
620 |
-
return [e, () => e("
|
621 |
}
|
622 |
class Hn extends mn {
|
623 |
constructor(e) {
|
@@ -646,9 +646,9 @@ const {
|
|
646 |
function bt(l) {
|
647 |
let e, t;
|
648 |
return e = new Hn({}), e.$on(
|
649 |
-
"
|
650 |
-
/*
|
651 |
-
l[
|
652 |
), {
|
653 |
c() {
|
654 |
ul(e.$$.fragment);
|
@@ -736,13 +736,10 @@ function An(l) {
|
|
736 |
}
|
737 |
function Wn(l, e, t) {
|
738 |
let { value: n } = e, { show_copy_button: i = !1 } = e, { show_remove_tags_button: o = !1 } = e;
|
739 |
-
const s = On();
|
740 |
-
function f() {
|
741 |
-
s("removeTags");
|
742 |
-
}
|
743 |
return l.$$set = (a) => {
|
744 |
"value" in a && t(0, n = a.value), "show_copy_button" in a && t(1, i = a.show_copy_button), "show_remove_tags_button" in a && t(2, o = a.show_remove_tags_button);
|
745 |
-
}, [n, i, o, f];
|
746 |
}
|
747 |
class In extends Mn {
|
748 |
constructor(e) {
|
@@ -1130,8 +1127,8 @@ const {
|
|
1130 |
attr: X,
|
1131 |
binding_callbacks: qt,
|
1132 |
bubble: je,
|
1133 |
-
create_component:
|
1134 |
-
destroy_component:
|
1135 |
detach: Pe,
|
1136 |
element: Qe,
|
1137 |
init: xn,
|
@@ -1338,7 +1335,7 @@ function ai(l) {
|
|
1338 |
)
|
1339 |
}
|
1340 |
}), i.$on(
|
1341 |
-
"
|
1342 |
/*handle_remove_tags*/
|
1343 |
l[17]
|
1344 |
);
|
@@ -1351,7 +1348,7 @@ function ai(l) {
|
|
1351 |
let a = f(l), _ = a(l);
|
1352 |
return {
|
1353 |
c() {
|
1354 |
-
e = Qe("label"),
|
1355 |
e,
|
1356 |
"container",
|
1357 |
/*container*/
|
@@ -1401,13 +1398,13 @@ function ai(l) {
|
|
1401 |
Mt(t.$$.fragment, r), Mt(i.$$.fragment, r), s = !1;
|
1402 |
},
|
1403 |
d(r) {
|
1404 |
-
r && Pe(e),
|
1405 |
}
|
1406 |
};
|
1407 |
}
|
1408 |
function ri(l, e, t) {
|
1409 |
const n = typeof document < "u";
|
1410 |
-
let { value: i = [] } = e, { value_is_output: o = !1 } = e, { label: s } = e, { legend_label: f } = e, { info: a = void 0 } = e, { show_label: _ = !0 } = e, { show_legend: r = !1 } = e, { show_legend_label: u = !1 } = e, { container: c = !0 } = e, { color_map: m = {} } = e, { show_copy_button: k = !1 } = e, { show_remove_tags_button: L = !1 } = e, { disabled:
|
1411 |
function E() {
|
1412 |
for (let g in j)
|
1413 |
i.map(([M, F]) => F).includes(g) || delete j[g];
|
@@ -1425,7 +1422,7 @@ function ri(l, e, t) {
|
|
1425 |
}
|
1426 |
const R = oi();
|
1427 |
ni(() => {
|
1428 |
-
|
1429 |
});
|
1430 |
function ae() {
|
1431 |
D(), A(), R("change", i), o || R("input", i);
|
@@ -1492,7 +1489,7 @@ function ri(l, e, t) {
|
|
1492 |
}
|
1493 |
function Oe(g) {
|
1494 |
qt[g ? "unshift" : "push"](() => {
|
1495 |
-
|
1496 |
});
|
1497 |
}
|
1498 |
function Ae() {
|
@@ -1500,14 +1497,14 @@ function ri(l, e, t) {
|
|
1500 |
}
|
1501 |
function w(g) {
|
1502 |
qt[g ? "unshift" : "push"](() => {
|
1503 |
-
|
1504 |
});
|
1505 |
}
|
1506 |
function pl() {
|
1507 |
y = this.textContent, d = this.innerHTML, t(11, y), t(12, d);
|
1508 |
}
|
1509 |
return l.$$set = (g) => {
|
1510 |
-
"value" in g && t(18, i = g.value), "value_is_output" in g && t(19, o = g.value_is_output), "label" in g && t(0, s = g.label), "legend_label" in g && t(1, f = g.legend_label), "info" in g && t(2, a = g.info), "show_label" in g && t(3, _ = g.show_label), "show_legend" in g && t(4, r = g.show_legend), "show_legend_label" in g && t(5, u = g.show_legend_label), "container" in g && t(6, c = g.container), "color_map" in g && t(20, m = g.color_map), "show_copy_button" in g && t(7, k = g.show_copy_button), "show_remove_tags_button" in g && t(8, L = g.show_remove_tags_button), "disabled" in g && t(9,
|
1511 |
}, E(), O(!0), [
|
1512 |
s,
|
1513 |
f,
|
@@ -1518,8 +1515,8 @@ function ri(l, e, t) {
|
|
1518 |
c,
|
1519 |
k,
|
1520 |
L,
|
1521 |
-
S,
|
1522 |
T,
|
|
|
1523 |
y,
|
1524 |
d,
|
1525 |
h,
|
@@ -1782,7 +1779,7 @@ function qi(l) {
|
|
1782 |
}
|
1783 |
};
|
1784 |
}
|
1785 |
-
function
|
1786 |
let e, t = (
|
1787 |
/*tag*/
|
1788 |
l[14] && qi(l)
|
@@ -1809,8 +1806,8 @@ function Ti(l) {
|
|
1809 |
}
|
1810 |
};
|
1811 |
}
|
1812 |
-
function
|
1813 |
-
let { $$slots: n = {}, $$scope: i } = e, { height: o = void 0 } = e, { width: s = void 0 } = e, { elem_id: f = "" } = e, { elem_classes: a = [] } = e, { variant: _ = "solid" } = e, { border_mode: r = "base" } = e, { padding: u = !0 } = e, { type: c = "normal" } = e, { test_id: m = void 0 } = e, { explicit_call: k = !1 } = e, { container: L = !0 } = e, { visible:
|
1814 |
const j = (h) => {
|
1815 |
if (h !== void 0) {
|
1816 |
if (typeof h == "number")
|
@@ -1820,7 +1817,7 @@ function Si(l, e, t) {
|
|
1820 |
}
|
1821 |
};
|
1822 |
return l.$$set = (h) => {
|
1823 |
-
"height" in h && t(0, o = h.height), "width" in h && t(1, s = h.width), "elem_id" in h && t(2, f = h.elem_id), "elem_classes" in h && t(3, a = h.elem_classes), "variant" in h && t(4, _ = h.variant), "border_mode" in h && t(5, r = h.border_mode), "padding" in h && t(6, u = h.padding), "type" in h && t(16, c = h.type), "test_id" in h && t(7, m = h.test_id), "explicit_call" in h && t(8, k = h.explicit_call), "container" in h && t(9, L = h.container), "visible" in h && t(10,
|
1824 |
}, [
|
1825 |
o,
|
1826 |
s,
|
@@ -1832,8 +1829,8 @@ function Si(l, e, t) {
|
|
1832 |
m,
|
1833 |
k,
|
1834 |
L,
|
1835 |
-
S,
|
1836 |
T,
|
|
|
1837 |
y,
|
1838 |
d,
|
1839 |
C,
|
@@ -1845,7 +1842,7 @@ function Si(l, e, t) {
|
|
1845 |
}
|
1846 |
class Li extends ci {
|
1847 |
constructor(e) {
|
1848 |
-
super(), pi(this, e,
|
1849 |
height: 0,
|
1850 |
width: 1,
|
1851 |
elem_id: 2,
|
@@ -1963,7 +1960,7 @@ const {
|
|
1963 |
destroy_each: wl,
|
1964 |
detach: v,
|
1965 |
element: $,
|
1966 |
-
empty:
|
1967 |
ensure_array_like: Be,
|
1968 |
get_all_dirty_from_scope: Ai,
|
1969 |
get_slot_changes: Wi,
|
@@ -1979,7 +1976,7 @@ const {
|
|
1979 |
text: H,
|
1980 |
toggle_class: B,
|
1981 |
transition_in: qe,
|
1982 |
-
transition_out:
|
1983 |
update_slot_base: Yi
|
1984 |
} = window.__gradio__svelte__internal, { tick: Gi } = window.__gradio__svelte__internal, { onDestroy: Ji } = window.__gradio__svelte__internal, Ki = (l) => ({}), Dt = (l) => ({});
|
1985 |
function Bt(l, e, t) {
|
@@ -2039,7 +2036,7 @@ function Qi(l) {
|
|
2039 |
o || (qe(f, a), o = !0);
|
2040 |
},
|
2041 |
o(a) {
|
2042 |
-
|
2043 |
},
|
2044 |
d(a) {
|
2045 |
a && (v(e), v(i)), f && f.d(a);
|
@@ -2076,8 +2073,8 @@ function xi(l) {
|
|
2076 |
/*timer*/
|
2077 |
l[5] && Wt(l)
|
2078 |
);
|
2079 |
-
const L = [oo, io],
|
2080 |
-
function
|
2081 |
return (
|
2082 |
/*last_progress_level*/
|
2083 |
d[15] != null ? 0 : (
|
@@ -2086,12 +2083,12 @@ function xi(l) {
|
|
2086 |
)
|
2087 |
);
|
2088 |
}
|
2089 |
-
~(o =
|
2090 |
let y = !/*timer*/
|
2091 |
l[5] && Kt(l);
|
2092 |
return {
|
2093 |
c() {
|
2094 |
-
r && r.c(), e = G(), t = $("div"), m && m.c(), n = G(), k && k.c(), i = G(), s && s.c(), f = G(), y && y.c(), a =
|
2095 |
t,
|
2096 |
"meta-text-center",
|
2097 |
/*variant*/
|
@@ -2104,7 +2101,7 @@ function xi(l) {
|
|
2104 |
);
|
2105 |
},
|
2106 |
m(d, C) {
|
2107 |
-
r && r.m(d, C), p(d, e, C), p(d, t, C), m && m.m(t, null), ce(t, n), k && k.m(t, null), p(d, i, C), ~o &&
|
2108 |
},
|
2109 |
p(d, C) {
|
2110 |
/*variant*/
|
@@ -2125,19 +2122,19 @@ function xi(l) {
|
|
2125 |
d[8] === "default"
|
2126 |
);
|
2127 |
let j = o;
|
2128 |
-
o =
|
2129 |
-
|
2130 |
-
}), bl()), ~o ? (s =
|
2131 |
d[5] ? y && (y.d(1), y = null) : y ? y.p(d, C) : (y = Kt(d), y.c(), y.m(a.parentNode, a));
|
2132 |
},
|
2133 |
i(d) {
|
2134 |
_ || (qe(s), _ = !0);
|
2135 |
},
|
2136 |
o(d) {
|
2137 |
-
|
2138 |
},
|
2139 |
d(d) {
|
2140 |
-
d && (v(e), v(t), v(i), v(f), v(a)), r && r.d(d), m && m.d(), k && k.d(), ~o &&
|
2141 |
}
|
2142 |
};
|
2143 |
}
|
@@ -2217,7 +2214,7 @@ function to(l) {
|
|
2217 |
c() {
|
2218 |
for (let i = 0; i < n.length; i += 1)
|
2219 |
n[i].c();
|
2220 |
-
e =
|
2221 |
},
|
2222 |
m(i, o) {
|
2223 |
for (let s = 0; s < n.length; s += 1)
|
@@ -2337,7 +2334,7 @@ function At(l) {
|
|
2337 |
);
|
2338 |
return {
|
2339 |
c() {
|
2340 |
-
t && t.c(), e =
|
2341 |
},
|
2342 |
m(n, i) {
|
2343 |
t && t.m(n, i), p(n, e, i);
|
@@ -2407,7 +2404,7 @@ function io(l) {
|
|
2407 |
t || (qe(e.$$.fragment, n), t = !0);
|
2408 |
},
|
2409 |
o(n) {
|
2410 |
-
|
2411 |
},
|
2412 |
d(n) {
|
2413 |
Oi(e, n);
|
@@ -2451,7 +2448,7 @@ function It(l) {
|
|
2451 |
c() {
|
2452 |
for (let i = 0; i < n.length; i += 1)
|
2453 |
n[i].c();
|
2454 |
-
e =
|
2455 |
},
|
2456 |
m(i, o) {
|
2457 |
for (let s = 0; s < n.length; s += 1)
|
@@ -2501,7 +2498,7 @@ function Ut(l) {
|
|
2501 |
);
|
2502 |
return {
|
2503 |
c() {
|
2504 |
-
o && o.c(), e = G(), s && s.c(), t = G(), f && f.c(), n = G(), a && a.c(), i =
|
2505 |
},
|
2506 |
m(_, r) {
|
2507 |
o && o.m(_, r), p(_, e, r), s && s.m(_, r), p(_, t, r), f && f.m(_, r), p(_, n, r), a && a.m(_, r), p(_, i, r);
|
@@ -2610,7 +2607,7 @@ function Jt(l) {
|
|
2610 |
);
|
2611 |
return {
|
2612 |
c() {
|
2613 |
-
t && t.c(), e =
|
2614 |
},
|
2615 |
m(n, i) {
|
2616 |
t && t.m(n, i), p(n, e, i);
|
@@ -2709,7 +2706,7 @@ function fo(l) {
|
|
2709 |
},
|
2710 |
p(_, r) {
|
2711 |
let u = t;
|
2712 |
-
t = a(_), t === u ? ~t && f[t].p(_, r) : (n && (vl(),
|
2713 |
f[u] = null;
|
2714 |
}), bl()), ~t ? (n = f[t], n ? n.p(_, r) : (n = f[t] = s[t](_), n.c()), qe(n, 1), n.m(e, null)) : n = null), (!o || r[0] & /*variant, show_progress*/
|
2715 |
320 && i !== (i = "wrap " + /*variant*/
|
@@ -2758,7 +2755,7 @@ function fo(l) {
|
|
2758 |
o || (qe(n), o = !0);
|
2759 |
},
|
2760 |
o(_) {
|
2761 |
-
|
2762 |
},
|
2763 |
d(_) {
|
2764 |
_ && v(e), ~t && f[t].d(), l[31](null);
|
@@ -2783,7 +2780,7 @@ async function _o(l, e = !0) {
|
|
2783 |
}
|
2784 |
}
|
2785 |
function ao(l, e, t) {
|
2786 |
-
let n, { $$slots: i = {}, $$scope: o } = e, { i18n: s } = e, { eta: f = null } = e, { queue_position: a } = e, { queue_size: _ } = e, { status: r } = e, { scroll_to_output: u = !1 } = e, { timer: c = !0 } = e, { show_progress: m = "full" } = e, { message: k = null } = e, { progress: L = null } = e, { variant:
|
2787 |
const Le = () => {
|
2788 |
t(0, f = t(26, O = t(19, he = null))), t(24, J = performance.now()), t(25, E = 0), Z = !0, ge();
|
2789 |
};
|
@@ -2810,7 +2807,7 @@ function ao(l, e, t) {
|
|
2810 |
});
|
2811 |
}
|
2812 |
return l.$$set = (w) => {
|
2813 |
-
"i18n" in w && t(1, s = w.i18n), "eta" in w && t(0, f = w.eta), "queue_position" in w && t(2, a = w.queue_position), "queue_size" in w && t(3, _ = w.queue_size), "status" in w && t(4, r = w.status), "scroll_to_output" in w && t(21, u = w.scroll_to_output), "timer" in w && t(5, c = w.timer), "show_progress" in w && t(6, m = w.show_progress), "message" in w && t(22, k = w.message), "progress" in w && t(7, L = w.progress), "variant" in w && t(8,
|
2814 |
}, l.$$.update = () => {
|
2815 |
l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
|
2816 |
218103809 && (f === null && t(0, f = O), f != null && O !== f && (t(27, R = (performance.now() - J) / 1e3 + f), t(19, he = R.toFixed(1)), t(26, O = f))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/
|
@@ -2835,8 +2832,8 @@ function ao(l, e, t) {
|
|
2835 |
c,
|
2836 |
m,
|
2837 |
L,
|
2838 |
-
S,
|
2839 |
T,
|
|
|
2840 |
y,
|
2841 |
d,
|
2842 |
C,
|
@@ -3180,8 +3177,8 @@ function qo(l) {
|
|
3180 |
}
|
3181 |
};
|
3182 |
}
|
3183 |
-
function
|
3184 |
-
let { gradio: n } = e, { label: i = "Highlighted Textbox" } = e, { legend_label: o = "Highlights:" } = e, { info: s = void 0 } = e, { elem_id: f = "" } = e, { elem_classes: a = [] } = e, { visible: _ = !0 } = e, { value: r } = e, { show_label: u } = e, { show_legend: c } = e, { show_legend_label: m } = e, { color_map: k = {} } = e, { container: L = !0 } = e, { scale:
|
3185 |
const J = !1, E = !0;
|
3186 |
function O(b) {
|
3187 |
r = b, t(0, r), t(20, h);
|
@@ -3193,7 +3190,7 @@ function To(l, e, t) {
|
|
3193 |
console.log("test"), n.dispatch("clear");
|
3194 |
};
|
3195 |
return l.$$set = (b) => {
|
3196 |
-
"gradio" in b && t(3, n = b.gradio), "label" in b && t(4, i = b.label), "legend_label" in b && t(5, o = b.legend_label), "info" in b && t(6, s = b.info), "elem_id" in b && t(7, f = b.elem_id), "elem_classes" in b && t(8, a = b.elem_classes), "visible" in b && t(9, _ = b.visible), "value" in b && t(0, r = b.value), "show_label" in b && t(10, u = b.show_label), "show_legend" in b && t(11, c = b.show_legend), "show_legend_label" in b && t(12, m = b.show_legend_label), "color_map" in b && t(1, k = b.color_map), "container" in b && t(13, L = b.container), "scale" in b && t(14,
|
3197 |
}, l.$$.update = () => {
|
3198 |
l.$$.dirty[0] & /*color_map*/
|
3199 |
2 && !k && Object.keys(k).length && t(1, k), l.$$.dirty[0] & /*value, combine_adjacent*/
|
@@ -3213,8 +3210,8 @@ function To(l, e, t) {
|
|
3213 |
c,
|
3214 |
m,
|
3215 |
L,
|
3216 |
-
S,
|
3217 |
T,
|
|
|
3218 |
y,
|
3219 |
d,
|
3220 |
C,
|
@@ -3233,12 +3230,12 @@ function To(l, e, t) {
|
|
3233 |
ge
|
3234 |
];
|
3235 |
}
|
3236 |
-
class
|
3237 |
constructor(e) {
|
3238 |
super(), vo(
|
3239 |
this,
|
3240 |
e,
|
3241 |
-
|
3242 |
qo,
|
3243 |
ko,
|
3244 |
{
|
@@ -3404,5 +3401,5 @@ class So extends uo {
|
|
3404 |
}
|
3405 |
}
|
3406 |
export {
|
3407 |
-
|
3408 |
};
|
|
|
6 |
destroy_each: ql,
|
7 |
detach: fe,
|
8 |
element: de,
|
9 |
+
empty: Sl,
|
10 |
ensure_array_like: tt,
|
11 |
+
get_all_dirty_from_scope: Tl,
|
12 |
get_slot_changes: Ll,
|
13 |
init: jl,
|
14 |
insert: _e,
|
|
|
190 |
);
|
191 |
return {
|
192 |
c() {
|
193 |
+
e = de("div"), t = de("span"), _ && _.c(), n = Me(), r && r.c(), o = Me(), u && u.c(), s = Sl(), U(t, "data-testid", "block-info"), U(t, "class", "svelte-vm3q5z"), V(t, "sr-only", !/*show_label*/
|
194 |
l[0]), V(t, "hide", !/*show_label*/
|
195 |
l[0]), V(
|
196 |
t,
|
|
|
216 |
c[6],
|
217 |
m,
|
218 |
null
|
219 |
+
) : Tl(
|
220 |
/*$$scope*/
|
221 |
c[6]
|
222 |
),
|
|
|
361 |
function at(l, e = {}) {
|
362 |
const t = Pl(l), { stiffness: n = 0.15, damping: i = 0.8, precision: o = 0.01 } = e;
|
363 |
let s, f, a, _ = l, r = l, u = 1, c = 0, m = !1;
|
364 |
+
function k(T, S = {}) {
|
365 |
+
r = T;
|
366 |
const y = a = {};
|
367 |
+
return l == null || S.hard || L.stiffness >= 1 && L.damping >= 1 ? (m = !0, s = st(), _ = T, t.set(l = r), Promise.resolve()) : (S.soft && (c = 1 / ((S.soft === !0 ? 0.5 : +S.soft) * 60), u = 0), f || (s = st(), m = !1, f = Bl((d) => {
|
368 |
if (m)
|
369 |
return m = !1, f = null, !1;
|
370 |
u = Math.min(u + c, 1);
|
|
|
383 |
}
|
384 |
const L = {
|
385 |
set: k,
|
386 |
+
update: (T, S) => k(T(r, l), S),
|
387 |
subscribe: t.subscribe,
|
388 |
stiffness: n,
|
389 |
damping: i,
|
|
|
586 |
mount_component: yn,
|
587 |
noop: Cn,
|
588 |
safe_not_equal: qn,
|
589 |
+
transition_in: Sn,
|
590 |
+
transition_out: Tn
|
591 |
} = window.__gradio__svelte__internal, { createEventDispatcher: Ln } = window.__gradio__svelte__internal;
|
592 |
function jn(l) {
|
593 |
let e, t, n, i, o;
|
|
|
605 |
},
|
606 |
p: Cn,
|
607 |
i(s) {
|
608 |
+
n || (Sn(t.$$.fragment, s), n = !0);
|
609 |
},
|
610 |
o(s) {
|
611 |
+
Tn(t.$$.fragment, s), n = !1;
|
612 |
},
|
613 |
d(s) {
|
614 |
s && bn(e), hn(t), i = !1, o();
|
|
|
617 |
}
|
618 |
function Fn(l) {
|
619 |
const e = Ln();
|
620 |
+
return [e, () => e("clear")];
|
621 |
}
|
622 |
class Hn extends mn {
|
623 |
constructor(e) {
|
|
|
646 |
function bt(l) {
|
647 |
let e, t;
|
648 |
return e = new Hn({}), e.$on(
|
649 |
+
"clear",
|
650 |
+
/*clear_handler*/
|
651 |
+
l[4]
|
652 |
), {
|
653 |
c() {
|
654 |
ul(e.$$.fragment);
|
|
|
736 |
}
|
737 |
function Wn(l, e, t) {
|
738 |
let { value: n } = e, { show_copy_button: i = !1 } = e, { show_remove_tags_button: o = !1 } = e;
|
739 |
+
const s = On(), f = () => s("clear");
|
|
|
|
|
|
|
740 |
return l.$$set = (a) => {
|
741 |
"value" in a && t(0, n = a.value), "show_copy_button" in a && t(1, i = a.show_copy_button), "show_remove_tags_button" in a && t(2, o = a.show_remove_tags_button);
|
742 |
+
}, [n, i, o, s, f];
|
743 |
}
|
744 |
class In extends Mn {
|
745 |
constructor(e) {
|
|
|
1127 |
attr: X,
|
1128 |
binding_callbacks: qt,
|
1129 |
bubble: je,
|
1130 |
+
create_component: St,
|
1131 |
+
destroy_component: Tt,
|
1132 |
detach: Pe,
|
1133 |
element: Qe,
|
1134 |
init: xn,
|
|
|
1335 |
)
|
1336 |
}
|
1337 |
}), i.$on(
|
1338 |
+
"clear",
|
1339 |
/*handle_remove_tags*/
|
1340 |
l[17]
|
1341 |
);
|
|
|
1348 |
let a = f(l), _ = a(l);
|
1349 |
return {
|
1350 |
c() {
|
1351 |
+
e = Qe("label"), St(t.$$.fragment), n = jt(), St(i.$$.fragment), o = jt(), _.c(), X(e, "for", "highlighted-textbox"), X(e, "class", "svelte-1atky07"), Ft(
|
1352 |
e,
|
1353 |
"container",
|
1354 |
/*container*/
|
|
|
1398 |
Mt(t.$$.fragment, r), Mt(i.$$.fragment, r), s = !1;
|
1399 |
},
|
1400 |
d(r) {
|
1401 |
+
r && Pe(e), Tt(t), Tt(i), _.d();
|
1402 |
}
|
1403 |
};
|
1404 |
}
|
1405 |
function ri(l, e, t) {
|
1406 |
const n = typeof document < "u";
|
1407 |
+
let { value: i = [] } = e, { value_is_output: o = !1 } = e, { label: s } = e, { legend_label: f } = e, { info: a = void 0 } = e, { show_label: _ = !0 } = e, { show_legend: r = !1 } = e, { show_legend_label: u = !1 } = e, { container: c = !0 } = e, { color_map: m = {} } = e, { show_copy_button: k = !1 } = e, { show_remove_tags_button: L = !1 } = e, { disabled: T } = e, S, y = "", d = "", C, j = !m || Object.keys(m).length === 0 ? {} : m, h = {}, Z = !1, J = "";
|
1408 |
function E() {
|
1409 |
for (let g in j)
|
1410 |
i.map(([M, F]) => F).includes(g) || delete j[g];
|
|
|
1422 |
}
|
1423 |
const R = oi();
|
1424 |
ni(() => {
|
1425 |
+
S && S.offsetHeight + S.scrollTop > S.scrollHeight - 100;
|
1426 |
});
|
1427 |
function ae() {
|
1428 |
D(), A(), R("change", i), o || R("input", i);
|
|
|
1489 |
}
|
1490 |
function Oe(g) {
|
1491 |
qt[g ? "unshift" : "push"](() => {
|
1492 |
+
S = g, t(10, S);
|
1493 |
});
|
1494 |
}
|
1495 |
function Ae() {
|
|
|
1497 |
}
|
1498 |
function w(g) {
|
1499 |
qt[g ? "unshift" : "push"](() => {
|
1500 |
+
S = g, t(10, S);
|
1501 |
});
|
1502 |
}
|
1503 |
function pl() {
|
1504 |
y = this.textContent, d = this.innerHTML, t(11, y), t(12, d);
|
1505 |
}
|
1506 |
return l.$$set = (g) => {
|
1507 |
+
"value" in g && t(18, i = g.value), "value_is_output" in g && t(19, o = g.value_is_output), "label" in g && t(0, s = g.label), "legend_label" in g && t(1, f = g.legend_label), "info" in g && t(2, a = g.info), "show_label" in g && t(3, _ = g.show_label), "show_legend" in g && t(4, r = g.show_legend), "show_legend_label" in g && t(5, u = g.show_legend_label), "container" in g && t(6, c = g.container), "color_map" in g && t(20, m = g.color_map), "show_copy_button" in g && t(7, k = g.show_copy_button), "show_remove_tags_button" in g && t(8, L = g.show_remove_tags_button), "disabled" in g && t(9, T = g.disabled);
|
1508 |
}, E(), O(!0), [
|
1509 |
s,
|
1510 |
f,
|
|
|
1515 |
c,
|
1516 |
k,
|
1517 |
L,
|
|
|
1518 |
T,
|
1519 |
+
S,
|
1520 |
y,
|
1521 |
d,
|
1522 |
h,
|
|
|
1779 |
}
|
1780 |
};
|
1781 |
}
|
1782 |
+
function Si(l) {
|
1783 |
let e, t = (
|
1784 |
/*tag*/
|
1785 |
l[14] && qi(l)
|
|
|
1806 |
}
|
1807 |
};
|
1808 |
}
|
1809 |
+
function Ti(l, e, t) {
|
1810 |
+
let { $$slots: n = {}, $$scope: i } = e, { height: o = void 0 } = e, { width: s = void 0 } = e, { elem_id: f = "" } = e, { elem_classes: a = [] } = e, { variant: _ = "solid" } = e, { border_mode: r = "base" } = e, { padding: u = !0 } = e, { type: c = "normal" } = e, { test_id: m = void 0 } = e, { explicit_call: k = !1 } = e, { container: L = !0 } = e, { visible: T = !0 } = e, { allow_overflow: S = !0 } = e, { scale: y = null } = e, { min_width: d = 0 } = e, C = c === "fieldset" ? "fieldset" : "div";
|
1811 |
const j = (h) => {
|
1812 |
if (h !== void 0) {
|
1813 |
if (typeof h == "number")
|
|
|
1817 |
}
|
1818 |
};
|
1819 |
return l.$$set = (h) => {
|
1820 |
+
"height" in h && t(0, o = h.height), "width" in h && t(1, s = h.width), "elem_id" in h && t(2, f = h.elem_id), "elem_classes" in h && t(3, a = h.elem_classes), "variant" in h && t(4, _ = h.variant), "border_mode" in h && t(5, r = h.border_mode), "padding" in h && t(6, u = h.padding), "type" in h && t(16, c = h.type), "test_id" in h && t(7, m = h.test_id), "explicit_call" in h && t(8, k = h.explicit_call), "container" in h && t(9, L = h.container), "visible" in h && t(10, T = h.visible), "allow_overflow" in h && t(11, S = h.allow_overflow), "scale" in h && t(12, y = h.scale), "min_width" in h && t(13, d = h.min_width), "$$scope" in h && t(17, i = h.$$scope);
|
1821 |
}, [
|
1822 |
o,
|
1823 |
s,
|
|
|
1829 |
m,
|
1830 |
k,
|
1831 |
L,
|
|
|
1832 |
T,
|
1833 |
+
S,
|
1834 |
y,
|
1835 |
d,
|
1836 |
C,
|
|
|
1842 |
}
|
1843 |
class Li extends ci {
|
1844 |
constructor(e) {
|
1845 |
+
super(), pi(this, e, Ti, Si, yi, {
|
1846 |
height: 0,
|
1847 |
width: 1,
|
1848 |
elem_id: 2,
|
|
|
1960 |
destroy_each: wl,
|
1961 |
detach: v,
|
1962 |
element: $,
|
1963 |
+
empty: Te,
|
1964 |
ensure_array_like: Be,
|
1965 |
get_all_dirty_from_scope: Ai,
|
1966 |
get_slot_changes: Wi,
|
|
|
1976 |
text: H,
|
1977 |
toggle_class: B,
|
1978 |
transition_in: qe,
|
1979 |
+
transition_out: Se,
|
1980 |
update_slot_base: Yi
|
1981 |
} = window.__gradio__svelte__internal, { tick: Gi } = window.__gradio__svelte__internal, { onDestroy: Ji } = window.__gradio__svelte__internal, Ki = (l) => ({}), Dt = (l) => ({});
|
1982 |
function Bt(l, e, t) {
|
|
|
2036 |
o || (qe(f, a), o = !0);
|
2037 |
},
|
2038 |
o(a) {
|
2039 |
+
Se(f, a), o = !1;
|
2040 |
},
|
2041 |
d(a) {
|
2042 |
a && (v(e), v(i)), f && f.d(a);
|
|
|
2073 |
/*timer*/
|
2074 |
l[5] && Wt(l)
|
2075 |
);
|
2076 |
+
const L = [oo, io], T = [];
|
2077 |
+
function S(d, C) {
|
2078 |
return (
|
2079 |
/*last_progress_level*/
|
2080 |
d[15] != null ? 0 : (
|
|
|
2083 |
)
|
2084 |
);
|
2085 |
}
|
2086 |
+
~(o = S(l)) && (s = T[o] = L[o](l));
|
2087 |
let y = !/*timer*/
|
2088 |
l[5] && Kt(l);
|
2089 |
return {
|
2090 |
c() {
|
2091 |
+
r && r.c(), e = G(), t = $("div"), m && m.c(), n = G(), k && k.c(), i = G(), s && s.c(), f = G(), y && y.c(), a = Te(), Y(t, "class", "progress-text svelte-1txqlrd"), B(
|
2092 |
t,
|
2093 |
"meta-text-center",
|
2094 |
/*variant*/
|
|
|
2101 |
);
|
2102 |
},
|
2103 |
m(d, C) {
|
2104 |
+
r && r.m(d, C), p(d, e, C), p(d, t, C), m && m.m(t, null), ce(t, n), k && k.m(t, null), p(d, i, C), ~o && T[o].m(d, C), p(d, f, C), y && y.m(d, C), p(d, a, C), _ = !0;
|
2105 |
},
|
2106 |
p(d, C) {
|
2107 |
/*variant*/
|
|
|
2122 |
d[8] === "default"
|
2123 |
);
|
2124 |
let j = o;
|
2125 |
+
o = S(d), o === j ? ~o && T[o].p(d, C) : (s && (vl(), Se(T[j], 1, 1, () => {
|
2126 |
+
T[j] = null;
|
2127 |
+
}), bl()), ~o ? (s = T[o], s ? s.p(d, C) : (s = T[o] = L[o](d), s.c()), qe(s, 1), s.m(f.parentNode, f)) : s = null), /*timer*/
|
2128 |
d[5] ? y && (y.d(1), y = null) : y ? y.p(d, C) : (y = Kt(d), y.c(), y.m(a.parentNode, a));
|
2129 |
},
|
2130 |
i(d) {
|
2131 |
_ || (qe(s), _ = !0);
|
2132 |
},
|
2133 |
o(d) {
|
2134 |
+
Se(s), _ = !1;
|
2135 |
},
|
2136 |
d(d) {
|
2137 |
+
d && (v(e), v(t), v(i), v(f), v(a)), r && r.d(d), m && m.d(), k && k.d(), ~o && T[o].d(d), y && y.d(d);
|
2138 |
}
|
2139 |
};
|
2140 |
}
|
|
|
2214 |
c() {
|
2215 |
for (let i = 0; i < n.length; i += 1)
|
2216 |
n[i].c();
|
2217 |
+
e = Te();
|
2218 |
},
|
2219 |
m(i, o) {
|
2220 |
for (let s = 0; s < n.length; s += 1)
|
|
|
2334 |
);
|
2335 |
return {
|
2336 |
c() {
|
2337 |
+
t && t.c(), e = Te();
|
2338 |
},
|
2339 |
m(n, i) {
|
2340 |
t && t.m(n, i), p(n, e, i);
|
|
|
2404 |
t || (qe(e.$$.fragment, n), t = !0);
|
2405 |
},
|
2406 |
o(n) {
|
2407 |
+
Se(e.$$.fragment, n), t = !1;
|
2408 |
},
|
2409 |
d(n) {
|
2410 |
Oi(e, n);
|
|
|
2448 |
c() {
|
2449 |
for (let i = 0; i < n.length; i += 1)
|
2450 |
n[i].c();
|
2451 |
+
e = Te();
|
2452 |
},
|
2453 |
m(i, o) {
|
2454 |
for (let s = 0; s < n.length; s += 1)
|
|
|
2498 |
);
|
2499 |
return {
|
2500 |
c() {
|
2501 |
+
o && o.c(), e = G(), s && s.c(), t = G(), f && f.c(), n = G(), a && a.c(), i = Te();
|
2502 |
},
|
2503 |
m(_, r) {
|
2504 |
o && o.m(_, r), p(_, e, r), s && s.m(_, r), p(_, t, r), f && f.m(_, r), p(_, n, r), a && a.m(_, r), p(_, i, r);
|
|
|
2607 |
);
|
2608 |
return {
|
2609 |
c() {
|
2610 |
+
t && t.c(), e = Te();
|
2611 |
},
|
2612 |
m(n, i) {
|
2613 |
t && t.m(n, i), p(n, e, i);
|
|
|
2706 |
},
|
2707 |
p(_, r) {
|
2708 |
let u = t;
|
2709 |
+
t = a(_), t === u ? ~t && f[t].p(_, r) : (n && (vl(), Se(f[u], 1, 1, () => {
|
2710 |
f[u] = null;
|
2711 |
}), bl()), ~t ? (n = f[t], n ? n.p(_, r) : (n = f[t] = s[t](_), n.c()), qe(n, 1), n.m(e, null)) : n = null), (!o || r[0] & /*variant, show_progress*/
|
2712 |
320 && i !== (i = "wrap " + /*variant*/
|
|
|
2755 |
o || (qe(n), o = !0);
|
2756 |
},
|
2757 |
o(_) {
|
2758 |
+
Se(n), o = !1;
|
2759 |
},
|
2760 |
d(_) {
|
2761 |
_ && v(e), ~t && f[t].d(), l[31](null);
|
|
|
2780 |
}
|
2781 |
}
|
2782 |
function ao(l, e, t) {
|
2783 |
+
let n, { $$slots: i = {}, $$scope: o } = e, { i18n: s } = e, { eta: f = null } = e, { queue_position: a } = e, { queue_size: _ } = e, { status: r } = e, { scroll_to_output: u = !1 } = e, { timer: c = !0 } = e, { show_progress: m = "full" } = e, { message: k = null } = e, { progress: L = null } = e, { variant: T = "default" } = e, { loading_text: S = "Loading..." } = e, { absolute: y = !0 } = e, { translucent: d = !1 } = e, { border: C = !1 } = e, { autoscroll: j } = e, h, Z = !1, J = 0, E = 0, O = null, R = null, ae = 0, A = null, K, D = null, me = !0;
|
2784 |
const Le = () => {
|
2785 |
t(0, f = t(26, O = t(19, he = null))), t(24, J = performance.now()), t(25, E = 0), Z = !0, ge();
|
2786 |
};
|
|
|
2807 |
});
|
2808 |
}
|
2809 |
return l.$$set = (w) => {
|
2810 |
+
"i18n" in w && t(1, s = w.i18n), "eta" in w && t(0, f = w.eta), "queue_position" in w && t(2, a = w.queue_position), "queue_size" in w && t(3, _ = w.queue_size), "status" in w && t(4, r = w.status), "scroll_to_output" in w && t(21, u = w.scroll_to_output), "timer" in w && t(5, c = w.timer), "show_progress" in w && t(6, m = w.show_progress), "message" in w && t(22, k = w.message), "progress" in w && t(7, L = w.progress), "variant" in w && t(8, T = w.variant), "loading_text" in w && t(9, S = w.loading_text), "absolute" in w && t(10, y = w.absolute), "translucent" in w && t(11, d = w.translucent), "border" in w && t(12, C = w.border), "autoscroll" in w && t(23, j = w.autoscroll), "$$scope" in w && t(28, o = w.$$scope);
|
2811 |
}, l.$$.update = () => {
|
2812 |
l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
|
2813 |
218103809 && (f === null && t(0, f = O), f != null && O !== f && (t(27, R = (performance.now() - J) / 1e3 + f), t(19, he = R.toFixed(1)), t(26, O = f))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/
|
|
|
2832 |
c,
|
2833 |
m,
|
2834 |
L,
|
|
|
2835 |
T,
|
2836 |
+
S,
|
2837 |
y,
|
2838 |
d,
|
2839 |
C,
|
|
|
3177 |
}
|
3178 |
};
|
3179 |
}
|
3180 |
+
function So(l, e, t) {
|
3181 |
+
let { gradio: n } = e, { label: i = "Highlighted Textbox" } = e, { legend_label: o = "Highlights:" } = e, { info: s = void 0 } = e, { elem_id: f = "" } = e, { elem_classes: a = [] } = e, { visible: _ = !0 } = e, { value: r } = e, { show_label: u } = e, { show_legend: c } = e, { show_legend_label: m } = e, { color_map: k = {} } = e, { container: L = !0 } = e, { scale: T = null } = e, { min_width: S = void 0 } = e, { show_copy_button: y = !1 } = e, { show_remove_tags_button: d = !1 } = e, { loading_status: C = void 0 } = e, { value_is_output: j = !1 } = e, { combine_adjacent: h = !1 } = e, { interactive: Z = !0 } = e;
|
3182 |
const J = !1, E = !0;
|
3183 |
function O(b) {
|
3184 |
r = b, t(0, r), t(20, h);
|
|
|
3190 |
console.log("test"), n.dispatch("clear");
|
3191 |
};
|
3192 |
return l.$$set = (b) => {
|
3193 |
+
"gradio" in b && t(3, n = b.gradio), "label" in b && t(4, i = b.label), "legend_label" in b && t(5, o = b.legend_label), "info" in b && t(6, s = b.info), "elem_id" in b && t(7, f = b.elem_id), "elem_classes" in b && t(8, a = b.elem_classes), "visible" in b && t(9, _ = b.visible), "value" in b && t(0, r = b.value), "show_label" in b && t(10, u = b.show_label), "show_legend" in b && t(11, c = b.show_legend), "show_legend_label" in b && t(12, m = b.show_legend_label), "color_map" in b && t(1, k = b.color_map), "container" in b && t(13, L = b.container), "scale" in b && t(14, T = b.scale), "min_width" in b && t(15, S = b.min_width), "show_copy_button" in b && t(16, y = b.show_copy_button), "show_remove_tags_button" in b && t(17, d = b.show_remove_tags_button), "loading_status" in b && t(18, C = b.loading_status), "value_is_output" in b && t(2, j = b.value_is_output), "combine_adjacent" in b && t(20, h = b.combine_adjacent), "interactive" in b && t(19, Z = b.interactive);
|
3194 |
}, l.$$.update = () => {
|
3195 |
l.$$.dirty[0] & /*color_map*/
|
3196 |
2 && !k && Object.keys(k).length && t(1, k), l.$$.dirty[0] & /*value, combine_adjacent*/
|
|
|
3210 |
c,
|
3211 |
m,
|
3212 |
L,
|
|
|
3213 |
T,
|
3214 |
+
S,
|
3215 |
y,
|
3216 |
d,
|
3217 |
C,
|
|
|
3230 |
ge
|
3231 |
];
|
3232 |
}
|
3233 |
+
class To extends uo {
|
3234 |
constructor(e) {
|
3235 |
super(), vo(
|
3236 |
this,
|
3237 |
e,
|
3238 |
+
So,
|
3239 |
qo,
|
3240 |
ko,
|
3241 |
{
|
|
|
3401 |
}
|
3402 |
}
|
3403 |
export {
|
3404 |
+
To as default
|
3405 |
};
|
src/demo/space.py
CHANGED
@@ -169,6 +169,11 @@ Highlights will disappear if the highlighted text is edited. Modals will appear
|
|
169 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Remove tags")],
|
170 |
outputs=None,
|
171 |
)
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
if __name__ == "__main__":
|
174 |
demo.launch()
|
|
|
169 |
inputs=[high, tag_id, tag_open, tag_close, gr.State("Remove tags")],
|
170 |
outputs=None,
|
171 |
)
|
172 |
+
high.change(
|
173 |
+
fn=show_info,
|
174 |
+
inputs=[high, tag_id, tag_open, tag_close, gr.State("Change")],
|
175 |
+
outputs=None,
|
176 |
+
)
|
177 |
|
178 |
if __name__ == "__main__":
|
179 |
demo.launch()
|
src/frontend/HighlightedTextbox.svelte
CHANGED
@@ -184,7 +184,7 @@
|
|
184 |
{show_copy_button}
|
185 |
show_remove_tags_button={show_remove_tags_button && !tags_removed}
|
186 |
value={tagged_text}
|
187 |
-
on:
|
188 |
/>
|
189 |
{#if disabled}
|
190 |
<div
|
|
|
184 |
{show_copy_button}
|
185 |
show_remove_tags_button={show_remove_tags_button && !tags_removed}
|
186 |
value={tagged_text}
|
187 |
+
on:clear={handle_remove_tags}
|
188 |
/>
|
189 |
{#if disabled}
|
190 |
<div
|
src/frontend/RemoveTags.svelte
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<script lang="ts">
|
2 |
-
import { fade } from "svelte/transition";
|
3 |
import { Check } from "@gradio/icons";
|
4 |
import { createEventDispatcher } from 'svelte';
|
5 |
|
@@ -7,7 +6,7 @@
|
|
7 |
</script>
|
8 |
|
9 |
<button
|
10 |
-
on:click={() => dispatch('
|
11 |
title="Remove highlights"
|
12 |
aria-roledescription="Remove highlights"
|
13 |
aria-label="Remove highlights"
|
|
|
1 |
<script lang="ts">
|
|
|
2 |
import { Check } from "@gradio/icons";
|
3 |
import { createEventDispatcher } from 'svelte';
|
4 |
|
|
|
6 |
</script>
|
7 |
|
8 |
<button
|
9 |
+
on:click={() => dispatch('clear')}
|
10 |
title="Remove highlights"
|
11 |
aria-roledescription="Remove highlights"
|
12 |
aria-label="Remove highlights"
|
src/frontend/Widgets.svelte
CHANGED
@@ -6,17 +6,13 @@
|
|
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:
|
20 |
{/if}
|
21 |
{#if show_copy_button}
|
22 |
<Copy {value} />
|
|
|
6 |
export let value: string;
|
7 |
export let show_copy_button: boolean = false;
|
8 |
export let show_remove_tags_button: boolean = false;
|
|
|
9 |
const dispatch = createEventDispatcher()
|
10 |
|
|
|
|
|
|
|
11 |
</script>
|
12 |
|
13 |
<div>
|
14 |
{#if show_remove_tags_button}
|
15 |
+
<RemoveTags on:clear={() => dispatch("clear")}/>
|
16 |
{/if}
|
17 |
{#if show_copy_button}
|
18 |
<Copy {value} />
|
src/pyproject.toml
CHANGED
@@ -8,7 +8,7 @@ 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 = "MIT"
|
@@ -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", "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.10"
|
12 |
description = "Editable Gradio textarea supporting highlighting"
|
13 |
readme = "README.md"
|
14 |
license = "MIT"
|
|
|
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", "backend/gradio_highlightedtextbox/templates", "backend/gradio_highlightedtextbox/templates"]
|
43 |
|
44 |
[tool.hatch.build.targets.wheel]
|
45 |
packages = ["/backend/gradio_highlightedtextbox"]
|