@celestia-island/hikari 0.55.438 → 0.55.441
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/HkAdminHeader.test.tsx +76 -1
- package/src/components/HkAdminHeader.tsx +73 -13
- package/src/components/HkAffixPicker.scss +13 -0
- package/src/components/HkAffixPicker.test.tsx +79 -1
- package/src/components/HkAffixPicker.tsx +37 -0
- package/src/components/HkDeleteFact.scss +25 -0
- package/src/components/HkDeleteFact.tsx +28 -0
- package/src/components/HkDeleteGateWindow.scss +9 -0
- package/src/components/HkDeleteGateWindow.test.ts +133 -0
- package/src/components/HkDeleteGateWindow.tsx +89 -0
- package/src/components/HkFaceShell.slots.test.ts +28 -1
- package/src/components/HkListTransition.scss +10 -0
- package/src/components/HkListTransition.styles.test.ts +85 -0
- package/src/components/HkNotificationBell.contract.test.ts +46 -0
- package/src/components/HkNotificationBell.scrollTarget.test.tsx +127 -0
- package/src/components/HkNotificationBell.scss +12 -0
- package/src/components/HkNotificationBell.styles.test.ts +15 -0
- package/src/components/HkNotificationBell.test.tsx +411 -6
- package/src/components/HkNotificationBell.tsx +198 -24
- package/src/components/HkSerpentineUnlock.tsx +26 -1
- package/src/components/serpentineGeometry.test.ts +21 -0
- package/src/components/serpentineGeometry.ts +41 -7
- package/src/index.ts +3 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { defineComponent, h, type PropType, type VNode } from "vue";
|
|
2
|
+
|
|
3
|
+
import HkSerpentineUnlock from "./HkSerpentineUnlock";
|
|
4
|
+
import HkModal from "./HkModal";
|
|
5
|
+
import "./HkDeleteGateWindow.scss";
|
|
6
|
+
|
|
7
|
+
export { default as HkDeleteFact } from "./HkDeleteFact";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The open-and-go delete confirmation window.
|
|
11
|
+
*
|
|
12
|
+
* ANY delete-related surface mounts this with `open` + `title`; the
|
|
13
|
+
* default slot renders the message area, and the HOUSE RULE for that slot
|
|
14
|
+
* is documented and enforced by review: the copy must carry EVERY key
|
|
15
|
+
* fact of the thing being deleted — its name (and per-locale alias where
|
|
16
|
+
* one exists), its owner, its size/counters, and the names of everything
|
|
17
|
+
* attached to it — each wrapped in an {@link HkDeleteFact} emphasis tag so
|
|
18
|
+
* the irreversible act is never aimed at an anonymous blob.
|
|
19
|
+
*
|
|
20
|
+
* The only confirm control is the serpentine walk (a full traced lane);
|
|
21
|
+
* closing abandons. The parent performs the actual deletion in
|
|
22
|
+
* `onConfirm`.
|
|
23
|
+
*/
|
|
24
|
+
export default defineComponent({
|
|
25
|
+
name: "HkDeleteGateWindow",
|
|
26
|
+
props: {
|
|
27
|
+
/** Window visibility (v-model:open). */
|
|
28
|
+
open: { type: Boolean, default: false },
|
|
29
|
+
/** Window title ("删除工作区"). */
|
|
30
|
+
title: { type: String, required: true },
|
|
31
|
+
/** What the confirming user is about to delete ("此工作区"). */
|
|
32
|
+
label: { type: String, required: true },
|
|
33
|
+
/** Hint before grabbing. */
|
|
34
|
+
grabHint: { type: String, required: true },
|
|
35
|
+
/** Hint while tracking. */
|
|
36
|
+
trackingHint: { type: String, required: true },
|
|
37
|
+
/** Corner-count range `[min, max]` — higher stakes, more turns. */
|
|
38
|
+
turns: {
|
|
39
|
+
type: Array as unknown as PropType<[number, number]>,
|
|
40
|
+
default: null,
|
|
41
|
+
},
|
|
42
|
+
/** Deterministic lane seed (tests / design review). */
|
|
43
|
+
seed: { type: Number, default: null },
|
|
44
|
+
/** Disables the gate (e.g. the delete RPC is in flight). */
|
|
45
|
+
disabled: { type: Boolean, default: false },
|
|
46
|
+
},
|
|
47
|
+
emits: {
|
|
48
|
+
"update:open": (v: boolean) => typeof v === "boolean",
|
|
49
|
+
/** Fired once, after a full lane walk released at the goal. */
|
|
50
|
+
confirm: () => true,
|
|
51
|
+
/** Progress at an early release; the parent may log or ignore. */
|
|
52
|
+
cancel: (progress: number) => typeof progress === "number",
|
|
53
|
+
},
|
|
54
|
+
setup(props, { emit, slots }) {
|
|
55
|
+
function close() {
|
|
56
|
+
emit("update:open", false);
|
|
57
|
+
}
|
|
58
|
+
function onConfirm() {
|
|
59
|
+
emit("confirm");
|
|
60
|
+
close();
|
|
61
|
+
}
|
|
62
|
+
return () =>
|
|
63
|
+
h(HkModal, {
|
|
64
|
+
modelValue: props.open,
|
|
65
|
+
"onUpdate:modelValue": (v: boolean) => emit("update:open", v),
|
|
66
|
+
title: props.title,
|
|
67
|
+
}, {
|
|
68
|
+
default: () => [
|
|
69
|
+
// The window renders the message wrapper itself: consumers put
|
|
70
|
+
// their key-fact chips inside the slot without knowing the class.
|
|
71
|
+
<div class="hk-delete-gate-message">
|
|
72
|
+
{slots.default?.() as VNode[]}
|
|
73
|
+
</div>,
|
|
74
|
+
<HkSerpentineUnlock
|
|
75
|
+
tone="danger"
|
|
76
|
+
label={props.label}
|
|
77
|
+
grabHint={props.grabHint}
|
|
78
|
+
trackingHint={props.trackingHint}
|
|
79
|
+
turns={props.turns ?? undefined}
|
|
80
|
+
seed={props.seed ?? undefined}
|
|
81
|
+
disabled={props.disabled}
|
|
82
|
+
onConfirm={() => onConfirm()}
|
|
83
|
+
onCancel={(progress: number) => emit("cancel", progress)}
|
|
84
|
+
/>,
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import * as barrel from "../index";
|
|
3
3
|
import { asIndexable } from "../utils/typing";
|
|
4
|
-
import type { HkAdminHeaderAvatarModalSlot, HkAdminHeaderSlots, HkFaceShellHeaderSlot, HkFaceShellSidebarSlot, HkFaceShellSlots, HkFaceShellUserPanelSlot } from "../index";
|
|
4
|
+
import type { HkAdminHeaderAvatarModalSlot, HkAdminHeaderLocalePickerSlot, HkAdminHeaderSlots, HkAdminHeaderUserMenuExtraSlot, HkFaceShellHeaderSlot, HkFaceShellSidebarSlot, HkFaceShellSlots, HkFaceShellUserPanelSlot } from "../index";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The L39 slot-type contract pins. The exported slot types are what chest and
|
|
@@ -46,6 +46,22 @@ function avatarModalBody(params: HkAdminHeaderAvatarModalSlot) {
|
|
|
46
46
|
return { open, onUpdateOpen };
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/** erp AdminLayout shape: the locale-picker destructure (L39 ruling-a
|
|
50
|
+
* revival — erp passes LocalePickerPopup exactly these members). */
|
|
51
|
+
function localePickerBody(params: HkAdminHeaderLocalePickerSlot) {
|
|
52
|
+
const { open, onUpdateOpen, triggerRef } = params;
|
|
53
|
+
onUpdateOpen(!open);
|
|
54
|
+
return { open, onUpdateOpen, triggerRef };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** erp AdminLayout shape: the user-menu-extra destructure (close is the
|
|
58
|
+
* only member; erp's account-center row calls it before navigating). */
|
|
59
|
+
function userMenuExtraBody(params: HkAdminHeaderUserMenuExtraSlot) {
|
|
60
|
+
const { close } = params;
|
|
61
|
+
close?.();
|
|
62
|
+
return { close };
|
|
63
|
+
}
|
|
64
|
+
|
|
49
65
|
describe("the public slot-type contract (L39)", () => {
|
|
50
66
|
it("exports every slot type name from the barrel", () => {
|
|
51
67
|
// Types are erased at runtime; the pin is the module-record presence of
|
|
@@ -80,6 +96,17 @@ describe("the public slot-type contract (L39)", () => {
|
|
|
80
96
|
const avatar = avatarModalBody({ open: false, onUpdateOpen: (v) => { opened = v; } });
|
|
81
97
|
expect(avatar.open).toBe(false);
|
|
82
98
|
expect(opened).toBe(true);
|
|
99
|
+
// L39 ruling-a revival shapes: erp's two revived slots destructured
|
|
100
|
+
// the way AdminLayout does (compile-level pin — a payload member
|
|
101
|
+
// rename breaks THIS file's vue-tsc, not a downstream repo's build).
|
|
102
|
+
let flipped = false;
|
|
103
|
+
const picker = localePickerBody({ open: false, onUpdateOpen: (v) => { flipped = v; }, triggerRef: null });
|
|
104
|
+
expect(picker.open).toBe(false);
|
|
105
|
+
expect(flipped).toBe(true);
|
|
106
|
+
let closed = false;
|
|
107
|
+
const extra = userMenuExtraBody({ close: () => { closed = true; } });
|
|
108
|
+
extra.close?.();
|
|
109
|
+
expect(closed).toBe(true);
|
|
83
110
|
});
|
|
84
111
|
|
|
85
112
|
it("the aggregate slot types fit a defineComponent slots declaration", () => {
|
|
@@ -22,6 +22,16 @@
|
|
|
22
22
|
opacity var(--duration-normal, 0.3s) ease-in,
|
|
23
23
|
transform var(--duration-normal, 0.3s) cubic-bezier(0.5, 0, 0.75, 0);
|
|
24
24
|
position: absolute;
|
|
25
|
+
/* A dying row must not take clicks (or a drag) while it fades: the
|
|
26
|
+
bell's rows carry copy / dismiss / restore buttons — the first
|
|
27
|
+
IN-LIBRARY pop consumer with interactive rows (chest's WorkspaceModal
|
|
28
|
+
already runs `pop` with clickable rows downstream, and gains this
|
|
29
|
+
dead-end for the fade window). The
|
|
30
|
+
primitive's own pin sets `inert` too, but only when layout metrics
|
|
31
|
+
exist — this is the CSS belt that still dead-ends a tap in a
|
|
32
|
+
non-layout environment or when the pin skipped (same relationship
|
|
33
|
+
the surface variant documents below). */
|
|
34
|
+
pointer-events: none;
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
.hk-list-pop-enter-from {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compiled-CSS pins for the pop variant's LEAVE rule (2026-11-20).
|
|
3
|
+
*
|
|
4
|
+
* `HkListTransition.scss` is compiled twice (Vue + the Rust-side
|
|
5
|
+
* vue-mirror) and nothing read the sheet, so a revert of the two
|
|
6
|
+
* properties below stayed green repo-wide (2026-11-20 review, mutation
|
|
7
|
+
* M9: the whole 6616-test suite passed with the rule deleted; only the
|
|
8
|
+
* mirror-drift check noticed, and a two-copy edit defeats that).
|
|
9
|
+
*
|
|
10
|
+
* Pinned like its sibling variant (HkModalBreadcrumb.motion.contract
|
|
11
|
+
* .test.ts pins `.hk-list-surface-leave-active` the same way):
|
|
12
|
+
*
|
|
13
|
+
* - a dying row takes no clicks. The primitive's `inert` pin covers it
|
|
14
|
+
* only when layout metrics exist, so the CSS belt is what still
|
|
15
|
+
* dead-ends a tap in a non-layout environment or when the pin
|
|
16
|
+
* skipped. The bell is the first `pop` consumer whose rows carry
|
|
17
|
+
* buttons (copy / dismiss / restore).
|
|
18
|
+
* - reduced motion really drops the choreography (house pattern).
|
|
19
|
+
*/
|
|
20
|
+
import { dirname, join } from "node:path";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
|
|
23
|
+
import { compile } from "sass";
|
|
24
|
+
import { describe, expect, it } from "vitest";
|
|
25
|
+
|
|
26
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
27
|
+
const css = compile(join(here, "HkListTransition.scss"), {
|
|
28
|
+
loadPaths: [here, join(here, "..", "styles")],
|
|
29
|
+
style: "expanded",
|
|
30
|
+
}).css;
|
|
31
|
+
|
|
32
|
+
/** Body of the first top-level `selector { … }` block. */
|
|
33
|
+
function rule(cssText: string, selector: string): string {
|
|
34
|
+
const start = cssText.indexOf(`${selector} {`);
|
|
35
|
+
if (start === -1) return "";
|
|
36
|
+
const open = cssText.indexOf("{", start);
|
|
37
|
+
let depth = 0;
|
|
38
|
+
for (let i = open; i < cssText.length; i++) {
|
|
39
|
+
if (cssText[i] === "{") depth += 1;
|
|
40
|
+
else if (cssText[i] === "}") {
|
|
41
|
+
depth -= 1;
|
|
42
|
+
if (depth === 0) return cssText.slice(open + 1, i);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return "";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Top-level `@media` block body (brace matched). */
|
|
49
|
+
function mediaBlock(cssText: string, headPrefix: string): string {
|
|
50
|
+
const start = cssText.indexOf(headPrefix);
|
|
51
|
+
if (start === -1) return "";
|
|
52
|
+
const open = cssText.indexOf("{", start);
|
|
53
|
+
let depth = 0;
|
|
54
|
+
for (let i = open; i < cssText.length; i++) {
|
|
55
|
+
if (cssText[i] === "{") depth += 1;
|
|
56
|
+
else if (cssText[i] === "}") {
|
|
57
|
+
depth -= 1;
|
|
58
|
+
if (depth === 0) return cssText.slice(open + 1, i);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
describe("HkListTransition pop variant", () => {
|
|
65
|
+
it("the leaving ghost is out of flow and takes no clicks", () => {
|
|
66
|
+
const leave = rule(css, ".hk-list-pop-leave-active");
|
|
67
|
+
expect(leave, "the pop leave-active rule compiles").not.toBe("");
|
|
68
|
+
// The primitive pins the ghost's box from its pre-patch offsets while
|
|
69
|
+
// this rule lifts it out of flow — the pin's premise.
|
|
70
|
+
expect(leave).toContain("position: absolute");
|
|
71
|
+
// A fading row must not swallow a click meant for what is underneath
|
|
72
|
+
// it (or for the row that just slid up under the cursor).
|
|
73
|
+
expect(leave).toContain("pointer-events: none");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("reduced motion collapses every variant's leave", () => {
|
|
77
|
+
const media = mediaBlock(css, "@media (prefers-reduced-motion: reduce)");
|
|
78
|
+
expect(media, "the reduced-motion block compiles").not.toBe("");
|
|
79
|
+
for (const variant of ["pop", "slide", "fade", "grow", "reveal", "surface"]) {
|
|
80
|
+
expect(media, `${variant} leave collapses`).toContain(
|
|
81
|
+
`.hk-list-${variant}-leave-active`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -56,6 +56,18 @@ describe("HkNotificationBell composition contract", () => {
|
|
|
56
56
|
expect(src).not.toContain("useToast");
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
it("the hold timer is released when the bell goes away", () => {
|
|
60
|
+
const src = body();
|
|
61
|
+
// Round-5 finding, M10: dropping the unmount cleanup stayed green
|
|
62
|
+
// repo-wide. A source pin (the same convention the rest of this file
|
|
63
|
+
// uses): the timer-queue cannot isolate OUR timer from the primitive's
|
|
64
|
+
// transition report, so the structural fact is pinned here, and the
|
|
65
|
+
// behaviour it protects is "no write into a dead instance".
|
|
66
|
+
const unmountPath = src.slice(src.indexOf("onUnmounted("));
|
|
67
|
+
expect(unmountPath, "an unmount hook exists").not.toBe("");
|
|
68
|
+
expect(unmountPath).toContain("clearTimeout(holdTimer)");
|
|
69
|
+
});
|
|
70
|
+
|
|
59
71
|
it("the journal is the ONLY data source", () => {
|
|
60
72
|
const src = body();
|
|
61
73
|
expect(src).toContain("useNotificationCenter");
|
|
@@ -63,4 +75,38 @@ describe("HkNotificationBell composition contract", () => {
|
|
|
63
75
|
expect(src).not.toContain("sessionStorage");
|
|
64
76
|
expect(src).not.toContain("localStorage");
|
|
65
77
|
});
|
|
78
|
+
|
|
79
|
+
it("row add/remove animates through HkListTransition on the animation context", () => {
|
|
80
|
+
const src = body();
|
|
81
|
+
// The rows ride the library's own list choreography primitive — the
|
|
82
|
+
// `pop` variant with FLIP moves — which reports every enter/leave
|
|
83
|
+
// batch to the runtime animation bus itself. No second transition
|
|
84
|
+
// implementation may grow beside it (the same rule that keeps a
|
|
85
|
+
// second notification UI from growing beside the bell).
|
|
86
|
+
//
|
|
87
|
+
// The props are pinned ON THE PRIMITIVE'S OWN OPENING TAG, not as bare
|
|
88
|
+
// substrings: a `toMatch(/\bmove\b/)` over the whole file is satisfied
|
|
89
|
+
// by any unrelated token, and a file-level `not.toContain("appear")`
|
|
90
|
+
// would fail a legitimate `appear={false}` (2026-11-20 review).
|
|
91
|
+
const usage = src.match(/<HkListTransition[\s\S]*?>/);
|
|
92
|
+
expect(usage, "the primitive is used here").toBeTruthy();
|
|
93
|
+
const tag = usage![0];
|
|
94
|
+
expect(tag).toContain('tag="ul"');
|
|
95
|
+
expect(tag).toContain('variant="pop"');
|
|
96
|
+
expect(tag, "FLIP moves for the surviving rows").toMatch(/\bmove\b/);
|
|
97
|
+
// `appear` would replay the whole list's entrance on every open.
|
|
98
|
+
// (jsdom applies no stylesheets, so FLIP/appear have no behavioural
|
|
99
|
+
// observable — this is a deliberate source-level pin, backed by the
|
|
100
|
+
// behaviour test "opening the panel does NOT replay the list's
|
|
101
|
+
// entrance".)
|
|
102
|
+
expect(tag).not.toMatch(/\bappear\b/);
|
|
103
|
+
expect(src).not.toContain("TransitionGroup");
|
|
104
|
+
expect(src).not.toContain("useSurfaceTransition");
|
|
105
|
+
// The list wrap outlives the empty swap — a torn-down group cancels
|
|
106
|
+
// its ghosts mid-flight, so the empty caption must live INSIDE the
|
|
107
|
+
// wrap (after the group), not in a branch that replaces it.
|
|
108
|
+
expect(src.indexOf("hk-notification-center__list-wrap")).toBeLessThan(
|
|
109
|
+
src.indexOf("hk-notification-center__empty"),
|
|
110
|
+
);
|
|
111
|
+
});
|
|
66
112
|
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { createApp, h, nextTick } from "vue";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The overlay-scrollbar ATTACH TARGET (2026-11-20 review, mutation M5).
|
|
6
|
+
*
|
|
7
|
+
* The bell owns the desktop flyout's overlay scrollbar because the list
|
|
8
|
+
* keeps native overflow MECHANICS while painting no native bar
|
|
9
|
+
* (`scrollbar-width: none`) — without the engine the list scrolls
|
|
10
|
+
* invisibly (user report 2026-11-19). The engine binds a `scroll`
|
|
11
|
+
* listener and reads/writes `scrollTop` on the element it is given, so
|
|
12
|
+
* attaching to anything but the SCROLLER (the `ul`) yields a thumb bound
|
|
13
|
+
* to a dead target: opening the panel still passes the other test (the
|
|
14
|
+
* tracks render inside the wrap either way), yet tall lists scroll
|
|
15
|
+
* invisibly again.
|
|
16
|
+
*
|
|
17
|
+
* That regression survived the whole behaviour suite, so this file pins
|
|
18
|
+
* the argument itself: the first attach call must receive the list
|
|
19
|
+
* element, with the wrap still riding as the track host.
|
|
20
|
+
*
|
|
21
|
+
* (Repo test convention: raw createApp + document queries, no
|
|
22
|
+
* @vue/test-utils dependency.)
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const attachSpy = vi.fn();
|
|
26
|
+
|
|
27
|
+
vi.mock("../composables/useOverlayScrollbar", async (importOriginal) => {
|
|
28
|
+
const actual = await importOriginal<typeof import("../composables/useOverlayScrollbar")>();
|
|
29
|
+
return {
|
|
30
|
+
...actual,
|
|
31
|
+
attachOverlayScrollbars: (el: HTMLElement, opts?: { axis?: string; host?: HTMLElement }) => {
|
|
32
|
+
attachSpy(el, opts);
|
|
33
|
+
return actual.attachOverlayScrollbars(el, opts as never);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const { default: HkNotificationBell } = await import("./HkNotificationBell");
|
|
39
|
+
const { recordNotification, resetNotifications } = await import("../runtime/notificationCenter");
|
|
40
|
+
const { setLocale } = await import("../i18n/context");
|
|
41
|
+
|
|
42
|
+
const mounts: Array<{ app: ReturnType<typeof createApp>; container: HTMLElement }> = [];
|
|
43
|
+
|
|
44
|
+
function mountBell() {
|
|
45
|
+
const container = document.createElement("div");
|
|
46
|
+
document.body.appendChild(container);
|
|
47
|
+
const app = createApp({ render: () => h(HkNotificationBell) });
|
|
48
|
+
mounts.push({ app, container });
|
|
49
|
+
app.mount(container);
|
|
50
|
+
return container;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function settle() {
|
|
54
|
+
await nextTick();
|
|
55
|
+
await new Promise((r) => setTimeout(r, 80));
|
|
56
|
+
await nextTick();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
afterEach(() => {
|
|
60
|
+
for (const { app, container } of mounts.splice(0)) {
|
|
61
|
+
app.unmount();
|
|
62
|
+
container.remove();
|
|
63
|
+
}
|
|
64
|
+
document.body
|
|
65
|
+
.querySelectorAll(".hk-popover-scrim, .hk-popover-panel")
|
|
66
|
+
.forEach((el) => el.remove());
|
|
67
|
+
resetNotifications();
|
|
68
|
+
attachSpy.mockClear();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe("bell overlay scrollbar wiring", () => {
|
|
72
|
+
it("attaches to the scrolling list, with the wrap as the track host", async () => {
|
|
73
|
+
await setLocale("en");
|
|
74
|
+
for (let i = 0; i < 12; i++) {
|
|
75
|
+
recordNotification({ id: `t:${i}`, kind: "toast", tone: "error", title: `row ${i}` });
|
|
76
|
+
}
|
|
77
|
+
mountBell();
|
|
78
|
+
await settle();
|
|
79
|
+
document
|
|
80
|
+
.querySelector<HTMLButtonElement>(".hk-notification-bell .hk-icon-button")!
|
|
81
|
+
.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
82
|
+
await settle();
|
|
83
|
+
|
|
84
|
+
expect(attachSpy, "the engine was attached").toHaveBeenCalled();
|
|
85
|
+
const [target, opts] = attachSpy.mock.calls[0];
|
|
86
|
+
// The SCROLLER, not the wrapper: the wrapper merely wraps the viewport
|
|
87
|
+
// and never scrolls — binding the thumb there is the invisible-scroll
|
|
88
|
+
// regression this pin exists for.
|
|
89
|
+
const list = document.querySelector(".hk-notification-center__list")!;
|
|
90
|
+
const wrap = document.querySelector(".hk-notification-center__list-wrap")!;
|
|
91
|
+
expect(target).toBe(list);
|
|
92
|
+
expect((target as HTMLElement).classList.contains("hk-notification-center__list")).toBe(true);
|
|
93
|
+
expect(target).not.toBe(wrap);
|
|
94
|
+
expect(opts?.host ?? null).toBe(wrap);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it("keeps ONE engine handle across journal changes on the open panel", async () => {
|
|
98
|
+
// The list stays mounted now (the entry/exit choreography needs it), so
|
|
99
|
+
// the engine must be armed once per open and UPDATED as content moves —
|
|
100
|
+
// a second attach per record would leak a listener set per row.
|
|
101
|
+
await setLocale("en");
|
|
102
|
+
mountBell();
|
|
103
|
+
await settle();
|
|
104
|
+
const bell = () =>
|
|
105
|
+
document.querySelector<HTMLButtonElement>(".hk-notification-bell .hk-icon-button")!;
|
|
106
|
+
bell().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
107
|
+
await settle();
|
|
108
|
+
expect(attachSpy, "the open panel arms the engine even when row-less").toHaveBeenCalledTimes(1);
|
|
109
|
+
const list = document.querySelector(".hk-notification-center__list");
|
|
110
|
+
expect(attachSpy.mock.calls[0][0]).toBe(list);
|
|
111
|
+
|
|
112
|
+
recordNotification({ id: "late", kind: "toast", tone: "error", title: "late arrival" });
|
|
113
|
+
await settle();
|
|
114
|
+
expect(attachSpy, "content changes update the handle, never re-arm it").toHaveBeenCalledTimes(1);
|
|
115
|
+
expect(attachSpy.mock.calls[0][0]).toBe(document.querySelector(".hk-notification-center__list"));
|
|
116
|
+
|
|
117
|
+
// A close/open cycle re-arms against the CURRENT element.
|
|
118
|
+
bell().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
119
|
+
await settle();
|
|
120
|
+
bell().dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
121
|
+
await settle();
|
|
122
|
+
expect(attachSpy).toHaveBeenCalledTimes(2);
|
|
123
|
+
expect(attachSpy.mock.calls[1][0]).toBe(
|
|
124
|
+
document.querySelector(".hk-notification-center__list"),
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -50,6 +50,18 @@
|
|
|
50
50
|
max-height: min(24rem, 55vh);
|
|
51
51
|
overflow-y: auto;
|
|
52
52
|
overscroll-behavior: contain;
|
|
53
|
+
/* The list is ALSO the containing block for HkListTransition's leaving
|
|
54
|
+
ghosts (rows leaving under the `pop` variant are lifted to
|
|
55
|
+
`position: absolute` and pinned to their pre-patch box by
|
|
56
|
+
pinLeaveGeometry). Without this the nearest positioned ancestor is
|
|
57
|
+
the track-hosting wrapper OUTSIDE the scroller: the ghost then
|
|
58
|
+
escapes the scroll clip and is pinned in LAYOUT coordinates while
|
|
59
|
+
the viewport is scrolled — a row dismissed from a scrolled list
|
|
60
|
+
painted hundreds of pixels away from where the user saw it (real
|
|
61
|
+
Chrome measurement, 2026-11-20: 629px drift on a 98px viewport).
|
|
62
|
+
With `relative` the ghost lives inside the scroller, is clipped by
|
|
63
|
+
it, and moves with the content. */
|
|
64
|
+
position: relative;
|
|
53
65
|
/* Native-scrollbar invariant (nativeScrollbar.contract.test.ts): the
|
|
54
66
|
list keeps native overflow mechanics, the platform bar never
|
|
55
67
|
paints — overlay scrollbars ride the popup chrome instead. */
|
|
@@ -114,4 +114,19 @@ describe("HkNotificationBell scss contract", () => {
|
|
|
114
114
|
scss.match(/--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 85%\)/g) ?? [],
|
|
115
115
|
).toHaveLength(1);
|
|
116
116
|
});
|
|
117
|
+
|
|
118
|
+
it("the list is its own containing block for the leaving ghosts", () => {
|
|
119
|
+
// HkListTransition lifts a leaving row to `position: absolute` and pins
|
|
120
|
+
// it to its pre-patch box. If the nearest positioned ancestor is the
|
|
121
|
+
// WRAP (outside the scroller), the ghost escapes the list's clip and is
|
|
122
|
+
// pinned in LAYOUT coordinates while the viewport is scrolled — real
|
|
123
|
+
// Chrome measurement (2026-11-20): a row dismissed from a scrolled list
|
|
124
|
+
// painted 629px away from where the user saw it, i.e. no visible fade.
|
|
125
|
+
// `position: relative` makes the ghost live inside the scroller, where
|
|
126
|
+
// it is clipped and moves with the content.
|
|
127
|
+
const listBlock = scss.match(/^\.hk-notification-center__list \{([^}]*)\}/m);
|
|
128
|
+
expect(listBlock, "the list rule exists").toBeTruthy();
|
|
129
|
+
expect(listBlock![1]).toContain("position: relative");
|
|
130
|
+
expect(listBlock![1], "and it stays the scroll container").toContain("overflow-y: auto");
|
|
131
|
+
});
|
|
117
132
|
});
|