dsh-ustc-quota 1.1.23 → 1.1.25

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 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
- - 右侧位置停在**对话列里、聊天内容与轮次导航条之间的空白**:左右各留 24px,宽度随空白自适应,不遮挡右侧原生按钮,也不侵入轮次导航条。上沿从「对话 / 轨迹 / 看板」选项卡下的分隔线以下开始,不会压住分隔线。拖动对话边界或开关任一侧边栏时,卡片跟着走。
111
+ - 右侧位置从**对话右侧拖动条**(DSH 的 `.widthHandle`,鼠标移上去会变成拖动光标、下方有淡竖线)右侧开始,到轮次导航条左侧结束,三者间距都是 6px(与左侧两张卡片的垂直间距一致),宽度随空白自适应。底色用左侧边栏的底色(`--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.23';
14
+ const CLIENT_VERSION = '1.1.25';
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',
@@ -1131,9 +1134,9 @@ window.__ModuleLoader__.load({
1131
1134
  // measures the conversation column and pins itself into the blank strip
1132
1135
  // between the chat content and the turn navigator, so it follows the
1133
1136
  // conversation when either side is dragged or toggled.
1134
- const DOCK_GAP = 24;
1135
- const DOCK_MIN_WIDTH = 220;
1136
- const DOCK_MAX_WIDTH = 420;
1137
+ const DOCK_GAP = 6;
1138
+ const DOCK_MIN_WIDTH = 180;
1139
+ const DOCK_MAX_WIDTH = 480;
1137
1140
 
1138
1141
  function measureRightDock() {
1139
1142
  const holder = document.querySelector('[data-slot="main.conversation"]');
@@ -1142,11 +1145,21 @@ window.__ModuleLoader__.load({
1142
1145
  const columnRect = column.getBoundingClientRect();
1143
1146
  if (columnRect.width < 240 || columnRect.height < 160) return null;
1144
1147
 
1145
- const flowHolder = document.querySelector('[data-slot="conversation.chat.flow"]');
1146
- const flow = flowHolder ? (flowHolder.firstElementChild || flowHolder) : null;
1147
- const flowRect = flow ? flow.getBoundingClientRect() : null;
1148
+ // DSH draws two col-resize strips either side of the transcript
1149
+ // (.widthHandle, data-side=left|right). The right one IS the conversation
1150
+ // boundary the user drags, and its left edge is content + 24px.
1151
+ let boundaryRight = null;
1152
+ const handles = document.querySelectorAll('[class*="widthHandle"]');
1153
+ for (const handle of handles) {
1154
+ if (handle.getAttribute('data-side') === 'left') continue;
1155
+ const rect = handle.getBoundingClientRect();
1156
+ if (rect.width <= 0 || rect.height < 40) continue;
1157
+ const edge = rect.right;
1158
+ if (boundaryRight === null || edge > boundaryRight) boundaryRight = edge;
1159
+ }
1160
+ if (boundaryRight === null) boundaryRight = columnRect.left + columnRect.width * 0.5 + 24;
1148
1161
 
1149
- // The turn navigator is a rail of per-turn buttons at the column's right edge.
1162
+ // Turn navigator rail: per-turn buttons stacked at the column's right edge.
1150
1163
  let navLeft = null;
1151
1164
  for (const button of document.querySelectorAll('button[aria-label]')) {
1152
1165
  const label = button.getAttribute('aria-label') || '';
@@ -1156,16 +1169,12 @@ window.__ModuleLoader__.load({
1156
1169
  }
1157
1170
  if (navLeft === null) navLeft = columnRect.right - 26;
1158
1171
 
1159
- let width = DOCK_MAX_WIDTH;
1160
- if (flowRect && flowRect.width > 0 && flowRect.right < navLeft) {
1161
- const available = navLeft - flowRect.right - DOCK_GAP * 2;
1162
- width = Math.min(DOCK_MAX_WIDTH, Math.max(DOCK_MIN_WIDTH, Math.round(available)));
1163
- }
1164
- width = Math.max(DOCK_MIN_WIDTH, Math.min(width, Math.round(columnRect.width - DOCK_GAP * 2)));
1172
+ const leftEdge = Math.round(boundaryRight) + DOCK_GAP;
1173
+ const rightEdge = Math.round(navLeft) - DOCK_GAP;
1174
+ if (rightEdge - leftEdge < DOCK_MIN_WIDTH) return null;
1165
1175
 
1166
- // Vertical bound: the dock may never cross or touch the separator under the
1167
- // conversation tab strip (对话 / 轨迹 / 看板 / Codex).
1168
- let contentTop = Math.round(columnRect.top) + 16;
1176
+ // Vertical bound: never cross or touch the separator under the tab strip.
1177
+ let contentTop = Math.round(columnRect.top) + DOCK_GAP;
1169
1178
  const tabStrip = document.querySelector('[data-conversation-tabs]');
1170
1179
  if (tabStrip) {
1171
1180
  const row = tabStrip.parentElement || tabStrip;
@@ -1174,13 +1183,12 @@ window.__ModuleLoader__.load({
1174
1183
  contentTop = Math.max(contentTop, Math.round(rowRect.bottom) + DOCK_GAP);
1175
1184
  }
1176
1185
  }
1177
- const bottomEdge = Math.round(columnRect.bottom);
1178
1186
 
1179
1187
  return {
1180
1188
  top: contentTop,
1181
- right: Math.max(8, Math.round(window.innerWidth - navLeft) + DOCK_GAP),
1182
- width,
1183
- maxHeight: Math.max(120, bottomEdge - contentTop - DOCK_GAP / 2),
1189
+ right: Math.round(window.innerWidth - rightEdge),
1190
+ width: Math.min(DOCK_MAX_WIDTH, rightEdge - leftEdge),
1191
+ maxHeight: Math.max(120, Math.round(columnRect.bottom) - contentTop - DOCK_GAP),
1184
1192
  };
1185
1193
  }
1186
1194
 
@@ -1226,7 +1234,7 @@ window.__ModuleLoader__.load({
1226
1234
  right: box ? box.right : 0,
1227
1235
  width: box ? box.width : DOCK_MAX_WIDTH,
1228
1236
  maxHeight: box ? box.maxHeight : 0,
1229
- overflowY: 'auto',
1237
+ overflow: 'visible',
1230
1238
  display: shown ? 'flex' : 'none',
1231
1239
  flexDirection: 'column',
1232
1240
  gap: 6,
@@ -1938,7 +1946,7 @@ window.__ModuleLoader__.load({
1938
1946
  : null;
1939
1947
 
1940
1948
  return h('div', {
1941
- style: STYLE.root,
1949
+ style: placement === 'right' ? Object.assign({}, STYLE.root, STYLE.rootDocked) : STYLE.root,
1942
1950
  ref: rootRef,
1943
1951
  role: 'group',
1944
1952
  '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.23';
25
+ const PLUGIN_VERSION = '1.1.25';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ustc-quota",
3
- "version": "1.1.23",
3
+ "version": "1.1.25",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Live 3h/12h/24h USTC token quota card in the DSH sidebar (works with the USTC TokenWorks distribution).",