chrome-devtools-frontend 1.0.1597624 → 1.0.1599001

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.
Files changed (140) hide show
  1. package/.agents/README.md +13 -0
  2. package/{agents/prompts/creating-a-model.md → .agents/skills/creating-a-model/SKILL.md} +7 -1
  3. package/{agents/prompts/devtools-imports.md → .agents/skills/devtools-imports/SKILL.md} +10 -5
  4. package/{agents/prompts/merging-devtools-module.md → .agents/skills/merging-devtools-module/SKILL.md} +5 -0
  5. package/{agents/prompts/ui-widgets.md → .agents/skills/ui-widgets/SKILL.md} +5 -0
  6. package/{agents/prompts/verification.md → .agents/skills/verification/SKILL.md} +5 -0
  7. package/docs/ui_engineering.md +6 -6
  8. package/front_end/core/host/AidaClient.ts +2 -0
  9. package/front_end/core/host/GcaTypes.ts +518 -0
  10. package/front_end/core/host/UserMetrics.ts +0 -1
  11. package/front_end/core/host/host.ts +2 -0
  12. package/front_end/core/root/ExperimentNames.ts +0 -1
  13. package/front_end/entrypoints/main/MainImpl.ts +0 -2
  14. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  15. package/front_end/generated/protocol.ts +2 -1
  16. package/front_end/models/ai_assistance/AiConversation.ts +28 -15
  17. package/front_end/models/ai_assistance/AiHistoryStorage.snapshot.txt +1 -1
  18. package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -0
  19. package/front_end/models/ai_assistance/ConversationHandler.ts +8 -2
  20. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +3 -18
  21. package/front_end/models/ai_assistance/agents/AiAgent.ts +39 -5
  22. package/front_end/models/ai_assistance/agents/BreakpointDebuggerAgent.ts +0 -1
  23. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +1 -0
  24. package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +108 -0
  25. package/front_end/models/ai_assistance/agents/FileAgent.ts +0 -15
  26. package/front_end/models/ai_assistance/agents/NetworkAgent.ts +0 -5
  27. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +76 -13
  28. package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +0 -10
  29. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -6
  30. package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -5
  31. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  32. package/front_end/models/emulation/DeviceModeModel.ts +5 -1
  33. package/front_end/models/emulation/EmulatedDevices.ts +3 -2
  34. package/front_end/models/issues_manager/SharedDictionaryIssue.ts +15 -5
  35. package/front_end/models/issues_manager/descriptions/sharedDictionaryUseErrorNoCorpCrossOriginNoCorsRequest.md +3 -0
  36. package/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNoCorpCossOriginNoCorsRequest.md +3 -0
  37. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -0
  38. package/front_end/models/lighthouse/RunTypes.ts +41 -0
  39. package/front_end/models/lighthouse/lighthouse.ts +2 -0
  40. package/front_end/models/trace/ModelImpl.ts +4 -0
  41. package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -8
  42. package/front_end/models/trace/types/Configuration.ts +0 -5
  43. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +90 -14
  44. package/front_end/panels/ai_assistance/PatchWidget.ts +1 -1
  45. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -0
  46. package/front_end/panels/ai_assistance/components/ChatMessage.ts +153 -42
  47. package/front_end/panels/ai_assistance/components/ChatView.ts +1 -1
  48. package/front_end/panels/ai_assistance/components/chatMessage.css +61 -0
  49. package/front_end/panels/application/AppManifestView.ts +2 -2
  50. package/front_end/panels/application/CookieItemsView.ts +9 -15
  51. package/front_end/panels/application/DeviceBoundSessionsView.ts +3 -5
  52. package/front_end/panels/application/FrameDetailsView.ts +2 -2
  53. package/front_end/panels/application/ReportingApiView.ts +2 -2
  54. package/front_end/panels/application/preloading/PreloadingView.ts +20 -7
  55. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +6 -3
  56. package/front_end/panels/application/preloading/components/PreloadingString.ts +15 -2
  57. package/front_end/panels/application/preloading/helper/PreloadingForward.ts +31 -2
  58. package/front_end/panels/changes/ChangesView.ts +7 -11
  59. package/front_end/panels/coverage/CoverageView.ts +4 -4
  60. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
  61. package/front_end/panels/elements/ElementsTreeOutline.ts +34 -8
  62. package/front_end/panels/elements/StylePropertiesSection.ts +129 -1
  63. package/front_end/panels/elements/StylePropertyHighlighter.ts +3 -0
  64. package/front_end/panels/elements/stylesSidebarPane.css +34 -0
  65. package/front_end/panels/issues/AffectedSelectivePermissionsInterventionView.ts +3 -5
  66. package/front_end/panels/layer_viewer/LayerDetailsView.ts +2 -1
  67. package/front_end/panels/lighthouse/LighthouseController.ts +148 -162
  68. package/front_end/panels/lighthouse/LighthousePanel.ts +2 -7
  69. package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -6
  70. package/front_end/panels/lighthouse/LighthouseStatusView.ts +3 -3
  71. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +7 -3
  72. package/front_end/panels/network/RequestConditionsDrawer.ts +4 -4
  73. package/front_end/panels/network/RequestCookiesView.ts +2 -2
  74. package/front_end/panels/network/RequestHeadersView.ts +4 -4
  75. package/front_end/panels/network/RequestResponseView.ts +2 -2
  76. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -2
  77. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -3
  78. package/front_end/panels/recorder/components/StepView.ts +2 -1
  79. package/front_end/panels/search/SearchView.ts +2 -2
  80. package/front_end/panels/sensors/SensorsView.ts +32 -22
  81. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +18 -4
  82. package/front_end/panels/timeline/StatusDialog.ts +159 -83
  83. package/front_end/panels/timeline/TimelineController.ts +0 -4
  84. package/front_end/panels/timeline/TimelineDetailsView.ts +8 -6
  85. package/front_end/panels/timeline/TimelinePanel.ts +29 -2
  86. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  87. package/front_end/panels/timeline/components/Sidebar.ts +1 -1
  88. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +1 -1
  89. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +62 -34
  90. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +53 -28
  91. package/front_end/panels/timeline/components/insights/CharacterSet.ts +2 -6
  92. package/front_end/panels/timeline/components/insights/EventRef.ts +2 -2
  93. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +7 -0
  94. package/front_end/panels/timeline/components/insights/insights.ts +0 -2
  95. package/front_end/panels/timeline/timeline-meta.ts +11 -0
  96. package/front_end/panels/webauthn/WebauthnPane.ts +2 -2
  97. package/front_end/third_party/chromium/README.chromium +1 -1
  98. package/front_end/third_party/puppeteer/README.chromium +2 -2
  99. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Realm.js +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Realm.js.map +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.d.ts +4 -0
  102. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.d.ts.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.js +13 -0
  104. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.js.map +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  107. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  108. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/cjs/third_party/mitt/mitt.js +2 -2
  113. package/front_end/third_party/puppeteer/package/lib/cjs/third_party/parsel-js/parsel-js.js +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/cjs/third_party/rxjs/rxjs.js +446 -446
  115. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +166 -167
  116. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Realm.js +2 -2
  117. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Realm.js.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.d.ts +4 -0
  119. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.d.ts.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.js +12 -0
  121. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.js.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  123. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  124. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  126. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt/mitt.js +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/esm/third_party/parsel-js/parsel-js.js +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/esm/third_party/rxjs/rxjs.js +97 -97
  130. package/front_end/third_party/puppeteer/package/package.json +1 -1
  131. package/front_end/third_party/puppeteer/package/src/bidi/Realm.ts +2 -2
  132. package/front_end/third_party/puppeteer/package/src/bidi/util.ts +17 -0
  133. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  134. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  135. package/front_end/ui/legacy/Widget.ts +47 -9
  136. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -1
  137. package/package.json +1 -1
  138. package/agents/prompts/README.md +0 -18
  139. package/front_end/models/issues_manager/descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -1
  140. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +0 -93
