@celestia-island/hikari 0.55.433 → 0.55.434
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/HkSerpentineUnlock.scss +5 -28
- package/src/components/HkSerpentineUnlock.test.ts +28 -18
- package/src/components/HkSerpentineUnlock.tsx +13 -21
- package/src/components/serpentineGeometry.test.ts +13 -8
- package/src/components/serpentineGeometry.ts +11 -4
- package/src/index.ts +0 -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
|
+
|
|
@@ -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}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
generateSerpentinePath,
|
|
5
5
|
pathLength,
|
|
6
6
|
projectOntoPath,
|
|
7
|
+
TRACK_PAD,
|
|
7
8
|
type PathPoint,
|
|
8
9
|
} from "./serpentineGeometry";
|
|
9
10
|
|
|
@@ -20,10 +21,12 @@ describe("generateSerpentinePath", () => {
|
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
|
|
23
|
-
it("starts
|
|
24
|
+
it("starts inset from the left edge, vertically centred", () => {
|
|
25
|
+
// Device feedback: the resting handle hugged the border line. The walk
|
|
26
|
+
// now begins TRACK_PAD in from the edge.
|
|
24
27
|
const p = generateSerpentinePath(W, H, 7);
|
|
25
28
|
const first = p.points[0]!;
|
|
26
|
-
expect(first.x).
|
|
29
|
+
expect(first.x).toBe(TRACK_PAD);
|
|
27
30
|
expect(first.x).toBeLessThan(W / 2);
|
|
28
31
|
expect(first.y).toBeCloseTo(H / 2, 5);
|
|
29
32
|
});
|
|
@@ -34,7 +37,7 @@ describe("generateSerpentinePath", () => {
|
|
|
34
37
|
const pts = p.points;
|
|
35
38
|
const last = pts[pts.length - 1]!;
|
|
36
39
|
const prev = pts[pts.length - 2]!;
|
|
37
|
-
expect(last.x).
|
|
40
|
+
expect(last.x).toBeCloseTo(W - TRACK_PAD, 5);
|
|
38
41
|
expect(last.y).toBeCloseTo(H / 2, 5);
|
|
39
42
|
// The final leg approaches horizontally (same y as the endpoint).
|
|
40
43
|
expect(prev.y).toBeCloseTo(last.y, 5);
|
|
@@ -61,8 +64,8 @@ describe("generateSerpentinePath", () => {
|
|
|
61
64
|
for (let seed = 0; seed < 100; seed++) {
|
|
62
65
|
const p = generateSerpentinePath(W, H, seed);
|
|
63
66
|
for (const pt of p.points) {
|
|
64
|
-
expect(pt.x).toBeGreaterThanOrEqual(
|
|
65
|
-
expect(pt.x).toBeLessThanOrEqual(W);
|
|
67
|
+
expect(pt.x).toBeGreaterThanOrEqual(TRACK_PAD);
|
|
68
|
+
expect(pt.x).toBeLessThanOrEqual(W - TRACK_PAD);
|
|
66
69
|
expect(pt.y).toBeGreaterThanOrEqual(0);
|
|
67
70
|
expect(pt.y).toBeLessThanOrEqual(H);
|
|
68
71
|
}
|
|
@@ -79,7 +82,8 @@ describe("generateSerpentinePath", () => {
|
|
|
79
82
|
|
|
80
83
|
it("reports a positive total length", () => {
|
|
81
84
|
const p = generateSerpentinePath(W, H, 1);
|
|
82
|
-
|
|
85
|
+
// The arc exceeds the padded x span by the vertical travel.
|
|
86
|
+
expect(p.totalLength).toBeGreaterThan(W - TRACK_PAD * 2);
|
|
83
87
|
});
|
|
84
88
|
|
|
85
89
|
// Regression pins for the leg-class variance: a generator that always
|
|
@@ -114,12 +118,13 @@ describe("generateSerpentinePath", () => {
|
|
|
114
118
|
for (let seed = 0; seed < 50; seed++) {
|
|
115
119
|
const p = generateSerpentinePath(narrow, H, seed);
|
|
116
120
|
for (const pt of p.points) {
|
|
121
|
+
expect(pt.x).toBeGreaterThanOrEqual(0);
|
|
117
122
|
expect(pt.x).toBeLessThanOrEqual(narrow);
|
|
118
123
|
expect(pt.y).toBeLessThanOrEqual(H);
|
|
119
124
|
}
|
|
120
|
-
// The final leg
|
|
125
|
+
// The final leg lands at the right inset at the centre.
|
|
121
126
|
const last = p.points[p.points.length - 1]!;
|
|
122
|
-
expect(last.x).toBe(narrow);
|
|
127
|
+
expect(last.x).toBe(narrow - Math.min(TRACK_PAD, Math.floor(narrow / 8)));
|
|
123
128
|
expect(last.y).toBeCloseTo(H / 2, 5);
|
|
124
129
|
}
|
|
125
130
|
}
|
|
@@ -74,6 +74,11 @@ export function projectOntoPath(points: PathPoint[], distance: number): PathPoin
|
|
|
74
74
|
/** Minimum horizontal run per horizontal leg (px) — keeps turns readable. */
|
|
75
75
|
const MIN_H_RUN = 40;
|
|
76
76
|
|
|
77
|
+
/** Horizontal inset of the start/goal from the container edges (px). The
|
|
78
|
+
* resting handle sits ON these points; without the inset it hugs the
|
|
79
|
+
* border line and half of its hit area falls outside the gate. */
|
|
80
|
+
export const TRACK_PAD = 24;
|
|
81
|
+
|
|
77
82
|
/**
|
|
78
83
|
* Build the serpentine lane for a `width × height` canvas.
|
|
79
84
|
*
|
|
@@ -92,6 +97,7 @@ export function generateSerpentinePath(
|
|
|
92
97
|
const rand = mulberry32(seed);
|
|
93
98
|
const centre = height / 2;
|
|
94
99
|
const firstRowUp = rand() < 0.5;
|
|
100
|
+
const pad = Math.min(TRACK_PAD, width / 8);
|
|
95
101
|
// Leg count is EVEN and always ends with the horizontal run to the right
|
|
96
102
|
// edge: V,H,V,H,...,V,H. Corners (interior vertices) are therefore 3 or 5,
|
|
97
103
|
// both inside the briefed 3..=5 range; the seeded first V satisfies "the
|
|
@@ -104,12 +110,13 @@ export function generateSerpentinePath(
|
|
|
104
110
|
// On narrow canvases the run floor shrinks so the lane still fits.
|
|
105
111
|
const minHRun = Math.min(MIN_H_RUN, Math.floor(width / 8));
|
|
106
112
|
|
|
107
|
-
const points: PathPoint[] = [{ x:
|
|
108
|
-
let x =
|
|
113
|
+
const points: PathPoint[] = [{ x: pad, y: centre }];
|
|
114
|
+
let x = pad;
|
|
109
115
|
// Distribute the horizontal budget across the H legs: every H leg except
|
|
110
116
|
// the last gets a random slice (>= minHRun); the LAST H leg takes the
|
|
111
117
|
// remainder so the walk lands exactly on the right edge.
|
|
112
|
-
const
|
|
118
|
+
const span = width - pad * 2;
|
|
119
|
+
const hBudget = span - minHRun * (vLegs - 1);
|
|
113
120
|
const hRuns: number[] = [];
|
|
114
121
|
let used = 0;
|
|
115
122
|
for (let h = 0; h < vLegs - 1; h++) {
|
|
@@ -119,7 +126,7 @@ export function generateSerpentinePath(
|
|
|
119
126
|
hRuns.push(Math.max(minHRun, capped));
|
|
120
127
|
used += hRuns[hRuns.length - 1]!;
|
|
121
128
|
}
|
|
122
|
-
hRuns.push(
|
|
129
|
+
hRuns.push(span - used);
|
|
123
130
|
|
|
124
131
|
// Legs strictly alternate V,H,V,H,...,V,H: each V switches the travelling
|
|
125
132
|
// row (centre -> firstRow -> secondRow -> ... -> centre), each H advances
|
package/src/index.ts
CHANGED
|
@@ -918,18 +918,6 @@ export { default as HkPhoneInput } from "./components/HkPhoneInput";
|
|
|
918
918
|
export { default as HkAffixPicker } from "./components/HkAffixPicker";
|
|
919
919
|
export { default as HkAddTile } from "./components/HkAddTile";
|
|
920
920
|
export { default as HkUserPicker, type HkUserOption } from "./components/HkUserPicker";
|
|
921
|
-
export { default as HkSlideConfirm } from "./components/HkSlideConfirm";
|
|
922
|
-
export {
|
|
923
|
-
generateSlidePath,
|
|
924
|
-
slideConfirmCorridor,
|
|
925
|
-
slideConfirmRng,
|
|
926
|
-
slideLaneY,
|
|
927
|
-
slidePathLength,
|
|
928
|
-
slidePixelPoints,
|
|
929
|
-
slidePointAtT,
|
|
930
|
-
slideSegmentDistance,
|
|
931
|
-
} from "./components/slideConfirmPath";
|
|
932
|
-
export type { SlidePath, SlidePoint } from "./components/slideConfirmPath";
|
|
933
921
|
export { default as HkPhaseTransition } from "./components/HkPhaseTransition";
|
|
934
922
|
export { default as HkGaugeRing } from "./components/HkGaugeRing";
|
|
935
923
|
export { default as HkProgressRing } from "./components/HkProgressRing";
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
@use "../styles/polyfill" as *;
|
|
2
|
-
|
|
3
|
-
// HkSlideConfirm (components/HkSlideConfirm.tsx) — the fat slide-to-
|
|
4
|
-
// confirm: a three-standard-row block whose orthogonal lane carries ≥3
|
|
5
|
-
// random right-angle turns; the knob is grabbed and TRACED from the left
|
|
6
|
-
// edge to the right edge; a premature release or a corridor exit snaps it
|
|
7
|
-
// back at once. Tokens follow the house scale (--space-*, --radius-*,
|
|
8
|
-
// rgb(var(--color-*)), --hi-color-*).
|
|
9
|
-
//
|
|
10
|
-
// GEOMETRY: the block's height is THREE standard control rows
|
|
11
|
-
// (calc(var(--space-40, 2.5rem) * 3)) — the 2026-11-19 user direction
|
|
12
|
-
// that makes the confirmation feel deliberate instead of reflexive. The
|
|
13
|
-
// lane svg is inset by the same TRACK_PAD the tsx maps coordinates with;
|
|
14
|
-
// the knob rides the lane's px frame (transform from the track corner,
|
|
15
|
-
// centered by the negative half-margin below).
|
|
16
|
-
|
|
17
|
-
.hk-slide-confirm {
|
|
18
|
-
position: relative;
|
|
19
|
-
height: calc(var(--space-40, 2.5rem) * 3);
|
|
20
|
-
border-radius: var(--radius-lg, 0.75rem);
|
|
21
|
-
background: var(--hi-color-surface, rgba(255, 255, 255, 0.95));
|
|
22
|
-
border: 1px solid rgb(var(--color-border) / 8%);
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
transition: border-color 0.2s ease, background 0.2s ease;
|
|
25
|
-
|
|
26
|
-
&:hover:not(.is-disabled) {
|
|
27
|
-
border-color: rgb(var(--color-border) / 20%);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&.is-done {
|
|
31
|
-
border-color: rgb(var(--color-primary) / 35%);
|
|
32
|
-
background: color-mix(in srgb, var(--hi-color-primary, #7aa2f7) 8%, transparent);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&.is-disabled {
|
|
36
|
-
opacity: 0.55;
|
|
37
|
-
pointer-events: none;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/* The lane: an svg inset by TRACK_PAD (the tsx maps coordinates in the
|
|
42
|
-
* same frame). One polyline, thick round stroke — a corridor to trace,
|
|
43
|
-
* not a line to read. */
|
|
44
|
-
.hk-slide-confirm-lane {
|
|
45
|
-
position: absolute;
|
|
46
|
-
overflow: visible;
|
|
47
|
-
pointer-events: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.hk-slide-confirm-lane-path {
|
|
51
|
-
fill: none;
|
|
52
|
-
stroke: rgb(var(--color-text) / 14%);
|
|
53
|
-
stroke-width: 1.25rem;
|
|
54
|
-
stroke-linecap: round;
|
|
55
|
-
stroke-linejoin: round;
|
|
56
|
-
|
|
57
|
-
&.is-done {
|
|
58
|
-
stroke: color-mix(in srgb, var(--hi-color-primary, #7aa2f7) 45%, transparent);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.hk-slide-confirm-label,
|
|
63
|
-
.hk-slide-confirm-done-label {
|
|
64
|
-
position: absolute;
|
|
65
|
-
inset: 0;
|
|
66
|
-
display: flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
padding: 0 var(--space-32, 2rem);
|
|
70
|
-
font-size: 0.75rem;
|
|
71
|
-
color: rgb(var(--color-text) / 45%);
|
|
72
|
-
text-align: center;
|
|
73
|
-
pointer-events: none;
|
|
74
|
-
@include user-select(none);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.hk-slide-confirm-done-label {
|
|
78
|
-
color: var(--hi-color-primary, #7aa2f7);
|
|
79
|
-
font-weight: 600;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/* The knob: a joystick-sized circle, centered on the lane point by the
|
|
83
|
-
* negative half-margin, riding the transform the tsx writes. While
|
|
84
|
-
* snapping it transitions back to the start (the "一下子回去" — the
|
|
85
|
-
* instant return reads as refusal, not as a reset). */
|
|
86
|
-
.hk-slide-confirm-knob {
|
|
87
|
-
position: absolute;
|
|
88
|
-
top: 0;
|
|
89
|
-
left: 0;
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
justify-content: center;
|
|
93
|
-
width: 2.4rem;
|
|
94
|
-
height: 2.4rem;
|
|
95
|
-
margin: -1.2rem; /* center the knob on the lane point */
|
|
96
|
-
border-radius: 50%;
|
|
97
|
-
background: var(--hi-color-surface, rgba(255, 255, 255, 0.98));
|
|
98
|
-
border: 1px solid rgb(var(--color-border) / 22%);
|
|
99
|
-
box-shadow: 0 2px 8px rgb(0 0 0 / 22%);
|
|
100
|
-
cursor: grab;
|
|
101
|
-
touch-action: none;
|
|
102
|
-
transition: transform 0.24s cubic-bezier(0.3, 0, 0.5, 1), border-color 0.2s ease;
|
|
103
|
-
|
|
104
|
-
&.is-done {
|
|
105
|
-
cursor: default;
|
|
106
|
-
border-color: var(--hi-color-primary, #7aa2f7);
|
|
107
|
-
background: color-mix(in srgb, var(--hi-color-primary, #7aa2f7) 18%, var(--hi-color-surface, rgba(255, 255, 255, 0.95)));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.hk-slide-confirm.is-dragging .hk-slide-confirm-knob {
|
|
112
|
-
cursor: grabbing;
|
|
113
|
-
/* While tracing, the knob follows the pointer 1:1 — no transition (a
|
|
114
|
-
* transitioned follow would lag the hand). Only the snap-back transition
|
|
115
|
-
* above applies, and only once .is-dragging is gone. */
|
|
116
|
-
transition: border-color 0.2s ease;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/* The grip: three horizontal pills — the joystick affordance. */
|
|
120
|
-
.hk-slide-confirm-knob-grip {
|
|
121
|
-
width: 0.9rem;
|
|
122
|
-
height: 0.55rem;
|
|
123
|
-
background:
|
|
124
|
-
linear-gradient(to bottom,
|
|
125
|
-
rgb(var(--color-text) / 45%) 0 2px, transparent 2px 4px,
|
|
126
|
-
rgb(var(--color-text) / 45%) 4px 6px, transparent 6px 8px,
|
|
127
|
-
rgb(var(--color-text) / 45%) 8px 10px, transparent 10px);
|
|
128
|
-
border-radius: 1px;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* Reduced motion: the snap-back must SNAP (the whole point of the refusal
|
|
132
|
-
* read), not glide — the transition is the only animated part. */
|
|
133
|
-
@media (prefers-reduced-motion: reduce) {
|
|
134
|
-
.hk-slide-confirm-knob {
|
|
135
|
-
transition: border-color 0.2s ease;
|
|
136
|
-
}
|
|
137
|
-
}
|