@dsh-tom/dsh-css 0.2.8 → 0.2.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 +2 -2
- package/dist/client.js +77 -18
- package/package.json +1 -1
- package/theme.css +23 -0
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npm publish --access public --registry=https://registry.npmjs.org/
|
|
|
22
22
|
打开 **插件 → 添加插件 → 安装第三方插件**,在“包名或地址”输入:
|
|
23
23
|
|
|
24
24
|
```text
|
|
25
|
-
D:\product\dsh-css\dsh-tom-dsh-css-0.2.
|
|
25
|
+
D:\product\dsh-css\dsh-tom-dsh-css-0.2.11.tgz
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
安装并启用,然后完全退出并重新打开 dsh。
|
|
@@ -32,7 +32,7 @@ D:\product\dsh-css\dsh-tom-dsh-css-0.2.8.tgz
|
|
|
32
32
|
包发布到 npmjs 后,先卸载已安装的旧版,再打开 **插件 → 添加插件 → 安装第三方插件**,输入:
|
|
33
33
|
|
|
34
34
|
```text
|
|
35
|
-
@dsh-tom/dsh-css@0.2.
|
|
35
|
+
@dsh-tom/dsh-css@0.2.11
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
选择 **安装源 → npm 官方源**,安装并启用,然后完全退出并重新打开 dsh。
|
package/dist/client.js
CHANGED
|
@@ -52,6 +52,17 @@ var theme_default = `.dsh-css-unread-dot {
|
|
|
52
52
|
mask-image: none;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/* \u4F1A\u8BDD\u83DC\u5355\u6539\u4E3A\u53F3\u952E\u6253\u5F00\uFF1B\u4FDD\u7559\u5BBF\u4E3B\u83DC\u5355\u951A\u70B9\uFF0C\u5E76\u79FB\u5230\u9F20\u6807\u4F4D\u7F6E\u3002 */
|
|
56
|
+
.hIlkoa_sessionRow > .hIlkoa_rowActions > ._root_4ub78_1 {
|
|
57
|
+
position: fixed;
|
|
58
|
+
left: var(--dsh-css-context-x, 0px);
|
|
59
|
+
top: var(--dsh-css-context-y, 0px);
|
|
60
|
+
width: 0;
|
|
61
|
+
height: 0;
|
|
62
|
+
|
|
63
|
+
& > button { display: none; }
|
|
64
|
+
}
|
|
65
|
+
|
|
55
66
|
/* \u6DF1\u8272\u6A21\u5F0F\u914D\u8272\uFF0C\u4FDD\u7559\u5185\u7F6E\u6587\u5B57\u3001\u8FB9\u6846\u548C\u8BED\u6CD5\u9AD8\u4EAE\u989C\u8272\u3002 */
|
|
56
67
|
html body[data-ds-dark-theme] {
|
|
57
68
|
/* \u533A\u57DF 1\uFF1A\u5DE6\u4FA7\u4F1A\u8BDD\u5217\u8868\uFF1BWindows \u6807\u9898\u680F\u5728\u4E0B\u65B9\u5355\u72EC\u8BBE\u7F6E\u3002\u539F RGB(27, 27, 28)\u3002 */
|
|
@@ -220,6 +231,13 @@ html[data-windows-titlebar] body[data-ds-dark-theme] ._2H3hWW_root:not(._2H3hWW_
|
|
|
220
231
|
padding: 44px 0 0 12px;
|
|
221
232
|
}
|
|
222
233
|
|
|
234
|
+
/* \u64CD\u4F5C\u6309\u94AE\u95F4\u8DDD 15px \u2192 10px\uFF1B\u53F3\u4FA7\u5185\u8FB9\u8DDD 8px \u2192 4px\u3002 */
|
|
235
|
+
& .hIlkoa_sessionRow {
|
|
236
|
+
padding-inline-end: 4px;
|
|
237
|
+
|
|
238
|
+
& > .hIlkoa_rowActions { gap: 10px; }
|
|
239
|
+
}
|
|
240
|
+
|
|
223
241
|
/* \u884C\u80CC\u666F\u5411\u5DE6\u5EF6\u4F38 4px\uFF0C\u7559\u8DB3\u6807\u9898\u5185\u8FB9\u8DDD\u5E76\u4E0E\u201C\u4F1A\u8BDD\u201D\u4FDD\u6301\u5DE6\u5BF9\u9F50\u3002 */
|
|
224
242
|
& ._9lTDKa_flatList .hIlkoa_sessionRow {
|
|
225
243
|
margin-inline-start: -4px;
|
|
@@ -233,6 +251,11 @@ html[data-windows-titlebar] body[data-ds-dark-theme] ._2H3hWW_root:not(._2H3hWW_
|
|
|
233
251
|
order: 1;
|
|
234
252
|
}
|
|
235
253
|
|
|
254
|
+
/* \u7A7A\u72B6\u6001\u5360\u4F4D\u51CF\u534A\uFF0C\u4E0E\u53F3\u5185\u8FB9\u8DDD\u5408\u8BA1 12px\uFF1B\u5B9E\u9645\u72B6\u6001\u56FE\u6807\u4FDD\u7559\u539F\u5BBD\u5EA6\u3002 */
|
|
255
|
+
& > .hIlkoa_slot:has(> [data-slot="sidebar.session.row.leading"]:empty) {
|
|
256
|
+
width: 8px;
|
|
257
|
+
}
|
|
258
|
+
|
|
236
259
|
& > .hIlkoa_slot:empty,
|
|
237
260
|
&:is(:hover, .hIlkoa_menuOpen) > .hIlkoa_slot:has(.dsh-css-unread-dot) {
|
|
238
261
|
display: none;
|
|
@@ -1060,24 +1083,37 @@ function replacePercent(value, percent) {
|
|
|
1060
1083
|
function registerCacheHitPrecision(ctx) {
|
|
1061
1084
|
const slot = "conversation.composer.dock";
|
|
1062
1085
|
ctx.slots.inject(slot, () => {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1086
|
+
let original;
|
|
1087
|
+
let dispose;
|
|
1088
|
+
const sync = () => {
|
|
1089
|
+
if (original && ctx.slots.entries(slot).includes(original)) return;
|
|
1090
|
+
dispose?.();
|
|
1091
|
+
dispose = void 0;
|
|
1092
|
+
original = ctx.slots.entries(slot).find((entry) => entry.options.id === "usage");
|
|
1093
|
+
if (!original) return;
|
|
1094
|
+
const renderUsage = original.component.type;
|
|
1095
|
+
function UsagePill(props) {
|
|
1096
|
+
const element = renderUsage(props);
|
|
1097
|
+
const usage = props.useProjection("tokenUsage");
|
|
1098
|
+
if (!usage) return element;
|
|
1099
|
+
const input2 = usage.uncachedInputTokens + usage.cacheReadTokens + usage.cacheWriteTokens;
|
|
1100
|
+
if (input2 === 0) return element;
|
|
1101
|
+
return replacePercent(element, (usage.cacheReadTokens / input2 * 100).toFixed(2));
|
|
1102
|
+
}
|
|
1103
|
+
dispose = ctx.slots.register({
|
|
1104
|
+
...original.options,
|
|
1105
|
+
name: slot,
|
|
1106
|
+
priority: (original.options.priority ?? 0) - 1,
|
|
1107
|
+
locale: original.locale,
|
|
1108
|
+
inject: original.inject
|
|
1109
|
+
}, UsagePill);
|
|
1110
|
+
};
|
|
1111
|
+
const unsubscribe = ctx.slots.subscribe(slot, sync);
|
|
1112
|
+
sync();
|
|
1113
|
+
return () => {
|
|
1114
|
+
unsubscribe();
|
|
1115
|
+
dispose?.();
|
|
1116
|
+
};
|
|
1081
1117
|
});
|
|
1082
1118
|
}
|
|
1083
1119
|
|
|
@@ -21668,6 +21704,28 @@ function applySidebarWidth(layout) {
|
|
|
21668
21704
|
restore();
|
|
21669
21705
|
};
|
|
21670
21706
|
}
|
|
21707
|
+
function applySessionContextMenu() {
|
|
21708
|
+
const menuSelector = ".hIlkoa_sessionRow > .hIlkoa_rowActions > ._root_4ub78_1";
|
|
21709
|
+
const open2 = (event) => {
|
|
21710
|
+
const row = event.target.closest?.(".hIlkoa_sessionRow");
|
|
21711
|
+
const menu = row?.querySelector(menuSelector);
|
|
21712
|
+
const button = menu?.querySelector(":scope > button");
|
|
21713
|
+
if (!button) return;
|
|
21714
|
+
event.preventDefault();
|
|
21715
|
+
event.stopPropagation();
|
|
21716
|
+
menu.style.setProperty("--dsh-css-context-x", `${event.clientX}px`);
|
|
21717
|
+
menu.style.setProperty("--dsh-css-context-y", `${event.clientY}px`);
|
|
21718
|
+
if (!row.classList.contains("hIlkoa_menuOpen")) button.click();
|
|
21719
|
+
};
|
|
21720
|
+
document.addEventListener("contextmenu", open2);
|
|
21721
|
+
return () => {
|
|
21722
|
+
document.removeEventListener("contextmenu", open2);
|
|
21723
|
+
for (const menu of document.querySelectorAll(menuSelector)) {
|
|
21724
|
+
menu.style.removeProperty("--dsh-css-context-x");
|
|
21725
|
+
menu.style.removeProperty("--dsh-css-context-y");
|
|
21726
|
+
}
|
|
21727
|
+
};
|
|
21728
|
+
}
|
|
21671
21729
|
async function apply2(ctx) {
|
|
21672
21730
|
ctx.effect(() => {
|
|
21673
21731
|
const style = document.createElement("style");
|
|
@@ -21678,6 +21736,7 @@ async function apply2(ctx) {
|
|
|
21678
21736
|
return () => style.remove();
|
|
21679
21737
|
});
|
|
21680
21738
|
ctx.effect(() => applySidebarWidth(ctx.layout));
|
|
21739
|
+
ctx.effect(applySessionContextMenu);
|
|
21681
21740
|
registerCacheHitPrecision(ctx);
|
|
21682
21741
|
registerDateGroups(ctx);
|
|
21683
21742
|
registerProjects(ctx);
|
package/package.json
CHANGED
package/theme.css
CHANGED
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
mask-image: none;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/* 会话菜单改为右键打开;保留宿主菜单锚点,并移到鼠标位置。 */
|
|
22
|
+
.hIlkoa_sessionRow > .hIlkoa_rowActions > ._root_4ub78_1 {
|
|
23
|
+
position: fixed;
|
|
24
|
+
left: var(--dsh-css-context-x, 0px);
|
|
25
|
+
top: var(--dsh-css-context-y, 0px);
|
|
26
|
+
width: 0;
|
|
27
|
+
height: 0;
|
|
28
|
+
|
|
29
|
+
& > button { display: none; }
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
/* 深色模式配色,保留内置文字、边框和语法高亮颜色。 */
|
|
22
33
|
html body[data-ds-dark-theme] {
|
|
23
34
|
/* 区域 1:左侧会话列表;Windows 标题栏在下方单独设置。原 RGB(27, 27, 28)。 */
|
|
@@ -186,6 +197,13 @@ html[data-windows-titlebar] body[data-ds-dark-theme] ._2H3hWW_root:not(._2H3hWW_
|
|
|
186
197
|
padding: 44px 0 0 12px;
|
|
187
198
|
}
|
|
188
199
|
|
|
200
|
+
/* 操作按钮间距 15px → 10px;右侧内边距 8px → 4px。 */
|
|
201
|
+
& .hIlkoa_sessionRow {
|
|
202
|
+
padding-inline-end: 4px;
|
|
203
|
+
|
|
204
|
+
& > .hIlkoa_rowActions { gap: 10px; }
|
|
205
|
+
}
|
|
206
|
+
|
|
189
207
|
/* 行背景向左延伸 4px,留足标题内边距并与“会话”保持左对齐。 */
|
|
190
208
|
& ._9lTDKa_flatList .hIlkoa_sessionRow {
|
|
191
209
|
margin-inline-start: -4px;
|
|
@@ -199,6 +217,11 @@ html[data-windows-titlebar] body[data-ds-dark-theme] ._2H3hWW_root:not(._2H3hWW_
|
|
|
199
217
|
order: 1;
|
|
200
218
|
}
|
|
201
219
|
|
|
220
|
+
/* 空状态占位减半,与右内边距合计 12px;实际状态图标保留原宽度。 */
|
|
221
|
+
& > .hIlkoa_slot:has(> [data-slot="sidebar.session.row.leading"]:empty) {
|
|
222
|
+
width: 8px;
|
|
223
|
+
}
|
|
224
|
+
|
|
202
225
|
& > .hIlkoa_slot:empty,
|
|
203
226
|
&:is(:hover, .hIlkoa_menuOpen) > .hIlkoa_slot:has(.dsh-css-unread-dot) {
|
|
204
227
|
display: none;
|