@celestia-island/hikari 0.55.399 → 0.55.400

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.399",
3
+ "version": "0.55.400",
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",
@@ -82,7 +82,7 @@
82
82
 
83
83
  .hk-notification-row {
84
84
  display: flex;
85
- gap: var(--space-10, 0.625rem);
85
+ gap: var(--space-12, 0.75rem);
86
86
  padding: var(--space-8, 0.5rem) var(--space-8, 0.5rem);
87
87
  border-bottom: 1px solid rgb(var(--color-border) / 6%);
88
88
 
@@ -141,6 +141,15 @@
141
141
  color: rgb(var(--color-text) / 92%);
142
142
  }
143
143
 
144
+ .hk-notification-row__title-state {
145
+ /* flex:none sibling of the clipping title: must never be eaten by
146
+ the title's own ellipsis (round-2 review, PR #1338). */
147
+ flex: none;
148
+ font-size: 0.6875rem;
149
+ font-weight: 400;
150
+ color: rgb(var(--color-muted, 108 108 108));
151
+ }
152
+
144
153
  .hk-notification-row__time {
145
154
  flex: none;
146
155
  font-size: 0.6875rem;
@@ -177,7 +186,11 @@
177
186
  flex: none;
178
187
  display: flex;
179
188
  align-items: center;
180
- align-self: flex-start;
189
+ /* Centered against the WHOLE row (2026-11-15 user ruling): other list
190
+ rows carry their trailing action vertically centered — an align-self
191
+ flex-start pinned the RotateCcw beside the timestamp line and read
192
+ as floating. */
193
+ align-self: center;
181
194
  gap: var(--space-4, 0.25rem);
182
195
  }
183
196
 
@@ -195,14 +208,4 @@
195
208
  --hi-icon-button-icon-color: rgb(var(--color-text) / 85%);
196
209
  }
197
210
 
198
- .hk-notification-row__meta {
199
- display: flex;
200
- align-items: center;
201
- gap: var(--space-8, 0.5rem);
202
- margin-top: 2px;
203
- }
204
211
 
