@celestia-island/hikari 0.55.357 → 0.55.359
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/HkCardList.scss +8 -0
- package/src/components/HkCardList.tsx +35 -2
- 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/HkSelect.scss +6 -2
- package/src/components/HkThemePanelContent.tsx +106 -55
- package/src/components/HkThemeToggle.contract.test.ts +77 -39
- package/src/components/HkThemeToggle.scss +94 -113
- package/src/components/HkThemeToggle.test.ts +193 -33
- package/src/components/HkThemeToggle.tsx +23 -5
- package/src/components/HkTitleBar.tsx +12 -0
- 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/i18n/locales/ar/platform.json +1 -0
- package/src/i18n/locales/de/platform.json +1 -0
- package/src/i18n/locales/en/platform.json +1 -0
- package/src/i18n/locales/es/platform.json +1 -0
- package/src/i18n/locales/fr/platform.json +1 -0
- package/src/i18n/locales/ja/platform.json +1 -0
- package/src/i18n/locales/ko/platform.json +1 -0
- package/src/i18n/locales/pt/platform.json +1 -0
- package/src/i18n/locales/ru/platform.json +1 -0
- package/src/i18n/locales/zh-Hans/platform.json +1 -0
- package/src/i18n/locales/zh-Hant/platform.json +1 -0
- package/src/index.ts +17 -0
- package/src/runtime/hyperlink.test.ts +231 -0
- package/src/runtime/hyperlink.ts +294 -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/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.
|
|
@@ -67,6 +67,14 @@
|
|
|
67
67
|
gap: var(--space-8, 0.5rem);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/* The touch action lane parks in the same flex line and owns the auto
|
|
71
|
+
margin; a trailing column beside it yields its own (the class the TSX
|
|
72
|
+
binds), so the row's free space never splits between the two right
|
|
73
|
+
edges. */
|
|
74
|
+
.hk-list-row-trailing--parked {
|
|
75
|
+
margin-left: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
70
78
|
/* ── Option-control array (HkListRow's `actions`) ───────────────────────
|
|
71
79
|
* The row's last lane: named icon buttons in one of two layouts (see
|
|
72
80
|
* HkListRowActionsMode). "persistent" keeps the lane in the flow — it
|
|
@@ -138,7 +138,17 @@ export function hkListRowMenuItems(actions: readonly HkListRowAction[]): HkMenuI
|
|
|
138
138
|
*
|
|
139
139
|
* The row is a list item, not a button — set `clickable` when the whole
|
|
140
140
|
* row drills through, which adds the cursor/focus/hover contract the
|
|
141
|
-
* stat cards use.
|
|
141
|
+
* stat cards use. Clicks inside the trailing column and the action lane
|
|
142
|
+
* STOP at their wrapper (the HkStatCard action-wrapper rule): an
|
|
143
|
+
* affordance nested in a clickable row owns its click and never
|
|
144
|
+
* double-fires the row's — the synthesized click a keyboard Enter
|
|
145
|
+
* produces on a lane button bubbles exactly like a pointer click, so
|
|
146
|
+
* the guard lives on the containers, not on individual buttons. The
|
|
147
|
+
* touch trigger's named menu teleports (HkMenu popup panels are
|
|
148
|
+
* siblings of the row, not children), so menu selections don't bubble
|
|
149
|
+
* either. When the touch lane owns the right edge, the trailing column
|
|
150
|
+
* gives up its auto margin (`--parked` below) so the two never split
|
|
151
|
+
* the row's free space.
|
|
142
152
|
*/
|
|
143
153
|
export const HkListRow = defineComponent({
|
|
144
154
|
name: "HkListRow",
|
|
@@ -188,6 +198,15 @@ export const HkListRow = defineComponent({
|
|
|
188
198
|
onMounted(() => document.addEventListener("pointerdown", onDocumentPointerDown, true));
|
|
189
199
|
onBeforeUnmount(() => document.removeEventListener("pointerdown", onDocumentPointerDown, true));
|
|
190
200
|
const menuItems = computed<HkMenuItem[]>(() => hkListRowMenuItems(props.actions ?? []));
|
|
201
|
+
/** Clicks inside an interactive wrapper (trailing column, action
|
|
202
|
+
* lane) stop here: the row's clickable handler must never see
|
|
203
|
+
* them — a per-row delete button that also selected the row was
|
|
204
|
+
* the 2026-11-13 theme-panel field report. Covers pointer clicks
|
|
205
|
+
* AND the click a keyboard Enter synthesizes on the focused
|
|
206
|
+
* button (same bubbling path). */
|
|
207
|
+
function stopRowClick(e: MouseEvent) {
|
|
208
|
+
e.stopPropagation();
|
|
209
|
+
}
|
|
191
210
|
return () => (
|
|
192
211
|
<div
|
|
193
212
|
ref={rowEl}
|
|
@@ -217,7 +236,20 @@ export const HkListRow = defineComponent({
|
|
|
217
236
|
{props.subtitle ? <div class="hk-list-row-subtitle">{props.subtitle}</div> : null}
|
|
218
237
|
{slots.default?.()}
|
|
219
238
|
</div>
|
|
220
|
-
{slots.trailing ?
|
|
239
|
+
{slots.trailing ? (
|
|
240
|
+
<div
|
|
241
|
+
class={[
|
|
242
|
+
"hk-list-row-trailing",
|
|
243
|
+
// The touch lane parks in the same flex line and owns the
|
|
244
|
+
// auto margin; the trailing column yields (see class doc
|
|
245
|
+
// above) so the two never split the free space.
|
|
246
|
+
hasActions() && touchFirst.value && "hk-list-row-trailing--parked",
|
|
247
|
+
]}
|
|
248
|
+
onClick={stopRowClick}
|
|
249
|
+
>
|
|
250
|
+
{slots.trailing()}
|
|
251
|
+
</div>
|
|
252
|
+
) : null}
|
|
221
253
|
{hasActions() && (
|
|
222
254
|
<div
|
|
223
255
|
class={[
|
|
@@ -231,6 +263,7 @@ export const HkListRow = defineComponent({
|
|
|
231
263
|
data-revealed={revealed.value ? "" : undefined}
|
|
232
264
|
role={touchFirst.value ? undefined : "toolbar"}
|
|
233
265
|
aria-label={touchFirst.value ? undefined : props.actionsLabel}
|
|
266
|
+
onClick={stopRowClick}
|
|
234
267
|
>
|
|
235
268
|
{touchFirst.value ? (
|
|
236
269
|
<button
|
|
@@ -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
|
}
|
|
@@ -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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import HkIconButton from "./HkIconButton";
|
|
2
1
|
import HkAddTile from "./HkAddTile";
|
|
2
|
+
import { HkListRow, type HkListRowAction } from "./HkCardList";
|
|
3
3
|
|
|
4
4
|
import { computed, defineComponent, onUnmounted, ref, watch, type PropType } from "vue";
|
|
5
5
|
import { Monitor, MoonStar, Sun, Trash as Trash2 } from "lucide-vue-next";
|
|
@@ -45,8 +45,13 @@ export interface ThemeItemScope {
|
|
|
45
45
|
*
|
|
46
46
|
* Everything between the popover's padding lives here: the color-mode
|
|
47
47
|
* group (HTabs segmented with the solar-altitude merged cell), the
|
|
48
|
-
* `mode-extra` host strip, the preset/custom theme rows (
|
|
49
|
-
*
|
|
48
|
+
* `mode-extra` host strip, the preset/custom theme rows (the STANDARD
|
|
49
|
+
* list row — HkListRow, 2026-11-13 user direction — with four scoped
|
|
50
|
+
* host slots), the customize entry and the `menu-extra` slot. The rows
|
|
51
|
+
* read as list items (role="listitem" + aria-current), not buttons —
|
|
52
|
+
* selection is the row's wash plus its click/Enter contract; lane and
|
|
53
|
+
* trailing clicks stop at their wrappers (HkListRow's clickable-row
|
|
54
|
+
* rule), so per-row affordances never double-fire a selection. The
|
|
50
55
|
* built-in HColorSchemeDialog rides along when `externalCustomize` is
|
|
51
56
|
* false — dialogs teleport, so hosting this inside any surface is safe.
|
|
52
57
|
*
|
|
@@ -67,6 +72,26 @@ export const HkThemePanelContent = defineComponent({
|
|
|
67
72
|
* dialog is not rendered in this mode.
|
|
68
73
|
*/
|
|
69
74
|
externalCustomize: { type: Boolean, default: false },
|
|
75
|
+
/**
|
|
76
|
+
* Per-row option-control builder (2026-11-13 user direction: the
|
|
77
|
+
* theme rows ride the standard list row, and the host owns the
|
|
78
|
+
* affordances on its lane). Returns the row's `HkListRowAction[]`.
|
|
79
|
+
* The grammar follows HkCardList's `actions` prop: a PRESENT
|
|
80
|
+
* builder owns the row's lane — an EMPTY array means "no actions",
|
|
81
|
+
* while a per-row `undefined` declines and falls back to the
|
|
82
|
+
* built-in anatomy (custom rows get the standard delete, unless an
|
|
83
|
+
* `item-trailing` slot is rendered — its suppression contract
|
|
84
|
+
* stands). A
|
|
85
|
+
* CALLBACK PROP, not a slot, deliberately: slot returns are
|
|
86
|
+
* normalized into vnodes by Vue, and plain action objects would be
|
|
87
|
+
* silently destroyed in transit (the name/onSelect payload is
|
|
88
|
+
* data, not render output — the same grammar as HkCardList's own
|
|
89
|
+
* `actions` prop).
|
|
90
|
+
*/
|
|
91
|
+
itemActions: {
|
|
92
|
+
type: Function as PropType<(scope: ThemeItemScope) => HkListRowAction[] | undefined>,
|
|
93
|
+
default: undefined,
|
|
94
|
+
},
|
|
70
95
|
},
|
|
71
96
|
emits: {
|
|
72
97
|
"update:scheme": (_theme: HCustomTheme) => true,
|
|
@@ -227,19 +252,28 @@ export const HkThemePanelContent = defineComponent({
|
|
|
227
252
|
<HDivider spacing="md" />
|
|
228
253
|
|
|
229
254
|
<div class="s-theme-menu-label">{t("hikari::theme.themes")}</div>
|
|
255
|
+
{/* The rows are a real list (role="list") so HkListRow's
|
|
256
|
+
role="listitem" anatomy reads correctly to assistive tech. */}
|
|
257
|
+
<div class="s-theme-item-list" role="list">
|
|
230
258
|
{allThemeList.value.map((th) => {
|
|
231
|
-
// Host-customizable row anatomy
|
|
232
|
-
//
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
//
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
// renders
|
|
241
|
-
//
|
|
242
|
-
//
|
|
259
|
+
// Host-customizable row anatomy, on the STANDARD list row
|
|
260
|
+
// (2026-11-13 user direction: the theme list rides hikari's
|
|
261
|
+
// standard list component so its right-side control facility
|
|
262
|
+
// — the hover-revealed action lane on pointer devices, the
|
|
263
|
+
// ⋯ named menu on touch — comes for free). `item-leading`
|
|
264
|
+
// renders for EVERY row (fixed icon cell, so names stay
|
|
265
|
+
// aligned); `item-name-suffix` renders right after the name,
|
|
266
|
+
// so a host mark (e.g. a provenance/sync glyph) reads as
|
|
267
|
+
// part of the name instead of as an affordance;
|
|
268
|
+
// `item-trailing` renders quiet trailing CONTENT (badges) —
|
|
269
|
+
// it is what the action lane covers while engaged, so
|
|
270
|
+
// affordances do not belong there anymore; the `itemActions`
|
|
271
|
+
// prop supplies the row's option-control array
|
|
272
|
+
// (HkListRowAction[] — named, localized by the host's own
|
|
273
|
+
// translator; a callback PROP, see the prop's doc). Without
|
|
274
|
+
// them the rows behave exactly as before: the active row's
|
|
275
|
+
// wash marks selection, and custom rows carry the built-in
|
|
276
|
+
// delete on the standard lane.
|
|
243
277
|
const scope: ThemeItemScope = {
|
|
244
278
|
id: th.id,
|
|
245
279
|
name: th.name,
|
|
@@ -256,59 +290,76 @@ export const HkThemePanelContent = defineComponent({
|
|
|
256
290
|
// key, so literal display names pass through unchanged, and the
|
|
257
291
|
// reactive message lookup re-renders rows on locale switches.
|
|
258
292
|
const displayName = t(th.name);
|
|
293
|
+
const isActive = currentTheme.value === th.id;
|
|
294
|
+
// Default lane anatomy: the host's `itemActions` builder wins;
|
|
295
|
+
// a host that renders `item-trailing` owns the affordance
|
|
296
|
+
// column (the suppression contract the old overlay button
|
|
297
|
+
// honored) and gets no built-in lane; fully default rows put
|
|
298
|
+
// the custom delete on the standard lane.
|
|
299
|
+
const actions: HkListRowAction[] | undefined =
|
|
300
|
+
props.itemActions?.(scope) ??
|
|
301
|
+
(trailingSlot
|
|
302
|
+
? undefined
|
|
303
|
+
: th.isCustom
|
|
304
|
+
? [
|
|
305
|
+
{
|
|
306
|
+
name: t("hikari::theme.deleteTheme"),
|
|
307
|
+
icon: Trash2,
|
|
308
|
+
danger: true,
|
|
309
|
+
onSelect: () => removeCustomTheme(th.id),
|
|
310
|
+
},
|
|
311
|
+
]
|
|
312
|
+
: undefined);
|
|
259
313
|
return (
|
|
260
|
-
<
|
|
314
|
+
<HkListRow
|
|
261
315
|
key={th.id}
|
|
262
316
|
class="s-theme-item-row"
|
|
317
|
+
clickable
|
|
263
318
|
data-custom={th.isCustom || undefined}
|
|
319
|
+
// Deliberate DOM hook (no stylesheet consumer since the
|
|
320
|
+
// name-clearance cancellation retired): hosts and tests
|
|
321
|
+
// key off the trailing-slot mode without re-deriving it.
|
|
264
322
|
data-trailing={trailingSlot ? "slot" : undefined}
|
|
265
323
|
data-name-suffix={nameSuffixSlot ? "slot" : undefined}
|
|
266
324
|
// The ROW is the pill: the highlight state lives here so
|
|
267
325
|
// the hover/active wash spans the full row width — a
|
|
268
326
|
// trailing slot column must not shrink it (2026-10-01
|
|
269
327
|
// user report: theme rows and the 自定义 row hovered at
|
|
270
|
-
// different widths). The
|
|
271
|
-
//
|
|
272
|
-
|
|
328
|
+
// different widths). The stylesheet keeps the unified
|
|
329
|
+
// menu-item pill on this root and strips the card-list
|
|
330
|
+
// row's own chrome so the two specs don't double-paint.
|
|
331
|
+
data-active={isActive || undefined}
|
|
332
|
+
aria-current={isActive ? "true" : undefined}
|
|
333
|
+
actions={actions}
|
|
334
|
+
actionsLabel={t("hikari::theme.rowActionsLabel")}
|
|
335
|
+
onClick={() => onSelectTheme(th.id)}
|
|
273
336
|
>
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
{
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
) : th.isCustom ? (
|
|
298
|
-
<HkIconButton
|
|
299
|
-
class="s-theme-item-delete"
|
|
300
|
-
size={24}
|
|
301
|
-
variant="ghost"
|
|
302
|
-
aria-label={t("hikari::theme.deleteTheme")}
|
|
303
|
-
{...{ title: t("hikari::theme.deleteTheme") }}
|
|
304
|
-
onClick={() => removeCustomTheme(th.id)}
|
|
305
|
-
>
|
|
306
|
-
{{ icon: () => <Trash2 aria-hidden="true" /> }}
|
|
307
|
-
</HkIconButton>
|
|
308
|
-
) : null}
|
|
309
|
-
</div>
|
|
337
|
+
{{
|
|
338
|
+
default: () => (
|
|
339
|
+
<div class="s-theme-item-line">
|
|
340
|
+
{/* The selected-check fallback is RETIRED (2026-10-21
|
|
341
|
+
user direction): selection is conveyed by the row's
|
|
342
|
+
data-active wash alone. No leading slot = no
|
|
343
|
+
leading mark. */}
|
|
344
|
+
{leadingSlot ? (
|
|
345
|
+
<span class="hk-menu-item-icon s-theme-item-lead">
|
|
346
|
+
{leadingSlot(scope)}
|
|
347
|
+
</span>
|
|
348
|
+
) : null}
|
|
349
|
+
<span class="s-theme-item-name">{displayName}</span>
|
|
350
|
+
{nameSuffixSlot ? (
|
|
351
|
+
<span class="s-theme-item-name-suffix">{nameSuffixSlot(scope)}</span>
|
|
352
|
+
) : null}
|
|
353
|
+
</div>
|
|
354
|
+
),
|
|
355
|
+
trailing: trailingSlot
|
|
356
|
+
? () => <span class="s-theme-item-trailing">{trailingSlot(scope)}</span>
|
|
357
|
+
: undefined,
|
|
358
|
+
}}
|
|
359
|
+
</HkListRow>
|
|
310
360
|
);
|
|
311
361
|
})}
|
|
362
|
+
</div>
|
|
312
363
|
|
|
313
364
|
{/* The customize entry is the standard add tile (2026-11-11
|
|
314
365
|
family migration): the compact dashed form riding the END of
|