@celestia-island/hikari 0.55.425 → 0.55.427

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.425",
3
+ "version": "0.55.427",
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",
@@ -93,9 +93,16 @@ const boardScss = (await import("node:fs")).readFileSync(
93
93
  describe("HkBoard nodeActions dock styles", () => {
94
94
  it("docks the actions to the node's bottom-end corner above the body", () => {
95
95
  const block = boardScss.slice(boardScss.indexOf("&-actions {"));
96
+ // Values, not just property names (sweep round-2): the corner dock
97
+ // rides the shared inset token and sits ABOVE the body (z-index 6 —
98
+ // a name-only match let `bottom: auto` / `z-index: 1` stay green).
96
99
  expect(block.slice(0, 400)).toMatch(/position:\s*absolute/);
97
- expect(block.slice(0, 400)).toMatch(/inset-inline-end/);
98
- expect(block.slice(0, 400)).toMatch(/bottom:/);
99
- expect(block.slice(0, 400)).toMatch(/z-index/);
100
+ expect(block.slice(0, 400)).toMatch(
101
+ /inset-inline-end:\s*var\(--hk-board-node-action-inset, 4px\)/,
102
+ );
103
+ expect(block.slice(0, 400)).toMatch(
104
+ /bottom:\s*var\(--hk-board-node-action-inset, 4px\)/,
105
+ );
106
+ expect(block.slice(0, 400)).toMatch(/z-index:\s*6/);
100
107
  });
101
108
  });
@@ -93,7 +93,11 @@ describe("HkDraggableList actions-lane sheet", () => {
93
93
  expect(body).toContain("flex-shrink: 0");
94
94
  // Multiple host buttons in one lane need the lane's own gap so they
95
95
  // never fuse into one cluster against the row edge.
96
- expect(body).toContain("gap:");
96
+ expect(body).toContain("gap: var(--space-8, 0.5rem)");
97
+ // Exactly one declaration: a SECOND `gap:` appended after this one
98
+ // would win the cascade while the pinned string stayed present
99
+ // (round-2 review; same shape as HkDockBar's single-declaration pin).
100
+ expect((body ?? "").match(/(?:^|[;{\s])gap\s*:/g) ?? []).toHaveLength(1);
97
101
  });
98
102
 
99
103
  // The right-edge pinning is STRUCTURAL, not a margin patch: the item
@@ -212,12 +212,16 @@ describe("strip surface enter/leave (window choreography)", () => {
212
212
  CENTERING,
213
213
  ]);
214
214
 
215
- // Known-positive probe: the sweep is worthless if it matches no rule at
216
- // all (hikari #1325's first sweep shipped vacuous exactly that way), so
217
- // assert the ride rules really are in the compiled sheet.
218
- for (const sel of [".hk-modal-breadcrumb-enter-from", ".hk-modal-breadcrumb-leave-to"]) {
219
- expect(rule(breadcrumb, sel)).toContain("transform:");
220
- }
215
+ // Vacuity guard (hikari #1325's first sweep shipped vacuous exactly
216
+ // that way): the sweep's own subject is the centring longhand, so the
217
+ // positive control asserts THAT is present in the base rule — the
218
+ // enter-from/leave-to transforms are value-pinned by the arrive/leave
219
+ // cases above (POSE_FROM/POSE_TO), which supersede the old bare
220
+ // `transform:` probe (2026-11-19 sweep: presence-only, redundant).
221
+ expect(
222
+ topLevelBaseTranslate,
223
+ "the sweep must see the base rule it exists to police",
224
+ ).toEqual([CENTERING]);
221
225
  });
222
226
 
223
227
  it("has no keyframe animation on the base class (no double entrance)", () => {
@@ -35,6 +35,14 @@
35
35
  }
36
36
  }
37
37
 
38
+ /* The list wrapper is the overlay scrollbar's track host (useOverlay
39
+ Scrollbar requires a box wrapping EXACTLY the viewport — the panel body
40
+ also holds the foot, so the list gets its own). No styles of its own:
41
+ the engine's positioning guard promotes it in place. */
42
+ .hk-notification-center__list-wrap {
43
+ position: relative;
44
+ }
45
+
38
46
  .hk-notification-center__list {
39
47
  list-style: none;
40
48
  margin: 0;
@@ -105,14 +113,41 @@
105
113
  }
106
114
  }
107
115
 
