@celestia-island/hikari 0.55.433 → 0.55.435
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/package.json +1 -1
- package/src/animation/registerAnimations.ts +1 -5
- package/src/components/HkAdminHeader.tsx +32 -1
- package/src/components/HkFaceShell.slots.test.ts +94 -0
- package/src/components/HkFaceShell.tsx +57 -1
- package/src/components/HkSerpentineUnlock.scss +5 -28
- package/src/components/HkSerpentineUnlock.test.ts +28 -18
- package/src/components/HkSerpentineUnlock.tsx +13 -21
- package/src/components/HkSupplementInset.scss +83 -0
- package/src/components/HkSupplementInset.test.tsx +136 -0
- package/src/components/HkSupplementInset.tsx +116 -0
- package/src/components/HkTabs.scss +13 -51
- package/src/components/HkTabs.test.ts +131 -82
- package/src/components/HkTabs.tsx +68 -27
- package/src/components/serpentineGeometry.test.ts +13 -8
- package/src/components/serpentineGeometry.ts +11 -4
- package/src/index.ts +4 -12
- package/src/components/HkSlideConfirm.scss +0 -137
- package/src/components/HkSlideConfirm.test.tsx +0 -418
- package/src/components/HkSlideConfirm.tsx +0 -439
- package/src/components/slideConfirmPath.test.ts +0 -179
- package/src/components/slideConfirmPath.ts +0 -192
package/package.json
CHANGED
|
@@ -157,8 +157,4 @@ registerCssAnimation("hk-edge-glow-breathe", { infinite: true });
|
|
|
157
157
|
// band and drops the loops (house pattern, see HkSkeleton).
|
|
158
158
|
registerCssAnimation("hk-emergency-breathe", { infinite: true });
|
|
159
159
|
registerCssAnimation("hk-emergency-signal", { infinite: true });
|
|
160
|
-
|
|
161
|
-
// shake (plays once): horizontal refusal feedback when the pointer drifts
|
|
162
|
-
// off the lane. Reduced motion swaps it for a static error outline (the
|
|
163
|
-
// gate never moves anything under reduced motion).
|
|
164
|
-
registerCssAnimation("hk-serpentine-shake");
|
|
160
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, defineComponent, ref, watch, type PropType, type VNode } from "vue";
|
|
1
|
+
import { computed, defineComponent, ref, watch, type PropType, type SlotsType, type VNode } from "vue";
|
|
2
2
|
import { Camera, ExternalLink, Languages, LogOut, Menu } from "lucide-vue-next";
|
|
3
3
|
import { HBadge, HButton, HSpinner } from "@celestia-island/hikari";
|
|
4
4
|
import { useI18n } from "../i18n/context";
|
|
@@ -11,8 +11,39 @@ export interface LocaleOption {
|
|
|
11
11
|
label: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Scoped payload of the `avatar-modal` slot — the exact object the header
|
|
16
|
+
* passes when it mounts the avatar crop modal (known-live-issues L39:
|
|
17
|
+
* consumers hand-copied this shape as local interfaces; single-sourced here).
|
|
18
|
+
*/
|
|
19
|
+
export interface HkAdminHeaderAvatarModalSlot {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onUpdateOpen: (value: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The header's whole slot surface, in `SlotsType` form. `identity`,
|
|
26
|
+
* `center`, `emergency-stop-extra` and `theme-toggle` take no params.
|
|
27
|
+
*
|
|
28
|
+
* NOT part of this contract: the erp-side `locale-picker` / `user-menu-extra`
|
|
29
|
+
* names (L39, lead ruling 2026-11-19) — declared by celestia-erp's local
|
|
30
|
+
* interfaces but NEVER consumed by hikari's HkAdminHeader, so the slot bodies
|
|
31
|
+
* erp passes have never rendered. Whether hikari should grow the consumption
|
|
32
|
+
* (reviving erp's invisible account-center menu entries) or erp should delete
|
|
33
|
+
* the dead bodies is ⏳ pending a user decision; until then neither name may
|
|
34
|
+
* appear in this aggregate.
|
|
35
|
+
*/
|
|
36
|
+
export type HkAdminHeaderSlots = SlotsType<{
|
|
37
|
+
identity?: () => VNode[];
|
|
38
|
+
center?: () => VNode[];
|
|
39
|
+
"emergency-stop-extra"?: () => VNode[];
|
|
40
|
+
"theme-toggle"?: () => VNode[];
|
|
41
|
+
"avatar-modal"?: (params: HkAdminHeaderAvatarModalSlot) => VNode[];
|
|
42
|
+
}>;
|
|
43
|
+
|
|
14
44
|
export const HkAdminHeader = defineComponent({
|
|
15
45
|
name: "HkAdminHeader",
|
|
46
|
+
slots: Object as HkAdminHeaderSlots,
|
|
16
47
|
props: {
|
|
17
48
|
/** Page title rendered beside the avatar — the view the console is
|
|
18
49
|
* currently ON (dashboard, providers, …). The signed-in nickname
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import * as barrel from "../index";
|
|
3
|
+
import { asIndexable } from "../utils/typing";
|
|
4
|
+
import type { HkAdminHeaderAvatarModalSlot, HkAdminHeaderSlots, HkFaceShellHeaderSlot, HkFaceShellSidebarSlot, HkFaceShellSlots, HkFaceShellUserPanelSlot } from "../index";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The L39 slot-type contract pins. The exported slot types are what chest and
|
|
8
|
+
* erp hand-copied as local interfaces (4 + 5 copies across the two repos);
|
|
9
|
+
* these pins keep the PUBLIC contract honest in both directions:
|
|
10
|
+
*
|
|
11
|
+
* - runtime: the barrel keeps exporting every type name (a deleted `export
|
|
12
|
+
* type` line does not fail any other test — types vanish silently for
|
|
13
|
+
* importers while vitest stays green, the exact barrel-gap shape the
|
|
14
|
+
* HkFaceShell runtime pin below was written for);
|
|
15
|
+
* - type-level: each interface is CONSUMED the way the downstream
|
|
16
|
+
* AdminLayouts consume it (subset destructuring + the aggregate wired into
|
|
17
|
+
* a defineComponent `slots:`), so a payload-field rename or removal breaks
|
|
18
|
+
* THIS file's compile (vue-tsc --noEmit), not a downstream repo's build.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** chest/erp AdminLayout shape: destructure a SUBSET of the header params. */
|
|
22
|
+
function headerSubset(params: HkFaceShellHeaderSlot) {
|
|
23
|
+
const { compact, onOpenDrawer } = params;
|
|
24
|
+
return { compact, onOpenDrawer };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The full five-field payload must be readable (no hand-copied subset lag). */
|
|
28
|
+
function headerFull(params: HkFaceShellHeaderSlot) {
|
|
29
|
+
return [params.isDesktop, params.showHamburger, params.compact, params.onHamburger, params.onOpenDrawer];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function sidebarBody(params: HkFaceShellSidebarSlot) {
|
|
33
|
+
// The optional peek/inDrawer flags are exactly the union the three render
|
|
34
|
+
// sites pass (desktop expanded, rail peek, mobile drawer).
|
|
35
|
+
return { collapsed: params.collapsed, onNavigate: params.onNavigate, peeking: params.peeking, inDrawer: params.inDrawer };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function userPanelBody(params: HkFaceShellUserPanelSlot) {
|
|
39
|
+
return { onNavigate: params.onNavigate };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** erp AdminLayout shape: the avatar-modal destructure. */
|
|
43
|
+
function avatarModalBody(params: HkAdminHeaderAvatarModalSlot) {
|
|
44
|
+
const { open, onUpdateOpen } = params;
|
|
45
|
+
onUpdateOpen(!open);
|
|
46
|
+
return { open, onUpdateOpen };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe("the public slot-type contract (L39)", () => {
|
|
50
|
+
it("exports every slot type name from the barrel", () => {
|
|
51
|
+
// Types are erased at runtime; the pin is the module-record presence of
|
|
52
|
+
// each name via a type-only import assertion below plus this runtime
|
|
53
|
+
// guard that the COMPONENTS still resolve (the types ride their files).
|
|
54
|
+
const face = asIndexable(barrel.HkFaceShell);
|
|
55
|
+
const header = asIndexable(barrel.HkAdminHeader);
|
|
56
|
+
expect(face, "HkFaceShell must stay exported").toBeTruthy();
|
|
57
|
+
expect(header, "HkAdminHeader must stay exported").toBeTruthy();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("both components keep their slots declaration wired into the options (R3 M4 pin)", () => {
|
|
61
|
+
// The `slots: Object as <Aggregate>` option line is what makes the
|
|
62
|
+
// declared contract type the component's OWN render-site invocations
|
|
63
|
+
// (proved red under field-rename mutations) — but deleting the line
|
|
64
|
+
// alone kept vue-tsc green (R3 M4 SURVIVED), because nothing compiled
|
|
65
|
+
// against the component side of the wiring. The options object carries
|
|
66
|
+
// `slots` at runtime, so this pin makes the deletion loud.
|
|
67
|
+
const face = asIndexable(barrel.HkFaceShell);
|
|
68
|
+
const header = asIndexable(barrel.HkAdminHeader);
|
|
69
|
+
expect(face.slots, "HkFaceShell must keep its slots declaration").toBeTruthy();
|
|
70
|
+
expect(header.slots, "HkAdminHeader must keep its slots declaration").toBeTruthy();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("the slot param interfaces accept the real payloads", () => {
|
|
74
|
+
expect(headerSubset({ isDesktop: false, showHamburger: true, compact: true, onHamburger: () => {}, onOpenDrawer: () => {} })).toEqual({ compact: true, onOpenDrawer: expect.any(Function) });
|
|
75
|
+
expect(headerFull({ isDesktop: true, showHamburger: false, compact: false, onHamburger: () => {}, onOpenDrawer: () => {} }).filter(Boolean).length).toBe(3);
|
|
76
|
+
expect(sidebarBody({ collapsed: true, onNavigate: () => {}, peeking: false })).toEqual({ collapsed: true, onNavigate: expect.any(Function), peeking: false, inDrawer: undefined });
|
|
77
|
+
expect(sidebarBody({ collapsed: false, onNavigate: () => {}, inDrawer: true }).inDrawer).toBe(true);
|
|
78
|
+
expect(userPanelBody({ onNavigate: () => {} }).onNavigate).toEqual(expect.any(Function));
|
|
79
|
+
let opened = false;
|
|
80
|
+
const avatar = avatarModalBody({ open: false, onUpdateOpen: (v) => { opened = v; } });
|
|
81
|
+
expect(avatar.open).toBe(false);
|
|
82
|
+
expect(opened).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("the aggregate slot types fit a defineComponent slots declaration", () => {
|
|
86
|
+
// The compile-time proof: both aggregates are SlotsType-compatible
|
|
87
|
+
// objects usable as `slots: Object as ...`. Runtime stand-in asserts the
|
|
88
|
+
// alias is a plain object cast (no accidental runtime import).
|
|
89
|
+
const faceSlots = {} as HkFaceShellSlots;
|
|
90
|
+
const headerSlots = {} as HkAdminHeaderSlots;
|
|
91
|
+
expect(faceSlots).toEqual({});
|
|
92
|
+
expect(headerSlots).toEqual({});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, defineComponent, provide, ref, watch, type PropType } from "vue";
|
|
1
|
+
import { computed, defineComponent, provide, ref, watch, type PropType, type SlotsType, type VNode } from "vue";
|
|
2
2
|
import { HkCrossfade, HDrawer, HScrollContainer, useBreakpoint } from "@celestia-island/hikari";
|
|
3
3
|
import { useI18n } from "../i18n/context";
|
|
4
4
|
import { useSidebarRail } from "../composables/useSidebarRail";
|
|
@@ -168,8 +168,64 @@ export function mobileSideGutterFree(value: string): string {
|
|
|
168
168
|
* footer, the fixed footer band and its injection-driven height
|
|
169
169
|
* reservation, the overlays slot — behaves identically in both modes.
|
|
170
170
|
*/
|
|
171
|
+
/**
|
|
172
|
+
* Scoped payload of the `header` slot — the exact object every render site
|
|
173
|
+
* passes (known-live-issues L39: consumers hand-copied subsets of this shape
|
|
174
|
+
* as local interfaces; the export makes the contract single-sourced).
|
|
175
|
+
*/
|
|
176
|
+
export interface HkFaceShellHeaderSlot {
|
|
177
|
+
/** Viewport at or above `mobileBreakpoint` (the desktop layout). */
|
|
178
|
+
isDesktop: boolean;
|
|
179
|
+
/** True on the mobile layout — the hamburger button should render. */
|
|
180
|
+
showHamburger: boolean;
|
|
181
|
+
/** True below `mobileBreakpoint` — the drawer is the only nav surface. */
|
|
182
|
+
compact: boolean;
|
|
183
|
+
/** Toggles the mobile hamburger drawer. */
|
|
184
|
+
onHamburger: () => void;
|
|
185
|
+
/** Opens the mobile nav drawer directly (e.g. the avatar's drawer mode). */
|
|
186
|
+
onOpenDrawer: () => void;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Scoped payload of the `sidebar` slot. Desktop renders it twice — expanded
|
|
191
|
+
* panel and (opt-in) the icon-rail hover peek; mobile renders a third copy
|
|
192
|
+
* inside the drawer. `peeking` is only set on the rail peek copy, `inDrawer`
|
|
193
|
+
* only on the mobile drawer copy; both stay optional so one body serves all.
|
|
194
|
+
*/
|
|
195
|
+
export interface HkFaceShellSidebarSlot {
|
|
196
|
+
/** The icon-rail dress (true only on the collapsed rail outside a peek). */
|
|
197
|
+
collapsed: boolean;
|
|
198
|
+
/** Call after any in-sidebar navigation so the mobile drawer closes. */
|
|
199
|
+
onNavigate: () => void;
|
|
200
|
+
/** True while the collapsed rail shows its hover-peek overlay (desktop). */
|
|
201
|
+
peeking?: boolean;
|
|
202
|
+
/** Set on the mobile drawer copy: the slot should fill its full width. */
|
|
203
|
+
inDrawer?: boolean;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Scoped payload of the `userPanel` slot (the drawer footer). */
|
|
207
|
+
export interface HkFaceShellUserPanelSlot {
|
|
208
|
+
/** Call after any in-panel navigation so the mobile drawer closes. */
|
|
209
|
+
onNavigate: () => void;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The shell's whole slot surface, in `SlotsType` form so a host can type its
|
|
214
|
+
* own wrapper with `slots: Object as HkFaceShellSlots` and get per-slot
|
|
215
|
+
* param checking for free. `content` / `footer` / `overlays` take no params.
|
|
216
|
+
*/
|
|
217
|
+
export type HkFaceShellSlots = SlotsType<{
|
|
218
|
+
header?: (params: HkFaceShellHeaderSlot) => VNode[];
|
|
219
|
+
sidebar?: (params: HkFaceShellSidebarSlot) => VNode[];
|
|
220
|
+
userPanel?: (params: HkFaceShellUserPanelSlot) => VNode[];
|
|
221
|
+
content?: () => VNode[];
|
|
222
|
+
footer?: () => VNode[];
|
|
223
|
+
overlays?: () => VNode[];
|
|
224
|
+
}>;
|
|
225
|
+
|
|
171
226
|
export const HkFaceShell = defineComponent({
|
|
172
227
|
name: "HkFaceShell",
|
|
228
|
+
slots: Object as HkFaceShellSlots,
|
|
173
229
|
props: {
|
|
174
230
|
sidebarCollapsed: { type: Boolean, default: false },
|
|
175
231
|
sidebarWidth: { type: String, default: "224px" },
|
|
@@ -32,19 +32,6 @@
|
|
|
32
32
|
border-color: rgb(var(--color-error) / 35%);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
&--failed {
|
|
36
|
-
animation: hk-serpentine-shake var(--duration-normal, 0.2s) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Reduced motion: no displacement animation at all — the failure feedback
|
|
41
|
-
// becomes a static error outline flash (colour only, no movement).
|
|
42
|
-
@media (prefers-reduced-motion: reduce) {
|
|
43
|
-
.hk-serpentine--failed {
|
|
44
|
-
animation: none;
|
|
45
|
-
outline: 2px solid rgb(var(--color-error));
|
|
46
|
-
outline-offset: 2px;
|
|
47
|
-
}
|
|
48
35
|
}
|
|
49
36
|
|
|
50
37
|
.hk-serpentine-svg {
|
|
@@ -98,27 +85,17 @@
|
|
|
98
85
|
|
|
99
86
|
.hk-serpentine--confirmed .hk-serpentine-handle {
|
|
100
87
|
background: rgb(var(--color-success));
|
|
88
|
+
transition: background var(--duration-normal, 0.2s) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
|
|
101
89
|
box-shadow: 0 0 0 2px rgb(var(--color-success) / 60%);
|
|
102
90
|
}
|
|
103
91
|
|
|
104
92
|
.hk-serpentine-hint {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
// In-flow under the lane: an absolutely-positioned hint hung below the
|
|
94
|
+
// box got clipped by the confirmation window's padding (device feedback).
|
|
95
|
+
display: block;
|
|
96
|
+
padding: var(--space-8, 8px) var(--space-12, 12px) var(--space-4, 4px);
|
|
108
97
|
text-align: center;
|
|
109
98
|
font-size: var(--text-xs, 0.75rem);
|
|
110
99
|
color: rgb(var(--color-muted));
|
|
111
100
|
}
|
|
112
101
|
|
|
113
|
-
@keyframes hk-serpentine-shake {
|
|
114
|
-
0%,
|
|
115
|
-
100% {
|
|
116
|
-
transform: translateX(0);
|
|
117
|
-
}
|
|
118
|
-
25% {
|
|
119
|
-
transform: translateX(-6px);
|
|
120
|
-
}
|
|
121
|
-
75% {
|
|
122
|
-
transform: translateX(6px);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -126,22 +126,21 @@ describe("HkSerpentineUnlock (mounted)", () => {
|
|
|
126
126
|
expect(cancelSpy).not.toHaveBeenCalled();
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
it("
|
|
129
|
+
it("holds position when the pointer drifts off-lane (no reset)", () => {
|
|
130
|
+
// Device feedback: an 18px corridor reset the walk on every wobble.
|
|
131
|
+
// Now a drifting pointer HOLDS the knob (no fail, no spring); the walk
|
|
132
|
+
// resumes when the pointer comes back, and only the release decides.
|
|
130
133
|
const el = mountGate();
|
|
131
134
|
const path = generateSerpentinePath(600, 96, 42);
|
|
132
|
-
// Grab at the start, walk onto the lane, then veer FAR off it (the
|
|
133
|
-
// grab check anchors at the lane start — mid-lane grabs are refused).
|
|
134
135
|
const start = path.points[0]!;
|
|
135
136
|
pointer(el, "pointerdown", start.x, start.y);
|
|
136
137
|
const mid = projectOntoPath(path.points, path.totalLength / 2);
|
|
137
138
|
pointer(el, "pointermove", mid.x, mid.y);
|
|
138
|
-
pointer(el, "pointermove", mid.x + 30, 95);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
expect(
|
|
142
|
-
expect(
|
|
143
|
-
frameBus.tick(16);
|
|
144
|
-
frameBus.tick(16);
|
|
139
|
+
pointer(el, "pointermove", mid.x + 30, 95); // far off-lane
|
|
140
|
+
pointer(el, "pointermove", mid.x, mid.y); // back on the lane
|
|
141
|
+
pointer(el, "pointerup", mid.x, mid.y);
|
|
142
|
+
expect(confirmSpy).not.toHaveBeenCalled();
|
|
143
|
+
expect(cancelSpy).toHaveBeenCalledWith(expect.closeTo(0.5, 1));
|
|
145
144
|
});
|
|
146
145
|
|
|
147
146
|
it("stops a running spring when the handle is re-grabbed", async () => {
|
|
@@ -165,10 +164,10 @@ describe("HkSerpentineUnlock (mounted)", () => {
|
|
|
165
164
|
frameBus.tick(16);
|
|
166
165
|
frameBus.tick(16);
|
|
167
166
|
await nextTick();
|
|
168
|
-
// The re-grab put the pointer at the start; stale
|
|
169
|
-
// not have moved the handle (the old spring is
|
|
170
|
-
// regression pin for the re-grab fight).
|
|
171
|
-
expect((el.querySelector(".hk-serpentine-handle") as HTMLElement).style.left).toBe("
|
|
167
|
+
// The re-grab put the pointer at the padded start (TRACK_PAD); stale
|
|
168
|
+
// spring frames must not have moved the handle (the old spring is
|
|
169
|
+
// dead — this is the regression pin for the re-grab fight).
|
|
170
|
+
expect((el.querySelector(".hk-serpentine-handle") as HTMLElement).style.left).toBe("24px");
|
|
172
171
|
});
|
|
173
172
|
|
|
174
173
|
it("announces twenty-percent bands (40% renders as forty, not worse)", async () => {
|
|
@@ -299,14 +298,25 @@ describe("HkSerpentineUnlock styles contract", () => {
|
|
|
299
298
|
}
|
|
300
299
|
});
|
|
301
300
|
|
|
302
|
-
it("
|
|
303
|
-
expect(scss).
|
|
304
|
-
expect(scss).toContain("animation:
|
|
305
|
-
|
|
301
|
+
it("keeps no displacement animation at all (the shake retired with the off-path fail)", () => {
|
|
302
|
+
expect(scss).not.toContain("@keyframes");
|
|
303
|
+
expect(scss).not.toContain("animation:");
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it("puts the hint in flow (no absolute hang below the box)", () => {
|
|
307
|
+
// Device feedback: the absolutely-positioned hint got clipped by the
|
|
308
|
+
// confirmation window. The hint is a block in flow now.
|
|
309
|
+
expect(scss).toContain("display: block;");
|
|
310
|
+
expect(scss).not.toContain("position: absolute;\n inset-inline: 0;");
|
|
306
311
|
});
|
|
307
312
|
|
|
308
313
|
it("uses real motion tokens, not invented ones", () => {
|
|
314
|
+
// The shake retired with the off-path fail; the remaining motion
|
|
315
|
+
// surface is the confirmed knob's transition, which uses the real
|
|
316
|
+
// duration/ease tokens. The invented --hk-motion-ease must not return.
|
|
309
317
|
expect(scss).toContain("--ease-standard");
|
|
310
318
|
expect(scss).not.toContain("--hk-motion-ease");
|
|
319
|
+
expect(scss).not.toContain("@keyframes");
|
|
320
|
+
expect(scss).not.toContain("HkSerpentineUnlock.scss:13");
|
|
311
321
|
});
|
|
312
322
|
});
|
|
@@ -65,8 +65,6 @@ export default defineComponent({
|
|
|
65
65
|
confirm: () => true,
|
|
66
66
|
/** Progress at release (0..1); the parent may log or ignore. */
|
|
67
67
|
cancel: (progress: number) => typeof progress === "number",
|
|
68
|
-
fail: (reason: "off-path" | "short") =>
|
|
69
|
-
reason === "off-path" || reason === "short",
|
|
70
68
|
},
|
|
71
69
|
setup(props, { emit }) {
|
|
72
70
|
const viewport = ref<HTMLElement | null>(null);
|
|
@@ -80,7 +78,6 @@ export default defineComponent({
|
|
|
80
78
|
const snapping = ref(false);
|
|
81
79
|
/** Set after a successful drag, before the parent acts. */
|
|
82
80
|
const confirmed = ref(false);
|
|
83
|
-
const failed = ref<"off-path" | "short" | null>(null);
|
|
84
81
|
const announced = ref(0);
|
|
85
82
|
|
|
86
83
|
const laneWidth = ref(600);
|
|
@@ -102,7 +99,6 @@ export default defineComponent({
|
|
|
102
99
|
() => {
|
|
103
100
|
confirmed.value = false;
|
|
104
101
|
stopSpring();
|
|
105
|
-
failed.value = null;
|
|
106
102
|
progress.value = 0;
|
|
107
103
|
},
|
|
108
104
|
);
|
|
@@ -111,6 +107,11 @@ export default defineComponent({
|
|
|
111
107
|
const keyboardGrabbed = ref(false);
|
|
112
108
|
const keyboardStep = 1 / 20;
|
|
113
109
|
|
|
110
|
+
/** Pointer-to-lane distance the tracking forgives (px): inside it the knob
|
|
111
|
+
* follows the projection; outside it the knob holds (no reset). Generous
|
|
112
|
+
* by design — a touch wobble must not cost the walk. */
|
|
113
|
+
const TRACKING_TOLERANCE = 30;
|
|
114
|
+
|
|
114
115
|
function onKeydown(event: KeyboardEvent) {
|
|
115
116
|
if (props.disabled || confirmed.value) return;
|
|
116
117
|
if (event.key === "Escape") {
|
|
@@ -171,7 +172,6 @@ export default defineComponent({
|
|
|
171
172
|
// The pointer IS on the resting handle: a re-grab mid-snap-back wins
|
|
172
173
|
// over the spring — stop it, or the two inputs fight over progress.
|
|
173
174
|
stopSpring();
|
|
174
|
-
failed.value = null;
|
|
175
175
|
try {
|
|
176
176
|
(event.target as HTMLElement).setPointerCapture(event.pointerId);
|
|
177
177
|
} catch {
|
|
@@ -193,15 +193,15 @@ export default defineComponent({
|
|
|
193
193
|
x: event.clientX - box.left,
|
|
194
194
|
y: event.clientY - box.top,
|
|
195
195
|
});
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
// Forgiving tracking (device feedback: an 18px corridor reset the
|
|
197
|
+
// walk on every touch wobble). Off-lane the knob HOLDS — the
|
|
198
|
+
// projection can only advance along the lane, so a stray pointer
|
|
199
|
+
// cannot skip ahead, and coming back resumes. The walk ends only on
|
|
200
|
+
// release: short of the goal that is a cancel (spring back), at the
|
|
201
|
+
// goal it confirms.
|
|
202
|
+
if (near.distance > TRACKING_TOLERANCE) return;
|
|
202
203
|
progress.value = Math.min(1, near.arc / path.value.totalLength);
|
|
203
204
|
announce(progress.value);
|
|
204
|
-
// Arrival only ARMS the goal; the confirm fires on release at it.
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
function onPointerUp() {
|
|
@@ -225,13 +225,6 @@ export default defineComponent({
|
|
|
225
225
|
snapBack();
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
function fail(reason: "off-path" | "short") {
|
|
229
|
-
tracking.value = false;
|
|
230
|
-
failed.value = reason;
|
|
231
|
-
emit("fail", reason);
|
|
232
|
-
snapBack();
|
|
233
|
-
}
|
|
234
|
-
|
|
235
228
|
// ── spring snap-back (frame bus) ─────────────────────────────────
|
|
236
229
|
let frameHandle: { disconnect(): void } | null = null;
|
|
237
230
|
let springState: { pos: number; vel: number } | null = null;
|
|
@@ -310,7 +303,6 @@ export default defineComponent({
|
|
|
310
303
|
"hk-serpentine--danger": tone === "danger",
|
|
311
304
|
"hk-serpentine--tracking": tracking.value,
|
|
312
305
|
"hk-serpentine--confirmed": confirmed.value,
|
|
313
|
-
"hk-serpentine--failed": failed.value !== null,
|
|
314
306
|
"hk-serpentine--snap": snapping.value,
|
|
315
307
|
}}
|
|
316
308
|
ref={viewport}
|
|
@@ -352,7 +344,7 @@ export default defineComponent({
|
|
|
352
344
|
/>
|
|
353
345
|
<span class="hk-serpentine-hint" aria-live="polite">
|
|
354
346
|
{confirmed.value
|
|
355
|
-
?
|
|
347
|
+
? "✓"
|
|
356
348
|
: tracking.value || keyboardGrabbed.value
|
|
357
349
|
? `${props.trackingHint} (${announced.value}%)`
|
|
358
350
|
: props.grabHint}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* HkSupplementInset — the supplementary slot of a button surface.
|
|
2
|
+
*
|
|
3
|
+
* At rest the supplement takes NO space (the surface's own content stays
|
|
4
|
+
* exactly centred where the host put it). On reveal the supplement's
|
|
5
|
+
* column animates open — pushing the main content left — and the
|
|
6
|
+
* supplement content fades in. Everything rides the animation context
|
|
7
|
+
* (duration/ease tokens; reduced-motion users get the instant states).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
.hk-supplement-inset {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
max-width: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.hk-supplement-inset-main {
|
|
18
|
+
/* The main region takes the remaining space; as the supplement column
|
|
19
|
+
opens, it (and its centred content) is pushed left. */
|
|
20
|
+
flex: 1 1 auto;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.hk-supplement-inset-supplement {
|
|
28
|
+
/* The column collapses to 0 and animates to the measured content width
|
|
29
|
+
(--hk-supplement-w, set from a ResizeObserver on the inner) — the
|
|
30
|
+
horizontal twin of HkExpansionPanel's 0fr→1fr body trick, minus the
|
|
31
|
+
magic constant. visibility joins the collapse: an unrevealed
|
|
32
|
+
supplement is untabbable and out of the a11y tree (an opacity-only
|
|
33
|
+
hide leaks Tab stops). */
|
|
34
|
+
max-width: 0px;
|
|
35
|
+
opacity: 0;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
visibility: hidden;
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
transition: max-width var(--duration-normal) var(--ease-standard),
|
|
41
|
+
opacity var(--duration-short) ease,
|
|
42
|
+
visibility 0s linear var(--duration-normal);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.hk-supplement-inset-supplement-inner {
|
|
46
|
+
/* The inner keeps its max-content width (the measurement target) and
|
|
47
|
+
overflows the collapsed outer — a shrinkable flex item would measure
|
|
48
|
+
at min-content and clamp the reveal forever. Hence flex: none. */
|
|
49
|
+
flex: none;
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: var(--space-4);
|
|
53
|
+
padding-inline-start: var(--space-4);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Reveal: the controlled prop, hovering, or holding focus inside the
|
|
57
|
+
inset. visibility flips immediately so the controls become focusable
|
|
58
|
+
the moment the reveal starts. */
|
|
59
|
+
.hk-supplement-inset[data-revealed] .hk-supplement-inset-supplement,
|
|
60
|
+
.hk-supplement-inset[data-hover-reveal]:not([data-closed]):hover .hk-supplement-inset-supplement,
|
|
61
|
+
.hk-supplement-inset[data-hover-reveal]:not([data-closed]):focus-within .hk-supplement-inset-supplement {
|
|
62
|
+
max-width: var(--hk-supplement-w, 32px);
|
|
63
|
+
opacity: 1;
|
|
64
|
+
visibility: visible;
|
|
65
|
+
transition: max-width var(--duration-normal) var(--ease-standard),
|
|
66
|
+
opacity var(--duration-short) ease,
|
|
67
|
+
visibility 0s linear 0s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* The host's press-off state: forced closed even under hover/focus-within
|
|
71
|
+
(touch keeps sticky hover after a tap — without this the press-off would
|
|
72
|
+
be unobservable there). Hovering again after leaving re-reveals. */
|
|
73
|
+
.hk-supplement-inset[data-closed] .hk-supplement-inset-supplement {
|
|
74
|
+
max-width: 0px;
|
|
75
|
+
opacity: 0;
|
|
76
|
+
visibility: hidden;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@media (prefers-reduced-motion: reduce) {
|
|
80
|
+
.hk-supplement-inset-supplement {
|
|
81
|
+
transition: none;
|
|
82
|
+
}
|
|
83
|
+
}
|