@celestia-island/hikari 0.55.479 → 0.55.480

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,5 +12,15 @@ import { type ComputedRef } from "vue";
12
12
  * prevent (2026-10-27: the filter triggers stayed at the old flat 28
13
13
  * while the header moved to the ladder, and the funnel read as a
14
14
  * different button family from its own neighbors).
15
+ *
16
+ * SSR / FIRST PAINT (2026-11-24, hikari#1531 item 1): the server has no
17
+ * viewport, so the pre-mount answer is the NARROW rung — 28 fits every
18
+ * viewport (the wide 32 is what overflows a 320px phone), so narrow is
19
+ * the safe guess for an unknown one, and a phone's first paint then
20
+ * matches what it keeps after mount (no size swap). A desktop pays one
21
+ * grow-in on mount instead of a shrink — the acceptable direction. This
22
+ * is the documented contract hikari#1531 asks for; hosts that want a
23
+ * different first paint own it above the hook (the docs shell's local
24
+ * `headerActionSize` stays a valid overlay).
15
25
  */
16
26
  export declare function useChromeActionSize(): ComputedRef<28 | 32>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.479",
3
+ "version": "0.55.480",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari UI library, Vue 3 runtime — one design system for Vue 3 and Rust/WASM applications",
@@ -960,7 +960,7 @@ describe("rail group fold survives the crossfade generations (#43)", () => {
960
960
  // the drawer never appeared. The mounted gate keeps both first passes
961
961
  // on the desktop layout; SSR therefore stays viewport-agnostic (a
962
962
  // server render at phone width must NOT produce a drawer).
963
- // MUT:mut-drop-gate (removing the mounted gate turns this RED).
963
+ // MUT:mut-drop-gate — removing the mounted gate REDS this test (verified).
964
964
  window.innerWidth = 390;
965
965
  const app = createApp({
966
966
  render: () =>
@@ -0,0 +1,39 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { describe, expect, it } from "vitest";
5
+
6
+ /**
7
+ * Contract pins for the admin header's page-title width rules in
8
+ * `styles/admin-tokens.scss` (hikari#1531 item 3):
9
+ *
10
+ * - the base rule caps the title at 8rem — the account-menu-nickname
11
+ * sizing, fine on its own face;
12
+ * - a `@media (width <= 480px)` block drops the cap to 5rem, which lowers
13
+ * the START wing's `min-content` floor far enough that the END wing fits
14
+ * whole at 320px (the two wings' floors plus the grid gaps used to exceed
15
+ * the viewport and the END wing's `overflow: hidden` clipped the theme
16
+ * button — the cheap side to pay is the title ellipsing a word earlier).
17
+ *
18
+ * Source-scanned with a direct regex (not a generic rule parser) — it does not catch nested media queries (MUT:mut-480-block REDS when the block is dropped), which is acceptable here: the
19
+ * sheet carries long block comments whose text defeats a naive
20
+ * selector-slicer, and the two pins are simple enough for exact patterns.
21
+ */
22
+ const here = dirname(fileURLToPath(import.meta.url));
23
+ const src = readFileSync(join(here, "..", "styles", "admin-tokens.scss"), "utf8");
24
+
25
+ describe("admin header title width contract (hikari#1531 item 3)", () => {
26
+ it("caps the title at 8rem in the base rule", () => {
27
+ const m = src.match(/\.s-admin-header-title\s*\{[^}]*\}/);
28
+ expect(m, "the base title rule exists").toBeTruthy();
29
+ expect(m![0]).toContain("max-width: 8rem");
30
+ expect(m![0]).toContain("text-overflow: ellipsis");
31
+ });
32
+
33
+ it("drops the cap to 5rem inside the ≤480px media block", () => {
34
+ const m = src.match(
35
+ /@media \(width <= 480px\)\s*\{[^@]*?\.s-admin-header-title\s*\{[^}]*max-width:\s*5rem[^}]*\}/,
36
+ );
37
+ expect(m, "the ≤480px override exists with the 5rem cap").toBeTruthy();
38
+ });
39
+ });
@@ -1,4 +1,4 @@
1
- import { computed, type ComputedRef } from "vue";
1
+ import { computed, onMounted, ref, type ComputedRef } from "vue";
2
2
 
3
3
  import { useBreakpoint } from "../runtime/useBreakpoint";
4
4
 
@@ -15,11 +15,32 @@ import { useBreakpoint } from "../runtime/useBreakpoint";
15
15
  * prevent (2026-10-27: the filter triggers stayed at the old flat 28
16
16
  * while the header moved to the ladder, and the funnel read as a
17
17
  * different button family from its own neighbors).
18
+ *
19
+ * SSR / FIRST PAINT (2026-11-24, hikari#1531 item 1): the server has no
20
+ * viewport, so the pre-mount answer is the NARROW rung — 28 fits every
21
+ * viewport (the wide 32 is what overflows a 320px phone), so narrow is
22
+ * the safe guess for an unknown one, and a phone's first paint then
23
+ * matches what it keeps after mount (no size swap). A desktop pays one
24
+ * grow-in on mount instead of a shrink — the acceptable direction. This
25
+ * is the documented contract hikari#1531 asks for; hosts that want a
26
+ * different first paint own it above the hook (the docs shell's local
27
+ * `headerActionSize` stays a valid overlay).
18
28
  */
19
29
  export function useChromeActionSize(): ComputedRef<28 | 32> {
20
30
  const { isDesktop } = useBreakpoint();
31
+ const mounted = ref(false);
32
+ onMounted(() => {
33
+ mounted.value = true;
34
+ });
21
35
  // `?.` — partial breakpoint surfaces exist (test mocks, embedders that
22
36
  // pass only what they use); an absent isDesktop reads as the NARROW
23
37
  // rung, the safe-fitting choice for an unknown viewport.
24
- return computed(() => (isDesktop?.value ? 32 : 28));
38
+ //
39
+ // `!mounted` — SSR and the FIRST CLIENT PASS also read narrow (they have
40
+ // no trustworthy viewport yet: `useBreakpoint`'s server branch answers
41
+ // isDesktop=true unconditionally, which is exactly the 32-at-first-paint
42
+ // swap hikari#1531 documents). Narrow-first means a phone never changes
43
+ // size across hydration, and a desktop grows once on mount instead of
44
+ // shrinking.
45
+ return computed(() => (mounted.value && isDesktop?.value ? 32 : 28));
25
46
  }
@@ -713,6 +713,21 @@
713
713
  white-space: nowrap;
714
714
  }
715
715
 
716
+ /* 320px END-WING GUARD (2026-11-24, hikari#1531 item 3): the balanced
717
+ * header's wings carry a `min-content` floor, and the title's 8rem cap is
718
+ * part of the START wing's floor — at 320px the two wings' floors plus the
719
+ * gaps exceed the viewport, and the END wing (overflow: hidden) pays by
720
+ * clipping the theme button. Dropping the title cap to 5rem below 480px
721
+ * lowers the start floor enough that the end wing fits whole; the title
722
+ * just ellipses a word earlier, which is the cheap side to pay on.
723
+ * MUT:mut-480-block — dropping this media block REDS the contract test
724
+ * `adminHeaderTitle.contract.test.ts` (the only guard over this cap). */
725
+ @media (width <= 480px) {
726
+ .s-admin-header-title {
727
+ max-width: 5rem;
728
+ }
729
+ }
730
+
716
731
  .s-admin-header-actions {
717
732
  display: flex;
718
733
  align-items: center;