@celestia-island/hikari 0.55.500 → 0.55.502

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 (44) hide show
  1. package/dist/types/components/HkBoard.d.ts +19 -0
  2. package/dist/types/components/HkLoginFlow.d.ts +7 -4
  3. package/dist/types/components/HkMermaidDiagram.d.ts +18 -9
  4. package/dist/types/components/centralAuthMarkData.d.ts +10 -0
  5. package/dist/types/components/loginProviders.d.ts +108 -0
  6. package/dist/types/composables/useBoardCamera.d.ts +8 -2
  7. package/dist/types/index.d.ts +1 -0
  8. package/dist/types/mermaid/layout.d.ts +61 -7
  9. package/dist/types/utils/boardCamera.d.ts +25 -4
  10. package/dist/types/utils/boardEdges.d.ts +61 -5
  11. package/package.json +1 -1
  12. package/src/components/HkBoard.arrows.test.tsx +311 -0
  13. package/src/components/HkBoard.tsx +48 -10
  14. package/src/components/HkLoginFlow.test.tsx +107 -4
  15. package/src/components/HkLoginFlow.tsx +18 -7
  16. package/src/components/HkMermaidDiagram.scss +42 -1
  17. package/src/components/HkMermaidDiagram.styles.test.ts +31 -0
  18. package/src/components/HkMermaidDiagram.test.tsx +72 -4
  19. package/src/components/HkMermaidDiagram.tsx +88 -20
  20. package/src/components/__tests__/hkMermaidLayout.test.ts +279 -2
  21. package/src/components/__tests__/mermaidClusterBackEdge.test.ts +34 -0
  22. package/src/components/__tests__/mermaidClusterLane.test.ts +43 -0
  23. package/src/components/centralAuthMarkData.ts +35 -0
  24. package/src/components/loginProviders.test.ts +236 -0
  25. package/src/components/loginProviders.ts +132 -0
  26. package/src/composables/useBoardCamera.ts +10 -2
  27. package/src/errorLandingStandalone/error-landing.html +1 -1
  28. package/src/i18n/locales/ar/components.json +1 -0
  29. package/src/i18n/locales/de/components.json +1 -0
  30. package/src/i18n/locales/en/components.json +1 -0
  31. package/src/i18n/locales/es/components.json +1 -0
  32. package/src/i18n/locales/fr/components.json +1 -0
  33. package/src/i18n/locales/ja/components.json +1 -0
  34. package/src/i18n/locales/ko/components.json +1 -0
  35. package/src/i18n/locales/pt/components.json +1 -0
  36. package/src/i18n/locales/ru/components.json +1 -0
  37. package/src/i18n/locales/zh-Hans/components.json +1 -0
  38. package/src/i18n/locales/zh-Hant/components.json +1 -0
  39. package/src/index.ts +13 -0
  40. package/src/mermaid/layout.ts +460 -77
  41. package/src/utils/boardCamera.test.ts +38 -0
  42. package/src/utils/boardCamera.ts +39 -5
  43. package/src/utils/boardEdges.test.ts +121 -3
  44. package/src/utils/boardEdges.ts +172 -16
@@ -56,6 +56,8 @@ export interface BoardNodeInput {
56
56
  /** Page payload, handed back through the scoped slot. */
57
57
  data?: Record<string, unknown>;
58
58
  }
59
+ /** What a drag may do once the whole content is already in view. */
60
+ export type BoardPanMode = "clamp" | "float";
59
61
  export interface BoardEdgeInput {
60
62
  id: string;
61
63
  from: string;
@@ -102,6 +104,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
102
104
  type: BooleanConstructor;
103
105
  default: boolean;
104
106
  };
107
+ /** `"clamp"` (default): content smaller than the viewport re-centers,
108
+ * so a fitted board cannot be dragged. `"float"`: it may be dragged
109
+ * while half of it stays in view — a diagram is content a reader
110
+ * may want to move aside, not a full-bleed scene. */
111
+ pan: {
112
+ type: PropType<BoardPanMode>;
113
+ default: string;
114
+ };
105
115
  minK: {
106
116
  type: NumberConstructor;
107
117
  default: number;
@@ -156,6 +166,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
156
166
  type: BooleanConstructor;
157
167
  default: boolean;
158
168
  };
