@co0ontty/wand 1.25.0 → 1.25.1

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,37 @@
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
- --wand-safe-top: env(safe-area-inset-top, 0px);
132
- --wand-safe-bottom: env(safe-area-inset-bottom, 0px);
133
- --wand-safe-left: env(safe-area-inset-left, 0px);
134
- --wand-safe-right: env(safe-area-inset-right, 0px);
135
- --safe-bottom: env(safe-area-inset-bottom, 0px);
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: env(safe-area-inset-top, 0px);
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 最小值, 确保即使旧版 APK 还没装 inset 注入
155
+ 桥的时候, 顶部抽屉/模态也不会撞到状态栏。新版 APK 注入实际 inset 后,
156
+ max() 会自动取更精准的值。*/
157
+ .is-wand-app {
158
+ --wand-safe-top: max(var(--app-inset-top), env(safe-area-inset-top, 0px), 32px);
159
+ --wand-safe-bottom: max(var(--app-inset-bottom), env(safe-area-inset-bottom, 0px), 0px);
138
160
  }
139
161
 
140
162
  /* 在普通移动浏览器 / Android WebView 边到边渲染 / 旋转后地址栏隐藏等场景下,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@co0ontty/wand",
3
- "version": "1.25.0",
3
+ "version": "1.25.1",
4
4
  "description": "A web terminal for local CLI tools like Claude.",
5
5
  "type": "module",
6
6
  "bin": {