@michengai/dsh-codex-ui 2.0.10 → 2.0.12
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/CHANGELOG.md +14 -0
- package/CHANGELOG.zh-CN.md +14 -0
- package/README.md +5 -3
- package/README.zh-CN.md +5 -3
- package/cordis.patch.yml +2 -0
- package/lib/client.js +1096 -119
- package/lib/composer-plugin.mjs +1 -1
- package/lib/desktop-menu-plugin.d.mts +21 -0
- package/lib/desktop-menu-plugin.mjs +582 -0
- package/lib/index.mjs +1 -1
- package/lib/{profile-resolver-D81fBy52.mjs → profile-resolver-B1VNepo_.mjs} +5 -2
- package/lib/session-title-plugin.mjs +36 -2
- package/lib/settings-skin-plugin.mjs +1 -1
- package/lib/sidebar-plugin.mjs +1 -1
- package/lib/theme-plugin.mjs +1 -1
- package/locale/desktop-menu/en.json +6 -0
- package/locale/desktop-menu/zh.json +6 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +8 -3
- package/lib/business-api-CSNUY-u5.mjs +0 -11
- package/lib/profile-resolver-9ws-Evm5.mjs +0 -73
package/lib/client.js
CHANGED
|
@@ -69,13 +69,16 @@ window.__ModuleLoader__.load({
|
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/business-api.ts
|
|
71
71
|
const CODEX_UI_API_BASE = "/api/michengai/dsh-codex-ui";
|
|
72
|
+
/** 请求重启时携带一次性令牌的请求头(客户端与 Host 共用)。 */
|
|
73
|
+
const CODEX_UI_RESTART_HEADER = "x-dcu-restart-key";
|
|
72
74
|
const CODEX_UI_API_ENDPOINTS = Object.freeze({
|
|
73
75
|
dependencies: `${CODEX_UI_API_BASE}/dependencies`,
|
|
74
76
|
settingsSkin: `${CODEX_UI_API_BASE}/settings-skin`,
|
|
75
77
|
composer: `${CODEX_UI_API_BASE}/composer`,
|
|
76
78
|
sidebar: `${CODEX_UI_API_BASE}/sidebar`,
|
|
77
79
|
sections: `${CODEX_UI_API_BASE}/sections`,
|
|
78
|
-
theme: `${CODEX_UI_API_BASE}/theme
|
|
80
|
+
theme: `${CODEX_UI_API_BASE}/theme`,
|
|
81
|
+
desktopMenu: `${CODEX_UI_API_BASE}/desktop-menu`
|
|
79
82
|
});
|
|
80
83
|
//#endregion
|
|
81
84
|
//#region src/dependencies.ts
|
|
@@ -2575,6 +2578,11 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
2575
2578
|
nameKey: "about.feature.theme.name",
|
|
2576
2579
|
descKey: "about.feature.theme"
|
|
2577
2580
|
},
|
|
2581
|
+
{
|
|
2582
|
+
id: "desktop-menu",
|
|
2583
|
+
nameKey: "about.feature.desktopMenu.name",
|
|
2584
|
+
descKey: "about.feature.desktopMenu"
|
|
2585
|
+
},
|
|
2578
2586
|
{
|
|
2579
2587
|
id: "dependencies",
|
|
2580
2588
|
nameKey: "about.feature.dependencies.name",
|
|
@@ -2584,12 +2592,10 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
2584
2592
|
const endpoint = CODEX_UI_API_ENDPOINTS.dependencies;
|
|
2585
2593
|
const stylesheet = `
|
|
2586
2594
|
.dcu-about{color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);display:flex;flex-direction:column}
|
|
2587
|
-
.dcu-about-head{display:flex;flex-direction:column;align-items:stretch;gap:12px;margin-bottom:16px}
|
|
2588
|
-
.dcu-about-title-block{min-width:0}
|
|
2589
|
-
.dcu-about h2,.dcu-about-title{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;color:var(--dsw-alias-label-primary)}
|
|
2590
|
-
.dcu-about-title-row{display:flex;align-items:center;gap:8px 12px;min-width:0;flex-wrap:wrap}
|
|
2591
2595
|
.dcu-about-feedback-links,.dcu-about-links{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
|
2592
2596
|
.dcu-about-version{margin-left:8px;color:var(--dsw-alias-label-tertiary);font-family:inherit;font-size:12px;font-weight:500;line-height:18px;letter-spacing:0;white-space:nowrap;vertical-align:baseline}
|
|
2597
|
+
.dcu-section-subtitle-wrap{margin-top:-4px;margin-bottom:4px}
|
|
2598
|
+
.dcu-section-subtitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-secondary)}
|
|
2593
2599
|
.dcu-subplugins-list{display:flex;flex-direction:column;gap:6px}
|
|
2594
2600
|
.dcu-subplugin-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;background:var(--dsw-alias-bg-layer-1,rgba(255,255,255,0.03));border:1px solid var(--dsw-alias-border-l1,rgba(255,255,255,0.06));border-radius:8px;transition:background-color 120ms ease}
|
|
2595
2601
|
.dcu-subplugin-item:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,0.05))}
|
|
@@ -2840,17 +2846,22 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
2840
2846
|
"aria-label": t("about.nav"),
|
|
2841
2847
|
children: [
|
|
2842
2848
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: stylesheet }),
|
|
2843
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
2844
|
-
className: "dcu-
|
|
2845
|
-
children:
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2849
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2850
|
+
className: "dcu-section-card dcu-card-features",
|
|
2851
|
+
children: [
|
|
2852
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2853
|
+
className: "dcu-section-header",
|
|
2854
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2855
|
+
className: "dcu-section-title-wrap",
|
|
2856
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
|
|
2857
|
+
className: "dcu-section-title",
|
|
2858
|
+
children: [t("about.title"), selfVersion === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2859
|
+
className: "dcu-about-version",
|
|
2860
|
+
children: ["v", selfVersion]
|
|
2861
|
+
})]
|
|
2862
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2863
|
+
className: "dcu-section-desc",
|
|
2864
|
+
children: t("about.description")
|
|
2854
2865
|
})]
|
|
2855
2866
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2856
2867
|
className: "dcu-about-feedback-links dcu-about-links",
|
|
@@ -2888,42 +2899,34 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
2888
2899
|
})
|
|
2889
2900
|
]
|
|
2890
2901
|
})]
|
|
2891
|
-
})
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2897
|
-
className: "dcu-section-header",
|
|
2898
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2899
|
-
className: "dcu-section-title-wrap",
|
|
2900
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
2901
|
-
className: "dcu-section-title",
|
|
2902
|
+
}),
|
|
2903
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2904
|
+
className: "dcu-section-subtitle-wrap",
|
|
2905
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2906
|
+
className: "dcu-section-subtitle",
|
|
2902
2907
|
children: t("about.features")
|
|
2903
|
-
})
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2908
|
+
})
|
|
2909
|
+
}),
|
|
2910
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2911
|
+
className: "dcu-subplugins-list",
|
|
2912
|
+
children: SUB_PLUGINS.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2913
|
+
className: "dcu-subplugin-item",
|
|
2914
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2915
|
+
className: "dcu-subplugin-header",
|
|
2916
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2917
|
+
className: "dcu-subplugin-name",
|
|
2918
|
+
children: t(item.nameKey)
|
|
2919
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
2920
|
+
className: "dcu-subplugin-badge",
|
|
2921
|
+
children: item.id
|
|
2922
|
+
})]
|
|
2923
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2924
|
+
className: "dcu-subplugin-desc",
|
|
2925
|
+
children: t(item.descKey)
|
|
2920
2926
|
})]
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
})]
|
|
2925
|
-
}, item.id))
|
|
2926
|
-
})]
|
|
2927
|
+
}, item.id))
|
|
2928
|
+
})
|
|
2929
|
+
]
|
|
2927
2930
|
}),
|
|
2928
2931
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeSettingsCard, { t }),
|
|
2929
2932
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -3120,7 +3123,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
3120
3123
|
"about.feedback": "问题反馈",
|
|
3121
3124
|
"about.checkUpdate": "检查更新",
|
|
3122
3125
|
"about.checking": "正在检查更新…",
|
|
3123
|
-
"about.description": "
|
|
3126
|
+
"about.description": "输入框增强、全屏设置工作台美化、桌面窗口菜单与生态插件管理。",
|
|
3124
3127
|
"about.features": "包含子插件与功能",
|
|
3125
3128
|
"about.feature.composer.name": "输入框增强 (Composer)",
|
|
3126
3129
|
"about.feature.composer": "终端风格输入历史(↑/↓)快捷召回、自适应宽度调节与会话建议卡片",
|
|
@@ -3134,6 +3137,23 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
3134
3137
|
"about.feature.theme": "内置 Codex 经典黑白与 Catppuccin 色盘,支持悬浮云母磨砂质感",
|
|
3135
3138
|
"about.feature.dependencies.name": "配套生态管理 (Dependencies)",
|
|
3136
3139
|
"about.feature.dependencies": "深度集成 DSH 官方与第三方生态插件集中管理与一键批量更新",
|
|
3140
|
+
"about.feature.desktopMenu.name": "桌面窗口菜单 (Desktop Menus)",
|
|
3141
|
+
"about.feature.desktopMenu": "在系统原生菜单栏追加帮助入口,并提供页面刷新与重启",
|
|
3142
|
+
"desktopMenu.help": "帮助",
|
|
3143
|
+
"desktopMenu.help.reloadPage": "刷新页面",
|
|
3144
|
+
"desktopMenu.help.restartAppHost": "重启应用与 Host",
|
|
3145
|
+
"desktopMenu.help.restartConfirm": "将退出并重新打开 DeepSeek Harness,正在运行的任务会被中断。继续?",
|
|
3146
|
+
"desktopMenu.restart.quitting": "正在退出并重新打开 DeepSeek Harness…",
|
|
3147
|
+
"desktopMenu.restart.relaunched": "已重新启动。",
|
|
3148
|
+
"desktopMenu.restart.cancelled": "应用没有退出,本次重启已取消。",
|
|
3149
|
+
"desktopMenu.restart.launchFailed": "应用已退出,但没能自动重新打开,请手动启动。",
|
|
3150
|
+
"desktopMenu.restart.timeout": "没有在预期时间内完成重启,请确认应用是否还在。",
|
|
3151
|
+
"desktopMenu.restart.busy": "已有重启正在进行中,请稍候。",
|
|
3152
|
+
"desktopMenu.restart.failed": "重启失败",
|
|
3153
|
+
"desktopMenu.restart.unreachable": "连不上宿主,重启通道不可用。",
|
|
3154
|
+
"desktopMenu.restart.unsupportedDesktopOnly": "当前不是桌面版,无法重启应用。",
|
|
3155
|
+
"desktopMenu.restart.unsupportedMissingApp": "找不到 DeepSeek Harness 的可执行文件,无法重启。",
|
|
3156
|
+
"desktopMenu.restart.close": "关闭",
|
|
3137
3157
|
"about.dependencies": "配套管理插件",
|
|
3138
3158
|
"about.dependenciesDescription": "每个配套插件均支持独立按需安装与一键批量同步升级。",
|
|
3139
3159
|
"about.loading": "正在读取依赖安装状态…",
|
|
@@ -3289,7 +3309,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
3289
3309
|
"about.feedback": "Issues",
|
|
3290
3310
|
"about.checkUpdate": "Check for updates",
|
|
3291
3311
|
"about.checking": "Checking…",
|
|
3292
|
-
"about.description": "
|
|
3312
|
+
"about.description": "Input enhancement, fullscreen settings workbench skin, desktop titlebar menu, and ecosystem plugin management.",
|
|
3293
3313
|
"about.features": "Built-in Sub-plugins & Capabilities",
|
|
3294
3314
|
"about.feature.composer.name": "Composer Enhancements",
|
|
3295
3315
|
"about.feature.composer": "Terminal-style input history (↑/↓), adaptive width resizing, and starter suggestions",
|
|
@@ -3303,6 +3323,23 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
3303
3323
|
"about.feature.theme": "Built-in Codex dark/light & Catppuccin palettes with floating mica glassmorphism",
|
|
3304
3324
|
"about.feature.dependencies.name": "Companion Dependencies",
|
|
3305
3325
|
"about.feature.dependencies": "Integrated management, live healthcheck, and one-click updates for DSH plugins",
|
|
3326
|
+
"about.feature.desktopMenu.name": "Desktop Window Menus",
|
|
3327
|
+
"about.feature.desktopMenu": "Adds a Help entry to the native menubar with page reload and restart",
|
|
3328
|
+
"desktopMenu.help": "Help",
|
|
3329
|
+
"desktopMenu.help.reloadPage": "Reload Page",
|
|
3330
|
+
"desktopMenu.help.restartAppHost": "Restart App and Host",
|
|
3331
|
+
"desktopMenu.help.restartConfirm": "DeepSeek Harness will close and reopen; running tasks will be interrupted. Continue?",
|
|
3332
|
+
"desktopMenu.restart.quitting": "Closing and reopening DeepSeek Harness…",
|
|
3333
|
+
"desktopMenu.restart.relaunched": "Restarted.",
|
|
3334
|
+
"desktopMenu.restart.cancelled": "The app did not exit; this restart was cancelled.",
|
|
3335
|
+
"desktopMenu.restart.launchFailed": "The app exited but could not be reopened automatically.",
|
|
3336
|
+
"desktopMenu.restart.timeout": "The restart did not finish in time; please check the app.",
|
|
3337
|
+
"desktopMenu.restart.busy": "A restart is already in progress. Please wait.",
|
|
3338
|
+
"desktopMenu.restart.failed": "Restart failed",
|
|
3339
|
+
"desktopMenu.restart.unreachable": "Cannot reach the Host; the restart channel is unavailable.",
|
|
3340
|
+
"desktopMenu.restart.unsupportedDesktopOnly": "This is not the desktop app, so it cannot be restarted.",
|
|
3341
|
+
"desktopMenu.restart.unsupportedMissingApp": "Cannot locate the DeepSeek Harness executable, so it cannot be restarted.",
|
|
3342
|
+
"desktopMenu.restart.close": "Close",
|
|
3306
3343
|
"about.dependencies": "Companion management plugins",
|
|
3307
3344
|
"about.dependenciesDescription": "Install or update each companion plugin individually, or synchronize all versions in one click.",
|
|
3308
3345
|
"about.loading": "Loading dependency status…",
|
|
@@ -4469,7 +4506,7 @@ html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [
|
|
|
4469
4506
|
flex: none !important;
|
|
4470
4507
|
}
|
|
4471
4508
|
|
|
4472
|
-
/* 顶部操作区(打开配置文件 +
|
|
4509
|
+
/* 顶部操作区(打开配置文件 + 关闭按钮):普通模式下透明浮动,无实体白条与下边框,绝不硬切出第二层顶部 */
|
|
4473
4510
|
[data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="header"] {
|
|
4474
4511
|
grid-column: 2 !important;
|
|
4475
4512
|
grid-row: 1 / -1 !important;
|
|
@@ -4481,14 +4518,16 @@ html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [
|
|
|
4481
4518
|
min-height: 56px !important;
|
|
4482
4519
|
box-sizing: border-box !important;
|
|
4483
4520
|
padding: 0 32px !important;
|
|
4484
|
-
border
|
|
4521
|
+
border: none !important;
|
|
4522
|
+
border-bottom: none !important;
|
|
4485
4523
|
display: flex !important;
|
|
4486
4524
|
align-items: center !important;
|
|
4487
4525
|
justify-content: flex-end !important;
|
|
4488
4526
|
gap: 12px !important;
|
|
4489
|
-
background:
|
|
4527
|
+
background: transparent !important;
|
|
4490
4528
|
z-index: 10 !important;
|
|
4491
4529
|
margin: 0 !important;
|
|
4530
|
+
pointer-events: none !important;
|
|
4492
4531
|
}
|
|
4493
4532
|
|
|
4494
4533
|
[data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="header"] > * {
|
|
@@ -4544,8 +4583,9 @@ html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:has(> [class
|
|
|
4544
4583
|
|
|
4545
4584
|
body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="header"],
|
|
4546
4585
|
html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="header"] {
|
|
4547
|
-
background:
|
|
4548
|
-
border
|
|
4586
|
+
background: transparent !important;
|
|
4587
|
+
border: none !important;
|
|
4588
|
+
border-bottom: none !important;
|
|
4549
4589
|
}
|
|
4550
4590
|
|
|
4551
4591
|
body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"],
|
|
@@ -4604,22 +4644,25 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="optio
|
|
|
4604
4644
|
min-height: 56px !important;
|
|
4605
4645
|
box-sizing: border-box !important;
|
|
4606
4646
|
padding: 0 32px !important;
|
|
4607
|
-
border
|
|
4608
|
-
border:
|
|
4609
|
-
|
|
4610
|
-
background: var(--dsw-alias-bg-layer-1) !important;
|
|
4647
|
+
border: none !important;
|
|
4648
|
+
border-radius: 0 !important;
|
|
4649
|
+
background: transparent !important;
|
|
4611
4650
|
display: flex !important;
|
|
4612
4651
|
align-items: center !important;
|
|
4613
4652
|
justify-content: flex-end !important;
|
|
4614
4653
|
gap: 12px !important;
|
|
4615
4654
|
z-index: 10 !important;
|
|
4655
|
+
pointer-events: none !important;
|
|
4656
|
+
}
|
|
4657
|
+
|
|
4658
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="header"] > * {
|
|
4659
|
+
pointer-events: auto !important;
|
|
4616
4660
|
}
|
|
4617
4661
|
|
|
4618
4662
|
html[data-dsh-glass-float] body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="header"],
|
|
4619
4663
|
html[data-dsh-glass-float] html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="header"] {
|
|
4620
|
-
background:
|
|
4621
|
-
border:
|
|
4622
|
-
border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08)) !important;
|
|
4664
|
+
background: transparent !important;
|
|
4665
|
+
border: none !important;
|
|
4623
4666
|
}
|
|
4624
4667
|
|
|
4625
4668
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"] {
|
|
@@ -4633,22 +4676,143 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="optio
|
|
|
4633
4676
|
padding-inline: 36px !important;
|
|
4634
4677
|
}
|
|
4635
4678
|
|
|
4636
|
-
/* 无论窗口 <=768px 还是处于收起态 [data-sidebar-collapsed]
|
|
4679
|
+
/* 无论窗口 <=768px 还是处于收起态 [data-sidebar-collapsed],结构尺寸均收敛为 56px 导轨 */
|
|
4637
4680
|
[data-shortcut-modal="settings"][data-sidebar-collapsed],
|
|
4638
4681
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed],
|
|
4639
4682
|
html[data-dsh-glass] [data-shortcut-modal="settings"][data-sidebar-collapsed] {
|
|
4640
4683
|
--dcu-settings-nav-width: 56px !important;
|
|
4641
4684
|
}
|
|
4642
4685
|
|
|
4643
|
-
[data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"])
|
|
4644
|
-
|
|
4645
|
-
|
|
4686
|
+
[data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) {
|
|
4687
|
+
grid-template-columns: 56px minmax(0, 1fr) !important;
|
|
4688
|
+
}
|
|
4689
|
+
|
|
4690
|
+
/* --- 普通纯色原生模式(未开启云母)下的收起态:与普通展开态完全一致,平铺紧贴,0 外边距、0 圆角、0 磨砂、0 阴影 --- */
|
|
4691
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) {
|
|
4692
|
+
gap: 0 !important;
|
|
4693
|
+
padding: 0 !important;
|
|
4694
|
+
background: var(--dsw-alias-bg-base, #151517) !important;
|
|
4695
|
+
}
|
|
4696
|
+
|
|
4697
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="navTitle"] {
|
|
4698
|
+
grid-column: 1 !important;
|
|
4699
|
+
grid-row: 1 !important;
|
|
4700
|
+
box-sizing: border-box !important;
|
|
4701
|
+
width: 56px !important;
|
|
4702
|
+
min-width: 56px !important;
|
|
4703
|
+
max-width: 56px !important;
|
|
4704
|
+
padding: 14px 0 10px 0 !important;
|
|
4705
|
+
margin: 0 !important;
|
|
4706
|
+
align-items: center !important;
|
|
4707
|
+
justify-content: center !important;
|
|
4708
|
+
border-radius: 0 !important;
|
|
4709
|
+
border: none !important;
|
|
4710
|
+
border-right: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08)) !important;
|
|
4711
|
+
border-bottom: none !important;
|
|
4712
|
+
background: var(--dsw-specific-sidebar-fill, var(--dsw-alias-bg-layer-1, #18181b)) !important;
|
|
4713
|
+
backdrop-filter: none !important;
|
|
4714
|
+
-webkit-backdrop-filter: none !important;
|
|
4715
|
+
box-shadow: none !important;
|
|
4716
|
+
flex: none !important;
|
|
4717
|
+
}
|
|
4718
|
+
|
|
4719
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav {
|
|
4720
|
+
box-sizing: border-box !important;
|
|
4721
|
+
width: 56px !important;
|
|
4722
|
+
min-width: 56px !important;
|
|
4723
|
+
max-width: 56px !important;
|
|
4724
|
+
margin: 0 !important;
|
|
4725
|
+
padding: 12px 0 16px !important;
|
|
4726
|
+
border-radius: 0 !important;
|
|
4727
|
+
border: none !important;
|
|
4728
|
+
border-right: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08)) !important;
|
|
4729
|
+
background: var(--dsw-specific-sidebar-fill, var(--dsw-alias-bg-layer-1, #18181b)) !important;
|
|
4730
|
+
backdrop-filter: none !important;
|
|
4731
|
+
-webkit-backdrop-filter: none !important;
|
|
4732
|
+
box-shadow: none !important;
|
|
4733
|
+
overflow-y: auto !important;
|
|
4734
|
+
overflow-x: hidden !important;
|
|
4735
|
+
scrollbar-width: none !important;
|
|
4736
|
+
-ms-overflow-style: none !important;
|
|
4737
|
+
display: flex !important;
|
|
4738
|
+
flex-direction: column !important;
|
|
4739
|
+
align-items: center !important;
|
|
4740
|
+
gap: 0 !important;
|
|
4741
|
+
}
|
|
4742
|
+
|
|
4743
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) {
|
|
4744
|
+
margin: 0 !important;
|
|
4745
|
+
border-radius: 0 !important;
|
|
4746
|
+
border: none !important;
|
|
4747
|
+
box-shadow: none !important;
|
|
4748
|
+
background: var(--dsw-alias-bg-base, #151517) !important;
|
|
4749
|
+
height: 100% !important;
|
|
4750
|
+
max-height: 100% !important;
|
|
4751
|
+
overflow: hidden !important;
|
|
4752
|
+
display: flex !important;
|
|
4753
|
+
flex-direction: column !important;
|
|
4754
|
+
}
|
|
4755
|
+
|
|
4756
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) > :first-child {
|
|
4757
|
+
background: transparent !important;
|
|
4758
|
+
border: none !important;
|
|
4759
|
+
border-bottom: none !important;
|
|
4760
|
+
flex: none !important;
|
|
4761
|
+
}
|
|
4762
|
+
|
|
4763
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) {
|
|
4764
|
+
margin: 0 !important;
|
|
4765
|
+
border-radius: 0 !important;
|
|
4766
|
+
border: none !important;
|
|
4767
|
+
box-shadow: none !important;
|
|
4768
|
+
background: transparent !important;
|
|
4769
|
+
overflow-y: auto !important;
|
|
4770
|
+
flex: 1 1 auto !important;
|
|
4771
|
+
min-height: 0 !important;
|
|
4772
|
+
padding-top: 28px !important;
|
|
4773
|
+
padding-bottom: 64px !important;
|
|
4774
|
+
padding-inline: 48px !important;
|
|
4775
|
+
box-sizing: border-box !important;
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"] {
|
|
4779
|
+
margin: 0 !important;
|
|
4780
|
+
border-radius: 0 !important;
|
|
4781
|
+
border: none !important;
|
|
4782
|
+
box-shadow: none !important;
|
|
4783
|
+
background: var(--dsw-alias-bg-base, #151517) !important;
|
|
4784
|
+
overflow-y: auto !important;
|
|
4785
|
+
height: 100% !important;
|
|
4786
|
+
max-height: 100% !important;
|
|
4787
|
+
padding-top: calc(56px + 28px) !important;
|
|
4788
|
+
padding-bottom: 64px !important;
|
|
4789
|
+
padding-inline: 48px !important;
|
|
4790
|
+
box-sizing: border-box !important;
|
|
4791
|
+
}
|
|
4792
|
+
|
|
4793
|
+
/* 浅色普通模式下的收起态高对比度平铺底板 */
|
|
4794
|
+
html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav,
|
|
4795
|
+
html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"][data-sidebar-collapsed] > nav,
|
|
4796
|
+
html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="navTitle"],
|
|
4797
|
+
html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="navTitle"] {
|
|
4798
|
+
background: var(--dsw-specific-sidebar-fill, var(--dsw-alias-bg-layer-1, #f3f3f4)) !important;
|
|
4799
|
+
border-right: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08)) !important;
|
|
4800
|
+
}
|
|
4801
|
+
|
|
4802
|
+
html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav),
|
|
4803
|
+
html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav),
|
|
4804
|
+
html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"],
|
|
4805
|
+
html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"] {
|
|
4806
|
+
background: var(--dsw-alias-bg-base, #ffffff) !important;
|
|
4807
|
+
}
|
|
4808
|
+
|
|
4809
|
+
/* --- 仅在开启云母悬浮模式(html[data-dsh-glass-float])下,才启用 12px 悬浮双岛、16px 圆角大卡片与磨砂投影 --- */
|
|
4810
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) {
|
|
4646
4811
|
grid-template-columns: 56px minmax(0, 1fr) !important;
|
|
4647
4812
|
gap: 0 12px !important;
|
|
4648
4813
|
padding: 8px 12px 12px 12px !important;
|
|
4649
4814
|
}
|
|
4650
4815
|
|
|
4651
|
-
[data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="navTitle"],
|
|
4652
4816
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="navTitle"] {
|
|
4653
4817
|
grid-column: 1 !important;
|
|
4654
4818
|
grid-row: 1 !important;
|
|
@@ -4669,8 +4833,6 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
4669
4833
|
flex: none !important;
|
|
4670
4834
|
}
|
|
4671
4835
|
|
|
4672
|
-
/* 旧版/标准嵌套结构:整个 nav 自身就是唯一的单层悬浮岛,内部绝不允许画任何边框或背景! */
|
|
4673
|
-
[data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > nav,
|
|
4674
4836
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > nav {
|
|
4675
4837
|
box-sizing: border-box !important;
|
|
4676
4838
|
width: 56px !important;
|
|
@@ -4694,6 +4856,64 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
4694
4856
|
gap: 0 !important;
|
|
4695
4857
|
}
|
|
4696
4858
|
|
|
4859
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > nav {
|
|
4860
|
+
grid-column: 1 !important;
|
|
4861
|
+
grid-row: 2 !important;
|
|
4862
|
+
box-sizing: border-box !important;
|
|
4863
|
+
width: 56px !important;
|
|
4864
|
+
min-width: 56px !important;
|
|
4865
|
+
max-width: 56px !important;
|
|
4866
|
+
height: 100% !important;
|
|
4867
|
+
max-height: 100% !important;
|
|
4868
|
+
margin: 0 !important;
|
|
4869
|
+
padding: 0 0 16px !important;
|
|
4870
|
+
flex: none !important;
|
|
4871
|
+
border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
|
|
4872
|
+
border-top: none !important;
|
|
4873
|
+
border-radius: 0 0 16px 16px !important;
|
|
4874
|
+
box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)) !important;
|
|
4875
|
+
background: var(--dsh-glass-card, var(--dsw-specific-sidebar-fill, #18181b)) !important;
|
|
4876
|
+
backdrop-filter: blur(var(--dsh-glass-blur, 16px)) !important;
|
|
4877
|
+
-webkit-backdrop-filter: blur(var(--dsh-glass-blur, 16px)) !important;
|
|
4878
|
+
overflow-y: auto !important;
|
|
4879
|
+
overflow-x: hidden !important;
|
|
4880
|
+
scrollbar-width: none !important;
|
|
4881
|
+
-ms-overflow-style: none !important;
|
|
4882
|
+
display: flex !important;
|
|
4883
|
+
flex-direction: column !important;
|
|
4884
|
+
align-items: center !important;
|
|
4885
|
+
}
|
|
4886
|
+
|
|
4887
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) {
|
|
4888
|
+
margin: 8px 12px 12px 0 !important;
|
|
4889
|
+
border-radius: 16px !important;
|
|
4890
|
+
border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
|
|
4891
|
+
box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
|
|
4892
|
+
background: var(--dsw-alias-bg-layer-1) !important;
|
|
4893
|
+
overflow-y: auto !important;
|
|
4894
|
+
height: calc(100% - 20px) !important;
|
|
4895
|
+
}
|
|
4896
|
+
|
|
4897
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"] {
|
|
4898
|
+
grid-column: 2 !important;
|
|
4899
|
+
grid-row: 1 / -1 !important;
|
|
4900
|
+
box-sizing: border-box !important;
|
|
4901
|
+
flex: 1 1 auto !important;
|
|
4902
|
+
min-width: 0 !important;
|
|
4903
|
+
min-height: 0 !important;
|
|
4904
|
+
overflow-y: auto !important;
|
|
4905
|
+
padding-top: calc(52px + 20px) !important;
|
|
4906
|
+
padding-bottom: 40px !important;
|
|
4907
|
+
padding-inline: 20px !important;
|
|
4908
|
+
margin: 0 !important;
|
|
4909
|
+
border-radius: 16px !important;
|
|
4910
|
+
border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
|
|
4911
|
+
box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
|
|
4912
|
+
background: var(--dsw-alias-bg-layer-1) !important;
|
|
4913
|
+
height: 100% !important;
|
|
4914
|
+
max-height: 100% !important;
|
|
4915
|
+
}
|
|
4916
|
+
|
|
4697
4917
|
[data-shortcut-modal="settings"][data-sidebar-collapsed] nav::-webkit-scrollbar,
|
|
4698
4918
|
[data-shortcut-modal="settings"][data-sidebar-collapsed] [class*="navList"]::-webkit-scrollbar {
|
|
4699
4919
|
display: none !important;
|
|
@@ -4846,25 +5066,53 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
4846
5066
|
flex: none !important;
|
|
4847
5067
|
}
|
|
4848
5068
|
|
|
4849
|
-
|
|
5069
|
+
/* 顶栏操作区(配置文件与关闭按钮):普通模式下透明浮动,无实体白条与下边框,绝不硬切出第二层顶部 */
|
|
5070
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="header"] {
|
|
5071
|
+
grid-column: 2 !important;
|
|
5072
|
+
grid-row: 1 / -1 !important;
|
|
5073
|
+
position: absolute !important;
|
|
5074
|
+
top: 0 !important;
|
|
5075
|
+
left: 0 !important;
|
|
5076
|
+
right: 0 !important;
|
|
5077
|
+
height: 56px !important;
|
|
5078
|
+
min-height: 56px !important;
|
|
5079
|
+
padding: 0 20px !important;
|
|
5080
|
+
border-radius: 0 !important;
|
|
5081
|
+
border: none !important;
|
|
5082
|
+
border-bottom: none !important;
|
|
5083
|
+
background: transparent !important;
|
|
5084
|
+
z-index: 10 !important;
|
|
5085
|
+
pointer-events: none !important;
|
|
5086
|
+
}
|
|
5087
|
+
|
|
5088
|
+
html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="header"],
|
|
5089
|
+
html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="header"] {
|
|
5090
|
+
background: transparent !important;
|
|
5091
|
+
border: none !important;
|
|
5092
|
+
border-bottom: none !important;
|
|
5093
|
+
}
|
|
5094
|
+
|
|
4850
5095
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="header"] {
|
|
4851
5096
|
grid-column: 2 !important;
|
|
4852
5097
|
grid-row: 1 / -1 !important;
|
|
4853
5098
|
position: absolute !important;
|
|
4854
5099
|
top: 8px !important;
|
|
4855
5100
|
left: 0 !important;
|
|
4856
|
-
right:
|
|
5101
|
+
right: 12px !important;
|
|
4857
5102
|
height: 52px !important;
|
|
4858
5103
|
min-height: 52px !important;
|
|
4859
5104
|
padding: 0 20px !important;
|
|
4860
|
-
border:
|
|
4861
|
-
border-
|
|
4862
|
-
|
|
4863
|
-
background: var(--dsw-alias-bg-layer-1) !important;
|
|
5105
|
+
border: none !important;
|
|
5106
|
+
border-radius: 0 !important;
|
|
5107
|
+
background: transparent !important;
|
|
4864
5108
|
z-index: 10 !important;
|
|
5109
|
+
pointer-events: none !important;
|
|
5110
|
+
}
|
|
5111
|
+
|
|
5112
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="header"] > * {
|
|
5113
|
+
pointer-events: auto !important;
|
|
4865
5114
|
}
|
|
4866
5115
|
|
|
4867
|
-
[data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav),
|
|
4868
5116
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) {
|
|
4869
5117
|
margin: 8px 12px 12px 0 !important;
|
|
4870
5118
|
border-radius: 16px !important;
|
|
@@ -4924,8 +5172,18 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
4924
5172
|
box-sizing: border-box !important;
|
|
4925
5173
|
}
|
|
4926
5174
|
|
|
4927
|
-
/* 4 块 Grid
|
|
4928
|
-
[data-shortcut-modal="settings"]:has(> [class*="options"])
|
|
5175
|
+
/* 4 块 Grid 布局映射:普通模式紧贴平铺,仅在云母模式下启用悬浮双岛与外层边距 */
|
|
5176
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:has(> [class*="options"]) {
|
|
5177
|
+
display: grid !important;
|
|
5178
|
+
grid-template-columns: 56px minmax(0, 1fr) !important;
|
|
5179
|
+
grid-template-rows: auto minmax(0, 1fr) !important;
|
|
5180
|
+
position: fixed !important;
|
|
5181
|
+
inset: 0 !important;
|
|
5182
|
+
gap: 0 !important;
|
|
5183
|
+
padding: 0 !important;
|
|
5184
|
+
background: var(--dsw-alias-bg-base, #151517) !important;
|
|
5185
|
+
}
|
|
5186
|
+
|
|
4929
5187
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="options"]),
|
|
4930
5188
|
html[data-dsh-glass] [data-shortcut-modal="settings"]:has(> [class*="options"]) {
|
|
4931
5189
|
display: grid !important;
|
|
@@ -4937,8 +5195,29 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
4937
5195
|
padding: 8px 12px 12px 12px !important;
|
|
4938
5196
|
}
|
|
4939
5197
|
|
|
4940
|
-
/*
|
|
4941
|
-
[data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="navTitle"]
|
|
5198
|
+
/* 左侧顶部区:普通模式下平铺实色无圆角,云母模式下为圆角磨砂卡片 */
|
|
5199
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="navTitle"] {
|
|
5200
|
+
grid-column: 1 !important;
|
|
5201
|
+
grid-row: 1 !important;
|
|
5202
|
+
box-sizing: border-box !important;
|
|
5203
|
+
width: 56px !important;
|
|
5204
|
+
min-width: 56px !important;
|
|
5205
|
+
max-width: 56px !important;
|
|
5206
|
+
padding: 14px 0 10px 0 !important;
|
|
5207
|
+
margin: 0 !important;
|
|
5208
|
+
align-items: center !important;
|
|
5209
|
+
justify-content: center !important;
|
|
5210
|
+
border-radius: 0 !important;
|
|
5211
|
+
border: none !important;
|
|
5212
|
+
border-right: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08)) !important;
|
|
5213
|
+
border-bottom: none !important;
|
|
5214
|
+
background: var(--dsw-specific-sidebar-fill, var(--dsw-alias-bg-layer-1, #18181b)) !important;
|
|
5215
|
+
backdrop-filter: none !important;
|
|
5216
|
+
-webkit-backdrop-filter: none !important;
|
|
5217
|
+
box-shadow: none !important;
|
|
5218
|
+
flex: none !important;
|
|
5219
|
+
}
|
|
5220
|
+
|
|
4942
5221
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="navTitle"] {
|
|
4943
5222
|
grid-column: 1 !important;
|
|
4944
5223
|
grid-row: 1 !important;
|
|
@@ -5034,9 +5313,37 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
5034
5313
|
display: none !important;
|
|
5035
5314
|
}
|
|
5036
5315
|
|
|
5037
|
-
/*
|
|
5038
|
-
[data-shortcut-modal="settings"] > nav,
|
|
5039
|
-
[data-shortcut-modal="settings"]:has(> [class*="options"]) > nav
|
|
5316
|
+
/* 左侧导航栏:普通模式下平铺实色无圆角无投影,云母模式下完整对齐首页云母磨砂圆角与下投影 */
|
|
5317
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"] > nav,
|
|
5318
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > nav {
|
|
5319
|
+
grid-column: 1 !important;
|
|
5320
|
+
grid-row: 2 !important;
|
|
5321
|
+
box-sizing: border-box !important;
|
|
5322
|
+
width: 56px !important;
|
|
5323
|
+
min-width: 56px !important;
|
|
5324
|
+
max-width: 56px !important;
|
|
5325
|
+
height: 100% !important;
|
|
5326
|
+
max-height: 100% !important;
|
|
5327
|
+
margin: 0 !important;
|
|
5328
|
+
padding: 0 0 16px !important;
|
|
5329
|
+
flex: none !important;
|
|
5330
|
+
border: none !important;
|
|
5331
|
+
border-right: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08)) !important;
|
|
5332
|
+
border-radius: 0 !important;
|
|
5333
|
+
box-shadow: none !important;
|
|
5334
|
+
background: var(--dsw-specific-sidebar-fill, var(--dsw-alias-bg-layer-1, #18181b)) !important;
|
|
5335
|
+
backdrop-filter: none !important;
|
|
5336
|
+
-webkit-backdrop-filter: none !important;
|
|
5337
|
+
overflow-y: auto !important;
|
|
5338
|
+
overflow-x: hidden !important;
|
|
5339
|
+
scrollbar-width: none !important;
|
|
5340
|
+
-ms-overflow-style: none !important;
|
|
5341
|
+
display: flex !important;
|
|
5342
|
+
flex-direction: column !important;
|
|
5343
|
+
align-items: center !important;
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5346
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"] > nav,
|
|
5040
5347
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="options"]) > nav,
|
|
5041
5348
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > nav {
|
|
5042
5349
|
grid-column: 1 !important;
|
|
@@ -5093,35 +5400,95 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
5093
5400
|
display: none !important;
|
|
5094
5401
|
}
|
|
5095
5402
|
|
|
5096
|
-
/* 移动端媒体查询下同样仅隐藏文字,不干涉图标 */
|
|
5097
|
-
[data-shortcut-modal="settings"] nav [class*="navList"] button svg,
|
|
5098
|
-
[data-shortcut-modal="settings"] nav [class*="navIcon"] svg {
|
|
5403
|
+
/* 移动端媒体查询下同样仅隐藏文字,不干涉图标 */
|
|
5404
|
+
[data-shortcut-modal="settings"] nav [class*="navList"] button svg,
|
|
5405
|
+
[data-shortcut-modal="settings"] nav [class*="navIcon"] svg {
|
|
5406
|
+
margin: 0 !important;
|
|
5407
|
+
width: 18px !important;
|
|
5408
|
+
height: 18px !important;
|
|
5409
|
+
}
|
|
5410
|
+
|
|
5411
|
+
/* 顶部操作区(配置文件与关闭按钮):对齐首页悬浮大卡片的 52px 顶栏,左边缘与右侧卡片完全对齐 */
|
|
5412
|
+
[data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="header"],
|
|
5413
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="header"] {
|
|
5414
|
+
grid-column: 2 !important;
|
|
5415
|
+
grid-row: 1 / -1 !important;
|
|
5416
|
+
position: absolute !important;
|
|
5417
|
+
top: 8px !important;
|
|
5418
|
+
left: 0 !important;
|
|
5419
|
+
right: 12px !important;
|
|
5420
|
+
height: 52px !important;
|
|
5421
|
+
min-height: 52px !important;
|
|
5422
|
+
padding: 0 20px !important;
|
|
5423
|
+
border: none !important;
|
|
5424
|
+
border-radius: 0 !important;
|
|
5425
|
+
background: transparent !important;
|
|
5426
|
+
z-index: 10 !important;
|
|
5427
|
+
pointer-events: none !important;
|
|
5428
|
+
}
|
|
5429
|
+
|
|
5430
|
+
html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="header"] > * {
|
|
5431
|
+
pointer-events: auto !important;
|
|
5432
|
+
}
|
|
5433
|
+
|
|
5434
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
|
|
5435
|
+
margin: 0 !important;
|
|
5436
|
+
border-radius: 0 !important;
|
|
5437
|
+
border: none !important;
|
|
5438
|
+
box-shadow: none !important;
|
|
5439
|
+
background: var(--dsw-alias-bg-base, #151517) !important;
|
|
5440
|
+
height: 100% !important;
|
|
5441
|
+
max-height: 100% !important;
|
|
5442
|
+
overflow: hidden !important;
|
|
5443
|
+
display: flex !important;
|
|
5444
|
+
flex-direction: column !important;
|
|
5445
|
+
}
|
|
5446
|
+
|
|
5447
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child {
|
|
5448
|
+
background: transparent !important;
|
|
5449
|
+
border: none !important;
|
|
5450
|
+
border-bottom: none !important;
|
|
5451
|
+
flex: none !important;
|
|
5452
|
+
}
|
|
5453
|
+
|
|
5454
|
+
/* 右侧设置内容区:普通模式平铺紧贴,云母模式下复刻首页右侧 16px 圆角大卡片独立悬浮岛 */
|
|
5455
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) {
|
|
5456
|
+
margin: 0 !important;
|
|
5457
|
+
border-radius: 0 !important;
|
|
5458
|
+
border: none !important;
|
|
5459
|
+
box-shadow: none !important;
|
|
5460
|
+
background: transparent !important;
|
|
5461
|
+
overflow-y: auto !important;
|
|
5462
|
+
flex: 1 1 auto !important;
|
|
5463
|
+
min-height: 0 !important;
|
|
5464
|
+
padding-top: 28px !important;
|
|
5465
|
+
padding-bottom: 40px !important;
|
|
5466
|
+
padding-inline: 20px !important;
|
|
5467
|
+
box-sizing: border-box !important;
|
|
5468
|
+
}
|
|
5469
|
+
|
|
5470
|
+
html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"] {
|
|
5099
5471
|
margin: 0 !important;
|
|
5100
|
-
|
|
5101
|
-
|
|
5472
|
+
border-radius: 0 !important;
|
|
5473
|
+
border: none !important;
|
|
5474
|
+
box-shadow: none !important;
|
|
5475
|
+
background: var(--dsw-alias-bg-base, #151517) !important;
|
|
5476
|
+
overflow-y: auto !important;
|
|
5477
|
+
height: 100% !important;
|
|
5478
|
+
max-height: 100% !important;
|
|
5479
|
+
padding-top: calc(56px + 28px) !important;
|
|
5480
|
+
padding-bottom: 40px !important;
|
|
5481
|
+
padding-inline: 20px !important;
|
|
5482
|
+
box-sizing: border-box !important;
|
|
5102
5483
|
}
|
|
5103
5484
|
|
|
5104
|
-
|
|
5105
|
-
[data-
|
|
5106
|
-
html[data-dsh-glass-float] [data-shortcut-modal="settings"]
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
position: absolute !important;
|
|
5110
|
-
top: 8px !important;
|
|
5111
|
-
left: 0 !important;
|
|
5112
|
-
right: 0 !important;
|
|
5113
|
-
height: 52px !important;
|
|
5114
|
-
min-height: 52px !important;
|
|
5115
|
-
padding: 0 20px !important;
|
|
5116
|
-
border: 1px solid var(--dsh-glass-rim-soft, rgba(255, 255, 255, 0.08)) !important;
|
|
5117
|
-
border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08)) !important;
|
|
5118
|
-
border-radius: 16px 16px 0 0 !important;
|
|
5119
|
-
background: var(--dsw-alias-bg-layer-1) !important;
|
|
5120
|
-
z-index: 10 !important;
|
|
5485
|
+
html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav),
|
|
5486
|
+
html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav),
|
|
5487
|
+
html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"],
|
|
5488
|
+
html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"] {
|
|
5489
|
+
background: var(--dsw-alias-bg-base, #ffffff) !important;
|
|
5121
5490
|
}
|
|
5122
5491
|
|
|
5123
|
-
/* 右侧设置内容区:完整复刻首页右侧 16px 圆角大卡片独立悬浮岛 */
|
|
5124
|
-
[data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav),
|
|
5125
5492
|
html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
|
|
5126
5493
|
margin: 8px 12px 12px 0 !important;
|
|
5127
5494
|
border-radius: 16px !important;
|
|
@@ -5432,7 +5799,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
5432
5799
|
*/
|
|
5433
5800
|
const CODEX_UI_NAV_MARKER = "data-dcu-nav-icon";
|
|
5434
5801
|
const NAV_ROW_SELECTOR = "[role=\"dialog\"] nav button, [data-shortcut-modal=\"settings\"] nav button";
|
|
5435
|
-
const STYLE_ID$
|
|
5802
|
+
const STYLE_ID$3 = "dcu-settings-nav-icon-style";
|
|
5436
5803
|
const ICON_MASK_URL = `url("data:image/svg+xml,${encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><rect x=\"1.5\" y=\"2\" width=\"13\" height=\"12\" rx=\"2\" stroke=\"black\" stroke-width=\"1.3\" fill=\"none\"/><line x1=\"5.5\" y1=\"2\" x2=\"5.5\" y2=\"14\" stroke=\"black\" stroke-width=\"1.3\"/><line x1=\"5.5\" y1=\"5.5\" x2=\"14.5\" y2=\"5.5\" stroke=\"black\" stroke-width=\"1.3\"/></svg>")}")`;
|
|
5437
5804
|
const NAV_ICON_CSS = `
|
|
5438
5805
|
[${CODEX_UI_NAV_MARKER}="codex-ui"] > svg { display: none !important; }
|
|
@@ -5453,9 +5820,9 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
5453
5820
|
}
|
|
5454
5821
|
`;
|
|
5455
5822
|
function ensureStyle(doc) {
|
|
5456
|
-
if (doc.getElementById(STYLE_ID$
|
|
5823
|
+
if (doc.getElementById(STYLE_ID$3) !== null) return;
|
|
5457
5824
|
const style = doc.createElement("style");
|
|
5458
|
-
style.id = STYLE_ID$
|
|
5825
|
+
style.id = STYLE_ID$3;
|
|
5459
5826
|
style.textContent = NAV_ICON_CSS;
|
|
5460
5827
|
(doc.head ?? doc.documentElement).appendChild(style);
|
|
5461
5828
|
}
|
|
@@ -5503,7 +5870,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
5503
5870
|
doc.querySelectorAll(`[${CODEX_UI_NAV_MARKER}="codex-ui"]`).forEach((btn) => {
|
|
5504
5871
|
btn.removeAttribute(CODEX_UI_NAV_MARKER);
|
|
5505
5872
|
});
|
|
5506
|
-
doc.getElementById(STYLE_ID$
|
|
5873
|
+
doc.getElementById(STYLE_ID$3)?.remove();
|
|
5507
5874
|
};
|
|
5508
5875
|
}
|
|
5509
5876
|
//#endregion
|
|
@@ -7868,7 +8235,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
|
|
|
7868
8235
|
/** 追加在项目行菜单里的入口标记。 */
|
|
7869
8236
|
const MENU_ITEM_ATTR = "data-dcu-ws-section-item";
|
|
7870
8237
|
const HEADER_CLASS = "dcu-ws-section";
|
|
7871
|
-
const STYLE_ID = "michengai-codex-ui-sections-styles";
|
|
8238
|
+
const STYLE_ID$2 = "michengai-codex-ui-sections-styles";
|
|
7872
8239
|
/** 各分区的折叠状态(与本文件的分区数据分键存放)。 */
|
|
7873
8240
|
const COLLAPSED_STORAGE_KEY = "michengai.codex-ui.workspace-sections-collapsed.v1";
|
|
7874
8241
|
/**
|
|
@@ -7914,9 +8281,9 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
7914
8281
|
`;
|
|
7915
8282
|
/** 注入分区样式;已存在时复用(样式与组件生命周期解耦,卸载不摘除)。 */
|
|
7916
8283
|
function injectStyles() {
|
|
7917
|
-
if (document.getElementById(STYLE_ID) !== null) return;
|
|
8284
|
+
if (document.getElementById(STYLE_ID$2) !== null) return;
|
|
7918
8285
|
const style = document.createElement("style");
|
|
7919
|
-
style.id = STYLE_ID;
|
|
8286
|
+
style.id = STYLE_ID$2;
|
|
7920
8287
|
style.textContent = SECTIONS_CSS;
|
|
7921
8288
|
document.head.appendChild(style);
|
|
7922
8289
|
}
|
|
@@ -8292,7 +8659,18 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
8292
8659
|
let lastAlignKey = "";
|
|
8293
8660
|
/** 把标题按分区顺序放到各自第一个分组块前面;空分区贴着下一个分区显示。 */
|
|
8294
8661
|
function placeHeaders(blocks, layoutState = state) {
|
|
8295
|
-
if (blocks.length === 0)
|
|
8662
|
+
if (blocks.length === 0) {
|
|
8663
|
+
const stalePinned = headers.get(PINNED_SECTION_ID);
|
|
8664
|
+
if (stalePinned !== void 0) {
|
|
8665
|
+
stalePinned.remove();
|
|
8666
|
+
headers.delete(PINNED_SECTION_ID);
|
|
8667
|
+
if (collapsed["pinned"] === true) {
|
|
8668
|
+
delete collapsed[PINNED_SECTION_ID];
|
|
8669
|
+
persistCollapsed();
|
|
8670
|
+
}
|
|
8671
|
+
}
|
|
8672
|
+
return;
|
|
8673
|
+
}
|
|
8296
8674
|
const target = blocks[0].block.parentElement;
|
|
8297
8675
|
if (target === null) return;
|
|
8298
8676
|
const ungrouped = Array.from(list?.querySelectorAll("[data-row-key=\"workspace:\"]") ?? []).map((row) => row instanceof HTMLElement ? blockOf(row, list) : null).find((block) => block !== null);
|
|
@@ -8303,6 +8681,18 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
8303
8681
|
const first = section.ids.map((id) => byId.get(id)).find((block) => block !== void 0);
|
|
8304
8682
|
if (first !== void 0) reference = first;
|
|
8305
8683
|
else if (section.id === "default" && ungrouped !== void 0) reference = ungrouped;
|
|
8684
|
+
if (section.id === "pinned" && section.ids.length === 0) {
|
|
8685
|
+
const stale = headers.get(PINNED_SECTION_ID);
|
|
8686
|
+
if (stale !== void 0) {
|
|
8687
|
+
stale.remove();
|
|
8688
|
+
headers.delete(PINNED_SECTION_ID);
|
|
8689
|
+
if (collapsed["pinned"] === true) {
|
|
8690
|
+
delete collapsed[PINNED_SECTION_ID];
|
|
8691
|
+
persistCollapsed();
|
|
8692
|
+
}
|
|
8693
|
+
}
|
|
8694
|
+
continue;
|
|
8695
|
+
}
|
|
8306
8696
|
const header = ensureHeader(section.id, section.name);
|
|
8307
8697
|
if (header.parentElement !== target || header.nextElementSibling !== reference) target.insertBefore(header, reference);
|
|
8308
8698
|
reference = header;
|
|
@@ -8328,7 +8718,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
8328
8718
|
}
|
|
8329
8719
|
const alignKey = `${headers.size}:${list?.clientWidth ?? 0}`;
|
|
8330
8720
|
const label = document.querySelector("[class*=\"sectionLabel\"]");
|
|
8331
|
-
const firstHeader = headers.get(
|
|
8721
|
+
const firstHeader = layoutState.sections.map((section) => headers.get(section.id)).find((header) => header !== void 0);
|
|
8332
8722
|
if (label !== null && firstHeader !== void 0 && alignKey !== lastAlignKey) {
|
|
8333
8723
|
lastAlignKey = alignKey;
|
|
8334
8724
|
const lead = Math.max(0, Math.round(label.getBoundingClientRect().left - firstHeader.getBoundingClientRect().left));
|
|
@@ -9190,6 +9580,572 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
9190
9580
|
return dispose;
|
|
9191
9581
|
}
|
|
9192
9582
|
//#endregion
|
|
9583
|
+
//#region src/client/desktop-menu/restart-client.ts
|
|
9584
|
+
/**
|
|
9585
|
+
* 「重启应用与 Host」的客户端通道与进度卡片。
|
|
9586
|
+
*
|
|
9587
|
+
* 页面只做三件事:问 Host 能不能重启(status,拿到一次性令牌)→ 带着令牌 POST →
|
|
9588
|
+
* 轮询阶段把实情显示出来。真正的退出与重开由 Host 侧生成的助手脚本完成。
|
|
9589
|
+
*
|
|
9590
|
+
* 为什么不在这里直接 location.reload:重载只换页面,插件宿主进程还在,装了新插件
|
|
9591
|
+
* 也不生效;真重启必须让整个应用退出再起来。
|
|
9592
|
+
*/
|
|
9593
|
+
/** 与 checkDesktopMenuEnabled 相同的方式拼出端点地址(兼容 dsh-app:// 协议)。 */
|
|
9594
|
+
function endpointUrl(search) {
|
|
9595
|
+
const base = typeof document !== "undefined" && document.baseURI ? document.baseURI : "http://localhost";
|
|
9596
|
+
const normalizedBase = base.endsWith("/") ? base : `${base}/`;
|
|
9597
|
+
const path = CODEX_UI_API_ENDPOINTS.desktopMenu.startsWith("/") ? CODEX_UI_API_ENDPOINTS.desktopMenu.slice(1) : CODEX_UI_API_ENDPOINTS.desktopMenu;
|
|
9598
|
+
return `${new URL(path, normalizedBase).href}${search}`;
|
|
9599
|
+
}
|
|
9600
|
+
/** 读一次重启状态;网络/协议不可用时返回 null(调用方据此报「通道不可用」)。 */
|
|
9601
|
+
async function fetchRestartStatus() {
|
|
9602
|
+
try {
|
|
9603
|
+
const response = await fetch(endpointUrl("?action=status"), {
|
|
9604
|
+
method: "GET",
|
|
9605
|
+
cache: "no-store",
|
|
9606
|
+
headers: { accept: "application/json" }
|
|
9607
|
+
});
|
|
9608
|
+
if (!response.ok) return null;
|
|
9609
|
+
const payload = await response.json();
|
|
9610
|
+
if (typeof payload?.token !== "string") return null;
|
|
9611
|
+
return payload;
|
|
9612
|
+
} catch {
|
|
9613
|
+
return null;
|
|
9614
|
+
}
|
|
9615
|
+
}
|
|
9616
|
+
/** 带着令牌请求重启。 */
|
|
9617
|
+
async function requestRestart(token) {
|
|
9618
|
+
try {
|
|
9619
|
+
const response = await fetch(endpointUrl("?action=restart"), {
|
|
9620
|
+
method: "POST",
|
|
9621
|
+
cache: "no-store",
|
|
9622
|
+
headers: {
|
|
9623
|
+
accept: "application/json",
|
|
9624
|
+
[CODEX_UI_RESTART_HEADER]: token
|
|
9625
|
+
}
|
|
9626
|
+
});
|
|
9627
|
+
const payload = await response.json().catch(() => ({}));
|
|
9628
|
+
if (response.ok && payload.ok === true) return { ok: true };
|
|
9629
|
+
return {
|
|
9630
|
+
ok: false,
|
|
9631
|
+
error: payload.error ?? `http-${response.status}`,
|
|
9632
|
+
detail: payload.detail,
|
|
9633
|
+
reason: payload.reason
|
|
9634
|
+
};
|
|
9635
|
+
} catch (error) {
|
|
9636
|
+
return {
|
|
9637
|
+
ok: false,
|
|
9638
|
+
error: error instanceof Error ? error.message : String(error)
|
|
9639
|
+
};
|
|
9640
|
+
}
|
|
9641
|
+
}
|
|
9642
|
+
const STYLE_ID$1 = "dcu-desktop-restart-style";
|
|
9643
|
+
const STYLES$1 = `
|
|
9644
|
+
.dcu-restart-toast {
|
|
9645
|
+
position: fixed;
|
|
9646
|
+
z-index: 10001;
|
|
9647
|
+
right: 20px;
|
|
9648
|
+
bottom: 20px;
|
|
9649
|
+
width: min(380px, calc(100vw - 40px));
|
|
9650
|
+
padding: 14px 16px;
|
|
9651
|
+
display: flex;
|
|
9652
|
+
flex-direction: column;
|
|
9653
|
+
gap: 8px;
|
|
9654
|
+
border-radius: var(--dsw-radius-md, 10px);
|
|
9655
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.1));
|
|
9656
|
+
background: var(--dsw-menu-surface-fill, var(--dsw-alias-surface-overlay, #1e1e22));
|
|
9657
|
+
backdrop-filter: var(--dsw-menu-backdrop-filter, blur(40px) saturate(150%));
|
|
9658
|
+
-webkit-backdrop-filter: var(--dsw-menu-backdrop-filter, blur(40px) saturate(150%));
|
|
9659
|
+
box-shadow: var(--dsw-elevation-prominent, 0 14px 34px rgba(0, 0, 0, 0.36));
|
|
9660
|
+
color: var(--dsw-alias-label-primary, #fff);
|
|
9661
|
+
font-family: var(--dsw-font-family, sans-serif);
|
|
9662
|
+
font-size: 13px;
|
|
9663
|
+
line-height: 19px;
|
|
9664
|
+
animation: dcu-restart-in 120ms ease-out;
|
|
9665
|
+
}
|
|
9666
|
+
|
|
9667
|
+
@keyframes dcu-restart-in {
|
|
9668
|
+
from { opacity: 0; transform: translateY(6px); }
|
|
9669
|
+
to { opacity: 1; transform: translateY(0); }
|
|
9670
|
+
}
|
|
9671
|
+
|
|
9672
|
+
.dcu-restart-toast[data-tone="error"] {
|
|
9673
|
+
border-color: var(--dsw-alias-state-error-primary, #ff6b6b);
|
|
9674
|
+
}
|
|
9675
|
+
|
|
9676
|
+
.dcu-restart-toast-title {
|
|
9677
|
+
font-weight: 600;
|
|
9678
|
+
}
|
|
9679
|
+
|
|
9680
|
+
.dcu-restart-toast-body {
|
|
9681
|
+
color: var(--dsw-alias-label-secondary, #a1a1a6);
|
|
9682
|
+
overflow-wrap: anywhere;
|
|
9683
|
+
}
|
|
9684
|
+
|
|
9685
|
+
.dcu-restart-toast-action {
|
|
9686
|
+
align-self: flex-end;
|
|
9687
|
+
height: 26px;
|
|
9688
|
+
padding: 0 10px;
|
|
9689
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
9690
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(255, 255, 255, 0.14));
|
|
9691
|
+
background: transparent;
|
|
9692
|
+
color: inherit;
|
|
9693
|
+
font: inherit;
|
|
9694
|
+
font-size: 12px;
|
|
9695
|
+
cursor: pointer;
|
|
9696
|
+
}
|
|
9697
|
+
|
|
9698
|
+
.dcu-restart-toast-action:hover {
|
|
9699
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(255, 255, 255, 0.08));
|
|
9700
|
+
}
|
|
9701
|
+
`;
|
|
9702
|
+
function ensureStyles$1() {
|
|
9703
|
+
if (document.getElementById(STYLE_ID$1) !== null) return;
|
|
9704
|
+
const style = document.createElement("style");
|
|
9705
|
+
style.id = STYLE_ID$1;
|
|
9706
|
+
style.textContent = STYLES$1;
|
|
9707
|
+
document.head.append(style);
|
|
9708
|
+
}
|
|
9709
|
+
/**
|
|
9710
|
+
* 显示重启提示卡。
|
|
9711
|
+
* @param copy - 当前语言文案。
|
|
9712
|
+
*/
|
|
9713
|
+
function showRestartToast(copy) {
|
|
9714
|
+
ensureStyles$1();
|
|
9715
|
+
const card = document.createElement("div");
|
|
9716
|
+
card.className = "dcu-restart-toast";
|
|
9717
|
+
card.setAttribute("role", "status");
|
|
9718
|
+
card.setAttribute("aria-live", "polite");
|
|
9719
|
+
const title = document.createElement("div");
|
|
9720
|
+
title.className = "dcu-restart-toast-title";
|
|
9721
|
+
const body = document.createElement("div");
|
|
9722
|
+
body.className = "dcu-restart-toast-body";
|
|
9723
|
+
const action = document.createElement("button");
|
|
9724
|
+
action.type = "button";
|
|
9725
|
+
action.className = "dcu-restart-toast-action";
|
|
9726
|
+
action.textContent = copy.close;
|
|
9727
|
+
action.hidden = true;
|
|
9728
|
+
action.addEventListener("click", () => {
|
|
9729
|
+
card.remove();
|
|
9730
|
+
});
|
|
9731
|
+
card.append(title, body, action);
|
|
9732
|
+
document.body.append(card);
|
|
9733
|
+
return { set(nextTitle, nextBody, tone = "info") {
|
|
9734
|
+
title.textContent = nextTitle;
|
|
9735
|
+
body.textContent = nextBody ?? "";
|
|
9736
|
+
body.hidden = nextBody === void 0 || nextBody === "";
|
|
9737
|
+
card.dataset.tone = tone;
|
|
9738
|
+
action.hidden = tone !== "error";
|
|
9739
|
+
} };
|
|
9740
|
+
}
|
|
9741
|
+
/**
|
|
9742
|
+
* 重启后盯住阶段:页面通常会在应用退出时被带走,所以这里只是尽量把结果说清楚。
|
|
9743
|
+
* @param toast - 提示卡。
|
|
9744
|
+
* @param copy - 文案。
|
|
9745
|
+
* @param pollMs - 轮询间隔。
|
|
9746
|
+
* @param limitMs - 最长观察时间。
|
|
9747
|
+
*/
|
|
9748
|
+
function watchRestart(toast, copy, pollMs = 700, limitMs = 9e4) {
|
|
9749
|
+
const startedAt = Date.now();
|
|
9750
|
+
let timer;
|
|
9751
|
+
let stopped = false;
|
|
9752
|
+
const stop = () => {
|
|
9753
|
+
stopped = true;
|
|
9754
|
+
if (timer !== void 0) window.clearInterval(timer);
|
|
9755
|
+
};
|
|
9756
|
+
const tick = async () => {
|
|
9757
|
+
if (stopped) return;
|
|
9758
|
+
if (Date.now() - startedAt > limitMs) {
|
|
9759
|
+
stop();
|
|
9760
|
+
toast.set(copy.timeout, void 0, "error");
|
|
9761
|
+
return;
|
|
9762
|
+
}
|
|
9763
|
+
const status = await fetchRestartStatus();
|
|
9764
|
+
if (stopped) return;
|
|
9765
|
+
if (status === null) return;
|
|
9766
|
+
const phase = status.phase;
|
|
9767
|
+
if (phase === "quitting" || phase === "starting") {
|
|
9768
|
+
toast.set(copy.quitting);
|
|
9769
|
+
return;
|
|
9770
|
+
}
|
|
9771
|
+
if (phase === "relaunched") {
|
|
9772
|
+
stop();
|
|
9773
|
+
toast.set(copy.relaunched);
|
|
9774
|
+
return;
|
|
9775
|
+
}
|
|
9776
|
+
if (phase === "cancelled") {
|
|
9777
|
+
stop();
|
|
9778
|
+
toast.set(copy.cancelled, status.detail, "error");
|
|
9779
|
+
return;
|
|
9780
|
+
}
|
|
9781
|
+
if (phase === "launch-failed") {
|
|
9782
|
+
stop();
|
|
9783
|
+
toast.set(copy.launchFailed, status.detail, "error");
|
|
9784
|
+
}
|
|
9785
|
+
};
|
|
9786
|
+
timer = window.setInterval(() => {
|
|
9787
|
+
tick();
|
|
9788
|
+
}, pollMs);
|
|
9789
|
+
return stop;
|
|
9790
|
+
}
|
|
9791
|
+
//#endregion
|
|
9792
|
+
//#region src/client/desktop-menu/index.ts
|
|
9793
|
+
/** 「重启应用与 Host」的文案:全部来自本插件的词典,不在代码里写死语言。 */
|
|
9794
|
+
function restartCopy(translate) {
|
|
9795
|
+
return {
|
|
9796
|
+
quitting: translate("desktopMenu.restart.quitting", "Closing and reopening DeepSeek Harness…"),
|
|
9797
|
+
relaunched: translate("desktopMenu.restart.relaunched", "Restarted."),
|
|
9798
|
+
cancelled: translate("desktopMenu.restart.cancelled", "The app did not exit; this restart was cancelled."),
|
|
9799
|
+
launchFailed: translate("desktopMenu.restart.launchFailed", "The app exited but could not be reopened automatically."),
|
|
9800
|
+
timeout: translate("desktopMenu.restart.timeout", "The restart did not finish in time; please check the app."),
|
|
9801
|
+
close: translate("desktopMenu.restart.close", "Close"),
|
|
9802
|
+
failed: translate("desktopMenu.restart.failed", "Restart failed"),
|
|
9803
|
+
busy: translate("desktopMenu.restart.busy", "A restart is already in progress. Please wait.")
|
|
9804
|
+
};
|
|
9805
|
+
}
|
|
9806
|
+
/** 不可重启的原因代码 → 本地文案。 */
|
|
9807
|
+
function unsupportedText(translate, reason) {
|
|
9808
|
+
if (reason === "desktop-only") return translate("desktopMenu.restart.unsupportedDesktopOnly", "This is not the desktop app, so it cannot be restarted.");
|
|
9809
|
+
return translate("desktopMenu.restart.unsupportedMissingApp", "Cannot locate the DeepSeek Harness executable, so it cannot be restarted.");
|
|
9810
|
+
}
|
|
9811
|
+
const MENU_HOST_CLASS = "dcu-desktop-menu-popover";
|
|
9812
|
+
const STYLE_ID = "dcu-desktop-menu-style";
|
|
9813
|
+
const STYLES = `
|
|
9814
|
+
.${MENU_HOST_CLASS} {
|
|
9815
|
+
position: fixed;
|
|
9816
|
+
z-index: 10000;
|
|
9817
|
+
min-width: 200px;
|
|
9818
|
+
max-width: 320px;
|
|
9819
|
+
padding: 4px;
|
|
9820
|
+
display: flex;
|
|
9821
|
+
flex-direction: column;
|
|
9822
|
+
gap: 2px;
|
|
9823
|
+
border-radius: var(--dsw-radius-md, 8px);
|
|
9824
|
+
background: var(--dsw-menu-surface-fill, var(--dsw-alias-surface-overlay, #1e1e22));
|
|
9825
|
+
backdrop-filter: var(--dsw-menu-backdrop-filter, blur(40px) saturate(150%));
|
|
9826
|
+
-webkit-backdrop-filter: var(--dsw-menu-backdrop-filter, blur(40px) saturate(150%));
|
|
9827
|
+
box-shadow: var(--dsw-elevation-prominent, 0 14px 34px rgba(0,0,0,0.36), 0 2px 8px rgba(0,0,0,0.24));
|
|
9828
|
+
border: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08));
|
|
9829
|
+
color: var(--dsw-alias-label-primary, #ffffff);
|
|
9830
|
+
font-family: var(--dsw-font-family, sans-serif);
|
|
9831
|
+
animation: dcu-menu-fade-in 100ms ease-out;
|
|
9832
|
+
outline: none;
|
|
9833
|
+
-webkit-app-region: no-drag;
|
|
9834
|
+
}
|
|
9835
|
+
|
|
9836
|
+
@keyframes dcu-menu-fade-in {
|
|
9837
|
+
from { opacity: 0; transform: translateY(-4px); }
|
|
9838
|
+
to { opacity: 1; transform: translateY(0); }
|
|
9839
|
+
}
|
|
9840
|
+
|
|
9841
|
+
.${MENU_HOST_CLASS} .dcu-menu-separator {
|
|
9842
|
+
height: 1px;
|
|
9843
|
+
margin: 4px 6px;
|
|
9844
|
+
background: var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.08));
|
|
9845
|
+
}
|
|
9846
|
+
|
|
9847
|
+
.${MENU_HOST_CLASS} button.dcu-menu-item {
|
|
9848
|
+
display: flex;
|
|
9849
|
+
align-items: center;
|
|
9850
|
+
justify-content: space-between;
|
|
9851
|
+
gap: 12px;
|
|
9852
|
+
width: 100%;
|
|
9853
|
+
min-height: 28px;
|
|
9854
|
+
padding: 5px 8px;
|
|
9855
|
+
text-align: left;
|
|
9856
|
+
border: 0;
|
|
9857
|
+
border-radius: var(--dsw-radius-sm, 6px);
|
|
9858
|
+
background: transparent;
|
|
9859
|
+
color: inherit;
|
|
9860
|
+
font: inherit;
|
|
9861
|
+
font-size: 13px;
|
|
9862
|
+
line-height: 18px;
|
|
9863
|
+
cursor: pointer;
|
|
9864
|
+
outline: none;
|
|
9865
|
+
transition: background-color 100ms ease;
|
|
9866
|
+
user-select: none;
|
|
9867
|
+
-webkit-user-select: none;
|
|
9868
|
+
-webkit-app-region: no-drag;
|
|
9869
|
+
}
|
|
9870
|
+
|
|
9871
|
+
.${MENU_HOST_CLASS} button.dcu-menu-item:hover,
|
|
9872
|
+
.${MENU_HOST_CLASS} button.dcu-menu-item:focus-visible {
|
|
9873
|
+
background: var(--dsw-alias-interactive-bg-hover, rgba(255, 255, 255, 0.08));
|
|
9874
|
+
}
|
|
9875
|
+
|
|
9876
|
+
.${MENU_HOST_CLASS} .dcu-menu-label {
|
|
9877
|
+
flex: 1 1 auto;
|
|
9878
|
+
white-space: nowrap;
|
|
9879
|
+
overflow: hidden;
|
|
9880
|
+
text-overflow: ellipsis;
|
|
9881
|
+
}
|
|
9882
|
+
`;
|
|
9883
|
+
function ensureStyles() {
|
|
9884
|
+
if (document.getElementById(STYLE_ID) !== null) return;
|
|
9885
|
+
const style = document.createElement("style");
|
|
9886
|
+
style.id = STYLE_ID;
|
|
9887
|
+
style.textContent = STYLES;
|
|
9888
|
+
document.head.append(style);
|
|
9889
|
+
}
|
|
9890
|
+
let activePopover = null;
|
|
9891
|
+
let activeAnchor = null;
|
|
9892
|
+
function closeActiveMenu(restoreFocus = false) {
|
|
9893
|
+
const anchor = activeAnchor;
|
|
9894
|
+
if (activePopover !== null) {
|
|
9895
|
+
activePopover.remove();
|
|
9896
|
+
activePopover = null;
|
|
9897
|
+
}
|
|
9898
|
+
if (activeAnchor !== null) {
|
|
9899
|
+
activeAnchor.setAttribute("aria-expanded", "false");
|
|
9900
|
+
activeAnchor = null;
|
|
9901
|
+
}
|
|
9902
|
+
if (restoreFocus && anchor && anchor.isConnected) anchor.focus();
|
|
9903
|
+
}
|
|
9904
|
+
function openDropdown(anchor, items, options = {}) {
|
|
9905
|
+
if (activeAnchor === anchor && activePopover !== null) {
|
|
9906
|
+
closeActiveMenu();
|
|
9907
|
+
return;
|
|
9908
|
+
}
|
|
9909
|
+
closeActiveMenu();
|
|
9910
|
+
ensureStyles();
|
|
9911
|
+
const rect = anchor.getBoundingClientRect();
|
|
9912
|
+
const popover = document.createElement("div");
|
|
9913
|
+
popover.className = MENU_HOST_CLASS;
|
|
9914
|
+
popover.setAttribute("role", "menu");
|
|
9915
|
+
popover.tabIndex = -1;
|
|
9916
|
+
for (const item of items) {
|
|
9917
|
+
if (item.separatorBefore) {
|
|
9918
|
+
const sep = document.createElement("div");
|
|
9919
|
+
sep.className = "dcu-menu-separator";
|
|
9920
|
+
sep.setAttribute("role", "separator");
|
|
9921
|
+
popover.append(sep);
|
|
9922
|
+
}
|
|
9923
|
+
const btn = document.createElement("button");
|
|
9924
|
+
btn.type = "button";
|
|
9925
|
+
btn.className = "dcu-menu-item";
|
|
9926
|
+
btn.setAttribute("role", "menuitem");
|
|
9927
|
+
const labelSpan = document.createElement("span");
|
|
9928
|
+
labelSpan.className = "dcu-menu-label";
|
|
9929
|
+
labelSpan.textContent = item.label;
|
|
9930
|
+
btn.append(labelSpan);
|
|
9931
|
+
btn.addEventListener("pointerdown", (e) => {
|
|
9932
|
+
e.stopPropagation();
|
|
9933
|
+
});
|
|
9934
|
+
btn.addEventListener("mousedown", (e) => {
|
|
9935
|
+
e.stopPropagation();
|
|
9936
|
+
});
|
|
9937
|
+
btn.addEventListener("click", (e) => {
|
|
9938
|
+
e.preventDefault();
|
|
9939
|
+
e.stopPropagation();
|
|
9940
|
+
closeActiveMenu();
|
|
9941
|
+
setTimeout(() => {
|
|
9942
|
+
try {
|
|
9943
|
+
Promise.resolve(item.action?.()).catch((err) => {
|
|
9944
|
+
console.error("Menu action error:", err);
|
|
9945
|
+
});
|
|
9946
|
+
} catch (err) {
|
|
9947
|
+
console.error("Menu action error:", err);
|
|
9948
|
+
}
|
|
9949
|
+
}, 10);
|
|
9950
|
+
});
|
|
9951
|
+
popover.append(btn);
|
|
9952
|
+
}
|
|
9953
|
+
document.body.append(popover);
|
|
9954
|
+
const popoverRect = popover.getBoundingClientRect();
|
|
9955
|
+
let left = rect.left;
|
|
9956
|
+
let top = rect.bottom + 2;
|
|
9957
|
+
if (left + popoverRect.width > window.innerWidth - 8) left = window.innerWidth - popoverRect.width - 8;
|
|
9958
|
+
if (left < 8) left = 8;
|
|
9959
|
+
if (top + popoverRect.height > window.innerHeight - 8) top = rect.top - popoverRect.height - 2;
|
|
9960
|
+
popover.style.left = `${Math.round(left)}px`;
|
|
9961
|
+
popover.style.top = `${Math.round(top)}px`;
|
|
9962
|
+
anchor.setAttribute("aria-expanded", "true");
|
|
9963
|
+
activePopover = popover;
|
|
9964
|
+
activeAnchor = anchor;
|
|
9965
|
+
const menuItems = Array.from(popover.querySelectorAll("button.dcu-menu-item"));
|
|
9966
|
+
const focusAt = (index) => {
|
|
9967
|
+
if (menuItems.length === 0) return;
|
|
9968
|
+
const clamped = Math.max(0, Math.min(index, menuItems.length - 1));
|
|
9969
|
+
menuItems[clamped].focus();
|
|
9970
|
+
};
|
|
9971
|
+
popover.addEventListener("keydown", (event) => {
|
|
9972
|
+
const current = menuItems.indexOf(document.activeElement);
|
|
9973
|
+
if (event.key === "ArrowDown") {
|
|
9974
|
+
event.preventDefault();
|
|
9975
|
+
focusAt(current < 0 ? 0 : current + 1);
|
|
9976
|
+
} else if (event.key === "ArrowUp") {
|
|
9977
|
+
event.preventDefault();
|
|
9978
|
+
focusAt(current < 0 ? menuItems.length - 1 : current - 1);
|
|
9979
|
+
} else if (event.key === "Home") {
|
|
9980
|
+
event.preventDefault();
|
|
9981
|
+
focusAt(0);
|
|
9982
|
+
} else if (event.key === "End") {
|
|
9983
|
+
event.preventDefault();
|
|
9984
|
+
focusAt(menuItems.length - 1);
|
|
9985
|
+
}
|
|
9986
|
+
});
|
|
9987
|
+
if (options.focusFirst === true && menuItems.length > 0) menuItems[0].focus();
|
|
9988
|
+
else popover.focus();
|
|
9989
|
+
}
|
|
9990
|
+
/**
|
|
9991
|
+
* 监听全局事件以支持点击外部或按 Esc 关闭菜单
|
|
9992
|
+
*/
|
|
9993
|
+
let globalListenersInstalled = false;
|
|
9994
|
+
function ensureGlobalListeners() {
|
|
9995
|
+
if (globalListenersInstalled) return;
|
|
9996
|
+
globalListenersInstalled = true;
|
|
9997
|
+
document.addEventListener("pointerdown", (e) => {
|
|
9998
|
+
if (activePopover === null) return;
|
|
9999
|
+
const path = e.composedPath ? e.composedPath() : [];
|
|
10000
|
+
if (path.length > 0) {
|
|
10001
|
+
if (activePopover && path.includes(activePopover)) return;
|
|
10002
|
+
if (activeAnchor && path.includes(activeAnchor)) return;
|
|
10003
|
+
} else {
|
|
10004
|
+
const target = e.target;
|
|
10005
|
+
if (target && (activePopover.contains(target) || activeAnchor?.contains(target))) return;
|
|
10006
|
+
}
|
|
10007
|
+
closeActiveMenu();
|
|
10008
|
+
}, true);
|
|
10009
|
+
window.addEventListener("keydown", (e) => {
|
|
10010
|
+
if (e.key === "Escape" && activePopover !== null) closeActiveMenu(true);
|
|
10011
|
+
}, true);
|
|
10012
|
+
}
|
|
10013
|
+
/**
|
|
10014
|
+
* 检查桌面端窗口菜单子插件在 Host 侧是否启用
|
|
10015
|
+
*/
|
|
10016
|
+
async function checkDesktopMenuEnabled() {
|
|
10017
|
+
try {
|
|
10018
|
+
const base = typeof document !== "undefined" && document.baseURI ? document.baseURI : "http://localhost";
|
|
10019
|
+
const normalizedBase = base.endsWith("/") ? base : `${base}/`;
|
|
10020
|
+
const path = CODEX_UI_API_ENDPOINTS.desktopMenu.startsWith("/") ? CODEX_UI_API_ENDPOINTS.desktopMenu.slice(1) : CODEX_UI_API_ENDPOINTS.desktopMenu;
|
|
10021
|
+
const url = new URL(path, normalizedBase).href;
|
|
10022
|
+
const res = await fetch(url, { method: "GET" });
|
|
10023
|
+
if (!res.ok) return true;
|
|
10024
|
+
return (await res.json()).enabled !== false;
|
|
10025
|
+
} catch {
|
|
10026
|
+
return true;
|
|
10027
|
+
}
|
|
10028
|
+
}
|
|
10029
|
+
/**
|
|
10030
|
+
* 观察并在 Windows 桌面端的 data-windows-menu 宿主上注入【帮助】菜单。
|
|
10031
|
+
* 只追加一个入口,官方【应用】【编辑】保持原样。
|
|
10032
|
+
*/
|
|
10033
|
+
function observeDesktopTitlebarMenus(translate = (_k, fallback) => fallback ?? "") {
|
|
10034
|
+
ensureGlobalListeners();
|
|
10035
|
+
let cleanedUp = false;
|
|
10036
|
+
let injectedHelpBtn = null;
|
|
10037
|
+
const getHelpItems = () => {
|
|
10038
|
+
const zh = document.documentElement.lang?.toLowerCase().startsWith("zh") ?? true;
|
|
10039
|
+
return [{
|
|
10040
|
+
id: "reload-page",
|
|
10041
|
+
label: translate("desktopMenu.help.reloadPage", zh ? "刷新页面" : "Reload Page"),
|
|
10042
|
+
action: () => {
|
|
10043
|
+
window.location.reload();
|
|
10044
|
+
}
|
|
10045
|
+
}, {
|
|
10046
|
+
id: "restart-host",
|
|
10047
|
+
label: translate("desktopMenu.help.restartAppHost", zh ? "重启应用与 Host" : "Restart App and Host"),
|
|
10048
|
+
action: async () => {
|
|
10049
|
+
const copy = restartCopy(translate);
|
|
10050
|
+
const status = await fetchRestartStatus();
|
|
10051
|
+
if (status === null) {
|
|
10052
|
+
showRestartToast(copy).set(copy.failed, translate("desktopMenu.restart.unreachable", "Cannot reach the Host; the restart channel is unavailable."), "error");
|
|
10053
|
+
return;
|
|
10054
|
+
}
|
|
10055
|
+
if (!status.canRestart) {
|
|
10056
|
+
showRestartToast(copy).set(copy.failed, unsupportedText(translate, status.reason), "error");
|
|
10057
|
+
return;
|
|
10058
|
+
}
|
|
10059
|
+
const confirmMsg = translate("desktopMenu.help.restartConfirm", "DeepSeek Harness will close and reopen; running tasks will be interrupted. Continue?");
|
|
10060
|
+
if (!window.confirm(confirmMsg)) return;
|
|
10061
|
+
const toast = showRestartToast(copy);
|
|
10062
|
+
toast.set(copy.quitting);
|
|
10063
|
+
const outcome = await requestRestart(status.token);
|
|
10064
|
+
if (!outcome.ok) {
|
|
10065
|
+
const detailText = outcome.error === "busy" ? copy.busy : outcome.reason ? unsupportedText(translate, outcome.reason) : outcome.detail ?? outcome.error ?? "unknown";
|
|
10066
|
+
toast.set(copy.failed, detailText, "error");
|
|
10067
|
+
return;
|
|
10068
|
+
}
|
|
10069
|
+
watchRestart(toast, copy);
|
|
10070
|
+
}
|
|
10071
|
+
}];
|
|
10072
|
+
};
|
|
10073
|
+
const mountMenus = () => {
|
|
10074
|
+
if (cleanedUp || typeof document === "undefined") return;
|
|
10075
|
+
const host = document.querySelector("[data-windows-menu]");
|
|
10076
|
+
if (!host || !host.shadowRoot) return;
|
|
10077
|
+
const shadow = host.shadowRoot;
|
|
10078
|
+
const bar = shadow.querySelector("[role=\"menubar\"]");
|
|
10079
|
+
if (!bar) return;
|
|
10080
|
+
if (Array.from(bar.querySelectorAll("button")).length === 0) return;
|
|
10081
|
+
if (!shadow.getElementById("dcu-desktop-menu-help")) {
|
|
10082
|
+
const helpBtn = document.createElement("button");
|
|
10083
|
+
helpBtn.type = "button";
|
|
10084
|
+
helpBtn.id = "dcu-desktop-menu-help";
|
|
10085
|
+
helpBtn.setAttribute("role", "menuitem");
|
|
10086
|
+
helpBtn.setAttribute("aria-haspopup", "menu");
|
|
10087
|
+
helpBtn.setAttribute("aria-expanded", "false");
|
|
10088
|
+
const setRovingFocus = (target) => {
|
|
10089
|
+
bar.querySelectorAll("button").forEach((btn) => {
|
|
10090
|
+
btn.tabIndex = btn === target ? 0 : -1;
|
|
10091
|
+
});
|
|
10092
|
+
target.focus();
|
|
10093
|
+
};
|
|
10094
|
+
helpBtn.tabIndex = -1;
|
|
10095
|
+
helpBtn.textContent = translate("desktopMenu.help", "帮助");
|
|
10096
|
+
helpBtn.addEventListener("click", (e) => {
|
|
10097
|
+
e.preventDefault();
|
|
10098
|
+
e.stopPropagation();
|
|
10099
|
+
openDropdown(helpBtn, getHelpItems());
|
|
10100
|
+
});
|
|
10101
|
+
helpBtn.addEventListener("keydown", (e) => {
|
|
10102
|
+
if (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") {
|
|
10103
|
+
e.preventDefault();
|
|
10104
|
+
e.stopPropagation();
|
|
10105
|
+
openDropdown(helpBtn, getHelpItems(), { focusFirst: true });
|
|
10106
|
+
return;
|
|
10107
|
+
}
|
|
10108
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
10109
|
+
e.preventDefault();
|
|
10110
|
+
e.stopPropagation();
|
|
10111
|
+
const official = Array.from(bar.querySelectorAll("button:not(#dcu-desktop-menu-help)"));
|
|
10112
|
+
const target = e.key === "ArrowLeft" ? official[official.length - 1] ?? official[0] : official[0];
|
|
10113
|
+
if (target) setRovingFocus(target);
|
|
10114
|
+
}
|
|
10115
|
+
});
|
|
10116
|
+
bar.addEventListener("keydown", (e) => {
|
|
10117
|
+
const target = e.target;
|
|
10118
|
+
if (!target || target === helpBtn) return;
|
|
10119
|
+
const official = Array.from(bar.querySelectorAll("button:not(#dcu-desktop-menu-help)"));
|
|
10120
|
+
if (official.length === 0) return;
|
|
10121
|
+
if (e.key === "ArrowRight" && target === official[official.length - 1]) {
|
|
10122
|
+
e.preventDefault();
|
|
10123
|
+
e.stopImmediatePropagation();
|
|
10124
|
+
setRovingFocus(helpBtn);
|
|
10125
|
+
} else if (e.key === "ArrowLeft" && target === official[0]) {
|
|
10126
|
+
e.preventDefault();
|
|
10127
|
+
e.stopImmediatePropagation();
|
|
10128
|
+
setRovingFocus(helpBtn);
|
|
10129
|
+
}
|
|
10130
|
+
}, true);
|
|
10131
|
+
bar.append(helpBtn);
|
|
10132
|
+
injectedHelpBtn = helpBtn;
|
|
10133
|
+
}
|
|
10134
|
+
};
|
|
10135
|
+
mountMenus();
|
|
10136
|
+
const observer = new MutationObserver(() => {
|
|
10137
|
+
mountMenus();
|
|
10138
|
+
});
|
|
10139
|
+
observer.observe(document.body, { childList: true });
|
|
10140
|
+
return () => {
|
|
10141
|
+
cleanedUp = true;
|
|
10142
|
+
observer.disconnect();
|
|
10143
|
+
closeActiveMenu();
|
|
10144
|
+
injectedHelpBtn?.remove();
|
|
10145
|
+
document.getElementById(STYLE_ID)?.remove();
|
|
10146
|
+
};
|
|
10147
|
+
}
|
|
10148
|
+
//#endregion
|
|
9193
10149
|
//#region src/client/index.ts
|
|
9194
10150
|
const inject = [
|
|
9195
10151
|
"slots",
|
|
@@ -9198,7 +10154,8 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
9198
10154
|
"conversation",
|
|
9199
10155
|
"inputTriggers",
|
|
9200
10156
|
"layout",
|
|
9201
|
-
"uiWorkspace"
|
|
10157
|
+
"uiWorkspace",
|
|
10158
|
+
"workspaces"
|
|
9202
10159
|
];
|
|
9203
10160
|
/** 浏览器客户端插件入口;保留官方原生侧边栏与工作区树,提供输入框增强、设置美化与生态关于页。 */
|
|
9204
10161
|
function apply(ctx) {
|
|
@@ -9209,6 +10166,26 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
|
|
|
9209
10166
|
const t = ctx.locale.bind(NS);
|
|
9210
10167
|
ctx.effect(() => observeTheme(ctx), "michengai-codex-ui: theme & appearance");
|
|
9211
10168
|
ctx.effect(() => observeSidebarNav(ctx), "michengai-codex-ui: sidebar navigation");
|
|
10169
|
+
ctx.effect(() => {
|
|
10170
|
+
let stop;
|
|
10171
|
+
let cancelled = false;
|
|
10172
|
+
checkDesktopMenuEnabled().then((enabled) => {
|
|
10173
|
+
if (cancelled || !enabled) return;
|
|
10174
|
+
const translate = (key, fallback) => {
|
|
10175
|
+
try {
|
|
10176
|
+
const value = t(key);
|
|
10177
|
+
return typeof value === "string" && value !== "" && value !== key ? value : fallback ?? key;
|
|
10178
|
+
} catch {
|
|
10179
|
+
return fallback ?? key;
|
|
10180
|
+
}
|
|
10181
|
+
};
|
|
10182
|
+
stop = observeDesktopTitlebarMenus(translate);
|
|
10183
|
+
});
|
|
10184
|
+
return () => {
|
|
10185
|
+
cancelled = true;
|
|
10186
|
+
stop?.();
|
|
10187
|
+
};
|
|
10188
|
+
}, "michengai-codex-ui: desktop titlebar menus");
|
|
9212
10189
|
ctx.effect(() => {
|
|
9213
10190
|
let stop;
|
|
9214
10191
|
let cancelled = false;
|