@celestia-island/hikari 0.55.467 → 0.55.468
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/HkHeaderPicker.d.ts +10 -0
- package/dist/types/components/HkLoginFlow.d.ts +105 -40
- package/dist/types/components/HkMfaVerifyCard.d.ts +82 -5
- package/dist/types/composables/useAnchoredTop.d.ts +63 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/mermaid/wasmEngine.d.ts +2 -0
- package/dist/types/scene3d/wasmFleetSpec.d.ts +2 -0
- package/dist/types/utils/qr/qrEncoder.d.ts +12 -1
- package/package.json +1 -1
- package/src/components/HkHeaderPicker.scss +8 -0
- package/src/components/HkHeaderPicker.test.tsx +47 -0
- package/src/components/HkHeaderPicker.tsx +23 -1
- package/src/components/HkLoginFlow.scss +43 -5
- package/src/components/HkLoginFlow.test.tsx +334 -20
- package/src/components/HkLoginFlow.tsx +204 -103
- package/src/components/HkMarkdownRenderer.mermaid.test.tsx +9 -0
- package/src/components/HkMermaidDiagram.race.test.tsx +48 -0
- package/src/components/HkMermaidDiagram.test.tsx +16 -1
- package/src/components/HkMermaidDiagram.tsx +15 -0
- package/src/components/HkMfaVerifyCard.test.ts +138 -1
- package/src/components/HkMfaVerifyCard.tsx +256 -148
- package/src/components/HkQrCode.ready.test.tsx +68 -12
- package/src/components/HkQrCode.tsx +13 -1
- package/src/components/HkStarSystem.test.tsx +5 -0
- package/src/components/HkStarSystem.tsx +51 -31
- package/src/components/__tests__/hkMermaidLayout.test.ts +29 -15
- package/src/components/__tests__/hkMermaidParse.test.ts +23 -12
- package/src/composables/useAnchoredTop.test.ts +264 -0
- package/src/composables/useAnchoredTop.ts +171 -0
- package/src/index.ts +12 -0
- package/src/mermaid/__golden.test.ts +3 -2
- package/src/mermaid/hostSurface.test.ts +9 -2
- package/src/mermaid/mermaidFacadeFault.test.ts +64 -0
- package/src/mermaid/mermaidRetry.test.ts +48 -0
- package/src/mermaid/wasmEngine.test.ts +17 -9
- package/src/mermaid/wasmEngine.ts +51 -20
- package/src/scene3d/__golden.test.ts +3 -2
- package/src/scene3d/holographicFleetScene.test.ts +69 -35
- package/src/scene3d/scene3dFacadeFault.test.ts +64 -0
- package/src/scene3d/scene3dHostSurface.test.ts +9 -2
- package/src/scene3d/scene3dRetry.test.ts +48 -0
- package/src/scene3d/wasmFleetSpec.ts +51 -20
- package/src/utils/qr/qrEncoder.test.ts +11 -6
- package/src/utils/qr/qrEncoder.ts +71 -23
- package/src/utils/qr/qrFacadeFault.test.ts +86 -0
- package/src/utils/qr/qrHostSurface.test.ts +9 -2
- package/src/utils/qr/qrMatrixOrientation.test.ts +3 -2
- package/src/utils/qr/qrRetry.test.ts +48 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PropType } from "vue";
|
|
2
2
|
import { type SelectPanelPlacement } from "./HkSelectPanel";
|
|
3
|
+
import { type TagVariant } from "./HkTag";
|
|
3
4
|
import "./HkHeaderPicker.scss";
|
|
4
5
|
/** One choice of a header picker. The selection surface is the same
|
|
5
6
|
* model as a select's; the three extra flags light the STANDARDIZED
|
|
@@ -21,6 +22,15 @@ export interface HkPickerOption {
|
|
|
21
22
|
* itself never confirms — removal is the HOST's decision; this just
|
|
22
23
|
* makes the affordance uniform. */
|
|
23
24
|
removable?: boolean;
|
|
25
|
+
/** Render the label inside an HkTag: for options whose label IS an
|
|
26
|
+
* identifier (a mailbox address, a handle, a slug) rather than prose —
|
|
27
|
+
* the tag chrome separates the value from the affordances beside it. */
|
|
28
|
+
labelTag?: boolean;
|
|
29
|
+
/** A kind badge rendered as an HkTag after the label ("personal" /
|
|
30
|
+
* "shared", an environment, a tier). The host owns the wording. */
|
|
31
|
+
badge?: string;
|
|
32
|
+
/** Badge tone (defaults to `default`). */
|
|
33
|
+
badgeVariant?: TagVariant;
|
|
24
34
|
}
|
|
25
35
|
/**
|
|
26
36
|
* HkHeaderPicker — the header-centre SELECTOR, the button group's
|
|
@@ -69,29 +69,52 @@ 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 — ONE stable
|
|
72
|
+
* visual — ONE stable card (logo, header copy, the pill segment group
|
|
73
73
|
* hidden when a deployment offers a single channel; a lone dead segment
|
|
74
|
-
* reads as a broken switch) whose body
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* landing as their own PRs) keeps its own auth client and drives the
|
|
81
|
-
* panel through props/events:
|
|
74
|
+
* reads as a broken switch) whose body crossfades and height-morphs, and
|
|
75
|
+
* whose account→verify move is the same in-card swap — while staying a
|
|
76
|
+
* CONTROLLED component: no endpoint, no URL building, no factor ladder
|
|
77
|
+
* policy. Each host (the chest migration plus the erp and arona login
|
|
78
|
+
* surfaces) keeps its own auth client and drives the panel through
|
|
79
|
+
* props/events:
|
|
82
80
|
*
|
|
83
81
|
* - `v-model` (channel key) + `channels` — the segment group.
|
|
84
82
|
* - `step` — `'account' | 'verify'`; the host flips it when its ladder
|
|
85
|
-
* answers with factors, and the
|
|
86
|
-
* (which never renders on an sso channel: a
|
|
87
|
-
* second step by construction — passing
|
|
88
|
-
* channel renders the account
|
|
83
|
+
* answers with factors, and the SAME card swaps its header copy and
|
|
84
|
+
* body over to the step-up (which never renders on an sso channel: a
|
|
85
|
+
* redirect flow has no second step by construction — passing
|
|
86
|
+
* `step="verify"` with an sso channel renders the account body as a
|
|
87
|
+
* fail-safe).
|
|
89
88
|
* - `account-submit(channel, username, password)` — credentials
|
|
90
89
|
* channel submitted (password is empty while `passwordField` is off).
|
|
91
90
|
* - `method-select(channel, key)` — an alternative method row was picked.
|
|
92
91
|
* - `sso-click(channel)` — the primary sso row was picked.
|
|
93
92
|
* - `verify(kind, proof)` / `verify-resend` / `verify-back` — the MFA
|
|
94
|
-
*
|
|
93
|
+
* body's events, re-emitted one level up.
|
|
94
|
+
*
|
|
95
|
+
* Card grammar (2026-11-24 user direction, the reason this file looks
|
|
96
|
+
* the way it does): *"where the content can change inside the card, do
|
|
97
|
+
* not let the whole card fly."* The panel is therefore ONE card frame
|
|
98
|
+
* (`.s-auth-card`) for the whole session:
|
|
99
|
+
*
|
|
100
|
+
* - the frame, its padding and its mount animation belong to the panel,
|
|
101
|
+
* not to a step: the frame node is static, so neither a step nor a
|
|
102
|
+
* channel swap remounts it (a fresh `.s-auth-card` per step replayed
|
|
103
|
+
* the frame's own entrance keyframes and handed the user a second
|
|
104
|
+
* "card appears" animation mid-flow);
|
|
105
|
+
* - the STEP swap crossfades the card's own contents (header copy + body)
|
|
106
|
+
* inside that frame, keyed on the step: the account generation carries
|
|
107
|
+
* the channel tabs over the sign-in body, the verify generation carries
|
|
108
|
+
* the step-up body (`HkMfaVerifyCard bare`);
|
|
109
|
+
* - the CHANNEL swap is a second, NESTED container below the segment
|
|
110
|
+
* group — a channel switch crossfades only the body and leaves the
|
|
111
|
+
* tabs and the header copy mounted (the 2026-11-24 stable-shell
|
|
112
|
+
* direction, unchanged);
|
|
113
|
+
* - the card's TOP edge is pinned while it grows (`useAnchoredTop`):
|
|
114
|
+
* a height morph inside a vertically centered host re-centers the box,
|
|
115
|
+
* which moves the top edge AND the content anchored to it — the
|
|
116
|
+
* literal "the card flies up" in the report. The hook is closed-loop,
|
|
117
|
+
* so a top-anchored host measures zero drift and nothing is written.
|
|
95
118
|
*
|
|
96
119
|
* Copy rules locked by the chest blueprint (LoginView.test.ts, kept
|
|
97
120
|
* verbatim here): segment labels are ALWAYS the panel's own locale keys,
|
|
@@ -102,8 +125,8 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
|
|
|
102
125
|
* still pads the card's methods strip).
|
|
103
126
|
*
|
|
104
127
|
* `initialUsername` rides the account→verify→back round-trip (the
|
|
105
|
-
* credentials
|
|
106
|
-
* name must travel through a prop rather than die with the
|
|
128
|
+
* credentials body remounts when the user navigates back, so the typed
|
|
129
|
+
* name must travel through a prop rather than die with the body).
|
|
107
130
|
*
|
|
108
131
|
* ```tsx
|
|
109
132
|
* <HkLoginFlow
|
|
@@ -129,8 +152,8 @@ export declare const HkLoginFlow: import("vue").DefineComponent<import("vue").Ex
|
|
|
129
152
|
type: StringConstructor;
|
|
130
153
|
required: true;
|
|
131
154
|
};
|
|
132
|
-
/** Flow step: `account` (the channel
|
|
133
|
-
*
|
|
155
|
+
/** Flow step: `account` (the channel bodies) or `verify` (the
|
|
156
|
+
* step-up body). Controlled by the host's ladder state. */
|
|
134
157
|
step: {
|
|
135
158
|
type: PropType<"account" | "verify">;
|
|
136
159
|
default: string;
|
|
@@ -140,28 +163,48 @@ export declare const HkLoginFlow: import("vue").DefineComponent<import("vue").Ex
|
|
|
140
163
|
type: BooleanConstructor;
|
|
141
164
|
default: boolean;
|
|
142
165
|
};
|
|
143
|
-
/** Logo image URL forwarded to the
|
|
166
|
+
/** Logo image URL forwarded to the card header. */
|
|
144
167
|
logoSrc: {
|
|
145
168
|
type: StringConstructor;
|
|
146
169
|
default: undefined;
|
|
147
170
|
};
|
|
148
|
-
/** The
|
|
149
|
-
* channel (2026-11-
|
|
150
|
-
* only the content below the tabs, never dissolve the
|
|
151
|
-
* back to the ACTIVE channel's `title` (then the
|
|
152
|
-
* sign-in copy) for hosts that still brand per channel;
|
|
153
|
-
* per-channel fallbacks then swap as instant text, so
|
|
154
|
-
* hosts should pass this once.
|
|
171
|
+
/** The card's header title on the ACCOUNT step — one stable header
|
|
172
|
+
* across every channel (2026-11-22 user direction: a channel switch
|
|
173
|
+
* must morph only the content below the tabs, never dissolve the
|
|
174
|
+
* card). Falls back to the ACTIVE channel's `title` (then the
|
|
175
|
+
* conventional sign-in copy) for hosts that still brand per channel;
|
|
176
|
+
* distinct per-channel fallbacks then swap as instant text, so
|
|
177
|
+
* multi-channel hosts should pass this once. The VERIFY step derives
|
|
178
|
+
* its own header copy from the step-up vocabulary
|
|
179
|
+
* (`hkMfaVerifyTitle` / `hkMfaVerifySubtitle`) — a sign-in title
|
|
180
|
+
* frozen over a step-up body reads as a stuck page. */
|
|
155
181
|
title: {
|
|
156
182
|
type: StringConstructor;
|
|
157
183
|
default: undefined;
|
|
158
184
|
};
|
|
159
|
-
/** The
|
|
185
|
+
/** The card's header subtitle — same stability contract as `title`. */
|
|
160
186
|
subtitle: {
|
|
161
187
|
type: StringConstructor;
|
|
162
188
|
default: undefined;
|
|
163
189
|
};
|
|
164
|
-
/**
|
|
190
|
+
/** The VERIFY step's header title override. Undefined (the default)
|
|
191
|
+
* takes the step-up vocabulary through `hkMfaVerifyTitle`, i.e. what
|
|
192
|
+
* the standalone step-up card has always said — the flow does NOT
|
|
193
|
+
* reuse `title` here (a sign-in title frozen over a step-up body
|
|
194
|
+
* reads as a stuck page), but a host that brands its panel must be
|
|
195
|
+
* able to brand BOTH steps, or the header contradicts the marketing
|
|
196
|
+
* copy on the second one. */
|
|
197
|
+
verifyTitle: {
|
|
198
|
+
type: StringConstructor;
|
|
199
|
+
default: undefined;
|
|
200
|
+
};
|
|
201
|
+
/** The verify step's header subtitle override (see `verifyTitle`);
|
|
202
|
+
* the `{name}` / `{proven}` interpolation still applies. */
|
|
203
|
+
verifySubtitle: {
|
|
204
|
+
type: StringConstructor;
|
|
205
|
+
default: undefined;
|
|
206
|
+
};
|
|
207
|
+
/** Seed for the credentials body's username field — survives the
|
|
165
208
|
* verify round-trip (see HkSignInCard.initialUsername). */
|
|
166
209
|
initialUsername: {
|
|
167
210
|
type: StringConstructor;
|
|
@@ -211,8 +254,8 @@ export declare const HkLoginFlow: import("vue").DefineComponent<import("vue").Ex
|
|
|
211
254
|
type: StringConstructor;
|
|
212
255
|
required: true;
|
|
213
256
|
};
|
|
214
|
-
/** Flow step: `account` (the channel
|
|
215
|
-
*
|
|
257
|
+
/** Flow step: `account` (the channel bodies) or `verify` (the
|
|
258
|
+
* step-up body). Controlled by the host's ladder state. */
|
|
216
259
|
step: {
|
|
217
260
|
type: PropType<"account" | "verify">;
|
|
218
261
|
default: string;
|
|
@@ -222,28 +265,48 @@ export declare const HkLoginFlow: import("vue").DefineComponent<import("vue").Ex
|
|
|
222
265
|
type: BooleanConstructor;
|
|
223
266
|
default: boolean;
|
|
224
267
|
};
|
|
225
|
-
/** Logo image URL forwarded to the
|
|
268
|
+
/** Logo image URL forwarded to the card header. */
|
|
226
269
|
logoSrc: {
|
|
227
270
|
type: StringConstructor;
|
|
228
271
|
default: undefined;
|
|
229
272
|
};
|
|
230
|
-
/** The
|
|
231
|
-
* channel (2026-11-
|
|
232
|
-
* only the content below the tabs, never dissolve the
|
|
233
|
-
* back to the ACTIVE channel's `title` (then the
|
|
234
|
-
* sign-in copy) for hosts that still brand per channel;
|
|
235
|
-
* per-channel fallbacks then swap as instant text, so
|
|
236
|
-
* hosts should pass this once.
|
|
273
|
+
/** The card's header title on the ACCOUNT step — one stable header
|
|
274
|
+
* across every channel (2026-11-22 user direction: a channel switch
|
|
275
|
+
* must morph only the content below the tabs, never dissolve the
|
|
276
|
+
* card). Falls back to the ACTIVE channel's `title` (then the
|
|
277
|
+
* conventional sign-in copy) for hosts that still brand per channel;
|
|
278
|
+
* distinct per-channel fallbacks then swap as instant text, so
|
|
279
|
+
* multi-channel hosts should pass this once. The VERIFY step derives
|
|
280
|
+
* its own header copy from the step-up vocabulary
|
|
281
|
+
* (`hkMfaVerifyTitle` / `hkMfaVerifySubtitle`) — a sign-in title
|
|
282
|
+
* frozen over a step-up body reads as a stuck page. */
|
|
237
283
|
title: {
|
|
238
284
|
type: StringConstructor;
|
|
239
285
|
default: undefined;
|
|
240
286
|
};
|
|
241
|
-
/** The
|
|
287
|
+
/** The card's header subtitle — same stability contract as `title`. */
|
|
242
288
|
subtitle: {
|
|
243
289
|
type: StringConstructor;
|
|
244
290
|
default: undefined;
|
|
245
291
|
};
|
|
246
|
-
/**
|
|
292
|
+
/** The VERIFY step's header title override. Undefined (the default)
|
|
293
|
+
* takes the step-up vocabulary through `hkMfaVerifyTitle`, i.e. what
|
|
294
|
+
* the standalone step-up card has always said — the flow does NOT
|
|
295
|
+
* reuse `title` here (a sign-in title frozen over a step-up body
|
|
296
|
+
* reads as a stuck page), but a host that brands its panel must be
|
|
297
|
+
* able to brand BOTH steps, or the header contradicts the marketing
|
|
298
|
+
* copy on the second one. */
|
|
299
|
+
verifyTitle: {
|
|
300
|
+
type: StringConstructor;
|
|
301
|
+
default: undefined;
|
|
302
|
+
};
|
|
303
|
+
/** The verify step's header subtitle override (see `verifyTitle`);
|
|
304
|
+
* the `{name}` / `{proven}` interpolation still applies. */
|
|
305
|
+
verifySubtitle: {
|
|
306
|
+
type: StringConstructor;
|
|
307
|
+
default: undefined;
|
|
308
|
+
};
|
|
309
|
+
/** Seed for the credentials body's username field — survives the
|
|
247
310
|
* verify round-trip (see HkSignInCard.initialUsername). */
|
|
248
311
|
initialUsername: {
|
|
249
312
|
type: StringConstructor;
|
|
@@ -289,6 +352,8 @@ export declare const HkLoginFlow: import("vue").DefineComponent<import("vue").Ex
|
|
|
289
352
|
logoSrc: string;
|
|
290
353
|
initialUsername: string;
|
|
291
354
|
passkeyRetryHint: string;
|
|
355
|
+
verifyTitle: string;
|
|
356
|
+
verifySubtitle: string;
|
|
292
357
|
verifyFactors: readonly string[];
|
|
293
358
|
verifyProven: string;
|
|
294
359
|
verifyAccountName: string;
|
|
@@ -16,6 +16,36 @@ export declare function hkIsMfaFactor(kind: string): kind is HkMfaFactor;
|
|
|
16
16
|
* stronger factor exists. Returns null when nothing verifiable remains
|
|
17
17
|
* (an empty list, or everything already proven). */
|
|
18
18
|
export declare function hkPreferredMfaFactor(factors: readonly string[]): HkMfaFactor | null;
|
|
19
|
+
/** The i18n lookup this module's copy helpers need (structurally what
|
|
20
|
+
* `useI18n().t` returns, so a host shell can borrow it without owning
|
|
21
|
+
* this component's setup). */
|
|
22
|
+
export type HkMfaTranslate = (key: string, fallback?: string) => string;
|
|
23
|
+
/** Locale label of one factor. Exported with the copy helpers so a host
|
|
24
|
+
* shell that renders the verify HEADER itself (the bare mode below, used
|
|
25
|
+
* by HkLoginFlow's in-card step swap) names the already-proven factor
|
|
26
|
+
* with the exact same wording the card's own picker tooltip uses. */
|
|
27
|
+
export declare function hkMfaFactorLabel(t: HkMfaTranslate, kind: HkMfaFactor): string;
|
|
28
|
+
/**
|
|
29
|
+
* The verify step's HEADER copy, derived from exactly the inputs the
|
|
30
|
+
* component's own shell derives it from — exported so a host that owns
|
|
31
|
+
* the card frame (bare mode) renders the identical title/subtitle. Two
|
|
32
|
+
* copies of this derivation is how the header and the card body drift
|
|
33
|
+
* apart (the step-two wording changes with `proven`, and the generic
|
|
34
|
+
* subtitle changes with the account name).
|
|
35
|
+
*
|
|
36
|
+
* `title` / `subtitle` overrides win, mirroring the props of the same
|
|
37
|
+
* name; pass `undefined` to take the derived copy.
|
|
38
|
+
*/
|
|
39
|
+
export declare function hkMfaVerifyTitle(t: HkMfaTranslate, options?: {
|
|
40
|
+
title?: string;
|
|
41
|
+
proven?: string | null;
|
|
42
|
+
}): string;
|
|
43
|
+
/** The verify step's subtitle (see hkMfaVerifyTitle). */
|
|
44
|
+
export declare function hkMfaVerifySubtitle(t: HkMfaTranslate, options?: {
|
|
45
|
+
subtitle?: string;
|
|
46
|
+
proven?: string | null;
|
|
47
|
+
accountName?: string;
|
|
48
|
+
}): string;
|
|
19
49
|
/**
|
|
20
50
|
* HkMfaVerifyCard — the shared second-factor ("verify account", step-up)
|
|
21
51
|
* card for every Celestia front end: the factor picker (slider icon
|
|
@@ -112,12 +142,35 @@ export declare const HkMfaVerifyCard: import("vue").DefineComponent<import("vue"
|
|
|
112
142
|
type: StringConstructor;
|
|
113
143
|
default: undefined;
|
|
114
144
|
};
|
|
115
|
-
/** Focus the
|
|
116
|
-
* opened)
|
|
145
|
+
/** Focus the factor ON STAGE when the card mounts (the verify step
|
|
146
|
+
* just opened) and whenever the selected factor changes: the proof
|
|
147
|
+
* field for `totp` / `sms` (HkOtpInput owns that one) / `password`,
|
|
148
|
+
* or the passkey action for a factor with no field at all. A card
|
|
149
|
+
* that only focused its text fields left the caret on `<body>` for a
|
|
150
|
+
* passkey-only account — and a host swapping this card in for
|
|
151
|
+
* another body (HkLoginFlow's step swap) then had nowhere to hand
|
|
152
|
+
* focus to. */
|
|
117
153
|
autofocus: {
|
|
118
154
|
type: BooleanConstructor;
|
|
119
155
|
default: boolean;
|
|
120
156
|
};
|
|
157
|
+
/** Render ONLY the step-up body — the factor picker, the proof field,
|
|
158
|
+
* the submit and the back action, with NO HkAuthCard shell (no card
|
|
159
|
+
* frame, no header): for a host that owns a stable card and swaps
|
|
160
|
+
* this body inside it. HkLoginFlow is the consumer that needs it —
|
|
161
|
+
* its account→verify move is a swap INSIDE one card (2026-11-24 user
|
|
162
|
+
* direction: "where the content can change inside the card, do not
|
|
163
|
+
* let the whole card fly"), so the header copy comes from the host
|
|
164
|
+
* (`hkMfaVerifyTitle` / `hkMfaVerifySubtitle`, the exact derivation
|
|
165
|
+
* this card's own shell uses) and the frame stays put. The body
|
|
166
|
+
* renders as a bare fragment so the host's `.s-auth-form` block keeps
|
|
167
|
+
* owning the column rhythm. Read once at setup (a static shape, like
|
|
168
|
+
* HkSignInCard's bare / HkAuthCard's smoothHeight): toggle it by
|
|
169
|
+
* remounting, not by flipping a ref. */
|
|
170
|
+
bare: {
|
|
171
|
+
type: BooleanConstructor;
|
|
172
|
+
default: boolean;
|
|
173
|
+
};
|
|
121
174
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
122
175
|
/** The user asks to prove `kind`; `proof` is the password text, the
|
|
123
176
|
* composed code, or "" for passkey (the ceremony is consumer-side). */
|
|
@@ -183,12 +236,35 @@ export declare const HkMfaVerifyCard: import("vue").DefineComponent<import("vue"
|
|
|
183
236
|
type: StringConstructor;
|
|
184
237
|
default: undefined;
|
|
185
238
|
};
|
|
186
|
-
/** Focus the
|
|
187
|
-
* opened)
|
|
239
|
+
/** Focus the factor ON STAGE when the card mounts (the verify step
|
|
240
|
+
* just opened) and whenever the selected factor changes: the proof
|
|
241
|
+
* field for `totp` / `sms` (HkOtpInput owns that one) / `password`,
|
|
242
|
+
* or the passkey action for a factor with no field at all. A card
|
|
243
|
+
* that only focused its text fields left the caret on `<body>` for a
|
|
244
|
+
* passkey-only account — and a host swapping this card in for
|
|
245
|
+
* another body (HkLoginFlow's step swap) then had nowhere to hand
|
|
246
|
+
* focus to. */
|
|
188
247
|
autofocus: {
|
|
189
248
|
type: BooleanConstructor;
|
|
190
249
|
default: boolean;
|
|
191
250
|
};
|
|
251
|
+
/** Render ONLY the step-up body — the factor picker, the proof field,
|
|
252
|
+
* the submit and the back action, with NO HkAuthCard shell (no card
|
|
253
|
+
* frame, no header): for a host that owns a stable card and swaps
|
|
254
|
+
* this body inside it. HkLoginFlow is the consumer that needs it —
|
|
255
|
+
* its account→verify move is a swap INSIDE one card (2026-11-24 user
|
|
256
|
+
* direction: "where the content can change inside the card, do not
|
|
257
|
+
* let the whole card fly"), so the header copy comes from the host
|
|
258
|
+
* (`hkMfaVerifyTitle` / `hkMfaVerifySubtitle`, the exact derivation
|
|
259
|
+
* this card's own shell uses) and the frame stays put. The body
|
|
260
|
+
* renders as a bare fragment so the host's `.s-auth-form` block keeps
|
|
261
|
+
* owning the column rhythm. Read once at setup (a static shape, like
|
|
262
|
+
* HkSignInCard's bare / HkAuthCard's smoothHeight): toggle it by
|
|
263
|
+
* remounting, not by flipping a ref. */
|
|
264
|
+
bare: {
|
|
265
|
+
type: BooleanConstructor;
|
|
266
|
+
default: boolean;
|
|
267
|
+
};
|
|
192
268
|
}>> & Readonly<{
|
|
193
269
|
onBack?: (() => any) | undefined;
|
|
194
270
|
onVerify?: ((_kind: "password" | "passkey" | "totp" | "sms", _proof: string) => any) | undefined;
|
|
@@ -200,8 +276,9 @@ export declare const HkMfaVerifyCard: import("vue").DefineComponent<import("vue"
|
|
|
200
276
|
subtitle: string;
|
|
201
277
|
autofocus: boolean;
|
|
202
278
|
logoSrc: string;
|
|
203
|
-
|
|
279
|
+
bare: boolean;
|
|
204
280
|
proven: string;
|
|
281
|
+
factors: readonly string[];
|
|
205
282
|
accountName: string;
|
|
206
283
|
resending: boolean;
|
|
207
284
|
passkeyRetryHint: string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* One correction step of the anchor loop, pure so tests can pin the
|
|
4
|
+
* arithmetic without a layout engine:
|
|
5
|
+
*
|
|
6
|
+
* `renderedTop` is the element's CURRENT viewport top (transforms
|
|
7
|
+
* included), `anchorTop` the top the block is pinned to, `shift` the
|
|
8
|
+
* translate the wrapper already carries. The returned shift is the one
|
|
9
|
+
* that puts the rendered top back on `anchorTop` in a single step, and
|
|
10
|
+
* the formula is incremental (`shift + delta`) so a partial correction
|
|
11
|
+
* (measurement taken mid-frame) still converges instead of overshooting.
|
|
12
|
+
*/
|
|
13
|
+
export declare function nextAnchorShift(shift: number, renderedTop: number, anchorTop: number): number;
|
|
14
|
+
/** Whether a measured drift is worth a correction (see REST_EPSILON_PX). */
|
|
15
|
+
export declare function needsAnchorCorrection(renderedTop: number, anchorTop: number): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* useAnchoredTop — keep a centered block's TOP EDGE still while its
|
|
18
|
+
* height changes.
|
|
19
|
+
*
|
|
20
|
+
* The problem it exists for (2026-11-24 user report — "the whole card
|
|
21
|
+
* flies up when I go from sign-in to verify-account"): a block that the
|
|
22
|
+
* host centers vertically (`align-items: center`, `place-items: center`,
|
|
23
|
+
* `margin: auto`) is re-centered on EVERY layout pass, so a height morph
|
|
24
|
+
* moves both edges — the top edge climbs by half the growth while the
|
|
25
|
+
* content, anchored to the top, travels with it. The user reads that as
|
|
26
|
+
* the card flying; nothing in CSS can express "grow downward only" for a
|
|
27
|
+
* box whose position is owned by its parent's centering.
|
|
28
|
+
*
|
|
29
|
+
* How it works: a ResizeObserver on `target` fires on size changes (the
|
|
30
|
+
* observer delivers once per frame at most, so a smooth growth arrives as
|
|
31
|
+
* a stream of frames, each corrected before it paints), the element's
|
|
32
|
+
* current viewport top is compared against the top
|
|
33
|
+
* recorded at rest, and the difference is folded into a `translateY` on
|
|
34
|
+
* the SAME element — painting it back onto its resting top. Consequences
|
|
35
|
+
* worth knowing:
|
|
36
|
+
*
|
|
37
|
+
* - It is CLOSED-LOOP, so it needs no knowledge of the host: a
|
|
38
|
+
* top-anchored layout simply never drifts, the measured delta stays 0
|
|
39
|
+
* and no transform is ever written (the hook is a no-op there rather
|
|
40
|
+
* than a second opinion on the layout).
|
|
41
|
+
* - The transform is paint-only: it never feeds back into layout, so the
|
|
42
|
+
* loop cannot oscillate and the correction is exact after one step.
|
|
43
|
+
* - The shift is kept (not released) when the morph settles: the held
|
|
44
|
+
* offset is part of the resting arrangement now, and dropping it would
|
|
45
|
+
* move the block by that offset the next time it re-enters the
|
|
46
|
+
* measurement path. It therefore ACCUMULATES across swaps, and a
|
|
47
|
+
* symmetric pair returns it to where it started only when both legs are
|
|
48
|
+
* measured the same way — the shipped symmetric swaps (account → verify
|
|
49
|
+
* → account, channel A → B → A) do, verified on the browser rig, but
|
|
50
|
+
* that is an observation about those swaps, not a theorem: an asymmetric
|
|
51
|
+
* series can leave a residual offset of at most half the largest height
|
|
52
|
+
* delta seen so far.
|
|
53
|
+
* - At rest the anchor re-bases to wherever the block actually sits, so a
|
|
54
|
+
* legitimate re-position (viewport resize, a line above the block
|
|
55
|
+
* appearing, a late webfont reflow) is adopted instead of being fought.
|
|
56
|
+
* - No ResizeObserver / no layout engine (SSR, jsdom): the hook is a
|
|
57
|
+
* no-op — a block that never animates never drifts, so there is nothing
|
|
58
|
+
* to correct.
|
|
59
|
+
*/
|
|
60
|
+
export declare function useAnchoredTop(target: Ref<HTMLElement | null>, options?: {
|
|
61
|
+
enabled?: () => boolean;
|
|
62
|
+
}): void;
|
|
63
|
+
export default useAnchoredTop;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -194,6 +194,7 @@ export { useDeferredTransition } from "./composables/useDeferredTransition";
|
|
|
194
194
|
export { useSurfaceTransition } from "./composables/useSurfaceTransition";
|
|
195
195
|
export { useSizeMorph } from "./composables/useSizeMorph";
|
|
196
196
|
export type { SizeMorph } from "./composables/useSizeMorph";
|
|
197
|
+
export { useAnchoredTop } from "./composables/useAnchoredTop";
|
|
197
198
|
export { useImage } from "./composables/useImage";
|
|
198
199
|
export type { ImageStatus, UseImageReturn } from "./composables/useImage";
|
|
199
200
|
export { useZoomPan } from "./composables/useZoomPan";
|
|
@@ -239,7 +240,7 @@ export { default as HAuthMethodList } from "./components/HkAuthMethodList";
|
|
|
239
240
|
export { HkSignInCard as HSignInCard } from "./components/HkSignInCard";
|
|
240
241
|
export { HkThirdPartySignInCard as HThirdPartySignInCard } from "./components/HkThirdPartySignInCard";
|
|
241
242
|
export { default as HAuthSubmitButton } from "./components/HkAuthSubmitButton";
|
|
242
|
-
export { HkMfaVerifyCard as HMfaVerifyCard, hkIsMfaFactor as isMfaFactor, hkPreferredMfaFactor as preferredMfaFactor, type HkMfaFactor as MfaFactor, } from "./components/HkMfaVerifyCard";
|
|
243
|
+
export { HkMfaVerifyCard as HMfaVerifyCard, hkIsMfaFactor as isMfaFactor, hkPreferredMfaFactor as preferredMfaFactor, hkMfaVerifyTitle as mfaVerifyTitle, hkMfaVerifySubtitle as mfaVerifySubtitle, type HkMfaFactor as MfaFactor, } from "./components/HkMfaVerifyCard";
|
|
243
244
|
export { usePageTitle, useRouteTitle } from "./composables/usePageTitle";
|
|
244
245
|
export { provideActionBar, useActionBar, PageActionSlot, orderActionRegistrations } from "./composables/useActionBar";
|
|
245
246
|
export { useActionBarCenter } from "./composables/useActionBar";
|
|
@@ -487,6 +488,7 @@ export { HkSignInCard as HkSignInCard } from "./components/HkSignInCard";
|
|
|
487
488
|
export { HkThirdPartySignInCard as HkThirdPartySignInCard } from "./components/HkThirdPartySignInCard";
|
|
488
489
|
export { HkMfaVerifyCard as HkMfaVerifyCard } from "./components/HkMfaVerifyCard";
|
|
489
490
|
export { type HkMfaFactor as HkMfaFactor } from "./components/HkMfaVerifyCard";
|
|
491
|
+
export { hkMfaVerifyTitle as hkMfaVerifyTitle, hkMfaVerifySubtitle as hkMfaVerifySubtitle, hkMfaFactorLabel as hkMfaFactorLabel, type HkMfaTranslate as HkMfaTranslate, } from "./components/HkMfaVerifyCard";
|
|
490
492
|
export { HkAuthScreen as HkAuthScreen } from "./components/HkAuthScreen";
|
|
491
493
|
export { type HkAuthScreenBeianEntry as HkAuthScreenBeianEntry } from "./components/HkAuthScreen";
|
|
492
494
|
export { HkLoginFlow as HkLoginFlow } from "./components/HkLoginFlow";
|
|
@@ -10,6 +10,8 @@ export declare class MermaidNotReadyError extends Error {
|
|
|
10
10
|
constructor(cause?: unknown);
|
|
11
11
|
}
|
|
12
12
|
/** Resolves once the component is usable; rejects if it could not be built. */
|
|
13
|
+
export declare function whenMermaidReady(): Promise<void>;
|
|
14
|
+
/** Snapshot of the first attempt, kept for callers that only want a value. */
|
|
13
15
|
export declare const mermaidReady: Promise<void>;
|
|
14
16
|
/** Keeps the declaration module live for bundlers that honour `sideEffects`. */
|
|
15
17
|
export declare const mermaidCapabilities: {
|
|
@@ -5,6 +5,8 @@ export declare class Scene3dNotReadyError extends Error {
|
|
|
5
5
|
constructor(cause?: unknown);
|
|
6
6
|
}
|
|
7
7
|
/** Resolves once the component is usable; rejects if it could not be built. */
|
|
8
|
+
export declare function whenScene3dReady(): Promise<void>;
|
|
9
|
+
/** Snapshot of the first attempt, kept for callers that only want a value. */
|
|
8
10
|
export declare const scene3dReady: Promise<void>;
|
|
9
11
|
/** Keeps the declaration module live for bundlers that honour `sideEffects`. */
|
|
10
12
|
export declare const scene3dCapabilities: {
|
|
@@ -10,7 +10,18 @@ export interface QrMatrixOptions {
|
|
|
10
10
|
export declare class QrNotReadyError extends Error {
|
|
11
11
|
constructor(cause?: unknown);
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Resolves once the component is usable; rejects if it could not be built.
|
|
15
|
+
*
|
|
16
|
+
* Safe to ignore for the common path — `qrMatrix` works without waiting — but
|
|
17
|
+
* a host that can wait (`HkQrCode` re-draws on it) should.
|
|
18
|
+
*
|
|
19
|
+
* Derived lazily rather than captured once: a failed attempt clears the cached
|
|
20
|
+
* promise so a later host can retry, and this getter then reflects that attempt
|
|
21
|
+
* instead of replaying the first rejection for the rest of the session.
|
|
22
|
+
*/
|
|
23
|
+
export declare function whenQrReady(): Promise<void>;
|
|
24
|
+
/** Snapshot of the first attempt, kept for callers that only want a value. */
|
|
14
25
|
export declare const qrReady: Promise<void>;
|
|
15
26
|
/** Keeps the declaration module live for bundlers that honour `sideEffects`. */
|
|
16
27
|
export declare const qrCapabilities: {
|
package/package.json
CHANGED
|
@@ -75,10 +75,18 @@
|
|
|
75
75
|
justify-content: space-between;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
.hk-header-picker-option-group {
|
|
79
|
+
display: inline-flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: var(--space-6, 0.375rem);
|
|
82
|
+
min-width: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
78
85
|
.hk-header-picker-option-label {
|
|
79
86
|
overflow: hidden;
|
|
80
87
|
text-overflow: ellipsis;
|
|
81
88
|
white-space: nowrap;
|
|
89
|
+
min-width: 0;
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
.hk-header-picker-option-actions {
|
|
@@ -178,6 +178,53 @@ describe("HkHeaderPicker", () => {
|
|
|
178
178
|
expect(scss).toContain("max-width: var(--hk-header-picker-max-w, 16rem);");
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
+
it("wraps an identifier label in a tag and shows the kind badge", async () => {
|
|
182
|
+
// A mailbox address / handle is an IDENTIFIER, not prose: the tag
|
|
183
|
+
// chrome separates it from the affordances beside it, and the badge
|
|
184
|
+
// names what kind of thing it is. The host owns both the wording and
|
|
185
|
+
// the tone.
|
|
186
|
+
const c = mountPicker({}, {});
|
|
187
|
+
(c.querySelector("button.hk-select-trigger") as HTMLElement).click();
|
|
188
|
+
await vi.waitFor(() => {
|
|
189
|
+
expect(document.querySelectorAll(".hk-header-picker-option").length).toBe(3);
|
|
190
|
+
});
|
|
191
|
+
// …but THIS host passes neither flag, so the family default (plain
|
|
192
|
+
// text, no badge) must be untouched.
|
|
193
|
+
const plainRow = document.querySelector(".hk-header-picker-option")!;
|
|
194
|
+
expect(plainRow.querySelector(".hk-tag")).toBeNull();
|
|
195
|
+
void c;
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it("renders labelTag and badge when the option asks for them", async () => {
|
|
199
|
+
const c = mountPicker(
|
|
200
|
+
{
|
|
201
|
+
modelValue: "a@example.test",
|
|
202
|
+
options: [
|
|
203
|
+
{
|
|
204
|
+
value: "a@example.test",
|
|
205
|
+
label: "a@example.test",
|
|
206
|
+
labelTag: true,
|
|
207
|
+
badge: "personal",
|
|
208
|
+
badgeVariant: "primary",
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
{},
|
|
213
|
+
);
|
|
214
|
+
(c.querySelector("button.hk-select-trigger") as HTMLElement).click();
|
|
215
|
+
await vi.waitFor(() => {
|
|
216
|
+
expect(document.querySelectorAll(".hk-header-picker-option").length).toBe(1);
|
|
217
|
+
});
|
|
218
|
+
const row = document.querySelector(".hk-header-picker-option")!;
|
|
219
|
+
const tags = Array.from(row.querySelectorAll(".hk-tag"));
|
|
220
|
+
expect(tags.length, "the label tag plus the badge").toBe(2);
|
|
221
|
+
expect(tags[0].textContent?.trim()).toBe("a@example.test");
|
|
222
|
+
expect(tags[1].textContent?.trim()).toBe("personal");
|
|
223
|
+
expect(tags[1].className).toContain("hk-tag-primary");
|
|
224
|
+
// Both ride the leading group, so the action lane keeps the far edge.
|
|
225
|
+
expect(row.querySelector(".hk-header-picker-option-group .hk-tag")).toBeTruthy();
|
|
226
|
+
});
|
|
227
|
+
|
|
181
228
|
it("disables the trigger when disabled", () => {
|
|
182
229
|
const c = mountPicker({ disabled: true }, {});
|
|
183
230
|
expect(
|
|
@@ -13,6 +13,7 @@ import { useBreakpoint } from "../runtime/useBreakpoint";
|
|
|
13
13
|
import HkDraggableList from "./HkDraggableList";
|
|
14
14
|
import HkIconButton from "./HkIconButton";
|
|
15
15
|
import HkSelectPanel, { type SelectPanelPlacement } from "./HkSelectPanel";
|
|
16
|
+
import HkTag, { type TagVariant } from "./HkTag";
|
|
16
17
|
import "./HkHeaderPicker.scss";
|
|
17
18
|
|
|
18
19
|
/** One choice of a header picker. The selection surface is the same
|
|
@@ -35,6 +36,15 @@ export interface HkPickerOption {
|
|
|
35
36
|
* itself never confirms — removal is the HOST's decision; this just
|
|
36
37
|
* makes the affordance uniform. */
|
|
37
38
|
removable?: boolean;
|
|
39
|
+
/** Render the label inside an HkTag: for options whose label IS an
|
|
40
|
+
* identifier (a mailbox address, a handle, a slug) rather than prose —
|
|
41
|
+
* the tag chrome separates the value from the affordances beside it. */
|
|
42
|
+
labelTag?: boolean;
|
|
43
|
+
/** A kind badge rendered as an HkTag after the label ("personal" /
|
|
44
|
+
* "shared", an environment, a tier). The host owns the wording. */
|
|
45
|
+
badge?: string;
|
|
46
|
+
/** Badge tone (defaults to `default`). */
|
|
47
|
+
badgeVariant?: TagVariant;
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
/**
|
|
@@ -233,7 +243,19 @@ export default defineComponent({
|
|
|
233
243
|
? { onPointerenter: () => { highlightedIndex.value = i; } }
|
|
234
244
|
: {})}
|
|
235
245
|
>
|
|
236
|
-
|
|
246
|
+
{/* Label and badge travel together on the leading edge; the
|
|
247
|
+
* action lane keeps the trailing edge (the row's space-between
|
|
248
|
+
* would otherwise park a bare badge in the middle). */}
|
|
249
|
+
<span class="hk-header-picker-option-group">
|
|
250
|
+
<span class="hk-header-picker-option-label">
|
|
251
|
+
{opt.labelTag ? <HkTag size="sm">{opt.label}</HkTag> : opt.label}
|
|
252
|
+
</span>
|
|
253
|
+
{opt.badge ? (
|
|
254
|
+
<HkTag size="sm" variant={opt.badgeVariant ?? "default"}>
|
|
255
|
+
{opt.badge}
|
|
256
|
+
</HkTag>
|
|
257
|
+
) : null}
|
|
258
|
+
</span>
|
|
237
259
|
<span class="hk-header-picker-option-actions">
|
|
238
260
|
{opt.editable && (
|
|
239
261
|
<HkIconButton
|