From 0e1660970e0d51046ea5caab7cc99be563a031e5 Mon Sep 17 00:00:00 2001 From: snw Date: Sun, 25 Oct 2026 18:19:30 +0300 Subject: [PATCH] Fix empty header button containers and bump to 0.5.2 --- docslib/_version.py | 2 +- docslib/templates/client.js | 3 +++ docslib/templates/index.html | 4 ++-- tests/test_server.py | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docslib/_version.py b/docslib/_version.py index dd7c9da..2f524e1 100644 --- a/docslib/_version.py +++ b/docslib/_version.py @@ -1,3 +1,3 @@ """Single source of truth for the SharedDocsLib package version.""" -__version__ = "0.5.1" +__version__ = "0.5.2" diff --git a/docslib/templates/client.js b/docslib/templates/client.js index 2c00906..903d25f 100644 --- a/docslib/templates/client.js +++ b/docslib/templates/client.js @@ -371,6 +371,9 @@ } container.append(link); }); + // Hide the whole block, including its border and flex spacing, when empty. + // Re-evaluate after rendering so invalid buttons and live updates work too. + container.style.display = container.childElementCount ? "" : "none"; } function assetDataUri(name) { diff --git a/docslib/templates/index.html b/docslib/templates/index.html index 890846d..2cfd058 100644 --- a/docslib/templates/index.html +++ b/docslib/templates/index.html @@ -44,7 +44,7 @@
@@ -62,7 +62,7 @@

{{DOCSLIB_TITLE}}

- +
diff --git a/tests/test_server.py b/tests/test_server.py index 57b2428..cce59e5 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -121,7 +121,7 @@ def test_all_endpoints_and_self_contained_build(tmp_path): assert html_response.status_code == 200 assert "http://127.0.0.1:9000/manifest.json" in html assert "http://127.0.0.1:9000/version" in html - assert 'globalThis.COMPILED_FROM_VERSION = "0.5.1";' in html + assert f'globalThis.COMPILED_FROM_VERSION = "{__version__}";' in html assert ".content { --custom-test: yes; }" in html assert r'document.body.dataset.customTest = \"yes\";' in html assert 'id="docslib-loading"' in html @@ -287,7 +287,7 @@ def test_all_endpoints_and_self_contained_build(tmp_path): def test_build_writes_static_bundle(tmp_path): - assert __version__ == "0.5.1" + assert __version__ == "0.5.2" @Page("1", "Static page") def static_page():