chrome-devtools-frontend 1.0.1548980 → 1.0.1550444

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 (323) hide show
  1. package/docs/contributing/settings-experiments-features.md +35 -0
  2. package/docs/styleguide/ux/components.md +53 -12
  3. package/docs/styleguide/ux/images/cards.png +0 -0
  4. package/docs/styleguide/ux/patterns.md +27 -0
  5. package/docs/ui_engineering.md +2 -2
  6. package/eslint.config.mjs +1 -0
  7. package/front_end/Tests.js +2 -0
  8. package/front_end/core/host/InspectorFrontendHost.ts +26 -558
  9. package/front_end/core/host/InspectorFrontendHostAPI.ts +6 -3
  10. package/front_end/core/host/InspectorFrontendHostStub.ts +558 -0
  11. package/front_end/core/host/ResourceLoader.ts +9 -23
  12. package/front_end/core/host/UserMetrics.ts +4 -4
  13. package/front_end/core/root/DevToolsContext.ts +4 -0
  14. package/front_end/core/root/Runtime.ts +10 -0
  15. package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
  16. package/front_end/core/sdk/CSSModel.ts +24 -24
  17. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +11 -11
  18. package/front_end/core/sdk/CSSQuery.ts +1 -1
  19. package/front_end/core/sdk/CSSRule.ts +2 -2
  20. package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
  21. package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
  22. package/front_end/core/sdk/DOMModel.ts +3 -0
  23. package/front_end/core/sdk/NetworkManager.ts +41 -41
  24. package/front_end/core/sdk/NetworkRequest.ts +4 -0
  25. package/front_end/core/sdk/OverlayModel.ts +2 -2
  26. package/front_end/core/sdk/PageResourceLoader.ts +71 -38
  27. package/front_end/core/sdk/SourceMap.ts +6 -0
  28. package/front_end/core/sdk/SourceMapCache.ts +21 -0
  29. package/front_end/core/sdk/SourceMapManager.ts +14 -7
  30. package/front_end/core/sdk/SourceMapScopesInfo.ts +6 -2
  31. package/front_end/core/sdk/TargetManager.ts +14 -2
  32. package/front_end/core/sdk/sdk-meta.ts +13 -0
  33. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
  34. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +1 -1
  35. package/front_end/entrypoints/main/MainImpl.ts +5 -4
  36. package/front_end/foundation/Universe.ts +8 -1
  37. package/front_end/generated/Deprecation.ts +18 -4
  38. package/front_end/generated/InspectorBackendCommands.ts +38 -33
  39. package/front_end/generated/SupportedCSSProperties.js +41 -41
  40. package/front_end/generated/protocol-mapping.d.ts +20 -0
  41. package/front_end/generated/protocol-proxy-api.d.ts +17 -0
  42. package/front_end/generated/protocol.ts +146 -35
  43. package/front_end/models/ai_assistance/AiConversation.ts +5 -4
  44. package/front_end/models/ai_assistance/BuiltInAi.ts +79 -5
  45. package/front_end/models/ai_assistance/ChangeManager.ts +4 -4
  46. package/front_end/models/ai_assistance/ConversationHandler.ts +0 -15
  47. package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -6
  48. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +135 -3
  49. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +24 -0
  50. package/front_end/models/bindings/CompilerScriptMapping.ts +43 -0
  51. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +19 -0
  52. package/front_end/models/bindings/ResourceMapping.ts +73 -0
  53. package/front_end/models/bindings/ResourceScriptMapping.ts +50 -0
  54. package/front_end/models/issues_manager/AttributionReportingIssue.ts +6 -8
  55. package/front_end/models/issues_manager/BounceTrackingIssue.ts +4 -14
  56. package/front_end/models/issues_manager/ClientHintIssue.ts +5 -12
  57. package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +5 -12
  58. package/front_end/models/issues_manager/CookieDeprecationMetadataIssue.ts +7 -14
  59. package/front_end/models/issues_manager/CookieIssue.ts +27 -30
  60. package/front_end/models/issues_manager/CorsIssue.ts +8 -17
  61. package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -8
  62. package/front_end/models/issues_manager/DeprecationIssue.ts +7 -14
  63. package/front_end/models/issues_manager/ElementAccessibilityIssue.ts +7 -14
  64. package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +4 -11
  65. package/front_end/models/issues_manager/FederatedAuthUserInfoRequestIssue.ts +4 -11
  66. package/front_end/models/issues_manager/GenericIssue.ts +28 -16
  67. package/front_end/models/issues_manager/HeavyAdIssue.ts +4 -11
  68. package/front_end/models/issues_manager/Issue.ts +12 -4
  69. package/front_end/models/issues_manager/IssueAggregator.ts +8 -2
  70. package/front_end/models/issues_manager/LowTextContrastIssue.ts +3 -10
  71. package/front_end/models/issues_manager/MixedContentIssue.ts +7 -13
  72. package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +4 -11
  73. package/front_end/models/issues_manager/PropertyRuleIssue.ts +6 -12
  74. package/front_end/models/issues_manager/QuirksModeIssue.ts +3 -10
  75. package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +7 -13
  76. package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +4 -11
  77. package/front_end/models/issues_manager/SharedDictionaryIssue.ts +6 -13
  78. package/front_end/models/issues_manager/StylesheetLoadingIssue.ts +8 -13
  79. package/front_end/models/issues_manager/UnencodedDigestIssue.ts +2 -9
  80. package/front_end/models/issues_manager/descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
  81. package/front_end/models/javascript_metadata/NativeFunctions.js +7 -16
  82. package/front_end/models/source_map_scopes/FunctionCodeResolver.snapshot.txt +98 -0
  83. package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +270 -0
  84. package/front_end/models/source_map_scopes/source_map_scopes.ts +2 -0
  85. package/front_end/models/workspace/UISourceCode.ts +51 -44
  86. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +76 -34
  87. package/front_end/panels/ai_assistance/aiAssistancePanel.css +1 -0
  88. package/front_end/panels/ai_assistance/components/ChatView.ts +23 -11
  89. package/front_end/panels/application/AppManifestView.ts +7 -6
  90. package/front_end/panels/application/ApplicationPanelSidebar.ts +21 -21
  91. package/front_end/panels/application/BackForwardCacheTreeElement.ts +2 -2
  92. package/front_end/panels/application/BounceTrackingMitigationsTreeElement.ts +2 -2
  93. package/front_end/panels/application/FrameDetailsView.ts +5 -6
  94. package/front_end/panels/application/InterestGroupTreeElement.ts +2 -2
  95. package/front_end/panels/application/OpenedWindowDetailsView.ts +2 -2
  96. package/front_end/panels/application/OriginTrialTreeView.ts +1 -1
  97. package/front_end/panels/application/PreloadingTreeElement.ts +3 -3
  98. package/front_end/panels/application/ReportingApiTreeElement.ts +2 -2
  99. package/front_end/panels/application/ServiceWorkerCacheTreeElement.ts +3 -3
  100. package/front_end/panels/application/ServiceWorkersView.ts +2 -2
  101. package/front_end/panels/application/SharedStorageListTreeElement.ts +2 -2
  102. package/front_end/panels/application/StorageBucketsTreeElement.ts +3 -3
  103. package/front_end/panels/application/StorageView.ts +2 -2
  104. package/front_end/panels/application/TrustTokensTreeElement.ts +4 -8
  105. package/front_end/panels/application/components/PermissionsPolicySection.ts +202 -158
  106. package/front_end/panels/application/components/ProtocolHandlersView.ts +118 -81
  107. package/front_end/panels/application/components/ServiceWorkerRouterView.ts +47 -41
  108. package/front_end/panels/application/components/SharedStorageMetadataView.ts +1 -1
  109. package/front_end/panels/application/components/StorageMetadataView.ts +31 -34
  110. package/front_end/panels/application/components/TrustTokensView.ts +77 -69
  111. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +1 -1
  112. package/front_end/panels/application/preloading/components/RuleSetGrid.ts +1 -1
  113. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +1 -1
  114. package/front_end/panels/changes/ChangesSidebar.ts +2 -0
  115. package/front_end/panels/changes/CombinedDiffView.ts +2 -0
  116. package/front_end/panels/common/AnnotationManager.ts +71 -0
  117. package/front_end/panels/common/PersistenceUtils.ts +6 -7
  118. package/front_end/panels/common/common.ts +1 -0
  119. package/front_end/panels/console/ConsolePrompt.ts +4 -4
  120. package/front_end/panels/console/ConsoleView.ts +5 -4
  121. package/front_end/panels/console/ConsoleViewMessage.ts +16 -15
  122. package/front_end/panels/console/console-meta.ts +0 -13
  123. package/front_end/panels/console_counters/WarningErrorCounter.ts +2 -0
  124. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +1 -1
  125. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +3 -1
  126. package/front_end/panels/elements/CSSRuleValidator.ts +7 -7
  127. package/front_end/panels/elements/CSSRuleValidatorHelper.ts +2 -2
  128. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +3 -3
  129. package/front_end/panels/elements/ElementsPanel.ts +49 -0
  130. package/front_end/panels/elements/ElementsTreeElement.ts +172 -121
  131. package/front_end/panels/elements/ElementsTreeOutline.ts +11 -3
  132. package/front_end/panels/elements/LayoutPane.ts +12 -10
  133. package/front_end/panels/elements/ShortcutTreeElement.ts +2 -2
  134. package/front_end/panels/elements/StyleEditorWidget.ts +2 -2
  135. package/front_end/panels/elements/StylePropertyTreeElement.ts +18 -18
  136. package/front_end/panels/elements/StylesSidebarPane.ts +4 -5
  137. package/front_end/panels/elements/TopLayerContainer.ts +2 -2
  138. package/front_end/panels/elements/components/AdornerManager.ts +3 -3
  139. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
  140. package/front_end/panels/elements/components/ElementsTreeExpandButton.ts +1 -1
  141. package/front_end/panels/elements/components/QueryContainer.ts +1 -1
  142. package/front_end/panels/elements/components/StylePropertyEditor.ts +7 -7
  143. package/front_end/panels/emulation/DeviceModeWrapper.ts +48 -3
  144. package/front_end/panels/explain/components/ConsoleInsight.ts +6 -4
  145. package/front_end/panels/issues/AffectedResourcesView.ts +2 -2
  146. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +2 -2
  147. package/front_end/panels/issues/IssueKindView.ts +2 -2
  148. package/front_end/panels/issues/IssueView.ts +4 -4
  149. package/front_end/panels/js_timeline/js_timeline-meta.ts +4 -2
  150. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +28 -50
  151. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +15 -11
  152. package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +1 -1
  153. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +1 -1
  154. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts +1 -1
  155. package/front_end/panels/media/PlayerListView.ts +100 -73
  156. package/front_end/panels/media/playerListView.css +5 -0
  157. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +2 -2
  158. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +4 -5
  159. package/front_end/panels/network/NetworkDataGridNode.ts +3 -3
  160. package/front_end/panels/network/NetworkFrameGrouper.ts +2 -2
  161. package/front_end/panels/network/NetworkItemView.ts +4 -4
  162. package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
  163. package/front_end/panels/network/RequestConditionsDrawer.ts +5 -5
  164. package/front_end/panels/network/RequestCookiesView.ts +2 -2
  165. package/front_end/panels/network/SignedExchangeInfoView.ts +2 -2
  166. package/front_end/panels/network/components/DirectSocketConnectionView.ts +17 -0
  167. package/front_end/panels/network/components/RequestTrustTokensView.ts +5 -6
  168. package/front_end/panels/network/resourceChunkView.css +4 -0
  169. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +3 -3
  170. package/front_end/panels/profiler/ProfileDataGrid.ts +2 -2
  171. package/front_end/panels/profiler/ProfilesPanel.ts +2 -2
  172. package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
  173. package/front_end/panels/recorder/components/CreateRecordingView.ts +1 -1
  174. package/front_end/panels/recorder/components/ExtensionView.ts +1 -1
  175. package/front_end/panels/recorder/components/RecordingListView.ts +1 -1
  176. package/front_end/panels/recorder/components/RecordingView.ts +1 -1
  177. package/front_end/panels/recorder/components/StepView.ts +1 -1
  178. package/front_end/panels/screencast/ScreencastView.ts +8 -8
  179. package/front_end/panels/search/SearchView.ts +1 -1
  180. package/front_end/panels/security/CookieControlsTreeElement.ts +2 -2
  181. package/front_end/panels/security/CookieControlsView.ts +1 -1
  182. package/front_end/panels/security/CookieReportTreeElement.ts +2 -2
  183. package/front_end/panels/security/SecurityPanel.ts +5 -5
  184. package/front_end/panels/security/SecurityPanelSidebar.ts +3 -4
  185. package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
  186. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +1 -1
  187. package/front_end/panels/settings/KeybindsSettingsTab.ts +5 -5
  188. package/front_end/panels/settings/SettingsScreen.ts +7 -8
  189. package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
  190. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +1 -1
  191. package/front_end/panels/snippets/SnippetsQuickOpen.ts +16 -6
  192. package/front_end/panels/sources/BreakpointEditDialog.ts +3 -3
  193. package/front_end/panels/sources/BreakpointsView.ts +1 -1
  194. package/front_end/panels/sources/CSSPlugin.ts +4 -4
  195. package/front_end/panels/sources/CallStackSidebarPane.ts +4 -4
  196. package/front_end/panels/sources/DebuggerPausedMessage.ts +3 -3
  197. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +40 -23
  198. package/front_end/panels/sources/GoToLineQuickOpen.ts +11 -5
  199. package/front_end/panels/sources/NavigatorView.ts +4 -4
  200. package/front_end/panels/sources/OpenFileQuickOpen.ts +11 -16
  201. package/front_end/panels/sources/OutlineQuickOpen.ts +23 -23
  202. package/front_end/panels/sources/ProfilePlugin.ts +21 -12
  203. package/front_end/panels/sources/SourcesView.ts +2 -2
  204. package/front_end/panels/sources/TabbedEditorContainer.ts +4 -5
  205. package/front_end/panels/sources/ThreadsSidebarPane.ts +2 -2
  206. package/front_end/panels/sources/UISourceCodeFrame.ts +5 -6
  207. package/front_end/panels/sources/filteredUISourceCodeListProvider.css +41 -0
  208. package/front_end/panels/timeline/TimelineHistoryManager.ts +2 -2
  209. package/front_end/panels/timeline/TimelinePanel.ts +29 -25
  210. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +3 -3
  211. package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +1 -1
  212. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
  213. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +1 -1
  214. package/front_end/panels/timeline/components/NetworkThrottlingSelector.ts +1 -1
  215. package/front_end/panels/timeline/components/OriginMap.ts +1 -1
  216. package/front_end/panels/timeline/components/insights/Checklist.ts +1 -1
  217. package/front_end/panels/timeline/components/insights/DOMSize.ts +1 -1
  218. package/front_end/panels/timeline/components/insights/ImageDelivery.ts +1 -1
  219. package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +1 -1
  220. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
  221. package/front_end/panels/timeline/docs/flame_chart_migration.md +11 -16
  222. package/front_end/panels/timeline/overlays/components/EntriesLinkOverlay.ts +1 -1
  223. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +1 -1
  224. package/front_end/panels/timeline/timeline-meta.ts +3 -2
  225. package/front_end/panels/utils/utils.ts +18 -3
  226. package/front_end/panels/whats_new/ReleaseNoteText.ts +10 -20
  227. package/front_end/panels/whats_new/resources/WNDT.md +8 -8
  228. package/front_end/third_party/chromium/README.chromium +1 -1
  229. package/front_end/third_party/puppeteer/third_party/mitt/README.chromium +1 -0
  230. package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -0
  231. package/front_end/third_party/puppeteer/third_party/rxjs/README.chromium +1 -0
  232. package/front_end/ui/components/adorners/Adorner.ts +21 -1
  233. package/front_end/ui/components/annotations/AnnotationRepository.ts +98 -0
  234. package/front_end/ui/components/annotations/AnnotationType.ts +10 -0
  235. package/front_end/ui/components/annotations/annotations.ts +6 -0
  236. package/front_end/ui/components/buttons/Button.ts +2 -2
  237. package/front_end/ui/components/buttons/FloatingButton.ts +2 -2
  238. package/front_end/ui/components/chrome_link/ChromeLink.ts +1 -1
  239. package/front_end/ui/components/dialogs/ButtonDialog.ts +1 -1
  240. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  241. package/front_end/ui/components/dialogs/ShortcutDialog.ts +1 -0
  242. package/front_end/ui/components/diff_view/DiffView.ts +1 -1
  243. package/front_end/ui/components/expandable_list/ExpandableList.ts +1 -1
  244. package/front_end/ui/components/highlighting/HighlightElement.ts +16 -2
  245. package/front_end/ui/components/highlighting/MarkupHighlight.ts +162 -0
  246. package/front_end/ui/components/highlighting/highlighting.ts +7 -0
  247. package/front_end/ui/components/icon_button/FileSourceIcon.ts +2 -2
  248. package/front_end/ui/components/icon_button/IconButton.ts +2 -2
  249. package/front_end/ui/components/icon_button/icon_button.ts +0 -2
  250. package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
  251. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +2 -2
  252. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +1 -1
  253. package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
  254. package/front_end/ui/components/list/List.ts +184 -0
  255. package/front_end/ui/components/list/list.css +90 -0
  256. package/front_end/ui/components/{cards/cards.ts → list/lists.ts} +3 -3
  257. package/front_end/ui/components/markdown_view/CodeBlock.ts +1 -1
  258. package/front_end/ui/components/markdown_view/MarkdownImage.ts +4 -4
  259. package/front_end/ui/components/markdown_view/MarkdownLink.ts +1 -1
  260. package/front_end/ui/components/markdown_view/MarkdownView.ts +1 -1
  261. package/front_end/ui/components/menus/Menu.ts +1 -1
  262. package/front_end/ui/components/menus/SelectMenu.ts +1 -1
  263. package/front_end/ui/components/node_text/NodeText.ts +1 -1
  264. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +1 -1
  265. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +1 -1
  266. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
  267. package/front_end/ui/components/panel_introduction_steps/PanelIntroductionSteps.ts +1 -1
  268. package/front_end/ui/components/report_view/ReportView.ts +1 -1
  269. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +2 -2
  270. package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
  271. package/front_end/ui/components/settings/SettingDeprecationWarning.ts +2 -2
  272. package/front_end/ui/components/snackbars/Snackbar.ts +1 -1
  273. package/front_end/ui/components/spinners/Spinner.ts +1 -1
  274. package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
  275. package/front_end/ui/components/suggestion_input/SuggestionInput.ts +1 -0
  276. package/front_end/ui/components/survey_link/SurveyLink.ts +2 -2
  277. package/front_end/ui/components/switch/SwitchImpl.ts +1 -1
  278. package/front_end/ui/components/text_editor/TextEditor.ts +1 -0
  279. package/front_end/ui/components/text_editor/config.ts +2 -2
  280. package/front_end/ui/components/text_prompt/TextPrompt.ts +1 -1
  281. package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
  282. package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -1
  283. package/front_end/ui/kit/cards/Card.docs.ts +43 -0
  284. package/front_end/ui/{components/icon_button → kit/icons}/Icon.docs.ts +3 -4
  285. package/front_end/ui/{components/icon_button → kit/icons}/Icon.ts +6 -4
  286. package/front_end/ui/kit/kit.ts +6 -0
  287. package/front_end/ui/legacy/Infobar.ts +3 -3
  288. package/front_end/ui/legacy/InspectorView.ts +3 -3
  289. package/front_end/ui/legacy/SearchableView.ts +2 -2
  290. package/front_end/ui/legacy/SoftContextMenu.ts +5 -5
  291. package/front_end/ui/legacy/SoftDropDown.ts +2 -2
  292. package/front_end/ui/legacy/TabbedPane.ts +106 -8
  293. package/front_end/ui/legacy/Toolbar.ts +3 -3
  294. package/front_end/ui/legacy/Treeoutline.ts +2 -2
  295. package/front_end/ui/legacy/UIUtils.ts +4 -188
  296. package/front_end/ui/legacy/ViewManager.ts +27 -12
  297. package/front_end/ui/legacy/ViewRegistration.ts +21 -22
  298. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +8 -8
  299. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +4 -4
  300. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +4 -4
  301. package/front_end/ui/legacy/components/inline_editor/FontEditor.ts +2 -2
  302. package/front_end/ui/legacy/components/inline_editor/Swatches.ts +5 -5
  303. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +3 -3
  304. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +5 -4
  305. package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +73 -35
  306. package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +11 -2
  307. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +3 -3
  308. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +23 -31
  309. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +11 -27
  310. package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +11 -15
  311. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +18 -65
  312. package/front_end/ui/legacy/components/source_frame/JSONView.ts +2 -1
  313. package/front_end/ui/legacy/components/utils/Linkifier.ts +3 -3
  314. package/front_end/ui/legacy/tabbedPane.css +10 -0
  315. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
  316. package/inspector_overlay/README.md +3 -3
  317. package/mcp/HostBindings.ts +310 -0
  318. package/mcp/mcp.ts +18 -0
  319. package/mcp/tsconfig.json +6 -1
  320. package/package.json +26 -24
  321. /package/front_end/ui/{components → kit}/cards/Card.ts +0 -0
  322. /package/front_end/ui/{components → kit}/cards/card.css +0 -0
  323. /package/front_end/ui/{components/icon_button → kit/icons}/icon.css +0 -0
