@celestia-island/hikari 0.55.458 → 0.55.460

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.
Files changed (61) hide show
  1. package/dist/types/components/HkAuthChannelList.d.ts +66 -0
  2. package/dist/types/components/HkLoginFlow.d.ts +13 -12
  3. package/dist/types/components/HkMarkdownEditor.d.ts +123 -0
  4. package/dist/types/index.d.ts +4 -0
  5. package/dist/types/mermaid/wasmEngine.d.ts +1 -1
  6. package/package.json +1 -1
  7. package/src/components/HkAuthChannelList.scss +83 -0
  8. package/src/components/HkAuthChannelList.test.tsx +74 -0
  9. package/src/components/HkAuthChannelList.tsx +88 -0
  10. package/src/components/HkDiffViewer.epoch.test.tsx +28 -10
  11. package/src/components/HkLoginFlow.scss +3 -5
  12. package/src/components/HkLoginFlow.test.tsx +20 -13
  13. package/src/components/HkLoginFlow.tsx +24 -19
  14. package/src/components/HkMarkdownEditor.barrel.test.ts +42 -0
  15. package/src/components/HkMarkdownEditor.scss +190 -0
  16. package/src/components/HkMarkdownEditor.test.tsx +404 -0
  17. package/src/components/HkMarkdownEditor.tsx +357 -0
  18. package/src/composables/useHighlight.coldPath.test.ts +162 -0
  19. package/src/composables/useHighlight.hostSurface.test.ts +220 -0
  20. package/src/composables/useHighlight.ts +102 -27
  21. package/src/i18n/locales/ar/components.json +14 -1
  22. package/src/i18n/locales/de/components.json +14 -1
  23. package/src/i18n/locales/en/components.json +14 -1
  24. package/src/i18n/locales/es/components.json +14 -1
  25. package/src/i18n/locales/fr/components.json +14 -1
  26. package/src/i18n/locales/ja/components.json +14 -1
  27. package/src/i18n/locales/ko/components.json +14 -1
  28. package/src/i18n/locales/pt/components.json +14 -1
  29. package/src/i18n/locales/ru/components.json +14 -1
  30. package/src/i18n/locales/zh-Hans/components.json +14 -1
  31. package/src/i18n/locales/zh-Hant/components.json +14 -1
  32. package/src/index.ts +4 -0
  33. package/src/mermaid/wasmEngine.ts +1 -1
  34. package/src/scene3d/wasmFleetSpec.ts +1 -1
  35. package/src/utils/qr/qrEncoder.ts +6 -1
  36. package/src/wasm/highlight/hikari_wasm_highlight.d.ts +3 -2
  37. package/src/wasm/highlight/hikari_wasm_highlight.js +486 -160
  38. package/src/wasm/highlight/interfaces/celestia-hikari-highlight-types.d.ts +4 -0
  39. package/src/wasm/highlight/interfaces/wasi-cli-exit.d.ts +1 -0
  40. package/src/wasm/highlight/interfaces/wasi-clocks-monotonic-clock.d.ts +2 -0
  41. package/src/wasm/highlight/interfaces/wasi-clocks-wall-clock.d.ts +6 -0
  42. package/src/wasm/mermaid/hikari_wasm_mermaid.d.ts +3 -2
  43. package/src/wasm/mermaid/hikari_wasm_mermaid.js +487 -161
  44. package/src/wasm/mermaid/interfaces/celestia-hikari-mermaid-types.d.ts +4 -0
  45. package/src/wasm/mermaid/interfaces/wasi-cli-exit.d.ts +1 -0
  46. package/src/wasm/mermaid/interfaces/wasi-clocks-monotonic-clock.d.ts +2 -0
  47. package/src/wasm/mermaid/interfaces/wasi-clocks-wall-clock.d.ts +6 -0
  48. package/src/wasm/qr/hikari_wasm_qr.d.ts +4 -3
  49. package/src/wasm/qr/hikari_wasm_qr.js +475 -155
  50. package/src/wasm/qr/interfaces/{hikari-qr-types.d.ts → celestia-hikari-qr-types.d.ts} +1 -2
  51. package/src/wasm/qr/interfaces/wasi-cli-exit.d.ts +1 -0
  52. package/src/wasm/qr/interfaces/wasi-clocks-monotonic-clock.d.ts +2 -0
  53. package/src/wasm/qr/interfaces/wasi-clocks-wall-clock.d.ts +6 -0
  54. package/src/wasm/scene3d/hikari_wasm_scene3d.d.ts +4 -3
  55. package/src/wasm/scene3d/hikari_wasm_scene3d.js +482 -161
  56. package/src/wasm/scene3d/interfaces/{hikari-scene3d-types.d.ts → celestia-hikari-scene3d-types.d.ts} +1 -1
  57. package/src/wasm/scene3d/interfaces/wasi-cli-exit.d.ts +1 -0
  58. package/src/wasm/scene3d/interfaces/wasi-clocks-monotonic-clock.d.ts +2 -0
  59. package/src/wasm/scene3d/interfaces/wasi-clocks-wall-clock.d.ts +6 -0
  60. package/src/wasm/highlight/interfaces/hikari-highlight-types.d.ts +0 -4
  61. package/src/wasm/mermaid/interfaces/hikari-mermaid-types.d.ts +0 -4
