@celestia-island/hikari 0.55.479 → 0.55.482
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/components/HkLoginFlow.d.ts +17 -5
- package/dist/types/composables/useChromeActionSize.d.ts +10 -0
- package/package.json +1 -1
- package/src/components/HkBadge.scss +12 -0
- package/src/components/HkBadge.test.tsx +26 -0
- package/src/components/HkFaceShell.rail.test.tsx +1 -1
- package/src/components/HkLoginFlow.scss +13 -9
- package/src/components/HkLoginFlow.test.tsx +123 -43
- package/src/components/HkLoginFlow.tsx +25 -20
- package/src/components/adminHeaderTitle.contract.test.ts +39 -0
- package/src/composables/useChromeActionSize.ts +23 -2
- package/src/styles/admin-tokens.scss +15 -0
|
@@ -125,11 +125,23 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
|
|
|
125
125
|
* group — a channel switch crossfades only the body and leaves the
|
|
126
126
|
* tabs and the header copy mounted (the 2026-11-24 stable-shell
|
|
127
127
|
* direction, unchanged);
|
|
128
|
-
* - the card
|
|
129
|
-
* a height morph inside a
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
128
|
+
* - the card is NOT top-edge pinned (2026-11-24 ruling, reversing the
|
|
129
|
+
* pin #1501 introduced on 11-23): a height morph inside a
|
|
130
|
+
* vertically centered host re-centers the box, so the top edge travels
|
|
131
|
+
* half the height delta in step with the 300 ms morph and the card
|
|
132
|
+
* ENDS the swap centered for its new height. `useAnchoredTop` used to
|
|
133
|
+
* hold the pre-morph top edge instead and keep holding it at rest,
|
|
134
|
+
* which left a taller step half the growth below the center for good
|
|
135
|
+
* (engine-measured in a 752 px stage: 219.6 px above vs 163.4 px below
|
|
136
|
+
* on the verify step) — the user read that as "the card sits too low".
|
|
137
|
+
* The pin also measured in viewport coordinates while scrolling fires
|
|
138
|
+
* no ResizeObserver, so a swap on a scrolled page folded the scroll
|
|
139
|
+
* offset into its translateY (a 60 px downward jump, painted outside
|
|
140
|
+
* the scroll range). What "do not let the card fly" still buys is
|
|
141
|
+
* everything else on this list: the frame node is the single static
|
|
142
|
+
* one, the swap is an in-card crossfade, and the box arrives BEFORE
|
|
143
|
+
* the entering generation fades in — content that has appeared never
|
|
144
|
+
* moves again.
|
|
133
145
|
*
|
|
134
146
|
* Copy rules locked by the chest blueprint (LoginView.test.ts, kept
|
|
135
147
|
* verbatim here): segment labels are ALWAYS the panel's own locale keys,
|
|
@@ -12,5 +12,15 @@ import { type ComputedRef } from "vue";
|
|
|
12
12
|
* prevent (2026-10-27: the filter triggers stayed at the old flat 28
|
|
13
13
|
* while the header moved to the ladder, and the funnel read as a
|
|
14
14
|
* different button family from its own neighbors).
|
|
15
|
+
*
|
|
16
|
+
* SSR / FIRST PAINT (2026-11-24, hikari#1531 item 1): the server has no
|
|
17
|
+
* viewport, so the pre-mount answer is the NARROW rung — 28 fits every
|
|
18
|
+
* viewport (the wide 32 is what overflows a 320px phone), so narrow is
|
|
19
|
+
* the safe guess for an unknown one, and a phone's first paint then
|
|
20
|
+
* matches what it keeps after mount (no size swap). A desktop pays one
|
|
21
|
+
* grow-in on mount instead of a shrink — the acceptable direction. This
|
|
22
|
+
* is the documented contract hikari#1531 asks for; hosts that want a
|
|
23
|
+
* different first paint own it above the hook (the docs shell's local
|
|
24
|
+
* `headerActionSize` stays a valid overlay).
|
|
15
25
|
*/
|
|
16
26
|
export declare function useChromeActionSize(): ComputedRef<28 | 32>;
|
package/package.json
CHANGED
|
@@ -32,6 +32,18 @@
|
|
|
32
32
|
start a text selection (the workspace tag contract makes HkCopyBadge
|
|
33
33
|
the copy path instead). */
|
|
34
34
|
@include user-select(none);
|
|
35
|
+
|
|
36
|
+
/* Icon spacing is the pill's own gap — never the child's margin. An
|
|
37
|
+
`mr-*` utility on an embedded svg/img double-spaces the label (the
|
|
38
|
+
OAuth provider pill shipped shield + mr-1 on top of this gap, reading
|
|
39
|
+
as stray spaces inside the tag), and per-child margins would make
|
|
40
|
+
every icon call site renegotiate the pill's geometry. This rule
|
|
41
|
+
outranks the utility classes (0,1,1 beats `.mr-*` at 0,1,0), so a
|
|
42
|
+
stale `mr-*` stays harmless after this ships. */
|
|
43
|
+
> svg,
|
|
44
|
+
> img {
|
|
45
|
+
margin: 0;
|
|
46
|
+
}
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
/* ---------- size ---------- */
|
|
@@ -69,3 +69,29 @@ describe("HkBadge pulse stylesheet contract", () => {
|
|
|
69
69
|
expect(css).toMatch(/@media \(prefers-reduced-motion: reduce\)\s*\{[^@]*\.hk-badge\[data-pulse\] \[data-el=dot\]\s*\{[^}]*animation:\s*none/);
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
+
|
|
73
|
+
// The pill's gap is the single source of truth for icon spacing. A utility
|
|
74
|
+
// margin on an embedded svg (the OAuth provider pill shipped `mr-1` under
|
|
75
|
+
// the shield) double-spaces the label; the sheet neutralizes child svg/img
|
|
76
|
+
// margins so a stale utility stays harmless. Mutation contract — 变异表 in
|
|
77
|
+
// the PR body: MUT:badge-child-margin drops the sheet block and "zeroes
|
|
78
|
+
// margins on embedded svg and img children" reds; widen the selector to a
|
|
79
|
+
// descendant form and "never widens the rule past direct children" catches
|
|
80
|
+
// it too. A regression here re-opens the double gap everywhere at once.
|
|
81
|
+
describe("HkBadge icon-spacing stylesheet contract", () => {
|
|
82
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
83
|
+
const css = compile(resolve(here, "HkBadge.scss"), { style: "expanded" }).css;
|
|
84
|
+
|
|
85
|
+
it("zeroes margins on embedded svg and img children", () => {
|
|
86
|
+
// Sass hoists the nested rule out of the base block when compiled.
|
|
87
|
+
expect(css).toMatch(/\.hk-badge > svg[^{]*\{[^}]*margin:\s*0/);
|
|
88
|
+
expect(css).toMatch(/\.hk-badge > img[^{]*\{[^}]*margin:\s*0/);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("never widens the rule past direct children", () => {
|
|
92
|
+
// A descendant selector would fight deliberately-spaced nested markup
|
|
93
|
+
// inside badge slots; only direct icon children are normalized.
|
|
94
|
+
expect(css).not.toMatch(/\.hk-badge\s+svg/);
|
|
95
|
+
expect(css).not.toMatch(/\.hk-badge\s+img/);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -960,7 +960,7 @@ describe("rail group fold survives the crossfade generations (#43)", () => {
|
|
|
960
960
|
// the drawer never appeared. The mounted gate keeps both first passes
|
|
961
961
|
// on the desktop layout; SSR therefore stays viewport-agnostic (a
|
|
962
962
|
// server render at phone width must NOT produce a drawer).
|
|
963
|
-
// MUT:mut-drop-gate
|
|
963
|
+
// MUT:mut-drop-gate — removing the mounted gate REDS this test (verified).
|
|
964
964
|
window.innerWidth = 390;
|
|
965
965
|
const app = createApp({
|
|
966
966
|
render: () =>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// HkLoginFlow — the shared sign-in panel.
|
|
2
2
|
//
|
|
3
3
|
// The root caps itself to the family-wide auth-card width contract
|
|
4
|
-
// (HK_AUTH_CARD_MAX_WIDTH, 28rem): the panel's children (the
|
|
5
|
-
//
|
|
4
|
+
// (HK_AUTH_CARD_MAX_WIDTH, 28rem): the panel's children (the frame box,
|
|
5
|
+
// the transition container's measuring wrappers) lay out as
|
|
6
6
|
// width:100%, so the HOST's centering slot must cap here rather than
|
|
7
7
|
// justify-items the crossfade items — the chest blueprint's hard-won
|
|
8
8
|
// rule. Hosts that embed the panel in a wider stage can override the
|
|
@@ -21,13 +21,17 @@
|
|
|
21
21
|
margin-inline: auto;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// The
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
24
|
+
// The box around the card. It was useAnchoredTop's target while the
|
|
25
|
+
// card's top edge was pinned (#1501 on 11-23; un-pinned by the 11-24 ruling);
|
|
26
|
+
// it is a plain frame box now and carries no transform — a centered
|
|
27
|
+
// host re-centers the taller card, which is the ruling (see the
|
|
28
|
+
// component header). The class name stays because hosts and probes
|
|
29
|
+
// address the frame through it; it no longer implies an anchor. The
|
|
30
|
+
// declarations this rule may carry remain limited to the sizing the box
|
|
31
|
+
// needs to be a faithful copy of its parent's content lane (the width)
|
|
32
|
+
// — a margin or padding here would shift the card relative to the frame
|
|
33
|
+
// the rest of the panel geometry was built against. It must also stay
|
|
34
|
+
// `position: static` as a forward rule:
|
|
31
35
|
// hikari's overlay roots are body-level today, so nothing under this box
|
|
32
36
|
// currently anchors to it — but the moment a descendant ever grew an
|
|
33
37
|
// overlay that resolves against its nearest positioned ancestor, a
|
|
@@ -730,10 +730,11 @@ describe("HkLoginFlow — stable shell channel swap (2026-11-24 user direction)"
|
|
|
730
730
|
|
|
731
731
|
describe("HkLoginFlow — in-card step swap (2026-11-24 user direction)", () => { // "Where the content can change inside the card, do not let the whole
|
|
732
732
|
// card fly." The account→verify move used to swap TWO whole cards: each
|
|
733
|
-
// generation was its own `HkAuthCard`, so the frame dissolved
|
|
734
|
-
// entrance keyframes replayed on the fresh node
|
|
735
|
-
//
|
|
736
|
-
//
|
|
733
|
+
// generation was its own `HkAuthCard`, so the frame dissolved and its
|
|
734
|
+
// entrance keyframes replayed on the fresh node — the reported "the card
|
|
735
|
+
// flies up". The pins below are ELEMENT-IDENTITY assertions on the frame,
|
|
736
|
+
// plus two geometry pins on how the host may move it (2026-11-24 ruling,
|
|
737
|
+
// the card must END a swap centered, so the frame box carries no pin).
|
|
737
738
|
|
|
738
739
|
function mountStepHost(options: {
|
|
739
740
|
accountName?: string;
|
|
@@ -993,67 +994,146 @@ describe("HkLoginFlow — in-card step swap (2026-11-24 user direction)", () =>
|
|
|
993
994
|
.toBe("Acme keeps your account safe");
|
|
994
995
|
});
|
|
995
996
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
997
|
+
/** A layout MODEL of the host for the two geometry pins below. happy-dom
|
|
998
|
+
* has no layout engine (every rect reads zero), so the centering rule is
|
|
999
|
+
* spelled out here: the frame box's LAYOUT top is
|
|
1000
|
+
* `(stage − cardHeight) / 2` for a stage never shorter than `stageMin`
|
|
1001
|
+
* nor than the card, and its PAINTED top adds whatever inline
|
|
1002
|
+
* translateY stands on the box and subtracts the page scroll — which is
|
|
1003
|
+
* exactly what a real engine reports. The numbers are the ones the
|
|
1004
|
+
* browser rig measured on the pinned tree (a 752 px stage; a 240 px
|
|
1005
|
+
* viewport over a 3 rem footer for the scrolled case).
|
|
1006
|
+
*
|
|
1007
|
+
* comment-gate-ok: this block documents the fake engine's geometry, not a
|
|
1008
|
+
* behavioural claim of the component; the claims the pins make ("no
|
|
1009
|
+
* transform remains", "the scrolled page does not jump") are anchored
|
|
1010
|
+
* at the two cases below (`MUT:flow-repins-top-edge`). */
|
|
1011
|
+
async function mountCenteredStage(stageMin = 752) {
|
|
1012
|
+
let cardHeight = 310.5;
|
|
1013
|
+
let scrollY = 0;
|
|
1014
|
+
const frames: Array<(entries: unknown[]) => void> = [];
|
|
1003
1015
|
vi.stubGlobal(
|
|
1004
1016
|
"ResizeObserver",
|
|
1005
1017
|
class {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
this.cb = cb;
|
|
1009
|
-
renders.push(cb);
|
|
1018
|
+
constructor(cb: (entries: unknown[]) => void) {
|
|
1019
|
+
frames.push(cb);
|
|
1010
1020
|
}
|
|
1011
1021
|
observe() {}
|
|
1012
1022
|
disconnect() {}
|
|
1013
1023
|
unobserve() {}
|
|
1014
1024
|
},
|
|
1015
1025
|
);
|
|
1016
|
-
const top = ref(100);
|
|
1017
1026
|
vi.spyOn(Element.prototype, "getBoundingClientRect").mockImplementation(
|
|
1018
1027
|
function (this: Element) {
|
|
1019
|
-
const
|
|
1028
|
+
const isFrame =
|
|
1029
|
+
(this as HTMLElement).classList?.contains("hk-login-flow-anchor") ?? false;
|
|
1030
|
+
const own = isFrame ? (this as HTMLElement).style.transform : "";
|
|
1020
1031
|
const shift = Number(/translateY\((-?[\d.]+)px\)/.exec(own)?.[1] ?? 0);
|
|
1021
|
-
const
|
|
1032
|
+
const height = isFrame ? cardHeight : 0;
|
|
1033
|
+
const layoutTop = (Math.max(stageMin, cardHeight) - cardHeight) / 2;
|
|
1034
|
+
const rendered = layoutTop + shift - scrollY;
|
|
1022
1035
|
return {
|
|
1023
|
-
top: rendered, left: 0, bottom: rendered, right: 0,
|
|
1024
|
-
width: 0, height
|
|
1036
|
+
top: rendered, left: 0, bottom: rendered + height, right: 0,
|
|
1037
|
+
width: 0, height, x: 0, y: rendered, toJSON: () => ({}),
|
|
1025
1038
|
} as DOMRect;
|
|
1026
1039
|
},
|
|
1027
1040
|
);
|
|
1041
|
+
const host = mountStepHost();
|
|
1042
|
+
// Let the mount settle before the caller acts, as it does on a page:
|
|
1043
|
+
// a template ref's first assignment queues jobs that read geometry.
|
|
1044
|
+
for (let i = 0; i < 4; i++) await nextTick();
|
|
1045
|
+
const frame = () =>
|
|
1046
|
+
host.container.querySelector(".hk-login-flow-anchor") as HTMLElement;
|
|
1047
|
+
return {
|
|
1048
|
+
step: host.step,
|
|
1049
|
+
frame,
|
|
1050
|
+
paintedTop: () => frame().getBoundingClientRect().top,
|
|
1051
|
+
/** One engine frame's notifications, to every live observer. The
|
|
1052
|
+
* entries are empty: happy-dom measures no box, so a size-driven
|
|
1053
|
+
* observer (HkTransitionContainer's) reads "nothing to pin" from
|
|
1054
|
+
* this frame, exactly as it does from a zero rect. */
|
|
1055
|
+
deliverFrames: () => {
|
|
1056
|
+
for (const cb of frames.slice()) cb([]);
|
|
1057
|
+
},
|
|
1058
|
+
growCard: (height: number) => {
|
|
1059
|
+
cardHeight = height;
|
|
1060
|
+
},
|
|
1061
|
+
scrollTo: (y: number) => {
|
|
1062
|
+
scrollY = y;
|
|
1063
|
+
},
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1028
1066
|
|
|
1029
|
-
|
|
1030
|
-
h(HkLoginFlow, {
|
|
1031
|
-
channels: [cloudChannel],
|
|
1032
|
-
modelValue: "cloud",
|
|
1033
|
-
step: "account",
|
|
1034
|
-
}),
|
|
1035
|
-
);
|
|
1036
|
-
const anchor = c.querySelector(".hk-login-flow-anchor") as HTMLElement;
|
|
1037
|
-
expect(anchor.style.transform).toBe("");
|
|
1038
|
-
// A centered host lifts the top edge by 12px while the card grows.
|
|
1039
|
-
top.value = 88;
|
|
1040
|
-
for (const cb of renders) cb();
|
|
1041
|
-
expect(anchor.style.transform).toBe("translateY(12px)");
|
|
1042
|
-
|
|
1067
|
+
afterEach(() => {
|
|
1043
1068
|
vi.unstubAllGlobals();
|
|
1044
1069
|
vi.restoreAllMocks();
|
|
1045
1070
|
});
|
|
1046
1071
|
|
|
1047
|
-
it("
|
|
1072
|
+
it("ends a step swap centered for the card's new height: the top edge is not pinned", async () => {
|
|
1073
|
+
// The reported defect (2026-11-24): the verify step is taller, and the
|
|
1074
|
+
// top-edge pin kept the card's PRE-swap top, so the card only grew
|
|
1075
|
+
// downward and sat visibly low for good (219.6 px above vs 163.4 px
|
|
1076
|
+
// below in a 752 px stage, engine-measured). A centered host re-centers
|
|
1077
|
+
// the taller box; the flow must let it.
|
|
1078
|
+
// MUT:flow-repins-top-edge (re-adding `useAnchoredTop(anchorRef)` to
|
|
1079
|
+
// the flow leaves `translateY(29.25px)` on the frame box once the
|
|
1080
|
+
// observers report the growth — both assertions at the end go red).
|
|
1081
|
+
const rig = await mountCenteredStage();
|
|
1082
|
+
rig.deliverFrames();
|
|
1083
|
+
expect(rig.frame().style.transform).toBe("");
|
|
1084
|
+
// At rest before the swap: centered for 310.5 px.
|
|
1085
|
+
expect(Math.abs(rig.paintedTop() - (752 - 310.5) / 2)).toBeLessThanOrEqual(1);
|
|
1086
|
+
|
|
1087
|
+
// Engine order: the DOM is patched first, then laid out, then the
|
|
1088
|
+
// resize notifications of that frame are delivered.
|
|
1089
|
+
rig.step.value = "verify";
|
|
1090
|
+
for (let i = 0; i < 12; i++) await nextTick();
|
|
1091
|
+
rig.growCard(369); // account → verify: the password step is taller
|
|
1092
|
+
rig.deliverFrames();
|
|
1093
|
+
|
|
1094
|
+
// Centered for the NEW height (±1 px), with nothing painted over the
|
|
1095
|
+
// layout.
|
|
1096
|
+
expect(rig.frame().style.transform).toBe("");
|
|
1097
|
+
expect(Math.abs(rig.paintedTop() - (752 - 369) / 2)).toBeLessThanOrEqual(1);
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1100
|
+
it("does not turn a page scroll into a jump when the swap lands on a scrolled page", async () => {
|
|
1101
|
+
// The pin's second defect, engine-measured: it measured in VIEWPORT
|
|
1102
|
+
// coordinates and re-based on a window resize only — scrolling fires
|
|
1103
|
+
// no ResizeObserver — so a swap on a scrolled page read the scroll
|
|
1104
|
+
// offset as drift and painted it back as a translateY (60 px downward,
|
|
1105
|
+
// and a transform does not extend the scroll range). The stage here is
|
|
1106
|
+
// shorter than the card (a 240 px viewport over a 3 rem footer), so
|
|
1107
|
+
// the layout top is 0 and any transform is a pure jump.
|
|
1108
|
+
// MUT:flow-repins-top-edge (re-adding the hook leaves
|
|
1109
|
+
// `translateY(60px)` on the frame box — both assertions at the end go
|
|
1110
|
+
// red).
|
|
1111
|
+
const rig = await mountCenteredStage(192);
|
|
1112
|
+
rig.deliverFrames();
|
|
1113
|
+
expect(rig.paintedTop()).toBe(0);
|
|
1114
|
+
|
|
1115
|
+
// The visitor scrolls to reach the submit, then the swap lands.
|
|
1116
|
+
rig.scrollTo(60);
|
|
1117
|
+
rig.step.value = "verify";
|
|
1118
|
+
for (let i = 0; i < 12; i++) await nextTick();
|
|
1119
|
+
rig.growCard(369);
|
|
1120
|
+
rig.deliverFrames();
|
|
1121
|
+
|
|
1122
|
+
expect(rig.frame().style.transform).toBe("");
|
|
1123
|
+
// Still where the scroll left it: the same document position.
|
|
1124
|
+
expect(rig.paintedTop()).toBe(-60);
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
it("keeps the frame box between the panel root and the card (structural pin)", async () => {
|
|
1048
1128
|
const { container } = mountStepHost();
|
|
1049
|
-
//
|
|
1050
|
-
//
|
|
1051
|
-
//
|
|
1052
|
-
// MUT:step-swap-unguarded (dropping the wrapper
|
|
1053
|
-
//
|
|
1054
|
-
const
|
|
1055
|
-
expect(
|
|
1056
|
-
expect(
|
|
1129
|
+
// Hosts and probes address the frame through `.hk-login-flow-anchor`,
|
|
1130
|
+
// and the geometry pins above measure it. It is a plain box — no
|
|
1131
|
+
// transform is ever written to it.
|
|
1132
|
+
// MUT:step-swap-unguarded (dropping the wrapper puts the frame
|
|
1133
|
+
// straight under .hk-login-flow — this goes red).
|
|
1134
|
+
const frameBox = container.querySelector(".hk-login-flow-anchor");
|
|
1135
|
+
expect(frameBox).not.toBeNull();
|
|
1136
|
+
expect(frameBox!.querySelector(":scope > .s-auth-card")).not.toBeNull();
|
|
1057
1137
|
expect(container.querySelector(".hk-login-flow > .s-auth-card")).toBeNull();
|
|
1058
1138
|
});
|
|
1059
1139
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { computed, defineComponent, ref, watch, type PropType } from "vue";
|
|
2
2
|
|
|
3
|
-
import { useAnchoredTop } from "../composables/useAnchoredTop";
|
|
4
3
|
import { useI18n } from "../i18n/context";
|
|
5
4
|
import { asPropType } from "../utils/typing";
|
|
6
5
|
import { HkAuthChannelList, type HkAuthChannelListEntry } from "./HkAuthChannelList";
|
|
@@ -142,11 +141,23 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
|
|
|
142
141
|
* group — a channel switch crossfades only the body and leaves the
|
|
143
142
|
* tabs and the header copy mounted (the 2026-11-24 stable-shell
|
|
144
143
|
* direction, unchanged);
|
|
145
|
-
* - the card
|
|
146
|
-
* a height morph inside a
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
144
|
+
* - the card is NOT top-edge pinned (2026-11-24 ruling, reversing the
|
|
145
|
+
* pin #1501 introduced on 11-23): a height morph inside a
|
|
146
|
+
* vertically centered host re-centers the box, so the top edge travels
|
|
147
|
+
* half the height delta in step with the 300 ms morph and the card
|
|
148
|
+
* ENDS the swap centered for its new height. `useAnchoredTop` used to
|
|
149
|
+
* hold the pre-morph top edge instead and keep holding it at rest,
|
|
150
|
+
* which left a taller step half the growth below the center for good
|
|
151
|
+
* (engine-measured in a 752 px stage: 219.6 px above vs 163.4 px below
|
|
152
|
+
* on the verify step) — the user read that as "the card sits too low".
|
|
153
|
+
* The pin also measured in viewport coordinates while scrolling fires
|
|
154
|
+
* no ResizeObserver, so a swap on a scrolled page folded the scroll
|
|
155
|
+
* offset into its translateY (a 60 px downward jump, painted outside
|
|
156
|
+
* the scroll range). What "do not let the card fly" still buys is
|
|
157
|
+
* everything else on this list: the frame node is the single static
|
|
158
|
+
* one, the swap is an in-card crossfade, and the box arrives BEFORE
|
|
159
|
+
* the entering generation fades in — content that has appeared never
|
|
160
|
+
* moves again.
|
|
150
161
|
*
|
|
151
162
|
* Copy rules locked by the chest blueprint (LoginView.test.ts, kept
|
|
152
163
|
* verbatim here): segment labels are ALWAYS the panel's own locale keys,
|
|
@@ -275,13 +286,6 @@ export const HkLoginFlow = defineComponent({
|
|
|
275
286
|
};
|
|
276
287
|
const mfaRef = ref<MfaCardHandle | null>(null);
|
|
277
288
|
|
|
278
|
-
/** The card frame's anchored box (see useAnchoredTop): the step and
|
|
279
|
-
* channel swaps grow/shrink the card, and in a centered host that
|
|
280
|
-
* reflows the frame — pinning the top edge is what keeps the panel
|
|
281
|
-
* still while it grows downward. */
|
|
282
|
-
const anchorRef = ref<HTMLElement | null>(null);
|
|
283
|
-
useAnchoredTop(anchorRef);
|
|
284
|
-
|
|
285
289
|
const currentChannel = computed(
|
|
286
290
|
() =>
|
|
287
291
|
props.channels.find((channel) => channel.key === props.modelValue) ??
|
|
@@ -464,13 +468,14 @@ export const HkLoginFlow = defineComponent({
|
|
|
464
468
|
return (
|
|
465
469
|
<div class="hk-login-flow">
|
|
466
470
|
{slots.top?.()}
|
|
467
|
-
{/* The
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
|
|
471
|
+
{/* The frame box. It carries no transform: a centered host
|
|
472
|
+
* re-centers the taller card, by design (header note).
|
|
473
|
+
* Wrapping the FRAME (rather than the panel root) keeps a
|
|
474
|
+
* notice appearing above the card from dragging the card with
|
|
475
|
+
* it: the notice takes its own row above this box. The class
|
|
476
|
+
* name stays — hosts and probes address the frame through it —
|
|
477
|
+
* and no longer implies an anchor. */}
|
|
478
|
+
<div class="hk-login-flow-anchor">
|
|
474
479
|
{/* ONE card frame for the whole session: the step swap below
|
|
475
480
|
* is a swap of this frame's CONTENTS. .s-auth-card also
|
|
476
481
|
* carries the panel's mount entrance, which therefore plays
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Contract pins for the admin header's page-title width rules in
|
|
8
|
+
* `styles/admin-tokens.scss` (hikari#1531 item 3):
|
|
9
|
+
*
|
|
10
|
+
* - the base rule caps the title at 8rem — the account-menu-nickname
|
|
11
|
+
* sizing, fine on its own face;
|
|
12
|
+
* - a `@media (width <= 480px)` block drops the cap to 5rem, which lowers
|
|
13
|
+
* the START wing's `min-content` floor far enough that the END wing fits
|
|
14
|
+
* whole at 320px (the two wings' floors plus the grid gaps used to exceed
|
|
15
|
+
* the viewport and the END wing's `overflow: hidden` clipped the theme
|
|
16
|
+
* button — the cheap side to pay is the title ellipsing a word earlier).
|
|
17
|
+
*
|
|
18
|
+
* Source-scanned with a direct regex (not a generic rule parser) — it does not catch nested media queries (MUT:mut-480-block REDS when the block is dropped), which is acceptable here: the
|
|
19
|
+
* sheet carries long block comments whose text defeats a naive
|
|
20
|
+
* selector-slicer, and the two pins are simple enough for exact patterns.
|
|
21
|
+
*/
|
|
22
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
const src = readFileSync(join(here, "..", "styles", "admin-tokens.scss"), "utf8");
|
|
24
|
+
|
|
25
|
+
describe("admin header title width contract (hikari#1531 item 3)", () => {
|
|
26
|
+
it("caps the title at 8rem in the base rule", () => {
|
|
27
|
+
const m = src.match(/\.s-admin-header-title\s*\{[^}]*\}/);
|
|
28
|
+
expect(m, "the base title rule exists").toBeTruthy();
|
|
29
|
+
expect(m![0]).toContain("max-width: 8rem");
|
|
30
|
+
expect(m![0]).toContain("text-overflow: ellipsis");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("drops the cap to 5rem inside the ≤480px media block", () => {
|
|
34
|
+
const m = src.match(
|
|
35
|
+
/@media \(width <= 480px\)\s*\{[^@]*?\.s-admin-header-title\s*\{[^}]*max-width:\s*5rem[^}]*\}/,
|
|
36
|
+
);
|
|
37
|
+
expect(m, "the ≤480px override exists with the 5rem cap").toBeTruthy();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, type ComputedRef } from "vue";
|
|
1
|
+
import { computed, onMounted, ref, type ComputedRef } from "vue";
|
|
2
2
|
|
|
3
3
|
import { useBreakpoint } from "../runtime/useBreakpoint";
|
|
4
4
|
|
|
@@ -15,11 +15,32 @@ import { useBreakpoint } from "../runtime/useBreakpoint";
|
|
|
15
15
|
* prevent (2026-10-27: the filter triggers stayed at the old flat 28
|
|
16
16
|
* while the header moved to the ladder, and the funnel read as a
|
|
17
17
|
* different button family from its own neighbors).
|
|
18
|
+
*
|
|
19
|
+
* SSR / FIRST PAINT (2026-11-24, hikari#1531 item 1): the server has no
|
|
20
|
+
* viewport, so the pre-mount answer is the NARROW rung — 28 fits every
|
|
21
|
+
* viewport (the wide 32 is what overflows a 320px phone), so narrow is
|
|
22
|
+
* the safe guess for an unknown one, and a phone's first paint then
|
|
23
|
+
* matches what it keeps after mount (no size swap). A desktop pays one
|
|
24
|
+
* grow-in on mount instead of a shrink — the acceptable direction. This
|
|
25
|
+
* is the documented contract hikari#1531 asks for; hosts that want a
|
|
26
|
+
* different first paint own it above the hook (the docs shell's local
|
|
27
|
+
* `headerActionSize` stays a valid overlay).
|
|
18
28
|
*/
|
|
19
29
|
export function useChromeActionSize(): ComputedRef<28 | 32> {
|
|
20
30
|
const { isDesktop } = useBreakpoint();
|
|
31
|
+
const mounted = ref(false);
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
mounted.value = true;
|
|
34
|
+
});
|
|
21
35
|
// `?.` — partial breakpoint surfaces exist (test mocks, embedders that
|
|
22
36
|
// pass only what they use); an absent isDesktop reads as the NARROW
|
|
23
37
|
// rung, the safe-fitting choice for an unknown viewport.
|
|
24
|
-
|
|
38
|
+
//
|
|
39
|
+
// `!mounted` — SSR and the FIRST CLIENT PASS also read narrow (they have
|
|
40
|
+
// no trustworthy viewport yet: `useBreakpoint`'s server branch answers
|
|
41
|
+
// isDesktop=true unconditionally, which is exactly the 32-at-first-paint
|
|
42
|
+
// swap hikari#1531 documents). Narrow-first means a phone never changes
|
|
43
|
+
// size across hydration, and a desktop grows once on mount instead of
|
|
44
|
+
// shrinking.
|
|
45
|
+
return computed(() => (mounted.value && isDesktop?.value ? 32 : 28));
|
|
25
46
|
}
|
|
@@ -713,6 +713,21 @@
|
|
|
713
713
|
white-space: nowrap;
|
|
714
714
|
}
|
|
715
715
|
|
|
716
|
+
/* 320px END-WING GUARD (2026-11-24, hikari#1531 item 3): the balanced
|
|
717
|
+
* header's wings carry a `min-content` floor, and the title's 8rem cap is
|
|
718
|
+
* part of the START wing's floor — at 320px the two wings' floors plus the
|
|
719
|
+
* gaps exceed the viewport, and the END wing (overflow: hidden) pays by
|
|
720
|
+
* clipping the theme button. Dropping the title cap to 5rem below 480px
|
|
721
|
+
* lowers the start floor enough that the end wing fits whole; the title
|
|
722
|
+
* just ellipses a word earlier, which is the cheap side to pay on.
|
|
723
|
+
* MUT:mut-480-block — dropping this media block REDS the contract test
|
|
724
|
+
* `adminHeaderTitle.contract.test.ts` (the only guard over this cap). */
|
|
725
|
+
@media (width <= 480px) {
|
|
726
|
+
.s-admin-header-title {
|
|
727
|
+
max-width: 5rem;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
716
731
|
.s-admin-header-actions {
|
|
717
732
|
display: flex;
|
|
718
733
|
align-items: center;
|