chrome-devtools-frontend 1.0.1543472 → 1.0.1544076

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 (109) hide show
  1. package/AUTHORS +1 -0
  2. package/front_end/core/host/AidaClient.ts +10 -7
  3. package/front_end/core/host/DispatchHttpRequestClient.ts +18 -3
  4. package/front_end/core/root/Runtime.ts +8 -7
  5. package/front_end/core/sdk/CPUThrottlingManager.ts +0 -4
  6. package/front_end/core/sdk/CSSMatchedStyles.ts +7 -9
  7. package/front_end/core/sdk/CSSModel.ts +1 -1
  8. package/front_end/core/sdk/CSSRule.ts +18 -6
  9. package/front_end/core/sdk/ChildTargetManager.ts +2 -2
  10. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +2 -0
  11. package/front_end/entrypoints/main/MainImpl.ts +0 -16
  12. package/front_end/foundation/Universe.ts +12 -1
  13. package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -8
  14. package/front_end/models/ai_assistance/agents/PatchAgent.ts +7 -1
  15. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +0 -5
  16. package/front_end/models/ai_assistance/agents/StylingAgent.ts +4 -8
  17. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +1 -1
  18. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +5 -3
  19. package/front_end/models/bindings/CSSWorkspaceBinding.ts +8 -7
  20. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +9 -8
  21. package/front_end/models/bindings/ResourceMapping.ts +57 -15
  22. package/front_end/models/live-metrics/LiveMetrics.ts +12 -20
  23. package/front_end/panels/accessibility/AccessibilityNodeView.ts +6 -2
  24. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
  25. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -4
  26. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +2 -1
  27. package/front_end/panels/animation/AnimationTimeline.ts +6 -6
  28. package/front_end/panels/application/components/ReportsGrid.ts +7 -2
  29. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +5 -3
  30. package/front_end/panels/application/components/TrustTokensView.ts +7 -1
  31. package/front_end/panels/application/preloading/PreloadingView.ts +10 -4
  32. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +7 -11
  33. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +15 -3
  34. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +12 -13
  35. package/front_end/panels/{elements → common}/DOMLinkifier.ts +6 -6
  36. package/front_end/panels/common/common.ts +1 -0
  37. package/front_end/panels/console/ConsoleViewMessage.ts +4 -4
  38. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -1
  39. package/front_end/panels/elements/ElementsTreeElement.ts +3 -1
  40. package/front_end/panels/elements/StylePropertiesSection.ts +52 -15
  41. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -3
  42. package/front_end/panels/elements/StylesSidebarPane.ts +24 -14
  43. package/front_end/panels/elements/elements-meta.ts +11 -2
  44. package/front_end/panels/elements/elements.ts +0 -3
  45. package/front_end/panels/explain/components/ConsoleInsight.ts +31 -20
  46. package/front_end/panels/issues/AffectedResourcesView.ts +2 -1
  47. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +2 -1
  48. package/front_end/panels/network/NetworkLogView.ts +1 -1
  49. package/front_end/panels/recorder/RecorderController.ts +7 -1
  50. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +42 -294
  51. package/front_end/panels/sources/DebuggerPausedMessage.ts +3 -3
  52. package/front_end/panels/sources/SourcesPanel.ts +5 -1
  53. package/front_end/panels/timeline/TimelineUIUtils.ts +3 -2
  54. package/front_end/panels/timeline/components/LiveMetricsView.ts +7 -4
  55. package/front_end/panels/timeline/components/insights/NodeLink.ts +3 -2
  56. package/front_end/third_party/puppeteer/README.chromium +2 -2
  57. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts +1 -0
  58. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
  59. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js +4 -1
  60. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
  61. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
  62. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
  63. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.js +8 -0
  64. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.js.map +1 -1
  65. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  66. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js +22 -0
  67. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js.map +1 -1
  68. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  69. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  70. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  71. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  72. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  73. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  74. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  75. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +34 -6
  76. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts +1 -0
  77. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
  78. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js +4 -1
  79. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
  80. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
  81. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
  82. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.js +8 -0
  83. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.js.map +1 -1
  84. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  85. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js +22 -0
  86. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js.map +1 -1
  87. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  88. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  89. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  90. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  92. package/front_end/third_party/puppeteer/package/package.json +2 -2
  93. package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +5 -1
  94. package/front_end/third_party/puppeteer/package/src/cdp/NetworkEventManager.ts +16 -1
  95. package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +28 -0
  96. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  97. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  98. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +8 -5
  99. package/front_end/ui/i18n/i18n.ts +16 -0
  100. package/front_end/ui/legacy/UIUtils.ts +1 -1
  101. package/front_end/ui/legacy/Widget.ts +56 -25
  102. package/front_end/ui/legacy/XLink.ts +0 -2
  103. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +3 -1
  104. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +155 -198
  105. package/front_end/ui/legacy/inspectorCommon.css +0 -4
  106. package/mcp/mcp.ts +1 -0
  107. package/package.json +1 -1
  108. package/front_end/ui/components/expandable_list/ExpandableList.docs.ts +0 -30
  109. /package/front_end/panels/{elements → common}/domLinkifier.css +0 -0