@@ -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 HkAuthMethodListEntry } from "./HkAuthMethodList";
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:
@@ -34,27 +34,28 @@ export interface HkLoginCredentialsChannel {
34
34
  * opening card must not ask for it (2026-11 user direction). */
35
35
  passwordField?: boolean;
36
36
  submitLabel?: string;
37
- /** Alternative sign-in tiles under the form (rendered only when
37
+ /** Alternative sign-in rows under the form (rendered only when
38
38
  * non-empty; an empty list omits the whole methods block instead of
39
39
  * padding a dead strip). */
40
- methods?: HkAuthMethodListEntry[];
41
- /** Divider text above the tiles; consumer-localized on purpose. */
40
+ methods?: HkAuthChannelListEntry[];
41
+ /** Divider text above the rows; consumer-localized on purpose. */
42
42
  methodsDivider?: string;
43
43
  }
44
44
  /** A channel whose whole sign-in is one redirect (a.celestia.world's
45
- * "Celestia" tile jumping to the central login, an org channel that
46
- * only offers Feishu): the card renders one centered primary tile and
47
- * `sso-click` sends the host off to build its OAuth URL. */
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. */
48
49
  export interface HkLoginSsoChannel {
49
50
  key: string;
50
51
  mode: "sso";
51
52
  label?: string;
52
53
  title?: string;
53
54
  subtitle?: string;
54
- /** Provider mark for the tile (brand SVG, <img>, …). Loose-typed like
55
+ /** Provider mark for the row (brand SVG, <img>, …). Loose-typed like
55
56
  * every auth icon: hosts materialize hikari against their own vue. */
56
57
  icon: unknown;
57
- /** Accessible name + the line under the tile; defaults to the channel
58
+ /** The row's label (accessible name + visible text); defaults to the
58
59
  * label. */
59
60
  buttonLabel?: string;
60
61
  disabled?: boolean;
@@ -71,7 +72,7 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
71
72
  * visual — the pill segment group (hidden when a deployment offers a
72
73
  * single channel; a lone dead segment reads as a broken switch), the
73
74
  * height-morphing channel swap, the direction-aware account→verify
74
- * slide, the methods tiles, the MFA card — while staying a CONTROLLED
75
+ * slide, the methods rows, the MFA card — while staying a CONTROLLED
75
76
  * component: no endpoint, no URL building, no factor ladder policy.
76
77
  * Each host (the chest migration plus the erp and arona login surfaces,
77
78
  * landing as their own PRs) keeps its own auth client and drives the
@@ -85,8 +86,8 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
85
86
  * channel renders the account card as a fail-safe).
86
87
  * - `account-submit(channel, username, password)` — credentials
87
88
  * channel submitted (password is empty while `passwordField` is off).
88
- * - `method-select(channel, key)` — an alternative tile was picked.
89
- * - `sso-click(channel)` — the primary sso tile was picked.
89
+ * - `method-select(channel, key)` — an alternative method row was picked.
90
+ * - `sso-click(channel)` — the primary sso row was picked.
90
91
  * - `verify(kind, proof)` / `verify-resend` / `verify-back` — the MFA
91
92
  * card's events, re-emitted one level up.
92
93
  *
