chrome-devtools-frontend 1.0.954845 → 1.0.956401

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 (341) hide show
  1. package/.eslintrc.js +1 -0
  2. package/AUTHORS +1 -0
  3. package/config/gni/devtools_grd_files.gni +0 -1
  4. package/config/owner/COMMON_OWNERS +2 -2
  5. package/front_end/.eslintrc.js +1 -11
  6. package/front_end/core/common/Console.ts +1 -1
  7. package/front_end/core/common/ResolverBase.ts +1 -1
  8. package/front_end/core/common/Throttler.ts +1 -1
  9. package/front_end/core/common/Worker.ts +4 -4
  10. package/front_end/core/host/InspectorFrontendHost.ts +1 -1
  11. package/front_end/core/host/ResourceLoader.ts +2 -2
  12. package/front_end/core/i18n/DevToolsLocale.ts +0 -2
  13. package/front_end/core/i18n/i18nImpl.ts +0 -2
  14. package/front_end/core/i18n/locales/en-US.json +3 -3
  15. package/front_end/core/i18n/locales/en-XL.json +3 -3
  16. package/front_end/core/sdk/AccessibilityModel.ts +1 -1
  17. package/front_end/core/sdk/CPUProfilerModel.ts +2 -2
  18. package/front_end/core/sdk/CPUThrottlingManager.ts +2 -2
  19. package/front_end/core/sdk/CSSModel.ts +7 -7
  20. package/front_end/core/sdk/CSSProperty.ts +1 -1
  21. package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
  22. package/front_end/core/sdk/ChildTargetManager.ts +6 -6
  23. package/front_end/core/sdk/Connections.ts +2 -2
  24. package/front_end/core/sdk/ConsoleModel.ts +1 -1
  25. package/front_end/core/sdk/DOMDebuggerModel.ts +16 -15
  26. package/front_end/core/sdk/DOMModel.ts +17 -17
  27. package/front_end/core/sdk/DebuggerModel.ts +24 -24
  28. package/front_end/core/sdk/EmulationModel.ts +16 -16
  29. package/front_end/core/sdk/EventBreakpointsModel.ts +2 -2
  30. package/front_end/core/sdk/IsolateManager.ts +2 -2
  31. package/front_end/core/sdk/IssuesModel.ts +1 -1
  32. package/front_end/core/sdk/LogModel.ts +3 -3
  33. package/front_end/core/sdk/NetworkManager.ts +25 -25
  34. package/front_end/core/sdk/OverlayModel.ts +23 -23
  35. package/front_end/core/sdk/PageResourceLoader.ts +1 -1
  36. package/front_end/core/sdk/PaintProfiler.ts +1 -1
  37. package/front_end/core/sdk/RemoteObject.ts +2 -2
  38. package/front_end/core/sdk/Resource.ts +2 -2
  39. package/front_end/core/sdk/ResourceTreeModel.ts +5 -5
  40. package/front_end/core/sdk/RuntimeModel.ts +11 -11
  41. package/front_end/core/sdk/ScreenCaptureModel.ts +3 -3
  42. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +7 -7
  43. package/front_end/core/sdk/ServiceWorkerManager.ts +4 -4
  44. package/front_end/core/sdk/SourceMapManager.ts +1 -1
  45. package/front_end/core/sdk/TargetManager.ts +2 -2
  46. package/front_end/core/sdk/TracingManager.ts +1 -1
  47. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +10 -0
  48. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +3 -4
  49. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +1 -1
  50. package/front_end/entrypoints/inspector_main/InspectorMain.ts +4 -4
  51. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +1 -1
  52. package/front_end/entrypoints/js_app/js_app.ts +2 -2
  53. package/front_end/entrypoints/main/MainImpl.ts +31 -23
  54. package/front_end/entrypoints/main/main-meta.ts +1 -1
  55. package/front_end/entrypoints/node_app/NodeMain.ts +6 -6
  56. package/front_end/entrypoints/worker_app/WorkerMain.ts +1 -1
  57. package/front_end/generated/ARIAProperties.js +1 -1
  58. package/front_end/generated/InspectorBackendCommands.js +5 -1
  59. package/front_end/generated/SupportedCSSProperties.js +15 -15
  60. package/front_end/generated/protocol.d.ts +13 -0
  61. package/front_end/global_typings/global_defs.d.ts +0 -1
  62. package/front_end/models/bindings/BreakpointManager.ts +21 -23
  63. package/front_end/models/bindings/CSSWorkspaceBinding.ts +3 -3
  64. package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
  65. package/front_end/models/bindings/ContentProviderBasedProject.ts +1 -1
  66. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +2 -2
  67. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +3 -3
  68. package/front_end/models/bindings/DefaultScriptMapping.ts +1 -1
  69. package/front_end/models/bindings/FileUtils.ts +5 -5
  70. package/front_end/models/bindings/IgnoreListManager.ts +4 -4
  71. package/front_end/models/bindings/LiveLocation.ts +9 -0
  72. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +2 -1
  73. package/front_end/models/bindings/ResourceMapping.ts +1 -1
  74. package/front_end/models/bindings/ResourceScriptMapping.ts +9 -9
  75. package/front_end/models/bindings/StylesSourceMapping.ts +3 -3
  76. package/front_end/models/bindings/TempFile.ts +1 -1
  77. package/front_end/models/emulation/DeviceModeModel.ts +5 -5
  78. package/front_end/models/emulation/EmulatedDevices.ts +1 -1
  79. package/front_end/models/extensions/ExtensionPanel.ts +1 -1
  80. package/front_end/models/extensions/ExtensionServer.ts +8 -8
  81. package/front_end/models/formatter/FormatterWorkerPool.ts +2 -12
  82. package/front_end/models/formatter/ScriptFormatter.ts +3 -3
  83. package/front_end/models/formatter/SourceFormatter.ts +2 -2
  84. package/front_end/models/issues_manager/ContrastCheckTrigger.ts +1 -1
  85. package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
  86. package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +3 -3
  87. package/front_end/models/persistence/Automapping.ts +3 -3
  88. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +3 -3
  89. package/front_end/models/persistence/IsolatedFileSystem.ts +1 -1
  90. package/front_end/models/persistence/IsolatedFileSystemManager.ts +2 -2
  91. package/front_end/models/persistence/NetworkPersistenceManager.ts +11 -11
  92. package/front_end/models/persistence/PersistenceActions.ts +3 -3
  93. package/front_end/models/persistence/PersistenceImpl.ts +2 -2
  94. package/front_end/models/persistence/WorkspaceSettingsTab.ts +1 -1
  95. package/front_end/models/workspace/UISourceCode.ts +2 -2
  96. package/front_end/models/workspace_diff/WorkspaceDiff.ts +2 -2
  97. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +4 -4
  98. package/front_end/panels/accessibility/AccessibilityNodeView.ts +3 -3
  99. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +7 -7
  100. package/front_end/panels/animation/AnimationModel.ts +6 -6
  101. package/front_end/panels/animation/AnimationTimeline.ts +3 -3
  102. package/front_end/panels/animation/AnimationUI.ts +3 -3
  103. package/front_end/panels/application/AppManifestView.ts +4 -4
  104. package/front_end/panels/application/ApplicationPanelCacheSection.ts +3 -3
  105. package/front_end/panels/application/ApplicationPanelSidebar.ts +15 -15
  106. package/front_end/panels/application/BackgroundServiceModel.ts +3 -3
  107. package/front_end/panels/application/BackgroundServiceView.ts +3 -3
  108. package/front_end/panels/application/CookieItemsView.ts +5 -5
  109. package/front_end/panels/application/DOMStorageItemsView.ts +4 -4
  110. package/front_end/panels/application/DOMStorageModel.ts +4 -4
  111. package/front_end/panels/application/DatabaseModel.ts +2 -2
  112. package/front_end/panels/application/DatabaseQueryView.ts +2 -2
  113. package/front_end/panels/application/DatabaseTableView.ts +1 -1
  114. package/front_end/panels/application/IndexedDBModel.ts +11 -11
  115. package/front_end/panels/application/IndexedDBViews.ts +5 -5
  116. package/front_end/panels/application/OpenedWindowDetailsView.ts +4 -4
  117. package/front_end/panels/application/ReportingApiView.ts +1 -1
  118. package/front_end/panels/application/ResourcesPanel.ts +2 -2
  119. package/front_end/panels/application/ServiceWorkerCacheViews.ts +7 -7
  120. package/front_end/panels/application/ServiceWorkersView.ts +15 -15
  121. package/front_end/panels/application/StorageView.ts +5 -5
  122. package/front_end/panels/application/TrustTokensTreeElement.ts +1 -1
  123. package/front_end/panels/application/components/BackForwardCacheStrings.ts +5 -1
  124. package/front_end/panels/application/components/BackForwardCacheView.ts +4 -4
  125. package/front_end/panels/application/components/FrameDetailsView.ts +3 -3
  126. package/front_end/panels/application/components/PermissionsPolicySection.ts +2 -2
  127. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +1 -1
  128. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +8 -7
  129. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +1 -1
  130. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +4 -4
  131. package/front_end/panels/changes/ChangesView.ts +4 -4
  132. package/front_end/panels/console/ConsoleContextSelector.ts +1 -1
  133. package/front_end/panels/console/ConsoleFilter.ts +17 -2
  134. package/front_end/panels/console/ConsoleFormat.ts +5 -4
  135. package/front_end/panels/console/ConsolePinPane.ts +4 -4
  136. package/front_end/panels/console/ConsolePrompt.ts +4 -4
  137. package/front_end/panels/console/ConsoleView.ts +96 -71
  138. package/front_end/panels/console/ConsoleViewMessage.ts +61 -19
  139. package/front_end/panels/console/consoleView.css +36 -0
  140. package/front_end/panels/console_counters/WarningErrorCounter.ts +2 -2
  141. package/front_end/panels/coverage/CoverageListView.ts +3 -3
  142. package/front_end/panels/coverage/CoverageModel.ts +3 -3
  143. package/front_end/panels/coverage/CoverageView.ts +6 -6
  144. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
  145. package/front_end/panels/css_overview/CSSOverviewModel.ts +2 -2
  146. package/front_end/panels/css_overview/CSSOverviewPanel.ts +1 -1
  147. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
  148. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
  149. package/front_end/panels/elements/AccessibilityTreeView.ts +5 -5
  150. package/front_end/panels/elements/ClassesPaneWidget.ts +1 -1
  151. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +10 -10
  152. package/front_end/panels/elements/ComputedStyleWidget.ts +2 -2
  153. package/front_end/panels/elements/DOMLinkifier.ts +2 -2
  154. package/front_end/panels/elements/ElementsPanel.ts +19 -19
  155. package/front_end/panels/elements/ElementsSidebarPane.ts +1 -1
  156. package/front_end/panels/elements/ElementsTreeElement.ts +26 -25
  157. package/front_end/panels/elements/ElementsTreeElementHighlighter.ts +1 -1
  158. package/front_end/panels/elements/ElementsTreeOutline.ts +4 -4
  159. package/front_end/panels/elements/InspectElementModeController.ts +3 -3
  160. package/front_end/panels/elements/LayoutSidebarPane.ts +2 -2
  161. package/front_end/panels/elements/MetricsSidebarPane.ts +2 -2
  162. package/front_end/panels/elements/StylePropertyHighlighter.ts +1 -1
  163. package/front_end/panels/elements/StylePropertyTreeElement.ts +16 -16
  164. package/front_end/panels/elements/StylesSidebarPane.ts +15 -15
  165. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +1 -1
  166. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +8 -8
  167. package/front_end/panels/elements/elementsPanel.css +1 -0
  168. package/front_end/panels/elements/elementsTreeOutline.css +6 -1
  169. package/front_end/panels/emulation/AdvancedApp.ts +2 -2
  170. package/front_end/panels/emulation/DeviceModeToolbar.ts +1 -1
  171. package/front_end/panels/emulation/DeviceModeView.ts +2 -2
  172. package/front_end/panels/emulation/DeviceModeWrapper.ts +4 -4
  173. package/front_end/panels/emulation/MediaQueryInspector.ts +3 -3
  174. package/front_end/panels/event_listeners/EventListenersView.ts +3 -3
  175. package/front_end/panels/input/InputModel.ts +2 -2
  176. package/front_end/panels/input/InputTimeline.ts +6 -6
  177. package/front_end/panels/issues/AffectedCookiesView.ts +2 -2
  178. package/front_end/panels/issues/AffectedDirectivesView.ts +1 -1
  179. package/front_end/panels/issues/AffectedElementsView.ts +1 -1
  180. package/front_end/panels/issues/AffectedResourcesView.ts +2 -2
  181. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +1 -1
  182. package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +1 -1
  183. package/front_end/panels/issues/IssueView.ts +1 -1
  184. package/front_end/panels/issues/components/HideIssuesMenu.ts +1 -1
  185. package/front_end/panels/layer_viewer/LayerDetailsView.ts +1 -1
  186. package/front_end/panels/layer_viewer/LayerViewHost.ts +1 -1
  187. package/front_end/panels/layer_viewer/Layers3DView.ts +7 -7
  188. package/front_end/panels/layer_viewer/PaintProfilerView.ts +1 -1
  189. package/front_end/panels/layers/LayerPaintProfilerView.ts +3 -3
  190. package/front_end/panels/layers/LayerTreeModel.ts +4 -4
  191. package/front_end/panels/layers/LayersPanel.ts +4 -4
  192. package/front_end/panels/lighthouse/LighthouseController.ts +1 -1
  193. package/front_end/panels/lighthouse/LighthousePanel.ts +5 -5
  194. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +1 -1
  195. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +1 -1
  196. package/front_end/panels/media/MediaModel.ts +1 -1
  197. package/front_end/panels/media/PlayerListView.ts +1 -1
  198. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +1 -1
  199. package/front_end/panels/network/BinaryResourceView.ts +1 -1
  200. package/front_end/panels/network/BlockedURLsPane.ts +5 -5
  201. package/front_end/panels/network/NetworkDataGridNode.ts +1 -1
  202. package/front_end/panels/network/NetworkItemView.ts +2 -2
  203. package/front_end/panels/network/NetworkLogView.ts +4 -4
  204. package/front_end/panels/network/NetworkLogViewColumns.ts +1 -1
  205. package/front_end/panels/network/NetworkPanel.ts +8 -8
  206. package/front_end/panels/network/NetworkTimeCalculator.ts +1 -1
  207. package/front_end/panels/network/RequestHeadersView.ts +4 -3
  208. package/front_end/panels/network/RequestPayloadView.ts +8 -8
  209. package/front_end/panels/network/RequestPreviewView.ts +1 -1
  210. package/front_end/panels/network/RequestResponseView.ts +2 -2
  211. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -1
  212. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -2
  213. package/front_end/panels/profiler/CPUProfileView.ts +4 -4
  214. package/front_end/panels/profiler/HeapProfileView.ts +6 -6
  215. package/front_end/panels/profiler/HeapProfilerPanel.ts +2 -2
  216. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +10 -10
  217. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +9 -8
  218. package/front_end/panels/profiler/HeapSnapshotView.ts +24 -24
  219. package/front_end/panels/profiler/LiveHeapProfileView.ts +4 -4
  220. package/front_end/panels/profiler/ProfileSidebarTreeElement.ts +1 -1
  221. package/front_end/panels/profiler/ProfileView.ts +3 -3
  222. package/front_end/panels/profiler/ProfilesPanel.ts +3 -3
  223. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -3
  224. package/front_end/panels/screencast/InputModel.ts +3 -3
  225. package/front_end/panels/screencast/ScreencastView.ts +10 -10
  226. package/front_end/panels/search/SearchResultsPane.ts +1 -1
  227. package/front_end/panels/search/SearchView.ts +2 -2
  228. package/front_end/panels/security/SecurityModel.ts +1 -1
  229. package/front_end/panels/security/SecurityPanel.ts +2 -2
  230. package/front_end/panels/sensors/SensorsView.ts +3 -2
  231. package/front_end/panels/settings/SettingsScreen.ts +5 -5
  232. package/front_end/panels/settings/components/SyncSection.ts +1 -1
  233. package/front_end/panels/snippets/SnippetsQuickOpen.ts +1 -1
  234. package/front_end/panels/sources/BreakpointEditDialog.ts +2 -2
  235. package/front_end/panels/sources/CallStackSidebarPane.ts +4 -4
  236. package/front_end/panels/sources/CoveragePlugin.ts +3 -3
  237. package/front_end/panels/sources/DebuggerPlugin.ts +12 -12
  238. package/front_end/panels/sources/GoToLineQuickOpen.ts +1 -1
  239. package/front_end/panels/sources/InplaceFormatterEditorAction.ts +3 -3
  240. package/front_end/panels/sources/JavaScriptBreakpointsSidebarPane.ts +3 -3
  241. package/front_end/panels/sources/NavigatorView.ts +6 -6
  242. package/front_end/panels/sources/OpenFileQuickOpen.ts +2 -2
  243. package/front_end/panels/sources/OutlineQuickOpen.ts +1 -1
  244. package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -3
  245. package/front_end/panels/sources/ScriptFormatterEditorAction.ts +3 -3
  246. package/front_end/panels/sources/SearchSourcesView.ts +2 -2
  247. package/front_end/panels/sources/SourcesNavigator.ts +9 -9
  248. package/front_end/panels/sources/SourcesPanel.ts +28 -25
  249. package/front_end/panels/sources/SourcesSearchScope.ts +2 -2
  250. package/front_end/panels/sources/SourcesView.ts +4 -4
  251. package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
  252. package/front_end/panels/sources/UISourceCodeFrame.ts +2 -2
  253. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +4 -4
  254. package/front_end/panels/timeline/EventsTimelineTreeView.ts +1 -1
  255. package/front_end/panels/timeline/TimelineController.ts +1 -1
  256. package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
  257. package/front_end/panels/timeline/TimelineEventOverview.ts +2 -2
  258. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +22 -5
  259. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +9 -6
  260. package/front_end/panels/timeline/TimelineHistoryManager.ts +1 -1
  261. package/front_end/panels/timeline/TimelineLayersView.ts +1 -1
  262. package/front_end/panels/timeline/TimelineLoader.ts +2 -2
  263. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +4 -4
  264. package/front_end/panels/timeline/TimelinePanel.ts +10 -10
  265. package/front_end/panels/timeline/TimelineUIUtils.ts +2 -2
  266. package/front_end/panels/timeline/components/WebVitalsTimeline.ts +2 -2
  267. package/front_end/panels/web_audio/WebAudioModel.ts +1 -1
  268. package/front_end/panels/web_audio/WebAudioView.ts +1 -1
  269. package/front_end/panels/webauthn/WebauthnPane.ts +7 -7
  270. package/front_end/ui/components/buttons/Button.ts +10 -10
  271. package/front_end/ui/components/data_grid/DataGrid.ts +14 -14
  272. package/front_end/ui/components/docs/tree_outline/basic.ts +2 -2
  273. package/front_end/ui/components/docs/tree_outline/custom-renderers.ts +1 -1
  274. package/front_end/ui/components/docs/tree_outline/lazy-children.ts +1 -1
  275. package/front_end/ui/components/helpers/scheduled-render.ts +1 -1
  276. package/front_end/ui/components/icon_button/Icon.ts +1 -1
  277. package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
  278. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +2 -2
  279. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +2 -2
  280. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +5 -2
  281. package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
  282. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +1 -1
  283. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +1 -1
  284. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +3 -3
  285. package/front_end/ui/components/text_editor/cursor_tooltip.ts +1 -1
  286. package/front_end/ui/components/text_editor/javascript.ts +2 -2
  287. package/front_end/ui/components/tree_outline/TreeOutline.ts +8 -8
  288. package/front_end/ui/legacy/Context.ts +1 -1
  289. package/front_end/ui/legacy/ContextMenu.ts +1 -1
  290. package/front_end/ui/legacy/GlassPane.ts +0 -1
  291. package/front_end/ui/legacy/InspectorView.ts +2 -3
  292. package/front_end/ui/legacy/PopoverHelper.ts +1 -1
  293. package/front_end/ui/legacy/ShortcutRegistry.ts +1 -1
  294. package/front_end/ui/legacy/TabbedPane.ts +2 -2
  295. package/front_end/ui/legacy/ThrottledWidget.ts +1 -1
  296. package/front_end/ui/legacy/Toolbar.ts +3 -3
  297. package/front_end/ui/legacy/Treeoutline.ts +6 -6
  298. package/front_end/ui/legacy/UIUtils.ts +17 -24
  299. package/front_end/ui/legacy/ViewManager.ts +9 -9
  300. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +1 -1
  301. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +7 -7
  302. package/front_end/ui/legacy/components/color_picker/spectrum.css +5 -2
  303. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +3 -3
  304. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +2 -2
  305. package/front_end/ui/legacy/components/data_grid/ShowMoreDataGridNode.ts +3 -3
  306. package/front_end/ui/legacy/components/inline_editor/CSSAngleEditor.ts +1 -1
  307. package/front_end/ui/legacy/components/inline_editor/FontEditor.ts +4 -4
  308. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +3 -3
  309. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +1 -1
  310. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +11 -11
  311. package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +8 -8
  312. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +13 -18
  313. package/front_end/ui/legacy/components/perf_ui/GCActionDelegate.ts +1 -1
  314. package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +1 -1
  315. package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +3 -3
  316. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +2 -4
  317. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -2
  318. package/front_end/ui/legacy/components/perf_ui/flameChart.css +8 -0
  319. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +5 -5
  320. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -2
  321. package/front_end/ui/legacy/components/source_frame/ImageView.ts +3 -4
  322. package/front_end/ui/legacy/components/source_frame/JSONView.ts +0 -1
  323. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +1 -2
  324. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +5 -5
  325. package/front_end/ui/legacy/components/source_frame/XMLView.ts +0 -2
  326. package/front_end/ui/legacy/components/utils/ImagePreview.ts +1 -1
  327. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +1 -1
  328. package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -5
  329. package/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts +2 -2
  330. package/front_end/ui/legacy/inspectorSyntaxHighlight.css +8 -11
  331. package/front_end/ui/legacy/tabbedPane.css +1 -0
  332. package/front_end/ui/legacy/themeColors.css +3 -1
  333. package/front_end/ui/legacy/theme_support/theme_support_impl.ts +23 -229
  334. package/front_end/ui/legacy/toolbar.css +1 -0
  335. package/package.json +1 -1
  336. package/scripts/component_server/server.js +2 -2
  337. package/scripts/eslint_rules/lib/no_bound_component_methods.js +116 -0
  338. package/scripts/eslint_rules/tests/check_license_header_test.js +10 -8
  339. package/scripts/eslint_rules/tests/no_bound_component_methods_test.js +85 -0
  340. package/front_end/global_typings/intl_display_names.d.ts +0 -111
  341. package/front_end/ui/legacy/inspectorSyntaxHighlightDark.css +0 -270
