chrome-devtools-frontend 1.0.943017 → 1.0.944427

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 (224) hide show
  1. package/config/gni/all_devtools_files.gni +0 -9
  2. package/config/gni/devtools_grd_files.gni +6 -1
  3. package/front_end/core/host/UserMetrics.ts +0 -1
  4. package/front_end/core/i18n/locales/af.json +455 -44
  5. package/front_end/core/i18n/locales/am.json +455 -44
  6. package/front_end/core/i18n/locales/ar.json +455 -44
  7. package/front_end/core/i18n/locales/as.json +455 -44
  8. package/front_end/core/i18n/locales/az.json +455 -44
  9. package/front_end/core/i18n/locales/be.json +456 -45
  10. package/front_end/core/i18n/locales/bg.json +455 -44
  11. package/front_end/core/i18n/locales/bn.json +455 -44
  12. package/front_end/core/i18n/locales/bs.json +455 -44
  13. package/front_end/core/i18n/locales/ca.json +457 -46
  14. package/front_end/core/i18n/locales/cs.json +458 -47
  15. package/front_end/core/i18n/locales/cy.json +455 -44
  16. package/front_end/core/i18n/locales/da.json +455 -44
  17. package/front_end/core/i18n/locales/de.json +455 -44
  18. package/front_end/core/i18n/locales/el.json +455 -44
  19. package/front_end/core/i18n/locales/en-GB.json +449 -38
  20. package/front_end/core/i18n/locales/en-US.json +7 -19
  21. package/front_end/core/i18n/locales/en-XL.json +7 -19
  22. package/front_end/core/i18n/locales/es-419.json +455 -44
  23. package/front_end/core/i18n/locales/es.json +455 -44
  24. package/front_end/core/i18n/locales/et.json +455 -44
  25. package/front_end/core/i18n/locales/eu.json +462 -51
  26. package/front_end/core/i18n/locales/fa.json +455 -44
  27. package/front_end/core/i18n/locales/fi.json +455 -44
  28. package/front_end/core/i18n/locales/fil.json +454 -43
  29. package/front_end/core/i18n/locales/fr-CA.json +455 -44
  30. package/front_end/core/i18n/locales/fr.json +456 -45
  31. package/front_end/core/i18n/locales/gl.json +455 -44
  32. package/front_end/core/i18n/locales/gu.json +456 -45
  33. package/front_end/core/i18n/locales/he.json +455 -44
  34. package/front_end/core/i18n/locales/hi.json +455 -44
  35. package/front_end/core/i18n/locales/hr.json +455 -44
  36. package/front_end/core/i18n/locales/hu.json +455 -44
  37. package/front_end/core/i18n/locales/hy.json +455 -44
  38. package/front_end/core/i18n/locales/id.json +455 -44
  39. package/front_end/core/i18n/locales/is.json +455 -44
  40. package/front_end/core/i18n/locales/it.json +502 -91
  41. package/front_end/core/i18n/locales/ja.json +456 -45
  42. package/front_end/core/i18n/locales/ka.json +455 -44
  43. package/front_end/core/i18n/locales/kk.json +456 -45
  44. package/front_end/core/i18n/locales/km.json +455 -44
  45. package/front_end/core/i18n/locales/kn.json +455 -44
  46. package/front_end/core/i18n/locales/ko.json +455 -44
  47. package/front_end/core/i18n/locales/ky.json +456 -45
  48. package/front_end/core/i18n/locales/lo.json +454 -43
  49. package/front_end/core/i18n/locales/lt.json +455 -44
  50. package/front_end/core/i18n/locales/lv.json +458 -47
  51. package/front_end/core/i18n/locales/mk.json +455 -44
  52. package/front_end/core/i18n/locales/ml.json +461 -50
  53. package/front_end/core/i18n/locales/mn.json +455 -44
  54. package/front_end/core/i18n/locales/mr.json +455 -44
  55. package/front_end/core/i18n/locales/ms.json +455 -44
  56. package/front_end/core/i18n/locales/my.json +456 -45
  57. package/front_end/core/i18n/locales/ne.json +456 -45
  58. package/front_end/core/i18n/locales/nl.json +532 -121
  59. package/front_end/core/i18n/locales/no.json +455 -44
  60. package/front_end/core/i18n/locales/or.json +455 -44
  61. package/front_end/core/i18n/locales/pa.json +455 -44
  62. package/front_end/core/i18n/locales/pl.json +455 -44
  63. package/front_end/core/i18n/locales/pt-PT.json +504 -93
  64. package/front_end/core/i18n/locales/pt.json +454 -43
  65. package/front_end/core/i18n/locales/ro.json +455 -44
  66. package/front_end/core/i18n/locales/ru.json +455 -44
  67. package/front_end/core/i18n/locales/si.json +455 -44
  68. package/front_end/core/i18n/locales/sk.json +456 -45
  69. package/front_end/core/i18n/locales/sl.json +455 -44
  70. package/front_end/core/i18n/locales/sq.json +455 -44
  71. package/front_end/core/i18n/locales/sr-Latn.json +455 -44
  72. package/front_end/core/i18n/locales/sr.json +455 -44
  73. package/front_end/core/i18n/locales/sv.json +456 -45
  74. package/front_end/core/i18n/locales/sw.json +455 -44
  75. package/front_end/core/i18n/locales/ta.json +456 -45
  76. package/front_end/core/i18n/locales/te.json +454 -43
  77. package/front_end/core/i18n/locales/th.json +455 -44
  78. package/front_end/core/i18n/locales/tr.json +455 -44
  79. package/front_end/core/i18n/locales/uk.json +455 -44
  80. package/front_end/core/i18n/locales/ur.json +455 -44
  81. package/front_end/core/i18n/locales/uz.json +455 -44
  82. package/front_end/core/i18n/locales/vi.json +455 -44
  83. package/front_end/core/i18n/locales/zh-HK.json +459 -48
  84. package/front_end/core/i18n/locales/zh-TW.json +457 -46
  85. package/front_end/core/i18n/locales/zh.json +460 -49
  86. package/front_end/core/i18n/locales/zu.json +455 -44
  87. package/front_end/core/protocol_client/InspectorBackend.ts +4 -0
  88. package/front_end/core/sdk/AccessibilityModel.ts +99 -78
  89. package/front_end/core/sdk/CSSStyleDeclaration.ts +4 -0
  90. package/front_end/core/sdk/ConsoleModel.ts +1 -5
  91. package/front_end/core/sdk/NetworkManager.ts +3 -0
  92. package/front_end/core/sdk/OverlayModel.ts +0 -9
  93. package/front_end/core/sdk/Script.ts +0 -4
  94. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +13 -12
  95. package/front_end/core/sdk/sdk-meta.ts +0 -26
  96. package/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.ts +1 -1
  97. package/front_end/entrypoints/devtools_app/devtools_app.js +1 -1
  98. package/front_end/entrypoints/devtools_app/devtools_app.json +1 -2
  99. package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -1
  100. package/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.ts +1 -1
  101. package/front_end/entrypoints/inspector/inspector.js +1 -1
  102. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +0 -13
  103. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +2 -3
  104. package/front_end/entrypoints/js_app/js_app.js +1 -1
  105. package/front_end/entrypoints/main/MainImpl.ts +2 -4
  106. package/front_end/entrypoints/main/main-meta.ts +1 -2
  107. package/front_end/entrypoints/ndb_app/ndb_app.js +1 -1
  108. package/front_end/entrypoints/node_app/node_app-meta.ts +0 -2
  109. package/front_end/entrypoints/node_app/node_app.js +1 -1
  110. package/front_end/entrypoints/node_main/node_main-meta.ts +0 -1
  111. package/front_end/entrypoints/shell/shell.json +1 -2
  112. package/front_end/entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.ts +1 -1
  113. package/front_end/entrypoints/worker_app/worker_app.js +1 -1
  114. package/front_end/generated/InspectorBackendCommands.js +3 -1
  115. package/front_end/generated/protocol-mapping.d.ts +1 -0
  116. package/front_end/generated/protocol-proxy-api.d.ts +2 -0
  117. package/front_end/generated/protocol.d.ts +40 -0
  118. package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +5 -1
  119. package/front_end/models/bindings/DefaultScriptMapping.ts +1 -9
  120. package/front_end/models/bindings/ResourceScriptMapping.ts +3 -11
  121. package/front_end/models/formatter/SourceFormatter.ts +0 -15
  122. package/front_end/models/persistence/persistence-meta.ts +0 -1
  123. package/front_end/models/timeline_model/TimelineJSProfile.ts +3 -16
  124. package/front_end/models/timeline_model/TimelineModel.ts +0 -1
  125. package/front_end/panels/accessibility/accessibility-meta.ts +0 -1
  126. package/front_end/panels/animation/animation-meta.ts +0 -1
  127. package/front_end/panels/application/ApplicationPanelCacheSection.ts +1 -1
  128. package/front_end/panels/application/BackForwardCacheView.ts +26 -26
  129. package/front_end/panels/application/application-meta.ts +0 -1
  130. package/front_end/panels/application/components/stackTraceRow.css +8 -0
  131. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +1 -2
  132. package/front_end/panels/changes/changes-meta.ts +0 -1
  133. package/front_end/panels/console/ConsolePinPane.ts +3 -6
  134. package/front_end/panels/console/ConsolePrompt.ts +121 -171
  135. package/front_end/panels/console/ConsoleView.ts +1 -1
  136. package/front_end/panels/console/ConsoleViewMessage.ts +8 -1
  137. package/front_end/panels/console/console-meta.ts +0 -1
  138. package/front_end/panels/console/consoleView.css +1 -1
  139. package/front_end/panels/console_counters/console_counters-meta.ts +0 -1
  140. package/front_end/panels/coverage/coverage-meta.ts +0 -1
  141. package/front_end/panels/css_overview/cssOverviewCompletedView.css +2 -2
  142. package/front_end/panels/css_overview/css_overview-meta.ts +0 -1
  143. package/front_end/panels/developer_resources/developer_resources-meta.ts +0 -1
  144. package/front_end/panels/elements/AccessibilityTreeUtils.ts +98 -67
  145. package/front_end/panels/elements/AccessibilityTreeView.ts +76 -125
  146. package/front_end/panels/elements/ElementsPanel.ts +6 -7
  147. package/front_end/panels/elements/ElementsTreeElement.ts +1 -0
  148. package/front_end/panels/elements/StyleEditorWidget.ts +13 -2
  149. package/front_end/panels/elements/StylePropertyHighlighter.ts +29 -19
  150. package/front_end/panels/elements/StylePropertyTreeElement.ts +7 -4
  151. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  152. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +27 -3
  153. package/front_end/panels/elements/elements-meta.ts +0 -1
  154. package/front_end/panels/emulation/emulation-meta.ts +0 -1
  155. package/front_end/panels/help/help-meta.ts +0 -1
  156. package/front_end/panels/input/input-meta.ts +0 -1
  157. package/front_end/panels/issues/issues-meta.ts +0 -1
  158. package/front_end/panels/js_profiler/js_profiler-meta.ts +0 -1
  159. package/front_end/panels/layers/layers-meta.ts +0 -4
  160. package/front_end/panels/lighthouse/lighthouse-meta.ts +0 -1
  161. package/front_end/panels/media/media-meta.ts +0 -1
  162. package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +0 -1
  163. package/front_end/panels/network/NetworkDataGridNode.ts +5 -1
  164. package/front_end/panels/network/network-meta.ts +1 -2
  165. package/front_end/panels/performance_monitor/performance_monitor-meta.ts +0 -1
  166. package/front_end/panels/profiler/profiler-meta.ts +0 -1
  167. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +0 -1
  168. package/front_end/panels/screencast/screencast-meta.ts +0 -1
  169. package/front_end/panels/security/security-meta.ts +0 -1
  170. package/front_end/panels/sensors/sensors-meta.ts +0 -1
  171. package/front_end/panels/settings/emulation/emulation-meta.ts +0 -1
  172. package/front_end/panels/settings/settings-meta.ts +0 -1
  173. package/front_end/panels/sources/BreakpointEditDialog.ts +1 -0
  174. package/front_end/panels/sources/Plugin.ts +0 -3
  175. package/front_end/panels/sources/UISourceCodeFrame.ts +23 -49
  176. package/front_end/panels/sources/sources-meta.ts +1 -2
  177. package/front_end/panels/timeline/TimelineController.ts +0 -3
  178. package/front_end/panels/timeline/timeline-meta.ts +2 -4
  179. package/front_end/panels/web_audio/web_audio-meta.ts +0 -1
  180. package/front_end/panels/webauthn/webauthn-meta.ts +0 -1
  181. package/front_end/third_party/codemirror.next/bundle.ts +3 -2
  182. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  183. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +32 -1
  184. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  185. package/front_end/third_party/codemirror.next/package.json +3 -3
  186. package/front_end/ui/components/docs/component_docs.ts +14 -0
  187. package/front_end/ui/components/docs/create_breadcrumbs.ts +1 -1
  188. package/front_end/ui/components/docs/toggle_dark_mode.ts +1 -0
  189. package/front_end/ui/components/docs/toggle_fonts.ts +2 -0
  190. package/front_end/ui/components/helpers/get-stylesheet.ts +0 -1
  191. package/front_end/ui/components/linear_memory_inspector/linear_memory_inspector-meta.ts +1 -2
  192. package/front_end/ui/components/text_editor/config.ts +34 -14
  193. package/front_end/ui/components/text_editor/javascript.ts +14 -9
  194. package/front_end/ui/components/text_editor/theme.ts +29 -4
  195. package/front_end/ui/components/tree_outline/TreeOutline.ts +71 -8
  196. package/front_end/ui/components/tree_outline/TreeOutlineUtils.ts +8 -6
  197. package/front_end/ui/legacy/Dialog.ts +8 -3
  198. package/front_end/ui/legacy/SoftContextMenu.ts +1 -1
  199. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  200. package/front_end/ui/legacy/UIUtils.ts +1 -1
  201. package/front_end/ui/legacy/components/inline_editor/CSSAngle.ts +1 -2
  202. package/front_end/ui/legacy/components/inline_editor/cssAngle.css +4 -0
  203. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +2 -2
  204. package/front_end/ui/legacy/components/object_ui/object_ui-meta.ts +0 -1
  205. package/front_end/ui/legacy/components/perf_ui/perf_ui-meta.ts +0 -1
  206. package/front_end/ui/legacy/components/quick_open/quick_open-meta.ts +2 -3
  207. package/front_end/ui/legacy/components/source_frame/FontView.ts +3 -1
  208. package/front_end/ui/legacy/components/source_frame/ImageView.ts +3 -1
  209. package/front_end/ui/legacy/components/source_frame/JSONView.ts +3 -1
  210. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +2 -1
  211. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +6 -4
  212. package/front_end/ui/legacy/components/source_frame/XMLView.ts +5 -2
  213. package/front_end/ui/legacy/components/utils/Linkifier.ts +49 -79
  214. package/front_end/ui/legacy/themeColors.css +2 -0
  215. package/inspector_overlay/css_grid_label_helpers.ts +1 -1
  216. package/inspector_overlay/highlight_common.ts +1 -1
  217. package/inspector_overlay/tool_highlight.ts +1 -1
  218. package/package.json +1 -1
  219. package/scripts/check_gn.js +0 -35
  220. package/scripts/eslint_rules/lib/es_modules_import.js +15 -24
  221. package/scripts/eslint_rules/tests/es_modules_import_test.js +8 -16
  222. package/front_end/panels/layers/module.json +0 -4
  223. package/front_end/ui/legacy/components/source_frame/messagesPopover.css +0 -32
  224. package/front_end/ui/legacy/components/source_frame/module.json +0 -11
