@co0ontty/wand 1.25.0 → 1.25.2
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.
|
@@ -54,6 +54,20 @@
|
|
|
54
54
|
['standalone', 'window-controls-overlay', 'fullscreen'].forEach(function(m) {
|
|
55
55
|
window.matchMedia('(display-mode: ' + m + ')').addEventListener('change', detectDisplayMode);
|
|
56
56
|
});
|
|
57
|
+
|
|
58
|
+
// Wand Android APK detection: the native shell appends "WandApp/<version>"
|
|
59
|
+
// to the WebView user-agent. On Android (targetSdk >= 35 forces edge-to-edge
|
|
60
|
+
// rendering) the WebView extends behind the status bar, but Android WebView
|
|
61
|
+
// doesn't propagate WindowInsets to env(safe-area-inset-*). Tagging the
|
|
62
|
+
// document root lets CSS apply a sane min top inset so top-pinned drawers
|
|
63
|
+
// and modals don't sit under the status bar. Newer APK builds also inject
|
|
64
|
+
// exact pixel values into --app-inset-top via the AndroidInsets bridge.
|
|
65
|
+
try {
|
|
66
|
+
var ua = (navigator && navigator.userAgent) || "";
|
|
67
|
+
if (/WandApp\//.test(ua)) {
|
|
68
|
+
document.documentElement.classList.add('is-wand-app');
|
|
69
|
+
}
|
|
70
|
+
} catch (e) {}
|
|
57
71
|
})();
|
|
58
72
|
|
|
59
73
|
(function() {
|
|
@@ -126,15 +126,49 @@
|
|
|
126
126
|
WebView、普通移动浏览器、桌面) 中都可用。在没有 inset 的设备上回退到
|
|
127
127
|
0px,所以不会影响桌面浏览体验。固定定位 (position: fixed) 的顶部元素
|
|
128
128
|
(如文件面板抽屉、各类预览/对话框) 必须自己消费这些 inset,因为它们脱离
|
|
129
|
-
了 .app-container 的 padding
|
|
129
|
+
了 .app-container 的 padding 流。
|
|
130
|
+
|
|
131
|
+
注: Android WebView (targetSdk >= 35 强制边到边渲染) 不会主动把
|
|
132
|
+
WindowInsets 暴露给 env(safe-area-inset-*), 所以纯 env() 在很多 Android
|
|
133
|
+
机器上会回落到 0 -> 顶部抽屉/模态直接撞到状态栏。我们用 var(--app-inset-top)
|
|
134
|
+
(由 Android 端通过 JS 注入实测像素值) 作为优先来源, 再 fallback 到 env(),
|
|
135
|
+
最后在窄视口下保证至少 28px 视觉缓冲。*/
|
|
130
136
|
:root {
|
|
131
|
-
--
|
|
132
|
-
--
|
|
133
|
-
--
|
|
134
|
-
--
|
|
135
|
-
--safe-
|
|
137
|
+
--app-inset-top: 0px; /* Android side injects actual status-bar height here */
|
|
138
|
+
--app-inset-bottom: 0px;
|
|
139
|
+
--app-inset-left: 0px;
|
|
140
|
+
--app-inset-right: 0px;
|
|
141
|
+
--wand-safe-top: max(var(--app-inset-top), env(safe-area-inset-top, 0px));
|
|
142
|
+
--wand-safe-bottom: max(var(--app-inset-bottom), env(safe-area-inset-bottom, 0px));
|
|
143
|
+
--wand-safe-left: max(var(--app-inset-left), env(safe-area-inset-left, 0px));
|
|
144
|
+
--wand-safe-right: max(var(--app-inset-right), env(safe-area-inset-right, 0px));
|
|
145
|
+
--safe-bottom: var(--wand-safe-bottom);
|
|
136
146
|
/* 默认与 wand-safe-top 等价; PWA / .is-pwa 下被覆盖为 max(inset, 14px) */
|
|
137
|
-
--pwa-safe-top:
|
|
147
|
+
--pwa-safe-top: var(--wand-safe-top);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Wand Android APK (UA 后缀 WandApp/*) 的兜底:
|
|
151
|
+
Android 自 targetSdk=35 起强制边到边, WebView 内容会绘制到状态栏底下,
|
|
152
|
+
但 Android WebView 不会主动把 WindowInsets 暴露给 env(safe-area-inset-*),
|
|
153
|
+
所以纯 env() 在绝大多数 Android 机器上回落到 0 -> 顶部直接撞到状态栏。
|
|
154
|
+
这里给旧版 Wand APK 兜一个 32px 最小值, 确保它们的顶部抽屉/模态不撞
|
|
155
|
+
状态栏。新版 APK 已经在原生层 setPadding 把 WebView 整体往里缩 (见
|
|
156
|
+
MainActivity.installWindowInsetsBridge) 并注入 .is-wand-app-native-insets
|
|
157
|
+
类来关掉这个兜底, 否则会双重 inset 浪费空间。*/
|
|
158
|
+
.is-wand-app {
|
|
159
|
+
--wand-safe-top: max(var(--app-inset-top), env(safe-area-inset-top, 0px), 32px);
|
|
160
|
+
--wand-safe-bottom: max(var(--app-inset-bottom), env(safe-area-inset-bottom, 0px), 0px);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* 新版 APK 原生已经 padding 过, 不需要 CSS 再加任何 safe-area。把所有
|
|
164
|
+
--wand-safe-* / --pwa-safe-top 全部归零, 让顶部抽屉 / 模态 / 顶栏直接顶
|
|
165
|
+
到 WebView 内容上沿 (= 状态栏下沿)。*/
|
|
166
|
+
.is-wand-app-native-insets {
|
|
167
|
+
--wand-safe-top: 0px;
|
|
168
|
+
--wand-safe-bottom: 0px;
|
|
169
|
+
--wand-safe-left: 0px;
|
|
170
|
+
--wand-safe-right: 0px;
|
|
171
|
+
--pwa-safe-top: 0px;
|
|
138
172
|
}
|
|
139
173
|
|
|
140
174
|
/* 在普通移动浏览器 / Android WebView 边到边渲染 / 旋转后地址栏隐藏等场景下,
|
|
@@ -10802,10 +10836,10 @@
|
|
|
10802
10836
|
.file-preview-modal {
|
|
10803
10837
|
width: 100vw;
|
|
10804
10838
|
max-width: 100vw;
|
|
10805
|
-
height
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
max-height: 100dvh;
|
|
10839
|
+
/* 键盘弹起时跟随 --app-viewport-height (= visualViewport.height) 收缩,
|
|
10840
|
+
否则 100dvh 不响应键盘, 编辑文本框会被键盘盖住。 */
|
|
10841
|
+
height: var(--app-viewport-height, 100dvh);
|
|
10842
|
+
max-height: var(--app-viewport-height, 100dvh);
|
|
10809
10843
|
border-radius: 0;
|
|
10810
10844
|
border: none;
|
|
10811
10845
|
box-shadow: none;
|