@vincentbanana/banana-gui 0.7.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 +21 -10
- package/desktop/selftest.json +1 -1
- package/package.json +2 -2
- package/ui/app.js +422 -136
- package/ui/index.html +115 -95
- package/ui/style.css +841 -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,18 +193,18 @@ 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('.
|
|
186
|
-
|
|
187
|
-
|
|
196
|
+
customTitlebar: getComputedStyle(document.querySelector('.titlebar')).webkitAppRegion,
|
|
197
|
+
tabs: document.querySelectorAll('.tab').length,
|
|
198
|
+
review: Boolean(document.querySelector('#reviewPanel')),
|
|
188
199
|
}))()`);
|
|
189
|
-
//
|
|
200
|
+
// 打开 Review,确认输入框仍在视口内、没有被面板盖住
|
|
190
201
|
const layout = await win.webContents.executeJavaScript(`(async () => {
|
|
191
|
-
document.querySelector('#
|
|
202
|
+
document.querySelector('#reviewBtn')?.click();
|
|
192
203
|
await new Promise((resolve) => setTimeout(resolve, 360));
|
|
193
204
|
const composer = document.querySelector('.composer-wrap')?.getBoundingClientRect();
|
|
194
|
-
const
|
|
205
|
+
const review = document.querySelector('#reviewPanel');
|
|
195
206
|
return {
|
|
196
|
-
|
|
207
|
+
reviewOpen: Boolean(review && !review.hidden),
|
|
197
208
|
composerVisible: Boolean(composer && composer.bottom <= window.innerHeight + 1 && composer.height > 0),
|
|
198
209
|
};
|
|
199
210
|
})()`);
|
|
@@ -202,9 +213,9 @@ async function selfTest(url) {
|
|
|
202
213
|
probe.composed &&
|
|
203
214
|
probe.sidebar &&
|
|
204
215
|
probe.scriptLoaded &&
|
|
205
|
-
probe.
|
|
206
|
-
probe.
|
|
207
|
-
layout.
|
|
216
|
+
probe.tabs >= 1 &&
|
|
217
|
+
probe.review &&
|
|
218
|
+
layout.reviewOpen &&
|
|
208
219
|
layout.composerVisible;
|
|
209
220
|
report({ ok, url: url.replace(/\/t\/[a-f0-9]+\//, '/t/<token>/'), ...probe, ...layout });
|
|
210
221
|
child?.kill();
|
package/desktop/selftest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
SELFTEST {"ok":true,"url":"http://127.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": {
|