From a15f73c2c7338dc2885e7d0e8f00896fb510e71a Mon Sep 17 00:00:00 2001 From: Eric Windmill Date: Fri, 4 Dec 2026 12:08:40 -0800 Subject: [PATCH 1/3] FlutterBench row detail drawer --- sites/www/lib/main.client.options.dart | 1 + sites/www/lib/main.server.options.dart | 2 +- .../flutterbench/bench_detail_drawer.dart | 394 ++++++++++++++++++ .../components/flutterbench/bench_table.dart | 67 ++- .../flutterbench_interactive.dart | 42 +- .../www/lib/src/pages/flutterbench_page.dart | 8 +- .../styles/pages/_flutterbench-drawer.scss | 370 ++++++++++++++++ sites/www/lib/styles/styles.scss | 1 + 8 files changed, 860 insertions(+), 25 deletions(-) create mode 100644 sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart create mode 100644 sites/www/lib/styles/pages/_flutterbench-drawer.scss diff --git a/sites/www/lib/main.client.options.dart b/sites/www/lib/main.client.options.dart index f8e3075184..07e39f010b 100644 --- a/sites/www/lib/main.client.options.dart +++ b/sites/www/lib/main.client.options.dart @@ -111,6 +111,7 @@ ClientOptions get defaultClientOptions => ClientOptions( 'flutterbench_interactive': ClientLoader( (p) => _flutterbench_interactive.FlutterBenchInteractive( rawResultsJson: p.get>('rawResultsJson'), + rawDatasetJson: p.get>('rawDatasetJson'), ), loader: _flutterbench_interactive.loadLibrary, ), diff --git a/sites/www/lib/main.server.options.dart b/sites/www/lib/main.server.options.dart index 44270ef3c9..7ce180b19b 100644 --- a/sites/www/lib/main.server.options.dart +++ b/sites/www/lib/main.server.options.dart @@ -191,7 +191,7 @@ Map __tabsTabs(_tabs.Tabs c) => { }; Map __flutterbench_interactiveFlutterBenchInteractive( _flutterbench_interactive.FlutterBenchInteractive c, -) => {'rawResultsJson': c.rawResultsJson}; +) => {'rawResultsJson': c.rawResultsJson, 'rawDatasetJson': c.rawDatasetJson}; Map __headerHeader(_header.Header c) => { 'contrastLogoSrc': c.contrastLogoSrc, 'defaultLogoSrc': c.defaultLogoSrc, diff --git a/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart b/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart new file mode 100644 index 0000000000..4514fbae99 --- /dev/null +++ b/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart @@ -0,0 +1,394 @@ +// Copyright 2026, the Flutter authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +import 'package:jaspr/dom.dart'; +import 'package:jaspr/jaspr.dart'; +import 'package:universal_web/web.dart' as web; + +import '../../models/content/flutter_bench.dart'; +import '../../utils/bench_format.dart'; +import '../../utils/inline_code.dart'; +import '../common/icon.dart'; + +/// A slide-over drawer with the details of one agent and model pairing. +/// +/// Displays: +/// 1. Top-level metric summary cards. +/// 2. Outcome and Quality breakdown cards, +/// weighted by the snapshot's scoring. +/// 3. A per-task table, with rows that expand to show +/// what each task evaluates. +/// +/// The drawer is a native `` opened with `showModal()`, +/// so the browser traps focus, makes the page behind it inert, +/// closes it on Escape, and restores focus when it closes. +class BenchDetailDrawer extends StatefulComponent { + const BenchDetailDrawer({ + required this.entry, + required this.snapshot, + required this.onClose, + this.taskEvaluations = const {}, + super.key, + }); + + /// The pairing to show, or `null` when the drawer is closed. + final BenchComparisonEntry? entry; + + /// Snapshot metadata, used for the scoring weights. + final BenchSnapshot snapshot; + + /// Called after the drawer closes, however the user closed it. + final VoidCallback onClose; + + /// What each task evaluates, keyed by [BenchTask.id] or [BenchTask.name]. + /// + /// Tasks with an entry can be expanded in the per-task table + /// to reveal the description. + final Map taskEvaluations; + + @override + State createState() => _BenchDetailDrawerState(); +} + +class _BenchDetailDrawerState extends State { + static const _titleId = 'bench-drawer-title'; + + final _dialogKey = GlobalNodeKey(); + + /// The pairing being rendered. + /// + /// Unlike [BenchDetailDrawer.entry], this stays set after the drawer + /// closes, so the content doesn't disappear during the exit transition. + BenchComparisonEntry? _shownEntry; + + BenchScoring get _scoring => component.snapshot.scoring; + + @override + void initState() { + super.initState(); + _shownEntry = component.entry; + } + + @override + void didUpdateComponent(BenchDetailDrawer oldComponent) { + super.didUpdateComponent(oldComponent); + final entry = component.entry; + if (entry != null) _shownEntry = entry; + + if (entry != null && oldComponent.entry == null) { + // Open after this frame, once the content is in the DOM, + // so `autofocus` lands on the close button. + context.binding.addPostFrameCallback(() { + final dialog = _dialogKey.currentNode; + if (mounted && dialog != null && !dialog.open) dialog.showModal(); + }); + } else if (entry == null && oldComponent.entry != null) { + final dialog = _dialogKey.currentNode; + if (dialog != null && dialog.open) dialog.close(); + } + } + + /// Closes the drawer when the user clicks the backdrop. + /// + /// `closedby="any"` handles this natively where it's supported. + /// Clicks on the backdrop target the dialog itself, + /// at a point outside its box. + void _onDialogClick(web.Event event) { + final dialog = _dialogKey.currentNode; + if (dialog == null || event.target != dialog) return; + final click = event as web.MouseEvent; + final rect = dialog.getBoundingClientRect(); + final isOutside = + click.clientX < rect.left || + click.clientX > rect.right || + click.clientY < rect.top || + click.clientY > rect.bottom; + if (isOutside) dialog.close(); + } + + void _close() => _dialogKey.currentNode?.close(); + + @override + Component build(BuildContext context) { + final entry = _shownEntry; + + return Component.element( + key: _dialogKey, + tag: 'dialog', + classes: 'bench-drawer', + attributes: const {'aria-labelledby': _titleId, 'closedby': 'any'}, + events: { + 'click': _onDialogClick, + 'close': (_) => component.onClose(), + }, + children: [if (entry != null) ..._buildContent(entry)], + ); + } + + List _buildContent(BenchComparisonEntry entry) { + final metrics = entry.baselineMetrics; + + return [ + div(classes: 'drawer-header', [ + div(classes: 'drawer-title-group', [ + span(classes: 'drawer-agent-badge', [.text(entry.agent)]), + h2(id: _titleId, classes: 'drawer-model-title', [ + .text(entry.model), + ]), + ]), + button( + classes: 'drawer-close-btn', + type: .button, + autofocus: true, + attributes: const {'aria-label': 'Close details'}, + onClick: _close, + const [ + span(attributes: {'aria-hidden': 'true'}, [.text('✕')]), + ], + ), + ]), + div(classes: 'drawer-body', [ + const h3(classes: 'section-heading', [.text('Performance Overview')]), + _buildSummaryCards(metrics), + h3(classes: 'section-heading', [ + .text( + 'Result Score Breakdown ' + '(${_scoring.outcomePercent}% / ${_scoring.qualityPercent}%)', + ), + ]), + _buildBreakdownCards(metrics), + const h3(classes: 'section-heading', [ + .text('Benchmark Tasks Breakdown'), + ]), + _TaskBreakdownTable( + key: ValueKey(entry.displayKey), + tasks: entry.baselineRun?.tasks ?? const [], + taskEvaluations: component.taskEvaluations, + ), + ]), + ]; + } + + Component _buildSummaryCards(BenchRunMetrics? metrics) { + return div(classes: 'metric-cards-grid', [ + _buildSummaryCard( + label: 'Avg Score', + value: formatScoreWithSd(metrics?.avgScore, metrics?.scoreSd), + ), + _buildSummaryCard( + label: 'Pass@1', + value: formatPercent(metrics?.passAt1Rate), + ), + _buildSummaryCard( + label: 'Avg Tokens', + value: formatTokens(metrics?.avgTokens), + ), + _buildSummaryCard( + label: 'Avg Cost', + value: formatCost(metrics?.avgCost), + ), + ]); + } + + Component _buildBreakdownCards(BenchRunMetrics? metrics) { + return div(classes: 'breakdown-cards-grid', [ + _buildBreakdownCard( + 'Outcome (${_scoring.outcomePercent}%)', + 'pill-outcome', + formatPercent(metrics?.avgOutcome), + ), + _buildBreakdownCard( + 'Quality (${_scoring.qualityPercent}%)', + 'pill-quality', + formatPercent(metrics?.avgQuality), + ), + ]); + } + + Component _buildSummaryCard({required String label, required String value}) { + return div(classes: 'summary-metric-card', [ + span(classes: 'card-label', [.text(label)]), + span(classes: 'card-value', [.text(value)]), + ]); + } + + Component _buildBreakdownCard( + String label, + String pillClass, + String value, + ) { + return div(classes: 'breakdown-card', [ + span(classes: 'pill-label $pillClass', [.text(label)]), + span(classes: 'large-value', [.text(value)]), + ]); + } +} + +/// The per-task breakdown table in [BenchDetailDrawer]. +/// +/// Each task with a description in `taskEvaluations` acts as +/// an expansion panel: tapping anywhere on its row reveals +/// a full-width row beneath it describing what the task evaluates. +/// A full-width row is used rather than a tooltip so the description +/// stays readable on narrow screens, where the table scrolls horizontally. +class _TaskBreakdownTable extends StatefulComponent { + const _TaskBreakdownTable({ + required this.tasks, + required this.taskEvaluations, + super.key, + }); + + final List tasks; + final Map taskEvaluations; + + @override + State<_TaskBreakdownTable> createState() => _TaskBreakdownTableState(); +} + +class _TaskBreakdownTableState extends State<_TaskBreakdownTable> { + /// The IDs of the tasks whose descriptions are expanded. + final Set _expandedTaskIds = {}; + + static const _columnCount = 6; + + void _toggle(String taskId) => setState(() { + if (!_expandedTaskIds.remove(taskId)) _expandedTaskIds.add(taskId); + }); + + @override + Component build(BuildContext context) { + return div(classes: 'per-task-table-wrapper', [ + table(classes: 'per-task-table', [ + const thead([ + tr([ + th(attributes: {'scope': 'col'}, [.text('Task Name')]), + th( + classes: 'num', + attributes: {'scope': 'col'}, + [.text('Result Score')], + ), + th( + classes: 'num', + attributes: {'scope': 'col'}, + [.text('Outcome')], + ), + th( + classes: 'num', + attributes: {'scope': 'col'}, + [.text('Quality')], + ), + th( + classes: 'num', + attributes: { + 'scope': 'col', + 'title': 'Trials passed out of trials run', + }, + [.text('Trials Passed')], + ), + th( + classes: 'num', + attributes: {'scope': 'col'}, + [.text('Avg Tokens')], + ), + ]), + ]), + tbody([ + if (component.tasks.isEmpty) + const tr([ + td( + attributes: {'colspan': '$_columnCount'}, + [.text('No results yet for this agent and model.')], + ), + ]), + for (final (index, task) in component.tasks.indexed) + ..._buildTaskRows(task, index), + ]), + ]), + ]); + } + + List _buildTaskRows(BenchTask task, int index) { + final evaluation = + component.taskEvaluations[task.id] ?? + component.taskEvaluations[task.name]; + final expandable = evaluation != null; + final expanded = expandable && _expandedTaskIds.contains(task.id); + final detailId = 'task-detail-$index'; + final metrics = task.metrics; + + return [ + tr( + classes: [ + 'task-row', + if (expandable) 'expandable', + if (expanded) 'expanded', + ].join(' '), + // The whole row is the tap target. The button inside the + // first cell provides keyboard and screen reader access; + // its click bubbles up to this handler. + events: expandable ? events(onClick: () => _toggle(task.id)) : null, + [ + td([ + if (expandable) + button( + classes: 'task-toggle', + type: .button, + attributes: { + 'aria-expanded': '$expanded', + 'aria-controls': detailId, + }, + [ + const Icon( + symbol: 'expand_more', + size: .sm, + classes: ['task-toggle-icon'], + ), + strong([.text(task.name)]), + ], + ) + else + strong([.text(task.name)]), + ]), + td(classes: 'num', [ + strong([.text(formatPercent(metrics.resultScore))]), + ]), + td(classes: 'num', [.text(formatPercent(metrics.outcome))]), + td(classes: 'num', [.text(formatPercent(metrics.quality))]), + td(classes: 'num', [ + .text( + // Tasks can run fewer trials than planned, + // so use each task's own trial count. + task.trials.isEmpty + ? missingValue + : formatFraction( + metrics.passedTrialCount, + task.trials.length, + ), + ), + ]), + td(classes: 'num', [.text(formatTokens(metrics.meanTokens))]), + ], + ), + if (expandable) + tr( + id: detailId, + classes: 'task-detail-row', + attributes: {if (!expanded) 'hidden': ''}, + [ + td( + attributes: const {'colspan': '$_columnCount'}, + [ + div(classes: 'task-detail', [ + const span(classes: 'task-detail-label', [ + .text('What we evaluate'), + ]), + p(withInlineCode(evaluation)), + ]), + ], + ), + ], + ), + ]; + } +} diff --git a/sites/www/lib/src/components/flutterbench/bench_table.dart b/sites/www/lib/src/components/flutterbench/bench_table.dart index 603f509e20..471f55f85c 100644 --- a/sites/www/lib/src/components/flutterbench/bench_table.dart +++ b/sites/www/lib/src/components/flutterbench/bench_table.dart @@ -16,6 +16,7 @@ enum SortColumn { agentModel, avgScore, passRate, passAtK, tokens, cost } /// and right-aligned, formatted numbers. /// /// Shows the baseline metrics of each agent and model pairing. +/// Selecting a row calls [onRowSelected], which opens its details. class BenchTable extends StatelessComponent { const BenchTable({ required this.entries, @@ -23,6 +24,7 @@ class BenchTable extends StatelessComponent { required this.sortColumn, required this.sortAscending, required this.onSort, + required this.onRowSelected, super.key, }); @@ -41,6 +43,9 @@ class BenchTable extends StatelessComponent { /// Called when the user selects a column header to sort by. final ValueChanged onSort; + /// Called when the user selects a row to see its details. + final ValueChanged onRowSelected; + @override Component build(BuildContext context) { final scoring = snapshot.scoring; @@ -104,31 +109,53 @@ class BenchTable extends StatelessComponent { ]), tbody([ for (final entry in entries) - tr(classes: 'bench-row', [ - td(classes: 'agent-model-cell', [ - span(classes: 'agent-name', [.text(entry.agent)]), - span(classes: 'model-name', [ - .text(entry.model), - span( - classes: 'reasoning-effort', + tr( + classes: 'bench-row', + // The whole row is the click target. The button in the + // first cell provides keyboard and screen reader access; + // its click bubbles up to this handler. + events: events(onClick: () => onRowSelected(entry)), + [ + td(classes: 'agent-model-cell', [ + button( + classes: 'row-details-button', + type: .button, attributes: { - 'title': 'Reasoning effort: ${entry.reasoningEffort}', + 'aria-haspopup': 'dialog', + 'aria-label': 'Show details for ${entry.displayKey}', }, - [.text(entry.reasoningEffort)], + [ + span(classes: 'agent-name', [.text(entry.agent)]), + span(classes: 'model-name', [ + .text(entry.model), + span( + classes: 'reasoning-effort', + attributes: { + 'title': + 'Reasoning effort: ${entry.reasoningEffort}', + }, + [.text(entry.reasoningEffort)], + ), + ]), + ], ), ]), - ]), - _metricCell(formatPercent(entry.baselineMetrics?.passRate)), - _metricCell(formatPercent(entry.baselineMetrics?.passAtKRate)), - _metricCell( - formatScoreWithSd( - entry.baselineMetrics?.avgScore, - entry.baselineMetrics?.scoreSd, + _metricCell(formatPercent(entry.baselineMetrics?.passRate)), + _metricCell( + formatPercent(entry.baselineMetrics?.passAtKRate), + ), + _metricCell( + formatScoreWithSd( + entry.baselineMetrics?.avgScore, + entry.baselineMetrics?.scoreSd, + ), ), - ), - _metricCell(formatTokens(entry.baselineMetrics?.totalTokens)), - _metricCell(formatCost(entry.baselineMetrics?.totalCost)), - ]), + _metricCell( + formatTokens(entry.baselineMetrics?.totalTokens), + ), + _metricCell(formatCost(entry.baselineMetrics?.totalCost)), + ], + ), ]), ]), ]), diff --git a/sites/www/lib/src/components/flutterbench/flutterbench_interactive.dart b/sites/www/lib/src/components/flutterbench/flutterbench_interactive.dart index c1dfd4f509..f9e6096b38 100644 --- a/sites/www/lib/src/components/flutterbench/flutterbench_interactive.dart +++ b/sites/www/lib/src/components/flutterbench/flutterbench_interactive.dart @@ -7,24 +7,33 @@ import 'package:jaspr/jaspr.dart'; import '../../models/content/flutter_bench.dart'; import 'bench_controls.dart'; +import 'bench_detail_drawer.dart'; import 'bench_table.dart'; /// Client-hydrated interactive leaderboard. /// /// Receives the benchmark results file as raw JSON (serialized by -/// Jaspr across the server→client boundary) and handles filtering -/// and sorting. +/// Jaspr across the server→client boundary) and handles filtering, +/// sorting, and the detail drawer. /// /// This is kept separate from `FlutterBenchPage` (the server-side /// page wrapper) to avoid importing `data_utils.dart` and /// `jaspr_content`, which aren't available on the web platform. @client class FlutterBenchInteractive extends StatefulComponent { - const FlutterBenchInteractive({required this.rawResultsJson, super.key}); + const FlutterBenchInteractive({ + required this.rawResultsJson, + required this.rawDatasetJson, + super.key, + }); /// The contents of the results file, decoded with [BenchResults.fromJson]. final Map rawResultsJson; + /// The contents of `content/flutterbench/dataset_tasks.json`, + /// used to describe what each task evaluates in the detail drawer. + final Map rawDatasetJson; + @override State createState() => _FlutterBenchInteractiveState(); @@ -36,15 +45,35 @@ class _FlutterBenchInteractiveState extends State { SortColumn _sortColumn = SortColumn.avgScore; bool _sortAscending = false; + /// The pairing shown in the detail drawer, or `null` if it's closed. + BenchComparisonEntry? _selectedEntry; + late BenchSnapshot _snapshot; late List _allComparisons; + /// What each task evaluates, keyed by both the dataset task's CUJ ID + /// (which matches [BenchTask.id]) and its name. + late Map _taskEvaluations; + @override void initState() { super.initState(); final results = BenchResults.fromJson(component.rawResultsJson); _snapshot = results.snapshot; _allComparisons = BenchComparisonEntry.fromRuns(results.runs); + _taskEvaluations = _parseTaskEvaluations(component.rawDatasetJson); + } + + static Map _parseTaskEvaluations(Map json) { + final tasks = (json['tasks'] as List? ?? const []) + .whereType>(); + return { + for (final task in tasks) + if (task['evaluates'] case final String evaluates) ...{ + if (task['name'] case final String name) name: evaluates, + if (task['cuj'] case final String cuj when cuj != '-') cuj: evaluates, + }, + }; } @override @@ -96,8 +125,15 @@ class _FlutterBenchInteractiveState extends State { _sortAscending = false; } }), + onRowSelected: (entry) => setState(() => _selectedEntry = entry), ), ]), + BenchDetailDrawer( + entry: _selectedEntry, + snapshot: _snapshot, + taskEvaluations: _taskEvaluations, + onClose: () => setState(() => _selectedEntry = null), + ), ]); } diff --git a/sites/www/lib/src/pages/flutterbench_page.dart b/sites/www/lib/src/pages/flutterbench_page.dart index 0d04f8593a..f53fdcd684 100644 --- a/sites/www/lib/src/pages/flutterbench_page.dart +++ b/sites/www/lib/src/pages/flutterbench_page.dart @@ -68,7 +68,13 @@ class FlutterBenchPage extends StatelessComponent { ]), ]), ]), - FlutterBenchInteractive(rawResultsJson: rawJson), + FlutterBenchInteractive( + rawResultsJson: rawJson, + rawDatasetJson: context.decodeJsonObject( + 'flutterbench.dataset_tasks', + (json) => json, + ), + ), if (child case final child?) div(classes: 'container', [child]), ]); } diff --git a/sites/www/lib/styles/pages/_flutterbench-drawer.scss b/sites/www/lib/styles/pages/_flutterbench-drawer.scss new file mode 100644 index 0000000000..7d23ee996c --- /dev/null +++ b/sites/www/lib/styles/pages/_flutterbench-drawer.scss @@ -0,0 +1,370 @@ +// Copyright 2026, the Flutter authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +// The leaderboard row detail drawer, a native modal ``, +// and the row styles that open it. + +@use 'flutterbench-shared' as bench; + +.flutterbench-page { + // Leaderboard rows open the drawer. + table.bench-table tbody tr.bench-row { + cursor: pointer; + transition: background-color bench.$transition; + + &:hover { + background-color: var(--blue-1); + } + + .row-details-button { + display: block; + padding: 0; + border: none; + background: none; + font: inherit; + color: inherit; + text-align: left; + cursor: pointer; + + &:focus-visible { + outline: 2px solid var(--site-primary-color); + outline-offset: 4px; + border-radius: 2px; + } + } + } +} + +dialog.bench-drawer { + // Reset the user-agent dialog styles and pin the panel to the right edge. + inset: 0 0 0 auto; + width: 900px; + max-width: 95vw; + height: 100dvh; + max-height: none; + margin: 0; + padding: 0; + border: none; + background: var(--site-base-bgColor); + box-shadow: -6px 0 28px rgba(0, 0, 0, 0.18); + overflow-y: auto; + // Keep scrolling inside the drawer from scrolling the page behind it. + overscroll-behavior: contain; + font-family: var(--font-body); + color: bench.$text-color; + + // Closed (exit) state. The transitions keep the dialog visible + // and in the top layer until it has slid out. + opacity: 0; + transition-property: opacity, transform, display, overlay; + transition-duration: 300ms; + transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1); + transition-behavior: allow-discrete; + + @media (prefers-reduced-motion: no-preference) { + transform: translateX(100%); + } + + @media (prefers-reduced-motion: reduce) { + transition-duration: 100ms; + } + + &[open] { + display: flex; + flex-direction: column; + opacity: 1; + + @starting-style { + opacity: 0; + } + + @media (prefers-reduced-motion: no-preference) { + transform: translateX(0); + + @starting-style { + transform: translateX(100%); + } + } + } + + &::backdrop { + background-color: rgba(4, 30, 60, 0); + // Make the backdrop a scroll container, + // so `overscroll-behavior` keeps the page behind it from scrolling. + overflow: hidden; + overscroll-behavior: contain; + transition-property: background-color, display, overlay; + transition-duration: 250ms; + transition-timing-function: ease; + transition-behavior: allow-discrete; + } + + &[open]::backdrop { + background-color: rgba(4, 30, 60, 0.4); + + @starting-style { + background-color: rgba(4, 30, 60, 0); + } + } + + .drawer-header { + position: sticky; + top: 0; + z-index: 10; + display: flex; + justify-content: space-between; + align-items: flex-start; + padding: 24px 28px; + border-bottom: 1px solid var(--ui-border-color); + background: var(--grey-1); + + .drawer-title-group { + .drawer-agent-badge { + display: inline-block; + margin-bottom: 6px; + padding: 2px 8px; + border-radius: 4px; + font-size: 11px; + font-weight: var(--font-weight-bold); + text-transform: uppercase; + letter-spacing: bench.$label-letter-spacing; + color: var(--blue-6); + background: var(--blue-1); + } + + h2.drawer-model-title { + margin: 0 0 4px 0; + font-size: 22px; + font-weight: var(--font-weight-bolder); + color: bench.$heading-color; + } + } + + .drawer-close-btn { + display: flex; + align-items: center; + justify-content: center; + width: 36px; + height: 36px; + border: 1px solid var(--ui-border-color); + border-radius: 50%; + background: none; + font-size: 18px; + color: bench.$text-color; + cursor: pointer; + transition: all bench.$transition; + + &:hover { + background: var(--grey-3); + color: bench.$heading-color; + } + + &:focus-visible { + outline: 2px solid var(--site-primary-color); + outline-offset: 2px; + } + } + } + + .drawer-body { + flex: 1; + padding: 24px 28px; + + .section-heading { + margin: 0 0 16px 0; + font-family: var(--font-ui); + font-size: var(--font-size-heading-5); + font-weight: var(--font-weight-bold); + color: bench.$heading-color; + } + + .metric-cards-grid { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 12px; + margin-bottom: 24px; + + .summary-metric-card { + display: flex; + flex-direction: column; + justify-content: space-between; + padding: 14px 16px; + border: 1px solid var(--ui-border-color); + border-radius: var(--ui-border-radius-sm); + background: var(--grey-1); + + .card-label { + @include bench.label; + margin-bottom: 8px; + } + + .card-value { + font-size: 20px; + font-weight: var(--font-weight-bolder); + color: bench.$heading-color; + font-variant-numeric: tabular-nums; + white-space: nowrap; + } + } + } + + // Pill top-left, large number bottom-right. + .breakdown-cards-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); + gap: 12px; + margin-bottom: 28px; + + .breakdown-card { + @include bench.card-surface; + display: flex; + flex-direction: column; + justify-content: space-between; + min-height: 96px; + padding: 16px; + box-shadow: bench.$light-card-shadow; + + .pill-label { + @include bench.pill; + align-self: flex-start; + + @each $category in (outcome, quality) { + &.pill-#{$category} { + @include bench.category-tint($category); + } + } + } + + .large-value { + align-self: flex-end; + font-size: 26px; + font-weight: var(--font-weight-bolder); + color: bench.$heading-color; + font-variant-numeric: tabular-nums; + } + } + } + + .per-task-table-wrapper { + overflow-x: auto; + border: 1px solid var(--ui-border-color); + border-radius: var(--ui-border-radius-sm); + + table.per-task-table { + width: 100%; + border-collapse: collapse; + font-size: 13px; + + th { + padding: 12px 14px; + border-bottom: 1px solid var(--ui-border-color); + background: var(--grey-1); + font-family: var(--font-ui); + font-weight: var(--font-weight-bold); + color: bench.$heading-color; + + &.num { + text-align: right; + } + } + + td { + padding: 12px 14px; + border-bottom: 1px solid var(--ui-border-color); + vertical-align: middle; + + &.num { + text-align: right; + font-variant-numeric: tabular-nums; + } + } + + tbody tr:last-child td { + border-bottom: none; + } + + tr.task-row.expandable { + cursor: pointer; + + &:hover td { + background: var(--grey-1); + } + + // Collapse the border between a task and its open description. + &.expanded td { + border-bottom-color: transparent; + } + } + + tr.task-row.expanded td { + background: var(--grey-1); + } + + .task-toggle { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 0; + border: none; + background: none; + font: inherit; + color: inherit; + text-align: left; + cursor: pointer; + + &:focus-visible { + outline: 2px solid var(--site-primary-color); + outline-offset: 2px; + border-radius: 2px; + } + + .task-toggle-icon { + flex-shrink: 0; + transition: transform 0.2s ease; + } + + &[aria-expanded='true'] .task-toggle-icon { + transform: rotate(180deg); + } + + @media (prefers-reduced-motion: reduce) { + .task-toggle-icon { + transition: none; + } + } + } + + tr.task-detail-row { + td { + padding-top: 0; + background: var(--grey-1); + } + + .task-detail { + // Stay readable on narrow screens even when the + // table itself is wider than the viewport. + position: sticky; + left: 14px; + max-width: min(60ch, calc(100vw - 80px)); + padding: 10px 0 2px 26px; + line-height: 1.5; + + p { + margin: 4px 0 0; + } + } + + .task-detail-label { + font-family: var(--font-ui); + font-size: 11px; + font-weight: var(--font-weight-bold); + letter-spacing: 0.04em; + text-transform: uppercase; + color: bench.$heading-color; + } + } + } + } + } +} diff --git a/sites/www/lib/styles/styles.scss b/sites/www/lib/styles/styles.scss index 3afee34f65..a8655e4a34 100644 --- a/sites/www/lib/styles/styles.scss +++ b/sites/www/lib/styles/styles.scss @@ -41,6 +41,7 @@ @use 'pages/flip'; @use 'pages/flutter_create'; @use 'pages/flutterbench-controls'; +@use 'pages/flutterbench-drawer'; @use 'pages/flutterbench-shell'; @use 'pages/flutterbench-table'; @use 'pages/games'; From a115ede6dfb4f255f2ed3c150361607d62d0d58f Mon Sep 17 00:00:00 2001 From: Eric Windmill Date: Fri, 4 Dec 2026 13:28:42 -0800 Subject: [PATCH 2/3] Rename FlutterBench drawer score card and show reasoning effort --- .../lib/src/components/flutterbench/bench_detail_drawer.dart | 5 ++++- sites/www/lib/styles/pages/_flutterbench-drawer.scss | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart b/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart index 4514fbae99..cb8ac606f3 100644 --- a/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart +++ b/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart @@ -136,6 +136,9 @@ class _BenchDetailDrawerState extends State { h2(id: _titleId, classes: 'drawer-model-title', [ .text(entry.model), ]), + span(classes: 'drawer-reasoning-effort', [ + .text('Reasoning effort: ${entry.reasoningEffort}'), + ]), ]), button( classes: 'drawer-close-btn', @@ -173,7 +176,7 @@ class _BenchDetailDrawerState extends State { Component _buildSummaryCards(BenchRunMetrics? metrics) { return div(classes: 'metric-cards-grid', [ _buildSummaryCard( - label: 'Avg Score', + label: 'Average Result Score', value: formatScoreWithSd(metrics?.avgScore, metrics?.scoreSd), ), _buildSummaryCard( diff --git a/sites/www/lib/styles/pages/_flutterbench-drawer.scss b/sites/www/lib/styles/pages/_flutterbench-drawer.scss index 7d23ee996c..1a0fcee8b8 100644 --- a/sites/www/lib/styles/pages/_flutterbench-drawer.scss +++ b/sites/www/lib/styles/pages/_flutterbench-drawer.scss @@ -139,6 +139,11 @@ dialog.bench-drawer { font-weight: var(--font-weight-bolder); color: bench.$heading-color; } + + .drawer-reasoning-effort { + font-size: 13px; + color: bench.$text-color; + } } .drawer-close-btn { From 68ce282443e16a2a81a23de17fb13601ad4eaee9 Mon Sep 17 00:00:00 2001 From: Eric Windmill Date: Fri, 4 Dec 2026 16:46:59 -0800 Subject: [PATCH 3/3] Show full-run tokens and cost in the FlutterBench drawer --- .../lib/src/components/flutterbench/bench_detail_drawer.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart b/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart index cb8ac606f3..86179015b4 100644 --- a/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart +++ b/sites/www/lib/src/components/flutterbench/bench_detail_drawer.dart @@ -185,11 +185,11 @@ class _BenchDetailDrawerState extends State { ), _buildSummaryCard( label: 'Avg Tokens', - value: formatTokens(metrics?.avgTokens), + value: formatTokens(metrics?.totalTokens), ), _buildSummaryCard( label: 'Avg Cost', - value: formatCost(metrics?.avgCost), + value: formatCost(metrics?.totalCost), ), ]); }