chrome-devtools-frontend 1.0.941208 → 1.0.943182

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 (289) hide show
  1. package/WATCHLISTS +1 -1
  2. package/config/gni/all_devtools_files.gni +0 -64
  3. package/config/gni/devtools_grd_files.gni +54 -19
  4. package/config/gni/devtools_image_files.gni +1 -3
  5. package/front_end/.eslintrc.js +11 -1
  6. package/front_end/Images/src/{feedback_thin_16x16_icon.svg → survey_feedback_icon.svg} +1 -1
  7. package/front_end/Tests.js +1 -32
  8. package/front_end/core/common/Color.ts +5 -0
  9. package/front_end/core/i18n/locales/en-US.json +17 -29
  10. package/front_end/core/i18n/locales/en-XL.json +17 -29
  11. package/front_end/core/sdk/CPUProfilerModel.ts +7 -9
  12. package/front_end/core/sdk/ConsoleModel.ts +27 -33
  13. package/front_end/core/sdk/DebuggerModel.ts +4 -14
  14. package/front_end/core/sdk/sdk-meta.ts +17 -3
  15. package/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.ts +1 -1
  16. package/front_end/entrypoints/devtools_app/devtools_app.js +1 -1
  17. package/front_end/entrypoints/devtools_app/devtools_app.json +1 -12
  18. package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -1
  19. package/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.ts +1 -1
  20. package/front_end/entrypoints/inspector/inspector.js +1 -1
  21. package/front_end/entrypoints/inspector/inspector.json +1 -3
  22. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +2 -3
  23. package/front_end/entrypoints/js_app/js_app.js +1 -1
  24. package/front_end/entrypoints/js_app/js_app.json +1 -3
  25. package/front_end/entrypoints/main/MainImpl.ts +26 -0
  26. package/front_end/entrypoints/main/main-meta.ts +1 -2
  27. package/front_end/entrypoints/ndb_app/ndb_app.js +1 -1
  28. package/front_end/entrypoints/node_app/node_app-meta.ts +0 -2
  29. package/front_end/entrypoints/node_app/node_app.js +1 -1
  30. package/front_end/entrypoints/node_app/node_app.json +1 -3
  31. package/front_end/entrypoints/node_main/node_main-meta.ts +0 -1
  32. package/front_end/entrypoints/shell/shell.js +0 -11
  33. package/front_end/entrypoints/shell/shell.json +1 -5
  34. package/front_end/entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.ts +1 -1
  35. package/front_end/entrypoints/worker_app/worker_app.js +1 -1
  36. package/front_end/entrypoints/worker_app/worker_app.json +1 -7
  37. package/front_end/generated/InspectorBackendCommands.js +19 -0
  38. package/front_end/generated/protocol-mapping.d.ts +31 -1
  39. package/front_end/generated/protocol-proxy-api.d.ts +34 -2
  40. package/front_end/generated/protocol.d.ts +81 -6
  41. package/front_end/legacy_test_runner/bindings_test_runner/IsolatedFilesystemTestRunner.js +2 -2
  42. package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +5 -1
  43. package/front_end/legacy_test_runner/legacy_test_runner.ts +10 -1
  44. package/front_end/legacy_test_runner/test_runner/TestRunner.js +3 -1
  45. package/front_end/models/formatter/SourceFormatter.ts +0 -10
  46. package/front_end/models/persistence/persistence-meta.ts +0 -1
  47. package/front_end/models/workspace/UISourceCode.ts +9 -42
  48. package/front_end/panels/accessibility/accessibility-meta.ts +0 -1
  49. package/front_end/panels/animation/AnimationTimeline.ts +3 -3
  50. package/front_end/panels/animation/animation-meta.ts +0 -1
  51. package/front_end/panels/application/ApplicationPanelSidebar.ts +3 -3
  52. package/front_end/panels/application/BackForwardCacheStrings.ts +3 -1
  53. package/front_end/panels/application/application-meta.ts +0 -4
  54. package/front_end/panels/application/components/EndpointsGrid.ts +1 -1
  55. package/front_end/panels/application/components/ReportsGrid.ts +1 -1
  56. package/front_end/panels/application/components/stackTraceRow.css +8 -0
  57. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +1 -2
  58. package/front_end/panels/changes/changes-meta.ts +0 -1
  59. package/front_end/panels/console/ConsolePinPane.ts +23 -32
  60. package/front_end/panels/console/ConsoleViewMessage.ts +8 -1
  61. package/front_end/panels/console/console-meta.ts +0 -1
  62. package/front_end/panels/console_counters/console_counters-meta.ts +0 -1
  63. package/front_end/panels/coverage/CoverageDecorationManager.ts +4 -5
  64. package/front_end/panels/coverage/CoverageView.ts +2 -105
  65. package/front_end/panels/coverage/coverage-meta.ts +0 -1
  66. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +11 -56
  67. package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -8
  68. package/front_end/panels/css_overview/css_overview-meta.ts +0 -1
  69. package/front_end/panels/developer_resources/developer_resources-meta.ts +0 -1
  70. package/front_end/panels/elements/ElementsTreeElement.ts +4 -9
  71. package/front_end/panels/elements/components/StylePropertyEditor.ts +2 -0
  72. package/front_end/panels/elements/components/adornerSettingsPane.css +0 -4
  73. package/front_end/panels/elements/elements-meta.ts +0 -1
  74. package/front_end/panels/emulation/DeviceModeToolbar.ts +3 -1
  75. package/front_end/panels/emulation/DeviceModeView.ts +2 -1
  76. package/front_end/panels/emulation/InspectedPagePlaceholder.ts +3 -1
  77. package/front_end/panels/emulation/MediaQueryInspector.ts +3 -1
  78. package/front_end/panels/emulation/emulation-meta.ts +2 -5
  79. package/front_end/panels/help/help-meta.ts +0 -1
  80. package/front_end/panels/input/input-meta.ts +0 -1
  81. package/front_end/panels/issues/issues-meta.ts +0 -3
  82. package/front_end/panels/js_profiler/js_profiler-meta.ts +0 -4
  83. package/front_end/panels/layers/layers-meta.ts +0 -4
  84. package/front_end/panels/lighthouse/LighthousePanel.ts +2 -4
  85. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +1 -4
  86. package/front_end/panels/lighthouse/lighthouse-meta.ts +0 -1
  87. package/front_end/panels/lighthouse/lighthouseStartView.css +4 -0
  88. package/front_end/panels/lighthouse/module.json +0 -6
  89. package/front_end/panels/media/media-meta.ts +0 -4
  90. package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +0 -1
  91. package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -1
  92. package/front_end/panels/network/network-meta.ts +1 -5
  93. package/front_end/panels/performance_monitor/performance_monitor-meta.ts +0 -1
  94. package/front_end/panels/profiler/CPUProfileView.ts +10 -3
  95. package/front_end/panels/profiler/profiler-meta.ts +0 -3
  96. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +0 -1
  97. package/front_end/panels/screencast/screencast-meta.ts +0 -4
  98. package/front_end/panels/security/security-meta.ts +0 -4
  99. package/front_end/panels/sensors/sensors-meta.ts +0 -1
  100. package/front_end/panels/settings/emulation/emulation-meta.ts +0 -1
  101. package/front_end/panels/settings/settings-meta.ts +0 -1
  102. package/front_end/panels/sources/BreakpointEditDialog.ts +16 -30
  103. package/front_end/panels/sources/CSSPlugin.ts +310 -331
  104. package/front_end/panels/sources/CallStackSidebarPane.ts +28 -34
  105. package/front_end/panels/sources/CoveragePlugin.ts +121 -6
  106. package/front_end/panels/sources/DebuggerPlugin.ts +1166 -1243
  107. package/front_end/panels/sources/EditingLocationHistoryManager.ts +71 -101
  108. package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -3
  109. package/front_end/panels/sources/InplaceFormatterEditorAction.ts +3 -3
  110. package/front_end/panels/sources/JavaScriptCompilerPlugin.ts +26 -23
  111. package/front_end/panels/sources/Plugin.ts +20 -4
  112. package/front_end/panels/sources/ProfilePlugin.ts +185 -0
  113. package/front_end/panels/sources/ScriptFormatterEditorAction.ts +3 -3
  114. package/front_end/panels/sources/ScriptOriginPlugin.ts +0 -10
  115. package/front_end/panels/sources/SnippetsPlugin.ts +1 -10
  116. package/front_end/panels/sources/SourcesPanel.ts +6 -5
  117. package/front_end/panels/sources/SourcesView.ts +10 -8
  118. package/front_end/panels/sources/TabbedEditorContainer.ts +31 -27
  119. package/front_end/panels/sources/UISourceCodeFrame.ts +335 -470
  120. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -2
  121. package/front_end/panels/sources/sources-legacy.ts +0 -6
  122. package/front_end/panels/sources/sources-meta.ts +2 -6
  123. package/front_end/panels/sources/sources.ts +0 -2
  124. package/front_end/panels/timeline/timeline-meta.ts +2 -9
  125. package/front_end/panels/web_audio/web_audio-meta.ts +0 -1
  126. package/front_end/panels/webauthn/webauthn-meta.ts +0 -1
  127. package/front_end/third_party/codemirror.next/bundle.ts +9 -13
  128. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  129. package/front_end/third_party/codemirror.next/chunk/javascript.js +2 -2
  130. package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -6
  131. package/front_end/third_party/codemirror.next/chunk/php.js +2 -6
  132. package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
  133. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
  134. package/front_end/third_party/codemirror.next/chunk/xml.js +2 -2
  135. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +279 -198
  136. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  137. package/front_end/third_party/codemirror.next/package.json +13 -11
  138. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1128 -1158
  139. package/front_end/third_party/lighthouse/locales/ar-XB.json +211 -79
  140. package/front_end/third_party/lighthouse/locales/ar.json +213 -81
  141. package/front_end/third_party/lighthouse/locales/bg.json +211 -79
  142. package/front_end/third_party/lighthouse/locales/ca.json +212 -80
  143. package/front_end/third_party/lighthouse/locales/cs.json +211 -79
  144. package/front_end/third_party/lighthouse/locales/da.json +211 -79
  145. package/front_end/third_party/lighthouse/locales/de.json +211 -79
  146. package/front_end/third_party/lighthouse/locales/el.json +213 -81
  147. package/front_end/third_party/lighthouse/locales/en-GB.json +211 -79
  148. package/front_end/third_party/lighthouse/locales/en-US.json +186 -75
  149. package/front_end/third_party/lighthouse/locales/en-XA.json +211 -79
  150. package/front_end/third_party/lighthouse/locales/en-XL.json +186 -75
  151. package/front_end/third_party/lighthouse/locales/es-419.json +211 -79
  152. package/front_end/third_party/lighthouse/locales/es.json +212 -80
  153. package/front_end/third_party/lighthouse/locales/fi.json +211 -79
  154. package/front_end/third_party/lighthouse/locales/fil.json +211 -79
  155. package/front_end/third_party/lighthouse/locales/fr.json +211 -79
  156. package/front_end/third_party/lighthouse/locales/he.json +212 -80
  157. package/front_end/third_party/lighthouse/locales/hi.json +214 -82
  158. package/front_end/third_party/lighthouse/locales/hr.json +211 -79
  159. package/front_end/third_party/lighthouse/locales/hu.json +211 -79
  160. package/front_end/third_party/lighthouse/locales/id.json +211 -79
  161. package/front_end/third_party/lighthouse/locales/it.json +211 -79
  162. package/front_end/third_party/lighthouse/locales/ja.json +211 -79
  163. package/front_end/third_party/lighthouse/locales/ko.json +211 -79
  164. package/front_end/third_party/lighthouse/locales/lt.json +211 -79
  165. package/front_end/third_party/lighthouse/locales/lv.json +214 -82
  166. package/front_end/third_party/lighthouse/locales/nl.json +211 -79
  167. package/front_end/third_party/lighthouse/locales/no.json +211 -79
  168. package/front_end/third_party/lighthouse/locales/pl.json +211 -79
  169. package/front_end/third_party/lighthouse/locales/pt-PT.json +211 -79
  170. package/front_end/third_party/lighthouse/locales/pt.json +211 -79
  171. package/front_end/third_party/lighthouse/locales/ro.json +212 -80
  172. package/front_end/third_party/lighthouse/locales/ru.json +211 -79
  173. package/front_end/third_party/lighthouse/locales/sk.json +211 -79
  174. package/front_end/third_party/lighthouse/locales/sl.json +211 -79
  175. package/front_end/third_party/lighthouse/locales/sr-Latn.json +211 -79
  176. package/front_end/third_party/lighthouse/locales/sr.json +211 -79
  177. package/front_end/third_party/lighthouse/locales/sv.json +211 -79
  178. package/front_end/third_party/lighthouse/locales/ta.json +218 -86
  179. package/front_end/third_party/lighthouse/locales/te.json +251 -119
  180. package/front_end/third_party/lighthouse/locales/th.json +211 -79
  181. package/front_end/third_party/lighthouse/locales/tr.json +211 -79
  182. package/front_end/third_party/lighthouse/locales/uk.json +212 -80
  183. package/front_end/third_party/lighthouse/locales/vi.json +211 -79
  184. package/front_end/third_party/lighthouse/locales/zh-HK.json +211 -79
  185. package/front_end/third_party/lighthouse/locales/zh-TW.json +211 -79
  186. package/front_end/third_party/lighthouse/locales/zh.json +211 -79
  187. package/front_end/third_party/lighthouse/report/bundle.d.ts +72 -34
  188. package/front_end/third_party/lighthouse/report/bundle.js +698 -492
  189. package/front_end/third_party/lighthouse/report-assets/report-generator.js +1 -2
  190. package/front_end/third_party/lighthouse/report-assets/report.js +40 -35
  191. package/front_end/third_party/lighthouse/report-assets/standalone-template.html +2 -4
  192. package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +60 -68
  193. package/front_end/ui/components/data_grid/dataGrid.css +12 -10
  194. package/front_end/ui/components/docs/component_docs.ts +14 -0
  195. package/front_end/ui/components/docs/create_breadcrumbs.ts +1 -1
  196. package/front_end/ui/components/docs/css_overview/start_view.html +25 -0
  197. package/front_end/ui/components/docs/css_overview/start_view.ts +14 -0
  198. package/front_end/ui/components/docs/icon_button/basic.ts +3 -3
  199. package/front_end/ui/components/docs/toggle_dark_mode.ts +1 -0
  200. package/front_end/ui/components/docs/toggle_fonts.ts +2 -0
  201. package/front_end/ui/components/helpers/get-stylesheet.ts +0 -15
  202. package/front_end/ui/components/linear_memory_inspector/linear_memory_inspector-meta.ts +1 -2
  203. package/front_end/ui/components/markdown_view/MarkdownImagesMap.ts +1 -1
  204. package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
  205. package/front_end/ui/components/text_editor/TextEditor.ts +79 -36
  206. package/front_end/ui/components/text_editor/config.ts +42 -26
  207. package/front_end/ui/components/text_editor/javascript.ts +2 -3
  208. package/front_end/ui/components/text_editor/position.ts +17 -0
  209. package/front_end/ui/components/text_editor/text_editor.ts +1 -0
  210. package/front_end/ui/components/text_editor/theme.ts +5 -1
  211. package/front_end/ui/components/tree_outline/TreeOutline.ts +63 -8
  212. package/front_end/ui/components/tree_outline/TreeOutlineUtils.ts +8 -6
  213. package/front_end/ui/legacy/Dialog.ts +3 -1
  214. package/front_end/ui/legacy/DropTarget.ts +2 -1
  215. package/front_end/ui/legacy/EmptyWidget.ts +2 -1
  216. package/front_end/ui/legacy/FilterBar.ts +2 -1
  217. package/front_end/ui/legacy/GlassPane.ts +4 -2
  218. package/front_end/ui/legacy/Infobar.ts +5 -8
  219. package/front_end/ui/legacy/InspectorView.ts +6 -1
  220. package/front_end/ui/legacy/ListWidget.ts +2 -1
  221. package/front_end/ui/legacy/PopoverHelper.ts +2 -1
  222. package/front_end/ui/legacy/ProgressIndicator.ts +2 -1
  223. package/front_end/ui/legacy/RemoteDebuggingTerminatedScreen.ts +2 -1
  224. package/front_end/ui/legacy/ReportView.ts +2 -1
  225. package/front_end/ui/legacy/RootView.ts +2 -1
  226. package/front_end/ui/legacy/SearchableView.ts +2 -1
  227. package/front_end/ui/legacy/ShortcutRegistry.ts +11 -7
  228. package/front_end/ui/legacy/SoftContextMenu.ts +3 -2
  229. package/front_end/ui/legacy/SoftDropDown.ts +4 -2
  230. package/front_end/ui/legacy/SplitWidget.ts +2 -1
  231. package/front_end/ui/legacy/SuggestBox.ts +2 -1
  232. package/front_end/ui/legacy/TabbedPane.ts +2 -1
  233. package/front_end/ui/legacy/TargetCrashedScreen.ts +2 -1
  234. package/front_end/ui/legacy/TextPrompt.ts +2 -1
  235. package/front_end/ui/legacy/Toolbar.ts +3 -2
  236. package/front_end/ui/legacy/Treeoutline.ts +4 -3
  237. package/front_end/ui/legacy/UIUtils.ts +17 -14
  238. package/front_end/ui/legacy/ViewManager.ts +2 -1
  239. package/front_end/ui/legacy/components/inline_editor/CSSAngle.ts +1 -2
  240. package/front_end/ui/legacy/components/inline_editor/cssAngle.css +4 -0
  241. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +2 -2
  242. package/front_end/ui/legacy/components/object_ui/object_ui-meta.ts +0 -4
  243. package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +35 -131
  244. package/front_end/ui/legacy/components/perf_ui/perf_ui-meta.ts +0 -3
  245. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +2 -2
  246. package/front_end/ui/legacy/components/quick_open/quick_open-meta.ts +2 -3
  247. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +3 -6
  248. package/front_end/ui/legacy/components/source_frame/FontView.ts +4 -1
  249. package/front_end/ui/legacy/components/source_frame/ImageView.ts +4 -1
  250. package/front_end/ui/legacy/components/source_frame/JSONView.ts +4 -1
  251. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +21 -15
  252. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +501 -252
  253. package/front_end/ui/legacy/components/source_frame/XMLView.ts +7 -2
  254. package/front_end/ui/legacy/components/source_frame/source_frame-legacy.ts +0 -11
  255. package/front_end/ui/legacy/components/source_frame/source_frame.ts +0 -2
  256. package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +2 -0
  257. package/front_end/ui/legacy/components/text_editor/cmdevtools.css +3 -1
  258. package/front_end/ui/legacy/components/text_editor/module.json +0 -3
  259. package/front_end/ui/legacy/components/utils/Linkifier.ts +7 -15
  260. package/front_end/ui/legacy/radioButton.css +1 -13
  261. package/front_end/ui/legacy/textButton.css +5 -4
  262. package/front_end/ui/legacy/themeColors.css +36 -0
  263. package/front_end/ui/legacy/theme_support/theme_support_impl.ts +7 -9
  264. package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +2 -2
  265. package/front_end/ui/legacy/utils/inject-core-styles.ts +7 -4
  266. package/package.json +1 -1
  267. package/scripts/check_gn.js +0 -35
  268. package/scripts/eslint_rules/lib/es_modules_import.js +15 -8
  269. package/scripts/eslint_rules/tests/es_modules_import_test.js +8 -0
  270. package/front_end/Images/radioDot-dark-theme.png +0 -0
  271. package/front_end/Images/radioDot.png +0 -0
  272. package/front_end/emulated_devices/module.json +0 -6
  273. package/front_end/panels/application/module.json +0 -6
  274. package/front_end/panels/emulation/module.json +0 -11
  275. package/front_end/panels/issues/module.json +0 -6
  276. package/front_end/panels/js_profiler/module.json +0 -5
  277. package/front_end/panels/layer_viewer/module.json +0 -5
  278. package/front_end/panels/layers/module.json +0 -5
  279. package/front_end/panels/media/module.json +0 -5
  280. package/front_end/panels/network/module.json +0 -5
  281. package/front_end/panels/profiler/module.json +0 -5
  282. package/front_end/panels/screencast/module.json +0 -6
  283. package/front_end/panels/security/module.json +0 -5
  284. package/front_end/panels/timeline/module.json +0 -7
  285. package/front_end/third_party/lighthouse/report-assets/report.css +0 -1774
  286. package/front_end/ui/legacy/components/source_frame/SourcesTextEditor.ts +0 -1030
  287. package/front_end/ui/legacy/components/source_frame/messagesPopover.css +0 -32
  288. package/front_end/ui/legacy/components/source_frame/module.json +0 -14
  289. package/front_end/ui/legacy/module.json +0 -41
