bc00d321d9
A rebuilt Terminal theme never equalled the last one (AppDesignTokens, AnsiAccents and the tab indicator compared by identity), so any host rebuild (a detached window's title, a font notification) rebuilt every Theme.of dependent and ran MaterialApp's 200 ms theme animation. Themes are now cached per (design, brightness, font) and compare by value; chat colour seeded schemes are cached too. test/perf/design_bench_test.dart and tool/perf/design_bench.mjs check every registered AppDesign against Default (tool/perf/README.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.1 KiB
Dart
31 lines
1.1 KiB
Dart
// Design switches for the design bench (tool/perf/design_bench.mjs).
|
|
//
|
|
// With `?perf=1` the full-app fixture exposes:
|
|
// `window.__perfDesigns()` the registered designs' ids as a JSON array, so
|
|
// the bench covers every `AppDesign` without a
|
|
// list of its own;
|
|
// `window.__perfDesign(id)` chooses that design live, as Settings → Design
|
|
// does (the same controller, no reload).
|
|
// Without the flag nothing is installed.
|
|
import 'dart:convert';
|
|
import 'dart:js_interop';
|
|
|
|
import 'package:pipelines_app/ui/theme/app_design.dart';
|
|
import 'package:pipelines_app/ui/theme/app_design_controller.dart';
|
|
|
|
@JS('__perfDesigns')
|
|
external set _perfDesigns(JSFunction probe);
|
|
|
|
@JS('__perfDesign')
|
|
external set _perfDesign(JSFunction select);
|
|
|
|
void installDesignProbe(Map<String, String> params) {
|
|
if (params['perf'] != '1') return;
|
|
_perfDesigns = (() => jsonEncode([
|
|
for (final design in AppDesign.values) design.id,
|
|
]).toJS).toJS;
|
|
_perfDesign = ((JSString id) {
|
|
AppDesignController.instance.select(AppDesign.fromId(id.toDart));
|
|
}).toJS;
|
|
}
|