hprof-analyzer 0.1.0

Fast, low-memory Java HPROF heap-dump analyzer with Eclipse MAT-parity reports (System Overview, Leak Suspects, Top Consumers).
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e2e2e2;
  --card: #f7f7f8;
  --accent: #2563eb;
  --warn-bg: #fff4e5;
  --warn-border: #f0b429;
}

.stack-detail summary { cursor: pointer; list-style: none; }
.stack-detail summary::-webkit-details-marker { display: none; }
.stack-detail summary::before { content: ""; font-size: 0.7rem; opacity: 0.6; }
.stack-detail[open] summary::before { content: ""; }
.stack-frames { margin: 0.3rem 0 0 1.25rem; padding: 0; list-style: decimal; }
.stack-frames li { font-size: 0.82rem; color: var(--muted); padding: 0.05rem 0; }
.stack-frames li code { background: none; padding: 0; font-size: inherit; }
tfoot tr { border-top: 2px solid var(--border); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #16181c;
    --fg: #e7e7e7;
    --muted: #9aa0aa;
    --border: #2c2f36;
    --card: #1e2127;
    --accent: #60a5fa;
    --warn-bg: #2a2318;
    --warn-border: #b8860b;
  }
}
:root[data-theme="dark"] {
  --bg: #16181c;
  --fg: #e7e7e7;
  --muted: #9aa0aa;
  --border: #2c2f36;
  --card: #1e2127;
  --accent: #60a5fa;
  --warn-bg: #2a2318;
  --warn-border: #b8860b;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e2e2e2;
  --card: #f7f7f8;
  --accent: #2563eb;
  --warn-bg: #fff4e5;
  --warn-border: #f0b429;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); }
.app { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; border-bottom: 1px solid var(--border); padding-bottom: 0.35rem; }
h3 { font-size: 1.02rem; margin: 1.25rem 0 0.5rem; }
.subtitle { color: var(--muted); font-size: 0.85rem; margin: 0 0 1rem; }
.oom { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 8px; padding: 1rem 1.25rem; margin: 0 0 1.5rem; }
.oom h2 { border: none; margin: 0 0 0.5rem; }
.oom ul { margin: 0; padding-left: 1.1rem; }
.oom li { margin: 0.3rem 0; line-height: 1.45; }

/* At-a-glance KPI strip. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin: 0 0 1.5rem; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; }
.kpi-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-value code { font-size: 0.95rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: help; }
.kpi-label { color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--card); padding: 0.05rem 0.3rem; border-radius: 4px; }
code.loader { font-size: 0.78rem; color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: 0.86rem; margin: 0.5rem 0 1rem; }
th, td { text-align: left; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.75rem 0; }
.summary-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1.5rem; font-size: 0.9rem; }
.summary-grid dt { color: var(--muted); }
.summary-grid dd { margin: 0; }
.chart-wrap { margin: 0.5rem 0 1rem; }
details { margin: 0.5rem 0; }
summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; }
.suspect { border-left: 3px solid var(--accent); padding-left: 0.9rem; margin: 1rem 0; }
.pill { display: inline-block; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 0.05rem 0.55rem; font-size: 0.75rem; color: var(--muted); margin-left: 0.4rem; }
.pill.keyword { margin-left: 0; margin-right: 0.4rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.thread { margin: 0.35rem 0; border-bottom: 1px solid var(--border); }
.thread summary { color: var(--fg); font-size: 0.9rem; padding: 0.25rem 0; }
.thread-name { font-weight: 600; color: var(--accent); }
.thread-serial { color: var(--muted); }
.stack { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem 0.8rem; margin: 0.35rem 0 0.75rem; overflow-x: auto; white-space: pre; line-height: 1.5; }

/* Sticky in-page table of contents. */
.toc { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.35rem; background: var(--bg); border-bottom: 1px solid var(--border); padding: 0.5rem 0; margin: 0.5rem 0 1rem; }
.toc a { text-decoration: none; color: var(--muted); font-size: 0.82rem; padding: 0.2rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; }
.toc a:hover { color: var(--accent); border-color: var(--accent); }
.toc a.active { color: var(--accent); border-color: var(--accent); }
.toc-group { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); opacity: 0.6; padding: 0 0.15rem; margin-left: 0.5rem; white-space: nowrap; }
.toc-group:first-child { margin-left: 0; }
.skip-link { position: absolute; left: -9999px; top: 1rem; z-index: 100; background: var(--accent); color: #fff; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.9rem; text-decoration: none; }
.skip-link:focus { left: 1rem; }

/* Fixed back-to-top button, visible after scrolling down. */
.back-to-top { position: fixed; right: 1rem; bottom: 1rem; z-index: 10; background: var(--card); color: var(--accent); border: 1px solid var(--border); border-radius: 999px; padding: 0.5rem 0.7rem; cursor: pointer; font-size: 1rem; line-height: 1; }

/* Theme toggle pill — sits above the sticky nav. */
.theme-toggle { background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.8rem; cursor: pointer; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle-wrap { display: flex; justify-content: flex-end; margin-bottom: 0.35rem; }

/* Section scroll anchoring so the sticky nav does not hide headings. */
section, .oom { scroll-margin-top: 3rem; }

/* Filter/tool rows above tables and thread lists. */
.tools { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.5rem 0; }
.filter { flex: 1; min-width: 200px; max-width: 420px; padding: 0.35rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font-size: 0.85rem; }
.filter:focus { outline: none; border-color: var(--accent); }
.hint { color: var(--muted); font-size: 0.78rem; }

/* Sortable histogram headers. */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
th.sortable.active { color: var(--accent); }

/* Leak-suspect accumulation path (shortest path to accumulation point). */
.suspect .rank { color: var(--accent); font-weight: 700; }
.accum-path { list-style: none; padding: 0; margin: 0.4rem 0 0.5rem; }
.accum-path li { position: relative; padding: 0.3rem 0 0.3rem 1.3rem; font-size: 0.85rem; }
.accum-path li::before { content: ""; position: absolute; left: 0.45rem; top: 0; bottom: 0; border-left: 2px solid var(--border); }
.accum-path li::after { content: ""; position: absolute; left: 0.2rem; top: 0.6rem; width: 0.55rem; height: 0.55rem; background: var(--accent); border-radius: 50%; }
.accum-path li:first-child::before { top: 0.6rem; }
.accum-path li:last-child::before { bottom: calc(100% - 0.6rem); }
.path-ret { color: var(--muted); font-size: 0.78rem; margin-left: 0.5rem; }

/* Exact retained byte + precise percent, MAT-report style ("509,972,304 (41.08%)"). */
.mat-exact { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.label { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

/* Expandable package tree. */
.tree-table td { vertical-align: middle; }
.tree-toggle { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.8rem; padding: 0 0.35rem 0 0; width: 1.2rem; }
.tree-leaf { color: var(--muted); display: inline-block; width: 1.2rem; text-align: left; padding-right: 0.35rem; }
.bar-cell { position: relative; }
.bar-bg { display: inline-block; width: 60px; height: 8px; background: var(--border); border-radius: 3px; vertical-align: middle; margin-right: 0.5rem; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* Dominator subtree: nested collapsible tree. */
.dom-subtree { list-style: none; padding: 0; margin: 0.3rem 0 0.3rem 0.6rem; border-left: 1px solid var(--border); }
.dom-subtree li { padding: 0.15rem 0; font-size: 0.85rem; }
.dom-subtree summary { cursor: pointer; font-size: 0.85rem; }

/* System properties: bounded key/value table in a scrollable container. */
.sysprops { max-height: 22rem; overflow: auto; border: 1px solid var(--border); border-radius: 6px; margin: 0.35rem 0 0.75rem; }
.sysprops table { margin: 0; }
.sysprops th { position: sticky; top: 0; background: var(--card); }
.sysprop-val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; word-break: break-word; }

.copy-cell { display: inline-flex; align-items: center; gap: 0.3rem; max-width: 100%; }
.copy-cell code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn { visibility: hidden; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.78rem; padding: 0 0.15rem; line-height: 1; border-radius: 3px; }
.copy-btn:hover, .copy-btn:focus { color: var(--accent); visibility: visible; outline: none; }
td:hover .copy-btn { visibility: visible; }

/* Print: hide interactive chrome, expand collapsibles, avoid mid-card breaks. */
@media print {
  .toc, .back-to-top, .theme-toggle-wrap { display: none !important; }
  details { display: block !important; }
  details > * { display: block !important; }
  summary { list-style: none; }
  .card, .suspect, .kpi, .chart-wrap { break-inside: avoid; page-break-inside: avoid; }
  body { background: #fff; color: #000; }
}

/* Mobile: single-column grids, tighter padding, scrollable wide tables. */
@media (max-width: 640px) {
  .app { padding: 1rem 0.75rem 3rem; }
  .summary-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.1rem; }
  table { font-size: 0.8rem; }
}