opencode-statboard 2.9.5 → 2.9.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/index.html +72 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-statboard",
3
- "version": "2.9.5",
3
+ "version": "2.9.6",
4
4
  "description": "Real-time dashboard for opencode token usage and cost statistics",
5
5
  "main": "server.js",
6
6
  "bin": {
package/public/index.html CHANGED
@@ -92,18 +92,37 @@
92
92
  .trend-wrap > div { flex: 1; min-width: 300px; }
93
93
  .trend-wrap #costSection { min-width: 240px; }
94
94
  .heatmap-wrap { display: flex; flex-direction: column; gap: 8px; }
95
- .heatmap-months { display: flex; gap: 2px; padding-left: 22px; font-size: 10px; color: var(--muted); }
95
+ .heatmap-months { display: flex; gap: 2px; padding-left: 28px; font-size: 11px; color: var(--muted); }
96
96
  .heatmap-months span { flex: 1; text-align: left; overflow: visible; white-space: nowrap; }
97
97
  .heatmap-grid { display: flex; gap: 2px; }
98
98
  .heatmap-grid .hm-week { display: flex; flex-direction: column; gap: 2px; }
99
- .hm-cell { width: 11px; height: 11px; border-radius: 2px; background: var(--card2); border: 1px solid var(--border); box-sizing: border-box; }
99
+ .hm-cell { width: 14px; height: 14px; border-radius: 2px; background: var(--card2); border: 1px solid var(--border); box-sizing: border-box; }
100
+ /* Heatmap color scale: 10 levels from cool to hot */
100
101
  .hm-cell.hm-0 { background: var(--card2); }
101
- .hm-cell.hm-1 { background: color-mix(in srgb, var(--in) 22%, var(--card2)); }
102
- .hm-cell.hm-2 { background: color-mix(in srgb, var(--in) 45%, var(--card2)); }
103
- .hm-cell.hm-3 { background: color-mix(in srgb, var(--in) 70%, var(--card2)); }
104
- .hm-cell.hm-4 { background: var(--in); }
105
- .heatmap-legend { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); }
106
- .heatmap-legend .hm-cell { width: 10px; height: 10px; }
102
+ .hm-cell.hm-1 { background: #0d47a1; } /* Deep blue */
103
+ .hm-cell.hm-2 { background: #1565c0; }
104
+ .hm-cell.hm-2 { background: #1976d2; }
105
+ .hm-cell.hm-3 { background: #1e88e5; }
106
+ .hm-cell.hm-4 { background: #2196f3; }
107
+ .hm-cell.hm-5 { background: #64b5f6; }
108
+ .hm-cell.hm-6 { background: #90caf9; }
109
+ .hm-cell.hm-7 { background: #bbdefb; }
110
+ .hm-cell.hm-8 { background: #e3f2fd; }
111
+ .hm-cell.hm-9 { background: #fff3e0; }
112
+ .hm-cell.hm-10 { background: #ffe0b2; }
113
+ .hm-cell.hm-11 { background: #ffcc80; }
114
+ .hm-cell.hm-12 { background: #ffb74d; }
115
+ .hm-cell.hm-13 { background: #ffa726; }
116
+ .hm-cell.hm-14 { background: #ff9800; }
117
+ .hm-cell.hm-15 { background: #fb8c00; }
118
+ .hm-cell.hm-16 { background: #f57c00; }
119
+ .hm-cell.hm-17 { background: #ef6c00; }
120
+ .hm-cell.hm-18 { background: #e65100; }
121
+ .hm-cell.hm-19 { background: #d84315; }
122
+ .hm-cell.hm-20 { background: #c62828; }
123
+ .hm-cell.hm-21 { background: #b71c1c; }
124
+ .heatmap-legend { display: flex; gap: 4px; align-items: center; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
125
+ .heatmap-legend .hm-cell { width: 12px; height: 12px; }
107
126
  .legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
108
127
  .legend span { display: flex; align-items: center; gap: 6px; }
109
128
  .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
@@ -244,10 +263,16 @@
244
263
  <div class="heatmap-legend">
245
264
  <span data-i18n="less">Less</span>
246
265
  <span class="hm-cell hm-0"></span>
247
- <span class="hm-cell hm-1"></span>
248
266
  <span class="hm-cell hm-2"></span>
249
- <span class="hm-cell hm-3"></span>
250
267
  <span class="hm-cell hm-4"></span>
268
+ <span class="hm-cell hm-6"></span>
269
+ <span class="hm-cell hm-8"></span>
270
+ <span class="hm-cell hm-10"></span>
271
+ <span class="hm-cell hm-12"></span>
272
+ <span class="hm-cell hm-14"></span>
273
+ <span class="hm-cell hm-16"></span>
274
+ <span class="hm-cell hm-18"></span>
275
+ <span class="hm-cell hm-20"></span>
251
276
  <span data-i18n="more">More</span>
252
277
  </div>
253
278
  </div>
@@ -821,9 +846,27 @@ function renderHeatmap(data) {
821
846
  const levelOf = (v) => {
822
847
  if (!v || v <= 0) return 0;
823
848
  const r = v / max;
824
- if (r >= 0.75) return 4;
825
- if (r >= 0.5) return 3;
826
- if (r >= 0.25) return 2;
849
+ // 20 levels for smooth gradient
850
+ if (r >= 0.95) return 20;
851
+ if (r >= 0.90) return 19;
852
+ if (r >= 0.85) return 18;
853
+ if (r >= 0.80) return 17;
854
+ if (r >= 0.75) return 16;
855
+ if (r >= 0.70) return 15;
856
+ if (r >= 0.65) return 14;
857
+ if (r >= 0.60) return 13;
858
+ if (r >= 0.55) return 12;
859
+ if (r >= 0.50) return 11;
860
+ if (r >= 0.45) return 10;
861
+ if (r >= 0.40) return 9;
862
+ if (r >= 0.35) return 9;
863
+ if (r >= 0.30) return 8;
864
+ if (r >= 0.25) return 7;
865
+ if (r >= 0.20) return 6;
866
+ if (r >= 0.15) return 5;
867
+ if (r >= 0.10) return 4;
868
+ if (r >= 0.05) return 3;
869
+ if (r >= 0.02) return 2;
827
870
  return 1;
828
871
  };
829
872
  grid.innerHTML = weeks.map((w) => '<div class="hm-week">' +
@@ -924,6 +967,7 @@ async function poll() {
924
967
  const time = new Date().toLocaleTimeString(lang === 'zh-TW' ? 'zh-TW' : 'en', { hour12: false });
925
968
  lastUpdatedText = t('lastUpdated') + ' ' + time + ' (' + t('dataAgo') + ' ' + ago + 's)';
926
969
  $('updated').textContent = lastUpdatedText;
970
+ refreshCurrentReport(); // auto-refresh report panels
927
971
  return j;
928
972
  } catch (e) {
929
973
  $('updated').textContent = t('connFail') + ': ' + e.message;
@@ -932,6 +976,21 @@ async function poll() {
932
976
  }
933
977
  }
934
978
 
979
+ // Auto-refresh the current scope report when poll succeeds (so all panels stay fresh)
980
+ // Debounced to avoid hammering the API if poll runs frequently
981
+ let reportRefreshDebounce = null;
982
+ async function refreshCurrentReport() {
983
+ if (reportRefreshDebounce) clearTimeout(reportRefreshDebounce);
984
+ reportRefreshDebounce = setTimeout(async () => {
985
+ if (window.__lastReport) {
986
+ try {
987
+ const r = await loadReport(scopeDays);
988
+ if (r) renderReport(r);
989
+ } catch (_) {}
990
+ }
991
+ }, 500); // debounce 500ms
992
+ }
993
+
935
994
  let reportLoading = false;
936
995
  let reportRetry = 0;
937
996
  const MAX_REPORT_RETRIES = 12;