@celestia-island/hikari 0.55.389 → 0.55.392
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 +1 -1
- package/src/components/HkMarkdownRenderer.link.test.tsx +178 -0
- package/src/components/HkMarkdownRenderer.tsx +55 -2
- package/src/components/HkNotificationBell.barrel.test.ts +27 -0
- package/src/components/HkNotificationBell.contract.test.ts +66 -0
- package/src/components/HkNotificationBell.scss +199 -0
- package/src/components/HkNotificationBell.test.tsx +240 -0
- package/src/components/HkNotificationBell.tsx +212 -0
- package/src/i18n/locales/ar/components.json +7 -1
- package/src/i18n/locales/de/components.json +7 -1
- package/src/i18n/locales/en/components.json +7 -1
- package/src/i18n/locales/es/components.json +7 -1
- package/src/i18n/locales/fr/components.json +7 -1
- package/src/i18n/locales/ja/components.json +7 -1
- package/src/i18n/locales/ko/components.json +7 -1
- package/src/i18n/locales/pt/components.json +7 -1
- package/src/i18n/locales/ru/components.json +7 -1
- package/src/i18n/locales/zh-Hans/components.json +7 -1
- package/src/i18n/locales/zh-Hant/components.json +7 -1
- package/src/index.ts +14 -0
- package/src/runtime/emergencyJournal.test.ts +144 -0
- package/src/runtime/index.ts +14 -0
- package/src/runtime/notificationCenter.test.ts +229 -0
- package/src/runtime/notificationCenter.ts +367 -0
- package/src/runtime/toastJournal.test.ts +145 -0
- package/src/runtime/useBlockingToast.ts +32 -1
- package/src/runtime/useEmergencyAlert.ts +47 -3
- package/src/runtime/useToast.ts +74 -6
package/package.json
CHANGED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
2
|
+
import { createApp, h, nextTick, ref } from "vue";
|
|
3
|
+
|
|
4
|
+
import HkMarkdownRenderer from "./HkMarkdownRenderer";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SECURITY (perfsec follow-up, 2026-11-15): the renderer's link override
|
|
8
|
+
* neutralizes script-scheme hrefs at RENDER time — no `href` attribute is
|
|
9
|
+
* emitted at all, so the guard holds even where the DOMPurify build
|
|
10
|
+
* misbehaves (happy-dom strips odd shapes; real browsers rely on it as the
|
|
11
|
+
* primary pass). Middle-click / "open in new tab" reads the raw attribute:
|
|
12
|
+
* this is the face that must stay clean. Legit links — https, mailto,
|
|
13
|
+
* relative, and custom protocols the coordinator adjudicates — keep their
|
|
14
|
+
* attribute and their delegated-click path.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const mounts: { app: ReturnType<typeof createApp>; container: HTMLElement }[] = [];
|
|
18
|
+
|
|
19
|
+
function mount(content: string): { container: HTMLElement; set: (v: string) => void } {
|
|
20
|
+
const holder = ref(content);
|
|
21
|
+
const container = document.createElement("div");
|
|
22
|
+
document.body.appendChild(container);
|
|
23
|
+
const app = createApp({
|
|
24
|
+
render: () => h(HkMarkdownRenderer, { content: holder.value }),
|
|
25
|
+
});
|
|
26
|
+
app.mount(container);
|
|
27
|
+
mounts.push({ app, container });
|
|
28
|
+
return { container, set: (v: string) => void (holder.value = v) };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function settleFor(root: HTMLElement, selector: string, tries = 120): Promise<void> {
|
|
32
|
+
for (let i = 0; i < tries; i += 1) {
|
|
33
|
+
if (root.querySelector(selector)) return;
|
|
34
|
+
await new Promise((r) => setTimeout(r, 5));
|
|
35
|
+
await nextTick();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
for (const { app, container } of mounts.splice(0)) {
|
|
41
|
+
app.unmount();
|
|
42
|
+
container.remove();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe("HkMarkdownRenderer link scheme guard", () => {
|
|
47
|
+
it("renders a javascript: link as an inert span with no href at all", async () => {
|
|
48
|
+
const { container } = mount("click [me](javascript:alert(1)) now");
|
|
49
|
+
await settleFor(container, ".hk-md-link-neutralized");
|
|
50
|
+
const neutral = container.querySelector(".hk-md-link-neutralized");
|
|
51
|
+
expect(neutral?.textContent).toBe("me");
|
|
52
|
+
// The face that matters: NO anchor carrying a script scheme exists —
|
|
53
|
+
// middle-click and "open in new tab" have nothing to read.
|
|
54
|
+
expect(container.querySelector("a")).toBeNull();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("also neutralizes data:, vbscript: and blob: in one document", async () => {
|
|
58
|
+
const doc = [
|
|
59
|
+
"[a](data:text/html,<b>x</b>)",
|
|
60
|
+
"[b](vbscript:msgbox)",
|
|
61
|
+
"[c](blob:https://x/uuid)",
|
|
62
|
+
].join(" and ");
|
|
63
|
+
const { container } = mount(doc);
|
|
64
|
+
await settleFor(container, ".hk-md-link-neutralized");
|
|
65
|
+
expect(container.querySelectorAll(".hk-md-link-neutralized").length).toBe(3);
|
|
66
|
+
expect(container.querySelector("a")).toBeNull();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("renders the tab-obfuscated javascript: shape as plain text, not a link", async () => {
|
|
70
|
+
// marked's own lexer refuses `java<TAB>script:` as a URL at all, so the
|
|
71
|
+
// construct never becomes an anchor — stronger than neutralizing: there
|
|
72
|
+
// is nothing to click, copy or open. Pinned so a future marked upgrade
|
|
73
|
+
// that starts accepting the shape trips THIS test (and then the guard
|
|
74
|
+
// above catches it).
|
|
75
|
+
const { container } = mount("[d](java\tscript:alert(1))");
|
|
76
|
+
await settleFor(container, ".hk-markdown-body span, .hk-markdown-body a, .hk-markdown-body p");
|
|
77
|
+
expect(container.querySelector("a")).toBeNull();
|
|
78
|
+
expect(container.querySelector(".hk-md-link-neutralized")).toBeNull();
|
|
79
|
+
expect(container.textContent).toContain("[d]");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("keeps legit links intact — https, mailto, relative, custom protocol", async () => {
|
|
83
|
+
const doc = [
|
|
84
|
+
"[docs](https://docs.celestia.world/meta/cla.html)",
|
|
85
|
+
"[mail](mailto:security@celestia.world)",
|
|
86
|
+
"[rel](cla.md)",
|
|
87
|
+
"[frag](#section)",
|
|
88
|
+
"[vscode](vscode://file/x)",
|
|
89
|
+
].join(" · ");
|
|
90
|
+
const { container } = mount(doc);
|
|
91
|
+
await settleFor(container, "a[href]");
|
|
92
|
+
const hrefs = [...container.querySelectorAll("a[href]")].map((a) => a.getAttribute("href"));
|
|
93
|
+
expect(hrefs).toContain("https://docs.celestia.world/meta/cla.html");
|
|
94
|
+
expect(hrefs).toContain("mailto:security@celestia.world");
|
|
95
|
+
expect(hrefs).toContain("cla.md");
|
|
96
|
+
expect(hrefs).toContain("#section");
|
|
97
|
+
// Custom protocols keep their attribute: the coordinator (not the
|
|
98
|
+
// renderer) adjudicates them on click — #1321's contract.
|
|
99
|
+
expect(hrefs).toContain("vscode://file/x");
|
|
100
|
+
expect(container.querySelector(".hk-md-link-neutralized")).toBeNull();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("re-render swaps a neutralized link for a good one and back", async () => {
|
|
104
|
+
const { container, set } = mount("[x](javascript:alert(1))");
|
|
105
|
+
await settleFor(container, ".hk-md-link-neutralized");
|
|
106
|
+
expect(container.querySelector("a")).toBeNull();
|
|
107
|
+
set("[x](https://ok.example/)");
|
|
108
|
+
await settleFor(container, "a[href='https://ok.example/']");
|
|
109
|
+
expect(container.querySelector(".hk-md-link-neutralized")).toBeNull();
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
describe("HkMarkdownRenderer raw-HTML and image sweep (review S1/S2)", () => {
|
|
114
|
+
it("strips the href of a raw-HTML anchor with a script scheme", async () => {
|
|
115
|
+
// renderer.link never sees raw HTML — it rides renderer.html into the
|
|
116
|
+
// sanitize pass, which is unreliable in some environments. The
|
|
117
|
+
// post-sanitize DOM sweep is what must catch this shape.
|
|
118
|
+
const { container } = mount('<a href="javascript:alert(1)">raw</a>');
|
|
119
|
+
await settleFor(container, ".hk-markdown-body a, .hk-markdown-body span");
|
|
120
|
+
const anchors = [...container.querySelectorAll("a")];
|
|
121
|
+
expect(anchors.length).toBe(1);
|
|
122
|
+
expect(anchors[0].getAttribute("href")).toBeNull();
|
|
123
|
+
expect(anchors[0].textContent).toBe("raw");
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("strips raw-HTML anchors case-insensitively and data: variants", async () => {
|
|
127
|
+
const doc = [
|
|
128
|
+
'<A HREF="JavaScript:alert(1)">up</A>',
|
|
129
|
+
'<a href="data:text/html,<b>x</b>">data</a>',
|
|
130
|
+
"<a href='vbscript:msgbox'>vb</a>",
|
|
131
|
+
].join("\n");
|
|
132
|
+
const { container } = mount(doc);
|
|
133
|
+
await settleFor(container, ".hk-markdown-body a, .hk-markdown-body span");
|
|
134
|
+
for (const a of [...container.querySelectorAll("a")]) {
|
|
135
|
+
expect(a.getAttribute("href")).toBeNull();
|
|
136
|
+
}
|
|
137
|
+
expect(container.querySelectorAll("a").length).toBe(3);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("strips a script-scheme img src (image token AND raw HTML)", async () => {
|
|
141
|
+
const doc = [
|
|
142
|
+
")",
|
|
143
|
+
'<img src="javascript:alert(1)" alt="y">',
|
|
144
|
+
"",
|
|
145
|
+
].join("\n");
|
|
146
|
+
const { container } = mount(doc);
|
|
147
|
+
await settleFor(container, ".hk-markdown-body img");
|
|
148
|
+
const srcs = [...container.querySelectorAll("img")]
|
|
149
|
+
.map((i) => i.getAttribute("src"))
|
|
150
|
+
.filter(Boolean);
|
|
151
|
+
expect(srcs).toEqual(["https://example.com/i.png"]);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("strips a script-scheme image-map area href (review follow-up)", async () => {
|
|
155
|
+
// <area href> is the same navigation sink as <a href>, and it is the
|
|
156
|
+
// one shape DOMPurify's unreliable builds let through alongside it.
|
|
157
|
+
const doc = [
|
|
158
|
+
'<map name="m">',
|
|
159
|
+
'<area href="javascript:alert(1)" alt="evil">',
|
|
160
|
+
'<area href="https://ok.example/x" alt="ok">',
|
|
161
|
+
"</map>",
|
|
162
|
+
].join("");
|
|
163
|
+
const { container } = mount(doc);
|
|
164
|
+
await settleFor(container, ".hk-markdown-body area");
|
|
165
|
+
const hrefs = [...container.querySelectorAll("area")]
|
|
166
|
+
.map((el) => el.getAttribute("href"))
|
|
167
|
+
.filter(Boolean);
|
|
168
|
+
expect(hrefs).toEqual(["https://ok.example/x"]);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it("keeps a legit raw-HTML anchor untouched", async () => {
|
|
172
|
+
const { container } = mount('<a href="https://ok.example/x">raw-ok</a>');
|
|
173
|
+
await settleFor(container, "a[href]");
|
|
174
|
+
expect(container.querySelector("a[href]")?.getAttribute("href")).toBe(
|
|
175
|
+
"https://ok.example/x",
|
|
176
|
+
);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
@@ -5,7 +5,7 @@ import HkMermaidDiagram from "./HkMermaidDiagram";
|
|
|
5
5
|
import { applyInlineChipsToBody } from "./inlineChips";
|
|
6
6
|
import { attachOverlayScrollbars, type OverlayScrollbarHandle } from "../composables/useOverlayScrollbar";
|
|
7
7
|
import { getMermaidEngine } from "../mermaid/engine";
|
|
8
|
-
import { openHyperlink } from "../runtime/hyperlink";
|
|
8
|
+
import { isDangerousHref, openHyperlink } from "../runtime/hyperlink";
|
|
9
9
|
import { asIndexable } from "../utils/typing";
|
|
10
10
|
import "./HkMarkdownRenderer.scss";
|
|
11
11
|
|
|
@@ -113,6 +113,24 @@ async function renderMarkdown(content: string): Promise<string> {
|
|
|
113
113
|
return `<div class="hk-md-code-wrap"><div class="hk-md-code">${langLabel}<pre><code class="hljs${langAttr}">${highlighted}</code></pre></div></div>`;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
// SECURITY (perfsec follow-up, 2026-11-15): the anchor's HREF attribute
|
|
117
|
+
// must never carry a script scheme — DOMPurify is the primary guard in
|
|
118
|
+
// real browsers, but the delegated click only covers plain activation;
|
|
119
|
+
// middle-click / "open in new tab" reads the attribute directly, and the
|
|
120
|
+
// sanitizer is unreliable under some environments (happy-dom strips odd
|
|
121
|
+
// things — see the mermaid tests). A dangerous href renders as an inert
|
|
122
|
+
// span with NO href at all: nothing to intercept, nothing to open, no
|
|
123
|
+
// dependency on the sanitize pass. Legit custom protocols (vscode:, …)
|
|
124
|
+
// keep their attribute — the coordinator decides on click, same as
|
|
125
|
+
// #1321.
|
|
126
|
+
renderer.link = function (this: Renderer, token: Tokens.Link): string {
|
|
127
|
+
if (isDangerousHref(token.href)) {
|
|
128
|
+
const text = this.parser.parseInline(token.tokens);
|
|
129
|
+
return `<span class="hk-md-link-neutralized" title="link removed: unsafe scheme">${text}</span>`;
|
|
130
|
+
}
|
|
131
|
+
return marked.Renderer.prototype.link.call(this, token);
|
|
132
|
+
};
|
|
133
|
+
|
|
116
134
|
renderer.table = function (this: Renderer, token: Tokens.Table): string {
|
|
117
135
|
// Tables size to their content: a wide one (many columns, or a single
|
|
118
136
|
// unbreakable cell) pushes every ancestor's min-content width past its
|
|
@@ -130,7 +148,42 @@ async function renderMarkdown(content: string): Promise<string> {
|
|
|
130
148
|
|
|
131
149
|
const raw = marked.parse(content, { renderer, async: false });
|
|
132
150
|
const html = typeof raw === "string" ? raw : "";
|
|
133
|
-
return DOMPurify.sanitize(html);
|
|
151
|
+
return sweepDangerousUrlAttributes(DOMPurify.sanitize(html));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* SECURITY (perfsec follow-up, 2026-11-15, review S1): the renderer.link
|
|
156
|
+
* override only sees marked's LINK tokens — raw HTML written straight into
|
|
157
|
+
* the markdown (`<a href="javascript:…">`) rides renderer.html into the
|
|
158
|
+
* sanitize pass, which is exactly the environment-unreliable half this
|
|
159
|
+
* guard exists for. This post-sanitize DOM sweep is the braces: every
|
|
160
|
+
* anchor href and image src in the FINAL html is checked, whatever path
|
|
161
|
+
* produced it (link token, autolink, raw HTML, image token). Dangerous
|
|
162
|
+
* values drop the attribute entirely — the element stays (text/link
|
|
163
|
+
* label visible), the navigation face does not.
|
|
164
|
+
*/
|
|
165
|
+
function sweepDangerousUrlAttributes(html: string): string {
|
|
166
|
+
if (typeof window === "undefined" || typeof DOMParser === "undefined") return html;
|
|
167
|
+
try {
|
|
168
|
+
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
169
|
+
let swept = false;
|
|
170
|
+
for (const a of [...doc.querySelectorAll("a[href], area[href]")]) {
|
|
171
|
+
if (isDangerousHref(a.getAttribute("href") ?? "")) {
|
|
172
|
+
a.removeAttribute("href");
|
|
173
|
+
swept = true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
for (const img of [...doc.querySelectorAll("img[src]")]) {
|
|
177
|
+
if (isDangerousHref(img.getAttribute("src") ?? "")) {
|
|
178
|
+
img.removeAttribute("src");
|
|
179
|
+
swept = true;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!swept) return html;
|
|
183
|
+
return doc.body.innerHTML;
|
|
184
|
+
} catch {
|
|
185
|
+
return html;
|
|
186
|
+
}
|
|
134
187
|
}
|
|
135
188
|
|
|
136
189
|
export default defineComponent({
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import * as barrel from "../index";
|
|
3
|
+
import { asIndexable } from "../utils/typing";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The public barrel guard (HkAddTile.barrel.test.ts shape): deleting
|
|
7
|
+
* the export lines from index.ts kept the ENTIRE suite green while the
|
|
8
|
+
* component's own tests reach the module through "./HkNotificationBell"
|
|
9
|
+
* — only an external consumer would have noticed.
|
|
10
|
+
*/
|
|
11
|
+
describe("the public barrel", () => {
|
|
12
|
+
it("exports the bell under both family names", () => {
|
|
13
|
+
const hk = asIndexable(barrel.HkNotificationBell);
|
|
14
|
+
expect(hk, "HkNotificationBell must be re-exported").toBeTruthy();
|
|
15
|
+
expect(hk.name).toBe("HkNotificationBell");
|
|
16
|
+
// The H- alias rides the HCard/HkCard family convention: consumers
|
|
17
|
+
// import either name, one component underneath.
|
|
18
|
+
expect(barrel.HNotificationBell).toBe(barrel.HkNotificationBell);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("exports the journal context surface", () => {
|
|
22
|
+
expect(typeof (barrel as Record<string, unknown>).useNotificationCenter).toBe("function");
|
|
23
|
+
expect(typeof (barrel as Record<string, unknown>).recordNotification).toBe("function");
|
|
24
|
+
expect(typeof (barrel as Record<string, unknown>).markAllNotificationsRead).toBe("function");
|
|
25
|
+
expect((barrel as Record<string, unknown>).MAX_NOTIFICATION_ENTRIES).toBe(100);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import componentSource from "./HkNotificationBell.tsx?raw";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Composition contract for the notification bell (the
|
|
7
|
+
* HEmergencySnoozeTray.contract.test.ts shape): read the component's
|
|
8
|
+
* own source and pin the structural decisions that make the bell ONE
|
|
9
|
+
* grammar with the rest of the chrome — deviations here are exactly
|
|
10
|
+
* how a second notification UI grows next to the first one.
|
|
11
|
+
*/
|
|
12
|
+
function body(): string {
|
|
13
|
+
// Strip comments so prose can never satisfy a contract.
|
|
14
|
+
return componentSource.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe("HkNotificationBell composition contract", () => {
|
|
18
|
+
it("the surface IS HkPopover with sheetOnMobile — no bespoke popup markup", () => {
|
|
19
|
+
const src = body();
|
|
20
|
+
expect(src).toContain("HkPopover");
|
|
21
|
+
expect(src).toContain("sheetOnMobile");
|
|
22
|
+
// No hand-rolled overlay/teleport/scrim in this component.
|
|
23
|
+
expect(src).not.toContain("Teleport");
|
|
24
|
+
expect(src).not.toContain("ensureOverlayRoot");
|
|
25
|
+
expect(src).not.toContain("scrim");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("the trigger IS HkIconButton on the chrome ladder", () => {
|
|
29
|
+
const src = body();
|
|
30
|
+
expect(src).toContain("HkIconButton");
|
|
31
|
+
expect(src).toContain("useChromeActionSize");
|
|
32
|
+
// The unread mark is the button's OWN dot (2026-10-28 ruling), not
|
|
33
|
+
// a wrapper badge around the trigger.
|
|
34
|
+
expect(src).toContain("dot=");
|
|
35
|
+
expect(src).toContain("dotLabel");
|
|
36
|
+
expect(src).not.toContain("HkCornerBadge");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("open IS the read receipt — markAllRead rides the open flag", () => {
|
|
40
|
+
const src = body();
|
|
41
|
+
expect(src).toContain("markAllRead");
|
|
42
|
+
expect(src).toContain("watch(open");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("restore is REPLAY-FREE except the entry's own resummon path", () => {
|
|
46
|
+
const src = body();
|
|
47
|
+
// The only action a row may fire is the journal-carried callback,
|
|
48
|
+
// gated on the SNOOZED state (an on-screen band has nothing to
|
|
49
|
+
// restore — R2 finding, PR #1322).
|
|
50
|
+
expect(src).toContain("onResummon?.()");
|
|
51
|
+
expect(src).toContain('entry.state === "snoozed"');
|
|
52
|
+
// No direct emergency/toast import here — resummon must ride the
|
|
53
|
+
// journal entry, or replay semantics would fork.
|
|
54
|
+
expect(src).not.toContain("useEmergencyAlert");
|
|
55
|
+
expect(src).not.toContain("unsnoozeEmergencyAlert");
|
|
56
|
+
expect(src).not.toContain("useToast");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("the journal is the ONLY data source", () => {
|
|
60
|
+
const src = body();
|
|
61
|
+
expect(src).toContain("useNotificationCenter");
|
|
62
|
+
// No private storage reading — persistence belongs to the context.
|
|
63
|
+
expect(src).not.toContain("sessionStorage");
|
|
64
|
+
expect(src).not.toContain("localStorage");
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HkNotificationBell chrome: the bell wrapper and the notification-
|
|
3
|
+
* center panel body. Tone colors reuse the badge/status channels the
|
|
4
|
+
* toast family already speaks (HkToast's --hi-color-* family) so a
|
|
5
|
+
* journal row reads as the same grammar as the surface it records;
|
|
6
|
+
* layout is deliberately plain flex/flow — the popup chrome (glass,
|
|
7
|
+
* scroll, sheet band) is HkPopover's job, not ours.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
.hk-notification-bell {
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Panel body: the list is the popup's ONE scroll surface (the
|
|
17
|
+
* single-scroll contract — never a nested pane inside it). */
|
|
18
|
+
.hk-notification-center {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
width: min(22rem, 100%);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.hk-notification-center__list {
|
|
25
|
+
list-style: none;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
max-height: min(24rem, 55vh);
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
overscroll-behavior: contain;
|
|
31
|
+
/* Native-scrollbar invariant (nativeScrollbar.contract.test.ts): the
|
|
32
|
+
list keeps native overflow mechanics, the platform bar never
|
|
33
|
+
paints — overlay scrollbars ride the popup chrome instead. */
|
|
34
|
+
scrollbar-width: none;
|
|
35
|
+
|
|
36
|
+
&::-webkit-scrollbar {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Mobile sheet branch (R2 finding, PR #1322): HkPopover's own sheet
|
|
41
|
+
panel is the scroller there, so the list must NOT become a second,
|
|
42
|
+
contained scroll surface — a drag inside the list would never hand
|
|
43
|
+
off to the sheet, stranding the Clear-all foot on short viewports.
|
|
44
|
+
The sheet shows the whole list; its panel scrolls. */
|
|
45
|
+
.hk-is-sheet & {
|
|
46
|
+
max-height: none;
|
|
47
|
+
overflow-y: visible;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.hk-notification-center__empty {
|
|
52
|
+
margin: 0;
|
|
53
|
+
padding: var(--space-12, 0.75rem) var(--space-8, 0.5rem);
|
|
54
|
+
color: rgb(var(--color-text) / 55%);
|
|
55
|
+
font-size: 0.8125rem;
|
|
56
|
+
text-align: center;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.hk-notification-center__foot {
|
|
60
|
+
display: flex;
|
|
61
|
+
justify-content: flex-end;
|
|
62
|
+
padding-top: var(--space-8, 0.5rem);
|
|
63
|
+
border-top: 1px solid rgb(var(--color-border) / 10%);
|
|
64
|
+
margin-top: var(--space-8, 0.5rem);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.hk-notification-center__clear {
|
|
68
|
+
appearance: none;
|
|
69
|
+
background: none;
|
|
70
|
+
border: none;
|
|
71
|
+
padding: 0 var(--space-4, 0.25rem);
|
|
72
|
+
color: rgb(var(--color-text) / 55%);
|
|
73
|
+
font-size: 0.75rem;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
|
|
76
|
+
&:hover {
|
|
77
|
+
color: rgb(var(--color-text) / 85%);
|
|
78
|
+
text-decoration: underline;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* ── rows ─────────────────────────────────────────────────────────── */
|
|
83
|
+
|
|
84
|
+
.hk-notification-row {
|
|
85
|
+
display: flex;
|
|
86
|
+
gap: var(--space-8, 0.5rem);
|
|
87
|
+
padding: var(--space-8, 0.5rem) var(--space-8, 0.5rem);
|
|
88
|
+
border-bottom: 1px solid rgb(var(--color-border) / 6%);
|
|
89
|
+
|
|
90
|
+
&:last-child {
|
|
91
|
+
border-bottom: none;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.hk-notification-row__icon {
|
|
96
|
+
flex: none;
|
|
97
|
+
display: inline-flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
padding-top: 2px;
|
|
100
|
+
/* Tone ink follows the row's tone class (rules below). */
|
|
101
|
+
color: rgb(var(--color-text) / 65%);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Tone ink on the glyph (the toast family's own --hi-color-<tone>
|
|
105
|
+
channels, theme-following; fallbacks are the tokenInventory-canonical
|
|
106
|
+
literals, NOT the toast family's sheet-local ones). */
|
|
107
|
+
.hk-notification-row.is-error .hk-notification-row__icon {
|
|
108
|
+
color: var(--hi-color-danger, #f7768e);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.hk-notification-row.is-warning .hk-notification-row__icon {
|
|
112
|
+
color: var(--hi-color-warning, #eed677);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.hk-notification-row.is-success .hk-notification-row__icon {
|
|
116
|
+
color: var(--hi-color-success, #0eb840);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.hk-notification-row.is-info .hk-notification-row__icon,
|
|
120
|
+
.hk-notification-row.is-loading .hk-notification-row__icon {
|
|
121
|
+
color: rgb(var(--color-text) / 65%);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.hk-notification-row__body {
|
|
125
|
+
flex: 1 1 auto;
|
|
126
|
+
min-width: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.hk-notification-row__top {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: baseline;
|
|
132
|
+
gap: var(--space-8, 0.5rem);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.hk-notification-row__title {
|
|
136
|
+
flex: 1 1 auto;
|
|
137
|
+
min-width: 0;
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
text-overflow: ellipsis;
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
font-size: 0.8125rem;
|
|
142
|
+
color: rgb(var(--color-text) / 92%);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.hk-notification-row__time {
|
|
146
|
+
flex: none;
|
|
147
|
+
font-size: 0.6875rem;
|
|
148
|
+
font-variant-numeric: tabular-nums;
|
|
149
|
+
color: rgb(var(--color-text) / 45%);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.hk-notification-row__detail {
|
|
153
|
+
margin: 2px 0 0;
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
gap: var(--space-4, 0.25rem);
|
|
157
|
+
overflow: hidden;
|
|
158
|
+
white-space: nowrap;
|
|
159
|
+
font-size: 0.75rem;
|
|
160
|
+
color: rgb(var(--color-text) / 55%);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.hk-notification-row__detail-text {
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
text-overflow: ellipsis;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.hk-notification-row__code {
|
|
169
|
+
flex: none;
|
|
170
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
171
|
+
font-size: 0.6875rem;
|
|
172
|
+
padding: 0 4px;
|
|
173
|
+
border: 1px solid rgb(var(--color-border) / 25%);
|
|
174
|
+
border-radius: 4px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.hk-notification-row__meta {
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
gap: var(--space-8, 0.5rem);
|
|
181
|
+
margin-top: 2px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.hk-notification-row__state {
|
|
185
|
+
font-size: 0.6875rem;
|
|
186
|
+
color: rgb(var(--color-text) / 45%);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.hk-notification-row__restore {
|
|
190
|
+
appearance: none;
|
|
191
|
+
background: none;
|
|
192
|
+
border: none;
|
|
193
|
+
padding: 0;
|
|
194
|
+
font-size: 0.75rem;
|
|
195
|
+
color: rgb(var(--color-primary, var(--color-text)) / 90%);
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
text-decoration: underline;
|
|
198
|
+
text-underline-offset: 2px;
|
|
199
|
+
}
|