@@ -0,0 +1,123 @@
1
+ import "./HkMarkdownEditor.scss";
2
+ /** Editing dialect of the editor body. `markdown` runs the toolbar and the
3
+ * rendered live preview; `plain` reduces the surface to a textarea (the
4
+ * split preview degrades to pre-wrapped plain text). */
5
+ export type HkMarkdownEditorMode = "markdown" | "plain";
6
+ /** The result of one pure text transform: the rewritten source plus the
7
+ * selection the editor should restore afterwards. Selections are plain
8
+ * string indices into `text` — the same coordinates a textarea's
9
+ * selectionStart/selectionEnd speak. */
10
+ export interface MarkdownTextEdit {
11
+ text: string;
12
+ selectionStart: number;
13
+ selectionEnd: number;
14
+ }
15
+ /**
16
+ * Wrap the current selection with markers (pure). `before`/`after` default
17
+ * to the same string (`**`, `*`, `` ` ``, `~~` …). The returned selection is
18
+ * restored INSIDE the wrap: a non-empty selection stays selected around its
19
+ * wrapped text, an empty one parks the caret between the markers so the
20
+ * next keystroke lands inside the emphasis.
21
+ */
22
+ export declare function applyWrap(source: string, selectionStart: number, selectionEnd: number, before: string, after?: string): MarkdownTextEdit;
23
+ /**
24
+ * Prefix every line covered by the selection (pure). The operated range is
25
+ * the full line range containing the selection — a caret mid-line still
26
+ * prefixes that whole line, and a selection spanning lines prefixes each
27
+ * one. `prefix` is either a literal (`- `, `> `, `## `) or a per-line
28
+ * factory receiving the zero-based line index (ordered lists emit
29
+ * `1. `, `2. `, …). The returned selection covers the rewritten lines.
30
+ */
31
+ export declare function applyLinePrefix(source: string, selectionStart: number, selectionEnd: number, prefix: string | ((lineIndex: number) => string)): MarkdownTextEdit;
32
+ /**
33
+ * HkMarkdownEditor — the family's standard two-pane markdown/plain-text
34
+ * editor. Left: the textarea (every toolbar action a pure string transform
35
+ * over the current selection, refocused with a restored selection after
36
+ * each action). Right: the live preview through HkMarkdownRenderer,
37
+ * shown in split view — markdown mode renders, plain mode degrades to
38
+ * pre-wrapped plain text. Image drops/pastes are REPORTED (one
39
+ * `imageDrop` event per file) and never embedded or uploaded: the host
40
+ * owns the upload and inserts its own markdown marker.
41
+ */
42
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
43
+ modelValue: {
44
+ type: StringConstructor;
45
+ default: string;
46
+ };
47
+ mode: {
48
+ type: () => HkMarkdownEditorMode;
49
+ default: string;
50
+ };
51
+ view: {
52
+ type: () => "split" | "edit";
53
+ default: string;
54
+ };
55
+ placeholder: {
56
+ type: StringConstructor;
57
+ default: string;
58
+ };
59
+ disabled: {
60
+ type: BooleanConstructor;
61
+ default: boolean;
62
+ };
63
+ /** Toolbar actions row (markdown mode only — plain mode has no
64
+ * markdown to insert). The mode segmented control always renders. */
65
+ toolbar: {
66
+ type: BooleanConstructor;
67
+ default: boolean;
68
+ };
69
+ /** Report drag-dropped and pasted images through `imageDrop`. */
70
+ imageDrop: {
71
+ type: BooleanConstructor;
72
+ default: boolean;
73
+ };
74
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
75
+ "update:modelValue": (_value: string) => true;
76
+ "update:mode": (_mode: HkMarkdownEditorMode) => true;
77
+ imageDrop: (_file: File) => true;
78
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
79
+ modelValue: {
80
+ type: StringConstructor;
81
+ default: string;
82
+ };
83
+ mode: {
84
+ type: () => HkMarkdownEditorMode;
85
+ default: string;
86
+ };
87
+ view: {
88
+ type: () => "split" | "edit";
89
+ default: string;
90
+ };
91
+ placeholder: {
92
+ type: StringConstructor;
93
+ default: string;
94
+ };
95
+ disabled: {
96
+ type: BooleanConstructor;
97
+ default: boolean;
98
+ };
99
+ /** Toolbar actions row (markdown mode only — plain mode has no
100
+ * markdown to insert). The mode segmented control always renders. */
101
+ toolbar: {
102
+ type: BooleanConstructor;
103
+ default: boolean;
104
+ };
105
+ /** Report drag-dropped and pasted images through `imageDrop`. */
106
+ imageDrop: {
107
+ type: BooleanConstructor;
108
+ default: boolean;
109
+ };
110
+ }>> & Readonly<{
111
+ "onUpdate:modelValue"?: ((_value: string) => any) | undefined;
112
+ onImageDrop?: ((_file: File) => any) | undefined;
113
+ "onUpdate:mode"?: ((_mode: HkMarkdownEditorMode) => any) | undefined;
114
+ }>, {
115
+ view: "split" | "edit";
116
+ mode: HkMarkdownEditorMode;
117
+ toolbar: boolean;
118
+ disabled: boolean;
119
+ modelValue: string;
120
+ placeholder: string;
121
+ imageDrop: boolean;
122
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
123
+ export default _default;
@@ -347,6 +347,8 @@ export { default as HkLabel } from "./components/HkLabel";
347
347
  export { default as HkListTransition } from "./components/HkListTransition";
348
348
  export { default as HkLoadMore } from "./components/HkLoadMore";
349
349
  export { default as HkMarkdownRenderer } from "./components/HkMarkdownRenderer";
350
+ export { default as HkMarkdownEditor, applyLinePrefix, applyWrap } from "./components/HkMarkdownEditor";
351
+ export type { HkMarkdownEditorMode, MarkdownTextEdit } from "./components/HkMarkdownEditor";
350
352
  export { default as HkMermaidDiagram } from "./components/HkMermaidDiagram";
351
353
  export { default as HkTerminal } from "./components/HkTerminal";
352
354
  export { default as HkModal } from "./components/HkModal";
@@ -491,6 +493,8 @@ export { type HkLoginChannel as HkLoginChannel } from "./components/HkLoginFlow"
491
493
  export { type HkLoginCredentialsChannel as HkLoginCredentialsChannel } from "./components/HkLoginFlow";
492
494
  export { type HkLoginSsoChannel as HkLoginSsoChannel } from "./components/HkLoginFlow";
493
495
  export { HkAuthSsoButton as HkAuthSsoButton } from "./components/HkAuthSsoButton";
496
+ export { HkAuthChannelList as HkAuthChannelList } from "./components/HkAuthChannelList";
497
+ export { type HkAuthChannelListEntry as HkAuthChannelListEntry } from "./components/HkAuthChannelList";
494
498
  export { HkLocalePicker as HkLocalePicker } from "./components/HkLocalePicker";
495
499
  export { HkAdminTablePage as HkAdminTablePage } from "./components/HkAdminTablePage";
496
500
  export { HkPageHeader as HkPageHeader } from "./components/HkPageHeader";
@@ -1,6 +1,6 @@
1
1
  import { HostClientError } from "@celestia-island/tairitsu-host-client";
2
2
  import type { MermaidParserEngine } from "./engine";
3
- /** The component's `hikari:mermaid/types` `parse-result` record. */
3
+ /** The component's `celestia:hikari-mermaid/types` `parse-result` record. */
4
4
  export interface MermaidParseResult {
5
5
  /** JSON-serialized MermaidDiagram; absent when unrecognized. */
6
6
  json?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.458",
3
+ "version": "0.55.460",
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",
@@ -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 wasm module at the top level: the composable's lazy import()
5
- // resolves to this factory, exactly like the real module landing after
6
- // the first plaintext render. The shape is the real ABI — the binding
7
- // returns `HighlightResult = { html?: string }`, NOT a bare string
8
- // (packages/vue/src/wasm/highlight/hikari_wasm_highlight.d.ts). A string
9
- // mock here hid the seam that fed the record to `v-html`, so every row
10
- // rendered "[object Object]"; the adapter test pins that separately.
11
- vi.mock("../wasm/highlight/hikari_wasm_highlight.js", () => ({
12
- highlight: (text: string, lang: string) => ({ html: `<wasm>${lang}:${text}</wasm>` }),
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 hero tile block: the HkAuthCard form column centers
17
- // its children, so this wrapper just adds breathing room under the
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 tiles and forwards their selection", async () => {
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 tile = c.querySelector<HTMLButtonElement>('[data-key="feishu"]');
158
- expect(tile).not.toBeNull();
159
- expect(c.querySelector(".s-auth-methods-divider")?.textContent).toContain("或");
160
- tile!.click();
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
- expect(c.querySelector(".s-auth-methods")).toBeNull();
169
- expect(c.querySelector(".s-auth-methods-divider")).toBeNull();
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 one centered primary tile and emits sso-click", async () => {
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
- const tile = c.querySelector<HTMLButtonElement>(".hk-auth-sso-tile");
184
- expect(tile).not.toBeNull();
185
- tile!.click();
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-sso-tile")).not.toBeNull();
208
+ expect(c.querySelector(".hk-auth-channel-row")).not.toBeNull();
202
209
  });
203
210
  });
204
211