205
- .hk-notification-row__state {
206
- font-size: 0.6875rem;
207
- color: rgb(var(--color-text) / 45%);
208
- }
@@ -132,7 +132,10 @@ describe("panel rows", () => {
132
132
  await settle();
133
133
  const row = rows()[0];
134
134
  expect(row.classList.contains("is-snoozed")).toBe(true);
135
- expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Hidden");
135
+ expect(row.querySelector(".hk-notification-row__title-state")?.textContent).toBe("· Hidden");
136
+ expect(row.querySelector(".hk-notification-row__title .hk-notification-row__title-state")).toBeNull();
137
+ // The standalone chip is gone (folded into the title, user ruling).
138
+ expect(row.querySelector(".hk-notification-row__state")).toBeFalsy();
136
139
  const restoreBtns = row.querySelectorAll<HTMLButtonElement>(".hk-notification-row__actions .hk-icon-button");
137
140
  const restore = restoreBtns[restoreBtns.length - 1];
138
141
  expect(restore, "restore button renders").toBeTruthy();
@@ -210,7 +213,7 @@ describe("panel rows", () => {
210
213
  bellButton().dispatchEvent(new MouseEvent("click", { bubbles: true }));
211
214
  await settle();
212
215
  const row = rows()[0];
213
- expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Resolved");
216
+ expect(row.querySelector(".hk-notification-row__title-state")?.textContent).toBe("· Resolved");
214
217
  expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
215
218
  // R10 (PR #1333): the state-scoped gate means a CLEARED emergency
216
219
  // row IS dismissable — this is the pin that was lost in eb492e44's
@@ -108,6 +108,20 @@ export default defineComponent({
108
108
  <span class="hk-notification-row__title" title={entry.title}>
109
109
  {entry.title}
110
110
  </span>
111
+ {/* The state word is a flex:none SIBLING of the clipping
112
+ title (round-2 review: inside the span, ellipsis ate it
113
+ first for exactly the long titles where it matters). */}
114
+ {(entry.state === "snoozed" || entry.state === "cleared") && (
115
+ <span class="hk-notification-row__title-state">
116
+ {"· "}
117
+ {t(
118
+ entry.state === "snoozed"
119
+ ? "hikari::notificationCenter.stateHidden"
120
+ : "hikari::notificationCenter.stateResolved",
121
+ entry.state === "snoozed" ? "Hidden" : "Resolved",
122
+ )}
123
+ </span>
124
+ )}
111
125
  <time
112
126
  class="hk-notification-row__time"
113
127
  datetime={new Date(entry.updatedAt).toISOString()}
@@ -121,20 +135,6 @@ export default defineComponent({
121
135
  {entry.detail && <span class="hk-notification-row__detail-text">{entry.detail}</span>}
122
136
  </p>
123
137
  )}
124
- {(entry.state === "snoozed" || entry.state === "cleared") && (
125
- <div class="hk-notification-row__meta">
126
- {entry.state === "snoozed" && (
127
- <span class="hk-notification-row__state">
128
- {t("hikari::notificationCenter.stateHidden", "Hidden")}
129
- </span>
130
- )}
131
- {entry.state === "cleared" && (
132
- <span class="hk-notification-row__state">
133
- {t("hikari::notificationCenter.stateResolved", "Resolved")}
134
- </span>
135
- )}
136
- </div>
137
- )}
138
138
  </div>
139
139
  <div class="hk-notification-row__actions">
140
140
  {/* Dismiss is gated OFF for live emergency episodes (round-6
@@ -256,14 +256,14 @@
256
256
  overflow: hidden;
257
257
  white-space: nowrap;
258
258
  text-overflow: ellipsis;
259
- // Same heading grammar as the select sheet title: semibold, slightly
260
- // letterspaced — one step up from the old 0.75rem so the sheet names
261
- // itself at body-text size, and window chrome never participates in
262
- // text selection.
263
- font-size: var(--text-base, 0.875rem);
264
- font-weight: 600;
265
- letter-spacing: 0.02em;
266
- color: rgb(var(--color-muted, 108 108 108));
259
+ // 2026-11-15 user ruling: a sheet IS a window — its title uses the
260
+ // SAME grammar as .hk-modal-title (bold primary at 1.125rem, no
261
+ // letterspacing). The old muted/semibold/0.875rem style was a
262
+ // special-cased framework the ruling retired ("不需要特立独行").
263
+ // Window chrome never participates in text selection.
264
+ font-size: var(--hk-modal-title-font-size, 1.125rem);
265
+ font-weight: var(--hk-modal-title-font-weight, 700);
266
+ color: var(--hk-modal-title-color, var(--hi-color-text-primary, #1e1e1e));
267
267
  @include user-select(none);
268
268
  }
269
269
 
@@ -414,15 +414,15 @@
414
414
  * roughly another --space-16 of leading padding inside, so the old
415
415
  * single --space-16 left the title hanging left of every row it
416
416
  * named instead of reading as the list's heading. Hosts tune it via
417
- * --hk-sheet-title-inset. Size/weight match the popover sheet heading
418
- * (--text-base, window chrome never text-selectable). The trailing
417
+ * --hk-sheet-title-inset. Size/weight/color follow the WINDOW title
418
+ * grammar (.hk-modal-title, 2026-11-15 ruling: a sheet is a window —
419
+ * no special-cased sheet-title framework anywhere). The trailing
419
420
  * inset doubles as the gap to the close button; the vertical rhythm
420
421
  * moved to the header row. */
421
422
  padding: 0 var(--space-16) 0 var(--hk-sheet-title-inset, calc(var(--space-16) * 2));
422
- font-size: var(--text-base);
423
- font-weight: 600;
424
- letter-spacing: 0.02em;
425
- color: rgb(var(--color-muted));
423
+ font-size: var(--hk-modal-title-font-size, 1.125rem);
424
+ font-weight: var(--hk-modal-title-font-weight, 700);
425
+ color: var(--hk-modal-title-color, var(--hi-color-text-primary, #1e1e1e));
426
426
  @include user-select(none);
427
427
  }
428
428
 
@@ -150,6 +150,69 @@ describe("installHkTooltipBridge", () => {
150
150
  expect(bridgePopup()?.classList.contains("hk-tooltip-visible")).toBe(false);
151
151
  });
152
152
 
153
+ it("never focus-engages after a touch pointer (per-modality strategy)", () => {
154
+ // 2026-11-15 field report: tapping a title-carrying button focused
155
+ // it, and the focus path — unmodality-gated — stuck the gray popup
156
+ // on screen with nothing on a touch page ever blurring it. The
157
+ // strategy split: touch taps own titles via the hint bar; the
158
+ // focus path engages only after a mouse/pen pointer.
159
+ vi.useFakeTimers();
160
+ install();
161
+ const el = trigger("Touch focused");
162
+ el.dispatchEvent(
163
+ new PointerEvent("pointerover", { pointerType: "touch", bubbles: true }),
164
+ );
165
+ el.dispatchEvent(
166
+ new PointerEvent("pointerdown", { pointerType: "touch", bubbles: true }),
167
+ );
168
+ el.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));
169
+ expect(el.hasAttribute("title")).toBe(true);
170
+ vi.advanceTimersByTime(1000);
171
+ expect(bridgePopup()?.classList.contains("hk-tooltip-visible")).toBe(false);
172
+ });
173
+
174
+ it("a touch pointerdown fully disconnects a stale mouse hold", () => {
175
+ vi.useFakeTimers();
176
+ install();
177
+ const el = trigger("Stale hold");
178
+ hover(el);
179
+ vi.advanceTimersByTime(400);
180
+ expect(el.hasAttribute("title")).toBe(false);
181
+ // Modality switch: the finger tap must RESTORE the title (the
182
+ // hide-only mouse path would leave the attribute stripped while the
183
+ // pointer rests — the touch hint bar reads title ?? data-hk-title,
184
+ // but view-source/AT expect the real attribute back).
185
+ el.dispatchEvent(
186
+ new PointerEvent("pointerdown", { pointerType: "touch", bubbles: true }),
187
+ );
188
+ expect(el.hasAttribute("title")).toBe(true);
189
+ expect(bridgePopup()?.classList.contains("hk-tooltip-visible")).toBe(false);
190
+ // The described-by relationship drops with the popup: a dangling
191
+ // aria-describedby to a hidden node would be announced by AT with
192
+ // no visible source (round-2 review, PR #1338).
193
+ expect(el.hasAttribute("aria-describedby")).toBe(false);
194
+ });
195
+
196
+ it("typing restores the keyboard modality after a finger tap (sticky-modality pin)", () => {
197
+ vi.useFakeTimers();
198
+ install();
199
+ const el = trigger("Hybrid keyboard");
200
+ el.dispatchEvent(
201
+ new PointerEvent("pointerover", { pointerType: "touch", bubbles: true }),
202
+ );
203
+ el.dispatchEvent(
204
+ new PointerEvent("pointerdown", { pointerType: "touch", bubbles: true }),
205
+ );
206
+ el.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));
207
+ expect(el.hasAttribute("title")).toBe(true);
208
+ el.dispatchEvent(new KeyboardEvent("keydown", { key: "Tab", bubbles: true }));
209
+ el.dispatchEvent(new FocusEvent("focusout", { bubbles: true }));
210
+ el.dispatchEvent(new FocusEvent("focusin", { bubbles: true }));
211
+ expect(el.hasAttribute("title")).toBe(false);
212
+ vi.advanceTimersByTime(400);
213
+ expect(bridgePopup()?.classList.contains("hk-tooltip-visible")).toBe(true);
214
+ });
215
+
153
216
  it("never engages a touch pointerover (the touch hint bar owns touch)", () => {
154
217
  vi.useFakeTimers();
155
218
  install();
@@ -13,7 +13,10 @@
13
13
  // → after the delay the shared `.hk-tooltip-popup` element is filled,
14
14
  // positioned (applyTooltipPosition: same placement/zoom math as
15
15
  // HkTooltip, plus the viewport-gutter clamp) and faded in
16
- // disengage (pointerout / focusout / scroll / resize / Esc); pointerdown
16
+ // disengage (pointerout / focusout / scroll / resize / Esc / a touch
17
+ // pointerdown anywhere — touch uses the per-modality strategy: the
18
+ // hint bar owns titles, so touch never hover- or focus-engages and
19
+ // any tap fully disconnects a stale hold); a mouse pointerdown
17
20
  // only hides the popup — the hold stays so no native tooltip flashes
18
21
  // → the popup fades out and the title attribute is RESTORED, so
19
22
  // view-source fidelity and non-pointer readers keep the original
@@ -68,6 +71,11 @@ export interface HkTooltipBridgeOptions {
68
71
  }
69
72
 
70
73
  interface BridgeState {
74
+ /** The pointer modality of the last pointer event (mouse/touch/pen).
75
+ * Touch never hover-engages and never focus-engages — the touch hint
76
+ * bar owns titles there (2026-11-15 user ruling: per-modality
77
+ * strategy). Empty until the first pointer event. */
78
+ lastPointerType: string;
71
79
  root: Document;
72
80
  popup: HTMLDivElement;
73
81
  content: HTMLDivElement;
@@ -253,6 +261,7 @@ export function installHkTooltipBridge(options: HkTooltipBridgeOptions = {}): ()
253
261
  overlayRoot.appendChild(popup);
254
262
 
255
263
  const state: BridgeState = {
264
+ lastPointerType: "",
256
265
  root: document,
257
266
  popup,
258
267
  content,
@@ -306,6 +315,7 @@ export function installHkTooltipBridge(options: HkTooltipBridgeOptions = {}): ()
306
315
  // anchored popup the touch mode never shows, and break the touch
307
316
  // bar's own title fallback. Pen keeps hover (stylus users hover).
308
317
  // Focus (focusin below) is untouched: keyboard a11y still engages.
318
+ state.lastPointerType = (e as PointerEvent).pointerType || "mouse";
309
319
  if ((e as PointerEvent).pointerType === "touch") return;
310
320
  const el = shouldEngage(state, e.target);
311
321
  if (el) engage(state, el);
@@ -325,11 +335,28 @@ export function installHkTooltipBridge(options: HkTooltipBridgeOptions = {}): ()
325
335
  }
326
336
  }, { capture: true, passive: true });
327
337
 
328
- on("pointerdown", () => {
338
+ on("pointerdown", (e) => {
339
+ const pointerType = (e as PointerEvent).pointerType || "mouse";
340
+ state.lastPointerType = pointerType;
341
+ if (pointerType === "touch") {
342
+ // A finger tap DISCONNECTS any hold (mouse keeps it — pressing
343
+ // with the tooltip up must not flash a native tooltip). On touch
344
+ // the popup can only be stale (focus/pointer paths are gated);
345
+ // restoring the title returns the element to the pre-engage state
346
+ // the touch hint bar reads from.
347
+ if (state.active) disengage(state);
348
+ return;
349
+ }
329
350
  if (state.active) hidePopup(state); // native also hides on press; stay engaged
330
351
  }, { capture: true, passive: true });
331
352
 
332
353
  on("focusin", (e) => {
354
+ // Touch taps focus buttons (Android), and nothing on a touch page
355
+ // ever blurs them — an unmodality-gated focus path stuck the gray
356
+ // tooltip on screen permanently (2026-11-15 field report). When the
357
+ // last pointer was a finger, the touch hint bar owns titles; the
358
+ // title attribute stays in place for AT announcement.
359
+ if (state.lastPointerType === "touch") return;
333
360
  const el = shouldEngage(state, e.target);
334
361
  if (el) engage(state, el);
335
362
  }, { capture: true });
@@ -363,6 +390,11 @@ export function installHkTooltipBridge(options: HkTooltipBridgeOptions = {}): ()
363
390
  }
364
391
 
365
392
  on("keydown", (e) => {
393
+ // Typing/tabs switch the modality back to keyboard: a hardware-
394
+ // keyboard user on a hybrid device must not lose focus tooltips
395
+ // because a finger touched the screen earlier (sticky-modality fix,
396
+ // round-2 review PR #1338).
397
+ state.lastPointerType = "keyboard";
366
398
  if ((e as KeyboardEvent).key === "Escape" && state.active) disengage(state);
367
399
  }, { capture: true });
368
400