@restregular/dsh-powerup 0.8.18 → 0.8.19
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/client.js +208 -2
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
const promptCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
|
|
84
84
|
/** Fallback bucket when the hero cannot resolve an owning workspace yet. */
|
|
85
85
|
const UNSCOPED_WORKSPACE = '__unscoped__';
|
|
86
|
-
const VERSION = '0.8.
|
|
86
|
+
const VERSION = '0.8.19';
|
|
87
87
|
const MENU_GAP = 8;
|
|
88
88
|
const MENU_WIDTH = 248;
|
|
89
89
|
/** Reference scheme understood by the Host's `powerup_step_read` tool. */
|
|
@@ -130,6 +130,11 @@
|
|
|
130
130
|
'page.locateTitle': '定位当前会话',
|
|
131
131
|
'page.locateDesc': '在工作区侧边栏的按钮栏加一个定位按钮,把当前会话在工作区列表中展开、居中显示,自动展开折叠的工作区。',
|
|
132
132
|
'page.locateHow': '在工作区列表顶部点击「定位当前会话」图标按钮,当前会话所在的工作区会自动展开并滚动到视图中央。',
|
|
133
|
+
'page.scrollToTopTitle': '侧边栏回到顶部',
|
|
134
|
+
'page.scrollToTopDesc': '在左侧边栏「新会话」按钮旁加一个回到顶部按钮:工作区列表向下滚动后才出现,点击后左侧边栏平滑滚回最顶部。',
|
|
135
|
+
'page.scrollToTopHow': '在左侧边栏向下滚动工作区列表,顶部的「新会话」旁会出现向上箭头按钮,点击即可回到顶部。',
|
|
136
|
+
'scrollToTop.label': '回到顶部',
|
|
137
|
+
'scrollToTop.hint': '将左侧边栏滚动回最顶部',
|
|
133
138
|
'launcher.groupDefault': '分组',
|
|
134
139
|
'launcher.count': '{count} 个面板',
|
|
135
140
|
'launcher.renameHint': '点击重命名',
|
|
@@ -382,6 +387,11 @@
|
|
|
382
387
|
'page.locateTitle': 'Locate current session',
|
|
383
388
|
'page.locateDesc': 'Adds a button to the workspace sidebar header that expands, reveals and centers the current session in the workspace list, auto-expanding collapsed workspaces.',
|
|
384
389
|
'page.locateHow': 'Click the locate button in the workspace header; the workspace containing the current session expands and scrolls to the center of the view.',
|
|
390
|
+
'page.scrollToTopTitle': 'Sidebar back to top',
|
|
391
|
+
'page.scrollToTopDesc': 'Adds a back-to-top button next to New Session in the left sidebar: it appears once the workspace list is scrolled down, and clicking it smoothly scrolls the sidebar back to the very top.',
|
|
392
|
+
'page.scrollToTopHow': 'Scroll the workspace list down in the left sidebar; an up-arrow button appears beside New Session — click it to return to the top.',
|
|
393
|
+
'scrollToTop.label': 'Back to top',
|
|
394
|
+
'scrollToTop.hint': 'Scroll the left sidebar back to the top',
|
|
385
395
|
'launcher.groupDefault': 'Group',
|
|
386
396
|
'launcher.count': '{count} panels',
|
|
387
397
|
'launcher.renameHint': 'Click to rename',
|
|
@@ -635,6 +645,7 @@
|
|
|
635
645
|
jobStop: true,
|
|
636
646
|
update: true,
|
|
637
647
|
locateSession: true,
|
|
648
|
+
scrollToTop: true,
|
|
638
649
|
workspacePrompts: true,
|
|
639
650
|
oneClickEnable: true,
|
|
640
651
|
oneClickRestart: true,
|
|
@@ -654,6 +665,7 @@
|
|
|
654
665
|
jobStop: parsed.jobStop !== false,
|
|
655
666
|
update: parsed.update !== false,
|
|
656
667
|
locateSession: parsed.locateSession !== false,
|
|
668
|
+
scrollToTop: parsed.scrollToTop !== false,
|
|
657
669
|
workspacePrompts: parsed.workspacePrompts !== false,
|
|
658
670
|
oneClickEnable: parsed.oneClickEnable !== false,
|
|
659
671
|
oneClickRestart: parsed.oneClickRestart !== false,
|
|
@@ -3092,6 +3104,20 @@
|
|
|
3092
3104
|
);
|
|
3093
3105
|
}
|
|
3094
3106
|
|
|
3107
|
+
function ScrollTopIcon({ size = 16 }) {
|
|
3108
|
+
return h(Icon, { size },
|
|
3109
|
+
h('path', {
|
|
3110
|
+
d: 'M8 12.5V3.5M4.2 7.3 8 3.5l3.8 3.8',
|
|
3111
|
+
fill: 'none', stroke: 'currentColor', strokeWidth: '1.4',
|
|
3112
|
+
strokeLinecap: 'round', strokeLinejoin: 'round',
|
|
3113
|
+
}),
|
|
3114
|
+
h('path', {
|
|
3115
|
+
d: 'M3 14h10', fill: 'none', stroke: 'currentColor',
|
|
3116
|
+
strokeWidth: '1.4', strokeLinecap: 'round',
|
|
3117
|
+
}),
|
|
3118
|
+
);
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3095
3121
|
function BrandMark({ size = 56 }) {
|
|
3096
3122
|
return h('svg', {
|
|
3097
3123
|
width: size, height: size, viewBox: '0 0 256 256', fill: 'none', 'aria-hidden': 'true',
|
|
@@ -3614,6 +3640,19 @@ marker is only present while our button is mounted, and the host's
|
|
|
3614
3640
|
[data-sidebar-workspace-header] .dsh-powerup-locate:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
3615
3641
|
[data-sidebar-workspace-header] .dsh-powerup-locate:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
|
|
3616
3642
|
[data-sidebar-workspace-header] .dsh-powerup-locate svg{width:16px;height:16px}
|
|
3643
|
+
`;
|
|
3644
|
+
|
|
3645
|
+
const SCROLL_TOP_CSS = `
|
|
3646
|
+
/* Back-to-top button injected next to the host's New Session row. Hidden by
|
|
3647
|
+
default; shown only while the sidebar workspace list is scrolled down. */
|
|
3648
|
+
.dsh-powerup-scrolltop{display:none;flex:none;align-items:center;justify-content:center;width:38px;height:38px;padding:0;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-button-elevated-fill);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;transition:background .12s ease,color .12s ease,opacity .12s ease;opacity:0}
|
|
3649
|
+
.dsh-powerup-scrolltop[data-visible="true"]{display:inline-flex;opacity:1}
|
|
3650
|
+
.dsh-powerup-scrolltop:hover{background:var(--dsw-alias-button-floating-hover)}
|
|
3651
|
+
.dsh-powerup-scrolltop:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
|
|
3652
|
+
.dsh-powerup-scrolltop svg{width:16px;height:16px}
|
|
3653
|
+
html[data-platform="darwin"] .dsh-powerup-scrolltop{background:var(--dsw-specific-sidebar-glass-fill)}
|
|
3654
|
+
html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-specific-sidebar-glass-hover)}
|
|
3655
|
+
@media (prefers-reduced-motion:reduce){.dsh-powerup-scrolltop{transition:none}}
|
|
3617
3656
|
`;
|
|
3618
3657
|
|
|
3619
3658
|
const PROMPTS_CSS = `
|
|
@@ -4640,11 +4679,173 @@ marker is only present while our button is mounted, and the host's
|
|
|
4640
4679
|
return core;
|
|
4641
4680
|
}
|
|
4642
4681
|
|
|
4682
|
+
/**
|
|
4683
|
+
* Back-to-top button for the left sidebar. It is injected into the host's
|
|
4684
|
+
* New Session row (`[class*="newSessionRow"]`) and only becomes visible
|
|
4685
|
+
* once the workspace list has been scrolled away from the top. Clicking
|
|
4686
|
+
* it scrolls both the outer sidebar viewport and the workspace list back
|
|
4687
|
+
* to the very top. No host modules are imported — we observe the same
|
|
4688
|
+
* `data-*` contracts the other sidebar features already use.
|
|
4689
|
+
* @param {{t?: Function, isEnabled?: Function, threshold?: number}} deps
|
|
4690
|
+
*/
|
|
4691
|
+
function createScrollToTopCore(deps) {
|
|
4692
|
+
const options = deps ?? {};
|
|
4693
|
+
const t = typeof options.t === 'function' ? options.t : (key) => key;
|
|
4694
|
+
const isEnabled = typeof options.isEnabled === 'function' ? options.isEnabled : () => true;
|
|
4695
|
+
const threshold = Number.isFinite(options.threshold) ? options.threshold : 24;
|
|
4696
|
+
|
|
4697
|
+
let button = null;
|
|
4698
|
+
let observer = null;
|
|
4699
|
+
let started = false;
|
|
4700
|
+
let boundContainers = [];
|
|
4701
|
+
let detachListeners = [];
|
|
4702
|
+
|
|
4703
|
+
function hasDocument() {
|
|
4704
|
+
return typeof document !== 'undefined' && document !== null
|
|
4705
|
+
&& typeof document.querySelector === 'function' && document.body !== null;
|
|
4706
|
+
}
|
|
4707
|
+
|
|
4708
|
+
/** Both scrollers can carry the offset; the outer viewport wins. */
|
|
4709
|
+
function scrollContainers() {
|
|
4710
|
+
if (!hasDocument()) return [];
|
|
4711
|
+
const out = [];
|
|
4712
|
+
const outer = document.querySelector('[data-sidebar-scrollport]');
|
|
4713
|
+
if (outer !== null) out.push(outer);
|
|
4714
|
+
const inner = document.querySelector('[data-sidebar-list-area]');
|
|
4715
|
+
if (inner !== null && !out.includes(inner)) out.push(inner);
|
|
4716
|
+
return out;
|
|
4717
|
+
}
|
|
4718
|
+
|
|
4719
|
+
function scrolledDown() {
|
|
4720
|
+
return scrollContainers().some((el) => (el.scrollTop || 0) > threshold);
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4723
|
+
function syncVisibility() {
|
|
4724
|
+
if (button === null) return;
|
|
4725
|
+
button.setAttribute('data-visible', scrolledDown() ? 'true' : 'false');
|
|
4726
|
+
}
|
|
4727
|
+
|
|
4728
|
+
function toTop() {
|
|
4729
|
+
for (const el of scrollContainers()) {
|
|
4730
|
+
try {
|
|
4731
|
+
el.scrollTo({ top: 0, behavior: 'smooth' });
|
|
4732
|
+
} catch {
|
|
4733
|
+
el.scrollTop = 0;
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
syncVisibility();
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4739
|
+
function row() {
|
|
4740
|
+
if (!hasDocument()) return null;
|
|
4741
|
+
return document.querySelector('[class*="newSessionRow"]');
|
|
4742
|
+
}
|
|
4743
|
+
|
|
4744
|
+
function bindScrollers() {
|
|
4745
|
+
for (const off of detachListeners) {
|
|
4746
|
+
try { off(); } catch { /* already detached */ }
|
|
4747
|
+
}
|
|
4748
|
+
detachListeners = [];
|
|
4749
|
+
boundContainers = scrollContainers();
|
|
4750
|
+
for (const el of boundContainers) {
|
|
4751
|
+
const handler = () => syncVisibility();
|
|
4752
|
+
el.addEventListener('scroll', handler, { passive: true });
|
|
4753
|
+
detachListeners.push(() => el.removeEventListener('scroll', handler));
|
|
4754
|
+
}
|
|
4755
|
+
syncVisibility();
|
|
4756
|
+
}
|
|
4757
|
+
|
|
4758
|
+
function ensureButton() {
|
|
4759
|
+
const host = row();
|
|
4760
|
+
if (host === null || !isEnabled()) {
|
|
4761
|
+
if (button !== null) {
|
|
4762
|
+
button.remove();
|
|
4763
|
+
button = null;
|
|
4764
|
+
}
|
|
4765
|
+
return;
|
|
4766
|
+
}
|
|
4767
|
+
if (button !== null && button.isConnected === true) return;
|
|
4768
|
+
button = document.createElement('button');
|
|
4769
|
+
button.type = 'button';
|
|
4770
|
+
button.className = 'dsh-powerup-scrolltop';
|
|
4771
|
+
button.setAttribute('data-powerup-scrolltop', '');
|
|
4772
|
+
button.setAttribute('data-visible', 'false');
|
|
4773
|
+
button.setAttribute('aria-label', t('scrollToTop.label'));
|
|
4774
|
+
button.setAttribute('title', t('scrollToTop.hint'));
|
|
4775
|
+
button.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path d="M8 12.5V3.5M4.2 7.3 8 3.5l3.8 3.8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
4776
|
+
button.addEventListener('click', (event) => {
|
|
4777
|
+
event.preventDefault();
|
|
4778
|
+
event.stopPropagation();
|
|
4779
|
+
toTop();
|
|
4780
|
+
});
|
|
4781
|
+
host.appendChild(button);
|
|
4782
|
+
bindScrollers();
|
|
4783
|
+
}
|
|
4784
|
+
|
|
4785
|
+
function sync() {
|
|
4786
|
+
if (!started) return;
|
|
4787
|
+
const containers = scrollContainers();
|
|
4788
|
+
if (containers.length !== boundContainers.length || containers.some((el, i) => el !== boundContainers[i])) {
|
|
4789
|
+
bindScrollers();
|
|
4790
|
+
}
|
|
4791
|
+
ensureButton();
|
|
4792
|
+
syncVisibility();
|
|
4793
|
+
}
|
|
4794
|
+
|
|
4795
|
+
function start() {
|
|
4796
|
+
if (started || !hasDocument()) return;
|
|
4797
|
+
started = true;
|
|
4798
|
+
ensureButton();
|
|
4799
|
+
if (typeof MutationObserver === 'function') {
|
|
4800
|
+
observer = new MutationObserver(() => sync());
|
|
4801
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
|
|
4805
|
+
function stop() {
|
|
4806
|
+
started = false;
|
|
4807
|
+
if (observer !== null) observer.disconnect();
|
|
4808
|
+
observer = null;
|
|
4809
|
+
for (const off of detachListeners) {
|
|
4810
|
+
try { off(); } catch { /* already detached */ }
|
|
4811
|
+
}
|
|
4812
|
+
detachListeners = [];
|
|
4813
|
+
boundContainers = [];
|
|
4814
|
+
if (button !== null) button.remove();
|
|
4815
|
+
button = null;
|
|
4816
|
+
}
|
|
4817
|
+
|
|
4818
|
+
return { start, stop, sync, toTop, scrollContainers, scrolledDown };
|
|
4819
|
+
}
|
|
4820
|
+
|
|
4821
|
+
/**
|
|
4822
|
+
* Install the sidebar back-to-top button.
|
|
4823
|
+
* @param {object} ctx client plugin context
|
|
4824
|
+
*/
|
|
4825
|
+
function installScrollToTop(ctx) {
|
|
4826
|
+
const core = createScrollToTopCore({
|
|
4827
|
+
t: (key, params) => translateCurrent(key, params),
|
|
4828
|
+
isEnabled: () => getSettings().scrollToTop,
|
|
4829
|
+
});
|
|
4830
|
+
ctx.effect(() => {
|
|
4831
|
+
if (getSettings().scrollToTop) core.start();
|
|
4832
|
+
const off = subscribeSettings(() => {
|
|
4833
|
+
if (getSettings().scrollToTop) core.start();
|
|
4834
|
+
else core.stop();
|
|
4835
|
+
});
|
|
4836
|
+
return () => {
|
|
4837
|
+
off();
|
|
4838
|
+
core.stop();
|
|
4839
|
+
};
|
|
4840
|
+
}, 'dsh-powerup: sidebar scroll to top');
|
|
4841
|
+
return core;
|
|
4842
|
+
}
|
|
4843
|
+
|
|
4643
4844
|
function installStyles(ctx) {
|
|
4644
4845
|
try {
|
|
4645
4846
|
const style = document.createElement('style');
|
|
4646
4847
|
style.setAttribute('data-dsh-powerup', '');
|
|
4647
|
-
style.textContent = CSS + '\n' + LAUNCHER_CSS + '\n' + SESSION_SWITCH_CSS + '\n' + LOCATE_CSS + '\n' + PROMPTS_CSS;
|
|
4848
|
+
style.textContent = CSS + '\n' + LAUNCHER_CSS + '\n' + SESSION_SWITCH_CSS + '\n' + LOCATE_CSS + '\n' + SCROLL_TOP_CSS + '\n' + PROMPTS_CSS;
|
|
4648
4849
|
document.head.appendChild(style);
|
|
4649
4850
|
ctx.effect(() => () => style.remove(), 'dsh-powerup: styles');
|
|
4650
4851
|
} catch (error) {
|
|
@@ -7995,6 +8196,7 @@ marker is only present while our button is mounted, and the host's
|
|
|
7995
8196
|
),
|
|
7996
8197
|
featureCard('sessionSwitch', QuickIcon, 'page.sessionSwitchTitle', 'page.sessionSwitchDesc', 'page.sessionSwitchHow'),
|
|
7997
8198
|
featureCard('locateSession', LocateIcon, 'page.locateTitle', 'page.locateDesc', 'page.locateHow'),
|
|
8199
|
+
featureCard('scrollToTop', ScrollTopIcon, 'page.scrollToTopTitle', 'page.scrollToTopDesc', 'page.scrollToTopHow'),
|
|
7998
8200
|
featureCard('workspacePrompts', TagIcon, 'page.promptsTitle', 'page.promptsDesc', 'page.promptsHow'),
|
|
7999
8201
|
featureCard('jobStop', StopIcon, 'page.jobStopTitle', 'page.jobStopDesc', 'page.jobStopHow'),
|
|
8000
8202
|
featureCard('update', UpdateIcon, 'page.updateTitle', 'page.updateDesc', 'page.updateHow', oneClickDetail),
|
|
@@ -8059,6 +8261,7 @@ marker is only present while our button is mounted, and the host's
|
|
|
8059
8261
|
installLauncher(ctx);
|
|
8060
8262
|
installSessionSwitcher(ctx);
|
|
8061
8263
|
installLocateSession(ctx);
|
|
8264
|
+
installScrollToTop(ctx);
|
|
8062
8265
|
|
|
8063
8266
|
const slots = ctx.get('slots');
|
|
8064
8267
|
if (slots === undefined || typeof slots.inject !== 'function' || typeof slots.register !== 'function') {
|
|
@@ -8157,6 +8360,7 @@ marker is only present while our button is mounted, and the host's
|
|
|
8157
8360
|
CSS,
|
|
8158
8361
|
SESSION_SWITCH_CSS,
|
|
8159
8362
|
LOCATE_CSS,
|
|
8363
|
+
SCROLL_TOP_CSS,
|
|
8160
8364
|
PROMPTS_CSS,
|
|
8161
8365
|
PROMPTS_LAST_KEY,
|
|
8162
8366
|
promptCreateDraft,
|
|
@@ -8173,7 +8377,9 @@ marker is only present while our button is mounted, and the host's
|
|
|
8173
8377
|
buildWorkspaceIndex,
|
|
8174
8378
|
createSessionSwitcherCore,
|
|
8175
8379
|
createLocateSessionCore,
|
|
8380
|
+
createScrollToTopCore,
|
|
8176
8381
|
LocateIcon,
|
|
8382
|
+
ScrollTopIcon,
|
|
8177
8383
|
LAUNCHER_CSS,
|
|
8178
8384
|
LAUNCHER_STORAGE_KEY,
|
|
8179
8385
|
LAUNCHER_CHAT_KEY,
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Power-Up",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "A set of small, independently toggleable upgrades for DeepSeek Harness on the Power-Up page: trajectory context menu and step references, job stop reasons, one-click plugin install, sidebar icon grid and back-to-top, session switching and locating, and workspace prompts."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Power-Up",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "为 DeepSeek Harness 提供一组可在 Power-Up 页面独立开关的小型增强:轨迹右键菜单与步骤引用、后台任务停止原因、插件一键安装、侧边栏图标网格与回到顶部、会话切换与定位、工作区提示词。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-powerup",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19",
|
|
4
4
|
"description": "为 DeepSeek Harness 提供一组可选的小型增强:轨迹右键菜单与步骤引用、后台任务停止原因、插件一键安装、侧边栏图标网格、会话切换、定位当前会话、工作区提示词;所有功能均可在 Power-Up 页面独立开关。 · Opt-in upgrades for DeepSeek Harness: Trajectory context menu and step references, job stop reasons, one-click plugin install, an adaptive sidebar launcher, session switching, locating the current session, and workspace prompts — each toggled independently on the Power-Up page.",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|