@celestia-island/hikari 0.55.397 → 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.397",
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}