@chatcode/cco-better-sidebar 0.18.0-alpha.3 → 0.18.0-rc.11
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/README.md +24 -5
- package/README_EN.md +24 -5
- package/cordis.patch.yml +6 -5
- package/lib/client-editor.js +10919 -362
- package/lib/client-mermaid.js +10810 -275
- package/lib/client-registry.js +3760 -2145
- package/lib/client-terminal.js +402 -261
- package/lib/client.js +3758 -2143
- package/lib/index.js +264 -46
- package/lib/types/client/LogoutConfirmDialog.d.ts +5 -0
- package/lib/types/client/PluginMarketSettingsSection.d.ts +7 -0
- package/lib/types/client/PluginMarketView.d.ts +7 -0
- package/lib/types/client/PluginProjectPicker.d.ts +13 -0
- package/lib/types/client/api.d.ts +17 -0
- package/lib/types/client/builtins/tabs.d.ts +13 -1
- package/lib/types/client/icons.d.ts +26 -8
- package/lib/types/client/locales.d.ts +39 -0
- package/lib/types/client/plugin-market-catalog.d.ts +25 -0
- package/lib/types/client/service.d.ts +1 -1
- package/lib/types/client/ui-tweaks/archive.d.ts +3 -7
- package/lib/types/client/ui-tweaks/branding.d.ts +1 -1
- package/lib/types/client/ui-tweaks/index.d.ts +3 -3
- package/lib/types/client/ui-tweaks/sidebar-header.d.ts +6 -0
- package/lib/types/client/ui-tweaks/typography.d.ts +9 -0
- package/lib/types/config.d.ts +4 -3
- package/lib/types/context-types.d.ts +12 -14
- package/lib/types/login-page-script.d.ts +2 -0
- package/lib/types/login-route.d.ts +2 -0
- package/lib/types/plugin-market-api.d.ts +5 -0
- package/lib/types/plugin-market-shared.d.ts +59 -0
- package/lib/types/prefs-shared.d.ts +1 -1
- package/lib/types/pty-deps.d.ts +1 -1
- package/lib/types/ui-tweaks/config.d.ts +6 -7
- package/lib/types/ui-tweaks/index.d.ts +2 -3
- package/package.json +4 -3
- package/src/client/AccountMenu.tsx +12 -2
- package/src/client/BrowserView.tsx +1 -1
- package/src/client/DiffTab.tsx +1 -1
- package/src/client/EditorHost.tsx +1 -1
- package/src/client/FileTree.tsx +10 -5
- package/src/client/FreeWindow.tsx +2 -1
- package/src/client/GitView.tsx +7 -3
- package/src/client/LogoutConfirmDialog.tsx +39 -0
- package/src/client/PluginMarketSettingsSection.tsx +55 -0
- package/src/client/PluginMarketView.module.css +50 -0
- package/src/client/PluginMarketView.tsx +243 -0
- package/src/client/PluginProjectPicker.tsx +73 -0
- package/src/client/SideCardSection.tsx +2 -23
- package/src/client/Sidebar.tsx +2 -2
- package/src/client/TabBar.tsx +2 -4
- package/src/client/TextEditor.tsx +2 -1
- package/src/client/TreePanel.tsx +1 -2
- package/src/client/UsageHeatmapSection.tsx +1 -1
- package/src/client/api.ts +9 -0
- package/src/client/builtins/tabs.tsx +25 -5
- package/src/client/builtins/viewers.tsx +2 -1
- package/src/client/icons.tsx +57 -4
- package/src/client/index.tsx +10 -1
- package/src/client/intercept.tsx +1 -1
- package/src/client/locales-ja.ts +39 -0
- package/src/client/locales.ts +118 -1
- package/src/client/md-toc.tsx +1 -1
- package/src/client/mermaid.tsx +2 -1
- package/src/client/open-with-settings.tsx +1 -1
- package/src/client/plugin-market-catalog.ts +90 -0
- package/src/client/service.ts +1 -1
- package/src/client/sidebar.module.css +81 -19
- package/src/client/ui-tweaks/archive.tsx +6 -56
- package/src/client/ui-tweaks/branding.tsx +80 -28
- package/src/client/ui-tweaks/index.tsx +45 -108
- package/src/client/ui-tweaks/sidebar-header.ts +73 -0
- package/src/client/ui-tweaks/typography.ts +38 -0
- package/src/config.ts +22 -2
- package/src/context-types.ts +5 -15
- package/src/index.ts +24 -20
- package/src/login-page-script.ts +107 -0
- package/src/login-route.ts +7 -4
- package/src/plugin-market-api.ts +88 -0
- package/src/plugin-market-shared.ts +30 -0
- package/src/prefs-shared.ts +1 -1
- package/src/pty-deps.ts +2 -2
- package/src/ui-tweaks/config.ts +12 -12
- package/src/ui-tweaks/index.ts +7 -13
|
@@ -11,18 +11,15 @@
|
|
|
11
11
|
* - **恢复** (Restore): remove the session from the archive set — its log and
|
|
12
12
|
* workspace slot are kept, so the conversation reappears in the normal
|
|
13
13
|
* sidebar list.
|
|
14
|
-
* -
|
|
15
|
-
* durable log, workspace accounting, archive-set entry and caches; the list
|
|
16
|
-
* then refreshes so the row (and the session itself) disappear.
|
|
17
|
-
* - **全部恢复 / 全部删除**: the same actions for every archived session.
|
|
14
|
+
* - **全部恢复**: restore every archived session.
|
|
18
15
|
*
|
|
19
16
|
* Live (open/running) sessions are refused by the server; the client maps the
|
|
20
17
|
* `session-live` error code to localized copy.
|
|
21
18
|
* @module dsh-ui-tweaks/client/archive
|
|
22
19
|
*/
|
|
23
20
|
|
|
24
|
-
import {
|
|
25
|
-
import type {
|
|
21
|
+
import { useMemo, useState, useSyncExternalStore } from 'react'
|
|
22
|
+
import type { SessionListState, SessionSummary } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
26
23
|
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
|
27
24
|
import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'
|
|
28
25
|
import type { SettingsClient } from './index.tsx'
|
|
@@ -73,12 +70,6 @@ function errorMessage(error: unknown, t: Translate): string {
|
|
|
73
70
|
return error instanceof Error ? error.message : String(error)
|
|
74
71
|
}
|
|
75
72
|
|
|
76
|
-
/** Re-pull the host session list after a permanent delete (the outward
|
|
77
|
-
* ISessions face omits refresh; the concrete runtime provides it). */
|
|
78
|
-
function refreshSessions(sessionsService: ISessions): void {
|
|
79
|
-
void (sessionsService as unknown as { refresh(): Promise<void> }).refresh()
|
|
80
|
-
}
|
|
81
|
-
|
|
82
73
|
/** Workspace display title: the path's last non-empty segment. */
|
|
83
74
|
function basenameOf(path: string | undefined): string {
|
|
84
75
|
if (path === undefined || path === '') return ''
|
|
@@ -143,35 +134,21 @@ interface ArchiveRow {
|
|
|
143
134
|
export interface ArchiveSectionProps {
|
|
144
135
|
controller: SettingsClient
|
|
145
136
|
t: Translate
|
|
146
|
-
sessionsService: ISessions
|
|
147
137
|
/** Framework standard feeds: session list + workspace archive set. */
|
|
148
138
|
useSessions: SnapshotSelectorHook<SessionListState>
|
|
149
139
|
useWorkspaces: SnapshotSelectorHook<WorkspaceSnapshot>
|
|
150
140
|
}
|
|
151
141
|
|
|
152
|
-
export function ArchiveSection({ controller, t,
|
|
142
|
+
export function ArchiveSection({ controller, t, useSessions, useWorkspaces }: ArchiveSectionProps) {
|
|
153
143
|
const settingsState = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot)
|
|
154
144
|
const enabled = settingsState.value?.archiveManagerEnabled === true
|
|
155
145
|
const sessions = useSessions(state => state)
|
|
156
146
|
const workspaces = useWorkspaces(state => state)
|
|
157
|
-
const [confirmId, setConfirmId] = useState<string | null>(null)
|
|
158
|
-
const [confirmAll, setConfirmAll] = useState(false)
|
|
159
147
|
const [busy, setBusy] = useState<string | null>(null)
|
|
160
148
|
const [error, setError] = useState<string | null>(null)
|
|
161
149
|
const timeFormatter = useMemo(() => new Intl.RelativeTimeFormat(navigator.language, { numeric: 'auto' }), [])
|
|
162
150
|
const now = Date.now()
|
|
163
151
|
|
|
164
|
-
useEffect(() => {
|
|
165
|
-
if (confirmId === null) return
|
|
166
|
-
const timer = window.setTimeout(() => { setConfirmId(current => (current === confirmId ? null : current)) }, 3000)
|
|
167
|
-
return () => { window.clearTimeout(timer) }
|
|
168
|
-
}, [confirmId])
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
if (!confirmAll) return
|
|
171
|
-
const timer = window.setTimeout(() => { setConfirmAll(false) }, 3000)
|
|
172
|
-
return () => { window.clearTimeout(timer) }
|
|
173
|
-
}, [confirmAll])
|
|
174
|
-
|
|
175
152
|
const rows: ArchiveRow[] = useMemo(() => {
|
|
176
153
|
const byId = sessions.byId
|
|
177
154
|
return workspaces.archivedSessionIds.map(id => ({ id, summary: byId[id] })).sort((a, b) => {
|
|
@@ -181,14 +158,14 @@ export function ArchiveSection({ controller, t, sessionsService, useSessions, us
|
|
|
181
158
|
})
|
|
182
159
|
}, [workspaces.archivedSessionIds, sessions.byId])
|
|
183
160
|
|
|
184
|
-
const run = (key: string, body: unknown
|
|
161
|
+
const run = (key: string, body: unknown): void => {
|
|
185
162
|
setBusy(key)
|
|
186
163
|
setError(null)
|
|
187
164
|
void archiveRequest<ArchiveSnapshot>({
|
|
188
165
|
method: 'POST',
|
|
189
166
|
headers: { 'Content-Type': 'application/json' },
|
|
190
167
|
body: JSON.stringify(body),
|
|
191
|
-
}).
|
|
168
|
+
}).catch((reason: unknown) => {
|
|
192
169
|
setError(errorMessage(reason, t))
|
|
193
170
|
}).finally(() => { setBusy(current => (current === key ? null : current)) })
|
|
194
171
|
}
|
|
@@ -197,28 +174,10 @@ export function ArchiveSection({ controller, t, sessionsService, useSessions, us
|
|
|
197
174
|
run(`restore:${id}`, { action: 'restore', sessionId: id })
|
|
198
175
|
}
|
|
199
176
|
|
|
200
|
-
const remove = (id: string): void => {
|
|
201
|
-
if (confirmId !== id) {
|
|
202
|
-
setConfirmId(id)
|
|
203
|
-
return
|
|
204
|
-
}
|
|
205
|
-
setConfirmId(null)
|
|
206
|
-
run(`delete:${id}`, { action: 'delete', sessionId: id }, () => { refreshSessions(sessionsService) })
|
|
207
|
-
}
|
|
208
|
-
|
|
209
177
|
const restoreAll = (): void => {
|
|
210
178
|
run('restore-all', { action: 'restore-all' })
|
|
211
179
|
}
|
|
212
180
|
|
|
213
|
-
const removeAll = (): void => {
|
|
214
|
-
if (!confirmAll) {
|
|
215
|
-
setConfirmAll(true)
|
|
216
|
-
return
|
|
217
|
-
}
|
|
218
|
-
setConfirmAll(false)
|
|
219
|
-
run('delete-all', { action: 'delete-all' }, () => { refreshSessions(sessionsService) })
|
|
220
|
-
}
|
|
221
|
-
|
|
222
181
|
if (!enabled) {
|
|
223
182
|
return (
|
|
224
183
|
<div className="dut-arc">
|
|
@@ -244,7 +203,6 @@ export function ArchiveSection({ controller, t, sessionsService, useSessions, us
|
|
|
244
203
|
{rows.length > 1 ? (
|
|
245
204
|
<>
|
|
246
205
|
<button type="button" className="dut-arc-btn" disabled={busy !== null} onClick={restoreAll}>{busy === 'restore-all' ? t('archiveRestoring') : t('archiveRestoreAll')}</button>
|
|
247
|
-
<button type="button" className={'dut-arc-btn dut-arc-del' + (confirmAll ? ' dut-arc-confirm' : '')} disabled={busy !== null} onClick={removeAll}>{busy === 'delete-all' ? t('archiveDeleteAll') + '…' : confirmAll ? t('archiveDeleteAll') + '?' : t('archiveDeleteAll')}</button>
|
|
248
206
|
</>
|
|
249
207
|
) : null}
|
|
250
208
|
</div>
|
|
@@ -263,14 +221,6 @@ export function ArchiveSection({ controller, t, sessionsService, useSessions, us
|
|
|
263
221
|
{sub !== '' ? <span className="dut-arc-sub">{sub}</span> : null}
|
|
264
222
|
</div>
|
|
265
223
|
<button type="button" className="dut-arc-btn" disabled={busy !== null} onClick={() => { restore(row.id) }}>{busy === `restore:${row.id}` ? t('archiveRestoring') : t('archiveRestore')}</button>
|
|
266
|
-
<button
|
|
267
|
-
type="button"
|
|
268
|
-
className={'dut-arc-btn dut-arc-del' + (confirmId === row.id ? ' dut-arc-confirm' : '')}
|
|
269
|
-
disabled={busy !== null}
|
|
270
|
-
onClick={() => { remove(row.id) }}
|
|
271
|
-
>
|
|
272
|
-
{busy === `delete:${row.id}` ? t('archiveDelete') + '…' : confirmId === row.id ? t('archiveDelete') + '?' : t('archiveDelete')}
|
|
273
|
-
</button>
|
|
274
224
|
</div>
|
|
275
225
|
)
|
|
276
226
|
})}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { ReactNode } from 'react'
|
|
11
|
+
import { clearSidebarHeader, SIDEBAR_HEADER_CSS, syncSidebarHeader } from './sidebar-header.ts'
|
|
11
12
|
|
|
12
13
|
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
13
14
|
interface SlotMap {
|
|
@@ -28,12 +29,33 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
28
29
|
export const PROJECT_LOGO_URL = '/_dsh/ui-tweaks/assets/logo.svg'
|
|
29
30
|
const PROJECT_NAME = 'ChatCode CLI'
|
|
30
31
|
const HERO_TITLE = '与世界,深一度对话'
|
|
31
|
-
const LEGACY_HOST_BRAND_TEXT = /DSH\s*(?:Local\s*Build|本地构建)|ChatCode\s*CLI/giu
|
|
32
|
-
const
|
|
32
|
+
const LEGACY_HOST_BRAND_TEXT = /DSH\s*(?:Local\s*Build|本地构建)|DeepSeek\s*Harness|ChatCode\s*CLI/giu
|
|
33
|
+
const LEGACY_HOST_BRAND_LABEL_TEXT = /^(?:DSH\s*(?:Local\s*Build|本地构建)|ChatCode\s*CLI)$/iu
|
|
34
|
+
const BRAND_SURFACE = '[class*="brandIdentity"],[class*="brandName"],[class*="headline"],.dut-sidebar-brand-name'
|
|
35
|
+
const USER_CONTENT = 'input,textarea,[contenteditable],[role="textbox"],pre,code,script,style'
|
|
33
36
|
const HOST_BUILD_VERSION_TEXT = /^v?\d+\.\d+\.\d+(?:[-+][0-9a-z.-]+)*$/iu
|
|
34
37
|
const HERO_HEADLINE = /探索未至之境/u
|
|
35
38
|
const HERO_PREVIEW_TEXT = /^(?:预览版|Preview)$/iu
|
|
36
39
|
const FAVICON_MARKER = 'data-dut-project-favicon'
|
|
40
|
+
const VERSION_NOTICE_MARKER = 'data-dut-version-notice'
|
|
41
|
+
const VERSION_NOTICE = {
|
|
42
|
+
en: {
|
|
43
|
+
legacyTitle: 'Internal Testing Notice',
|
|
44
|
+
title: 'Version Usage Notice',
|
|
45
|
+
paragraphs: [
|
|
46
|
+
'ChatCode CLI is currently evolving rapidly, and its features and user experience will continue to improve. If you encounter any issues or have feedback or suggestions, please join our DingTalk group to share them.',
|
|
47
|
+
'DingTalk group ID: 178730000511',
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
zh: {
|
|
51
|
+
legacyTitle: '内测声明',
|
|
52
|
+
title: '版本使用声明',
|
|
53
|
+
paragraphs: [
|
|
54
|
+
'ChatCode CLI 当前版本处于快速迭代阶段,相关功能与使用体验将持续优化。如您在使用过程中遇到问题,或有任何意见与建议,欢迎加入钉钉交流群反馈。',
|
|
55
|
+
'钉钉群号:178730000511',
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
} as const
|
|
37
59
|
|
|
38
60
|
/** Reusable rendering of the packaged project logo. */
|
|
39
61
|
export function ProjectLogoIcon({ className = '' }: { className?: string }): ReactNode {
|
|
@@ -68,14 +90,11 @@ body:not([data-ds-dark-theme]) .dut-unicom-primary-action:active{transform:trans
|
|
|
68
90
|
hovered, the host owns the complete interaction treatment again. */
|
|
69
91
|
body[data-ds-dark-theme] .dut-unicom-primary-action:not(:hover){background:#9B0B09 !important}
|
|
70
92
|
.dut-project-logo{display:block;object-fit:contain}
|
|
71
|
-
.dut-left-logo{width:
|
|
72
|
-
.dut-brand-title{font-
|
|
73
|
-
.dut-sidebar-logo{width:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
44px knot is not cropped by that host-owned overflow boundary. */
|
|
77
|
-
[class*="brandIdentity"]:has(.dut-sidebar-logo){height:44px !important}
|
|
78
|
-
.dut-sidebar-brand-name{font-size:18px !important;line-height:22px !important;font-weight:600 !important;letter-spacing:0 !important;white-space:nowrap}
|
|
93
|
+
.dut-left-logo{width:24px !important;height:24px !important}
|
|
94
|
+
.dut-brand-title{font:var(--dsw-font-s-strong-14) !important}
|
|
95
|
+
.dut-sidebar-logo{width:24px !important;height:24px !important}
|
|
96
|
+
.dut-sidebar-brand-name{font:var(--dsw-font-s-strong-14) !important;letter-spacing:-.01em !important;white-space:nowrap}
|
|
97
|
+
${SIDEBAR_HEADER_CSS}
|
|
79
98
|
.dut-brand-version{display:none !important}
|
|
80
99
|
.dut-hero-preview{display:none !important}
|
|
81
100
|
.dut-hero-logo{width:60px !important;height:60px !important}
|
|
@@ -85,8 +104,12 @@ body[data-ds-dark-theme] .dut-unicom-primary-action:not(:hover){background:#9B0B
|
|
|
85
104
|
`
|
|
86
105
|
|
|
87
106
|
function hasPrimaryLabel(button: HTMLButtonElement): boolean {
|
|
107
|
+
// Plugin cards own their appearance. Inventory disclosure buttons include
|
|
108
|
+
// descriptions, where words like "install" do not identify a primary action.
|
|
109
|
+
if (button.closest('[data-chatcode-plugin-market], [data-plugin-module]')) return false
|
|
88
110
|
const label = `${button.textContent ?? ''} ${button.getAttribute('aria-label') ?? ''} ${button.title}`.trim().toLowerCase()
|
|
89
|
-
|
|
111
|
+
if (button.classList.contains('dut-sidebar-brand') || button.classList.contains('dut-sidebar-new-session')) return false
|
|
112
|
+
return /(?:^|\s)(send|install)(?:\s|$)|发送|(?:^|\s)安装(?:\s|$)/u.test(label)
|
|
90
113
|
}
|
|
91
114
|
|
|
92
115
|
/** Replace one host SVG while retaining its generated layout class names. */
|
|
@@ -135,8 +158,33 @@ function hideVersionBesideBrandLabel(label: HTMLElement): void {
|
|
|
135
158
|
}
|
|
136
159
|
}
|
|
137
160
|
|
|
161
|
+
/** Replace the registry build's older upstream notice with ChatCode product copy. */
|
|
162
|
+
function syncVersionNotice(): void {
|
|
163
|
+
document.querySelectorAll<HTMLElement>(
|
|
164
|
+
`[role="dialog"][aria-label="${VERSION_NOTICE.zh.legacyTitle}"],`
|
|
165
|
+
+ `[role="dialog"][aria-label="${VERSION_NOTICE.en.legacyTitle}"],`
|
|
166
|
+
+ `[role="dialog"][${VERSION_NOTICE_MARKER}]`,
|
|
167
|
+
).forEach((dialog) => {
|
|
168
|
+
const heading = dialog.querySelector<HTMLElement>('h1,h2,h3')
|
|
169
|
+
const legacyTitle = dialog.getAttribute('aria-label') ?? heading?.textContent?.trim()
|
|
170
|
+
const language = dialog.dataset.dutVersionNoticeLanguage === 'zh'
|
|
171
|
+
|| legacyTitle === VERSION_NOTICE.zh.legacyTitle ? 'zh' : 'en'
|
|
172
|
+
const notice = VERSION_NOTICE[language]
|
|
173
|
+
dialog.setAttribute('aria-label', notice.title)
|
|
174
|
+
dialog.setAttribute(VERSION_NOTICE_MARKER, '')
|
|
175
|
+
dialog.dataset.dutVersionNoticeLanguage = language
|
|
176
|
+
if (heading !== null && heading.textContent !== notice.title) heading.textContent = notice.title
|
|
177
|
+
const paragraphs = dialog.querySelectorAll<HTMLParagraphElement>('p')
|
|
178
|
+
notice.paragraphs.forEach((text, index) => {
|
|
179
|
+
const paragraph = paragraphs.item(index)
|
|
180
|
+
if (paragraph !== null && paragraph.textContent !== text) paragraph.textContent = text
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
|
|
138
185
|
function syncBranding(): void {
|
|
139
|
-
|
|
186
|
+
const title = document.title.replace(LEGACY_HOST_BRAND_TEXT, PROJECT_NAME)
|
|
187
|
+
if (title !== document.title) document.title = title
|
|
140
188
|
|
|
141
189
|
// The host deliberately renders the blank-session preview badge as a
|
|
142
190
|
// third headline column. ChatCode is the production identity here, so
|
|
@@ -150,25 +198,25 @@ function syncBranding(): void {
|
|
|
150
198
|
|
|
151
199
|
// The sidebar label identifies the precise icon to its left. Process it
|
|
152
200
|
// before the generic text pass so the sibling relationship is still intact.
|
|
153
|
-
document.querySelectorAll<HTMLElement>(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
201
|
+
document.querySelectorAll<HTMLElement>(BRAND_SURFACE).forEach((surface) => {
|
|
202
|
+
surface.querySelectorAll<HTMLElement>('*').forEach((element) => {
|
|
203
|
+
if (element.closest(USER_CONTENT) !== null) return
|
|
204
|
+
if (element.childElementCount !== 0 || !LEGACY_HOST_BRAND_LABEL_TEXT.test(element.textContent?.trim() ?? '')) return
|
|
205
|
+
if (element.textContent !== PROJECT_NAME) element.textContent = PROJECT_NAME
|
|
206
|
+
element.classList.add('dut-brand-title')
|
|
207
|
+
replaceLogoBesideBrandLabel(element)
|
|
208
|
+
hideVersionBesideBrandLabel(element)
|
|
209
|
+
})
|
|
159
210
|
})
|
|
160
211
|
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
node.data = node.data.replace(LEGACY_HOST_BRAND_TEXT, PROJECT_NAME)
|
|
169
|
-
LEGACY_HOST_BRAND_TEXT.lastIndex = 0
|
|
212
|
+
for (const surface of document.querySelectorAll(BRAND_SURFACE)) {
|
|
213
|
+
const walker = document.createTreeWalker(surface, NodeFilter.SHOW_TEXT)
|
|
214
|
+
let node: Text | null
|
|
215
|
+
while ((node = walker.nextNode() as Text | null) !== null) {
|
|
216
|
+
if (node.parentElement?.closest(USER_CONTENT) !== null) continue
|
|
217
|
+
const next = node.data.replace(LEGACY_HOST_BRAND_TEXT, PROJECT_NAME).replace(HERO_HEADLINE, PROJECT_NAME)
|
|
218
|
+
if (next !== node.data) node.data = next
|
|
170
219
|
}
|
|
171
|
-
if (HERO_HEADLINE.test(node.data)) node.data = node.data.replace(HERO_HEADLINE, PROJECT_NAME)
|
|
172
220
|
}
|
|
173
221
|
|
|
174
222
|
// Keep the product name in the sidebar, but use a more expressive headline
|
|
@@ -182,12 +230,15 @@ function syncBranding(): void {
|
|
|
182
230
|
title.classList.add('dut-hero-title')
|
|
183
231
|
})
|
|
184
232
|
|
|
233
|
+
syncVersionNotice()
|
|
234
|
+
|
|
185
235
|
// Older host builds expose a brand-mark wrapper but no text-bearing sibling.
|
|
186
236
|
document.querySelectorAll<HTMLElement>('[class*="brandMark"]').forEach((host) => {
|
|
187
237
|
const svg = host.matches('svg') ? host : host.querySelector('svg')
|
|
188
238
|
if (svg instanceof SVGElement) replaceHostLogo(svg)
|
|
189
239
|
})
|
|
190
240
|
|
|
241
|
+
syncSidebarHeader()
|
|
191
242
|
document.querySelectorAll<HTMLButtonElement>('button').forEach((button) => {
|
|
192
243
|
button.classList.toggle('dut-unicom-primary-action', hasPrimaryLabel(button))
|
|
193
244
|
})
|
|
@@ -232,6 +283,7 @@ export function installBranding(): () => void {
|
|
|
232
283
|
return () => {
|
|
233
284
|
observer.disconnect()
|
|
234
285
|
if (frame !== undefined) window.cancelAnimationFrame(frame)
|
|
286
|
+
clearSidebarHeader()
|
|
235
287
|
favicon.remove()
|
|
236
288
|
style.remove()
|
|
237
289
|
}
|
|
@@ -36,6 +36,7 @@ import { WhaleIndicator, installWhaleStyles } from './whale.tsx'
|
|
|
36
36
|
import { PreciseCacheHitEntry } from './cachehit.tsx'
|
|
37
37
|
import { installTaskNotifier, previewAlerts, requestNotifyPermission } from './notifier.ts'
|
|
38
38
|
import { HeroProjectLogo, installBranding, ProjectLogoIcon, SidebarProjectLogo, SidebarProjectName } from './branding.tsx'
|
|
39
|
+
import { buildFontCss } from './typography.ts'
|
|
39
40
|
|
|
40
41
|
const NS = 'ui-tweaks'
|
|
41
42
|
const SETTINGS_ROUTE = '/_dsh/ui-tweaks/settings'
|
|
@@ -43,12 +44,12 @@ const SETTINGS_ROUTE = '/_dsh/ui-tweaks/settings'
|
|
|
43
44
|
/** Client context narrowed to the browser sessions face in this combined build. */
|
|
44
45
|
type UITweaksClientContext = ClientContext & { sessions: ISessions }
|
|
45
46
|
|
|
46
|
-
const DEFAULT_FONT_SIZE =
|
|
47
|
+
const DEFAULT_FONT_SIZE = 14
|
|
47
48
|
const MIN_FONT_SIZE = 10
|
|
48
49
|
const MAX_FONT_SIZE = 32
|
|
49
50
|
/** Legacy: code font as a percentage of the message font size (81% = stock 13/16). */
|
|
50
51
|
const DEFAULT_CODE_FONT_SCALE = 81
|
|
51
|
-
/**
|
|
52
|
+
/** Default absolute code-block size, paired with 14px prose. */
|
|
52
53
|
const DEFAULT_CODE_FONT_SIZE = 13
|
|
53
54
|
const MIN_CODE_FONT_SIZE = 8
|
|
54
55
|
const MAX_CODE_FONT_SIZE = 32
|
|
@@ -134,7 +135,7 @@ const en = {
|
|
|
134
135
|
fontSize: 'Message font size',
|
|
135
136
|
fontSizeHint: `Number between ${MIN_FONT_SIZE} and ${MAX_FONT_SIZE}; applies to message text, headings, tables and code.`,
|
|
136
137
|
codeFontSize: 'Code font size',
|
|
137
|
-
codeFontSizeHint: `Absolute code size in px (${MIN_CODE_FONT_SIZE}–${MAX_CODE_FONT_SIZE}); ${DEFAULT_CODE_FONT_SIZE}px is ChatCode CLI's default at a
|
|
138
|
+
codeFontSizeHint: `Absolute code size in px (${MIN_CODE_FONT_SIZE}–${MAX_CODE_FONT_SIZE}); ${DEFAULT_CODE_FONT_SIZE}px is ChatCode CLI's default at a 14px body. Applies to code blocks; inline code follows proportionally.`,
|
|
138
139
|
lineHeight: 'Line spacing',
|
|
139
140
|
lineHeightHint: `Base vertical spacing in px: gaps between message rows (Think ↔ tool cards) and blocks inside one reply, plus text line-height, paragraph and list margins, all scale from it; ${DEFAULT_LINE_HEIGHT} is ChatCode CLI's default.`,
|
|
140
141
|
tableStyle: 'Table style',
|
|
@@ -146,7 +147,7 @@ const en = {
|
|
|
146
147
|
gitBarOn: 'On',
|
|
147
148
|
gitBarOff: 'Off',
|
|
148
149
|
archiveManager: 'Archive manager',
|
|
149
|
-
archiveManagerHint: 'An Archive settings page to
|
|
150
|
+
archiveManagerHint: 'An Archive settings page to view and restore archived sessions.',
|
|
150
151
|
archiveManagerOn: 'On',
|
|
151
152
|
archiveManagerOff: 'Off',
|
|
152
153
|
mcpManager: 'MCP manager',
|
|
@@ -251,7 +252,7 @@ const en = {
|
|
|
251
252
|
archiveCount: 'sessions',
|
|
252
253
|
archiveUnavailable: 'Archive unavailable.',
|
|
253
254
|
archiveLiveError: 'This session is running; close it before permanently deleting it.',
|
|
254
|
-
archiveDisabledHint: 'Archive management is off. Turn it on in 界面调整 (UI Tweaks) to
|
|
255
|
+
archiveDisabledHint: 'Archive management is off. Turn it on in 界面调整 (UI Tweaks) to view and restore archived sessions here.',
|
|
255
256
|
archiveEnable: 'Enable archive management',
|
|
256
257
|
archiveRestored: 'Restored.',
|
|
257
258
|
defaultAction: 'Default',
|
|
@@ -334,7 +335,7 @@ const zh: Record<LocaleKey, string> = {
|
|
|
334
335
|
fontSize: '消息字体大小',
|
|
335
336
|
fontSizeHint: `取值 ${MIN_FONT_SIZE}–${MAX_FONT_SIZE},作用于消息正文、标题、表格与代码。`,
|
|
336
337
|
codeFontSize: '代码字号',
|
|
337
|
-
codeFontSizeHint: `代码绝对字号,取值 ${MIN_CODE_FONT_SIZE}–${MAX_CODE_FONT_SIZE}px;${DEFAULT_CODE_FONT_SIZE}px 为 ChatCode CLI 默认(正文
|
|
338
|
+
codeFontSizeHint: `代码绝对字号,取值 ${MIN_CODE_FONT_SIZE}–${MAX_CODE_FONT_SIZE}px;${DEFAULT_CODE_FONT_SIZE}px 为 ChatCode CLI 默认(正文 14 时)。作用于代码块,行内代码按比例跟随。`,
|
|
338
339
|
lineHeight: '行高',
|
|
339
340
|
lineHeightHint: `回复区垂直间距的基准值:消息之间(如 Think ↔ 工具卡片)、回复内块之间、正文行高、段落与列表边距都按它缩放;取值 ${MIN_LINE_HEIGHT}–${MAX_LINE_HEIGHT}px,${DEFAULT_LINE_HEIGHT} 为 ChatCode CLI 默认。`,
|
|
340
341
|
tableStyle: '表格样式',
|
|
@@ -346,7 +347,7 @@ const zh: Record<LocaleKey, string> = {
|
|
|
346
347
|
gitBarOn: '开启',
|
|
347
348
|
gitBarOff: '关闭',
|
|
348
349
|
archiveManager: '归档管理',
|
|
349
|
-
archiveManagerHint: '
|
|
350
|
+
archiveManagerHint: '在设置中显示「归档」页面:查看和恢复已归档会话。',
|
|
350
351
|
archiveManagerOn: '开启',
|
|
351
352
|
archiveManagerOff: '关闭',
|
|
352
353
|
mcpManager: 'MCP 管理',
|
|
@@ -451,7 +452,7 @@ const zh: Record<LocaleKey, string> = {
|
|
|
451
452
|
archiveCount: '个会话',
|
|
452
453
|
archiveUnavailable: '归档暂不可用。',
|
|
453
454
|
archiveLiveError: '该会话正在运行,无法彻底删除,请先关闭该会话。',
|
|
454
|
-
archiveDisabledHint: '
|
|
455
|
+
archiveDisabledHint: '归档管理尚未开启。在「界面调整」中开启“归档管理”后,可在此查看和恢复已归档会话。',
|
|
455
456
|
archiveEnable: '开启归档管理',
|
|
456
457
|
archiveRestored: '已恢复。',
|
|
457
458
|
defaultAction: '默认',
|
|
@@ -533,11 +534,13 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
533
534
|
|
|
534
535
|
function resolveValue(value: TweaksValue | undefined): ResolvedTweaks {
|
|
535
536
|
const fontSize = typeof value?.fontSize === 'number' ? value.fontSize : DEFAULT_FONT_SIZE
|
|
536
|
-
|
|
537
|
-
//
|
|
537
|
+
const codeFontScale = value?.codeFontScale ?? DEFAULT_CODE_FONT_SCALE
|
|
538
|
+
// Explicit code sizing wins; the stock preference keeps readable 13px code.
|
|
538
539
|
const codeFontSize = typeof value?.codeFontSize === 'number'
|
|
539
540
|
? Math.min(MAX_CODE_FONT_SIZE, Math.max(MIN_CODE_FONT_SIZE, value.codeFontSize))
|
|
540
|
-
:
|
|
541
|
+
: codeFontScale === DEFAULT_CODE_FONT_SCALE
|
|
542
|
+
? DEFAULT_CODE_FONT_SIZE
|
|
543
|
+
: Math.max(8, Math.round(fontSize * (13 / 16) * (codeFontScale / DEFAULT_CODE_FONT_SCALE)))
|
|
541
544
|
return {
|
|
542
545
|
fontSize,
|
|
543
546
|
codeFontSize,
|
|
@@ -559,50 +562,6 @@ function resolveValue(value: TweaksValue | undefined): ResolvedTweaks {
|
|
|
559
562
|
}
|
|
560
563
|
}
|
|
561
564
|
|
|
562
|
-
/** Scale one theme px value proportionally to the chosen base size. */
|
|
563
|
-
function rel(base: number, fontSize: number): number {
|
|
564
|
-
return Math.max(8, Math.round((base / DEFAULT_FONT_SIZE) * fontSize))
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/** Rebuild the markdown font tokens for the chosen base size, keeping the theme faces. */
|
|
568
|
-
function buildFontCss(fontSize: number, lineHeight: number, codeFontSize: number): string {
|
|
569
|
-
const cs = getComputedStyle(document.body)
|
|
570
|
-
const fam = (name: string, fallback: string): string => {
|
|
571
|
-
const value = cs.getPropertyValue(name).trim()
|
|
572
|
-
return value.length > 0 ? value : fallback
|
|
573
|
-
}
|
|
574
|
-
const base = fam('--dsw-font-markdown-base-font-family', '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif')
|
|
575
|
-
const code = fam('--dsw-font-markdown-code-font-family', '"SF Mono", Consolas, monospace')
|
|
576
|
-
const codeBlock = fam('--dsw-font-markdown-code-block-font-family', '"SF Mono", Consolas, monospace')
|
|
577
|
-
|
|
578
|
-
const parts: string[] = []
|
|
579
|
-
// `baseLine` is the token's line-height at the 16px baseline; it scales with
|
|
580
|
-
// both the chosen font size and the 行高 unit, so at the default (16) it
|
|
581
|
-
// reproduces the stock rhythm exactly.
|
|
582
|
-
const token = (shorthand: string, size: number, baseLine: number, family: string): void => {
|
|
583
|
-
const line = Math.max(12, Math.round((baseLine / DEFAULT_FONT_SIZE) * fontSize * (lineHeight / DEFAULT_LINE_HEIGHT)))
|
|
584
|
-
parts.push(`--${shorthand}:${size}px/${line}px ${family}`)
|
|
585
|
-
parts.push(`--${shorthand}-font-size:${size}px`)
|
|
586
|
-
parts.push(`--${shorthand}-line-height:${line}px`)
|
|
587
|
-
}
|
|
588
|
-
// Code fonts hang off the absolute code-block size (stock: 13px at a 16px
|
|
589
|
-
// body), with inline code slightly larger and the small variant slightly
|
|
590
|
-
// smaller, preserving DSH's hierarchy (14/13 and 12/13 of the block).
|
|
591
|
-
const codePx = (blockRatio: number): number => Math.max(8, Math.round(codeFontSize * blockRatio))
|
|
592
|
-
token('dsw-font-markdown-base', fontSize, 28, base)
|
|
593
|
-
token('dsw-font-markdown-base-strong', fontSize, 28, base)
|
|
594
|
-
token('dsw-font-markdown-base-italic', fontSize, 28, base)
|
|
595
|
-
token('dsw-font-markdown-base-strong-italic', fontSize, 28, base)
|
|
596
|
-
token('dsw-font-markdown-h1', rel(24, fontSize), 34, base)
|
|
597
|
-
token('dsw-font-markdown-h2', rel(22, fontSize), 32, base)
|
|
598
|
-
token('dsw-font-markdown-h3', rel(20, fontSize), 30, base)
|
|
599
|
-
token('dsw-font-markdown-h4', fontSize, 28, base)
|
|
600
|
-
token('dsw-font-markdown-code', codePx(14 / 13), 22, code)
|
|
601
|
-
token('dsw-font-markdown-code-block', codePx(1), 22, codeBlock)
|
|
602
|
-
token('dsw-font-markdown-code-block-small', codePx(12 / 13), 18, codeBlock)
|
|
603
|
-
return `body{${parts.join(';')}}`
|
|
604
|
-
}
|
|
605
|
-
|
|
606
565
|
/**
|
|
607
566
|
* Claude Desktop-ish markdown table look: light-gray rounded cell cards with
|
|
608
567
|
* small gaps, no borders. Cells share the theme's inline-code background and
|
|
@@ -610,7 +569,7 @@ function buildFontCss(fontSize: number, lineHeight: number, codeFontSize: number
|
|
|
610
569
|
* renderer, so headers and cells always match.
|
|
611
570
|
*/
|
|
612
571
|
const CLAUDE_TABLE_CSS = `
|
|
613
|
-
div[data-slot="conversation.chat.node"] table{
|
|
572
|
+
div[data-slot="conversation.chat.node"] [class*="_markdown"]:not([data-markdown-variant="compact"]) table{
|
|
614
573
|
border-collapse:separate !important;
|
|
615
574
|
border-spacing:3px !important;
|
|
616
575
|
width:100% !important;
|
|
@@ -621,7 +580,7 @@ div[data-slot="conversation.chat.node"] table{
|
|
|
621
580
|
border:none !important;
|
|
622
581
|
font-size:var(--dsw-font-markdown-base-font-size) !important;
|
|
623
582
|
}
|
|
624
|
-
div[data-slot="conversation.chat.node"] table thead th{
|
|
583
|
+
div[data-slot="conversation.chat.node"] [class*="_markdown"]:not([data-markdown-variant="compact"]) table thead th{
|
|
625
584
|
background:var(--dsw-alias-markdown-inline-code) !important;
|
|
626
585
|
color:inherit !important;
|
|
627
586
|
font-weight:400 !important;
|
|
@@ -630,7 +589,7 @@ div[data-slot="conversation.chat.node"] table thead th{
|
|
|
630
589
|
border:none !important;
|
|
631
590
|
border-radius:6px !important;
|
|
632
591
|
}
|
|
633
|
-
div[data-slot="conversation.chat.node"] table tbody td{
|
|
592
|
+
div[data-slot="conversation.chat.node"] [class*="_markdown"]:not([data-markdown-variant="compact"]) table tbody td{
|
|
634
593
|
background:var(--dsw-alias-markdown-inline-code) !important;
|
|
635
594
|
color:inherit !important;
|
|
636
595
|
font-size:inherit !important;
|
|
@@ -639,8 +598,8 @@ div[data-slot="conversation.chat.node"] table tbody td{
|
|
|
639
598
|
border:none !important;
|
|
640
599
|
border-radius:6px !important;
|
|
641
600
|
}
|
|
642
|
-
div[data-slot="conversation.chat.node"] table code,
|
|
643
|
-
div[data-slot="conversation.chat.node"] table pre{
|
|
601
|
+
div[data-slot="conversation.chat.node"] [class*="_markdown"]:not([data-markdown-variant="compact"]) table code,
|
|
602
|
+
div[data-slot="conversation.chat.node"] [class*="_markdown"]:not([data-markdown-variant="compact"]) table pre{
|
|
644
603
|
background:transparent !important;
|
|
645
604
|
border:none !important;
|
|
646
605
|
box-shadow:none !important;
|
|
@@ -650,52 +609,32 @@ div[data-slot="conversation.chat.node"] table pre{
|
|
|
650
609
|
function buildRuntimeCss(value: ResolvedTweaks): string {
|
|
651
610
|
const rules: string[] = []
|
|
652
611
|
rules.push(buildFontCss(value.fontSize, value.lineHeight, value.codeFontSize))
|
|
653
|
-
//
|
|
654
|
-
// route them through the same base so they follow the fontSize setting too.
|
|
612
|
+
// Sent messages share the reply metrics, including explicit UI Tweaks sizes.
|
|
655
613
|
// `steering` messages are sent while the agent is busy (busyEnter: steer);
|
|
656
614
|
// `[data-pending-steering]` is their in-flight bubble before it becomes durable.
|
|
657
|
-
rules.push(`[data-chat-flow-kind="user"] [class
|
|
658
|
-
//
|
|
659
|
-
//
|
|
660
|
-
|
|
661
|
-
//
|
|
662
|
-
|
|
663
|
-
//
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
// Markdown table cells are pinned by DSH (15px); let every table style follow
|
|
667
|
-
// the fontSize setting as well.
|
|
668
|
-
rules.push(`div[data-slot="conversation.chat.node"] table th,div[data-slot="conversation.chat.node"] table td{font-size:var(--dsw-font-markdown-base-font-size) !important}`)
|
|
669
|
-
// Inline code is pinned by DSH to 0.875em of the surrounding text (it ignores
|
|
670
|
-
// the code token); scale that em by how far the chosen code size sits from
|
|
671
|
-
// the stock ratio (a 13px block at this body size).
|
|
672
|
-
const stockCodeBlock = value.fontSize * (13 / 16)
|
|
615
|
+
rules.push(`[data-chat-flow-kind="user"] [class*="_bubble"],[data-chat-flow-kind="steering"] [class*="_bubble"],[data-pending-steering] [class*="_bubble"]{font-size:var(--dsw-font-markdown-base-font-size) !important;line-height:var(--dsw-font-markdown-base-line-height) !important}`)
|
|
616
|
+
// Current contenteditable composers and older textarea composers inherit
|
|
617
|
+
// one size/leading pair, including placeholders and measurement layers.
|
|
618
|
+
rules.push(`[data-composer-card]{font:var(--dsw-font-markdown-base) !important}`)
|
|
619
|
+
// Tables use the same body size and leading in both table styles.
|
|
620
|
+
rules.push(`div[data-slot="conversation.chat.node"] [class*="_markdown"]:not([data-markdown-variant="compact"]) table th,div[data-slot="conversation.chat.node"] [class*="_markdown"]:not([data-markdown-variant="compact"]) table td{font-size:var(--dsw-font-markdown-base-font-size) !important;line-height:var(--dsw-font-markdown-base-line-height) !important}`)
|
|
621
|
+
// Inline code normally uses 0.92em. Explicit code sizing follows the
|
|
622
|
+
// same ratio relative to the 14px body / 13px code baseline.
|
|
623
|
+
const stockCodeBlock = value.fontSize * (13 / 14)
|
|
673
624
|
if (Math.abs(value.codeFontSize - stockCodeBlock) > 0.5) {
|
|
674
|
-
const em = (0.
|
|
675
|
-
rules.push(`div[data-slot="conversation.chat.node"] div[class*="
|
|
625
|
+
const em = (0.92 * (value.codeFontSize / stockCodeBlock)).toFixed(3)
|
|
626
|
+
rules.push(`div[data-slot="conversation.chat.node"] div[class*="_markdown"]:not([data-markdown-variant="compact"]) :not(pre)>code{font-size:${em}em !important}`)
|
|
676
627
|
}
|
|
677
|
-
//
|
|
678
|
-
// the stock 16px, every vertical spacing scales from it proportionally:
|
|
679
|
-
// ① gaps between message rows (Think ↔ tool cards like pwsh, user ↔
|
|
680
|
-
// assistant) — the chat flow column;
|
|
681
|
-
// ② gaps between content blocks inside one assistant reply (Think ↔ text) —
|
|
682
|
-
// the Assistant Markdown block container (`Sxvs8a_body`, CSS-module
|
|
683
|
-
// hashed, stable within the pinned rc.8 conversation package);
|
|
684
|
-
// ③ the markdown typography rhythm: paragraphs (`p` has a stock `margin:
|
|
685
|
-
// 16px 0` that must be overridden on both axes, not just bottom, or it
|
|
686
|
-
// can never tighten below 16), list margins, list-item gaps (stock 6px),
|
|
687
|
-
// paragraphs inside list items (stock 8px), code blocks, headings and
|
|
688
|
-
// rules — all scaled from the 行高 unit.
|
|
689
|
-
// Text line-height itself scales in buildFontCss above.
|
|
628
|
+
// Custom spacing scales prose without expanding compact thinking.
|
|
690
629
|
if (value.lineHeight !== DEFAULT_LINE_HEIGHT) {
|
|
691
630
|
const n = value.lineHeight
|
|
692
|
-
const md = `div[data-slot="conversation.chat.node"] div[class*="
|
|
693
|
-
const liGap = Math.max(2, Math.round((
|
|
631
|
+
const md = `div[data-slot="conversation.chat.node"] div[class*="_markdown"]:not([data-markdown-variant="compact"])`
|
|
632
|
+
const liGap = Math.max(2, Math.round((4 * n) / DEFAULT_LINE_HEIGHT))
|
|
694
633
|
const liPGap = Math.max(2, Math.round((8 * n) / DEFAULT_LINE_HEIGHT))
|
|
695
|
-
rules.push(`div[data-slot="conversation.view"]
|
|
696
|
-
rules.push(`div[data-slot="conversation.chat.node"]
|
|
697
|
-
rules.push(`${md} p{margin:${n}px 0 !important}`)
|
|
698
|
-
rules.push(`${md} ul,${md} ol{margin:${n}px 0 !important}`)
|
|
634
|
+
rules.push(`div[data-slot="conversation.view"] [data-chat-flow]{gap:${n}px !important}`)
|
|
635
|
+
rules.push(`div[data-slot="conversation.chat.node"] [data-assistant-body]{--dsh-assistant-block-gap:${n}px}`)
|
|
636
|
+
rules.push(`${md} p{margin:${Math.round(0.75 * n)}px 0 !important}`)
|
|
637
|
+
rules.push(`${md} ul,${md} ol{margin:${Math.round(0.75 * n)}px 0 !important}`)
|
|
699
638
|
rules.push(`${md} pre{margin:${n}px 0 !important}`)
|
|
700
639
|
// Code blocks: the pre's inner vertical padding is stock 16px (shiki
|
|
701
640
|
// default); scale it so the block's own height follows 行高 too. Only
|
|
@@ -711,13 +650,11 @@ function buildRuntimeCss(value: ResolvedTweaks): string {
|
|
|
711
650
|
}
|
|
712
651
|
rules.push(`${md} li:not(:first-child){margin-top:${liGap}px !important}`)
|
|
713
652
|
rules.push(`${md} li>p{margin:${liPGap}px 0 !important}`)
|
|
714
|
-
rules.push(`${md} h1,${md} h2,${md} h3{margin:${
|
|
653
|
+
rules.push(`${md} h1,${md} h2,${md} h3{margin:${Math.round(1.5 * n)}px 0 ${Math.round(0.75 * n)}px !important}`)
|
|
715
654
|
rules.push(`${md} h4,${md} h5,${md} h6{margin:${n}px 0 !important}`)
|
|
716
655
|
rules.push(`${md} hr{margin:${2 * n}px 0 !important}`)
|
|
717
656
|
rules.push(`${md} blockquote{margin:${n}px 0 0 !important}`)
|
|
718
|
-
//
|
|
719
|
-
// margin (stock `>*:first-child` / `>*:last-child`), so a message starts
|
|
720
|
-
// and ends tight and the spacing to the next node stays the column gap.
|
|
657
|
+
// Preserve the first and last block's flush edges.
|
|
721
658
|
rules.push(`${md} > :first-child{margin-top:0 !important}`)
|
|
722
659
|
rules.push(`${md} > :last-child{margin-bottom:0 !important}`)
|
|
723
660
|
}
|
|
@@ -1487,7 +1424,7 @@ export function apply(ctx: UITweaksClientContext): void {
|
|
|
1487
1424
|
// packaged logo there rather than restyling the host's fallback FishLogo.
|
|
1488
1425
|
ctx.slots.inject('conversation.hero.brand.mark', () => ctx.slots.register({
|
|
1489
1426
|
name: 'conversation.hero.brand.mark',
|
|
1490
|
-
priority: 10,
|
|
1427
|
+
priority: -10,
|
|
1491
1428
|
}, HeroProjectLogo))
|
|
1492
1429
|
|
|
1493
1430
|
// The sidebar renders this same slot in its expanded header and collapsed
|
|
@@ -1495,7 +1432,7 @@ export function apply(ctx: UITweaksClientContext): void {
|
|
|
1495
1432
|
// from falling back to the host FishLogo after the sidebar is collapsed.
|
|
1496
1433
|
ctx.slots.inject('sidebar.brand.mark', () => ctx.slots.register({
|
|
1497
1434
|
name: 'sidebar.brand.mark',
|
|
1498
|
-
priority: 10,
|
|
1435
|
+
priority: -10,
|
|
1499
1436
|
}, SidebarProjectLogo))
|
|
1500
1437
|
|
|
1501
1438
|
// Newer DSH hosts expose the expanded wordmark as its own slot. Owning it
|
|
@@ -1504,7 +1441,7 @@ export function apply(ctx: UITweaksClientContext): void {
|
|
|
1504
1441
|
// path above.
|
|
1505
1442
|
ctx.slots.inject('sidebar.brand.name', () => ctx.slots.register({
|
|
1506
1443
|
name: 'sidebar.brand.name',
|
|
1507
|
-
priority: 10,
|
|
1444
|
+
priority: -10,
|
|
1508
1445
|
}, SidebarProjectName))
|
|
1509
1446
|
|
|
1510
1447
|
// GitBar v3: the branch chip lives in the session header's action row
|
|
@@ -1545,7 +1482,7 @@ export function apply(ctx: UITweaksClientContext): void {
|
|
|
1545
1482
|
ctx.effect(() => installHeroChip(controller, t), 'dsh-ui-tweaks: hero branch chip')
|
|
1546
1483
|
|
|
1547
1484
|
// Archive manager: a Settings section ("归档") that lists archived sessions
|
|
1548
|
-
// and can restore
|
|
1485
|
+
// and can restore them. Registered only while the
|
|
1549
1486
|
// archiveManagerEnabled toggle in the UI Tweaks section is on, so the nav
|
|
1550
1487
|
// row appears / disappears live with the switch (the settings shell
|
|
1551
1488
|
// projects its nav from the section ledger).
|
|
@@ -1555,7 +1492,7 @@ export function apply(ctx: UITweaksClientContext): void {
|
|
|
1555
1492
|
order: 50,
|
|
1556
1493
|
label: () => t('archiveNav'),
|
|
1557
1494
|
locale: NS,
|
|
1558
|
-
inject: () => ({ controller, t
|
|
1495
|
+
inject: () => ({ controller, t }),
|
|
1559
1496
|
}, ArchiveSection))
|
|
1560
1497
|
|
|
1561
1498
|
// MCP manager: a Settings section ("MCP 管理") that lists the configured MCP
|