@@ -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 = {
@@ -370,11 +369,11 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
370
369
  protocolService.registerStatusCallback(
371
370
  message => this.dispatchEventToListeners(Events.AuditProgressChanged, {message}));
372
371
 
373
- for (const preset of Presets) {
372
+ for (const preset of getPresets()) {
374
373
  preset.setting.addChangeListener(this.recomputePageAuditability.bind(this));
375
374
  }
376
375
 
377
- for (const runtimeSetting of RuntimeSettings) {
376
+ for (const runtimeSetting of getRuntimeSettings()) {
378
377
  runtimeSetting.setting.addChangeListener(this.recomputePageAuditability.bind(this));
379
378
  }
380
379
 
@@ -441,7 +440,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
441
440
  }
442
441
 
443
442
  private hasAtLeastOneCategory(): boolean {
444
- return Presets.some(preset => preset.setting.get());
443
+ return getPresets().some(preset => preset.setting.get());
445
444
  }
446
445
 
447
446
  private unauditablePageMessage(): string|null {
@@ -492,7 +491,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
492
491
 
493
492
  private async hasImportantResourcesNotCleared(): Promise<string> {
494
493
  const clearStorageSetting =
495
- RuntimeSettings.find(runtimeSetting => runtimeSetting.setting.name === 'lighthouse.clear-storage');
494
+ getRuntimeSettings().find(runtimeSetting => runtimeSetting.setting.name === 'lighthouse.clear-storage');
496
495
  if (clearStorageSetting && !clearStorageSetting.setting.get()) {
497
496
  return '';
498
497
  }
@@ -559,7 +558,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
559
558
  mode: string,
560
559
  } {
561
560
  const flags = {};
562
- for (const runtimeSetting of RuntimeSettings) {
561
+ for (const runtimeSetting of getRuntimeSettings()) {
563
562
  runtimeSetting.setFlags(flags, runtimeSetting.setting.get());
564
563
  }
565
564
  return flags as {
@@ -568,10 +567,10 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
568
567
  };
569
568
  }
570
569
 
571
- getCategoryIDs(): CategoryId[] {
570
+ getCategoryIDs(): LighthouseModel.RunTypes.CategoryId[] {
572
571
  const {mode} = this.getFlags();
573
- const categoryIDs: CategoryId[] = [];
574
- for (const preset of Presets) {
572
+ const categoryIDs: LighthouseModel.RunTypes.CategoryId[] = [];
573
+ for (const preset of getPresets()) {
575
574
  if (mode && !preset.supportedModes.includes(mode)) {
576
575
  continue;
577
576
  }
@@ -620,7 +619,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
620
619
  private recordMetrics(flags: {mode: string}, categoryIds: string[]): void {
621
620
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.LighthouseStarted);
622
621
 
623
- for (const preset of Presets) {
622
+ for (const preset of getPresets()) {
624
623
  if (!categoryIds.includes(preset.configID)) {
625
624
  continue;
626
625
  }
@@ -645,7 +644,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
645
644
  * user has selected in the UI, but these can be overridden by passing in the
646
645
  * category IDs, in which case these take priority.
647
646
  */
648
- async startLighthouse(overrides?: RunOverrides): Promise<void> {
647
+ async startLighthouse(overrides?: LighthouseModel.RunTypes.RunOverrides): Promise<void> {
649
648
  if (this.lastAction) {
650
649
  await this.lastAction;
651
650
  }
@@ -702,144 +701,154 @@ const STORAGE_TYPE_NAMES = new Map([
702
701
  [Protocol.Storage.StorageType.Websql, i18nLazyString(UIStrings.webSql)],
703
702
  ]);
704
703
 
705
- export const Presets: Preset[] = [
706
- // configID maps to Lighthouse's Object.keys(config.categories)[0] value
707
- {
708
- setting: Common.Settings.Settings.instance().createSetting(
709
- 'lighthouse.cat-perf', true, Common.Settings.SettingStorageType.SYNCED),
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: [
704
+ let presets: LighthouseModel.RunTypes.Preset[]|null = null;
705
+ export function getPresets(): LighthouseModel.RunTypes.Preset[] {
706
+ if (!presets) {
707
+ presets = [
708
+ // configID maps to Lighthouse's Object.keys(config.categories)[0] value
758
709
  {
759
- label: i18nLazyString(UIStrings.mobile),
760
- tooltip: i18nLazyString(UIStrings.applyMobileEmulationDuring),
761
- value: 'mobile'
710
+ setting: Common.Settings.Settings.instance().createSetting(
711
+ 'lighthouse.cat-perf', true, Common.Settings.SettingStorageType.SYNCED),
712
+ configID: 'performance',
713
+ title: i18nLazyString(UIStrings.performance),
714
+ description: i18nLazyString(UIStrings.howLongDoesThisAppTakeToShow),
715
+ supportedModes: ['navigation', 'timespan', 'snapshot'],
716
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed.PERFORMANCE,
762
717
  },
763
718
  {
764
- label: i18nLazyString(UIStrings.desktop),
765
- tooltip: i18nLazyString(UIStrings.applyDesktopEmulationDuring),
766
- value: 'desktop'
719
+ setting: Common.Settings.Settings.instance().createSetting(
720
+ 'lighthouse.cat-a11y', true, Common.Settings.SettingStorageType.SYNCED),
721
+ configID: 'accessibility',
722
+ title: i18nLazyString(UIStrings.accessibility),
723
+ description: i18nLazyString(UIStrings.isThisPageUsableByPeopleWith),
724
+ supportedModes: ['navigation', 'snapshot'],
725
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed.ACCESSIBILITY,
767
726
  },
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
727
  {
780
- label: i18nLazyString(UIStrings.navigation),
781
- tooltip: i18nLazyString(UIStrings.navigationTooltip),
782
- value: 'navigation',
728
+ setting: Common.Settings.Settings.instance().createSetting(
729
+ 'lighthouse.cat-best-practices', true, Common.Settings.SettingStorageType.SYNCED),
730
+ configID: 'best-practices',
731
+ title: i18nLazyString(UIStrings.bestPractices),
732
+ description: i18nLazyString(UIStrings.doesThisPageFollowBestPractices),
733
+ supportedModes: ['navigation', 'timespan', 'snapshot'],
734
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed.BEST_PRACTICES,
783
735
  },
784
736
  {
785
- label: i18nLazyString(UIStrings.timespan),
786
- tooltip: i18nLazyString(UIStrings.timespanTooltip),
787
- value: 'timespan',
737
+ setting: Common.Settings.Settings.instance().createSetting(
738
+ 'lighthouse.cat-seo', true, Common.Settings.SettingStorageType.SYNCED),
739
+ configID: 'seo',
740
+ title: i18nLazyString(UIStrings.seo),
741
+ description: i18nLazyString(UIStrings.isThisPageOptimizedForSearch),
742
+ supportedModes: ['navigation', 'snapshot'],
743
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed.SEO,
788
744
  },
745
+ ];
746
+ }
747
+ return presets;
748
+ }
749
+
750
+ let runtimeSettings: LighthouseModel.RunTypes.RuntimeSetting[]|null = null;
751
+ export function getRuntimeSettings(): LighthouseModel.RunTypes.RuntimeSetting[] {
752
+ if (!runtimeSettings) {
753
+ runtimeSettings = [
789
754
  {
790
- label: i18nLazyString(UIStrings.snapshot),
791
- tooltip: i18nLazyString(UIStrings.snapshotTooltip),
792
- value: 'snapshot',
755
+ setting: Common.Settings.Settings.instance().createSetting(
756
+ 'lighthouse.device-type', 'mobile', Common.Settings.SettingStorageType.SYNCED),
757
+ title: i18nLazyString(UIStrings.applyMobileEmulation),
758
+ description: i18nLazyString(UIStrings.applyMobileEmulationDuring),
759
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
760
+ // See Audits.AuditsPanel._setupEmulationAndProtocolConnection()
761
+ flags.formFactor = value;
762
+ },
763
+ options: [
764
+ {
765
+ label: i18nLazyString(UIStrings.mobile),
766
+ tooltip: i18nLazyString(UIStrings.applyMobileEmulationDuring),
767
+ value: 'mobile'
768
+ },
769
+ {
770
+ label: i18nLazyString(UIStrings.desktop),
771
+ tooltip: i18nLazyString(UIStrings.applyDesktopEmulationDuring),
772
+ value: 'desktop'
773
+ },
774
+ ],
793
775
  },
794
- ],
795
- learnMore: 'https://github.com/GoogleChrome/lighthouse/blob/HEAD/docs/user-flows.md' as
796
- Platform.DevToolsPath.UrlString,
797
- },
798
- {
799
- // This setting is disabled, but we keep it around to show in the UI.
800
- setting: Common.Settings.Settings.instance().createSetting(
801
- 'lighthouse.throttling', 'simulate', Common.Settings.SettingStorageType.SYNCED),
802
- title: i18nLazyString(UIStrings.throttlingMethod),
803
- // We will disable this when we have a Lantern trace viewer within DevTools.
804
- learnMore:
805
- 'https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md#devtools-lighthouse-panel-throttling' as
806
- Platform.DevToolsPath.UrlString,
807
- description: i18nLazyString(UIStrings.simulateASlowerPageLoadBasedOn),
808
- setFlags: (flags: Flags, value: string|boolean) => {
809
- if (typeof value === 'string') {
810
- flags.throttlingMethod = value;
811
- } else {
812
- flags.throttlingMethod = value ? 'simulate' : 'devtools';
813
- }
814
- },
815
- options: [
816
- {label: i18nLazyString(UIStrings.simulatedThrottling), value: 'simulate'},
817
- {label: i18nLazyString(UIStrings.devtoolsThrottling), value: 'devtools'},
818
- ],
819
- },
820
- {
821
- setting: Common.Settings.Settings.instance().createSetting(
822
- 'lighthouse.clear-storage', true, Common.Settings.SettingStorageType.SYNCED),
823
- title: i18nLazyString(UIStrings.clearStorage),
824
- description: i18nLazyString(UIStrings.resetStorageLocalstorage),
825
- setFlags: (flags: Flags, value: string|boolean) => {
826
- flags.disableStorageReset = !value;
827
- },
828
- },
829
- {
830
- setting: Common.Settings.Settings.instance().createSetting(
831
- 'lighthouse.enable-sampling', false, Common.Settings.SettingStorageType.SYNCED),
832
- title: i18nLazyString(UIStrings.enableSampling),
833
- description: i18nLazyString(UIStrings.enableJavaScriptSampling),
834
- setFlags: (flags: Flags, value: string|boolean) => {
835
- if (value) {
836
- flags.additionalTraceCategories = 'disabled-by-default-v8.cpu_profiler';
837
- } else {
838
- flags.additionalTraceCategories = '';
839
- }
840
- },
841
- },
842
- ];
776
+ {
777
+ setting: Common.Settings.Settings.instance().createSetting(
778
+ 'lighthouse.mode', 'navigation', Common.Settings.SettingStorageType.SYNCED),
779
+ title: i18nLazyString(UIStrings.lighthouseMode),
780
+ description: i18nLazyString(UIStrings.runLighthouseInMode),
781
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
782
+ flags.mode = value;
783
+ },
784
+ options: [
785
+ {
786
+ label: i18nLazyString(UIStrings.navigation),
787
+ tooltip: i18nLazyString(UIStrings.navigationTooltip),
788
+ value: 'navigation',
789
+ },
790
+ {
791
+ label: i18nLazyString(UIStrings.timespan),
792
+ tooltip: i18nLazyString(UIStrings.timespanTooltip),
793
+ value: 'timespan',
794
+ },
795
+ {
796
+ label: i18nLazyString(UIStrings.snapshot),
797
+ tooltip: i18nLazyString(UIStrings.snapshotTooltip),
798
+ value: 'snapshot',
799
+ },
800
+ ],
801
+ learnMore: 'https://github.com/GoogleChrome/lighthouse/blob/HEAD/docs/user-flows.md' as
802
+ Platform.DevToolsPath.UrlString,
803
+ },
804
+ {
805
+ // This setting is disabled, but we keep it around to show in the UI.
806
+ setting: Common.Settings.Settings.instance().createSetting(
807
+ 'lighthouse.throttling', 'simulate', Common.Settings.SettingStorageType.SYNCED),
808
+ title: i18nLazyString(UIStrings.throttlingMethod),
809
+ // We will disable this when we have a Lantern trace viewer within DevTools.
810
+ learnMore:
811
+ 'https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md#devtools-lighthouse-panel-throttling' as
812
+ Platform.DevToolsPath.UrlString,
813
+ description: i18nLazyString(UIStrings.simulateASlowerPageLoadBasedOn),
814
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
815
+ if (typeof value === 'string') {
816
+ flags.throttlingMethod = value;
817
+ } else {
818
+ flags.throttlingMethod = value ? 'simulate' : 'devtools';
819
+ }
820
+ },
821
+ options: [
822
+ {label: i18nLazyString(UIStrings.simulatedThrottling), value: 'simulate'},
823
+ {label: i18nLazyString(UIStrings.devtoolsThrottling), value: 'devtools'},
824
+ ],
825
+ },
826
+ {
827
+ setting: Common.Settings.Settings.instance().createSetting(
828
+ 'lighthouse.clear-storage', true, Common.Settings.SettingStorageType.SYNCED),
829
+ title: i18nLazyString(UIStrings.clearStorage),
830
+ description: i18nLazyString(UIStrings.resetStorageLocalstorage),
831
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
832
+ flags.disableStorageReset = !value;
833
+ },
834
+ },
835
+ {
836
+ setting: Common.Settings.Settings.instance().createSetting(
837
+ 'lighthouse.enable-sampling', false, Common.Settings.SettingStorageType.SYNCED),
838
+ title: i18nLazyString(UIStrings.enableSampling),
839
+ description: i18nLazyString(UIStrings.enableJavaScriptSampling),
840
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
841
+ if (value) {
842
+ flags.additionalTraceCategories = 'disabled-by-default-v8.cpu_profiler';
843
+ } else {
844
+ flags.additionalTraceCategories = '';
845
+ }
846
+ },
847
+ },
848
+ ];
849
+ }
850
+ return runtimeSettings;
851
+ }
843
852
 
844
853
  export enum Events {
845
854
  /* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
@@ -866,26 +875,3 @@ export interface EventTypes {
866
875
  [Events.PageWarningsChanged]: PageWarningsChangedEvent;
867
876
  [Events.AuditProgressChanged]: AuditProgressChangedEvent;
868
877
  }
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);
@@ -392,7 +391,7 @@ export class LighthousePanel extends UI.Panel.Panel {
392
391
  }
393
392
 
394
393
  static async executeLighthouseRecording(
395
- overrides?: RunOverrides,
394
+ overrides?: LighthouseModel.RunTypes.RunOverrides,
396
395
  ): Promise<LighthouseModel.ReporterTypes.ReportJSON|null> {
397
396
  const panel = LighthousePanel.instance();
398
397
  await UI.ViewManager.ViewManager.instance().showView('lighthouse');
@@ -401,7 +400,3 @@ export class LighthousePanel extends UI.Panel.Panel {
401
400
  return report;
402
401
  }
403
402
  }
404
-
405
- export interface RunOverrides {
406
- categoryIds: CategoryId[];
407
- }
@@ -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 {type LighthouseController, type Preset, Presets, RuntimeSettings} from './LighthouseController.js';
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 = RuntimeSettings.find(item => item.setting.name === settingName);
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 = RuntimeSettings.find(item => item.setting.name === settingName);
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 = RuntimeSettings.find(item => item.setting.name === settingName);
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 Presets) {
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');
@@ -9,7 +9,7 @@ import * as Buttons from '../../ui/components/buttons/buttons.js';
9
9
  import * as UI from '../../ui/legacy/legacy.js';
10
10
  import * as Lit from '../../ui/lit/lit.js';
11
11
 
12
- import {RuntimeSettings} from './LighthouseController.js';
12
+ import {getRuntimeSettings} from './LighthouseController.js';
13
13
  import lighthouseDialogStyles from './lighthouseDialog.css.js';
14
14
  import type {LighthousePanel} from './LighthousePanel.js';
15
15
 
@@ -378,8 +378,8 @@ export class StatusView {
378
378
  return phase.message();
379
379
  }
380
380
 
381
- const deviceTypeSetting = RuntimeSettings.find(item => item.setting.name === 'lighthouse.device-type');
382
- const throttleSetting = RuntimeSettings.find(item => item.setting.name === 'lighthouse.throttling');
381
+ const deviceTypeSetting = getRuntimeSettings().find(item => item.setting.name === 'lighthouse.device-type');
382
+ const throttleSetting = getRuntimeSettings().find(item => item.setting.name === 'lighthouse.throttling');
383
383
  const deviceType = deviceTypeSetting ? deviceTypeSetting.setting.get() : '';
384
384
  const throttling = throttleSetting ? throttleSetting.setting.get() : '';
385
385
  const match = LoadingMessages.find(item => {
@@ -425,17 +425,21 @@ export class LinearMemoryInspector extends Common.ObjectWrapper.eventMixin<Event
425
425
  }
426
426
 
427
427
  #onValueTypeToggled(type: ValueType, checked: boolean): void {
428
+ const valueTypes = new Set(this.#valueTypes);
428
429
  if (checked) {
429
- this.#valueTypes.add(type);
430
+ valueTypes.add(type);
430
431
  } else {
431
- this.#valueTypes.delete(type);
432
+ valueTypes.delete(type);
432
433
  }
434
+ this.#valueTypes = valueTypes;
433
435
  this.dispatchEventToListeners(Events.SETTINGS_CHANGED, this.#createSettings());
434
436
  void this.requestUpdate();
435
437
  }
436
438
 
437
439
  #onValueTypeModeChanged(type: ValueType, mode: ValueTypeMode): void {
438
- this.#valueTypeModes.set(type, mode);
440
+ const valueTypeModes = new Map(this.#valueTypeModes);
441
+ valueTypeModes.set(type, mode);
442
+ this.#valueTypeModes = valueTypeModes;
439
443
  this.dispatchEventToListeners(Events.SETTINGS_CHANGED, this.#createSettings());
440
444
  void this.requestUpdate();
441
445
  }
@@ -24,7 +24,7 @@ import * as PanelUtils from '../utils/utils.js';
24
24
  import requestConditionsDrawerStyles from './requestConditionsDrawer.css.js';
25
25
 
26
26
  const {ref, live} = Directives;
27
- const {widgetConfig} = UI.Widget;
27
+ const {widget} = UI.Widget;
28
28
 
29
29
  const UIStrings = {
30
30
  /**
@@ -175,7 +175,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
175
175
  ${i18nString(UIStrings.addRule)}
176
176
  </devtools-button>
177
177
  </div>
178
- <devtools-widget .widgetConfig=${UI.Widget.widgetConfig(UI.Widget.VBox)}>
178
+ <devtools-widget ${widget(UI.Widget.VBox)}>
179
179
  ${input.list.element}
180
180
  </devtools-widget>
181
181
  `,
@@ -271,7 +271,7 @@ function renderItem(
271
271
  <devtools-widget
272
272
  class=conditions-selector
273
273
  title=${i18nString(UIStrings.requestConditionsLabel)}
274
- .widgetConfig=${UI.Widget.widgetConfig(
274
+ ${widget(
275
275
  MobileThrottling.NetworkThrottlingSelector.NetworkThrottlingSelectorWidget, {
276
276
  variant:
277
277
  MobileThrottling.NetworkThrottlingSelector.NetworkThrottlingSelect.Variant.INDIVIDUAL_REQUEST_CONDITIONS,
@@ -282,7 +282,7 @@ function renderItem(
282
282
  })}></devtools-widget>
283
283
  <devtools-widget
284
284
  ?disabled=${!editable || !originalOrUpgradedURLPattern}
285
- .widgetConfig=${widgetConfig(AffectedCountWidget, {condition, lookUpRequestCount})}></devtools-widget>`;
285
+ ${widget(AffectedCountWidget, {condition, lookUpRequestCount})}></devtools-widget>`;
286
286
  // clang-format on
287
287
  }
288
288
 
@@ -113,7 +113,7 @@ export const DEFAULT_VIEW: ViewFunction = (input, _output, target) => {
113
113
  </div>
114
114
 
115
115
  ${input.requestCookies.cookies.length > 0 ? html`
116
- <devtools-widget .widgetConfig=${UI.Widget.widgetConfig(CookieTable.CookiesTable.CookiesTable, {
116
+ <devtools-widget ${widget(CookieTable.CookiesTable.CookiesTable, {
117
117
  cookiesData: input.requestCookies,
118
118
  inline: true
119
119
  })} class="cookie-table cookies-panel-item"></devtools-widget>
@@ -131,7 +131,7 @@ export const DEFAULT_VIEW: ViewFunction = (input, _output, target) => {
131
131
  </div>
132
132
 
133
133
  ${input.responseCookies.cookies.length ? html`
134
- <devtools-widget .widgetConfig=${UI.Widget.widgetConfig(CookieTable.CookiesTable.CookiesTable, {
134
+ <devtools-widget ${widget(CookieTable.CookiesTable.CookiesTable, {
135
135
  cookiesData: input.responseCookies,
136
136
  inline: true })} class="cookie-table cookies-panel-item"></devtools-widget>
137
137
  ` : Lit.nothing}
@@ -21,6 +21,7 @@ import * as NetworkComponents from './components/components.js';
21
21
  import {ShowMoreDetailsWidget} from './ShowMoreDetailsWidget.js';
22
22
 
23
23
  const {render, html} = Lit;
24
+ const {widget} = UI.Widget;
24
25
 
25
26
  const UIStrings = {
26
27
  /**
@@ -210,8 +211,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
210
211
  contents: (input.showRequestHeadersText && requestHeadersText) ?
211
212
  renderRawHeaders(requestHeadersText) :
212
213
  html`
213
- <devtools-widget .widgetConfig=${
214
- UI.Widget.widgetConfig(NetworkComponents.RequestHeaderSection.RequestHeaderSection, {
214
+ <devtools-widget ${widget(NetworkComponents.RequestHeaderSection.RequestHeaderSection, {
215
215
  request: input.request,
216
216
  toReveal: input.toReveal,
217
217
  })} jslog=${VisualLogging.section('request-headers')}></devtools-widget>`
@@ -392,8 +392,8 @@ function renderHeaderOverridesLink(input: ViewInput): Lit.LitTemplate {
392
392
  }
393
393
 
394
394
  function renderRawHeaders(text: string): Lit.TemplateResult {
395
- return html`<div class="row raw-headers-row"><devtools-widget class=raw-headers .widgetConfig=${
396
- UI.Widget.widgetConfig(ShowMoreDetailsWidget, {text})}></devtools-widget></div>`;
395
+ return html`<div class="row raw-headers-row"><devtools-widget class=raw-headers
396
+ ${widget(ShowMoreDetailsWidget, {text})}></devtools-widget></div>`;
397
397
  }
398
398
 
399
399
  function renderGeneralRow(
@@ -43,7 +43,7 @@ export interface ViewOutput {
43
43
  revealPosition: (position: SourceFrame.SourceFrame.RevealPosition) => Promise<void>;
44
44
  }
45
45
 
46
- const {widgetConfig, widgetRef, widget} = UI.Widget;
46
+ const {widgetRef, widget} = UI.Widget;
47
47
  type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
48
48
 
49
49
  export const DEFAULT_VIEW: View = (input: ViewInput, output: ViewOutput, target: HTMLElement): void => {
@@ -62,7 +62,7 @@ export const DEFAULT_VIEW: View = (input: ViewInput, output: ViewOutput, target:
62
62
  // clang-format on
63
63
  } else if (input.renderAsText) {
64
64
  // clang-format off
65
- widgetTemplate = html`<devtools-widget .widgetConfig=${widgetConfig(element => new SourceFrame.ResourceSourceFrame.SearchableContainer(
65
+ widgetTemplate = html`<devtools-widget ${widget(element => new SourceFrame.ResourceSourceFrame.SearchableContainer(
66
66
  input.request, input.mimeType, element))}
67
67
  ${widgetRef(SourceFrame.ResourceSourceFrame.SearchableContainer, widget => {output.revealPosition = widget.revealPosition.bind(widget);})}></devtools-widget>`;
68
68
  // clang-format on
@@ -58,7 +58,7 @@ const UIStrings = {
58
58
  } as const;
59
59
  const str_ = i18n.i18n.registerUIStrings('panels/performance_monitor/PerformanceMonitor.ts', UIStrings);
60
60
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
61
- const {widgetConfig} = UI.Widget;
61
+ const {widget} = UI.Widget;
62
62
  const {classMap, ref} = Directives;
63
63
 
64
64
  interface PerformanceMonitorInput {
@@ -81,7 +81,7 @@ type PerformanceMonitorView = (input: PerformanceMonitorInput, output: Performan
81
81
  const DEFAULT_VIEW: PerformanceMonitorView = (input, output, target) => {
82
82
  // clang-format off
83
83
  render(html`
84
- <devtools-widget .widgetConfig=${widgetConfig(ControlPane, {
84
+ <devtools-widget ${widget(ControlPane, {
85
85
  onMetricChanged: input.onMetricChanged,
86
86
  chartsInfo: input.chartsInfo,
87
87
  metrics: input.metrics