claude-code-cost 0.14.0 → 0.16.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/public/index.html CHANGED
@@ -30,10 +30,6 @@
30
30
  <span class="logo-text">Cost Dashboard</span>
31
31
  </div>
32
32
  <div class="spacer"></div>
33
- <div class="topbar-nav" id="viewNav">
34
- <button class="topbar-nav-btn active" data-view="overview" onclick="navigate('overview')">Overview</button>
35
- <button class="topbar-nav-btn" data-view="projects" onclick="navigate('projects')">Projects</button>
36
- </div>
37
33
  <span class="scope-chip" id="scopeChip" hidden title="Scoped to one project">
38
34
  <span id="scopeChipName"></span>
39
35
  <button class="scope-chip-clear" onclick="clearScope()" title="Clear project scope" aria-label="Clear project scope">
@@ -42,15 +38,42 @@
42
38
  </svg>
43
39
  </button>
44
40
  </span>
45
- <select class="topbar-select" id="rangeSelect" onchange="onRangeChange(this.value)">
46
- <option value="today">Today</option>
47
- <option value="1">1 day</option>
48
- <option value="3" selected>3 days</option>
49
- <option value="7">7 days</option>
50
- <option value="30">30 days</option>
51
- <option value="90">90 days</option>
52
- <option value="365">1 year</option>
53
- </select>
41
+ <span class="range-picker" id="rangePicker">
42
+ <button class="topbar-btn range-trigger" id="rangeTrigger" title="Date range" onclick="toggleRangePicker(event)">
43
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
44
+ <rect x="3" y="4.5" width="18" height="17" rx="2"/><line x1="3" y1="9.5" x2="21" y2="9.5"/>
45
+ <line x1="8" y1="2.5" x2="8" y2="6"/><line x1="16" y1="2.5" x2="16" y2="6"/>
46
+ </svg>
47
+ <span class="range-label" id="rangeTriggerLabel">3 DAYS</span>
48
+ <svg class="chev" width="10" height="6" viewBox="0 0 10 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
49
+ <path d="M1 1.5L5 5 9 1.5"/>
50
+ </svg>
51
+ </button>
52
+ <div class="range-pop" id="rangePop">
53
+ <div class="range-presets" id="rangePresets">
54
+ <div class="range-head-label">Shortcuts</div>
55
+ </div>
56
+ <div class="range-cal-side">
57
+ <div class="range-fields">
58
+ <div class="range-field">
59
+ <span class="range-head-label">From</span>
60
+ <button class="range-field-box" id="rangeFromBox" onclick="aimRangePicker('from')">&mdash;</button>
61
+ </div>
62
+ <span class="range-field-dash">&rarr;</span>
63
+ <div class="range-field">
64
+ <span class="range-head-label">To</span>
65
+ <button class="range-field-box" id="rangeToBox" onclick="aimRangePicker('to')">&mdash;</button>
66
+ </div>
67
+ </div>
68
+ <div class="range-months" id="rangeMonths"></div>
69
+ <div class="range-foot">
70
+ <span class="range-summary" id="rangeSummary"></span>
71
+ <button class="range-btn" id="rangeCancel" onclick="closeRangePicker()">Cancel</button>
72
+ <button class="range-btn primary" id="rangeApply" onclick="applyRangeDraft()">Apply</button>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </span>
54
77
  <button class="topbar-btn" id="refreshBtn" title="Refresh data" onclick="refreshData()">
55
78
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 11-2.12-9.36L23 10"/></svg>
56
79
  Refresh
@@ -87,7 +110,7 @@
87
110
  <h4 class="shortcut-section">Navigation</h4>
88
111
  <table class="shortcut-table">
89
112
  <tr><td><kbd>1</kbd></td><td>Overview</td></tr>
90
- <tr><td><kbd>2</kbd></td><td>Projects</td></tr>
113
+ <tr><td><kbd>2</kbd></td><td>Insights</td></tr>
91
114
  <tr><td><kbd>Backspace</kbd></td><td>Go back</td></tr>
92
115
  <tr><td><kbd>Esc</kbd></td><td>Close modal / go back</td></tr>
93
116
  </table>
package/public/style.css CHANGED
@@ -122,76 +122,8 @@ body {
122
122
  flex: 1;
123
123
  }
124
124
 