@@ -3537,6 +3537,12 @@ interface CompletionConfig {
3537
3537
  */
3538
3538
  defaultKeymap?: boolean;
3539
3539
  /**
3540
+ By default, completions are shown below the cursor when there is
3541
+ space. Setting this to true will make the extension put the
3542
+ completions above the cursor when possible.
3543
+ */
3544
+ aboveCursor?: boolean;
3545
+ /**
3540
3546
  This can be used to add additional CSS classes to completion
3541
3547
  options.
3542
3548
  */
@@ -3739,6 +3745,14 @@ interface CompletionResult {
3739
3745
  Accept the current completion.
3740
3746
  */
3741
3747
  declare const acceptCompletion: Command;
3748
+ /**
3749
+ Explicitly start autocompletion.
3750
+ */
3751
+ declare const startCompletion: Command;
3752
+ /**
3753
+ Close the currently active completion.
3754
+ */
3755
+ declare const closeCompletion: Command;
3742
3756
 
3743
3757
  /**
3744
3758
  A completion source that will scan the document for words (using a
@@ -3755,6 +3769,10 @@ declare function autocompletion(config?: CompletionConfig): Extension;
3755
3769
  Returns the available completions as an array.
3756
3770
  */
3757
3771
  declare function currentCompletions(state: EditorState): readonly Completion[];
3772
+ /**
3773
+ Return the currently selected completion, if any.
3774
+ */
3775
+ declare function selectedCompletion(state: EditorState): Completion | null;
3758
3776
 
3759
3777
  /**
3760
3778
  Describes an element in your XML document schema.
@@ -5484,6 +5502,19 @@ declare function tooltips(config?: {
5484
5502
  those.
5485
5503
  */
5486
5504
  parent?: HTMLElement;
5505
+ /**
5506
+ By default, when figuring out whether there is room for a
5507
+ tooltip at a given position, the extension considers the entire
5508
+ space between 0,0 and `innerWidth`,`innerHeight` to be available
5509
+ for showing tooltips. You can provide a function here that
5510
+ returns an alternative rectangle.
5511
+ */
5512
+ tooltipSpace?: (view: EditorView) => {
5513
+ top: number;
5514
+ left: number;
5515
+ bottom: number;
5516
+ right: number;
5517
+ };
5487
5518
  }): Extension;
