@celestia-island/hikari 0.55.457 → 0.55.459
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/HkAuthChannelList.d.ts +66 -0
- package/dist/types/components/HkLoginFlow.d.ts +19 -12
- package/dist/types/index.d.ts +2 -0
- package/dist/types/scene3d/declare-caps.d.ts +10 -0
- package/dist/types/scene3d/wasmFleetSpec.d.ts +13 -0
- package/package.json +3 -2
- package/src/components/HkAuthChannelList.scss +83 -0
- package/src/components/HkAuthChannelList.test.tsx +74 -0
- package/src/components/HkAuthChannelList.tsx +88 -0
- package/src/components/HkDiffViewer.epoch.test.tsx +28 -10
- package/src/components/HkLoginFlow.scss +3 -5
- package/src/components/HkLoginFlow.test.tsx +56 -13
- package/src/components/HkLoginFlow.tsx +31 -20
- package/src/composables/useHighlight.coldPath.test.ts +162 -0
- package/src/composables/useHighlight.hostSurface.test.ts +220 -0
- package/src/composables/useHighlight.ts +102 -27
- package/src/index.ts +2 -0
- package/src/scene3d/declare-caps.ts +29 -0
- package/src/scene3d/scene3dHostSurface.test.ts +334 -0
- package/src/scene3d/wasmFleetSpec.ts +93 -10
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import "./HkAuthChannelList.scss";
|
|
2
|
+
/** One sign-in destination row: the provider's mark on the left, the
|
|
3
|
+
* channel's name on the right. */
|
|
4
|
+
export interface HkAuthChannelListEntry {
|
|
5
|
+
key: string;
|
|
6
|
+
/** The channel name rendered as the row's label (e.g. 「飞书登录」). */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Prebuilt icon vnode (brand SVG, <img>, …) rendered at the row's
|
|
9
|
+
* left. Loose-typed like every auth icon: hosts materialize hikari
|
|
10
|
+
* against their own vue store. A missing icon leaves the slot empty
|
|
11
|
+
* (the label carries the row). */
|
|
12
|
+
icon?: unknown;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* HkAuthChannelList — the standard sign-in destination list (2026-11-22
|
|
17
|
+
* user direction): one FULL-WIDTH ROW per channel, the mark on the left
|
|
18
|
+
* and the channel's NAME in plain sight on the right.
|
|
19
|
+
*
|
|
20
|
+
* This replaces the small square icon tiles (`HkAuthMethodList`) as the
|
|
21
|
+
* form for login-flow destination buttons — on every Celestia auth
|
|
22
|
+
* surface. A tile hides the channel's name behind a hover tooltip; a
|
|
23
|
+
* list row states it. The row is a plain bordered button (token-driven,
|
|
24
|
+
* dark-mode automatic) — no square framing, no hover reveal.
|
|
25
|
+
*
|
|
26
|
+
* Control contract: the list never talks to a backend; the host injects
|
|
27
|
+
* `methods` and handles `select(key)`.
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <HkAuthChannelList
|
|
31
|
+
* methods={[{ key: "feishu", label: "飞书登录", icon: <FeishuMark /> }]}
|
|
32
|
+
* onSelect={(key) => startLogin(key)}
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const HkAuthChannelList: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
37
|
+
/** Optional divider text rendered above the list (consumer copy). */
|
|
38
|
+
divider: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
/** Channel rows, in render order. */
|
|
43
|
+
methods: {
|
|
44
|
+
type: () => HkAuthChannelListEntry[];
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
48
|
+
/** A channel row was activated. */
|
|
49
|
+
select: (_key: string) => true;
|
|
50
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
51
|
+
/** Optional divider text rendered above the list (consumer copy). */
|
|
52
|
+
divider: {
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
/** Channel rows, in render order. */
|
|
57
|
+
methods: {
|
|
58
|
+
type: () => HkAuthChannelListEntry[];
|
|
59
|
+
required: true;
|
|
60
|
+
};
|
|
61
|
+
}>> & Readonly<{
|
|
62
|
+
onSelect?: ((_key: string) => any) | undefined;
|
|
63
|
+
}>, {
|
|
64
|
+
divider: string;
|
|
65
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
66
|
+
export default HkAuthChannelList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PropType } from "vue";
|
|
2
|
-
import { type
|
|
2
|
+
import { type HkAuthChannelListEntry } from "./HkAuthChannelList";
|
|
3
3
|
import { type HkMfaFactor } from "./HkMfaVerifyCard";
|
|
4
4
|
import "./HkLoginFlow.scss";
|
|
5
5
|
/** A channel whose sign-in is a credentials handshake the host drives:
|
|
@@ -22,33 +22,40 @@ export interface HkLoginCredentialsChannel {
|
|
|
22
22
|
* on identifier logins); HkSignInCard's runtime credential policy
|
|
23
23
|
* resolves the default. */
|
|
24
24
|
usernameAutocomplete?: string;
|
|
25
|
+
/** Per-channel seed override for the username field. The flow-level
|
|
26
|
+
* `initialUsername` exists for the account→verify→back round-trip of
|
|
27
|
+
* ONE channel; a channel that never collects that value (the org
|
|
28
|
+
* email funnel) overrides with "" so the OTHER channel's account
|
|
29
|
+
* name never leaks into its field (chest R4 seam finding). */
|
|
30
|
+
initialUsername?: string;
|
|
25
31
|
/** Classic two-field card. Defaults to FALSE — account-first is the
|
|
26
32
|
* family-wide posture since the MFA redesign: the password is proven
|
|
27
33
|
* on the verify step as one factor among the announced ones, so the
|
|
28
34
|
* opening card must not ask for it (2026-11 user direction). */
|
|
29
35
|
passwordField?: boolean;
|
|
30
36
|
submitLabel?: string;
|
|
31
|
-
/** Alternative sign-in
|
|
37
|
+
/** Alternative sign-in rows under the form (rendered only when
|
|
32
38
|
* non-empty; an empty list omits the whole methods block instead of
|
|
33
39
|
* padding a dead strip). */
|
|
34
|
-
methods?:
|
|
35
|
-
/** Divider text above the
|
|
40
|
+
methods?: HkAuthChannelListEntry[];
|
|
41
|
+
/** Divider text above the rows; consumer-localized on purpose. */
|
|
36
42
|
methodsDivider?: string;
|
|
37
43
|
}
|
|
38
44
|
/** A channel whose whole sign-in is one redirect (a.celestia.world's
|
|
39
|
-
* "Celestia"
|
|
40
|
-
* only offers Feishu): the card renders
|
|
41
|
-
*
|
|
45
|
+
* "Celestia" row jumping to the central login, an org channel that
|
|
46
|
+
* only offers Feishu): the card renders the standard channel list —
|
|
47
|
+
* one full-width row naming the destination — and `sso-click` sends
|
|
48
|
+
* the host off to build its OAuth URL. */
|
|
42
49
|
export interface HkLoginSsoChannel {
|
|
43
50
|
key: string;
|
|
44
51
|
mode: "sso";
|
|
45
52
|
label?: string;
|
|
46
53
|
title?: string;
|
|
47
54
|
subtitle?: string;
|
|
48
|
-
/** Provider mark for the
|
|
55
|
+
/** Provider mark for the row (brand SVG, <img>, …). Loose-typed like
|
|
49
56
|
* every auth icon: hosts materialize hikari against their own vue. */
|
|
50
57
|
icon: unknown;
|
|
51
|
-
/**
|
|
58
|
+
/** The row's label (accessible name + visible text); defaults to the
|
|
52
59
|
* label. */
|
|
53
60
|
buttonLabel?: string;
|
|
54
61
|
disabled?: boolean;
|
|
@@ -65,7 +72,7 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
|
|
|
65
72
|
* visual — the pill segment group (hidden when a deployment offers a
|
|
66
73
|
* single channel; a lone dead segment reads as a broken switch), the
|
|
67
74
|
* height-morphing channel swap, the direction-aware account→verify
|
|
68
|
-
* slide, the methods
|
|
75
|
+
* slide, the methods rows, the MFA card — while staying a CONTROLLED
|
|
69
76
|
* component: no endpoint, no URL building, no factor ladder policy.
|
|
70
77
|
* Each host (the chest migration plus the erp and arona login surfaces,
|
|
71
78
|
* landing as their own PRs) keeps its own auth client and drives the
|
|
@@ -79,8 +86,8 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
|
|
|
79
86
|
* channel renders the account card as a fail-safe).
|
|
80
87
|
* - `account-submit(channel, username, password)` — credentials
|
|
81
88
|
* channel submitted (password is empty while `passwordField` is off).
|
|
82
|
-
* - `method-select(channel, key)` — an alternative
|
|
83
|
-
* - `sso-click(channel)` — the primary sso
|
|
89
|
+
* - `method-select(channel, key)` — an alternative method row was picked.
|
|
90
|
+
* - `sso-click(channel)` — the primary sso row was picked.
|
|
84
91
|
* - `verify(kind, proof)` / `verify-resend` / `verify-back` — the MFA
|
|
85
92
|
* card's events, re-emitted one level up.
|
|
86
93
|
*
|
package/dist/types/index.d.ts
CHANGED
|
@@ -491,6 +491,8 @@ export { type HkLoginChannel as HkLoginChannel } from "./components/HkLoginFlow"
|
|
|
491
491
|
export { type HkLoginCredentialsChannel as HkLoginCredentialsChannel } from "./components/HkLoginFlow";
|
|
492
492
|
export { type HkLoginSsoChannel as HkLoginSsoChannel } from "./components/HkLoginFlow";
|
|
493
493
|
export { HkAuthSsoButton as HkAuthSsoButton } from "./components/HkAuthSsoButton";
|
|
494
|
+
export { HkAuthChannelList as HkAuthChannelList } from "./components/HkAuthChannelList";
|
|
495
|
+
export { type HkAuthChannelListEntry as HkAuthChannelListEntry } from "./components/HkAuthChannelList";
|
|
494
496
|
export { HkLocalePicker as HkLocalePicker } from "./components/HkLocalePicker";
|
|
495
497
|
export { HkAdminTablePage as HkAdminTablePage } from "./components/HkAdminTablePage";
|
|
496
498
|
export { HkPageHeader as HkPageHeader } from "./components/HkPageHeader";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const SCENE3D_CAPABILITIES: {
|
|
2
|
+
interfaces: string[];
|
|
3
|
+
wasiModules: string[];
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The value the publish returned (the previous declaration). Exported and read
|
|
7
|
+
* by the spec builder so this module cannot be dropped as dead code by a
|
|
8
|
+
* bundler that honours `sideEffects`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SCENE3D_DECLARATION_PUBLISHED: import("@celestia-island/tairitsu-host-client").CapabilityDeclaration | undefined;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { HostClientError } from "@celestia-island/tairitsu-host-client";
|
|
1
2
|
import type { FleetRowLike, FleetSceneSpec } from "./holographicFleetSpec";
|
|
3
|
+
/** Thrown when the spec builder is called before the component is usable. */
|
|
4
|
+
export declare class Scene3dNotReadyError extends Error {
|
|
5
|
+
constructor(cause?: unknown);
|
|
6
|
+
}
|
|
7
|
+
/** Resolves once the component is usable; rejects if it could not be built. */
|
|
8
|
+
export declare const scene3dReady: Promise<void>;
|
|
9
|
+
/** Keeps the declaration module live for bundlers that honour `sideEffects`. */
|
|
10
|
+
export declare const scene3dCapabilities: {
|
|
11
|
+
interfaces: string[];
|
|
12
|
+
wasiModules: string[];
|
|
13
|
+
};
|
|
2
14
|
/** Build the fleet scene spec through the wasm component. */
|
|
3
15
|
export declare function buildFleetSceneSpecWasm(rows: readonly FleetRowLike[]): FleetSceneSpec;
|
|
16
|
+
export { HostClientError };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celestia-island/hikari",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.459",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Hikari UI library, Vue 3 runtime — one design system for Vue 3 and Rust/WASM applications",
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
"**/*.scss",
|
|
108
108
|
"**/*.css",
|
|
109
109
|
"**/qr/declare-caps.ts",
|
|
110
|
-
"**/mermaid/declare-caps.ts"
|
|
110
|
+
"**/mermaid/declare-caps.ts",
|
|
111
|
+
"**/scene3d/declare-caps.ts"
|
|
111
112
|
],
|
|
112
113
|
"peerDependenciesMeta": {
|
|
113
114
|
"pinia": {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// HkAuthChannelList — the standard sign-in destination list (rows, not
|
|
2
|
+
// tiles). One full-width bordered row per channel: mark left, name
|
|
3
|
+
// right; token-driven so dark mode rides the triplets.
|
|
4
|
+
|
|
5
|
+
.hk-auth-channel-list {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--space-8, 0.5rem);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.hk-auth-channel-divider {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: var(--space-12, 0.75rem);
|
|
15
|
+
color: color-mix(in srgb, rgb(var(--color-text, 25 30 40)) 55%, transparent);
|
|
16
|
+
font-size: 0.75rem;
|
|
17
|
+
|
|
18
|
+
&::before,
|
|
19
|
+
&::after {
|
|
20
|
+
content: "";
|
|
21
|
+
flex: 1;
|
|
22
|
+
height: 1px;
|
|
23
|
+
background: color-mix(in srgb, rgb(var(--color-text, 25 30 40)) 12%, transparent);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.hk-auth-channel-rows {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: var(--space-8, 0.5rem);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.hk-auth-channel-row {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: var(--space-12, 0.75rem);
|
|
37
|
+
width: 100%;
|
|
38
|
+
padding: 0.625rem var(--space-16, 1rem);
|
|
39
|
+
border: 1px solid color-mix(in srgb, rgb(var(--color-text, 25 30 40)) 14%, transparent);
|
|
40
|
+
border-radius: var(--hi-radius-lg, 12px);
|
|
41
|
+
background: color-mix(in srgb, rgb(var(--color-surface, 255 255 255)) 88%, transparent);
|
|
42
|
+
color: rgb(var(--color-text, 25 30 40));
|
|
43
|
+
font-size: 0.875rem;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
transition:
|
|
46
|
+
border-color 0.15s ease,
|
|
47
|
+
background-color 0.15s ease;
|
|
48
|
+
|
|
49
|
+
&:hover:not(:disabled) {
|
|
50
|
+
border-color: color-mix(in srgb, rgb(var(--color-primary, 122 162 247)) 55%, transparent);
|
|
51
|
+
background: color-mix(in srgb, rgb(var(--color-surface, 255 255 255)) 100%, transparent);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:focus-visible {
|
|
55
|
+
outline: 2px solid rgb(var(--color-primary, 122 162 247));
|
|
56
|
+
outline-offset: 2px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:disabled {
|
|
60
|
+
opacity: 0.55;
|
|
61
|
+
cursor: not-allowed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.hk-auth-channel-icon {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
flex: none;
|
|
70
|
+
width: 1.25rem;
|
|
71
|
+
height: 1.25rem;
|
|
72
|
+
|
|
73
|
+
svg,
|
|
74
|
+
img {
|
|
75
|
+
width: 1.25rem;
|
|
76
|
+
height: 1.25rem;
|
|
77
|
+
object-fit: contain;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.hk-auth-channel-name {
|
|
82
|
+
text-align: left;
|
|
83
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { createApp, h, nextTick } from "vue";
|
|
3
|
+
|
|
4
|
+
import HkAuthChannelList from "./HkAuthChannelList";
|
|
5
|
+
|
|
6
|
+
const mounts: Array<{ app: ReturnType<typeof createApp>; container: HTMLElement }> = [];
|
|
7
|
+
|
|
8
|
+
function mount(node: ReturnType<typeof h>) {
|
|
9
|
+
const container = document.createElement("div");
|
|
10
|
+
document.body.appendChild(container);
|
|
11
|
+
const app = createApp({ render: () => node });
|
|
12
|
+
app.mount(container);
|
|
13
|
+
mounts.push({ app, container });
|
|
14
|
+
return container;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
for (const { app, container } of mounts.splice(0)) {
|
|
19
|
+
app.unmount();
|
|
20
|
+
container.remove();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const methods = [
|
|
25
|
+
{ key: "feishu", label: "飞书登录", icon: h("svg") },
|
|
26
|
+
{ key: "celestial", label: "Celestia 账号" },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
describe("HkAuthChannelList", () => {
|
|
30
|
+
it("renders full-width rows: the mark on the left, the channel NAME on the right", () => {
|
|
31
|
+
// 2026-11-22 user direction: sign-in destinations are a standard
|
|
32
|
+
// list — the name is plain sight, not a hover tooltip on a tile.
|
|
33
|
+
const c = mount(h(HkAuthChannelList, { methods }));
|
|
34
|
+
const rows = c.querySelectorAll<HTMLButtonElement>(".hk-auth-channel-row");
|
|
35
|
+
expect(rows.length).toBe(2);
|
|
36
|
+
expect(rows[0]!.textContent).toContain("飞书登录");
|
|
37
|
+
expect(rows[1]!.textContent).toContain("Celestia 账号");
|
|
38
|
+
// The accessible name rides the row itself (no role override).
|
|
39
|
+
expect(rows[0]!.getAttribute("aria-label")).toBe("飞书登录");
|
|
40
|
+
expect(rows[0]!.getAttribute("role")).toBeNull();
|
|
41
|
+
// The icon renders BEFORE the name (left-mark, right-name).
|
|
42
|
+
const icon = rows[0]!.querySelector(".hk-auth-channel-icon");
|
|
43
|
+
const name = rows[0]!.querySelector(".hk-auth-channel-name");
|
|
44
|
+
expect(icon).not.toBeNull();
|
|
45
|
+
expect(name).not.toBeNull();
|
|
46
|
+
expect((icon as HTMLElement).compareDocumentPosition(name as HTMLElement)
|
|
47
|
+
& Node.DOCUMENT_POSITION_FOLLOWING).not.toBe(0);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("emits select with the row's key and honors disabled rows", async () => {
|
|
51
|
+
const onSelect = vi.fn();
|
|
52
|
+
const c = mount(
|
|
53
|
+
h(HkAuthChannelList, {
|
|
54
|
+
methods: [
|
|
55
|
+
...methods,
|
|
56
|
+
{ key: "off", label: "Disabled", disabled: true },
|
|
57
|
+
],
|
|
58
|
+
onSelect,
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
const rows = c.querySelectorAll<HTMLButtonElement>(".hk-auth-channel-row");
|
|
62
|
+
rows[0]!.click();
|
|
63
|
+
await nextTick();
|
|
64
|
+
expect(onSelect).toHaveBeenCalledWith("feishu");
|
|
65
|
+
rows[2]!.click();
|
|
66
|
+
await nextTick();
|
|
67
|
+
expect(onSelect).toHaveBeenCalledTimes(1);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("renders an optional divider above the rows", () => {
|
|
71
|
+
const c = mount(h(HkAuthChannelList, { divider: "或", methods }));
|
|
72
|
+
expect(c.querySelector(".hk-auth-channel-divider")?.textContent).toContain("或");
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { defineComponent } from "vue";
|
|
2
|
+
|
|
3
|
+
import "./HkAuthChannelList.scss";
|
|
4
|
+
|
|
5
|
+
/** One sign-in destination row: the provider's mark on the left, the
|
|
6
|
+
* channel's name on the right. */
|
|
7
|
+
export interface HkAuthChannelListEntry {
|
|
8
|
+
key: string;
|
|
9
|
+
/** The channel name rendered as the row's label (e.g. 「飞书登录」). */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Prebuilt icon vnode (brand SVG, <img>, …) rendered at the row's
|
|
12
|
+
* left. Loose-typed like every auth icon: hosts materialize hikari
|
|
13
|
+
* against their own vue store. A missing icon leaves the slot empty
|
|
14
|
+
* (the label carries the row). */
|
|
15
|
+
icon?: unknown;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* HkAuthChannelList — the standard sign-in destination list (2026-11-22
|
|
21
|
+
* user direction): one FULL-WIDTH ROW per channel, the mark on the left
|
|
22
|
+
* and the channel's NAME in plain sight on the right.
|
|
23
|
+
*
|
|
24
|
+
* This replaces the small square icon tiles (`HkAuthMethodList`) as the
|
|
25
|
+
* form for login-flow destination buttons — on every Celestia auth
|
|
26
|
+
* surface. A tile hides the channel's name behind a hover tooltip; a
|
|
27
|
+
* list row states it. The row is a plain bordered button (token-driven,
|
|
28
|
+
* dark-mode automatic) — no square framing, no hover reveal.
|
|
29
|
+
*
|
|
30
|
+
* Control contract: the list never talks to a backend; the host injects
|
|
31
|
+
* `methods` and handles `select(key)`.
|
|
32
|
+
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <HkAuthChannelList
|
|
35
|
+
* methods={[{ key: "feishu", label: "飞书登录", icon: <FeishuMark /> }]}
|
|
36
|
+
* onSelect={(key) => startLogin(key)}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export const HkAuthChannelList = defineComponent({
|
|
41
|
+
name: "HkAuthChannelList",
|
|
42
|
+
props: {
|
|
43
|
+
/** Optional divider text rendered above the list (consumer copy). */
|
|
44
|
+
divider: { type: String, default: "" },
|
|
45
|
+
/** Channel rows, in render order. */
|
|
46
|
+
methods: {
|
|
47
|
+
type: Array as () => HkAuthChannelListEntry[],
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
emits: {
|
|
52
|
+
/** A channel row was activated. */
|
|
53
|
+
select: (_key: string) => true,
|
|
54
|
+
},
|
|
55
|
+
setup(props, { emit }) {
|
|
56
|
+
return () => (
|
|
57
|
+
<div class="hk-auth-channel-list">
|
|
58
|
+
{props.divider && (
|
|
59
|
+
<div class="hk-auth-channel-divider">
|
|
60
|
+
<span>{props.divider}</span>
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
<div class="hk-auth-channel-rows">
|
|
64
|
+
{props.methods.map((method) => (
|
|
65
|
+
<button
|
|
66
|
+
key={method.key}
|
|
67
|
+
type="button"
|
|
68
|
+
class="hk-auth-channel-row"
|
|
69
|
+
data-key={method.key}
|
|
70
|
+
disabled={method.disabled}
|
|
71
|
+
aria-label={method.label}
|
|
72
|
+
onClick={() => {
|
|
73
|
+
if (!method.disabled) emit("select", method.key);
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<span class="hk-auth-channel-icon" aria-hidden="true">
|
|
77
|
+
{method.icon ?? null}
|
|
78
|
+
</span>
|
|
79
|
+
<span class="hk-auth-channel-name">{method.label}</span>
|
|
80
|
+
</button>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export default HkAuthChannelList;
|
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from "vitest";
|
|
2
2
|
import { createApp, defineComponent, h } from "vue";
|
|
3
3
|
|
|
4
|
-
// Mock the
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// (packages/vue/src/wasm/highlight/hikari_wasm_highlight.d.ts). A
|
|
9
|
-
// mock
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
// Mock the host client's async door at the top level: the composable now loads
|
|
5
|
+
// the component through `loadComponent`, so that is where "the wasm module
|
|
6
|
+
// lands" happens. The returned surface mimics the real call shape, and its
|
|
7
|
+
// `html` is the real ABI record — `HighlightResult = { html?: string }`, NOT a
|
|
8
|
+
// bare string (packages/vue/src/wasm/highlight/hikari_wasm_highlight.d.ts). A
|
|
9
|
+
// string-returning mock hid the seam that fed the record to `v-html`; the
|
|
10
|
+
// adapter test pins that separately.
|
|
11
|
+
//
|
|
12
|
+
// Mocking the module this test used to mock (`../wasm/highlight/...`) no longer
|
|
13
|
+
// works: the composable imports it from `src/composables/`, which resolves to a
|
|
14
|
+
// different module id, so the real component loaded and the assertion never
|
|
15
|
+
// saw `<wasm>` (measured).
|
|
16
|
+
vi.mock("@celestia-island/tairitsu-host-client", async (importOriginal) => {
|
|
17
|
+
const actual = await importOriginal<typeof import("@celestia-island/tairitsu-host-client")>();
|
|
18
|
+
return {
|
|
19
|
+
...actual,
|
|
20
|
+
loadComponent: async () =>
|
|
21
|
+
({
|
|
22
|
+
exports: {},
|
|
23
|
+
call: (_name: string, text: string, lang: string) => ({
|
|
24
|
+
html: `<wasm>${lang}:${text}</wasm>`,
|
|
25
|
+
}),
|
|
26
|
+
stop: async () => {},
|
|
27
|
+
whenIdle: async () => {},
|
|
28
|
+
stopped: false,
|
|
29
|
+
}) as unknown as Awaited<ReturnType<typeof actual.loadComponent>>,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
14
32
|
|
|
15
33
|
import HkDiffViewer from "./HkDiffViewer";
|
|
16
34
|
import { useHighlight } from "../composables/useHighlight";
|
|
@@ -13,11 +13,9 @@
|
|
|
13
13
|
margin-inline: auto;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
// The sso card's
|
|
17
|
-
//
|
|
18
|
-
// channel tabs.
|
|
16
|
+
// The sso card's destination list block: full-width rows (the 2026-11
|
|
17
|
+
// standard-list direction), so this wrapper just adds breathing room
|
|
18
|
+
// under the channel tabs.
|
|
19
19
|
.hk-login-flow-sso {
|
|
20
|
-
display: flex;
|
|
21
|
-
justify-content: center;
|
|
22
20
|
padding-block: var(--space-24, 1.5rem) var(--space-8, 0.5rem);
|
|
23
21
|
}
|
|
@@ -139,7 +139,7 @@ describe("HkLoginFlow — credentials channel", () => {
|
|
|
139
139
|
expect(onSubmit).toHaveBeenCalledWith("cloud", "demiurge", "");
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
-
it("renders alternative method
|
|
142
|
+
it("renders alternative method rows and forwards their selection", async () => {
|
|
143
143
|
const onSelect = vi.fn();
|
|
144
144
|
const channel: HkLoginChannel = {
|
|
145
145
|
key: "cloud",
|
|
@@ -154,24 +154,27 @@ describe("HkLoginFlow — credentials channel", () => {
|
|
|
154
154
|
onMethodSelect: onSelect,
|
|
155
155
|
}),
|
|
156
156
|
);
|
|
157
|
-
const
|
|
158
|
-
expect(
|
|
159
|
-
expect(
|
|
160
|
-
|
|
157
|
+
const row = c.querySelector<HTMLButtonElement>('[data-key="feishu"]');
|
|
158
|
+
expect(row).not.toBeNull();
|
|
159
|
+
expect(row!.getAttribute("aria-label")).toBe("Feishu");
|
|
160
|
+
expect(c.querySelector(".hk-auth-channel-divider")?.textContent).toContain("或");
|
|
161
|
+
row!.click();
|
|
161
162
|
await nextTick();
|
|
162
163
|
expect(onSelect).toHaveBeenCalledWith("cloud", "feishu");
|
|
163
164
|
});
|
|
164
165
|
|
|
165
166
|
it("omits the whole methods block when the list is empty", () => {
|
|
166
167
|
const c = mount(h(HkLoginFlow, { channels: [cloudChannel], modelValue: "cloud" }));
|
|
167
|
-
// An empty methods list must not pad a dead strip under the form
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
// An empty methods list must not pad a dead strip under the form
|
|
169
|
+
// (the operative pin is the channel list's absence — the retired
|
|
170
|
+
// tile wrapper's absence is not observable here, R2).
|
|
171
|
+
expect(c.querySelector(".hk-auth-channel-list")).toBeNull();
|
|
172
|
+
expect(c.querySelector(".hk-auth-channel-divider")).toBeNull();
|
|
170
173
|
});
|
|
171
174
|
});
|
|
172
175
|
|
|
173
176
|
describe("HkLoginFlow — sso channel", () => {
|
|
174
|
-
it("renders
|
|
177
|
+
it("renders the channel's destination row and emits sso-click", async () => {
|
|
175
178
|
const onClick = vi.fn();
|
|
176
179
|
const c = mount(
|
|
177
180
|
h(HkLoginFlow, {
|
|
@@ -180,9 +183,13 @@ describe("HkLoginFlow — sso channel", () => {
|
|
|
180
183
|
onSsoClick: onClick,
|
|
181
184
|
}),
|
|
182
185
|
);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
+
// The 2026-11 list form: the destination renders as a standard
|
|
187
|
+
// channel row (icon left, name right) — not a square tile.
|
|
188
|
+
const row = c.querySelector<HTMLButtonElement>(".hk-auth-channel-row");
|
|
189
|
+
expect(row).not.toBeNull();
|
|
190
|
+
// No buttonLabel on the fixture → the conventional channel label.
|
|
191
|
+
expect(row!.getAttribute("aria-label")).toBe("Organization login");
|
|
192
|
+
row!.click();
|
|
186
193
|
await nextTick();
|
|
187
194
|
expect(onClick).toHaveBeenCalledWith("org");
|
|
188
195
|
});
|
|
@@ -198,7 +205,7 @@ describe("HkLoginFlow — sso channel", () => {
|
|
|
198
205
|
);
|
|
199
206
|
// A redirect flow has no second step by construction; the panel
|
|
200
207
|
// keeps showing the account card instead of a dead MFA card.
|
|
201
|
-
expect(c.querySelector(".hk-auth-
|
|
208
|
+
expect(c.querySelector(".hk-auth-channel-row")).not.toBeNull();
|
|
202
209
|
});
|
|
203
210
|
});
|
|
204
211
|
|
|
@@ -391,6 +398,42 @@ describe("HkLoginFlow — host wiring details", () => {
|
|
|
391
398
|
expect(active?.textContent).toContain("Celestia Cloud");
|
|
392
399
|
});
|
|
393
400
|
|
|
401
|
+
it("keeps one channel's account name out of another channel's field", () => {
|
|
402
|
+
// The per-channel seed override: the org (email) channel pins "" so
|
|
403
|
+
// the cloud channel's typed account name — seeded flow-level for the
|
|
404
|
+
// verify round-trip — never pre-fills the org email field. Both
|
|
405
|
+
// postures mounted statically (the channel swap's crossfade settles
|
|
406
|
+
// on environment-dependent timing; the MOUNT-TIME seed is the
|
|
407
|
+
// contract under test).
|
|
408
|
+
const orgMount = mount(
|
|
409
|
+
h(HkLoginFlow, {
|
|
410
|
+
channels: [
|
|
411
|
+
{ key: "cloud", mode: "credentials" },
|
|
412
|
+
{ key: "org", mode: "credentials", usernameType: "email", usernameAutocomplete: "email", initialUsername: "" },
|
|
413
|
+
],
|
|
414
|
+
modelValue: "org",
|
|
415
|
+
initialUsername: "cloud-user",
|
|
416
|
+
}),
|
|
417
|
+
);
|
|
418
|
+
expect(
|
|
419
|
+
orgMount.querySelector<HTMLInputElement>('input[name="signin-username"]')?.value,
|
|
420
|
+
).toBe("");
|
|
421
|
+
|
|
422
|
+
const cloudMount = mount(
|
|
423
|
+
h(HkLoginFlow, {
|
|
424
|
+
channels: [
|
|
425
|
+
{ key: "cloud", mode: "credentials" },
|
|
426
|
+
{ key: "org", mode: "credentials", usernameType: "email", usernameAutocomplete: "email", initialUsername: "" },
|
|
427
|
+
],
|
|
428
|
+
modelValue: "cloud",
|
|
429
|
+
initialUsername: "cloud-user",
|
|
430
|
+
}),
|
|
431
|
+
);
|
|
432
|
+
expect(
|
|
433
|
+
cloudMount.querySelector<HTMLInputElement>('input[name="signin-username"]')?.value,
|
|
434
|
+
).toBe("cloud-user");
|
|
435
|
+
});
|
|
436
|
+
|
|
394
437
|
it("forwards per-channel autocomplete tokens to the username field", () => {
|
|
395
438
|
const c = mount(
|
|
396
439
|
h(HkLoginFlow, {
|