125
- .topbar-nav {
126
- display: flex;
127
- gap: 2px;
128
- background: var(--bg-elevated);
129
- border: 1px solid var(--border);
130
- border-radius: 6px;
131
- padding: 2px;
132
- }
133
-
134
- .topbar-nav-btn {
135
- padding: 4px 12px;
136
- border-radius: 4px;
137
- font-size: 11px;
138
- font-weight: 500;
139
- cursor: pointer;
140
- border: none;
141
- background: transparent;
142
- color: var(--text-tertiary);
143
- font-family: var(--mono);
144
- transition: all 0.15s ease;
145
- text-transform: uppercase;
146
- letter-spacing: 0.03em;
147
- }
148
-
149
- .topbar-nav-btn:hover {
150
- color: var(--text-secondary);
151
- }
152
-
153
- .topbar-nav-btn.active {
154
- background: var(--accent-dim);
155
- color: var(--accent-text);
156
- }
157
-
158
- /* Native chevron is OS-styled and clashes with the mono topbar, so appearance is reset
159
- and the chevron redrawn; its gray reads as tertiary text in both themes. */
160
- .topbar-select {
161
- appearance: none;
162
- background-color: var(--bg-elevated);
163
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' fill='none' stroke='%238a8d95' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5L5 5 9 1.5'/%3E%3C/svg%3E");
164
- background-repeat: no-repeat;
165
- background-position: right 9px center;
166
- background-size: 9px 6px;
167
- border: 1px solid var(--border);
168
- border-radius: 6px;
169
- color: var(--text-tertiary);
170
- font-family: var(--mono);
171
- font-size: 11px;
172
- font-weight: 500;
173
- letter-spacing: 0.03em;
174
- text-transform: uppercase;
175
- padding: 6px 26px 6px 10px;
176
- outline: none;
177
- cursor: pointer;
178
- transition: all 0.15s ease;
179
- }
180
- .topbar-select:hover {
181
- border-color: var(--accent);
182
- color: var(--text-secondary);
183
- }
184
- .topbar-select:focus-visible {
185
- border-color: var(--accent);
186
- }
187
- .topbar-select option {
188
- background: var(--bg-surface);
189
- color: var(--text-primary);
190
- }
191
-
192
125
  /* #region SCOPE_CHIP */
193
126
 
194
- /* Reuses --accent-dim/--accent-text from .topbar-nav-btn.active so LIGHT_THEME needs nothing. */
195
127
  .scope-chip {
196
128
  display: flex;
197
129
  align-items: center;
@@ -353,6 +285,328 @@ body {
353
285
  }
354
286
  }
355
287
 
