dsh-ustc-quota 1.1.38 → 1.1.40

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,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.38';
14
+ const CLIENT_VERSION = '1.1.40';
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)) auto',
480
- columnGap: 4,
479
+ gridTemplateColumns: 'var(--ustc-key-col, 36px) repeat(3, minmax(0, 1fr))',
480
+ columnGap: 16,
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: 4,
489
+ columnGap: 16,
490
490
  alignItems: 'center',
491
491
  minWidth: 0,
492
492
  paddingTop: 6,
@@ -495,9 +495,10 @@ window.__ModuleLoader__.load({
495
495
  legendCell: {
496
496
  minWidth: 0,
497
497
  display: 'flex',
498
- flexDirection: 'column',
499
- alignItems: 'center',
500
- gap: 0,
498
+ flexDirection: 'row',
499
+ alignItems: 'baseline',
500
+ justifyContent: 'center',
501
+ gap: 5,
501
502
  },
502
503
  legendName: {
503
504
  fontSize: 10,
@@ -514,7 +515,7 @@ window.__ModuleLoader__.load({
514
515
  paddingLeft: 2,
515
516
  },
516
517
  legendReset: {
517
- width: '100%',
518
+ minWidth: 0,
518
519
  fontSize: 8,
519
520
  color: 'var(--dsw-alias-label-secondary)',
520
521
  whiteSpace: 'nowrap',
@@ -568,8 +569,8 @@ window.__ModuleLoader__.load({
568
569
  gap: 3,
569
570
  },
570
571
  inlineBar: {
571
- flex: '1 1 14px',
572
- minWidth: 10,
572
+ flex: '1 1 0',
573
+ minWidth: 8,
573
574
  height: 5,
574
575
  position: 'relative',
575
576
  borderRadius: 999,
@@ -584,8 +585,10 @@ window.__ModuleLoader__.load({
584
585
  minWidth: 0,
585
586
  },
586
587
  value: {
587
- minWidth: 0,
588
- fontSize: 10.5,
588
+ flex: '0 0 auto',
589
+ width: 44,
590
+ textAlign: 'right',
591
+ fontSize: 10,
589
592
  fontWeight: 650,
590
593
  color: 'var(--dsw-alias-label-primary)',
591
594
  whiteSpace: 'nowrap',
@@ -594,6 +597,8 @@ window.__ModuleLoader__.load({
594
597
  },
595
598
  percent: {
596
599
  flex: '0 0 auto',
600
+ width: 24,
601
+ textAlign: 'right',
597
602
  fontSize: 8.5,
598
603
  color: 'var(--dsw-alias-label-secondary)',
599
604
  whiteSpace: 'nowrap',
@@ -811,7 +816,9 @@ window.__ModuleLoader__.load({
811
816
  function formatPercent(ratio) {
812
817
  if (typeof ratio !== 'number' || !Number.isFinite(ratio)) return null;
813
818
  const percent = ratio * 100;
814
- if (percent > 0 && percent < 10) return `${percent.toFixed(1)}%`;
819
+ const tenths = Math.round(percent * 10) / 10;
820
+ if (tenths === 0) return '0%';
821
+ if (tenths < 10) return `${tenths.toFixed(1)}%`;
815
822
  return `${Math.round(percent)}%`;
816
823
  }
817
824
 
@@ -1799,10 +1806,7 @@ window.__ModuleLoader__.load({
1799
1806
  if (isStale) titleParts.push(t('stale'));
1800
1807
 
1801
1808
  return h('div', { style: STYLE.cell, title: titleParts.join(' · ') },
1802
- h('div', { style: STYLE.valueLine },
1803
- h('span', { style: STYLE.value }, `${isStale ? '≈ ' : ''}${valueText}`),
1804
- percent ? h('span', { style: { ...STYLE.percent, color: percentColor } }, percent) : null
1805
- ),
1809
+ h('span', { style: STYLE.value }, `${isStale ? '≈ ' : ''}${valueText}`),
1806
1810
  h('div', {
1807
1811
  style: { ...STYLE.inlineBar, opacity: isStale ? 0.55 : 1 },
1808
1812
  role: 'progressbar',
@@ -1823,7 +1827,8 @@ window.__ModuleLoader__.load({
1823
1827
  transition: 'width 200ms ease',
1824
1828
  },
1825
1829
  })
1826
- )
1830
+ ),
1831
+ percent ? h('span', { style: { ...STYLE.percent, color: percentColor } }, percent) : null
1827
1832
  );
1828
1833
  }
1829
1834
 
@@ -1916,6 +1921,7 @@ window.__ModuleLoader__.load({
1916
1921
  : null,
1917
1922
  error && snapshot ? h('span', { style: STYLE.warn, title: error }, '!') : null,
1918
1923
 
1924
+ h('span', { style: STYLE.meta }, updated ? `${t('updatedLabel')} ${updated}` : ''),
1919
1925
  h('button', {
1920
1926
  type: 'button',
1921
1927
  'aria-label': t('refresh'),
@@ -1952,7 +1958,6 @@ window.__ModuleLoader__.load({
1952
1958
  h('div', { style: STYLE.legendRow },
1953
1959
  h('div', { key: 'corner' }),
1954
1960
  WINDOW_IDS.map((id) => h(React.Fragment, { key: id }, windowLegend(id))),
1955
- h('div', { key: 'updated', style: STYLE.legendMeta, title: updated || '' }, updated ? `${t('updatedLabel')} ${updated}` : '')
1956
1961
  ),
1957
1962
  keys.map((key, index) => keyRow(key, index, activeProvider))
1958
1963
  ),
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.38';
25
+ const PLUGIN_VERSION = '1.1.40';
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.38",
3
+ "version": "1.1.40",
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).",