@vincentbanana/banana-gui 1.0.12 → 1.0.14
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/package.json +2 -2
- package/ui/app.js +97 -1
- package/ui/index.html +5 -1
- package/ui/style.css +92 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincentbanana/banana-gui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "Banana 鐨勫浘褰㈢晫闈細鏈湴鏈嶅姟 + 娴忚鍣ㄣ€傞粦鐧戒富棰橈紝鑷粯鍥炬爣锛屾棤绗笁鏂?UI 渚濊禆",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"electron-builder": "^25.0.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@vincentbanana/bananacli": "^0.8.
|
|
75
|
+
"@vincentbanana/bananacli": "^0.8.14"
|
|
76
76
|
},
|
|
77
77
|
"license": "MIT",
|
|
78
78
|
"publishConfig": {
|
package/ui/app.js
CHANGED
|
@@ -555,6 +555,57 @@ function prefersReducedMotion() {
|
|
|
555
555
|
);
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
+
// ---------------- 灵动动效 ----------------
|
|
559
|
+
const MOTION_KEY = 'banana.motion';
|
|
560
|
+
const MOTION_LEVEL_KEY = 'banana.motion.level';
|
|
561
|
+
const MOTION_LEVELS = ['subtle', 'natural', 'playful'];
|
|
562
|
+
|
|
563
|
+
function motionOn() {
|
|
564
|
+
try {
|
|
565
|
+
return localStorage.getItem(MOTION_KEY) === '1';
|
|
566
|
+
} catch {
|
|
567
|
+
return false;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function motionLevel() {
|
|
572
|
+
try {
|
|
573
|
+
const value = localStorage.getItem(MOTION_LEVEL_KEY);
|
|
574
|
+
return MOTION_LEVELS.includes(value) ? value : 'natural';
|
|
575
|
+
} catch {
|
|
576
|
+
return 'natural';
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function motionEffective() {
|
|
581
|
+
return motionOn() && !prefersReducedMotion();
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function applyMotion() {
|
|
585
|
+
const root = document.documentElement;
|
|
586
|
+
root.dataset.motion = motionEffective() ? '1' : '0';
|
|
587
|
+
root.dataset.motionLevel = motionLevel();
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function setMotion(on) {
|
|
591
|
+
try {
|
|
592
|
+
localStorage.setItem(MOTION_KEY, on ? '1' : '0');
|
|
593
|
+
} catch {}
|
|
594
|
+
applyMotion();
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function setMotionLevel(level) {
|
|
598
|
+
try {
|
|
599
|
+
localStorage.setItem(MOTION_LEVEL_KEY, MOTION_LEVELS.includes(level) ? level : 'natural');
|
|
600
|
+
} catch {}
|
|
601
|
+
applyMotion();
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function motionScrollFactor() {
|
|
605
|
+
if (!motionEffective()) return 0.12;
|
|
606
|
+
return { subtle: 0.15, natural: 0.11, playful: 0.085 }[motionLevel()];
|
|
607
|
+
}
|
|
608
|
+
|
|
558
609
|
function stopCamera() {
|
|
559
610
|
camera.running = false;
|
|
560
611
|
if (camera.raf) cancelAnimationFrame(camera.raf);
|
|
@@ -581,7 +632,7 @@ function cameraTick() {
|
|
|
581
632
|
stopCamera();
|
|
582
633
|
return;
|
|
583
634
|
}
|
|
584
|
-
const step = Math.min(64, Math.max(1, distance *
|
|
635
|
+
const step = Math.min(64, Math.max(1, distance * motionScrollFactor()));
|
|
585
636
|
THREAD.scrollTop = current + step;
|
|
586
637
|
camera.lastTop = THREAD.scrollTop;
|
|
587
638
|
camera.programmaticAt = Date.now();
|
|
@@ -1789,6 +1840,13 @@ function renderTodos() {
|
|
|
1789
1840
|
$('todoSummary').setAttribute('aria-expanded', String(state.todoOpen));
|
|
1790
1841
|
$('todoCount').textContent = `${done}/${todos.length}`;
|
|
1791
1842
|
$('todoBarFill').style.width = todos.length ? `${Math.round((done / todos.length) * 100)}%` : '0%';
|
|
1843
|
+
const chip = $('taskBtn');
|
|
1844
|
+
if (chip) {
|
|
1845
|
+
chip.hidden = todos.length === 0;
|
|
1846
|
+
chip.title = `${t('todo.title')} ${done}/${todos.length}`;
|
|
1847
|
+
$('taskChipText').textContent = `${t('todo.title')} ${done}/${todos.length}`;
|
|
1848
|
+
$('taskChipFill').style.width = todos.length ? `${Math.round((done / todos.length) * 100)}%` : '0%';
|
|
1849
|
+
}
|
|
1792
1850
|
const list = $('todoList');
|
|
1793
1851
|
list.innerHTML = '';
|
|
1794
1852
|
todos.forEach((item) => {
|
|
@@ -3537,6 +3595,38 @@ function renderAppearanceSettings(body) {
|
|
|
3537
3595
|
);
|
|
3538
3596
|
section.appendChild(card);
|
|
3539
3597
|
|
|
3598
|
+
const lively = settingsCard();
|
|
3599
|
+
lively.appendChild(
|
|
3600
|
+
settingsRow(
|
|
3601
|
+
'灵动动效',
|
|
3602
|
+
'测试功能:消息、按钮和面板带自然弹力与阻尼;终端与代码区不受影响。',
|
|
3603
|
+
settingsSwitch(motionOn(), (on) => {
|
|
3604
|
+
setMotion(on);
|
|
3605
|
+
renderSettings();
|
|
3606
|
+
toast(on ? '灵动动效已开启' : '灵动动效已关闭');
|
|
3607
|
+
}),
|
|
3608
|
+
),
|
|
3609
|
+
);
|
|
3610
|
+
lively.appendChild(
|
|
3611
|
+
settingsRow(
|
|
3612
|
+
'动效强度',
|
|
3613
|
+
'阻尼越大越收得住;大面板不会来回晃。',
|
|
3614
|
+
settingsSeg(
|
|
3615
|
+
[
|
|
3616
|
+
{ value: 'subtle', label: '克制' },
|
|
3617
|
+
{ value: 'natural', label: '自然' },
|
|
3618
|
+
{ value: 'playful', label: '明显' },
|
|
3619
|
+
],
|
|
3620
|
+
motionLevel(),
|
|
3621
|
+
(value) => {
|
|
3622
|
+
setMotionLevel(value);
|
|
3623
|
+
toast('动效强度:' + (value === 'subtle' ? '克制' : value === 'playful' ? '明显' : '自然'));
|
|
3624
|
+
},
|
|
3625
|
+
),
|
|
3626
|
+
),
|
|
3627
|
+
);
|
|
3628
|
+
section.appendChild(lively);
|
|
3629
|
+
|
|
3540
3630
|
const motion = settingsCard();
|
|
3541
3631
|
motion.appendChild(
|
|
3542
3632
|
settingsRow('减少动效', '关闭大部分弹簧和入场动画,适合晕动或低性能设备。', settingsSwitch(
|
|
@@ -3545,6 +3635,7 @@ function renderAppearanceSettings(body) {
|
|
|
3545
3635
|
if (on) document.documentElement.dataset.reduceMotion = '1';
|
|
3546
3636
|
else delete document.documentElement.dataset.reduceMotion;
|
|
3547
3637
|
localStorage.setItem('banana.reduceMotion', on ? '1' : '0');
|
|
3638
|
+
applyMotion();
|
|
3548
3639
|
toast(on ? '已减少动效' : '已恢复弹力动画');
|
|
3549
3640
|
},
|
|
3550
3641
|
)),
|
|
@@ -5270,6 +5361,10 @@ function bind() {
|
|
|
5270
5361
|
if (state.review.mode === 'changes') void loadChanges(true);
|
|
5271
5362
|
}
|
|
5272
5363
|
});
|
|
5364
|
+
$('taskBtn').addEventListener('click', () => {
|
|
5365
|
+
if (state.review.open && state.review.mode === 'tasks') closeReview();
|
|
5366
|
+
else openReview('tasks');
|
|
5367
|
+
});
|
|
5273
5368
|
$('searchBtn').addEventListener('click', openCommandCenter);
|
|
5274
5369
|
$('openSettingsFoot').addEventListener('click', () => openSettings());
|
|
5275
5370
|
$('newTab').addEventListener('click', () => $('newChat').click());
|
|
@@ -5573,6 +5668,7 @@ async function maybePromptProjectTrust() {
|
|
|
5573
5668
|
async function boot() {
|
|
5574
5669
|
bind();
|
|
5575
5670
|
applyLanguage();
|
|
5671
|
+
applyMotion();
|
|
5576
5672
|
// 命令表来自服务端(与 CLI 同一份),拉不到也不影响对话
|
|
5577
5673
|
try {
|
|
5578
5674
|
const all = (await get('commands')).commands ?? [];
|
package/ui/index.html
CHANGED
|
@@ -74,7 +74,11 @@
|
|
|
74
74
|
<div class="chat-actions">
|
|
75
75
|
<span class="mode-badge" id="modeBadge" hidden>Plan</span>
|
|
76
76
|
<button class="icon-btn" id="filesBtn" title="工作区文件" aria-label="工作区文件"></button>
|
|
77
|
-
<button class="
|
|
77
|
+
<button class="chip-btn task-chip" id="taskBtn" hidden title="任务" aria-label="任务">
|
|
78
|
+
<span id="taskChipText"></span>
|
|
79
|
+
<span class="task-chip-bar"><i id="taskChipFill"></i></span>
|
|
80
|
+
</button>
|
|
81
|
+
<button class="icon-btn" id="reviewBtn" title="查看改动 / 文件 / 任务(Review)" aria-label="查看 Review"></button>
|
|
78
82
|
</div>
|
|
79
83
|
</header>
|
|
80
84
|
|
package/ui/style.css
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
--shadow-sm: 0 1px 2px rgba(16, 16, 20, 0.05);
|
|
50
50
|
--shadow-1: var(--shadow-sm);
|
|
51
|
-
--shadow-overlay: 0
|
|
51
|
+
--shadow-overlay: 0 8px 24px rgba(16, 16, 20, 0.10);
|
|
52
52
|
--shadow-lg: var(--shadow-overlay);
|
|
53
53
|
--shadow-raised: var(--shadow-sm);
|
|
54
54
|
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
--info: #82bdbd;
|
|
97
97
|
--on-danger: #ffffff;
|
|
98
98
|
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
|
|
99
|
-
--shadow-overlay: 0
|
|
99
|
+
--shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.40);
|
|
100
100
|
--shadow-lg: var(--shadow-overlay);
|
|
101
101
|
--shadow-raised: var(--shadow-sm);
|
|
102
102
|
}
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
--info: #82bdbd;
|
|
130
130
|
--on-danger: #ffffff;
|
|
131
131
|
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
|
|
132
|
-
--shadow-overlay: 0
|
|
132
|
+
--shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.40);
|
|
133
133
|
--shadow-lg: var(--shadow-overlay);
|
|
134
134
|
--shadow-raised: var(--shadow-sm);
|
|
135
135
|
}
|
|
@@ -4301,6 +4301,95 @@ input:focus-visible, textarea:focus-visible { outline: none; }
|
|
|
4301
4301
|
.sb-search { border-radius: 8px; }
|
|
4302
4302
|
.sidebar-foot { padding: 10px; gap: 8px; }
|
|
4303
4303
|
|
|
4304
|
+
/* 任务入口:顶部一枚进度胶囊,点击打开右侧任务面板 */
|
|
4305
|
+
.todo-dock { display: none; }
|
|
4306
|
+
.task-chip {
|
|
4307
|
+
height: 26px;
|
|
4308
|
+
padding: 0 9px;
|
|
4309
|
+
gap: 7px;
|
|
4310
|
+
font-size: 11.5px;
|
|
4311
|
+
font-variant-numeric: tabular-nums;
|
|
4312
|
+
}
|
|
4313
|
+
.task-chip[hidden] { display: none; }
|
|
4314
|
+
.task-chip-bar {
|
|
4315
|
+
width: 40px;
|
|
4316
|
+
height: 3px;
|
|
4317
|
+
border-radius: 99px;
|
|
4318
|
+
background: var(--line);
|
|
4319
|
+
overflow: hidden;
|
|
4320
|
+
}
|
|
4321
|
+
.task-chip-bar i {
|
|
4322
|
+
display: block;
|
|
4323
|
+
width: 0;
|
|
4324
|
+
height: 100%;
|
|
4325
|
+
background: var(--accent-ink);
|
|
4326
|
+
transition: width 200ms var(--ease);
|
|
4327
|
+
}
|
|
4328
|
+
|
|
4329
|
+
/* ---------- 灵动动效(测试功能,默认关闭) ---------- */
|
|
4330
|
+
:root[data-motion='1'] {
|
|
4331
|
+
--motion-dur: 240ms;
|
|
4332
|
+
--motion-dur-slow: 320ms;
|
|
4333
|
+
--motion-spring: cubic-bezier(0.22, 1.16, 0.36, 1);
|
|
4334
|
+
--motion-shift: 7px;
|
|
4335
|
+
--motion-press: 0.96;
|
|
4336
|
+
}
|
|
4337
|
+
:root[data-motion='1'][data-motion-level='subtle'] {
|
|
4338
|
+
--motion-dur: 180ms;
|
|
4339
|
+
--motion-dur-slow: 250ms;
|
|
4340
|
+
--motion-spring: cubic-bezier(0.28, 1.04, 0.5, 1);
|
|
4341
|
+
--motion-shift: 4px;
|
|
4342
|
+
--motion-press: 0.975;
|
|
4343
|
+
}
|
|
4344
|
+
:root[data-motion='1'][data-motion-level='playful'] {
|
|
4345
|
+
--motion-dur: 300ms;
|
|
4346
|
+
--motion-dur-slow: 380ms;
|
|
4347
|
+
--motion-spring: cubic-bezier(0.2, 1.4, 0.34, 1);
|
|
4348
|
+
--motion-shift: 10px;
|
|
4349
|
+
--motion-press: 0.94;
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4352
|
+
@keyframes motionIn {
|
|
4353
|
+
from { opacity: 0; transform: translateY(var(--motion-shift, 6px)) scale(0.996); }
|
|
4354
|
+
to { opacity: 1; transform: none; }
|
|
4355
|
+
}
|
|
4356
|
+
|
|
4357
|
+
:root[data-motion='1'] .msg.enter,
|
|
4358
|
+
:root[data-motion='1'] .plan-card {
|
|
4359
|
+
animation: motionIn var(--motion-dur-slow) var(--motion-spring) both;
|
|
4360
|
+
}
|
|
4361
|
+
|
|
4362
|
+
:root[data-motion='1'] .btn:active,
|
|
4363
|
+
:root[data-motion='1'] .icon-btn:active,
|
|
4364
|
+
:root[data-motion='1'] .chip-btn:active,
|
|
4365
|
+
:root[data-motion='1'] .send-btn:not(:disabled):active,
|
|
4366
|
+
:root[data-motion='1'] .session-item:active {
|
|
4367
|
+
transform: scale(var(--motion-press));
|
|
4368
|
+
transition-duration: 90ms;
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4371
|
+
:root[data-motion='1'] .review.is-opening {
|
|
4372
|
+
animation: reviewIn var(--motion-dur) var(--motion-spring) both;
|
|
4373
|
+
}
|
|
4374
|
+
:root[data-motion='1'] .model-pop,
|
|
4375
|
+
:root[data-motion='1'] .reasoning-pop {
|
|
4376
|
+
animation: pop var(--motion-dur) var(--motion-spring) both;
|
|
4377
|
+
}
|
|
4378
|
+
:root[data-motion='1'] .sidebar {
|
|
4379
|
+
transition-timing-function: var(--motion-spring);
|
|
4380
|
+
transition-duration: var(--motion-dur);
|
|
4381
|
+
}
|
|
4382
|
+
|
|
4383
|
+
:root[data-motion='1'] .todo-bar i,
|
|
4384
|
+
:root[data-motion='1'] .task-chip-bar i {
|
|
4385
|
+
transition: width var(--motion-dur) var(--motion-spring);
|
|
4386
|
+
}
|
|
4387
|
+
|
|
4388
|
+
/* 去掉模板感:输入区和主卡片不再抬高 */
|
|
4389
|
+
.composer { box-shadow: none; }
|
|
4390
|
+
.composer:focus-within { box-shadow: none; }
|
|
4391
|
+
.chat-card { box-shadow: none; }
|
|
4392
|
+
|
|
4304
4393
|
/* 顶栏和聊天头部:少一点装饰,多一点边界 */
|
|
4305
4394
|
.topbar { height: 50px; }
|
|
4306
4395
|
.chat-head { height: 46px; }
|