@celestia-island/hikari 0.55.395 → 0.55.396

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.395",
3
+ "version": "0.55.396",
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",
@@ -26,7 +26,15 @@ describe("emergency snooze tray composition contract", () => {
26
26
  expect(tsx).not.toMatch(/class=["'][^"']*hk-persistent-toast(?!-group)/);
27
27
  });
28
28
 
29
- it("restore goes through the context, not ad-hoc state", () => {
30
- expect(tsx).toMatch(/unsnoozeEmergencyAlert\(item\.id\)/);
29
+ it("the detail card mirrors the toast text — no restore affordance here", () => {
30
+ // 2026-11-15 user ruling: the bell panel owns restore (each snoozed
31
+ // bell row carries the armed unsnooze button). The tray's hover card
32
+ // must not re-create it — that was the "添油加醋" the ruling retired,
33
+ // and a second restore home beside the bell's would fork the path.
34
+ expect(tsx).not.toMatch(/unsnoozeEmergencyAlert/);
35
+ expect(tsx).not.toMatch(/HkButton/);
36
+ // The card still mirrors the original toast's text surface:
37
+ expect(tsx).toContain("hk-emergency-snooze-card__title");
38
+ expect(tsx).toContain("hk-emergency-snooze-card__desc");
31
39
  });
32
40
  });
@@ -16,8 +16,9 @@ import {
16
16
  * - snoozed alerts render HkPersistentToast chips (severity tone,
17
17
  * label = title), iconOnly collapses to the icon (label span gone,
18
18
  * aria-label kept)
19
- * - the restore button in the detail card unsnoozes (the alert
20
- * returns to the band; the chip leaves the tray)
19
+ * - the detail card mirrors the original toast text (icon + title +
20
+ * description) with NO restore button — restore lives in the
21
+ * notification-center bell panel (2026-11-15 user ruling)
21
22
  */
22
23
 
23
24
  const mounts: Array<{ app: ReturnType<typeof createApp>; container: HTMLElement }> = [];
@@ -105,21 +106,21 @@ describe("HEmergencySnoozeTray", () => {
105
106
  expect(chip.getAttribute("aria-label")).toBe("可用额度已用完");
106
107
  });
107
108
 
108
- it("the restore button unsnoozes: the chip leaves the tray", async () => {
109
+ it("the hover card mirrors the toast text with NO restore button", async () => {
110
+ // 2026-11-15 user ruling: the bell panel owns restore; the tray's
111
+ // hover card is a text mirror only (no second restore home beside
112
+ // the bell's).
109
113
  mountHost();
110
114
  raiseEmergencyAlert({ id: "q", severity: "warning", title: "t", dismissible: true });
111
115
  snoozeEmergencyAlert("q");
112
116
  await settle();
113
- // The detail card is lazy: clicking the chip pins it open, which
114
- // is how a keyboard/touch user reaches the restore button.
115
117
  chips()[0].click();
116
118
  await settle();
117
- const restore = document.querySelector<HTMLButtonElement>(".hk-emergency-snooze-card button");
118
- expect(restore).not.toBeNull();
119
- restore!.click();
120
- await settle();
121
- const { alerts } = useEmergencyAlert();
122
- expect(alerts[0]?.snoozed).toBe(false);
123
- expect(chips()).toHaveLength(0);
119
+ expect(
120
+ document.querySelector(".hk-emergency-snooze-card button"),
121
+ "the tray must not grow a second restore affordance",
122
+ ).toBeNull();
123
+ // The title text still mirrors the original toast.
124
+ expect(document.querySelector(".hk-emergency-snooze-card__title")?.textContent).toBe("t");
124
125
  });
125
126
  });
@@ -14,9 +14,10 @@
14
14
  *
15
15
  * Chip contract:
16
16
  * - tone = the alert's severity (warning amber / danger red);
17
- * - label = the alert title; the detail card carries the description
18
- * and a "show again" button — clicking it UNSNOOZES the alert (the
19
- * band returns; the episode stays live until the condition clears).
17
+ * - label = the alert title; the detail card mirrors the original
18
+ * toast text (icon + title + description — no extra affordances;
19
+ * the tray's own Show-again button was retired 2026-11-15 — restore
20
+ * lives in the notification-center bell panel).
20
21
  * - Narrow chrome bars (host passes `iconOnly`, e.g. via
21
22
  * useBreakpoint().isMobile) collapse each chip to its tone icon;
22
23
  * the group counter takes over from there.
@@ -27,13 +28,10 @@
27
28
  import { TriangleAlert } from "lucide-vue-next";
28
29
  import { computed, defineComponent } from "vue";
29
30
 
30
- import { useI18n } from "../i18n/context";
31
31
  import {
32
- unsnoozeEmergencyAlert,
33
32
  useEmergencyAlert,
34
33
  type EmergencyAlertItem,
35
34
  } from "../runtime/useEmergencyAlert";
36
- import HkButton from "./HkButton";
37
35
  import HkPersistentToast from "./HkPersistentToast";
38
36
  import HkPersistentToastGroup from "./HkPersistentToastGroup";
39
37
 
@@ -50,7 +48,6 @@ export default defineComponent({
50
48
  },
51
49
  setup(props) {
52
50
  const { alerts } = useEmergencyAlert();
53
- const { t } = useI18n();
54
51
 
55
52
  const snoozed = computed(() => alerts.filter((a) => a.snoozed));
56
53
  const resolvedMaxVisible = computed(() =>
@@ -77,13 +74,6 @@ export default defineComponent({
77
74
  {item.description && (
78
75
  <p class="hk-emergency-snooze-card__desc">{item.description}</p>
79
76
  )}
80
- <HkButton
81
- size="sm"
82
- variant="primary"
83
- onClick={() => unsnoozeEmergencyAlert(item.id)}
84
- >
85
- {t("hikari::emergencyAlert.restore", "Show again")}
86
- </HkButton>
87
77
  </div>
88
78
  ),
89
79
  }}
@@ -18,7 +18,21 @@
18
18
  .hk-notification-center {
19
19
  display: flex;
20
20
  flex-direction: column;
21
- width: min(22rem, 100%);
21
+ /* FIXED width, never a percentage: the popover panel sizes itself to
22
+ max-content, and a `min(22rem, 100%)` child resolves cyclically
23
+ there — the panel hugged the nowrap detail's FULL text width while
24
+ the body clamped to 22rem, leaving a dead band on the right (the
25
+ "莫名其妙的空挡"). A definite 22rem makes the panel wrap it exactly. */
26
+ width: 22rem;
27
+ max-width: calc(100vw - 2 * var(--viewport-gutter, 16px));
28
+
29
+ /* The mobile sheet is viewport-wide: the body follows (and the
30
+ desktop max-width must be reset, or a dead band reappears on the
31
+ sheet's right — round-2 review, PR #1333). */
32
+ .hk-is-sheet & {
33
+ width: 100%;
34
+ max-width: none;
35
+ }
22
36
  }
23
37
 
24
38
  .hk-notification-center__list {
@@ -174,6 +188,27 @@
174
188
  border-radius: 4px;
175
189
  }
176
190
 
191
+ .hk-notification-row__actions {
192
+ flex: none;
193
+ display: flex;
194
+ align-items: center;
195
+ align-self: flex-start;
196
+ }
197
+
198
+ /* Ink for the per-row dismiss glyph (round-3 review, PR #1333 — proven
199
+ * by computed style): the ghost HkIconButton pins its glyph to
200
+ * --hi-icon-button-icon-color ON the button, so `color` on any ancestor
201
+ * is inert. The var must be overridden on the button itself: quiet
202
+ * secondary ink at rest, legible on row hover or keyboard focus-within. */
203
+ .hk-notification-row__actions .hk-icon-button {
204
+ --hi-icon-button-icon-color: rgb(var(--color-text) / 40%);
205
+ }
206
+
207
+ .hk-notification-row:hover .hk-notification-row__actions .hk-icon-button,
208
+ .hk-notification-row:focus-within .hk-notification-row__actions .hk-icon-button {
209
+ --hi-icon-button-icon-color: rgb(var(--color-text) / 85%);
210
+ }
211
+
177
212
  .hk-notification-row__meta {
178
213
  display: flex;
179
214
  align-items: center;
@@ -0,0 +1,47 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ import { describe, expect, it } from "vitest";
5
+
6
+ /**
7
+ * Text pins for the bell's sheet layout and the dismiss-glyph ink
8
+ * (round-3 review, PR #1333): both fixes lived in scss no test read,
9
+ * so a revert stayed green. Comments are stripped before matching.
10
+ */
11
+ const scss = readFileSync(join(__dirname, "HkNotificationBell.scss"), "utf-8")
12
+ .replace(/\/\*[\s\S]*?\*\//g, "")
13
+ .replace(/^[ \t]*\/\/.*$/gm, "");
14
+
15
+ describe("HkNotificationBell scss contract", () => {
16
+ it("the panel body is a definite 22rem inside the max-content popover", () => {
17
+ expect(scss).toContain("width: 22rem;");
18
+ // The old `min(22rem, 100%)` clamp is the dead-band root cause.
19
+ expect(scss).not.toMatch(/width:\s*min\(/);
20
+ });
21
+
22
+ it("the sheet branch follows the viewport AND resets the desktop max-width", () => {
23
+ expect(scss).toMatch(
24
+ /\.hk-is-sheet &\s*\{[^}]*width:\s*100%;[^}]*max-width:\s*none;/,
25
+ );
26
+ });
27
+
28
+ it("the dismiss glyph ink rides --hi-icon-button-icon-color (ancestor color is inert)", () => {
29
+ // Rest ink on the button, plus the row-hover/focus-within brighten —
30
+ // both through the var channel the ghost button itself consumes.
31
+ // The rest rule is anchored at line start so the joint block's
32
+ // :focus-within selector line cannot satisfy it for the 40% value
33
+ // (round-6 review: deleting just the rest arm kept the file green).
34
+ expect(scss).toMatch(
35
+ /^\.hk-notification-row__actions \.hk-icon-button \{[^}]*--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 40%\)/m,
36
+ );
37
+ // The joint rule block: BOTH pseudo-classes must key the var, each
38
+ // in its own selector arm (a mutant that keeps only :focus-within
39
+ // and downgrades :hover to inert ancestor color fails here).
40
+ expect(scss).toMatch(
41
+ /\.hk-notification-row:hover \.hk-notification-row__actions \.hk-icon-button,\s*\n\.hk-notification-row:focus-within \.hk-notification-row__actions \.hk-icon-button\s*\{[^}]*--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 85%\)/,
42
+ );
43
+ expect(scss).toMatch(
44
+ /\.hk-notification-row:focus-within \.hk-notification-row__actions \.hk-icon-button\s*\{\s*--hi-icon-button-icon-color:/,
45
+ );
46
+ });
47
+ });
@@ -156,6 +156,21 @@ describe("panel rows", () => {
156
156
  expect(row.querySelector(".hk-notification-row__state")).toBeFalsy();
157
157
  });
158
158
 
159
+ it("an emergency row carries NO dismiss button (live episode is not user-dismissable)", async () => {
160
+ await setLocale("en");
161
+ raiseEmergencyAlert({ id: "quota", severity: "warning", title: "quota out", dismissible: true });
162
+ snoozeEmergencyAlert("quota");
163
+ mountBell();
164
+ await settle();
165
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
166
+ await settle();
167
+ expect(rows()).toHaveLength(1);
168
+ expect(
169
+ rows()[0].querySelector(".hk-notification-row__actions .hk-icon-button"),
170
+ "the emergency row must not carry the dismiss control",
171
+ ).toBeNull();
172
+ });
173
+
159
174
  it("a same-millisecond tie renders the LATER push above (append order)", async () => {
160
175
  // R8/R9 pin (PR #1322): with updatedAt equal the journal's own
161
176
  // append order judges — the later push must sit above the earlier
@@ -195,24 +210,34 @@ describe("panel rows", () => {
195
210
  const row = rows()[0];
196
211
  expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Resolved");
197
212
  expect(row.querySelector(".hk-notification-row__restore")).toBeFalsy();
213
+ // R10 (PR #1333): the state-scoped gate means a CLEARED emergency
214
+ // row IS dismissable — this is the pin that was lost in eb492e44's
215
+ // wrong-sibling deletion.
216
+ expect(
217
+ row.querySelector(".hk-notification-row__actions .hk-icon-button"),
218
+ "a resolved record is dismissable",
219
+ ).not.toBeNull();
198
220
  });
199
221
 
200
- it("a cleared emergency shows Resolved without a restore button", async () => {
222
+ it("the row dismiss button forgets that entry only", async () => {
223
+ // The unified per-row affordance (user ruling 2026-11-15): every row
224
+ // carries a trailing dismiss control — remove THIS record, leave the
225
+ // rest of the journal alone.
201
226
  await setLocale("en");
202
- recordNotification({
203
- id: "emergency:done",
204
- kind: "emergency",
205
- tone: "warning",
206
- title: "resolved",
207
- state: "cleared",
208
- });
227
+ recordNotification({ id: "a", kind: "toast", tone: "error", title: "keep me" });
228
+ recordNotification({ id: "b", kind: "toast", tone: "warning", title: "drop me" });
209
229
  mountBell();
210
230
  await settle();
211
231
  bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
212
232
  await settle();
213
- const row = rows()[0];
214
- expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Resolved");
215
- expect(row.querySelector(".hk-notification-row__restore")).toBeFalsy();
233
+ expect(rows()).toHaveLength(2);
234
+ const dropRow = rows().find((r) => r.textContent?.includes("drop me"))!;
235
+ const dismiss = dropRow.querySelector<HTMLButtonElement>(".hk-notification-row__actions .hk-icon-button")!;
236
+ expect(dismiss.getAttribute("aria-label")).toBe("Dismiss");
237
+ dismiss.dispatchEvent(new MouseEvent("click", { bubbles: true }));
238
+ await settle();
239
+ expect(rows()).toHaveLength(1);
240
+ expect(rows()[0].textContent).toContain("keep me");
216
241
  });
217
242
 
218
243
  it("rows sort newest-first and Clear all empties the journal", async () => {
@@ -27,7 +27,7 @@
27
27
  * itself — an empty notification center still shows its (disabled-
28
28
  * looking) trigger so the host chrome never reflows on first use.
29
29
  */
30
- import { CircleCheck as CheckCircle, Info, LoaderCircle, TriangleAlert as AlertTriangle } from "lucide-vue-next";
30
+ import { CircleCheck as CheckCircle, Info, LoaderCircle, TriangleAlert as AlertTriangle, X } from "lucide-vue-next";
31
31
  import { computed, defineComponent, h, ref, watch, type Component } from "vue";
32
32
 
33
33
  import { useChromeActionSize } from "../composables/useChromeActionSize";
@@ -67,7 +67,7 @@ export default defineComponent({
67
67
  name: "HkNotificationBell",
68
68
  setup() {
69
69
  const { t } = useI18n();
70
- const { entries, markAllRead, reset } = useNotificationCenter();
70
+ const { entries, forget, markAllRead, reset } = useNotificationCenter();
71
71
  const chromeSize = useChromeActionSize();
72
72
  const open = ref(false);
73
73
  const anchorRef = ref<HTMLElement | null>(null);
@@ -147,6 +147,26 @@ export default defineComponent({
147
147
  </div>
148
148
  )}
149
149
  </div>
150
+ {/* The unified per-row dismiss (user ruling 2026-11-15) applies
151
+ to RECORDS — but never to a LIVE emergency episode: a
152
+ snoozed alert's entry carries the app's ONLY restore handle
153
+ (onResummon), and forgetting it would strand the alert with
154
+ no recall path while the polled episode self-reverts the
155
+ row (round-6 review, PR #1333). Cleared rows are records
156
+ again and stay dismissable. */}
157
+ {(entry.kind !== "emergency" ||
158
+ entry.state === "cleared") && (
159
+ <div class="hk-notification-row__actions">
160
+ <HIconButton
161
+ size={24}
162
+ variant="ghost"
163
+ aria-label={t("hikari::notificationCenter.dismiss", "Dismiss")}
164
+ onClick={() => forget(entry.id)}
165
+ >
166
+ {{ icon: () => <X size={14} /> }}
167
+ </HIconButton>
168
+ </div>
169
+ )}
150
170
  </li>
151
171
  );
152
172
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "لا إشعارات بعد",
357
357
  "hikari::notificationCenter.stateHidden": "مخفي",
358
358
  "hikari::notificationCenter.stateResolved": "تم الحل",
359
- "hikari::notificationCenter.clearAll": "مسح الكل"
359
+ "hikari::notificationCenter.clearAll": "مسح الكل",
360
+ "hikari::notificationCenter.dismiss": "تجاهل"
360
361
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "Noch keine Benachrichtigungen",
357
357
  "hikari::notificationCenter.stateHidden": "Ausgeblendet",
358
358
  "hikari::notificationCenter.stateResolved": "Behoben",
359
- "hikari::notificationCenter.clearAll": "Alle löschen"
359
+ "hikari::notificationCenter.clearAll": "Alle löschen",
360
+ "hikari::notificationCenter.dismiss": "Verwerfen"
360
361
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "No notifications yet",
357
357
  "hikari::notificationCenter.stateHidden": "Hidden",
358
358
  "hikari::notificationCenter.stateResolved": "Resolved",
359
- "hikari::notificationCenter.clearAll": "Clear all"
359
+ "hikari::notificationCenter.clearAll": "Clear all",
360
+ "hikari::notificationCenter.dismiss": "Dismiss"
360
361
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "Aún no hay notificaciones",
357
357
  "hikari::notificationCenter.stateHidden": "Oculta",
358
358
  "hikari::notificationCenter.stateResolved": "Resuelta",
359
- "hikari::notificationCenter.clearAll": "Borrar todo"
359
+ "hikari::notificationCenter.clearAll": "Borrar todo",
360
+ "hikari::notificationCenter.dismiss": "Descartar"
360
361
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "Aucune notification pour l'instant",
357
357
  "hikari::notificationCenter.stateHidden": "Masquée",
358
358
  "hikari::notificationCenter.stateResolved": "Résolue",
359
- "hikari::notificationCenter.clearAll": "Tout effacer"
359
+ "hikari::notificationCenter.clearAll": "Tout effacer",
360
+ "hikari::notificationCenter.dismiss": "Ignorer"
360
361
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "通知はまだありません",
357
357
  "hikari::notificationCenter.stateHidden": "非表示",
358
358
  "hikari::notificationCenter.stateResolved": "解決済み",
359
- "hikari::notificationCenter.clearAll": "すべて消去"
359
+ "hikari::notificationCenter.clearAll": "すべて消去",
360
+ "hikari::notificationCenter.dismiss": "削除"
360
361
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "알림이 없습니다",
357
357
  "hikari::notificationCenter.stateHidden": "숨김",
358
358
  "hikari::notificationCenter.stateResolved": "해제됨",
359
- "hikari::notificationCenter.clearAll": "모두 지우기"
359
+ "hikari::notificationCenter.clearAll": "모두 지우기",
360
+ "hikari::notificationCenter.dismiss": "지우기"
360
361
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "Ainda não há notificações",
357
357
  "hikari::notificationCenter.stateHidden": "Oculta",
358
358
  "hikari::notificationCenter.stateResolved": "Resolvida",
359
- "hikari::notificationCenter.clearAll": "Limpar tudo"
359
+ "hikari::notificationCenter.clearAll": "Limpar tudo",
360
+ "hikari::notificationCenter.dismiss": "Descartar"
360
361
  }
@@ -356,5 +356,6 @@
356
356
  "hikari::notificationCenter.empty": "Уведомлений пока нет",
357
357
  "hikari::notificationCenter.stateHidden": "Скрыто",
358
358
  "hikari::notificationCenter.stateResolved": "Устранено",
359
- "hikari::notificationCenter.clearAll": "Очистить всё"
359
+ "hikari::notificationCenter.clearAll": "Очистить всё",
360
+ "hikari::notificationCenter.dismiss": "Скрыть"
360
361
  }
@@ -360,5 +360,6 @@
360
360
  "hikari::notificationCenter.empty": "暂无通知",
361
361
  "hikari::notificationCenter.stateHidden": "已隐藏",
362
362
  "hikari::notificationCenter.stateResolved": "已恢复",
363
- "hikari::notificationCenter.clearAll": "全部清空"
363
+ "hikari::notificationCenter.clearAll": "全部清空",
364
+ "hikari::notificationCenter.dismiss": "消除"
364
365
  }
@@ -360,5 +360,6 @@
360
360
  "hikari::notificationCenter.empty": "暫無通知",
361
361
  "hikari::notificationCenter.stateHidden": "已隱藏",
362
362
  "hikari::notificationCenter.stateResolved": "已恢復",
363
- "hikari::notificationCenter.clearAll": "全部清空"
363
+ "hikari::notificationCenter.clearAll": "全部清空",
364
+ "hikari::notificationCenter.dismiss": "消除"
364
365
  }