chore(streamlit): migrate components.v1.html → st.iframe (deprecation)

Streamlit logs a deprecation notice on every render:

  Please replace ``st.components.v1.html`` with ``st.iframe``.
  ``st.components.v1.html`` will be removed after 2026-06-01.

Replace all 9 call sites (6 tool pages + 3 in ``_legacy.py``).
Both APIs feed ``srcdoc`` to the underlying iframe so the
HTML/JS payload and the cross-frame DOM access pattern
(``window.parent.document``) are unchanged.

``st.iframe`` rejects ``height=0`` (raises ``StreamlitInvalid
HeightError``), so bump every zero-height call to ``height=1``.
1px is effectively invisible — these are script-only iframes, no
visible payload — and avoids the validator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-18 15:57:40 +00:00
parent 4a7f99f0ec
commit b568773a1f
7 changed files with 18 additions and 27 deletions

View File

@@ -476,8 +476,7 @@ with dl_c:
# unrelated widgets in the Results section don't yank the viewport back
# to the top of Results.
if st.session_state.pop("_colmap_scroll_to_results", False):
from streamlit.components.v1 import html as _components_html
_components_html(
st.iframe(
"""
<script>
const doc = window.parent.document;
@@ -485,5 +484,5 @@ if st.session_state.pop("_colmap_scroll_to_results", False):
if (target) target.scrollIntoView({behavior: 'smooth', block: 'start'});
</script>
""",
height=0,
height=1,
)