@michaelyagi/shoji 0.1.0-beta.7 → 0.1.0-beta.8

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.
@@ -149,6 +149,19 @@
149
149
  display: none;
150
150
  position: fixed;
151
151
  inset: 0;
152
+ /* DESIGN.md §2.6a's fifth real bug: inset:0 alone doesn't stay in sync
153
+ with a mobile browser's dynamic toolbar (URL bar) collapsing after
154
+ scroll on some real devices — window.innerHeight grows but the
155
+ painted box didn't follow, off-centering the photo. A JS-measured
156
+ visualViewport.height fix worked in emulation but made it *worse* on
157
+ real hardware (a stale snapshot read before the toolbar's collapse
158
+ had settled, then applied as an inline height that clobbered this
159
+ rule and left the dialog short of the real viewport, exposing page
160
+ content below it). 100dvh is browser-native and continuously live —
161
+ no JS snapshot to go stale — the correct fix for this whole bug
162
+ class. Unsupported browsers (all real targets support it) simply
163
+ keep the plain inset:0 behavior, no worse than before this fix. */
164
+ height: 100dvh;
152
165
  z-index: var(--shoji-z-base);
153
166
  }
154
167
 
@@ -1902,19 +1902,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1902
1902
  __publicField(this, "captureGestureStartState", () => {
1903
1903
  this.controlsHiddenAtGestureStart = this.autoHidden;
1904
1904
  });
1905
- /**
1906
- * A real mobile bug (DESIGN.md §2.6a): after scrolling far enough to
1907
- * collapse a mobile browser's own URL bar, `window.innerHeight` grows
1908
- * but `.shoji-outer`'s painted size didn't follow, off-centering the
1909
- * photo. `visualViewport.height` reflects the true visible area;
1910
- * `window`'s `resize` is the fallback where it's unsupported.
1911
- */
1912
- __publicField(this, "syncViewportHeight", () => {
1913
- var _a;
1914
- if (!this.dom) return;
1915
- const height = ((_a = window.visualViewport) == null ? void 0 : _a.height) ?? window.innerHeight;
1916
- this.dom.outer.style.height = `${height}px`;
1917
- });
1918
1905
  __publicField(this, "onKeydown", (event) => {
1919
1906
  if (document.activeElement instanceof HTMLVideoElement && event.key !== "Escape") return;
1920
1907
  this.onActivity();
@@ -2952,10 +2939,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2952
2939
  naturalSize && !((_a = this.itemList[index]) == null ? void 0 : _a.video) ? this.resolveOpenPlaceholderSrc(this.itemList[index], origin) : void 0
2953
2940
  );
2954
2941
  this.dom.outer.classList.add("shoji-open");
2955
- this.syncViewportHeight();
2956
- if (window.visualViewport)
2957
- window.visualViewport.addEventListener("resize", this.syncViewportHeight);
2958
- else window.addEventListener("resize", this.syncViewportHeight);
2959
2942
  document.addEventListener("keydown", this.onKeydown);
2960
2943
  this.focusTrap.activate(this.dom.dialog);
2961
2944
  this.scheduleAutoHide();
@@ -3180,12 +3163,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3180
3163
  this.opened = false;
3181
3164
  unlockBodyScroll();
3182
3165
  document.removeEventListener("keydown", this.onKeydown);
3183
- if (window.visualViewport)
3184
- window.visualViewport.removeEventListener("resize", this.syncViewportHeight);
3185
- else window.removeEventListener("resize", this.syncViewportHeight);
3186
3166
  this.focusTrap.deactivate();
3187
3167
  (_a = this.dom) == null ? void 0 : _a.outer.classList.remove("shoji-open");
3188
- if (this.dom) this.dom.outer.style.height = "";
3189
3168
  if (this.dom) this.dom.backdrop.style.opacity = "";
3190
3169
  if (this.autoHideTimer !== null) {
3191
3170
  clearTimeout(this.autoHideTimer);