@@ -21,13 +21,11 @@ limitations under the License.
21
21
  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
22
22
  <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEhklEQVR4AWJxL/BhIAesev1U5tcflpncgNrKIsqNIwzC9feMpDUzs70kOczMzMzJJcxwCTMzncPMnOwtzBwzMzPb0vRfeZPp0VhPS5I39V5fdiXV1/VD+9QC7OVn9BsyH1XIoEI1PfmJvLFowVV564+34DFUHudbmfDh4kVXh//7XwE+WjS/YfXZe3yr4j2rqj1AIhSB7hZ8ZtPZu/zw8cK523U4wE1/rvPfWrz4zs0m9ZdC9yUJAlASdBAgocRegfF/f3/h/PuaFsxMdwjAR0vm1+06eMMfIrhLqTWqdH4EumU2SPfMhigJAlRQbZrgrRsl9U+Y2DYDFCz3ILC9kiAiqSrMwbWT0nceEnR+9Kggc2zjOJCASDENkg0a5HfZZgDP81CM3CrQs2Z1+o7DJ6ePr8sK0AOCHv5Jjdt3evyYSaZ351VIStIxPRAUtrBYbxC6w+BZ0ivVSBKkIhJhemSyZpfB00EiPO2VjzYkxhcqXQqCWCShGplvi3y0QxqbuBurMjyJeWnkHZuAEgIQGsUBqwrfjZ+IlBgKyRJzVVYF8O6qFWdh86YzQzMrZigYmxAyfvHgLZQ/LC1CbeniW2Hkqr/PH16SgvGuf2/uzNMBwJA/njxizGPtSyAf7EziJCMGRDRdhoAC4PL1A/SrKQMAAQkEfpJAcRQdrBJ7gNwjSpJsdwK+CANBkqa1LgQB4IicV9nYUct7gaxuDJUErQIiEAiMxLVOFlKzIktPpT0ggpdpC/8YAHnxbgkUY4tAAFSR7AAXNyAAWHJrA/kHGjzg5nleuwFO7Nd/IoDw4Pm58+4jNLmYG0wRA5bErc2Mr3Y+dXTDW1VvwqbJkzMCHQ4S1GTCBOIgUHJrGdEwqzR+jAp/o2qAZelUDoQnruEEdDclJI6576AlNVfc+22XN/+Y1vnJD0Yind6UpEEvn/Hqq15EYjCW7jZCJEpnNvDgkyelDjs106kuux2AAXCSobULOWP8mLhYlpoDMK4qAFXJGk+grtH8YXVz5KJblqaG1+VUdTc0I290bmUQAriGITRbdQnom0aoFj8kx1+wMD2ifncAXUQE4SkDqN1hE0jEophs1SUwZAOhUAiMCLwRtamtTZtbbmZErSAUHbSysaoEmnrsakiMiUAURi283gN6wans9oX8rOCrj7/JP35DFD+iQ7Au/K2KE1jzx6ujjUnXFH9KjEq6ZlhsTBICrNLJf47Pv/pkHzvup1w4dmUbEei0+bcXRqJuh5kVARQ8byyYxOwNGr7A87xh1tp8sGT+uMInrwi++Xj7TQz2d27NvwEkrOflAFQGIDA5khASBCGdO2/Z/MnLPwYfv5TFhjW7QhVKAB6afwe2LpFlFsCnlQEosgQgDsdOG1/LKeNqJS4JCSPJ/i+TakwEARor7gER1Iva5JmPOJK0RUqmoPnnlzFCtmIAhAAQEIQRgDaiYPIauNXcnDlRIrWNFY3hm7PG9YRqr7IV7HrCgAC17befjEvRq2nGhAHtBqDpOuI/I1diUUAMYIxEdyejBJqLnNoszGZtfiX/CztGv2mq+sdaAAAAAElFTkSuQmCC">
