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.
- package/AUTHORS +1 -0
- package/front_end/core/host/AidaClient.ts +10 -7
- package/front_end/core/host/DispatchHttpRequestClient.ts +18 -3
- package/front_end/core/root/Runtime.ts +8 -7
- package/front_end/core/sdk/CPUThrottlingManager.ts +0 -4
- package/front_end/core/sdk/CSSMatchedStyles.ts +7 -9
- package/front_end/core/sdk/CSSModel.ts +1 -1
- package/front_end/core/sdk/CSSRule.ts +18 -6
- package/front_end/core/sdk/ChildTargetManager.ts +2 -2
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +2 -0
- package/front_end/entrypoints/main/MainImpl.ts +0 -16
- package/front_end/foundation/Universe.ts +12 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -8
- package/front_end/models/ai_assistance/agents/PatchAgent.ts +7 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +0 -5
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +4 -8
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +1 -1
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +5 -3
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +8 -7
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +9 -8
- package/front_end/models/bindings/ResourceMapping.ts +57 -15
- package/front_end/models/live-metrics/LiveMetrics.ts +12 -20
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +6 -2
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
- package/front_end/panels/ai_assistance/components/ChatView.ts +2 -4
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +2 -1
- package/front_end/panels/animation/AnimationTimeline.ts +6 -6
- package/front_end/panels/application/components/ReportsGrid.ts +7 -2
- package/front_end/panels/application/components/SharedStorageAccessGrid.ts +5 -3
- package/front_end/panels/application/components/TrustTokensView.ts +7 -1
- package/front_end/panels/application/preloading/PreloadingView.ts +10 -4
- package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +7 -11
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +15 -3
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +12 -13
- package/front_end/panels/{elements → common}/DOMLinkifier.ts +6 -6
- package/front_end/panels/common/common.ts +1 -0
- package/front_end/panels/console/ConsoleViewMessage.ts +4 -4
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +3 -1
- package/front_end/panels/elements/StylePropertiesSection.ts +52 -15
- package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -3
- package/front_end/panels/elements/StylesSidebarPane.ts +24 -14
- package/front_end/panels/elements/elements-meta.ts +11 -2
- package/front_end/panels/elements/elements.ts +0 -3
- package/front_end/panels/explain/components/ConsoleInsight.ts +31 -20
- package/front_end/panels/issues/AffectedResourcesView.ts +2 -1
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +2 -1
- package/front_end/panels/network/NetworkLogView.ts +1 -1
- package/front_end/panels/recorder/RecorderController.ts +7 -1
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +42 -294
- package/front_end/panels/sources/DebuggerPausedMessage.ts +3 -3
- package/front_end/panels/sources/SourcesPanel.ts +5 -1
- package/front_end/panels/timeline/TimelineUIUtils.ts +3 -2
- package/front_end/panels/timeline/components/LiveMetricsView.ts +7 -4
- package/front_end/panels/timeline/components/insights/NodeLink.ts +3 -2
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.js +8 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js +22 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +34 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.js +8 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js +22 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +5 -1
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkEventManager.ts +16 -1
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +28 -0
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +8 -5
- package/front_end/ui/i18n/i18n.ts +16 -0
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/Widget.ts +56 -25
- package/front_end/ui/legacy/XLink.ts +0 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +3 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +155 -198
- package/front_end/ui/legacy/inspectorCommon.css +0 -4
- package/mcp/mcp.ts +1 -0
- package/package.json +1 -1
- package/front_end/ui/components/expandable_list/ExpandableList.docs.ts +0 -30
- /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(
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
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
|
|
602
|
-
|
|
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
|
-
|
|
623
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
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
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
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 (
|
|
668
|
-
|
|
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
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
-
|
|
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
|
-
|
|
723
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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>`,
|
|
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.
|
|
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:
|
|
1748
|
+
#element: DocumentFragment;
|
|
1792
1749
|
|
|
1793
|
-
constructor(
|
|
1794
|
-
this.#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():
|
|
1759
|
+
get element(): DocumentFragment {
|
|
1803
1760
|
return this.#element;
|
|
1804
1761
|
}
|
|
1805
1762
|
|
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
|
@@ -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
|
-
}
|
|
File without changes
|