@celestia-island/hikari 0.55.358 → 0.55.360
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/HkAboutModal.test.tsx +33 -1
- package/src/components/HkAboutModal.tsx +11 -0
- package/src/components/HkAdminHeader.test.tsx +23 -0
- package/src/components/HkAdminHeader.tsx +9 -1
- package/src/components/HkDrawer.scss +14 -4
- package/src/components/HkLoadingVeil.scss +6 -1
- package/src/components/HkMarkdownRenderer.tsx +32 -1
- package/src/components/HkPopover.scss +6 -1
- package/src/components/HkScrollContainer.dock.test.tsx +100 -2
- package/src/components/HkScrollContainer.scss +15 -10
- package/src/components/HkScrollContainer.tsx +9 -2
- package/src/components/HkSelect.scss +6 -2
- package/src/components/HkTitleBar.test.tsx +32 -0
- package/src/components/HkTitleBar.tsx +25 -1
- package/src/components/HkTooltip.tsx +11 -1
- package/src/components/__tests__/hkMarkdownLinks.test.ts +152 -0
- package/src/components/chromeBand.contract.test.ts +54 -1
- package/src/index.ts +25 -0
- package/src/plugins/boot-chrome.d.mts +10 -1
- package/src/plugins/boot-chrome.mjs +8 -0
- package/src/res/boot-chrome.js +97 -3
- package/src/res/bootChrome.test.ts +108 -1
- package/src/runtime/hyperlink.test.ts +231 -0
- package/src/runtime/hyperlink.ts +294 -0
- package/src/runtime/index.ts +6 -0
- package/src/runtime/popupBounds.test.ts +58 -1
- package/src/runtime/popupBounds.ts +45 -2
- package/src/runtime/tooltipBridge.test.ts +88 -0
- package/src/runtime/tooltipBridge.ts +21 -0
- package/src/runtime/tooltipPosition.ts +28 -4
- package/src/runtime/windowChrome.ts +59 -0
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
import { createApp, defineComponent, h, nextTick, ref } from "vue";
|
|
3
3
|
|
|
4
4
|
import { HkAboutModal } from "./HkAboutModal";
|
|
5
5
|
import { setLocale } from "../i18n/context";
|
|
6
|
+
import { provideHyperlinkCoordinator } from "../runtime/hyperlink";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* HkAboutModal contract tests for the branding + redesign waves:
|
|
@@ -77,6 +78,9 @@ afterEach(() => {
|
|
|
77
78
|
app.unmount();
|
|
78
79
|
container.remove();
|
|
79
80
|
}
|
|
81
|
+
provideHyperlinkCoordinator(null);
|
|
82
|
+
vi.unstubAllGlobals();
|
|
83
|
+
vi.restoreAllMocks();
|
|
80
84
|
setLocale("en");
|
|
81
85
|
});
|
|
82
86
|
|
|
@@ -499,4 +503,32 @@ describe("HkAboutModal branding", () => {
|
|
|
499
503
|
);
|
|
500
504
|
expect(subtitle.querySelector(".s-about-modal-subtitle-sep")).toBeTruthy();
|
|
501
505
|
});
|
|
506
|
+
|
|
507
|
+
it("routes a link click through the hyperlink coordinator (never the default)", async () => {
|
|
508
|
+
// The coordination contract (runtime/hyperlink.ts): the About dialog's
|
|
509
|
+
// rows are exactly the "help links" class — on the web face a click
|
|
510
|
+
// must open a hardened new tab through the coordinator, and the
|
|
511
|
+
// anchor's own default must stay dead so the dialog never navigates
|
|
512
|
+
// away. Observed through the resolver half: it saw the About source,
|
|
513
|
+
// and its null verdict swallowed the activation.
|
|
514
|
+
const seen: Array<{ href: string; source: string }> = [];
|
|
515
|
+
provideHyperlinkCoordinator({
|
|
516
|
+
resolve: (info) => {
|
|
517
|
+
seen.push({ href: info.href, source: info.source });
|
|
518
|
+
return null;
|
|
519
|
+
},
|
|
520
|
+
});
|
|
521
|
+
mountAbout({
|
|
522
|
+
links: [{ label: "Homepage", href: "https://example.com" }],
|
|
523
|
+
});
|
|
524
|
+
await flushModal();
|
|
525
|
+
|
|
526
|
+
const link = query<HTMLAnchorElement>('.s-about-modal-link[href="https://example.com"]');
|
|
527
|
+
const event = new MouseEvent("click", { bubbles: true, cancelable: true });
|
|
528
|
+
link.dispatchEvent(event);
|
|
529
|
+
await flushModal();
|
|
530
|
+
|
|
531
|
+
expect(seen).toEqual([{ href: "https://example.com", source: "about" }]);
|
|
532
|
+
expect(event.defaultPrevented).toBe(true);
|
|
533
|
+
});
|
|
502
534
|
});
|
|
@@ -3,6 +3,7 @@ import { Github } from "lucide-vue-next";
|
|
|
3
3
|
import { HBadge, HModal } from "@celestia-island/hikari";
|
|
4
4
|
|
|
5
5
|
import { useI18n } from "../i18n/context";
|
|
6
|
+
import { openHyperlink } from "../runtime/hyperlink";
|
|
6
7
|
|
|
7
8
|
import "./HkAboutModal.scss";
|
|
8
9
|
|
|
@@ -177,6 +178,16 @@ export const HkAboutBody = defineComponent({
|
|
|
177
178
|
href={item.href}
|
|
178
179
|
target="_blank"
|
|
179
180
|
rel="noopener noreferrer"
|
|
181
|
+
// The activation rides the hyperlink coordinator (runtime/
|
|
182
|
+
// hyperlink.ts): a new tab on the web face, the system browser
|
|
183
|
+
// in the native shell — the webview itself never navigates.
|
|
184
|
+
// The href/target attributes stay for semantics and the
|
|
185
|
+
// browser's link menu; only the left-click default is taken
|
|
186
|
+
// over.
|
|
187
|
+
onClick={(event: MouseEvent) => {
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
void openHyperlink(item.href, { source: "about" });
|
|
190
|
+
}}
|
|
180
191
|
// A text link is named by its own label unless the host names it
|
|
181
192
|
// explicitly; an icon-only link has no text to be named by, so it
|
|
182
193
|
// always needs a name of its own.
|
|
@@ -60,6 +60,7 @@ vi.mock("./HkMenu", async () => {
|
|
|
60
60
|
return { default: HMenuStub };
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
import { CHROME_BAND_DRAG_REGION } from "../runtime/windowChrome";
|
|
63
64
|
import { HkAdminHeader } from "./HkAdminHeader";
|
|
64
65
|
|
|
65
66
|
/**
|
|
@@ -333,3 +334,25 @@ describe("HkAdminHeader", () => {
|
|
|
333
334
|
expect(actions?.className).toContain("s-header-wing-end");
|
|
334
335
|
});
|
|
335
336
|
});
|
|
337
|
+
|
|
338
|
+
describe("HkAdminHeader chrome face drag region (2026-11-12)", () => {
|
|
339
|
+
// WHY: with chrome on, this header IS the desktop window's caption band (Tauri
|
|
340
|
+
// decorations:false). A bare drag attribute only matches the exact event
|
|
341
|
+
// target, so the wings that tile the header shadowed it — dragging and the
|
|
342
|
+
// double-click maximize never fired. The chrome face must carry hikari's deep
|
|
343
|
+
// contract on the header root; the content face (chrome off) must not.
|
|
344
|
+
it("carries the shared deep drag region when it is the caption band", () => {
|
|
345
|
+
const c = mount(headerNode({ chrome: true }));
|
|
346
|
+
const header = c.querySelector("header")!;
|
|
347
|
+
expect(header.getAttribute("data-tauri-drag-region")).toBe(CHROME_BAND_DRAG_REGION);
|
|
348
|
+
// The LITERAL as well — the constant comparison alone follows a wrong value
|
|
349
|
+
// (mutation evidence: "true" kept this suite green before this pin).
|
|
350
|
+
expect(header.getAttribute("data-tauri-drag-region")).toBe("deep");
|
|
351
|
+
expect(header.classList.contains("hk-chrome-band")).toBe(true);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
it("leaves the content-face header out of the drag contract", () => {
|
|
355
|
+
const c = mount(headerNode({}));
|
|
356
|
+
expect(c.querySelector("header")!.hasAttribute("data-tauri-drag-region")).toBe(false);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
@@ -2,6 +2,7 @@ import { computed, defineComponent, ref, watch, type PropType, type VNode } from
|
|
|
2
2
|
import { Camera, ExternalLink, Languages, LogOut, Menu } from "lucide-vue-next";
|
|
3
3
|
import { HBadge, HButton, HSpinner } from "@celestia-island/hikari";
|
|
4
4
|
import { useI18n } from "../i18n/context";
|
|
5
|
+
import { CHROME_BAND_DRAG_REGION } from "../runtime/windowChrome";
|
|
5
6
|
import HkMenu, { type HkMenuItem } from "./HkMenu";
|
|
6
7
|
import { HkAvatarButton } from "./HkAvatarButton";
|
|
7
8
|
|
|
@@ -27,7 +28,13 @@ export const HkAdminHeader = defineComponent({
|
|
|
27
28
|
* window-controls chrome contract (.s-glass-header--chrome /
|
|
28
29
|
* --hk-window-controls-edge-inset) instead of the content inset —
|
|
29
30
|
* a standard-mode cluster glued to the frame corner is the flush
|
|
30
|
-
* variant's look worn by the wrong mode (field report 2026-10-25).
|
|
31
|
+
* variant's look worn by the wrong mode (field report 2026-10-25).
|
|
32
|
+
* The face also claims the titlebar layer (.hk-chrome-band) and
|
|
33
|
+
* carries hikari's deep drag region (CHROME_BAND_DRAG_REGION): the
|
|
34
|
+
* whole header surface drags and double-click-maximizes under
|
|
35
|
+
* Tauri's injected handler — the header IS the caption band, and its
|
|
36
|
+
* wings/wrappers would otherwise shadow a bare attribute off the
|
|
37
|
+
* event target (2026-11-12 user report). */
|
|
31
38
|
chrome: { type: Boolean, default: false },
|
|
32
39
|
actions: { type: Array as PropType<VNode[]>, default: () => [] },
|
|
33
40
|
/** Signed-in identity. Drives the avatar fallback letter, the
|
|
@@ -220,6 +227,7 @@ export const HkAdminHeader = defineComponent({
|
|
|
220
227
|
props.chrome ? "s-glass-header--chrome" : "",
|
|
221
228
|
props.chrome ? "hk-chrome-band" : "",
|
|
222
229
|
]}
|
|
230
|
+
data-tauri-drag-region={props.chrome ? CHROME_BAND_DRAG_REGION : undefined}
|
|
223
231
|
>
|
|
224
232
|
<div ref={userTriggerRef} class="s-admin-header-user s-header-wing-start">
|
|
225
233
|
{/* The hamburger rides INSIDE the left wing: the balanced grid
|
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
* through to the page below (2026-10-15 defect). */
|
|
8
8
|
pointer-events: auto;
|
|
9
9
|
position: fixed;
|
|
10
|
-
inset:
|
|
10
|
+
/* --hk-chrome-band-inset: the chrome-band geometry leg (see
|
|
11
|
+
* .hk-modal-overlay) — the dim/blur curtain yields its top edge to the
|
|
12
|
+
* host caption band on native shells, same as every windowed veil. */
|
|
13
|
+
top: var(--hk-chrome-band-inset, 0px);
|
|
14
|
+
right: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
left: 0;
|
|
11
17
|
background: var(--hk-drawer-overlay-bg, rgba(0, 0, 0, 0.45));
|
|
12
18
|
@include backdrop-filter(var(--hk-drawer-overlay-blur, blur(6px)));
|
|
13
19
|
}
|
|
@@ -47,7 +53,9 @@
|
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
.hk-drawer-left {
|
|
50
|
-
|
|
56
|
+
/* Panels dock BELOW the caption band too (geometry leg): the drawer
|
|
57
|
+
* slides in under the host caption, never over it. */
|
|
58
|
+
top: var(--hk-chrome-band-inset, 0px);
|
|
51
59
|
bottom: 0;
|
|
52
60
|
left: 0;
|
|
53
61
|
border-right: 1px solid var(--hi-color-border, rgba(100,100,100,0.08));
|
|
@@ -55,7 +63,8 @@
|
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
.hk-drawer-right {
|
|
58
|
-
|
|
66
|
+
/* Below the caption band, same as the left panel. */
|
|
67
|
+
top: var(--hk-chrome-band-inset, 0px);
|
|
59
68
|
bottom: 0;
|
|
60
69
|
right: 0;
|
|
61
70
|
border-left: 1px solid var(--hi-color-border, rgba(100,100,100,0.08));
|
|
@@ -63,7 +72,8 @@
|
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
.hk-drawer-top {
|
|
66
|
-
|
|
75
|
+
/* Below the caption band, same as the side panels. */
|
|
76
|
+
top: var(--hk-chrome-band-inset, 0px);
|
|
67
77
|
left: 0;
|
|
68
78
|
right: 0;
|
|
69
79
|
border-bottom: 1px solid var(--hi-color-border, rgba(100,100,100,0.08));
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
.hk-loading-veil {
|
|
9
9
|
position: fixed;
|
|
10
|
-
|
|
10
|
+
/* The chrome-band geometry leg: the blocking veil starts below the
|
|
11
|
+
* host caption band on native shells (see .hk-modal-overlay). */
|
|
12
|
+
top: var(--hk-chrome-band-inset, 0px);
|
|
13
|
+
right: 0;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
left: 0;
|
|
11
16
|
z-index: var(--hk-overlay-z-veil, 150);
|
|
12
17
|
display: flex;
|
|
13
18
|
align-items: center;
|
|
@@ -5,6 +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
9
|
import { asIndexable } from "../utils/typing";
|
|
9
10
|
import "./HkMarkdownRenderer.scss";
|
|
10
11
|
|
|
@@ -149,6 +150,13 @@ export default defineComponent({
|
|
|
149
150
|
* consumer renders exactly as before.
|
|
150
151
|
*/
|
|
151
152
|
inlineChips: { type: Boolean, default: false },
|
|
153
|
+
/**
|
|
154
|
+
* Opaque per-surface tag carried on every link activation this body
|
|
155
|
+
* fires — the host coordinator scopes its resolution with it (the
|
|
156
|
+
* chest tags vendored protocol docs so their relative links map to
|
|
157
|
+
* the docs site). Never interpreted by hikari itself.
|
|
158
|
+
*/
|
|
159
|
+
linkContext: { type: String, default: undefined },
|
|
152
160
|
},
|
|
153
161
|
setup(props) {
|
|
154
162
|
const renderedHtml = ref("");
|
|
@@ -266,9 +274,32 @@ export default defineComponent({
|
|
|
266
274
|
mermaidApps.length = 0;
|
|
267
275
|
});
|
|
268
276
|
|
|
277
|
+
// THE link path (runtime/hyperlink.ts): every anchor this body
|
|
278
|
+
// renders activates through the coordinator — a plain browser opens a
|
|
279
|
+
// new tab, the native shell hands the URL to the system browser, and
|
|
280
|
+
// the webview itself NEVER navigates (the 2026-11-12 protocol-modal
|
|
281
|
+
// 404 was exactly an anchor left to its default behavior). All
|
|
282
|
+
// modifier combos intercept too: ctrl/middle-click on the desktop
|
|
283
|
+
// would otherwise navigate the app window the same way.
|
|
284
|
+
function onBodyClick(event: MouseEvent): void {
|
|
285
|
+
const target = event.target as HTMLElement | null;
|
|
286
|
+
const anchor = target?.closest?.("a[href]") as HTMLAnchorElement | null;
|
|
287
|
+
if (!anchor) return;
|
|
288
|
+
event.preventDefault();
|
|
289
|
+
void openHyperlink(anchor.getAttribute("href") ?? "", {
|
|
290
|
+
source: "markdown",
|
|
291
|
+
...(props.linkContext !== undefined ? { linkContext: props.linkContext } : {}),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
269
295
|
return () => (
|
|
270
296
|
<div class="hk-markdown" data-plain={props.plain || undefined} data-loading={props.loading}>
|
|
271
|
-
<div
|
|
297
|
+
<div
|
|
298
|
+
ref={bodyRef}
|
|
299
|
+
class="hk-markdown-body"
|
|
300
|
+
innerHTML={renderedHtml.value}
|
|
301
|
+
onClick={onBodyClick}
|
|
302
|
+
/>
|
|
272
303
|
{props.loading && (
|
|
273
304
|
<div class="hk-markdown-overlay">
|
|
274
305
|
<HSpinner center />
|
|
@@ -103,7 +103,12 @@
|
|
|
103
103
|
// ------
|
|
104
104
|
.hk-popover-scrim {
|
|
105
105
|
position: fixed;
|
|
106
|
-
|
|
106
|
+
/* The chrome-band geometry leg (see .hk-modal-overlay): the sheet's
|
|
107
|
+
* dim curtain yields its top edge to the host caption band. */
|
|
108
|
+
top: var(--hk-chrome-band-inset, 0px);
|
|
109
|
+
right: 0;
|
|
110
|
+
bottom: 0;
|
|
111
|
+
left: 0;
|
|
107
112
|
pointer-events: auto;
|
|
108
113
|
background: rgb(0 0 0 / 40%);
|
|
109
114
|
}
|
|
@@ -18,8 +18,8 @@ import { readFileSync } from "node:fs";
|
|
|
18
18
|
import { dirname, join } from "node:path";
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
20
|
|
|
21
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
22
|
-
import { createApp, h, defineComponent, ref, type VNodeChild } from "vue";
|
|
21
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
22
|
+
import { createApp, h, defineComponent, reactive, ref, type VNodeChild } from "vue";
|
|
23
23
|
|
|
24
24
|
import HkKanban from "./HkKanban";
|
|
25
25
|
import HkScrollContainer from "./HkScrollContainer";
|
|
@@ -70,6 +70,104 @@ describe("HkScrollContainer dock slots", () => {
|
|
|
70
70
|
expect(host.style.getPropertyValue("--hk-scroll-dock-top")).toBe("0px");
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
+
it("drops a fade-era data-dir mirror once the gate owns the edges", async () => {
|
|
74
|
+
// The dir mirror belongs to the `fade` band-slot swap (the sheet's RTL
|
|
75
|
+
// rules read it under [data-fade]). When a dock container ALSO had
|
|
76
|
+
// `fade` on for a while and then turns it off, the dock branch takes
|
|
77
|
+
// over - and it must not leave the mirror behind (the cleanup promise
|
|
78
|
+
// is "fade off removes it", which the no-dock tests pin but a dock
|
|
79
|
+
// container exercises through a different branch).
|
|
80
|
+
const instance = ref<{ refresh: () => void } | null>(null);
|
|
81
|
+
const container = document.createElement("div");
|
|
82
|
+
document.body.appendChild(container);
|
|
83
|
+
containers.push(container);
|
|
84
|
+
const props = reactive({ fade: true, dockFade: true });
|
|
85
|
+
const app = createApp(defineComponent({
|
|
86
|
+
setup() {
|
|
87
|
+
return () =>
|
|
88
|
+
h(
|
|
89
|
+
HkScrollContainer,
|
|
90
|
+
{ ref: instance as never, ...props },
|
|
91
|
+
{
|
|
92
|
+
default: () => h("div", { class: "content" }, "rows"),
|
|
93
|
+
dockBottom: () => h("div", { class: "the-dock" }, "dock"),
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
},
|
|
97
|
+
}));
|
|
98
|
+
mounts.push(app);
|
|
99
|
+
const host = (app.mount(container) as unknown as { $el: HTMLElement }).$el;
|
|
100
|
+
const viewport = host.querySelector(".hk-scroll-container-viewport") as HTMLElement;
|
|
101
|
+
Object.defineProperty(viewport, "scrollHeight", { value: 400, configurable: true });
|
|
102
|
+
Object.defineProperty(viewport, "clientHeight", { value: 100, configurable: true });
|
|
103
|
+
Object.defineProperty(viewport, "scrollTop", { value: 120, configurable: true });
|
|
104
|
+
instance.value?.refresh();
|
|
105
|
+
await Promise.resolve();
|
|
106
|
+
// The fade pass has run, so a mirrored dir exists...
|
|
107
|
+
expect(host.getAttribute("data-dir")).not.toBeNull();
|
|
108
|
+
|
|
109
|
+
// ...and turning `fade` off must drop it (the dock branch cleans up)
|
|
110
|
+
// and re-derive the strengths through the binary gate.
|
|
111
|
+
props.fade = false;
|
|
112
|
+
// Let the wrapper re-render first (the spread only re-reads on the
|
|
113
|
+
// wrapper's own render pass); refresh AFTER the child has the new
|
|
114
|
+
// props, or the fade branch runs one last time and re-stamps the dir.
|
|
115
|
+
await Promise.resolve();
|
|
116
|
+
instance.value?.refresh();
|
|
117
|
+
await Promise.resolve();
|
|
118
|
+
expect(host.getAttribute("data-dir")).toBeNull();
|
|
119
|
+
// 280 still hidden below the fold: the dock gate is lit.
|
|
120
|
+
expect(host.style.getPropertyValue("--hk-scroll-fade-strength-bottom")).toBe("1");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("re-senses when dockFade flips at rest, without a manual refresh", async () => {
|
|
124
|
+
// The re-sense watcher keys on [fade, fadeDistance, dockFade]. This is
|
|
125
|
+
// its only coverage: flipping dockFade at rest with NO manual refresh —
|
|
126
|
+
// the watcher's scheduled frame must re-run the dock branch and clear
|
|
127
|
+
// the stale strength (a manual refresh here would exercise the sense
|
|
128
|
+
// pass and hide a missing key, which the review's mutation proved).
|
|
129
|
+
vi.useFakeTimers();
|
|
130
|
+
try {
|
|
131
|
+
const instance = ref<{ refresh: () => void } | null>(null);
|
|
132
|
+
const container = document.createElement("div");
|
|
133
|
+
document.body.appendChild(container);
|
|
134
|
+
containers.push(container);
|
|
135
|
+
const props = reactive({ dockFade: true });
|
|
136
|
+
const app = createApp(defineComponent({
|
|
137
|
+
setup() {
|
|
138
|
+
return () =>
|
|
139
|
+
h(
|
|
140
|
+
HkScrollContainer,
|
|
141
|
+
{ ref: instance as never, ...props },
|
|
142
|
+
{
|
|
143
|
+
default: () => h("div", { class: "content" }, "rows"),
|
|
144
|
+
dockBottom: () => h("div", { class: "the-dock" }, "dock"),
|
|
145
|
+
},
|
|
146
|
+
);
|
|
147
|
+
},
|
|
148
|
+
}));
|
|
149
|
+
mounts.push(app);
|
|
150
|
+
const host = (app.mount(container) as unknown as { $el: HTMLElement }).$el;
|
|
151
|
+
const viewport = host.querySelector(".hk-scroll-container-viewport") as HTMLElement;
|
|
152
|
+
Object.defineProperty(viewport, "scrollHeight", { value: 400, configurable: true });
|
|
153
|
+
Object.defineProperty(viewport, "clientHeight", { value: 100, configurable: true });
|
|
154
|
+
Object.defineProperty(viewport, "scrollTop", { value: 0, configurable: true });
|
|
155
|
+
instance.value?.refresh();
|
|
156
|
+
await vi.advanceTimersByTimeAsync(60);
|
|
157
|
+
// 300 hidden below the fold: the gate is lit at full depth.
|
|
158
|
+
expect(host.style.getPropertyValue("--hk-scroll-fade-strength-bottom")).toBe("1");
|
|
159
|
+
|
|
160
|
+
props.dockFade = false;
|
|
161
|
+
// NO refresh: the watcher's own scheduled update must do the pass.
|
|
162
|
+
await vi.advanceTimersByTimeAsync(60);
|
|
163
|
+
// The dock branch no longer runs, the stale value was cleared and
|
|
164
|
+
// nothing republished it.
|
|
165
|
+
expect(host.style.getPropertyValue("--hk-scroll-fade-strength-bottom")).toBe("");
|
|
166
|
+
} finally {
|
|
167
|
+
vi.useRealTimers();
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
73
171
|
it("retires the dock band at the scroll end instead of covering the last row", async () => {
|
|
74
172
|
// 2026-11-12 user report: the cruise board's band kept painting over
|
|
75
173
|
// its own flush-parked last row at full scroll. Dock bands share the
|
|
@@ -86,8 +86,10 @@
|
|
|
86
86
|
into a 0..1 number mirrored as --hk-scroll-fade-strength-<side>.
|
|
87
87
|
Pull the strip and the trailing edge's fade grows from a hard cut
|
|
88
88
|
through a hint to the full band; scroll back and it recedes. Edges
|
|
89
|
-
with nothing hidden read strength 1 (the pre-JS
|
|
90
|
-
|
|
89
|
+
with nothing hidden read strength 1 (the pre-JS fallback), which
|
|
90
|
+
with a 0px band contributes nothing. Dock-fed edges are gated
|
|
91
|
+
separately by the dock branch (binary, see the dock-edge-fade
|
|
92
|
+
block). Physical-side
|
|
91
93
|
names AND a mirrored data-dir: the component resolves the computed
|
|
92
94
|
direction once and publishes both the depths and the direction
|
|
93
95
|
attribute from the same pass, so the LTR and RTL state rules
|
|
@@ -381,16 +383,19 @@
|
|
|
381
383
|
documented shape, not a bug.
|
|
382
384
|
|
|
383
385
|
The dock band MULTIPLIES its own size by the published strength
|
|
384
|
-
(2026-11-12 user report).
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
386
|
+
(2026-11-12 user report). Before the dock gate the component published
|
|
387
|
+
no strengths for a dock-only container (the `fade` prop owns that
|
|
388
|
+
ramp), so the band sat at full depth forever and a scroller parked at
|
|
389
|
+
its END kept painting over its own last row —
|
|
388
390
|
「拉到最底部仍然有渐变阴影覆盖最后一行」. The dock path now publishes a
|
|
389
391
|
binary gate (lit while the edge hides content, retired at the end), and
|
|
390
|
-
this `calc()` is what turns it into px:
|
|
391
|
-
the flush-parked row reads in full
|
|
392
|
-
|
|
393
|
-
|
|
392
|
+
this `calc()` is what turns it into px: with `fade` off, the dock
|
|
393
|
+
branch publishes 0 at the end, so the flush-parked row reads in full
|
|
394
|
+
(with `fade` on, the ramp branch owns the edge and the 2026-11-06
|
|
395
|
+
ownership note above still describes that combination). The `1`
|
|
396
|
+
fallback keeps the pre-fix full band wherever nothing is published
|
|
397
|
+
(SSR, no JS pass yet). A ride dock does run the gate but stamps no
|
|
398
|
+
marker, so its published values have no reader. */
|
|
394
399
|
.hk-scroll-container[data-dock-fade="bottom"] {
|
|
395
400
|
--hk-scroll-fade-bottom: calc(
|
|
396
401
|
var(--hk-scroll-dock-fade, 2rem) * var(--hk-scroll-fade-strength-bottom, 1)
|
|
@@ -235,7 +235,14 @@ export default defineComponent({
|
|
|
235
235
|
* ride-mode dock: that dock lives INSIDE the masked viewport, so the
|
|
236
236
|
* same band would fade the dock's own bottom edge; and it needs no
|
|
237
237
|
* dissolve at all, because the air between content and dock is the
|
|
238
|
-
* dock's measured height (see `dockMode`).
|
|
238
|
+
* dock's measured height (see `dockMode`). The band RETIRES at the
|
|
239
|
+
* scroll end (2026-11-12 user report): it is the dock size
|
|
240
|
+
* multiplied by a binary strength this component publishes for
|
|
241
|
+
* dock-fed edges — lit while content still hides past the edge,
|
|
242
|
+
* retired at the sense's own 1px deadband — so a flush-parked last
|
|
243
|
+
* row reads in full instead of sitting under a permanent gradient.
|
|
244
|
+
* With `fade` ALSO on, the ramp branch owns the edges and the
|
|
245
|
+
* sheet's ownership note describes that combination. */
|
|
239
246
|
dockFade: { type: Boolean, default: true },
|
|
240
247
|
/** Opt-in tail clearance for FLOATING docks (2026-10-12): a dock that
|
|
241
248
|
* lives OUTSIDE this container (a shell-level fixed plane — a page's
|
|
@@ -1086,7 +1093,7 @@ export default defineComponent({
|
|
|
1086
1093
|
// Runtime fade changes re-sense immediately: flipping `fade` on with
|
|
1087
1094
|
// content already hidden must not wait for a scroll, and a different
|
|
1088
1095
|
// fadeDistance re-derives every strength without any DOM motion.
|
|
1089
|
-
watch(() => [props.fade, props.fadeDistance] as const, () => {
|
|
1096
|
+
watch(() => [props.fade, props.fadeDistance, props.dockFade] as const, () => {
|
|
1090
1097
|
scheduleUpdate();
|
|
1091
1098
|
});
|
|
1092
1099
|
|
|
@@ -292,8 +292,12 @@
|
|
|
292
292
|
.hk-select-sheet-scrim {
|
|
293
293
|
pointer-events: auto;
|
|
294
294
|
position: fixed;
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
/* The chrome-band geometry leg (see .hk-modal-overlay): the sheet's
|
|
296
|
+
* dim curtain yields its top edge to the host caption band. */
|
|
297
|
+
top: var(--hk-chrome-band-inset, 0px);
|
|
298
|
+
right: 0;
|
|
299
|
+
bottom: 0;
|
|
300
|
+
left: 0;
|
|
297
301
|
background: rgb(0 0 0 / 40%);
|
|
298
302
|
}
|
|
299
303
|
|
|
@@ -7,6 +7,7 @@ import { afterEach, describe, expect, it } from "vitest";
|
|
|
7
7
|
import { createApp, h, nextTick, ref } from "vue";
|
|
8
8
|
|
|
9
9
|
import { setLocale } from "../i18n/context";
|
|
10
|
+
import { CHROME_BAND_DRAG_REGION } from "../runtime/windowChrome";
|
|
10
11
|
|
|
11
12
|
import HkTitleBar from "./HkTitleBar";
|
|
12
13
|
|
|
@@ -251,3 +252,34 @@ describe("HkTitleBar stylesheet contract", () => {
|
|
|
251
252
|
expect(scss).not.toMatch(/^\s*--hk-tb-icon-size:/m);
|
|
252
253
|
});
|
|
253
254
|
});
|
|
255
|
+
|
|
256
|
+
describe("HkTitleBar caption band drag region (2026-11-12)", () => {
|
|
257
|
+
// WHY: the bar IS the desktop window's caption band, and Tauri's injected
|
|
258
|
+
// drag handler only matches a BARE data-tauri-drag-region on the exact event
|
|
259
|
+
// target — so a band of wrappers/spans left drag (and double-click maximize)
|
|
260
|
+
// dead everywhere except the few pixels the root paints. The whole bar must
|
|
261
|
+
// carry hikari's deep contract instead.
|
|
262
|
+
it("carries the shared deep drag region on the root", () => {
|
|
263
|
+
const c = mount(h(HkTitleBar, { title: "App" }));
|
|
264
|
+
const bar = c.querySelector(".hk-titlebar")!;
|
|
265
|
+
expect(bar.getAttribute("data-tauri-drag-region")).toBe(CHROME_BAND_DRAG_REGION);
|
|
266
|
+
// The LITERAL, not just the imported constant: asserting the constant alone
|
|
267
|
+
// follows a wrong value instead of catching it (a mutation to "true" left
|
|
268
|
+
// this suite green before this pin existed — Tauri needs "deep" for the
|
|
269
|
+
// whole-band surface).
|
|
270
|
+
expect(bar.getAttribute("data-tauri-drag-region")).toBe("deep");
|
|
271
|
+
// The CSS grammar attribute stays: WKWebView drags through app-region.
|
|
272
|
+
expect(bar.hasAttribute("data-drag-region")).toBe(true);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it("keeps the caption buttons OUT of the drag region themselves", () => {
|
|
276
|
+
// They are clickables, which Tauri's handler already skips — but the
|
|
277
|
+
// actions row must not carry the attribute either (a future refactor that
|
|
278
|
+
// moved it there would start dragging instead of clicking).
|
|
279
|
+
const c = mount(h(HkTitleBar, { title: "App" }));
|
|
280
|
+
for (const button of c.querySelectorAll(".hk-titlebar-btn")) {
|
|
281
|
+
expect(button.hasAttribute("data-tauri-drag-region")).toBe(false);
|
|
282
|
+
}
|
|
283
|
+
expect(c.querySelector(".hk-titlebar-actions")!.hasAttribute("data-tauri-drag-region")).toBe(false);
|
|
284
|
+
});
|
|
285
|
+
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { defineComponent, onBeforeUnmount, onMounted, ref } from "vue";
|
|
2
2
|
import { useI18n } from "../i18n/context";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
CHROME_BAND_DRAG_REGION,
|
|
5
|
+
claimWindowChrome,
|
|
6
|
+
} from "../runtime/windowChrome";
|
|
4
7
|
|
|
5
8
|
import "./HkTitleBar.scss";
|
|
6
9
|
|
|
@@ -17,6 +20,14 @@ import "./HkTitleBar.scss";
|
|
|
17
20
|
* interactive children) — supported by Tauri (WebView2/WKWebView/WebKitGTK)
|
|
18
21
|
* and Electron alike; no JS drag logic needed.
|
|
19
22
|
*
|
|
23
|
+
* Tauri's injected drag handler keys off the `data-tauri-drag-region`
|
|
24
|
+
* ATTRIBUTE (the CSS property above only covers WKWebView), and its bare
|
|
25
|
+
* value matches the exact event target only — so the bar carries hikari's
|
|
26
|
+
* `CHROME_BAND_DRAG_REGION` ("deep"): the WHOLE bar surface, not just the
|
|
27
|
+
* pixels the root paints, drags and double-click-maximizes, while the
|
|
28
|
+
* interactive children keep blocking for themselves (the handler skips
|
|
29
|
+
* clickables and honors explicit `"false"`; see runtime/windowChrome).
|
|
30
|
+
*
|
|
20
31
|
* Text selection is disabled across the bar (captions are chrome, not
|
|
21
32
|
* content).
|
|
22
33
|
*
|
|
@@ -76,6 +87,7 @@ export default defineComponent({
|
|
|
76
87
|
class="hk-titlebar"
|
|
77
88
|
data-drag-region
|
|
78
89
|
data-maximized={props.maximized || undefined}
|
|
90
|
+
data-tauri-drag-region={CHROME_BAND_DRAG_REGION}
|
|
79
91
|
>
|
|
80
92
|
{slots.left?.() ?? (
|
|
81
93
|
<span class="hk-titlebar-title">
|
|
@@ -96,6 +108,9 @@ export default defineComponent({
|
|
|
96
108
|
class="hk-titlebar-btn"
|
|
97
109
|
title={a.label}
|
|
98
110
|
aria-label={a.label}
|
|
111
|
+
// Caption-row trigger: the tooltip MAY pin over the strip —
|
|
112
|
+
// the explicit band-overlap exemption (runtime/tooltipBridge).
|
|
113
|
+
data-hk-tooltip-band-overlap="true"
|
|
99
114
|
onClick={(e: MouseEvent) => {
|
|
100
115
|
e.stopPropagation();
|
|
101
116
|
emit("action", a.id);
|
|
@@ -110,6 +125,9 @@ export default defineComponent({
|
|
|
110
125
|
class="hk-titlebar-btn"
|
|
111
126
|
title={t("hikari::titleBar.minimize", "Minimize")}
|
|
112
127
|
aria-label={t("hikari::titleBar.minimize", "Minimize")}
|
|
128
|
+
// Caption-row trigger: the tooltip MAY pin over the strip —
|
|
129
|
+
// the explicit band-overlap exemption (runtime/tooltipBridge).
|
|
130
|
+
data-hk-tooltip-band-overlap="true"
|
|
113
131
|
onClick={(e: MouseEvent) => {
|
|
114
132
|
e.stopPropagation();
|
|
115
133
|
emit("minimize");
|
|
@@ -124,6 +142,9 @@ export default defineComponent({
|
|
|
124
142
|
class="hk-titlebar-btn"
|
|
125
143
|
title={props.maximized ? t("hikari::titleBar.restore", "Restore") : t("hikari::titleBar.maximize", "Maximize")}
|
|
126
144
|
aria-label={props.maximized ? t("hikari::titleBar.restore", "Restore") : t("hikari::titleBar.maximize", "Maximize")}
|
|
145
|
+
// Caption-row trigger: the tooltip MAY pin over the strip —
|
|
146
|
+
// the explicit band-overlap exemption (runtime/tooltipBridge).
|
|
147
|
+
data-hk-tooltip-band-overlap="true"
|
|
127
148
|
onClick={(e: MouseEvent) => {
|
|
128
149
|
e.stopPropagation();
|
|
129
150
|
emit("toggle-maximize");
|
|
@@ -142,6 +163,9 @@ export default defineComponent({
|
|
|
142
163
|
class="hk-titlebar-btn hk-titlebar-btn-close"
|
|
143
164
|
title={t("hikari::titleBar.close", "Close")}
|
|
144
165
|
aria-label={t("hikari::titleBar.close", "Close")}
|
|
166
|
+
// Caption-row trigger: the tooltip MAY pin over the strip —
|
|
167
|
+
// the explicit band-overlap exemption (runtime/tooltipBridge).
|
|
168
|
+
data-hk-tooltip-band-overlap="true"
|
|
145
169
|
onClick={(e: MouseEvent) => {
|
|
146
170
|
e.stopPropagation();
|
|
147
171
|
emit("close");
|
|
@@ -56,6 +56,14 @@ export default defineComponent({
|
|
|
56
56
|
* ignored in this mode.
|
|
57
57
|
*/
|
|
58
58
|
trigger: { type: String as PropType<TooltipTrigger>, default: "hover" },
|
|
59
|
+
/**
|
|
60
|
+
* The EXPLICIT caption-band exemption (2026-11-12 user direction):
|
|
61
|
+
* default false — the placed bubble keeps at least a 4px gap under the
|
|
62
|
+
* host caption strip (popupBounds floors the popup frame at the
|
|
63
|
+
* chrome-band inset); true lets the bubble pin over the strip, for
|
|
64
|
+
* triggers that live ON the caption (the title bar's own buttons).
|
|
65
|
+
*/
|
|
66
|
+
allowBandOverlap: { type: Boolean, default: false },
|
|
59
67
|
},
|
|
60
68
|
slots: Object as SlotsType<{
|
|
61
69
|
default?: (props: HkTooltipSlotProps) => unknown;
|
|
@@ -113,7 +121,9 @@ export default defineComponent({
|
|
|
113
121
|
// that keeps the measured bubble inside the viewport gutter (flip,
|
|
114
122
|
// cap, shift) instead of spilling off-screen or shrinking to the
|
|
115
123
|
// containing block's leftover space.
|
|
116
|
-
applyTooltipPosition(popupRef.value, rect, props.placement, props.maxWidth
|
|
124
|
+
applyTooltipPosition(popupRef.value, rect, props.placement, props.maxWidth, {
|
|
125
|
+
allowBandOverlap: props.allowBandOverlap,
|
|
126
|
+
});
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
function stopPositionTracking() {
|