169
+ /** `"clamp"` (default): content smaller than the viewport re-centers,
170
+ * so a fitted board cannot be dragged. `"float"`: it may be dragged
171
+ * while half of it stays in view — a diagram is content a reader
172
+ * may want to move aside, not a full-bleed scene. */
173
+ pan: {
174
+ type: PropType<BoardPanMode>;
175
+ default: string;
176
+ };
159
177
  minK: {
160
178
  type: NumberConstructor;
161
179
  default: number;
@@ -195,6 +213,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
195
213
  interactive: boolean;
196
214
  gridSize: number;
197
215
  minimap: boolean;
216
+ pan: BoardPanMode;
198
217
  fitOnMount: boolean;
199
218
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
200
219
  export default _default;
@@ -86,10 +86,13 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
86
86
  * - `v-model` (channel key) + `channels` — the segment group.
87
87
  * - `step` — `'account' | 'verify'`; the host flips it when its ladder
88
88
  * answers with factors, and the SAME card swaps its header copy and
89
- * body over to the step-up (which never renders on an sso channel: a
90
- * redirect flow has no second step by construction — passing
91
- * `step="verify"` with an sso channel renders the account body as a
92
- * fail-safe).
89
+ * body over to the step-up. A redirect (sso) channel has no second step
90
+ * of its own, so `step="verify"` without an announced factor table
91
+ * renders the account body as a fail-safe — but a host that RECEIVED a
92
+ * ladder (the OAuth hand-off calling back with `mfa_pending` /
93
+ * `mfa_factors`, which is the only way an SSO-only deployment can ask
94
+ * for a second factor) passes `verifyFactors` and gets the real step-up
95
+ * on the sso channel too.
93
96
  * - `account-submit(channel, username, password)` — credentials
94
97
  * channel submitted (password is empty while `passwordField` is off).
95
98
  * - `sso-click(channel)` — the primary sso row was picked.
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * HkMermaidDiagram — the mermaid rendering business component, a peer of
3
3
  * the rich-text family (HkMarkdownRenderer renders prose, this renders
4
- * diagrams), built on the HkBoard 画板 (world camera, grid, minimap,
5
- * pan/zoom chrome).
4
+ * diagrams), built on the HkBoard 画板 (world camera, pan/zoom).
6
5
  *
7
6
  * Contract (user direction 2026-11-16):
8
7
  * - the PARSER is never bundled here: hosts register an engine on
@@ -10,9 +9,9 @@
10
9
  * gives syntax highlighting). No engine, or a parse failure, or an
11
10
  * unsupported diagram type → the source falls back to a plain code
12
11
  * block — never a broken surface.
13
- * - the caller decides the chrome: `minimap` hides the bottom-right
14
- * minimap, `interactive` gates canvas dragging/zoom (HkBoard props,
15
- * passed straight through).
12
+ * - the caller decides the chrome: `minimap` turns the zoom bar off,
13
+ * `interactive` gates canvas dragging/zoom (an HkBoard prop, passed
14
+ * straight through).
16
15
  *
17
16
  * Layout lives in ../mermaid/layout.ts (pure, deterministic); this file
18
17
  * only adapts the laid-out model into HkBoard nodes/edges and paints
@@ -26,7 +25,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
26
25
  type: StringConstructor;
27
26
  required: true;
28
27
  };
29
- /** Show the bottom-right minimap (HkBoard pass-through). */
28
+ /** Show the zoom bar under the diagram (`−` `NN%` `+` reset; the `%`
29
+ * label opens a slider). It sits in its own row BELOW the board — the
30
+ * board's own bottom-right dock is an overlay, and at fit zoom it
31
+ * covered the last node of every wide diagram (measured on
32
+ * docs.celestia.world 2026-11-27). */
30
33
  minimap: {
31
34
  type: BooleanConstructor;
32
35
  default: boolean;
@@ -42,7 +45,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
42
45
  type: BooleanConstructor;
43
46
  default: boolean;
44
47
  };
45
- /** Explicit viewport height in px (default: content-clamped auto). */
48
+ /** Height of the diagram STAGE in px (default: content-clamped auto).
49
+ * The zoom bar row below it adds its own height on top. */
46
50
  height: {
47
51
  type: PropType<number | "auto">;
48
52
  default: string;
@@ -60,7 +64,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
60
64
  type: StringConstructor;
61
65
  required: true;
62
66
  };
63
- /** Show the bottom-right minimap (HkBoard pass-through). */
67
+ /** Show the zoom bar under the diagram (`−` `NN%` `+` reset; the `%`
68
+ * label opens a slider). It sits in its own row BELOW the board — the
69
+ * board's own bottom-right dock is an overlay, and at fit zoom it
70
+ * covered the last node of every wide diagram (measured on
71
+ * docs.celestia.world 2026-11-27). */
64
72
  minimap: {
65
73
  type: BooleanConstructor;
66
74
  default: boolean;
@@ -76,7 +84,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
76
84
  type: BooleanConstructor;
77
85
  default: boolean;
78
86
  };
