dsh-enhance 0.3.12 → 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 +313 -28
- 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). */
|
|
@@ -2769,32 +2875,41 @@ html[data-windows-titlebar] body:has(> .bt-menu) .bt-leftcol {
|
|
|
2769
2875
|
box-shadow: none;
|
|
2770
2876
|
}
|
|
2771
2877
|
|
|
2772
|
-
/*
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
The avatar and its status badge are untouched; a short label leaves a compact
|
|
2781
|
-
card, and a single-line label stays on one line. Not scoped to
|
|
2782
|
-
data-windows-titlebar: the overflow shows in a plain browser too. */
|
|
2783
|
-
.bt-leftcol .bt-tile {
|
|
2784
|
-
width: auto !important;
|
|
2785
|
-
max-width: 100% !important;
|
|
2786
|
-
box-sizing: border-box !important;
|
|
2787
|
-
padding-left: 12px !important;
|
|
2788
|
-
padding-right: 12px !important;
|
|
2878
|
+
/* Keep the host profile above the scrollport so it can show the native sidebar
|
|
2879
|
+
material and the scrollport still clips every conversation row. */
|
|
2880
|
+
.bt-leftcol > .bt-side:not(.bt-rail):has(> .bt-list > .bt-tile-wrap:first-child) {
|
|
2881
|
+
position: relative;
|
|
2882
|
+
/* Host tile: 60px avatar, 18px name, 4px gap, 10px button padding. */
|
|
2883
|
+
--ds-profile-padding-top: 6px;
|
|
2884
|
+
--ds-profile-task-height: 0px;
|
|
2885
|
+
--ds-profile-height: calc(107px + var(--ds-profile-padding-top) + var(--ds-profile-task-height));
|
|
2789
2886
|
}
|
|
2790
|
-
.bt-leftcol .bt-tile .bt-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2887
|
+
.bt-leftcol > .bt-side:not(.bt-rail):has(> .bt-list > .bt-tile-wrap:first-child > .bt-tile > .bt-task-pill) {
|
|
2888
|
+
/* The optional task count adds an 18px pill, 4px margin and 4px gap. */
|
|
2889
|
+
--ds-profile-task-height: 26px;
|
|
2890
|
+
}
|
|
2891
|
+
.bt-leftcol > .bt-side:not(.bt-rail) > .bt-list:has(> .bt-tile-wrap:first-child) {
|
|
2892
|
+
margin-top: var(--ds-profile-height);
|
|
2893
|
+
}
|
|
2894
|
+
.bt-leftcol > .bt-side:not(.bt-rail) > .bt-list > .bt-tile-wrap:first-child {
|
|
2895
|
+
/* The static block position is the scrollport's top. Anchor inline sizing
|
|
2896
|
+
to the sidebar so the tile stays centred outside the scroll clip. */
|
|
2897
|
+
position: absolute;
|
|
2898
|
+
inset-inline: 0;
|
|
2899
|
+
translate: 0 -100%;
|
|
2900
|
+
box-sizing: border-box;
|
|
2901
|
+
padding-top: var(--ds-profile-padding-top);
|
|
2902
|
+
height: var(--ds-profile-height);
|
|
2903
|
+
z-index: 2;
|
|
2904
|
+
}
|
|
2905
|
+
.bt-leftcol > .bt-side:not(.bt-rail) > .bt-list > .bt-tile-wrap:first-child > .bt-tile {
|
|
2906
|
+
width: 127px;
|
|
2907
|
+
max-width: 100%;
|
|
2908
|
+
background: transparent;
|
|
2909
|
+
-webkit-app-region: no-drag !important;
|
|
2910
|
+
}
|
|
2911
|
+
.bt-leftcol > .bt-side:not(.bt-rail) > .bt-list > .bt-tile-wrap:first-child > .bt-tile > .bt-chip {
|
|
2912
|
+
display: none;
|
|
2798
2913
|
}
|
|
2799
2914
|
|
|
2800
2915
|
/* The footer's native .bt-account/.bt-you styles provide the button and disc. */
|
|
@@ -3723,6 +3838,11 @@ ${fallback} li::marker {
|
|
|
3723
3838
|
if (typeof document === "undefined") return;
|
|
3724
3839
|
const surface = currentSurface();
|
|
3725
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`);
|
|
3726
3846
|
for (const [name, css] of sheetsFor(surface)) ctx.effect(() => {
|
|
3727
3847
|
const tag = document.createElement("style");
|
|
3728
3848
|
tag.dataset.plugin = pluginId;
|
|
@@ -4419,14 +4539,18 @@ ${fallback} li::marker {
|
|
|
4419
4539
|
const GROUP = ".bt-sec, .bt-sec-body, .bt-sec-body-in, .bt-sec-ungrouped";
|
|
4420
4540
|
function visibleContent(list, direction, height, end) {
|
|
4421
4541
|
const viewport = list.getBoundingClientRect();
|
|
4542
|
+
const first = list.firstElementChild;
|
|
4543
|
+
const pinned = !list.parentElement?.classList.contains("bt-rail") && first?.classList.contains("bt-tile-wrap") ? first : null;
|
|
4544
|
+
const visibleTop = pinned?.getBoundingClientRect().bottom ?? viewport.top;
|
|
4422
4545
|
const towardTop = direction < 0;
|
|
4423
4546
|
const targets = [];
|
|
4424
4547
|
const collect = (parent) => {
|
|
4425
4548
|
let child = towardTop ? parent.firstElementChild : parent.lastElementChild;
|
|
4426
|
-
|
|
4549
|
+
if (pinned && child === pinned) child = pinned.nextElementSibling;
|
|
4550
|
+
while (child && child !== pinned) {
|
|
4427
4551
|
const bounds = child.getBoundingClientRect();
|
|
4428
|
-
if (towardTop ? bounds.top >= viewport.bottom : bounds.bottom <=
|
|
4429
|
-
if (bounds.height > 0 && bounds.bottom >
|
|
4552
|
+
if (towardTop ? bounds.top >= viewport.bottom : bounds.bottom <= visibleTop) break;
|
|
4553
|
+
if (bounds.height > 0 && bounds.bottom > visibleTop && bounds.top < viewport.bottom) {
|
|
4430
4554
|
if (bounds.height > height && child.matches(GROUP)) collect(child);
|
|
4431
4555
|
else {
|
|
4432
4556
|
const space = viewport.top + height + end - bounds.bottom;
|
|
@@ -4688,6 +4812,166 @@ ${fallback} li::marker {
|
|
|
4688
4812
|
root.documentElement.removeAttribute(MODE_ATTR);
|
|
4689
4813
|
};
|
|
4690
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
|
+
}
|
|
4691
4975
|
// src/client/surfaces/ds-bot/footer-panels.ts
|
|
4692
4976
|
const FOOTER_SELECTOR = ".bt-leftcol > .bt-side > .bt-leftcol-foot";
|
|
4693
4977
|
const PANELS = [{
|
|
@@ -8390,6 +8674,7 @@ ${fallback} li::marker {
|
|
|
8390
8674
|
}), "dsh-enhance: dictionaries");
|
|
8391
8675
|
installStyles(ctx);
|
|
8392
8676
|
if (surface === "ds-bot") {
|
|
8677
|
+
ctx.effect(() => installPanelActions(document), "dsh-enhance: DS Bot panel actions");
|
|
8393
8678
|
ctx.effect(() => installSidebarBounce(document), "dsh-enhance: DS Bot sidebar bounce");
|
|
8394
8679
|
ctx.inject(["layout"], (scope) => {
|
|
8395
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",
|