288
+ /* Root-level view switcher, rendered by the overview and insights views rather than the topbar
289
+ itself — drill-down views show a breadcrumb in its place. Reuses --accent-dim/--accent-text,
290
+ so no LIGHT_THEME rule is needed. */
291
+ .view-tabs {
292
+ display: flex;
293
+ gap: 4px;
294
+ margin-bottom: 16px;
295
+ border-bottom: 1px solid var(--border);
296
+ }
297
+
298
+ .view-tab {
299
+ background: none;
300
+ border: none;
301
+ border-bottom: 2px solid transparent;
302
+ color: var(--text-tertiary);
303
+ font-family: var(--mono);
304
+ font-size: 12px;
305
+ text-transform: uppercase;
306
+ letter-spacing: 0.05em;
307
+ padding: 8px 14px;
308
+ cursor: pointer;
309
+ transition:
310
+ color 0.15s ease,
311
+ border-color 0.15s ease;
312
+ }
313
+
314
+ .view-tab:hover {
315
+ color: var(--text-primary);
316
+ }
317
+
318
+ .view-tab.on {
319
+ color: var(--accent-text);
320
+ border-bottom-color: var(--accent);
321
+ }
322
+
323
+ /* #endregion */
324
+
325
+ /* #region DATE_PICKER */
326
+
327
+ /* Replaces the native range <select>: a trigger button plus a popover with preset shortcuts and
328
+ two month grids. Reuses the topbar-btn shell and the same tokens as .theme-menu, so every color
329
+ theme and the light theme need nothing here. */
330
+ .range-picker {
331
+ position: relative;
332
+ display: inline-flex;
333
+ }
334
+ .range-trigger .range-label {
335
+ min-width: 84px;
336
+ text-align: left;
337
+ }
338
+ .range-trigger .chev {
339
+ transition: transform 0.15s ease;
340
+ }
341
+ .range-trigger.on {
342
+ border-color: var(--accent);
343
+ background: var(--accent-dim);
344
+ color: var(--accent-text);
345
+ }
346
+ .range-trigger.on svg {
347
+ color: var(--accent-text);
348
+ }
349
+ .range-trigger.on .chev {
350
+ transform: rotate(180deg);
351
+ }
352
+
353
+ .range-pop {
354
+ display: none;
355
+ position: absolute;
356
+ top: calc(100% + 6px);
357
+ right: 0;
358
+ z-index: 100;
359
+ max-width: calc(100vw - 24px);
360
+ background: var(--bg-elevated);
361
+ border: 1px solid var(--border);
362
+ border-radius: 8px;
363
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
364
+ overflow: hidden;
365
+ }
366
+ .range-pop.open {
367
+ display: flex;
368
+ }
369
+
370
+ .range-presets {
371
+ display: flex;
372
+ flex-direction: column;
373
+ gap: 2px;
374
+ padding: 8px;
375
+ border-right: 1px solid var(--border);
376
+ background: var(--bg-surface);
377
+ min-width: 116px;
378
+ }
379
+
380
+ /* Shared by the Shortcuts header and the From/To field captions. */
381
+ .range-head-label {
382
+ display: block;
383
+ font-size: 9px;
384
+ letter-spacing: 0.12em;
385
+ text-transform: uppercase;
386
+ color: var(--text-muted);
387
+ padding: 2px 6px 6px;
388
+ }
389
+
390
+ .range-preset {
391
+ border: 0;
392
+ background: none;
393
+ color: var(--text-secondary);
394
+ font-family: var(--mono);
395
+ font-size: 11px;
396
+ text-transform: uppercase;
397
+ letter-spacing: 0.03em;
398
+ text-align: left;
399
+ padding: 5px 8px;
400
+ border-radius: 5px;
401
+ cursor: pointer;
402
+ }
403
+ .range-preset:hover {
404
+ background: var(--bg-hover);
405
+ color: var(--text-primary);
406
+ }
407
+ .range-preset.on {
408
+ background: var(--accent-dim);
409
+ color: var(--accent-text);
410
+ }
411
+
412
+ .range-cal-side {
413
+ padding: 8px 10px 10px;
414
+ }
415
+
416
+ .range-fields {
417
+ display: flex;
418
+ align-items: flex-end;
419
+ gap: 8px;
420
+ padding: 0 2px 8px;
421
+ }
422
+ .range-field {
423
+ flex: 1;
424
+ }
425
+ .range-field .range-head-label {
426
+ padding: 0 0 3px;
427
+ }
428
+ .range-field-box {
429
+ border: 1px solid var(--border);
430
+ border-radius: 5px;
431
+ background: var(--bg-surface);
432
+ color: var(--text-secondary);
433
+ font-family: var(--mono);
434
+ font-size: 11px;
435
+ letter-spacing: 0.03em;
436
+ padding: 5px 8px;
437
+ width: 100%;
438
+ text-align: left;
439
+ cursor: pointer;
440
+ }
441
+ .range-field-box.active {
442
+ border-color: var(--accent);
443
+ color: var(--accent-text);
444
+ }
445
+ .range-field-box.empty {
446
+ color: var(--text-muted);
447
+ }
448
+ .range-field-dash {
449
+ color: var(--text-muted);
450
+ padding-bottom: 6px;
451
+ }
452
+
453
+ .range-months {
454
+ display: flex;
455
+ gap: 14px;
456
+ }
457
+ .range-cal {
458
+ width: 196px;
459
+ }
460
+ .range-cal-head {
461
+ display: flex;
462
+ align-items: center;
463
+ justify-content: space-between;
464
+ padding: 0 2px 6px;
465
+ }
466
+ .range-cal-title {
467
+ font-size: 11px;
468
+ text-transform: uppercase;
469
+ letter-spacing: 0.06em;
470
+ color: var(--text-secondary);
471
+ }
472
+ .range-nav {
473
+ border: 1px solid var(--border);
474
+ background: var(--bg-surface);
475
+ color: var(--text-tertiary);
476
+ border-radius: 4px;
477
+ width: 20px;
478
+ height: 20px;
479
+ display: flex;
480
+ align-items: center;
481
+ justify-content: center;
482
+ cursor: pointer;
483
+ }
484
+ .range-nav:hover:not(:disabled) {
485
+ border-color: var(--accent);
486
+ color: var(--accent-text);
487
+ }
488
+ .range-nav:disabled {
489
+ opacity: 0.3;
490
+ cursor: default;
491
+ }
492
+ .range-nav svg {
493
+ width: 9px;
494
+ height: 9px;
495
+ }
496
+ .range-nav-gap {
497
+ width: 20px;
498
+ }
499
+
500
+ .range-dow,
501
+ .range-grid {
502
+ display: grid;
503
+ grid-template-columns: repeat(7, 1fr);
504
+ }
505
+ .range-dow span {
506
+ font-size: 9px;
507
+ text-align: center;
508
+ color: var(--text-muted);
509
+ letter-spacing: 0.06em;
510
+ padding-bottom: 3px;
511
+ }
512
+ .range-day {
513
+ height: 24px;
514
+ border: 0;
515
+ background: none;
516
+ font-family: var(--mono);
517
+ font-size: 11px;
518
+ color: var(--text-secondary);
519
+ cursor: pointer;
520
+ position: relative;
521
+ }
522
+ .range-day.pad {
523
+ visibility: hidden;
524
+ }
525
+ .range-day.off {
526
+ color: var(--text-muted);
527
+ opacity: 0.4;
528
+ cursor: default;
529
+ }
530
+ .range-day.today::after {
531
+ content: '';
532
+ position: absolute;
533
+ left: 50%;
534
+ bottom: 3px;
535
+ width: 3px;
536
+ height: 3px;
537
+ margin-left: -1.5px;
538
+ border-radius: 50%;
539
+ background: var(--accent);
540
+ }
541
+ .range-day:hover:not(.off) {
542
+ color: var(--text-primary);
543
+ }
544
+ .range-day.in {
545
+ background: var(--accent-dim);
546
+ color: var(--accent-text);
547
+ }
548
+ .range-day.edge {
549
+ background: var(--accent);
550
+ color: #fff;
551
+ border-radius: 4px;
552
+ font-weight: 500;
553
+ }
554
+ .range-day.edge.today::after {
555
+ background: #fff;
556
+ }
557
+ .range-day.in.start {
558
+ border-radius: 4px 0 0 4px;
559
+ }
560
+ .range-day.in.end {
561
+ border-radius: 0 4px 4px 0;
562
+ }
563
+
564
+ .range-foot {
565
+ display: flex;
566
+ align-items: center;
567
+ gap: 8px;
568
+ padding-top: 9px;
569
+ margin-top: 8px;
570
+ border-top: 1px solid var(--border);
571
+ }
572
+ .range-summary {
573
+ flex: 1;
574
+ font-size: 10px;
575
+ color: var(--text-muted);
576
+ letter-spacing: 0.04em;
577
+ text-transform: uppercase;
578
+ }
579
+ .range-btn {
580
+ font-family: var(--mono);
581
+ font-size: 11px;
582
+ text-transform: uppercase;
583
+ letter-spacing: 0.03em;
584
+ padding: 5px 12px;
585
+ border-radius: 5px;
586
+ cursor: pointer;
587
+ border: 1px solid var(--border);
588
+ background: var(--bg-surface);
589
+ color: var(--text-tertiary);
590
+ }
591
+ .range-btn:hover {
592
+ border-color: var(--accent);
593
+ color: var(--text-secondary);
594
+ }
595
+ .range-btn.primary {
596
+ background: var(--accent);
597
+ border-color: var(--accent);
598
+ color: #fff;
599
+ }
600
+ .range-btn.primary:hover {
601
+ filter: brightness(1.08);
602
+ color: #fff;
603
+ }
604
+ .range-btn.primary:disabled {
605
+ opacity: 0.4;
606
+ cursor: default;
607
+ filter: none;
608
+ }
609
+
356
610
  /* #endregion */
