@celestia-island/hikari 0.55.357 → 0.55.358

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.357",
3
+ "version": "0.55.358",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari UI library, Vue 3 runtime — one design system for Vue 3 and Rust/WASM applications",
@@ -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 ? <div class="hk-list-row-trailing">{slots.trailing()}</div> : null}
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
@@ -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 (three scoped
49
- * host slots), the customize entry and the `menu-extra` slot. The
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. `item-leading` replaces the
232
- // selected-check cell and renders for EVERY row (fixed icon
233
- // cell, so names stay aligned); `item-name-suffix` renders
234
- // INSIDE the row button right after the name, so a host mark
235
- // (e.g. a provenance/sync glyph) reads as part of the name
236
- // instead of as an affordance; `item-trailing` reserves a
237
- // real trailing column for every row and takes full
238
- // ownership of the affordances there — the built-in custom
239
- // delete overlay is suppressed in that mode, so the host
240
- // renders delete (and anything else) itself. Without the
241
- // slots the rows behave exactly as before: check only on the
242
- // active row, delete overlaid on custom rows only.
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
- <div
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 button keeps the click/focus
271
- // semantics; the stylesheet strips its own chrome.
272
- data-active={currentTheme.value === th.id || undefined}
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
- <button
275
- type="button"
276
- class="s-theme-item-btn"
277
- data-active={currentTheme.value === th.id || undefined}
278
- onClick={() => onSelectTheme(th.id)}
279
- >
280
- {/* The selected-check fallback is RETIRED (2026-10-21
281
- user direction): selection is conveyed by the row's
282
- data-active wash alone — with the leading icon cell
283
- gone across hosts, the leftover check read as a
284
- stray icon. No leading slot = no leading mark. */}
285
- {leadingSlot ? (
286
- <span class="hk-menu-item-icon s-theme-item-lead">
287
- {leadingSlot(scope)}
288
- </span>
289
- ) : null}
290
- <span class="s-theme-item-name">{displayName}</span>
291
- {nameSuffixSlot ? (
292
- <span class="s-theme-item-name-suffix">{nameSuffixSlot(scope)}</span>
293
- ) : null}
294
- </button>
295
- {trailingSlot ? (
296
- <span class="s-theme-item-trailing">{trailingSlot(scope)}</span>
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
@@ -17,7 +17,8 @@
17
17
  * (chest's DPI entry) align their labels with the theme rows' names
18
18
  * without rescaling their icons. (The customize row left this contract
19
19
  * 2026-11-11: the entry is the standard HkAddTile compact form now — a
20
- * self-contained dashed tile, not a lead-column row.)
20
+ * self-contained dashed tile, not a lead-column row. The lead cell rides
21
+ * the standard row's name line since 2026-11-13.)
21
22
  */
22
23
  import { describe, expect, it } from "vitest";
23
24
  import { readFileSync } from "node:fs";
@@ -31,52 +32,65 @@ describe("HkThemeToggle theme-row pill contract", () => {
31
32
  // 2026-10-01 user report: with the item-trailing slot reserving a real
32
33
  // column, the row button's hover wash stopped short of the row edge —
33
34
  // theme rows and the standalone 自定义 row hovered at different widths.
34
- // The pill therefore lives on `.s-theme-item-row` (full row width no
35
- // matter how wide the trailing column is) and the row's button is
36
- // chromeless. happy-dom has no layout engine, so the geometry is pinned
37
- // as scss-text assertions.
38
- it("puts the unified menu-item pill on the row, not the row button", () => {
35
+ // The pill lives on `.s-theme-item-row` (full row width no matter how
36
+ // wide the trailing column is). Since 2026-11-13 the row root IS the
37
+ // standard list row (HkListRow), so the same element carries both
38
+ // families' classes and the card-list metrics must be compound-beaten.
39
+ // happy-dom has no layout engine, so the geometry is pinned as
40
+ // scss-text assertions.
41
+ it("puts the unified menu-item pill on the row root", () => {
39
42
  const css = read("HkThemeToggle.scss");
40
43
  const rowBlock = css.match(/\.s-theme-item-row\s*\{[^}]*\}/);
41
44
  expect(rowBlock).not.toBeNull();
42
45
  expect(rowBlock![0]).toContain("@include mi.item;");
43
- // The overlaid delete affordance pins to the row (positioning context).
46
+ // The standard lane's overlay pins to the row (positioning context).
44
47
  expect(rowBlock![0]).toContain("position: relative");
45
48
  });
46
49
 
47
- it("strips the row button's own chrome so the wash is not doubled", () => {
50
+ it("compound-beats the card-list row metrics WITHOUT re-including the mixin", () => {
48
51
  const css = read("HkThemeToggle.scss");
49
- const block = css.match(/\.s-theme-item-row \.s-theme-item-btn\s*\{[^}]*\}/);
52
+ const block = css.match(/\.hk-list-row\.s-theme-item-row\s*\{[^}]*\}/);
50
53
  expect(block).not.toBeNull();
51
- // The ROW owns the frame: its border 1 + padding 12 put the content at
52
- // the same 13px the standalone pills measure (border 1 + padding 12), so
53
- // the button drops its own border entirely.
54
- expect(block![0]).toContain("border: none;");
55
- expect(block![0]).toContain("background: transparent");
56
- expect(block![0]).toContain("min-height: 0");
57
- // The button stretches over the row's frame (negative block margins
58
- // mirrored by re-applied padding) so the WHOLE pill is the click/focus
59
- // target — master's pill WAS the button — while the name's content box
60
- // keeps the standalone offsets. Losing the stretch drops the button
61
- // back to a centered auto-height box inside the row (misaligned and
62
- // undersized); losing the bleed pair desyncs the content offset by the
63
- // frame width.
64
- expect(block![0]).toContain("align-self: stretch");
65
- expect(block![0]).toContain("margin-block: calc(");
66
- expect(block![0]).toContain("padding-block: calc(");
54
+ // The card-list base (0,1,0 in HkCardList.scss) would tie-break
55
+ // against the pill chrome; the compound selector (0,2,0) pins the
56
+ // menu-item metrics deterministically — through var() references so
57
+ // the sheet-context token re-binding keeps flowing in.
58
+ expect(block![0]).toContain("padding: var(--hk-menu-item-pad-y) var(--hk-menu-item-pad-x)");
59
+ expect(block![0]).toContain("min-height: var(--hk-menu-item-min-h)");
60
+ expect(block![0]).toContain("gap: var(--hk-menu-item-gap)");
61
+ expect(block![0]).toContain("border-radius: var(--hk-menu-item-radius)");
62
+ // The re-include trap (see _menu-item.scss's adoption note): a nested
63
+ // mi.item at (0,2,0) would tie with the modal sheet-token re-binding
64
+ // (0,2,0) and defeat the 44px touch geometry there (HkBreadcrumb).
65
+ // This rule must reference the tokens, never re-declare them.
66
+ expect(block![0]).not.toContain("mi.item");
67
+ // The full state transition is restored (the clickable class's
68
+ // narrower transition would otherwise win at (0,2,0)).
69
+ expect(block![0]).toContain("border-color 0.12s ease");
67
70
  });
68
71
 
69
- it("suppresses the row button's own hover and active state chrome", () => {
72
+ it("keeps the row focus ring deterministic against the clickable class", () => {
70
73
  const css = read("HkThemeToggle.scss");
71
- // The hover override must repeat mi.item's guard chain to out-specify
72
- // the mixin's hover rule; the active/checked suppression targets the
73
- // state attributes directly.
74
- expect(css).toContain(
75
- ".s-theme-item-row .s-theme-item-btn:hover:not(:disabled):not([data-disabled]):not([data-active]):not([data-checked])",
76
- );
77
- expect(css).toMatch(
78
- /\.s-theme-item-row \.s-theme-item-btn\[data-active\][^{]*\{[^}]*background: transparent/,
79
- );
74
+ // mi.item's :focus-visible ties with HkListRow-clickable's at (0,2,0);
75
+ // the compound rule (0,3,0) makes the ring order-independent.
76
+ const block = css.match(/\.hk-list-row\.s-theme-item-row:focus-visible\s*\{[^}]*\}/);
77
+ expect(block).not.toBeNull();
78
+ expect(block![0]).toContain("outline: 2px solid rgb(var(--color-primary) / 70%)");
79
+ });
80
+
81
+ it("keeps the item-list wrapper on the family row rhythm", () => {
82
+ // The rows used to be direct flex children of .s-theme-menu and
83
+ // lived on its 4px gap; the list wrapper (role="list" band) must
84
+ // carry the SAME gap or adjacent pills touch edge-to-edge (2026-11-13
85
+ // R2). happy-dom has no layout engine — pin the declarations.
86
+ const css = read("HkThemeToggle.scss");
87
+ const block = css.match(/\.s-theme-item-list\s*\{[^}]*\}/);
88
+ expect(block).not.toBeNull();
89
+ expect(block![0]).toContain("display: flex");
90
+ expect(block![0]).toContain("flex-direction: column");
91
+ expect(block![0]).toContain("gap: var(--space-4, 0.25rem)");
92
+ // Band width invariant: the wrapper pads nothing horizontally.
93
+ expect(block![0]).not.toMatch(/padding/);
80
94
  });
81
95
 
82
96
  it("registers the theme row family for the mobile sheet token swap", () => {
@@ -92,13 +106,37 @@ describe("HkThemeToggle theme-row pill contract", () => {
92
106
  expect(modalList).not.toBeNull();
93
107
  expect(modalList![0]).toContain(".s-theme-item-row");
94
108
  });
109
+
110
+ it("sizes the sheet action trigger up to the family's touch contract", () => {
111
+ // The standard lane's touch trigger (⋯) is the ONLY actions tap
112
+ // target on touch-first clients; the generic 26px box would be the
113
+ // one undersized target among 44px sheet rows (the retired delete
114
+ // button made the same accommodation). The rule MUST sit in the
115
+ // component's own touch predicate block — the 2026-11-13 R2b round
116
+ // caught the width-based regex bridging across blocks and pinning
117
+ // nothing (reverting the predicate kept every test green), so the
118
+ // fence below pins the media block CONTAINMENT the same way the
119
+ // customize tile's does: no `[\s\S]*?` crossing a closing brace.
120
+ const css = read("HkThemeToggle.scss");
121
+ const block = css.match(
122
+ /@media \(hover: none\), \(pointer: coarse\) \{[^@]*?\.s-theme-item-row \.hk-list-row-actions__trigger\s*\{[^}]*width: 2\.25rem[^}]*\}/,
123
+ );
124
+ expect(block).not.toBeNull();
125
+ expect(block![0]).toContain("height: 2.25rem");
126
+ // And the retired width-based seat must not come back: no trigger
127
+ // rule under the viewport block.
128
+ const widthBlock = css.match(
129
+ /@media \(max-width: 767px\) \{[^@]*\.s-theme-item-row \.hk-list-row-actions__trigger/,
130
+ );
131
+ expect(widthBlock).toBeNull();
132
+ });
95
133
  });
96
134
 
97
135
  describe("HkThemeToggle row lead-cell contract", () => {
98
136
  it("sizes the theme-row lead cell to fit a 28px swatch mark", () => {
99
137
  const css = read("HkThemeToggle.scss");
100
138
  const block = css.match(
101
- /\.s-theme-item-btn \.hk-menu-item-icon\.s-theme-item-lead\s*\{[^}]*\}/,
139
+ /\.s-theme-item-line \.hk-menu-item-icon\.s-theme-item-lead\s*\{[^}]*\}/,
102
140
  );
103
141
  expect(block).not.toBeNull();
104
142
  expect(block![0]).toContain("width: 28px");
@@ -107,10 +145,10 @@ describe("HkThemeToggle row lead-cell contract", () => {
107
145
 
108
146
  it("does not widen icon cells with a bare unscoped theme-row rule", () => {
109
147
  const css = read("HkThemeToggle.scss");
110
- // A bare `.s-theme-item-btn .hk-menu-item-icon {` rule also hits
111
- // host mode-extra rows; the widened cell may only target named
148
+ // A bare `.s-theme-item-line .hk-menu-item-icon {` would normalize
149
+ // every cell in the line; the widened cell may only target named
112
150
  // scopes (lead slot, mode-extra strip).
113
- expect(css).not.toMatch(/^\.s-theme-item-btn \.hk-menu-item-icon\s*\{/m);
151
+ expect(css).not.toMatch(/^\.s-theme-item-line \.hk-menu-item-icon\s*\{/m);
114
152
  });
115
153
 
116
154
  it("renders the customize entry as the standard HkAddTile compact form", () => {
@@ -144,79 +144,83 @@
144
144
  * Every row is ONE full-width pill, and the pill is THE ROW (2026-10-01
145
145
  * user report: with the trailing slot reserving a real column, the row
146
146
  * button's wash stopped short of the row edge — theme rows and the
147
- * standalone 自定义 row hovered at different widths). The unified
148
- * menu-item chrome therefore lives on `.s-theme-item-row` (which also
149
- * carries `data-active` from the TSX), and the row's button surrenders
150
- * its own chrome below, so the hover/active wash, border and radius
151
- * span the full row no matter how wide the trailing column is. The
152
- * standalone pills (自定义 row, host mode-extra rows) keep the chrome on
153
- * the button itself — same spec, same width as a row.
147
+ * standalone 自定义 row hovered at different widths). Since 2026-11-13
148
+ * the row root is the STANDARD list row (HkListRow): the unified
149
+ * menu-item chrome stays on `.s-theme-item-row` (which also carries
150
+ * `data-active` through attr fallthrough), and the card-list row's own
151
+ * card metrics are compound-beaten below so the two specs on one element
152
+ * don't fight over padding/gap. The row's click/focus semantics come
153
+ * from HkListRow's `clickable` contract (Enter/Space parity included).
154
+ * The standalone pills (自定义 row, host mode-extra rows) keep the
155
+ * chrome on their own `.s-theme-item-btn` — same spec, same width.
154
156
  *
155
157
  * Metrics/states come from the unified menu-item spec (./_menu-item.scss)
156
158
  * — the same grammar as menu rows and select options; inside the mobile
157
159
  * sheet the shared `.hk-popover-panel.hk-is-sheet` token context applies
158
- * the 44px touch geometry (the row family is registered there), so the
159
- * old component-local media bump is gone (only the overlaid delete
160
- * button keeps its own touch sizing below).
160
+ * the 44px touch geometry (the row family is registered there).
161
161
  */
162
162
 
163
+ /* The list wrapper is a BAND (geometry-neutral horizontally), but the
164
+ * inter-row rhythm is its own: the rows used to be direct flex children
165
+ * of .s-theme-menu and lived on its 4px gap — the wrapper must carry
166
+ * the same gap or adjacent pills touch edge-to-edge (2026-11-13 R2). */
167
+ .s-theme-item-list {
168
+ display: flex;
169
+ flex-direction: column;
170
+ gap: var(--space-4, 0.25rem);
171
+ min-width: 0;
172
+ }
173
+
163
174
  .s-theme-item-row {
164
175
  @include mi.item;
165
176
 
166
177
  position: relative;
167
178
  }
168
179
 
169
- /* The row's button keeps the CLICK and FOCUS semantics (keyboard parity,
170
- * screen-reader role) but no visual chrome of its own: background goes
171
- * transparent and the border is dropped entirely — the ROW now owns the
172
- * frame, and the content x lands on the same offset as the standalone
173
- * pills anyway (row border 1 + row padding 12 = the standalone border 1 +
174
- * padding 12 = 13px from the pill edge). Vertically the button bleeds
175
- * over the row's frame (negative margins) and re-applies the padding
176
- * inside, so the WHOLE pill is the click/focus target — master's pill
177
- * WAS the button — while the name's content box keeps the standalone
178
- * offsets (border 1 + pad-y). Row heights are unchanged: the button's
179
- * net layout contribution is its content, so the row's own min-height
180
- * rules exactly as the button's did before. */
181
- .s-theme-item-row .s-theme-item-btn {
182
- min-width: 0;
183
- min-height: 0;
184
- flex: 1;
185
- width: auto;
186
- /* Fill the row's full cross size (overriding the row's align-items:
187
- * center FOR THIS ITEM only) so the click/focus target is the whole
188
- * pill, not just the name's line box. */
189
- align-self: stretch;
190
- /* Bleed over the row's frame — its vertical padding plus the 1px
191
- * mi.item border — then re-apply that padding inside: the name's
192
- * content box keeps the standalone pills' offsets (border 1 + pad)
193
- * while the hit area covers the pill edge to edge. The 1px constant
194
- * mirrors mi.item's border width; if the mixin's border ever changes,
195
- * this pair moves with it. */
196
- margin-block: calc(-1 * var(--hk-menu-item-pad-y, 6px) - 1px);
197
- padding-block: calc(var(--hk-menu-item-pad-y, 6px) + 1px);
198
- padding-inline: 0;
199
- border: none;
200
- /* Follow the row's pill radius: the button keeps mi.item's :focus-visible
201
- * inset outline (keyboard parity), and outlines follow border-radius —
202
- * a zero radius here would render the ring as a sharp rectangle poking
203
- * past the row's rounded corners. */
204
- border-radius: inherit;
205
- background: transparent;
206
- font: inherit;
207
- color: inherit;
180
+ /* The element now carries BOTH families' classes; the card-list base
181
+ * (0,1,0 in HkCardList.scss, resolved before this sheet) would otherwise
182
+ * tie-break against the pill chrome above. This compound rule (0,2,0)
183
+ * pins the menu-item metrics deterministically — and deliberately does
184
+ * NOT re-include mi.item: re-declaring the token set at (0,2,0) would
185
+ * tie with the modal sheet-context re-binding (0,2,0 in _menu-item.scss)
186
+ * and defeat the 44px touch geometry there (the HkBreadcrumb trap the
187
+ * mixin's adoption note warns about). var() references resolve through
188
+ * the cascade, so the tokens keep flowing from wherever they legally
189
+ * bind. */
190
+ .hk-list-row.s-theme-item-row {
191
+ gap: var(--hk-menu-item-gap);
192
+ min-height: var(--hk-menu-item-min-h);
193
+ padding: var(--hk-menu-item-pad-y) var(--hk-menu-item-pad-x);
194
+ border-radius: var(--hk-menu-item-radius);
195
+ text-align: start;
196
+ /* Restore the full state transition the pill spec declares (the
197
+ * clickable class's narrower transition would win at (0,2,0)). */
198
+ transition:
199
+ background-color 0.12s ease,
200
+ border-color 0.12s ease,
201
+ color 0.12s ease;
208
202
  }
209
203
 
210
- /* Suppress the button's own state chrome — the row above owns the wash.
211
- * The hover guard repeats mi.item's guard chain so this override
212
- * out-specifies the mixin's (0,6,0) hover rule. */
213
- .s-theme-item-row .s-theme-item-btn:hover:not(:disabled):not([data-disabled]):not([data-active]):not([data-checked]),
214
- .s-theme-item-row .s-theme-item-btn[data-active],
215
- .s-theme-item-row .s-theme-item-btn[data-checked] {
216
- background: transparent;
217
- border-color: transparent;
218
- color: inherit;
219
- font-weight: inherit;
204
+ /* The clickable row's own focus ring ties with the pill spec's at
205
+ * (0,2,0); compound-beat it so the ring never depends on sheet order. */
206
+ .hk-list-row.s-theme-item-row:focus-visible {
207
+ outline: 2px solid rgb(var(--color-primary) / 70%);
208
+ outline-offset: -2px;
209
+ }
210
+
211
+ /* The pill spec's guarded hover (0,6,0 with its :not chain) already
212
+ * outranks the clickable class's flat hover (0,2,0), so the wash never
213
+ * double-paints — nothing to suppress. */
214
+
215
+ /* The name line: one flex run inside HkListRow's main column, so the
216
+ * name, the optional lead cell and the name-suffix mark stay on ONE
217
+ * baseline (the main column is vertical; without this wrapper the
218
+ * mi.label flex would stretch the wrong axis). */
219
+ .s-theme-item-line {
220
+ display: flex;
221
+ align-items: center;
222
+ min-width: 0;
223
+ flex: 1 1 auto;
220
224
  }
221
225
 
222
226
  .s-theme-item-btn {
@@ -276,12 +280,12 @@
276
280
  * leaves the bleed zero room at any zoom.
277
281
  *
278
282
  * The widened cell is scoped to the LEAD slot only (2026-09-12 field
279
- * report): the bare `.s-theme-item-btn .hk-menu-item-icon` this shipped
280
- * as also matched the 自定义 row and every host row reusing
281
- * s-theme-item-btn (chest's mode-extra DPI entry), where mi.icon
282
- * normalizes the svg to the cell — their 14px glyphs rendered 28px
283
- * wide. Rows without a leading slot keep the standard menu metrics. */
284
- .s-theme-item-btn .hk-menu-item-icon.s-theme-item-lead {
283
+ * report): a bare `.s-theme-item-line .hk-menu-item-icon` would also
284
+ * normalize unrelated cells. Rows without a leading slot keep the
285
+ * standard menu metrics. Since 2026-11-13 the lead cell rides the
286
+ * standard row's name line (no inner button anymore) — the selector
287
+ * follows the line wrapper. */
288
+ .s-theme-item-line .hk-menu-item-icon.s-theme-item-lead {
285
289
  @include mi.icon;
286
290
 
287
291
  width: 28px;
@@ -318,54 +322,33 @@
318
322
  height: var(--hk-menu-item-icon-box);
319
323
  }
320
324
 
321
- /* Custom rows keep the name clear of the overlaid delete button. */
322
- .s-theme-item-row[data-custom] .s-theme-item-name {
323
- margin-inline-end: 2rem;
324
- }
325
+ /* Custom rows used to reserve name clearance for the pinned delete
326
+ * overlay; the standard action lane (2026-11-13) parks OUT of the flow
327
+ * and only covers the row's right content while engaged, so no row
328
+ * pays for actions it is not using — no clearance anymore. */
325
329
 
326
330
  /* The selected-check cell retired with its render branch (2026-10-21
327
331
  * user direction): the active row's data-active wash is the sole
328
332
  * selection indicator. */
329
333
 
330
- /* Hover/active states come verbatim from the unified mi.item spec included
331
- * on .s-theme-item-btn above — former local copies deleted (R3 sweep). */
332
-
333
- /* Delete affordance for custom themes — an overlay pinned inside the
334
- * pill's trailing edge (the row is relative), not a reserved column:
335
- * built-in rows show nothing there and the pill runs to the row edge. */
336
- .s-theme-item-delete {
337
- /* Wave B2/B3: the custom-theme delete is the STANDARD icon button at S24
338
- (= the old 1.5rem desktop box). The seat keeps the row's parked-edge
339
- positioning (absolute, trailing, vertically centred) — real geometry.
340
- The error-tinted hover rides the channel vars, ink hover-scoped (token
341
- lesson); the inset error focus ring yields to the standard ring. */
342
- position: absolute;
343
- inset-inline-end: var(--space-8, 0.5rem);
344
- top: 50%;
345
- transform: translateY(-50%);
346
- --hi-icon-button-bg-hover: rgb(var(--color-error) / 15%);
347
-
348
- &:hover {
349
- --hi-icon-button-icon-color: rgb(var(--color-error));
334
+ /* Row actions (the built-in custom delete, or the host's `itemActions`
335
+ * array) come verbatim from the standard lane in HkCardList.scss:
336
+ * hover/focus-within reveal on pointer devices, the ⋯ named menu
337
+ * trigger on touch. The touch trigger's hit target gets the retired
338
+ * delete button's 36px (2.25rem) touch seat — keyed to the SAME
339
+ * predicate the component uses to render the trigger (HkListRow's
340
+ * touchFirst media query), so a touch-first tablet gets the oversized
341
+ * target too (the button keyed on viewport width and missed exactly
342
+ * that case; 44px is the sheet ROW contract, not this trigger's).
343
+ * Desktop keeps the standard lane metrics. */
344
+ @media (hover: none), (pointer: coarse) {
345
+ .s-theme-item-row .hk-list-row-actions__trigger {
346
+ width: 2.25rem;
347
+ height: 2.25rem;
350
348
  }
351
349
  }
352
350
 
353
- /* Touch-sized delete target on phone widths, scaled for the 44px sheet
354
- * rows that the shared spec applies inside sheet contexts (see
355
- * ./_menu-item.scss). The name clearance follows so the button and the
356
- * label never collide on long custom scheme names. */
357
351
  @media (max-width: 767px) {
358
- .s-theme-item-delete {
359
- /* Set the COMPONENT's size var (not width/height — the S24 rung's
360
- min/max clamps would defeat them): the phone delete target keeps its
361
- 36px sheet-row contract. */
362
- --hi-icon-button-size: 2.25rem;
363
- }
364
-
365
- .s-theme-item-row[data-custom] .s-theme-item-name {
366
- margin-inline-end: 2.75rem;
367
- }
368
-
369
352
  /* The customize tile rides the menu family's sheet touch geometry:
370
353
  * its compact padding alone reads ~32px, under the 44px sheet-row
371
354
  * contract every sibling row gets from the item-sheet tokens
@@ -388,11 +371,13 @@
388
371
  color: inherit;
389
372
  }
390
373
 
391
- /* When the host renders the item-trailing slot, every row reserves a
392
- * REAL trailing column (the slot owns it — the built-in custom-delete
393
- * overlay is suppressed), so trailing affordances align across rows
394
- * instead of floating over the pill's edge. The custom-name clearance
395
- * for the overlay delete no longer applies in this mode. */
374
+ /* When the host renders the item-trailing slot, its content renders as
375
+ * the row's quiet trailing column (2026-11-13 grammar: trailing carries
376
+ * CONTENT — badges, marks — while affordances live on the standard
377
+ * action lane the host fills via the `itemActions` prop; the lane's
378
+ * overlay parks out of the flow and covers this column only while
379
+ * engaged, and clicks inside the column stop at the column — they are
380
+ * the content's own, never the row's selection). */
396
381
  .s-theme-item-trailing {
397
382
  display: inline-flex;
398
383
  align-items: center;
@@ -400,7 +385,3 @@
400
385
  flex-shrink: 0;
401
386
  margin-inline-start: var(--space-4, 0.25rem);
402
387
  }
403
-
404
- .s-theme-item-row[data-trailing="slot"] .s-theme-item-name {
405
- margin-inline-end: 0;
406
- }
@@ -258,7 +258,7 @@ describe("HkThemeToggle color-mode group", () => {
258
258
  expect(modeSegments()).toHaveLength(3);
259
259
  });
260
260
 
261
- it("keeps every theme row one full-width pill with deletes overlaid", async () => {
261
+ it("keeps every theme row one standard list row with the delete on the action lane", async () => {
262
262
  useTheme().addCustomTheme(anyPresetTokens());
263
263
  const { container } = mountToggle(true);
264
264
  await settle();
@@ -271,20 +271,23 @@ describe("HkThemeToggle color-mode group", () => {
271
271
 
272
272
  let customRows = 0;
273
273
  for (const row of rows) {
274
- // The pill is the first (and for built-ins the ONLY) in-flow child:
275
- // no trailing slot element survives (it reserved a dead column
276
- // right of every built-in row in the mobile sheet). Custom rows
277
- // flag themselves and carry the delete button overlay as the one
278
- // extra child.
279
- expect(row.children[0].classList.contains("s-theme-item-btn")).toBe(true);
280
- expect(row.querySelector(".s-theme-item-slot")).toBeNull();
281
- const extra = [...row.children].slice(1);
274
+ // Every row is the STANDARD list row (2026-11-13 user direction):
275
+ // the menu-item pill stays on the shared root, the name rides the
276
+ // row's main column, and affordances live on HkListRow's action
277
+ // lane — custom rows flag themselves and carry the delete there;
278
+ // built-ins carry no lane at all.
279
+ expect(row.classList.contains("hk-list-row")).toBe(true);
280
+ expect(row.querySelector(".s-theme-item-line .s-theme-item-name")).toBeTruthy();
281
+ const lane = row.querySelector<HTMLElement>(".hk-list-row-actions");
282
282
  if (row.hasAttribute("data-custom")) {
283
283
  customRows += 1;
284
- expect(extra).toHaveLength(1);
285
- expect(extra[0].classList.contains("s-theme-item-delete")).toBe(true);
284
+ expect(lane).toBeTruthy();
285
+ const del = lane!.querySelector<HTMLElement>(".hk-list-row-actions__btn");
286
+ expect(del).toBeTruthy();
287
+ expect(del!.hasAttribute("data-danger")).toBe(true);
288
+ expect(del!.getAttribute("aria-label")).toBe("Delete theme");
286
289
  } else {
287
- expect(extra).toHaveLength(0);
290
+ expect(lane).toBeNull();
288
291
  }
289
292
  }
290
293
  expect(customRows).toBe(1);
@@ -292,16 +295,64 @@ describe("HkThemeToggle color-mode group", () => {
292
295
  // The active row's selection indicator is the data-active wash alone:
293
296
  // the check glyph retired with the leading-icon cell (2026-10-21 user
294
297
  // direction). No leading mark renders without an item-leading slot.
295
- const activeBtn = document.body.querySelector<HTMLButtonElement>(".s-theme-item-btn[data-active]");
296
- expect(activeBtn).toBeTruthy();
297
- expect(activeBtn?.querySelector(".s-theme-item-check")).toBeNull();
298
-
299
- // The ROW is the pill (2026-10-01): the active state surfaces on the
300
- // row element too, so the highlight spans the full row width instead
301
- // of stopping short at a trailing column.
302
- const activeRows = rows.filter((r) => r.hasAttribute("data-active"));
303
- expect(activeRows).toHaveLength(1);
304
- expect(activeRows[0].querySelector(".s-theme-item-btn[data-active]")).toBeTruthy();
298
+ const activeRow = document.body.querySelector<HTMLElement>(".s-theme-item-row[data-active]");
299
+ expect(activeRow).toBeTruthy();
300
+ expect(activeRow!.querySelector(".s-theme-item-check")).toBeNull();
301
+ // The row is a real selectable list item (clickable contract):
302
+ // keyboard parity comes from HkListRow.
303
+ expect(activeRow!.getAttribute("aria-current")).toBe("true");
304
+ expect(activeRow!.classList.contains("hk-list-row-clickable")).toBe(true);
305
+
306
+ // Clicking a NON-active row selects it and closes the menu (the row's
307
+ // click contract carries the selection; request-close dismisses the
308
+ // popover — the old anatomy's inner button did both).
309
+ const before = useTheme().currentTheme.value;
310
+ // The custom scheme is the fixture's only non-active row.
311
+ const target = rows.find((r) => !r.hasAttribute("data-active"))!;
312
+ expect(target.hasAttribute("data-custom")).toBe(true);
313
+ target.click();
314
+ await settle();
315
+ expect(useTheme().currentTheme.value).not.toBe(before);
316
+ expect(useTheme().currentTheme.value).toBe("test-custom");
317
+ // request-close dismissed the popover.
318
+ expect(document.body.querySelector(".s-theme-menu")).toBeNull();
319
+ });
320
+
321
+ it("lane action clicks never double-fire the row's selection", async () => {
322
+ // 2026-11-13 R2: the row is clickable and the lane is INSIDE it —
323
+ // without the wrapper-level stopPropagation (HkCardList's
324
+ // HkStatCard-action rule) a lane click also selected the row (the
325
+ // delete button on a custom row SWITCHED to the theme it was
326
+ // deleting and closed the menu). The guard must hold for the whole
327
+ // composed behavior: action runs, selection unchanged, menu open.
328
+ useTheme().addCustomTheme(anyPresetTokens());
329
+ const container = document.createElement("div");
330
+ document.body.appendChild(container);
331
+ const deleted: string[] = [];
332
+ const app = createApp({
333
+ render: () =>
334
+ h(HkThemeToggle, {
335
+ externalCustomize: true,
336
+ itemActions: (scope: { id: string }) => [
337
+ { name: `Act ${scope.id}`, onSelect: () => { deleted.push(scope.id); } },
338
+ ],
339
+ }),
340
+ });
341
+ app.mount(container);
342
+ mounts.push({ app, container });
343
+ await settle();
344
+ openMenu(container);
345
+ await settle();
346
+
347
+ const customRow = [...document.body.querySelectorAll<HTMLElement>(".s-theme-menu .s-theme-item-row")]
348
+ .find((r) => r.hasAttribute("data-custom"))!;
349
+ expect(customRow).toBeTruthy();
350
+ customRow.querySelector<HTMLButtonElement>(".hk-list-row-actions__btn")!.click();
351
+ await settle();
352
+
353
+ expect(deleted).toHaveLength(1);
354
+ expect(useTheme().currentTheme.value).toBe("default");
355
+ expect(document.body.querySelector(".s-theme-menu")).toBeTruthy();
305
356
  });
306
357
  it("renders the mode-extra strip under the mode group when provided", async () => {
307
358
  const container = document.createElement("div");
@@ -393,7 +444,7 @@ describe("HkThemeToggle item slots", () => {
393
444
  expect(seen.length).toBeGreaterThanOrEqual(rows.length);
394
445
  });
395
446
 
396
- it("reserves the trailing column and suppresses the built-in delete overlay", async () => {
447
+ it("renders the trailing slot as quiet content and suppresses the built-in delete lane", async () => {
397
448
  // The stock table holds one preset; two customs give the three rows
398
449
  // (built-in + 2 custom) this column sweep needs.
399
450
  useTheme().addCustomTheme(anyPresetTokens());
@@ -413,20 +464,128 @@ describe("HkThemeToggle item slots", () => {
413
464
  expect(row.hasAttribute("data-trailing")).toBe(true);
414
465
  expect(row.getAttribute("data-trailing")).toBe("slot");
415
466
  expect(row.querySelector(".s-theme-item-trailing .trail-mark")).toBeTruthy();
416
- // The slot owns the trailing zone: the built-in overlay is gone
417
- // even on custom rows.
418
- expect(row.querySelector(".s-theme-item-delete")).toBeNull();
467
+ // The slot owns the affordance column (the old suppression
468
+ // contract): no built-in action lane renders, not even on
469
+ // custom rows.
470
+ expect(row.querySelector(".hk-list-row-actions")).toBeNull();
419
471
  if (row.hasAttribute("data-custom")) customRows += 1;
420
472
  }
421
473
  expect(customRows).toBe(2);
474
+
475
+ // Clicks inside the trailing column stop at the column (HkCardList's
476
+ // wrapper guard — the R2b round found the trailing wrapper unpinned
477
+ // while it is load-bearing for exactly this host shape: a badge in a
478
+ // clickable theme row). A click on a NON-ACTIVE row's quiet mark
479
+ // (the R3 round flagged the active-row fixture as vacuous for the
480
+ // selection half) neither selects that row nor closes the menu.
481
+ const before = useTheme().currentTheme.value;
482
+ const markedRow = rows.find((r) => r.hasAttribute("data-custom"))!;
483
+ expect(markedRow.hasAttribute("data-active")).toBe(false);
484
+ markedRow.querySelector<HTMLElement>(".s-theme-item-trailing .trail-mark")!.click();
485
+ await settle();
486
+ expect(useTheme().currentTheme.value).toBe(before);
487
+ expect(document.body.querySelector(".s-theme-menu")).toBeTruthy();
488
+ });
489
+
490
+ it("lets the host itemActions prop own the standard action lane", async () => {
491
+ // The new grammar: the host returns named actions from the callback
492
+ // PROP (deliberately not a slot — slot returns are normalized into
493
+ // vnodes, which would destroy the plain action objects);
494
+ // HkListRow renders them through its lane (the same facility every
495
+ // card list uses).
496
+ useTheme().addCustomTheme(anyPresetTokens());
497
+ const container = document.createElement("div");
498
+ document.body.appendChild(container);
499
+ const picked: string[] = [];
500
+ const app = createApp({
501
+ render: () =>
502
+ h(HkThemeToggle, {
503
+ externalCustomize: true,
504
+ itemActions: (scope: { id: string }) => [
505
+ {
506
+ name: `Inspect ${scope.id}`,
507
+ onSelect: () => { picked.push(scope.id); },
508
+ },
509
+ ],
510
+ }),
511
+ });
512
+ app.mount(container);
513
+ mounts.push({ app, container });
514
+ await settle();
515
+ openMenu(container);
516
+ await settle();
517
+
518
+ const rows = [...document.body.querySelectorAll<HTMLElement>(".s-theme-menu .s-theme-item-row")];
519
+ expect(rows.length).toBeGreaterThanOrEqual(2);
520
+ for (const row of rows) {
521
+ const btn = row.querySelector<HTMLButtonElement>(".hk-list-row-actions__btn");
522
+ expect(btn).toBeTruthy();
523
+ expect(btn!.getAttribute("aria-label")).toMatch(/^Inspect /);
524
+ btn!.click();
525
+ }
526
+ expect(picked.length).toBeGreaterThanOrEqual(2);
527
+ expect(rows.every((r) => r.querySelector(".s-theme-item-trailing"))).toBe(false);
528
+ });
529
+
530
+ it("declines per row: undefined inherits the default, [] suppresses", async () => {
531
+ // The documented contract: a PRESENT builder owns the lane, and a
532
+ // per-row undefined DECLINES (falls back to the built-in anatomy —
533
+ // the custom row gets the standard delete), while an explicit []
534
+ // means "no actions". Both readings are pinned on CUSTOM rows — the
535
+ // only rows where undefined and [] differ (a stock row has no
536
+ // built-in lane under either, so pinning there is vacuous — the
537
+ // B4 round's finding).
538
+ useTheme().addCustomTheme(anyPresetTokens());
539
+ useTheme().addCustomTheme({
540
+ ...anyPresetTokens(),
541
+ id: "test-custom-2",
542
+ name: "Second custom scheme",
543
+ });
544
+ const container = document.createElement("div");
545
+ document.body.appendChild(container);
546
+ const app = createApp({
547
+ render: () =>
548
+ h(HkThemeToggle, {
549
+ externalCustomize: true,
550
+ // Decline on the first custom (undefined → built-in delete),
551
+ // suppress on the second ([] → no lane at all).
552
+ itemActions: (scope: { id: string }) =>
553
+ scope.id === "test-custom" ? undefined : [],
554
+ }),
555
+ });
556
+ app.mount(container);
557
+ mounts.push({ app, container });
558
+ await settle();
559
+ openMenu(container);
560
+ await settle();
561
+
562
+ const rows = [...document.body.querySelectorAll<HTMLElement>(".s-theme-menu .s-theme-item-row")];
563
+ const declined = rows.find(
564
+ (r) => r.hasAttribute("data-custom") && r.textContent?.includes("A Rather Long Custom Scheme Name"),
565
+ )!;
566
+ const suppressed = rows.find(
567
+ (r) => r.hasAttribute("data-custom") && r.textContent?.includes("Second custom scheme"),
568
+ )!;
569
+ expect(declined).toBeTruthy();
570
+ expect(suppressed).toBeTruthy();
571
+
572
+ const builtin = declined.querySelector<HTMLButtonElement>(".hk-list-row-actions__btn");
573
+ expect(builtin, "the declined custom row falls back to the built-in delete").toBeTruthy();
574
+ expect(builtin!.getAttribute("aria-label")).toBe("Delete theme");
575
+ // [] must suppress — a [] →decline regression keeps this lane alive.
576
+ expect(
577
+ suppressed.querySelector(".hk-list-row-actions"),
578
+ "the suppressed custom row renders no lane",
579
+ ).toBeNull();
422
580
  });
423
581
 
424
- it("renders the name-suffix cell INSIDE the row button, right after the name", async () => {
582
+ it("renders the name-suffix cell inside the row's name line, right after the name", async () => {
425
583
  // The whole point of the slot (vs. reusing item-trailing) is that the
426
584
  // mark reads as part of the NAME. That is a DOM-position claim, so it
427
- // is asserted structurally: inside `.s-theme-item-btn`, in the same
428
- // row, and immediately after `.s-theme-item-name` — not merely
429
- // "somewhere in the row".
585
+ // is asserted structurally: inside the row's `.s-theme-item-line`
586
+ // (the row IS the click target — HkListRow's clickable contract), in
587
+ // the same row, and immediately after `.s-theme-item-name` — not
588
+ // merely "somewhere in the row".
430
589
  useTheme().addCustomTheme(anyPresetTokens());
431
590
  const container = mountSlotted(
432
591
  () => null,
@@ -446,9 +605,10 @@ describe("HkThemeToggle item slots", () => {
446
605
  expect(row.querySelectorAll(".suffix-mark")).toHaveLength(1);
447
606
  const name = row.querySelector<HTMLElement>(".s-theme-item-name");
448
607
  expect(name).toBeTruthy();
449
- // Inside the row BUTTON (so a click on the row still selects the
450
- // theme) and the name's immediate next sibling.
451
- expect(name!.closest(".s-theme-item-btn")).toBeTruthy();
608
+ // Inside the row's name line (the row itself carries the click
609
+ // contract) and the name's immediate next sibling.
610
+ expect(name!.closest(".s-theme-item-line")).toBeTruthy();
611
+ expect(name!.closest(".s-theme-item-line")!.parentElement!.classList.contains("hk-list-row-main")).toBe(true);
452
612
  expect(cell!.closest(".s-theme-item-name-suffix")!.parentElement).toBe(name!.parentElement);
453
613
  expect(name!.nextElementSibling).toBe(cell!.closest(".s-theme-item-name-suffix"));
454
614
  }
@@ -3,7 +3,8 @@ import { Palette } from "lucide-vue-next";
3
3
  import { HPopover, useI18n, type PopupPlacement } from "@celestia-island/hikari";
4
4
 
5
5
  import HkIconButton from "./HkIconButton";
6
- import { HkThemePanelContent } from "./HkThemePanelContent";
6
+ import { HkThemePanelContent, type ThemeItemScope } from "./HkThemePanelContent";
7
+ import type { HkListRowAction } from "./HkCardList";
7
8
  import type { HCustomTheme } from "./HkColorSchemeDialog";
8
9
  import "./HkThemeToggle.scss";
9
10
  import { useChromeActionSize } from "../composables/useChromeActionSize";
@@ -29,14 +30,20 @@ export { type ThemeItemScope } from "./HkThemePanelContent";
29
30
  * · `item-leading` — renders for
30
31
  * every row in the fixed icon cell so names align regardless of the
31
32
  * active row. Scope: `ThemeItemScope` (id/name/isCustom/preset).
32
- * · `item-name-suffix` — an inline cell rendered INSIDE the row button,
33
+ * · `item-name-suffix` — an inline cell rendered in the row's name line,
33
34
  * immediately after the (catalog-resolved) name, so a host mark reads
34
35
  * as part of the name rather than as an affordance. Renders only when
35
36
  * the host provides the slot; the cell is `aria-hidden`-free and
36
37
  * layout-neutral (does not grow, never pushes the trailing column).
37
- * · `item-trailing` — reserves a trailing column on every row and owns
38
- * it entirely; the built-in custom-delete overlay is suppressed, so
39
- * the host renders delete/edit itself where it wants them.
38
+ * · `item-trailing` — quiet trailing CONTENT (badges, marks) rendered
39
+ * as the row's trailing column; the standard action lane covers it
40
+ * only while engaged.
41
+ *
42
+ * The row affordances themselves live on the STANDARD action lane
43
+ * (2026-11-13 user direction): the `itemActions` callback prop returns
44
+ * each row's `HkListRowAction[]`; without it, custom rows carry the
45
+ * built-in delete and hosts rendering `item-trailing` take over the
46
+ * affordance column entirely (the suppression contract).
40
47
  *
41
48
  * `mode-extra` — a host strip rendered directly under the color-mode
42
49
  * group (before the divider). Mode-adjacent host chrome that is NOT a
@@ -74,6 +81,16 @@ export const HkThemeToggle = defineComponent({
74
81
  * dialog). The internal dialog is not rendered in this mode.
75
82
  */
76
83
  externalCustomize: { type: Boolean, default: false },
84
+ /**
85
+ * Per-row option-control builder, forwarded verbatim to the shared
86
+ * panel content (a callback PROP — slot returns would be normalized
87
+ * into vnodes and destroy the plain action objects; see
88
+ * HkThemePanelContent's prop doc).
89
+ */
90
+ itemActions: {
91
+ type: Function as PropType<(scope: ThemeItemScope) => HkListRowAction[] | undefined>,
92
+ default: undefined,
93
+ },
77
94
  },
78
95
  emits: {
79
96
  "update:scheme": (_theme: HCustomTheme) => true,
@@ -131,6 +148,7 @@ export const HkThemeToggle = defineComponent({
131
148
  * one implementation. Slots and events pass straight through. */}
132
149
  <HkThemePanelContent
133
150
  externalCustomize={props.externalCustomize}
151
+ itemActions={props.itemActions}
134
152
  onRequest-close={closeMenu}
135
153
  onOpen-customize={() => emit("open-customize")}
136
154
  onUpdate:scheme={(theme: HCustomTheme) => emit("update:scheme", theme)}
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "فاتح",
19
19
  "hikari::theme.modeDark": "داكن",
20
20
  "hikari::theme.modeAuto": "تلقائي",
21
+ "hikari::theme.rowActionsLabel": "إجراءات الصف",
21
22
  "hikari::theme.themes": "سمات الألوان",
22
23
  "hikari::theme.autoAltitudeTip": "يتبع الوضع التلقائي ارتفاع الشمس. اضغط للتبديل إلى الوضع اليدوي",
23
24
  "hikari::theme.editScheme": "تعديل نظام الألوان…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "Hell",
19
19
  "hikari::theme.modeDark": "Dunkel",
20
20
  "hikari::theme.modeAuto": "Automatisch",
21
+ "hikari::theme.rowActionsLabel": "Zeilenaktionen",
21
22
  "hikari::theme.themes": "Farbschemata",
22
23
  "hikari::theme.autoAltitudeTip": "Der Automatikmodus folgt dem Sonnenstand. Zum manuellen Wechsel drücken",
23
24
  "hikari::theme.editScheme": "Farbschema bearbeiten…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "Light",
19
19
  "hikari::theme.modeDark": "Dark",
20
20
  "hikari::theme.modeAuto": "Auto",
21
+ "hikari::theme.rowActionsLabel": "Row actions",
21
22
  "hikari::theme.themes": "Color themes",
22
23
  "hikari::theme.autoAltitudeTip": "Auto follows the sun altitude. Press to switch to manual",
23
24
  "hikari::theme.editScheme": "Edit color scheme…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "Claro",
19
19
  "hikari::theme.modeDark": "Oscuro",
20
20
  "hikari::theme.modeAuto": "Automático",
21
+ "hikari::theme.rowActionsLabel": "Acciones de fila",
21
22
  "hikari::theme.themes": "Temas de color",
22
23
  "hikari::theme.autoAltitudeTip": "El modo automático sigue la altitud del sol. Pulsa para pasar a manual",
23
24
  "hikari::theme.editScheme": "Editar esquema de color…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "Clair",
19
19
  "hikari::theme.modeDark": "Sombre",
20
20
  "hikari::theme.modeAuto": "Auto",
21
+ "hikari::theme.rowActionsLabel": "Actions de ligne",
21
22
  "hikari::theme.themes": "Thèmes de couleurs",
22
23
  "hikari::theme.autoAltitudeTip": "Le mode auto suit l'altitude du soleil. Appuyez pour passer en manuel",
23
24
  "hikari::theme.editScheme": "Modifier le schéma de couleurs…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "ライト",
19
19
  "hikari::theme.modeDark": "ダーク",
20
20
  "hikari::theme.modeAuto": "自動",
21
+ "hikari::theme.rowActionsLabel": "行の操作",
21
22
  "hikari::theme.themes": "配色テーマ",
22
23
  "hikari::theme.autoAltitudeTip": "自動モードは太陽高度に追従します。押すと手動に切り替わります",
23
24
  "hikari::theme.editScheme": "配色を編集…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "라이트",
19
19
  "hikari::theme.modeDark": "다크",
20
20
  "hikari::theme.modeAuto": "자동",
21
+ "hikari::theme.rowActionsLabel": "행 작업",
21
22
  "hikari::theme.themes": "색상 테마",
22
23
  "hikari::theme.autoAltitudeTip": "자동 모드는 태양 고도를 따릅니다. 눌러서 수동으로 전환하세요",
23
24
  "hikari::theme.editScheme": "색 구성표 편집…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "Claro",
19
19
  "hikari::theme.modeDark": "Escuro",
20
20
  "hikari::theme.modeAuto": "Automático",
21
+ "hikari::theme.rowActionsLabel": "Ações da linha",
21
22
  "hikari::theme.themes": "Temas de cores",
22
23
  "hikari::theme.autoAltitudeTip": "O modo automático segue a altitude do sol. Pressione para mudar para manual",
23
24
  "hikari::theme.editScheme": "Editar esquema de cores…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "Светлая",
19
19
  "hikari::theme.modeDark": "Тёмная",
20
20
  "hikari::theme.modeAuto": "Авто",
21
+ "hikari::theme.rowActionsLabel": "Действия строки",
21
22
  "hikari::theme.themes": "Цветовые темы",
22
23
  "hikari::theme.autoAltitudeTip": "Автоматический режим следует за высотой солнца. Нажмите, чтобы перейти на ручной",
23
24
  "hikari::theme.editScheme": "Изменить цветовую схему…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "浅色",
19
19
  "hikari::theme.modeDark": "深色",
20
20
  "hikari::theme.modeAuto": "自动",
21
+ "hikari::theme.rowActionsLabel": "行操作",
21
22
  "hikari::theme.themes": "配色主题",
22
23
  "hikari::theme.autoAltitudeTip": "自动模式跟随太阳高度角,点按切回手动",
23
24
  "hikari::theme.editScheme": "编辑配色方案…",
@@ -18,6 +18,7 @@
18
18
  "hikari::theme.modeLight": "淺色",
19
19
  "hikari::theme.modeDark": "深色",
20
20
  "hikari::theme.modeAuto": "自動",
21
+ "hikari::theme.rowActionsLabel": "行操作",
21
22
  "hikari::theme.themes": "配色主題",
22
23
  "hikari::theme.autoAltitudeTip": "自動模式跟隨太陽高度角,點按切回手動",
23
24
  "hikari::theme.editScheme": "編輯配色方案…",