79
- /** Explicit viewport height in px (default: content-clamped auto). */
87
+ /** Height of the diagram STAGE in px (default: content-clamped auto).
88
+ * The zoom bar row below it adds its own height on top. */
80
89
  height: {
81
90
  type: PropType<number | "auto">;
82
91
  default: string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The central identity provider's mark, ready for `src=` / CSS `url(…)`.
3
+ *
4
+ * A 64×64 WebP data URI (transparent background) generated from the landing
5
+ * repo's logo — the single home for Celestia artwork — and committed as text
6
+ * so no host has to serve or resolve a separate asset file. Render it at
7
+ * 16×16; the source carries a 2 px margin so it optically matches the
8
+ * surrounding icons.
9
+ */
10
+ export declare const hkCentralAuthMarkSrc = "data:image/webp;base64,UklGRn4GAABXRUJQVlA4WAoAAAAQAAAAPwAAPwAAQUxQSNkCAAABoENtmyHb+v7665xzbdu2QtsOGdqMbNu2bdu2bR6r/vq/oKtmZtdkJ4qICcCMgYpNv51mfzx9xLKAhpEQBZY46PFf07Qfd0HoQcL8v9BJcuzNGwA6OAXWuOofknT+v6SEWsR5nE56ziRvWhpBBiOKha9IZM5OTudN0Ipgzn/c2XVz/rcfoCUplgKw5+9kcnbdJy+CUFLsSGM9kffOhygaVVAUjVEUs91AJtaN+yKWIs7y1AM98at1UBw153zzzTkaxRU/oDl7TH5dTfEIrRcyccIOi+968j1vf//X2LF/f//O/aftseQmfzOxZ+NrkBLwPnNvzOQk9jk509h75nejIB1B/LYvOmnJLLu752zJSGefzr/nrM30c390Z5/u7G/svLUxPw6gQef/89XCV8Pxx+wlCN4ehsyvtaJ4hNae8TUIihGXMLWXeDu0dsBwHI9YUmzE3J5xF2hJMN84emvO6csglBDwCq21zE+DoBpxKlNriVci1hQbZG8tcyvokG0uPURczdRa4l2oCWb5jbk15//zQEqKDZnZvHEHaCniWKb2kp+BWFLcMQzGx6ClIG/Q2sv8NIh0IvAV8zD8GhE7wLK/D4Nz7CooXvQlh/bLizp/Tnrhf3p7zgkvTfqzM+vceJnWXuaHmHO2DhBuZGrP+EBAUUZh/2FIPA6jpIOAFZK351wHAeWAl2mtGT8MgqqGza29vFvQWsS2Rm/LPW+PWAlYZ9L0KfSW3KenSesgFILM8zV325o5t5ONe+zGr+eRUMAjPB3Yh0ytJPJA4HQ+goLg1gdEI7b9g2YtZON/uyOqPHArpFONWOJuMpuPjFsmH1kOEb2LCAAFtn2RpKXsg/GcjOTruwAKQERqVQnAJjf8SZJulrN7yT1nMyfJf2/dEggBA1cB5tnhwjf/40DHvn3JLvMDUIyoKgAsutlBFz/87g//TjanTf7vx/cevfSQLRcHAFXMaAgAVlA4IH4DAAAwEgCdASpAAEAAPi0Sh0KhoQz/M1QMAWJaADBh8bRM6B3FNtz4jHrAdEd1DH7AewB5bnsh/tz6M14LVkxZxhL0Oq/xl/kcQb+ONVfCyQzjunfUY5bpo9d56p89H6Nx0S6MxndiQ9w5TfsOsrnw9W1l/5rwnhZzfmLYNUEfs7i099P7lntWnjn4ynYArGlDWUh+urfxUnlPAhAAAP7/8P/KlWK3IGe2n/8KojvxJifgAAO9+vh/fkEFgSlmIqPDv3T7RQ0CZRQOZGJwjPj//rXP6uePkolb6J/0A1mt/7mpLljmN0Cp5cPl/L2FryRVDmPvjU3CEsVYRi9Bz4qXF5DtMZxGhqQwERfnrApm8HCalY7kjArvQxn4olYyIIa8R/R+azN0XvUzfwlznElwP6sFb4gT/xo+aAUwgzQ+pjl+ME/564LY7RhuNAjsOq/qFnVE8dSEtuXnl3P9Y1RxqYng0X09wVp1ks4hdvBN7VSfuarJG09r4HzvH7v54EWLz8nJ6Vr8Xt5uT27JKl+zGmqS9nofl02pvSXHwO0St2h/i/8MZZ59PlHF2PukkhKqyHGw+8/ObFIv935oyHb9NFLz7X0Mo9QBEuD+gWPSObcUlcKCq8WlEINfq7pAWIW4N54ZsvmfA+iBJfEfLSZrU2k7/eJ9MAKhQyhs6Et0PT6V+NV1G3+7fisVHPqP3ZbyriPKCZwC7JM14FLOeoQojKkycN5UgZLymrRDnHRKyoeAJuI1IlNpEZR16WXqB/dTh3S9JmwKmnFI29A9ya5n8zZZtFZv0BJAwPVu6Vul+ZWR++r88rnnNYmchVhb/k1OuQQ9/KRwYPCmmOgqEgea0RO1UaIrBmaWSidbCNdRiQfpfpuRtx50oGgB/mBqPtYzau8Xmtzuxx+LuqFSvkJhdHVSPLmUa0OPiApax9P7KoG+N6vhYxCZp+Eel5OnGxirDLikN8hpbR4eqlyEy9bKWBhT/8vKtLTPvvivL+BLEV0F9LeS1FMwKrp1MoJLh4HHQfA4A+hP1J7cPwhV2D8wOq0DcUIdhneBVsjZAjocZKu17Xdt7MXykUZ3kSyL//aExzcAs9OhvQFXGHHjOlglyGA7YbdiwpvpuCPlJWRQ6UsvzeEfO7QpHAf/8FcdFwPiFUk2Xc3UDfJl/7IJJGHZK+qt2xZ75f9fV0krMW4AAAA=";
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The built-in presentation of the central identity provider's sign-in row.
3
+ *
4
+ * Celestia's central identity provider has one wire id (`"erp"` — the id every
5
+ * live service already emits, which this module deliberately does NOT rename)
6
+ * and no name or icon of its own. Every host therefore shipped its own answer:
7
+ * a bare id in the row, or a hand-typed "Celestia ID" with no mark. This module
8
+ * is the single home for both, so chest, 0721 and future front ends render the
9
+ * same row.
10
+ *
11
+ * The module is free of Vue dependencies EXCEPT for reading the name out of
12
+ * hikari's own i18n context ({@link hkCentralAuthName}): the predicate and the
13
+ * constants below stay pure, so a non-Vue consumer can still import them.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * import {
18
+ * HK_CENTRAL_AUTH_PROVIDER_ID, hkCentralAuthMarkSrc, hkCentralAuthName,
19
+ * hkProviderLabelIsId,
20
+ * } from "@celestia-island/hikari/vue";
21
+ *
22
+ * const name = hkCentralAuthName();
23
+ * const label =
24
+ * method.provider === HK_CENTRAL_AUTH_PROVIDER_ID && hkProviderLabelIsId(method.provider, method.label)
25
+ * ? name
26
+ * : method.label;
27
+ * const icon =
28
+ * method.provider === HK_CENTRAL_AUTH_PROVIDER_ID && !method.icon
29
+ * ? hkCentralAuthMarkSrc
30
+ * : method.icon;
31
+ * ```
32
+ *
33
+ * The rules a host must honour, in order of precedence:
34
+ *
35
+ * 1. **Nothing an operator configures is overridden.** A provider `label` or
36
+ * `icon` set in the host's own configuration always wins; a deployment that
37
+ * renames the row to its company's portal keeps that name.
38
+ * 2. **The built-in name fills a fallback, not a default.** Serve the translated
39
+ * name only when the label has degenerated to the id — the long-standing
40
+ * server-side convention where an unset label is emitted as the id. Use
41
+ * `hkProviderLabelIsId` for that test; it matches the id exactly, so a
42
+ * deliberately lower-cased alias ("erp-europe") is left alone. Read the name
43
+ * through {@link hkCentralAuthName}.
44
+ * 3. **The built-in mark fills a gap, not a default.** Use
45
+ * {@link hkCentralAuthMarkSrc} only when the server supplied no icon.
46
+ * 4. **A deployment that does not configure this provider sees no change.** The
47
+ * self-hosted default is still local username/password: nothing here is
48
+ * imported unless the login-policy document actually lists the provider.
49
+ * 5. **The icon is a 64×64 inline WebP data URI.** Render it at 16×16 — the
50
+ * same box as the surrounding row glyphs; the source is scaled for exactly
51
+ * that and carries the margin to match their optical weight.
52
+ */
53
+ /**
54
+ * The central identity provider's wire id: the value every live host already
55
+ * emits in its login-policy document under `methods[].provider`.
56
+ *
57
+ * This is a wire contract with kirino and with each deployed service. It is
58
+ * named here so a host does not have to hard-code the literal, NOT to
59
+ * introduce a new id — the asset in this module (name and mark) is what
60
+ * changed, the id is not.
61
+ */
62
+ export declare const HK_CENTRAL_AUTH_PROVIDER_ID = "erp";
63
+ /**
64
+ * The i18n key of the provider's display name, in every shipped locale.
65
+ *
66
+ * `hkCentralAuthName()` reads it; a host whose own catalog merges the
67
+ * `hikari::` keys may also pass it to its `t()` directly, with
68
+ * {@link HK_CENTRAL_AUTH_NAME_EN} as the fallback.
69
+ */
70
+ export declare const HK_CENTRAL_AUTH_NAME_KEY = "hikari::loginFlow.providerCelestiaAuth";
71
+ /** The provider's display name in English — the canonical literal and the
72
+ * fallback behind {@link HK_CENTRAL_AUTH_NAME_KEY}. */
73
+ export declare const HK_CENTRAL_AUTH_NAME_EN = "Celestia Unified Authentication Platform";
74
+ /**
75
+ * The provider's display name in the language hikari's locale context is
76
+ * currently in — THE entry point hosts should render.
77
+ *
78
+ * Why not `t(HK_CENTRAL_AUTH_NAME_KEY, HK_CENTRAL_AUTH_NAME_EN)` in the host's
79
+ * own translator: that only works for a host whose i18n catalog actually merges
80
+ * hikari's `hikari::` keys. 0721's vue-i18n instance deliberately does not, so
81
+ * the same call would sit on the English fallback in every language. Every host
82
+ * does, however, keep hikari's context in step with the app language when the
83
+ * user switches (`setLocale` / `setHikariLocale` on that switch), which is
84
+ * exactly the state this function reads — so it is the one spelling that works
85
+ * everywhere. A host that DOES merge the keys may keep using `t(...)` with
86
+ * {@link HK_CENTRAL_AUTH_NAME_KEY} and {@link HK_CENTRAL_AUTH_NAME_EN}.
87
+ *
88
+ * Reads hikari's reactive locale state, so calling it inside a render or a
89
+ * `computed` makes the row re-render on a language switch. Call it there — do
90
+ * not hoist the result into a module-level constant, which would freeze
91
+ * whichever language happened to be active at import time. It returns whatever
92
+ * hikari's current language is; a host that never calls `setLocale` sees
93
+ * English.
94
+ */
95
+ export declare function hkCentralAuthName(): string;
96
+ /**
97
+ * Whether a provider's `label` has degenerated to its id — the server-side
98
+ * convention for "the operator did not name this provider", so the host should
99
+ * substitute its built-in name.
100
+ *
101
+ * True when the label is absent, empty, or whitespace only, and when it equals
102
+ * `providerId` character for character. Case differences are NOT a match:
103
+ * `"ERP"` over `"erp"` is a name an operator typed, and a host must not
104
+ * overwrite it. An empty `providerId` is never a match — every empty label
105
+ * would otherwise collapse onto it.
106
+ */
107
+ export declare function hkProviderLabelIsId(providerId: string, label: string | null | undefined): boolean;
108
+ export { hkCentralAuthMarkSrc } from "./centralAuthMarkData";
@@ -7,13 +7,15 @@
7
7
  * snapping — an active pinch stays raw/continuous while the fingers
8
8
  * move and only animates to the nearest rung on release;
9
9
  * - wheel steps one rung per notch, anchored at the pointer;
10
- * - pan is clamped against the content bbox (half-viewport slack);
10
+ * - pan is clamped against the content bbox (half-viewport slack), and a
11
+ * board may let content smaller than the viewport float instead of
12
+ * re-centering (`smallContentPan: "keep"`);
11
13
  * - reduced-motion (or `animated: false`) skips the tween and snaps.
12
14
  *
13
15
  * The component wires DOM events; this composable stays input-agnostic.
14
16
  */
15
17
  import { type MaybeRefOrGetter, type Ref } from "vue";
16
- import { type BoardCamera, type BoardPoint, type BoardRect, type BoardViewport } from "../utils/boardCamera";
18
+ import { type BoardCamera, type BoardPoint, type BoardRect, type BoardSmallContentPan, type BoardViewport } from "../utils/boardCamera";
17
19
  export interface UseBoardCameraOptions {
18
20
  /** The viewport element (screen space) — used for anchor math. */
19
21
  viewportSize: MaybeRefOrGetter<BoardViewport>;
@@ -28,6 +30,10 @@ export interface UseBoardCameraOptions {
28
30
  * library's default cap (BOARD_FIT_CAP). Unset keeps the default; the
29
31
  * camera clamp still honours maxK. */
30
32
  fitCap?: number;
33
+ /** What a drag does with content smaller than the viewport: `"center"`
34
+ * (default) pins a fitted board, `"keep"` lets it be dragged while half
35
+ * of it stays in view (see BoardSmallContentPan). */
36
+ smallContentPan?: BoardSmallContentPan;
31
37
  }
32
38
  export interface UseBoardCameraReturn {
33
39
  camera: Ref<BoardCamera>;
@@ -502,6 +502,7 @@ export { type HkAuthChannelListEntry as HkAuthChannelListEntry } from "./compone
502
502
  export { HkAuthHandoff as HkAuthHandoff } from "./components/HkAuthHandoff";
503
503
  export { type HkAuthHandoffAction as HkAuthHandoffAction, type HkAuthHandoffStatus as HkAuthHandoffStatus, } from "./components/HkAuthHandoff";
504
504
  export { hkIsSameOriginPath as hkIsSameOriginPath, hkLoginPlanFromDiscovery as hkLoginPlanFromDiscovery, hkRelayEntryHref as hkRelayEntryHref, type HkLoginDiscovery as HkLoginDiscovery, type HkLoginMethod as HkLoginMethod, type HkLoginMode as HkLoginMode, type HkLoginPlan as HkLoginPlan, type HkLoginPlanCopy as HkLoginPlanCopy, } from "./components/loginDiscovery";
505
+ export { HK_CENTRAL_AUTH_NAME_EN as HK_CENTRAL_AUTH_NAME_EN, HK_CENTRAL_AUTH_NAME_KEY as HK_CENTRAL_AUTH_NAME_KEY, HK_CENTRAL_AUTH_PROVIDER_ID as HK_CENTRAL_AUTH_PROVIDER_ID, hkCentralAuthMarkSrc as hkCentralAuthMarkSrc, hkCentralAuthName as hkCentralAuthName, hkProviderLabelIsId as hkProviderLabelIsId, } from "./components/loginProviders";
505
506
  export { HkLocalePicker as HkLocalePicker } from "./components/HkLocalePicker";
506
507
  export { HkAdminTablePage as HkAdminTablePage } from "./components/HkAdminTablePage";
507
508
  export { HkMasterDetail as HkMasterDetail } from "./components/HkMasterDetail";
@@ -13,7 +13,7 @@
13
13
  * `j:` junctions, `g:` gantt bars, `s:` section labels, `ax` the day
14
14
  * axis) so a doc can never collide two parts.
15
15
  */
16
- import type { MermaidDoc, MermaidGraphDoc } from "./types";
16
+ import type { MermaidDoc, MermaidDirection } from "./types";
17
17
  export type MermaidNodeKind = "shape" | "group" | "participant" | "class" | "section" | "task" | "axis" | "pie" | "quadrant";
18
18
  export interface LaidOutNode {
19
19
  id: string;
@@ -29,17 +29,24 @@ export interface LaidOutNode {
29
29
  passthrough?: boolean;
30
30
  data: Record<string, unknown>;
31
31
  }
32
+ /** The board anchor modes the mermaid layout asks for (a subset of the
33
+ * board's — see utils/boardEdges.ts BoardAnchorMode). */
34
+ export type MermaidAnchorMode = "center" | "nearest" | "top" | "bottom" | "left" | "right";
32
35
  export interface LaidOutEdge {
33
36
  id: string;
34
37
  from: string;
35
38
  to: string;
36
39
  /** Board route style; bezier = mermaid flowchart feel. */
37
40
  style: "straight" | "bezier" | "orthogonal";
38
- /** Border anchor overrides. An edge into a subgraph cluster lands on the
39
- * frame's border (mermaid attaches there), not on its center — the center
40
- * sits behind the frame's own members. */
41
- anchorFrom?: "center" | "nearest" | "top" | "top-left" | "fan";
42
- anchorTo?: "center" | "nearest" | "top" | "top-left" | "fan";
41
+ /** Border anchors. A flow edge leaves through the side its source's rank
42
+ * stack grows toward and arrives through the opposite side of its target
43
+ * (a top-down flowchart: bottom → top), which is how mermaid.js docks
44
+ * them — and what keeps every arrowhead head-on for the border it lands
45
+ * on. An edge into a subgraph cluster lands on the frame's border
46
+ * (`nearest`), not on its center — the center sits behind the frame's own
47
+ * own members. */
48
+ anchorFrom?: MermaidAnchorMode;
49
+ anchorTo?: MermaidAnchorMode;
43
50
  dashed: boolean;
44
51
  arrow: "none" | "solid" | "open";
45
52
  label: string | null;
@@ -71,6 +78,30 @@ interface GraphItem {
71
78
  /** Original parse order — the stable tie-break everywhere. */
72
79
  order: number;
73
80
  }
81
+ interface RankedEdge {
82
+ index: number;
83
+ from: string;
84
+ to: string;
85
+ }
86
+ /**
87
+ * The edges to read AGAINST their direction so the graph becomes a DAG (a
88
+ * feedback arc set), found by a depth-first search: an edge leading back
89
+ * to a node still on the search stack closes a cycle. The search starts
90
+ * from the true sources (fewest incoming edges first), then follows parse
91
+ * order — a cluster's members are parsed before the node that feeds them,
92
+ * and starting THERE turns the feeding edge into the "back" one (the
93
+ * audit corpus 2026-11-27: `A --> B` came out below B).
94
+ *
95
+ * WHY (measured on the same corpus): the previous ranking ran Kahn's
96
+ * algorithm on the raw graph, and Kahn's queue never reaches a node that
97
+ * sits in or after a cycle — `Start → Is it? → OK → Rethink → Is it?`
98
+ * ranked Start, OK, Rethink and End all at 0 and drew the decision diamond
99
+ * BELOW its own outputs. Reading one edge of every cycle backwards is what
100
+ * dagre (mermaid.js's engine) does; that edge is still DRAWN forwards
101
+ * afterwards, docked around the side of the stack (see `flowAnchors`).
102
+ * Returns the indexes of the edges to read backwards.
103
+ */
104
+ export declare function feedbackArcSet(items: GraphItem[], edges: RankedEdge[]): Set<number>;
74
105
  export interface GraphLayoutInput {
75
106
  /** World-rect size per node id (already includes card chrome). */
76
107
  items: GraphItem[];
@@ -78,7 +109,7 @@ export interface GraphLayoutInput {
78
109
  from: string;
79
110
  to: string;
80
111
  }>;
81
- direction: MermaidGraphDoc["direction"];
112
+ direction: MermaidDirection;
82
113
  /** Cross-axis gap between same-rank siblings, world px. Cluster frames pad
83
114
  * their members on both sides (and reserve a caption band on the stacked
84
115
  * axis), so a grouped graph widens this budget — `GROUP_CROSS_GAP_H` for
@@ -86,13 +117,36 @@ export interface GraphLayoutInput {
86
117
  * touch and overlap. */
87
118
  crossGap?: number;
88
119
  }
120
+ export interface GraphLane {
121
+ /** Index into the `edges` input. */
122
+ edge: number;
123
+ /** The lane's world centers, from the rank after the lower end to the
124
+ * rank before the upper end (visual order). */
125
+ points: Array<{
126
+ x: number;
127
+ y: number;
128
+ }>;
129
+ }
89
130
  export interface GraphLayoutOutput {
90
131
  positions: Map<string, {
91
132
  x: number;
92
133
  y: number;
93
134
  }>;
135
+ /** FLOW rank per node id — 0 is where the flow starts (the bottom for BT,
136
+ * the right for RL). An edge toward a higher flow rank points down the
137
+ * stack and docks on the stack-growing sides (see `flowAnchors`). */
138
+ ranks: Map<string, number>;
94
139
  width: number;
95
140
  height: number;
141
+ /** Lane cells, one entry per edge that skips ranks (edges read against
142
+ * their direction by the cycle breaker get none — they loop around the
143
+ * side instead). */
144
+ lanes: GraphLane[];
145
+ /** Indexes of the `edges` input the cycle breaker reads AGAINST their
146
+ * direction (the feedback arc set). The ranker never sees such an edge,
147
+ * so its source always lands in a HIGHER flow rank than its target —
148
+ * which is what makes it a back edge for docking. */
149
+ backEdges: number[];
96
150
  }
97
151
  /** Rank + barycenter-order + pixel-place a node-edge graph. */
98
152
  export declare function layoutGraph(input: GraphLayoutInput): GraphLayoutOutput;
@@ -83,12 +83,23 @@ export declare function boardToWorld(cam: BoardCamera, sx: number, sy: number):
83
83
  * callers quantize when they want the ladder (see quantizeBoardK).
84
84
  */
85
85
  export declare function boardZoomAt(cam: BoardCamera, targetK: number, anchorScreen: BoardPoint): BoardCamera;
86
+ /**
87
+ * What a drag may do with content that is SMALLER than the viewport on an
88
+ * axis.
89
+ * - `"center"` (the board default): re-center — a fitted board is pinned,
90
+ * a drag never moves it;
91
+ * - `"keep"`: it may be dragged anywhere as long as half of it stays in
92
+ * view (the same "never pushed fully out of view" invariant the larger
93
+ * than-viewport case already has, applied to small content).
94
+ */
95
+ export type BoardSmallContentPan = "center" | "keep";
86
96
  /**
87
97
  * Clamp the pan so the content bbox can never be dragged fully out of
88
98
  * view: content larger than the viewport keeps half a viewport of slack
89
- * on each side; content smaller than the viewport re-centers.
99
+ * on each side; content smaller than the viewport re-centers — unless
100
+ * `small` is `"keep"` (see BoardSmallContentPan).
90
101
  */
91
- export declare function boardClampPan(cam: BoardCamera, content: BoardRect, viewport: BoardViewport, slack?: number): BoardCamera;
102
+ export declare function boardClampPan(cam: BoardCamera, content: BoardRect, viewport: BoardViewport, slack?: number, small?: BoardSmallContentPan): BoardCamera;
92
103
  /**
93
104
  * Fit the whole content bbox into the viewport (centered, padded). Wide
94
105
  * boards shrink as far as needed to show everything — fit is allowed
@@ -116,5 +127,15 @@ export declare const boardEaseOutCubic: (t: number) => number;
116
127
  * `t` is clamped to [0, 1] and eased with ease-out cubic.
117
128
  */
118
129
  export declare function boardTweenCam(from: BoardCamera, to: BoardCamera, t: number): BoardCamera;
119
- /** Union of rects (ignoring empty ones) — the content bbox for clamp/fit. */
120
- export declare function boardBBox(rects: BoardRect[]): BoardRect;
130
+ /**
131
+ * Union of rects (ignoring empty ones) — the content bbox for clamp/fit.
132
+ * A zero-size rect is a JUNCTION (an invisible node that only routes
133
+ * edges): by default it does not count, but a board whose picture is made
134
+ * of them (a sequence diagram's message rows sit on zero-size junctions)
135
+ * must pass `points: true` or the bbox covers the participants only and
136
+ * the fit parks the camera on a quarter of the diagram (measured on
137
+ * docs.celestia.world 2026-11-27: 7 of 9 messages fell outside the card).
138
+ */
139
+ export declare function boardBBox(rects: BoardRect[], opts?: {
140
+ points?: boolean;
141
+ }): BoardRect;
@@ -11,6 +11,10 @@
11
11
  * • "nearest" — the border point closest to the other end;
12
12
  * • "top" — top-border midpoint (top-aligned columns, operations-style
13
13
  * vertical drops);
14
+ * • "bottom" / "left" / "right" — the other three border midpoints: a
15
+ * flowchart leaves through the side its rank stack grows
16
+ * toward and arrives through the opposite one, so every
17
+ * arrow is head-on for the border it lands on;
14
18
  * • "top-left" — the top-left corner (top-left aligned rows);
15
19
  * • "fan" — 天女散花: when one node feeds SEVERAL edges, the
16
20
  * attach points spread evenly across the exit border
@@ -18,7 +22,9 @@
18
22
  *
19
23
  * - ROUTE STYLE (`BoardEdgeStyle`) — how the two anchors join:
20
24
  * • "straight" — a straight segment;
21
- * • "bezier" — a horizontal-tangent cubic (flowing curve);
25
+ * • "bezier" — a normal-tangent cubic (flowing curve): it leaves
26
+ * and arrives ALONG the border normals of its anchors
27
+ * (see "Route tangents" below);
22
28
  * • "orthogonal" — strict elbow (H-V-H), the operations pipe discipline;
23
29
  * • "spine" — vertical-first elbow (V-H), for tree rails.
24
30
  *
@@ -54,7 +60,7 @@ export interface BoardNodeRect {
54
60
  w: number;
55
61
  h: number;
56
62
  }
57
- export type BoardAnchorMode = "center" | "nearest" | "top" | "top-left" | "fan";
63
+ export type BoardAnchorMode = "center" | "nearest" | "top" | "bottom" | "left" | "right" | "top-left" | "fan";
58
64
  export type BoardEdgeStyle = "straight" | "bezier" | "orthogonal" | "spine";
59
65
  /**
60
66
  * Resolve the anchor point on `rect` for an edge toward `to`.
@@ -62,12 +68,62 @@ export type BoardEdgeStyle = "straight" | "bezier" | "orthogonal" | "spine";
62
68
  * border; no-ops when count ≤ 1).
63
69
  */
64
70
  export declare function boardAnchor(rect: BoardNodeRect, mode: BoardAnchorMode, to: BoardPoint, index?: number, count?: number): BoardPoint;
71
+ /**
72
+ * Unit travel directions at the two ends of a route: what a bezier leaves
73
+ * `a` along, and what it arrives at `b` along.
74
+ *
75
+ * WHY THIS EXISTS (measured on docs.celestia.world 2026-11-27): an SVG
76
+ * `orient="auto"` arrowhead rotates to the path's END TANGENT. The bezier
77
+ * used to leave and arrive horizontally no matter where its anchors sat,
78
+ * so every arrow of a top-down flowchart pointed LEFT or RIGHT — and since
79
+ * a path ends ON the node border, the half of that sideways triangle that
80
+ * stuck out above the node was all the reader saw. (A cubic whose last
81
+ * control point coincides with its end has a ZERO tangent; Chrome 155 orients
82
+ * that marker at 180° — also sideways.) A route therefore has to arrive
83
+ * along the border normal of the node it enters, which only the caller
84
+ * knows: it owns the rects. Callers pass them in; without them the tangent
85
+ * falls back to the route's dominant travel axis.
86
+ */
87
+ export interface BoardTangents {
88
+ /** Unit direction the route leaves its first point along. */
89
+ from?: BoardPoint;
90
+ /** Unit direction the route arrives at its last point along. */
91
+ to?: BoardPoint;
92
+ }
93
+ /**
94
+ * Fallback tangent: the dominant travel axis of `a → b` (vertical when the
95
+ * route climbs or drops at least as much as it strafes). A zero-length
96
+ * leg has no travel to read — it returns the x axis.
97
+ */
98
+ export declare function boardAxisTangent(a: BoardPoint, b: BoardPoint): BoardPoint;
99
+ /**
100
+ * Outward unit normal of the border `point` sits on, or `null` when no
101
+ * border is within `tol` of it (the point sits inside the rect, or farther
102
+ * than `tol` outside it) or the rect is a degenerate junction — every
103
+ * border of a zero-size rect is the same dot, so it names no side.
104
+ *
105
+ * `outward` breaks a corner tie: at a corner two borders qualify, and the
106
+ * one whose normal points most along `outward` is the side the route is
107
+ * really using. For the route's FIRST point pass its travel direction (the
108
+ * route leaves along the normal); for its LAST point pass the negated
109
+ * travel direction (the route arrives against the normal).
110
+ */
111
+ export declare function boardAnchorNormal(rect: BoardNodeRect, point: BoardPoint, outward?: BoardPoint, tol?: number): BoardPoint | null;
65
112
  /** One edge between two anchor points. */
66
- export declare function boardEdgePath(a: BoardPoint, b: BoardPoint, style: BoardEdgeStyle): string;
113
+ export declare function boardEdgePath(a: BoardPoint, b: BoardPoint, style: BoardEdgeStyle, tangents?: BoardTangents): string;
67
114
  /**
68
115
  * One edge routed THROUGH via points (the centers of empty corner/junction
69
116
  * nodes). The style applies to every leg; orthogonal legs chain into clean
70
117
  * right angles, straight legs chain into a polyline, bezier legs chain
71
- * with smooth midpoints so long vias read as one flowing curve.
118
+ * with a tangent per point so long vias read as one flowing curve — and so
119
+ * the LAST leg still arrives along its tangent (a midpoint-derived control
120
+ * point would sit on the end point and zero the end tangent).
121
+ */
122
+ export declare function boardViaPath(a: BoardPoint, via: BoardPoint[], b: BoardPoint, style: BoardEdgeStyle, tangents?: BoardTangents): string;
123
+ /**
124
+ * Where a route's caption belongs: on the bezier itself (its parametric
125
+ * midpoint — for opposing border normals that is the chord midpoint, for
126
+ * an elbow it is the bend), on the middle via point when the route bends
127
+ * through junctions, else on the chord midpoint.
72
128
  */
73
- export declare function boardViaPath(a: BoardPoint, via: BoardPoint[], b: BoardPoint, style: BoardEdgeStyle): string;
129
+ export declare function boardEdgeMidpoint(a: BoardPoint, via: BoardPoint[], b: BoardPoint, style: BoardEdgeStyle, tangents?: BoardTangents): BoardPoint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.500",
3
+ "version": "0.55.502",
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",