@celestia-island/hikari 0.55.460 → 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.
- package/dist/types/components/HkAdminShell.d.ts +8 -0
- package/dist/types/components/HkFaceShell.d.ts +13 -0
- package/dist/types/components/HkLoginFlow.d.ts +42 -6
- package/dist/types/components/HkMasterDetail.d.ts +201 -0
- package/dist/types/components/HkSignInCard.d.ts +31 -2
- package/dist/types/composables/useActionBar.d.ts +21 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/animation/registerAnimations.ts +7 -0
- package/src/components/HkAdminShell.centre.test.tsx +175 -0
- package/src/components/HkAdminShell.tsx +14 -0
- package/src/components/HkFaceShell.test.tsx +48 -1
- package/src/components/HkFaceShell.tsx +28 -0
- package/src/components/HkLoginFlow.test.tsx +225 -14
- package/src/components/HkLoginFlow.tsx +149 -97
- package/src/components/HkMasterDetail.scss +246 -0
- package/src/components/HkMasterDetail.ssr.test.tsx +82 -0
- package/src/components/HkMasterDetail.test.tsx +603 -0
- package/src/components/HkMasterDetail.tsx +294 -0
- package/src/components/HkSignInCard.test.ts +43 -0
- package/src/components/HkSignInCard.tsx +96 -54
- package/src/composables/useActionBar.ts +26 -0
- package/src/i18n/locales/ar/components.json +3 -1
- package/src/i18n/locales/de/components.json +3 -1
- package/src/i18n/locales/en/components.json +3 -1
- package/src/i18n/locales/es/components.json +3 -1
- package/src/i18n/locales/fr/components.json +3 -1
- package/src/i18n/locales/ja/components.json +3 -1
- package/src/i18n/locales/ko/components.json +3 -1
- package/src/i18n/locales/pt/components.json +3 -1
- package/src/i18n/locales/ru/components.json +3 -1
- package/src/i18n/locales/zh-Hans/components.json +3 -1
- package/src/i18n/locales/zh-Hant/components.json +3 -1
- package/src/index.ts +10 -0
- package/src/styles/admin-tokens.scss +15 -0
|
@@ -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
|
|
@@ -69,10 +69,12 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
|
|
|
69
69
|
* This is the business-level composition above the auth kit (extracted
|
|
70
70
|
* from shittim-chest's LoginView, 2026-11 user direction: the login
|
|
71
71
|
* screen had drifted into per-app reimplementations). It owns EVERYTHING
|
|
72
|
-
* visual —
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
72
|
+
* visual — ONE stable shell card (logo, header, the pill segment group
|
|
73
|
+
* hidden when a deployment offers a single channel; a lone dead segment
|
|
74
|
+
* reads as a broken switch) whose body below the tabs crossfades and
|
|
75
|
+
* height-morphs per channel through `HkTransitionContainer`, with the
|
|
76
|
+
* account→verify step as the same fade+height morph between the shell
|
|
77
|
+
* and the MFA card — while staying a CONTROLLED
|
|
76
78
|
* component: no endpoint, no URL building, no factor ladder policy.
|
|
77
79
|
* Each host (the chest migration plus the erp and arona login surfaces,
|
|
78
80
|
* landing as their own PRs) keeps its own auth client and drives the
|
|
@@ -138,11 +140,27 @@ export declare const HkLoginFlow: import("vue").DefineComponent<import("vue").Ex
|
|
|
138
140
|
type: BooleanConstructor;
|
|
139
141
|
default: boolean;
|
|
140
142
|
};
|
|
141
|
-
/** Logo image URL forwarded to the
|
|
143
|
+
/** Logo image URL forwarded to the shell card's header. */
|
|
142
144
|
logoSrc: {
|
|
143
145
|
type: StringConstructor;
|
|
144
146
|
default: undefined;
|
|
145
147
|
};
|
|
148
|
+
/** The SHELL card's header title — one stable header across every
|
|
149
|
+
* channel (2026-11-24 user direction: a channel switch must morph
|
|
150
|
+
* only the content below the tabs, never dissolve the card). Falls
|
|
151
|
+
* back to the ACTIVE channel's `title` (then the conventional
|
|
152
|
+
* sign-in copy) for hosts that still brand per channel; distinct
|
|
153
|
+
* per-channel fallbacks then swap as instant text, so multi-channel
|
|
154
|
+
* hosts should pass this once. */
|
|
155
|
+
title: {
|
|
156
|
+
type: StringConstructor;
|
|
157
|
+
default: undefined;
|
|
158
|
+
};
|
|
159
|
+
/** The SHELL card's subtitle — same stability contract as `title`. */
|
|
160
|
+
subtitle: {
|
|
161
|
+
type: StringConstructor;
|
|
162
|
+
default: undefined;
|
|
163
|
+
};
|
|
146
164
|
/** Seed for the credentials card's username field — survives the
|
|
147
165
|
* verify round-trip (see HkSignInCard.initialUsername). */
|
|
148
166
|
initialUsername: {
|
|
@@ -204,11 +222,27 @@ export declare const HkLoginFlow: import("vue").DefineComponent<import("vue").Ex
|
|
|
204
222
|
type: BooleanConstructor;
|
|
205
223
|
default: boolean;
|
|
206
224
|
};
|
|
207
|
-
/** Logo image URL forwarded to the
|
|
225
|
+
/** Logo image URL forwarded to the shell card's header. */
|
|
208
226
|
logoSrc: {
|
|
209
227
|
type: StringConstructor;
|
|
210
228
|
default: undefined;
|
|
211
229
|
};
|
|
230
|
+
/** The SHELL card's header title — one stable header across every
|
|
231
|
+
* channel (2026-11-24 user direction: a channel switch must morph
|
|
232
|
+
* only the content below the tabs, never dissolve the card). Falls
|
|
233
|
+
* back to the ACTIVE channel's `title` (then the conventional
|
|
234
|
+
* sign-in copy) for hosts that still brand per channel; distinct
|
|
235
|
+
* per-channel fallbacks then swap as instant text, so multi-channel
|
|
236
|
+
* hosts should pass this once. */
|
|
237
|
+
title: {
|
|
238
|
+
type: StringConstructor;
|
|
239
|
+
default: undefined;
|
|
240
|
+
};
|
|
241
|
+
/** The SHELL card's subtitle — same stability contract as `title`. */
|
|
242
|
+
subtitle: {
|
|
243
|
+
type: StringConstructor;
|
|
244
|
+
default: undefined;
|
|
245
|
+
};
|
|
212
246
|
/** Seed for the credentials card's username field — survives the
|
|
213
247
|
* verify round-trip (see HkSignInCard.initialUsername). */
|
|
214
248
|
initialUsername: {
|
|
@@ -249,7 +283,9 @@ export declare const HkLoginFlow: import("vue").DefineComponent<import("vue").Ex
|
|
|
249
283
|
"onVerify-back"?: (() => any) | undefined;
|
|
250
284
|
}>, {
|
|
251
285
|
step: "verify" | "account";
|
|
286
|
+
title: string;
|
|
252
287
|
loading: boolean;
|
|
288
|
+
subtitle: string;
|
|
253
289
|
logoSrc: string;
|
|
254
290
|
initialUsername: string;
|
|
255
291
|
passkeyRetryHint: string;
|
|
@@ -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>;
|
|
@@ -32,6 +32,13 @@
|
|
|
32
32
|
* between the form and the footer (typically `HkAuthMethodList`), so
|
|
33
33
|
* alternative sign-in buttons line up with the inputs while the footer
|
|
34
34
|
* rows keep their centered-group layout.
|
|
35
|
+
* - `bare: true` — render ONLY the credential fragment (the `<form>` plus
|
|
36
|
+
* the methods/footer blocks, same wrapper classes) with NO HkAuthCard
|
|
37
|
+
* shell: for hosts that own a stable card shell and swap this body
|
|
38
|
+
* inside it (HkLoginFlow's channel switch — 2026-11-24 user direction:
|
|
39
|
+
* the shell, its header and the channel tabs must NOT dissolve when
|
|
40
|
+
* only the content below the tabs changes). The `top` slot is a shell
|
|
41
|
+
* concern and deliberately does not exist in bare mode.
|
|
35
42
|
*
|
|
36
43
|
* ```tsx
|
|
37
44
|
* <HSignInCard
|
|
@@ -44,9 +51,11 @@
|
|
|
44
51
|
* ```
|
|
45
52
|
*/
|
|
46
53
|
export declare const HkSignInCard: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
54
|
+
/** Card title (shell mode). Unused in `bare` mode — the host owns
|
|
55
|
+
* the shell — but kept in the prop shape for the standalone card. */
|
|
47
56
|
title: {
|
|
48
57
|
type: StringConstructor;
|
|
49
|
-
|
|
58
|
+
default: string;
|
|
50
59
|
};
|
|
51
60
|
subtitle: {
|
|
52
61
|
type: StringConstructor;
|
|
@@ -108,14 +117,24 @@ export declare const HkSignInCard: import("vue").DefineComponent<import("vue").E
|
|
|
108
117
|
type: StringConstructor;
|
|
109
118
|
default: string;
|
|
110
119
|
};
|
|
120
|
+
/** Render ONLY the credential fragment — no HkAuthCard shell, no
|
|
121
|
+
* `top` slot. For hosts that own a stable shell and transition this
|
|
122
|
+
* body inside it (HkLoginFlow's channel swap). Default keeps the
|
|
123
|
+
* full standalone card. */
|
|
124
|
+
bare: {
|
|
125
|
+
type: BooleanConstructor;
|
|
126
|
+
default: boolean;
|
|
127
|
+
};
|
|
111
128
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
112
129
|
/** Fired on explicit click or Enter; never with an empty username (or
|
|
113
130
|
* an empty password while `passwordField` is on) or while busy. */
|
|
114
131
|
submit: (_username: string, _password: string) => true;
|
|
115
132
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
133
|
+
/** Card title (shell mode). Unused in `bare` mode — the host owns
|
|
134
|
+
* the shell — but kept in the prop shape for the standalone card. */
|
|
116
135
|
title: {
|
|
117
136
|
type: StringConstructor;
|
|
118
|
-
|
|
137
|
+
default: string;
|
|
119
138
|
};
|
|
120
139
|
subtitle: {
|
|
121
140
|
type: StringConstructor;
|
|
@@ -177,9 +196,18 @@ export declare const HkSignInCard: import("vue").DefineComponent<import("vue").E
|
|
|
177
196
|
type: StringConstructor;
|
|
178
197
|
default: string;
|
|
179
198
|
};
|
|
199
|
+
/** Render ONLY the credential fragment — no HkAuthCard shell, no
|
|
200
|
+
* `top` slot. For hosts that own a stable shell and transition this
|
|
201
|
+
* body inside it (HkLoginFlow's channel swap). Default keeps the
|
|
202
|
+
* full standalone card. */
|
|
203
|
+
bare: {
|
|
204
|
+
type: BooleanConstructor;
|
|
205
|
+
default: boolean;
|
|
206
|
+
};
|
|
180
207
|
}>> & Readonly<{
|
|
181
208
|
onSubmit?: ((_username: string, _password: string) => any) | undefined;
|
|
182
209
|
}>, {
|
|
210
|
+
title: string;
|
|
183
211
|
loading: boolean;
|
|
184
212
|
disabled: boolean;
|
|
185
213
|
subtitle: string;
|
|
@@ -191,4 +219,5 @@ export declare const HkSignInCard: import("vue").DefineComponent<import("vue").E
|
|
|
191
219
|
usernamePlaceholder: string;
|
|
192
220
|
passwordField: boolean;
|
|
193
221
|
initialUsername: string;
|
|
222
|
+
bare: boolean;
|
|
194
223
|
}, {}, {}, {}, 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;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
@@ -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
|
+
});
|