Merge remote-tracking branch 'origin/dev' into fix/826-file-link-line-jump
# Conflicts: # CHANGELOG.md # src/client/FileTree.tsx # src/client/desktop-env.ts
This commit is contained in:
commit
5f90f1d466
42 files changed
+1130
-81
No files matched your search
@@ -336,7 +336,11 @@ const DirRow = memo(function DirRow(props: DirRowProps): ReactNode {
|
||||
style={{ paddingLeft: depth * 22 + 6 }}
|
||||
// A folded row renders the whole chain (`a/b/c`) and a plain click
|
||||
// toggles every link at once, so the breadcrumb opens and closes as one.
|
||||
title={chain.length > 1 ? target.path : undefined}
|
||||
// EVERY directory row carries its full path here — a single-segment row
|
||||
// is truncated by the label's ellipsis exactly like the breadcrumb, and
|
||||
// the body never scrolls horizontally, so the tooltip is the only way to
|
||||
// read a deep path (the same affordance `FileRow` gives a file).
|
||||
title={target.path}
|
||||
onClick={(event) => { actions.activate(event, entry.path, true, chain) }}
|
||||
onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
@@ -398,6 +402,9 @@ const RootRow = memo(function RootRow(props: RootRowProps): ReactNode {
|
||||
<div
|
||||
className={clsx(css.explorerRow, dropTarget && css.explorerRowDropTarget)}
|
||||
style={{ paddingLeft: 6 }}
|
||||
// The root row prints only the workspace folder's BASENAME, so it needs
|
||||
// the full path on hover like every other row.
|
||||
title={path}
|
||||
onDragOver={(event) => { actions.dragOver(event, path) }}
|
||||
onDrop={(event) => { actions.drop(event, path, true) }}
|
||||
onContextMenu={(event) => { actions.contextMenu(event, path, true) }}
|
||||
|
||||
+34
-6
@@ -41,12 +41,13 @@ import { IconPanelBottomOutline16 } from './icons.tsx'
|
||||
import { Workbench, type WorkbenchActions } from './split-pane.tsx'
|
||||
import { useViewportSize } from './breakpoints.ts'
|
||||
import { bottomPushHeight } from './layout-push.ts'
|
||||
import { parseDesktopEnv } from './desktop-env.ts'
|
||||
import { parseDesktopEnv, probeDesktopWindow } from './desktop-env.ts'
|
||||
import { getWcoSnapshot, subscribeWco } from './wco.ts'
|
||||
import { getShellPreset } from './shell-presets.ts'
|
||||
import { computeTitleBarStrip } from './titlebar-strip.ts'
|
||||
import { TabContent, buildNewTabOptions } from './sidebar/TabContent.tsx'
|
||||
import { confirmDiscardDraft, dirtyCount, editorDirtyRevision, subscribeEditorDirty } from './editor-dirty.ts'
|
||||
import { createOpenInApp } from './open-in-app.ts'
|
||||
import { useCenterColumn } from './sidebar/use-center-column.ts'
|
||||
import { useHostFeeds } from './sidebar/use-host-feeds.ts'
|
||||
import { mountedSessions } from './native/surface.ts'
|
||||
@@ -240,10 +241,11 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
}, [dirtyRevision])
|
||||
|
||||
// Title-bar / shell compatibility (the "位置兼容模式" scheme):
|
||||
// auto — CONSERVATIVE: only the standard Window Controls Overlay
|
||||
// geometry contributes (the real caption-overlay height,
|
||||
// reactive to maximize/restore). No URL stamp, no preset, no
|
||||
// guess — plain browsers see zero modification.
|
||||
// auto — CONSERVATIVE: the desktop shell's own window contract when it
|
||||
// publishes one, otherwise only the standard Window Controls
|
||||
// Overlay geometry contributes (the real caption-overlay
|
||||
// height, reactive to maximize/restore). No URL stamp, no
|
||||
// preset, no guess — plain browsers see zero modification.
|
||||
// preset — an opt-in built-in shell preset (shell-presets.ts) adds its
|
||||
// per-shell strip as the no-WCO fallback.
|
||||
// custom — the user's own CSS (injected below) + the legacy manual
|
||||
@@ -254,6 +256,11 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
// both on unmount/boundary swap so a crashed sidebar never leaves them
|
||||
// behind.
|
||||
const desktopEnv = parseDesktopEnv()
|
||||
// The shell's own geometry contract (absent on a plain browser page and on
|
||||
// shells that only stamp the URL — see desktop-env.ts). Probed per render:
|
||||
// it is a plain read of an immutable service, and the sidebar re-renders on
|
||||
// every session / prefs / viewport change anyway.
|
||||
const desktopWindow = probeDesktopWindow(ctx)
|
||||
const wco = useSyncExternalStore(
|
||||
useMemo(() => subscribeWco, []),
|
||||
getWcoSnapshot,
|
||||
@@ -261,7 +268,7 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
const scheme = snapshot.prefs.titleBarScheme
|
||||
const preset = scheme === 'preset' ? getShellPreset(snapshot.prefs.titleBarPresetId) : undefined
|
||||
const titleBarStrip = computeTitleBarStrip(
|
||||
desktopEnv, wco, scheme, preset, snapshot.prefs.titleBarStripPx,
|
||||
desktopEnv, wco, scheme, preset, snapshot.prefs.titleBarStripPx, desktopWindow,
|
||||
)
|
||||
const titleBarCompat = titleBarStrip > 0
|
||||
useEffect(() => {
|
||||
@@ -569,6 +576,26 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
referenceInChatShared(ctx, sessionId, path, isDir)
|
||||
}, [ctx, sessionId])
|
||||
|
||||
/**
|
||||
* The tab context menu's "reveal in the file manager" row. The host's
|
||||
* open-in-app capability is the ONLY path this plugin reveals through
|
||||
* (`ctx.remote.session.openWorkspacePath({action:'reveal'})`, shared with
|
||||
* the explorer's own reveal row via `createOpenInApp`); a deployment
|
||||
* without a desktop (plain web) answers false, which is logged and
|
||||
* otherwise a no-op — the bottom panel has no error strip to write to, and
|
||||
* a failed reveal must never take the strip down. Defined above the
|
||||
* no-session early return — a hook must never sit behind a conditional
|
||||
* return (React counts hooks per render).
|
||||
*/
|
||||
const openInApp = useMemo(() => createOpenInApp(ctx), [ctx])
|
||||
const revealTabFile = useCallback((path: string): void => {
|
||||
void openInApp.reveal(path).then((ok) => {
|
||||
if (!ok) console.error(`[dsh-better-sidebar] reveal in file manager failed: ${path}`)
|
||||
}).catch((error: unknown) => {
|
||||
console.error('[dsh-better-sidebar] reveal in file manager error:', error)
|
||||
})
|
||||
}, [openInApp])
|
||||
|
||||
if (state === undefined || sessionId === undefined) {
|
||||
// No conversation yet: the host stays mounted (the drag shield keeps
|
||||
// covering the region) but nothing is rendered — the toggle button lives
|
||||
@@ -769,6 +796,7 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
getTabIcon={tabIconOf}
|
||||
getTabBadge={tabBadgeOf}
|
||||
getTabRightActions={tabRightActionsOf}
|
||||
onRevealInFileManager={revealTabFile}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+33
-5
@@ -5,7 +5,8 @@
|
||||
* are draggable; dropping onto another tab inserts before it, dropping on the
|
||||
* strip background appends to this pane. Right-clicking a tab opens the tab
|
||||
* context menu (close / close others / close to the left / close to the
|
||||
* right, the close ones scoped to this pane).
|
||||
* right / close all — every close scoped to this pane — plus reveal the
|
||||
* right-clicked tab's file in the OS file manager).
|
||||
*/
|
||||
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
||||
import clsx from 'clsx'
|
||||
@@ -79,9 +80,18 @@ export function TabBar(props: {
|
||||
* render their own).
|
||||
*/
|
||||
getTabRightActions?: (tab: SidebarTab, paneId: string) => ReactNode
|
||||
/**
|
||||
* Reveal one tab's associated file in the OS file manager — the tab
|
||||
* context menu's reveal row, fed by the shell with the host's open-in-app
|
||||
* capability. The row is disabled for a tab with no associated file (no
|
||||
* `path`, e.g. the changes / tasks / side-chat / diff pages) and when the
|
||||
* shell passes no resolver at all.
|
||||
*/
|
||||
onRevealInFileManager?: (path: string) => void
|
||||
}) {
|
||||
const {
|
||||
paneId, tabs, active, onActivate, onClose, onNewTab, newTabOptions, onDropTab, getTabIcon, getTabBadge, getTabRightActions,
|
||||
onRevealInFileManager,
|
||||
} = props
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
// The tab right-click context menu: the target tab plus the cursor
|
||||
@@ -92,6 +102,12 @@ export function TabBar(props: {
|
||||
// The context target's index in the render-time tab snapshot; -1 when the
|
||||
// tab disappeared since the menu opened (the menu hides then).
|
||||
const tabMenuIndex = tabMenu === null ? -1 : tabs.findIndex(tab => tab.id === tabMenu.tabId)
|
||||
// The context target's associated file: `path` carries it for file tabs
|
||||
// (editor windows, folder windows included). The changes / tasks /
|
||||
// side-chat / diff pages have none — a diff's repo-relative ref is not a
|
||||
// path the host could reveal — so the reveal row greys out for them.
|
||||
const tabMenuPath = tabs[tabMenuIndex]?.path
|
||||
const canReveal = onRevealInFileManager !== undefined && tabMenuPath !== undefined && tabMenuPath !== ''
|
||||
|
||||
// The active tab's right-actions node, resolved up front so the render
|
||||
// below can skip the wrapper entirely when there is nothing to show (an
|
||||
@@ -284,10 +300,12 @@ export function TabBar(props: {
|
||||
{/*
|
||||
The tab context menu, positioned at the right-click cursor (portal
|
||||
so the panel's overflow clip cannot crop it). Close operations are
|
||||
scoped to THIS pane: "close others/left/right" walk the render-time
|
||||
tab snapshot and reuse the per-tab onClose path (which routes
|
||||
through the service), so the target tab is never closed and the
|
||||
pane never empties mid-loop.
|
||||
scoped to THIS pane: "close others/left/right/all" walk the
|
||||
render-time tab snapshot and reuse the per-tab onClose path (which
|
||||
routes through the service), so every closed tab runs its own
|
||||
lifecycle and the target tab is only closed by the operations that
|
||||
mean it (close / close all). "Close all" is always available: the
|
||||
menu only opens from a tab, so the pane always holds at least one.
|
||||
*/}
|
||||
<Menu
|
||||
open={tabMenu !== null && tabMenuIndex >= 0}
|
||||
@@ -297,6 +315,8 @@ export function TabBar(props: {
|
||||
{ id: 'closeOthers', label: t('closeOtherTabs'), ...(tabs.length <= 1 ? { disabled: true } : {}) },
|
||||
{ id: 'closeLeft', label: t('closeLeftTabs'), ...(tabMenuIndex <= 0 ? { disabled: true } : {}) },
|
||||
{ id: 'closeRight', label: t('closeRightTabs'), ...(tabMenuIndex >= tabs.length - 1 ? { disabled: true } : {}) },
|
||||
{ id: 'closeAll', label: t('closeAllTabs') },
|
||||
{ id: 'revealInFileManager', label: t('revealTabInFileManager'), ...(canReveal ? {} : { disabled: true }) },
|
||||
]}
|
||||
onSelect={(id) => {
|
||||
const target = tabMenu
|
||||
@@ -314,6 +334,14 @@ export function TabBar(props: {
|
||||
for (const tab of tabs.slice(0, index)) onClose(tab.id)
|
||||
} else if (id === 'closeRight') {
|
||||
for (const tab of tabs.slice(index + 1)) onClose(tab.id)
|
||||
} else if (id === 'closeAll') {
|
||||
// EVERY tab in this pane, the right-clicked one included (that
|
||||
// is what separates it from "close others") and the ones
|
||||
// scrolled out of the strip's viewport included.
|
||||
for (const tab of tabs) onClose(tab.id)
|
||||
} else if (id === 'revealInFileManager') {
|
||||
const path = tabs[index]?.path
|
||||
if (path !== undefined && path !== '') onRevealInFileManager?.(path)
|
||||
}
|
||||
}}
|
||||
portal
|
||||
|
||||
+62
-10
@@ -6,19 +6,33 @@
|
||||
* mid-session); `resetDesktopEnvForTests` clears the memo for unit tests.
|
||||
*
|
||||
* GEOMETRY POLICY: this module only REPORTS shell facts — it never decides
|
||||
* how to adapt. The strip height comes from standard signals first (the
|
||||
* Window Controls Overlay API, see wco.ts), then the documented contract
|
||||
* parameter `dsh-desktop-titlebar-inset` (a shell may stamp the real pixels
|
||||
* it reserves at the top), then the user's chosen scheme (preset / custom).
|
||||
* The legacy win32-advanced 32px constant is gone from the core: it lives
|
||||
* in the opt-in shell preset (shell-presets.ts) as a fallback for shells
|
||||
* without the WCO API.
|
||||
* how to adapt. The strip height comes from the shell's own window contract
|
||||
* when the shell publishes one (`ctx.desktopWindow` — see
|
||||
* {@link probeDesktopWindow}), then from standard signals (the Window
|
||||
* Controls Overlay API, see wco.ts), then the documented contract parameter
|
||||
* `dsh-desktop-titlebar-inset` (a shell may stamp the real pixels it reserves
|
||||
* at the top), then the user's chosen scheme (preset / custom). The legacy
|
||||
* win32-advanced 32px constant is gone from the core: it lives in the opt-in
|
||||
* shell preset (shell-presets.ts) as a fallback for shells without the WCO
|
||||
* API.
|
||||
*/
|
||||
import type { Context, SidebarDesktopWindowService } from '../context-types.ts'
|
||||
|
||||
/** The three presentation modes the official desktop shell documents. */
|
||||
export type DesktopMode = 'compatibility' | 'extended' | 'advanced'
|
||||
|
||||
export interface DesktopEnv {
|
||||
/** Running inside a desktop shell (any URL stamp or preload marker). */
|
||||
readonly desktop: boolean
|
||||
/** `advanced` = frameless/custom-titlebar shell; `compatibility` = native frame. */
|
||||
readonly mode: 'compatibility' | 'advanced' | null
|
||||
/**
|
||||
* `advanced` = the shell draws a compact caption row INTO the web content
|
||||
* (so the page itself has to yield those pixels);
|
||||
* `compatibility` / `extended` = the shell keeps a native/framed title bar
|
||||
* ABOVE the content (compatibility ships the complete upstream frame below
|
||||
* it, extended hosts the same surfaces itself) — both report a zero content
|
||||
* inset, i.e. the page starts below chrome the shell already owns.
|
||||
*/
|
||||
readonly mode: DesktopMode | null
|
||||
/** Shell platform stamp ('darwin' | 'win32' | …), lowercased, or null. */
|
||||
readonly platform: string | null
|
||||
/**
|
||||
@@ -45,7 +59,9 @@ export function parseDesktopEnv(): DesktopEnv {
|
||||
? new URLSearchParams(window.location.search.replace(/^\?/, ''))
|
||||
: new URLSearchParams()
|
||||
const modeParam = params.get('dsh-desktop-mode')
|
||||
const mode = modeParam === 'compatibility' || modeParam === 'advanced' ? modeParam : null
|
||||
const mode = modeParam === 'compatibility' || modeParam === 'extended' || modeParam === 'advanced'
|
||||
? modeParam
|
||||
: null
|
||||
const platformParam = params.get('dsh-desktop-platform')
|
||||
const platform = platformParam !== null && platformParam !== '' ? platformParam.toLowerCase() : null
|
||||
const desktop = mode !== null || hasPreloadMarker
|
||||
@@ -66,6 +82,42 @@ function parseTitlebarInset(raw: string | null): number {
|
||||
return Math.min(120, Math.max(0, Math.round(parsed)))
|
||||
}
|
||||
|
||||
/**
|
||||
* The desktop shell's own window contract (`ctx.desktopWindow`, a CLIENT
|
||||
* cordis service provided by the official Electron shell — see
|
||||
* docs/plugin-services of anywhere-labs/dsh-desktop), or undefined on a
|
||||
* plain browser page.
|
||||
*
|
||||
* This is the authority the whole geometry question belongs to: the shell
|
||||
* reports where IT starts placing the upstream content surface, so a shell
|
||||
* that already moved the page below its own title bar reports
|
||||
* `safeAreaInsets.top = 0` there and must NOT be compensated again by the
|
||||
* plugin's strip (which is what the `dsh-desktop-titlebar-inset` URL stamp
|
||||
* used to cause — a second 36px of blank space, issue #864).
|
||||
*
|
||||
* PROBED, never injected: `dsh.client.inject` treats a missing service as
|
||||
* "keep this plugin pending", and a plain browser never provides this one —
|
||||
* listing it would stop the whole plugin from ever mounting. Read at CALL
|
||||
* time rather than memoized like the URL stamps above: the service is
|
||||
* published by the shell's own client plugin fiber, so it can legitimately
|
||||
* be absent on the first read and present later.
|
||||
*
|
||||
* @param ctx - client context (any context without a `get` face — a minimal
|
||||
* test double — resolves to undefined).
|
||||
* @returns the shell's window service, or undefined when there is none.
|
||||
*/
|
||||
export function probeDesktopWindow(ctx: Context): SidebarDesktopWindowService | undefined {
|
||||
try {
|
||||
if (typeof ctx.get !== 'function') return undefined
|
||||
return ctx.get('desktopWindow') as SidebarDesktopWindowService | undefined
|
||||
} catch (error) {
|
||||
// Probing is best-effort by contract: an incompatible host leaves the
|
||||
// caller on the standard-signal chain instead of crashing the render.
|
||||
console.error('[dsh-better-sidebar] desktop-window probe failed', error)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute base for the plugin's own host transports — the HTTP routes
|
||||
* (`/sidebar/api/*`, `/sidebar/file`, `/sidebar/bundle/*`, …) and the
|
||||
|
||||
@@ -119,6 +119,8 @@ export const ar: Record<string, string> = {
|
||||
closeOtherTabs: 'إغلاق التبويبات الأخرى',
|
||||
closeLeftTabs: 'إغلاق التبويبات على اليسار',
|
||||
closeRightTabs: 'إغلاق التبويبات على اليمين',
|
||||
closeAllTabs: 'إغلاق كل التبويبات',
|
||||
revealTabInFileManager: 'إظهار الملف في مدير الملفات',
|
||||
pinTerminal: 'تثبيت الطرفية',
|
||||
pinAgentTerminal: 'تثبيت طرفية Agent',
|
||||
pinToWorkspace: 'تثبيت إلى مساحة العمل',
|
||||
|
||||
@@ -104,6 +104,8 @@ export const de: Record<string, string> = {
|
||||
closeOtherTabs: 'Andere Tabs schließen',
|
||||
closeLeftTabs: 'Tabs links schließen',
|
||||
closeRightTabs: 'Tabs rechts schließen',
|
||||
closeAllTabs: 'Alle Tabs schließen',
|
||||
revealTabInFileManager: 'Datei im Dateimanager anzeigen',
|
||||
pinTerminal: 'Terminal anheften',
|
||||
pinAgentTerminal: 'Agent-Terminal anheften',
|
||||
pinToWorkspace: 'An Arbeitsbereich anheften',
|
||||
|
||||
@@ -111,6 +111,8 @@ export const fr: Record<string, string> = {
|
||||
closeOtherTabs: 'Fermer les autres onglets',
|
||||
closeLeftTabs: 'Fermer les onglets à gauche',
|
||||
closeRightTabs: 'Fermer les onglets à droite',
|
||||
closeAllTabs: 'Fermer tous les onglets',
|
||||
revealTabInFileManager: 'Afficher le fichier dans le gestionnaire de fichiers',
|
||||
pinTerminal: 'Épingler le terminal',
|
||||
pinAgentTerminal: 'Épingler le terminal Agent',
|
||||
pinToWorkspace: 'Épingler à l\'espace de travail',
|
||||
|
||||
@@ -118,6 +118,8 @@ export const hi: Record<string, string> = {
|
||||
closeOtherTabs: 'अन्य टैब बंद करें',
|
||||
closeLeftTabs: 'बाएँ टैब बंद करें',
|
||||
closeRightTabs: 'दाएँ टैब बंद करें',
|
||||
closeAllTabs: 'सभी टैब बंद करें',
|
||||
revealTabInFileManager: 'फ़ाइल को फ़ाइल मैनेजर में दिखाएँ',
|
||||
pinTerminal: 'टर्मिनल पिन करें',
|
||||
pinAgentTerminal: 'Agent टर्मिनल पिन करें',
|
||||
pinToWorkspace: 'वर्कस्पेस पर पिन करें',
|
||||
|
||||
@@ -116,6 +116,8 @@ export const id: Record<string, string> = {
|
||||
closeOtherTabs: 'Tutup Tab Lain',
|
||||
closeLeftTabs: 'Tutup Tab di Kiri',
|
||||
closeRightTabs: 'Tutup Tab di Kanan',
|
||||
closeAllTabs: 'Tutup Semua Tab',
|
||||
revealTabInFileManager: 'Tampilkan Berkas di Pengelola Berkas',
|
||||
pinTerminal: 'Sematkan Terminal',
|
||||
pinAgentTerminal: 'Sematkan Terminal Agent',
|
||||
pinToWorkspace: 'Sematkan ke Workspace',
|
||||
|
||||
@@ -109,6 +109,8 @@ export const it: Record<string, string> = {
|
||||
closeOtherTabs: 'Chiudi le altre schede',
|
||||
closeLeftTabs: 'Chiudi le schede a sinistra',
|
||||
closeRightTabs: 'Chiudi le schede a destra',
|
||||
closeAllTabs: 'Chiudi tutte le schede',
|
||||
revealTabInFileManager: 'Mostra il file nel gestore file',
|
||||
pinTerminal: 'Blocca Terminale',
|
||||
pinAgentTerminal: 'Blocca Terminale Agent',
|
||||
pinToWorkspace: 'Blocca in Workspace',
|
||||
|
||||
@@ -118,6 +118,8 @@ export const ja: Record<string, string> = {
|
||||
closeOtherTabs: '他のタブを閉じる',
|
||||
closeLeftTabs: '左のタブを閉じる',
|
||||
closeRightTabs: '右のタブを閉じる',
|
||||
closeAllTabs: 'すべてのタブを閉じる',
|
||||
revealTabInFileManager: 'ファイルの場所を開く',
|
||||
pinTerminal: 'ターミナルを固定',
|
||||
pinAgentTerminal: 'Agent ターミナルを固定',
|
||||
pinToWorkspace: 'ワークスペースに固定',
|
||||
|
||||
@@ -110,6 +110,8 @@ export const ko: Record<string, string> = {
|
||||
closeOtherTabs: '다른 탭 닫기',
|
||||
closeLeftTabs: '왼쪽 탭 닫기',
|
||||
closeRightTabs: '오른쪽 탭 닫기',
|
||||
closeAllTabs: '모든 탭 닫기',
|
||||
revealTabInFileManager: '파일 위치 열기',
|
||||
pinTerminal: '터미널 고정',
|
||||
pinAgentTerminal: 'Agent 터미널 고정',
|
||||
pinToWorkspace: '워크스페이스에 고정',
|
||||
|
||||
@@ -116,6 +116,8 @@ export const nl: Record<string, string> = {
|
||||
closeOtherTabs: 'Andere tabbladen sluiten',
|
||||
closeLeftTabs: 'Tabbladen links sluiten',
|
||||
closeRightTabs: 'Tabbladen rechts sluiten',
|
||||
closeAllTabs: 'Alle tabbladen sluiten',
|
||||
revealTabInFileManager: 'Bestand tonen in bestandsbeheerder',
|
||||
pinTerminal: 'Terminal vastmaken',
|
||||
pinAgentTerminal: 'Agent-terminal vastmaken',
|
||||
pinToWorkspace: 'Vastmaken aan werkruimte',
|
||||
|
||||
@@ -120,6 +120,8 @@ export const pl: Record<string, string> = {
|
||||
closeOtherTabs: 'Zamknij inne karty',
|
||||
closeLeftTabs: 'Zamknij karty po lewej',
|
||||
closeRightTabs: 'Zamknij karty po prawej',
|
||||
closeAllTabs: 'Zamknij wszystkie karty',
|
||||
revealTabInFileManager: 'Pokaż plik w menedżerze plików',
|
||||
pinTerminal: 'Przypnij Terminal',
|
||||
pinAgentTerminal: 'Przypnij Terminal Agent',
|
||||
pinToWorkspace: 'Przypnij do obszaru roboczego',
|
||||
|
||||
@@ -101,6 +101,8 @@ export const pt: Record<string, string> = {
|
||||
closeOtherTabs: 'Fechar outras abas',
|
||||
closeLeftTabs: 'Fechar abas à esquerda',
|
||||
closeRightTabs: 'Fechar abas à direita',
|
||||
closeAllTabs: 'Fechar todas as abas',
|
||||
revealTabInFileManager: 'Mostrar arquivo no gerenciador de arquivos',
|
||||
pinTerminal: 'Fixar Terminal',
|
||||
pinAgentTerminal: 'Fixar Terminal do Agent',
|
||||
pinToWorkspace: 'Fixar no Workspace',
|
||||
|
||||
@@ -114,6 +114,8 @@ export const ru: Record<string, string> = {
|
||||
closeOtherTabs: 'Закрыть остальные вкладки',
|
||||
closeLeftTabs: 'Закрыть вкладки слева',
|
||||
closeRightTabs: 'Закрыть вкладки справа',
|
||||
closeAllTabs: 'Закрыть все вкладки',
|
||||
revealTabInFileManager: 'Показать файл в файловом менеджере',
|
||||
pinTerminal: 'Закрепить терминал',
|
||||
pinAgentTerminal: 'Закрепить терминал Agent',
|
||||
pinToWorkspace: 'Закрепить в рабочей области',
|
||||
|
||||
@@ -101,6 +101,8 @@ export const sv: Record<string, string> = {
|
||||
closeOtherTabs: 'Stäng andra flikar',
|
||||
closeLeftTabs: 'Stäng flikar till vänster',
|
||||
closeRightTabs: 'Stäng flikar till höger',
|
||||
closeAllTabs: 'Stäng alla flikar',
|
||||
revealTabInFileManager: 'Visa filen i filhanteraren',
|
||||
pinTerminal: 'Fäst Terminal',
|
||||
pinAgentTerminal: 'Fäst Agent-terminal',
|
||||
pinToWorkspace: 'Fäst på arbetsyta',
|
||||
|
||||
@@ -118,6 +118,8 @@ export const th: Record<string, string> = {
|
||||
closeOtherTabs: 'ปิด Tab อื่น',
|
||||
closeLeftTabs: 'ปิด Tab ด้านซ้าย',
|
||||
closeRightTabs: 'ปิด Tab ด้านขวา',
|
||||
closeAllTabs: 'ปิด Tab ทั้งหมด',
|
||||
revealTabInFileManager: 'แสดงไฟล์ในตัวจัดการไฟล์',
|
||||
pinTerminal: 'ปักหมุดเทอร์มินัล',
|
||||
pinAgentTerminal: 'ปักหมุดเทอร์มินัล Agent',
|
||||
pinToWorkspace: 'ปักหมุดไปยังพื้นที่ทำงาน',
|
||||
|
||||
@@ -118,6 +118,8 @@ export const tr: Record<string, string> = {
|
||||
closeOtherTabs: 'Diğer sekmeleri kapat',
|
||||
closeLeftTabs: 'Soldaki sekmeleri kapat',
|
||||
closeRightTabs: 'Sağdaki sekmeleri kapat',
|
||||
closeAllTabs: 'Tüm sekmeleri kapat',
|
||||
revealTabInFileManager: 'Dosyayı dosya yöneticisinde göster',
|
||||
pinTerminal: 'Terminali Sabitle',
|
||||
pinAgentTerminal: 'Agent Terminalini Sabitle',
|
||||
pinToWorkspace: 'Çalışma Alanına Sabitle',
|
||||
|
||||
@@ -118,6 +118,8 @@ export const vi: Record<string, string> = {
|
||||
closeOtherTabs: 'Đóng các tab khác',
|
||||
closeLeftTabs: 'Đóng tab bên trái',
|
||||
closeRightTabs: 'Đóng tab bên phải',
|
||||
closeAllTabs: 'Đóng tất cả tab',
|
||||
revealTabInFileManager: 'Hiển thị tệp trong trình quản lý tệp',
|
||||
pinTerminal: 'Ghim Terminal',
|
||||
pinAgentTerminal: 'Ghim Terminal Agent',
|
||||
pinToWorkspace: 'Ghim vào Workspace',
|
||||
|
||||
@@ -133,6 +133,8 @@ export const zhHK: Record<string, string> = {
|
||||
closeOtherTabs: '關閉其他標籤',
|
||||
closeLeftTabs: '關閉左側標籤',
|
||||
closeRightTabs: '關閉右側標籤',
|
||||
closeAllTabs: '關閉全部標籤',
|
||||
revealTabInFileManager: '在檔案總管中定位',
|
||||
pinTerminal: '固定終端',
|
||||
pinAgentTerminal: '固定 Agent 終端',
|
||||
pinToWorkspace: '固定到工作區',
|
||||
|
||||
@@ -133,6 +133,8 @@ export const zhMO: Record<string, string> = {
|
||||
closeOtherTabs: '關閉其他標籤',
|
||||
closeLeftTabs: '關閉左側標籤',
|
||||
closeRightTabs: '關閉右側標籤',
|
||||
closeAllTabs: '關閉全部標籤',
|
||||
revealTabInFileManager: '在檔案總管中定位',
|
||||
pinTerminal: '固定終端',
|
||||
pinAgentTerminal: '固定 Agent 終端',
|
||||
pinToWorkspace: '固定到工作區',
|
||||
|
||||
@@ -133,6 +133,8 @@ export const zhTW: Record<string, string> = {
|
||||
closeOtherTabs: '關閉其他標籤',
|
||||
closeLeftTabs: '關閉左側標籤',
|
||||
closeRightTabs: '關閉右側標籤',
|
||||
closeAllTabs: '關閉全部標籤',
|
||||
revealTabInFileManager: '在檔案總管中定位',
|
||||
pinTerminal: '固定終端',
|
||||
pinAgentTerminal: '固定 Agent 終端',
|
||||
pinToWorkspace: '固定到工作區',
|
||||
|
||||
@@ -130,6 +130,8 @@ export const zh = {
|
||||
closeOtherTabs: '关闭其他页签',
|
||||
closeLeftTabs: '关闭左侧页签',
|
||||
closeRightTabs: '关闭右侧页签',
|
||||
closeAllTabs: '关闭全部页签',
|
||||
revealTabInFileManager: '在资源管理器中定位',
|
||||
pinTerminal: '固定终端',
|
||||
pinAgentTerminal: '固定 Agent 终端',
|
||||
pinToWorkspace: '固定到工作区',
|
||||
@@ -696,6 +698,8 @@ export const en: Record<keyof typeof zh, string> = {
|
||||
closeOtherTabs: 'Close Other Tabs',
|
||||
closeLeftTabs: 'Close Tabs to the Left',
|
||||
closeRightTabs: 'Close Tabs to the Right',
|
||||
closeAllTabs: 'Close All Tabs',
|
||||
revealTabInFileManager: 'Reveal in File Manager',
|
||||
pinTerminal: 'Pin Terminal',
|
||||
pinAgentTerminal: 'Pin Agent Terminal',
|
||||
pinToWorkspace: 'Pin to Workspace',
|
||||
|
||||
@@ -24,8 +24,9 @@ export interface ShellPreset {
|
||||
readonly desc: string | (() => string)
|
||||
/**
|
||||
* The top strip (px) this shell reserves over web content, per
|
||||
* environment — the fallback used when neither the standard WCO API nor
|
||||
* the `dsh-desktop-titlebar-inset` contract parameter is available.
|
||||
* environment — the fallback used when neither the shell's own
|
||||
* `ctx.desktopWindow` contract, nor the standard WCO API, nor the
|
||||
* `dsh-desktop-titlebar-inset` contract parameter is available.
|
||||
* Return undefined when the shell needs no strip in that environment.
|
||||
* MUST be pure (called during render).
|
||||
*/
|
||||
@@ -51,13 +52,19 @@ export interface ShellPreset {
|
||||
* a 20px caption row (traffic lights top-left), win32 draws the native
|
||||
* window controls in a ~32px overlay (WCO reports the real height when
|
||||
* available, which the auto scheme already consumes; the 32 is the
|
||||
* no-WCO fallback). Compatibility mode keeps the native frame — nothing.
|
||||
* no-WCO fallback). Compatibility and extended modes keep the shell's own
|
||||
* frame ABOVE the web content — the shell has already pushed the page below
|
||||
* it (and, on shells new enough to publish `ctx.desktopWindow`, reports
|
||||
* `safeAreaInsets.top = 0`), so nothing is due here: the
|
||||
* `env.mode !== 'advanced'` guard below is what keeps an extended shell from
|
||||
* inheriting advanced's caption-row value.
|
||||
*/
|
||||
const DSH_DESKTOP: ShellPreset = {
|
||||
id: 'dsh-desktop',
|
||||
title: 'DeepSeek Harness Desktop',
|
||||
desc: () => t('presetDshDesktopDesc'),
|
||||
stripFor: (env) => {
|
||||
// Advanced only — compatibility / extended own the region themselves.
|
||||
if (env.mode !== 'advanced') return undefined
|
||||
if (env.platform === 'darwin') return 20
|
||||
if (env.platform === 'win32') return 32
|
||||
|
||||
@@ -35,6 +35,19 @@
|
||||
:global([data-dsh-panel-host]) {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
/* Explicit viewport height — NOT a containing-block derivation (issue
|
||||
#616). `inset: 0` alone sizes a fixed box from its containing block, and
|
||||
a page-level `filter` / `backdrop-filter` / `transform` — exactly what a
|
||||
glass skin puts on the shell wrapper or on <body> itself — REPLACES that
|
||||
containing block with the ancestor's own padding box. The shell's content
|
||||
is itself fixed/viewport-sized, so that box is zero-height: the host
|
||||
collapses to 0px and the whole native right sidebar goes invisible while
|
||||
its DOM (and every panel in it) is fully present. `vh` is measured
|
||||
against the viewport instead, so the height survives any ancestor's
|
||||
containing-block games; the over-constrained triple (top: 0 + height +
|
||||
bottom: 0) resolves by ignoring `bottom`, keeping this a top-anchored
|
||||
viewport-height layer. */
|
||||
height: 100vh;
|
||||
z-index: 25;
|
||||
pointer-events: none;
|
||||
/* Clip at the viewport edge: collapsed panels slide off-screen with
|
||||
@@ -42,7 +55,8 @@
|
||||
contributes to its ancestors' scrollable overflow — without this the
|
||||
hidden panels extended the document's scrollable area, making the whole
|
||||
page draggable left-right and up-down while any panel was collapsed.
|
||||
The host is exactly viewport-sized (inset: 0), so the clip is invisible
|
||||
The host is exactly viewport-sized (inset: 0 + the explicit 100vh
|
||||
height above), so the clip is invisible
|
||||
until a panel slides in from the edge; internal scroll containers and
|
||||
the app's fixed overlay stack are unaffected. `clip`, not `hidden`: a
|
||||
hidden box stays a PROGRAMMATICALLY scrollable container, and a
|
||||
|
||||
@@ -148,8 +148,13 @@ function LeafView(props: {
|
||||
getTabIcon?: (tab: SidebarTab) => ReactNode
|
||||
getTabBadge?: (tab: SidebarTab) => ReactNode
|
||||
getTabRightActions?: (tab: SidebarTab, paneId: string) => ReactNode
|
||||
/**
|
||||
* Reveal a tab's file in the OS file manager (the tab context menu's
|
||||
* reveal row; see TabBar). Absent → that row stays disabled.
|
||||
*/
|
||||
onRevealInFileManager?: (path: string) => void
|
||||
}) {
|
||||
const { leaf, newTabOptions, actions, onNewTab, renderTab, getTabIcon, getTabBadge, getTabRightActions } = props
|
||||
const { leaf, newTabOptions, actions, onNewTab, renderTab, getTabIcon, getTabBadge, getTabRightActions, onRevealInFileManager } = props
|
||||
const [dropZone, setDropZone] = useState<DropZone | null>(null)
|
||||
const activeTab = leaf.tabs.find(tab => tab.id === leaf.active) ?? leaf.tabs[leaf.tabs.length - 1]
|
||||
|
||||
@@ -206,6 +211,7 @@ function LeafView(props: {
|
||||
getTabIcon={getTabIcon}
|
||||
getTabBadge={getTabBadge}
|
||||
getTabRightActions={getTabRightActions}
|
||||
onRevealInFileManager={onRevealInFileManager}
|
||||
onDropTab={(payload, before) => {
|
||||
if (before === null) actions.moveTabToEdge(payload, leaf.id, 'center')
|
||||
else actions.moveTabBefore(payload, leaf.id, before)
|
||||
@@ -246,8 +252,9 @@ function NodeView(props: {
|
||||
getTabIcon?: (tab: SidebarTab) => ReactNode
|
||||
getTabBadge?: (tab: SidebarTab) => ReactNode
|
||||
getTabRightActions?: (tab: SidebarTab, paneId: string) => ReactNode
|
||||
onRevealInFileManager?: (path: string) => void
|
||||
}) {
|
||||
const { node, state, newTabOptions, actions, onNewTab, renderTab, getTabIcon, getTabBadge, getTabRightActions } = props
|
||||
const { node, state, newTabOptions, actions, onNewTab, renderTab, getTabIcon, getTabBadge, getTabRightActions, onRevealInFileManager } = props
|
||||
if (node.kind === 'leaf') {
|
||||
return (
|
||||
<LeafView
|
||||
@@ -259,6 +266,7 @@ function NodeView(props: {
|
||||
getTabIcon={getTabIcon}
|
||||
getTabBadge={getTabBadge}
|
||||
getTabRightActions={getTabRightActions}
|
||||
onRevealInFileManager={onRevealInFileManager}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -287,6 +295,7 @@ function NodeView(props: {
|
||||
getTabIcon={getTabIcon}
|
||||
getTabBadge={getTabBadge}
|
||||
getTabRightActions={getTabRightActions}
|
||||
onRevealInFileManager={onRevealInFileManager}
|
||||
/>
|
||||
</div>
|
||||
</Fragment>
|
||||
@@ -309,8 +318,11 @@ export function Workbench(props: {
|
||||
getTabIcon?: (tab: SidebarTab) => ReactNode
|
||||
getTabBadge?: (tab: SidebarTab) => ReactNode
|
||||
getTabRightActions?: (tab: SidebarTab, paneId: string) => ReactNode
|
||||
/** Reveal a tab's file in the OS file manager (see TabBar); absent → the
|
||||
* tab context menu's reveal row is disabled. */
|
||||
onRevealInFileManager?: (path: string) => void
|
||||
}) {
|
||||
const { state, tree, newTabOptions, actions, onNewTab, renderTab, getTabIcon, getTabBadge, getTabRightActions } = props
|
||||
const { state, tree, newTabOptions, actions, onNewTab, renderTab, getTabIcon, getTabBadge, getTabRightActions, onRevealInFileManager } = props
|
||||
return (
|
||||
<div className={css.workbench}>
|
||||
<NodeView
|
||||
@@ -323,6 +335,7 @@ export function Workbench(props: {
|
||||
getTabIcon={getTabIcon}
|
||||
getTabBadge={getTabBadge}
|
||||
getTabRightActions={getTabRightActions}
|
||||
onRevealInFileManager={onRevealInFileManager}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -5,13 +5,20 @@
|
||||
*
|
||||
* 0. `web` scheme — EXPLICIT "DSH official web": never adapt, not even
|
||||
* standard WCO geometry (the user declares the plain web UI).
|
||||
* 1. Window Controls Overlay real geometry (standard API, authoritative
|
||||
* 1. The desktop shell's own window contract (`ctx.desktopWindow`, see
|
||||
* desktop-env.ts) — authoritative when present: `safeAreaInsets.top` is
|
||||
* where the SHELL starts placing the content, so it already accounts for
|
||||
* everything the shell reserved. This is what keeps a shell that moved
|
||||
* the page below its own title bar (compatibility / extended, inset 0)
|
||||
* from being compensated a second time by the URL stamp below.
|
||||
* 2. Window Controls Overlay real geometry (standard API, authoritative
|
||||
* when present — even 0, e.g. the overlay is hidden while maximized).
|
||||
* 2. The `dsh-desktop-titlebar-inset` URL contract parameter (a shell
|
||||
* declares the exact pixels it reserves).
|
||||
* 3. The active shell preset's strip (scheme `preset` — opt-in data).
|
||||
* 4. The legacy manual `titleBarStripPx` (scheme `custom`).
|
||||
* 5. 0 — plain-browser semantics, nothing modified.
|
||||
* 3. The `dsh-desktop-titlebar-inset` URL contract parameter (a shell
|
||||
* declares the exact pixels it reserves) — only for shells old enough
|
||||
* not to publish the service above.
|
||||
* 4. The active shell preset's strip (scheme `preset` — opt-in data).
|
||||
* 5. The legacy manual `titleBarStripPx` (scheme `custom`).
|
||||
* 6. 0 — plain-browser semantics, nothing modified.
|
||||
*
|
||||
* The result drives `--dsh-title-bar-strip` + `body[data-dsh-title-bar-compat]`
|
||||
* exactly like the legacy boolean did; only the VALUE source changed.
|
||||
@@ -19,6 +26,7 @@
|
||||
import type { DesktopEnv } from './desktop-env.ts'
|
||||
import type { TitleBarScheme } from '../prefs-shared.ts'
|
||||
import type { WcoSnapshot } from './wco.ts'
|
||||
import type { SidebarDesktopWindowService } from '../context-types.ts'
|
||||
import { presetStripFor, type ShellPreset } from './shell-presets.ts'
|
||||
|
||||
export function computeTitleBarStrip(
|
||||
@@ -27,8 +35,16 @@ export function computeTitleBarStrip(
|
||||
scheme: TitleBarScheme,
|
||||
preset: ShellPreset | undefined,
|
||||
customStripPx: number,
|
||||
desktopWindow?: SidebarDesktopWindowService | undefined,
|
||||
): number {
|
||||
if (scheme === 'web') return 0
|
||||
// The shell's own contract outranks every signal below, including a URL
|
||||
// stamp the shell itself published: the stamp is the shell's OWN reserve,
|
||||
// and the shell's `safeAreaInsets.top` is that reserve already applied.
|
||||
// A service without a usable `top` (an older/incompatible host) falls
|
||||
// through to the standard chain instead of throwing mid-render.
|
||||
const shellTop = desktopWindow?.safeAreaInsets?.top
|
||||
if (typeof shellTop === 'number' && Number.isFinite(shellTop)) return shellTop
|
||||
if (wco.present) return wco.height
|
||||
if (env.titlebarInset > 0) return env.titlebarInset
|
||||
if (scheme === 'preset') return presetStripFor(preset, env) ?? 0
|
||||
|
||||
Reference in new issue
Block a user