5488
5519
  /**
5489
5520
  Describes a tooltip. Values of this type, when provided through
@@ -5574,4 +5605,4 @@ declare function shell(): Promise<StreamLanguage<unknown>>;
5574
5605
  declare function wast(): Promise<typeof _codemirror_lang_wast>;
5575
5606
  declare function xml(): Promise<typeof _codemirror_lang_xml>;
5576
5607
 
5577
- export { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, Command, Compartment, Completion, CompletionContext, CompletionResult, CompletionSource, Decoration, DecorationSet, EditorSelection, EditorState, EditorStateConfig, EditorView, Extension, Facet, GutterMarker, HighlightStyle, KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MatchDecorator, NodeProp, NodeSet, NodeType, Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, StreamParser, StringStream, StyleModule, SyntaxNode, Tag, TagStyle, Text, TextIterator, Tooltip, TooltipView, Transaction, TransactionSpec, Tree, TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, autocompletion, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, codeFolding, coffeescript, completeAnyWord, cpp, index_d$2 as css, currentCompletions, cursorMatchingBracket, cursorSubwordBackward, cursorSubwordForward, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, gutter, gutters, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, insertNewlineAndIndent, java, index_d as javascript, json, keymap, lineNumberMarkers, lineNumbers, markdown, php, placeholder, python, redo, redoSelection, scrollPastEnd, selectMatchingBracket, selectNextOccurrence, selectSubwordBackward, selectSubwordForward, shell, showPanel, showTooltip, standardKeymap, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, wast, xml };
5608
+ export { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, Command, Compartment, Completion, CompletionContext, CompletionResult, CompletionSource, Decoration, DecorationSet, EditorSelection, EditorState, EditorStateConfig, EditorView, Extension, Facet, GutterMarker, HighlightStyle, KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MatchDecorator, NodeProp, NodeSet, NodeType, Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, StreamParser, StringStream, StyleModule, SyntaxNode, Tag, TagStyle, Text, TextIterator, Tooltip, TooltipView, Transaction, TransactionSpec, Tree, TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, autocompletion, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, closeCompletion, codeFolding, coffeescript, completeAnyWord, cpp, index_d$2 as css, currentCompletions, cursorMatchingBracket, cursorSubwordBackward, cursorSubwordForward, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, gutter, gutters, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, insertNewlineAndIndent, java, index_d as javascript, json, keymap, lineNumberMarkers, lineNumbers, markdown, php, placeholder, python, redo, redoSelection, scrollPastEnd, selectMatchingBracket, selectNextOccurrence, selectSubwordBackward, selectSubwordForward, selectedCompletion, shell, showPanel, showTooltip, standardKeymap, startCompletion, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, wast, xml };
@@ -1,2 +1,2 @@
1
- export{$ as insertNewlineAndIndent,_ as indentMore,A as java,a$ as StyleModule,a0 as selectMatchingBracket,a1 as selectSubwordBackward,a2 as selectSubwordForward,a3 as standardKeymap,a4 as toggleComment,a5 as codeFolding,a6 as foldGutter,a7 as foldKeymap,a8 as gutter,a9 as GutterMarker,a_ as TreeCursor,aA as ChangeDesc,aa as gutters,aB as ChangeSet,ab as lineNumberMarkers,aC as Compartment,ac as lineNumbers,aD as EditorState,ad as HighlightStyle,aE as Facet,ae as highlightTree,aF as SelectionRange,af as Tag,aG as StateEffect,ag as history,aH as StateEffectType,ah as historyKeymap,aI as StateField,ai as redo,aJ as Transaction,aj as redoSelection,aK as StreamLanguage,ak as undo,aL as StringStream,al as undoSelection,aM as Line,am as css,aN as Text,an as html,ao as javascript,aO as showTooltip,ap as ensureSyntaxTree,aP as tooltips,aQ as Decoration,aq as indentOnInput,aR as drawSelection,ar as indentUnit,aS as EditorView,as as bracketMatching,aT as highlightSpecialChars,at as showPanel,aU as MatchDecorator,au as Range,av as RangeSet,aV as placeholder,aw as RangeSetBuilder,aW as scrollPastEnd,aX as ViewPlugin,ax as selectNextOccurrence,ay as Annotation,aY as ViewUpdate,az as AnnotationType,aZ as WidgetType,B as json,D as markdown,e as LanguageSupport,F as php,g as NodeType,G as python,h as NodeSet,H as shell,I as wast,j as Language,J as xml,K as acceptCompletion,k as syntaxTree,L as LRParser,m as EditorSelection,M as autocompletion,N as NodeProp,n as Prec,O as completeAnyWord,o as keymap,P as Parser,Q as CompletionContext,R as currentCompletions,S as ifNotIn,T as Tree,t as tags,U as closeBrackets,V as closeBracketsKeymap,W as cursorMatchingBracket,x as clojure,X as cursorSubwordBackward,y as coffeescript,Y as cursorSubwordForward,z as cpp,Z as indentLess}from"./chunk/codemirror.js";
1
+ export{$ as cursorSubwordForward,_ as cursorSubwordBackward,A as java,a$ as ViewUpdate,a0 as indentLess,a1 as indentMore,a2 as insertNewlineAndIndent,a3 as selectMatchingBracket,a4 as selectSubwordBackward,a5 as selectSubwordForward,a6 as standardKeymap,a7 as toggleComment,a8 as codeFolding,a9 as foldGutter,a_ as ViewPlugin,aa as foldKeymap,aA as selectNextOccurrence,aB as Annotation,ab as gutter,aC as AnnotationType,ac as GutterMarker,aD as ChangeDesc,ad as gutters,aE as ChangeSet,ae as lineNumberMarkers,aF as Compartment,af as lineNumbers,aG as EditorState,ag as HighlightStyle,aH as Facet,ah as highlightTree,aI as SelectionRange,ai as Tag,aJ as StateEffect,aj as history,aK as StateEffectType,ak as historyKeymap,aL as StateField,al as redo,aM as Transaction,am as redoSelection,aN as StreamLanguage,an as undo,aO as StringStream,ao as undoSelection,aP as Line,ap as css,aQ as Text,aq as html,ar as javascript,aR as showTooltip,as as ensureSyntaxTree,aS as tooltips,aT as Decoration,at as indentOnInput,aU as drawSelection,au as indentUnit,aV as EditorView,av as bracketMatching,aW as highlightSpecialChars,aw as showPanel,aX as MatchDecorator,ax as Range,ay as RangeSet,aY as placeholder,az as RangeSetBuilder,aZ as scrollPastEnd,B as json,b0 as WidgetType,b1 as TreeCursor,b2 as StyleModule,D as markdown,e as LanguageSupport,F as php,g as NodeType,G as python,h as NodeSet,H as shell,I as wast,j as Language,J as xml,K as acceptCompletion,k as syntaxTree,L as LRParser,m as EditorSelection,M as autocompletion,N as NodeProp,n as Prec,O as closeCompletion,o as keymap,P as Parser,Q as completeAnyWord,R as CompletionContext,S as currentCompletions,T as Tree,t as tags,U as ifNotIn,V as selectedCompletion,W as startCompletion,x as clojure,X as closeBrackets,Y as closeBracketsKeymap,y as coffeescript,z as cpp,Z as cursorMatchingBracket}from"./chunk/codemirror.js";
2
2
 
@@ -3,7 +3,7 @@
3
3
  "version": "0.0.1",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@codemirror/autocomplete": "0.19.5",
6
+ "@codemirror/autocomplete": "0.19.8",
7
7
  "@codemirror/closebrackets": "0.19.0",
8
8
  "@codemirror/commands": "0.19.5",
9
9
  "@codemirror/comment": "0.19.0",
@@ -31,8 +31,8 @@
31
31
  "@codemirror/state": "0.19.5",
32
32
  "@codemirror/stream-parser": "0.19.2",
33
33
  "@codemirror/text": "0.19.5",
34
- "@codemirror/tooltip": "0.19.6",
35
- "@codemirror/view": "0.19.16",
34
+ "@codemirror/tooltip": "0.19.9",
35
+ "@codemirror/view": "0.19.20",
36
36
  "@lezer/common": "0.15.8",
37
37
  "@rollup/plugin-node-resolve": "^13.0.4",
38
38
  "rollup-plugin-dts": "^4.0.0",
@@ -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);
@@ -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,
@@ -42,5 +42,4 @@ export function legacyGetStyleSheets(path: string): CSSStyleSheet[] {
42
42
  */
