dsh-ustc-quota 1.1.37 → 1.1.39
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 -0
- package/client.js +122 -20
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,6 +108,7 @@ key-c 8.7/30 29% 8.7/70 12% 11.1/100 11%
|
|
|
108
108
|
## 面板位置
|
|
109
109
|
|
|
110
110
|
- 卡片默认在左侧边栏底部。**鼠标移到卡片上时,标题左边的品牌图标会变成方向图标**(布局图示,标出卡片将要去的那一侧),点一下即可换边;移开鼠标图标复原。选择会记住,重启后保持。
|
|
111
|
+
- 排版自适应:每个窗口一行显示「数值 · 进度条 · 百分比」,三段各自固定宽度对齐,跨行不参差;刷新时间并入「3h / 12h / 24h」表头行右侧。用宽度换高度,卡片更矮更紧凑。
|
|
111
112
|
- 右侧位置会在对话区右侧**预留一条槽**:插件给对话列加右侧内边距(约列宽的 26%,封顶 34%),正文与轮次导航条整体左移,卡片占住这条槽——因此不遮挡正文、不遮挡轮次导航条、也不遮挡右侧原生按钮。上沿从「对话 / 轨迹 / 看板」选项卡下的分隔线以下 6px 开始。
|
|
112
113
|
- 窄窗口或打开侧栏时槽宽自动收窄(下限 140px),卡片始终可见;如果连正文最小宽度都不够,则允许卡片比常规更窄,而不是消失。
|
|
113
114
|
- 换边不重新加载:两处卡片共用同一份已取到的数据。底色用左侧边栏的底色(`--dsw-specific-sidebar-fill`),阴影与左侧一致。
|
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.39';
|
|
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`;
|
|
@@ -476,8 +476,8 @@ window.__ModuleLoader__.load({
|
|
|
476
476
|
},
|
|
477
477
|
legendRow: {
|
|
478
478
|
display: 'grid',
|
|
479
|
-
gridTemplateColumns: 'var(--ustc-key-col, 36px) repeat(3, minmax(0, 1fr))',
|
|
480
|
-
columnGap:
|
|
479
|
+
gridTemplateColumns: 'var(--ustc-key-col, 36px) repeat(3, minmax(0, 1fr)) auto',
|
|
480
|
+
columnGap: 8,
|
|
481
481
|
alignItems: 'center',
|
|
482
482
|
minWidth: 0,
|
|
483
483
|
paddingBottom: 4,
|
|
@@ -486,7 +486,7 @@ window.__ModuleLoader__.load({
|
|
|
486
486
|
keyRow: {
|
|
487
487
|
display: 'grid',
|
|
488
488
|
gridTemplateColumns: 'var(--ustc-key-col, 36px) repeat(3, minmax(0, 1fr))',
|
|
489
|
-
columnGap:
|
|
489
|
+
columnGap: 8,
|
|
490
490
|
alignItems: 'center',
|
|
491
491
|
minWidth: 0,
|
|
492
492
|
paddingTop: 6,
|
|
@@ -505,6 +505,14 @@ window.__ModuleLoader__.load({
|
|
|
505
505
|
color: 'var(--dsw-alias-label-primary)',
|
|
506
506
|
whiteSpace: 'nowrap',
|
|
507
507
|
},
|
|
508
|
+
legendMeta: {
|
|
509
|
+
fontSize: 8,
|
|
510
|
+
lineHeight: 1.2,
|
|
511
|
+
color: 'var(--dsw-alias-label-secondary)',
|
|
512
|
+
whiteSpace: 'nowrap',
|
|
513
|
+
textAlign: 'right',
|
|
514
|
+
paddingLeft: 2,
|
|
515
|
+
},
|
|
508
516
|
legendReset: {
|
|
509
517
|
width: '100%',
|
|
510
518
|
fontSize: 8,
|
|
@@ -555,8 +563,18 @@ window.__ModuleLoader__.load({
|
|
|
555
563
|
cell: {
|
|
556
564
|
minWidth: 0,
|
|
557
565
|
display: 'flex',
|
|
558
|
-
flexDirection: '
|
|
559
|
-
|
|
566
|
+
flexDirection: 'row',
|
|
567
|
+
alignItems: 'center',
|
|
568
|
+
gap: 3,
|
|
569
|
+
},
|
|
570
|
+
inlineBar: {
|
|
571
|
+
flex: '1 1 0',
|
|
572
|
+
minWidth: 8,
|
|
573
|
+
height: 5,
|
|
574
|
+
position: 'relative',
|
|
575
|
+
borderRadius: 999,
|
|
576
|
+
background: 'transparent',
|
|
577
|
+
overflow: 'hidden',
|
|
560
578
|
},
|
|
561
579
|
valueLine: {
|
|
562
580
|
display: 'flex',
|
|
@@ -566,8 +584,9 @@ window.__ModuleLoader__.load({
|
|
|
566
584
|
minWidth: 0,
|
|
567
585
|
},
|
|
568
586
|
value: {
|
|
569
|
-
|
|
570
|
-
|
|
587
|
+
flex: '0 0 auto',
|
|
588
|
+
textAlign: 'right',
|
|
589
|
+
fontSize: 10,
|
|
571
590
|
fontWeight: 650,
|
|
572
591
|
color: 'var(--dsw-alias-label-primary)',
|
|
573
592
|
whiteSpace: 'nowrap',
|
|
@@ -576,6 +595,8 @@ window.__ModuleLoader__.load({
|
|
|
576
595
|
},
|
|
577
596
|
percent: {
|
|
578
597
|
flex: '0 0 auto',
|
|
598
|
+
width: 24,
|
|
599
|
+
textAlign: 'right',
|
|
579
600
|
fontSize: 8.5,
|
|
580
601
|
color: 'var(--dsw-alias-label-secondary)',
|
|
581
602
|
whiteSpace: 'nowrap',
|
|
@@ -793,7 +814,9 @@ window.__ModuleLoader__.load({
|
|
|
793
814
|
function formatPercent(ratio) {
|
|
794
815
|
if (typeof ratio !== 'number' || !Number.isFinite(ratio)) return null;
|
|
795
816
|
const percent = ratio * 100;
|
|
796
|
-
|
|
817
|
+
const tenths = Math.round(percent * 10) / 10;
|
|
818
|
+
if (tenths === 0) return '0%';
|
|
819
|
+
if (tenths < 10) return `${tenths.toFixed(1)}%`;
|
|
797
820
|
return `${Math.round(percent)}%`;
|
|
798
821
|
}
|
|
799
822
|
|
|
@@ -1141,6 +1164,72 @@ window.__ModuleLoader__.load({
|
|
|
1141
1164
|
const DOCK_TRANSCRIPT_FLOOR = 360;
|
|
1142
1165
|
|
|
1143
1166
|
|
|
1167
|
+
// When the blank strip beside the transcript is too narrow, free room on the
|
|
1168
|
+
// right instead of letting the card shrink: pad the conversation column and pin
|
|
1169
|
+
// the transcript to the left edge of that padded box.
|
|
1170
|
+
const DOCK_COMFORT = 220;
|
|
1171
|
+
let pushedColumn = null;
|
|
1172
|
+
let pushedTarget = null;
|
|
1173
|
+
let pushedSaved = null;
|
|
1174
|
+
let padState = 0;
|
|
1175
|
+
|
|
1176
|
+
function transcriptOf() {
|
|
1177
|
+
const flow = document.querySelector('[data-slot="conversation.chat.flow"]');
|
|
1178
|
+
if (!flow) return null;
|
|
1179
|
+
let node = flow;
|
|
1180
|
+
for (let i = 0; i < 6 && node; i += 1) {
|
|
1181
|
+
const style = getComputedStyle(node);
|
|
1182
|
+
if (style.marginLeft === 'auto' || style.marginRight === 'auto') return node;
|
|
1183
|
+
node = node.parentElement;
|
|
1184
|
+
}
|
|
1185
|
+
return flow.firstElementChild || flow;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
function pushConversation(reserve) {
|
|
1189
|
+
const holder = document.querySelector('[data-slot="main.conversation"]');
|
|
1190
|
+
const column = holder ? (holder.firstElementChild || holder) : null;
|
|
1191
|
+
if (!column) return;
|
|
1192
|
+
const target = transcriptOf();
|
|
1193
|
+
if (!target) return;
|
|
1194
|
+
if (pushedColumn !== column) {
|
|
1195
|
+
releaseConversation();
|
|
1196
|
+
pushedColumn = column;
|
|
1197
|
+
pushedSaved = {
|
|
1198
|
+
pad: column.style.getPropertyValue('padding-right'),
|
|
1199
|
+
padPriority: column.style.getPropertyPriority('padding-right'),
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
if (pushedTarget !== target) {
|
|
1203
|
+
if (pushedTarget) {
|
|
1204
|
+
pushedTarget.style.removeProperty('margin-left');
|
|
1205
|
+
pushedTarget.style.removeProperty('margin-right');
|
|
1206
|
+
}
|
|
1207
|
+
pushedTarget = target;
|
|
1208
|
+
target.style.setProperty('margin-left', '0px', 'important');
|
|
1209
|
+
target.style.setProperty('margin-right', 'auto', 'important');
|
|
1210
|
+
}
|
|
1211
|
+
const wanted = reserve + 'px';
|
|
1212
|
+
if (column.style.getPropertyValue('padding-right') !== wanted) {
|
|
1213
|
+
column.style.setProperty('padding-right', wanted, 'important');
|
|
1214
|
+
}
|
|
1215
|
+
padState = reserve;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
function releaseConversation() {
|
|
1219
|
+
if (pushedTarget) {
|
|
1220
|
+
pushedTarget.style.removeProperty('margin-left');
|
|
1221
|
+
pushedTarget.style.removeProperty('margin-right');
|
|
1222
|
+
pushedTarget = null;
|
|
1223
|
+
}
|
|
1224
|
+
if (pushedColumn && pushedSaved) {
|
|
1225
|
+
if (pushedSaved.pad) pushedColumn.style.setProperty('padding-right', pushedSaved.pad, pushedSaved.padPriority);
|
|
1226
|
+
else pushedColumn.style.removeProperty('padding-right');
|
|
1227
|
+
}
|
|
1228
|
+
pushedColumn = null;
|
|
1229
|
+
pushedSaved = null;
|
|
1230
|
+
padState = 0;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1144
1233
|
function measureRightDock() {
|
|
1145
1234
|
const holder = document.querySelector('[data-slot="main.conversation"]');
|
|
1146
1235
|
const column = holder ? (holder.firstElementChild || holder) : null;
|
|
@@ -1189,10 +1278,12 @@ window.__ModuleLoader__.load({
|
|
|
1189
1278
|
}
|
|
1190
1279
|
}
|
|
1191
1280
|
|
|
1281
|
+
const floored = span < 240;
|
|
1192
1282
|
return {
|
|
1193
1283
|
top: contentTop,
|
|
1194
|
-
left: leftEdge,
|
|
1195
|
-
width:
|
|
1284
|
+
left: floored ? Math.max(0, rightEdge - 240) : leftEdge,
|
|
1285
|
+
width: floored ? 240 : span,
|
|
1286
|
+
naturalSpan: span,
|
|
1196
1287
|
columnWidth: Math.round(columnRect.width),
|
|
1197
1288
|
maxHeight: Math.max(120, Math.round(columnRect.bottom) - contentTop - DOCK_GAP),
|
|
1198
1289
|
};
|
|
@@ -1218,7 +1309,20 @@ window.__ModuleLoader__.load({
|
|
|
1218
1309
|
observer = new ResizeObserver(schedule);
|
|
1219
1310
|
observer.observe(column);
|
|
1220
1311
|
}
|
|
1221
|
-
|
|
1312
|
+
const next = measureRightDock();
|
|
1313
|
+
if (activeRef.current && next) {
|
|
1314
|
+
const natural = next.naturalSpan;
|
|
1315
|
+
let pad = padState;
|
|
1316
|
+
if (natural < DOCK_COMFORT - 8) pad = pad + (DOCK_COMFORT - natural);
|
|
1317
|
+
else if (natural > DOCK_COMFORT + 24) pad = Math.max(0, pad - (natural - DOCK_COMFORT));
|
|
1318
|
+
const limit = Math.max(0, next.columnWidth - 340);
|
|
1319
|
+
pad = Math.min(Math.round(pad), limit);
|
|
1320
|
+
if (pad > 0) pushConversation(pad);
|
|
1321
|
+
else releaseConversation();
|
|
1322
|
+
} else {
|
|
1323
|
+
releaseConversation();
|
|
1324
|
+
}
|
|
1325
|
+
setBox(next);
|
|
1222
1326
|
};
|
|
1223
1327
|
function schedule() {
|
|
1224
1328
|
if (!frame) frame = window.requestAnimationFrame(measure);
|
|
@@ -1700,12 +1804,9 @@ window.__ModuleLoader__.load({
|
|
|
1700
1804
|
if (isStale) titleParts.push(t('stale'));
|
|
1701
1805
|
|
|
1702
1806
|
return h('div', { style: STYLE.cell, title: titleParts.join(' · ') },
|
|
1703
|
-
h('
|
|
1704
|
-
h('span', { style: STYLE.value }, `${isStale ? '≈ ' : ''}${valueText}`),
|
|
1705
|
-
percent ? h('span', { style: { ...STYLE.percent, color: percentColor } }, percent) : null
|
|
1706
|
-
),
|
|
1807
|
+
h('span', { style: STYLE.value }, `${isStale ? '≈ ' : ''}${valueText}`),
|
|
1707
1808
|
h('div', {
|
|
1708
|
-
style: { ...STYLE.
|
|
1809
|
+
style: { ...STYLE.inlineBar, opacity: isStale ? 0.55 : 1 },
|
|
1709
1810
|
role: 'progressbar',
|
|
1710
1811
|
'aria-label': label,
|
|
1711
1812
|
'aria-valuemin': 0,
|
|
@@ -1724,7 +1825,8 @@ window.__ModuleLoader__.load({
|
|
|
1724
1825
|
transition: 'width 200ms ease',
|
|
1725
1826
|
},
|
|
1726
1827
|
})
|
|
1727
|
-
)
|
|
1828
|
+
),
|
|
1829
|
+
percent ? h('span', { style: { ...STYLE.percent, color: percentColor } }, percent) : null
|
|
1728
1830
|
);
|
|
1729
1831
|
}
|
|
1730
1832
|
|
|
@@ -1816,7 +1918,6 @@ window.__ModuleLoader__.load({
|
|
|
1816
1918
|
? h('span', { style: STYLE.warn, title: warnings.join('\n'), 'aria-label': t('warnings') }, '!')
|
|
1817
1919
|
: null,
|
|
1818
1920
|
error && snapshot ? h('span', { style: STYLE.warn, title: error }, '!') : null,
|
|
1819
|
-
h('span', { style: STYLE.meta }, updated ? `${t('updatedLabel')} ${updated}` : ''),
|
|
1820
1921
|
|
|
1821
1922
|
h('button', {
|
|
1822
1923
|
type: 'button',
|
|
@@ -1853,7 +1954,8 @@ window.__ModuleLoader__.load({
|
|
|
1853
1954
|
h('div', { style: tableStyle },
|
|
1854
1955
|
h('div', { style: STYLE.legendRow },
|
|
1855
1956
|
h('div', { key: 'corner' }),
|
|
1856
|
-
WINDOW_IDS.map((id) => h(React.Fragment, { key: id }, windowLegend(id)))
|
|
1957
|
+
WINDOW_IDS.map((id) => h(React.Fragment, { key: id }, windowLegend(id))),
|
|
1958
|
+
h('div', { key: 'updated', style: STYLE.legendMeta, title: updated || '' }, updated ? `${t('updatedLabel')} ${updated}` : '')
|
|
1857
1959
|
),
|
|
1858
1960
|
keys.map((key, index) => keyRow(key, index, activeProvider))
|
|
1859
1961
|
),
|
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.39';
|
|
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