@celestia-island/hikari 0.55.427 → 0.55.429

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 (45) hide show
  1. package/package.json +1 -1
  2. package/src/animation/registerAnimations.ts +5 -0
  3. package/src/components/HkBoard.nodeActions.test.tsx +3 -1
  4. package/src/components/HkContextMenuProvider.tsx +84 -2
  5. package/src/components/HkNotificationBell.scss +24 -6
  6. package/src/components/HkNotificationBell.styles.test.ts +45 -3
  7. package/src/components/HkNotificationBell.test.tsx +55 -2
  8. package/src/components/HkNotificationBell.tsx +15 -6
  9. package/src/components/HkSerpentineUnlock.scss +124 -0
  10. package/src/components/HkSerpentineUnlock.test.ts +312 -0
  11. package/src/components/HkSerpentineUnlock.tsx +366 -0
  12. package/src/components/HkSolarLocationEditor.tsx +440 -0
  13. package/src/components/HkSolarLocationSetting.tsx +35 -392
  14. package/src/components/HkTabs.scss +119 -0
  15. package/src/components/HkTabs.test.ts +585 -1
  16. package/src/components/HkTabs.tsx +284 -38
  17. package/src/components/HkThemePanelContent.solar.contract.test.ts +148 -0
  18. package/src/components/HkThemePanelContent.tsx +56 -2
  19. package/src/components/serpentineGeometry.test.ts +157 -0
  20. package/src/components/serpentineGeometry.ts +184 -0
  21. package/src/composables/defaultContextMenu.test.ts +569 -0
  22. package/src/composables/defaultContextMenu.ts +326 -0
  23. package/src/i18n/locales/ar/components.json +6 -1
  24. package/src/i18n/locales/ar/platform.json +1 -0
  25. package/src/i18n/locales/de/components.json +6 -1
  26. package/src/i18n/locales/de/platform.json +1 -0
  27. package/src/i18n/locales/en/components.json +6 -1
  28. package/src/i18n/locales/en/platform.json +1 -0
  29. package/src/i18n/locales/es/components.json +6 -1
  30. package/src/i18n/locales/es/platform.json +1 -0
  31. package/src/i18n/locales/fr/components.json +6 -1
  32. package/src/i18n/locales/fr/platform.json +1 -0
  33. package/src/i18n/locales/ja/components.json +6 -1
  34. package/src/i18n/locales/ja/platform.json +1 -0
  35. package/src/i18n/locales/ko/components.json +6 -1
  36. package/src/i18n/locales/ko/platform.json +1 -0
  37. package/src/i18n/locales/pt/components.json +6 -1
  38. package/src/i18n/locales/pt/platform.json +1 -0
  39. package/src/i18n/locales/ru/components.json +6 -1
  40. package/src/i18n/locales/ru/platform.json +1 -0
  41. package/src/i18n/locales/zh-Hans/components.json +6 -1
  42. package/src/i18n/locales/zh-Hans/platform.json +1 -0
  43. package/src/i18n/locales/zh-Hant/components.json +6 -1
  44. package/src/i18n/locales/zh-Hant/platform.json +1 -0
  45. package/src/index.ts +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.427",
3
+ "version": "0.55.429",
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",
@@ -157,3 +157,8 @@ 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
+ // components/HkSerpentineUnlock.scss — the deliberate-action gate's fail
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");
@@ -103,6 +103,8 @@ describe("HkBoard nodeActions dock styles", () => {
103
103
  expect(block.slice(0, 400)).toMatch(
104
104
  /bottom:\s*var\(--hk-board-node-action-inset, 4px\)/,
105
105
  );
106
- expect(block.slice(0, 400)).toMatch(/z-index:\s*6/);
106
+ // Anchored: `/z-index:\s*6/` is a PREFIX match, so a stacking
107
+ // retune to 60/600 stayed green (final-residual fix).
108
+ expect(block.slice(0, 400)).toMatch(/z-index:\s*6\s*;/);
107
109
  });
108
110
  });
@@ -22,15 +22,17 @@
22
22
  * `useContextMenuTrigger()` (composables/useContextMenu).
23
23
  */
24
24
 
25
- import { computed, defineComponent, provide, ref, shallowRef } from "vue";
25
+ import { computed, defineComponent, onBeforeUnmount, provide, ref, shallowRef, watch } from "vue";
26
26
 