23
23
  <title>Lighthouse Report</title>
24
- <style>/*%%LIGHTHOUSE_CSS%%*/</style>
24
+ <style>body {margin: 0}</style>
25
25
  </head>
26
- <body class="lh-root lh-vars">
26
+ <body>
27
27
  <noscript>Lighthouse report requires JavaScript. Please enable.</noscript>
28
28
 
29
- <main><!-- report populated here --></main>
30
-
31
29
  <div id="lh-log"></div>
32
30
 
33
31
  <script>window.__LIGHTHOUSE_JSON__ = %%LIGHTHOUSE_JSON%%;</script>
@@ -2,56 +2,50 @@
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 type * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
6
-
7
- let highlightStyle: CodeMirror.HighlightStyle|null = null;
8
-
9
- function importCM(): Promise<typeof CodeMirror> {
10
- return import('../../../third_party/codemirror.next/codemirror.next.js');
11
- }
12
-
13
- export function getHighlightStyle(modCM: typeof CodeMirror): CodeMirror.HighlightStyle {
14
- if (!highlightStyle) {
15
- const t = modCM.tags;
16
- highlightStyle = modCM.HighlightStyle.define([
17
- {tag: t.variableName, class: 'token-variable'},
18
- {tag: t.propertyName, class: 'token-property'},
19
- {tag: [t.typeName, t.className, t.namespace, t.macroName], class: 'token-type'},
20
- {tag: [t.special(t.name), t.constant(t.className)], class: 'token-variable-special'},
21
- {tag: t.definition(t.name), class: 'token-definition'},
22
- {tag: t.standard(t.variableName), class: 'token-builtin'},
23
-
24
- {tag: [t.number, t.literal, t.unit], class: 'token-number'},
25
- {tag: t.string, class: 'token-string'},
26
- {tag: [t.special(t.string), t.regexp, t.escape], class: 'token-string-special'},
27
- {tag: [t.atom, t.labelName, t.bool], class: 'token-atom'},
28
-
29
- {tag: t.keyword, class: 'token-keyword'},
30
- {tag: [t.comment, t.quote], class: 'token-comment'},
31
- {tag: t.meta, class: 'token-meta'},
32
- {tag: t.invalid, class: 'token-invalid'},
33
-
34
- {tag: t.tagName, class: 'token-tag'},
35
- {tag: t.attributeName, class: 'token-attribute'},
36
- {tag: t.attributeValue, class: 'token-attribute-value'},
37
-
38
- {tag: t.inserted, class: 'token-inserted'},
39
- {tag: t.deleted, class: 'token-deleted'},
40
- {tag: t.heading, class: 'token-heading'},
41
- {tag: t.link, class: 'token-link'},
42
- {tag: t.strikethrough, class: 'token-strikethrough'},
43
- {tag: t.strong, class: 'token-strong'},
44
- {tag: t.emphasis, class: 'token-emphasis'},
45
- ]);
46
- }
47
- return highlightStyle;
48
- }
5
+ import * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
6
+
7
+ const t = CodeMirror.tags;
8
+
9
+ export const highlightStyle: CodeMirror.HighlightStyle = CodeMirror.HighlightStyle.define([
10
+ {tag: t.variableName, class: 'token-variable'},
11
+ {tag: t.propertyName, class: 'token-property'},
12
+ {tag: [t.typeName, t.className, t.namespace, t.macroName], class: 'token-type'},
13
+ {tag: [t.special(t.name), t.constant(t.className)], class: 'token-variable-special'},
14
+ {tag: t.definition(t.name), class: 'token-definition'},
15
+ {tag: t.standard(t.variableName), class: 'token-builtin'},
16
+
17
+ {tag: [t.number, t.literal, t.unit], class: 'token-number'},
18
+ {tag: t.string, class: 'token-string'},
19
+ {tag: [t.special(t.string), t.regexp, t.escape], class: 'token-string-special'},
20
+ {tag: [t.atom, t.labelName, t.bool], class: 'token-atom'},
21
+
22
+ {tag: t.keyword, class: 'token-keyword'},
23
+ {tag: [t.comment, t.quote], class: 'token-comment'},
24
+ {tag: t.meta, class: 'token-meta'},
25
+ {tag: t.invalid, class: 'token-invalid'},
26
+
27
+ {tag: t.tagName, class: 'token-tag'},
28
+ {tag: t.attributeName, class: 'token-attribute'},
29
+ {tag: t.attributeValue, class: 'token-attribute-value'},
30
+
31
+ {tag: t.inserted, class: 'token-inserted'},
32
+ {tag: t.deleted, class: 'token-deleted'},
33
+ {tag: t.heading, class: 'token-heading'},
34
+ {tag: t.link, class: 'token-link'},
35
+ {tag: t.strikethrough, class: 'token-strikethrough'},
36
+ {tag: t.strong, class: 'token-strong'},
37
+ {tag: t.emphasis, class: 'token-emphasis'},
38
+ ]);
49
39
 