@@ -1,61 +1,67 @@
1
1
  // Copyright 2023 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 */
5
4
 
6
5
  import type * as SDK from '../../../core/sdk/sdk.js';
7
- import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wrapper.js';
8
- import * as Lit from '../../../ui/lit/lit.js';
6
+ import * as UI from '../../../ui/legacy/legacy.js';
7
+ import {html, render, type TemplateResult} from '../../../ui/lit/lit.js';
9
8
 
10
9
  import serviceWorkerRouterViewStyles from './serviceWorkerRouterView.css.js';
11
10
 
12
- const {html, render} = Lit;
11
+ function renderRouterRule(rule: SDK.ServiceWorkerManager.ServiceWorkerRouterRule): TemplateResult {
12
+ return html`
13
+ <li class="router-rule">
14
+ <div class="rule-id">Rule ${rule.id}</div>
15
+ <ul class="item">
16
+ <li class="condition">
17
+ <div class="rule-type">Condition</div>
18
+ <div class="rule-value">${rule.condition}</div>
19
+ </li>
20
+ <li class="source">
21
+ <div class="rule-type">Source</div>
22
+ <div class="rule-value">${rule.source}</div>
23
+ </li>
24
+ </ul>
25
+ </li>`;
26
+ }
27
+
28
+ interface ViewInterface {
29
+ rules: SDK.ServiceWorkerManager.ServiceWorkerRouterRule[];
30
+ }
13
31
 
