chrome-devtools-frontend 1.0.1701636 → 1.0.1703574

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 (91) hide show
  1. package/eslint.config.mjs +3 -1
  2. package/front_end/core/common/ParsedURL.ts +5 -1
  3. package/front_end/core/host/UserMetricsEnums.ts +2 -1
  4. package/front_end/core/root/ExperimentNames.ts +1 -0
  5. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +2 -7
  6. package/front_end/core/text_utils/Markdown.ts +73 -0
  7. package/front_end/core/text_utils/text_utils.ts +2 -0
  8. package/front_end/devtools_compatibility.js +2 -1
  9. package/front_end/entrypoints/main/MainImpl.ts +8 -0
  10. package/front_end/generated/InspectorBackendCommands.ts +6 -4
  11. package/front_end/generated/protocol-mapping.d.ts +8 -0
  12. package/front_end/generated/protocol-proxy-api.d.ts +6 -0
  13. package/front_end/generated/protocol.ts +22 -3
  14. package/front_end/models/ai_assistance/AiAgent2.ts +13 -1
  15. package/front_end/models/ai_assistance/AiConversation.ts +1 -1
  16. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +13 -19
  17. package/front_end/models/change_tracker/ChangeTracker.ts +5 -64
  18. package/front_end/models/comment_manager/CD4ABridge.ts +5 -0
  19. package/front_end/models/comment_manager/CommentManager.ts +3 -5
  20. package/front_end/models/comment_manager/CommentThread.ts +30 -13
  21. package/front_end/models/issues_manager/CookieDeprecationMetadataIssue.ts +6 -7
  22. package/front_end/models/issues_manager/DeprecationIssue.ts +1 -1
  23. package/front_end/models/issues_manager/MarkdownIssueDescription.ts +18 -52
  24. package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +2 -4
  25. package/front_end/models/issues_manager/descriptions/cookieWarnMetadataGrantRead.md +0 -1
  26. package/front_end/models/issues_manager/descriptions/cookieWarnMetadataGrantReadOptOut.md +5 -0
  27. package/front_end/models/issues_manager/descriptions/cookieWarnMetadataGrantSet.md +0 -1
  28. package/front_end/models/issues_manager/descriptions/cookieWarnMetadataGrantSetOptOut.md +5 -0
  29. package/front_end/models/issues_manager/descriptions/deprecation.md +1 -1
  30. package/front_end/models/issues_manager/descriptions/sriValidationFailedIntegrityMismatch.md +2 -0
  31. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +1 -1
  32. package/front_end/models/persistence/NetworkPersistenceManager.ts +14 -2
  33. package/front_end/panels/common/CommentThreadWidget.ts +29 -10
  34. package/front_end/panels/common/CommentsOverlayWidget.ts +50 -14
  35. package/front_end/panels/common/CommentsStatusBarPill.ts +40 -7
  36. package/front_end/panels/common/commentThreadWidget.css +11 -0
  37. package/front_end/panels/common/commentsStatusBarPill.css +13 -0
  38. package/front_end/panels/elements/StylePropertiesSection.ts +10 -0
  39. package/front_end/panels/elements/StylePropertyTreeElement.ts +1 -1
  40. package/front_end/panels/elements/StylesSidebarPane.ts +101 -49
  41. package/front_end/panels/elements/components/CSSQuery.ts +1 -1
  42. package/front_end/panels/elements/components/cssQuery.css +4 -0
  43. package/front_end/panels/elements/elements.ts +0 -1
  44. package/front_end/panels/elements/stylesSidebarPane.css +6 -0
  45. package/front_end/panels/issues/IssueView.ts +5 -1
  46. package/front_end/panels/sources/ResourceOriginPlugin.ts +8 -3
  47. package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -4
  48. package/front_end/panels/sources/SourcesView.ts +127 -147
  49. package/front_end/panels/sources/TabbedEditorContainer.ts +518 -246
  50. package/front_end/panels/sources/UISourceCodeFrame.ts +9 -0
  51. package/front_end/third_party/chromium/README.chromium +1 -1
  52. package/front_end/third_party/chromium/client-variations/ClientVariations.js +25 -96
  53. package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
  54. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  55. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  56. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
  57. package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
  58. package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
  59. package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
  60. package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
  61. package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
  62. package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
  63. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  64. package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
  65. package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
  66. package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
  67. package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
  68. package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
  69. package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
  70. package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
  71. package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
  72. package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
  73. package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
  74. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
  75. package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
  76. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
  77. package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
  78. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  79. package/front_end/third_party/codemirror.next/package.json +4 -1
  80. package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
  81. package/front_end/ui/comments/CommentOverlayManager.ts +11 -10
  82. package/front_end/ui/components/markdown_view/MarkdownPlaceholderLitRenderer.ts +59 -0
  83. package/front_end/ui/components/markdown_view/markdown_view.ts +2 -0
  84. package/front_end/ui/legacy/TabbedPane.ts +51 -40
  85. package/front_end/ui/legacy/Treeoutline.ts +28 -19
  86. package/front_end/ui/legacy/UIUtils.ts +1 -1
  87. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +424 -570
  88. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +2 -27
  89. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  90. package/mcp/mcp.ts +1 -0
  91. package/package.json +2 -1
