@celestia-island/hikari 0.55.396 → 0.55.398

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.396",
3
+ "version": "0.55.398",
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",
@@ -545,6 +545,48 @@
545
545
  // band tracks the real chrome instead of a static guess)
546
546
  // - rounded top corners only, full width
547
547
  // ------
548
+ /* JS-driven sheet dock (2026-11-15 field report — Via browser on an
549
+ * aging Android WebView: every HkModal skewed off-viewport-left while
550
+ * HkPopover's JS-class sheet rendered fine — the engine lags on the
551
+ * CSS media query and/or the individual `translate` property this
552
+ * file's centered frame relies on). HkModal now carries the SAME
553
+ * breakpoint signal HkPopover uses; when the app is mobile this class
554
+ * docks the sheet with ancient-CSS-only positioning (left/right/
555
+ * bottom/top:auto — no `translate` in the path), out-ranking the
556
+ * centered base (0,2,0 > 0,1,0). Modern engines: the class and the
557
+ * ≤767px media query below agree — same values, no conflict. */
558
+ .hk-modal-content.hk-is-sheet {
559
+ top: auto;
560
+ bottom: var(--hk-sheet-bottom-gap, 0px);
561
+ left: 0;
562
+ right: 0;
563
+ /* NO transform here on purpose: the mobile slide-from-bottom reveal
564
+ (enter-from translateY(100%)) lives at (0,1,0) inside the media
565
+ query — a class-level `transform: none` at (0,2,0) would out-rank
566
+ it and kill the slide on every phone (round-2 review, PR #1335,
567
+ computed-style-proven). HkPopover's own .hk-is-sheet rule carries
568
+ no transform either. */
569
+ translate: none;
570
+ max-width: 100% !important;
571
+ contain: layout style;
572
+ background: var(
573
+ --hk-modal-bg-mobile,
574
+ var(--hk-modal-bg, var(--hi-color-surface, rgba(255, 255, 255, 0.95)))
575
+ );
576
+ border-radius: var(--hk-modal-radius, var(--radius-xl, 16px))
577
+ var(--hk-modal-radius, var(--radius-xl, 16px))
578
+ 0 0;
579
+ border-left: 0;
580
+ border-right: 0;
581
+ border-bottom: 0;
582
+ max-height: calc(
583
+ 100vh - var(--hk-sheet-top-inset, 4.25rem) - var(--hk-sheet-bottom-gap, 0px)
584
+ ) !important;
585
+ max-height: calc(
586
+ 100dvh - var(--hk-sheet-top-inset, 4.25rem) - var(--hk-sheet-bottom-gap, 0px)
587
+ ) !important;
588
+ }
589
+
548
590
  @media (max-width: 767px) {
549
591
  // Docked sheets never re-filter their backdrop per frame: the sheet
550
592
  // is a fixed, full-width layer whose geometry changes with every
@@ -32,7 +32,13 @@ function ruleBody(sheet: string, selector: string): string {
32
32
 
33
33
  const sheet = compile(resolve(componentDir, "HkModal.scss"), {
34
34
  style: "expanded",
35
- }).css.replace(/\s+/g, " ");
35
+ }).css
36
+ // Strip comments BEFORE flattening: the sheet-dock rule sits behind a
37
+ // block comment in the compiled output, and its body carries an inline
38
+ // rationale — both would break the `}`-lookbehind selector match and
39
+ // poison the `not.toContain("transform")` negative.
40
+ .replace(/\/\*[\s\S]*?\*\//g, "")
41
+ .replace(/\s+/g, " ");
36
42
 
37
43
  describe("HkModal window material (compiled contract)", () => {
38
44
  it("positions the backdrop layer under the chrome and inside the frame's corners", () => {
@@ -80,3 +86,50 @@ describe("HkModal window material (compiled contract)", () => {
80
86
  expect(shared).not.toContain("content: none");
81
87
  });
82
88
  });
89
+
90
+
91
+ describe("HkModal JS-driven sheet dock (compiled contract)", () => {
92
+ // Round-2 guard for PR #1335 (Via-browser field report): the class-
93
+ // driven dock rule is the fix's whole payload, and Vitest stubs CSS —
94
+ // deleting the 26-line block left every runtime test green. These pins
95
+ // read the COMPILED sheet: deleting the block or any load-bearing
96
+ // declaration fails here.
97
+ const dock = ruleBody(sheet, ".hk-modal-content.hk-is-sheet");
98
+
99
+ it("the dock rule compiles exactly once with the positioning subset", () => {
100
+ expect(dock).toContain("top: auto");
101
+ expect(dock).toContain("bottom: var(--hk-sheet-bottom-gap, 0px)");
102
+ expect(dock).toContain("left: 0");
103
+ expect(dock).toContain("right: 0");
104
+ // The dock anchors by left/right/bottom — the centered base's
105
+ // translate must be neutralized or the sheet rides half its own
106
+ // size up-left.
107
+ expect(dock).toContain("translate: none");
108
+ expect(dock).toContain("max-width: 100% !important");
109
+ });
110
+
111
+ it("carries NO class-level transform (the slide reveal must survive)", () => {
112
+ // Round-2 S1: a class-level `transform: none` at (0,2,0) out-ranks
113
+ // the media query's enter-from translateY(100%) at (0,1,0) and kills
114
+ // the slide-from-bottom on every phone. The class rule must not
115
+ // mention transform at all.
116
+ expect(dock).not.toContain("transform");
117
+ });
118
+
119
+ it("the slide reveal the dock protects is itself pinned", () => {
120
+ // Round-3 symmetry guard, corrected in round 4: the translateY(100%)
121
+ // literal lives ONLY in the ≤767px enter-from block (desktop rides
122
+ // translateY(10px) scale(0.97)); the dock's transform-free rule
123
+ // exists so that mobile literal can slide the sheet up from the
124
+ // bottom edge. The deeper winner-level pin lives in
125
+ // HkModal.open-close-scale.test.ts; this whole-sheet containment is
126
+ // the cheap tripwire.
127
+ expect(sheet).toContain("transform: translateY(100%)");
128
+ });
129
+
130
+ it("keeps the mobile chrome subset (radius, borders, caps)", () => {
131
+ expect(dock).toContain("border-radius: var(--hk-modal-radius, var(--radius-xl, 16px))");
132
+ expect(dock).toContain("border-left: 0");
133
+ expect(dock).toContain("max-height: calc(100dvh");
134
+ });
135
+ });
@@ -14,6 +14,49 @@ afterEach(async () => {
14
14
  });
15
15
 
16
16
  describe("HkModal overlay integration", () => {
17
+ it("the JS breakpoint drives the sheet class (2026-11-15 Via-browser field report)", async () => {
18
+ // The CSS media query and the individual `translate` property both
19
+ // lagged on the reporting device's WebView — every HkModal skewed
20
+ // off-viewport-left while HkPopover's JS-class sheet rendered fine.
21
+ // The sheet branch now rides the SAME JS signal: isMobile →
22
+ // .hk-is-sheet, and the SCSS docks the frame by class alone.
23
+ const container = document.createElement("div");
24
+ document.body.appendChild(container);
25
+ containers.push(container);
26
+
27
+ const previousWidth = window.innerWidth;
28
+ const open = ref(true);
29
+ const Wrapper = defineComponent({
30
+ setup() {
31
+ return () =>
32
+ h(HkModal, { modelValue: open.value }, { default: () => h("div", "content") });
33
+ },
34
+ });
35
+ try {
36
+ // Mobile: the frame docks via the class.
37
+ (window as { innerWidth: number }).innerWidth = 500;
38
+ const app = createApp(Wrapper);
39
+ mounts.push(app);
40
+ app.mount(container);
41
+ await nextTick();
42
+ const sheetFrame = document.querySelector<HTMLElement>(".hk-modal-content");
43
+ expect(sheetFrame, "modal frame renders").toBeTruthy();
44
+ expect(sheetFrame!.classList.contains("hk-is-sheet")).toBe(true);
45
+
46
+ // Desktop: the centered frame comes back (class absent).
47
+ app.unmount();
48
+ (window as { innerWidth: number }).innerWidth = 1280;
49
+ const app2 = createApp(Wrapper);
50
+ mounts.push(app2);
51
+ app2.mount(container);
52
+ await nextTick();
53
+ const deskFrame = document.querySelector<HTMLElement>(".hk-modal-content");
54
+ expect(deskFrame!.classList.contains("hk-is-sheet")).toBe(false);
55
+ } finally {
56
+ (window as { innerWidth: number }).innerWidth = previousWidth;
57
+ }
58
+ });
59
+
17
60
  it("closeAll() closes an open closable modal through its update:modelValue", async () => {
18
61
  const container = document.createElement("div");
19
62
  document.body.appendChild(container);
@@ -32,6 +32,7 @@ import HIconButton from "./HkIconButton";
32
32
  import HIcon from "./HkIcon";
33
33
  import "./window-close.scss";
34
34
  import { ensureOverlayRoot } from "../overlay/overlayRoot";
35
+ import { useBreakpoint } from "../runtime/useBreakpoint";
35
36
 
36
37
  export interface ModalAction {
37
38
  label: string;
@@ -196,6 +197,14 @@ export default defineComponent({
196
197
  setup(props, { emit, slots }) {
197
198
  const { t } = useI18n();
198
199
  const manager = usePopupManager();
200
+ // JS-driven sheet branch (2026-11-15 field report — Via browser:
201
+ // every HkModal skewed off-viewport-left while HkPopover's
202
+ // JS-class sheet rendered fine; the device's WebView lags on the
203
+ // CSS media query / individual `translate` path). The class rides
204
+ // the SAME breakpoint signal the rest of the app uses, so when the
205
+ // app is mobile the modal docks as a sheet regardless of engine
206
+ // CSS support. Modern engines: class and media query agree.
207
+ const { isMobile: sheetMobile } = useBreakpoint();
199
208
  // Open/close motion reported into the unified animation context
200
209
  // (animationBus) — one track for the whole surface, armed on the
201
210
  // machine's animation-phase edges.
@@ -1098,7 +1107,7 @@ export default defineComponent({
1098
1107
  />
1099
1108
  <div
1100
1109
  ref={contentRef}
1101
- class={["hk-modal-content", props.contentClass, ...machine.classesFor("hk-modal-content")]}
1110
+ class={["hk-modal-content", ...(sheetMobile.value ? ["hk-is-sheet"] : []), props.contentClass, ...machine.classesFor("hk-modal-content")]}
1102
1111
  role="dialog"
1103
1112
  aria-modal="true"
1104
1113
  aria-label={resolvedSurfaceName.value}
@@ -78,26 +78,11 @@
78
78
  margin-top: var(--space-8, 0.5rem);
79
79
  }
80
80
 
81
- .hk-notification-center__clear {
82
- appearance: none;
83
- background: none;
84
- border: none;
85
- padding: 0 var(--space-4, 0.25rem);
86
- color: rgb(var(--color-text) / 55%);
87
- font-size: 0.75rem;
88
- cursor: pointer;
89
-
90
- &:hover {
91
- color: rgb(var(--color-text) / 85%);
92
- text-decoration: underline;
93
- }
94
- }
95
-
96
81
  /* ── rows ─────────────────────────────────────────────────────────── */
97
82
 
98
83
  .hk-notification-row {
99
84
  display: flex;
100
- gap: var(--space-8, 0.5rem);
85
+ gap: var(--space-10, 0.625rem);
101
86
  padding: var(--space-8, 0.5rem) var(--space-8, 0.5rem);
102
87
  border-bottom: 1px solid rgb(var(--color-border) / 6%);
103
88
 
@@ -193,6 +178,7 @@
193
178
  display: flex;
194
179
  align-items: center;
195
180
  align-self: flex-start;
181
+ gap: var(--space-4, 0.25rem);
196
182
  }
197
183
 
198
184
  /* Ink for the per-row dismiss glyph (round-3 review, PR #1333 — proven
@@ -220,15 +206,3 @@
220
206
  font-size: 0.6875rem;
221
207
  color: rgb(var(--color-text) / 45%);
222
208
  }
223
-
224
- .hk-notification-row__restore {
225
- appearance: none;
226
- background: none;
227
- border: none;
228
- padding: 0;
229
- font-size: 0.75rem;
230
- color: rgb(var(--color-primary, var(--color-text)) / 90%);
231
- cursor: pointer;
232
- text-decoration: underline;
233
- text-underline-offset: 2px;
234
- }
@@ -133,14 +133,16 @@ describe("panel rows", () => {
133
133
  const row = rows()[0];
134
134
  expect(row.classList.contains("is-snoozed")).toBe(true);
135
135
  expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Hidden");
136
- const restore = row.querySelector<HTMLButtonElement>(".hk-notification-row__restore");
137
- expect(restore?.textContent).toBe("Show again");
136
+ const restoreBtns = row.querySelectorAll<HTMLButtonElement>(".hk-notification-row__actions .hk-icon-button");
137
+ const restore = restoreBtns[restoreBtns.length - 1];
138
+ expect(restore, "restore button renders").toBeTruthy();
139
+ expect(restore!.getAttribute("aria-label")).toContain("Show again");
138
140
  restore!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
139
141
  await settle();
140
142
  // The band is live again and the record follows — and the restore
141
143
  // button is GONE (R2 finding: no dead control on an active band).
142
144
  expect(row.classList.contains("is-active")).toBe(true);
143
- expect(row.querySelector(".hk-notification-row__restore")).toBeFalsy();
145
+ expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
144
146
  });
145
147
 
146
148
  it("an ACTIVE emergency row (band on screen) shows no restore button", async () => {
@@ -152,7 +154,7 @@ describe("panel rows", () => {
152
154
  await settle();
153
155
  const row = rows()[0];
154
156
  expect(row.classList.contains("is-active")).toBe(true);
155
- expect(row.querySelector(".hk-notification-row__restore")).toBeFalsy();
157
+ expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
156
158
  expect(row.querySelector(".hk-notification-row__state")).toBeFalsy();
157
159
  });
158
160
 
@@ -166,7 +168,7 @@ describe("panel rows", () => {
166
168
  await settle();
167
169
  expect(rows()).toHaveLength(1);
168
170
  expect(
169
- rows()[0].querySelector(".hk-notification-row__actions .hk-icon-button"),
171
+ rows()[0].querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Dismiss"]'),
170
172
  "the emergency row must not carry the dismiss control",
171
173
  ).toBeNull();
172
174
  });
@@ -209,7 +211,7 @@ describe("panel rows", () => {
209
211
  await settle();
210
212
  const row = rows()[0];
211
213
  expect(row.querySelector(".hk-notification-row__state")?.textContent).toBe("Resolved");
212
- expect(row.querySelector(".hk-notification-row__restore")).toBeFalsy();
214
+ expect(row.querySelector('.hk-notification-row__actions .hk-icon-button[aria-label="Show again"]')).toBeFalsy();
213
215
  // R10 (PR #1333): the state-scoped gate means a CLEARED emergency
214
216
  // row IS dismissable — this is the pin that was lost in eb492e44's
215
217
  // wrong-sibling deletion.
@@ -255,7 +257,7 @@ describe("panel rows", () => {
255
257
  const titles = rows().map((r) => r.querySelector(".hk-notification-row__title")?.textContent);
256
258
  expect(titles).toEqual(["newer", "older"]);
257
259
 
258
- (document.querySelector<HTMLButtonElement>(".hk-notification-center__clear")!).dispatchEvent(
260
+ (document.querySelector<HTMLButtonElement>(".hk-notification-center__foot .hk-btn")!).dispatchEvent(
259
261
  new MouseEvent("click", { bubbles: true }),
260
262
  );
261
263
  await settle();
@@ -27,7 +27,7 @@
27
27
  * itself — an empty notification center still shows its (disabled-
28
28
  * looking) trigger so the host chrome never reflows on first use.
29
29
  */
30
- import { CircleCheck as CheckCircle, Info, LoaderCircle, TriangleAlert as AlertTriangle, X } from "lucide-vue-next";
30
+ import { CircleCheck as CheckCircle, Info, LoaderCircle, RotateCcw, TriangleAlert as AlertTriangle, X } from "lucide-vue-next";
31
31
  import { computed, defineComponent, h, ref, watch, type Component } from "vue";
32
32
 
33
33
  import { useChromeActionSize } from "../composables/useChromeActionSize";
@@ -37,7 +37,8 @@ import {
37
37
  type HkNotificationEntry,
38
38
  type HkNotificationTone,
39
39
  } from "../runtime/notificationCenter";
40
- import HIconButton from "./HkIconButton";
40
+ import HkIconButton from "./HkIconButton";
41
+ import HkButton from "./HkButton";
41
42
  import HkPopover from "./HkPopover";
42
43
  import "./HkNotificationBell.scss";
43
44
 
@@ -91,18 +92,15 @@ export default defineComponent({
91
92
 
92
93
  function renderRow(entry: HkNotificationEntry) {
93
94
  const Icon = TONE_ICONS[entry.tone] ?? Info;
94
- // A restore button exists ONLY for a SNOOZED entry with a live
95
- // path (R2 finding, PR #1322): the callback may briefly survive
96
- // a restore (the source re-arms/clears it), but an on-screen
97
- // band is not something "Show again" can bring back — the state
98
- // gate keeps a dead control off the row.
95
+ const isLive = entry.kind === "emergency" && entry.state !== "cleared";
99
96
  const resummonable = entry.onResummon !== undefined && entry.state === "snoozed";
100
97
  return (
101
98
  <li key={entry.id} class={["hk-notification-row", `is-${entry.tone}`, `is-${entry.state}`]}>
99
+ {/* The row glyph renders through h(Icon, …): Vue's Component
100
+ union is not a valid JSX element type, so `<Icon />` is
101
+ not available here — both this tone glyph and the row
102
+ actions' RotateCcw go through the render function. */}
102
103
  <span class="hk-notification-row__icon" aria-hidden="true">
103
- {/* Render via h(): Vue's `Component` union includes non-callable
104
- option types, so `<Icon />` is not a valid JSX element type
105
- (the HkNavSidebar convention). */}
106
104
  {h(Icon, { size: 14 })}
107
105
  </span>
108
106
  <div class="hk-notification-row__body">
@@ -135,38 +133,34 @@ export default defineComponent({
135
133
  {t("hikari::notificationCenter.stateResolved", "Resolved")}
136
134
  </span>
137
135
  )}
138
- {resummonable && (
139
- <button
140
- type="button"
141
- class="hk-notification-row__restore"
142
- onClick={() => entry.onResummon?.()}
143
- >
144
- {t("hikari::emergencyAlert.restore", "Show again")}
145
- </button>
146
- )}
147
136
  </div>
148
137
  )}
149
138
  </div>
150
- {/* The unified per-row dismiss (user ruling 2026-11-15) applies
151
- to RECORDS — but never to a LIVE emergency episode: a
152
- snoozed alert's entry carries the app's ONLY restore handle
153
- (onResummon), and forgetting it would strand the alert with
154
- no recall path while the polled episode self-reverts the
155
- row (round-6 review, PR #1333). Cleared rows are records
156
- again and stay dismissable. */}
157
- {(entry.kind !== "emergency" ||
158
- entry.state === "cleared") && (
159
- <div class="hk-notification-row__actions">
160
- <HIconButton
139
+ <div class="hk-notification-row__actions">
140
+ {/* Dismiss is gated OFF for live emergency episodes (round-6
141
+ S1: a snoozed alert's entry carries the ONLY restore
142
+ handle). Restore is gated ON only for snoozed entries. */}
143
+ {!isLive && (
144
+ <HkIconButton
161
145
  size={24}
162
146
  variant="ghost"
163
147
  aria-label={t("hikari::notificationCenter.dismiss", "Dismiss")}
164
148
  onClick={() => forget(entry.id)}
165
149
  >
166
150
  {{ icon: () => <X size={14} /> }}
167
- </HIconButton>
168
- </div>
169
- )}
151
+ </HkIconButton>
152
+ )}
153
+ {resummonable && (
154
+ <HkIconButton
155
+ size={24}
156
+ variant="ghost"
157
+ aria-label={t("hikari::emergencyAlert.restore", "Show again")}
158
+ onClick={() => entry.onResummon?.()}
159
+ >
160
+ {{ icon: () => h(RotateCcw, { size: 14 }) }}
161
+ </HkIconButton>
162
+ )}
163
+ </div>
170
164
  </li>
171
165
  );
172
166
  }
@@ -175,7 +169,7 @@ export default defineComponent({
175
169
  const label = t("hikari::notificationCenter.title", "Notifications");
176
170
  return (
177
171
  <span ref={anchorRef} class="hk-notification-bell">
178
- <HIconButton
172
+ <HkIconButton
179
173
  icon="bell"
180
174
  size={chromeSize.value}
181
175
  variant="ghost"
@@ -213,13 +207,13 @@ export default defineComponent({
213
207
  {sorted.value.map(renderRow)}
214
208
  </ul>
215
209
  <div class="hk-notification-center__foot">
216
- <button
217
- type="button"
218
- class="hk-notification-center__clear"
210
+ <HkButton
211
+ variant="ghost"
212
+ size="sm"
219
213
  onClick={() => reset()}
220
214
  >
221
215
  {t("hikari::notificationCenter.clearAll", "Clear all")}
222
- </button>
216
+ </HkButton>
223
217
  </div>
224
218
  </>
225
219
  )}