dsh-enhance 0.3.13 → 0.3.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/lib/client.js +272 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -2430,6 +2430,19 @@ html[data-windows-titlebar] div[class*="_rightbarCol"] {
|
|
|
2430
2430
|
border-top: 0 !important;
|
|
2431
2431
|
}
|
|
2432
2432
|
|
|
2433
|
+
/* Use the macOS caption space for the tab strip. DS Bot's preload omits the platform
|
|
2434
|
+
attribute used by the host drag styles, so use our macOS marker. */
|
|
2435
|
+
html[data-ds-enhance-mac][data-windows-titlebar]:not([data-fullscreen]) .bt-panel:has(> .bt-ptabs[data-window-drag]) {
|
|
2436
|
+
--bt-caption-band: 0px;
|
|
2437
|
+
}
|
|
2438
|
+
html[data-ds-enhance-mac][data-windows-titlebar]:not([data-fullscreen]) .bt-panel > .bt-ptabs[data-window-drag] {
|
|
2439
|
+
-webkit-app-region: drag;
|
|
2440
|
+
}
|
|
2441
|
+
html[data-ds-enhance-mac][data-windows-titlebar] .bt-panel > .bt-ptabs[data-window-drag] :is(button, a, [role="button"], [role="tab"]),
|
|
2442
|
+
html[data-ds-enhance-mac][data-windows-titlebar] .bt-panel:has(> .bt-ptabs[data-window-drag]) > .bt-panel-grip {
|
|
2443
|
+
-webkit-app-region: no-drag;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2433
2446
|
/* With that 40px band gone the dockkit tab strip sits inside the native
|
|
2434
2447
|
title-bar drag region. The host marks the strip itself as a window drag
|
|
2435
2448
|
handle (data-window-drag → app-region: drag), so the strip's own padding,
|
|
@@ -2686,6 +2699,99 @@ ${CORNER_ROW} button,
|
|
|
2686
2699
|
padding-top: max(0px, calc(49px - var(--bt-caption-band, 0px))) !important;
|
|
2687
2700
|
}
|
|
2688
2701
|
|
|
2702
|
+
/* In the tabbed panel the details view follows the strip. Keep its actions
|
|
2703
|
+
in that flow so they never cover the tab labels or the panel close button. */
|
|
2704
|
+
.bt-panel:has(> .bt-ptabs) > .bt-panel-view:has(> .bt-drawer-top) {
|
|
2705
|
+
padding-top: 0 !important;
|
|
2706
|
+
}
|
|
2707
|
+
.bt-panel:has(> .bt-ptabs) > .bt-panel-view > .bt-drawer-top {
|
|
2708
|
+
position: relative !important;
|
|
2709
|
+
inset: auto !important;
|
|
2710
|
+
padding: 6px 20px 0 12px !important;
|
|
2711
|
+
flex: none;
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
/* Match the dock's Files tab: a 28px chip with the shared hover and selected fills. */
|
|
2715
|
+
.bt-panel > .bt-ptabs {
|
|
2716
|
+
--ds-tab-radius: var(--dsw-radius-sm, 6px);
|
|
2717
|
+
--ds-tab-hover: var(--dsw-alias-interactive-bg-hover, var(--bt-hover));
|
|
2718
|
+
--ds-tab-selected: var(--dsw-alias-markdown-tag, var(--bt-active));
|
|
2719
|
+
}
|
|
2720
|
+
.bt-panel > .bt-ptabs > .bt-ptabs-in > .bt-ptab-ind {
|
|
2721
|
+
display: none;
|
|
2722
|
+
}
|
|
2723
|
+
.bt-panel > .bt-ptabs :is(.bt-ptab, .bt-ptab-wrap, .bt-ptab-new, .bt-ptab-close) {
|
|
2724
|
+
height: 28px;
|
|
2725
|
+
border-radius: var(--ds-tab-radius);
|
|
2726
|
+
}
|
|
2727
|
+
.bt-panel > .bt-ptabs .bt-ptab-wrap { padding-right: 4px; }
|
|
2728
|
+
.bt-panel > .bt-ptabs .bt-ptab-btn { padding-inline-start: 10px; }
|
|
2729
|
+
.bt-panel > .bt-ptabs .bt-ptab-wrap:hover,
|
|
2730
|
+
.bt-panel > .bt-ptabs :is(.bt-ptab-new, .bt-ptab-close):hover { background: var(--ds-tab-hover); }
|
|
2731
|
+
.bt-panel > .bt-ptabs .bt-ptab-wrap[data-selected],
|
|
2732
|
+
.bt-panel > .bt-ptabs .bt-ptab-bot[aria-selected="true"]:not(:has(+ .ds-panel-actions)) { background: var(--ds-tab-selected); }
|
|
2733
|
+
.bt-panel > .bt-ptabs .bt-ptab-wrap:not([data-selected]) + .bt-ptab-wrap:not([data-selected])::before {
|
|
2734
|
+
content: ''; position: absolute; inset: 7px auto 7px -1px;
|
|
2735
|
+
width: 1px; background: var(--bt-line); pointer-events: none;
|
|
2736
|
+
}
|
|
2737
|
+
.bt-panel > .bt-ptabs .bt-ptabs-in:has(> .ds-panel-actions) {
|
|
2738
|
+
--ds-identity-width: 104px;
|
|
2739
|
+
scroll-padding-left: calc(var(--ds-identity-width) + 24px);
|
|
2740
|
+
}
|
|
2741
|
+
/* The opaque surface prevents scrolled labels showing through the pinned group.
|
|
2742
|
+
The separate rounded fill paints selection across the name and arrow once. */
|
|
2743
|
+
.bt-panel > .bt-ptabs .bt-ptabs-in > .bt-ptab-bot:has(+ .ds-panel-actions) {
|
|
2744
|
+
width: var(--ds-identity-width); box-sizing: border-box;
|
|
2745
|
+
background: var(--bt-main); box-shadow: 22px 0 var(--bt-main);
|
|
2746
|
+
border-radius: 0; z-index: 3;
|
|
2747
|
+
}
|
|
2748
|
+
.bt-ptab-bot:has(+ .ds-panel-actions)::before {
|
|
2749
|
+
content: ''; position: absolute; inset: 0 -22px 0 0;
|
|
2750
|
+
border-radius: var(--ds-tab-radius); z-index: -1; pointer-events: none;
|
|
2751
|
+
}
|
|
2752
|
+
.bt-ptab-bot:is(:hover, :has(+ .ds-panel-actions:hover), :has(+ .ds-panel-actions[aria-expanded="true"]))::before {
|
|
2753
|
+
background: var(--ds-tab-hover);
|
|
2754
|
+
}
|
|
2755
|
+
.bt-ptab-bot[aria-selected="true"]:has(+ .ds-panel-actions)::before { background: var(--ds-tab-selected); }
|
|
2756
|
+
.bt-ptab-bot:has(+ .ds-panel-actions):not(:has(.bt-ptab-name))::after {
|
|
2757
|
+
content: attr(title); overflow: hidden; text-overflow: ellipsis;
|
|
2758
|
+
}
|
|
2759
|
+
.bt-panel > .bt-ptabs .ds-panel-actions {
|
|
2760
|
+
position: sticky; left: calc(var(--ds-identity-width) + 2px); z-index: 4; flex: none;
|
|
2761
|
+
width: 20px; height: 28px; border: 0; border-radius: var(--ds-tab-radius); padding: 0;
|
|
2762
|
+
background: transparent; color: var(--bt-ink-2); cursor: pointer;
|
|
2763
|
+
display: inline-grid; place-items: center;
|
|
2764
|
+
}
|
|
2765
|
+
.bt-panel > .bt-ptabs .ds-panel-actions::before {
|
|
2766
|
+
content: '';
|
|
2767
|
+
width: 10px;
|
|
2768
|
+
height: 7px;
|
|
2769
|
+
background: currentColor;
|
|
2770
|
+
clip-path: polygon(0 0, 100% 0, 50% 100%);
|
|
2771
|
+
}
|
|
2772
|
+
.bt-panel > .bt-ptabs > .bt-pmenu > .bt-ptab-new { color: var(--bt-ink-2); }
|
|
2773
|
+
.bt-panel > .bt-ptabs > .bt-pmenu > .bt-ptab-new:hover { color: var(--bt-ink); }
|
|
2774
|
+
.bt-panel > .bt-ptabs > .bt-pmenu > .bt-ptab-new > svg path { stroke-width: 3.2px; }
|
|
2775
|
+
.ds-panel-actions:hover, .ds-panel-actions[aria-expanded="true"] { color: var(--bt-ink); }
|
|
2776
|
+
.bt-panel > .bt-ptabs :is(.ds-panel-actions, .bt-ptab-new, .bt-ptab-close):focus-visible {
|
|
2777
|
+
outline: 2px solid var(--bt-accent); outline-offset: -2px;
|
|
2778
|
+
}
|
|
2779
|
+
.bt-panel:has(> .bt-ptabs .ds-panel-actions) > .bt-panel-view > .bt-drawer-top:not(:popover-open) { display: none !important; }
|
|
2780
|
+
.bt-panel:has(> .bt-ptabs .ds-panel-actions) > .bt-panel-view > .bt-drawer-top:popover-open {
|
|
2781
|
+
position: fixed !important; inset: var(--ds-actions-y) auto auto var(--ds-actions-x) !important;
|
|
2782
|
+
display: flex; flex-direction: column; align-items: stretch; gap: 2px;
|
|
2783
|
+
box-sizing: border-box; width: 192px; overflow: visible; margin: 0 !important; padding: 5px !important;
|
|
2784
|
+
border: .5px solid var(--bt-line); border-radius: 12px; color: var(--bt-ink);
|
|
2785
|
+
background: var(--bt-main); box-shadow: 0 8px 24px #0003; animation: none;
|
|
2786
|
+
}
|
|
2787
|
+
.bt-panel:has(> .bt-ptabs .ds-panel-actions) > .bt-panel-view > .bt-drawer-top:popover-open .bt-round {
|
|
2788
|
+
display: flex; justify-content: flex-start; gap: 8px; box-sizing: border-box;
|
|
2789
|
+
width: 100%; padding: 0 9px; border-radius: 7px; white-space: nowrap;
|
|
2790
|
+
}
|
|
2791
|
+
.bt-drawer-top:popover-open .bt-round::after { content: attr(aria-label); font: 13px system-ui; }
|
|
2792
|
+
.bt-drawer-top:popover-open .bt-pmenu { display: block; }
|
|
2793
|
+
.bt-drawer-top:popover-open .bt-pmenu-pop { position: static; margin: 3px 0; min-width: 0; }
|
|
2794
|
+
|
|
2689
2795
|
/* The settings view uses an in-flow subheader instead of .bt-drawer-top.
|
|
2690
2796
|
Without a tab strip, replace the inherited 40px band with the 20px inset
|
|
2691
2797
|
(10px panel clearance plus the subheader's existing 10px padding). */
|
|
@@ -3732,6 +3838,11 @@ ${fallback} li::marker {
|
|
|
3732
3838
|
if (typeof document === "undefined") return;
|
|
3733
3839
|
const surface = currentSurface();
|
|
3734
3840
|
const pluginId = stylePluginId(surface);
|
|
3841
|
+
if (surface === "ds-bot" && /^Mac/.test(document.defaultView?.navigator.platform ?? "")) ctx.effect(() => {
|
|
3842
|
+
const root = document.documentElement;
|
|
3843
|
+
root.setAttribute("data-ds-enhance-mac", "");
|
|
3844
|
+
return () => root.removeAttribute("data-ds-enhance-mac");
|
|
3845
|
+
}, `${pluginId}: macOS chrome marker`);
|
|
3735
3846
|
for (const [name, css] of sheetsFor(surface)) ctx.effect(() => {
|
|
3736
3847
|
const tag = document.createElement("style");
|
|
3737
3848
|
tag.dataset.plugin = pluginId;
|
|
@@ -4701,6 +4812,166 @@ ${fallback} li::marker {
|
|
|
4701
4812
|
root.documentElement.removeAttribute(MODE_ATTR);
|
|
4702
4813
|
};
|
|
4703
4814
|
}
|
|
4815
|
+
// src/client/surfaces/ds-bot/panel-actions.ts
|
|
4816
|
+
const botSelector = ".bt-panel:not([data-leaving]) > .bt-ptabs > .bt-ptabs-in > button.bt-ptab-bot:has(.bt-mark)";
|
|
4817
|
+
const installations = /* @__PURE__ */ new WeakMap();
|
|
4818
|
+
function installPanelActions(doc) {
|
|
4819
|
+
const entry = installations.get(doc) ?? {
|
|
4820
|
+
users: 0,
|
|
4821
|
+
dispose: mountPanelActions(doc)
|
|
4822
|
+
};
|
|
4823
|
+
installations.set(doc, entry);
|
|
4824
|
+
entry.users++;
|
|
4825
|
+
let released = false;
|
|
4826
|
+
return () => {
|
|
4827
|
+
if (released) return;
|
|
4828
|
+
released = true;
|
|
4829
|
+
if (--entry.users === 0) {
|
|
4830
|
+
installations.delete(doc);
|
|
4831
|
+
entry.dispose();
|
|
4832
|
+
}
|
|
4833
|
+
};
|
|
4834
|
+
}
|
|
4835
|
+
/** Keep React's buttons in their original tree so settings, sharing and More
|
|
4836
|
+
* always run in the current DetailsDrawer, including its nested PanelMenu. */
|
|
4837
|
+
function mountPanelActions(doc) {
|
|
4838
|
+
const win = doc.defaultView;
|
|
4839
|
+
if (!win.HTMLElement.prototype.showPopover) return () => {};
|
|
4840
|
+
let bot = null;
|
|
4841
|
+
let panel = null;
|
|
4842
|
+
let popup = null;
|
|
4843
|
+
let pending = null;
|
|
4844
|
+
let timeout = 0;
|
|
4845
|
+
const arrow = doc.createElement("button");
|
|
4846
|
+
arrow.type = "button";
|
|
4847
|
+
arrow.className = "ds-panel-actions";
|
|
4848
|
+
arrow.setAttribute("aria-haspopup", "dialog");
|
|
4849
|
+
arrow.setAttribute("aria-expanded", "false");
|
|
4850
|
+
function close(focus = false) {
|
|
4851
|
+
win.clearTimeout(timeout);
|
|
4852
|
+
pending = null;
|
|
4853
|
+
if (popup) {
|
|
4854
|
+
popup.querySelector("[data-info-row=\"more\"] button[aria-expanded=\"true\"]")?.click();
|
|
4855
|
+
popup.hidePopover();
|
|
4856
|
+
popup.removeAttribute("popover");
|
|
4857
|
+
popup.removeAttribute("role");
|
|
4858
|
+
popup.removeAttribute("aria-label");
|
|
4859
|
+
popup.style.removeProperty("--ds-actions-x");
|
|
4860
|
+
popup.style.removeProperty("--ds-actions-y");
|
|
4861
|
+
popup = null;
|
|
4862
|
+
}
|
|
4863
|
+
arrow.setAttribute("aria-expanded", "false");
|
|
4864
|
+
if (focus && arrow.isConnected) arrow.focus();
|
|
4865
|
+
}
|
|
4866
|
+
function sync() {
|
|
4867
|
+
const next = doc.querySelector(botSelector);
|
|
4868
|
+
if (bot !== next) {
|
|
4869
|
+
close();
|
|
4870
|
+
arrow.remove();
|
|
4871
|
+
bot = next;
|
|
4872
|
+
panel = bot?.closest(".bt-panel") ?? null;
|
|
4873
|
+
}
|
|
4874
|
+
if (!bot || !panel) return;
|
|
4875
|
+
if (bot.nextElementSibling !== arrow) bot.after(arrow);
|
|
4876
|
+
const label = `${bot.title} ${doc.documentElement.lang.startsWith("zh") ? "操作" : "actions"}`;
|
|
4877
|
+
if (arrow.title !== label) {
|
|
4878
|
+
arrow.title = label;
|
|
4879
|
+
arrow.setAttribute("aria-label", label);
|
|
4880
|
+
}
|
|
4881
|
+
if (!pending) return;
|
|
4882
|
+
const row = panel.querySelector(":scope > .bt-panel-view > .bt-drawer-top");
|
|
4883
|
+
if (bot.title !== pending.name || popup && row !== popup) return close();
|
|
4884
|
+
if (popup || !row || bot.getAttribute("aria-selected") !== "true") return;
|
|
4885
|
+
if (panel.querySelector(":scope > .bt-panel-view > .bt-drawer-id > .bt-drawer-name")?.textContent !== pending.name) return close();
|
|
4886
|
+
win.clearTimeout(timeout);
|
|
4887
|
+
popup = row;
|
|
4888
|
+
row.setAttribute("popover", "manual");
|
|
4889
|
+
row.setAttribute("role", "dialog");
|
|
4890
|
+
row.setAttribute("aria-label", label);
|
|
4891
|
+
const anchor = arrow.getBoundingClientRect();
|
|
4892
|
+
row.style.setProperty("--ds-actions-x", `${Math.max(4, Math.min(anchor.left, win.innerWidth - 196))}px`);
|
|
4893
|
+
row.style.setProperty("--ds-actions-y", `${anchor.bottom + 4}px`);
|
|
4894
|
+
row.showPopover();
|
|
4895
|
+
arrow.setAttribute("aria-expanded", "true");
|
|
4896
|
+
const items = row.querySelectorAll("button");
|
|
4897
|
+
items[pending.last ? items.length - 1 : 0]?.focus();
|
|
4898
|
+
}
|
|
4899
|
+
function open(last = false) {
|
|
4900
|
+
if (!bot) return;
|
|
4901
|
+
close();
|
|
4902
|
+
pending = {
|
|
4903
|
+
name: bot.title,
|
|
4904
|
+
last
|
|
4905
|
+
};
|
|
4906
|
+
timeout = win.setTimeout(() => close(), 1e3);
|
|
4907
|
+
if (bot.getAttribute("aria-selected") !== "true") bot.click();
|
|
4908
|
+
else panel?.querySelector(":scope > .bt-panel-view > .bt-subhead > button:first-child")?.click();
|
|
4909
|
+
sync();
|
|
4910
|
+
}
|
|
4911
|
+
arrow.onclick = () => pending ? close(true) : open();
|
|
4912
|
+
arrow.onkeydown = (e) => {
|
|
4913
|
+
if (!["ArrowDown", "ArrowUp"].includes(e.key)) return;
|
|
4914
|
+
e.preventDefault();
|
|
4915
|
+
open(e.key === "ArrowUp");
|
|
4916
|
+
};
|
|
4917
|
+
function onPointer(e) {
|
|
4918
|
+
if (pending && !arrow.contains(e.target) && !popup?.contains(e.target)) close();
|
|
4919
|
+
}
|
|
4920
|
+
function onClick(e) {
|
|
4921
|
+
const action = e.target.closest("button");
|
|
4922
|
+
if (popup && action && popup.contains(action) && !action.hasAttribute("aria-haspopup")) close(action.parentElement === popup && !action.hasAttribute("data-info-row"));
|
|
4923
|
+
}
|
|
4924
|
+
function onKey(e) {
|
|
4925
|
+
if (!popup || popup.querySelector("[aria-expanded=\"true\"]")) return;
|
|
4926
|
+
if (e.key === "Tab") {
|
|
4927
|
+
close(true);
|
|
4928
|
+
return;
|
|
4929
|
+
}
|
|
4930
|
+
if (e.key === "Escape") {
|
|
4931
|
+
e.preventDefault();
|
|
4932
|
+
e.stopPropagation();
|
|
4933
|
+
close(true);
|
|
4934
|
+
return;
|
|
4935
|
+
}
|
|
4936
|
+
if (![
|
|
4937
|
+
"ArrowUp",
|
|
4938
|
+
"ArrowDown",
|
|
4939
|
+
"Home",
|
|
4940
|
+
"End"
|
|
4941
|
+
].includes(e.key)) return;
|
|
4942
|
+
const buttons = Array.from(popup.querySelectorAll("button"));
|
|
4943
|
+
const i = buttons.indexOf(doc.activeElement);
|
|
4944
|
+
e.preventDefault();
|
|
4945
|
+
buttons[e.key === "Home" ? 0 : e.key === "End" ? buttons.length - 1 : (i + buttons.length + (e.key === "ArrowDown" ? 1 : -1)) % buttons.length]?.focus();
|
|
4946
|
+
}
|
|
4947
|
+
const observer = new win.MutationObserver(sync);
|
|
4948
|
+
observer.observe(doc.body, {
|
|
4949
|
+
subtree: true,
|
|
4950
|
+
childList: true,
|
|
4951
|
+
attributes: true,
|
|
4952
|
+
attributeFilter: [
|
|
4953
|
+
"title",
|
|
4954
|
+
"aria-selected",
|
|
4955
|
+
"data-leaving"
|
|
4956
|
+
]
|
|
4957
|
+
});
|
|
4958
|
+
const events = new win.AbortController();
|
|
4959
|
+
const options = { signal: events.signal };
|
|
4960
|
+
doc.addEventListener("pointerdown", onPointer, options);
|
|
4961
|
+
doc.addEventListener("click", onClick, options);
|
|
4962
|
+
doc.addEventListener("keydown", onKey, {
|
|
4963
|
+
...options,
|
|
4964
|
+
capture: true
|
|
4965
|
+
});
|
|
4966
|
+
win.addEventListener("resize", () => close(), options);
|
|
4967
|
+
sync();
|
|
4968
|
+
return () => {
|
|
4969
|
+
observer.disconnect();
|
|
4970
|
+
events.abort();
|
|
4971
|
+
close();
|
|
4972
|
+
arrow.remove();
|
|
4973
|
+
};
|
|
4974
|
+
}
|
|
4704
4975
|
// src/client/surfaces/ds-bot/footer-panels.ts
|
|
4705
4976
|
const FOOTER_SELECTOR = ".bt-leftcol > .bt-side > .bt-leftcol-foot";
|
|
4706
4977
|
const PANELS = [{
|
|
@@ -8403,6 +8674,7 @@ ${fallback} li::marker {
|
|
|
8403
8674
|
}), "dsh-enhance: dictionaries");
|
|
8404
8675
|
installStyles(ctx);
|
|
8405
8676
|
if (surface === "ds-bot") {
|
|
8677
|
+
ctx.effect(() => installPanelActions(document), "dsh-enhance: DS Bot panel actions");
|
|
8406
8678
|
ctx.effect(() => installSidebarBounce(document), "dsh-enhance: DS Bot sidebar bounce");
|
|
8407
8679
|
ctx.inject(["layout"], (scope) => {
|
|
8408
8680
|
scope.effect(() => installFooterPanels(scope, document, (target, Icon) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-enhance",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"description": "DeepSeek Harness enhancements: Markdown theme for every renderer, select-text annotations with pins, a file right-click menu, a narrower sidebar, and startup defaults (maximized window, narrowest sidebar, colourful running marker). 中文:DSH 增强插件——Markdown 主题、划词批注、文件右键菜单、侧栏宽度、启动默认状态。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|