@@ -37,9 +37,8 @@ import * as SDK from '../../../../core/sdk/sdk.js';
37
37
  import type * as Protocol from '../../../../generated/protocol.js';
38
38
  import * as TextUtils from '../../../../models/text_utils/text_utils.js';
39
39
  import * as uiI18n from '../../../../ui/i18n/i18n.js';
40
- import * as IconButton from '../../../components/icon_button/icon_button.js';
41
40
  import * as TextEditor from '../../../components/text_editor/text_editor.js';
42
- import {Directives, html, render} from '../../../lit/lit.js';
41
+ import {Directives, html, type LitTemplate, nothing, render} from '../../../lit/lit.js';
43
42
  import * as VisualLogging from '../../../visual_logging/visual_logging.js';
44
43
  import * as UI from '../../legacy.js';
45
44
  import type * as Components from '../utils/utils.js';
@@ -504,86 +503,82 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
504
503
  return UI.Fragment.html`<span class="name">${name}</span>`;
505
504
  }
506
505
 
507
- static valueElementForFunctionDescription(description?: string, includePreview?: boolean, defaultName?: string):
508
- HTMLElement {
509
- const valueElement = document.createElement('span');
510
- valueElement.classList.add('object-value-function');
511
- description = description || '';
512
- const text = description.replace(/^function [gs]et /, 'function ')
513
- .replace(/^function [gs]et\(/, 'function\(')
514
- .replace(/^[gs]et /, '');
515
- defaultName = defaultName || '';
516
-
517
- // This set of best-effort regular expressions captures common function descriptions.
518
- // Ideally, some parser would provide prefix, arguments, function body text separately.
519
- const asyncMatch = text.match(/^(async\s+function)/);
520
- const isGenerator = text.startsWith('function*');
521
- const isGeneratorShorthand = text.startsWith('*');
522
- const isBasic = !isGenerator && text.startsWith('function');
523
- const isClass = text.startsWith('class ') || text.startsWith('class{');
524
- const firstArrowIndex = text.indexOf('=>');
525
- const isArrow = !asyncMatch && !isGenerator && !isBasic && !isClass && firstArrowIndex > 0;
526
-
527
- let textAfterPrefix;
528
- if (isClass) {
529
- textAfterPrefix = text.substring('class'.length);
530
- const classNameMatch = /^[^{\s]+/.exec(textAfterPrefix.trim());
531
- let className: string = defaultName;
532
- if (classNameMatch) {
533
- className = classNameMatch[0].trim() || defaultName;
534
- }
535
- addElements('class', textAfterPrefix, className);
536
- } else if (asyncMatch) {
537
- textAfterPrefix = text.substring(asyncMatch[1].length);
538
- addElements('async \u0192', textAfterPrefix, nameAndArguments(textAfterPrefix));
539
- } else if (isGenerator) {
540
- textAfterPrefix = text.substring('function*'.length);
541
- addElements('\u0192*', textAfterPrefix, nameAndArguments(textAfterPrefix));
542
- } else if (isGeneratorShorthand) {
543
- textAfterPrefix = text.substring('*'.length);
544
- addElements('\u0192*', textAfterPrefix, nameAndArguments(textAfterPrefix));
545
- } else if (isBasic) {
546
- textAfterPrefix = text.substring('function'.length);
547
- addElements('\u0192', textAfterPrefix, nameAndArguments(textAfterPrefix));
548
- } else if (isArrow) {
549
- const maxArrowFunctionCharacterLength = 60;
550
- let abbreviation: string = text;
551
- if (defaultName) {
552
- abbreviation = defaultName + '()';
553
- } else if (text.length > maxArrowFunctionCharacterLength) {
554
- abbreviation = text.substring(0, firstArrowIndex + 2) + ' {…}';
555
- }
556
- addElements('', text, abbreviation);
557
- } else {
558
- addElements('\u0192', text, nameAndArguments(text));
559
- }
560
- UI.Tooltip.Tooltip.install(valueElement, Platform.StringUtilities.trimEndWithMaxLength(description, 500));
561
- return valueElement;
506
+ static valueElementForFunctionDescription(
507
+ description?: string, includePreview?: boolean, defaultName?: string, className?: string): LitTemplate {
508
+ const contents =
509
+ (description: string, defaultName: string): {prefix: string, abbreviation: string, body: string} => {
510
+ const text = description.replace(/^function [gs]et /, 'function ')
511
+ .replace(/^function [gs]et\(/, 'function\(')
512
+ .replace(/^[gs]et /, '');
513
+
514
+ // This set of best-effort regular expressions captures common function descriptions.
515
+ // Ideally, some parser would provide prefix, arguments, function body text separately.
516
+ const asyncMatch = text.match(/^(async\s+function)/);
517
+ const isGenerator = text.startsWith('function*');
518
+ const isGeneratorShorthand = text.startsWith('*');
519
+ const isBasic = !isGenerator && text.startsWith('function');
520
+ const isClass = text.startsWith('class ') || text.startsWith('class{');
521
+ const firstArrowIndex = text.indexOf('=>');
522
+ const isArrow = !asyncMatch && !isGenerator && !isBasic && !isClass && firstArrowIndex > 0;
523
+
524
+ if (isClass) {
525
+ const body = text.substring('class'.length);
526
+ const classNameMatch = /^[^{\s]+/.exec(body.trim());
527
+ let className: string = defaultName;
528
+ if (classNameMatch) {
529
+ className = classNameMatch[0].trim() || defaultName;
530
+ }
531
+ return {prefix: 'class', body, abbreviation: className};
532
+ }
533
+ if (asyncMatch) {
534
+ const body = text.substring(asyncMatch[1].length);
535
+ return {prefix: 'async \u0192', body, abbreviation: nameAndArguments(body)};
536
+ }
537
+ if (isGenerator) {
538
+ const body = text.substring('function*'.length);
539
+ return {prefix: '\u0192*', body, abbreviation: nameAndArguments(body)};
540
+ }
541
+ if (isGeneratorShorthand) {
542
+ const body = text.substring('*'.length);
543
+ return {prefix: '\u0192*', body, abbreviation: nameAndArguments(body)};
544
+ }
545
+ if (isBasic) {
546
+ const body = text.substring('function'.length);
547
+ return {prefix: '\u0192', body, abbreviation: nameAndArguments(body)};
548
+ }
549
+ if (isArrow) {
550
+ const maxArrowFunctionCharacterLength = 60;
551
+ let abbreviation: string = text;
552
+ if (defaultName) {
553
+ abbreviation = defaultName + '()';
554
+ } else if (text.length > maxArrowFunctionCharacterLength) {
555
+ abbreviation = text.substring(0, firstArrowIndex + 2) + ' {…}';
556
+ }
557
+ return {prefix: '', body: text, abbreviation};
558
+ }
559
+ return {prefix: '\u0192', body: text, abbreviation: nameAndArguments(text)};
560
+ };
561
+
562
+ const {prefix, body, abbreviation} = contents(description ?? '', defaultName ?? '');
563
+ const maxFunctionBodyLength = 200;
564
+ return html`<span
565
+ class="object-value-function ${className ?? ''}"
566
+ title=${Platform.StringUtilities.trimEndWithMaxLength(description ?? '', 500)}>${
567
+ prefix && html`<span class=object-value-function-prefix>${prefix} </span>`}${
568
+ includePreview ? Platform.StringUtilities.trimEndWithMaxLength(body.trim(), maxFunctionBodyLength) :
569
+ abbreviation.replace(/\n/g, ' ')}</span>`;
562
570
 
563
571
  function nameAndArguments(contents: string): string {
564
572
  const startOfArgumentsIndex = contents.indexOf('(');
565
573
  const endOfArgumentsMatch = contents.match(/\)\s*{/);
566
574
  if (startOfArgumentsIndex !== -1 && endOfArgumentsMatch?.index !== undefined &&
567
575
  endOfArgumentsMatch.index > startOfArgumentsIndex) {
568
- const name = contents.substring(0, startOfArgumentsIndex).trim() || defaultName;
576
+ const name = contents.substring(0, startOfArgumentsIndex).trim() || (defaultName ?? '');
569
577
  const args = contents.substring(startOfArgumentsIndex, endOfArgumentsMatch.index + 1);
570
578
  return name + args;
571
579
  }
572
580
  return defaultName + '()';
573
581
  }
574
-
575
- function addElements(prefix: string, body: string, abbreviation: string): void {
576
- const maxFunctionBodyLength = 200;
577
- if (prefix.length) {
578
- valueElement.createChild('span', 'object-value-function-prefix').textContent = prefix + ' ';
579
- }
580
- if (includePreview) {
581
- UI.UIUtils.createTextChild(
582
- valueElement, Platform.StringUtilities.trimEndWithMaxLength(body.trim(), maxFunctionBodyLength));
583
- } else {
584
- UI.UIUtils.createTextChild(valueElement, abbreviation.replace(/\n/g, ' '));
585
- }
586
- }
587
582
  }
588
583
 
589
584
  static createPropertyValueWithCustomSupport(
@@ -598,141 +593,100 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
598
593
  value, wasThrown, showPreview, linkifier, isSyntheticProperty, variableName);
599
594
  }
600
595
 
601
- static appendMemoryIcon(element: Element, object: SDK.RemoteObject.RemoteObject, expression?: string): void {
602
- if (!object.isLinearMemoryInspectable()) {
603
- return;
604
- }
605
-
606
- const memoryIcon = new IconButton.Icon.Icon();
607
- memoryIcon.name = 'memory';
608
- memoryIcon.style.width = 'var(--sys-size-8)';
609
- memoryIcon.style.height = '13px';
610
- memoryIcon.addEventListener('click', event => {
611
- event.consume();
612
- void Common.Revealer.reveal(new SDK.RemoteObject.LinearMemoryInspectable(object, expression));
613
- });
614
- memoryIcon.setAttribute('jslog', `${VisualLogging.action('open-memory-inspector').track({click: true})}`);
615
-
616
- const revealText = i18nString(UIStrings.openInMemoryInpector);
617
- UI.Tooltip.Tooltip.install(memoryIcon, revealText);
618
- UI.ARIAUtils.setLabel(memoryIcon, revealText);
619
-
620
- // Directly set property on memory icon, so that the memory icon is also
596
+ static getMemoryIcon(object: SDK.RemoteObject.RemoteObject, expression?: string): LitTemplate {
597
+ // Directly set styles on memory icon, so that the memory icon is also
621
598
  // styled within the context of code mirror.
622
- memoryIcon.style.setProperty('vertical-align', 'sub');
623
- memoryIcon.style.setProperty('cursor', 'pointer');
599
+ // clang-format off
600
+ return !object.isLinearMemoryInspectable() ? nothing : html`<devtools-icon
601
+ name=memory
602
+ style="width: var(--sys-size-8); height: 13px; vertical-align: sub; cursor: pointer;"
603
+ @click=${(event: Event) => {
604
+ event.consume();
605
+ void Common.Revealer.reveal(new SDK.RemoteObject.LinearMemoryInspectable(object, expression));
606
+ }}
607
+ jslog=${VisualLogging.action('open-memory-inspector').track({click: true})}
608
+ title=${i18nString(UIStrings.openInMemoryInpector)}
609
+ aria-label=${i18nString(UIStrings.openInMemoryInpector)}></devtools-icon>`;
610
+ // clang-format on
611
+ }
624
612
 
625
- element.appendChild(memoryIcon);
613
+ static appendMemoryIcon(element: Element, object: SDK.RemoteObject.RemoteObject, expression?: string): void {
614
+ const fragment = document.createDocumentFragment();
615
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
616
+ render(ObjectPropertiesSection.getMemoryIcon(object, expression), fragment);
617
+ element.appendChild(fragment);
626
618
  }
627
619
 
628
620
  static createPropertyValue(
629
621
  value: SDK.RemoteObject.RemoteObject, wasThrown: boolean, showPreview: boolean,
630
622
  linkifier?: Components.Linkifier.Linkifier, isSyntheticProperty = false, variableName?: string): HTMLElement {
631
- let propertyValue: HTMLElement;
623
+ const propertyValue = document.createDocumentFragment();
632
624
  const type = value.type;
633
625
  const subtype = value.subtype;
634
626
  const description = value.description || '';
635
627
  const className = value.className;
636
- if (type === 'object' && subtype === 'internal#location') {
637
- const rawLocation = value.debuggerModel().createRawLocationByScriptId(
638
- value.value.scriptId, value.value.lineNumber, value.value.columnNumber);
639
- if (rawLocation && linkifier) {
640
- return linkifier.linkifyRawLocation(rawLocation, Platform.DevToolsPath.EmptyUrlString);
628
+
629
+ const contents = (): LitTemplate => {
630
+ if (type === 'object' && subtype === 'internal#location') {
631
+ const rawLocation = value.debuggerModel().createRawLocationByScriptId(
632
+ value.value.scriptId, value.value.lineNumber, value.value.columnNumber);
633
+ if (rawLocation && linkifier) {
634
+ return html`${linkifier.linkifyRawLocation(rawLocation, Platform.DevToolsPath.EmptyUrlString, 'value')}`;
635
+ }
636
+ return html`<span class=value title=${description}>${'<' + i18nString(UIStrings.unknown) + '>'}</span>`;
641
637
  }
642
- propertyValue = createUnknownInternalLocationElement();
643
- } else if (type === 'string' && typeof description === 'string') {
644
- propertyValue = createStringElement();
645
- } else if (type === 'object' && subtype === 'trustedtype') {
646
- propertyValue = createTrustedTypeElement();
647
- } else if (type === 'function') {
648
- propertyValue = ObjectPropertiesSection.valueElementForFunctionDescription(description);
649
- } else if (type === 'object' && subtype === 'node' && description) {
650
- propertyValue = createNodeElement();
651
- } else {
652
- const valueElement = document.createElement('span');
653
- valueElement.classList.add('object-value-' + (subtype || type));
654
- if (value.preview && showPreview) {
655
- const previewFormatter = new RemoteObjectPreviewFormatter();
656
- /* eslint-disable-next-line @devtools/no-lit-render-outside-of-view */
657
- render(previewFormatter.renderObjectPreview(value.preview), valueElement);
658
- propertyValue = valueElement;
659
- UI.Tooltip.Tooltip.install(propertyValue as HTMLElement, description || '');
660
- } else if (description.length > maxRenderableStringLength) {
661
- propertyValue = new ExpandableTextPropertyValue(valueElement, description, EXPANDABLE_MAX_LENGTH).element;
662
- } else {
663
- propertyValue = valueElement;
664
- propertyValue.textContent = description;
665
- UI.Tooltip.Tooltip.install(propertyValue as HTMLElement, description);
638
+ if (type === 'string' && typeof description === 'string') {
639
+ const text = JSON.stringify(description);
640
+ const tooLong = description.length > maxRenderableStringLength;
641
+ return html`<span class="value object-value-string" title=${ifDefined(tooLong ? undefined : description)}>${
642
+ tooLong ? new ExpandableTextPropertyValue(text, EXPANDABLE_MAX_LENGTH).element : text}</span>`;
666
643
  }
667
- if (!isSyntheticProperty) {
668
- this.appendMemoryIcon(valueElement, value, variableName);
644
+ if (type === 'object' && subtype === 'trustedtype') {
645
+ const text = `${className} '${description}'`;
646
+ const tooLong = text.length > maxRenderableStringLength;
647
+ return html`<span class="value object-value-trustedtype" title=${ifDefined(tooLong ? undefined : text)}>${
648
+ tooLong ? new ExpandableTextPropertyValue(text, EXPANDABLE_MAX_LENGTH).element :
649
+ html`${className} <span class=object-value-string title=${description}>${
650
+ JSON.stringify(description)}</span>`}</span>`;
669
651
  }
670
- }
671
-
672
- if (wasThrown) {
673
- const wrapperElement = document.createElement('span');
674
- wrapperElement.classList.add('error');
675
- wrapperElement.classList.add('value');
676
- wrapperElement.appendChild(uiI18n.getFormatLocalizedString(str_, UIStrings.exceptionS, {PH1: propertyValue}));
677
- propertyValue = wrapperElement;
678
- }
679
- propertyValue.classList.add('value');
680
- return propertyValue;
681
-
682
- function createUnknownInternalLocationElement(): HTMLElement {
683
- const valueElement = document.createElement('span');
684
- valueElement.textContent = '<' + i18nString(UIStrings.unknown) + '>';
685
- UI.Tooltip.Tooltip.install(valueElement, description || '');
686
- return valueElement;
687
- }
688
-
689
- function createStringElement(): HTMLElement {
690
- const valueElement = document.createElement('span');
691
- valueElement.classList.add('object-value-string');
692
- const text = JSON.stringify(description);
693
- let propertyValue: HTMLElement;
694
- if (description.length > maxRenderableStringLength) {
695
- propertyValue = new ExpandableTextPropertyValue(valueElement, text, EXPANDABLE_MAX_LENGTH).element;
696
- } else {
697
- UI.UIUtils.createTextChild(valueElement, text);
698
- propertyValue = valueElement;
699
- UI.Tooltip.Tooltip.install(valueElement, description);
652
+ if (type === 'function') {
653
+ return ObjectPropertiesSection.valueElementForFunctionDescription(description, undefined, undefined, 'value');
700
654
  }
701
- return propertyValue;
702
- }
703
-
704
- function createTrustedTypeElement(): HTMLElement {
705
- const valueElement = document.createElement('span');
706
- valueElement.classList.add('object-value-trustedtype');
707
- const text = `${className} "${description}"`;
708
- let propertyValue;
709
- if (text.length > maxRenderableStringLength) {
710
- propertyValue = new ExpandableTextPropertyValue(valueElement, text, EXPANDABLE_MAX_LENGTH).element;
711
- } else {
712
- const contentString = createStringElement();
713
- UI.UIUtils.createTextChild(valueElement, `${className} `);
714
- valueElement.appendChild(contentString);
715
- propertyValue = valueElement;
716
- UI.Tooltip.Tooltip.install(valueElement, text);
655
+ if (type === 'object' && subtype === 'node' && description) {
656
+ return html`<span class="value object-value-node"
657
+ @click=${(event: Event) => {
658
+ void Common.Revealer.reveal(value);
659
+ event.consume(true);
660
+ }}
661
+ @mousemove=${() => SDK.OverlayModel.OverlayModel.highlightObjectAsDOMNode(value)}
662
+ @mouseleave=${() => SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight()}
663
+ >${renderNodeTitle(description)}</span>`;
664
+ }
665
+ if (description.length > maxRenderableStringLength) {
666
+ return html`<span class="value object-value-${subtype || type}" title=${description}>${
667
+ new ExpandableTextPropertyValue(description, EXPANDABLE_MAX_LENGTH).element}</span>`;
717
668
  }
669
+ const hasPreview = value.preview && showPreview;
670
+ return html`<span class="value object-value-${subtype || type}" title=${description}>${
671
+ hasPreview ? new RemoteObjectPreviewFormatter().renderObjectPreview(value.preview) :
672
+ description}${isSyntheticProperty ? nothing : this.getMemoryIcon(value, variableName)}</span>`;
673
+ };
718
674
 
719
- return propertyValue;
675
+ if (wasThrown) {
676
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
677
+ render(
678
+ html`<span class="error value">${
679
+ uiI18n.getFormatLocalizedStringTemplate(str_, UIStrings.exceptionS, {PH1: contents()})}</span>`,
680
+ propertyValue);
681
+ } else {
682
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
683
+ render(contents(), propertyValue);
720
684
  }
721
-
722
- function createNodeElement(): HTMLElement {
723
- const valueElement = document.createElement('span');
724
- valueElement.classList.add('object-value-node');
725
- /* eslint-disable-next-line @devtools/no-lit-render-outside-of-view */
726
- render(renderNodeTitle(description), valueElement);
727
- valueElement.addEventListener('click', event => {
728
- void Common.Revealer.reveal(value);
729
- event.consume(true);
730
- }, false);
731
- valueElement.addEventListener(
732
- 'mousemove', () => SDK.OverlayModel.OverlayModel.highlightObjectAsDOMNode(value), false);
733
- valueElement.addEventListener('mouseleave', () => SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight(), false);
734
- return valueElement;
685
+ const child = propertyValue.firstElementChild;
686
+ if (!(child instanceof HTMLElement)) {
687
+ throw new Error('Expected an HTML element');
735
688
  }
689
+ return child;
736
690
  }
737
691
 
738
692
  static formatObjectAsFunction(
@@ -754,8 +708,11 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
754
708
  if (response?.functionName) {
755
709
  defaultName = response.functionName;
756
710
  }
757
- const valueElement =
758
- ObjectPropertiesSection.valueElementForFunctionDescription(func.description, includePreview, defaultName);
711
+ const valueElement = document.createDocumentFragment();
712
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
713
+ render(
714
+ ObjectPropertiesSection.valueElementForFunctionDescription(func.description, includePreview, defaultName),
715
+ valueElement);
759
716
  element.appendChild(valueElement);
760
717
  }
761
718
  }
@@ -942,7 +899,8 @@ export const TREE_ELEMENT_DEFAULT_VIEW: TreeElementView = (input, output, target
942
899
  input.onAutoComplete(e.detail.expression, e.detail.filter, e.detail.force);
943
900
  };
944
901
  // clang-format off
945
- render(html`<span class=name-and-value>${input.nameElement}<span class='separator'>: </span><devtools-prompt
902
+ render(
903
+ html`<span class=name-and-value>${input.nameElement}<span class='separator'>: </span><devtools-prompt
946
904
  @commit=${(e: UI.TextPrompt.TextPromptElement.CommitEvent) => input.editingCommitted(e.detail)}
947
905
  @cancel=${() => input.editingEnded()}
948
906
  @beforeautocomplete=${onAutoComplete}
@@ -951,7 +909,8 @@ export const TREE_ELEMENT_DEFAULT_VIEW: TreeElementView = (input, output, target
951
909
  ?editing=${input.editing}>
952
910
  ${input.expanded && input.expandedValueElement || input.valueElement}
953
911
  <datalist id=${completionsId}>${repeat(input.completions, c => html`<option>${c}</option>`)}</datalist>
954
- </devtools-prompt></span><span>`, target);
912
+ </devtools-prompt></span><span>`,
913
+ target);
955
914
  // clang-format on
956
915
  }
957
916
  };
@@ -966,7 +925,6 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
966
925
  readOnly!: boolean;
967
926
  private prompt!: ObjectPropertyPrompt|undefined;
968
927
  private editableDiv!: HTMLElement;
969
- propertyValue?: HTMLElement;
970
928
  expandedValueElement?: HTMLElement;
971
929
  #editing = false;
972
930
  readonly #view: TreeElementView;
@@ -1262,10 +1220,9 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1262
1220
  this.valueElement.classList.add('value');
1263
1221
  } else if (this.property.object) {
1264
1222
  const showPreview = this.property.name !== '[[Prototype]]';
1265
- this.propertyValue = ObjectPropertiesSection.createPropertyValueWithCustomSupport(
1223
+ this.valueElement = ObjectPropertiesSection.createPropertyValueWithCustomSupport(
1266
1224
  this.property.object, this.property.property.wasThrown, showPreview, this.linkifier,
1267
1225
  this.property.property.synthetic, this.property.path /* variableName */);
1268
- this.valueElement = this.propertyValue;
1269
1226
  } else if (this.property.property.getter) {
1270
1227
  this.valueElement = document.createElement('span');
1271
1228
  const element = this.valueElement.createChild('span');
@@ -1788,10 +1745,10 @@ export class ExpandableTextPropertyValue {
1788
1745
  private readonly maxDisplayableTextLength: number;
1789
1746
  readonly #byteCount: number;
1790
1747
  #expanded = false;
1791
- #element: HTMLElement;
1748
+ #element: DocumentFragment;
1792
1749
 
1793
- constructor(element: HTMLElement, text: string, maxLength: number) {
1794
- this.#element = element;
1750
+ constructor(text: string, maxLength: number) {
1751
+ this.#element = document.createDocumentFragment();
1795
1752
  this.text = text;
1796
1753
  this.maxLength = maxLength;
1797
1754
  this.maxDisplayableTextLength = 10000000;
@@ -1799,7 +1756,7 @@ export class ExpandableTextPropertyValue {
1799
1756
  this.#render();
1800
1757
  }
1801
1758
 
1802
- get element(): HTMLElement {
1759
+ get element(): DocumentFragment {
1803
1760
  return this.#element;
1804
1761
  }
1805
1762
 
@@ -57,10 +57,6 @@ code, kbd, samp, pre {
57
57
  ) !important; /* stylelint-disable-line declaration-no-important */
58
58
 
59
59
  white-space: pre-wrap;
60
-
61
- &:not(input)::selection {
62
- color: var(--sys-color-on-surface);
63
- }
64
60
  }
65
61
 
66
62
  .source-code.breakpoint {
package/mcp/mcp.ts CHANGED
@@ -9,6 +9,7 @@
9
9
  */
10
10
  export * as Common from '../front_end/core/common/common.js';
11
11
  export * as I18n from '../front_end/core/i18n/i18n.js';
12
+ export type * as CDPConnection from '../front_end/core/protocol_client/CDPConnection.js';
12
13
  export {ConnectionTransport} from '../front_end/core/protocol_client/ConnectionTransport.js';
13
14
  export * as Foundation from '../front_end/foundation/foundation.js';
14
15
  export {
package/package.json CHANGED
@@ -103,5 +103,5 @@
103
103
  "flat-cache": "6.1.12"
104
104
  }
105
105
  },
106
- "version": "1.0.1543472"
106
+ "version": "1.0.1544076"
107
107
  }
@@ -1,30 +0,0 @@
1
- // Copyright 2021 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Lit from '../../lit/lit.js';
6
-
7
- import {ExpandableList} from './expandable_list.js';
8
-
9
- const {html} = Lit;
10
-
11
- export function render(container: HTMLElement): void {
12
- const component = new ExpandableList.ExpandableList();
13
-
14
- const rows = [];
15
- rows.push(html`
16
- <div>This is row 1. Click on the triangle icon to expand.</div>
17
- `);
18
-
19
- for (let rowNumber = 2; rowNumber < 11; rowNumber++) {
20
- rows.push(html`
21
- <div>This is row ${rowNumber}.</div>
22
- `);
23
- }
24
-
25
- component.data = {
26
- rows,
27
- };
28
-
29
- container.appendChild(component);
30
- }