@@ -8,7 +8,7 @@ import * as Common from '../../core/common/common.js';
8
8
  import * as i18n from '../../core/i18n/i18n.js';
9
9
  import * as Platform from '../../core/platform/platform.js';
10
10
  import * as Buttons from '../../ui/components/buttons/buttons.js';
11
- import {type LitTemplate, render} from '../../ui/lit/lit.js';
11
+ import {type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
12
12
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
13
13
  import * as Geometry from '../geometry/geometry.js';
14
14
  import {createIcon, Icon} from '../kit/kit.js';
@@ -105,7 +105,7 @@ export class TabbedPane extends TabbedPaneBase {
105
105
  private delegate?: TabbedPaneTabDelegate;
106
106
  private currentTab?: TabbedPaneTab;
107
107
  private sliderEnabled?: boolean;
108
- private placeholderElement?: Element;
108
+ private placeholderElement?: Element|LitTemplate;
109
109
  private focusedPlaceholderElement?: Element;
110
110
  private placeholderContainerElement?: HTMLElement;
111
111
  private lastSelectedOverflowTab?: TabbedPaneTab;
@@ -184,7 +184,6 @@ export class TabbedPane extends TabbedPaneBase {
184
184
  this.currentDevicePixelRatio = window.devicePixelRatio;
185
185
  ZoomManager.instance().addEventListener(ZoomManagerEvents.ZOOM_CHANGED, this.zoomChanged, this);
186
186
  this.makeTabSlider();
187
-
188
187
  }
189
188
 
190
189
  setAccessibleName(name: string): void {
@@ -271,9 +270,8 @@ export class TabbedPane extends TabbedPaneBase {
271
270
  this.delegate = delegate;
272
271
  }
273
272
 
274
- appendTab(
275
- id: string, tabTitle: string, view: AnyWidget, tabTooltip?: string, userGesture?: boolean, isCloseable?: boolean,
276
- isPreviewFeature?: boolean, index?: number, jslogContext?: string): void {
273
+ appendTab(id: string, tabTitle: string, view: AnyWidget, tabTooltip?: string, userGesture?: boolean,
274
+ isCloseable?: boolean, isPreviewFeature?: boolean, index?: number, jslogContext?: string): void {
277
275
  const closeable = typeof isCloseable === 'boolean' ? isCloseable : Boolean(this.closeableTabs);
278
276
  const tab =
279
277
  new TabbedPaneTab(this, id, tabTitle, closeable, Boolean(isPreviewFeature), view, tabTooltip, jslogContext);
@@ -620,14 +618,19 @@ export class TabbedPane extends TabbedPaneBase {
620
618
  return constraints;
621
619
  }
622
620
 
623
- setPlaceholderElement(element: Element, focusedElement?: Element): void {
621
+ setPlaceholderElement(element: Element|LitTemplate, focusedElement?: Element): void {
624
622
  this.placeholderElement = element;
625
623
  if (focusedElement) {
626
624
  this.focusedPlaceholderElement = focusedElement;
627
625
  }
628
626
  if (this.placeholderContainerElement) {
629
- this.placeholderContainerElement.removeChildren();
630
- this.placeholderContainerElement.appendChild(element);
627
+ if (element instanceof Element) {
628
+ render(nothing, this.placeholderContainerElement);
629
+ this.placeholderContainerElement.removeChildren();
630
+ this.placeholderContainerElement.appendChild(element);
631
+ } else {
632
+ render(element, this.placeholderContainerElement);
633
+ }
631
634
  }
632
635
  }
633
636
 
@@ -644,7 +647,11 @@ export class TabbedPane extends TabbedPaneBase {
644
647
  this.#contentElement.classList.add('has-no-tabs');
645
648
  if (this.placeholderElement && !this.placeholderContainerElement) {
646
649
  this.placeholderContainerElement = this.#contentElement.createChild('div', 'tabbed-pane-placeholder fill');
647
- this.placeholderContainerElement.appendChild(this.placeholderElement);
650
+ if (this.placeholderElement instanceof Element) {
651
+ this.placeholderContainerElement.appendChild(this.placeholderElement);
652
+ } else {
653
+ render(this.placeholderElement, this.placeholderContainerElement);
654
+ }
648
655
  if (this.focusedPlaceholderElement) {
649
656
  this.setDefaultFocusedElement(this.focusedPlaceholderElement);
650
657
  }
@@ -675,10 +682,9 @@ export class TabbedPane extends TabbedPaneBase {
675
682
  if (!this.#rightToolbar.hasCompactLayout() &&
676
683
  totalWidth - rightToolbarWidth - leftToolbarWidth < this.measuredDropDownButtonWidth + 10) {
677
684
  this.#rightToolbar.setCompactLayout(true);
678
- } else if (
679
- this.#rightToolbar.hasCompactLayout() &&
680
- // Estimate the right toolbar size in non-compact mode as 2 times its compact size.
681
- totalWidth - 2 * rightToolbarWidth - leftToolbarWidth > this.measuredDropDownButtonWidth + 10) {
685
+ } else if (this.#rightToolbar.hasCompactLayout() &&
686
+ // Estimate the right toolbar size in non-compact mode as 2 times its compact size.
687
+ totalWidth - 2 * rightToolbarWidth - leftToolbarWidth > this.measuredDropDownButtonWidth + 10) {
682
688
  this.#rightToolbar.setCompactLayout(false);
683
689
  }
684
690
  }
@@ -732,11 +738,11 @@ export class TabbedPane extends TabbedPaneBase {
732
738
  continue;
733
739
  }
734
740
  if (this.numberOfTabsShown() === 0 && this.tabsHistory[0] === tab) {
735
- menu.defaultSection().appendCheckboxItem(
736
- tab.title, this.dropDownMenuItemSelected.bind(this, tab), {checked: true, jslogContext: tab.jslogContext});
741
+ menu.defaultSection().appendCheckboxItem(tab.title, this.dropDownMenuItemSelected.bind(this, tab),
742
+ {checked: true, jslogContext: tab.jslogContext});
737
743
  } else {
738
- menu.defaultSection().appendItem(
739
- tab.title, this.dropDownMenuItemSelected.bind(this, tab), {jslogContext: tab.jslogContext});
744
+ menu.defaultSection().appendItem(tab.title, this.dropDownMenuItemSelected.bind(this, tab),
745
+ {jslogContext: tab.jslogContext});
740
746
  }
741
747
  }
742
748
  void menu.show().then(() => ARIAUtils.setExpanded(this.dropDownButton, menu.isHostedMenuOpen()));
@@ -996,9 +1002,8 @@ export class TabbedPane extends TabbedPaneBase {
996
1002
  return totalWidth / measuredWidths.length;
997
1003
  }
998
1004
 
999
- private tabsToShowIndexes(
1000
- tabsOrdered: TabbedPaneTab[], tabsHistory: TabbedPaneTab[], totalWidth: number,
1001
- measuredDropDownButtonWidth: number): number[] {
1005
+ private tabsToShowIndexes(tabsOrdered: TabbedPaneTab[], tabsHistory: TabbedPaneTab[], totalWidth: number,
1006
+ measuredDropDownButtonWidth: number): number[] {
1002
1007
  const tabsToShowIndexes = [];
1003
1008
 
1004
1009
  let totalTabsWidth = 0;
@@ -1222,9 +1227,8 @@ export class TabbedPaneTab {
1222
1227
  private titleElement?: HTMLElement;
1223
1228
  private dragStartX?: number;
1224
1229
  #jslogContext?: string;
1225
- constructor(
1226
- tabbedPane: TabbedPane, id: string, title: string, closeable: boolean, previewFeature: boolean, view: AnyWidget,
1227
- tooltip?: string, jslogContext?: string) {
1230
+ constructor(tabbedPane: TabbedPane, id: string, title: string, closeable: boolean, previewFeature: boolean,
1231
+ view: AnyWidget, tooltip?: string, jslogContext?: string) {
1228
1232
  this.closeable = closeable;
1229
1233
  this.previewFeature = previewFeature;
1230
1234
  this.tabbedPane = tabbedPane;
@@ -1427,9 +1431,8 @@ export class TabbedPaneTab {
1427
1431
 
1428
1432
  tabElement.addEventListener('contextmenu', this.tabContextMenu.bind(this), false);
1429
1433
  if (this.tabbedPane.allowTabReorder) {
1430
- installDragHandle(
1431
- tabElement, this.startTabDragging.bind(this), this.tabDragging.bind(this), this.endTabDragging.bind(this),
1432
- null, null, 200);
1434
+ installDragHandle(tabElement, this.startTabDragging.bind(this), this.tabDragging.bind(this),
1435
+ this.endTabDragging.bind(this), null, null, 200);
1433
1436
  }
1434
1437
  }
1435
1438
 
@@ -1542,25 +1545,24 @@ export class TabbedPaneTab {
1542
1545
  const contextMenu = new ContextMenu(event);
1543
1546
  if (this.closeable) {
1544
1547
  contextMenu.defaultSection().appendItem(i18nString(UIStrings.close), close.bind(this), {jslogContext: 'close'});
1545
- contextMenu.defaultSection().appendItem(
1546
- i18nString(UIStrings.closeOthers), closeOthers.bind(this), {jslogContext: 'close-others'});
1547
- contextMenu.defaultSection().appendItem(
1548
- i18nString(UIStrings.closeTabsToTheRight), closeToTheRight.bind(this),
1549
- {jslogContext: 'close-tabs-to-the-right'});
1550
- contextMenu.defaultSection().appendItem(
1551
- i18nString(UIStrings.closeAll), closeAll.bind(this), {jslogContext: 'close-all'});
1548
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.closeOthers), closeOthers.bind(this),
1549
+ {jslogContext: 'close-others'});
1550
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.closeTabsToTheRight), closeToTheRight.bind(this),
1551
+ {jslogContext: 'close-tabs-to-the-right'});
1552
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.closeAll), closeAll.bind(this),
1553
+ {jslogContext: 'close-all'});
1552
1554
  }
1553
1555
  if (this.delegate) {
1554
1556
  this.delegate.onContextMenu(this.id, contextMenu);
1555
1557
  }
1556
1558
  const tabIndex = this.tabbedPane.getTabIndex(this.id);
1557
1559
  if (tabIndex > 0) {
1558
- contextMenu.defaultSection().appendItem(
1559
- i18nString(UIStrings.moveTabLeft), moveTabBackward.bind(this, tabIndex), {jslogContext: 'move-tab-backward'});
1560
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.moveTabLeft), moveTabBackward.bind(this, tabIndex),
1561
+ {jslogContext: 'move-tab-backward'});
1560
1562
  }
1561
1563
  if (tabIndex < this.tabbedPane.tabsElement.childNodes.length - 1) {
1562
- contextMenu.defaultSection().appendItem(
1563
- i18nString(UIStrings.moveTabRight), moveTabForward.bind(this, tabIndex), {jslogContext: 'move-tab-forward'});
1564
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.moveTabRight), moveTabForward.bind(this, tabIndex),
1565
+ {jslogContext: 'move-tab-forward'});
1564
1566
  }
1565
1567
  void contextMenu.show();
1566
1568
  }
@@ -1673,13 +1675,19 @@ export class TabbedPaneElement extends WidgetElement<TabbedPane> {
1673
1675
  this.getWidget()?.setTabDelegate(delegate);
1674
1676
  }
1675
1677
 
1676
- #placeholderElement?: Element;
1678
+ #placeholderElement?: Element|LitTemplate;
1679
+ #headerJslog?: string;
1677
1680
  #managedTabIds = new Set<string>();
1678
- set placeholder(element: Element) {
1681
+ set placeholder(element: Element|LitTemplate) {
1679
1682
  this.#placeholderElement = element;
1680
1683
  this.getWidget()?.setPlaceholderElement(element);
1681
1684
  }
1682
1685
 
1686
+ set headerJslog(jslog: string) {
1687
+ this.#headerJslog = jslog;
1688
+ this.getWidget()?.headerElement().setAttribute('jslog', jslog);
1689
+ }
1690
+
1683
1691
  readonly #tabObserver = new MutationObserver(() => this.#updateTabs());
1684
1692
 
1685
1693
  constructor() {
@@ -1693,6 +1701,9 @@ export class TabbedPaneElement extends WidgetElement<TabbedPane> {
1693
1701
  if (this.#delegate) {
1694
1702
  widget.setTabDelegate(this.#delegate);
1695
1703
  }
1704
+ if (this.#headerJslog) {
1705
+ widget.headerElement().setAttribute('jslog', this.#headerJslog);
1706
+ }
1696
1707
  const slot = widget.contentElement.querySelector('slot:not([name])');
1697
1708
  if (slot) {
1698
1709
  slot.addEventListener('slotchange', () => this.#syncTabs());
@@ -647,8 +647,8 @@ export class TreeElement {
647
647
  throw new Error('child can\'t be undefined or null');
648
648
  }
649
649
 
650
- console.assert(
651
- !child.parent, 'Attempting to insert a child that is already in the tree, reparenting is not supported.');
650
+ console.assert(!child.parent,
651
+ 'Attempting to insert a child that is already in the tree, reparenting is not supported.');
652
652
 
653
653
  const previousChild = (index > 0 ? this.childrenInternal[index - 1] : null);
654
654
  if (previousChild) {
@@ -788,6 +788,9 @@ export class TreeElement {
788
788
 
789
789
  set selectable(x: boolean) {
790
790
  this.selectableInternal = x;
791
+ if (!x && this.selected) {
792
+ this.deselect();
793
+ }
791
794
  }
792
795
 
793
796
  get listItemElement(): HTMLLIElement {
@@ -902,8 +905,8 @@ export class TreeElement {
902
905
  this.collapse();
903
906
  ARIAUtils.unsetExpandable(this.listItemNode);
904
907
  } else {
905
- VisualLogging.registerLoggable(
906
- this.expandLoggable, `${VisualLogging.expand()}`, this.listItemNode, new DOMRect(0, 0, 16, 16));
908
+ VisualLogging.registerLoggable(this.expandLoggable, `${VisualLogging.expand()}`, this.listItemNode,
909
+ new DOMRect(0, 0, 16, 16));
907
910
  ARIAUtils.setExpanded(this.listItemNode, false);
908
911
  }
909
912
  }
@@ -1437,9 +1440,8 @@ export class TreeElement {
1437
1440
  if (!dontPopulate) {
1438
1441
  void element.populateIfNeeded();
1439
1442
  }
1440
- element =
1441
- (skipUnrevealed ? (element.revealed() && element.expanded ? element.lastChild() : null) :
1442
- element.lastChild());
1443
+ element = (skipUnrevealed ? (element.revealed() && element.expanded ? element.lastChild() : null) :
1444
+ element.lastChild());
1443
1445
  }
1444
1446
 
1445
1447
  if (element) {
@@ -1523,8 +1525,8 @@ export class TreeSearch < NodeT extends TreeNode<NodeT>,
1523
1525
  return this.#getNodeMatchMap().get(node) ?? [];
1524
1526
  }
1525
1527
 
1526
- static highlight(ranges: TextUtils.TextRange.SourceRange[], selectedRange: TextUtils.TextRange.SourceRange|undefined):
1527
- ReturnType<typeof Lit.Directives.ref> {
1528
+ static highlight(ranges: TextUtils.TextRange.SourceRange[],
1529
+ selectedRange: TextUtils.TextRange.SourceRange|undefined): ReturnType<typeof Lit.Directives.ref> {
1528
1530
  return Lit.Directives.ref(element => {
1529
1531
  if (!(element instanceof HTMLElement)) {
1530
1532
  return;
@@ -1532,8 +1534,8 @@ export class TreeSearch < NodeT extends TreeNode<NodeT>,
1532
1534
  const configListItem = element.closest<HTMLLIElement>('li[role="treeitem"]');
1533
1535
  const titleElement = configListItem ? TreeViewTreeElement.get(configListItem)?.titleElement : undefined;
1534
1536
  if (configListItem && titleElement) {
1535
- const targetElement = HTMLElementWithLightDOMTemplate.findCorrespondingElement(
1536
- element, configListItem, titleElement as HTMLElement);
1537
+ const targetElement = HTMLElementWithLightDOMTemplate.findCorrespondingElement(element, configListItem,
1538
+ titleElement as HTMLElement);
1537
1539
  if (targetElement) {
1538
1540
  Highlighting.HighlightManager.HighlightManager.instance().set(targetElement, ranges, selectedRange);
1539
1541
  }
@@ -1560,9 +1562,8 @@ export class TreeSearch < NodeT extends TreeNode<NodeT>,
1560
1562
 
1561
1563
  // This is a generator to sidestep stack overflow risks
1562
1564
  *
1563
- #innerSearch(
1564
- node: NodeT, currentMatch: SearchResultT|undefined, jumpBackwards: boolean,
1565
- match: (node: NodeT, isPostOrder: boolean) => SearchResultT[]): Generator<SearchResultT> {
1565
+ #innerSearch(node: NodeT, currentMatch: SearchResultT|undefined, jumpBackwards: boolean,
1566
+ match: (node: NodeT, isPostOrder: boolean) => SearchResultT[]): Generator<SearchResultT> {
1566
1567
  const updateCurrentMatchIndex = (isPostOrder: boolean): void => {
1567
1568
  if (currentMatch?.node === node && currentMatch.isPostOrderMatch === isPostOrder) {
1568
1569
  // We're current matching the node that contains the currently focused search result, the n-th result
@@ -1713,7 +1714,7 @@ class TreeViewTreeElement extends TreeElement {
1713
1714
  this.updateExpansionFromAttribute();
1714
1715
 
1715
1716
  Highlighting.HighlightManager.HighlightManager.instance().apply(this.titleElement);
1716
- if (hadFocus) {
1717
+ if (hadFocus && this.selected) {
1717
1718
  this.listItemElement.focus();
1718
1719
  }
1719
1720
  }
@@ -2158,8 +2159,15 @@ class IfExpandedDirective extends Lit.Directive.Directive {
2158
2159
  this.#partInfo = partInfo as {type: Lit.Directive.PartType, startNode: Node};
2159
2160
  }
2160
2161
 
2161
- render(content: Lit.LitTemplate|Iterable<Lit.LitTemplate>): Lit.LitTemplate|Iterable<Lit.LitTemplate> {
2162
- return this.#isInExpandedRow(this.#partInfo.startNode) ? content : Lit.nothing;
2162
+ render(content: Lit.LitTemplate|Iterable<Lit.LitTemplate>|
2163
+ (() => Lit.LitTemplate | Iterable<Lit.LitTemplate>)): Lit.LitTemplate|Iterable<Lit.LitTemplate> {
2164
+ if (!this.#isInExpandedRow(this.#partInfo.startNode)) {
2165
+ return Lit.nothing;
2166
+ }
2167
+ if (typeof content === 'function') {
2168
+ return content();
2169
+ }
2170
+ return content;
2163
2171
  }
2164
2172
 
2165
2173
  #isInExpandedRow(element: Node|null|undefined): boolean {
@@ -2186,8 +2194,9 @@ class IfExpandedDirective extends Lit.Directive.Directive {
2186
2194
  return node.expanded;
2187
2195
  }
2188
2196
  }
2189
- export const ifExpanded: (content: Lit.LitTemplate|Iterable<Lit.LitTemplate>) =>
2190
- Lit.DirectiveResult<typeof IfExpandedDirective> = Lit.Directive.directive(IfExpandedDirective);
2197
+ export const ifExpanded:
2198
+ (content: Lit.LitTemplate|Iterable<Lit.LitTemplate>|(() => Lit.LitTemplate | Iterable<Lit.LitTemplate>)) =>
2199
+ Lit.DirectiveResult<typeof IfExpandedDirective> = Lit.Directive.directive(IfExpandedDirective);
2191
2200
 
2192
2201
  export class TreeElementWrapper extends HTMLElement {
2193
2202
  #treeElement?: TreeElement;
@@ -2116,7 +2116,7 @@ export class HTMLElementWithLightDOMTemplate extends HTMLElement {
2116
2116
  return clone;
2117
2117
  }
2118
2118
 
2119
- private static patchLitTemplate(template: Lit.LitTemplate): void {
2119
+ static patchLitTemplate(template: Lit.LitTemplate): void {
2120
2120
  const interceptingWrapper = Lit.Directive.directive(Lit.CustomDirectives.InterceptBindingDirective);
2121
2121
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2122
2122
  const patchingWrapper = <Args extends any[], R>(fn: (...args: Args) => R): ((...args: Args) => R) => {