@celestia-island/hikari 0.55.460 → 0.55.461
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/HkLoginFlow.d.ts +42 -6
- package/dist/types/components/HkSignInCard.d.ts +31 -2
- package/package.json +1 -1
- package/src/components/HkLoginFlow.test.tsx +225 -14
- package/src/components/HkLoginFlow.tsx +149 -97
- package/src/components/HkSignInCard.test.ts +43 -0
- package/src/components/HkSignInCard.tsx +96 -54
- package/src/styles/admin-tokens.scss +15 -0
|
@@ -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;
|
|
@@ -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>;
|
package/package.json
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
1
5
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
6
|
import { createApp, defineComponent, h, nextTick, ref } from "vue";
|
|
3
7
|
|
|
@@ -334,7 +338,7 @@ describe("HkLoginFlow — verify step", () => {
|
|
|
334
338
|
expect(c.querySelector(".hk-tabs")).toBeNull();
|
|
335
339
|
});
|
|
336
340
|
|
|
337
|
-
it("
|
|
341
|
+
it("morphs account → verify → back when the host flips the step prop reactively", async () => {
|
|
338
342
|
// The host mirrors every real consumer: reactive state read INSIDE
|
|
339
343
|
// the render function, so each change re-evaluates the props. (A
|
|
340
344
|
// one-shot `h()` snapshot VNode never updates — re-mounting such a
|
|
@@ -364,21 +368,228 @@ describe("HkLoginFlow — verify step", () => {
|
|
|
364
368
|
|
|
365
369
|
step.value = "account";
|
|
366
370
|
for (let i = 0; i < 12; i++) await nextTick();
|
|
367
|
-
// The account
|
|
368
|
-
//
|
|
369
|
-
//
|
|
370
|
-
// the
|
|
371
|
-
//
|
|
372
|
-
//
|
|
373
|
-
|
|
374
|
-
|
|
371
|
+
// The account shell comes back. Scope the assertion to the OUTER
|
|
372
|
+
// tier's DIRECT stage items (`.hk-login-flow > .hk-tc > …`) — the
|
|
373
|
+
// union of every crossfade item in the subtree is unfalsifiable
|
|
374
|
+
// (the inner items ride inside the settled account item, so a
|
|
375
|
+
// stuck-outer mutation can never turn this red; the forward leg's
|
|
376
|
+
// OTP-presence check carries the teeth for that mutation).
|
|
377
|
+
// MUT:r1487-outer-key-channel (R7 M1: keying the outer container on
|
|
378
|
+
// the channel makes `dataset.crossfadeKey` read "account:cloud" here
|
|
379
|
+
// and this assertion goes red).
|
|
380
|
+
const outerSettled = Array.from(
|
|
381
|
+
c.querySelectorAll(
|
|
382
|
+
".hk-login-flow > .hk-tc > .hk-tc-stage > .hk-crossfade > .hk-crossfade-item"
|
|
383
|
+
+ ":not(.hk-crossfade-leave-active):not(.hk-crossfade-leave-to)",
|
|
384
|
+
),
|
|
385
|
+
);
|
|
386
|
+
expect(outerSettled.length).toBe(1);
|
|
387
|
+
expect((outerSettled[0] as HTMLElement).dataset.crossfadeKey).toBe("account");
|
|
388
|
+
expect(outerSettled[0]!.querySelector('input[name="signin-username"]')).not.toBeNull();
|
|
389
|
+
expect(outerSettled[0]!.querySelector(".hk-otp-cell")).toBeNull();
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
describe("HkLoginFlow — stable shell channel swap (2026-11-24 user direction)", () => { // "Switching the top segment group only crossfades the content below
|
|
394
|
+
// it and morphs the height — use the library's existing component, do
|
|
395
|
+
// not destroy the whole card." The pins below are ELEMENT-IDENTITY
|
|
396
|
+
// assertions: if the shell (or the tabs, or the header) remounts on a
|
|
397
|
+
// channel switch, the captured element nodes go stale and the test
|
|
398
|
+
// fails — the exact regression the direction forbids.
|
|
399
|
+
|
|
400
|
+
function mountTwoChannel(channel: "cloud" | "org") {
|
|
401
|
+
const active = ref<"cloud" | "org">(channel);
|
|
402
|
+
const Host = defineComponent({
|
|
403
|
+
setup: () => () =>
|
|
404
|
+
h(HkLoginFlow, {
|
|
405
|
+
channels: [cloudChannel, orgChannel],
|
|
406
|
+
modelValue: active.value,
|
|
407
|
+
title: "Sign in",
|
|
408
|
+
subtitle: "Console",
|
|
409
|
+
"onUpdate:modelValue": (key: string) => {
|
|
410
|
+
active.value = key as "cloud" | "org";
|
|
411
|
+
},
|
|
412
|
+
}),
|
|
413
|
+
});
|
|
414
|
+
return { container: mount(h(Host)), active };
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
it("keeps the shell, header and tabs mounted while only the body swaps", async () => {
|
|
418
|
+
const { container, active } = mountTwoChannel("cloud");
|
|
419
|
+
const tabsBefore = container.querySelector(".hk-tabs");
|
|
420
|
+
const titleBefore = container.querySelector(".s-auth-title");
|
|
421
|
+
const logoSlotBefore = container.querySelector(".s-auth-header");
|
|
422
|
+
expect(tabsBefore).not.toBeNull();
|
|
423
|
+
expect(titleBefore?.textContent).toBe("Sign in");
|
|
424
|
+
// Exactly ONE card — the shell. A silently-ignored `bare` mode
|
|
425
|
+
// (HkSignInCard wrapping its own card inside the shell) shows up
|
|
426
|
+
// as a second .s-auth-card / .s-auth-form here.
|
|
427
|
+
// MUT:r1487-bare-ignored (deleting HkSignInCard's bare return
|
|
428
|
+
// makes this count 2 and the nested selector non-null).
|
|
429
|
+
expect(container.querySelectorAll(".s-auth-card")).toHaveLength(1);
|
|
430
|
+
expect(container.querySelector(".s-auth-card .s-auth-card")).toBeNull();
|
|
431
|
+
expect(container.querySelectorAll(".s-auth-form")).toHaveLength(1);
|
|
432
|
+
// The shell opts OUT of HkAuthCard's own smooth-height wrapper: the
|
|
433
|
+
// inner container owns the height choreography, and a second
|
|
434
|
+
// measuring wrapper would chain its 300ms transition after the
|
|
435
|
+
// container's (a telescoping double-morph). smoothHeight={false}
|
|
436
|
+
// leaves the wrapper unmeasured — no inline height, no observer
|
|
437
|
+
// (a measured wrapper pins an inline height and tracks the card).
|
|
438
|
+
// MUT:r1487-shell-double-morph (dropping the prop installs the
|
|
439
|
+
// observer and writes an inline height — this goes red).
|
|
440
|
+
const heightWrapper = container.querySelector(
|
|
441
|
+
".s-auth-card-height",
|
|
442
|
+
) as HTMLElement;
|
|
443
|
+
expect(heightWrapper).not.toBeNull();
|
|
444
|
+
expect(heightWrapper.style.height).toBe("");
|
|
445
|
+
|
|
446
|
+
active.value = "org";
|
|
447
|
+
for (let i = 0; i < 12; i++) await nextTick();
|
|
448
|
+
|
|
449
|
+
// SAME DOM NODES — the shell never dissolved.
|
|
450
|
+
expect(container.querySelector(".hk-tabs")).toBe(tabsBefore);
|
|
451
|
+
expect(container.querySelector(".s-auth-title")).toBe(titleBefore);
|
|
452
|
+
expect(container.querySelector(".s-auth-header")).toBe(logoSlotBefore);
|
|
453
|
+
// The tabs sit ABOVE the swapped region — outside the inner
|
|
454
|
+
// container's own class (a tabs-inside-the-body shape would
|
|
455
|
+
// dissolve the switch itself; the tabs are necessarily inside the
|
|
456
|
+
// OUTER tier, so the inner tier's class is the discriminator).
|
|
457
|
+
// MUT:r1487-tabs-inside-body (moving tabsEl() into the inner
|
|
458
|
+
// container gives the tabs a .hk-login-flow-body ancestor — this
|
|
459
|
+
// fails).
|
|
460
|
+
expect(tabsBefore!.closest(".hk-login-flow-body")).toBeNull();
|
|
461
|
+
// The swapped region carries the org body (the sso row list), and
|
|
462
|
+
// it lives BELOW the tabs inside the shell card.
|
|
463
|
+
const shellCard = container.querySelector(".s-auth-card")!;
|
|
464
|
+
const ssoBlock = container.querySelector(".hk-login-flow-sso");
|
|
465
|
+
expect(ssoBlock).not.toBeNull();
|
|
466
|
+
expect(shellCard.contains(ssoBlock!)).toBe(true);
|
|
467
|
+
// The inner crossfade is keyed on the CHANNEL; the outer tier stayed
|
|
468
|
+
// on the account generation (the shell item's key never changed).
|
|
469
|
+
// MUT:r1487-inner-key-fixed (R7 M6: pinning the inner swapKey to a
|
|
470
|
+
// constant leaves no item carrying data-crossfade-key="org" and
|
|
471
|
+
// this assertion goes red).
|
|
472
|
+
const innerItems = container.querySelectorAll(
|
|
473
|
+
".hk-tc .hk-tc .hk-crossfade-item",
|
|
375
474
|
);
|
|
376
|
-
expect(
|
|
377
|
-
// And the OTP cells of the returning stage live only in a leaving
|
|
378
|
-
// body — the settled stage carries none.
|
|
475
|
+
expect(innerItems.length).toBeGreaterThan(0);
|
|
379
476
|
expect(
|
|
380
|
-
|
|
381
|
-
|
|
477
|
+
Array.from(innerItems).some(
|
|
478
|
+
(el) => (el as HTMLElement).dataset.crossfadeKey === "org",
|
|
479
|
+
),
|
|
480
|
+
).toBe(true);
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
it("swaps the credentials body back without losing the typed tab state", async () => {
|
|
484
|
+
const { container, active } = mountTwoChannel("org");
|
|
485
|
+
active.value = "cloud";
|
|
486
|
+
for (let i = 0; i < 12; i++) await nextTick();
|
|
487
|
+
// The INNER container's settled item is the cloud body (the outer
|
|
488
|
+
// account item contains the leaving inner org item too — scope the
|
|
489
|
+
// assertion to the inner tier, the only thing that swapped).
|
|
490
|
+
const innerSettled = Array.from(
|
|
491
|
+
container.querySelectorAll(
|
|
492
|
+
".hk-tc .hk-tc .hk-crossfade-item:not(.hk-crossfade-leave-active):not(.hk-crossfade-leave-to)",
|
|
493
|
+
),
|
|
494
|
+
);
|
|
495
|
+
expect(innerSettled.length).toBe(1);
|
|
496
|
+
expect((innerSettled[0] as HTMLElement).dataset.crossfadeKey).toBe("cloud");
|
|
497
|
+
expect(innerSettled[0]!.querySelector('input[name="signin-username"]')).not.toBeNull();
|
|
498
|
+
expect(innerSettled[0]!.querySelector(".hk-login-flow-sso")).toBeNull();
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
it("blurs a field focused inside the leaving body on a channel switch", async () => {
|
|
502
|
+
// The anti-strobe cover HkStepFlow's dropFlowFocus used to provide
|
|
503
|
+
// (chest round-22 field report: a focused field re-anchors the
|
|
504
|
+
// Android autofill panel on every layout beat). The TAB button
|
|
505
|
+
// keeps its focus — the blur scope is the swapped body only.
|
|
506
|
+
const { container, active } = mountTwoChannel("cloud");
|
|
507
|
+
const input = container.querySelector<HTMLInputElement>(
|
|
508
|
+
'input[name="signin-username"]',
|
|
509
|
+
)!;
|
|
510
|
+
input.focus();
|
|
511
|
+
expect(document.activeElement).toBe(input);
|
|
512
|
+
active.value = "org";
|
|
513
|
+
await nextTick();
|
|
514
|
+
// MUT:r1487-focus-strobe (dropping the blur watch leaves the
|
|
515
|
+
// dissolved field focused — the autofill strobe regression).
|
|
516
|
+
expect(document.activeElement).not.toBe(input);
|
|
517
|
+
|
|
518
|
+
// The exempt half: an activated TAB TRIGGER keeps focus across the
|
|
519
|
+
// switch (keyboard a11y — the blur scope must not fold to the whole
|
|
520
|
+
// flow).
|
|
521
|
+
// MUT:r1487-blur-scope-fold (widening the scope to .hk-login-flow
|
|
522
|
+
// blurs the trigger here and this goes red).
|
|
523
|
+
active.value = "cloud";
|
|
524
|
+
await nextTick();
|
|
525
|
+
await new Promise((r) => setTimeout(r, 30));
|
|
526
|
+
const trigger = container.querySelectorAll<HTMLButtonElement>(
|
|
527
|
+
".hk-tabs-trigger",
|
|
528
|
+
)[0]!;
|
|
529
|
+
trigger.focus();
|
|
530
|
+
expect(document.activeElement).toBe(trigger);
|
|
531
|
+
active.value = "org";
|
|
532
|
+
await nextTick();
|
|
533
|
+
expect(document.activeElement).toBe(trigger);
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
it("extends the :has rhythm collapse to the bare fragment's descendant blocks (styles pin)", () => {
|
|
537
|
+
// The stable shell's bare fragment renders the methods/footer
|
|
538
|
+
// blocks as DESCENDANTS of the shell's .s-auth-form — the sibling
|
|
539
|
+
// `:has(+ …)` rules cannot see them, so the descendant variants
|
|
540
|
+
// carry the same collapsed bottom padding (without them the form's
|
|
541
|
+
// full 24px bottom padding stacks onto the footer's top margin).
|
|
542
|
+
// MUT:r1487-rhythm-descendant (reverting to sibling-only rules
|
|
543
|
+
// makes this match empty).
|
|
544
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
545
|
+
const scss = readFileSync(join(here, "../styles/admin-tokens.scss"), "utf-8");
|
|
546
|
+
const methods = scss.match(/\.s-auth-form:has\(\.s-auth-methods\)\s*,\s*\.s-auth-form:has\(\.s-auth-footer\)\s*{[^}]*}/)?.[0] ?? "";
|
|
547
|
+
expect(methods, "descendant :has collapse rule must exist").toBeTruthy();
|
|
548
|
+
expect(methods).toContain("padding-bottom: var(--space-8, 0.5rem)");
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
it("renders no footer band when the host passed no footer slot (flow-level dead-space guard)", () => {
|
|
552
|
+
// The flow's own footer-slot existence guard (mirroring the card's
|
|
553
|
+
// methods/footer rules): an unconditional lambda would make the
|
|
554
|
+
// bare fragment render an empty padded .s-auth-footer band under
|
|
555
|
+
// every channel body.
|
|
556
|
+
// MUT:r1487-flow-footer-dead-space (forwarding the footer lambda
|
|
557
|
+
// unconditionally renders the empty band here).
|
|
558
|
+
const c = mount(h(HkLoginFlow, {
|
|
559
|
+
channels: [cloudChannel],
|
|
560
|
+
modelValue: "cloud",
|
|
561
|
+
}));
|
|
562
|
+
expect(c.querySelector(".s-auth-footer")).toBeNull();
|
|
563
|
+
// The default username icon lane survives the bare fragment (the
|
|
564
|
+
// fallback <User> mark rides the field unless a channel overrides).
|
|
565
|
+
// MUT:r1487-icon-fallback-drop (dropping the else branch leaves
|
|
566
|
+
// the field icon-less).
|
|
567
|
+
expect(c.querySelector(".s-auth-card-field-icon")).not.toBeNull();
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
it("flows the per-channel fallback title through the stable shell header", async () => {
|
|
571
|
+
// Without a flow-level title the ACTIVE channel's title supplies
|
|
572
|
+
// the header copy (single-channel hosts unchanged); switching then
|
|
573
|
+
// updates the text in place — the header node itself stays mounted.
|
|
574
|
+
const active = ref<"cloud" | "org">("cloud");
|
|
575
|
+
const Host = defineComponent({
|
|
576
|
+
setup: () => () =>
|
|
577
|
+
h(HkLoginFlow, {
|
|
578
|
+
channels: [
|
|
579
|
+
cloudChannel,
|
|
580
|
+
{ key: "org", mode: "sso", icon: h("svg"), title: "Organization access" },
|
|
581
|
+
],
|
|
582
|
+
modelValue: active.value,
|
|
583
|
+
"onUpdate:modelValue": () => {},
|
|
584
|
+
}),
|
|
585
|
+
});
|
|
586
|
+
const container = mount(h(Host));
|
|
587
|
+
const titleEl = container.querySelector(".s-auth-title")!;
|
|
588
|
+
expect(titleEl.textContent).toContain("Sign in");
|
|
589
|
+
active.value = "org";
|
|
590
|
+
for (let i = 0; i < 12; i++) await nextTick();
|
|
591
|
+
expect(container.querySelector(".s-auth-title")).toBe(titleEl);
|
|
592
|
+
expect(titleEl.textContent).toContain("Organization access");
|
|
382
593
|
});
|
|
383
594
|
});
|
|
384
595
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, defineComponent, ref, type PropType } from "vue";
|
|
1
|
+
import { computed, defineComponent, ref, watch, type PropType } from "vue";
|
|
2
2
|
|
|
3
3
|
import { useI18n } from "../i18n/context";
|
|
4
4
|
import { asPropType } from "../utils/typing";
|
|
@@ -6,7 +6,6 @@ import { HkAuthCard } from "./HkAuthCard";
|
|
|
6
6
|
import { HkAuthChannelList, type HkAuthChannelListEntry } from "./HkAuthChannelList";
|
|
7
7
|
import { HkMfaVerifyCard, type HkMfaFactor } from "./HkMfaVerifyCard";
|
|
8
8
|
import { HkSignInCard } from "./HkSignInCard";
|
|
9
|
-
import HkStepFlow from "./HkStepFlow";
|
|
10
9
|
import HkTabs from "./HkTabs";
|
|
11
10
|
import HkTransitionContainer from "./HkTransitionContainer";
|
|
12
11
|
|
|
@@ -82,10 +81,12 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
|
|
|
82
81
|
* This is the business-level composition above the auth kit (extracted
|
|
83
82
|
* from shittim-chest's LoginView, 2026-11 user direction: the login
|
|
84
83
|
* screen had drifted into per-app reimplementations). It owns EVERYTHING
|
|
85
|
-
* visual —
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
84
|
+
* visual — ONE stable shell card (logo, header, the pill segment group
|
|
85
|
+
* hidden when a deployment offers a single channel; a lone dead segment
|
|
86
|
+
* reads as a broken switch) whose body below the tabs crossfades and
|
|
87
|
+
* height-morphs per channel through `HkTransitionContainer`, with the
|
|
88
|
+
* account→verify step as the same fade+height morph between the shell
|
|
89
|
+
* and the MFA card — while staying a CONTROLLED
|
|
89
90
|
* component: no endpoint, no URL building, no factor ladder policy.
|
|
90
91
|
* Each host (the chest migration plus the erp and arona login surfaces,
|
|
91
92
|
* landing as their own PRs) keeps its own auth client and drives the
|
|
@@ -144,8 +145,18 @@ export const HkLoginFlow = defineComponent({
|
|
|
144
145
|
step: { type: String as PropType<"account" | "verify">, default: "account" },
|
|
145
146
|
/** In-flight state of the credentials submit. */
|
|
146
147
|
loading: { type: Boolean, default: false },
|
|
147
|
-
/** Logo image URL forwarded to the
|
|
148
|
+
/** Logo image URL forwarded to the shell card's header. */
|
|
148
149
|
logoSrc: { type: String, default: undefined },
|
|
150
|
+
/** The SHELL card's header title — one stable header across every
|
|
151
|
+
* channel (2026-11-24 user direction: a channel switch must morph
|
|
152
|
+
* only the content below the tabs, never dissolve the card). Falls
|
|
153
|
+
* back to the ACTIVE channel's `title` (then the conventional
|
|
154
|
+
* sign-in copy) for hosts that still brand per channel; distinct
|
|
155
|
+
* per-channel fallbacks then swap as instant text, so multi-channel
|
|
156
|
+
* hosts should pass this once. */
|
|
157
|
+
title: { type: String, default: undefined },
|
|
158
|
+
/** The SHELL card's subtitle — same stability contract as `title`. */
|
|
159
|
+
subtitle: { type: String, default: undefined },
|
|
149
160
|
/** Seed for the credentials card's username field — survives the
|
|
150
161
|
* verify round-trip (see HkSignInCard.initialUsername). */
|
|
151
162
|
initialUsername: { type: String, default: "" },
|
|
@@ -196,6 +207,22 @@ export const HkLoginFlow = defineComponent({
|
|
|
196
207
|
props.channels[0],
|
|
197
208
|
);
|
|
198
209
|
|
|
210
|
+
// Anti-strobe on the channel swap (the chest round-22 field report
|
|
211
|
+
// HkStepFlow's dropFlowFocus used to cover): a field still focused
|
|
212
|
+
// INSIDE the leaving body re-anchors the Android autofill panel on
|
|
213
|
+
// every layout beat of the morph. The tab buttons are deliberately
|
|
214
|
+
// OUTSIDE the blur scope — the activated tab must keep focus
|
|
215
|
+
// (keyboard a11y).
|
|
216
|
+
watch(() => currentChannel.value?.key, () => {
|
|
217
|
+
const active = document.activeElement;
|
|
218
|
+
if (
|
|
219
|
+
active instanceof HTMLElement &&
|
|
220
|
+
active.closest(".hk-login-flow-body")
|
|
221
|
+
) {
|
|
222
|
+
active.blur();
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
199
226
|
/** Segment label precedence: explicit label > the conventional-key
|
|
200
227
|
* locale > the raw key. The conventional keys cover every Celestia
|
|
201
228
|
* deployment today, so most hosts pass no labels at all. */
|
|
@@ -229,14 +256,12 @@ export const HkLoginFlow = defineComponent({
|
|
|
229
256
|
/>
|
|
230
257
|
) : null;
|
|
231
258
|
|
|
232
|
-
function
|
|
259
|
+
function renderCredentialsBody(channel: HkLoginCredentialsChannel) {
|
|
233
260
|
const methods = channel.methods ?? [];
|
|
234
261
|
return (
|
|
235
262
|
<HkSignInCard
|
|
236
263
|
key={channel.key}
|
|
237
|
-
|
|
238
|
-
subtitle={channel.subtitle ?? t("hikari::loginFlow.signInSubtitle", "Welcome back")}
|
|
239
|
-
logoSrc={props.logoSrc}
|
|
264
|
+
bare
|
|
240
265
|
loading={props.loading}
|
|
241
266
|
passwordField={channel.passwordField ?? false}
|
|
242
267
|
usernameType={channel.usernameType ?? "text"}
|
|
@@ -249,10 +274,13 @@ export const HkLoginFlow = defineComponent({
|
|
|
249
274
|
}
|
|
250
275
|
>
|
|
251
276
|
{{
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
|
|
255
|
-
|
|
277
|
+
// Forward the icon slot ONLY when the host passed one — an
|
|
278
|
+
// unconditional lambda would shadow HkSignInCard's own
|
|
279
|
+
// <User> fallback and leave the field icon-less (the same
|
|
280
|
+
// dead-slot rule as methods/footer).
|
|
281
|
+
...(slots.usernameIcon
|
|
282
|
+
? { usernameIcon: () => slots.usernameIcon?.({ channel: channel.key }) }
|
|
283
|
+
: {}),
|
|
256
284
|
...(methods.length > 0
|
|
257
285
|
? {
|
|
258
286
|
methods: () => (
|
|
@@ -264,49 +292,32 @@ export const HkLoginFlow = defineComponent({
|
|
|
264
292
|
),
|
|
265
293
|
}
|
|
266
294
|
: {}),
|
|
267
|
-
footer
|
|
295
|
+
// The footer wrapper must not exist when no footer was
|
|
296
|
+
// passed (HkAuthCard's dead-space rule; the bare fragment
|
|
297
|
+
// renders the wrapper itself whenever the slot is present).
|
|
298
|
+
...(slots.footer
|
|
299
|
+
? { footer: () => slots.footer?.({ channel: channel.key }) }
|
|
300
|
+
: {}),
|
|
268
301
|
}}
|
|
269
302
|
</HkSignInCard>
|
|
270
303
|
);
|
|
271
304
|
}
|
|
272
305
|
|
|
273
|
-
function
|
|
306
|
+
function renderSsoBody(channel: HkLoginSsoChannel) {
|
|
274
307
|
return (
|
|
275
|
-
<
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
/>
|
|
289
|
-
) : null,
|
|
290
|
-
default: () => (
|
|
291
|
-
<>
|
|
292
|
-
{tabsEl()}
|
|
293
|
-
<div class="hk-login-flow-sso">
|
|
294
|
-
<HkAuthChannelList
|
|
295
|
-
methods={[
|
|
296
|
-
{
|
|
297
|
-
key: channel.key,
|
|
298
|
-
label: channel.buttonLabel ?? channelLabel(channel),
|
|
299
|
-
icon: channel.icon,
|
|
300
|
-
disabled: channel.disabled,
|
|
301
|
-
},
|
|
302
|
-
]}
|
|
303
|
-
onSelect={() => emit("sso-click", channel.key)}
|
|
304
|
-
/>
|
|
305
|
-
</div>
|
|
306
|
-
</>
|
|
307
|
-
),
|
|
308
|
-
}}
|
|
309
|
-
</HkAuthCard>
|
|
308
|
+
<div key={channel.key} class="hk-login-flow-sso">
|
|
309
|
+
<HkAuthChannelList
|
|
310
|
+
methods={[
|
|
311
|
+
{
|
|
312
|
+
key: channel.key,
|
|
313
|
+
label: channel.buttonLabel ?? channelLabel(channel),
|
|
314
|
+
icon: channel.icon,
|
|
315
|
+
disabled: channel.disabled,
|
|
316
|
+
},
|
|
317
|
+
]}
|
|
318
|
+
onSelect={() => emit("sso-click", channel.key)}
|
|
319
|
+
/>
|
|
320
|
+
</div>
|
|
310
321
|
);
|
|
311
322
|
}
|
|
312
323
|
|
|
@@ -314,54 +325,95 @@ export const HkLoginFlow = defineComponent({
|
|
|
314
325
|
const channel = currentChannel.value;
|
|
315
326
|
if (!channel) return null;
|
|
316
327
|
|
|
328
|
+
// The stable shell header: flow-level copy wins; per-channel
|
|
329
|
+
// fallbacks keep single-channel hosts working unchanged.
|
|
330
|
+
const shellTitle = props.title ?? channel.title ?? (channel.mode === "credentials"
|
|
331
|
+
? t("hikari::loginFlow.signInTitle", "Sign in")
|
|
332
|
+
: channelLabel(channel));
|
|
333
|
+
const shellSubtitle = props.subtitle ?? channel.subtitle ?? (channel.mode === "credentials"
|
|
334
|
+
? t("hikari::loginFlow.signInSubtitle", "Welcome back")
|
|
335
|
+
: "");
|
|
336
|
+
|
|
337
|
+
// The fail-safe of the old design, kept: verify only ever renders
|
|
338
|
+
// for a credentials channel (a redirect flow has no second step).
|
|
339
|
+
const verifying = props.step === "verify" && channel.mode === "credentials";
|
|
340
|
+
|
|
317
341
|
return (
|
|
318
342
|
<div class="hk-login-flow">
|
|
319
343
|
{slots.top?.()}
|
|
320
|
-
{/*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
344
|
+
{/* Two transition tiers (2026-11-24 user direction — "switching
|
|
345
|
+
* the top segment group only crossfades the content below it
|
|
346
|
+
* and morphs the height; use the library's existing component,
|
|
347
|
+
* do not destroy the whole card"):
|
|
348
|
+
*
|
|
349
|
+
* - the OUTER container is keyed on the STEP ("account" vs
|
|
350
|
+
* "verify"): the account generation is ONE stable shell card
|
|
351
|
+
* (logo + header + segment group), the verify generation is
|
|
352
|
+
* the MFA card — a step move morphs between the two cards.
|
|
353
|
+
* - the INNER container is keyed on the CHANNEL and lives in
|
|
354
|
+
* the shell's body BELOW the segment group: a channel switch
|
|
355
|
+
* crossfades only the credentials form / the sso row list
|
|
356
|
+
* and morphs the height — the shell, its header and the tabs
|
|
357
|
+
* are NOT inside the swapped region and never dissolve.
|
|
358
|
+
*
|
|
359
|
+
* The shell card opts out of its own smooth-height wrapper:
|
|
360
|
+
* inside this flow the inner container owns the height
|
|
361
|
+
* choreography, and a second measuring wrapper would chain its
|
|
362
|
+
* 300ms transition after the container's (a telescoping
|
|
363
|
+
* double-morph). */}
|
|
364
|
+
<HkTransitionContainer swapKey={verifying ? "verify" : "account"} axis="height">
|
|
365
|
+
{verifying ? (
|
|
366
|
+
<HkMfaVerifyCard
|
|
367
|
+
key="verify"
|
|
368
|
+
ref={mfaRef}
|
|
369
|
+
factors={props.verifyFactors}
|
|
370
|
+
proven={props.verifyProven}
|
|
371
|
+
accountName={props.verifyAccountName}
|
|
372
|
+
logoSrc={props.logoSrc}
|
|
373
|
+
loading={props.verifyLoading}
|
|
374
|
+
resending={props.verifyResending}
|
|
375
|
+
passkeyRetryHint={props.passkeyRetryHint}
|
|
376
|
+
autofocus
|
|
377
|
+
onVerify={(kind: HkMfaFactor, proof: string) => emit("verify", kind, proof)}
|
|
378
|
+
onResend={() => emit("verify-resend")}
|
|
379
|
+
onBack={() => emit("verify-back")}
|
|
380
|
+
/>
|
|
381
|
+
) : (
|
|
382
|
+
<HkAuthCard key="account" title={shellTitle} subtitle={shellSubtitle} smoothHeight={false}>
|
|
383
|
+
{{
|
|
384
|
+
logo: () =>
|
|
385
|
+
props.logoSrc ? (
|
|
386
|
+
<img
|
|
387
|
+
class="hk-logo-img"
|
|
388
|
+
src={props.logoSrc}
|
|
389
|
+
alt=""
|
|
390
|
+
style={{ width: "3.5rem", height: "3.5rem" }}
|
|
391
|
+
/>
|
|
392
|
+
) : null,
|
|
393
|
+
default: () => (
|
|
394
|
+
<>
|
|
395
|
+
{/* The segment group rides ABOVE the swapped body —
|
|
396
|
+
* stable across channel switches. */}
|
|
397
|
+
{tabsEl()}
|
|
398
|
+
<HkTransitionContainer
|
|
399
|
+
// The class lands on the container's root Tag
|
|
400
|
+
// because HkTransitionContainer does not set
|
|
401
|
+
// inheritAttrs:false — an implicit contract the
|
|
402
|
+
// blur scope above and its pin depend on: adding
|
|
403
|
+
// that flag there silently breaks both.
|
|
404
|
+
class="hk-login-flow-body"
|
|
405
|
+
swapKey={channel.key}
|
|
406
|
+
axis="height"
|
|
407
|
+
>
|
|
408
|
+
{channel.mode === "credentials"
|
|
409
|
+
? renderCredentialsBody(channel)
|
|
410
|
+
: renderSsoBody(channel)}
|
|
411
|
+
</HkTransitionContainer>
|
|
412
|
+
</>
|
|
413
|
+
),
|
|
414
|
+
}}
|
|
415
|
+
</HkAuthCard>
|
|
416
|
+
)}
|
|
365
417
|
</HkTransitionContainer>
|
|
366
418
|
{slots.below?.()}
|
|
367
419
|
</div>
|
|
@@ -219,4 +219,47 @@ describe("HkSignInCard", () => {
|
|
|
219
219
|
const btn = c.querySelector(".hk-btn-primary") as HTMLElement;
|
|
220
220
|
expect(btn.getAttribute("disabled")).not.toBeNull(); // password still empty
|
|
221
221
|
});
|
|
222
|
+
|
|
223
|
+
it("renders the methods and footer blocks EXACTLY ONCE per card in shell mode", () => {
|
|
224
|
+
// The bare-mode extraction (2026-11) once rendered the wrapper divs
|
|
225
|
+
// in BOTH the credential fragment and HkAuthCard's own slots — a
|
|
226
|
+
// standalone card with slots showed two .s-auth-methods and two
|
|
227
|
+
// .s-auth-footer blocks (R3 of the extraction PR caught it live).
|
|
228
|
+
// MUT:r1487-double-blocks (rendering the blocks in shell mode too
|
|
229
|
+
// makes both counts 2).
|
|
230
|
+
const c = mount(
|
|
231
|
+
h(HkSignInCard, { title: "T" }, {
|
|
232
|
+
methods: () => h("div", { class: "m-row" }, "m"),
|
|
233
|
+
footer: () => h("div", { class: "f-row" }, "f"),
|
|
234
|
+
}),
|
|
235
|
+
);
|
|
236
|
+
expect(c.querySelectorAll(".s-auth-methods")).toHaveLength(1);
|
|
237
|
+
expect(c.querySelectorAll(".s-auth-footer")).toHaveLength(1);
|
|
238
|
+
expect(c.querySelectorAll(".m-row")).toHaveLength(1);
|
|
239
|
+
expect(c.querySelectorAll(".f-row")).toHaveLength(1);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it("renders no footer wrapper at all when no footer slot was passed (dead-space guard)", () => {
|
|
243
|
+
// The footer half of the methods dead-space rule, made symmetric
|
|
244
|
+
// after R4 caught the unconditional forwarding: a methods-less,
|
|
245
|
+
// footer-less card must leave BOTH wrapper bands absent.
|
|
246
|
+
// MUT:r1487-footer-dead-space (unconditional footer forwarding
|
|
247
|
+
// renders an empty .s-auth-footer band here).
|
|
248
|
+
const c = mount(h(HkSignInCard, { title: "T" }));
|
|
249
|
+
expect(c.querySelector(".s-auth-footer")).toBeNull();
|
|
250
|
+
expect(c.querySelector(".s-auth-methods")).toBeNull();
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("renders the blocks exactly once in BARE mode too", () => {
|
|
254
|
+
const c = mount(
|
|
255
|
+
h(HkSignInCard, { bare: true }, {
|
|
256
|
+
methods: () => h("div", { class: "m-row" }, "m"),
|
|
257
|
+
footer: () => h("div", { class: "f-row" }, "f"),
|
|
258
|
+
}),
|
|
259
|
+
);
|
|
260
|
+
// No HkAuthCard exists in bare mode — the fragment owns the blocks.
|
|
261
|
+
expect(c.querySelectorAll(".s-auth-card")).toHaveLength(0);
|
|
262
|
+
expect(c.querySelectorAll(".s-auth-methods")).toHaveLength(1);
|
|
263
|
+
expect(c.querySelectorAll(".s-auth-footer")).toHaveLength(1);
|
|
264
|
+
});
|
|
222
265
|
});
|
|
@@ -42,6 +42,13 @@ import HkAuthSubmitButton from "./HkAuthSubmitButton";
|
|
|
42
42
|
* between the form and the footer (typically `HkAuthMethodList`), so
|
|
43
43
|
* alternative sign-in buttons line up with the inputs while the footer
|
|
44
44
|
* rows keep their centered-group layout.
|
|
45
|
+
* - `bare: true` — render ONLY the credential fragment (the `<form>` plus
|
|
46
|
+
* the methods/footer blocks, same wrapper classes) with NO HkAuthCard
|
|
47
|
+
* shell: for hosts that own a stable card shell and swap this body
|
|
48
|
+
* inside it (HkLoginFlow's channel switch — 2026-11-24 user direction:
|
|
49
|
+
* the shell, its header and the channel tabs must NOT dissolve when
|
|
50
|
+
* only the content below the tabs changes). The `top` slot is a shell
|
|
51
|
+
* concern and deliberately does not exist in bare mode.
|
|
45
52
|
*
|
|
46
53
|
* ```tsx
|
|
47
54
|
* <HSignInCard
|
|
@@ -56,7 +63,9 @@ import HkAuthSubmitButton from "./HkAuthSubmitButton";
|
|
|
56
63
|
export const HkSignInCard = defineComponent({
|
|
57
64
|
name: "HkSignInCard",
|
|
58
65
|
props: {
|
|
59
|
-
title
|
|
66
|
+
/** Card title (shell mode). Unused in `bare` mode — the host owns
|
|
67
|
+
* the shell — but kept in the prop shape for the standalone card. */
|
|
68
|
+
title: { type: String, default: "" },
|
|
60
69
|
subtitle: { type: String, default: "" },
|
|
61
70
|
/** Optional logo image URL for the card header. */
|
|
62
71
|
logoSrc: { type: String, default: undefined },
|
|
@@ -84,6 +93,11 @@ export const HkSignInCard = defineComponent({
|
|
|
84
93
|
* user navigates back from a later step, so the typed account name
|
|
85
94
|
* must travel through a prop rather than module state. */
|
|
86
95
|
initialUsername: { type: String, default: "" },
|
|
96
|
+
/** Render ONLY the credential fragment — no HkAuthCard shell, no
|
|
97
|
+
* `top` slot. For hosts that own a stable shell and transition this
|
|
98
|
+
* body inside it (HkLoginFlow's channel swap). Default keeps the
|
|
99
|
+
* full standalone card. */
|
|
100
|
+
bare: { type: Boolean, default: false },
|
|
87
101
|
},
|
|
88
102
|
emits: {
|
|
89
103
|
/** Fired on explicit click or Enter; never with an empty username (or
|
|
@@ -102,6 +116,79 @@ export const HkSignInCard = defineComponent({
|
|
|
102
116
|
emit("submit", u, props.passwordField ? password.value : "");
|
|
103
117
|
}
|
|
104
118
|
|
|
119
|
+
/** The credential fragment every mode shares: the `<form>` (username,
|
|
120
|
+
* optional password, block submit). `withBlocks` additionally
|
|
121
|
+
* renders the methods/footer wrapper divs — BARE mode only: no
|
|
122
|
+
* HkAuthCard exists there to own those layout blocks, while in
|
|
123
|
+
* shell mode HkAuthCard's own slots render them (rendering both
|
|
124
|
+
* would duplicate the blocks — R3 caught exactly that in the
|
|
125
|
+
* standalone card). The wrapper classes match HkAuthCard's blocks
|
|
126
|
+
* so the bare fragment occupies the same visual lanes inside a
|
|
127
|
+
* host-owned shell. */
|
|
128
|
+
const credentialBody = (withBlocks: boolean) => (
|
|
129
|
+
<>
|
|
130
|
+
<form onSubmit={(e: Event) => { e.preventDefault(); attemptSubmit(); }}>
|
|
131
|
+
<HkInput
|
|
132
|
+
modelValue={username.value}
|
|
133
|
+
onUpdate:modelValue={(v: string) => (username.value = v)}
|
|
134
|
+
type={props.usernameType}
|
|
135
|
+
name="signin-username"
|
|
136
|
+
autocomplete={props.usernameAutocomplete ?? credentialAutocomplete("username", "username")}
|
|
137
|
+
placeholder={
|
|
138
|
+
props.usernamePlaceholder ??
|
|
139
|
+
t("hikari::signIn.usernamePlaceholder", "Username")
|
|
140
|
+
}
|
|
141
|
+
disabled={props.loading || props.disabled}
|
|
142
|
+
submitOnEnter={attemptSubmit}
|
|
143
|
+
>
|
|
144
|
+
{{
|
|
145
|
+
prefixIcon: () =>
|
|
146
|
+
slots.usernameIcon ? (
|
|
147
|
+
slots.usernameIcon()
|
|
148
|
+
) : (
|
|
149
|
+
<User class="s-auth-card-field-icon" aria-hidden="true" />
|
|
150
|
+
),
|
|
151
|
+
}}
|
|
152
|
+
</HkInput>
|
|
153
|
+
{/* Account-first mode omits the field entirely — not hides
|
|
154
|
+
it with CSS: a hidden password input would still plant a
|
|
155
|
+
credential-manager save prompt and an autocomplete target
|
|
156
|
+
on a form that never carries a password. */}
|
|
157
|
+
{props.passwordField && (
|
|
158
|
+
<HkInput
|
|
159
|
+
variant="password"
|
|
160
|
+
modelValue={password.value}
|
|
161
|
+
onUpdate:modelValue={(v: string) => (password.value = v)}
|
|
162
|
+
name="signin-password"
|
|
163
|
+
autocomplete={props.passwordAutocomplete ?? credentialAutocomplete("password", "current-password")}
|
|
164
|
+
placeholder={t("hikari::signIn.passwordPlaceholder", "Password")}
|
|
165
|
+
disabled={props.loading || props.disabled}
|
|
166
|
+
submitOnEnter={attemptSubmit}
|
|
167
|
+
/>
|
|
168
|
+
)}
|
|
169
|
+
<HkAuthSubmitButton
|
|
170
|
+
label={props.submitLabel ?? t("hikari::signIn.submit", "Sign in")}
|
|
171
|
+
block
|
|
172
|
+
loading={props.loading}
|
|
173
|
+
disabled={props.disabled || !username.value.trim() || (props.passwordField && !password.value)}
|
|
174
|
+
doSubmit={() => Promise.resolve(attemptSubmit())}
|
|
175
|
+
/>
|
|
176
|
+
</form>
|
|
177
|
+
{withBlocks && slots.methods && (
|
|
178
|
+
<div class="s-auth-methods">{slots.methods()}</div>
|
|
179
|
+
)}
|
|
180
|
+
{withBlocks && slots.footer && (
|
|
181
|
+
<div class="s-auth-footer">{slots.footer()}</div>
|
|
182
|
+
)}
|
|
183
|
+
</>
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
// Bare mode: the fragment alone — the host owns the shell (and any
|
|
187
|
+
// transition choreography around this body).
|
|
188
|
+
if (props.bare) {
|
|
189
|
+
return () => credentialBody(true);
|
|
190
|
+
}
|
|
191
|
+
|
|
105
192
|
return () => (
|
|
106
193
|
<HkAuthCard title={props.title} subtitle={props.subtitle}>
|
|
107
194
|
{{
|
|
@@ -114,61 +201,16 @@ export const HkSignInCard = defineComponent({
|
|
|
114
201
|
default: () => (
|
|
115
202
|
<>
|
|
116
203
|
{slots.top?.()}
|
|
117
|
-
|
|
118
|
-
<HkInput
|
|
119
|
-
modelValue={username.value}
|
|
120
|
-
onUpdate:modelValue={(v: string) => (username.value = v)}
|
|
121
|
-
type={props.usernameType}
|
|
122
|
-
name="signin-username"
|
|
123
|
-
autocomplete={props.usernameAutocomplete ?? credentialAutocomplete("username", "username")}
|
|
124
|
-
placeholder={
|
|
125
|
-
props.usernamePlaceholder ??
|
|
126
|
-
t("hikari::signIn.usernamePlaceholder", "Username")
|
|
127
|
-
}
|
|
128
|
-
disabled={props.loading || props.disabled}
|
|
129
|
-
submitOnEnter={attemptSubmit}
|
|
130
|
-
>
|
|
131
|
-
{{
|
|
132
|
-
prefixIcon: () =>
|
|
133
|
-
slots.usernameIcon ? (
|
|
134
|
-
slots.usernameIcon()
|
|
135
|
-
) : (
|
|
136
|
-
<User class="s-auth-card-field-icon" aria-hidden="true" />
|
|
137
|
-
),
|
|
138
|
-
}}
|
|
139
|
-
</HkInput>
|
|
140
|
-
{/* Account-first mode omits the field entirely — not hides
|
|
141
|
-
it with CSS: a hidden password input would still plant a
|
|
142
|
-
credential-manager save prompt and an autocomplete target
|
|
143
|
-
on a form that never carries a password. */}
|
|
144
|
-
{props.passwordField && (
|
|
145
|
-
<HkInput
|
|
146
|
-
variant="password"
|
|
147
|
-
modelValue={password.value}
|
|
148
|
-
onUpdate:modelValue={(v: string) => (password.value = v)}
|
|
149
|
-
name="signin-password"
|
|
150
|
-
autocomplete={props.passwordAutocomplete ?? credentialAutocomplete("password", "current-password")}
|
|
151
|
-
placeholder={t("hikari::signIn.passwordPlaceholder", "Password")}
|
|
152
|
-
disabled={props.loading || props.disabled}
|
|
153
|
-
submitOnEnter={attemptSubmit}
|
|
154
|
-
/>
|
|
155
|
-
)}
|
|
156
|
-
<HkAuthSubmitButton
|
|
157
|
-
label={props.submitLabel ?? t("hikari::signIn.submit", "Sign in")}
|
|
158
|
-
block
|
|
159
|
-
loading={props.loading}
|
|
160
|
-
disabled={props.disabled || !username.value.trim() || (props.passwordField && !password.value)}
|
|
161
|
-
doSubmit={() => Promise.resolve(attemptSubmit())}
|
|
162
|
-
/>
|
|
163
|
-
</form>
|
|
204
|
+
{credentialBody(false)}
|
|
164
205
|
</>
|
|
165
206
|
),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
207
|
+
/* Both block slots forward ONLY when the consumer passed one —
|
|
208
|
+
an unconditional lambda makes HkAuthCard see an always-present
|
|
209
|
+
slot and render its (padded, top-margined) wrapper as empty
|
|
210
|
+
dead space (the methods half pinned 2026-09; the footer half
|
|
211
|
+
made symmetric 2026-11 after R4 of the extraction PR caught
|
|
212
|
+
the asymmetry). */
|
|
213
|
+
...(slots.footer ? { footer: () => slots.footer?.() } : {}),
|
|
172
214
|
...(slots.methods ? { methods: () => slots.methods?.() } : {}),
|
|
173
215
|
}}
|
|
174
216
|
</HkAuthCard>
|
|
@@ -1328,6 +1328,21 @@
|
|
|
1328
1328
|
padding-bottom: var(--space-8, 0.5rem);
|
|
1329
1329
|
}
|
|
1330
1330
|
|
|
1331
|
+
/* The stable-shell shape (HkLoginFlow's bare sign-in fragment, 2026-11):
|
|
1332
|
+
the methods and footer blocks ride INSIDE the swapped channel body as
|
|
1333
|
+
DESCENDANTS of the shell's form block, so the sibling rules above
|
|
1334
|
+
cannot see that shape — collapse it with the same padding here (a
|
|
1335
|
+
bare-fragment footer otherwise stacks the form's full bottom padding
|
|
1336
|
+
onto the footer's top margin). A card whose blocks ARE direct children
|
|
1337
|
+
already fires the sibling rules above with the same value, so this arm
|
|
1338
|
+
changes nothing for it (HkLoginFlow is the only descendant-shaped
|
|
1339
|
+
consumer today). Non-:has engines keep the full bottom padding in BOTH
|
|
1340
|
+
shapes — the sibling rules degrade the same way (spacing-only). */
|
|
1341
|
+
.s-auth-form:has(.s-auth-methods),
|
|
1342
|
+
.s-auth-form:has(.s-auth-footer) {
|
|
1343
|
+
padding-bottom: var(--space-8, 0.5rem);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1331
1346
|
.s-auth-link {
|
|
1332
1347
|
font-size: var(--text-xs, 0.75rem);
|
|
1333
1348
|
color: var(--hi-color-text-secondary, #999);
|