Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- ⚡ **Table scrolling**: a fast scroll in the Call Tree, Analysis and Database tables draws each frame 15% faster.

### Fixed

- 🧮 **Table percentages**: a share shows its real decimals, such as 12.50%. It showed 13.00%.
- 🌗 **High contrast**: the bars behind table values show when Windows high contrast is on.

## [1.24.1] - 2026-11-19

### Fixed
Expand Down
31 changes: 14 additions & 17 deletions log-viewer/src/components/grid/AppGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,24 @@ const theme = css`

/** What the app's cells draw: bars, queries and their group headers. */
const cells = css`
.progress-wrapper {
position: relative;
/* The bar, sized by the inline background-size that bar() in cells.ts sets. */
.bar {
font-variant-numeric: tabular-nums;
white-space: nowrap;
background: linear-gradient(var(--lana-grid-bar-fill), var(--lana-grid-bar-fill)) right / 0 100%
no-repeat;
}
.progress-bar {
position: absolute;
height: 100%;
opacity: 0.3;
right: 0;
/* charts.orange keeps the bar distinct from the blue selected row; the literal is
the pre-token colour, for hosts that inject no \`--vscode-*\`. */
background: var(--vscode-charts-orange, #a97d0f);
}
.progress-bar__text {
position: relative;
white-space: pre;
display: inline-flex;
}
.progress-bar__text__percent {
.bar__percent {
display: inline-block;
width: 9ch;
}
/* Forced colours drop every background image, so the bar would not show. */
@media (forced-colors: active) {
.bar {
forced-color-adjust: none;
color: CanvasText;
}
}
/* A Used figure that differs from the Seen one: a data-quality caveat. */
.reported-differs {
background: var(--lana-callout-warning-bg);
Expand Down
60 changes: 60 additions & 0 deletions log-viewer/src/components/grid/__tests__/cells.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2026 Certinia Inc. All rights reserved.
*
* @jest-environment jsdom
*/
import { render } from 'lit';

import { bar, type BarOptions } from '../cells.js';

function draw(value: number, total: number, options?: BarOptions) {
const host = document.createElement('div');
render(bar(value, total, options), host);
return {
text: host.firstElementChild?.textContent,
bar: host.firstElementChild?.getAttribute('style'),
elements: host.querySelectorAll('*').length,
};
}

describe('bar', () => {
it('shows the value and its share in one cell of three elements', () => {
expect(draw(25, 200)).toEqual({
text: '25.00(12.50%)',
bar: 'background-size: 12.5% 100%',
elements: 3,
});
});

it('draws a hairline for a share that rounds to nothing', () => {
expect(draw(1, 100_000)).toEqual({
text: '1.00(0.00%)',
bar: 'background-size: 1% 100%',
elements: 3,
});
});

it('draws no bar for a zero value, a zero total or a negative value', () => {
expect([draw(0, 100), draw(5, 0), draw(-5, 100)]).toEqual([
{ text: '0.00(0.00%)', bar: 'background-size: 0% 100%', elements: 3 },
{ text: '5.00(0.00%)', bar: 'background-size: 0% 100%', elements: 3 },
{ text: '-5.00(-5.00%)', bar: 'background-size: 0% 100%', elements: 3 },
]);
});

it('draws past the full width for a value above its total, and shows the real share', () => {
expect(draw(150, 100)).toEqual({
text: '150.00(150.00%)',
bar: 'background-size: 150% 100%',
elements: 3,
});
});

it('shows a whole count with no share when asked, in two elements', () => {
expect(draw(300, 1200, { precision: 0, percent: false })).toEqual({
text: '300',
bar: 'background-size: 25% 100%',
elements: 2,
});
});
});
25 changes: 6 additions & 19 deletions log-viewer/src/components/grid/cells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,13 @@ export interface BarOptions {
export function bar(value: number, total: number, options: BarOptions = {}): TemplateResult {
const { precision = 2, percent = true } = options;
const share = sharePercent(value, total);
const barPercent = share > 0 ? Math.max(share, MIN_VISIBLE_PERCENT) : 0;
// `data-grid-find-text` is the grid's FIND_TEXT_ATTR: find marks the value, not the percent.
return html`<div class="progress-wrapper">
${
value > 0 && total > 0
? html`<div
class="progress-bar"
style="width: ${Math.max(share, MIN_VISIBLE_PERCENT)}%"
></div>`
: nothing
}
<div class="progress-bar__text">
<span data-grid-find-text>${(value || 0).toFixed(precision)}</span>${
percent
? html`<span class="progress-bar__text__percent"
>(${Math.round(share).toFixed(2)}%)</span
>`
: nothing
}
</div>
</div>`;
return html`<div class="bar" style="background-size: ${barPercent}% 100%"
><span data-grid-find-text>${(value || 0).toFixed(precision)}</span>${
percent ? html`<span class="bar__percent">(${share.toFixed(2)}%)</span>` : nothing
}</div
>`;
}

/** Nanoseconds as milliseconds, with a bar for their share of `totalNs`. */
Expand Down
4 changes: 2 additions & 2 deletions log-viewer/src/components/grid/measureWidth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { formatNsAsMs } from '#core/utility/Duration.js';

// Deterministic estimate rather than canvas measurement: the webview cell font
// isn't reliably readable at build time, and under-measuring makes the column
// too narrow so its `bar + value + percent` content wraps instead of the table
// too narrow so its `value + percent` content wraps instead of the table
// scrolling. A per-character estimate with padding is robust and close enough.
const CH_PX = 7.5; // ~tabular-nums UI font
const PADDING = 24; // cell padding + progress-bar allowance
const PADDING = 24; // cell padding, with slack
const MIN_WIDTH = 110;

/**
Expand Down
12 changes: 12 additions & 0 deletions log-viewer/src/styles/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@
rows with no data hue of their own; length is always the magnitude. */
--lana-meter-fill: color-mix(in srgb, var(--vscode-foreground, #cccccc) 55%, transparent);

/* Grid bars — a value's share of its column, behind the number. Orange, so it stays
distinct from the blue selected row. */
--lana-grid-bar-fill: color-mix(in srgb, var(--vscode-charts-orange, #a97d0f) 30%, transparent);

/* Warning callout — a tinted fill behind an actionable data-quality caveat. */
--lana-callout-warning-bg: color-mix(in srgb, var(--lana-severity-warning) 12%, transparent);
--lana-callout-warning-bg-hover: color-mix(
Expand Down Expand Up @@ -250,6 +254,14 @@
);
}

/* Forced colours allow only system colours, so the grid bars take the highlight colour. */
@media (forced-colors: active) {
:host,
:root {
--lana-grid-bar-fill: color-mix(in srgb, Highlight 40%, transparent);
}
}

/* The user's VS Code look, set by `features/settings/uiMode.ts`. */
:root[data-ui-mode='classic'] {
/* VS Code's classic pane header; no `--vscode-*` size holds it. */
Expand Down