chrome-devtools-frontend 1.0.1598808 → 1.0.1601661
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/.agents/README.md +13 -0
- package/{agents/prompts/creating-a-model.md → .agents/skills/creating-a-model/SKILL.md} +7 -1
- package/{agents/prompts/devtools-imports.md → .agents/skills/devtools-imports/SKILL.md} +10 -5
- package/{agents/prompts/merging-devtools-module.md → .agents/skills/merging-devtools-module/SKILL.md} +5 -0
- package/{agents/prompts/ui-widgets.md → .agents/skills/ui-widgets/SKILL.md} +5 -0
- package/{agents/prompts/verification.md → .agents/skills/verification/SKILL.md} +5 -0
- package/front_end/core/common/Settings.ts +24 -1
- package/front_end/core/dom_extension/DOMExtension.ts +1 -0
- package/front_end/core/host/AidaClient.ts +5 -2
- package/front_end/core/host/AidaGcaTranslation.ts +377 -0
- package/front_end/core/host/GcaTypes.ts +520 -0
- package/front_end/core/host/UserMetrics.ts +0 -3
- package/front_end/core/host/host.ts +4 -0
- package/front_end/core/root/ExperimentNames.ts +0 -3
- package/front_end/core/sdk/CPUThrottlingManager.ts +12 -9
- package/front_end/core/sdk/ResourceTreeModel.ts +1 -1
- package/front_end/core/sdk/SourceMap.ts +4 -2
- package/front_end/entrypoints/main/MainImpl.ts +1 -12
- package/front_end/generated/Deprecation.ts +16 -0
- package/front_end/generated/InspectorBackendCommands.ts +4 -6
- package/front_end/generated/protocol.ts +46 -77
- package/front_end/models/ai_assistance/AiConversation.ts +49 -22
- package/front_end/models/ai_assistance/AiHistoryStorage.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -0
- package/front_end/models/ai_assistance/ConversationHandler.ts +16 -11
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +76 -36
- package/front_end/models/ai_assistance/agents/AiAgent.ts +26 -2
- package/front_end/models/ai_assistance/agents/BreakpointDebuggerAgent.ts +0 -1
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +11 -0
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +39 -0
- package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +53 -12
- package/front_end/models/ai_assistance/agents/FileAgent.ts +0 -15
- package/front_end/models/ai_assistance/agents/NetworkAgent.ts +0 -5
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +57 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +87 -15
- package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +0 -10
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -6
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -5
- package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +84 -0
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +172 -0
- package/front_end/models/breakpoints/BreakpointManager.ts +20 -12
- package/front_end/models/emulation/DeviceModeModel.ts +5 -1
- package/front_end/models/emulation/EmulatedDevices.ts +3 -2
- package/front_end/models/javascript_metadata/NativeFunctions.js +60 -0
- package/front_end/models/lighthouse/LighthouseReporterTypes.ts +104 -10
- package/front_end/models/lighthouse/RunTypes.ts +42 -0
- package/front_end/models/lighthouse/lighthouse.ts +2 -0
- package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +59 -35
- package/front_end/models/stack_trace/StackTrace.ts +5 -0
- package/front_end/models/stack_trace/StackTraceImpl.ts +7 -1
- package/front_end/models/stack_trace/StackTraceModel.ts +2 -1
- package/front_end/models/stack_trace/stack_trace.ts +4 -0
- package/front_end/models/trace/ModelImpl.ts +4 -0
- package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -8
- package/front_end/models/trace/types/Configuration.ts +0 -5
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +7 -3
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +163 -74
- package/front_end/panels/ai_assistance/ExportConversation.ts +25 -0
- package/front_end/panels/ai_assistance/ai_assistance.ts +2 -0
- package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -0
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +120 -32
- package/front_end/panels/ai_assistance/components/ChatView.ts +44 -0
- package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +240 -0
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +4 -12
- package/front_end/panels/ai_assistance/components/StylingAgentMarkdownRenderer.ts +5 -27
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +115 -17
- package/front_end/panels/ai_assistance/components/chatMessage.css +65 -1
- package/front_end/panels/ai_assistance/components/chatView.css +8 -0
- package/front_end/panels/ai_assistance/components/exportForAgentsDialog.css +82 -0
- package/front_end/panels/ai_assistance/components/walkthroughView.css +9 -1
- package/front_end/panels/animation/AnimationTimeline.ts +5 -5
- package/front_end/panels/application/AppManifestView.ts +13 -7
- package/front_end/panels/application/FrameDetailsView.ts +4 -4
- package/front_end/panels/application/preloading/PreloadingView.ts +2 -4
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +6 -3
- package/front_end/panels/application/preloading/components/PreloadingString.ts +15 -2
- package/front_end/panels/application/preloading/helper/PreloadingForward.ts +31 -2
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +3 -2
- package/front_end/panels/common/DOMLinkifier.ts +10 -8
- package/front_end/panels/console/ConsoleView.ts +24 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +22 -23
- package/front_end/panels/console/console.ts +0 -2
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +5 -5
- package/front_end/panels/elements/ElementsTreeElement.ts +2 -3
- package/front_end/panels/elements/PropertiesWidget.ts +5 -3
- package/front_end/panels/elements/StandaloneStylesContainer.ts +21 -9
- package/front_end/panels/elements/StylePropertiesSection.ts +98 -50
- package/front_end/panels/elements/StylePropertyTreeElement.ts +38 -4
- package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +43 -35
- package/front_end/panels/elements/StylesSidebarPane.ts +154 -24
- package/front_end/panels/elements/components/ComputedStyleTrace.ts +3 -2
- package/front_end/panels/event_listeners/EventListenersView.ts +16 -4
- package/front_end/panels/explain/components/ConsoleInsight.ts +6 -9
- package/front_end/panels/explain/explain-meta.ts +5 -0
- package/front_end/panels/issues/AffectedResourcesView.ts +5 -9
- package/front_end/panels/issues/AffectedSelectivePermissionsInterventionView.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +154 -164
- package/front_end/panels/lighthouse/LighthousePanel.ts +5 -9
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +1 -0
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +9 -6
- package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -6
- package/front_end/panels/lighthouse/LighthouseStatusView.ts +32 -8
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +7 -3
- package/front_end/panels/network/NetworkDataGridNode.ts +34 -0
- package/front_end/panels/network/NetworkLogViewColumns.ts +10 -0
- package/front_end/panels/network/RequestPayloadView.ts +4 -1
- package/front_end/panels/network/RequestTimingView.ts +8 -2
- package/front_end/panels/performance_monitor/performanceMonitor.css +6 -4
- package/front_end/panels/recorder/RecorderController.ts +52 -14
- package/front_end/panels/recorder/components/RecordingView.ts +2 -1
- package/front_end/panels/recorder/models/RecordingStorage.ts +15 -20
- package/front_end/panels/sensors/SensorsView.ts +333 -157
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +18 -4
- package/front_end/panels/sources/DebuggerPausedMessage.ts +6 -6
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +2 -3
- package/front_end/panels/sources/NavigatorView.ts +11 -7
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
- package/front_end/panels/sources/SourcesPanel.ts +12 -34
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +5 -1
- package/front_end/panels/sources/sources-meta.ts +6 -0
- package/front_end/panels/timeline/StatusDialog.ts +159 -83
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +6 -2
- package/front_end/panels/timeline/TimelineController.ts +0 -4
- package/front_end/panels/timeline/TimelineDetailsView.ts +35 -3
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +6 -1
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +9 -4
- package/front_end/panels/timeline/TimelinePanel.ts +36 -11
- package/front_end/panels/timeline/TimelineTreeView.ts +14 -3
- package/front_end/panels/timeline/TimelineUIUtils.ts +5 -57
- package/front_end/panels/timeline/components/InteractionBreakdown.ts +2 -1
- package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
- package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +3 -7
- package/front_end/panels/timeline/components/Sidebar.ts +11 -19
- package/front_end/panels/timeline/components/SidebarInsightsTab.ts +2 -1
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +60 -27
- package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +66 -0
- package/front_end/panels/timeline/components/TimelineSummary.ts +7 -19
- package/front_end/panels/timeline/components/components.ts +2 -0
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +55 -28
- package/front_end/panels/timeline/components/insights/NodeLink.ts +3 -3
- package/front_end/panels/timeline/components/insights/baseInsightComponent.css +7 -0
- package/front_end/panels/timeline/components/insights/insights.ts +0 -2
- package/front_end/panels/timeline/components/timelineRangeSummaryView.css +20 -0
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +7 -7
- package/front_end/panels/timeline/timeline-meta.ts +11 -0
- package/front_end/panels/timeline/timelineDetailsView.css +0 -9
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +11 -2
- package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +11 -2
- package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +65 -4
- package/front_end/ui/kit/link/link.css +2 -2
- package/front_end/ui/legacy/Widget.ts +5 -3
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +7 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +57 -35
- package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +1 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +6 -1
- package/package.json +1 -1
- package/agents/prompts/README.md +0 -18
- package/front_end/panels/timeline/components/insights/InsightRenderer.ts +0 -93
- /package/front_end/{panels/console → models/stack_trace}/ErrorStackParser.ts +0 -0
|
@@ -12,7 +12,6 @@ import * as EmulationModel from '../../models/emulation/emulation.js';
|
|
|
12
12
|
import type * as LighthouseModel from '../../models/lighthouse/lighthouse.js';
|
|
13
13
|
import * as Emulation from '../emulation/emulation.js';
|
|
14
14
|
|
|
15
|
-
import type {RunOverrides} from './LighthousePanel.js';
|
|
16
15
|
import type {LighthouseRun as LighthouseRunType, ProtocolService} from './LighthouseProtocolService.js';
|
|
17
16
|
|
|
18
17
|
const UIStrings = {
|
|
@@ -192,6 +191,7 @@ class LighthouseRun {
|
|
|
192
191
|
formFactor: (string|undefined),
|
|
193
192
|
mode: string,
|
|
194
193
|
};
|
|
194
|
+
readonly isAIControlled: boolean;
|
|
195
195
|
private emulationStateBefore?: {
|
|
196
196
|
emulation: {
|
|
197
197
|
type: EmulationModel.DeviceModeModel.Type,
|
|
@@ -210,12 +210,13 @@ class LighthouseRun {
|
|
|
210
210
|
|
|
211
211
|
constructor(
|
|
212
212
|
controller: LighthouseController, protocolService: ProtocolService, inspectedURL: Platform.DevToolsPath.UrlString,
|
|
213
|
-
categoryIDs: string[], flags: {formFactor: (string|undefined), mode: string}) {
|
|
213
|
+
categoryIDs: string[], flags: {formFactor: (string|undefined), mode: string}, isAIControlled: boolean) {
|
|
214
214
|
this.controller = controller;
|
|
215
215
|
this.protocolService = protocolService;
|
|
216
216
|
this.inspectedURL = inspectedURL;
|
|
217
217
|
this.categoryIDs = categoryIDs;
|
|
218
218
|
this.flags = flags;
|
|
219
|
+
this.isAIControlled = isAIControlled;
|
|
219
220
|
this.#isRunning = false;
|
|
220
221
|
}
|
|
221
222
|
|
|
@@ -370,11 +371,11 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
370
371
|
protocolService.registerStatusCallback(
|
|
371
372
|
message => this.dispatchEventToListeners(Events.AuditProgressChanged, {message}));
|
|
372
373
|
|
|
373
|
-
for (const preset of
|
|
374
|
+
for (const preset of getPresets()) {
|
|
374
375
|
preset.setting.addChangeListener(this.recomputePageAuditability.bind(this));
|
|
375
376
|
}
|
|
376
377
|
|
|
377
|
-
for (const runtimeSetting of
|
|
378
|
+
for (const runtimeSetting of getRuntimeSettings()) {
|
|
378
379
|
runtimeSetting.setting.addChangeListener(this.recomputePageAuditability.bind(this));
|
|
379
380
|
}
|
|
380
381
|
|
|
@@ -441,7 +442,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
441
442
|
}
|
|
442
443
|
|
|
443
444
|
private hasAtLeastOneCategory(): boolean {
|
|
444
|
-
return
|
|
445
|
+
return getPresets().some(preset => preset.setting.get());
|
|
445
446
|
}
|
|
446
447
|
|
|
447
448
|
private unauditablePageMessage(): string|null {
|
|
@@ -492,7 +493,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
492
493
|
|
|
493
494
|
private async hasImportantResourcesNotCleared(): Promise<string> {
|
|
494
495
|
const clearStorageSetting =
|
|
495
|
-
|
|
496
|
+
getRuntimeSettings().find(runtimeSetting => runtimeSetting.setting.name === 'lighthouse.clear-storage');
|
|
496
497
|
if (clearStorageSetting && !clearStorageSetting.setting.get()) {
|
|
497
498
|
return '';
|
|
498
499
|
}
|
|
@@ -551,6 +552,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
551
552
|
inspectedURL: this.currentLighthouseRun.inspectedURL,
|
|
552
553
|
categoryIDs: this.currentLighthouseRun.categoryIDs,
|
|
553
554
|
flags: this.currentLighthouseRun.flags,
|
|
555
|
+
isAIControlled: this.currentLighthouseRun.isAIControlled,
|
|
554
556
|
};
|
|
555
557
|
}
|
|
556
558
|
|
|
@@ -559,7 +561,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
559
561
|
mode: string,
|
|
560
562
|
} {
|
|
561
563
|
const flags = {};
|
|
562
|
-
for (const runtimeSetting of
|
|
564
|
+
for (const runtimeSetting of getRuntimeSettings()) {
|
|
563
565
|
runtimeSetting.setFlags(flags, runtimeSetting.setting.get());
|
|
564
566
|
}
|
|
565
567
|
return flags as {
|
|
@@ -568,10 +570,10 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
568
570
|
};
|
|
569
571
|
}
|
|
570
572
|
|
|
571
|
-
getCategoryIDs(): CategoryId[] {
|
|
573
|
+
getCategoryIDs(): LighthouseModel.RunTypes.CategoryId[] {
|
|
572
574
|
const {mode} = this.getFlags();
|
|
573
|
-
const categoryIDs: CategoryId[] = [];
|
|
574
|
-
for (const preset of
|
|
575
|
+
const categoryIDs: LighthouseModel.RunTypes.CategoryId[] = [];
|
|
576
|
+
for (const preset of getPresets()) {
|
|
575
577
|
if (mode && !preset.supportedModes.includes(mode)) {
|
|
576
578
|
continue;
|
|
577
579
|
}
|
|
@@ -620,7 +622,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
620
622
|
private recordMetrics(flags: {mode: string}, categoryIds: string[]): void {
|
|
621
623
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.LighthouseStarted);
|
|
622
624
|
|
|
623
|
-
for (const preset of
|
|
625
|
+
for (const preset of getPresets()) {
|
|
624
626
|
if (!categoryIds.includes(preset.configID)) {
|
|
625
627
|
continue;
|
|
626
628
|
}
|
|
@@ -645,7 +647,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
645
647
|
* user has selected in the UI, but these can be overridden by passing in the
|
|
646
648
|
* category IDs, in which case these take priority.
|
|
647
649
|
*/
|
|
648
|
-
async startLighthouse(overrides?: RunOverrides): Promise<void> {
|
|
650
|
+
async startLighthouse(overrides?: LighthouseModel.RunTypes.RunOverrides): Promise<void> {
|
|
649
651
|
if (this.lastAction) {
|
|
650
652
|
await this.lastAction;
|
|
651
653
|
}
|
|
@@ -662,7 +664,8 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
662
664
|
|
|
663
665
|
this.recordMetrics(flags, categoryIDs);
|
|
664
666
|
|
|
665
|
-
this.currentLighthouseRun = new LighthouseRun(
|
|
667
|
+
this.currentLighthouseRun = new LighthouseRun(
|
|
668
|
+
this, this.protocolService, inspectedURL, categoryIDs, flags, Boolean(overrides?.isAIControlled));
|
|
666
669
|
await this.currentLighthouseRun.start();
|
|
667
670
|
resolve();
|
|
668
671
|
});
|
|
@@ -702,144 +705,154 @@ const STORAGE_TYPE_NAMES = new Map([
|
|
|
702
705
|
[Protocol.Storage.StorageType.Websql, i18nLazyString(UIStrings.webSql)],
|
|
703
706
|
]);
|
|
704
707
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
{
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
configID: 'performance',
|
|
711
|
-
title: i18nLazyString(UIStrings.performance),
|
|
712
|
-
description: i18nLazyString(UIStrings.howLongDoesThisAppTakeToShow),
|
|
713
|
-
supportedModes: ['navigation', 'timespan', 'snapshot'],
|
|
714
|
-
userMetric: Host.UserMetrics.LighthouseCategoryUsed.PERFORMANCE,
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
setting: Common.Settings.Settings.instance().createSetting(
|
|
718
|
-
'lighthouse.cat-a11y', true, Common.Settings.SettingStorageType.SYNCED),
|
|
719
|
-
configID: 'accessibility',
|
|
720
|
-
title: i18nLazyString(UIStrings.accessibility),
|
|
721
|
-
description: i18nLazyString(UIStrings.isThisPageUsableByPeopleWith),
|
|
722
|
-
supportedModes: ['navigation', 'snapshot'],
|
|
723
|
-
userMetric: Host.UserMetrics.LighthouseCategoryUsed.ACCESSIBILITY,
|
|
724
|
-
},
|
|
725
|
-
{
|
|
726
|
-
setting: Common.Settings.Settings.instance().createSetting(
|
|
727
|
-
'lighthouse.cat-best-practices', true, Common.Settings.SettingStorageType.SYNCED),
|
|
728
|
-
configID: 'best-practices',
|
|
729
|
-
title: i18nLazyString(UIStrings.bestPractices),
|
|
730
|
-
description: i18nLazyString(UIStrings.doesThisPageFollowBestPractices),
|
|
731
|
-
supportedModes: ['navigation', 'timespan', 'snapshot'],
|
|
732
|
-
userMetric: Host.UserMetrics.LighthouseCategoryUsed.BEST_PRACTICES,
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
setting: Common.Settings.Settings.instance().createSetting(
|
|
736
|
-
'lighthouse.cat-seo', true, Common.Settings.SettingStorageType.SYNCED),
|
|
737
|
-
configID: 'seo',
|
|
738
|
-
title: i18nLazyString(UIStrings.seo),
|
|
739
|
-
description: i18nLazyString(UIStrings.isThisPageOptimizedForSearch),
|
|
740
|
-
supportedModes: ['navigation', 'snapshot'],
|
|
741
|
-
userMetric: Host.UserMetrics.LighthouseCategoryUsed.SEO,
|
|
742
|
-
},
|
|
743
|
-
];
|
|
744
|
-
|
|
745
|
-
export type Flags = Record<string, string|boolean>;
|
|
746
|
-
|
|
747
|
-
export const RuntimeSettings: RuntimeSetting[] = [
|
|
748
|
-
{
|
|
749
|
-
setting: Common.Settings.Settings.instance().createSetting(
|
|
750
|
-
'lighthouse.device-type', 'mobile', Common.Settings.SettingStorageType.SYNCED),
|
|
751
|
-
title: i18nLazyString(UIStrings.applyMobileEmulation),
|
|
752
|
-
description: i18nLazyString(UIStrings.applyMobileEmulationDuring),
|
|
753
|
-
setFlags: (flags: Flags, value: string|boolean) => {
|
|
754
|
-
// See Audits.AuditsPanel._setupEmulationAndProtocolConnection()
|
|
755
|
-
flags.formFactor = value;
|
|
756
|
-
},
|
|
757
|
-
options: [
|
|
708
|
+
let presets: LighthouseModel.RunTypes.Preset[]|null = null;
|
|
709
|
+
export function getPresets(): LighthouseModel.RunTypes.Preset[] {
|
|
710
|
+
if (!presets) {
|
|
711
|
+
presets = [
|
|
712
|
+
// configID maps to Lighthouse's Object.keys(config.categories)[0] value
|
|
758
713
|
{
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
714
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
715
|
+
'lighthouse.cat-perf', true, Common.Settings.SettingStorageType.SYNCED),
|
|
716
|
+
configID: 'performance',
|
|
717
|
+
title: i18nLazyString(UIStrings.performance),
|
|
718
|
+
description: i18nLazyString(UIStrings.howLongDoesThisAppTakeToShow),
|
|
719
|
+
supportedModes: ['navigation', 'timespan', 'snapshot'],
|
|
720
|
+
userMetric: Host.UserMetrics.LighthouseCategoryUsed.PERFORMANCE,
|
|
762
721
|
},
|
|
763
722
|
{
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
723
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
724
|
+
'lighthouse.cat-a11y', true, Common.Settings.SettingStorageType.SYNCED),
|
|
725
|
+
configID: 'accessibility',
|
|
726
|
+
title: i18nLazyString(UIStrings.accessibility),
|
|
727
|
+
description: i18nLazyString(UIStrings.isThisPageUsableByPeopleWith),
|
|
728
|
+
supportedModes: ['navigation', 'snapshot'],
|
|
729
|
+
userMetric: Host.UserMetrics.LighthouseCategoryUsed.ACCESSIBILITY,
|
|
767
730
|
},
|
|
768
|
-
],
|
|
769
|
-
},
|
|
770
|
-
{
|
|
771
|
-
setting: Common.Settings.Settings.instance().createSetting(
|
|
772
|
-
'lighthouse.mode', 'navigation', Common.Settings.SettingStorageType.SYNCED),
|
|
773
|
-
title: i18nLazyString(UIStrings.lighthouseMode),
|
|
774
|
-
description: i18nLazyString(UIStrings.runLighthouseInMode),
|
|
775
|
-
setFlags: (flags: Flags, value: string|boolean) => {
|
|
776
|
-
flags.mode = value;
|
|
777
|
-
},
|
|
778
|
-
options: [
|
|
779
731
|
{
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
732
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
733
|
+
'lighthouse.cat-best-practices', true, Common.Settings.SettingStorageType.SYNCED),
|
|
734
|
+
configID: 'best-practices',
|
|
735
|
+
title: i18nLazyString(UIStrings.bestPractices),
|
|
736
|
+
description: i18nLazyString(UIStrings.doesThisPageFollowBestPractices),
|
|
737
|
+
supportedModes: ['navigation', 'timespan', 'snapshot'],
|
|
738
|
+
userMetric: Host.UserMetrics.LighthouseCategoryUsed.BEST_PRACTICES,
|
|
783
739
|
},
|
|
784
740
|
{
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
741
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
742
|
+
'lighthouse.cat-seo', true, Common.Settings.SettingStorageType.SYNCED),
|
|
743
|
+
configID: 'seo',
|
|
744
|
+
title: i18nLazyString(UIStrings.seo),
|
|
745
|
+
description: i18nLazyString(UIStrings.isThisPageOptimizedForSearch),
|
|
746
|
+
supportedModes: ['navigation', 'snapshot'],
|
|
747
|
+
userMetric: Host.UserMetrics.LighthouseCategoryUsed.SEO,
|
|
788
748
|
},
|
|
749
|
+
];
|
|
750
|
+
}
|
|
751
|
+
return presets;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
let runtimeSettings: LighthouseModel.RunTypes.RuntimeSetting[]|null = null;
|
|
755
|
+
export function getRuntimeSettings(): LighthouseModel.RunTypes.RuntimeSetting[] {
|
|
756
|
+
if (!runtimeSettings) {
|
|
757
|
+
runtimeSettings = [
|
|
789
758
|
{
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
759
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
760
|
+
'lighthouse.device-type', 'mobile', Common.Settings.SettingStorageType.SYNCED),
|
|
761
|
+
title: i18nLazyString(UIStrings.applyMobileEmulation),
|
|
762
|
+
description: i18nLazyString(UIStrings.applyMobileEmulationDuring),
|
|
763
|
+
setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
|
|
764
|
+
// See Audits.AuditsPanel._setupEmulationAndProtocolConnection()
|
|
765
|
+
flags.formFactor = value;
|
|
766
|
+
},
|
|
767
|
+
options: [
|
|
768
|
+
{
|
|
769
|
+
label: i18nLazyString(UIStrings.mobile),
|
|
770
|
+
tooltip: i18nLazyString(UIStrings.applyMobileEmulationDuring),
|
|
771
|
+
value: 'mobile'
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
label: i18nLazyString(UIStrings.desktop),
|
|
775
|
+
tooltip: i18nLazyString(UIStrings.applyDesktopEmulationDuring),
|
|
776
|
+
value: 'desktop'
|
|
777
|
+
},
|
|
778
|
+
],
|
|
793
779
|
},
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
]
|
|
780
|
+
{
|
|
781
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
782
|
+
'lighthouse.mode', 'navigation', Common.Settings.SettingStorageType.SYNCED),
|
|
783
|
+
title: i18nLazyString(UIStrings.lighthouseMode),
|
|
784
|
+
description: i18nLazyString(UIStrings.runLighthouseInMode),
|
|
785
|
+
setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
|
|
786
|
+
flags.mode = value;
|
|
787
|
+
},
|
|
788
|
+
options: [
|
|
789
|
+
{
|
|
790
|
+
label: i18nLazyString(UIStrings.navigation),
|
|
791
|
+
tooltip: i18nLazyString(UIStrings.navigationTooltip),
|
|
792
|
+
value: 'navigation',
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
label: i18nLazyString(UIStrings.timespan),
|
|
796
|
+
tooltip: i18nLazyString(UIStrings.timespanTooltip),
|
|
797
|
+
value: 'timespan',
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
label: i18nLazyString(UIStrings.snapshot),
|
|
801
|
+
tooltip: i18nLazyString(UIStrings.snapshotTooltip),
|
|
802
|
+
value: 'snapshot',
|
|
803
|
+
},
|
|
804
|
+
],
|
|
805
|
+
learnMore: 'https://github.com/GoogleChrome/lighthouse/blob/HEAD/docs/user-flows.md' as
|
|
806
|
+
Platform.DevToolsPath.UrlString,
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
// This setting is disabled, but we keep it around to show in the UI.
|
|
810
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
811
|
+
'lighthouse.throttling', 'simulate', Common.Settings.SettingStorageType.SYNCED),
|
|
812
|
+
title: i18nLazyString(UIStrings.throttlingMethod),
|
|
813
|
+
// We will disable this when we have a Lantern trace viewer within DevTools.
|
|
814
|
+
learnMore:
|
|
815
|
+
'https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md#devtools-lighthouse-panel-throttling' as
|
|
816
|
+
Platform.DevToolsPath.UrlString,
|
|
817
|
+
description: i18nLazyString(UIStrings.simulateASlowerPageLoadBasedOn),
|
|
818
|
+
setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
|
|
819
|
+
if (typeof value === 'string') {
|
|
820
|
+
flags.throttlingMethod = value;
|
|
821
|
+
} else {
|
|
822
|
+
flags.throttlingMethod = value ? 'simulate' : 'devtools';
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
options: [
|
|
826
|
+
{label: i18nLazyString(UIStrings.simulatedThrottling), value: 'simulate'},
|
|
827
|
+
{label: i18nLazyString(UIStrings.devtoolsThrottling), value: 'devtools'},
|
|
828
|
+
],
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
832
|
+
'lighthouse.clear-storage', true, Common.Settings.SettingStorageType.SYNCED),
|
|
833
|
+
title: i18nLazyString(UIStrings.clearStorage),
|
|
834
|
+
description: i18nLazyString(UIStrings.resetStorageLocalstorage),
|
|
835
|
+
setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
|
|
836
|
+
flags.disableStorageReset = !value;
|
|
837
|
+
},
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
setting: Common.Settings.Settings.instance().createSetting(
|
|
841
|
+
'lighthouse.enable-sampling', false, Common.Settings.SettingStorageType.SYNCED),
|
|
842
|
+
title: i18nLazyString(UIStrings.enableSampling),
|
|
843
|
+
description: i18nLazyString(UIStrings.enableJavaScriptSampling),
|
|
844
|
+
setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
|
|
845
|
+
if (value) {
|
|
846
|
+
flags.additionalTraceCategories = 'disabled-by-default-v8.cpu_profiler';
|
|
847
|
+
} else {
|
|
848
|
+
flags.additionalTraceCategories = '';
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
},
|
|
852
|
+
];
|
|
853
|
+
}
|
|
854
|
+
return runtimeSettings;
|
|
855
|
+
}
|
|
843
856
|
|
|
844
857
|
export enum Events {
|
|
845
858
|
/* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
|
|
@@ -866,26 +879,3 @@ export interface EventTypes {
|
|
|
866
879
|
[Events.PageWarningsChanged]: PageWarningsChangedEvent;
|
|
867
880
|
[Events.AuditProgressChanged]: AuditProgressChangedEvent;
|
|
868
881
|
}
|
|
869
|
-
|
|
870
|
-
export type CategoryId = 'performance'|'accessibility'|'best-practices'|'seo';
|
|
871
|
-
|
|
872
|
-
export interface Preset {
|
|
873
|
-
setting: Common.Settings.Setting<boolean>;
|
|
874
|
-
configID: CategoryId;
|
|
875
|
-
title: () => Common.UIString.LocalizedString;
|
|
876
|
-
description: () => Common.UIString.LocalizedString;
|
|
877
|
-
supportedModes: string[];
|
|
878
|
-
userMetric: Host.UserMetrics.LighthouseCategoryUsed;
|
|
879
|
-
}
|
|
880
|
-
export interface RuntimeSetting {
|
|
881
|
-
setting: Common.Settings.Setting<string|boolean>;
|
|
882
|
-
description: () => Common.UIString.LocalizedString;
|
|
883
|
-
setFlags: (flags: Flags, value: string|boolean) => void;
|
|
884
|
-
options?: Array<{
|
|
885
|
-
label: () => Common.UIString.LocalizedString,
|
|
886
|
-
value: string,
|
|
887
|
-
tooltip?: () => Common.UIString.LocalizedString,
|
|
888
|
-
}>;
|
|
889
|
-
title?: () => Common.UIString.LocalizedString;
|
|
890
|
-
learnMore?: Platform.DevToolsPath.UrlString;
|
|
891
|
-
}
|
|
@@ -13,7 +13,6 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
15
|
type AuditProgressChangedEvent,
|
|
16
|
-
type CategoryId,
|
|
17
16
|
Events,
|
|
18
17
|
LighthouseController,
|
|
19
18
|
type PageAuditabilityChangedEvent,
|
|
@@ -153,7 +152,7 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
154
|
|
|
156
|
-
async handleCompleteRun(overrides?: RunOverrides):
|
|
155
|
+
async handleCompleteRun(overrides?: LighthouseModel.RunTypes.RunOverrides):
|
|
157
156
|
Promise<{report: LighthouseModel.ReporterTypes.ReportJSON | null}> {
|
|
158
157
|
try {
|
|
159
158
|
await this.controller.startLighthouse(overrides);
|
|
@@ -290,9 +289,10 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
|
290
289
|
}
|
|
291
290
|
|
|
292
291
|
private renderStatusView(): void {
|
|
293
|
-
const
|
|
292
|
+
const currentRun = this.controller.getCurrentRun();
|
|
294
293
|
this.contentElement.classList.toggle('in-progress', true);
|
|
295
|
-
this.statusView.setInspectedURL(inspectedURL);
|
|
294
|
+
this.statusView.setInspectedURL(currentRun?.inspectedURL);
|
|
295
|
+
this.statusView.setAIControlled(Boolean(currentRun?.isAIControlled));
|
|
296
296
|
this.statusView.show(this.contentElement);
|
|
297
297
|
}
|
|
298
298
|
|
|
@@ -392,7 +392,7 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
static async executeLighthouseRecording(
|
|
395
|
-
overrides?: RunOverrides,
|
|
395
|
+
overrides?: LighthouseModel.RunTypes.RunOverrides,
|
|
396
396
|
): Promise<LighthouseModel.ReporterTypes.ReportJSON|null> {
|
|
397
397
|
const panel = LighthousePanel.instance();
|
|
398
398
|
await UI.ViewManager.ViewManager.instance().showView('lighthouse');
|
|
@@ -401,7 +401,3 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
|
401
401
|
return report;
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
|
|
405
|
-
export interface RunOverrides {
|
|
406
|
-
categoryIds: CategoryId[];
|
|
407
|
-
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2018 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
5
|
|
|
5
6
|
import * as Common from '../../core/common/common.js';
|
|
6
7
|
import * as Host from '../../core/host/host.js';
|
|
@@ -13,6 +14,7 @@ import * as LighthouseReport from '../../third_party/lighthouse/report/report.js
|
|
|
13
14
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
14
15
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
15
16
|
import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
|
|
17
|
+
import {html, nothing, render} from '../../ui/lit/lit.js';
|
|
16
18
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
17
19
|
import * as PanelsCommon from '../common/common.js';
|
|
18
20
|
|
|
@@ -154,24 +156,25 @@ export class LighthouseReportRenderer {
|
|
|
154
156
|
|
|
155
157
|
const screenshotElement = origHTMLElement.querySelector('.lh-element-screenshot');
|
|
156
158
|
origHTMLElement.textContent = '';
|
|
157
|
-
|
|
158
|
-
origHTMLElement.append(screenshotElement);
|
|
159
|
-
}
|
|
160
|
-
origHTMLElement.appendChild(element);
|
|
159
|
+
render(html`${screenshotElement ?? nothing}${element}`, origHTMLElement);
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
static async linkifySourceLocationDetails(el: Element): Promise<void> {
|
|
165
164
|
for (const origElement of el.getElementsByClassName('lh-source-location')) {
|
|
166
165
|
const origHTMLElement = origElement as HTMLElement;
|
|
167
|
-
const detailsItem = origHTMLElement.dataset as
|
|
166
|
+
const detailsItem = origHTMLElement.dataset as {
|
|
167
|
+
sourceUrl?: Platform.DevToolsPath.UrlString,
|
|
168
|
+
sourceLine?: string,
|
|
169
|
+
sourceColumn?: string,
|
|
170
|
+
};
|
|
168
171
|
if (!detailsItem.sourceUrl || !detailsItem.sourceLine || !detailsItem.sourceColumn) {
|
|
169
172
|
continue;
|
|
170
173
|
}
|
|
171
174
|
const url = detailsItem.sourceUrl;
|
|
172
175
|
const line = Number(detailsItem.sourceLine);
|
|
173
176
|
const column = Number(detailsItem.sourceColumn);
|
|
174
|
-
const element =
|
|
177
|
+
const element = Components.Linkifier.Linkifier.linkifyURL(url, {
|
|
175
178
|
lineNumber: line,
|
|
176
179
|
columnNumber: column,
|
|
177
180
|
showColumnNumber: false,
|
|
@@ -8,12 +8,13 @@ import '../../ui/legacy/legacy.js';
|
|
|
8
8
|
import type * as Common from '../../core/common/common.js';
|
|
9
9
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
10
10
|
import type * as Platform from '../../core/platform/platform.js';
|
|
11
|
+
import type * as LHModel from '../../models/lighthouse/lighthouse.js';
|
|
11
12
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
12
13
|
import {Link} from '../../ui/kit/kit.js';
|
|
13
14
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
14
15
|
import {Directives, html, render} from '../../ui/lit/lit.js';
|
|
15
16
|
|
|
16
|
-
import {
|
|
17
|
+
import {getPresets, getRuntimeSettings, type LighthouseController} from './LighthouseController.js';
|
|
17
18
|
import type {LighthousePanel} from './LighthousePanel.js';
|
|
18
19
|
import lighthouseStartViewStyles from './lighthouseStartView.css.js';
|
|
19
20
|
import {RadioSetting} from './RadioSetting.js';
|
|
@@ -135,7 +136,7 @@ export class StartView extends UI.Widget.Widget {
|
|
|
135
136
|
private startButton!: Buttons.Button.Button;
|
|
136
137
|
private helpText?: Element;
|
|
137
138
|
private warningText?: Element;
|
|
138
|
-
private checkboxes: Array<{preset: Preset, checkbox: UI.Toolbar.ToolbarCheckbox}> = [];
|
|
139
|
+
private checkboxes: Array<{preset: LHModel.RunTypes.Preset, checkbox: UI.Toolbar.ToolbarCheckbox}> = [];
|
|
139
140
|
|
|
140
141
|
changeFormMode?: (mode: string) => void;
|
|
141
142
|
|
|
@@ -151,7 +152,7 @@ export class StartView extends UI.Widget.Widget {
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
private populateRuntimeSettingAsRadio(settingName: string, label: string, parentElement: Element): void {
|
|
154
|
-
const runtimeSetting =
|
|
155
|
+
const runtimeSetting = getRuntimeSettings().find(item => item.setting.name === settingName);
|
|
155
156
|
if (!runtimeSetting?.options) {
|
|
156
157
|
throw new Error(`${settingName} is not a setting with options`);
|
|
157
158
|
}
|
|
@@ -175,7 +176,7 @@ export class StartView extends UI.Widget.Widget {
|
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
private populateRuntimeSettingAsToolbarCheckbox(settingName: string, toolbar: UI.Toolbar.Toolbar): void {
|
|
178
|
-
const runtimeSetting =
|
|
179
|
+
const runtimeSetting = getRuntimeSettings().find(item => item.setting.name === settingName);
|
|
179
180
|
if (!runtimeSetting?.title) {
|
|
180
181
|
throw new Error(`${settingName} is not a setting with a title`);
|
|
181
182
|
}
|
|
@@ -193,7 +194,7 @@ export class StartView extends UI.Widget.Widget {
|
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
private populateRuntimeSettingAsToolbarDropdown(settingName: string, toolbar: UI.Toolbar.Toolbar): void {
|
|
196
|
-
const runtimeSetting =
|
|
197
|
+
const runtimeSetting = getRuntimeSettings().find(item => item.setting.name === settingName);
|
|
197
198
|
if (!runtimeSetting?.title) {
|
|
198
199
|
throw new Error(`${settingName} is not a setting with a title`);
|
|
199
200
|
}
|
|
@@ -225,7 +226,7 @@ export class StartView extends UI.Widget.Widget {
|
|
|
225
226
|
// Populate the categories
|
|
226
227
|
|
|
227
228
|
this.checkboxes = [];
|
|
228
|
-
for (const preset of
|
|
229
|
+
for (const preset of getPresets()) {
|
|
229
230
|
preset.setting.setTitle(preset.title());
|
|
230
231
|
const checkbox = new UI.Toolbar.ToolbarSettingCheckbox(preset.setting, preset.description());
|
|
231
232
|
const row = categoryFormElements.createChild('div', 'vbox lighthouse-launcher-row');
|