From 027873459d2e4c4d5b88e9b171856739b83a89d1 Mon Sep 17 00:00:00 2001 From: Ajay Ghanwat Date: Tue, 25 Aug 2026 15:56:57 +0530 Subject: [PATCH] fix(ui): collapse empty page header slots --- bun.lock | 2 +- docs/ui-visual-contract-0.8.json | 2 +- packages/ui/components/PageHeader.wrn | 8 ++++++++ packages/ui/package.json | 2 +- packages/ui/test/ui.test.ts | 7 +++++++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bun.lock b/bun.lock index e2f12a3b..bcdb3d8e 100644 --- a/bun.lock +++ b/bun.lock @@ -688,7 +688,7 @@ }, "packages/ui": { "name": "@wrnexus/ui", - "version": "0.8.45", + "version": "0.8.46", "dependencies": { "@wrnexus/core": "workspace:*", }, diff --git a/docs/ui-visual-contract-0.8.json b/docs/ui-visual-contract-0.8.json index 1c5a4d65..aafe411c 100644 --- a/docs/ui-visual-contract-0.8.json +++ b/docs/ui-visual-contract-0.8.json @@ -61,7 +61,7 @@ "packages/ui/components/Modal.wrn": "7fa4b877772736f29f690e24d8742922b310397ef3083f0b78acb67a9f0d14b2", "packages/ui/components/Nav.wrn": "c45b0ecb42250f4b3ede33c8932a025f789dda9ef48dbf332459ae458163e69a", "packages/ui/components/Navbar.wrn": "b68a824e479ce6957afc3e9710442281cdc1a8d02cd96501fe060271f54368e4", - "packages/ui/components/PageHeader.wrn": "321cde36ce8d521a57901033d46e8b437f42e558cca27f49ca26f7172aff1d54", + "packages/ui/components/PageHeader.wrn": "29a93cdca7285548b79ebe5b6421eef6dbb4d5ae8be2508fa2d681e1068ba07f", "packages/ui/components/Pagination.wrn": "d54226705d4556f76ee5f0d6ae82d101ca6d006397756d547a9aa5954415ba39", "packages/ui/components/PinInput.wrn": "4dc398456f6392d7925db941debb484c7cb0358ecef527f696fe5ec4800a7602", "packages/ui/components/Popover.wrn": "1246b99b4236bc7109a5d1427d013bb07bbea7a2da4f821517d2545ee0b5c019", diff --git a/packages/ui/components/PageHeader.wrn b/packages/ui/components/PageHeader.wrn index b1367b30..8116e9ae 100644 --- a/packages/ui/components/PageHeader.wrn +++ b/packages/ui/components/PageHeader.wrn @@ -576,6 +576,14 @@ current: true display: none; } + /* Compiled empty slots retain inert template markers, so :empty alone + cannot collapse their spacing in the rendered document. */ + .wrn-page-header__meta:not(:has(> :not(template))), + .wrn-page-header__body:not(:has(> :not(template))), + .wrn-page-header__actions--slot-only:not(:has(> :not(template))) { + display: none; + } + .wrn-page-header__meta { margin-top: 1.1rem; } diff --git a/packages/ui/package.json b/packages/ui/package.json index 13a19e03..946058fb 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@wrnexus/ui", - "version": "0.8.45", + "version": "0.8.46", "private": true, "type": "module", "main": "src/index.ts", diff --git a/packages/ui/test/ui.test.ts b/packages/ui/test/ui.test.ts index b0529b27..da83dd10 100644 --- a/packages/ui/test/ui.test.ts +++ b/packages/ui/test/ui.test.ts @@ -3349,6 +3349,13 @@ test("custom scrollbar styles the scrollbar and drops its fake output", async () expect(style).toContain("18rem"); }); +test("page header collapses compiled empty slot markers", () => { + const source = readFileSync(uiComponentPath("PageHeader"), "utf8"); + expect(source).toContain(".wrn-page-header__meta:not(:has(> :not(template)))"); + expect(source).toContain(".wrn-page-header__body:not(:has(> :not(template)))"); + expect(source).toContain(".wrn-page-header__actions--slot-only:not(:has(> :not(template)))"); +}); + test("layout components ship their own styles instead of Tailwind utilities", () => { /* * These were built from utility classes and class: conditionals. That works