dsh-ustc-quota 1.1.40 → 1.1.47
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 -1
- package/client.js +144 -115
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,10 +108,11 @@ key-c 8.7/30 29% 8.7/70 12% 11.1/100 11%
|
|
|
108
108
|
## 面板位置
|
|
109
109
|
|
|
110
110
|
- 卡片默认在左侧边栏底部。**鼠标移到卡片上时,标题左边的品牌图标会变成方向图标**(布局图示,标出卡片将要去的那一侧),点一下即可换边;移开鼠标图标复原。选择会记住,重启后保持。
|
|
111
|
-
-
|
|
111
|
+
- 排版自适应:**只在右侧并且卡片宽度 ≥ 340px** 时才用单行式(每个窗口一行「数值 · 进度条 · 百分比」,两端对齐、重置时间与窗口名同行)。左侧边栏与窄卡片始终沿用原紧凑双行式,不因宽度变化而跳动。
|
|
112
112
|
- 右侧位置会在对话区右侧**预留一条槽**:插件给对话列加右侧内边距(约列宽的 26%,封顶 34%),正文与轮次导航条整体左移,卡片占住这条槽——因此不遮挡正文、不遮挡轮次导航条、也不遮挡右侧原生按钮。上沿从「对话 / 轨迹 / 看板」选项卡下的分隔线以下 6px 开始。
|
|
113
113
|
- 窄窗口或打开侧栏时槽宽自动收窄(下限 140px),卡片始终可见;如果连正文最小宽度都不够,则允许卡片比常规更窄,而不是消失。
|
|
114
114
|
- 换边不重新加载:两处卡片共用同一份已取到的数据。底色用左侧边栏的底色(`--dsw-specific-sidebar-fill`),阴影与左侧一致。
|
|
115
|
+
- 右侧卡片与其它插件的右侧卡片(如 Codex Advisor)会自动上下排开,不会重叠;测量一时失败时退回固定位置显示,不会整块消失。
|
|
115
116
|
## 更新
|
|
116
117
|
|
|
117
118
|
- 标题「USTC 词元额度」右侧显示灰色小字版本号;点击版本号可手动检查更新;
|
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.47';
|
|
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`;
|
|
@@ -477,7 +477,7 @@ window.__ModuleLoader__.load({
|
|
|
477
477
|
legendRow: {
|
|
478
478
|
display: 'grid',
|
|
479
479
|
gridTemplateColumns: 'var(--ustc-key-col, 36px) repeat(3, minmax(0, 1fr))',
|
|
480
|
-
columnGap:
|
|
480
|
+
columnGap: 'var(--ustc-gap, 4px)',
|
|
481
481
|
alignItems: 'center',
|
|
482
482
|
minWidth: 0,
|
|
483
483
|
paddingBottom: 4,
|
|
@@ -486,13 +486,20 @@ 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: 'var(--ustc-gap, 4px)',
|
|
490
490
|
alignItems: 'center',
|
|
491
491
|
minWidth: 0,
|
|
492
492
|
paddingTop: 6,
|
|
493
493
|
paddingBottom: 2,
|
|
494
494
|
},
|
|
495
495
|
legendCell: {
|
|
496
|
+
minWidth: 0,
|
|
497
|
+
display: 'flex',
|
|
498
|
+
flexDirection: 'column',
|
|
499
|
+
alignItems: 'center',
|
|
500
|
+
gap: 0,
|
|
501
|
+
},
|
|
502
|
+
legendCellWide: {
|
|
496
503
|
minWidth: 0,
|
|
497
504
|
display: 'flex',
|
|
498
505
|
flexDirection: 'row',
|
|
@@ -515,7 +522,7 @@ window.__ModuleLoader__.load({
|
|
|
515
522
|
paddingLeft: 2,
|
|
516
523
|
},
|
|
517
524
|
legendReset: {
|
|
518
|
-
|
|
525
|
+
width: '100%',
|
|
519
526
|
fontSize: 8,
|
|
520
527
|
color: 'var(--dsw-alias-label-secondary)',
|
|
521
528
|
whiteSpace: 'nowrap',
|
|
@@ -562,6 +569,12 @@ window.__ModuleLoader__.load({
|
|
|
562
569
|
cursor: 'help',
|
|
563
570
|
},
|
|
564
571
|
cell: {
|
|
572
|
+
minWidth: 0,
|
|
573
|
+
display: 'flex',
|
|
574
|
+
flexDirection: 'column',
|
|
575
|
+
gap: 2,
|
|
576
|
+
},
|
|
577
|
+
cellWide: {
|
|
565
578
|
minWidth: 0,
|
|
566
579
|
display: 'flex',
|
|
567
580
|
flexDirection: 'row',
|
|
@@ -585,8 +598,17 @@ window.__ModuleLoader__.load({
|
|
|
585
598
|
minWidth: 0,
|
|
586
599
|
},
|
|
587
600
|
value: {
|
|
601
|
+
minWidth: 0,
|
|
602
|
+
fontSize: 10.5,
|
|
603
|
+
fontWeight: 650,
|
|
604
|
+
color: 'var(--dsw-alias-label-primary)',
|
|
605
|
+
whiteSpace: 'nowrap',
|
|
606
|
+
overflow: 'hidden',
|
|
607
|
+
textOverflow: 'ellipsis',
|
|
608
|
+
},
|
|
609
|
+
valueWide: {
|
|
588
610
|
flex: '0 0 auto',
|
|
589
|
-
width:
|
|
611
|
+
width: 'var(--ustc-value-w, 44px)',
|
|
590
612
|
textAlign: 'right',
|
|
591
613
|
fontSize: 10,
|
|
592
614
|
fontWeight: 650,
|
|
@@ -595,7 +617,7 @@ window.__ModuleLoader__.load({
|
|
|
595
617
|
overflow: 'hidden',
|
|
596
618
|
textOverflow: 'ellipsis',
|
|
597
619
|
},
|
|
598
|
-
|
|
620
|
+
percentWide: {
|
|
599
621
|
flex: '0 0 auto',
|
|
600
622
|
width: 24,
|
|
601
623
|
textAlign: 'right',
|
|
@@ -603,6 +625,12 @@ window.__ModuleLoader__.load({
|
|
|
603
625
|
color: 'var(--dsw-alias-label-secondary)',
|
|
604
626
|
whiteSpace: 'nowrap',
|
|
605
627
|
},
|
|
628
|
+
percent: {
|
|
629
|
+
flex: '0 0 auto',
|
|
630
|
+
fontSize: 8.5,
|
|
631
|
+
color: 'var(--dsw-alias-label-secondary)',
|
|
632
|
+
whiteSpace: 'nowrap',
|
|
633
|
+
},
|
|
606
634
|
bar: {
|
|
607
635
|
position: 'relative',
|
|
608
636
|
height: 6,
|
|
@@ -1166,72 +1194,6 @@ window.__ModuleLoader__.load({
|
|
|
1166
1194
|
const DOCK_TRANSCRIPT_FLOOR = 360;
|
|
1167
1195
|
|
|
1168
1196
|
|
|
1169
|
-
// When the blank strip beside the transcript is too narrow, free room on the
|
|
1170
|
-
// right instead of letting the card shrink: pad the conversation column and pin
|
|
1171
|
-
// the transcript to the left edge of that padded box.
|
|
1172
|
-
const DOCK_COMFORT = 220;
|
|
1173
|
-
let pushedColumn = null;
|
|
1174
|
-
let pushedTarget = null;
|
|
1175
|
-
let pushedSaved = null;
|
|
1176
|
-
let padState = 0;
|
|
1177
|
-
|
|
1178
|
-
function transcriptOf() {
|
|
1179
|
-
const flow = document.querySelector('[data-slot="conversation.chat.flow"]');
|
|
1180
|
-
if (!flow) return null;
|
|
1181
|
-
let node = flow;
|
|
1182
|
-
for (let i = 0; i < 6 && node; i += 1) {
|
|
1183
|
-
const style = getComputedStyle(node);
|
|
1184
|
-
if (style.marginLeft === 'auto' || style.marginRight === 'auto') return node;
|
|
1185
|
-
node = node.parentElement;
|
|
1186
|
-
}
|
|
1187
|
-
return flow.firstElementChild || flow;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
function pushConversation(reserve) {
|
|
1191
|
-
const holder = document.querySelector('[data-slot="main.conversation"]');
|
|
1192
|
-
const column = holder ? (holder.firstElementChild || holder) : null;
|
|
1193
|
-
if (!column) return;
|
|
1194
|
-
const target = transcriptOf();
|
|
1195
|
-
if (!target) return;
|
|
1196
|
-
if (pushedColumn !== column) {
|
|
1197
|
-
releaseConversation();
|
|
1198
|
-
pushedColumn = column;
|
|
1199
|
-
pushedSaved = {
|
|
1200
|
-
pad: column.style.getPropertyValue('padding-right'),
|
|
1201
|
-
padPriority: column.style.getPropertyPriority('padding-right'),
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
if (pushedTarget !== target) {
|
|
1205
|
-
if (pushedTarget) {
|
|
1206
|
-
pushedTarget.style.removeProperty('margin-left');
|
|
1207
|
-
pushedTarget.style.removeProperty('margin-right');
|
|
1208
|
-
}
|
|
1209
|
-
pushedTarget = target;
|
|
1210
|
-
target.style.setProperty('margin-left', '0px', 'important');
|
|
1211
|
-
target.style.setProperty('margin-right', 'auto', 'important');
|
|
1212
|
-
}
|
|
1213
|
-
const wanted = reserve + 'px';
|
|
1214
|
-
if (column.style.getPropertyValue('padding-right') !== wanted) {
|
|
1215
|
-
column.style.setProperty('padding-right', wanted, 'important');
|
|
1216
|
-
}
|
|
1217
|
-
padState = reserve;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
function releaseConversation() {
|
|
1221
|
-
if (pushedTarget) {
|
|
1222
|
-
pushedTarget.style.removeProperty('margin-left');
|
|
1223
|
-
pushedTarget.style.removeProperty('margin-right');
|
|
1224
|
-
pushedTarget = null;
|
|
1225
|
-
}
|
|
1226
|
-
if (pushedColumn && pushedSaved) {
|
|
1227
|
-
if (pushedSaved.pad) pushedColumn.style.setProperty('padding-right', pushedSaved.pad, pushedSaved.padPriority);
|
|
1228
|
-
else pushedColumn.style.removeProperty('padding-right');
|
|
1229
|
-
}
|
|
1230
|
-
pushedColumn = null;
|
|
1231
|
-
pushedSaved = null;
|
|
1232
|
-
padState = 0;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
1197
|
function measureRightDock() {
|
|
1236
1198
|
const holder = document.querySelector('[data-slot="main.conversation"]');
|
|
1237
1199
|
const column = holder ? (holder.firstElementChild || holder) : null;
|
|
@@ -1251,15 +1213,18 @@ window.__ModuleLoader__.load({
|
|
|
1251
1213
|
}
|
|
1252
1214
|
if (boundaryRight === null) boundaryRight = columnRect.left + columnRect.width * 0.5 + 24;
|
|
1253
1215
|
|
|
1254
|
-
// Right bound:
|
|
1255
|
-
//
|
|
1216
|
+
// Right bound: the turn rail when there are turns; otherwise the collapsed
|
|
1217
|
+
// right-sidebar icon rail, which only counts when it sits at the far right.
|
|
1256
1218
|
let rightLimit = columnRect.right;
|
|
1257
1219
|
for (const button of document.querySelectorAll('button[aria-label]')) {
|
|
1258
1220
|
const label = button.getAttribute('aria-label') || '';
|
|
1259
|
-
|
|
1221
|
+
const isTurn = /turnNavigation|轮次|跳转/i.test(label);
|
|
1222
|
+
const isRail = /右侧边栏/.test(label);
|
|
1223
|
+
if (!isTurn && !isRail) continue;
|
|
1260
1224
|
const rect = button.getBoundingClientRect();
|
|
1261
1225
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
1262
1226
|
if (rect.left <= boundaryRight) continue;
|
|
1227
|
+
if (isRail && columnRect.right - rect.left > 72) continue;
|
|
1263
1228
|
if (rect.left < rightLimit) rightLimit = rect.left;
|
|
1264
1229
|
}
|
|
1265
1230
|
if (rightLimit > columnRect.right) rightLimit = columnRect.right;
|
|
@@ -1267,7 +1232,22 @@ window.__ModuleLoader__.load({
|
|
|
1267
1232
|
const leftEdge = Math.round(boundaryRight) + DOCK_GAP;
|
|
1268
1233
|
const rightEdge = Math.round(rightLimit) - DOCK_GAP;
|
|
1269
1234
|
const span = rightEdge - leftEdge;
|
|
1270
|
-
if (span < 40)
|
|
1235
|
+
if (span < 40) {
|
|
1236
|
+
// Measurement can fail transiently (column re-mounts, first paint). Never
|
|
1237
|
+
// hide the card: anchor it to the column's right edge with a sane width and
|
|
1238
|
+
// let the next measurement refine it.
|
|
1239
|
+
const fallbackTop = Math.round(columnRect.top) + 40;
|
|
1240
|
+
const fallbackWidth = Math.min(300, Math.max(220, Math.round(columnRect.width * 0.24)));
|
|
1241
|
+
return {
|
|
1242
|
+
top: fallbackTop,
|
|
1243
|
+
left: Math.max(0, Math.round(columnRect.right) - fallbackWidth - 12),
|
|
1244
|
+
width: fallbackWidth,
|
|
1245
|
+
naturalSpan: fallbackWidth,
|
|
1246
|
+
columnWidth: Math.round(columnRect.width),
|
|
1247
|
+
maxHeight: Math.max(120, Math.round(columnRect.height) - 60),
|
|
1248
|
+
fallback: true,
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1271
1251
|
|
|
1272
1252
|
// Vertical bound: below the conversation tab strip, above the column bottom.
|
|
1273
1253
|
let contentTop = Math.round(columnRect.top) + DOCK_GAP;
|
|
@@ -1281,8 +1261,23 @@ window.__ModuleLoader__.load({
|
|
|
1281
1261
|
}
|
|
1282
1262
|
|
|
1283
1263
|
const floored = span < 240;
|
|
1264
|
+
let stackTop = contentTop;
|
|
1265
|
+
try {
|
|
1266
|
+
// Other plugins place their own right docks with the same anchor; stack below
|
|
1267
|
+
// any of them that already occupy this band so the cards never overlap.
|
|
1268
|
+
for (const node of document.querySelectorAll('[data-codex-advisor-dock="right"]')) {
|
|
1269
|
+
const rect = node.getBoundingClientRect();
|
|
1270
|
+
if (rect.height <= 0 || rect.width <= 0) continue;
|
|
1271
|
+
if (rect.bottom > stackTop && rect.top < columnRect.bottom) {
|
|
1272
|
+
stackTop = Math.max(stackTop, Math.round(rect.bottom) + DOCK_GAP);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
} catch {
|
|
1276
|
+
// Stacking is best-effort; a broken neighbour must not break this card.
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1284
1279
|
return {
|
|
1285
|
-
top:
|
|
1280
|
+
top: stackTop,
|
|
1286
1281
|
left: floored ? Math.max(0, rightEdge - 240) : leftEdge,
|
|
1287
1282
|
width: floored ? 240 : span,
|
|
1288
1283
|
naturalSpan: span,
|
|
@@ -1311,20 +1306,7 @@ window.__ModuleLoader__.load({
|
|
|
1311
1306
|
observer = new ResizeObserver(schedule);
|
|
1312
1307
|
observer.observe(column);
|
|
1313
1308
|
}
|
|
1314
|
-
|
|
1315
|
-
if (activeRef.current && next) {
|
|
1316
|
-
const natural = next.naturalSpan;
|
|
1317
|
-
let pad = padState;
|
|
1318
|
-
if (natural < DOCK_COMFORT - 8) pad = pad + (DOCK_COMFORT - natural);
|
|
1319
|
-
else if (natural > DOCK_COMFORT + 24) pad = Math.max(0, pad - (natural - DOCK_COMFORT));
|
|
1320
|
-
const limit = Math.max(0, next.columnWidth - 340);
|
|
1321
|
-
pad = Math.min(Math.round(pad), limit);
|
|
1322
|
-
if (pad > 0) pushConversation(pad);
|
|
1323
|
-
else releaseConversation();
|
|
1324
|
-
} else {
|
|
1325
|
-
releaseConversation();
|
|
1326
|
-
}
|
|
1327
|
-
setBox(next);
|
|
1309
|
+
setBox(measureRightDock());
|
|
1328
1310
|
};
|
|
1329
1311
|
function schedule() {
|
|
1330
1312
|
if (!frame) frame = window.requestAnimationFrame(measure);
|
|
@@ -1364,6 +1346,9 @@ window.__ModuleLoader__.load({
|
|
|
1364
1346
|
const position = usePanelPosition();
|
|
1365
1347
|
const active = props.active !== false;
|
|
1366
1348
|
const [cardHovered, setCardHovered] = React.useState(false);
|
|
1349
|
+
const [narrow, setNarrow] = React.useState(false);
|
|
1350
|
+
// The one-line layout needs ~340px of card width; below that keep the compact card.
|
|
1351
|
+
const wideLayout = placement === 'right' && !narrow;
|
|
1367
1352
|
const [markHovered, setMarkHovered] = React.useState(false);
|
|
1368
1353
|
const activeRef = React.useRef(active);
|
|
1369
1354
|
activeRef.current = active;
|
|
@@ -1549,6 +1534,19 @@ window.__ModuleLoader__.load({
|
|
|
1549
1534
|
};
|
|
1550
1535
|
}, [load]);
|
|
1551
1536
|
|
|
1537
|
+
React.useLayoutEffect(() => {
|
|
1538
|
+
const root = rootRef.current;
|
|
1539
|
+
if (!root || typeof ResizeObserver !== 'function') return undefined;
|
|
1540
|
+
const observer = new ResizeObserver(() => {
|
|
1541
|
+
// Border-box width: the padding-free content box is always smaller and would
|
|
1542
|
+
// misfire the threshold by the card's own insets.
|
|
1543
|
+
const width = root.getBoundingClientRect().width;
|
|
1544
|
+
setNarrow(width < 340);
|
|
1545
|
+
});
|
|
1546
|
+
observer.observe(root);
|
|
1547
|
+
return () => { observer.disconnect(); };
|
|
1548
|
+
}, [props.wide]);
|
|
1549
|
+
|
|
1552
1550
|
React.useLayoutEffect(() => {
|
|
1553
1551
|
const root = rootRef.current;
|
|
1554
1552
|
if (!root) return undefined;
|
|
@@ -1748,7 +1746,7 @@ window.__ModuleLoader__.load({
|
|
|
1748
1746
|
...candidates.map((window) => `${window.id}: ${window.resetAt ? formatFull(window.resetAt) : t('notConfigured')}`),
|
|
1749
1747
|
].join('\n')
|
|
1750
1748
|
: label;
|
|
1751
|
-
return h('div', { style: STYLE.legendCell, title },
|
|
1749
|
+
return h('div', { style: wideLayout ? STYLE.legendCellWide : STYLE.legendCell, title },
|
|
1752
1750
|
h('div', { style: STYLE.legendName }, label),
|
|
1753
1751
|
h('div', { style: STYLE.legendReset }, resetText)
|
|
1754
1752
|
);
|
|
@@ -1805,30 +1803,44 @@ window.__ModuleLoader__.load({
|
|
|
1805
1803
|
if (window.source) titleParts.push(sourceLabel(window.source));
|
|
1806
1804
|
if (isStale) titleParts.push(t('stale'));
|
|
1807
1805
|
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1806
|
+
const barNode = (style) => h('div', {
|
|
1807
|
+
style: { ...style, opacity: isStale ? 0.55 : 1 },
|
|
1808
|
+
role: 'progressbar',
|
|
1809
|
+
'aria-label': label,
|
|
1810
|
+
'aria-valuemin': 0,
|
|
1811
|
+
'aria-valuemax': 100,
|
|
1812
|
+
'aria-valuenow': ratio === null ? undefined : Math.round(Math.min(1, Math.max(0, ratio)) * 100),
|
|
1813
|
+
'aria-valuetext': percent || valueText,
|
|
1814
|
+
},
|
|
1815
|
+
h('div', { style: STYLE.track, 'aria-hidden': true }),
|
|
1816
|
+
h('div', {
|
|
1817
|
+
style: {
|
|
1818
|
+
position: 'relative',
|
|
1819
|
+
height: '100%',
|
|
1820
|
+
width: fillWidth,
|
|
1821
|
+
background: usedColor,
|
|
1822
|
+
borderRadius: 999,
|
|
1823
|
+
transition: 'width 200ms ease',
|
|
1818
1824
|
},
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1825
|
+
})
|
|
1826
|
+
);
|
|
1827
|
+
const valueNode = (style) => h('span', { style }, `${isStale ? '≈ ' : ''}${valueText}`);
|
|
1828
|
+
const percentNode = (style) => (percent ? h('span', { style: { ...style, color: percentColor } }, percent) : null);
|
|
1829
|
+
|
|
1830
|
+
if (wideLayout) {
|
|
1831
|
+
return h('div', { style: STYLE.cellWide, title: titleParts.join(' · ') },
|
|
1832
|
+
valueNode(STYLE.valueWide),
|
|
1833
|
+
barNode(STYLE.inlineBar),
|
|
1834
|
+
percentNode(STYLE.percentWide)
|
|
1835
|
+
);
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
return h('div', { style: STYLE.cell, title: titleParts.join(' · ') },
|
|
1839
|
+
h('div', { style: STYLE.valueLine },
|
|
1840
|
+
valueNode(STYLE.value),
|
|
1841
|
+
percentNode(STYLE.percent)
|
|
1830
1842
|
),
|
|
1831
|
-
|
|
1843
|
+
barNode(STYLE.bar)
|
|
1832
1844
|
);
|
|
1833
1845
|
}
|
|
1834
1846
|
|
|
@@ -1882,7 +1894,24 @@ window.__ModuleLoader__.load({
|
|
|
1882
1894
|
|
|
1883
1895
|
const failed = keys.filter((key) => key.ok === false);
|
|
1884
1896
|
const keyColumnWidth = keyColumnWidthFor(keys, activeProvider, defaultProvider);
|
|
1885
|
-
|
|
1897
|
+
// Align the bars by sizing the value column to the longest value on screen.
|
|
1898
|
+
let valueChars = 3;
|
|
1899
|
+
for (const key of keys) {
|
|
1900
|
+
for (const window of (key.windows || [])) {
|
|
1901
|
+
const usedValue = typeof window.used === 'number' && Number.isFinite(window.used) ? window.used : null;
|
|
1902
|
+
const limitValue = typeof window.limit === 'number' && Number.isFinite(window.limit) ? window.limit : null;
|
|
1903
|
+
const text = usedValue === null
|
|
1904
|
+
? '—'
|
|
1905
|
+
: `${formatNumber(usedValue)}/${limitValue === null ? '—' : formatNumber(limitValue)}`;
|
|
1906
|
+
if (text.length > valueChars) valueChars = text.length;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
const tableStyle = {
|
|
1910
|
+
...STYLE.table,
|
|
1911
|
+
'--ustc-key-col': `${keyColumnWidth}px`,
|
|
1912
|
+
'--ustc-gap': wideLayout ? '16px' : '4px',
|
|
1913
|
+
'--ustc-value-w': `${Math.min(12, valueChars + 0.5)}ch`,
|
|
1914
|
+
};
|
|
1886
1915
|
const versionTitle = updateInfo && updateInfo.updateAvailable
|
|
1887
1916
|
? `${t('updateAvailable')} v${updateInfo.latestVersion}`
|
|
1888
1917
|
: updateChecking
|
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.47';
|
|
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