LennardZuendorf commited on
Commit
50bb1bc
1 Parent(s): 46f5fbc

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,9 +1,9 @@
1
 
2
  ---
3
  tags: [gradio-custom-component,gradio-template-HTML,HTML,iFrame]
4
- title: gradio_iframe V0.0.4
5
- colorFrom: gray
6
- colorTo: red
7
  sdk: docker
8
  pinned: false
9
  license: apache-2.0
 
1
 
2
  ---
3
  tags: [gradio-custom-component,gradio-template-HTML,HTML,iFrame]
4
+ title: gradio_iframe V0.0.9
5
+ colorFrom: red
6
+ colorTo: indigo
7
  sdk: docker
8
  pinned: false
9
  license: apache-2.0
__pycache__/__init__.cpython-311.pyc CHANGED
Binary files a/__pycache__/__init__.cpython-311.pyc and b/__pycache__/__init__.cpython-311.pyc differ
 
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -8,7 +8,7 @@ example = iFrame().example_inputs()
8
  with gr.Blocks() as demo:
9
  with gr.Row():
10
  iFrame(label="Blank"), # blank component
11
- iFrame(value=example, label="Populated"), # populated component
12
 
13
 
14
  demo.launch()
 
8
  with gr.Blocks() as demo:
9
  with gr.Row():
10
  iFrame(label="Blank"), # blank component
11
+ iFrame(value=example, label="Populated", height="1000px"), # populated component
12
 
13
 
14
  demo.launch()
requirements.txt CHANGED
@@ -1 +1 @@
1
- gradio_iframe-0.0.4-py3-none-any.whl
 