@@ -98,7 +98,6 @@ export class ImageView extends UI.View.SimpleView {
98
98
  private cachedContent?: string|null;
99
99
  constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider) {
100
100
  super(i18nString(UIStrings.image));
101
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
102
101
  this.registerRequiredCSS(imageViewStyles);
103
102
  this.element.tabIndex = -1;
104
103
  this.element.classList.add('image-view');
@@ -139,7 +138,7 @@ export class ImageView extends UI.View.SimpleView {
139
138
  }
140
139
 
141
140
  wasShown(): void {
142
- this.updateContentIfNeeded();
141
+ void this.updateContentIfNeeded();
143
142
  }
144
143
 
145
144
  disposeView(): void {
@@ -150,7 +149,7 @@ export class ImageView extends UI.View.SimpleView {
150
149
  }
151
150
 
152
151
  private workingCopyCommitted(): void {
153
- this.updateContentIfNeeded();
152
+ void this.updateContentIfNeeded();
154
153
  }
155
154
 
156
155
  private async updateContentIfNeeded(): Promise<void> {
@@ -192,7 +191,7 @@ export class ImageView extends UI.View.SimpleView {
192
191
  await this.saveImage();
193
192
  });
194
193
 
195
- contextMenu.show();
194
+ void contextMenu.show();
196
195
  }
197
196
 
198
197
  private copyImageAsDataURL(): void {
@@ -56,7 +56,6 @@ export class JSONView extends UI.Widget.VBox implements UI.SearchableView.Search
56
56
  constructor(parsedJSON: ParsedJSON, startCollapsed?: boolean) {
57
57
  super();
58
58
  this.initialized = false;
59
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
60
59
  this.registerRequiredCSS(jsonViewStyles);
61
60
  this.parsedJSON = parsedJSON;
62
61
  this.startCollapsed = Boolean(startCollapsed);
@@ -84,7 +84,6 @@ export class SearchableContainer extends UI.Widget.VBox {
84
84
 
85
85
  constructor(resource: TextUtils.ContentProvider.ContentProvider, contentType: string, autoPrettyPrint?: boolean) {
86
86
  super(true);
87
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
88
87
  this.registerRequiredCSS(resourceSourceFrameStyles);
89
88
  const sourceFrame = new ResourceSourceFrame(resource, contentType);
90
89
  this.sourceFrame = sourceFrame;
@@ -99,7 +98,7 @@ export class SearchableContainer extends UI.Widget.VBox {
99
98
  searchableView.show(this.contentElement);
100
99
 
101
100
  const toolbar = new UI.Toolbar.Toolbar('toolbar', this.contentElement);
102
- sourceFrame.toolbarItems().then(items => {
101
+ void sourceFrame.toolbarItems().then(items => {
103
102
  items.map(item => toolbar.appendToolbarItem(item));
104
103
  });
105
104
  }
@@ -150,7 +150,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
150
150
  this.formattedMap = null;
151
151
  this.prettyToggle = new UI.Toolbar.ToolbarToggle(i18nString(UIStrings.prettyPrint), 'largeicon-pretty-print');
152
152
  this.prettyToggle.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, () => {
153
- this.setPretty(!this.prettyToggle.toggled());
153
+ void this.setPretty(!this.prettyToggle.toggled());
154
154
  });
155
155
  this.shouldAutoPrettyPrint = false;
156
156
  this.prettyToggle.setVisible(false);
@@ -394,7 +394,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
394
394
  }
395
395
 
396
396
  wasShown(): void {
397
- this.ensureContentLoaded();
397
+ void this.ensureContentLoaded();
398
398
  this.wasShownOrLoaded();
399
399
  }
400
400
 
@@ -760,7 +760,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
760
760
  this.doFindSearchMatches.bind(this, searchConfig, shouldJump, Boolean(jumpBackwards));
761
761
  }
762
762
 
763
- this.ensureContentLoaded();
763
+ void this.ensureContentLoaded();
764
764
  }
765
765
 
766
766
  private resetCurrentSearchResultIndex(): void {
@@ -945,7 +945,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
945
945
  const pos = state.selection.main.from, line = state.doc.lineAt(pos);
946
946
  this.populateTextAreaContextMenu(contextMenu, line.number - 1, pos - line.from);
947
947
  contextMenu.appendApplicableItems(this);
948
- contextMenu.show();
948
+ void contextMenu.show();
949
949
  return true;
950
950
  }
951
951
 
@@ -959,7 +959,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
959
959
  const lineNumber = this.textEditor.state.doc.lineAt(position).number - 1;
960
960
  this.populateLineGutterContextMenu(contextMenu, lineNumber);
961
961
  contextMenu.appendApplicableItems(this);
962
- contextMenu.show();
962
+ void contextMenu.show();
963
963
  return true;
964
964
  }
965
965
 
@@ -28,11 +28,9 @@ export class XMLView extends UI.Widget.Widget implements UI.SearchableView.Searc
28
28
 
29
29
  constructor(parsedXML: Document) {
30
30
  super(true);
31
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
32
31
  this.registerRequiredCSS(xmlViewStyles);
33
32
  this.contentElement.classList.add('shadow-xml-view', 'source-code');
34
33
  this.treeOutline = new UI.TreeOutline.TreeOutlineInShadow();
35
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
36
34
  this.treeOutline.registerRequiredCSS(xmlTreeStyles);
37
35
  this.contentElement.appendChild(this.treeOutline.element);
38
36
  this.currentSearchFocusIndex = 0;
@@ -95,7 +95,7 @@ export class ImagePreview {
95
95
  if (imageAltText) {
96
96
  imageElement.alt = imageAltText;
97
97
  }
98
- imageResource.populateImageSource(imageElement);
98
+ void imageResource.populateImageSource(imageElement);
99
99
 
100
100
  function buildContent(): void {
101
101
  const shadowBoundary = document.createElement('div');
@@ -83,7 +83,7 @@ function populateContextMenu(link: Element, event: Event): void {
83
83
  }
84
84
  }
85
85
  contextMenu.appendApplicableItems(event);
86
- contextMenu.show();
86
+ void contextMenu.show();
87
87
  }
88
88
 
89
89
  export function buildStackTraceRows(
@@ -255,7 +255,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
255
255
  const linkDisplayOptions = {showColumnNumber: linkifyURLOptions.showColumnNumber};
256
256
 
257
257
  const currentOnLiveLocationUpdate = this.onLiveLocationUpdate;
258
- Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
258
+ void Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
259
259
  .createLiveLocation(rawLocation, this.updateAnchor.bind(this, link, linkDisplayOptions), pool)
260
260
  .then(liveLocation => {
261
261
  if (liveLocation) {
@@ -356,7 +356,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
356
356
  const linkDisplayOptions = {showColumnNumber: false};
357
357
 
358
358
  const currentOnLiveLocationUpdate = this.onLiveLocationUpdate;
359
- Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
359
+ void Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
360
360
  .createStackTraceTopFrameLiveLocation(
361
361
  debuggerModel.createRawLocationsByStackTrace(stackTrace),
362
362
  this.updateAnchor.bind(this, link, linkDisplayOptions), pool)
@@ -395,7 +395,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
395
395
  const linkDisplayOptions = {showColumnNumber: false};
396
396
 
397
397
  const currentOnLiveLocationUpdate = this.onLiveLocationUpdate;
398
- Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance()
398
+ void Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance()
399
399
  .createLiveLocation(rawLocation, this.updateAnchor.bind(this, link, linkDisplayOptions), pool)
400
400
  .then(liveLocation => {
401
401
  linkInfo.liveLocation = liveLocation;
@@ -437,7 +437,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
437
437
  if (header && header.ownerNode) {
438
438
  anchor.addEventListener('click', event => {
439
439
  event.consume(true);
440
- Common.Revealer.reveal(header.ownerNode || null);
440
+ void Common.Revealer.reveal(header.ownerNode || null);
441
441
  }, false);
442
442
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
443
443
  // This workaround is needed to make stylelint happy
@@ -700,7 +700,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
700
700
  static invokeFirstAction(linkInfo: _LinkInfo): boolean {
701
701
  const actions = Linkifier.linkActions(linkInfo);
702
702
  if (actions.length) {
703
- actions[0].handler.call(null);
703
+ void actions[0].handler.call(null);
704
704
  return true;
705
705
  }
706
706
  return false;
@@ -21,7 +21,7 @@ export class TargetDetachedDialog extends SDK.SDKModel.SDKModel<void> implements
21
21
  constructor(target: SDK.Target.Target) {
22
22
  super(target);
23
23
  target.registerInspectorDispatcher(this);
24
- target.inspectorAgent().invoke_enable();
24
+ void target.inspectorAgent().invoke_enable();
25
25
  // Hide all dialogs if a new top-level target is created.
26
26
  if (target.parentTarget()?.type() === SDK.Target.Type.Browser && TargetDetachedDialog.hideCrashedDialog) {
27
27
  TargetDetachedDialog.hideCrashedDialog.call(null);
@@ -71,7 +71,7 @@ export class TargetDetachedDialog extends SDK.SDKModel.SDKModel<void> implements
71
71
  /** ;
72
72
  */
73
73
  targetReloadedAfterCrash(): void {
74
- this.target().runtimeAgent().invoke_runIfWaitingForDebugger();
74
+ void this.target().runtimeAgent().invoke_runIfWaitingForDebugger();
75
75
  if (TargetDetachedDialog.hideCrashedDialog) {
76
76
  TargetDetachedDialog.hideCrashedDialog.call(null);
77
77
  TargetDetachedDialog.hideCrashedDialog = null;
@@ -27,18 +27,16 @@
27
27
  */
28
28
 
29
29
  .webkit-css-property {
30
- color: var(--webkit-css-property-color, rgb(200 0 0)); /* stylelint-disable-line plugin/use_theme_colors */ /* See: crbug.com/1152736 for color variable migration. */
30
+ color: var(--webkit-css-property-color, var(--color-syntax-1)); /* stylelint-disable-line plugin/use_theme_colors */ /* See: crbug.com/1152736 for color variable migration. */
31
31
  }
32
32
 
33
33
  .webkit-html-comment {
34
34
  /* Keep this in sync with view-source.css (.webkit-html-comment) */
35
- color: rgb(35 110 37); /* stylelint-disable-line plugin/use_theme_colors */
36
- /* See: crbug.com/1152736 for color variable migration. */
35
+ color: var(--color-token-comment);
37
36
  }
38
37
 
39
38
  .webkit-html-tag {
40
- color: rgb(168 148 166); /* stylelint-disable-line plugin/use_theme_colors */
41
- /* See: crbug.com/1152736 for color variable migration. */
39
+ color: var(--color-token-tag);
42
40
  }
43
41
 
44
42
  .webkit-html-tag-name,
@@ -49,16 +47,17 @@
49
47
 
50
48
  .webkit-html-pseudo-element {
51
49
  /* This one is non-standard. */
52
- color: rgb(17 85 204); /* stylelint-disable-line plugin/use_theme_colors */
53
- /* See: crbug.com/1152736 for color variable migration. */
50
+ color: var(--color-token-pseudo-element);
54
51
  }
55
52
 
56
53
  .webkit-html-js-node,
57
54
  .webkit-html-css-node {
55
+ color: var(--color-text-primary);
58
56
  white-space: pre-wrap;
59
57
  }
60
58
 
61
59
  .webkit-html-text-node {
60
+ color: var(--color-text-primary);
62
61
  unicode-bidi: -webkit-isolate;
63
62
  }
64
63
 
@@ -77,15 +76,13 @@
77
76
 
78
77
  .webkit-html-attribute-name {
79
78
  /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
80
- color: var(--color-token-attribute); /* stylelint-disable-line plugin/use_theme_colors */
81
- /* See: crbug.com/1152736 for color variable migration. */
79
+ color: var(--color-token-attribute);
82
80
  unicode-bidi: -webkit-isolate;
83
81
  }
84
82
 
85
83
  .webkit-html-attribute-value {
86
84
  /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */
87
- color: rgb(26 26 166); /* stylelint-disable-line plugin/use_theme_colors */
88
- /* See: crbug.com/1152736 for color variable migration. */
85
+ color: var(--color-token-attribute-value);
89
86
  unicode-bidi: -webkit-isolate;
90
87
  word-break: break-all;
91
88
  }
@@ -236,6 +236,7 @@
236
236
  flex: 0 0 auto;
237
237
  flex-direction: column;
238
238
  padding-top: 10px;
239
+ padding-right: 8px;
239
240
  overflow: hidden;
240
241
  }
241
242
 
@@ -155,6 +155,7 @@
155
155
  --color-token-meta: rgb(85 85 85);
156
156
  --color-token-deleted: rgb(221 68 68);
157
157
  --color-token-inserted: rgb(34 153 34);
158
+ --color-token-pseudo-element: rgb(17 85 204);
158
159
 
159
160
  /* Colors used by the code editor */
160
161
  --color-secondary-cursor: #c0c0c0;
@@ -295,8 +296,9 @@
295
296
  --color-token-comment: rgb(137 137 137);
296
297
  --color-token-tag: rgb(93 176 215);
297
298
  --color-token-attribute: rgb(155 187 220);
298
- --color-token-attribute-value: rgb(1 200 1);
299
+ --color-token-attribute-value: rgb(242 151 102);
299
300
  --color-token-meta: rgb(221 251 85);
301
+ --color-token-pseudo-element: rgb(237 119 229);
300
302
 
301
303
  /* Colors used by the code editor */
302
304
  --color-secondary-cursor: rgb(63 63 63);
@@ -34,46 +34,20 @@
34
34
  */
35
35
 
36
36
  import * as Common from '../../../core/common/common.js';
37
- import * as Platform from '../../../core/platform/platform.js';
38
37
 
39
38
  import inspectorSyntaxHighlightStyles from '../inspectorSyntaxHighlight.css.legacy.js';
40
- import inspectorSyntaxHighlightDarkStyles from '../inspectorSyntaxHighlightDark.css.legacy.js';
41
39
 
42
40
  let themeSupportInstance: ThemeSupport;
43
41
 
44
42
  const themeValuesCache = new Map<CSSStyleDeclaration, Map<string, string>>();
45
43
 
46
- export class ThemeSupport {
47
- private readonly themeNameInternal: string;
48
- private themableProperties: Set<string>;
49
- private readonly cachedThemePatches: Map<string, string>;
50
- private readonly setting: Common.Settings.Setting<string>;
51
- private readonly customSheets: Set<string>;
52
- private readonly computedRoot: () => symbol | CSSStyleDeclaration;
53
- private injectingStyleSheet?: boolean;
44
+ export class ThemeSupport extends EventTarget {
45
+ private themeNameInternal = 'systemPreferred';
46
+ private customSheets: Set<string> = new Set();
47
+ private computedRoot = Common.Lazy.lazy(() => window.getComputedStyle(document.documentElement));
54
48
 
55
- private constructor(setting: Common.Settings.Setting<string>) {
56
- const systemPreferredTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'default';
57
- this.themeNameInternal = setting.get() === 'systemPreferred' ? systemPreferredTheme : setting.get();
58
- this.themableProperties = new Set([
59
- 'color',
60
- 'box-shadow',
61
- 'text-shadow',
62
- 'outline-color',
63
- 'background-image',
64
- 'background-color',
65
- 'border-left-color',
66
- 'border-right-color',
67
- 'border-top-color',
68
- 'border-bottom-color',
69
- '-webkit-border-image',
70
- 'fill',
71
- 'stroke',
72
- ]);
73
- this.cachedThemePatches = new Map();
74
- this.setting = setting;
75
- this.customSheets = new Set();
76
- this.computedRoot = Common.Lazy.lazy(() => window.getComputedStyle(document.documentElement));
49
+ private constructor(private setting: Common.Settings.Setting<string>) {
50
+ super();
77
51
  }
78
52
 
79
53
  static hasInstance(): boolean {
@@ -139,12 +113,7 @@ export class ThemeSupport {
139
113
  }
140
114
 
141
115
  injectHighlightStyleSheets(element: Element|ShadowRoot): void {
142
- this.injectingStyleSheet = true;
143
116
  this.appendStyle(element, inspectorSyntaxHighlightStyles);
144
- if (this.themeNameInternal === 'dark') {
145
- this.appendStyle(element, inspectorSyntaxHighlightDarkStyles);
146
- }
147
- this.injectingStyleSheet = false;
148
117
  }
149
118
 
150
119
  /**
@@ -165,212 +134,37 @@ export class ThemeSupport {
165
134
  }
166
135
  }
167
136
 
168
- isForcedColorsMode(): boolean {
169
- return window.matchMedia('(forced-colors: active)').matches;
170
- }
171
-
172
137
  addCustomStylesheet(sheetText: string): void {
173
138
  this.customSheets.add(sheetText);
174
139
  }
175
140
 
176
141
  applyTheme(document: Document): void {
177
- if (!this.hasTheme() || this.isForcedColorsMode()) {
142
+ const isForcedColorsMode = window.matchMedia('(forced-colors: active)').matches;
143
+ if (isForcedColorsMode) {
178
144
  return;
179
145
  }
180
146
 
181
- if (this.themeNameInternal === 'dark') {
182
- document.documentElement.classList.add('-theme-with-dark-background');
183
- }
184
-
185
- const styleSheets = document.styleSheets;
186
- const result = [];
187
- for (let i = 0; i < styleSheets.length; ++i) {
188
- const href = styleSheets[i].href;
189
- if (!href) {
190
- continue;
191
- }
192
- result.push(this.patchForTheme(href, (styleSheets[i] as CSSStyleSheet)));
193
- }
194
- result.push('/*# sourceURL=inspector.css.theme */');
195
-
196
- const styleElement = document.createElement('style');
197
- styleElement.textContent = result.join('\n');
198
- document.head.appendChild(styleElement);
199
- }
200
-
201
- themeStyleSheet(id: string, text: string): string {
202
- if (!this.hasTheme() || this.injectingStyleSheet || this.isForcedColorsMode()) {
203
- return '';
204
- }
205
-
206
- let patch = this.cachedThemePatches.get(id);
207
- if (!patch) {
208
- const styleElement = document.createElement('style');
209
- styleElement.textContent = text;
210
- document.body.appendChild(styleElement);
211
-
212
- const {sheet} = styleElement;
213
- if (!sheet) {
214
- throw new Error('No sheet in stylesheet object');
215
- }
216
- patch = this.patchForTheme(id, sheet);
217
- document.body.removeChild(styleElement);
218
- }
219
- return patch;
220
- }
221
-
222
- private patchForTheme(id: string, styleSheet: CSSStyleSheet): string {
223
- const cached = this.cachedThemePatches.get(id);
224
- if (cached) {
225
- return cached;
226
- }
227
-
228
- try {
229
- const rules = styleSheet.cssRules;
230
- const result = [];
231
- for (let j = 0; j < rules.length; ++j) {
232
- const rule = rules[j];
233
- if (rule instanceof CSSImportRule) {
234
- result.push(this.patchForTheme(rule.styleSheet.href || '', rule.styleSheet));
235
- continue;
236
- }
237
-
238
- if (!(rule instanceof CSSStyleRule)) {
239
- continue;
240
- }
241
-
242
- const output: string[] = [];
243
- const style = rule.style;
244
- const selectorText = rule.selectorText;
245
- for (let i = 0; style && i < style.length; ++i) {
246
- this.patchProperty(selectorText, style, style[i], output);
247
- }
248
- if (output.length) {
249
- result.push(rule.selectorText + '{' + output.join('') + '}');
250
- }
251
- }
252
-
253
- const fullText = result.join('\n');
254
- this.cachedThemePatches.set(id, fullText);
255
- return fullText;
256
- } catch (e) {
257
- this.setting.set('default');
258
- return '';
259
- }
260
- }
261
-
262
- /**
263
- * Theming API is primarily targeted at making dark theme look good.
264
- * - If rule has ".-theme-preserve" in selector, it won't be affected.
265
- * - One can create specializations for dark themes via body.-theme-with-dark-background selector in host context.
266
- */
267
- private patchProperty(selectorText: string, style: CSSStyleDeclaration, name: string, output: string[]): void {
268
- if (!this.themableProperties.has(name)) {
269
- return;
270
- }
271
-
272
- const value = style.getPropertyValue(name);
273
- if (!value || value === 'none' || value === 'inherit' || value === 'initial' || value === 'transparent') {
274
- return;
275
- }
276
- if (name === 'background-image' && value.indexOf('gradient') === -1) {
277
- return;
278
- }
279
-
280
- if (selectorText.indexOf('-theme-') !== -1) {
281
- return;
282
- }
147
+ const systemPreferredTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'default';
148
+ this.themeNameInternal = this.setting.get() === 'systemPreferred' ? systemPreferredTheme : this.setting.get();
283
149
 
284
- let colorUsage = ThemeSupport.ColorUsage.Unknown;
285
- if (name.indexOf('background') === 0 || name.indexOf('border') === 0) {
286
- colorUsage |= ThemeSupport.ColorUsage.Background;
287
- }
288
- if (name.indexOf('background') === -1) {
289
- colorUsage |= ThemeSupport.ColorUsage.Foreground;
290
- }
150
+ const wasDarkThemed = document.documentElement.classList.contains('-theme-with-dark-background');
151
+ document.documentElement.classList.toggle('-theme-with-dark-background', this.themeNameInternal === 'dark');
291
152
 
292
- output.push(name);
293
- output.push(':');
294
- if (/^var\(.*\)$/.test(value)) {
295
- // Don't translate CSS variables.
296
- output.push(value);
297
- } else {
298
- const items = value.replace(Common.Color.Regex, '\0$1\0').split('\0');
299
- for (const item of items) {
300
- output.push(this.patchColorText(item, (colorUsage as number)));
301
- }
302
- }
303
- if (style.getPropertyPriority(name)) {
304
- output.push(' !important');
305
- }
306
- output.push(';');
307
- }
153
+ const isDarkThemed = document.documentElement.classList.contains('-theme-with-dark-background');
308
154
 
309
- /**
310
- * This legacy function has been supeseded by CSS custom properties. Wherever possible, please use
311
- * the values declared in global stylesheets.
312
- *
313
- * @deprecated
314
- */
315
- patchColorText(text: string, colorUsage: number): string {
316
- const color = Common.Color.Color.parse(text);
317
- if (!color) {
318
- return text;
155
+ // In the event the theme changes we need to clear caches and notify subscribers.
156
+ if (wasDarkThemed !== isDarkThemed) {
157
+ themeValuesCache.clear();
158
+ this.customSheets.clear();
159
+ this.dispatchEvent(new ThemeChangeEvent());
319
160
  }
320
- const outColor = this.patchColor(color, colorUsage);
321
- let outText = outColor.asString(null);
322
- if (!outText) {
323
- outText = outColor.asString(outColor.hasAlpha() ? Common.Color.Format.RGBA : Common.Color.Format.RGB);
324
- }
325
- return outText || text;
326
- }
327
-
328
- /**
329
- * This legacy function has been supeseded by CSS custom properties. Wherever possible, please use
330
- * the values declared in global stylesheets.
331
- *
332
- * @deprecated
333
- */
334
- patchColor(color: Common.Color.Color, colorUsage: number): Common.Color.Color {
335
- const hsla = color.hsla();
336
- this.patchHSLA(hsla, colorUsage);
337
-
338
- const rgba: number[] = [];
339
- Common.Color.Color.hsl2rgb(hsla, rgba);
340
- return new Common.Color.Color(rgba, color.format());
341
161
  }
162
+ }
342
163
 
343
- private patchHSLA(hsla: number[], colorUsage: number): void {
344
- const hue = hsla[0];
345
- const sat = hsla[1];
346
- let lit: number = hsla[2];
347
- const alpha = hsla[3];
164
+ export class ThemeChangeEvent extends Event {
165
+ static readonly eventName = 'themechange';
348
166
 
349
- switch (this.themeNameInternal) {
350
- case 'dark': {
351
- const minCap = colorUsage & ThemeSupport.ColorUsage.Background ? 0.14 : 0;
352
- const maxCap = colorUsage & ThemeSupport.ColorUsage.Foreground ? 0.9 : 1;
353
- lit = 1 - lit;
354
- if (lit < minCap * 2) {
355
- lit = minCap + lit / 2;
356
- } else if (lit > 2 * maxCap - 1) {
357
- lit = maxCap - 1 / 2 + lit / 2;
358
- }
359
- break;
360
- }
361
- }
362
- hsla[0] = Platform.NumberUtilities.clamp(hue, 0, 1);
363
- hsla[1] = Platform.NumberUtilities.clamp(sat, 0, 1);
364
- hsla[2] = Platform.NumberUtilities.clamp(lit, 0, 1);
365
- hsla[3] = Platform.NumberUtilities.clamp(alpha, 0, 1);
366
- }
367
- }
368
- export namespace ThemeSupport {
369
- // TODO(crbug.com/1167717): Make this a const enum again
370
- // eslint-disable-next-line rulesdir/const_enum
371
- export enum ColorUsage {
372
- Unknown = 0,
373
- Foreground = 1,
374
- Background = 2,
167
+ constructor() {
168
+ super(ThemeChangeEvent.eventName, {bubbles: true, composed: true});
375
169
  }
376
170
  }
@@ -294,6 +294,7 @@ select.toolbar-item:disabled {
294
294
  opacity: 50%;
295
295
  }
296
296
 
297
+ button.toolbar-item:focus-visible,
297
298
  select.toolbar-item:focus-visible {
298
299
  background: var(--color-background-elevation-2);
299
300
  border-radius: 2px;
package/package.json CHANGED
@@ -53,5 +53,5 @@
53
53
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
54
54
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
55
55
  },
56
- "version": "1.0.954845"
56
+ "version": "1.0.956401"
57
57
  }
@@ -150,8 +150,8 @@ function createServerIndexFile(componentNames) {
150
150
  <meta charset="UTF-8" />
151
151
  <meta name="viewport" content="width=device-width" />
152
152
  <title>DevTools components</title>
153
- <link rel="stylesheet" href="/front_end/ui/legacy/themeColors.css" />
154
- <link rel="stylesheet" href="/front_end/ui/components/docs/component_docs_styles.css" />
153
+ <link rel="stylesheet" href="${sharedResourcesBase}front_end/ui/legacy/themeColors.css" />
154
+ <link rel="stylesheet" href="${sharedResourcesBase}front_end/ui/components/docs/component_docs_styles.css" />
155
155
  </head>
156
156
  <body id="index-page">
157
157
  <h1>DevTools components</h1>