14
- export class ServiceWorkerRouterView extends LegacyWrapper.LegacyWrapper.WrappableComponent {
15
- readonly #shadow = this.attachShadow({mode: 'open'});
32
+ type View = (input: ViewInterface, output: undefined, target: HTMLElement) => void;
33
+
34
+ const DEFAULT_VIEW: View = (input, _output, target) => {
35
+ // clang-format off
36
+ render(html`
37
+ <style>${serviceWorkerRouterViewStyles}</style>
38
+ <ul class="router-rules">
39
+ ${input.rules.map(renderRouterRule)}
40
+ </ul>`, target);
41
+ // clang-format on
42
+ };
43
+
44
+ export class ServiceWorkerRouterView extends UI.Widget.Widget {
16
45
  #rules: SDK.ServiceWorkerManager.ServiceWorkerRouterRule[] = [];
46
+ #view: View;
17
47
 
18
- update(rules: SDK.ServiceWorkerManager.ServiceWorkerRouterRule[]): void {
48
+ constructor(element?: HTMLElement, view = DEFAULT_VIEW) {
49
+ super(element, {useShadowDom: true});
50
+ this.#view = view;
51
+ }
52
+
53
+ set rules(rules: SDK.ServiceWorkerManager.ServiceWorkerRouterRule[]) {
19
54
  this.#rules = rules;
20
55
  if (this.#rules.length > 0) {
21
- this.#render();
56
+ this.requestUpdate();
22
57
  }
23
58
  }
24
59
 
25
- #render(): void {
26
- // clang-format off
27
- render(html`
28
- <style>${serviceWorkerRouterViewStyles}</style>
29
- <ul class="router-rules">
30
- ${this.#rules.map(this.#renderRouterRule)}
31
- </ul>
32
- `, this.#shadow, {host: this});
33
- // clang-format on
34
- }
35
-
36
- #renderRouterRule(rule: SDK.ServiceWorkerManager.ServiceWorkerRouterRule): Lit.TemplateResult {
37
- return html`
38
- <li class="router-rule">
39
- <div class="rule-id">Rule ${rule.id}</div>
40
- <ul class="item">
41
- <li class="condition">
42
- <div class="rule-type">Condition</div>
43
- <div class="rule-value">${rule.condition}</div>
44
- </li>
45
- <li class="source">
46
- <div class="rule-type">Source</div>
47
- <div class="rule-value">${rule.source}</div>
48
- </li>
49
- </ul>
50
- </li>
51
- `;
60
+ get rules(): SDK.ServiceWorkerManager.ServiceWorkerRouterRule[] {
61
+ return this.#rules;
52
62
  }
53
- }
54
-
55
- customElements.define('devtools-service-worker-router-view', ServiceWorkerRouterView);
56
63
 
57
- declare global {
58
- interface HTMLElementTagNameMap {
59
- 'devtools-service-worker-router-view': ServiceWorkerRouterView;
64
+ override performUpdate(): void {
65
+ this.#view({rules: this.#rules}, undefined, this.contentElement);
60
66
  }
61
67
  }
@@ -2,7 +2,7 @@
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
4
 
5
- import '../../../ui/components/icon_button/icon_button.js';
5
+ import '../../../ui/kit/kit.js';
6
6
 
7
7
  import * as i18n from '../../../core/i18n/i18n.js';
8
8
  import type * as Protocol from '../../../generated/protocol.js';
@@ -12,12 +12,10 @@ import * as Buttons from '../../../ui/components/buttons/buttons.js';
12
12
  import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wrapper.js';
13
13
  import * as RenderCoordinator from '../../../ui/components/render_coordinator/render_coordinator.js';
14
14
  import * as UI from '../../../ui/legacy/legacy.js';
15
- import * as Lit from '../../../ui/lit/lit.js';
15
+ import {html, type LitTemplate, nothing, render, type TemplateResult} from '../../../ui/lit/lit.js';
16
16
 
17
17
  import storageMetadataViewStyle from './storageMetadataView.css.js';
18
18
 
19
- const {html} = Lit;
20
-
21
19
  const UIStrings = {
22
20
  /**
23
21
  * @description The origin of a URL (https://web.dev/same-site-same-origin/#origin).
@@ -147,10 +145,8 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
147
145
  return RenderCoordinator.write('StorageMetadataView render', async () => {
148
146
  // Disabled until https://crbug.com/1079231 is fixed.
149
147
  // clang-format off
150
- Lit.render(html`
151
- <style>
152
- ${storageMetadataViewStyle}
153
- </style>
148
+ render(html`
149
+ <style>${storageMetadataViewStyle}</style>
154
150
  <devtools-report .data=${{reportTitle: this.getTitle() ?? i18nString(UIStrings.loading)}}>
155
151
  ${await this.renderReportContent()}
156
152
  </devtools-report>`, this.#shadow, {host: this});
@@ -167,17 +163,17 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
167
163
  return this.#storageBucketsModel ? `${bucketName} - ${origin}` : origin;
168
164
  }
169
165
 
170
- key(content: string|Lit.TemplateResult): Lit.TemplateResult {
166
+ key(content: string|TemplateResult): TemplateResult {
171
167
  return html`<devtools-report-key>${content}</devtools-report-key>`;
172
168
  }
173
169
 
174
- value(content: string|Lit.TemplateResult): Lit.TemplateResult {
170
+ value(content: string|TemplateResult): TemplateResult {
175
171
  return html`<devtools-report-value>${content}</devtools-report-value>`;
176
172
  }
177
173
 
178
- async renderReportContent(): Promise<Lit.LitTemplate> {
174
+ async renderReportContent(): Promise<LitTemplate> {
179
175
  if (!this.#storageKey) {
180
- return Lit.nothing;
176
+ return nothing;
181
177
  }
182
178
  const origin = this.#storageKey.origin;
183
179
  const ancestorChainHasCrossSite =
@@ -196,26 +192,28 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
196
192
 
197
193
  // Disabled until https://crbug.com/1079231 is fixed.
198
194
  // clang-format off
199
- return html`
195
+ return html`
200
196
  ${(isIframeOrEmbedded) ?
201
197
  html`${this.key(i18nString(UIStrings.origin))}
202
198
  ${this.value(html`<div class="text-ellipsis" title=${origin}>${origin}</div>`)}`
203
- : Lit.nothing}
204
- ${(topLevelSite || topLevelSiteIsOpaque) ? this.key(i18nString(UIStrings.topLevelSite)) : Lit.nothing}
205
- ${topLevelSite ? this.value(topLevelSite) : Lit.nothing}
206
- ${topLevelSiteIsOpaque ? this.value(i18nString(UIStrings.opaque)) : Lit.nothing}
207
- ${thirdPartyReason ? html`${this.key(i18nString(UIStrings.isThirdParty))}${this.value(thirdPartyReason)}` : Lit.nothing}
199
+ : nothing}
200
+ ${(topLevelSite || topLevelSiteIsOpaque) ?
201
+ this.key(i18nString(UIStrings.topLevelSite)) : nothing}
202
+ ${topLevelSite ? this.value(topLevelSite) : nothing}
203
+ ${topLevelSiteIsOpaque ? this.value(i18nString(UIStrings.opaque)) : nothing}
204
+ ${thirdPartyReason ? html`
205
+ ${this.key(i18nString(UIStrings.isThirdParty))}${this.value(thirdPartyReason)}` : nothing}
208
206
  ${hasNonce || topLevelSiteIsOpaque ?
209
- this.key(i18nString(UIStrings.isOpaque)) : Lit.nothing}
210
- ${hasNonce ? this.value(i18nString(UIStrings.yes)) : Lit.nothing}
207
+ this.key(i18nString(UIStrings.isOpaque)) : nothing}
208
+ ${hasNonce ? this.value(i18nString(UIStrings.yes)) : nothing}
211
209
  ${topLevelSiteIsOpaque ?
212
- this.value(i18nString(UIStrings.yesBecauseTopLevelIsOpaque)) : Lit.nothing}
213
- ${this.#storageBucket ? this.#renderStorageBucketInfo() : Lit.nothing}
214
- ${this.#storageBucketsModel ? this.#renderBucketControls() : Lit.nothing}`;
210
+ this.value(i18nString(UIStrings.yesBecauseTopLevelIsOpaque)) : nothing}
211
+ ${this.#storageBucket ? this.#renderStorageBucketInfo() : nothing}
212
+ ${this.#storageBucketsModel ? this.#renderBucketControls() : nothing}`;
215
213
  // clang-format on
216
214
  }
217
215
 
218
- #renderStorageBucketInfo(): Lit.LitTemplate {
216
+ #renderStorageBucketInfo(): LitTemplate {
219
217
  if (!this.#storageBucket) {
220
218
  throw new Error('Should not call #renderStorageBucketInfo if #bucket is null.');
221
219
  }
@@ -260,18 +258,17 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
260
258
  return (new Date(expiration * 1000)).toLocaleString();
261
259
  }
262
260
 
263
- #renderBucketControls(): Lit.TemplateResult {
261
+ #renderBucketControls(): TemplateResult {
264
262
  // clang-format off
265
- return html`
266
- <devtools-report-divider></devtools-report-divider>
267
- <devtools-report-section>
268
- <devtools-button
269
- aria-label=${i18nString(UIStrings.deleteBucket)}
270
- .variant=${Buttons.Button.Variant.OUTLINED}
271
- @click=${this.#deleteBucket}>
272
- ${i18nString(UIStrings.deleteBucket)}
273
- </devtools-button>
274
- </devtools-report-section>`;
263
+ return html`
264
+ <devtools-report-divider></devtools-report-divider>
265
+ <devtools-report-section>
266
+ <devtools-button aria-label=${i18nString(UIStrings.deleteBucket)}
267
+ .variant=${Buttons.Button.Variant.OUTLINED}
268
+ @click=${this.#deleteBucket}>
269
+ ${i18nString(UIStrings.deleteBucket)}
270
+ </devtools-button>
271
+ </devtools-report-section>`;
275
272
  // clang-format on
276
273
  }
277
274
 
@@ -1,17 +1,14 @@
1
1
  // Copyright 2020 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 */
5
4
 
6
- import '../../../ui/components/icon_button/icon_button.js';
5
+ import '../../../ui/kit/kit.js';
7
6
  import '../../../ui/legacy/components/data_grid/data_grid.js';
8
7
 
9
8
  import * as i18n from '../../../core/i18n/i18n.js';
10
9
  import * as SDK from '../../../core/sdk/sdk.js';
11
10
  import type * as Protocol from '../../../generated/protocol.js';
12
11
  import * as Buttons from '../../../ui/components/buttons/buttons.js';
13
- import * as LegacyWrapper from '../../../ui/components/legacy_wrapper/legacy_wrapper.js';
14
- import * as RenderCoordinator from '../../../ui/components/render_coordinator/render_coordinator.js';
15
12
  import * as UI from '../../../ui/legacy/legacy.js';
16
13
  import * as Lit from '../../../ui/lit/lit.js';
17
14
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
@@ -64,7 +61,7 @@ const UIStrings = {
64
61
  const str_ = i18n.i18n.registerUIStrings('panels/application/components/TrustTokensView.ts', UIStrings);
65
62
  export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
66
63
 
67
- export interface TrustTokensViewData {
64
+ export interface TrustTokensViewInput {
68
65
  tokens: Protocol.Storage.TrustTokens[];
69
66
  deleteClickHandler: (issuerOrigin: string) => void;
70
67
  }
@@ -72,65 +69,32 @@ export interface TrustTokensViewData {
72
69
  /** Fetch the Trust Token data regularly from the backend while the panel is open */
73
70
  const REFRESH_INTERVAL_MS = 1000;
74
71
 
75
- export class TrustTokensView extends LegacyWrapper.LegacyWrapper.WrappableComponent {
76
- readonly #shadow = this.attachShadow({mode: 'open'});
77
-
78
- #deleteClickHandler(issuerOrigin: string): void {
79
- const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
80
- void mainTarget?.storageAgent().invoke_clearTrustTokens({issuerOrigin});
81
- }
82
-
83
- connectedCallback(): void {
84
- this.wrapper?.contentElement.classList.add('vbox');
85
- void this.render();
86
- }
87
-
88
- override async render(): Promise<void> {
89
- const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
90
- if (!mainTarget) {
91
- return;
92
- }
93
- const {tokens} = await mainTarget.storageAgent().invoke_getTrustTokens();
94
- tokens.sort((a, b) => a.issuerOrigin.localeCompare(b.issuerOrigin));
95
-
96
- await RenderCoordinator.write('Render TrustTokensView', () => {
97
- // clang-format off
98
- Lit.render(html`
99
- <style>${trustTokensViewStyles}</style>
100
- <style>${UI.inspectorCommonStyles}</style>
101
- ${this.#renderGridOrNoDataMessage(tokens)}
102
- `, this.#shadow, {host: this});
103
- // clang-format on
104
- if (this.isConnected) {
105
- setTimeout(() => this.render(), REFRESH_INTERVAL_MS);
106
- }
107
- });
108
- }
109
-
110
- #renderGridOrNoDataMessage(tokens: Protocol.Storage.TrustTokens[]): Lit.TemplateResult {
111
- if (tokens.length === 0) {
112
- // clang-format off
72
+ function renderGridOrNoDataMessage(input: TrustTokensViewInput): Lit.TemplateResult {
73
+ if (input.tokens.length === 0) {
74
+ // clang-format off
113
75
  return html`
114
- <div class="empty-state" jslog=${VisualLogging.section().context('empty-view')}>
115
- <div class="empty-state-header">${i18nString(UIStrings.noTrustTokens)}</div>
116
- <div class="empty-state-description">
117
- <span>${i18nString(UIStrings.trustTokensDescription)}</span>
118
- <x-link
119
- class="x-link devtools-link"
120
- href=${PRIVATE_STATE_TOKENS_EXPLANATION_URL}
121
- jslog=${VisualLogging.link()
122
- .track({ click: true, keydown: 'Enter|Space' })
123
- .context('learn-more')}
124
- >${i18nString(UIStrings.learnMore)}</x-link>
76
+ <div jslog=${VisualLogging.pane('trust-tokens')}>
77
+ <div class="empty-state" jslog=${VisualLogging.section().context('empty-view')}>
78
+ <div class="empty-state-header">${i18nString(UIStrings.noTrustTokens)}</div>
79
+ <div class="empty-state-description">
80
+ <span>${i18nString(UIStrings.trustTokensDescription)}</span>
81
+ <x-link
82
+ class="x-link devtools-link"
83
+ href=${PRIVATE_STATE_TOKENS_EXPLANATION_URL}
84
+ jslog=${VisualLogging.link()
85
+ .track({ click: true, keydown: 'Enter|Space' })
86
+ .context('learn-more')}
87
+ >${i18nString(UIStrings.learnMore)}</x-link>
88
+ </div>
125
89
  </div>
126
90
  </div>
127
91
  `;
128
- // clang-format on
129
- }
92
+ // clang-format on
93
+ }
130
94
 
131
- // clang-format off
95
+ // clang-format off
132
96
  return html`
133
- <div>
97
+ <div jslog=${VisualLogging.pane('trust-tokens')}>
134
98
  <span class="heading">${i18nString(UIStrings.trustTokens)}</span>
135
99
  <devtools-icon name="info" title=${i18nString(UIStrings.allStoredTrustTokensAvailableIn)}></devtools-icon>
136
100
  <devtools-data-grid striped inline>
@@ -140,7 +104,7 @@ export class TrustTokensView extends LegacyWrapper.LegacyWrapper.WrappableCompon
140
104
  <th id="count" weight="5" sortable>${i18nString(UIStrings.storedTokenCount)}</th>
141
105
  <th id="delete-button" weight="1" sortable></th>
142
106
  </tr>
143
- ${tokens.filter(token => token.count > 0)
107
+ ${input.tokens.filter(token => token.count > 0)
144
108
  .map(token => html`
145
109
  <tr>
146
110
  <td>${removeTrailingSlash(token.issuerOrigin)}</td>
@@ -151,7 +115,7 @@ export class TrustTokensView extends LegacyWrapper.LegacyWrapper.WrappableCompon
151
115
  .size=${Buttons.Button.Size.SMALL}
152
116
  .title=${i18nString(UIStrings.deleteTrustTokens, {PH1: removeTrailingSlash(token.issuerOrigin)})}
153
117
  .variant=${Buttons.Button.Variant.ICON}
154
- @click=${this.#deleteClickHandler.bind(this, removeTrailingSlash(token.issuerOrigin))}></devtools-button>
118
+ @click=${() =>input.deleteClickHandler(removeTrailingSlash(token.issuerOrigin))}></devtools-button>
155
119
  </td>
156
120
  </tr>
157
121
  `)}
@@ -159,18 +123,62 @@ export class TrustTokensView extends LegacyWrapper.LegacyWrapper.WrappableCompon
159
123
  </devtools-data-grid>
160
124
  </div>
161
125
  `;
162
- // clang-format on
163
- }
126
+ // clang-format on
164
127
  }
165
128
 
166
- function removeTrailingSlash(s: string): string {
167
- return s.replace(/\/$/, '');
168
- }
129
+ type View = (input: TrustTokensViewInput, output: undefined, target: HTMLElement) => void;
130
+
131
+ const DEFAULT_VIEW: View = (input, output, target) => {
132
+ // clang-format off
133
+ Lit.render(html`
134
+ <style>${trustTokensViewStyles}</style>
135
+ <style>${UI.inspectorCommonStyles}</style>
136
+ ${renderGridOrNoDataMessage(input)}
137
+ `, target);
138
+ // clang-format on
139
+ };
140
+
141
+ export class TrustTokensView extends UI.Widget.VBox {
142
+ #updateInterval = 0;
143
+ #tokens: Protocol.Storage.TrustTokens[] = [];
144
+ #view: View;
145
+
146
+ constructor(element?: HTMLElement, view = DEFAULT_VIEW) {
147
+ super(element, {useShadowDom: true});
148
+ this.#view = view;
149
+ }
169
150
 
170
- customElements.define('devtools-trust-tokens-storage-view', TrustTokensView);
151
+ override wasShown(): void {
152
+ super.wasShown();
153
+ this.requestUpdate();
154
+ this.#updateInterval = setInterval(this.requestUpdate.bind(this), REFRESH_INTERVAL_MS);
155
+ }
171
156
 
172
- declare global {
173
- interface HTMLElementTagNameMap {
174
- 'devtools-trust-tokens-storage-view': TrustTokensView;
157
+ override willHide(): void {
158
+ super.willHide();
159
+ clearInterval(this.#updateInterval);
160
+ this.#updateInterval = 0;
175
161
  }
162
+
163
+ override async performUpdate(): Promise<void> {
164
+ const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
165
+ if (!mainTarget) {
166
+ return;
167
+ }
168
+ const {tokens} = await mainTarget.storageAgent().invoke_getTrustTokens();
169
+ tokens.sort((a, b) => a.issuerOrigin.localeCompare(b.issuerOrigin));
170
+ this.#tokens = tokens;
171
+ this.#view(
172
+ {tokens: this.#tokens, deleteClickHandler: this.#deleteClickHandler.bind(this)}, undefined,
173
+ this.contentElement);
174
+ }
175
+
176
+ #deleteClickHandler(issuerOrigin: string): void {
177
+ const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
178
+ void mainTarget?.storageAgent().invoke_clearTrustTokens({issuerOrigin});
179
+ }
180
+ }
181
+
182
+ function removeTrailingSlash(s: string): string {
183
+ return s.replace(/\/$/, '');
176
184
  }
@@ -4,7 +4,7 @@
4
4
  /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
5
 
6
6
  import '../../../../ui/legacy/components/data_grid/data_grid.js';
7
- import '../../../../ui/components/icon_button/icon_button.js';
7
+ import '../../../../ui/kit/kit.js';
8
8
 
9
9
  import * as Common from '../../../../core/common/common.js';
10
10
  import * as i18n from '../../../../core/i18n/i18n.js';
@@ -4,7 +4,7 @@
4
4
  /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
5
 
6
6
  import '../../../../ui/legacy/components/data_grid/data_grid.js';
7
- import '../../../../ui/components/icon_button/icon_button.js';
7
+ import '../../../../ui/kit/kit.js';
8
8
 
9
9
  import * as Common from '../../../../core/common/common.js';
10
10
  import * as i18n from '../../../../core/i18n/i18n.js';
@@ -3,7 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
5
 
6
- import '../../../../ui/components/icon_button/icon_button.js';
6
+ import '../../../../ui/kit/kit.js';
7
7
  import '../../../../ui/components/report_view/report_view.js';
8
8
  import './PreloadingMismatchedHeadersGrid.js';
9
9
  import './MismatchedPreloadingGrid.js';
@@ -2,6 +2,8 @@
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
4
 
5
+ import '../../ui/kit/kit.js';
6
+
5
7
  import * as Common from '../../core/common/common.js';
6
8
  import * as i18n from '../../core/i18n/i18n.js';
7
9
  import * as Workspace from '../../models/workspace/workspace.js';
@@ -2,6 +2,8 @@
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
4
 
5
+ import '../../ui/kit/kit.js';
6
+
5
7
  import * as Common from '../../core/common/common.js';
6
8
  import * as i18n from '../../core/i18n/i18n.js';
7
9
  import * as Persistence from '../../models/persistence/persistence.js';
@@ -0,0 +1,71 @@
1
+ // Copyright 2025 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import type * as Common from '../../core/common/common.js';
6
+ import type * as SDK from '../../core/sdk/sdk.js';
7
+ import * as Annotations from '../../ui/components/annotations/annotations.js';
8
+
9
+ interface AnnotationPlacement {
10
+ parentElement: Element;
11
+ insertBefore?: Node|null;
12
+ resolveRelativePosition:
13
+ (parentElement: Element, revealNode: boolean, lookupId: string,
14
+ node?: SDK.DOMModel.DOMNode) => Promise<{x: number, y: number}|null>;
15
+ }
16
+
17
+ // This class handles general management of Annotations, the data needed to display them and any panel-specific things
18
+ // that the AnnotationRepository must be free from. It is created on-demand the first time a panel, that wants to show
19
+ // an Annotation, appears.
20
+ //
21
+ // NOTE: For now this class is not for general use and is inactive (unless a specific flag is supplied).
22
+ export class AnnotationManager {
23
+ static #instance: AnnotationManager|null = null;
24
+
25
+ #annotationPlacements: Map<Annotations.AnnotationType, AnnotationPlacement>|null = null;
26
+
27
+ constructor() {
28
+ if (!Annotations.AnnotationRepository.annotationsEnabled()) {
29
+ console.warn('AnnotationManager created with annotations disabled');
30
+ return;
31
+ }
32
+
33
+ Annotations.AnnotationRepository.instance().addEventListener(
34
+ Annotations.Events.ANNOTATION_ADDED, this.#onAnnotationAdded, this);
35
+ }
36
+
37
+ static instance(): AnnotationManager {
38
+ if (!AnnotationManager.#instance) {
39
+ AnnotationManager.#instance = new AnnotationManager();
40
+ }
41
+ return AnnotationManager.#instance;
42
+ }
43
+
44
+ initializePlacementForAnnotationType(
45
+ type: Annotations.AnnotationType,
46
+ resolveRelativePosition:
47
+ (parentElement: Element, revealNode: boolean, lookupId: string,
48
+ node?: SDK.DOMModel.DOMNode) => Promise<{x: number, y: number}|null>,
49
+ parentElement: Element, insertBefore: Node|null = null): void {
50
+ if (!Annotations.AnnotationRepository.annotationsEnabled()) {
51
+ return;
52
+ }
53
+
54
+ if (!this.#annotationPlacements) {
55
+ this.#annotationPlacements = new Map();
56
+ }
57
+ this.#annotationPlacements.set(type, {parentElement, insertBefore, resolveRelativePosition});
58
+
59
+ // eslint-disable-next-line no-console
60
+ console.log(
61
+ `[AnnotationManager] initializing placement for ${Annotations.AnnotationType[type]}`, {parentElement},
62
+ 'placement count:', this.#annotationPlacements);
63
+ }
64
+
65
+ async #onAnnotationAdded(
66
+ event: Common.EventTarget.EventTargetEvent<Annotations.EventTypes[Annotations.Events.ANNOTATION_ADDED]>):
67
+ Promise<void> {
68
+ // eslint-disable-next-line no-console
69
+ console.log('[AnnotationManager] received event onAnnotationAdded', event);
70
+ }
71
+ }
@@ -1,14 +1,13 @@
1
1
  // Copyright 2016 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-imperative-dom-api */
5
4
 
6
5
  import * as Common from '../../core/common/common.js';
7
6
  import * as i18n from '../../core/i18n/i18n.js';
8
7
  import * as Platform from '../../core/platform/platform.js';
9
8
  import * as Persistence from '../../models/persistence/persistence.js';
10
9
  import * as Workspace from '../../models/workspace/workspace.js';
11
- import * as IconButton from '../../ui/components/icon_button/icon_button.js';
10
+ import {Icon} from '../../ui/kit/kit.js';
12
11
  import * as Components from '../../ui/legacy/components/utils/utils.js';
13
12
  import * as UI from '../../ui/legacy/legacy.js';
14
13
 
@@ -43,13 +42,13 @@ export class PersistenceUtils {
43
42
  return i18nString(UIStrings.linkedToS, {PH1: Platform.StringUtilities.trimMiddle(binding.network.url(), 150)});
44
43
  }
45
44
 
46
- static iconForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): IconButton.Icon.Icon|null {
45
+ static iconForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): Icon|null {
47
46
  const binding = Persistence.Persistence.PersistenceImpl.instance().binding(uiSourceCode);
48
47
  if (binding) {
49
48
  if (!Common.ParsedURL.schemeIs(binding.fileSystem.url(), 'file:')) {
50
49
  return null;
51
50
  }
52
- const icon = new IconButton.Icon.Icon();
51
+ const icon = new Icon();
53
52
  icon.name = 'document';
54
53
  icon.classList.add('small');
55
54
  UI.Tooltip.Tooltip.install(icon, PersistenceUtils.tooltipForUISourceCode(binding.network));
@@ -69,14 +68,14 @@ export class PersistenceUtils {
69
68
 
70
69
  if (Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance().isActiveHeaderOverrides(
71
70
  uiSourceCode)) {
72
- const icon = new IconButton.Icon.Icon();
71
+ const icon = new Icon();
73
72
  icon.name = 'document';
74
73
  icon.classList.add('small');
75
74
  icon.classList.add('dot', 'purple');
76
75
  return icon;
77
76
  }
78
77
 
79
- const icon = new IconButton.Icon.Icon();
78
+ const icon = new Icon();
80
79
  icon.name = 'document';
81
80
  icon.classList.add('small');
82
81
  UI.Tooltip.Tooltip.install(icon, PersistenceUtils.tooltipForUISourceCode(uiSourceCode));
@@ -97,7 +96,7 @@ export class LinkDecorator extends Common.ObjectWrapper.ObjectWrapper<Components
97
96
  this.dispatchEventToListeners(Components.Linkifier.LinkDecorator.Events.LINK_ICON_CHANGED, binding.network);
98
97
  }
99
98
 
100
- linkIcon(uiSourceCode: Workspace.UISourceCode.UISourceCode): IconButton.Icon.Icon|null {
99
+ linkIcon(uiSourceCode: Workspace.UISourceCode.UISourceCode): Icon|null {
101
100
  return PersistenceUtils.iconForUISourceCode(uiSourceCode);
102
101
  }
103
102
  }
@@ -96,6 +96,7 @@ export class TypeToAllowDialog {
96
96
 
97
97
  export {AiCodeCompletionTeaser} from './AiCodeCompletionTeaser.js';
98
98
  export {AiCodeGenerationTeaser} from './AiCodeGenerationTeaser.js';
99
+ export {AnnotationManager} from './AnnotationManager.js';
99
100
  export {FreDialog} from './FreDialog.js';
100
101
  export {GdpSignUpDialog} from './GdpSignUpDialog.js';
101
102
  export {AiCodeCompletionDisclaimer} from './AiCodeCompletionDisclaimer.js';