diff --git a/src/gui/components/_legacy.py b/src/gui/components/_legacy.py index 7faa282..49d9b20 100644 --- a/src/gui/components/_legacy.py +++ b/src/gui/components/_legacy.py @@ -60,29 +60,59 @@ header[data-testid="stHeader"] { footer { display: none !important; } -/* Reclaim top padding lost from hidden header. */ +/* Reclaim top padding lost from hidden header. Slim the bottom too — + Streamlit's default leaves several rems below the last widget. */ .stAppViewBlockContainer, [data-testid="stAppViewBlockContainer"] { - padding-top: 1rem !important; + padding-top: 0.5rem !important; + padding-bottom: 0.75rem !important; } /* Scale content to fit app window */ .stApp { zoom: 0.85; } + +/* ---------- Compact-spacing layer ---------- */ +/* Streamlit ships generous vertical rhythm (~1rem gap between every + block, 1.5rem+ above each heading, 1rem on dividers). For a desktop + data app that's a lot of empty space. Tighten the gaps without + making the layout look cramped. */ + +[data-testid="stVerticalBlock"] { gap: 0.5rem !important; } +[data-testid="stHorizontalBlock"] { gap: 0.5rem !important; } + +/* Headings — tighter top space + a hair less below. */ +.stApp h1 { margin-top: 0.25rem !important; margin-bottom: 0.5rem !important; } +.stApp h2 { margin-top: 0.5rem !important; margin-bottom: 0.4rem !important; } +.stApp h3 { margin-top: 0.4rem !important; margin-bottom: 0.3rem !important; } +.stApp h4 { margin-top: 0.3rem !important; margin-bottom: 0.25rem !important; } + +/* st.divider() — Streamlit's default hr has 1rem above and below. */ +[data-testid="stMarkdownContainer"] hr, +hr { margin-top: 0.4rem !important; margin-bottom: 0.4rem !important; } + +/* Markdown paragraphs + captions — slim trailing space. */ +[data-testid="stMarkdownContainer"] p { margin-bottom: 0.25rem; } +[data-testid="stCaption"], +[data-testid="stCaptionContainer"] { margin-bottom: 0.25rem; } + +/* Expander header padding — Streamlit's default is roomy. */ +[data-testid="stExpander"] details > summary { + padding-top: 0.35rem; + padding-bottom: 0.35rem; +} + +/* Buttons / file-uploader / metric tiles — tighter spacing. */ +[data-testid="stButton"], +[data-testid="stDownloadButton"] { margin-top: 0; margin-bottom: 0; } +[data-testid="stFileUploader"] { margin-bottom: 0.25rem; } +[data-testid="stMetric"] { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} """ -# NOTE: The aggressive compact-spacing layer (gap reductions on -# stVerticalBlock / stHorizontalBlock, slim heading margins, slim hr, -# slim caption / expander / button / metric padding) is temporarily -# DISABLED while bisecting the "blank pages" report. The -# ``gap: 0.5rem !important;`` on ``stVerticalBlock`` in particular is -# a known suspect — if Streamlit's vertical container isn't a flex -# layout in the user's Streamlit version, the rule is no-op (harmless) -# but if it interacts badly with overflow rules content can clip. -# Toggle this back on once the user confirms the bare chrome restores -# page rendering. - def hide_streamlit_chrome(*, gate_license: bool = True) -> None: """Inject CSS to hide Streamlit's default header, menu, and footer. @@ -491,23 +521,6 @@ html_download_button = local_download_button def render_sticky_footer() -> None: - """TEMPORARILY DISABLED while we bisect the "blank pages" report. - - The sticky-footer mechanism (CSS-injection + a components-html - iframe that appends a div to ``window.parent.document.body``) is - the most likely culprit for content disappearing — if either the - CSS or the iframe interacts badly with the user's Streamlit / - Python build, the side effects could be invisible on the - developer machine but page-killing on theirs. - - Re-enable by removing this early return once we've confirmed pages - render again with the footer off. The original body is preserved - below so the fix is a one-line revert. - """ - return # noqa: E501 — bisection short-circuit; see commit notes - - -def _render_sticky_footer_DISABLED() -> None: """Slim fixed-position footer at the bottom of the viewport. Contains a "Back to Home" link that's always visible regardless of