dsh-spend-ledger 1.2.1 → 1.2.2
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/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/client.js +104 -34
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.2
|
|
4
|
+
|
|
5
|
+
浅色模式下热力图的方块默认是黑的——只修这一处,深色模式保持不变。
|
|
6
|
+
|
|
7
|
+
### 每日热力图
|
|
8
|
+
|
|
9
|
+
- **原因**:每一格的颜色写在内联 `style` 里(`BLUE_RAMP`,深色主题的深灰蓝,
|
|
10
|
+
空格子是 `#252a31`)。宿主切主题靠 `body[data-ds-dark-theme]`,内联样式压在
|
|
11
|
+
这层之上,换到浅色时深色值原样留在白卡上,看起来就是一片黑。
|
|
12
|
+
- **改法**:颜色只写在 CSS 里、按主题分两层——`.ts-cell-paint` 及其 `-l1..4`
|
|
13
|
+
是深色(原值逐字节照搬),`body:not([data-ds-dark-theme])` 覆盖成浅色。
|
|
14
|
+
JS 只负责「级别 → 类名」,不再产出任何颜色值;图例色块同步走同一套类名。
|
|
15
|
+
- **浅色五档**:空格子 `#eef1f6` 贴近卡片白底,`l1`–`l4` 由浅蓝加深到 `#1d5fd1`。
|
|
16
|
+
相邻两档至少差 `1.22:1`、最深一档对白底 `5.8:1`——四档能一眼分开,
|
|
17
|
+
又不会深到像个洞。
|
|
18
|
+
- **深色**:逐档取像素核对,五档与改动前完全一致。
|
|
19
|
+
|
|
20
|
+
### 选中描边(两个主题都改了)
|
|
21
|
+
|
|
22
|
+
- 选中环原来取 `currentColor`,也就是 `--dsw-alias-label-primary`——浅色主题下它
|
|
23
|
+
接近纯黑,压在蓝块上就是一圈黑边。
|
|
24
|
+
- 固定颜色本来就不可能对:环要压在 5 档底色上,而底色从近白跨到实蓝、从深灰跨到
|
|
25
|
+
亮蓝。纯黑在浅色 `l4` 只剩 3.3:1,纯白在浅色 `l0` 只有 1.1:1;深色里纯白环压在
|
|
26
|
+
`l0` 上是 14:1,就是那道扎眼的硬白边。
|
|
27
|
+
- 改为按档位各自解一个目标反差(`--ts-ring`):深色统一 5.2:1、浅色浅档 4.5:1。
|
|
28
|
+
越浅的底给越深的环、越深的底给越亮的环,整排看过去力度一致。
|
|
29
|
+
- 深色:`#999b9f` → `#abadb2` → `#d0d6dc` → `#fefefe` → `#ffffff`
|
|
30
|
+
- 浅色:`#546ea2` → `#40609e` → `#224990` → `#ffffff` → `#ffffff`
|
|
31
|
+
- 键盘聚焦仍是 2px 品牌色,与鼠标选中的 1.5px 区分开。
|
|
32
|
+
|
|
3
33
|
## 1.2.1
|
|
4
34
|
|
|
5
35
|
只改「此刻」与「选中」的画法,其余不动。
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
- **全部用量**:输入 + 缓存读取 + 缓存写入 + 输出(等于服务商的 `totalTokens`,不是只看 input+output)。
|
|
21
21
|
- **今日 / 昨日**:顶部给出今日用量与环比。
|
|
22
22
|
- **用量构成**:四类 token 的占比条。
|
|
23
|
-
- **14 天趋势 +
|
|
23
|
+
- **14 天趋势 + 每日热力图**:按本地日历日分桶,点色块看当天明细。色阶与选中环都跟随主题:浅色是近白到实蓝、深色是深灰到亮蓝,选中环按档位各自取色(底色越浅环越深),所以两套主题下都能一眼分出四档、也不会出现黑框或硬白框。
|
|
24
24
|
- **当天明细**:当天每个会话、每个模型各花了多少,以及缓存命中率。
|
|
25
25
|
- **预算条**:日预算。没配 `budgetTokens` 时按历史最忙一天 ×1.25 取整推出来,只作参照。
|
|
26
26
|
- **已删除会话仍计入**:删掉会话不会让历史花费凭空缩水,页面会单列这部分占比。
|
package/client.js
CHANGED
|
@@ -254,23 +254,102 @@ window.__ModuleLoader__.load({
|
|
|
254
254
|
.ts-cell:hover:not(:disabled) { transform: translateY(-1px) scale(1.05); filter: brightness(1.08); z-index: 2; }
|
|
255
255
|
.ts-cell:active:not(:disabled) { transform: translateY(0) scale(0.97); }
|
|
256
256
|
.ts-cell:disabled { cursor: default; }
|
|
257
|
+
|
|
258
|
+
/* ---------- 热力图涂装:颜色只在这里,按主题分两层 ----------
|
|
259
|
+
宿主的主题开关是 body[data-ds-dark-theme]:浅色走 body 默认值,深色才挂这个属性。
|
|
260
|
+
所以「深色 = 不带属性的那一层」写不了,只能反过来:先在 .ts-cell-paint 上写
|
|
261
|
+
**深色**(原值逐字节照搬),再用 body:not([data-ds-dark-theme]) 覆盖成浅色。
|
|
262
|
+
这样深色模式与改动前完全一致,浅色不再出现黑方块。 */
|
|
263
|
+
.ts-cell-paint { background: var(--ts-heat-fill); border-color: var(--ts-heat-edge); box-shadow: var(--ts-heat-shadow); }
|
|
264
|
+
|
|
265
|
+
/* 深色(默认 = 无属性时也要对),故两层都显式给出: */
|
|
266
|
+
.ts-cell-paint,
|
|
267
|
+
body[data-ds-dark-theme] .ts-cell-paint {
|
|
268
|
+
--ts-heat-fill: #252a31;
|
|
269
|
+
--ts-heat-edge: rgba(185, 205, 224, 0.09);
|
|
270
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), inset 0 -1px 0 rgba(0, 0, 0, 0.28);
|
|
271
|
+
}
|
|
272
|
+
.ts-cell-paint-l1, body[data-ds-dark-theme] .ts-cell-paint-l1 {
|
|
273
|
+
--ts-heat-fill: #323943; --ts-heat-edge: rgba(194, 214, 232, 0.08);
|
|
274
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(194, 214, 232, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.24);
|
|
275
|
+
}
|
|
276
|
+
.ts-cell-paint-l2, body[data-ds-dark-theme] .ts-cell-paint-l2 {
|
|
277
|
+
--ts-heat-fill: #3c566f; --ts-heat-edge: rgba(164, 210, 239, 0.16);
|
|
278
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(164, 210, 239, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 28, 56, 0.30);
|
|
279
|
+
}
|
|
280
|
+
.ts-cell-paint-l3, body[data-ds-dark-theme] .ts-cell-paint-l3 {
|
|
281
|
+
--ts-heat-fill: #3d7197; --ts-heat-edge: rgba(162, 222, 246, 0.23);
|
|
282
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(162, 222, 246, 0.23), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 30, 68, 0.36);
|
|
283
|
+
}
|
|
284
|
+
.ts-cell-paint-l4, body[data-ds-dark-theme] .ts-cell-paint-l4 {
|
|
285
|
+
--ts-heat-fill: #3c82b8; --ts-heat-edge: rgba(177, 228, 246, 0.28);
|
|
286
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(177, 228, 246, 0.28), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 32, 84, 0.42);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* 浅色:同一套蓝,方向反过来——空格子贴近卡片白底,有量的从浅蓝加深到实蓝。
|
|
290
|
+
档位取值按反差挑过:相邻两档至少差 1.22:1,最深一档对白底 5.8:1,
|
|
291
|
+
既能一眼分出四档,又不会深到在浅底上像个洞。
|
|
292
|
+
边缘用半透明深蓝,内阴影只在顶部留一道极淡高光。 */
|
|
293
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint {
|
|
294
|
+
--ts-heat-fill: #eef1f6;
|
|
295
|
+
--ts-heat-edge: rgba(15, 23, 42, 0.07);
|
|
296
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(15, 23, 42, 0.05);
|
|
297
|
+
}
|
|
298
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint-l1 {
|
|
299
|
+
--ts-heat-fill: #c7ddfb; --ts-heat-edge: rgba(29, 95, 209, 0.18);
|
|
300
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 2px rgba(29, 95, 209, 0.10);
|
|
301
|
+
}
|
|
302
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint-l2 {
|
|
303
|
+
--ts-heat-fill: #8ebef8; --ts-heat-edge: rgba(29, 95, 209, 0.24);
|
|
304
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 2px rgba(29, 95, 209, 0.14);
|
|
305
|
+
}
|
|
306
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint-l3 {
|
|
307
|
+
--ts-heat-fill: #4a8ee8; --ts-heat-edge: rgba(23, 78, 173, 0.32);
|
|
308
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 1px 3px rgba(29, 95, 209, 0.20);
|
|
309
|
+
}
|
|
310
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint-l4 {
|
|
311
|
+
--ts-heat-fill: #1d5fd1; --ts-heat-edge: rgba(16, 56, 128, 0.40);
|
|
312
|
+
--ts-heat-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 4px rgba(23, 78, 173, 0.28);
|
|
313
|
+
}
|
|
257
314
|
/* 选中不套外框:outline 画在色块外面,自带一套矩形圆角,和色块自己的 7px 圆角
|
|
258
315
|
对不齐,于是读起来像"斜贴了一个相框",还把这一格的量级切断了。
|
|
259
316
|
改成贴着色块自己的圆角画一圈内描边:形状不变,只是这一格的边界更清楚。
|
|
260
|
-
|
|
317
|
+
|
|
318
|
+
描边颜色不能是一个固定值:它压在 5 档底色上,档位从近白跨到实蓝、从深灰跨到亮蓝。
|
|
319
|
+
一个颜色必然在某一档上翻车——纯黑在浅色 l4 只剩 3.3:1,纯白在浅色 l0 只有 1.1:1;
|
|
320
|
+
深色主题里纯白压在 l0 上是 14:1,就是那道扎眼的硬白边。
|
|
321
|
+
所以按档位各自解一个目标反差:深色统一 5.2:1、浅色浅档 4.5:1,
|
|
322
|
+
越浅的底给越深的环、越深的底给越亮的环,整排看过去力度才是一致的。 */
|
|
261
323
|
.ts-cell-selected { outline: none; }
|
|
262
324
|
.ts-cell-selected::after {
|
|
263
325
|
content: '';
|
|
264
326
|
position: absolute;
|
|
265
327
|
inset: 0;
|
|
266
328
|
border-radius: inherit;
|
|
267
|
-
box-shadow: inset 0 0 0 1.5px
|
|
268
|
-
opacity: 0.88;
|
|
329
|
+
box-shadow: inset 0 0 0 1.5px var(--ts-ring);
|
|
269
330
|
pointer-events: none;
|
|
270
331
|
}
|
|
332
|
+
/* 深色:每档都对自己底色约 5.2:1。深档收在近白而不是纯白,避免硬边。 */
|
|
333
|
+
.ts-cell-selected,
|
|
334
|
+
body[data-ds-dark-theme] .ts-cell-selected { --ts-ring: #999b9f; }
|
|
335
|
+
.ts-cell-paint-l1.ts-cell-selected,
|
|
336
|
+
body[data-ds-dark-theme] .ts-cell-paint-l1.ts-cell-selected { --ts-ring: #abadb2; }
|
|
337
|
+
.ts-cell-paint-l2.ts-cell-selected,
|
|
338
|
+
body[data-ds-dark-theme] .ts-cell-paint-l2.ts-cell-selected { --ts-ring: #d0d6dc; }
|
|
339
|
+
.ts-cell-paint-l3.ts-cell-selected,
|
|
340
|
+
body[data-ds-dark-theme] .ts-cell-paint-l3.ts-cell-selected { --ts-ring: #fefefe; }
|
|
341
|
+
.ts-cell-paint-l4.ts-cell-selected,
|
|
342
|
+
body[data-ds-dark-theme] .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #ffffff; }
|
|
343
|
+
|
|
344
|
+
/* 浅色:浅档给深蓝(约 4.5:1),深档给白(3.3–5.8:1)。 */
|
|
345
|
+
body:not([data-ds-dark-theme]) .ts-cell-selected { --ts-ring: #546ea2; }
|
|
346
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint-l1.ts-cell-selected { --ts-ring: #40609e; }
|
|
347
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint-l2.ts-cell-selected { --ts-ring: #224990; }
|
|
348
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint-l3.ts-cell-selected { --ts-ring: #ffffff; }
|
|
349
|
+
body:not([data-ds-dark-theme]) .ts-cell-paint-l4.ts-cell-selected { --ts-ring: #ffffff; }
|
|
350
|
+
/* 键盘聚焦:加粗到 2px 并改用品牌色,与鼠标点击的选中区分开。 */
|
|
271
351
|
.ts-cell-selected:focus-visible::after {
|
|
272
352
|
box-shadow: inset 0 0 0 2px var(--dsw-alias-brand-primary);
|
|
273
|
-
opacity: 1;
|
|
274
353
|
}
|
|
275
354
|
/* Matte nylon-blue: depth comes from restrained edges and shadows, without a gloss layer over every tile. */
|
|
276
355
|
/* Hover readout: replaces the unthemeable native title tooltip. JS places it
|
|
@@ -470,9 +549,6 @@ window.__ModuleLoader__.load({
|
|
|
470
549
|
.ts-bal-table-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
|
|
471
550
|
.ts-bal-table-title { font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
|
|
472
551
|
.ts-bal-foot { padding: 8px 20px 12px; border-top: 1px solid var(--dsw-alias-border-l1); font-size: 10.5px; color: var(--dsw-alias-label-tertiary); line-height: 1.5; }
|
|
473
|
-
@media (max-width: 720px) {
|
|
474
|
-
.ts-pt-row { grid-template-columns: minmax(72px, 1.2fr) repeat(2, minmax(58px, 1fr)); font-size: 11px; }
|
|
475
|
-
}
|
|
476
552
|
`;
|
|
477
553
|
|
|
478
554
|
function apiUrl(routePath) {
|
|
@@ -962,32 +1038,25 @@ window.__ModuleLoader__.load({
|
|
|
962
1038
|
}
|
|
963
1039
|
|
|
964
1040
|
/**
|
|
965
|
-
*
|
|
966
|
-
*
|
|
967
|
-
*
|
|
1041
|
+
* 热力图的档位:0 = 无用量,1–4 = intensity() 的四档。
|
|
1042
|
+
*
|
|
1043
|
+
* 色值只写在 CSS 里,按主题分两层:
|
|
1044
|
+
* .ts-cell-paint … -l4 深色(宿主默认层)
|
|
1045
|
+
* body:not([data-ds-dark-theme]) … 浅色
|
|
1046
|
+
*
|
|
1047
|
+
* 为什么不再由 JS 给颜色:宿主切主题靠 `body[data-ds-dark-theme]`,
|
|
1048
|
+
* 而内联 style 压在上面,换到浅色时深色值原样留在白底上——看起来就是一片黑。
|
|
1049
|
+
* 这里只负责级别 → 类名的映射,一处色值只维护一份。
|
|
968
1050
|
*/
|
|
969
|
-
const
|
|
970
|
-
{ fill: '#323943', edge: 'rgba(194, 214, 232, 0.08)', shadow: 'rgba(0, 0, 0, 0.24)' },
|
|
971
|
-
{ fill: '#3c566f', edge: 'rgba(164, 210, 239, 0.16)', shadow: 'rgba(0, 28, 56, 0.30)' },
|
|
972
|
-
{ fill: '#3d7197', edge: 'rgba(162, 222, 246, 0.23)', shadow: 'rgba(0, 30, 68, 0.36)' },
|
|
973
|
-
{ fill: '#3c82b8', edge: 'rgba(177, 228, 246, 0.28)', shadow: 'rgba(0, 32, 84, 0.42)' },
|
|
974
|
-
{ fill: '#4b93c8', edge: 'rgba(201, 238, 250, 0.34)', shadow: 'rgba(0, 38, 94, 0.46)' },
|
|
975
|
-
];
|
|
1051
|
+
const HEAT_LEVELS = 4;
|
|
976
1052
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
function
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
}
|
|
985
|
-
const step = cellPaint(level);
|
|
986
|
-
return {
|
|
987
|
-
background: step.fill,
|
|
988
|
-
borderColor: step.edge,
|
|
989
|
-
boxShadow: `inset 0 1px 0 ${step.edge}, inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 3px ${step.shadow}`,
|
|
990
|
-
};
|
|
1053
|
+
/**
|
|
1054
|
+
* 级别 → 涂装类名。0 是空格子,1–5 是五档热度。
|
|
1055
|
+
* 越界一律夹到两端,避免画出不存在的档。
|
|
1056
|
+
*/
|
|
1057
|
+
function cellPaintClass(level) {
|
|
1058
|
+
const clamped = Math.max(0, Math.min(HEAT_LEVELS, level | 0));
|
|
1059
|
+
return `ts-cell-paint ts-cell-paint-l${clamped}`;
|
|
991
1060
|
}
|
|
992
1061
|
|
|
993
1062
|
function gradeTone(grade) {
|
|
@@ -2180,14 +2249,15 @@ window.__ModuleLoader__.load({
|
|
|
2180
2249
|
const counters = cellState.day === undefined ? undefined : countersOf(cellState.day);
|
|
2181
2250
|
const total = counters?.total ?? 0;
|
|
2182
2251
|
const level = cellState.future ? 0 : intensity(total, peak);
|
|
2183
|
-
|
|
2252
|
+
// 颜色走类名而不是内联 style:内联会压过主题,浅色下就成了一片黑方块。
|
|
2253
|
+
const className = `ts-cell ${cellPaintClass(level)}${cellState.key === selected ? ' ts-cell-selected' : ''}`;
|
|
2184
2254
|
// The browser's native `title` tooltip cannot be themed, so the cell
|
|
2185
2255
|
// carries no title: hovering reports into the card's own tooltip.
|
|
2186
2256
|
return h('button', {
|
|
2187
2257
|
key: cellState.key,
|
|
2188
2258
|
type: 'button',
|
|
2189
2259
|
className,
|
|
2190
|
-
style: cellState.future ? { opacity: 0.35 } :
|
|
2260
|
+
style: cellState.future ? { opacity: 0.35 } : undefined,
|
|
2191
2261
|
disabled: cellState.future,
|
|
2192
2262
|
'aria-label': `${cellState.key} · ${fmtTokens(total)} tokens`,
|
|
2193
2263
|
onMouseEnter: cellState.future ? undefined : (event) => showHover(cellState, event.currentTarget),
|
|
@@ -2223,7 +2293,7 @@ window.__ModuleLoader__.load({
|
|
|
2223
2293
|
].map((entry) => h(
|
|
2224
2294
|
'div',
|
|
2225
2295
|
{ key: entry.label, className: 'ts-legend-item' },
|
|
2226
|
-
h('span', { className:
|
|
2296
|
+
h('span', { className: `ts-legend-swatch ${cellPaintClass(entry.level)}` }),
|
|
2227
2297
|
h('span', {}, entry.label),
|
|
2228
2298
|
)),
|
|
2229
2299
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-spend-ledger",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"displayName": "花费",
|
|
5
5
|
"description": "Token spend ledger settings page plus a sidebar footer row with the DeepSeek account balance and the official peak/off-peak state (24-hour strip and price table): daily all-in token usage heatmap, cache efficiency, usage composition, and per-day session detail. Duplicated model calls are merged by message id, and a durable day ledger keeps recorded usage after a session is deleted.",
|
|
6
6
|
"type": "module",
|