@celestia-island/hikari 0.55.396 → 0.55.397
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
|
@@ -78,26 +78,11 @@
|
|
|
78
78
|
margin-top: var(--space-8, 0.5rem);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
.hk-notification-center__clear {
|
|
82
|
-
appearance: none;
|
|
83
|
-
background: none;
|
|
84
|
-
border: none;
|
|
85
|
-
padding: 0 var(--space-4, 0.25rem);
|
|
86
|
-
color: rgb(var(--color-text) / 55%);
|
|
87
|
-
font-size: 0.75rem;
|
|
88
|
-
cursor: pointer;
|
|
89
|
-
|
|
90
|
-
&:hover {
|
|
91
|
-
color: rgb(var(--color-text) / 85%);
|
|
92
|
-
text-decoration: underline;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
81
|
/* ── rows ─────────────────────────────────────────────────────────── */
|
|
97
82
|
|
|
98
83
|
.hk-notification-row {
|
|
99
84
|
display: flex;
|
|
100
|
-
gap: var(--space-
|
|
85
|
+
gap: var(--space-10, 0.625rem);
|
|
101
86
|
padding: var(--space-8, 0.5rem) var(--space-8, 0.5rem);
|
|
102
87
|
border-bottom: 1px solid rgb(var(--color-border) / 6%);
|
|
103
88
|
|
|
@@ -193,6 +178,7 @@
|
|
|
193
178
|
display: flex;
|
|
194
179
|
align-items: center;
|
|
195
180
|
align-self: flex-start;
|
|
181
|
+
gap: var(--space-4, 0.25rem);
|
|
196
182
|
}
|
|
197
183
|
|
|
198
184
|
/* Ink for the per-row dismiss glyph (round-3 review, PR #1333 — proven
|
|
@@ -220,15 +206,3 @@
|
|
|
220
206
|
font-size: 0.6875rem;
|
|
221
207
|
color: rgb(var(--color-text) / 45%);
|
|
222
208
|
}
|
|
223
|
-
|
|
224
|
-
.hk-notification-row__restore {
|
|
225
|
-
appearance: none;
|
|
226
|
-
background: none;
|
|
227
|
-
border: none;
|
|
228
|
-
padding: 0;
|
|
229
|
-
font-size: 0.75rem;
|
|
230
|
-
color: rgb(var(--color-primary, var(--color-text)) / 90%);
|
|
231
|
-
cursor: pointer;
|
|
232
|
-
text-decoration: underline;
|
|
233
|
-
text-underline-offset: 2px;
|
|
234
|
-
}
|
|
@@ -133,14 +133,16 @@ describe("panel rows", () => {
|
|
|
133
133
|
const row = rows()[0];
|
|
134
134
|
expect(row.classList.contains("is-snoozed")).toBe(true);
|
|
135
135
|
expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Hidden");
|
|
136
|
-
const
|
|
137
|
-
|
|
136
|
+
const restoreBtns = row.querySelectorAll<HTMLButtonElement>(".hk-notification-row__actions .hk-icon-button");
|
|
137
|
+
const restore = restoreBtns[restoreBtns.length - 1];
|
|
138
|
+
expect(restore, "restore button renders").toBeTruthy();
|
|
139
|
+
expect(restore!.getAttribute("aria-label")).toContain("Show again");
|
|
138
140
|
restore!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
139
141
|
await settle();
|
|
140
142
|
// The band is live again and the record follows — and the restore
|
|
141
143
|
// button is GONE (R2 finding: no dead control on an active band).
|
|
142
144
|
expect(row.classList.contains("is-active")).toBe(true);
|
|
143
|
-
expect(row.querySelector(
|
|
145
|
+
expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
|
|
144
146
|
});
|
|
145
147
|
|
|
146
148
|
it("an ACTIVE emergency row (band on screen) shows no restore button", async () => {
|
|
@@ -152,7 +154,7 @@ describe("panel rows", () => {
|
|
|
152
154
|
await settle();
|
|
153
155
|
const row = rows()[0];
|
|
154
156
|
expect(row.classList.contains("is-active")).toBe(true);
|
|
155
|
-
expect(row.querySelector(
|
|
157
|
+
expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
|
|
156
158
|
expect(row.querySelector(".hk-notification-row__state")).toBeFalsy();
|
|
157
159
|
});
|
|
158
160
|
|
|
@@ -166,7 +168,7 @@ describe("panel rows", () => {
|
|
|
166
168
|
await settle();
|
|
167
169
|
expect(rows()).toHaveLength(1);
|
|
168
170
|
expect(
|
|
169
|
-
rows()[0].querySelector(
|
|
171
|
+
rows()[0].querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Dismiss"]'),
|
|
170
172
|
"the emergency row must not carry the dismiss control",
|
|
171
173
|
).toBeNull();
|
|
172
174
|
});
|
|
@@ -209,7 +211,7 @@ describe("panel rows", () => {
|
|
|
209
211
|
await settle();
|
|
210
212
|
const row = rows()[0];
|
|
211
213
|
expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Resolved");
|
|
212
|
-
expect(row.querySelector(
|
|
214
|
+
expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
|
|
213
215
|
// R10 (PR #1333): the state-scoped gate means a CLEARED emergency
|
|
214
216
|
// row IS dismissable — this is the pin that was lost in eb492e44's
|
|
215
217
|
// wrong-sibling deletion.
|
|
@@ -255,7 +257,7 @@ describe("panel rows", () => {
|
|
|
255
257
|
const titles = rows().map((r) => r.querySelector(".hk-notification-row__title")?.textContent);
|
|
256
258
|
expect(titles).toEqual(["newer", "older"]);
|
|
257
259
|
|
|
258
|
-
(document.querySelector<HTMLButtonElement>(".hk-notification-
|
|
260
|
+
(document.querySelector<HTMLButtonElement>(".hk-notification-center__foot .hk-btn")!).dispatchEvent(
|
|
259
261
|
new MouseEvent("click", { bubbles: true }),
|
|
260
262
|
);
|
|
261
263
|
await settle();
|
|
@@ -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, X } from "lucide-vue-next";
|
|
30
|
+
import { CircleCheck as CheckCircle, Info, LoaderCircle, RotateCcw, 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";
|
|
@@ -37,7 +37,8 @@ import {
|
|
|
37
37
|
type HkNotificationEntry,
|
|
38
38
|
type HkNotificationTone,
|
|
39
39
|
} from "../runtime/notificationCenter";
|
|
40
|
-
import
|
|
40
|
+
import HkIconButton from "./HkIconButton";
|
|
41
|
+
import HkButton from "./HkButton";
|
|
41
42
|
import HkPopover from "./HkPopover";
|
|
42
43
|
import "./HkNotificationBell.scss";
|
|
43
44
|
|
|
@@ -91,18 +92,15 @@ export default defineComponent({
|
|
|
91
92
|
|
|
92
93
|
function renderRow(entry: HkNotificationEntry) {
|
|
93
94
|
const Icon = TONE_ICONS[entry.tone] ?? Info;
|
|
94
|
-
|
|
95
|
-
// path (R2 finding, PR #1322): the callback may briefly survive
|
|
96
|
-
// a restore (the source re-arms/clears it), but an on-screen
|
|
97
|
-
// band is not something "Show again" can bring back — the state
|
|
98
|
-
// gate keeps a dead control off the row.
|
|
95
|
+
const isLive = entry.kind === "emergency" && entry.state !== "cleared";
|
|
99
96
|
const resummonable = entry.onResummon !== undefined && entry.state === "snoozed";
|
|
100
97
|
return (
|
|
101
98
|
<li key={entry.id} class={["hk-notification-row", `is-${entry.tone}`, `is-${entry.state}`]}>
|
|
99
|
+
{/* The row glyph renders through h(Icon, …): Vue's Component
|
|
100
|
+
union is not a valid JSX element type, so `<Icon />` is
|
|
101
|
+
not available here — both this tone glyph and the row
|
|
102
|
+
actions' RotateCcw go through the render function. */}
|
|
102
103
|
<span class="hk-notification-row__icon" aria-hidden="true">
|
|
103
|
-
{/* Render via h(): Vue's `Component` union includes non-callable
|
|
104
|
-
option types, so `<Icon />` is not a valid JSX element type
|
|
105
|
-
(the HkNavSidebar convention). */}
|
|
106
104
|
{h(Icon, { size: 14 })}
|
|
107
105
|
</span>
|
|
108
106
|
<div class="hk-notification-row__body">
|
|
@@ -135,38 +133,34 @@ export default defineComponent({
|
|
|
135
133
|
{t("hikari::notificationCenter.stateResolved", "Resolved")}
|
|
136
134
|
</span>
|
|
137
135
|
)}
|
|
138
|
-
{resummonable && (
|
|
139
|
-
<button
|
|
140
|
-
type="button"
|
|
141
|
-
class="hk-notification-row__restore"
|
|
142
|
-
onClick={() => entry.onResummon?.()}
|
|
143
|
-
>
|
|
144
|
-
{t("hikari::emergencyAlert.restore", "Show again")}
|
|
145
|
-
</button>
|
|
146
|
-
)}
|
|
147
136
|
</div>
|
|
148
137
|
)}
|
|
149
138
|
</div>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
again and stay dismissable. */}
|
|
157
|
-
{(entry.kind !== "emergency" ||
|
|
158
|
-
entry.state === "cleared") && (
|
|
159
|
-
<div class="hk-notification-row__actions">
|
|
160
|
-
<HIconButton
|
|
139
|
+
<div class="hk-notification-row__actions">
|
|
140
|
+
{/* Dismiss is gated OFF for live emergency episodes (round-6
|
|
141
|
+
S1: a snoozed alert's entry carries the ONLY restore
|
|
142
|
+
handle). Restore is gated ON only for snoozed entries. */}
|
|
143
|
+
{!isLive && (
|
|
144
|
+
<HkIconButton
|
|
161
145
|
size={24}
|
|
162
146
|
variant="ghost"
|
|
163
147
|
aria-label={t("hikari::notificationCenter.dismiss", "Dismiss")}
|
|
164
148
|
onClick={() => forget(entry.id)}
|
|
165
149
|
>
|
|
166
150
|
{{ icon: () => <X size={14} /> }}
|
|
167
|
-
</
|
|
168
|
-
|
|
169
|
-
|
|
151
|
+
</HkIconButton>
|
|
152
|
+
)}
|
|
153
|
+
{resummonable && (
|
|
154
|
+
<HkIconButton
|
|
155
|
+
size={24}
|
|
156
|
+
variant="ghost"
|
|
157
|
+
aria-label={t("hikari::emergencyAlert.restore", "Show again")}
|
|
158
|
+
onClick={() => entry.onResummon?.()}
|
|
159
|
+
>
|
|
160
|
+
{{ icon: () => h(RotateCcw, { size: 14 }) }}
|
|
161
|
+
</HkIconButton>
|
|
162
|
+
)}
|
|
163
|
+
</div>
|
|
170
164
|
</li>
|
|
171
165
|
);
|
|
172
166
|
}
|
|
@@ -175,7 +169,7 @@ export default defineComponent({
|
|
|
175
169
|
const label = t("hikari::notificationCenter.title", "Notifications");
|
|
176
170
|
return (
|
|
177
171
|
<span ref={anchorRef} class="hk-notification-bell">
|
|
178
|
-
<
|
|
172
|
+
<HkIconButton
|
|
179
173
|
icon="bell"
|
|
180
174
|
size={chromeSize.value}
|
|
181
175
|
variant="ghost"
|
|
@@ -213,13 +207,13 @@ export default defineComponent({
|
|
|
213
207
|
{sorted.value.map(renderRow)}
|
|
214
208
|
</ul>
|
|
215
209
|
<div class="hk-notification-center__foot">
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
210
|
+
<HkButton
|
|
211
|
+
variant="ghost"
|
|
212
|
+
size="sm"
|
|
219
213
|
onClick={() => reset()}
|
|
220
214
|
>
|
|
221
215
|
{t("hikari::notificationCenter.clearAll", "Clear all")}
|
|
222
|
-
</
|
|
216
|
+
</HkButton>
|
|
223
217
|
</div>
|
|
224
218
|
</>
|
|
225
219
|
)}
|