357
611
 
358
612
  /* #region LAYOUT */
@@ -483,6 +737,12 @@ body {
483
737
  color: var(--text-secondary);
484
738
  }
485
739
 
740
+ .chart-title-note {
741
+ color: var(--text-muted);
742
+ font-weight: 400;
743
+ float: right;
744
+ }
745
+
486
746
  /* #endregion */
487
747
 
488
748
  /* #region TABLE */
@@ -946,6 +1206,119 @@ body {
946
1206
 
947
1207
  /* #endregion */
948
1208
 
1209
+ /* #region INSIGHTS */
1210
+
1211
+ .heatmap {
1212
+ display: flex;
1213
+ flex-direction: column;
1214
+ gap: 3px;
1215
+ }
1216
+
1217
+ .hm-row {
1218
+ display: grid;
1219
+ grid-template-columns: 48px repeat(24, 1fr);
1220
+ gap: 3px;
1221
+ align-items: center;
1222
+ }
1223
+
1224
+ .hm-row.hm-today .hm-day {
1225
+ color: var(--accent);
1226
+ font-weight: 700;
1227
+ }
1228
+
1229
+ .hm-row.hm-today .hm-cell {
1230
+ outline: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
1231
+ }
1232
+
1233
+ .hm-day,
1234
+ .hm-hour {
1235
+ font-size: 9px;
1236
+ color: var(--text-muted);
1237
+ font-family: var(--mono);
1238
+ }
1239
+
1240
+ .hm-hour {
1241
+ text-align: center;
1242
+ }
1243
+
1244
+ .hm-cell {
1245
+ position: relative;
1246
+ aspect-ratio: 1.6;
1247
+ min-height: 12px;
1248
+ border-radius: 2px;
1249
+ background: var(--bg-hover);
1250
+ overflow: hidden;
1251
+ }
1252
+
1253
+ .hm-cell i {
1254
+ position: absolute;
1255
+ inset: 0;
1256
+ background: var(--accent);
1257
+ border-radius: 2px;
1258
+ }
1259
+
1260
+ .hm-cell:hover {
1261
+ outline: 1px solid var(--accent);
1262
+ outline-offset: 1px;
1263
+ }
1264
+
1265
+ .hm-tip {
1266
+ position: fixed;
1267
+ z-index: 100;
1268
+ display: none;
1269
+ flex-direction: column;
1270
+ gap: 1px;
1271
+ padding: 5px 8px;
1272
+ background: var(--bg-elevated);
1273
+ border: 1px solid var(--border);
1274
+ border-radius: 4px;
1275
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
1276
+ font-family: var(--mono);
1277
+ pointer-events: none;
1278
+ }
1279
+
1280
+ .hm-tip.on {
1281
+ display: flex;
1282
+ }
1283
+
1284
+ .hm-tip b {
1285
+ font-size: 12px;
1286
+ color: var(--text-primary);
1287
+ }
1288
+
1289
+ .hm-tip span {
1290
+ font-size: 10px;
1291
+ color: var(--text-muted);
1292
+ }
1293
+
1294
+ .block-badge {
1295
+ display: inline-block;
1296
+ font-size: 10px;
1297
+ font-family: var(--mono);
1298
+ color: var(--text-tertiary);
1299
+ background: var(--bg-hover);
1300
+ border-radius: 3px;
1301
+ padding: 2px 6px;
1302
+ white-space: nowrap;
1303
+ }
1304
+
1305
+ .block-badge.active {
1306
+ color: var(--success);
1307
+ background: var(--success-dim);
1308
+ }
1309
+
1310
+ .card-value.pace-ok {
1311
+ color: var(--success);
1312
+ }
1313
+ .card-value.pace-warn {
1314
+ color: var(--warning);
1315
+ }
1316
+ .card-value.pace-hot {
1317
+ color: var(--error);
1318
+ }
1319
+
1320
+ /* #endregion */
1321
+
949
1322
  /* #region LIGHT_THEME */
950
1323
 
951
1324
  body.light {
@@ -989,20 +1362,23 @@ body.light {
989
1362
  }
990
1363
  }
991
1364
 
1365
+ /* The two-month popover is wider than a narrow viewport: renderRangePicker() watches the same
1366
+ breakpoint and draws a single month with both nav arrows. */
1367
+ @media (max-width: 760px) {
1368
+ .range-presets {
1369
+ min-width: 100px;
1370
+ }
1371
+ .range-cal {
1372
+ width: 182px;
1373
+ }
1374
+ }
1375
+
992
1376
  @media (max-width: 600px) {
993
1377
  .topbar {
994
1378
  flex-wrap: wrap;
995
1379
  gap: 8px;
996
1380
  padding: 8px 12px;
997
1381
  }
998
- .topbar-nav {
999
- order: 10;
1000
- width: 100%;
1001
- }
1002
- .topbar-nav-btn {
1003
- flex: 1;
1004
- text-align: center;
1005
- }
1006
1382
  .cards-row {
1007
1383
  grid-template-columns: 1fr;
1008
1384
  }