@vincentbanana/banana-gui 0.6.0 → 0.8.0
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/desktop/main.cjs +35 -3
- package/desktop/selftest.json +1 -0
- package/package.json +2 -2
- package/ui/app.js +760 -295
- package/ui/index.html +144 -91
- package/ui/style.css +1245 -0
package/desktop/main.cjs
CHANGED
|
@@ -174,6 +174,17 @@ async function selfTest(url) {
|
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
176
|
try {
|
|
177
|
+
// 页面是异步启动的:等标签条或模型加载完成,避免在 boot 之前断言
|
|
178
|
+
await win.webContents.executeJavaScript(`new Promise((resolve) => {
|
|
179
|
+
let ticks = 0;
|
|
180
|
+
const timer = setInterval(() => {
|
|
181
|
+
ticks += 1;
|
|
182
|
+
if (document.querySelectorAll('.tab').length > 0 || ticks > 60) {
|
|
183
|
+
clearInterval(timer);
|
|
184
|
+
resolve(true);
|
|
185
|
+
}
|
|
186
|
+
}, 50);
|
|
187
|
+
})`);
|
|
177
188
|
const probe = await win.webContents.executeJavaScript(`(() => ({
|
|
178
189
|
title: document.title,
|
|
179
190
|
composed: Boolean(document.querySelector('#composer')),
|
|
@@ -182,10 +193,31 @@ async function selfTest(url) {
|
|
|
182
193
|
theme: getComputedStyle(document.documentElement).getPropertyValue('--bg').trim(),
|
|
183
194
|
frameless: Boolean(window.bananaDesktop?.frameless),
|
|
184
195
|
winControls: !document.querySelector('#winControls')?.hidden,
|
|
185
|
-
customTitlebar: getComputedStyle(document.querySelector('.
|
|
196
|
+
customTitlebar: getComputedStyle(document.querySelector('.titlebar')).webkitAppRegion,
|
|
197
|
+
tabs: document.querySelectorAll('.tab').length,
|
|
198
|
+
review: Boolean(document.querySelector('#reviewPanel')),
|
|
186
199
|
}))()`);
|
|
187
|
-
|
|
188
|
-
|
|
200
|
+
// 打开 Review,确认输入框仍在视口内、没有被面板盖住
|
|
201
|
+
const layout = await win.webContents.executeJavaScript(`(async () => {
|
|
202
|
+
document.querySelector('#reviewBtn')?.click();
|
|
203
|
+
await new Promise((resolve) => setTimeout(resolve, 360));
|
|
204
|
+
const composer = document.querySelector('.composer-wrap')?.getBoundingClientRect();
|
|
205
|
+
const review = document.querySelector('#reviewPanel');
|
|
206
|
+
return {
|
|
207
|
+
reviewOpen: Boolean(review && !review.hidden),
|
|
208
|
+
composerVisible: Boolean(composer && composer.bottom <= window.innerHeight + 1 && composer.height > 0),
|
|
209
|
+
};
|
|
210
|
+
})()`);
|
|
211
|
+
const ok =
|
|
212
|
+
probe.title === 'Banana' &&
|
|
213
|
+
probe.composed &&
|
|
214
|
+
probe.sidebar &&
|
|
215
|
+
probe.scriptLoaded &&
|
|
216
|
+
probe.tabs >= 1 &&
|
|
217
|
+
probe.review &&
|
|
218
|
+
layout.reviewOpen &&
|
|
219
|
+
layout.composerVisible;
|
|
220
|
+
report({ ok, url: url.replace(/\/t\/[a-f0-9]+\//, '/t/<token>/'), ...probe, ...layout });
|
|
189
221
|
child?.kill();
|
|
190
222
|
app.exit(ok ? 0 : 1);
|
|
191
223
|
} catch (error) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
SELFTEST {"ok":true,"url":"http://127.0.0.1:1229/t/<token>/","title":"Banana","composed":true,"sidebar":true,"scriptLoaded":true,"theme":"#ffffff","frameless":true,"winControls":true,"customTitlebar":"drag","tabs":1,"review":true,"reviewOpen":true,"composerVisible":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincentbanana/banana-gui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Banana 的图形界面:本地服务 + 浏览器。黑白主题,自绘图标,无第三方 UI 依赖",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"electron-builder": "^25.0.0"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@vincentbanana/bananacli": "^0.
|
|
74
|
+
"@vincentbanana/bananacli": "^0.6.0"
|
|
75
75
|
},
|
|
76
76
|
"license": "MIT",
|
|
77
77
|
"publishConfig": {
|