@celestia-island/hikari 0.55.461 → 0.55.462

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.
@@ -22,6 +22,14 @@ export type { PaddingSidesScan } from "./HkFaceShell";
22
22
  * output. Faces that own their action bar — or their whole content
23
23
  * lifecycle, like a canvas stage — consume HkFaceShell directly and
24
24
  * provide whatever they want, closest to their pages.
25
+ *
26
+ * BOTH header zones ride that one provide: `actions` is added here (the
27
+ * inner shell knows nothing about the bar the admin face owns), and the
28
+ * centre renderer arrives on the inner shell's own payload — HkFaceShell
29
+ * reads the bar provided ABOVE it, which for every HkAdminShell host is
30
+ * exactly this one — and is relayed verbatim by the spread below. So a
31
+ * host's `slots.header({ actions, center })` receives the two channels
32
+ * from one registration surface, and neither is a second source.
25
33
  */
26
34
  export declare const HkAdminShell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
27
35
  sidebarCollapsed: {
@@ -123,6 +123,19 @@ export interface HkFaceShellHeaderSlot {
123
123
  onHamburger: () => void;
124
124
  /** Opens the mobile nav drawer directly (e.g. the avatar's drawer mode). */
125
125
  onOpenDrawer: () => void;
126
+ /**
127
+ * The CENTRE header zone (2026-11-23): the enclosing action bar's centre
128
+ * renderer, so a host renders `HkAdminHeader`'s `center` slot without
129
+ * reaching for `useActionBar()` itself — the page registered it, the
130
+ * layout delivers it. `undefined` when nothing provides a bar above this
131
+ * shell (a face that owns its own chrome keeps the field absent rather
132
+ * than mounting an always-empty centre wrapper).
133
+ *
134
+ * Kept a renderer, never VNodes: the read of the bar's `center.value`
135
+ * then happens in the CONSUMER's render effect, so a page that registers
136
+ * (or drops) its centre group repaints the header that renders it.
137
+ */
138
+ center?: () => VNode[];
126
139
  }
127
140
  /**
128
141
  * Scoped payload of the `sidebar` slot. Desktop renders it twice — expanded
@@ -0,0 +1,201 @@
1
+ import { type Component, type PropType, type SlotsType, type VNode } from "vue";
2
+ import "./HkMasterDetail.scss";
3
+ /**
4
+ * Scoped payload of HkMasterDetail's slots. All three are plain renders —
5
+ * the pane hands out no state: selection is the host's (`detailOpen` +
6
+ * whatever row the roster drew), never this component's.
7
+ */
8
+ export type HkMasterDetailSlots = SlotsType<{
9
+ /** The roster: typically an `HkAdminTablePage` / `HkTable`, a card list
10
+ * or any scrolling list. Required in practice — an empty list slot
11
+ * leaves the left column blank. */
12
+ list?: () => VNode[];
13
+ /** The selected item's body. Rendered only while `detailOpen`; closed,
14
+ * the pane shows the empty state instead. */
15
+ detail?: () => VNode[];
16
+ /** Trailing header actions inside the detail pane (refresh, copy, a
17
+ * "open full page" link…) — rendered BEFORE the close affordance. */
18
+ actions?: () => VNode[];
19
+ }>;
20
+ /**
21
+ * HkMasterDetail — the family's standard two-pane roster+detail surface
22
+ * (mail inbox, ticket queue, audit log: any host list that picks one row
23
+ * and shows it beside the list).
24
+ *
25
+ * Layout: one CSS grid, `[list][detail]` with the family's `--space-12`
26
+ * gutter; the detail pane is a CARD (HkCard's chrome: the surface blend,
27
+ * `border-subtle`, `--radius-lg`, `--shadow-elevated`) that STICKS while
28
+ * the roster scrolls — `sticky: false` for hosts that embed the pane in a
29
+ * container that is already shorter than the viewport. The column tracks
30
+ * come from `listWidth` / `detailWidth` (host-tunable through
31
+ * `--hk-master-detail-list-w` / `-detail-w`, which the props write).
32
+ *
33
+ * Narrow viewports (`splitAt`, default 1100px, driven by the shared
34
+ * `useBreakpoint` width): ONE column — the roster keeps the full width and
35
+ * the detail pane becomes an OVERLAY DRAWER from the right over a scrim.
36
+ * The drawer mounts only while a detail is open (nothing to show behind a
37
+ * closed one) and closes through the same `close` emit the header
38
+ * affordance uses: Escape anywhere on the drawer face, a tap on the scrim,
39
+ * or the labelled close button. Escape's precedence follows HkDrawer /
40
+ * HkModal — a nested control that already consumed the key owns it.
41
+ *
42
+ * The head band (`.hk-master-detail-detail-head`) carries the drawer-form
43
+ * title, the `actions` slot and the close affordance; it renders only when
44
+ * it has at least one of those. A wide, closed, action-less pane therefore
45
+ * shows just the empty state — a band holding nothing would be blank
46
+ * chrome above a placeholder.
47
+ *
48
+ * NOT a focus-trapping window: the drawer is a page region laid OVER the
49
+ * roster (fixed position, dialog-sized), not a teleported overlay. It
50
+ * paints in the page-chrome band (`--hk-z-sidebar`), so a host popup or
51
+ * window teleported to `#hk-overlay-root` (--hk-z-float and up) covers it
52
+ * by design. Hosts that need capture semantics (focus trap, body scroll
53
+ * lock, back-gesture handling) mount HkDrawer themselves; this component
54
+ * deliberately does not re-implement that surface family.
55
+ *
56
+ * Emits `close` when the user dismisses the selection. The close
57
+ * affordance renders only when a listener is bound (`@close` /
58
+ * `onClose`) — a pane whose host cannot deselect has no button to press.
59
+ *
60
+ * ```tsx
61
+ * <HkMasterDetail
62
+ * detailOpen={selected.value != null}
63
+ * detailTitle={t("inbox.message", "Message")}
64
+ * emptyTitle={t("inbox.pickOne", "Pick a message")}
65
+ * onClose={() => (selected.value = null)}
66
+ * >
67
+ * {{ list: () => <InboxTable … />, detail: () => <MessageBody … /> }}
68
+ * </HkMasterDetail>
69
+ * ```
70
+ */
71
+ export declare const HkMasterDetail: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
72
+ /** Whether a detail is selected. Closed, the detail pane renders the
73
+ * empty state (two-pane) or nothing at all (drawer form). */
74
+ detailOpen: {
75
+ type: BooleanConstructor;
76
+ default: boolean;
77
+ };
78
+ /** Accessible name of the detail region — and, in the drawer form,
79
+ * the visible header title. */
80
+ detailTitle: {
81
+ type: StringConstructor;
82
+ required: true;
83
+ };
84
+ /** Empty-state heading. An empty value falls back to the localized
85
+ * "Nothing selected" message. */
86
+ emptyTitle: {
87
+ type: StringConstructor;
88
+ default: string;
89
+ };
90
+ emptyDescription: {
91
+ type: StringConstructor;
92
+ default: undefined;
93
+ };
94
+ /** Empty-state icon (lucide-vue-next style), forwarded to
95
+ * HkEmptyState. */
96
+ emptyIcon: {
97
+ type: PropType<Component>;
98
+ default: undefined;
99
+ };
100
+ /** Roster column track. */
101
+ listWidth: {
102
+ type: StringConstructor;
103
+ default: string;
104
+ };
105
+ /** Detail column track. */
106
+ detailWidth: {
107
+ type: StringConstructor;
108
+ default: string;
109
+ };
110
+ /** Stick the detail pane while the roster scrolls. Hosts embedding
111
+ * the pane in an already-bounded container pass false — a sticky
112
+ * child inside a short box just scrolls with it. */
113
+ sticky: {
114
+ type: BooleanConstructor;
115
+ default: boolean;
116
+ };
117
+ /** Viewport width (px) below which the two panes collapse into one
118
+ * column with the detail in the overlay drawer. */
119
+ splitAt: {
120
+ type: NumberConstructor;
121
+ default: number;
122
+ };
123
+ /** Accessible label of the close affordance (defaults to the
124
+ * localized "Close"). */
125
+ closeLabel: {
126
+ type: StringConstructor;
127
+ default: undefined;
128
+ };
129
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
130
+ close: () => true;
131
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
132
+ /** Whether a detail is selected. Closed, the detail pane renders the
133
+ * empty state (two-pane) or nothing at all (drawer form). */
134
+ detailOpen: {
135
+ type: BooleanConstructor;
136
+ default: boolean;
137
+ };
138
+ /** Accessible name of the detail region — and, in the drawer form,
139
+ * the visible header title. */
140
+ detailTitle: {
141
+ type: StringConstructor;
142
+ required: true;
143
+ };
144
+ /** Empty-state heading. An empty value falls back to the localized
145
+ * "Nothing selected" message. */
146
+ emptyTitle: {
147
+ type: StringConstructor;
148
+ default: string;
149
+ };
150
+ emptyDescription: {
151
+ type: StringConstructor;
152
+ default: undefined;
153
+ };
154
+ /** Empty-state icon (lucide-vue-next style), forwarded to
155
+ * HkEmptyState. */
156
+ emptyIcon: {
157
+ type: PropType<Component>;
158
+ default: undefined;
159
+ };
160
+ /** Roster column track. */
161
+ listWidth: {
162
+ type: StringConstructor;
163
+ default: string;
164
+ };
165
+ /** Detail column track. */
166
+ detailWidth: {
167
+ type: StringConstructor;
168
+ default: string;
169
+ };
170
+ /** Stick the detail pane while the roster scrolls. Hosts embedding
171
+ * the pane in an already-bounded container pass false — a sticky
172
+ * child inside a short box just scrolls with it. */
173
+ sticky: {
174
+ type: BooleanConstructor;
175
+ default: boolean;
176
+ };
177
+ /** Viewport width (px) below which the two panes collapse into one
178
+ * column with the detail in the overlay drawer. */
179
+ splitAt: {
180
+ type: NumberConstructor;
181
+ default: number;
182
+ };
183
+ /** Accessible label of the close affordance (defaults to the
184
+ * localized "Close"). */
185
+ closeLabel: {
186
+ type: StringConstructor;
187
+ default: undefined;
188
+ };
189
+ }>> & Readonly<{
190
+ onClose?: (() => any) | undefined;
191
+ }>, {
192
+ sticky: boolean;
193
+ closeLabel: string;
194
+ emptyTitle: string;
195
+ emptyDescription: string;
196
+ detailOpen: boolean;
197
+ emptyIcon: Component;
198
+ listWidth: string;
199
+ detailWidth: string;
200
+ splitAt: number;
201
+ }, HkMasterDetailSlots, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -34,6 +34,11 @@ import { type Ref, type VNode } from "vue";
34
34
  * 节点概览 / 历史记录). Same registration contract, same per-scope
