dsh-ustc-quota 1.1.22 → 1.1.24
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 +1 -1
- package/client.js +73 -22
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ key-c 8.7/30 29% 8.7/70 12% 11.1/100 11%
|
|
|
108
108
|
## 面板位置
|
|
109
109
|
|
|
110
110
|
- 卡片默认在左侧边栏底部。**鼠标移到卡片上时,标题左边的品牌图标会变成方向图标**(`→` 移到右侧、`←` 移回左侧),点一下即可换边;移开鼠标图标复原。选择会记住,重启后保持。
|
|
111
|
-
-
|
|
111
|
+
- 右侧位置停在**聊天内容与轮次导航条之间的空白**:与聊天内容、导航条、上方分隔线各留 12px,宽度随空白自适应,不压住对话正文、不遮挡右侧原生按钮、不侵入轮次导航条。底色用左侧边栏的底色(`--dsw-specific-sidebar-fill`),阴影与左侧一致。拖动对话边界或开关任一侧边栏时,卡片跟着走。
|
|
112
112
|
- 换边不重新加载:两处卡片共用同一份已取到的数据,切换时直接显示,之后在后台刷新。
|
|
113
113
|
## 更新
|
|
114
114
|
|
package/client.js
CHANGED
|
@@ -11,7 +11,7 @@ window.__ModuleLoader__.load({
|
|
|
11
11
|
const UPDATE_ENDPOINT = 'plugins/dsh-ustc-quota/update';
|
|
12
12
|
const UPDATE_APPLY_ENDPOINT = 'plugins/dsh-ustc-quota/update/apply';
|
|
13
13
|
const WINDOW_IDS = ['3h', '12h', '24h'];
|
|
14
|
-
const CLIENT_VERSION = '1.1.
|
|
14
|
+
const CLIENT_VERSION = '1.1.24';
|
|
15
15
|
const UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
16
16
|
const CLIENT_VERSION_KEY = `${NS}:client-version`;
|
|
17
17
|
const CLIENT_RELOAD_KEY = `${NS}:client-reload`;
|
|
@@ -368,6 +368,9 @@ window.__ModuleLoader__.load({
|
|
|
368
368
|
color: 'var(--dsw-alias-label-secondary)',
|
|
369
369
|
fontVariantNumeric: 'tabular-nums',
|
|
370
370
|
},
|
|
371
|
+
rootDocked: {
|
|
372
|
+
background: 'var(--dsw-specific-sidebar-fill, var(--dsw-alias-bg-module-platform))',
|
|
373
|
+
},
|
|
371
374
|
header: {
|
|
372
375
|
display: 'flex',
|
|
373
376
|
alignItems: 'center',
|
|
@@ -1048,17 +1051,38 @@ window.__ModuleLoader__.load({
|
|
|
1048
1051
|
style: { display: 'block' },
|
|
1049
1052
|
'data-ustc-mark-glyph': showSwitch ? 'switch' : 'brand',
|
|
1050
1053
|
}, children);
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1054
|
+
// A layout glyph, not an arrow: a panel frame whose narrow band marks where
|
|
1055
|
+
// the card is about to sit. Reads as "dock to this side" at 13 px.
|
|
1056
|
+
const panelBand = targetRight ? 15.4 : 8.6;
|
|
1057
|
+
const pillX = targetRight ? 17.1 : 3.9;
|
|
1058
|
+
const switchGlyph = [
|
|
1059
|
+
h('rect', {
|
|
1060
|
+
key: 'frame',
|
|
1061
|
+
x: 2.6,
|
|
1062
|
+
y: 4.4,
|
|
1063
|
+
width: 18.8,
|
|
1064
|
+
height: 15.2,
|
|
1065
|
+
rx: 3,
|
|
1066
|
+
stroke: 'currentColor',
|
|
1067
|
+
strokeWidth: 1.5,
|
|
1068
|
+
}),
|
|
1069
|
+
h('path', {
|
|
1070
|
+
key: 'split',
|
|
1071
|
+
d: 'M' + panelBand + ' 4.4V19.6',
|
|
1072
|
+
stroke: 'currentColor',
|
|
1073
|
+
strokeWidth: 1.5,
|
|
1074
|
+
strokeLinecap: 'round',
|
|
1075
|
+
}),
|
|
1076
|
+
h('rect', {
|
|
1077
|
+
key: 'band',
|
|
1078
|
+
x: pillX,
|
|
1079
|
+
y: 9.4,
|
|
1080
|
+
width: 2.9,
|
|
1081
|
+
height: 5.2,
|
|
1082
|
+
rx: 1.45,
|
|
1083
|
+
fill: 'currentColor',
|
|
1084
|
+
}),
|
|
1085
|
+
];
|
|
1062
1086
|
return h('span', { style: STYLE.brandMark, 'aria-hidden': true, 'data-ustc-mark': '' },
|
|
1063
1087
|
frame(showSwitch
|
|
1064
1088
|
? switchGlyph
|
|
@@ -1110,8 +1134,8 @@ window.__ModuleLoader__.load({
|
|
|
1110
1134
|
// measures the conversation column and pins itself into the blank strip
|
|
1111
1135
|
// between the chat content and the turn navigator, so it follows the
|
|
1112
1136
|
// conversation when either side is dragged or toggled.
|
|
1113
|
-
const DOCK_GAP =
|
|
1114
|
-
const DOCK_MIN_WIDTH =
|
|
1137
|
+
const DOCK_GAP = 12;
|
|
1138
|
+
const DOCK_MIN_WIDTH = 180;
|
|
1115
1139
|
const DOCK_MAX_WIDTH = 420;
|
|
1116
1140
|
|
|
1117
1141
|
function measureRightDock() {
|
|
@@ -1121,9 +1145,23 @@ window.__ModuleLoader__.load({
|
|
|
1121
1145
|
const columnRect = column.getBoundingClientRect();
|
|
1122
1146
|
if (columnRect.width < 240 || columnRect.height < 160) return null;
|
|
1123
1147
|
|
|
1148
|
+
// The flow container spans the whole column; the visible conversation column is
|
|
1149
|
+
// the widest chat row inside it, so measure the rows instead of the container.
|
|
1150
|
+
let contentRight = null;
|
|
1124
1151
|
const flowHolder = document.querySelector('[data-slot="conversation.chat.flow"]');
|
|
1125
|
-
|
|
1126
|
-
|
|
1152
|
+
if (flowHolder) {
|
|
1153
|
+
const rows = flowHolder.querySelectorAll(':scope > *');
|
|
1154
|
+
for (const row of rows) {
|
|
1155
|
+
const rect = row.getBoundingClientRect();
|
|
1156
|
+
if (rect.width < 80 || rect.height < 8) continue;
|
|
1157
|
+
contentRight = contentRight === null ? rect.right : Math.max(contentRight, rect.right);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
if (contentRight === null) {
|
|
1161
|
+
const flow = flowHolder ? (flowHolder.firstElementChild || flowHolder) : null;
|
|
1162
|
+
const flowRect = flow ? flow.getBoundingClientRect() : null;
|
|
1163
|
+
if (flowRect && flowRect.width > 0) contentRight = flowRect.right;
|
|
1164
|
+
}
|
|
1127
1165
|
|
|
1128
1166
|
// The turn navigator is a rail of per-turn buttons at the column's right edge.
|
|
1129
1167
|
let navLeft = null;
|
|
@@ -1136,17 +1174,30 @@ window.__ModuleLoader__.load({
|
|
|
1136
1174
|
if (navLeft === null) navLeft = columnRect.right - 26;
|
|
1137
1175
|
|
|
1138
1176
|
let width = DOCK_MAX_WIDTH;
|
|
1139
|
-
if (
|
|
1140
|
-
const available = navLeft -
|
|
1177
|
+
if (contentRight !== null && contentRight < navLeft - DOCK_MIN_WIDTH) {
|
|
1178
|
+
const available = navLeft - contentRight - DOCK_GAP * 2;
|
|
1141
1179
|
width = Math.min(DOCK_MAX_WIDTH, Math.max(DOCK_MIN_WIDTH, Math.round(available)));
|
|
1142
1180
|
}
|
|
1143
1181
|
width = Math.max(DOCK_MIN_WIDTH, Math.min(width, Math.round(columnRect.width - DOCK_GAP * 2)));
|
|
1144
1182
|
|
|
1183
|
+
// Vertical bound: the dock may never cross or touch the separator under the
|
|
1184
|
+
// conversation tab strip (对话 / 轨迹 / 看板 / Codex).
|
|
1185
|
+
let contentTop = Math.round(columnRect.top) + 16;
|
|
1186
|
+
const tabStrip = document.querySelector('[data-conversation-tabs]');
|
|
1187
|
+
if (tabStrip) {
|
|
1188
|
+
const row = tabStrip.parentElement || tabStrip;
|
|
1189
|
+
const rowRect = row.getBoundingClientRect();
|
|
1190
|
+
if (rowRect.height > 0 && rowRect.bottom > columnRect.top && rowRect.bottom < columnRect.bottom) {
|
|
1191
|
+
contentTop = Math.max(contentTop, Math.round(rowRect.bottom) + DOCK_GAP);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
const bottomEdge = Math.round(columnRect.bottom);
|
|
1195
|
+
|
|
1145
1196
|
return {
|
|
1146
|
-
top:
|
|
1197
|
+
top: contentTop,
|
|
1147
1198
|
right: Math.max(8, Math.round(window.innerWidth - navLeft) + DOCK_GAP),
|
|
1148
1199
|
width,
|
|
1149
|
-
maxHeight: Math.max(
|
|
1200
|
+
maxHeight: Math.max(120, bottomEdge - contentTop - DOCK_GAP / 2),
|
|
1150
1201
|
};
|
|
1151
1202
|
}
|
|
1152
1203
|
|
|
@@ -1192,7 +1243,7 @@ window.__ModuleLoader__.load({
|
|
|
1192
1243
|
right: box ? box.right : 0,
|
|
1193
1244
|
width: box ? box.width : DOCK_MAX_WIDTH,
|
|
1194
1245
|
maxHeight: box ? box.maxHeight : 0,
|
|
1195
|
-
|
|
1246
|
+
overflow: 'visible',
|
|
1196
1247
|
display: shown ? 'flex' : 'none',
|
|
1197
1248
|
flexDirection: 'column',
|
|
1198
1249
|
gap: 6,
|
|
@@ -1904,7 +1955,7 @@ window.__ModuleLoader__.load({
|
|
|
1904
1955
|
: null;
|
|
1905
1956
|
|
|
1906
1957
|
return h('div', {
|
|
1907
|
-
style: STYLE.root,
|
|
1958
|
+
style: placement === 'right' ? Object.assign({}, STYLE.root, STYLE.rootDocked) : STYLE.root,
|
|
1908
1959
|
ref: rootRef,
|
|
1909
1960
|
role: 'group',
|
|
1910
1961
|
'aria-label': t('title'),
|
package/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const ROUTE_PATH = '/plugins/dsh-ustc-quota/snapshot';
|
|
|
22
22
|
const UPDATE_PATH = '/plugins/dsh-ustc-quota/update';
|
|
23
23
|
const UPDATE_APPLY_PATH = '/plugins/dsh-ustc-quota/update/apply';
|
|
24
24
|
const UPDATE_TOKEN_TTL_MS = 30 * 60 * 1000;
|
|
25
|
-
const PLUGIN_VERSION = '1.1.
|
|
25
|
+
const PLUGIN_VERSION = '1.1.24';
|
|
26
26
|
const KEY_INFO_PATH = 'key/info';
|
|
27
27
|
const USER_INFO_PATH = 'user/info';
|
|
28
28
|
const DISCOVERY_TTL_MS = 30000;
|
package/package.json
CHANGED