43
43
  export const CSS_RESOURCES_TO_LOAD_INTO_RUNTIME = [
44
44
  'panels/application/serviceWorkerUpdateCycleView.css',
45
- 'ui/legacy/components/source_frame/jsonView.css',
46
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
@@ -68,7 +68,10 @@ export const tabMovesFocus = DynamicSetting.bool('textEditorTabMovesFocus', CM.k
68
68
  shift: (view: CM.EditorView): boolean => view.state.doc.length ? CM.indentLess(view) : false,
69
69
  }]));
70
70
 
71
- export const autocompletion = CM.autocompletion({icons: false});
71
+ export const autocompletion = CM.autocompletion({
72
+ icons: false,
73
+ optionClass: (option: CM.Completion): string => option.type === 'secondary' ? 'cm-secondaryCompletion' : '',
74
+ });
72
75
 
73
76
  export const sourcesAutocompletion = DynamicSetting.bool('textEditorAutocompletion', autocompletion);
74
77
 
@@ -185,7 +188,6 @@ const baseKeymap = CM.keymap.of([
185
188
  {key: 'Mod-d', run: CM.selectNextOccurrence},
186
189
  {key: 'Alt-ArrowLeft', mac: 'Ctrl-ArrowLeft', run: CM.cursorSubwordBackward, shift: CM.selectSubwordBackward},
187
190
  {key: 'Alt-ArrowRight', mac: 'Ctrl-ArrowRight', run: CM.cursorSubwordForward, shift: CM.selectSubwordForward},
188
- ...CM.closeBracketsKeymap,
189
191
  ...CM.standardKeymap,
190
192
  ...CM.historyKeymap,
191
193
  ]);