35
35
  * lifetime: a view whose filter is a small closed enum renders it there
36
36
  * (HkTabs segmented) instead of a filter card inside the page body.
37
+ * DELIVERY (2026-11-23): the layout's header slot receives the renderer as
38
+ * its `center` payload field — HkFaceShell reads the bar it sits under
39
+ * through `useActionBarCenter()` and HkAdminShell relays the same field
40
+ * beside `actions`, so a page registers once and the host never touches
41
+ * the composable to render it.
37
42
  *
38
43
  * Readout-style header zones (a left-wing HUD cluster) are host-side
39
44
  * extensions, not part of this contract: this module exposes only the
@@ -106,6 +111,22 @@ interface ActionBarContext {
106
111
  center: Ref<ActionBarRenderer | null>;
107
112
  }
108
113
  export declare function provideActionBar(): ActionBarContext;
114
+ /**
115
+ * The enclosing bar's CENTRE renderer, for LAYOUTS that hand their header
116
+ * slot a payload but do not own the bar themselves (HkFaceShell): whoever
117
+ * provides the bar above the layout — HkAdminShell in the admin face, a
118
+ * host's own `provideActionBar()` in a bespoke one — is the single source,
119
+ * and the renderer handed out stays a FUNCTION so the read of
120
+ * `center.value` happens inside the consumer's own render effect (the
121
+ * registration therefore repaints the header that renders it).
122
+ *
123
+ * `undefined` when nothing provides a bar above: layouts keep the payload
124
+ * field ABSENT then, instead of handing every face an always-empty
125
+ * renderer that would make a header mount a centre wrapper for nothing.
126
+ *
127
+ * Call in setup — it injects.
128
+ */
129
+ export declare function useActionBarCenter(): ActionBarRenderer | undefined;
109
130
  export declare function useActionBar(): {
110
131
  setActions: (_renderer: ActionBarRenderer, _slot: string) => void;
111
132
  clearActions: () => void;
@@ -242,6 +242,7 @@ export { default as HAuthSubmitButton } from "./components/HkAuthSubmitButton";
242
242
  export { HkMfaVerifyCard as HMfaVerifyCard, hkIsMfaFactor as isMfaFactor, hkPreferredMfaFactor as preferredMfaFactor, type HkMfaFactor as MfaFactor, } from "./components/HkMfaVerifyCard";
243
243
  export { usePageTitle, useRouteTitle } from "./composables/usePageTitle";
244
244
  export { provideActionBar, useActionBar, PageActionSlot, orderActionRegistrations } from "./composables/useActionBar";
245
+ export { useActionBarCenter } from "./composables/useActionBar";
245
246
  export type { ActionBarRenderer, PageActionSlotValue, ActionBarRegistration } from "./composables/useActionBar";
246
247
  export { useChromeActionSize } from "./composables/useChromeActionSize";
247
248
  export { leadingZeroBits, sha256, solvePow, solvePowSync, verifyPow } from "./utils/pow";
@@ -497,6 +498,8 @@ export { HkAuthChannelList as HkAuthChannelList } from "./components/HkAuthChann
497
498
  export { type HkAuthChannelListEntry as HkAuthChannelListEntry } from "./components/HkAuthChannelList";
498
499
  export { HkLocalePicker as HkLocalePicker } from "./components/HkLocalePicker";
499
500
  export { HkAdminTablePage as HkAdminTablePage } from "./components/HkAdminTablePage";
501
+ export { HkMasterDetail as HkMasterDetail } from "./components/HkMasterDetail";
502
+ export type { HkMasterDetailSlots } from "./components/HkMasterDetail";
500
503
  export { HkPageHeader as HkPageHeader } from "./components/HkPageHeader";
501
504
  export { HkStatCard as HkStatCard } from "./components/HkStatCard";
502
505
  export { statToneColor, type StatTone as StatTone, type StatVariant as StatVariant } from "./components/HkStatCard";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.461",
3
+ "version": "0.55.462",
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",
@@ -158,3 +158,10 @@ registerCssAnimation("hk-edge-glow-breathe", { infinite: true });
158
158
  registerCssAnimation("hk-emergency-breathe", { infinite: true });
159
159
  registerCssAnimation("hk-emergency-signal", { infinite: true });
160
160
 
161
+ // components/HkMasterDetail.scss — the drawer form's entry (two one-shots):
162
+ // the detail pane slides in from the right edge and its veil fades in. Both
163
+ // play once (the pane unmounts on close, so no leave keyframe); the host's
164
+ // global animation switch and reduced motion clamp them (the component's
165
+ // own sheet carries both opt-outs).
166
+ registerCssAnimation("hk-master-detail-drawer-in");
167
+ registerCssAnimation("hk-master-detail-scrim-in");
@@ -0,0 +1,175 @@
1
+ import { afterEach, describe, expect, it } from "vitest";
2
+ import { createApp, defineComponent, h, nextTick, ref, type VNode } from "vue";
3
+
4
+ import { HkAdminShell } from "./HkAdminShell";
5
+ import { HkAdminHeader } from "./HkAdminHeader";
6
+ import { useActionBar } from "../composables/useActionBar";
7
+ import type { HkFaceShellHeaderSlot } from "../index";
8
+
9
+ /**
10
+ * The header's CENTRE channel, end to end (2026-11-23).
11
+ *
12
+ * `useActionBar().setCenter` existed with nothing rendering it: a page
13
+ * registered its filter/mode group into a ref no shell ever read, so the
14
+ * zone was dead on every admin face — and the composable's own unit suite
15
+ * (composables/useActionBar.test.ts) could not see that, because it mounts
16
+ * its own probe layout. This file mounts the REAL chain:
17
+ *
18
+ * page (setCenter) -> HkAdminShell's provide -> HkFaceShell's header
19
+ * payload (`center`) -> HkAdminHeader's own `center` slot -> DOM
20
+ *
21
+ * so a shell that stops relaying the renderer goes red here.
22
+ *
23
+ * Deliberately NOT mocking "@celestia-island/hikari" (the reason
24
+ * HkFaceShell.barrel.test.ts documents): the package self-reference
25
+ * resolves to the same src/index.ts module as the barrel, and a vi.mock
26
+ * spread here hands HkAdminHeader an incomplete namespace while the barrel
27
+ * is still initializing — the header then renders nothing and this file
28
+ * would be testing the mock instead of the wiring.
29
+ *
30
+ * The payload is load-bearing: dropping the `center` field from
31
+ * HkFaceShell's header payload reds all three tests in this file
32
+ * (the PR body's mutation table records the count) [MUT:centre-spread-dropped].
33
+ */
34
+
35
+ const mounts: Array<{ app: ReturnType<typeof createApp>; container: HTMLElement }> = [];
36
+
37
+ function setWidth(w: number) {
38
+ Object.defineProperty(window, "innerWidth", {
39
+ configurable: true,
40
+ writable: true,
41
+ value: w,
42
+ });
43
+ window.dispatchEvent(new Event("resize"));
44
+ }
45
+
46
+ function mount(node: ReturnType<typeof h>): HTMLElement {
47
+ const container = document.createElement("div");
48
+ document.body.appendChild(container);
49
+ const app = createApp({ render: () => node });
50
+ app.mount(container);
51
+ mounts.push({ app, container });
52
+ return container;
53
+ }
54
+
55
+ afterEach(() => {
56
+ for (const { app, container } of mounts.splice(0)) {
57
+ app.unmount();
58
+ container.remove();
59
+ }
60
+ setWidth(1280);
61
+ });
62
+
63
+ /** The payload HkAdminShell hands its header slot: the shell's own params
64
+ * plus the `actions` flat list it injects. */
65
+ type ShellHeaderParams = HkFaceShellHeaderSlot & { actions: VNode[] };
66
+
67
+ describe("HkAdminShell — the header centre channel", () => {
68
+ it("delivers the page's centre group to the header slot and clears it on unmount", async () => {
69
+ setWidth(1024);
70
+ const showPage = ref(true);
71
+ const Page = defineComponent({
72
+ name: "CentrePage",
73
+ setup() {
74
+ const bar = useActionBar();
75
+ // One page, both zones — the two channels travel together.
76
+ bar.setActions(() => [h("button", { class: "page-action" }, "refresh")], "refresh");
77
+ bar.setCenter(() => [h("span", { class: "page-centre" }, "mid")]);
78
+ return () => h("main", { class: "page-body" }, "PAGE");
79
+ },
80
+ });
81
+
82
+ const c = mount(
83
+ h(HkAdminShell, {}, {
84
+ // The host shape this contract exists for: hand the shell-provided
85
+ // renderer straight to HkAdminHeader's own `center` slot.
86
+ header: (params: ShellHeaderParams) =>
87
+ h(
88
+ HkAdminHeader,
89
+ { title: "Page", actions: params.actions },
90
+ params.center ? { center: params.center } : {},
91
+ ),
92
+ content: () =>
93
+ showPage.value ? h(Page) : h("div", { class: "page-filler" }, "NEXT"),
94
+ }),
95
+ );
96
+
97
+ await nextTick();
98
+ expect(c.querySelector(".page-body")).toBeTruthy();
99
+ // The centre zone renders the page's registration inside the header's
100
+ // own centre wrapper…
101
+ expect(c.querySelector(".s-admin-header-center .page-centre")?.textContent).toBe("mid");
102
+ // …and the right cluster still arrives through the same payload.
103
+ expect(c.querySelector(".s-admin-header-actions .page-action")).toBeTruthy();
104
+
105
+ // The page goes away (a route / view swap): BOTH registrations leave
106
+ // with it — the per-scope disposal contract the composable documents.
107
+ showPage.value = false;
108
+ await nextTick();
109
+ await nextTick();
110
+ expect(c.querySelector(".page-centre")).toBeNull();
111
+ expect(c.querySelector(".s-admin-header-actions .page-action")).toBeNull();
112
+ });
113
+
114
+ it("hands a renderer that produces nothing while no page registered a group", async () => {
115
+ // The admin face provides a bar of its own, so the field arrives as a
116
+ // renderer here — an empty VNode list until a page registers one.
117
+ // (The ABSENT case belongs to HkFaceShell with no bar above it:
118
+ // pinned in HkFaceShell.test.tsx.)
119
+ setWidth(1024);
120
+ const seen: ShellHeaderParams[] = [];
121
+ const c = mount(
122
+ h(HkAdminShell, {}, {
123
+ header: (params: ShellHeaderParams) => {
124
+ seen.push(params);
125
+ return null;
126
+ },
127
+ content: () => h("main", null, "CONTENT"),
128
+ }),
129
+ );
130
+ await nextTick();
131
+ expect(seen.length).toBeGreaterThan(0);
132
+ expect(typeof seen[0].center).toBe("function");
133
+ expect(seen[0].center!()).toEqual([]);
134
+ expect(c.querySelector(".s-admin-header-center")).toBeNull();
135
+ });
136
+
137
+ it("keeps a page's centre registration alive across a header repaint", async () => {
138
+ // The host repaints its header (the title is a live ref read inside the
139
+ // header slot): the centre group must survive the repaint, because the
140
+ // payload carries a RENDERER the consumer re-invokes, not VNodes it
141
+ // would have to reuse.
142
+ setWidth(1024);
143
+ const Page = defineComponent({
144
+ name: "LiveCentrePage",
145
+ setup() {
146
+ useActionBar().setCenter(() => [h("span", { class: "page-centre" }, "mid")]);
147
+ return () => h("main", null, "PAGE");
148
+ },
149
+ });
150
+ const title = ref("Page");
151
+ const c = mount(
152
+ h(HkAdminShell, {}, {
153
+ header: (params: ShellHeaderParams) =>
154
+ h(
155
+ HkAdminHeader,
156
+ { title: title.value, actions: params.actions },
157
+ params.center ? { center: params.center } : {},
158
+ ),
159
+ content: () => h(Page),
160
+ }),
161
+ );
162
+ await nextTick();
163
+ expect(c.querySelector(".s-admin-header-center .page-centre")?.textContent).toBe("mid");
164
+ expect(c.querySelector(".s-admin-header-title")?.textContent).toBe("Page");
165
+
166
+ // A host-side header repaint replaces the vnode tree without touching
167
+ // the registration. The title assertion is what proves the repaint
168
+ // really happened — without it this test would pass on a tree that
169
+ // did not re-render at all.
170
+ title.value = "Renamed";
171
+ await nextTick();
172
+ expect(c.querySelector(".s-admin-header-title")?.textContent).toBe("Renamed");
173
+ expect(c.querySelector(".s-admin-header-center .page-centre")?.textContent).toBe("mid");
174
+ });
175
+ });
@@ -35,6 +35,14 @@ export type { PaddingSidesScan } from "./HkFaceShell";
35
35
  * output. Faces that own their action bar — or their whole content
36
36
  * lifecycle, like a canvas stage — consume HkFaceShell directly and
37
37
  * provide whatever they want, closest to their pages.
38
+ *
39
+ * BOTH header zones ride that one provide: `actions` is added here (the
40
+ * inner shell knows nothing about the bar the admin face owns), and the
41
+ * centre renderer arrives on the inner shell's own payload — HkFaceShell
42
+ * reads the bar provided ABOVE it, which for every HkAdminShell host is
43
+ * exactly this one — and is relayed verbatim by the spread below. So a
44
+ * host's `slots.header({ actions, center })` receives the two channels
45
+ * from one registration surface, and neither is a second source.
38
46
  */
39
47
  export const HkAdminShell = defineComponent({
40
48
  name: "HkAdminShell",
@@ -163,6 +171,12 @@ export const HkAdminShell = defineComponent({
163
171
  // VNode[] (now one entry per registered affordance, in
164
172
  // slot order).
165
173
  actions: actionBar.actions.value.flatMap((render) => render()),
174
+ // The centre zone rides the spread: the inner shell
175
+ // resolved it from the bar provided above it (this
176
+ // wrapper's own), so re-forwarding `shellParams.center`
177
+ // would only re-read the same ref through a second path.
178
+ // Pinned end to end by HkAdminShell.centre.test.tsx — a
179
+ // shell that stops relaying the field goes red there.
166
180
  })
167
181
  : undefined,
168
182
  sidebar: slots.sidebar,
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it, vi } from "vitest";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { dirname, join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
- import { createApp, defineComponent, h, inject } from "vue";
5
+ import { createApp, defineComponent, h, inject, nextTick, type VNode } from "vue";
6
6
 
7
7
  // HDrawer teleports and animates; replace it with an inline passthrough
8
8
  // (same stub shape as HkAdminShell.test.tsx) so the shell contract is
@@ -37,6 +37,7 @@ vi.mock("@celestia-island/hikari", async (importOriginal) => {
37
37
  import { HkFaceShell } from "./HkFaceShell";
38
38
  import { HkAdminShell } from "./HkAdminShell";
39
39
  import { HK_SCROLL_PROGRESS_ALLOWED } from "./HkScrollProgressDock";
40
+ import { provideActionBar } from "../composables/useActionBar";
40
41
 
41
42
  /**
42
43
  * HkFaceShell — the generalized face shell extracted from HkAdminShell
@@ -255,6 +256,52 @@ describe("the extraction boundary: the action-bar channel", () => {
255
256
  });
256
257
  });
257
258
 
259
+ /**
260
+ * The header CENTRE channel (2026-11-23) — the other half of the bar
261
+ * contract. `actions` belongs to the shell that PROVIDES the bar; `center`
262
+ * belongs to whichever shell sits UNDER one (HkFaceShell provides none, so
263
+ * it injects the nearest). The delivery is the field's ABSENCE, not an
264
+ * empty renderer: a face whose host owns its chrome must not be handed a
265
+ * centre group no page registered.
266
+ */
267
+ describe("the header centre channel", () => {
268
+ it("HkFaceShell carries NO center param when no bar is provided above", () => {
269
+ const seen: Array<Record<string, unknown>> = [];
270
+ mount(h(HkFaceShell, { navTitle: "Navigation" }, {
271
+ header: (params: Record<string, unknown>) => {
272
+ seen.push(params);
273
+ return null;
274
+ },
275
+ content: CONTENT,
276
+ }));
277
+ expect(seen.length).toBeGreaterThan(0);
278
+ for (const params of seen) {
279
+ expect("center" in params).toBe(false);
280
+ }
281
+ });
282
+
283
+ it("HkFaceShell relays the centre group of a bar provided ABOVE it", async () => {
284
+ // A bespoke face that owns its bar provides it over the shell — the
285
+ // same shape HkAdminShell has, without its `actions` injection.
286
+ const Host = defineComponent({
287
+ name: "CentreHost",
288
+ setup() {
289
+ const bar = provideActionBar();
290
+ bar.center.value = () => [h("span", { class: "host-centre" }, "host-mid")];
291
+ return () =>
292
+ h(HkFaceShell, { navTitle: "Navigation" }, {
293
+ header: (params: { center?: () => VNode[] }) =>
294
+ h("div", { class: "header-centre" }, params.center?.() ?? []),
295
+ content: CONTENT,
296
+ });
297
+ },
298
+ });
299
+ const c = mount(h(Host));
300
+ await nextTick();
301
+ expect(c.querySelector(".header-centre .host-centre")?.textContent).toBe("host-mid");
302
+ });
303
+ });
304
+
258
305
  describe("the contentMode attrs leak (R2 S2)", () => {
259
306
  it("HkAdminShell declares and forwards contentMode — a passed stage value reaches the host honestly", () => {
260
307
  const staged = mount(h(HkAdminShell, {
@@ -1,6 +1,7 @@
1
1
  import { computed, defineComponent, provide, ref, watch, type PropType, type SlotsType, type VNode } from "vue";
2
2
  import { HkCrossfade, HDrawer, HScrollContainer, useBreakpoint } from "@celestia-island/hikari";
3
3
  import { useI18n } from "../i18n/context";
4
+ import { useActionBarCenter } from "../composables/useActionBar";
4
5
  import { useSidebarRail } from "../composables/useSidebarRail";
5
6
  import { provideMenuGroupState } from "../composables/useMenuGroupState";
6
7
  import HkSidebarRailSwap from "./HkSidebarRailSwap";
@@ -184,6 +185,19 @@ export interface HkFaceShellHeaderSlot {
184
185
  onHamburger: () => void;
185
186
  /** Opens the mobile nav drawer directly (e.g. the avatar's drawer mode). */
186
187
  onOpenDrawer: () => void;
188
+ /**
189
+ * The CENTRE header zone (2026-11-23): the enclosing action bar's centre
190
+ * renderer, so a host renders `HkAdminHeader`'s `center` slot without
191
+ * reaching for `useActionBar()` itself — the page registered it, the
192
+ * layout delivers it. `undefined` when nothing provides a bar above this
193
+ * shell (a face that owns its own chrome keeps the field absent rather
194
+ * than mounting an always-empty centre wrapper).
195
+ *
196
+ * Kept a renderer, never VNodes: the read of the bar's `center.value`
197
+ * then happens in the CONSUMER's render effect, so a page that registers
198
+ * (or drops) its centre group repaints the header that renders it.
199
+ */
200
+ center?: () => VNode[];
187
201
  }
188
202
 
189
203
  /**
@@ -351,6 +365,15 @@ export const HkFaceShell = defineComponent({
351
365
  const { width: viewportWidth } = useBreakpoint();
352
366
  const isDesktop = computed(() => viewportWidth.value >= props.mobileBreakpoint);
353
367
  const sidebarOpen = ref(false);
368
+ // ── the header's CENTRE channel, read from the bar above ─────────
369
+ // This shell provides NO bar of its own (whoever provides, provides
370
+ // closest to the pages — see the component doc), so the read is an
371
+ // inject of the nearest one: HkAdminShell's in the admin face, a
372
+ // host's own in a bespoke one. `undefined` when there is none, which
373
+ // keeps the slot field absent instead of always-empty. Resolved once,
374
+ // at setup: the renderer it returns closes over the bar's ref, so the
375
+ // registration stays live without re-injecting on every render.
376
+ const actionBarCenter = useActionBarCenter();
354
377
 
355
378
  // ── sidebar menu GROUP fold, stable across the rail crossfade ─────
356
379
  // The rail swap mounts each density as a FRESH generation, so an
@@ -517,6 +540,11 @@ export const HkFaceShell = defineComponent({
517
540
  // Lets a header trigger (e.g. the avatar in "drawer" action
518
541
  // mode) open the mobile nav drawer directly.
519
542
  onOpenDrawer: openSidebar,
543
+ // The centre zone's data: the bar provided ABOVE this shell
544
+ // (HkAdminShell provides one; a bespoke face provides its
545
+ // own). Absent — not empty — when no bar is above, so the
546
+ // field never claims a centre group that does not exist.
547
+ ...(actionBarCenter ? { center: actionBarCenter } : {}),
520
548
  })}
521
549
  </div>
522
550
  )}