50
40
  export async function create(code: string, mimeType: string): Promise<CodeHighlighter> {
51
- const CM = await importCM();
52
41
  const language = await languageFromMIME(mimeType);
53
- const tree = language ? language.language.parser.parse(code) : new CM.Tree(CM.NodeType.none, [], [], code.length);
54
- return new CodeHighlighter(code, tree, CM);
42
+ let tree: CodeMirror.Tree;
43
+ if (language) {
44
+ tree = language.language.parser.parse(code);
45
+ } else {
46
+ tree = new CodeMirror.Tree(CodeMirror.NodeType.none, [], [], code.length);
47
+ }
48
+ return new CodeHighlighter(code, tree);
55
49
  }
56
50
 
57
51
  export async function highlightNode(node: Element, mimeType: string): Promise<void> {
@@ -71,57 +65,55 @@ export async function highlightNode(node: Element, mimeType: string): Promise<vo
71
65
  }
72
66
 
73
67
  export async function languageFromMIME(mimeType: string): Promise<CodeMirror.LanguageSupport|null> {
74
- const CM = await importCM();
75
-
76
68
  switch (mimeType) {
77
69
  case 'text/javascript':
78
- return (await CM.javascript()).javascript();
70
+ return CodeMirror.javascript.javascript();
79
71
  case 'text/jsx':
80
- return (await CM.javascript()).javascript({jsx: true});
72
+ return CodeMirror.javascript.javascript({jsx: true});
81
73
  case 'text/typescript':
82
- return (await CM.javascript()).javascript({typescript: true});
74
+ return CodeMirror.javascript.javascript({typescript: true});
83
75
  case 'text/typescript-jsx':
84
- return (await CM.javascript()).javascript({typescript: true, jsx: true});
76
+ return CodeMirror.javascript.javascript({typescript: true, jsx: true});
85
77
 
86
78
  case 'text/css':
87
79
  case 'text/x-scss':
88
- return (await CM.css()).css();
80
+ return CodeMirror.css.css();
89
81
 
90
82
  case 'text/html':
91
- return (await CM.html()).html();
83
+ return CodeMirror.html.html();
92
84
 
93
85
  case 'application/xml':
94
- return (await CM.xml()).xml();
86
+ return (await CodeMirror.xml()).xml();
95
87
 
96
88
  case 'text/webassembly':
97
- return (await CM.wast()).wast();
89
+ return (await CodeMirror.wast()).wast();
98
90
 
99
91
  case 'text/x-c++src':
100
- return (await CM.cpp()).cpp();
92
+ return (await CodeMirror.cpp()).cpp();
101
93
 
102
94
  case 'text/x-java':
103
- return (await CM.java()).java();
95
+ return (await CodeMirror.java()).java();
104
96
 
105
97
  case 'application/json':
106
- return (await CM.json()).json();
98
+ return (await CodeMirror.json()).json();
107
99
 
108
100
  case 'application/x-httpd-php':
109
- return (await CM.php()).php();
101
+ return (await CodeMirror.php()).php();
110
102
 
111
103
  case 'text/x-python':
112
- return (await CM.python()).python();
104
+ return (await CodeMirror.python()).python();
113
105
 
114
106
  case 'text/markdown':
115
- return (await CM.markdown()).markdown();
107
+ return (await CodeMirror.markdown()).markdown();
116
108
 
117
109
  case 'text/x-sh':
118
- return new CM.LanguageSupport(await CM.shell());
110
+ return new CodeMirror.LanguageSupport(await CodeMirror.shell());
119
111
 
120
112
  case 'text/x-coffeescript':
121
- return new CM.LanguageSupport(await CM.coffeescript());
113
+ return new CodeMirror.LanguageSupport(await CodeMirror.coffeescript());
122
114
 
123
115
  case 'text/x-clojure':
124
- return new CM.LanguageSupport(await CM.clojure());
116
+ return new CodeMirror.LanguageSupport(await CodeMirror.clojure());
125
117
 
126
118
  default:
127
119
  return null;
@@ -129,7 +121,7 @@ export async function languageFromMIME(mimeType: string): Promise<CodeMirror.Lan
129
121
  }
130
122
 
131
123
  export class CodeHighlighter {
132
- constructor(readonly code: string, readonly tree: CodeMirror.Tree, private readonly modCM: typeof CodeMirror) {
124
+ constructor(readonly code: string, readonly tree: CodeMirror.Tree) {
133
125
  }
134
126
 
135
127
  highlight(token: (text: string, style: string) => void): void {
@@ -144,7 +136,7 @@ export class CodeHighlighter {
144
136
  pos = to;
145
137
  }
146
138
  };
147
- this.modCM.highlightTree(this.tree, getHighlightStyle(this.modCM).match, (from, to, style) => {
139
+ CodeMirror.highlightTree(this.tree, highlightStyle.match, (from, to, style) => {
148
140
  flush(from, '');
149
141
  flush(to, style);
150
142
  }, from, to);
@@ -120,21 +120,23 @@ th.firstVisibleColumn {
120
120
  }
121
121
 
122
122
  [aria-sort="descending"]::after {
123
- content: " ";
124
- border-left: 0.3em solid transparent;
125
- border-right: 0.3em solid transparent;
126
- border-top: 0.3em solid var(--color-text-primary);
123
+ content: "";
124
+ width: 0;
125
+ border-left: 0.4em solid transparent;
126
+ border-right: 0.4em solid transparent;
127
+ border-top: 0.4em solid var(--color-text-secondary);
127
128
  position: absolute;
128
129
  right: 0.5em;
129
- top: 0.6em;
130
+ top: 0.85em;
130
131
  }
131
132
 
132
133
  [aria-sort="ascending"]::after {
133
- content: " ";
134
- border-bottom: 0.3em solid var(--color-text-primary);
135
- border-left: 0.3em solid transparent;
136
- border-right: 0.3em solid transparent;
134
+ content: "";
135
+ width: 0;
136
+ border-bottom: 0.4em solid var(--color-text-secondary);
137
+ border-left: 0.4em solid transparent;
138
+ border-right: 0.4em solid transparent;
137
139
  position: absolute;
138
140
  right: 0.5em;
139
- top: 0.6em;
141
+ top: 0.7em;
140
142
  }
@@ -12,3 +12,17 @@ import * as ToggleFonts from './toggle_fonts.js';
12
12
  ToggleDarkMode.init();
13
13
  CreateBreadcrumbs.init();
14
14
  ToggleFonts.init();
15
+
16
+ // This can be used by tests to hide the UI elements that are part of the component docs interface.
17
+ // E.g., this is useful for screenshot tests.
18
+ window.addEventListener('hidecomponentdocsui', () => {
19
+ for (const node of document.querySelectorAll('.component-docs-ui')) {
20
+ (node as HTMLElement).style.display = 'none';
21
+ }
22
+ });
23
+
24
+ window.addEventListener('showcomponentdocsui', () => {
25
+ for (const node of document.querySelectorAll('.component-docs-ui')) {
26
+ (node as HTMLElement).style.display = '';
27
+ }
28
+ });
@@ -32,7 +32,7 @@ export function init(): void {
32
32
  }
33
33
  </style>
34
34
 
35
- <ul class="docs-breadcrumbs">
35
+ <ul class="docs-breadcrumbs component-docs-ui">
36
36
  <li><a href="/">Index</a></li>
37
37
  <li><a href=".">All component examples</a></li>
38
38
  </ul>`, container);
@@ -0,0 +1,25 @@
1
+ <!--
2
+ Copyright 2021 The Chromium Authors. All rights reserved.
3
+ Use of this source code is governed by a BSD-style license that can be
4
+ found in the LICENSE file.
5
+ -->
6
+ <!DOCTYPE html>
7
+ <html>
8
+ <head>
9
+ <meta charset="UTF-8" />
10
+ <meta name="viewport" content="width=device-width" />
11
+ <title>CSS Overview Start View</title>
12
+ <style>
13
+ #container {
14
+ width: 80%;
15
+ border: 1px solid black;
16
+ padding: 10px;
17
+ }
18
+ </style>
19
+ </head>
20
+ <body>
21
+ <div id="container">
22
+ </div>
23
+ <script type="module" src="./start_view.js"></script>
24
+ </body>
25
+ </html>
@@ -0,0 +1,14 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
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 * as FrontendHelpers from '../../../../../test/unittests/front_end/helpers/EnvironmentHelpers.js';
6
+ import * as CSSOverviewComponents from '../../../../panels/css_overview/components/components.js';
7
+ import * as ComponentHelpers from '../../helpers/helpers.js';
8
+
9
+ await ComponentHelpers.ComponentServerSetup.setup();
10
+ await FrontendHelpers.initializeGlobalVars();
11
+
12
+ const component = new CSSOverviewComponents.CSSOverviewStartView.CSSOverviewStartView();
13
+
14
+ document.getElementById('container')?.appendChild(component);
@@ -12,18 +12,18 @@ function appendComponent(data: IconButton.IconButton.IconButtonData) {
12
12
 
13
13
  appendComponent({
14
14
  clickHandler: (): void => {},
15
- groups: [{iconName: 'feedback_thin_16x16_icon', iconColor: 'black', text: '1 item'}],
15
+ groups: [{iconName: 'survey_feedback_icon', iconColor: 'black', text: '1 item'}],
16
16
  });
17
17
 
18
18
  appendComponent({
19
19
  clickHandler: (): void => {},
20
- groups: [{iconName: 'feedback_thin_16x16_icon', iconColor: 'black', text: '1 item'}],
20
+ groups: [{iconName: 'survey_feedback_icon', iconColor: 'black', text: '1 item'}],
21
21
  });
22
22
 
23
23
  appendComponent({
24
24
  clickHandler: (): void => {},
25
25
  groups: [
26
- {iconName: 'feedback_thin_16x16_icon', iconColor: 'blue', text: 'Test'},
26
+ {iconName: 'survey_feedback_icon', iconColor: 'blue', text: 'Test'},
27
27
  {iconName: 'warning_icon', iconColor: '', text: '1'},
28
28
  ],
29
29
  });
@@ -16,6 +16,7 @@ export function init(): void {
16
16
  window.addEventListener('load', () => {
17
17
  const button = document.createElement('button');
18
18
  button.innerText = 'Toggle light/dark mode';
19
+ button.className = 'component-docs-ui';
19
20
 
20
21
  button.style.position = 'fixed';
21
22
  button.style.bottom = '10px';
@@ -14,6 +14,7 @@ export function init(): void {
14
14
  // we want a single font-family to be used by the tests.
15
15
  if (urlParams.has('fontFamily')) {
16
16
  const div = document.createElement('div');
17
+ div.className = 'component-docs-ui';
17
18
  div.style.position = 'fixed';
18
19
  div.style.bottom = '10px';
19
20
  div.style.right = '230px';
@@ -30,6 +31,7 @@ export function init(): void {
30
31
 
31
32
  document.body.classList.add(PLATFORM_LINUX_CLASS);
32
33
  const button = document.createElement('button');
34
+ button.className = 'component-docs-ui';
33
35
 
34
36
  const loop = [
35
37
  PLATFORM_LINUX_CLASS,
@@ -41,20 +41,5 @@ export function legacyGetStyleSheets(path: string): CSSStyleSheet[] {
41
41
  * them through to the right place, respecting Karma's ROOT_DIRECTORY setting.
42
42
  */
43
43
  export const CSS_RESOURCES_TO_LOAD_INTO_RUNTIME = [
44
- 'ui/legacy/inspectorCommon.css',
45
- 'ui/legacy/textButton.css',
46
- 'ui/legacy/themeColors.css',
47
- 'ui/legacy/inspectorSyntaxHighlight.css',
48
- 'ui/legacy/progressIndicator.css',
49
44
  'panels/application/serviceWorkerUpdateCycleView.css',
50
- 'ui/legacy/tabbedPane.css',
51
- 'ui/legacy/glassPane.css',
52
- 'ui/legacy/suggestBox.css',
53
- 'ui/legacy/treeoutline.css',
54
- 'ui/legacy/softContextMenu.css',
55
- 'ui/legacy/splitWidget.css',
56
- 'ui/legacy/components/source_frame/jsonView.css',
57
- 'ui/legacy/searchableView.css',
58
- 'ui/legacy/toolbar.css',
59
- 'ui/legacy/inspectorViewTabbedPane.css',
60
45
  ];
@@ -2,12 +2,11 @@
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 * as i18n from '../../../core/i18n/i18n.js';
5
6
  import * as UI from '../../legacy/legacy.js';
6
7
 
7
- // eslint-disable-next-line rulesdir/es_modules_import
8
8
  import type * as LinearMemoryInspector from './linear_memory_inspector.js';
9
9
 
10
- import * as i18n from '../../../core/i18n/i18n.js';
11
10
  const UIStrings = {
12
11
  /**
13
12
  *@description Title of the Linear Memory Inspector tool
@@ -22,7 +22,7 @@ export interface ImageData {
22
22
  * [
23
23
  * 'feedbackIcon',
24
24
  * {
25
- * src: 'Images/feedback_thin_16x16_icon.svg',
25
+ * src: 'Images/survey_feedback_icon.svg',
26
26
  * isIcon: true,
27
27
  * width: '20px',
28
28
  * height: '20px',
@@ -124,7 +124,7 @@ export class SurveyLink extends HTMLElement {
124
124
  // eslint-disable-next-line rulesdir/ban_style_tags_in_lit_html
125
125
  const output = LitHtml.html`
126
126
  <button class="link ${linkState}" tabindex=${ariaDisabled ? '-1' : '0'} .disabled=${ariaDisabled} aria-disabled=${ariaDisabled} @click=${this.sendSurvey}>
127
- <${IconButton.Icon.Icon.litTagName} class="link-icon" .data=${{iconName: 'feedback_thin_16x16_icon', color: 'var(--color-link)', width: 'var(--issue-link-icon-size, 16px)', height: 'var(--issue-link-icon-size, 16px)'} as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}><!--
127
+ <${IconButton.Icon.Icon.litTagName} class="link-icon" .data=${{iconName: 'feedback_button_icon', color: 'var(--color-link)', width: 'var(--issue-link-icon-size, 16px)', height: 'var(--issue-link-icon-size, 16px)'} as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}><!--
128
128
  -->${linkText}
129
129
  </button>
130
130
  `;
@@ -8,7 +8,8 @@ import * as LitHtml from '../../lit-html/lit-html.js';
8
8
  import * as CodeHighlighter from '../code_highlighter/code_highlighter.js';
9
9
  import * as ComponentHelpers from '../helpers/helpers.js';
10
10
 
11
- import {baseConfiguration, dynamicSetting} from './config.js';
11
+ import {baseConfiguration, dynamicSetting, DynamicSetting} from './config.js';
12
+ import {toLineColumn, toOffset} from './position.js';
12
13
 
13
14
  declare global {
14
15
  interface HTMLElementTagNameMap {
@@ -21,6 +22,7 @@ export class TextEditor extends HTMLElement {
21
22
 
22
23
  private readonly shadow = this.attachShadow({mode: 'open'});
23
24
  private activeEditor: CodeMirror.EditorView|undefined = undefined;
25
+ private dynamicSettings: readonly DynamicSetting<unknown>[] = DynamicSetting.none;
24
26
  private activeSettingListeners: [Common.Settings.Setting<unknown>, (event: {data: unknown}) => void][] = [];
25
27
  private pendingState: CodeMirror.EditorState|undefined;
26
28
 
@@ -32,10 +34,17 @@ export class TextEditor extends HTMLElement {
32
34
 
33
35
  private createEditor(): CodeMirror.EditorView {
34
36
  this.activeEditor = new CodeMirror.EditorView({
35
- state: this.updateDynamicSettings(this.state),
37
+ state: this.state,
36
38
  parent: this.shadow,
37
39
  root: this.shadow,
40
+ dispatch: (tr: CodeMirror.Transaction): void => {
41
+ this.editor.update([tr]);
42
+ if (tr.reconfigured) {
43
+ this.ensureSettingListeners();
44
+ }
45
+ },
38
46
  });
47
+ this.ensureSettingListeners();
39
48
  return this.activeEditor;
40
49
  }
41
50
 
@@ -43,6 +52,10 @@ export class TextEditor extends HTMLElement {
43
52
  return this.activeEditor || this.createEditor();
44
53
  }
45
54
 
55
+ dispatch(spec: CodeMirror.TransactionSpec): void {
56
+ return this.editor.dispatch(spec);
57
+ }
58
+
46
59
  get state(): CodeMirror.EditorState {
47
60
  if (this.activeEditor) {
48
61
  return this.activeEditor.state;
@@ -65,7 +78,6 @@ export class TextEditor extends HTMLElement {
65
78
  if (!this.activeEditor) {
66
79
  this.createEditor();
67
80
  }
68
- this.registerSettingHandlers();
69
81
  }
70
82
 
71
83
  disconnectedCallback(): void {
@@ -73,63 +85,94 @@ export class TextEditor extends HTMLElement {
73
85
  this.pendingState = this.activeEditor.state;
74
86
  this.activeEditor.destroy();
75
87
  this.activeEditor = undefined;
88
+ this.ensureSettingListeners();
76
89
  }
77
- for (const [setting, listener] of this.activeSettingListeners) {
78
- setting.removeChangeListener(listener);
79
- }
80
- this.activeSettingListeners = [];
81
90
  }
82
91
 
83
- private updateDynamicSettings(state: CodeMirror.EditorState): CodeMirror.EditorState {
84
- const settings = Common.Settings.Settings.instance();
85
- const changes = [];
86
- for (const opt of state.facet(dynamicSetting)) {
87
- const mustUpdate = opt.sync(state, settings.moduleSetting(opt.settingName).get());
88
- if (mustUpdate) {
89
- changes.push(mustUpdate);
90
- }
92
+ focus(): void {
93
+ if (this.activeEditor) {
94
+ this.activeEditor.focus();
91
95
  }
92
- return changes.length ? state.update({effects: changes}).state : state;
93
96
  }
94
97
 
95
- private registerSettingHandlers(): void {
98
+ private ensureSettingListeners(): void {
99
+ const dynamicSettings = this.activeEditor ? this.activeEditor.state.facet(dynamicSetting) : DynamicSetting.none;
100
+ if (dynamicSettings === this.dynamicSettings) {
101
+ return;
102
+ }
103
+ this.dynamicSettings = dynamicSettings;
104
+
105
+ for (const [setting, listener] of this.activeSettingListeners) {
106
+ setting.removeChangeListener(listener);
107
+ }
108
+ this.activeSettingListeners = [];
109
+
96
110
  const settings = Common.Settings.Settings.instance();
97
- for (const opt of this.state.facet(dynamicSetting)) {
111
+ for (const dynamicSetting of dynamicSettings) {
98
112
  const handler = ({data}: {data: unknown}): void => {
99
- const change = opt.sync(this.state, data);
113
+ const change = dynamicSetting.sync(this.state, data);
100
114
  if (change && this.activeEditor) {
101
115
  this.activeEditor.dispatch({effects: change});
102
116
  }
103
117
  };
104
- const setting = settings.moduleSetting(opt.settingName);
118
+ const setting = settings.moduleSetting(dynamicSetting.settingName);
105
119
  setting.addChangeListener(handler);
106
120
  this.activeSettingListeners.push([setting, handler]);
107
121
  }
108
122
  }
109
123
 
110
- revealPosition(position: number): void {
124
+ revealPosition(selection: CodeMirror.EditorSelection, highlight: boolean = true): void {
111
125
  const view = this.activeEditor;
112
126
  if (!view) {
113
127
  return;
114
128
  }
115
129
 
116
- const line = view.state.doc.lineAt(position);
130
+ const line = view.state.doc.lineAt(selection.main.head);
131
+ const effects: CodeMirror.StateEffect<unknown>[] = [];
132
+ if (highlight) {
133
+ effects.push(
134
+ view.state.field(highlightState, false) ?
135
+ setHighlightLine.of(line.from) :
136
+ CodeMirror.StateEffect.appendConfig.of(highlightState.init(() => highlightDeco(line.from))));
137
+ }
138
+ const editorRect = view.scrollDOM.getBoundingClientRect();
139
+ const targetPos = view.coordsAtPos(selection.main.head);
140
+ if (!targetPos || targetPos.top < editorRect.top || targetPos.bottom > editorRect.bottom) {
141
+ effects.push(CodeMirror.EditorView.centerOn.of(selection.main));
142
+ }
143
+
117
144
  view.dispatch({
118
- selection: CodeMirror.EditorSelection.cursor(position),
119
- scrollIntoView: true,
120
- effects:
121
- [view.state.field(highlightState, false) ?
122
- setHighlightLine.of(line.from) :
123
- CodeMirror.StateEffect.appendConfig.of(highlightState.init(() => highlightDeco(line.from)))],
145
+ selection,
146
+ effects,
147
+ userEvent: 'select.reveal',
124
148
  });
125
- const {id} = view.state.field(highlightState);
126
- // Reset the highlight state if, after 2 seconds (the animation
127
- // duration) it is still showing this highlight.
128
- setTimeout(() => {
129
- if (view.state.field(highlightState).id === id) {
130
- view.dispatch({effects: setHighlightLine.of(null)});
131
- }
132
- }, 2000);
149
+ if (highlight) {
150
+ const {id} = view.state.field(highlightState);
151
+ // Reset the highlight state if, after 2 seconds (the animation
152
+ // duration) it is still showing this highlight.
153
+ setTimeout(() => {
154
+ if (view.state.field(highlightState).id === id) {
155
+ view.dispatch({effects: setHighlightLine.of(null)});
156
+ }
157
+ }, 2000);
158
+ }
159
+ }
160
+
161
+ createSelection(head: {lineNumber: number, columnNumber: number}, anchor?: {
162
+ lineNumber: number,
163
+ columnNumber: number,
164
+ }): CodeMirror.EditorSelection {
165
+ const {doc} = this.state;
166
+ const headPos = toOffset(doc, head);
167
+ return CodeMirror.EditorSelection.single(anchor ? toOffset(doc, anchor) : headPos, headPos);
168
+ }
169
+
170
+ toLineColumn(pos: number): {lineNumber: number, columnNumber: number} {
171
+ return toLineColumn(this.state.doc, pos);
172
+ }
173
+
174
+ toOffset(pos: {lineNumber: number, columnNumber: number}): number {
175
+ return toOffset(this.state.doc, pos);
133
176
  }
134
177
  }
135
178