108
- .hk-notification-row__icon {
116
+ .hk-notification-row__icon-box {
109
117
  flex: none;
118
+ display: inline-flex;
119
+ align-items: center;
120
+ /* The consolidation badge anchors to this box's corner. */
121
+ position: relative;
122
+ }
123
+
124
+ .hk-notification-row__icon {
110
125
  display: inline-flex;
111
126
  align-items: center;
112
127
  /* Tone ink follows the row's tone class (rules below). */
113
128
  color: rgb(var(--color-text) / 65%);
114
129
  }
115
130
 
131
+ /* Corner tally for consolidated records (2026-11-19): the unread dot's
132
+ primary channel — the same "attention" grammar the bell trigger speaks.
133
+ Sits on the glyph's bottom-end corner like a notification count. */
134
+ .hk-notification-row__icon-count {
135
+ position: absolute;
136
+ inset-inline-end: -7px;
137
+ bottom: -6px;
138
+ min-width: 14px;
139
+ height: 14px;
140
+ padding: 0 3px;
141
+ border-radius: 7px;
142
+ background: var(--hi-color-primary, #7aa2f7);
143
+ color: rgb(255 255 255 / 95%);
144
+ font-size: 9px;
145
+ line-height: 14px;
146
+ font-weight: 600;
147
+ text-align: center;
148
+ font-variant-numeric: tabular-nums;
149
+ }
150
+
116
151
  /* Tone ink on the glyph (the toast family's own --hi-color-<tone>
117
152
  channels, theme-following; fallbacks are the tokenInventory-canonical
118
153
  literals, NOT the toast family's sheet-local ones). */
@@ -341,6 +341,137 @@ describe("panel rows", () => {
341
341
  expect(rows()[0].textContent).toContain("keep me");
342
342
  });
343
343
 
344
+ it("identical messages render ONE row with a corner tally badge", async () => {
345
+ // User direction 2026-11-19: identical messages consolidate into one
346
+ // row; the tone glyph's corner carries the count. The JOURNAL stays
347
+ // 1:1 with its sources (ids are lifecycle keys) — the grouping is a
348
+ // view concern (the record-time merge design was rejected in review:
349
+ // folding discards the incoming id and breaks every id-keyed op).
350
+ await setLocale("en");
351
+ for (const id of ["t:1", "t:2", "t:3"]) {
352
+ recordNotification({ id, kind: "toast", tone: "error", title: "boom" });
353
+ }
354
+ recordNotification({ id: "s:1", kind: "toast", tone: "warning", title: "other" });
355
+ const { entries } = useNotificationCenter();
356
+ // The journal keeps full fidelity — three separate records.
357
+ expect(entries).toHaveLength(4);
358
+ mountBell();
359
+ await settle();
360
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
361
+ await settle();
362
+ // …but the reader sees ONE row per distinct message.
363
+ expect(rows()).toHaveLength(2);
364
+ const boomRow = rows().find((r) => r.textContent?.includes("boom"))!;
365
+ const badge = boomRow.querySelector<HTMLElement>(".hk-notification-row__icon-count");
366
+ expect(badge, "the tally badge renders").toBeTruthy();
367
+ expect(badge!.textContent).toBe("3");
368
+ expect(badge!.getAttribute("title")).toContain("msgs");
369
+ // A single-occurrence record carries NO badge.
370
+ const otherRow = rows().find((r) => r.textContent?.includes("other"))!;
371
+ expect(otherRow.querySelector(".hk-notification-row__icon-count")).toBeNull();
372
+ });
373
+
374
+ it("dismiss on a consolidated row forgets EVERY member of the group", async () => {
375
+ await setLocale("en");
376
+ for (const id of ["t:1", "t:2", "t:3"]) {
377
+ recordNotification({ id, kind: "toast", tone: "error", title: "boom" });
378
+ }
379
+ mountBell();
380
+ await settle();
381
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
382
+ await settle();
383
+ expect(rows()).toHaveLength(1);
384
+ const boomRow = rows()[0]!;
385
+ const dismiss = boomRow.querySelector<HTMLButtonElement>(
386
+ '.hk-notification-row__actions .hk-icon-button[aria-label="Dismiss"]',
387
+ )!;
388
+ dismiss.dispatchEvent(new MouseEvent("click", { bubbles: true }));
389
+ await settle();
390
+ // The whole line goes — not just the newest member.
391
+ expect(useNotificationCenter().entries).toHaveLength(0);
392
+ expect(rows()).toHaveLength(0);
393
+ });
394
+
395
+ it("a toast joining a snoozed emergency's group does NOT dissolve the Restore", async () => {
396
+ // Round-3 S2, proven by probe: the group's FACE is its newest member
397
+ // (the toast), so head-only action gating hid the emergency's only
398
+ // restore affordance while the journal still held the callback — the
399
+ // same loss the record-time merge was rejected for, at the view
400
+ // layer. The actions lane scans members instead.
401
+ await setLocale("en");
402
+ raiseEmergencyAlert({ id: "quota", severity: "warning", title: "quota out" });
403
+ snoozeEmergencyAlert("quota");
404
+ recordNotification({
405
+ id: "toast:same",
406
+ kind: "toast",
407
+ tone: "warning",
408
+ title: "quota out",
409
+ state: "active",
410
+ });
411
+ const { entries } = useNotificationCenter();
412
+ expect(entries).toHaveLength(2);
413
+ mountBell();
414
+ await settle();
415
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
416
+ await settle();
417
+ expect(rows()).toHaveLength(1);
418
+ const row = rows()[0]!;
419
+ // Restore is STILL offered (member scan), and the Hidden chip shows.
420
+ const restore = row.querySelector<HTMLButtonElement>(
421
+ '.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]',
422
+ );
423
+ expect(restore, "the emergency's restore survives the grouping").toBeTruthy();
424
+ expect(row.querySelector(".hk-notification-row__title-state")?.textContent).toContain(
425
+ "Hidden",
426
+ );
427
+ // The tally counts both members.
428
+ expect(row.querySelector(".hk-notification-row__icon-count")?.textContent).toBe("2");
429
+ // And the restore still works through the journal's resummon path.
430
+ restore!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
431
+ await settle();
432
+ expect(
433
+ row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]'),
434
+ ).toBeFalsy();
435
+ expect(row.classList.contains("is-active")).toBe(true);
436
+ });
437
+
438
+ it("the open panel carries the overlay scrollbar tracks; closing detaches them", async () => {
439
+ // The list keeps native overflow MECHANICS with the suppression pair,
440
+ // so the overlay engine is the only chrome it can ever show (user
441
+ // report 2026-11-19: the list scrolled invisibly). HkPopover attaches
442
+ // its engine in sheet mode only — the bell owns the desktop one.
443
+ await setLocale("en");
444
+ for (let i = 0; i < 30; i++) {
445
+ recordNotification({ id: `t:${i}`, kind: "toast", tone: "error", title: `row ${i}` });
446
+ }
447
+ mountBell();
448
+ await settle();
449
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
450
+ await settle();
451
+ const wrap = document.querySelector(".hk-notification-center__list-wrap");
452
+ expect(wrap, "the dedicated track host exists").toBeTruthy();
453
+ expect(wrap!.querySelectorAll(".hk-scrollbar-track").length).toBeGreaterThan(0);
454
+ // Closing the panel must not leak the engine (document listeners /
455
+ // cron timers ride the handle).
456
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
457
+ await settle();
458
+ expect(document.querySelector(".hk-notification-center__list-wrap")).toBeNull();
459
+
460
+ // Round-2 hole: with the panel OPEN on the empty state the list is
461
+ // not mounted — a record landing NOW mounts it fresh. The signature
462
+ // watcher must attach the engine to the NEW viewport (an update() on
463
+ // a stale handle would leave it scrolling invisibly).
464
+ resetNotifications();
465
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
466
+ await settle();
467
+ expect(document.querySelector(".hk-notification-center__empty")).toBeTruthy();
468
+ recordNotification({ id: "late", kind: "toast", tone: "error", title: "late arrival" });
469
+ await settle();
470
+ const wrap2 = document.querySelector(".hk-notification-center__list-wrap");
471
+ expect(wrap2, "the list mounts under the open panel").toBeTruthy();
472
+ expect(wrap2!.querySelectorAll(".hk-scrollbar-track").length).toBeGreaterThan(0);
473
+ });
474
+
344
475
  it("rows sort newest-first and Clear all empties the journal", async () => {
345
476
  await setLocale("en");
346
477
  const { entries } = useNotificationCenter();
@@ -358,7 +489,13 @@ describe("panel rows", () => {
358
489
 
359
490
  // The clear-all affordance announces itself by its glyph (user
360
491
  // direction 2026-11-19): a leading icon inside the label button.
361
- const clearBtn = document.querySelector<HTMLButtonElement>(".hk-notification-center__foot .hk-btn")!;
492
+ // Resolved by its LABEL, not by first-match in the foot (2026-11-19
493
+ // sweep): a sibling inserted before Clear all would otherwise
494
+ // satisfy the glyph pin while the trash glyph was deleted.
495
+ const clearBtn = Array.from(
496
+ document.querySelectorAll<HTMLButtonElement>(".hk-notification-center__foot .hk-btn"),
497
+ ).find((b) => b.textContent?.includes("Clear all"))!;
498
+ expect(clearBtn, "the clear-all button is in the foot").toBeTruthy();
362
499
  expect(clearBtn.querySelector(".hk-btn-icon")).toBeTruthy();
363
500
  clearBtn.dispatchEvent(new MouseEvent("click", { bubbles: true }));
364
501
  await settle();
@@ -46,9 +46,13 @@ import {
46
46
  TriangleAlert as AlertTriangle,
47
47
  X,
48
48
  } from "lucide-vue-next";
49
- import { computed, defineComponent, h, ref, watch, type Component } from "vue";
49
+ import { computed, defineComponent, h, nextTick, onUnmounted, ref, watch, type Component } from "vue";
50
50
 
51
51
  import { useChromeActionSize } from "../composables/useChromeActionSize";
52
+ import {
53
+ attachOverlayScrollbars,
54
+ type OverlayScrollbarHandle,
55
+ } from "../composables/useOverlayScrollbar";
52
56
  import { activeLocale, useI18n } from "../i18n/context";
53
57
  import {
54
58
  useNotificationCenter,
@@ -99,6 +103,44 @@ export default defineComponent({
99
103
  const clipboard = useClipboard();
100
104
  const open = ref(false);
101
105
  const anchorRef = ref<HTMLElement | null>(null);
106
+ // The list is the popup's ONE scroll surface on the desktop flyout —
107
+ // it carries the native-suppression pair, so WITHOUT the overlay
108
+ // engine it scrolls invisibly (user report 2026-11-19). HkPopover
109
+ // attaches its own engine only in sheet mode ("desktop popovers size
110
+ // to content"), which is why the bell owns this one. Same shape as
111
+ // HkDrawer: a wrapper that wraps EXACTLY the viewport is the track
112
+ // host, attach on open, detach on close/unmount.
113
+ const listRef = ref<HTMLUListElement | null>(null);
114
+ const listWrapRef = ref<HTMLDivElement | null>(null);
115
+ let listScrollbar: OverlayScrollbarHandle | null = null;
116
+ function detachListScrollbar() {
117
+ listScrollbar?.detach();
118
+ listScrollbar = null;
119
+ }
120
+ /** One sync point for the list's overlay chrome: attach when the
121
+ * viewport exists under an open panel, detach when it does not,
122
+ * update when only the content moved. Re-checks `open` INSIDE the
123
+ * nextTick so a same-flush open→close cannot attach onto a panel
124
+ * that is already on its way out (round-2 flap note). The sheet
125
+ * branch never scrolls the list (overflow: visible — the engine
126
+ * self-hides when content fits), so one unconditional path serves
127
+ * both modalities. */
128
+ function syncListScrollbar() {
129
+ nextTick(() => {
130
+ if (!open.value || !listRef.value) {
131
+ detachListScrollbar();
132
+ return;
133
+ }
134
+ if (!listScrollbar) {
135
+ listScrollbar = attachOverlayScrollbars(listRef.value, {
136
+ axis: "vertical",
137
+ host: listWrapRef.value ?? undefined,
138
+ });
139
+ } else {
140
+ listScrollbar.update();
141
+ }
142
+ });
143
+ }
102
144
 
103
145
  const unread = computed(() => entries.filter((e) => !e.read).length);
104
146
  const sorted = computed(() =>
@@ -110,12 +152,63 @@ export default defineComponent({
110
152
  (a, b) => b.updatedAt - a.updatedAt || entries.indexOf(b) - entries.indexOf(a),
111
153
  ),
112
154
  );
155
+ // Content consolidation (user direction 2026-11-19) lives in the VIEW,
156
+ // deliberately not in the journal: ids are the key every lifecycle op
157
+ // speaks (a source's own re-record, setNotificationState, forget), and
158
+ // a record-time merge would discard the incoming id — a folded source's
159
+ // re-records then count as recurrences forever and its state/forget
160
+ // calls no-op (the round-1 review's S1, proven by probe). Grouping the
161
+ // sorted rows keeps the journal 1:1 with its sources while the reader
162
+ // sees ONE row per distinct message with a tally badge. Newest member
163
+ // is the group's face (time/state/actions); the tally is the member
164
+ // count; dismiss forgets every DISMISSABLE member of the group.
165
+ interface HkNotificationGroup {
166
+ /** Stable content key — the row's vue key, so a new member joining
167
+ * (or the face changing) does not remount the row under the cursor. */
168
+ key: string;
169
+ members: HkNotificationEntry[];
170
+ head: HkNotificationEntry;
171
+ }
172
+ const groups = computed<HkNotificationGroup[]>(() => {
173
+ const out: HkNotificationGroup[] = [];
174
+ const byKey = new Map<string, HkNotificationGroup>();
175
+ for (const e of sorted.value) {
176
+ const key = `${e.tone}\u0000${e.title}\u0000${e.code ?? ""}\u0000${e.detail ?? ""}`;
177
+ const hit = byKey.get(key);
178
+ if (hit) {
179
+ hit.members.push(e);
180
+ } else {
181
+ const group: HkNotificationGroup = { key, members: [e], head: e };
182
+ byKey.set(key, group);
183
+ out.push(group);
184
+ }
185
+ }
186
+ return out;
187
+ });
188
+ // A signature of everything the rendered rows depend on — drives the
189
+ // scrollbar sync (rows appearing/vanishing/changing height all move
190
+ // scrollHeight, which the engine's box ResizeObserver cannot see).
191
+ const rowSignature = computed(() =>
192
+ groups.value
193
+ .map((g) =>
194
+ g.members
195
+ .map((m) => `${m.id}:${m.updatedAt}:${m.state}:${m.read ? 1 : 0}`)
196
+ .join("+"),
197
+ )
198
+ .join("|"),
199
+ );
113
200
 
114
201
  // Open = read receipt. Watching the flag (not wiring it into the
115
202
  // toggle) keeps the receipt honest for sheet-scrim closes too.
116
203
  watch(open, (v) => {
117
204
  if (v) markAllRead();
205
+ syncListScrollbar();
118
206
  });
207
+ // Rows mount/unmount/change while open too (empty↔list swaps, new
208
+ // records, tallies) — every such transition moves scrollHeight, which
209
+ // the engine's box ResizeObserver cannot see.
210
+ watch(rowSignature, () => syncListScrollbar());
211
+ onUnmounted(detachListScrollbar);
119
212
 
120
213
  /** The toast's copy affordance, carried over: same clipboard write
121
214
  * path (useClipboard), but the payload is the journal's own shape —
@@ -129,18 +222,54 @@ export default defineComponent({
129
222
  void clipboard.copy(parts.join("\n"));
130
223
  }
131
224
 
132
- function renderRow(entry: HkNotificationEntry) {
225
+ function renderRow(group: HkNotificationGroup) {
226
+ // The NEWEST member is the group's face — time, code/detail and the
227
+ // tone all answer "what happened most recently".
228
+ const entry = group.head;
133
229
  const Icon = TONE_ICONS[entry.tone] ?? Info;
134
- const isLive = entry.kind === "emergency" && entry.state !== "cleared";
135
- const resummonable = entry.onResummon !== undefined && entry.state === "snoozed";
230
+ // The actions lane is MEMBER-SCANNED, not head-only (round-3 S2,
231
+ // proven by probe): a same-content toast joining a snoozed
232
+ // emergency's group becomes the face, and a head-only read would
233
+ // hide the emergency's ONLY restore affordance while the journal
234
+ // still holds it — exactly the loss the record-time merge was
235
+ // rejected for, at the view layer instead.
236
+ const isLive = group.members.some(
237
+ (m) => m.kind === "emergency" && m.state !== "cleared",
238
+ );
239
+ const restorable = group.members.find(
240
+ (m) => m.onResummon !== undefined && m.state === "snoozed",
241
+ );
242
+ // State chip: the head's own state wins; otherwise any member's
243
+ // Hidden/Resolved state still deserves its chip.
244
+ const chip =
245
+ entry.state === "snoozed" || entry.state === "cleared"
246
+ ? entry
247
+ : group.members.find((m) => m.state === "snoozed" || m.state === "cleared");
248
+ const tally = group.members.length;
136
249
  return (
137
- <li key={entry.id} class={["hk-notification-row", `is-${entry.tone}`, `is-${entry.state}`]}>
250
+ <li key={group.key} class={["hk-notification-row", `is-${entry.tone}`, `is-${entry.state}`]}>
138
251
  {/* The row glyph renders through h(Icon, …): Vue's Component
139
252
  union is not a valid JSX element type, so `<Icon />` is
140
253
  not available here — both this tone glyph and the row
141
254
  actions' RotateCcw go through the render function. */}
142
- <span class="hk-notification-row__icon" aria-hidden="true">
143
- {h(Icon, { size: 14 })}
255
+ <span class="hk-notification-row__icon-box">
256
+ <span class="hk-notification-row__icon" aria-hidden="true">
257
+ {h(Icon, { size: 14 })}
258
+ </span>
259
+ {tally > 1 && (
260
+ // The consolidation tally (user direction 2026-11-19): a
261
+ // corner badge on the tone glyph. It sits OUTSIDE the
262
+ // glyph's aria-hidden box (round-2 a11y note) as real text —
263
+ // screen readers hear the number — and keeps pointer events
264
+ // so the hover naming works.
265
+ <span
266
+ class="hk-notification-row__icon-count"
267
+ title={`${tally} ${t("hikari::toast.msgs", "msgs")}`}
268
+ aria-label={`${tally} ${t("hikari::toast.msgs", "msgs")}`}
269
+ >
270
+ {tally > 99 ? "99+" : tally}
271
+ </span>
272
+ )}
144
273
  </span>
145
274
  <div class="hk-notification-row__body">
146
275
  <div class="hk-notification-row__top">
@@ -150,14 +279,14 @@ export default defineComponent({
150
279
  {/* The state word is a flex:none SIBLING of the clipping
151
280
  title (round-2 review: inside the span, ellipsis ate it
152
281
  first for exactly the long titles where it matters). */}
153
- {(entry.state === "snoozed" || entry.state === "cleared") && (
282
+ {chip && (
154
283
  <span class="hk-notification-row__title-state">
155
284
  {"· "}
156
285
  {t(
157
- entry.state === "snoozed"
286
+ chip.state === "snoozed"
158
287
  ? "hikari::notificationCenter.stateHidden"
159
288
  : "hikari::notificationCenter.stateResolved",
160
- entry.state === "snoozed" ? "Hidden" : "Resolved",
289
+ chip.state === "snoozed" ? "Hidden" : "Resolved",
161
290
  )}
162
291
  </span>
163
292
  )}
@@ -197,17 +326,26 @@ export default defineComponent({
197
326
  size={24}
198
327
  variant="ghost"
199
328
  aria-label={t("hikari::notificationCenter.dismiss", "Dismiss")}
200
- onClick={() => forget(entry.id)}
329
+ onClick={() => {
330
+ // X on a consolidated row dismisses the WHOLE line —
331
+ // every member whose surface allows dismissal (a live
332
+ // emergency episode is never user-dismissable).
333
+ for (const m of group.members) {
334
+ if (!(m.kind === "emergency" && m.state !== "cleared")) {
335
+ forget(m.id);
336
+ }
337
+ }
338
+ }}
201
339
  >
202
340
  {{ icon: () => <X size={14} /> }}
203
341
  </HkIconButton>
204
342
  )}
205
- {resummonable && (
343
+ {restorable && (
206
344
  <HkIconButton
207
345
  size={24}
208
346
  variant="ghost"
209
347
  aria-label={t("hikari::emergencyAlert.restore", "Show again")}
210
- onClick={() => entry.onResummon?.()}
348
+ onClick={() => restorable.onResummon?.()}
211
349
  >
212
350
  {{ icon: () => h(RotateCcw, { size: 14 }) }}
213
351
  </HkIconButton>
@@ -255,9 +393,11 @@ export default defineComponent({
255
393
  </p>
256
394
  ) : (
257
395
  <>
258
- <ul class="hk-notification-center__list" role="list">
259
- {sorted.value.map(renderRow)}
260
- </ul>
396
+ <div class="hk-notification-center__list-wrap" ref={listWrapRef}>
397
+ <ul class="hk-notification-center__list" role="list" ref={listRef}>
398
+ {groups.value.map(renderRow)}
399
+ </ul>
400
+ </div>
261
401
  <div class="hk-notification-center__foot">
262
402
  {/* The wipe glyph reads before the label is parsed —
263
403
  a destructive affordance announced by its icon
@@ -9,13 +9,32 @@
9
9
  * STRIP: overflow hides under edge fades (data-h-overflow masks, the
10
10
  * HkScrollContainer contract) and pans by wheel / mouse drag / native
11
11
  * touch (the machinery lives in useOptionStrip); phones relax back into
12
- * a wrapping group (media query below — the sheet carries full width).
12
+ * a wrapping group (media query below — wrap replaces the pan; the hug
13
+ * survives, so a one-line set stays pill-width and only a wrapping set
14
+ * fills the sheet).
13
15
  */
14
16
 
15
17
  @use "../styles/polyfill" as *;
16
18
 
17
19
  .hk-pill-group {
18
- display: flex;
20
+ /* HUG, DON'T STRETCH (2026-11-19 report: "the group has mysterious
21
+ * padding" — a bordered EMPTY BOX trailing the last pill in a ~148px
22
+ * table cell). The track is a block-level div, so a `display: flex`
23
+ * track filled its container and the chrome framed blank space to the
24
+ * right of a short option set. `inline-flex` + `width: fit-content`
25
+ * makes the track exactly as wide as its pills; the pairing is NOT
26
+ * redundant — a flex item is display-blockified (inline-flex → flex),
27
+ * so only the definite `fit-content` width stops a column flex parent's
28
+ * `align-items: stretch` from re-filling the lane (HkFilterChip's
29
+ * `.hk-filter-chip-body` and the hosts' `flex flex-col` form-field
30
+ * slots are exactly such parents).
31
+ *
32
+ * `max-width: 100%` is what keeps the pannable strip intact: a pill
33
+ * set too wide for the lane still clamps to the lane, so
34
+ * `scrollWidth > clientWidth` (the data-h-overflow fade sensing in
35
+ * useOptionStrip) and the wheel/drag pan behave exactly as before. */
36
+ display: inline-flex;
37
+ width: fit-content;
19
38
  flex-wrap: nowrap;
20
39
  max-width: 100%;
21
40
  gap: var(--space-4, 4px);
@@ -144,10 +163,11 @@
144
163
  flex: 0 0 auto;
145
164
  }
146
165
 
147
- /* Phones: the sheet carries the full width, nothing pans there — the
148
- * strip relaxes back into the wrapping group (the wowsp filter bar's
149
- * rule; the fade masks and the grab affordance name interactions the
150
- * track no longer has). */
166
+ /* Phones: the wrap replaces the pan (the wowsp filter bar's rule; the
167
+ * fade masks and the grab affordance name interactions the track no
168
+ * longer has). Only wrap/overflow/touch/cursor relax — the hug and the
169
+ * lane clamp survive, so a one-line set stays pill-width and a wrapping
170
+ * set fills the sheet width. */
151
171
  @media (max-width: 767px) {
152
172
  .hk-pill-group {
153
173
  flex-wrap: wrap;
@@ -277,3 +277,115 @@ describe("HkPillToggleGroup tone channel", () => {
277
277
  }
278
278
  });
279
279
  });
280
+
281
+ // ── Track geometry: hug, don't stretch ───────────────────────────────────
282
+ // 2026-11-19 report (shittim-chest GrantListEditor): the 授予/拒绝 state
283
+ // pills in a ~148px table cell sat left-aligned inside a full-width
284
+ // bordered track, so the chrome framed an EMPTY BOX after the last pill
285
+ // ("部分按钮组有莫名其妙的内边距"). The track must size to its pills while
286
+ // keeping the one-line pannable strip intact — happy-dom does no layout, so
287
+ // the contract is pinned over the sheet source (the nativeScrollbar /
288
+ // HkAffixPicker house pattern), never a computed width.
289
+ const scssSource = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "HkPillToggleGroup.scss"), "utf-8");
290
+
291
+ /** Extract ONE balanced `{...}` declaration block following the given
292
+ * selector — `[^}]*` would stop at the first nested `}` and let
293
+ * properties appended after a future nested block evade the pin. */
294
+ function cssBlock(src: string, selector: string): string {
295
+ const at = src.indexOf(selector);
296
+ expect(at, `${selector} block exists`).toBeGreaterThanOrEqual(0);
297
+ const open = src.indexOf("{", at);
298
+ let depth = 0;
299
+ for (let i = open; i < src.length; i++) {
300
+ if (src[i] === "{") depth++;
301
+ else if (src[i] === "}") {
302
+ depth--;
303
+ if (depth === 0) return src.slice(open, i + 1);
304
+ }
305
+ }
306
+ return "";
307
+ }
308
+
309
+ /** Declarations only: a comment that happens to quote a property must not
310
+ * satisfy a pin (mutating the rule away would otherwise stay green). */
311
+ function stripSassComments(src: string): string {
312
+ return src.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^[ \t]*\/\/.*$/gm, "");
313
+ }
314
+
315
+ /** The block's TOP-LEVEL declarations: the slice before the first nested
316
+ * rule (every nested rule in this sheet opens with `&`), then split on
317
+ * `;` — a terminator is a separator, never the next match's anchor, so
318
+ * consecutive declarations are all seen. Values trimmed and lowercased
319
+ * (CSS keywords are ASCII-case-insensitive, so `FLEX` and `flex` are
320
+ * the same declaration). Grouped per property so a LATER duplicate
321
+ * declaration cannot hide behind a passing first one — the pins below
322
+ * assert the FULL value set, not mere presence. */
323
+ function declarations(block: string): Map<string, string[]> {
324
+ const body = block.replace(/^[^{]*\{/, "").replace(/\}[^}]*$/, "");
325
+ const nestedAt = body.search(/(?:^|\n)\s*&/);
326
+ const top = nestedAt === -1 ? body : body.slice(0, nestedAt);
327
+ const out = new Map<string, string[]>();
328
+ for (const fragment of top.split(";")) {
329
+ const m = fragment.match(/^\s*([-a-z]+)\s*:\s*(.+?)\s*$/);
330
+ if (!m) continue;
331
+ const prop = m[1].toLowerCase();
332
+ const value = m[2].toLowerCase();
333
+ out.set(prop, [...(out.get(prop) ?? []), value]);
334
+ }
335
+ return out;
336
+ }
337
+
338
+ describe("HkPillToggleGroup track geometry contract", () => {
339
+ const track = stripSassComments(cssBlock(scssSource, ".hk-pill-group {"));
340
+ const trackDecls = declarations(track);
341
+
342
+ it("the track hugs its pills instead of filling the lane", () => {
343
+ // The FULL value sets, not presence: a later `width: 100%` in the same
344
+ // block would cancel the hug while a presence pin stayed green.
345
+ expect(trackDecls.get("display")).toEqual(["inline-flex"]);
346
+ expect(trackDecls.get("width")).toEqual(["fit-content"]);
347
+ expect(trackDecls.get("max-width")).toEqual(["100%"]);
348
+ // The pair is NOT redundant: a flex item is display-blockified
349
+ // (inline-flex → flex), so only a definite width stops a column flex
350
+ // parent's align-items: stretch from re-filling the lane (HkFilterChip's
351
+ // .hk-filter-chip-body column and the hosts' `flex flex-col` form-field
352
+ // slots are exactly such parents — HkTimePicker centers itself with
353
+ // align-self).
354
+ // No !important games: an override ladder inside the block must not be
355
+ // able to resurrect the stretch behind the pins above.
356
+ expect(track, "no important override inside the track block").not.toContain("!important");
357
+ });
358
+
359
+ it("the clamp keeps the one-line pannable strip alive when pills overflow", () => {
360
+ // fit-content + the clamp = shrink-to-fit capped at the lane: the pill
361
+ // set that genuinely overflows still scrolls, and useOptionStrip's
362
+ // scrollWidth-vs-clientWidth fade sensing still sees it. (The clamp
363
+ // value set is asserted above; the scroll machinery is asserted here.)
364
+ expect(track).toMatch(/overflow-x:\s*auto;/);
365
+ expect(track, "nowrap: one pannable line, not a wrap").toMatch(/flex-wrap:\s*nowrap;/);
366
+ // The native-scrollbar suppression pair rides inside this rule block
367
+ // (nativeScrollbar.contract.test.ts group 1 also enforces it).
368
+ expect(track).toMatch(/scrollbar-width:\s*none;/);
369
+ expect(track).toMatch(/&::-webkit-scrollbar\s*\{[^}]*display:\s*none/);
370
+ // Edge-fade masks are keyed off data-h-overflow — the sensing contract
371
+ // they share with HkScrollContainer must survive the hug.
372
+ for (const side of ["start", "end", "both"]) {
373
+ expect(track, `data-h-overflow=${side} fade`).toContain(`&[data-h-overflow="${side}"]`);
374
+ }
375
+ });
376
+
377
+ it("phones still relax the hugging track back into a wrapping group", () => {
378
+ const phone = stripSassComments(
379
+ cssBlock(scssSource.slice(scssSource.indexOf("@media (max-width: 767px)")), ".hk-pill-group {"),
380
+ );
381
+ const phoneDecls = declarations(phone);
382
+ expect(phoneDecls.get("flex-wrap")).toEqual(["wrap"]);
383
+ expect(phoneDecls.get("overflow")).toEqual(["visible"]);
384
+ // The media query relaxes ONLY wrap/overflow/touch/cursor: it must not
385
+ // re-declare display or width (that would restore the stretched track
386
+ // on phones behind the desktop pins).
387
+ expect(phoneDecls.has("display"), "no display in the phone block").toBe(false);
388
+ expect(phoneDecls.has("width"), "no width in the phone block").toBe(false);
389
+ expect(phoneDecls.has("max-width"), "no max-width in the phone block").toBe(false);
390
+ });
391
+ });
@@ -45,8 +45,15 @@ function resolveIcon(icon: unknown): VNode | null {
45
45
  * hides under edge fades and pans by wheel / mouse drag / native touch,
46
46
  * exactly the 水表 popups' behavior — a wrapping track always measured
47
47
  * ONE long line inside HkPopover's max-content panel and ran off-screen
48
- * (wowsp #667). Phones relax back into a wrapping group (the sheet
49
- * carries full width; nothing pans there) via the SCSS media query.
48
+ * (wowsp #667). Phones relax back into a wrapping group (wrap replaces
49
+ * the pan; the hug survives — a one-line set stays pill-width) via the
50
+ * SCSS media query.
51
+ * The track HUGS its pills (`inline-flex` + `width: fit-content` clamped
52
+ * by `max-width: 100%`), so a two-option state toggle inside a narrow
53
+ * table cell frames its own width instead of framing an empty box to the
54
+ * right of the last pill (2026-11-19 chest GrantListEditor report);
55
+ * the clamp keeps the pannable strip intact whenever the pills really
56
+ * overflow.
50
57
  *
51
58
  * Deliberately THIN (the host owns the set): `toggle(value)` reports one
52
59
  * pill toggled; the optional leading all-pill reports `all()` and the
@@ -666,8 +666,16 @@ describe("HkStatusBar", () => {
666
666
  // Reduced-motion users keep the steady tint.
667
667
  const scss = readFileSync(resolve(__dirname, "../styles/admin-tokens.scss"), "utf8");
668
668
  const rule = /\.s-status-bar-tag-reconnecting\s*\{[^}]*\}/.exec(scss)?.[0] ?? "";
669
- expect(rule, "reconnecting rule carries the breathe animation").toContain("animation:");
669
+ // Name + loop term, not a frozen shorthand: the duration/easing may be
670
+ // retuned without breaking the claim, while `animation: none` (the
671
+ // settled-state defect) and a lost `infinite` (one-shot pulse) both fail.
672
+ expect(rule, "reconnecting rule carries the breathe animation").toMatch(
673
+ /animation:\s*s-status-bar-reconnecting-breathe\b[^;]*\binfinite/,
674
+ );
670
675
  expect(scss).toContain("@keyframes s-status-bar-reconnecting-breathe");
676
+ // One declaration in the rule: an appended `animation: none` would win
677
+ // the cascade while the pinned shorthand above stayed present.
678
+ expect(rule.match(/(?:^|[;{\s])animation\s*:/g) ?? []).toHaveLength(1);
671
679
  expect(scss).toMatch(
672
680
  /@media[^{]*prefers-reduced-motion[^{]*\{[^@]*?\.s-status-bar-tag-reconnecting\s*\{[^}]*animation:\s*none/s,
673
681
  );
@@ -726,8 +726,11 @@ describe("HkTable section band stylesheet", () => {
726
726
 
727
727
  const cell = ruleBody(".hk-table-section-cell");
728
728
  expect(cell).toContain("text-align: start");
729
- expect(cell).toContain("border-bottom");
730
- expect(cell).toContain("background:");
729
+ expect(cell).toContain("border-bottom: 1px solid var(--hi-color-border");
730
+ expect(cell).toContain("background: var(--hi-color-bg-subtle");
731
+ // One declaration each — an appended override must not hide.
732
+ expect(cell.match(/(?:^|[;{\s])border-bottom\s*:/g) ?? []).toHaveLength(1);
733
+ expect(cell.match(/(?:^|[;{\s])background\s*:/g) ?? []).toHaveLength(1);
731
734
  // The UA's `th { font-weight: bold }` must not leak into slot content.
732
735
  expect(cell).toContain("font-weight: inherit");
733
736
  expect(cell).not.toMatch(/font-weight:\s*(?:bold|[1-9]\d{2})/);
@@ -768,7 +771,10 @@ describe("HkTable section band stylesheet", () => {
768
771
  ".hk-table-lg .hk-table-section-cell",
769
772
  ]) {
770
773
  const body = ruleBody(selector);
771
- expect(body.trim()).toMatch(/^padding:/);
774
+ // The VALUE is pinned per rung (sweep round-2): a bare /^padding:/
775
+ // let `padding: 0` keep the sm rung green while the lg pin stayed
776
+ // satisfied by the other rule.
777
+ expect(body.trim()).toMatch(/^padding:\s*var\(--space-/);
772
778
  expect(body).not.toContain("font-size");
773
779
  expect(body).not.toContain("font-weight");
774
780
  }
@@ -156,6 +156,8 @@
156
156
  /* The segmented control is hikari's HkPillToggleGroup; only the clock
157
157
  * panel's own alignment/icon scale lives here. */
158
158
  .hk-tp-period {
159
+ /* The track hugs since HkPillToggleGroup's width change (2026-11-19); center the hugged track in the panel column. */
160
+ align-self: center;
159
161
  justify-content: center;
160
162
  cursor: default;
161
163
  touch-action: manipulation;
@@ -8,6 +8,33 @@ const here = dirname(fileURLToPath(import.meta.url));
8
8
  const scss = readFileSync(resolve(here, "HkTimePicker.scss"), "utf8");
9
9
  const tsx = readFileSync(resolve(here, "HkTimePicker.tsx"), "utf8");
10
10
 
11
+ /** The DECLARATIONS of a rule, comments stripped (a comment that names a
12
+ * property must not satisfy a guard about it). */
13
+ function ruleBlock(selector: string): string {
14
+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
15
+ const head = new RegExp(`${escaped}\\s*\\{`).exec(scss);
16
+ if (!head) throw new Error(`no rule for ${selector}`);
17
+ // Nested SCSS blocks: walk braces to the matching close.
18
+ const open = head.index + head[0].length - 1;
19
+ let depth = 0;
20
+ let end = open;
21
+ for (; end < scss.length; end++) {
22
+ if (scss[end] === "{") depth += 1;
23
+ else if (scss[end] === "}") {
24
+ depth -= 1;
25
+ if (depth === 0) break;
26
+ }
27
+ }
28
+ return scss
29
+ .slice(open + 1, end)
30
+ .split("\n")
31
+ .filter((line) => {
32
+ const t = line.trim();
33
+ return !t.startsWith("*") && !t.startsWith("/*") && !t.startsWith("//");
34
+ })
35
+ .join("\n");
36
+ }
37
+
11
38
  /**
12
39
  * Source-contract pins: the minute-mode metrics key (the number layer is
13
40
  * a sibling of the slider, so `.hk-tp-face.is-minute` can never match —
@@ -28,4 +55,17 @@ describe("HkTimePicker source contracts", () => {
28
55
  expect(tsx).toContain("<HkPillToggleGroup");
29
56
  expect(scss).not.toContain(".hk-tp-period-btn");
30
57
  });
58
+
59
+ it("centers the hugged period track in the panel's column", () => {
60
+ // HkPillToggleGroup's track hugs its pills (inline-flex + fit-content), so
61
+ // it no longer stretches to the panel width and `justify-content` alone
62
+ // cannot center it; the track must center itself against the panel's
63
+ // stretch alignment via `align-self`.
64
+ expect(ruleBlock(".hk-tp-period")).toMatch(/align-self:\s*center/);
65
+ // …and there is exactly ONE such rule: a later duplicate re-declaring
66
+ // `align-self` (or `justify-content`) would override the centering
67
+ // while the pin above stayed green (presence ≠ winner).
68
+ const ruleCount = scss.match(/\.hk-tp-period\s*\{/g)?.length ?? 0;
69
+ expect(ruleCount, "exactly one .hk-tp-period rule block").toBe(1);
70
+ });
31
71
  });
@@ -213,7 +213,10 @@ describe("HkTitleBar stylesheet contract", () => {
213
213
 
214
214
  it("keeps the windowed radius var wired to the close button", () => {
215
215
  const scss = readFileSync(resolve(componentDir, "HkTitleBar.scss"), "utf8");
216
- expect(scss).toContain("--hk-tb-radius-close:");
216
+ expect(scss).toContain("--hk-tb-radius-close: 0 var(--radius-md) 0 0;");
217
+ // Declaration + exactly one consumer: a second declaration would override
218
+ // the pinned one while it stayed in the text.
219
+ expect(scss.match(/--hk-tb-radius-close/g) ?? []).toHaveLength(2);
217
220
  const body = ruleBody(css, ".hk-titlebar .hk-titlebar-btn-close");
218
221
  expect(body).toContain("border-radius: var(--hk-tb-radius-close)");
219
222
  });
@@ -53,8 +53,11 @@ describe("minimap dock stylesheet contract", () => {
53
53
  expect(canvasCss).toContain(".hk-node-canvas-minimap[data-placement=bottom-right]");
54
54
  const dock = ruleFor(boardCss, ".hk-board-minimap");
55
55
  expect(dock).toContain("position: absolute");
56
- expect(dock).toContain("inset-inline-end");
57
- expect(dock).toContain("bottom");
56
+ expect(dock).toContain("inset-inline-end: var(--space-10)");
57
+ expect(dock).toContain("bottom: var(--space-10)");
58
+ // One declaration per axis — an appended override must not hide.
59
+ expect(dock.match(/(?:^|[;{\s])inset-inline-end\s*:/g) ?? []).toHaveLength(1);
60
+ expect(dock.match(/(?:^|[;{\s])bottom\s*:/g) ?? []).toHaveLength(1);
58
61
  });
59
62
 
60
63
  it("the card's self-docking form survives for direct mounts", () => {