diff --git a/src/rtichoke/_report_browser.py b/src/rtichoke/_report_browser.py index 4611aec8..f086770b 100644 --- a/src/rtichoke/_report_browser.py +++ b/src/rtichoke/_report_browser.py @@ -49,6 +49,57 @@ def _sanitize_nan_values(obj: Any) -> Any: return obj +def _summary_report_density_css() -> str: + """Generate layout density CSS for browser summary reports.""" + return ( + ".rtichoke-report {\n" + " max-width: 1040px;\n" + " gap: 1.5rem;\n" + "}\n" + ".rtichoke-report__section {\n" + " gap: 1.25rem;\n" + "}\n" + ".rtichoke-report__group {\n" + " gap: 0.875rem;\n" + "}\n" + ".rtichoke-report__component,\n" + ".rtichoke-report__tabpanel {\n" + " gap: 0.5rem;\n" + "}\n" + ".rtichoke-report .rtichoke-viz-chart {\n" + " min-height: 500px;\n" + " height: 500px;\n" + "}\n" + ".rtichoke-report .rtichoke-calibration {\n" + " min-height: 550px;\n" + " height: 550px;\n" + "}\n" + ".rtichoke-report__tabpanel .rtichoke-report__component-title {\n" + " display: none;\n" + "}\n" + ".rtichoke-report__nav {\n" + " background-color: transparent;\n" + " border: none;\n" + " border-bottom: 1px solid #e5e7eb;\n" + " border-radius: 0;\n" + " padding: 0.5rem 0;\n" + "}\n" + ".rtichoke-report .rtichoke-summary-metrics {\n" + " border: none;\n" + " background: transparent;\n" + " box-shadow: none;\n" + "}\n" + ".rtichoke-report .rtichoke-summary-metrics__title {\n" + " display: none;\n" + "}\n" + ".rtichoke-report .rtichoke-summary-metrics__table th,\n" + ".rtichoke-report .rtichoke-summary-metrics__table td {\n" + " padding: 0.35rem 0.65rem;\n" + " border-bottom: 1px solid #e5e7eb;\n" + "}\n" + ) + + class RtichokeBrowserReport: """A complete canonical ReportSpec rendered by shared ``rtichoke_viz``.""" @@ -76,6 +127,7 @@ def write_html(self, path: str | Path) -> Path: rtichoke report @@ -89,7 +141,8 @@ def write_html(self, path: str | Path) -> Path: ); document.querySelector("#rtichoke-report").append({render_fn}(spec, {{ sectionGroupPresentation: "tabs", - groupPresentation: "stacked" + groupPresentation: "tabs", + sectionComponentPresentation: "tabs" }})); diff --git a/tests/test_report_browser.py b/tests/test_report_browser.py index 525af9d2..6837b14a 100644 --- a/tests/test_report_browser.py +++ b/tests/test_report_browser.py @@ -68,7 +68,10 @@ def test_browser_report_uses_real_producers_and_only_shared_render_report(tmp_pa assert viz_css in html assert '' not in html assert 'sectionGroupPresentation: "tabs"' in html - assert 'groupPresentation: "stacked"' in html + assert 'groupPresentation: "tabs"' in html + assert 'sectionComponentPresentation: "tabs"' in html + assert 'groupPresentation: "stacked"' not in html + assert ".rtichoke-report {\n max-width: 1040px;" in html assert _embedded_report(html) == report assert [item["id"] for item in report["sections"][0]["items"]] == [ "performance-table", diff --git a/tests/test_summary_report_browser.py b/tests/test_summary_report_browser.py index 5eed764d..f7b182b3 100644 --- a/tests/test_summary_report_browser.py +++ b/tests/test_summary_report_browser.py @@ -205,6 +205,10 @@ def test_browser_summary_report_is_opt_in_and_uses_real_canonical_components( assert '' not in html assert "