1
+ gradio_iframe-0.0.9-py3-none-any.whl
src/backend/gradio_iframe/templates/component/index.js CHANGED
@@ -93,10 +93,7 @@ function dt(n, t, e) {
93
  const m = () => {
94
  try {
95
  const c = _.contentDocument || _.contentWindow.document;
96
- if (a === "100%") {
97
- const v = c.documentElement.scrollHeight;
98
- e(6, _.style.height = `${v}px`, _);
99
- }
100
  } catch (c) {
101
  console.error("Error accessing iframe content:", c);
102
  }
@@ -148,7 +145,7 @@ function bt(n, t) {
148
  return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
149
  }
150
  const Re = typeof window < "u";
151
- let ke = Re ? () => window.performance.now() : () => Date.now(), Ue = Re ? (n) => requestAnimationFrame(n) : te;
152
  const O = /* @__PURE__ */ new Set();
153
  function We(n) {
154
  O.forEach((t) => {
@@ -193,13 +190,13 @@ function ht(n, t = te) {
193
  }
194
  return { set: i, update: s, subscribe: o };
195
  }
196
- function ye(n) {
197
  return Object.prototype.toString.call(n) === "[object Date]";
198
  }
199
  function se(n, t, e, l) {
200
- if (typeof e == "number" || ye(e)) {
201
  const i = l - e, s = (e - t) / (n.dt || 1 / 60), o = n.opts.stiffness * i, a = n.opts.damping * s, r = (o - a) * n.inv_mass, f = (s + r) * n.dt;
202
- return Math.abs(f) < n.opts.precision && Math.abs(i) < n.opts.precision ? l : (n.settled = !1, ye(e) ? new Date(e.getTime() + f) : e + f);
203
  } else {
204
  if (Array.isArray(e))
205
  return e.map(
@@ -217,20 +214,20 @@ function se(n, t, e, l) {
217
  function pe(n, t = {}) {
218
  const e = ht(n), { stiffness: l = 0.15, damping: i = 0.8, precision: s = 0.01 } = t;
219
  let o, a, r, f = n, _ = n, m = 1, b = 0, c = !1;
220
- function v(p, L = {}) {
221
  _ = p;
222
  const F = r = {};
223
- return n == null || L.hard || C.stiffness >= 1 && C.damping >= 1 ? (c = !0, o = ke(), f = p, e.set(n = _), Promise.resolve()) : (L.soft && (b = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), m = 0), a || (o = ke(), c = !1, a = gt((u) => {
224
  if (c)
225
  return c = !1, a = null, !1;
226
  m = Math.min(m + b, 1);
227
- const y = {
228
  inv_mass: m,
229
  opts: C,
230
  settled: !0,
231
  dt: (u - o) * 60 / 1e3
232
- }, g = se(y, f, n, _);
233
- return o = u, f = n, e.set(n = g), y.settled && (a = null), !y.settled;
234
  })), new Promise((u) => {
235
  a.promise.then(() => {
236
  F === r && u();
@@ -238,8 +235,8 @@ function pe(n, t = {}) {
238
  }));
239
  }
240
  const C = {
241
- set: v,
242
- update: (p, L) => v(p(_, n), L),
243
  subscribe: e.subscribe,
244
  stiffness: l,
245
  damping: i,
@@ -250,11 +247,11 @@ function pe(n, t = {}) {
250
  const {
251
  SvelteComponent: wt,
252
  append: N,
253
- attr: k,
254
  component_subscribe: qe,
255
  detach: vt,
256
- element: kt,
257
- init: yt,
258
  insert: pt,
259
  noop: Fe,
260
  safe_not_equal: qt,
@@ -266,28 +263,28 @@ function Lt(n) {
266
  let t, e, l, i, s, o, a, r, f, _, m, b;
267
  return {
268
  c() {
269
- t = kt("div"), e = z("svg"), l = z("g"), i = z("path"), s = z("path"), o = z("path"), a = z("path"), r = z("g"), f = z("path"), _ = z("path"), m = z("path"), b = z("path"), k(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), k(i, "fill", "#FF7C00"), k(i, "fill-opacity", "0.4"), k(i, "class", "svelte-43sxxs"), k(s, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), k(s, "fill", "#FF7C00"), k(s, "class", "svelte-43sxxs"), k(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), k(o, "fill", "#FF7C00"), k(o, "fill-opacity", "0.4"), k(o, "class", "svelte-43sxxs"), k(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), k(a, "fill", "#FF7C00"), k(a, "class", "svelte-43sxxs"), $(l, "transform", "translate(" + /*$top*/
270
  n[1][0] + "px, " + /*$top*/
271
- n[1][1] + "px)"), k(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), k(f, "fill", "#FF7C00"), k(f, "fill-opacity", "0.4"), k(f, "class", "svelte-43sxxs"), k(_, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), k(_, "fill", "#FF7C00"), k(_, "class", "svelte-43sxxs"), k(m, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), k(m, "fill", "#FF7C00"), k(m, "fill-opacity", "0.4"), k(m, "class", "svelte-43sxxs"), k(b, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), k(b, "fill", "#FF7C00"), k(b, "class", "svelte-43sxxs"), $(r, "transform", "translate(" + /*$bottom*/
272
  n[2][0] + "px, " + /*$bottom*/
273
- n[2][1] + "px)"), k(e, "viewBox", "-1200 -1200 3000 3000"), k(e, "fill", "none"), k(e, "xmlns", "http://www.w3.org/2000/svg"), k(e, "class", "svelte-43sxxs"), k(t, "class", "svelte-43sxxs"), Le(
274
  t,
275
  "margin",
276
  /*margin*/
277
  n[0]
278
  );
279
  },
280
- m(c, v) {
281
- pt(c, t, v), N(t, e), N(e, l), N(l, i), N(l, s), N(l, o), N(l, a), N(e, r), N(r, f), N(r, _), N(r, m), N(r, b);
282
  },
283
- p(c, [v]) {
284
- v & /*$top*/
285
  2 && $(l, "transform", "translate(" + /*$top*/
286
  c[1][0] + "px, " + /*$top*/
287
- c[1][1] + "px)"), v & /*$bottom*/
288
  4 && $(r, "transform", "translate(" + /*$bottom*/
289
  c[2][0] + "px, " + /*$bottom*/
290
- c[2][1] + "px)"), v & /*margin*/
291
  1 && Le(
292
  t,
293
  "margin",
@@ -324,7 +321,7 @@ function Ct(n, t, e) {
324
  }
325
  class Mt extends wt {
326
  constructor(t) {
327
- super(), yt(this, t, Ct, Lt, qt, { margin: 0 });
328
  }
329
  }
330
  const {
@@ -429,7 +426,7 @@ function Xt(n) {
429
  n[18] && /*show_progress*/
430
  n[6] === "full" && Ne(n)
431
  );
432
- function m(u, y) {
433
  if (
434
  /*progress*/
435
  u[7]
@@ -448,12 +445,12 @@ function Xt(n) {
448
  )
449
  return Yt;
450
  }
451
- let b = m(n), c = b && b(n), v = (
452
  /*timer*/
453
  n[5] && je(n)
454
  );
455
  const C = [Jt, Wt], p = [];
456
- function L(u, y) {
457
  return (
458
  /*last_progress_level*/
459
  u[15] != null ? 0 : (
@@ -467,7 +464,7 @@ function Xt(n) {
467
  n[5] && Ie(n);
468
  return {
469
  c() {
470
- _ && _.c(), t = j(), e = P("div"), c && c.c(), l = j(), v && v.c(), i = j(), o && o.c(), a = j(), F && F.c(), r = W(), T(e, "class", "progress-text svelte-1txqlrd"), V(
471
  e,
472
  "meta-text-center",
473
  /*variant*/
@@ -479,21 +476,21 @@ function Xt(n) {
479
  n[8] === "default"
480
  );
481
  },
482
- m(u, y) {
483
- _ && _.m(u, y), w(u, t, y), w(u, e, y), c && c.m(e, null), H(e, l), v && v.m(e, null), w(u, i, y), ~s && p[s].m(u, y), w(u, a, y), F && F.m(u, y), w(u, r, y), f = !0;
484
  },
485
- p(u, y) {
486
  /*variant*/
487
  u[8] === "default" && /*show_eta_bar*/
488
  u[18] && /*show_progress*/
489
- u[6] === "full" ? _ ? _.p(u, y) : (_ = Ne(u), _.c(), _.m(t.parentNode, t)) : _ && (_.d(1), _ = null), b === (b = m(u)) && c ? c.p(u, y) : (c && c.d(1), c = b && b(u), c && (c.c(), c.m(e, l))), /*timer*/
490
- u[5] ? v ? v.p(u, y) : (v = je(u), v.c(), v.m(e, null)) : v && (v.d(1), v = null), (!f || y[0] & /*variant*/
491
  256) && V(
492
  e,
493
  "meta-text-center",
494
  /*variant*/
495
  u[8] === "center"
496
- ), (!f || y[0] & /*variant*/
497
  256) && V(
498
  e,
499
  "meta-text",
@@ -501,10 +498,10 @@ function Xt(n) {
501
  u[8] === "default"
502
  );
503
  let g = s;
504
- s = L(u), s === g ? ~s && p[s].p(u, y) : (o && (Qe(), U(p[g], 1, 1, () => {
505
  p[g] = null;
506
- }), Je()), ~s ? (o = p[s], o ? o.p(u, y) : (o = p[s] = C[s](u), o.c()), R(o, 1), o.m(a.parentNode, a)) : o = null), /*timer*/
507
- u[5] ? F && (F.d(1), F = null) : F ? F.p(u, y) : (F = Ie(u), F.c(), F.m(r.parentNode, r));
508
  },
509
  i(u) {
510
  f || (R(o), f = !0);
@@ -513,7 +510,7 @@ function Xt(n) {
513
  U(o), f = !1;
514
  },
515
  d(u) {
516
- u && (h(t), h(e), h(i), h(a), h(r)), _ && _.d(u), c && c.d(), v && v.d(), ~s && p[s].d(u), F && F.d(u);
517
  }
518
  };
519
  }
@@ -1159,7 +1156,7 @@ async function xt(n, t = !0) {
1159
  }
1160
  }
1161
  function $t(n, t, e) {
1162
- let l, { $$slots: i = {}, $$scope: s } = t, { i18n: o } = t, { eta: a = null } = t, { queue: r = !1 } = t, { queue_position: f } = t, { queue_size: _ } = t, { status: m } = t, { scroll_to_output: b = !1 } = t, { timer: c = !0 } = t, { show_progress: v = "full" } = t, { message: C = null } = t, { progress: p = null } = t, { variant: L = "default" } = t, { loading_text: F = "Loading..." } = t, { absolute: u = !0 } = t, { translucent: y = !1 } = t, { border: g = !1 } = t, { autoscroll: ne } = t, J, K = !1, x = 0, A = 0, ie = null, de = 0, I = null, Q, Z = null, me = !0;
1163
  const et = () => {
1164
  e(25, x = performance.now()), e(26, A = 0), K = !0, be();
1165
  };
@@ -1186,7 +1183,7 @@ function $t(n, t, e) {
1186
  });
1187
  }
1188
  return n.$$set = (d) => {
1189
- "i18n" in d && e(1, o = d.i18n), "eta" in d && e(0, a = d.eta), "queue" in d && e(21, r = d.queue), "queue_position" in d && e(2, f = d.queue_position), "queue_size" in d && e(3, _ = d.queue_size), "status" in d && e(4, m = d.status), "scroll_to_output" in d && e(22, b = d.scroll_to_output), "timer" in d && e(5, c = d.timer), "show_progress" in d && e(6, v = d.show_progress), "message" in d && e(23, C = d.message), "progress" in d && e(7, p = d.progress), "variant" in d && e(8, L = d.variant), "loading_text" in d && e(9, F = d.loading_text), "absolute" in d && e(10, u = d.absolute), "translucent" in d && e(11, y = d.translucent), "border" in d && e(12, g = d.border), "autoscroll" in d && e(24, ne = d.autoscroll), "$$scope" in d && e(28, s = d.$$scope);
1190
  }, n.$$.update = () => {
1191
  n.$$.dirty[0] & /*eta, old_eta, queue, timer_start*/
1192
  169869313 && (a === null ? e(0, a = ie) : r && e(0, a = (performance.now() - x) / 1e3 + a), a != null && (e(19, he = a.toFixed(1)), e(27, ie = a))), n.$$.dirty[0] & /*eta, timer_diff*/
@@ -1209,12 +1206,12 @@ function $t(n, t, e) {
1209
  _,
1210
  m,
1211
  c,
1212
- v,
1213
  p,
1214
  L,
1215
  F,
1216
  u,
1217
- y,
1218
  g,
1219
  J,
1220
  I,
@@ -1490,9 +1487,9 @@ function ml(n) {
1490
  };
1491
  }
1492
  function bl(n, t, e) {
1493
- let { $$slots: l = {}, $$scope: i } = t, { height: s = void 0 } = t, { width: o = void 0 } = t, { elem_id: a = "" } = t, { elem_classes: r = [] } = t, { variant: f = "solid" } = t, { border_mode: _ = "base" } = t, { padding: m = !0 } = t, { type: b = "normal" } = t, { test_id: c = void 0 } = t, { explicit_call: v = !1 } = t, { container: C = !0 } = t, { visible: p = !0 } = t, { allow_overflow: L = !0 } = t, { scale: F = null } = t, { min_width: u = 0 } = t, y = b === "fieldset" ? "fieldset" : "div";
1494
  return n.$$set = (g) => {
1495
- "height" in g && e(0, s = g.height), "width" in g && e(1, o = g.width), "elem_id" in g && e(2, a = g.elem_id), "elem_classes" in g && e(3, r = g.elem_classes), "variant" in g && e(4, f = g.variant), "border_mode" in g && e(5, _ = g.border_mode), "padding" in g && e(6, m = g.padding), "type" in g && e(15, b = g.type), "test_id" in g && e(7, c = g.test_id), "explicit_call" in g && e(8, v = g.explicit_call), "container" in g && e(9, C = g.container), "visible" in g && e(10, p = g.visible), "allow_overflow" in g && e(11, L = g.allow_overflow), "scale" in g && e(12, F = g.scale), "min_width" in g && e(13, u = g.min_width), "$$scope" in g && e(16, i = g.$$scope);
1496
  }, [
1497
  s,
1498
  o,
@@ -1502,13 +1499,13 @@ function bl(n, t, e) {
1502
  _,
1503
  m,
1504
  c,
1505
- v,
1506
  C,
1507
  p,
1508
  L,
1509
  F,
1510
  u,
1511
- y,
1512
  b,
1513
  i,
1514
  l
@@ -1852,11 +1849,11 @@ hl.reduce(
1852
  const {
1853
  SvelteComponent: wl,
1854
  assign: vl,
1855
- attr: kl,
1856
  create_component: ae,
1857
  destroy_component: re,
1858
  detach: Ye,
1859
- element: yl,
1860
  get_spread_object: pl,
1861
  get_spread_update: ql,
1862
  init: Fl,
@@ -1922,7 +1919,7 @@ function Ml(n) {
1922
  ), {
1923
  c() {
1924
  var f;
1925
- ae(t.$$.fragment), e = Cl(), l = yl("div"), ae(i.$$.fragment), kl(l, "class", "svelte-gqsrr7"), Oe(
1926
  l,
1927
  "pending",
1928
  /*loading_status*/
@@ -1933,7 +1930,7 @@ function Ml(n) {
1933
  _e(t, f, _), Ge(f, e, _), Ge(f, l, _), _e(i, l, null), s = !0;
1934
  },
1935
  p(f, _) {
1936
- var c, v;
1937
  const m = _ & /*gradio, loading_status*/
1938
  192 ? ql(o, [
1939
  _ & /*gradio*/
@@ -1973,7 +1970,7 @@ function Ml(n) {
1973
  l,
1974
  "pending",
1975
  /*loading_status*/
1976
- ((v = f[6]) == null ? void 0 : v.status) === "pending"
1977
  );
1978
  },
1979
  i(f) {
 
93
  const m = () => {
94
  try {
95
  const c = _.contentDocument || _.contentWindow.document;
96
+ a === "100%" ? e(6, _.style.height = `${c.documentElement.scrollHeight}px`, _) : e(6, _.style.height = a, _);
 
 
 
97
  } catch (c) {
98
  console.error("Error accessing iframe content:", c);
99
  }
 
145
  return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
146
  }
147
  const Re = typeof window < "u";
148
+ let ye = Re ? () => window.performance.now() : () => Date.now(), Ue = Re ? (n) => requestAnimationFrame(n) : te;
149
  const O = /* @__PURE__ */ new Set();
150
  function We(n) {
151
  O.forEach((t) => {
 
190
  }
191
  return { set: i, update: s, subscribe: o };
192
  }
193
+ function ke(n) {
194
  return Object.prototype.toString.call(n) === "[object Date]";
195
  }
196
  function se(n, t, e, l) {
197
+ if (typeof e == "number" || ke(e)) {
198
  const i = l - e, s = (e - t) / (n.dt || 1 / 60), o = n.opts.stiffness * i, a = n.opts.damping * s, r = (o - a) * n.inv_mass, f = (s + r) * n.dt;
199
+ return Math.abs(f) < n.opts.precision && Math.abs(i) < n.opts.precision ? l : (n.settled = !1, ke(e) ? new Date(e.getTime() + f) : e + f);
200
  } else {
201
  if (Array.isArray(e))
202
  return e.map(
 
214
  function pe(n, t = {}) {
215
  const e = ht(n), { stiffness: l = 0.15, damping: i = 0.8, precision: s = 0.01 } = t;
216
  let o, a, r, f = n, _ = n, m = 1, b = 0, c = !1;
217
+ function y(p, L = {}) {
218
  _ = p;
219
  const F = r = {};
220
+ return n == null || L.hard || C.stiffness >= 1 && C.damping >= 1 ? (c = !0, o = ye(), f = p, e.set(n = _), Promise.resolve()) : (L.soft && (b = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), m = 0), a || (o = ye(), c = !1, a = gt((u) => {
221
  if (c)
222
  return c = !1, a = null, !1;
223
  m = Math.min(m + b, 1);
224
+ const k = {
225
  inv_mass: m,
226
  opts: C,
227
  settled: !0,
228
  dt: (u - o) * 60 / 1e3
229
+ }, g = se(k, f, n, _);
230
+ return o = u, f = n, e.set(n = g), k.settled && (a = null), !k.settled;
231
  })), new Promise((u) => {
232
  a.promise.then(() => {
233
  F === r && u();
 
235
  }));
236
  }
237
  const C = {
238
+ set: y,
239
+ update: (p, L) => y(p(_, n), L),
240
  subscribe: e.subscribe,
241
  stiffness: l,
242
  damping: i,
 
247
  const {
248
  SvelteComponent: wt,
249
  append: N,
250
+ attr: v,
251
  component_subscribe: qe,
252
  detach: vt,
253
+ element: yt,
254
+ init: kt,
255
  insert: pt,
256
  noop: Fe,
257
  safe_not_equal: qt,
 
263
  let t, e, l, i, s, o, a, r, f, _, m, b;
264
  return {
265
  c() {
266
+ t = yt("div"), e = z("svg"), l = z("g"), i = z("path"), s = z("path"), o = z("path"), a = z("path"), r = z("g"), f = z("path"), _ = z("path"), m = z("path"), b = z("path"), v(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), v(i, "fill", "#FF7C00"), v(i, "fill-opacity", "0.4"), v(i, "class", "svelte-43sxxs"), v(s, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), v(s, "fill", "#FF7C00"), v(s, "class", "svelte-43sxxs"), v(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), v(o, "fill", "#FF7C00"), v(o, "fill-opacity", "0.4"), v(o, "class", "svelte-43sxxs"), v(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), v(a, "fill", "#FF7C00"), v(a, "class", "svelte-43sxxs"), $(l, "transform", "translate(" + /*$top*/
267
  n[1][0] + "px, " + /*$top*/
268
+ n[1][1] + "px)"), v(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), v(f, "fill", "#FF7C00"), v(f, "fill-opacity", "0.4"), v(f, "class", "svelte-43sxxs"), v(_, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), v(_, "fill", "#FF7C00"), v(_, "class", "svelte-43sxxs"), v(m, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), v(m, "fill", "#FF7C00"), v(m, "fill-opacity", "0.4"), v(m, "class", "svelte-43sxxs"), v(b, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), v(b, "fill", "#FF7C00"), v(b, "class", "svelte-43sxxs"), $(r, "transform", "translate(" + /*$bottom*/
269
  n[2][0] + "px, " + /*$bottom*/
270
+ n[2][1] + "px)"), v(e, "viewBox", "-1200 -1200 3000 3000"), v(e, "fill", "none"), v(e, "xmlns", "http://www.w3.org/2000/svg"), v(e, "class", "svelte-43sxxs"), v(t, "class", "svelte-43sxxs"), Le(
271
  t,
272
  "margin",
273
  /*margin*/
274
  n[0]
275
  );
276
  },
277
+ m(c, y) {
278
+ pt(c, t, y), N(t, e), N(e, l), N(l, i), N(l, s), N(l, o), N(l, a), N(e, r), N(r, f), N(r, _), N(r, m), N(r, b);
279
  },
280
+ p(c, [y]) {
281
+ y & /*$top*/
282
  2 && $(l, "transform", "translate(" + /*$top*/
283
  c[1][0] + "px, " + /*$top*/
284
+ c[1][1] + "px)"), y & /*$bottom*/
285
  4 && $(r, "transform", "translate(" + /*$bottom*/
286
  c[2][0] + "px, " + /*$bottom*/
287
+ c[2][1] + "px)"), y & /*margin*/
288
  1 && Le(
289
  t,
290
  "margin",
 
321
  }
322
  class Mt extends wt {
323
  constructor(t) {
324
+ super(), kt(this, t, Ct, Lt, qt, { margin: 0 });
325
  }
326
  }
327
  const {
 
426
  n[18] && /*show_progress*/
427
  n[6] === "full" && Ne(n)
428
  );
429
+ function m(u, k) {
430
  if (
431
  /*progress*/
432
  u[7]
 
445
  )
446
  return Yt;
447
  }
448
+ let b = m(n), c = b && b(n), y = (
449
  /*timer*/
450
  n[5] && je(n)
451
  );
452
  const C = [Jt, Wt], p = [];
453
+ function L(u, k) {
454
  return (
455
  /*last_progress_level*/
456
  u[15] != null ? 0 : (
 
464
  n[5] && Ie(n);
465
  return {
466
  c() {
467
+ _ && _.c(), t = j(), e = P("div"), c && c.c(), l = j(), y && y.c(), i = j(), o && o.c(), a = j(), F && F.c(), r = W(), T(e, "class", "progress-text svelte-1txqlrd"), V(
468
  e,
469
  "meta-text-center",
470
  /*variant*/
 
476
  n[8] === "default"
477
  );
478
  },
479
+ m(u, k) {
480
+ _ && _.m(u, k), w(u, t, k), w(u, e, k), c && c.m(e, null), H(e, l), y && y.m(e, null), w(u, i, k), ~s && p[s].m(u, k), w(u, a, k), F && F.m(u, k), w(u, r, k), f = !0;
481
  },
482
+ p(u, k) {
483
  /*variant*/
484
  u[8] === "default" && /*show_eta_bar*/
485
  u[18] && /*show_progress*/
486
+ u[6] === "full" ? _ ? _.p(u, k) : (_ = Ne(u), _.c(), _.m(t.parentNode, t)) : _ && (_.d(1), _ = null), b === (b = m(u)) && c ? c.p(u, k) : (c && c.d(1), c = b && b(u), c && (c.c(), c.m(e, l))), /*timer*/
487
+ u[5] ? y ? y.p(u, k) : (y = je(u), y.c(), y.m(e, null)) : y && (y.d(1), y = null), (!f || k[0] & /*variant*/
488
  256) && V(
489
  e,
490
  "meta-text-center",
491
  /*variant*/
492
  u[8] === "center"
493
+ ), (!f || k[0] & /*variant*/
494
  256) && V(
495
  e,
496
  "meta-text",
 
498
  u[8] === "default"
499
  );
500
  let g = s;
501
+ s = L(u), s === g ? ~s && p[s].p(u, k) : (o && (Qe(), U(p[g], 1, 1, () => {
502
  p[g] = null;
503
+ }), Je()), ~s ? (o = p[s], o ? o.p(u, k) : (o = p[s] = C[s](u), o.c()), R(o, 1), o.m(a.parentNode, a)) : o = null), /*timer*/
504
+ u[5] ? F && (F.d(1), F = null) : F ? F.p(u, k) : (F = Ie(u), F.c(), F.m(r.parentNode, r));
505
  },
506
  i(u) {
507
  f || (R(o), f = !0);
 
510
  U(o), f = !1;
511
  },
512
  d(u) {
513
+ u && (h(t), h(e), h(i), h(a), h(r)), _ && _.d(u), c && c.d(), y && y.d(), ~s && p[s].d(u), F && F.d(u);
514
  }
515
  };
516
  }
 
1156
  }
1157
  }
1158
  function $t(n, t, e) {
1159
+ let l, { $$slots: i = {}, $$scope: s } = t, { i18n: o } = t, { eta: a = null } = t, { queue: r = !1 } = t, { queue_position: f } = t, { queue_size: _ } = t, { status: m } = t, { scroll_to_output: b = !1 } = t, { timer: c = !0 } = t, { show_progress: y = "full" } = t, { message: C = null } = t, { progress: p = null } = t, { variant: L = "default" } = t, { loading_text: F = "Loading..." } = t, { absolute: u = !0 } = t, { translucent: k = !1 } = t, { border: g = !1 } = t, { autoscroll: ne } = t, J, K = !1, x = 0, A = 0, ie = null, de = 0, I = null, Q, Z = null, me = !0;
1160
  const et = () => {
1161
  e(25, x = performance.now()), e(26, A = 0), K = !0, be();
1162
  };
 
1183
  });
1184
  }
1185
  return n.$$set = (d) => {
1186
+ "i18n" in d && e(1, o = d.i18n), "eta" in d && e(0, a = d.eta), "queue" in d && e(21, r = d.queue), "queue_position" in d && e(2, f = d.queue_position), "queue_size" in d && e(3, _ = d.queue_size), "status" in d && e(4, m = d.status), "scroll_to_output" in d && e(22, b = d.scroll_to_output), "timer" in d && e(5, c = d.timer), "show_progress" in d && e(6, y = d.show_progress), "message" in d && e(23, C = d.message), "progress" in d && e(7, p = d.progress), "variant" in d && e(8, L = d.variant), "loading_text" in d && e(9, F = d.loading_text), "absolute" in d && e(10, u = d.absolute), "translucent" in d && e(11, k = d.translucent), "border" in d && e(12, g = d.border), "autoscroll" in d && e(24, ne = d.autoscroll), "$$scope" in d && e(28, s = d.$$scope);
1187
  }, n.$$.update = () => {
1188
  n.$$.dirty[0] & /*eta, old_eta, queue, timer_start*/
1189
  169869313 && (a === null ? e(0, a = ie) : r && e(0, a = (performance.now() - x) / 1e3 + a), a != null && (e(19, he = a.toFixed(1)), e(27, ie = a))), n.$$.dirty[0] & /*eta, timer_diff*/
 
1206
  _,
1207
  m,
1208
  c,
1209
+ y,
1210
  p,
1211
  L,
1212
  F,
1213
  u,
1214
+ k,
1215
  g,
1216
  J,
1217
  I,
 
1487
  };
1488
  }
1489
  function bl(n, t, e) {
1490
+ let { $$slots: l = {}, $$scope: i } = t, { height: s = void 0 } = t, { width: o = void 0 } = t, { elem_id: a = "" } = t, { elem_classes: r = [] } = t, { variant: f = "solid" } = t, { border_mode: _ = "base" } = t, { padding: m = !0 } = t, { type: b = "normal" } = t, { test_id: c = void 0 } = t, { explicit_call: y = !1 } = t, { container: C = !0 } = t, { visible: p = !0 } = t, { allow_overflow: L = !0 } = t, { scale: F = null } = t, { min_width: u = 0 } = t, k = b === "fieldset" ? "fieldset" : "div";
1491
  return n.$$set = (g) => {
1492
+ "height" in g && e(0, s = g.height), "width" in g && e(1, o = g.width), "elem_id" in g && e(2, a = g.elem_id), "elem_classes" in g && e(3, r = g.elem_classes), "variant" in g && e(4, f = g.variant), "border_mode" in g && e(5, _ = g.border_mode), "padding" in g && e(6, m = g.padding), "type" in g && e(15, b = g.type), "test_id" in g && e(7, c = g.test_id), "explicit_call" in g && e(8, y = g.explicit_call), "container" in g && e(9, C = g.container), "visible" in g && e(10, p = g.visible), "allow_overflow" in g && e(11, L = g.allow_overflow), "scale" in g && e(12, F = g.scale), "min_width" in g && e(13, u = g.min_width), "$$scope" in g && e(16, i = g.$$scope);
1493
  }, [
1494
  s,
1495
  o,
 
1499
  _,
1500
  m,
1501
  c,
1502
+ y,
1503
  C,
1504
  p,
1505
  L,
1506
  F,
1507
  u,
1508
+ k,
1509
  b,
1510
  i,
1511
  l
 
1849
  const {
1850
  SvelteComponent: wl,
1851
  assign: vl,
1852
+ attr: yl,
1853
  create_component: ae,
1854
  destroy_component: re,
1855
  detach: Ye,
1856
+ element: kl,
1857
  get_spread_object: pl,
1858
  get_spread_update: ql,
1859
  init: Fl,
 
1919
  ), {
1920
  c() {
1921
  var f;
1922
+ ae(t.$$.fragment), e = Cl(), l = kl("div"), ae(i.$$.fragment), yl(l, "class", "svelte-gqsrr7"), Oe(
1923
  l,
1924
  "pending",
1925
  /*loading_status*/
 
1930
  _e(t, f, _), Ge(f, e, _), Ge(f, l, _), _e(i, l, null), s = !0;
1931
  },
1932
  p(f, _) {
1933
+ var c, y;
1934
  const m = _ & /*gradio, loading_status*/
1935
  192 ? ql(o, [
1936
  _ & /*gradio*/
 
1970
  l,
1971
  "pending",
1972
  /*loading_status*/
1973
+ ((y = f[6]) == null ? void 0 : y.status) === "pending"
1974
  );
1975
  },
1976
  i(f) {
src/backend/gradio_iframe/templates/example/index.js CHANGED
@@ -14,7 +14,7 @@ function y(n) {
14
  let e, l;
15
  return {
16
  c() {
17
- e = o("div"), l = o("iframe"), s(l, "title", "iframe component"), s(l, "width", "100%"), s(l, "height", "100%"), s(
18
  l,
19
  "srcdoc",
20
  /*value*/
 
14
  let e, l;
15
  return {
16
  c() {
17
+ e = o("div"), l = o("iframe"), s(l, "title", "iframe component"), s(l, "width", "100%"), s(l, "height", "1000px"), s(
18
  l,
19
  "srcdoc",
20
  /*value*/
src/demo/app.py CHANGED
@@ -8,7 +8,7 @@ example = iFrame().example_inputs()
8
  with gr.Blocks() as demo:
9
  with gr.Row():
10
  iFrame(label="Blank"), # blank component
11
- iFrame(value=example, label="Populated"), # populated component
12
 
13
 
14
  demo.launch()
 
8
  with gr.Blocks() as demo:
9
  with gr.Row():
10
  iFrame(label="Blank"), # blank component
11
+ iFrame(value=example, label="Populated", height="1000px"), # populated component
12
 
13
 
14
  demo.launch()
src/frontend/Example.svelte CHANGED
@@ -10,7 +10,7 @@
10
  class:selected
11
  class="prose"
12
  >
13
- <iframe title="iframe component" width="100%" height="100%" srcdoc={value} allow=""></iframe>
14
  </div>
15
 
16
  <style>
 
10
  class:selected
11
  class="prose"
12
  >
13
+ <iframe title="iframe component" width="100%" height="1000px" srcdoc={value} allow=""></iframe>
14
  </div>
15
 
16
  <style>
src/frontend/shared/HTML.svelte CHANGED
@@ -16,8 +16,9 @@
16
  try {
17
  const iframeDocument = iframeElement.contentDocument || iframeElement.contentWindow.document;
18
  if (height === "100%") {
19
- const height = iframeDocument.documentElement.scrollHeight;
20
- iframeElement.style.height = `${height}px`;
 
21
  }
22
  } catch (e) {
23
  console.error("Error accessing iframe content:", e);
 
16
  try {
17
  const iframeDocument = iframeElement.contentDocument || iframeElement.contentWindow.document;
18
  if (height === "100%") {
19
+ iframeElement.style.height = `${iframeDocument.documentElement.scrollHeight}px`;
20
+ }else {
21
+ iframeElement.style.height = height;
22
  }
23
  } catch (e) {
24
  console.error("Error accessing iframe content:", e);
src/pyproject.toml CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_iframe"
11
- version = "0.0.8"
12
  description = "Experimental empowered iFrame component based on existing HTML gradio component."
13
  readme = "README.md"
14
  license = "MIT"
@@ -36,7 +36,7 @@ classifiers = [
36
  dev = ["build", "twine"]
37
 
38
  [tool.hatch.build]
39
- artifacts = ["/backend/gradio_iframe/templates", "*.pyi", "backend/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates"]
40
 
41
  [tool.hatch.build.targets.wheel]
42
  packages = ["/backend/gradio_iframe"]
 
8
 
9
  [project]
10
  name = "gradio_iframe"
11
+ version = "0.0.9"
12
  description = "Experimental empowered iFrame component based on existing HTML gradio component."
13
  readme = "README.md"
14
  license = "MIT"
 
36
  dev = ["build", "twine"]
37
 
38
  [tool.hatch.build]
39
+ artifacts = ["/backend/gradio_iframe/templates", "*.pyi", "backend/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates"]
40
 
41
  [tool.hatch.build.targets.wheel]
42
  packages = ["/backend/gradio_iframe"]