27
27
  import { popupViewportRect } from "../runtime/popupBounds";
28
28
  import HkMenu from "./HkMenu";
29
29
  import type { PanelAnchor } from "./HkSelectPanel";
30
+ import { contextMenuDefaultsFor } from "../composables/defaultContextMenu";
30
31
  import {
31
32
  CONTEXT_MENU_KEY,
32
33
  type ContextMenuApi,
33
34
  type ContextMenuRequest,
35
+ type ContextTriggerPoint,
34
36
  } from "../composables/useContextMenu";
35
37
 
36
38
  /** Pick the HkMenu placement that grows away from the pointer's nearest
@@ -66,7 +68,21 @@ function pointAnchor(x: number, y: number): PanelAnchor {
66
68
 
67
69
  export default defineComponent({
68
70
  name: "HkContextMenuProvider",
69
- setup(_, { slots }) {
71
+ props: {
72
+ /**
73
+ * Install the app-wide DEFAULT context-menu regime while this
74
+ * provider is mounted (composables/defaultContextMenu): a
75
+ * window-level bubble listener that yields to any element-level
76
+ * binding (those preventDefault first), consults the registered
77
+ * default contributors (the built-in clipboard menu claims
78
+ * editable targets), and suppresses the platform menu everywhere
79
+ * else. Hosts extend the regime with
80
+ * `registerContextMenuDefault(...)` — region-specific defaults
81
+ * belong in contributors, not in new window listeners.
82
+ */
83
+ defaults: { type: Boolean, default: false },
84
+ },
85
+ setup(props, { slots }) {
70
86
  const open = ref(false);
71
87
  const request = shallowRef<ContextMenuRequest | null>(null);
72
88
  /** Remount identity: every open() swaps the HkMenu instance, so a
@@ -93,6 +109,9 @@ export default defineComponent({
93
109
 
94
110
  const api: ContextMenuApi = {
95
111
  open(next: ContextMenuRequest) {
112
+ // Replacing an open menu closes the previous one — its owner gets
113
+ // the "closed without a selection" hook it was promised.
114
+ if (open.value) request.value?.onClose?.();
96
115
  request.value = next;
97
116
  menuEpoch.value += 1;
98
117
  open.value = true;
@@ -103,6 +122,69 @@ export default defineComponent({
103
122
  };
104
123
  provide(CONTEXT_MENU_KEY, api);
105
124
 
125
+ // ── The default regime (prop `defaults`) ─────────────────────────
126
+ // Window-level BUBBLE phase: target-level bindings run first on the
127
+ // element; only their leftovers reach here (defaultPrevented =
128
+ // yielded). The platform menu never appears: the regime owns every
129
+ // unclaimed right-click, with a menu when a contributor claims the
130
+ // point and silent suppression otherwise.
131
+ //
132
+ // preventDefault comes FIRST: the platform menu must be suppressed
133
+ // even when a contributor misbehaves, and a throwing contributor is
134
+ // isolated (DEV-loud) instead of silently handing the event back to
135
+ // the browser.
136
+ function onWindowContextMenu(event: MouseEvent) {
137
+ if (event.defaultPrevented) return; // a binding opened its menu
138
+ event.preventDefault();
139
+ const point: ContextTriggerPoint = {
140
+ x: event.clientX,
141
+ y: event.clientY,
142
+ kind: "pointer",
143
+ target: event.target,
144
+ defaultPrevented: false,
145
+ };
146
+ let request: ContextMenuRequest | null = null;
147
+ try {
148
+ request = contextMenuDefaultsFor(point);
149
+ } catch (err) {
150
+ if (import.meta.env.DEV) {
151
+ // eslint-disable-next-line no-console -- dev-only drift alarm
152
+ console.error("[HkContextMenuProvider] default contributor threw:", err);
153
+ }
154
+ }
155
+ if (request) api.open(request);
156
+ }
157
+
158
+ // The listener follows the prop: a host may flip `defaults` at
159
+ // runtime (a face that gains the regime after boot), and toggling it
160
+ // off must actually stop claiming right-clicks.
161
+ let defaultsListening = false;
162
+ /** SSR-safe: a server render has no window, and `immediate: true` runs
163
+ * this during setup (the provider's documented SSR contract). */
164
+ const canListen = typeof window !== "undefined";
165
+ watch(
166
+ () => props.defaults,
167
+ (on) => {
168
+ if (!canListen) return;
169
+ if (on && !defaultsListening) {
170
+ window.addEventListener("contextmenu", onWindowContextMenu);
171
+ defaultsListening = true;
172
+ } else if (!on && defaultsListening) {
173
+ window.removeEventListener("contextmenu", onWindowContextMenu);
174
+ defaultsListening = false;
175
+ }
176
+ },
177
+ { immediate: true },
178
+ );
179
+ onBeforeUnmount(() => {
180
+ // A menu still open when the provider goes away is a menu that
181
+ // closed without a selection — the documented hook fires.
182
+ request.value?.onClose?.();
183
+ if (!canListen) return;
184
+ window.removeEventListener("contextmenu", onWindowContextMenu);
185
+ defaultsListening = false;
186
+ });
187
+
106
188
  /** A server render has no DOM to build the anchor from: pass `null`,
107
189
  * the same state as a consumer that gives HkMenu no anchor at all
108
190
  * (positioning only ever runs in the browser). */
@@ -131,18 +131,36 @@
131
131
  /* Corner tally for consolidated records (2026-11-19): the unread dot's
132
132
  primary channel — the same "attention" grammar the bell trigger speaks.
133
133
  Sits on the glyph's bottom-end corner like a notification count. */
134
+ /* Screen-reader-only text (no global utility exists in hikari — this is
135
+ the local twin of HkTable's .hk-table-sr-only). The tally's visible
136
+ "99+" cap is sighted shorthand; AT reads this pair instead. */
137
+ .hk-notification-row__sr-only {
138
+ position: absolute;
139
+ width: 1px;
140
+ height: 1px;
141
+ padding: 0;
142
+ margin: -1px;
143
+ overflow: hidden;
144
+ clip-path: inset(50%);
145
+ white-space: nowrap;
146
+ border: 0;
147
+ }
148
+
134
149
  .hk-notification-row__icon-count {
135
150
  position: absolute;
136
151
  inset-inline-end: -7px;
137
152
  bottom: -6px;
138
- min-width: 14px;
139
- height: 14px;
140
- padding: 0 3px;
141
- border-radius: 7px;
153
+ /* Geometry rides the scale: the badge is a hair under the 2xs step
154
+ (0.5625rem = 9px, the token's own 0.625rem would overflow the 14px
155
+ chip), and the chip box is 2 × the radius. */
156
+ min-width: 0.875rem;
157
+ height: 0.875rem;
158
+ padding: 0 0.1875rem;
159
+ border-radius: 0.4375rem;
142
160
  background: var(--hi-color-primary, #7aa2f7);
143
161
  color: rgb(255 255 255 / 95%);
144
- font-size: 9px;
145
- line-height: 14px;
162
+ font-size: 0.5625rem;
163
+ line-height: 0.875rem;
146
164
  font-weight: 600;
147
165
  text-align: center;
148
166
  font-variant-numeric: tabular-nums;
@@ -13,6 +13,41 @@ const scss = readFileSync(join(__dirname, "HkNotificationBell.scss"), "utf-8")
13
13
  .replace(/^[ \t]*\/\/.*$/gm, "");
14
14
 
15
15
  describe("HkNotificationBell scss contract", () => {
16
+ it("the tally's sr-only twin really hides (the a11y recipe is pinned here)", () => {
17
+ // The badge's accessible name is real text in a visually-hidden span;
18
+ // happy-dom applies no stylesheets, so the CONTRACT lives here — every
19
+ // arm of the sr-only recipe must survive a revert that would make the
20
+ // twin visible (or, worse, leave it in flow and break the row).
21
+ const block = scss.match(/\.hk-notification-row__sr-only \{([^}]*)\}/);
22
+ expect(block, "the sr-only rule exists").toBeTruthy();
23
+ for (const arm of [
24
+ "position: absolute",
25
+ "width: 1px",
26
+ "height: 1px",
27
+ "overflow: hidden",
28
+ "clip-path: inset(50%)",
29
+ "white-space: nowrap",
30
+ ]) {
31
+ expect(block![1], `sr-only carries ${arm}`).toContain(arm);
32
+ }
33
+ });
34
+
35
+ it("each load-bearing rule is declared ONCE (a duplicate top-level rule could override it unseen)", () => {
36
+ // The row helpers extract the FIRST matching rule, so an appended
37
+ // duplicate with the same selector wins the cascade while the pinned
38
+ // body stays present (final-residual class). Counting the selector at
39
+ // file scope closes it for the rules these pins defend.
40
+ for (const selector of [
41
+ ".hk-notification-center__list {",
42
+ ".hk-notification-row {",
43
+ ".hk-notification-row__icon-count {",
44
+ ".hk-notification-center__foot {",
45
+ ]) {
46
+ const hits = scss.split(selector).length - 1;
47
+ expect(hits, `${selector} declared exactly once`).toBe(1);
48
+ }
49
+ });
50
+
16
51
  it("the panel body is a definite 22rem inside the max-content popover", () => {
17
52
  expect(scss).toContain("width: 22rem;");
18
53
  // The old `min(22rem, 100%)` clamp is the dead-band root cause.
@@ -68,8 +103,15 @@ describe("HkNotificationBell scss contract", () => {
68
103
  expect(scss).toMatch(
69
104
  /\.hk-notification-row:hover \.hk-notification-row__actions \.hk-icon-button,\s*\n\.hk-notification-row:focus-within \.hk-notification-row__actions \.hk-icon-button\s*\{[^}]*--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 85%\)/,
70
105
  );
71
- expect(scss).toMatch(
72
- /\.hk-notification-row:focus-within \.hk-notification-row__actions \.hk-icon-button\s*\{\s*--hi-icon-button-icon-color:/,
73
- );
106
+ // Exactly ONE declaration per ink value: the old third arm asserted
107
+ // only the property NAME on the focus-within selector, which the joint
108
+ // block above already covers (redundant) while an appended second
109
+ // declaration could override it unseen (final-residual fix).
110
+ expect(
111
+ scss.match(/--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 40%\)/g) ?? [],
112
+ ).toHaveLength(1);
113
+ expect(
114
+ scss.match(/--hi-icon-button-icon-color:\s*rgb\(var\(--color-text\) \/ 85%\)/g) ?? [],
115
+ ).toHaveLength(1);
74
116
  });
75
117
  });
@@ -364,7 +364,9 @@ describe("panel rows", () => {
364
364
  const boomRow = rows().find((r) => r.textContent?.includes("boom"))!;
365
365
  const badge = boomRow.querySelector<HTMLElement>(".hk-notification-row__icon-count");
366
366
  expect(badge, "the tally badge renders").toBeTruthy();
367
- expect(badge!.textContent).toBe("3");
367
+ // The visible glyph is the cap ("99+" above 99); the SR twin carries
368
+ // the pair (see the a11y case below).
369
+ expect(badge!.querySelector('[aria-hidden="true"]')!.textContent).toBe("3");
368
370
  expect(badge!.getAttribute("title")).toContain("msgs");
369
371
  // A single-occurrence record carries NO badge.
370
372
  const otherRow = rows().find((r) => r.textContent?.includes("other"))!;
@@ -392,6 +394,28 @@ describe("panel rows", () => {
392
394
  expect(rows()).toHaveLength(0);
393
395
  });
394
396
 
397
+ it("the tally's accessible name is real text with its unit (not a bare number)", async () => {
398
+ // Final-residual fix: `aria-label` on a role-less span is not a
399
+ // reliable accessible name (generic role cannot be named from author),
400
+ // so the badge ships a visually-hidden twin with the full pair while
401
+ // the visible glyph stays the sighted shorthand.
402
+ await setLocale("en");
403
+ for (const id of ["t:1", "t:2", "t:3", "t:4"]) {
404
+ recordNotification({ id, kind: "toast", tone: "error", title: "boom" });
405
+ }
406
+ mountBell();
407
+ await settle();
408
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
409
+ await settle();
410
+ const badge = rows()[0]!.querySelector<HTMLElement>(".hk-notification-row__icon-count")!;
411
+ const sr = badge.querySelector<HTMLElement>(".hk-notification-row__sr-only");
412
+ expect(sr, "the visually-hidden twin renders").toBeTruthy();
413
+ expect(sr!.textContent).toBe("4 msgs");
414
+ // The hiding recipe itself is pinned in the scss contract (happy-dom
415
+ // applies no stylesheets, so a computed-style probe here would test
416
+ // the environment, not the code).
417
+ });
418
+
395
419
  it("a toast joining a snoozed emergency's group does NOT dissolve the Restore", async () => {
396
420
  // Round-3 S2, proven by probe: the group's FACE is its newest member
397
421
  // (the toast), so head-only action gating hid the emergency's only
@@ -425,7 +449,9 @@ describe("panel rows", () => {
425
449
  "Hidden",
426
450
  );
427
451
  // The tally counts both members.
428
- expect(row.querySelector(".hk-notification-row__icon-count")?.textContent).toBe("2");
452
+ expect(
453
+ row.querySelector('.hk-notification-row__icon-count [aria-hidden="true"]')?.textContent,
454
+ ).toBe("2");
429
455
  // And the restore still works through the journal's resummon path.
430
456
  restore!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
431
457
  await settle();
@@ -435,6 +461,33 @@ describe("panel rows", () => {
435
461
  expect(row.classList.contains("is-active")).toBe(true);
436
462
  });
437
463
 
464
+ it("two identical-content snoozed episodes each keep their own Restore", async () => {
465
+ // Final-residual fix: `restorable` used to be a single `find`, so a
466
+ // group holding two episodes surfaced ONE handle and stranded the
467
+ // other's callback (journal intact, band hidden = unreachable).
468
+ await setLocale("en");
469
+ raiseEmergencyAlert({ id: "a", severity: "warning", title: "dup" });
470
+ snoozeEmergencyAlert("a");
471
+ raiseEmergencyAlert({ id: "b", severity: "warning", title: "dup" });
472
+ snoozeEmergencyAlert("b");
473
+ mountBell();
474
+ await settle();
475
+ bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
476
+ await settle();
477
+ expect(rows(), "both episodes share one content group").toHaveLength(1);
478
+ const restores = rows()[0]!.querySelectorAll<HTMLButtonElement>(
479
+ '.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]',
480
+ );
481
+ expect(restores, "one Restore per restorable episode").toHaveLength(2);
482
+ // Each button drives its OWN episode: unsnoozing one leaves the other.
483
+ restores[0]!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
484
+ await settle();
485
+ const after = rows()[0]!.querySelectorAll<HTMLButtonElement>(
486
+ '.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]',
487
+ );
488
+ expect(after, "the other episode keeps its handle").toHaveLength(1);
489
+ });
490
+
438
491
  it("the open panel carries the overlay scrollbar tracks; closing detaches them", async () => {
439
492
  // The list keeps native overflow MECHANICS with the suppression pair,
440
493
  // so the overlay engine is the only chrome it can ever show (user
@@ -236,7 +236,11 @@ export default defineComponent({
236
236
  const isLive = group.members.some(
237
237
  (m) => m.kind === "emergency" && m.state !== "cleared",
238
238
  );
239
- const restorable = group.members.find(
239
+ // ALL restorable members, not just the first (final-residual fix):
240
+ // two identical-content episodes are two episodes, each with its
241
+ // own live callback — a `find` surfaced one Restore and stranded
242
+ // the other's only handle.
243
+ const restorables = group.members.filter(
240
244
  (m) => m.onResummon !== undefined && m.state === "snoozed",
241
245
  );
242
246
  // State chip: the head's own state wins; otherwise any member's
@@ -265,9 +269,13 @@ export default defineComponent({
265
269
  <span
266
270
  class="hk-notification-row__icon-count"
267
271
  title={`${tally} ${t("hikari::toast.msgs", "msgs")}`}
268
- aria-label={`${tally} ${t("hikari::toast.msgs", "msgs")}`}
269
272
  >
270
- {tally > 99 ? "99+" : tally}
273
+ {/* The visible cap is sighted-user shorthand; AT gets the
274
+ full pair as real text (final-residual fix: `aria-label`
275
+ on a role-less span is not a reliable accessible name —
276
+ generic role cannot be named from author). */}
277
+ <span aria-hidden="true">{tally > 99 ? "99+" : tally}</span>
278
+ <span class="hk-notification-row__sr-only">{`${tally} ${t("hikari::toast.msgs", "msgs")}`}</span>
271
279
  </span>
272
280
  )}
273
281
  </span>
@@ -340,16 +348,17 @@ export default defineComponent({
340
348
  {{ icon: () => <X size={14} /> }}
341
349
  </HkIconButton>
342
350
  )}
343
- {restorable && (
351
+ {restorables.map((m) => (
344
352
  <HkIconButton
353
+ key={`restore-${m.id}`}
345
354
  size={24}
346
355
  variant="ghost"
347
356
  aria-label={t("hikari::emergencyAlert.restore", "Show again")}
348
- onClick={() => restorable.onResummon?.()}
357
+ onClick={() => m.onResummon?.()}
349
358
  >
350
359
  {{ icon: () => h(RotateCcw, { size: 14 }) }}
351
360
  </HkIconButton>
352
- )}
361
+ ))}
353
362
  </div>
354
363
  </li>
355
364
  );
@@ -0,0 +1,124 @@
1
+ @use "../styles/polyfill" as *;
2
+
3
+ // Serpentine deliberate-action gate. The lane aliases the theme's tokens;
4
+ // all paint values wrap the triplet in rgb(...) (see WorkspaceGitWindow's
5
+ // palette pin for why the bare form paints nothing).
6
+
7
+ .hk-serpentine {
8
+ position: relative;
9
+ height: calc(var(--space-24, 24px) * 4);
10
+ border-radius: var(--radius-md, 8px);
11
+ border: 1px solid var(--border-faint);
12
+ background: rgb(var(--color-surface) / 40%);
13
+ cursor: grab;
14
+ touch-action: none;
15
+ @include user-select(none);
16
+
17
+ &:focus-visible {
18
+ outline: 2px solid rgb(var(--color-info));
19
+ outline-offset: 2px;
20
+ }
21
+
22
+ &--tracking {
23
+ cursor: grabbing;
24
+ }
25
+
26
+ &--confirmed {
27
+ cursor: default;
28
+ border-color: rgb(var(--color-success) / 60%);
29
+ }
30
+
31
+ &--danger {
32
+ border-color: rgb(var(--color-error) / 35%);
33
+ }
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
+ }
49
+
50
+ .hk-serpentine-svg {
51
+ position: absolute;
52
+ inset: 0;
53
+ width: 100%;
54
+ height: 100%;
55
+ display: block;
56
+ }
57
+
58
+ .hk-serpentine-lane {
59
+ fill: none;
60
+ stroke-width: 3;
61
+ stroke-linecap: round;
62
+ stroke-linejoin: round;
63
+ stroke: var(--border-faint);
64
+ opacity: 0.7;
65
+ }
66
+
67
+ .hk-serpentine-travelled {
68
+ fill: none;
69
+ stroke-width: 3;
70
+ stroke-linecap: round;
71
+ stroke-linejoin: round;
72
+ stroke: rgb(var(--color-info));
73
+ }
74
+
75
+ .hk-serpentine-handle {
76
+ position: absolute;
77
+ width: 22px;
78
+ height: 22px;
79
+ border-radius: 999px;
80
+ transform: translate(-50%, -50%);
81
+ background: rgb(var(--color-info));
82
+ border: 2px solid rgb(var(--color-surface));
83
+ box-shadow: 0 0 0 2px rgb(var(--color-info) / 45%);
84
+ pointer-events: none;
85
+ }
86
+
87
+ .hk-serpentine--danger .hk-serpentine-handle {
88
+ background: rgb(var(--color-error));
89
+ box-shadow: 0 0 0 2px rgb(var(--color-error) / 45%);
90
+ }
91
+
92
+ // Mid-spring: the handle is visually "loose" (semi-transparent) — it is
93
+ // being driven by the snap-back, not by the user, and cannot be grabbed
94
+ // until it rests.
95
+ .hk-serpentine--snap .hk-serpentine-handle {
96
+ opacity: 0.55;
97
+ }
98
+
99
+ .hk-serpentine--confirmed .hk-serpentine-handle {
100
+ background: rgb(var(--color-success));
101
+ box-shadow: 0 0 0 2px rgb(var(--color-success) / 60%);
102
+ }
103
+
104
+ .hk-serpentine-hint {
105
+ position: absolute;
106
+ inset-inline: 0;
107
+ bottom: calc(-1 * var(--space-16, 16px) - 4px);
108
+ text-align: center;
109
+ font-size: var(--text-xs, 0.75rem);
110
+ color: rgb(var(--color-muted));
111
+ }
112
+
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
+ }