@@ -201,6 +203,15 @@ export function theme(): CM.Extension {
201
203
  return [editorTheme, themeIsDark() ? dummyDarkTheme : []];
202
204
  }
203
205
 
206
+ let sideBarElement: HTMLElement|null = null;
207
+
208
+ function getTooltipSpace(): DOMRect {
209
+ if (!sideBarElement) {
210
+ sideBarElement = document.querySelector('[slot="insertion-point-sidebar"]');
211
+ }
212
+ return (sideBarElement || document.body).getBoundingClientRect();
213
+ }
214
+
204
215
  export function baseConfiguration(text: string): CM.Extension {
205
216
  return [
206
217
  theme(),
@@ -210,7 +221,6 @@ export function baseConfiguration(text: string): CM.Extension {
210
221
  CM.EditorState.allowMultipleSelections.of(true),
211
222
  CM.indentOnInput(),
212
223
  CodeHighlighter.CodeHighlighter.highlightStyle,
213
- CM.closeBrackets(),
214
224
  baseKeymap,
215
225
  tabMovesFocus.instance(),
216
226
  bracketMatching.instance(),
@@ -218,10 +228,18 @@ export function baseConfiguration(text: string): CM.Extension {
218
228
  CM.Prec.lowest(CM.EditorView.contentAttributes.of({'aria-label': i18nString(UIStrings.codeEditor)})),
219
229
  detectLineSeparator(text),
220
230
  autocompletion,
221
- CM.tooltips({parent: getTooltipHost() as unknown as HTMLElement}),
231
+ CM.tooltips({
232
+ parent: getTooltipHost() as unknown as HTMLElement,
233
+ tooltipSpace: getTooltipSpace,
234
+ }),
222
235
  ];
223
236
  }
224
237
 
238
+ export const closeBrackets: CM.Extension = [
239
+ CM.closeBrackets(),
240
+ CM.keymap.of(CM.closeBracketsKeymap),
241
+ ];
242
+
225
243
  // Root editor tooltips at the top of the document, creating a special
226
244
  // element with the editor styles mounted in it for them. This is
227
245
  // annoying, but necessary because a scrollable parent node clips them
@@ -287,12 +305,16 @@ export const showCompletionHint = CM.ViewPlugin.fromClass(class {
287
305
  }
288
306
 
289
307
  topCompletion(state: CM.EditorState): string|null {
290
- const completions = CM.currentCompletions(state);
291
- if (!completions.length) {
308
+ const completion = CM.selectedCompletion(state);
309
+ if (!completion) {
292
310
  return null;
293
311
  }
294
- const {label} = completions[0];
295
- if (label.length > 100 || label.indexOf('\n') > -1) {
312
+ let {label, apply} = completion;
313
+ if (typeof apply === 'string') {
314
+ label = apply;
315
+ apply = undefined;
316
+ }
317
+ if (apply || label.length > 100 || label.indexOf('\n') > -1 || completion.type === 'secondary') {
296
318
  return null;
297
319
  }
298
320
  const pos = state.selection.main.head;
@@ -300,13 +322,11 @@ export const showCompletionHint = CM.ViewPlugin.fromClass(class {
300
322
  if (pos !== lineBefore.to) {
301
323
  return null;
302
324
  }
303
- const textBefore = lineBefore.text.slice(0, pos - lineBefore.from);
304
- for (let i = label.length - 1; i > 0; i--) {
305
- if (textBefore.endsWith(label.slice(0, i)) && !/\w/.test(textBefore.charAt(textBefore.length - i - 1))) {
306
- return label.slice(i);
307
- }
325
+ const wordBefore = /[\w$]+$/.exec(lineBefore.text);
326
+ if (wordBefore && !label.startsWith(wordBefore[0])) {
327
+ return null;
308
328
  }
309
- return null;
329
+ return label.slice(wordBefore ? wordBefore[0].length : 0);
310
330
  }
311
331
  }, {decorations: p => p.decorations});
312
332
 
@@ -90,7 +90,7 @@ export const enum QueryType {
90
90
  PropertyExpression = 2,
91
91
  }
92
92
 
93
- export function getQueryType(tree: CodeMirror.Tree, pos: number): {
93
+ export function getQueryType(tree: CodeMirror.Tree, pos: number, doc: CodeMirror.Text): {
94
94
  type: QueryType,
95
95
  from?: number,
96
96
  relatedNode?: CodeMirror.SyntaxNode,
@@ -101,13 +101,15 @@ export function getQueryType(tree: CodeMirror.Tree, pos: number): {
101
101
  return null;
102
102
  }
103
103
 
104
- if (node.name === 'VariableName') {
105
- return {type: QueryType.Expression, from: node.from};
106
- }
107
104
  if (node.name === 'PropertyName') {
108
105
  return parent?.name !== 'MemberExpression' ? null :
109
106
  {type: QueryType.PropertyName, from: node.from, relatedNode: parent};
110
107
  }
108
+ if (node.name === 'VariableName' ||
109
+ // Treat alphabetic keywords as variables
110
+ !node.firstChild && node.to - node.from < 20 && !/[^a-z]/.test(doc.sliceString(node.from, node.to))) {
111
+ return {type: QueryType.Expression, from: node.from};
112
+ }
111
113
  if (node.name === 'String') {
112
114
  const parent = node.parent;
113
115
  return parent?.name === 'MemberExpression' && parent.childBefore(node.from)?.name === '[' ?
@@ -134,8 +136,8 @@ export function getQueryType(tree: CodeMirror.Tree, pos: number): {
134
136
 
135
137
  export async function javascriptCompletionSource(cx: CodeMirror.CompletionContext):
136
138
  Promise<CodeMirror.CompletionResult|null> {
137
- const query = getQueryType(CodeMirror.syntaxTree(cx.state), cx.pos);
138
- if (!query || query.from === undefined && !cx.explicit) {
139
+ const query = getQueryType(CodeMirror.syntaxTree(cx.state), cx.pos, cx.state.doc);
140
+ if (!query || query.from === undefined && !cx.explicit && query.type === QueryType.Expression) {
139
141
  return null;
140
142
  }
141
143
 
@@ -162,7 +164,8 @@ export async function javascriptCompletionSource(cx: CodeMirror.CompletionContex
162
164
  if (!objectExpr) {
163
165
  return null;
164
166
  }
165
- result = await completeProperties(cx.state.sliceDoc(objectExpr.from, objectExpr.to), quote);
167
+ result = await completeProperties(
168
+ cx.state.sliceDoc(objectExpr.from, objectExpr.to), quote, cx.state.sliceDoc(cx.pos, cx.pos + 1) === ']');
166
169
  } else {
167
170
  return null;
168
171
  }
@@ -250,6 +253,7 @@ class PropertyCache {
250
253
  async function completeProperties(
251
254
  expression: string,
252
255
  quoted?: string,
256
+ hasBracket: boolean = false,
253
257
  ): Promise<CompletionSet> {
254
258
  const cache = PropertyCache.instance();
255
259
  if (!quoted) {
@@ -262,7 +266,7 @@ async function completeProperties(
262
266
  if (!context) {
263
267
  return new CompletionSet();
264
268
  }
265
- const result = completePropertiesInner(expression, context, quoted);
269
+ const result = completePropertiesInner(expression, context, quoted, hasBracket);
266
270
  if (!quoted) {
267
271
  cache.set(expression, result);
268
272
  }
@@ -275,6 +279,7 @@ async function completePropertiesInner(
275
279
  expression: string,
276
280
  context: SDK.RuntimeModel.ExecutionContext,
277
281
  quoted?: string,
282
+ hasBracket: boolean = false,
278
283
  ): Promise<CompletionSet> {
279
284
  const result = new CompletionSet();
280
285
  if (!context) {
@@ -313,7 +318,7 @@ async function completePropertiesInner(
313
318
  label,
314
319
  type: prop.value?.type === 'function' ? functionType : otherType,
315
320
  };
316
- if (quoted) {
321
+ if (quoted && !hasBracket) {
317
322
  completion.apply = label + ']';
318
323
  }
319
324
  if (!prop.isOwn) {
@@ -18,7 +18,7 @@ export const editorTheme = CM.EditorView.theme({
18
18
  fontSize: 'var(--source-code-font-size)',
19
19
  },
20
20
 
21
- '.cm-panels, .cm-tooltip': {
21
+ '.cm-panels': {
22
22
  backgroundColor: 'var(--color-background-elevation-1)',
23
23
  },
24
24
 
@@ -110,25 +110,50 @@ export const editorTheme = CM.EditorView.theme({
110
110
  color: 'var(--color-text-secondary)',
111
111
  },
112
112
 
113
+ '.cm-tooltip': {
114
+ boxShadow: 'var(--drop-shadow)',
115
+ backgroundColor: 'var(--color-background-elevation-1)',
116
+ },
117
+
113
118
  '.cm-argumentHints': {
114
119
  pointerEvents: 'none',
115
120
  padding: '0 4px',
116
121
  whiteSpace: 'nowrap',
117
122
  lineHeight: '20px',
118
123
  marginBottom: '4px',
119
- boxShadow: 'var(--drop-shadow)',
120
- backgroundColor: 'var(--color-background)',
121
124
  width: 'fit-content',
122
125
  },
123
126
 
124
127
  '.cm-tooltip.cm-tooltip-autocomplete > ul': {
128
+ backgroundColor: 'var(--color-background)',
125
129
  minWidth: '16em',
130
+ '& > li.cm-secondaryCompletion': {
131
+ display: 'flex',
132
+ backgroundColor: 'var(--color-background-elevation-1)',
133
+ justifyContent: 'space-between',
134
+ '&::before': {
135
+ content: '">"',
136
+ fontWeight: 'bold',
137
+ color: 'var(--color-primary-variant)',
138
+ marginRight: '5px',
139
+ },
140
+ },
141
+ '& > li:hover': {
142
+ backgroundColor: 'var(--item-hover-color)',
143
+ },
126
144
  '& > li[aria-selected]': {
127
145
  backgroundColor: 'var(--color-selected-option-background)',
128
- color: 'var(--color-selected-option)',
146
+ '&, &.cm-secondaryCompletion::before': {
147
+ color: 'var(--color-selected-option)',
148
+ },
129
149
  },
130
150
  },
131
151
 
152
+ '.cm-completionMatchedText': {
153
+ textDecoration: 'none',
154
+ fontWeight: 'bold',
155
+ },
156
+
132
157
  '.cm-highlightedLine': {
133
158
  animation: 'cm-fading-highlight 2s 0s',
134
159
  },
@@ -10,7 +10,7 @@ import * as Coordinator from '../render_coordinator/render_coordinator.js';
10
10
 
11
11
  import treeOutlineStyles from './treeOutline.css.js';
12
12
 
13
- import type {TreeNode, TreeNodeWithChildren} from './TreeOutlineUtils.js';
13
+ import type {TreeNodeId, TreeNode, TreeNodeWithChildren} from './TreeOutlineUtils.js';
14
14
  import {findNextNodeForTreeOutlineKeyboardNavigation, getNodeChildren, getPathToTreeNode, isExpandableNode, trackDOMNodeToTreeNode} from './TreeOutlineUtils.js';
15
15
 
16
16
  const coordinator = Coordinator.RenderCoordinator.RenderCoordinator.instance();
@@ -24,6 +24,7 @@ export interface TreeOutlineData<TreeNodeDataType> {
24
24
  * cause issues in the TreeOutline.
25
25
  */
26
26
  tree: readonly TreeNode<TreeNodeDataType>[];
27
+ filter?: (node: TreeNodeDataType) => FilterOption;
27
28
  }
28
29
 
29
30
  export function defaultRenderer(node: TreeNode<string>): LitHtml.TemplateResult {
@@ -66,6 +67,19 @@ export class ItemMouseOutEvent<TreeNodeDataType> extends Event {
66
67
  }
67
68
  }
68
69
 
70
+ /**
71
+ *
72
+ * The tree can be filtered by providing a custom filter function.
73
+ * The filter is applied on every node when constructing the tree
74
+ * and proceeds as follows:
75
+ * - If the filter return SHOW for a node, the node is included in the tree.
76
+ * - If the filter returns FLATTEN, the node is ignored but its subtree is included.
77
+ */
78
+ export const enum FilterOption {
79
+ SHOW = 'SHOW',
80
+ FLATTEN = 'FLATTEN',
81
+ }
82
+
69
83
  export class TreeOutline<TreeNodeDataType> extends HTMLElement {
70
84
  static readonly litTagName = LitHtml.literal`devtools-tree-outline`;
71
85
  private readonly shadow = this.attachShadow({mode: 'open'});
@@ -79,7 +93,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
79
93
  * know for sure when that node will be rendered. This variable tracks the
80
94
  * node that we want focused but may not yet have been rendered.
81
95
  */
82
- private nodePendingFocus: TreeNode<TreeNodeDataType>|null = null;
96
+ private nodeIdPendingFocus: TreeNodeId|null = null;
83
97
  private selectedTreeNode: TreeNode<TreeNodeDataType>|null = null;
84
98
  private defaultRenderer =
85
99
  (node: TreeNode<TreeNodeDataType>, _state: {isExpanded: boolean}): LitHtml.TemplateResult => {
@@ -91,6 +105,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
91
105
  }
92
106
  return LitHtml.html`${String(node.treeNodeData)}`;
93
107
  };
108
+ private nodeFilter?: ((node: TreeNodeDataType) => FilterOption);
94
109
 
95
110
  /**
96
111
  * scheduledRender = render() has been called and scheduled a render.
@@ -134,6 +149,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
134
149
  set data(data: TreeOutlineData<TreeNodeDataType>) {
135
150
  this.defaultRenderer = data.defaultRenderer;
136
151
  this.treeData = data.tree;
152
+ this.nodeFilter = data.filter;
137
153
  if (!this.hasRenderedAtLeastOnce) {
138
154
  this.selectedTreeNode = this.treeData[0];
139
155
  }
@@ -150,14 +166,29 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
150
166
  await this.render();
151
167
  }
152
168
 
169
+ /**
170
+ * Collapses all nodes in the tree.
171
+ */
172
+ async collapseAllNodes(): Promise<void> {
173
+ this.nodeExpandedMap.clear();
174
+ await this.render();
175
+ }
176
+
153
177
  /**
154
178
  * Takes a TreeNode, expands the outline to reveal it, and focuses it.
155
179
  */
156
180
  async expandToAndSelectTreeNode(targetTreeNode: TreeNode<TreeNodeDataType>): Promise<void> {
157
- const pathToTreeNode = await getPathToTreeNode(this.treeData, targetTreeNode);
181
+ return this.expandToAndSelectTreeNodeId(targetTreeNode.id);
182
+ }
183
+
184
+ /**
185
+ * Takes a TreeNode ID, expands the outline to reveal it, and focuses it.
186
+ */
187
+ async expandToAndSelectTreeNodeId(targetTreeNodeId: TreeNodeId): Promise<void> {
188
+ const pathToTreeNode = await getPathToTreeNode(this.treeData, targetTreeNodeId);
158
189
 
159
190
  if (pathToTreeNode === null) {
160
- throw new Error(`Could not find node with id ${targetTreeNode.id} in the tree.`);
191
+ throw new Error(`Could not find node with id ${targetTreeNodeId} in the tree.`);
161
192
  }
162
193
  pathToTreeNode.forEach((node, index) => {
163
194
  // We don't expand the very last node, which was the target node.
@@ -167,10 +198,26 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
167
198
  });
168
199
 
169
200
  // Mark the node as pending focus so when it is rendered into the DOM we can focus it
170
- this.nodePendingFocus = targetTreeNode;
201
+ this.nodeIdPendingFocus = targetTreeNodeId;
171
202
  await this.render();
172
203
  }
173
204
 
205
+ /**
206
+ * Takes a list of TreeNode IDs and expands the corresponding nodes.
207
+ */
208
+ expandNodeIds(nodeIds: TreeNodeId[]): Promise<void> {
209
+ nodeIds.forEach(id => this.nodeExpandedMap.set(id, true));
210
+ return this.render();
211
+ }
212
+
213
+ /**
214
+ * Takes a TreeNode ID and focuses the corresponding node.
215
+ */
216
+ focusNodeId(nodeId: TreeNodeId): Promise<void> {
217
+ this.nodeIdPendingFocus = nodeId;
218
+ return this.render();
219
+ }
220
+
174
221
  async collapseChildrenOfNode(domNode: HTMLLIElement): Promise<void> {
175
222
  const treeNode = this.domNodeToTreeNodeMap.get(domNode);
176
223
  if (!treeNode) {
@@ -208,7 +255,22 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
208
255
  }
209
256
 
210
257
  private async fetchNodeChildren(node: TreeNodeWithChildren<TreeNodeDataType>): Promise<TreeNode<TreeNodeDataType>[]> {
211
- return getNodeChildren(node);
258
+ const children = await getNodeChildren(node);
259
+ if (!this.nodeFilter) {
260
+ return children;
261
+ }
262
+ const filteredChildren = [];
263
+ for (const child of children) {
264
+ const filtering = this.nodeFilter(child.treeNodeData);
265
+ // We always include the selected node in the tree, regardless of its filtering status.
266
+ if (filtering === FilterOption.SHOW || this.isSelectedNode(child) || child.id === this.nodeIdPendingFocus) {
267
+ filteredChildren.push(child);
268
+ } else if (filtering === FilterOption.FLATTEN && isExpandableNode(child)) {
269
+ const grandChildren = await this.fetchNodeChildren(child);
270
+ filteredChildren.push(...grandChildren);
271
+ }
272
+ }
273
+ return filteredChildren;
212
274
  }
213
275
 
214
276
  private setNodeExpandedState(node: TreeNode<TreeNodeDataType>, newExpandedState: boolean): void {
@@ -337,7 +399,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
337
399
  }
338
400
 
339
401
  private focusPendingNode(domNode: HTMLLIElement): void {
340
- this.nodePendingFocus = null;
402
+ this.nodeIdPendingFocus = null;
341
403
  this.focusTreeNode(domNode);
342
404
  }
343
405
 
@@ -411,7 +473,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
411
473
  return;
412
474
  }
413
475
 
414
- if (this.nodePendingFocus && node.id === this.nodePendingFocus.id) {
476
+ if (this.nodeIdPendingFocus && node.id === this.nodeIdPendingFocus) {
415
477
  this.focusPendingNode(domNode);
416
478
  }
417
479
  })}
@@ -433,6 +495,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
433
495
  `;
434
496
  // clang-format on
435
497
  }
498
+
436
499
  private async render(): Promise<void> {
437
500
  if (this.scheduledRender) {
438
501
  // If we are already rendering, don't render again immediately, but
@@ -4,10 +4,12 @@
4
4
  import * as Platform from '../../../core/platform/platform.js';
5
5
  import * as LitHtml from '../../lit-html/lit-html.js';
6
6
 
7
+ export type TreeNodeId = string;
8
+
7
9
  interface BaseTreeNode<TreeNodeDataType> {
8
10
  treeNodeData: TreeNodeDataType;
9
11
  renderer?: (node: TreeNode<TreeNodeDataType>, state: {isExpanded: boolean}) => LitHtml.TemplateResult;
10
- id: string;
12
+ id: TreeNodeId;
11
13
  }
12
14
 
13
15
  export interface TreeNodeWithChildren<TreeNodeDataType> extends BaseTreeNode<TreeNodeDataType> {
@@ -196,10 +198,10 @@ export const getNodeChildren =
196
198
  * And you look for F, you'll get back [A, D, F]
197
199
  */
198
200
  export const getPathToTreeNode =
199
- async<TreeNodeDataType>(tree: readonly TreeNode<TreeNodeDataType>[], nodeToFind: TreeNode<TreeNodeDataType>):
201
+ async<TreeNodeDataType>(tree: readonly TreeNode<TreeNodeDataType>[], nodeIdToFind: TreeNodeId):
200
202
  Promise<TreeNode<TreeNodeDataType>[]|null> => {
201
203
  for (const rootNode of tree) {
202
- const foundPathOrNull = await getPathToTreeNodeRecursively(rootNode, nodeToFind, [rootNode]);
204
+ const foundPathOrNull = await getPathToTreeNodeRecursively(rootNode, nodeIdToFind, [rootNode]);
203
205
  if (foundPathOrNull !== null) {
204
206
  return foundPathOrNull;
205
207
  }
@@ -208,16 +210,16 @@ export const getPathToTreeNode =
208
210
  };
209
211
 
210
212
  const getPathToTreeNodeRecursively = async<TreeNodeDataType>(
211
- currentNode: TreeNode<TreeNodeDataType>, nodeToFind: TreeNode<TreeNodeDataType>,
213
+ currentNode: TreeNode<TreeNodeDataType>, nodeIdToFind: TreeNodeId,
212
214
  pathToNode: TreeNode<TreeNodeDataType>[]): Promise<TreeNode<TreeNodeDataType>[]|null> => {
213
- if (currentNode.id === nodeToFind.id) {
215
+ if (currentNode.id === nodeIdToFind) {
214
216
  return pathToNode;
215
217
  }
216
218
 
217
219
  if (currentNode.children) {
218
220
  const children = await getNodeChildren(currentNode);
219
221
  for (const child of children) {
220
- const foundPathOrNull = await getPathToTreeNodeRecursively(child, nodeToFind, [...pathToNode, child]);
222
+ const foundPathOrNull = await getPathToTreeNodeRecursively(child, nodeIdToFind, [...pathToNode, child]);
221
223
  if (foundPathOrNull !== null) {
222
224
  return foundPathOrNull;
223
225
  }
@@ -137,9 +137,14 @@ export class Dialog extends Common.ObjectWrapper.eventMixin<EventTypes, typeof G
137
137
  if (node instanceof HTMLElement) {
138
138
  const element = (node as HTMLElement);
139
139
  const tabIndex = element.tabIndex;
140
- if (tabIndex >= 0 && (!exclusionSet || !exclusionSet.has(element))) {
141
- this.tabIndexMap.set(element, tabIndex);
142
- element.tabIndex = -1;
140
+ if (!exclusionSet?.has(element)) {
141
+ if (tabIndex >= 0) {
142
+ this.tabIndexMap.set(element, tabIndex);
143
+ element.tabIndex = -1;
144
+ } else if (element.hasAttribute('contenteditable')) {
145
+ this.tabIndexMap.set(element, element.hasAttribute('tabindex') ? tabIndex : 0);
146
+ element.tabIndex = -1;
147
+ }
143
148
  }
144
149
  }
145
150
  }