claude-code-cost 0.6.3 → 0.8.0
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/package.json +1 -1
- package/public/app.js +34 -4
- package/public/style.css +20 -16
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -682,6 +682,15 @@ function getChartColors() {
|
|
|
682
682
|
};
|
|
683
683
|
}
|
|
684
684
|
|
|
685
|
+
// Translucent fill from a hex color so chart bars read as a quiet wash, not a solid block.
|
|
686
|
+
function hexToRgba(hex, alpha) {
|
|
687
|
+
const h = hex.replace('#', '');
|
|
688
|
+
const r = parseInt(h.slice(0, 2), 16);
|
|
689
|
+
const g = parseInt(h.slice(2, 4), 16);
|
|
690
|
+
const b = parseInt(h.slice(4, 6), 16);
|
|
691
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
692
|
+
}
|
|
693
|
+
|
|
685
694
|
function chartDefaults() {
|
|
686
695
|
const c = getChartColors();
|
|
687
696
|
return {
|
|
@@ -733,9 +742,9 @@ function renderDailyChart(daily, canvasId = 'dailyChart', chartKey = 'daily') {
|
|
|
733
742
|
{
|
|
734
743
|
label: 'Daily Cost',
|
|
735
744
|
data: daily.map((d) => d.cost),
|
|
736
|
-
backgroundColor: c.
|
|
745
|
+
backgroundColor: c.chartFill,
|
|
737
746
|
borderColor: c.accent,
|
|
738
|
-
borderWidth: 1,
|
|
747
|
+
borderWidth: 1.5,
|
|
739
748
|
borderRadius: 3,
|
|
740
749
|
},
|
|
741
750
|
],
|
|
@@ -779,8 +788,9 @@ function renderModelChart(models, canvasId = 'modelChart', chartKey = 'model') {
|
|
|
779
788
|
datasets: [
|
|
780
789
|
{
|
|
781
790
|
data: models.map((m) => m.cost),
|
|
782
|
-
backgroundColor: models.map((_, i) => palette[i % palette.length]),
|
|
783
|
-
|
|
791
|
+
backgroundColor: models.map((_, i) => hexToRgba(palette[i % palette.length], 0.5)),
|
|
792
|
+
borderColor: models.map((_, i) => palette[i % palette.length]),
|
|
793
|
+
borderWidth: 1.5,
|
|
784
794
|
borderRadius: 3,
|
|
785
795
|
},
|
|
786
796
|
],
|
|
@@ -1303,6 +1313,26 @@ window.hubNavigate = function hubNavigate(app, url) {
|
|
|
1303
1313
|
window.parent?.postMessage({ type: 'hub:navigate', app, url }, '*');
|
|
1304
1314
|
};
|
|
1305
1315
|
|
|
1316
|
+
(function initHubTheme() {
|
|
1317
|
+
const getTheme = () => (document.body.classList.contains('light') ? 'light' : 'dark');
|
|
1318
|
+
const hubOrigin = () => (window.__HUB__?.url ? new URL(window.__HUB__.url).origin : null);
|
|
1319
|
+
let lastTheme = getTheme();
|
|
1320
|
+
window.addEventListener('message', (e) => {
|
|
1321
|
+
if (e.source !== window.parent || e.origin !== hubOrigin()) return;
|
|
1322
|
+
if (e.data?.type !== 'hub:theme') return;
|
|
1323
|
+
if (getTheme() === e.data.theme) return;
|
|
1324
|
+
window.toggleTheme();
|
|
1325
|
+
lastTheme = getTheme();
|
|
1326
|
+
});
|
|
1327
|
+
new MutationObserver(() => {
|
|
1328
|
+
const t = getTheme();
|
|
1329
|
+
if (t === lastTheme) return;
|
|
1330
|
+
lastTheme = t;
|
|
1331
|
+
const origin = hubOrigin();
|
|
1332
|
+
if (origin) window.parent.postMessage({ type: 'hub:theme', theme: t }, origin);
|
|
1333
|
+
}).observe(document.body, { attributes: true, attributeFilter: ['class'] });
|
|
1334
|
+
})();
|
|
1335
|
+
|
|
1306
1336
|
// #endregion
|
|
1307
1337
|
|
|
1308
1338
|
// #region INIT
|
package/public/style.css
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
--accent-text: #f0a070;
|
|
15
15
|
--accent-dim: rgba(232, 111, 51, 0.22);
|
|
16
16
|
--accent-glow: rgba(232, 111, 51, 0.55);
|
|
17
|
-
--chart-fill: rgba(232, 111, 51, 0.
|
|
17
|
+
--chart-fill: rgba(232, 111, 51, 0.32);
|
|
18
18
|
--success: #3ecf8e;
|
|
19
19
|
--success-dim: rgba(62, 207, 142, 0.18);
|
|
20
20
|
--warning: #f0b429;
|
|
@@ -249,9 +249,9 @@ body {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
.stat-card {
|
|
252
|
-
background: var(--bg-
|
|
252
|
+
background: var(--bg-surface);
|
|
253
253
|
border: 1px solid var(--border);
|
|
254
|
-
border-radius:
|
|
254
|
+
border-radius: 6px;
|
|
255
255
|
padding: 16px;
|
|
256
256
|
transition: border-color 0.15s ease;
|
|
257
257
|
}
|
|
@@ -270,7 +270,7 @@ body {
|
|
|
270
270
|
|
|
271
271
|
.stat-card .card-value {
|
|
272
272
|
font-size: 22px;
|
|
273
|
-
font-weight:
|
|
273
|
+
font-weight: 500;
|
|
274
274
|
color: var(--text-primary);
|
|
275
275
|
font-family: var(--mono);
|
|
276
276
|
}
|
|
@@ -297,9 +297,9 @@ body {
|
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
.chart-box {
|
|
300
|
-
background: var(--bg-
|
|
300
|
+
background: var(--bg-surface);
|
|
301
301
|
border: 1px solid var(--border);
|
|
302
|
-
border-radius:
|
|
302
|
+
border-radius: 6px;
|
|
303
303
|
padding: 16px;
|
|
304
304
|
overflow: hidden;
|
|
305
305
|
min-width: 0;
|
|
@@ -622,12 +622,14 @@ body {
|
|
|
622
622
|
.modal-box {
|
|
623
623
|
background: var(--bg-surface);
|
|
624
624
|
border: 1px solid var(--border);
|
|
625
|
-
border-radius:
|
|
625
|
+
border-radius: 8px;
|
|
626
626
|
width: 90%;
|
|
627
627
|
max-width: 500px;
|
|
628
628
|
max-height: 90vh;
|
|
629
629
|
padding: 24px;
|
|
630
|
-
box-shadow:
|
|
630
|
+
box-shadow:
|
|
631
|
+
0 16px 44px rgba(0, 0, 0, 0.38),
|
|
632
|
+
0 4px 12px rgba(0, 0, 0, 0.2);
|
|
631
633
|
overflow-y: auto;
|
|
632
634
|
}
|
|
633
635
|
|
|
@@ -639,8 +641,10 @@ body {
|
|
|
639
641
|
}
|
|
640
642
|
|
|
641
643
|
.modal-title {
|
|
642
|
-
font-
|
|
643
|
-
font-
|
|
644
|
+
font-family: var(--serif);
|
|
645
|
+
font-size: 20px;
|
|
646
|
+
font-weight: 500;
|
|
647
|
+
letter-spacing: -0.01em;
|
|
644
648
|
color: var(--text-primary);
|
|
645
649
|
}
|
|
646
650
|
|
|
@@ -759,8 +763,8 @@ body {
|
|
|
759
763
|
}
|
|
760
764
|
|
|
761
765
|
.toast.toast-success {
|
|
762
|
-
border-color:
|
|
763
|
-
color:
|
|
766
|
+
border-color: var(--success);
|
|
767
|
+
color: var(--success);
|
|
764
768
|
}
|
|
765
769
|
|
|
766
770
|
@keyframes slideIn {
|
|
@@ -780,10 +784,10 @@ body {
|
|
|
780
784
|
|
|
781
785
|
body.light {
|
|
782
786
|
--bg-deep: #e8e6e3;
|
|
783
|
-
--bg-surface: #
|
|
784
|
-
--bg-elevated: #
|
|
787
|
+
--bg-surface: #efede9;
|
|
788
|
+
--bg-elevated: #fbfaf9;
|
|
785
789
|
--bg-hover: #d2d0cc;
|
|
786
|
-
--border: #
|
|
790
|
+
--border: #cfcbc4;
|
|
787
791
|
--text-primary: #0a0a0a;
|
|
788
792
|
--text-secondary: #444444;
|
|
789
793
|
--text-tertiary: #666666;
|
|
@@ -791,7 +795,7 @@ body.light {
|
|
|
791
795
|
--accent-text: #b85a20;
|
|
792
796
|
--accent-dim: rgba(232, 111, 51, 0.18);
|
|
793
797
|
--accent-glow: rgba(232, 111, 51, 0.5);
|
|
794
|
-
--chart-fill: rgba(232, 111, 51, 0.
|
|
798
|
+
--chart-fill: rgba(232, 111, 51, 0.28);
|
|
795
799
|
--success: #1a8a5a;
|
|
796
800
|
--success-dim: rgba(26, 138, 90, 0.15);
|
|
797
801
|
--warning: #b07d0a;
|