@celestia-island/hikari 0.55.224 → 0.55.226
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/HkAboutBody.test.tsx +124 -0
- package/src/components/HkAboutModal.tsx +204 -109
- package/src/components/HkScrollContainer.fade.contract.test.ts +66 -0
- package/src/components/HkScrollContainer.scss +98 -46
- package/src/components/HkToast.scss +19 -11
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
2
|
+
import { createApp, defineComponent, h, nextTick } from "vue";
|
|
3
|
+
|
|
4
|
+
import { HkAboutBody } from "./HkAboutModal";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* HkAboutBody contract tests for the extraction wave (2026-10-29): the
|
|
8
|
+
* body is the modal's whole layout mountable OUTSIDE a modal — the desktop
|
|
9
|
+
* settings' About pane renders it directly, and a second hand-copied body
|
|
10
|
+
* is exactly how the credits links drifted. These tests pin the two
|
|
11
|
+
* body-level knobs the modal never needed:
|
|
12
|
+
* - `filingsAsChips` renders the legal filings as their own chip group
|
|
13
|
+
* (`data-slot="filings"`) and NO bare footer-links row
|
|
14
|
+
* - default (modal) behavior keeps the bare footer-links row and no filings
|
|
15
|
+
* group
|
|
16
|
+
* - the default slot appends host content after the copyright footer
|
|
17
|
+
* - without a backdrop factory no backdrop layer renders (a body host may
|
|
18
|
+
* not want the decorative canvas at all)
|
|
19
|
+
*
|
|
20
|
+
* (Repo test convention: raw createApp + document queries, no
|
|
21
|
+
* @vue/test-utils dependency.)
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const mounts: Array<{ app: ReturnType<typeof createApp>; container: HTMLElement }> = [];
|
|
25
|
+
|
|
26
|
+
function mountBody(props: Record<string, unknown> = {}, slot?: () => unknown): void {
|
|
27
|
+
const container = document.createElement("div");
|
|
28
|
+
document.body.appendChild(container);
|
|
29
|
+
|
|
30
|
+
const Wrapper = defineComponent({
|
|
31
|
+
setup() {
|
|
32
|
+
return () =>
|
|
33
|
+
h(HkAboutBody, { appName: "Test App", version: "1.2.3", ...props }, slot ? { default: slot } : undefined);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const app = createApp(Wrapper);
|
|
37
|
+
app.mount(container);
|
|
38
|
+
mounts.push({ app, container });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function query<T extends Element>(selector: string): T {
|
|
42
|
+
const el = document.body.querySelector<T>(selector);
|
|
43
|
+
expect(el, `${selector} renders`).toBeTruthy();
|
|
44
|
+
return el!;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function flush() {
|
|
48
|
+
await nextTick();
|
|
49
|
+
await nextTick();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
afterEach(() => {
|
|
53
|
+
for (const { app, container } of mounts.splice(0)) {
|
|
54
|
+
app.unmount();
|
|
55
|
+
container.remove();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const FILINGS = [
|
|
60
|
+
{ label: "苏ICP备2025155733号-2", href: "https://beian.miit.gov.cn/", face: "chip" as const },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
describe("HkAboutBody extraction", () => {
|
|
64
|
+
it("mounts the full body outside a modal", async () => {
|
|
65
|
+
mountBody({
|
|
66
|
+
tagline: "Chat with your AI agents",
|
|
67
|
+
credits: [
|
|
68
|
+
{ text: "来自 " },
|
|
69
|
+
{ name: "Celestia Island", href: "https://celestia.world", face: "accent" },
|
|
70
|
+
{ text: ",由 " },
|
|
71
|
+
{ name: "伊欧", href: "https://github.com/langyo", face: "accent" },
|
|
72
|
+
{ text: " 主创" },
|
|
73
|
+
],
|
|
74
|
+
componentVersions: [{ label: "WebUI 版本", value: "0.1.0 master:abc1234" }],
|
|
75
|
+
});
|
|
76
|
+
await flush();
|
|
77
|
+
|
|
78
|
+
expect(query(".s-about-modal")).toBeTruthy();
|
|
79
|
+
// No HModal shell around it: no dialog surface, no overlay.
|
|
80
|
+
expect(document.body.querySelector(".hk-modal")).toBeNull();
|
|
81
|
+
expect(query(".s-about-modal-name").textContent).toContain("Test App");
|
|
82
|
+
expect(document.body.querySelectorAll(".s-about-modal-credit-link")).toHaveLength(2);
|
|
83
|
+
expect(query(".s-about-modal-row-number").textContent).toContain("master:abc1234");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("filingsAsChips renders the filings group and no footer-links row", async () => {
|
|
87
|
+
mountBody({ footerLinks: FILINGS, filingsAsChips: true });
|
|
88
|
+
await flush();
|
|
89
|
+
|
|
90
|
+
const group = query('.s-about-modal-links[data-slot="filings"]');
|
|
91
|
+
const link = group.querySelector<HTMLAnchorElement>(".s-about-modal-link");
|
|
92
|
+
expect(link?.getAttribute("data-face")).toBe("chip");
|
|
93
|
+
expect(link?.getAttribute("href")).toBe("https://beian.miit.gov.cn/");
|
|
94
|
+
// The bare row is the modal face; chips mode must not render both.
|
|
95
|
+
expect(document.body.querySelector(".s-about-modal-footer-links")).toBeNull();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("default filings keep the bare footer-links row with no group", async () => {
|
|
99
|
+
mountBody({ footerLinks: [{ label: "ICP", href: "https://beian.miit.gov.cn/" }] });
|
|
100
|
+
await flush();
|
|
101
|
+
|
|
102
|
+
expect(query(".s-about-modal-footer-links")).toBeTruthy();
|
|
103
|
+
expect(document.body.querySelector('.s-about-modal-links[data-slot="filings"]')).toBeNull();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("appends default-slot content after the copyright footer", async () => {
|
|
107
|
+
mountBody({}, () => h("button", { class: "body-slot-row" }, "Check update"));
|
|
108
|
+
await flush();
|
|
109
|
+
|
|
110
|
+
const body = query(".s-about-modal-body");
|
|
111
|
+
const footer = body.querySelector(".s-about-modal-footer")!;
|
|
112
|
+
const button = body.querySelector(".body-slot-row")!;
|
|
113
|
+
expect(button).toBeTruthy();
|
|
114
|
+
// After the footer in document order: the slot rides at the body's end.
|
|
115
|
+
expect(footer.compareDocumentPosition(button) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("renders no backdrop layer when the host passes no factory", async () => {
|
|
119
|
+
mountBody();
|
|
120
|
+
await flush();
|
|
121
|
+
|
|
122
|
+
expect(document.body.querySelector(".s-about-modal-backdrop")).toBeNull();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -82,24 +82,27 @@ export interface HAboutComponentVersion {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
* (Upstreamed from shittim-chest's plana-legacy layer.)
|
|
85
|
+
* HkAboutBody — the About dialog's body, mountable OUTSIDE a modal.
|
|
87
86
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
87
|
+
* Extracted verbatim from HkAboutModal (2026-10-29): the desktop settings'
|
|
88
|
+
* About section renders this same body inside its own pane, so every
|
|
89
|
+
* surface shares one implementation of the identity hero, the credits
|
|
90
|
+
* sentence, the spec card and the link rows — the hand-copied second body
|
|
91
|
+
* is exactly how the credits links drifted (both names pointing at the
|
|
92
|
+
* organization's URL, the trailing role word lost).
|
|
93
|
+
*
|
|
94
|
+
* Two body-level knobs exist for hosts that are not a modal:
|
|
95
|
+
* - `filingsAsChips` renders the legal filings as a chip group
|
|
96
|
+
* (`data-slot="filings"`) instead of the bare footer-text row — the
|
|
97
|
+
* desktop surface's standing direction (2026-10-23: no bare text
|
|
98
|
+
* hyperlinks on that surface) while the modal keeps the plain row
|
|
99
|
+
* (2026-09-14).
|
|
100
|
+
* - the default slot appends host content after the copyright footer
|
|
101
|
+
* (the desktop's update-check row), still inside the body's flow.
|
|
98
102
|
*/
|
|
99
|
-
export const
|
|
100
|
-
name: "
|
|
103
|
+
export const HkAboutBody = defineComponent({
|
|
104
|
+
name: "HkAboutBody",
|
|
101
105
|
props: {
|
|
102
|
-
modelValue: { type: Boolean, default: false },
|
|
103
106
|
/** Application display name. */
|
|
104
107
|
appName: { type: String, required: true },
|
|
105
108
|
/** Application version (e.g. "0.1.4"). */
|
|
@@ -134,18 +137,17 @@ export const HkAboutModal = defineComponent({
|
|
|
134
137
|
links: { type: Array as PropType<HAboutLink[]>, default: () => [] },
|
|
135
138
|
/** Optional centered legal links above the copyright (ICP filings). */
|
|
136
139
|
footerLinks: { type: Array as PropType<HAboutLink[]>, default: () => [] },
|
|
140
|
+
/** Render the legal filings as a chip group instead of the bare
|
|
141
|
+
* footer-text row (the desktop surface's standing direction). */
|
|
142
|
+
filingsAsChips: { type: Boolean, default: false },
|
|
137
143
|
/**
|
|
138
144
|
* Optional decorative backdrop factory, rendered behind the content
|
|
139
|
-
* inside a clipped, pointer-inert layer. The
|
|
145
|
+
* inside a clipped, pointer-inert layer. The body owns only the layer —
|
|
140
146
|
* sizing, theming and the render loop belong to the returned subtree.
|
|
141
147
|
*/
|
|
142
148
|
backdrop: { type: Function as PropType<() => unknown>, default: undefined },
|
|
143
|
-
title: { type: String, default: undefined },
|
|
144
|
-
},
|
|
145
|
-
emits: {
|
|
146
|
-
"update:modelValue": (_v: boolean) => true,
|
|
147
149
|
},
|
|
148
|
-
setup(props, {
|
|
150
|
+
setup(props, { slots }) {
|
|
149
151
|
const { t } = useI18n();
|
|
150
152
|
|
|
151
153
|
// One link renderer for every link in the dialog: credits names,
|
|
@@ -233,102 +235,195 @@ export const HkAboutModal = defineComponent({
|
|
|
233
235
|
};
|
|
234
236
|
|
|
235
237
|
return () => (
|
|
236
|
-
<
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<div class="s-about-modal">
|
|
243
|
-
|
|
244
|
-
<div class="s-about-modal-
|
|
245
|
-
{props.
|
|
238
|
+
<div class="s-about-modal">
|
|
239
|
+
{props.backdrop && (
|
|
240
|
+
<div class="s-about-modal-backdrop" aria-hidden="true">
|
|
241
|
+
{props.backdrop()}
|
|
242
|
+
</div>
|
|
243
|
+
)}
|
|
244
|
+
<div class="s-about-modal-body">
|
|
245
|
+
<header class="s-about-modal-header">
|
|
246
|
+
<div class="s-about-modal-logo-frame">
|
|
247
|
+
{props.logoSrc ? (
|
|
248
|
+
<img
|
|
249
|
+
class="s-about-modal-logo-img"
|
|
250
|
+
src={props.logoSrc}
|
|
251
|
+
alt=""
|
|
252
|
+
draggable={false}
|
|
253
|
+
/>
|
|
254
|
+
) : (
|
|
255
|
+
<div class="s-about-modal-logo">{props.appName.slice(0, 1).toUpperCase()}</div>
|
|
256
|
+
)}
|
|
246
257
|
</div>
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
<div class="s-about-modal-identity">
|
|
259
|
+
<h2 class="s-about-modal-name">{props.appName}</h2>
|
|
260
|
+
<p class="s-about-modal-subtitle">
|
|
261
|
+
<span class="s-about-modal-version">
|
|
262
|
+
{t("hikari::about.version", "Version")} {props.version}
|
|
263
|
+
</span>
|
|
264
|
+
{props.tagline && (
|
|
265
|
+
<>
|
|
266
|
+
<span class="s-about-modal-subtitle-sep" aria-hidden="true">
|
|
267
|
+
·
|
|
268
|
+
</span>
|
|
269
|
+
<span class="s-about-modal-tagline">{props.tagline}</span>
|
|
270
|
+
</>
|
|
260
271
|
)}
|
|
261
|
-
</
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<p class="s-about-modal-subtitle">
|
|
265
|
-
<span class="s-about-modal-version">
|
|
266
|
-
{t("hikari::about.version", "Version")} {props.version}
|
|
267
|
-
</span>
|
|
268
|
-
{props.tagline && (
|
|
269
|
-
<>
|
|
270
|
-
<span class="s-about-modal-subtitle-sep" aria-hidden="true">
|
|
271
|
-
·
|
|
272
|
-
</span>
|
|
273
|
-
<span class="s-about-modal-tagline">{props.tagline}</span>
|
|
274
|
-
</>
|
|
275
|
-
)}
|
|
276
|
-
</p>
|
|
277
|
-
</div>
|
|
278
|
-
</header>
|
|
272
|
+
</p>
|
|
273
|
+
</div>
|
|
274
|
+
</header>
|
|
279
275
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
276
|
+
{(props.credits.length > 0 || props.description) && (
|
|
277
|
+
<div class="s-about-modal-credits">
|
|
278
|
+
{renderCredits()}
|
|
279
|
+
{props.description && (
|
|
280
|
+
<p class="s-about-modal-description">{props.description}</p>
|
|
281
|
+
)}
|
|
282
|
+
</div>
|
|
283
|
+
)}
|
|
288
284
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
285
|
+
{props.componentVersions.length > 0 && (
|
|
286
|
+
<div class="s-about-modal-rows">
|
|
287
|
+
{props.componentVersions.map((component) => (
|
|
288
|
+
<div class="s-about-modal-row" key={component.label}>
|
|
289
|
+
<span class="s-about-modal-row-label">{component.label}</span>
|
|
290
|
+
<span class="s-about-modal-row-value">
|
|
291
|
+
<span class="s-about-modal-row-number">{component.value}</span>
|
|
292
|
+
{component.meta && (
|
|
293
|
+
<span
|
|
294
|
+
class="s-about-modal-row-meta"
|
|
295
|
+
data-tone={component.metaTone ?? "neutral"}
|
|
296
|
+
>
|
|
297
|
+
{component.meta}
|
|
298
|
+
</span>
|
|
299
|
+
)}
|
|
300
|
+
</span>
|
|
301
|
+
</div>
|
|
302
|
+
))}
|
|
303
|
+
</div>
|
|
304
|
+
)}
|
|
309
305
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
306
|
+
{(props.licenses.length > 0 || props.links.length > 0) && (
|
|
307
|
+
<div class="s-about-modal-chips">
|
|
308
|
+
{renderLinks(props.licenses, "licenses")}
|
|
309
|
+
{renderLinks(props.links, "links")}
|
|
310
|
+
</div>
|
|
311
|
+
)}
|
|
316
312
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
313
|
+
{props.filingsAsChips
|
|
314
|
+
? // The desktop surface's filings: chips in their own group,
|
|
315
|
+
// in the body flow (2026-10-23 direction).
|
|
316
|
+
renderLinks(props.footerLinks, "filings")
|
|
317
|
+
: visibleLinks(props.footerLinks).length > 0 && (
|
|
318
|
+
<div class="s-about-modal-footer-links">
|
|
319
|
+
{visibleLinks(props.footerLinks).map((link, index) =>
|
|
320
|
+
renderLink(link, "s-about-modal-footer-link", `legal:${index}`),
|
|
321
|
+
)}
|
|
322
|
+
</div>
|
|
323
|
+
)}
|
|
324
324
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
325
|
+
<footer class="s-about-modal-footer">
|
|
326
|
+
<HBadge variant="muted">
|
|
327
|
+
© {new Date().getFullYear()} {props.copyright ?? props.appName}
|
|
328
|
+
</HBadge>
|
|
329
|
+
</footer>
|
|
330
|
+
|
|
331
|
+
{slots.default?.()}
|
|
331
332
|
</div>
|
|
333
|
+
</div>
|
|
334
|
+
);
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* HkAboutModal — version / about dialog.
|
|
340
|
+
* (Upstreamed from shittim-chest's plana-legacy layer.)
|
|
341
|
+
*
|
|
342
|
+
* A centered HModal wrapping {@link HkAboutBody} — the body carries the
|
|
343
|
+
* whole layout (identity hero, credits block, spec card, link rows) and is
|
|
344
|
+
* the piece other surfaces mount directly, so the modal and the settings
|
|
345
|
+
* pane cannot drift. Every link opens in a new tab and renders in the face
|
|
346
|
+
* its entry asks for: the ghost chip, or bare text (`plain` / tinted
|
|
347
|
+
* `accent`) for names / URLs / filings that should read as ordinary
|
|
348
|
+
* sentence text. Every branding prop is optional — the modal degrades to
|
|
349
|
+
* the plain identity card when none are given.
|
|
350
|
+
*/
|
|
351
|
+
export const HkAboutModal = defineComponent({
|
|
352
|
+
name: "HkAboutModal",
|
|
353
|
+
props: {
|
|
354
|
+
modelValue: { type: Boolean, default: false },
|
|
355
|
+
/** Application display name. */
|
|
356
|
+
appName: { type: String, required: true },
|
|
357
|
+
/** Application version (e.g. "0.1.4"). */
|
|
358
|
+
version: { type: String, required: true },
|
|
359
|
+
/** Optional logo image URL — replaces the first-letter tile. */
|
|
360
|
+
logoSrc: { type: String, default: undefined },
|
|
361
|
+
/** Optional one-liner shown beside the version (e.g. the app tagline). */
|
|
362
|
+
tagline: { type: String, default: undefined },
|
|
363
|
+
/** Optional centered small line under the credits (organization blurb). */
|
|
364
|
+
description: { type: String, default: undefined },
|
|
365
|
+
/**
|
|
366
|
+
* Credits sentence, assembled from text runs and linked names
|
|
367
|
+
* (e.g. 来自 <Celestia Island>,由 <伊欧> 主创). Each name renders in the
|
|
368
|
+
* face its entry asks for — `chip`, bare text with `plain`, or bare
|
|
369
|
+
* text tinted in the primary colour with `accent`.
|
|
370
|
+
*/
|
|
371
|
+
credits: { type: Array as PropType<HAboutCredit[]>, default: () => [] },
|
|
372
|
+
/** License links (e.g. SySL-1.0 / BUSL-1.1), rendered centered. */
|
|
373
|
+
licenses: { type: Array as PropType<HAboutLink[]>, default: () => [] },
|
|
374
|
+
/** Software-component version rows (WebUI / engines), label + value. */
|
|
375
|
+
componentVersions: {
|
|
376
|
+
type: Array as PropType<HAboutComponentVersion[]>,
|
|
377
|
+
default: () => [],
|
|
378
|
+
},
|
|
379
|
+
/** Optional copyright holder in the footer (defaults to the app name). */
|
|
380
|
+
copyright: { type: String, default: undefined },
|
|
381
|
+
/**
|
|
382
|
+
* Optional external links (e.g. the site domains, the project's GitHub
|
|
383
|
+
* home). An entry may carry an `icon` instead of a `label` — that is how
|
|
384
|
+
* the GitHub mark rides at the end of the domain row.
|
|
385
|
+
*/
|
|
386
|
+
links: { type: Array as PropType<HAboutLink[]>, default: () => [] },
|
|
387
|
+
/** Optional centered legal links above the copyright (ICP filings). */
|
|
388
|
+
footerLinks: { type: Array as PropType<HAboutLink[]>, default: () => [] },
|
|
389
|
+
/** Render the legal filings as a chip group (see {@link HkAboutBody}). */
|
|
390
|
+
filingsAsChips: { type: Boolean, default: false },
|
|
391
|
+
/**
|
|
392
|
+
* Optional decorative backdrop factory, rendered behind the content
|
|
393
|
+
* inside a clipped, pointer-inert layer. The modal owns only the layer —
|
|
394
|
+
* sizing, theming and the render loop belong to the returned subtree.
|
|
395
|
+
*/
|
|
396
|
+
backdrop: { type: Function as PropType<() => unknown>, default: undefined },
|
|
397
|
+
title: { type: String, default: undefined },
|
|
398
|
+
},
|
|
399
|
+
emits: {
|
|
400
|
+
"update:modelValue": (_v: boolean) => true,
|
|
401
|
+
},
|
|
402
|
+
setup(props, { emit }) {
|
|
403
|
+
const { t } = useI18n();
|
|
404
|
+
|
|
405
|
+
return () => (
|
|
406
|
+
<HModal
|
|
407
|
+
modelValue={props.modelValue}
|
|
408
|
+
onUpdate:modelValue={(v: boolean) => emit("update:modelValue", v)}
|
|
409
|
+
title={props.title ?? t("hikari::about.title", "About")}
|
|
410
|
+
width="30rem"
|
|
411
|
+
>
|
|
412
|
+
<HkAboutBody
|
|
413
|
+
appName={props.appName}
|
|
414
|
+
version={props.version}
|
|
415
|
+
logoSrc={props.logoSrc}
|
|
416
|
+
tagline={props.tagline}
|
|
417
|
+
description={props.description}
|
|
418
|
+
credits={props.credits}
|
|
419
|
+
licenses={props.licenses}
|
|
420
|
+
componentVersions={props.componentVersions}
|
|
421
|
+
copyright={props.copyright}
|
|
422
|
+
links={props.links}
|
|
423
|
+
footerLinks={props.footerLinks}
|
|
424
|
+
filingsAsChips={props.filingsAsChips}
|
|
425
|
+
backdrop={props.backdrop}
|
|
426
|
+
/>
|
|
332
427
|
</HModal>
|
|
333
428
|
);
|
|
334
429
|
},
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source contract for the scroll-container edge fades (the 2026-10
|
|
3
|
+
* revision): each edge owns a CSS var and the viewport mask INTERSECTS a
|
|
4
|
+
* vertical and a horizontal gradient, so a two-axis container fades on all
|
|
5
|
+
* four sides and the corners fall off naturally.
|
|
6
|
+
*
|
|
7
|
+
* The regression this pins (user report: "the light effect is clipped at
|
|
8
|
+
* the two sides"): the old sheet wrote ONE `mask-image` per axis, so the
|
|
9
|
+
* last matching rule won, the other axis never faded, and its band ended in
|
|
10
|
+
* a hard cut. Vertical fades were missing entirely. Hence:
|
|
11
|
+
* - exactly ONE mask declaration pair lives in the sheet (the composed
|
|
12
|
+
* block on the viewport) — a new per-axis `mask-image` rule is drift;
|
|
13
|
+
* - all four edge vars are declared (top/right/bottom/left, 0px base);
|
|
14
|
+
* - start/end/both rules exist for BOTH axes;
|
|
15
|
+
* - RTL swaps the horizontal vars instead of rewriting the mask.
|
|
16
|
+
*/
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { readFileSync } from "node:fs";
|
|
19
|
+
import { dirname, join } from "node:path";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
21
|
+
|
|
22
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
const sheet = readFileSync(join(here, "HkScrollContainer.scss"), "utf-8");
|
|
24
|
+
|
|
25
|
+
describe("scroll fade composition contract", () => {
|
|
26
|
+
it("declares one composed mask on the viewport (no per-axis overrides)", () => {
|
|
27
|
+
const declarations = sheet.match(/^\s*-?(?:webkit-)?mask-image:/gm) ?? [];
|
|
28
|
+
// The composed block owns exactly one pair: -webkit-mask-image + mask-image.
|
|
29
|
+
expect(declarations.length).toBe(2);
|
|
30
|
+
expect(sheet).toContain("mask-composite: intersect");
|
|
31
|
+
expect(sheet).toContain("-webkit-mask-composite: source-in");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("declares the four edge vars with zero defaults", () => {
|
|
35
|
+
for (const edge of ["top", "right", "bottom", "left"]) {
|
|
36
|
+
expect(sheet).toContain(`--hk-scroll-fade-${edge}: 0px;`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("fades both axes from the sensed overflow", () => {
|
|
41
|
+
for (const axis of ["v", "h"]) {
|
|
42
|
+
for (const state of ["start", "end", "both"]) {
|
|
43
|
+
expect(sheet).toContain(
|
|
44
|
+
`[data-${axis}-overflow="${state}"]`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// The vertical half is what the old sheet was missing entirely.
|
|
49
|
+
expect(sheet).toContain('--hk-scroll-fade-top: var(--hk-scroll-fade-size)');
|
|
50
|
+
expect(sheet).toContain('--hk-scroll-fade-bottom: var(--hk-scroll-fade-size)');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("swaps horizontal sides under RTL instead of rewriting the mask", () => {
|
|
54
|
+
expect(sheet).toContain(
|
|
55
|
+
'[dir="rtl"] .hk-scroll-container[data-fade="true"][data-h-overflow="start"]',
|
|
56
|
+
);
|
|
57
|
+
expect(sheet).toContain(
|
|
58
|
+
'[dir="rtl"] .hk-scroll-container[data-fade="true"][data-h-overflow="end"]',
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("routes the dock fades through the same edge vars", () => {
|
|
63
|
+
expect(sheet).toContain('--hk-scroll-fade-bottom: var(--hk-scroll-dock-fade, 2rem)');
|
|
64
|
+
expect(sheet).toContain('--hk-scroll-fade-top: var(--hk-scroll-dock-fade, 2rem)');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -39,18 +39,104 @@
|
|
|
39
39
|
margin-inline: auto;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/* ── Optional edge fades (fade=true)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
/* ── Optional edge fades (fade=true / dock fades) ─────────────────
|
|
43
|
+
FOUR-EDGE composition (2026-10 revision): each edge owns a CSS var, and
|
|
44
|
+
the viewport's mask INTERSECTS a vertical and a horizontal gradient, so
|
|
45
|
+
the fade reaches zero on every side that hides content and the corners
|
|
46
|
+
fall off naturally in all four directions. The previous per-axis rules
|
|
47
|
+
overwrote one `mask-image` property, so a two-axis container only faded
|
|
48
|
+
one axis AND the band ended in a hard cut at the other axis's edges
|
|
49
|
+
(user report: the light effect is clipped at the two sides). Vertical
|
|
50
|
+
fades were missing entirely. Dock fades ride the same vars, which also
|
|
51
|
+
removes their old mask-override conflict. */
|
|
52
|
+
.hk-scroll-container:is([data-fade="true"], [data-dock-fade]) > .hk-scroll-container-viewport {
|
|
53
|
+
--hk-scroll-fade-top: 0px;
|
|
54
|
+
--hk-scroll-fade-right: 0px;
|
|
55
|
+
--hk-scroll-fade-bottom: 0px;
|
|
56
|
+
--hk-scroll-fade-left: 0px;
|
|
57
|
+
-webkit-mask-image:
|
|
58
|
+
linear-gradient(
|
|
59
|
+
to bottom,
|
|
60
|
+
transparent 0,
|
|
61
|
+
#000 var(--hk-scroll-fade-top),
|
|
62
|
+
#000 calc(100% - var(--hk-scroll-fade-bottom)),
|
|
63
|
+
transparent 100%
|
|
64
|
+
),
|
|
65
|
+
linear-gradient(
|
|
66
|
+
to right,
|
|
67
|
+
transparent 0,
|
|
68
|
+
#000 var(--hk-scroll-fade-left),
|
|
69
|
+
#000 calc(100% - var(--hk-scroll-fade-right)),
|
|
70
|
+
transparent 100%
|
|
71
|
+
);
|
|
72
|
+
-webkit-mask-composite: source-in;
|
|
73
|
+
-webkit-mask-repeat: no-repeat;
|
|
74
|
+
mask-image:
|
|
75
|
+
linear-gradient(
|
|
76
|
+
to bottom,
|
|
77
|
+
transparent 0,
|
|
78
|
+
#000 var(--hk-scroll-fade-top),
|
|
79
|
+
#000 calc(100% - var(--hk-scroll-fade-bottom)),
|
|
80
|
+
transparent 100%
|
|
81
|
+
),
|
|
82
|
+
linear-gradient(
|
|
83
|
+
to right,
|
|
84
|
+
transparent 0,
|
|
85
|
+
#000 var(--hk-scroll-fade-left),
|
|
86
|
+
#000 calc(100% - var(--hk-scroll-fade-right)),
|
|
87
|
+
transparent 100%
|
|
88
|
+
);
|
|
89
|
+
mask-composite: intersect;
|
|
90
|
+
mask-repeat: no-repeat;
|
|
91
|
+
}
|
|
92
|
+
|
|
47
93
|
.hk-scroll-container[data-fade="true"] {
|
|
48
94
|
--hk-scroll-fade-size: var(--space-24);
|
|
49
95
|
}
|
|
50
96
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
97
|
+
/* Vertical axis — the half the old implementation never had. */
|
|
98
|
+
.hk-scroll-container[data-fade="true"][data-v-overflow="start"] {
|
|
99
|
+
--hk-scroll-fade-top: var(--hk-scroll-fade-size);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.hk-scroll-container[data-fade="true"][data-v-overflow="end"] {
|
|
103
|
+
--hk-scroll-fade-bottom: var(--hk-scroll-fade-size);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.hk-scroll-container[data-fade="true"][data-v-overflow="both"] {
|
|
107
|
+
--hk-scroll-fade-top: var(--hk-scroll-fade-size);
|
|
108
|
+
--hk-scroll-fade-bottom: var(--hk-scroll-fade-size);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* Horizontal axis (LTR: inline start = left). */
|
|
112
|
+
.hk-scroll-container[data-fade="true"][data-h-overflow="start"] {
|
|
113
|
+
--hk-scroll-fade-left: var(--hk-scroll-fade-size);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.hk-scroll-container[data-fade="true"][data-h-overflow="end"] {
|
|
117
|
+
--hk-scroll-fade-right: var(--hk-scroll-fade-size);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.hk-scroll-container[data-fade="true"][data-h-overflow="both"] {
|
|
121
|
+
--hk-scroll-fade-left: var(--hk-scroll-fade-size);
|
|
122
|
+
--hk-scroll-fade-right: var(--hk-scroll-fade-size);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* RTL: the inline start edge is the right side, so the horizontal vars
|
|
126
|
+
swap instead of the mask (the mask itself is direction-neutral). */
|
|
127
|
+
[dir="rtl"] .hk-scroll-container[data-fade="true"][data-h-overflow="start"] {
|
|
128
|
+
--hk-scroll-fade-left: 0px;
|
|
129
|
+
--hk-scroll-fade-right: var(--hk-scroll-fade-size);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
[dir="rtl"] .hk-scroll-container[data-fade="true"][data-h-overflow="end"] {
|
|
133
|
+
--hk-scroll-fade-right: 0px;
|
|
134
|
+
--hk-scroll-fade-left: var(--hk-scroll-fade-size);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
[dir="rtl"] .hk-scroll-container[data-fade="true"][data-h-overflow="both"] {
|
|
138
|
+
--hk-scroll-fade-left: var(--hk-scroll-fade-size);
|
|
139
|
+
--hk-scroll-fade-right: var(--hk-scroll-fade-size);
|
|
54
140
|
}
|
|
55
141
|
|
|
56
142
|
/* ── Anchored docks (dockTop / dockBottom slots) ─────────────────
|
|
@@ -74,14 +160,12 @@
|
|
|
74
160
|
instead of a hard clip against the dock's top edge. Content never
|
|
75
161
|
sits under the dock, so this fades the viewport's last few pixels,
|
|
76
162
|
not the dock itself. */
|
|
77
|
-
.hk-scroll-container[data-dock-fade="bottom"]
|
|
78
|
-
-
|
|
79
|
-
mask-image: linear-gradient(to bottom, #000 calc(100% - var(--hk-scroll-dock-fade, 2rem)), transparent);
|
|
163
|
+
.hk-scroll-container[data-dock-fade="bottom"] {
|
|
164
|
+
--hk-scroll-fade-bottom: var(--hk-scroll-dock-fade, 2rem);
|
|
80
165
|
}
|
|
81
166
|
|
|
82
|
-
.hk-scroll-container[data-dock-fade="top"]
|
|
83
|
-
-
|
|
84
|
-
mask-image: linear-gradient(to bottom, transparent, #000 var(--hk-scroll-dock-fade, 2rem));
|
|
167
|
+
.hk-scroll-container[data-dock-fade="top"] {
|
|
168
|
+
--hk-scroll-fade-top: var(--hk-scroll-dock-fade, 2rem);
|
|
85
169
|
}
|
|
86
170
|
|
|
87
171
|
/* ── Floating-dock tail clearance (dockTailClearance opt-in) ──────
|
|
@@ -135,39 +219,7 @@
|
|
|
135
219
|
}
|
|
136
220
|
|
|
137
221
|
|
|
138
|
-
.hk-scroll-container[data-fade="true"][data-h-overflow="start"] > .hk-scroll-container-viewport {
|
|
139
|
-
-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--hk-scroll-fade-size));
|
|
140
|
-
mask-image: linear-gradient(to right, transparent 0, #000 var(--hk-scroll-fade-size));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/* RTL: the horizontal scroll start/end edges swap sides, so the
|
|
144
|
-
* directional fades flip (the "both" mask is end-symmetric — no flip). */
|
|
145
|
-
[dir="rtl"] .hk-scroll-container[data-fade="true"][data-h-overflow="end"] > .hk-scroll-container-viewport {
|
|
146
|
-
-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--hk-scroll-fade-size));
|
|
147
|
-
mask-image: linear-gradient(to right, transparent 0, #000 var(--hk-scroll-fade-size));
|
|
148
|
-
}
|
|
149
222
|
|
|
150
|
-
[dir="rtl"] .hk-scroll-container[data-fade="true"][data-h-overflow="start"] > .hk-scroll-container-viewport {
|
|
151
|
-
-webkit-mask-image: linear-gradient(to left, transparent 0, #000 var(--hk-scroll-fade-size));
|
|
152
|
-
mask-image: linear-gradient(to left, transparent 0, #000 var(--hk-scroll-fade-size));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.hk-scroll-container[data-fade="true"][data-h-overflow="both"] > .hk-scroll-container-viewport {
|
|
156
|
-
-webkit-mask-image: linear-gradient(
|
|
157
|
-
to right,
|
|
158
|
-
transparent 0,
|
|
159
|
-
#000 var(--hk-scroll-fade-size),
|
|
160
|
-
#000 calc(100% - var(--hk-scroll-fade-size)),
|
|
161
|
-
transparent 100%
|
|
162
|
-
);
|
|
163
|
-
mask-image: linear-gradient(
|
|
164
|
-
to right,
|
|
165
|
-
transparent 0,
|
|
166
|
-
#000 var(--hk-scroll-fade-size),
|
|
167
|
-
#000 calc(100% - var(--hk-scroll-fade-size)),
|
|
168
|
-
transparent 100%
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
223
|
|
|
172
224
|
/* autoFollow content is bottom-anchored while it fits the viewport: the
|
|
173
225
|
newest row hugs the bottom edge (a tail-following console, e.g. the
|
|
@@ -134,17 +134,21 @@
|
|
|
134
134
|
to { transform: rotate(360deg); }
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
/* Inline action (e.g. Undo): a
|
|
138
|
-
*
|
|
139
|
-
*
|
|
137
|
+
/* Inline action (e.g. Undo / open analysis): a GLASS PILL on the toast's
|
|
138
|
+
* solid band. The old ghost outline sat flat on the accent fill — "a grey
|
|
139
|
+
* outlined transparent button", user report 2026-10 — because it borrowed
|
|
140
|
+
* the page-surface border tokens on a filled surface. A currentColor tint
|
|
141
|
+
* follows every variant (white on the coloured bands, near-black on the
|
|
142
|
+
* amber warning band) and reads as a real affordance without introducing
|
|
143
|
+
* a second accent colour. */
|
|
140
144
|
.hk-toast-action {
|
|
141
145
|
flex: none;
|
|
142
146
|
align-self: center;
|
|
143
147
|
margin-inline-start: var(--space-4, 4px);
|
|
144
|
-
padding: var(--space-
|
|
145
|
-
border: 1px solid
|
|
146
|
-
border-radius: var(--radius-
|
|
147
|
-
background: transparent;
|
|
148
|
+
padding: var(--space-4, 4px) var(--space-10, 10px);
|
|
149
|
+
border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
|
|
150
|
+
border-radius: var(--radius-full, 9999px);
|
|
151
|
+
background: color-mix(in srgb, currentColor 14%, transparent);
|
|
148
152
|
color: inherit;
|
|
149
153
|
font: inherit;
|
|
150
154
|
font-size: var(--text-sm, 0.8125rem);
|
|
@@ -152,14 +156,18 @@
|
|
|
152
156
|
line-height: 1.4;
|
|
153
157
|
cursor: pointer;
|
|
154
158
|
white-space: nowrap;
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
transition:
|
|
160
|
+
background var(--duration-fast, 0.15s) ease,
|
|
157
161
|
border-color var(--duration-fast, 0.15s) ease;
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
.hk-toast-action:hover {
|
|
161
|
-
|
|
162
|
-
border-color:
|
|
165
|
+
background: color-mix(in srgb, currentColor 24%, transparent);
|
|
166
|
+
border-color: color-mix(in srgb, currentColor 55%, transparent);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.hk-toast-action:active {
|
|
170
|
+
background: color-mix(in srgb, currentColor 32%, transparent);
|
|
163
171
|
}
|
|
164
172
|
|
|
165
173
|
.hk-toast-action:focus-visible {
|
package/src/index.ts
CHANGED
|
@@ -534,6 +534,7 @@ export { HkCaptchaModal as HCaptchaModal } from "./components/HkCaptchaModal";
|
|
|
534
534
|
export { HkProtocolModal as HProtocolModal } from "./components/HkProtocolModal";
|
|
535
535
|
export {
|
|
536
536
|
HkAboutModal as HAboutModal,
|
|
537
|
+
HkAboutBody as HAboutBody,
|
|
537
538
|
type HAboutComponentVersion,
|
|
538
539
|
type HAboutCredit,
|
|
539
540
|
type HAboutLink,
|
|
@@ -806,6 +807,7 @@ export { HkCaptchaWidget as HkCaptchaWidget } from "./components/HkCaptchaWidget
|
|
|
806
807
|
export { HkCaptchaModal as HkCaptchaModal } from "./components/HkCaptchaModal";
|
|
807
808
|
export { HkProtocolModal as HkProtocolModal } from "./components/HkProtocolModal";
|
|
808
809
|
export { HkAboutModal as HkAboutModal } from "./components/HkAboutModal";
|
|
810
|
+
export { HkAboutBody as HkAboutBody } from "./components/HkAboutModal";
|
|
809
811
|
export { HkLogWindow as HkLogWindow } from "./components/HkLogWindow";
|
|
810
812
|
export { HkSettingsBody as HkSettingsBody } from "./components/HkSettingsDialog";
|
|
811
813
|
export { HkSettingsDialog as HkSettingsDialog } from "./components/HkSettingsDialog";
|