chrome-devtools-frontend 1.0.1543472 → 1.0.1545096
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/config/typescript/tsconfig.eslint.json +1 -0
- package/front_end/core/common/ParsedURL.ts +1 -1
- package/front_end/core/common/common.ts +0 -2
- package/front_end/core/host/AidaClient.ts +10 -7
- package/front_end/core/host/DispatchHttpRequestClient.ts +18 -3
- package/front_end/core/protocol_client/CDPConnection.ts +3 -3
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +2 -1
- 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/CSSMetadata.ts +17 -5
- 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/core/sdk/NetworkManager.ts +6 -8
- package/front_end/core/sdk/NetworkRequest.ts +4 -0
- package/front_end/core/sdk/SDKModel.ts +4 -2
- package/front_end/core/sdk/TargetManager.ts +14 -15
- 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/generated/Deprecation.ts +4 -0
- package/front_end/generated/InspectorBackendCommands.ts +2 -5
- package/front_end/generated/SupportedCSSProperties.js +0 -23
- package/front_end/generated/protocol-mapping.d.ts +0 -15
- package/front_end/generated/protocol-proxy-api.d.ts +0 -11
- package/front_end/generated/protocol.ts +2 -34
- 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 +3 -2
- 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/ai_assistance/components/UserActionRow.ts +2 -1
- package/front_end/panels/animation/AnimationTimeline.ts +6 -6
- package/front_end/panels/application/ApplicationPanelSidebar.ts +6 -7
- package/front_end/panels/application/{components/FrameDetailsView.ts → FrameDetailsView.ts} +134 -165
- package/front_end/panels/application/{components/OriginTrialTreeView.ts → OriginTrialTreeView.ts} +9 -9
- package/front_end/panels/application/application.ts +4 -0
- 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/StackTrace.ts +5 -3
- package/front_end/panels/application/components/TrustTokensView.ts +7 -1
- package/front_end/panels/application/components/components.ts +2 -4
- package/front_end/panels/application/{components/frameDetailsReportView.css → frameDetailsReportView.css} +5 -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/common/BadgeNotification.ts +2 -1
- package/front_end/panels/{elements → common}/DOMLinkifier.ts +13 -8
- package/front_end/panels/common/GdpSignUpDialog.ts +2 -1
- 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/ElementStatePaneWidget.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 +0 -13
- 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/LighthouseProtocolService.ts +3 -6
- 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/settings/FrameworkIgnoreListSettingsTab.ts +2 -1
- package/front_end/panels/settings/SettingsScreen.ts +3 -2
- 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 +18 -6
- package/front_end/panels/timeline/components/MetricCard.ts +2 -2
- package/front_end/panels/timeline/components/insights/NodeLink.ts +4 -4
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -1
- package/front_end/panels/timeline/timeline-meta.ts +0 -10
- package/front_end/panels/timeline/timeline.ts +0 -2
- package/front_end/panels/whats_new/ReleaseNoteView.ts +2 -1
- package/front_end/panels/whats_new/WhatsNewImpl.ts +3 -2
- package/front_end/third_party/chromium/README.chromium +1 -1
- 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/tsconfig.json +1 -0
- package/front_end/ui/components/buttons/Button.docs.ts +6 -5
- package/front_end/ui/components/snackbars/Snackbars.docs.ts +1 -1
- package/front_end/ui/components/spinners/Spinners.docs.ts +1 -1
- package/front_end/ui/components/survey_link/SurveyLink.docs.ts +2 -1
- package/front_end/ui/components/switch/Switch.docs.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +8 -5
- package/front_end/ui/components/tooltips/Tooltip.docs.ts +3 -3
- package/front_end/ui/helpers/OpenInNewTab.ts +87 -0
- package/front_end/ui/helpers/helpers.ts +5 -0
- package/front_end/ui/i18n/i18n.ts +16 -0
- package/front_end/ui/legacy/ContextMenu.docs.ts +12 -11
- package/front_end/ui/legacy/RadioButton.docs.ts +1 -1
- package/front_end/ui/legacy/SelectMenu.docs.ts +1 -1
- package/front_end/ui/legacy/Slider.docs.ts +1 -1
- package/front_end/ui/legacy/UIUtils.ts +1 -34
- package/front_end/ui/legacy/Widget.ts +56 -25
- package/front_end/ui/legacy/XLink.ts +4 -6
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +2 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +3 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +294 -336
- package/front_end/ui/legacy/components/utils/Linkifier.ts +2 -1
- package/front_end/ui/legacy/inspectorCommon.css +0 -4
- package/mcp/mcp.ts +1 -0
- package/mcp/tsconfig.json +16 -0
- package/package.json +2 -2
- package/front_end/core/common/Linkifier.ts +0 -55
- package/front_end/panels/timeline/CLSLinkifier.ts +0 -58
- package/front_end/ui/components/expandable_list/ExpandableList.docs.ts +0 -30
- /package/front_end/panels/application/{components/originTrialTokenRows.css → originTrialTokenRows.css} +0 -0
- /package/front_end/panels/application/{components/originTrialTreeView.css → originTrialTreeView.css} +0 -0
- /package/front_end/panels/{elements → common}/domLinkifier.css +0 -0
|
@@ -2,53 +2,23 @@
|
|
|
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 Common from '../../core/common/common.js';
|
|
6
5
|
import * as Host from '../../core/host/host.js';
|
|
7
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
8
|
-
import * as Root from '../../core/root/root.js';
|
|
9
7
|
import * as AiCodeCompletion from '../../models/ai_code_completion/ai_code_completion.js';
|
|
10
8
|
import type * as Workspace from '../../models/workspace/workspace.js';
|
|
11
|
-
import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
9
|
+
import type * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
12
10
|
import * as TextEditor from '../../ui/components/text_editor/text_editor.js';
|
|
13
11
|
import * as SourceFrame from '../../ui/legacy/components/source_frame/source_frame.js';
|
|
14
12
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
15
|
-
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
16
13
|
import * as PanelCommon from '../common/common.js';
|
|
17
14
|
|
|
18
15
|
import {Plugin} from './Plugin.js';
|
|
19
16
|
|
|
20
|
-
const AI_CODE_COMPLETION_CHARACTER_LIMIT = 20_000;
|
|
21
17
|
const DISCLAIMER_TOOLTIP_ID = 'sources-ai-code-completion-disclaimer-tooltip';
|
|
22
18
|
const SPINNER_TOOLTIP_ID = 'sources-ai-code-completion-spinner-tooltip';
|
|
23
19
|
const CITATIONS_TOOLTIP_ID = 'sources-ai-code-completion-citations-tooltip';
|
|
24
20
|
|
|
25
|
-
function createCallbacks(editor: TextEditor.TextEditor.TextEditor): AiCodeCompletion.AiCodeCompletion.Callbacks {
|
|
26
|
-
return {
|
|
27
|
-
getSelectionHead: () => editor.editor.state.selection.main.head,
|
|
28
|
-
getCompletionHint: () => editor.editor.plugin(TextEditor.Config.showCompletionHint)?.currentHint,
|
|
29
|
-
setAiAutoCompletion: (args: {
|
|
30
|
-
text: string,
|
|
31
|
-
from: number,
|
|
32
|
-
startTime: number,
|
|
33
|
-
onImpression: (rpcGlobalId: Host.AidaClient.RpcGlobalId, latency: number, sampleId?: number) => void,
|
|
34
|
-
clearCachedRequest: () => void,
|
|
35
|
-
rpcGlobalId?: Host.AidaClient.RpcGlobalId,
|
|
36
|
-
sampleId?: number,
|
|
37
|
-
}|null) => editor.editor.dispatch({effects: TextEditor.Config.setAiAutoCompleteSuggestion.of(args)}),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
21
|
export class AiCodeCompletionPlugin extends Plugin {
|
|
42
|
-
#aidaClient?: Host.AidaClient.AidaClient;
|
|
43
|
-
#aidaAvailability?: Host.AidaClient.AidaAccessPreconditions;
|
|
44
|
-
#boundOnAidaAvailabilityChange: () => Promise<void>;
|
|
45
|
-
#aiCodeCompletion?: AiCodeCompletion.AiCodeCompletion.AiCodeCompletion;
|
|
46
|
-
#aiCodeCompletionSetting = Common.Settings.Settings.instance().createSetting('ai-code-completion-enabled', false);
|
|
47
|
-
#aiCodeCompletionTeaserDismissedSetting =
|
|
48
|
-
Common.Settings.Settings.instance().createSetting('ai-code-completion-teaser-dismissed', false);
|
|
49
|
-
#teaserCompartment = new CodeMirror.Compartment();
|
|
50
|
-
#teaser?: PanelCommon.AiCodeCompletionTeaser;
|
|
51
|
-
#teaserDisplayTimeout?: number;
|
|
52
22
|
#editor?: TextEditor.TextEditor.TextEditor;
|
|
53
23
|
#aiCodeCompletionDisclaimer?: PanelCommon.AiCodeCompletionDisclaimer;
|
|
54
24
|
#aiCodeCompletionDisclaimerContainer = document.createElement('div');
|
|
@@ -57,25 +27,39 @@ export class AiCodeCompletionPlugin extends Plugin {
|
|
|
57
27
|
#aiCodeCompletionCitationsToolbar?: PanelCommon.AiCodeCompletionSummaryToolbar;
|
|
58
28
|
#aiCodeCompletionCitationsToolbarContainer = document.createElement('div');
|
|
59
29
|
#aiCodeCompletionCitationsToolbarAttached = false;
|
|
60
|
-
|
|
61
|
-
#
|
|
62
|
-
#boundOnAiCodeCompletionSettingChanged: () => void;
|
|
30
|
+
aiCodeCompletionConfig: TextEditor.AiCodeCompletionProvider.AiCodeCompletionConfig;
|
|
31
|
+
#aiCodeCompletionProvider: TextEditor.AiCodeCompletionProvider.AiCodeCompletionProvider;
|
|
63
32
|
|
|
64
33
|
constructor(uiSourceCode: Workspace.UISourceCode.UISourceCode) {
|
|
65
34
|
super(uiSourceCode);
|
|
66
|
-
|
|
35
|
+
const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
|
|
36
|
+
if (!AiCodeCompletion.AiCodeCompletion.AiCodeCompletion.isAiCodeCompletionEnabled(devtoolsLocale.locale)) {
|
|
67
37
|
throw new Error('AI code completion feature is not enabled.');
|
|
68
38
|
}
|
|
69
|
-
this.#boundEditorKeyDown = this.#editorKeyDown.bind(this);
|
|
70
|
-
this.#boundOnAiCodeCompletionSettingChanged = this.#onAiCodeCompletionSettingChanged.bind(this);
|
|
71
|
-
this.#boundOnAidaAvailabilityChange = this.#onAidaAvailabilityChange.bind(this);
|
|
72
|
-
Host.AidaClient.HostConfigTracker.instance().addEventListener(
|
|
73
|
-
Host.AidaClient.Events.AIDA_AVAILABILITY_CHANGED, this.#boundOnAidaAvailabilityChange);
|
|
74
|
-
const showTeaser = !this.#aiCodeCompletionSetting.get() && !this.#aiCodeCompletionTeaserDismissedSetting.get();
|
|
75
|
-
if (showTeaser) {
|
|
76
|
-
this.#teaser = new PanelCommon.AiCodeCompletionTeaser({onDetach: this.#detachAiCodeCompletionTeaser.bind(this)});
|
|
77
|
-
}
|
|
78
39
|
|
|
40
|
+
this.aiCodeCompletionConfig = {
|
|
41
|
+
completionContext: {
|
|
42
|
+
additionalFiles: this.uiSourceCode.url().startsWith('snippet://') ? [{
|
|
43
|
+
path: 'devtools-console-context.js',
|
|
44
|
+
content: AiCodeCompletion.AiCodeCompletion.consoleAdditionalContextFileContent,
|
|
45
|
+
included_reason: Host.AidaClient.Reason.RELATED_FILE,
|
|
46
|
+
}] :
|
|
47
|
+
undefined,
|
|
48
|
+
inferenceLanguage: this.#getInferenceLanguage()
|
|
49
|
+
},
|
|
50
|
+
onFeatureEnabled: () => {
|
|
51
|
+
this.#setupAiCodeCompletion();
|
|
52
|
+
},
|
|
53
|
+
onFeatureDisabled: () => {
|
|
54
|
+
this.#cleanupAiCodeCompletion();
|
|
55
|
+
},
|
|
56
|
+
onSuggestionAccepted: this.#onAiCodeCompletionSuggestionAccepted.bind(this),
|
|
57
|
+
onRequestTriggered: this.#onAiRequestTriggered.bind(this),
|
|
58
|
+
onResponseReceived: this.#onAiResponseReceived.bind(this),
|
|
59
|
+
panel: AiCodeCompletion.AiCodeCompletion.ContextFlavor.SOURCES,
|
|
60
|
+
};
|
|
61
|
+
this.#aiCodeCompletionProvider =
|
|
62
|
+
TextEditor.AiCodeCompletionProvider.AiCodeCompletionProvider.createInstance(this.aiCodeCompletionConfig);
|
|
79
63
|
this.#aiCodeCompletionDisclaimerContainer.classList.add('ai-code-completion-disclaimer-container');
|
|
80
64
|
this.#aiCodeCompletionDisclaimerContainer.style.paddingInline = 'var(--sys-size-3)';
|
|
81
65
|
}
|
|
@@ -85,158 +69,28 @@ export class AiCodeCompletionPlugin extends Plugin {
|
|
|
85
69
|
}
|
|
86
70
|
|
|
87
71
|
override dispose(): void {
|
|
88
|
-
this.#
|
|
89
|
-
this.#aiCodeCompletionSetting.removeChangeListener(this.#boundOnAiCodeCompletionSettingChanged);
|
|
90
|
-
Host.AidaClient.HostConfigTracker.instance().removeEventListener(
|
|
91
|
-
Host.AidaClient.Events.AIDA_AVAILABILITY_CHANGED, this.#boundOnAidaAvailabilityChange);
|
|
92
|
-
this.#editor?.removeEventListener('keydown', this.#boundEditorKeyDown);
|
|
93
|
-
this.#cleanupAiCodeCompletion();
|
|
72
|
+
this.#aiCodeCompletionProvider.dispose();
|
|
94
73
|
super.dispose();
|
|
95
74
|
}
|
|
96
75
|
|
|
97
76
|
override editorInitialized(editor: TextEditor.TextEditor.TextEditor): void {
|
|
98
77
|
this.#editor = editor;
|
|
99
|
-
this.#
|
|
100
|
-
this.#
|
|
101
|
-
|
|
102
|
-
|
|
78
|
+
this.#aiCodeCompletionProvider.editorInitialized(editor);
|
|
79
|
+
this.#editor.editor.dispatch({
|
|
80
|
+
effects: TextEditor.AiCodeCompletionProvider.setAiCodeCompletionTeaserMode.of(
|
|
81
|
+
TextEditor.AiCodeCompletionProvider.AiCodeCompletionTeaserMode.ON)
|
|
82
|
+
});
|
|
103
83
|
}
|
|
104
84
|
|
|
105
85
|
override editorExtension(): CodeMirror.Extension {
|
|
106
|
-
return
|
|
107
|
-
CodeMirror.EditorView.updateListener.of(update => this.#editorUpdate(update)), this.#teaserCompartment.of([]),
|
|
108
|
-
TextEditor.Config.aiAutoCompleteSuggestion, CodeMirror.Prec.highest(CodeMirror.keymap.of(this.#editorKeymap()))
|
|
109
|
-
];
|
|
86
|
+
return this.#aiCodeCompletionProvider.extension();
|
|
110
87
|
}
|
|
111
88
|
|
|
112
89
|
override rightToolbarItems(): UI.Toolbar.ToolbarItem[] {
|
|
113
90
|
return [this.#aiCodeCompletionDisclaimerToolbarItem];
|
|
114
91
|
}
|
|
115
92
|
|
|
116
|
-
#editorUpdate(update: CodeMirror.ViewUpdate): void {
|
|
117
|
-
if (this.#teaser) {
|
|
118
|
-
if (update.docChanged) {
|
|
119
|
-
update.view.dispatch({effects: this.#teaserCompartment.reconfigure([])});
|
|
120
|
-
window.clearTimeout(this.#teaserDisplayTimeout);
|
|
121
|
-
this.#addTeaserPluginToCompartment(update.view);
|
|
122
|
-
} else if (update.selectionSet && update.state.doc.length > 0) {
|
|
123
|
-
update.view.dispatch({effects: this.#teaserCompartment.reconfigure([])});
|
|
124
|
-
}
|
|
125
|
-
} else if (this.#aiCodeCompletion) {
|
|
126
|
-
if (update.docChanged && update.state.doc !== update.startState.doc) {
|
|
127
|
-
this.#triggerAiCodeCompletion();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
#triggerAiCodeCompletion(): void {
|
|
133
|
-
if (!this.#editor || !this.#aiCodeCompletion) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const {doc, selection} = this.#editor.state;
|
|
137
|
-
const query = doc.toString();
|
|
138
|
-
const cursor = selection.main.head;
|
|
139
|
-
let prefix = query.substring(0, cursor);
|
|
140
|
-
if (prefix.trim().length === 0) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
let suffix = query.substring(cursor);
|
|
144
|
-
if (prefix.length > AI_CODE_COMPLETION_CHARACTER_LIMIT) {
|
|
145
|
-
prefix = prefix.substring(prefix.length - AI_CODE_COMPLETION_CHARACTER_LIMIT);
|
|
146
|
-
}
|
|
147
|
-
if (suffix.length > AI_CODE_COMPLETION_CHARACTER_LIMIT) {
|
|
148
|
-
suffix = suffix.substring(0, AI_CODE_COMPLETION_CHARACTER_LIMIT);
|
|
149
|
-
}
|
|
150
|
-
this.#aiCodeCompletion.onTextChanged(prefix, suffix, cursor, this.#getInferenceLanguage());
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
#editorKeymap(): readonly CodeMirror.KeyBinding[] {
|
|
154
|
-
return [
|
|
155
|
-
{
|
|
156
|
-
key: 'Escape',
|
|
157
|
-
run: (): boolean => {
|
|
158
|
-
if (this.#aiCodeCompletion && this.#editor && TextEditor.Config.hasActiveAiSuggestion(this.#editor.state)) {
|
|
159
|
-
this.#editor.dispatch({
|
|
160
|
-
effects: TextEditor.Config.setAiAutoCompleteSuggestion.of(null),
|
|
161
|
-
});
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
return false;
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
key: 'Tab',
|
|
169
|
-
run: (): boolean => {
|
|
170
|
-
if (this.#aiCodeCompletion && this.#editor && TextEditor.Config.hasActiveAiSuggestion(this.#editor.state)) {
|
|
171
|
-
const {accepted, suggestion} = TextEditor.Config.acceptAiAutoCompleteSuggestion(this.#editor.editor);
|
|
172
|
-
if (accepted) {
|
|
173
|
-
if (suggestion?.rpcGlobalId) {
|
|
174
|
-
this.#aiCodeCompletion?.registerUserAcceptance(suggestion.rpcGlobalId, suggestion.sampleId);
|
|
175
|
-
}
|
|
176
|
-
this.#onAiCodeCompletionSuggestionAccepted();
|
|
177
|
-
}
|
|
178
|
-
return accepted;
|
|
179
|
-
}
|
|
180
|
-
return false;
|
|
181
|
-
},
|
|
182
|
-
}
|
|
183
|
-
];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
async #editorKeyDown(event: KeyboardEvent): Promise<void> {
|
|
187
|
-
if (!this.#teaser?.isShowing()) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const keyboardEvent = event;
|
|
191
|
-
if (UI.KeyboardShortcut.KeyboardShortcut.eventHasCtrlEquivalentKey(keyboardEvent)) {
|
|
192
|
-
if (keyboardEvent.key === 'i') {
|
|
193
|
-
keyboardEvent.consume(true);
|
|
194
|
-
void VisualLogging.logKeyDown(event.currentTarget, event, 'ai-code-completion-teaser.fre');
|
|
195
|
-
await this.#teaser?.onAction(event);
|
|
196
|
-
} else if (keyboardEvent.key === 'x') {
|
|
197
|
-
keyboardEvent.consume(true);
|
|
198
|
-
void VisualLogging.logKeyDown(event.currentTarget, event, 'ai-code-completion-teaser.dismiss');
|
|
199
|
-
this.#teaser?.onDismiss(event);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
#addTeaserPluginToCompartment = Common.Debouncer.debounce((view: CodeMirror.EditorView) => {
|
|
205
|
-
this.#teaserDisplayTimeout = window.setTimeout(() => {
|
|
206
|
-
this.#addTeaserPluginToCompartmentImmediate(view);
|
|
207
|
-
}, AiCodeCompletion.AiCodeCompletion.DELAY_BEFORE_SHOWING_RESPONSE_MS);
|
|
208
|
-
}, AiCodeCompletion.AiCodeCompletion.AIDA_REQUEST_DEBOUNCE_TIMEOUT_MS);
|
|
209
|
-
|
|
210
|
-
#addTeaserPluginToCompartmentImmediate = (view: CodeMirror.EditorView): void => {
|
|
211
|
-
if (!this.#teaser) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
view.dispatch({effects: this.#teaserCompartment.reconfigure([aiCodeCompletionTeaserExtension(this.#teaser)])});
|
|
216
|
-
};
|
|
217
|
-
|
|
218
93
|
#setupAiCodeCompletion(): void {
|
|
219
|
-
if (!this.#editor) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
if (!this.#aidaClient) {
|
|
223
|
-
this.#aidaClient = new Host.AidaClient.AidaClient();
|
|
224
|
-
}
|
|
225
|
-
if (this.#teaser) {
|
|
226
|
-
this.#detachAiCodeCompletionTeaser();
|
|
227
|
-
this.#teaser = undefined;
|
|
228
|
-
}
|
|
229
|
-
if (!this.#aiCodeCompletion) {
|
|
230
|
-
const contextFlavor = this.uiSourceCode.url().startsWith('snippet://') ?
|
|
231
|
-
AiCodeCompletion.AiCodeCompletion.ContextFlavor.CONSOLE :
|
|
232
|
-
AiCodeCompletion.AiCodeCompletion.ContextFlavor.SOURCES;
|
|
233
|
-
this.#aiCodeCompletion = new AiCodeCompletion.AiCodeCompletion.AiCodeCompletion(
|
|
234
|
-
{aidaClient: this.#aidaClient}, contextFlavor, createCallbacks(this.#editor));
|
|
235
|
-
this.#aiCodeCompletion.addEventListener(
|
|
236
|
-
AiCodeCompletion.AiCodeCompletion.Events.REQUEST_TRIGGERED, this.#onAiRequestTriggered, this);
|
|
237
|
-
this.#aiCodeCompletion.addEventListener(
|
|
238
|
-
AiCodeCompletion.AiCodeCompletion.Events.RESPONSE_RECEIVED, this.#onAiResponseReceived, this);
|
|
239
|
-
}
|
|
240
94
|
this.#createAiCodeCompletionDisclaimer();
|
|
241
95
|
this.#createAiCodeCompletionCitationsToolbar();
|
|
242
96
|
}
|
|
@@ -281,46 +135,10 @@ export class AiCodeCompletionPlugin extends Plugin {
|
|
|
281
135
|
}
|
|
282
136
|
}
|
|
283
137
|
|
|
284
|
-
#onAiCodeCompletionSettingChanged(): void {
|
|
285
|
-
if (this.#aiCodeCompletionSetting.get()) {
|
|
286
|
-
this.#setupAiCodeCompletion();
|
|
287
|
-
} else if (this.#aiCodeCompletion) {
|
|
288
|
-
this.#cleanupAiCodeCompletion();
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
async #onAidaAvailabilityChange(): Promise<void> {
|
|
293
|
-
const currentAidaAvailability = await Host.AidaClient.AidaClient.checkAccessPreconditions();
|
|
294
|
-
if (currentAidaAvailability !== this.#aidaAvailability) {
|
|
295
|
-
this.#aidaAvailability = currentAidaAvailability;
|
|
296
|
-
if (this.#aidaAvailability === Host.AidaClient.AidaAccessPreconditions.AVAILABLE) {
|
|
297
|
-
this.#onAiCodeCompletionSettingChanged();
|
|
298
|
-
if (this.#editor?.state.doc.length === 0) {
|
|
299
|
-
this.#addTeaserPluginToCompartmentImmediate(this.#editor?.editor);
|
|
300
|
-
}
|
|
301
|
-
} else if (this.#aiCodeCompletion) {
|
|
302
|
-
this.#cleanupAiCodeCompletion();
|
|
303
|
-
if (this.#teaser) {
|
|
304
|
-
this.#editor?.dispatch({
|
|
305
|
-
effects: this.#teaserCompartment.reconfigure([]),
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
138
|
#cleanupAiCodeCompletion(): void {
|
|
313
|
-
this.#
|
|
314
|
-
AiCodeCompletion.AiCodeCompletion.Events.REQUEST_TRIGGERED, this.#onAiRequestTriggered, this);
|
|
315
|
-
this.#aiCodeCompletion?.removeEventListener(
|
|
316
|
-
AiCodeCompletion.AiCodeCompletion.Events.RESPONSE_RECEIVED, this.#onAiResponseReceived, this);
|
|
317
|
-
this.#aiCodeCompletion?.remove();
|
|
318
|
-
this.#aiCodeCompletion = undefined;
|
|
319
|
-
this.#aiCodeCompletionCitations = [];
|
|
320
|
-
this.#aiCodeCompletionDisclaimer?.detach();
|
|
139
|
+
this.#aiCodeCompletionDisclaimerContainer.removeChildren();
|
|
321
140
|
this.#aiCodeCompletionDisclaimer = undefined;
|
|
322
141
|
this.#removeAiCodeCompletionCitationsToolbar();
|
|
323
|
-
this.#aiCodeCompletionCitationsToolbar = undefined;
|
|
324
142
|
}
|
|
325
143
|
|
|
326
144
|
#onAiRequestTriggered = (): void => {
|
|
@@ -329,13 +147,12 @@ export class AiCodeCompletionPlugin extends Plugin {
|
|
|
329
147
|
}
|
|
330
148
|
};
|
|
331
149
|
|
|
332
|
-
#onAiResponseReceived =
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
};
|
|
150
|
+
#onAiResponseReceived = (citations: Host.AidaClient.Citation[]): void => {
|
|
151
|
+
this.#aiCodeCompletionCitations = citations;
|
|
152
|
+
if (this.#aiCodeCompletionDisclaimer) {
|
|
153
|
+
this.#aiCodeCompletionDisclaimer.loading = false;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
339
156
|
|
|
340
157
|
#onAiCodeCompletionSuggestionAccepted(): void {
|
|
341
158
|
if (!this.#aiCodeCompletionCitationsToolbar || this.#aiCodeCompletionCitations.length === 0) {
|
|
@@ -349,28 +166,6 @@ export class AiCodeCompletionPlugin extends Plugin {
|
|
|
349
166
|
}
|
|
350
167
|
}
|
|
351
168
|
|
|
352
|
-
#detachAiCodeCompletionTeaser(): void {
|
|
353
|
-
this.#editor?.dispatch({
|
|
354
|
-
effects: this.#teaserCompartment.reconfigure([]),
|
|
355
|
-
});
|
|
356
|
-
this.#teaser = undefined;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
#isAiCodeCompletionEnabled(): boolean {
|
|
360
|
-
const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
|
|
361
|
-
const aidaAvailability = Root.Runtime.hostConfig.aidaAvailability;
|
|
362
|
-
if (!devtoolsLocale.locale.startsWith('en-')) {
|
|
363
|
-
return false;
|
|
364
|
-
}
|
|
365
|
-
if (aidaAvailability?.blockedByGeo) {
|
|
366
|
-
return false;
|
|
367
|
-
}
|
|
368
|
-
if (aidaAvailability?.blockedByAge) {
|
|
369
|
-
return false;
|
|
370
|
-
}
|
|
371
|
-
return Boolean(Root.Runtime.hostConfig.devToolsAiCodeCompletion?.enabled);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
169
|
#getInferenceLanguage(): Host.AidaClient.AidaInferenceLanguage|undefined {
|
|
375
170
|
const mimeType = this.uiSourceCode.mimeType();
|
|
376
171
|
switch (mimeType) {
|
|
@@ -435,51 +230,4 @@ export class AiCodeCompletionPlugin extends Plugin {
|
|
|
435
230
|
return undefined;
|
|
436
231
|
}
|
|
437
232
|
}
|
|
438
|
-
|
|
439
|
-
setAidaClientForTest(aidaClient: Host.AidaClient.AidaClient): void {
|
|
440
|
-
this.#aidaClient = aidaClient;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
export function aiCodeCompletionTeaserExtension(teaser: PanelCommon.AiCodeCompletionTeaser): CodeMirror.Extension {
|
|
445
|
-
const teaserPlugin = CodeMirror.ViewPlugin.fromClass(class {
|
|
446
|
-
#teaserDecoration: CodeMirror.DecorationSet;
|
|
447
|
-
|
|
448
|
-
constructor(readonly view: CodeMirror.EditorView) {
|
|
449
|
-
const cursorPosition = this.view.state.selection.main.head;
|
|
450
|
-
const line = this.view.state.doc.lineAt(cursorPosition);
|
|
451
|
-
const column = cursorPosition - line.from;
|
|
452
|
-
const isCursorAtEndOfLine = column >= line.length;
|
|
453
|
-
if (isCursorAtEndOfLine) {
|
|
454
|
-
this.#teaserDecoration = CodeMirror.Decoration.set([
|
|
455
|
-
CodeMirror.Decoration
|
|
456
|
-
.widget({
|
|
457
|
-
widget: new TextEditor.AiCodeCompletionTeaserPlaceholder.AiCodeCompletionTeaserPlaceholder(teaser),
|
|
458
|
-
side: 1
|
|
459
|
-
})
|
|
460
|
-
.range(cursorPosition),
|
|
461
|
-
]);
|
|
462
|
-
} else {
|
|
463
|
-
this.#teaserDecoration = CodeMirror.Decoration.none;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
declare update: () => void;
|
|
468
|
-
|
|
469
|
-
get decorations(): CodeMirror.DecorationSet {
|
|
470
|
-
return this.#teaserDecoration;
|
|
471
|
-
}
|
|
472
|
-
}, {
|
|
473
|
-
decorations: v => v.decorations,
|
|
474
|
-
eventHandlers: {
|
|
475
|
-
mousedown(event: MouseEvent): boolean {
|
|
476
|
-
// Required for mouse click to propagate to the "Don't show again" span in teaser.
|
|
477
|
-
if (event.target instanceof Node && teaser.contentElement.contains(event.target)) {
|
|
478
|
-
return true;
|
|
479
|
-
}
|
|
480
|
-
return false;
|
|
481
|
-
},
|
|
482
|
-
},
|
|
483
|
-
});
|
|
484
|
-
return teaserPlugin;
|
|
485
233
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
5
|
|
|
6
|
-
import * as Common from '../../core/common/common.js';
|
|
7
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
8
7
|
import type * as Platform from '../../core/platform/platform.js';
|
|
9
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
@@ -14,6 +13,7 @@ import * as IconButton from '../../ui/components/icon_button/icon_button.js';
|
|
|
14
13
|
import * as uiI18n from '../../ui/i18n/i18n.js';
|
|
15
14
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
16
15
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
16
|
+
import * as PanelsCommon from '../common/common.js';
|
|
17
17
|
|
|
18
18
|
import {getLocalizedBreakpointName} from './CategorizedBreakpointL10n.js';
|
|
19
19
|
import debuggerPausedMessageStyles from './debuggerPausedMessage.css.js';
|
|
@@ -168,11 +168,11 @@ export class DebuggerPausedMessage {
|
|
|
168
168
|
i18nString(UIStrings.pausedOnS, {PH1: breakpointType ? breakpointType() : String(null)})));
|
|
169
169
|
|
|
170
170
|
const subElement = messageWrapper.createChild('div', 'status-sub monospace');
|
|
171
|
-
const linkifiedNode =
|
|
171
|
+
const linkifiedNode = PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(data.node);
|
|
172
172
|
subElement.appendChild(linkifiedNode);
|
|
173
173
|
|
|
174
174
|
if (data.targetNode) {
|
|
175
|
-
const targetNodeLink =
|
|
175
|
+
const targetNodeLink = PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(data.targetNode);
|
|
176
176
|
let messageElement;
|
|
177
177
|
if (data.insertion) {
|
|
178
178
|
if (data.targetNode === data.node) {
|
|
@@ -252,8 +252,12 @@ export class SourcesPanel extends UI.Panel.Panel implements
|
|
|
252
252
|
const initialDebugSidebarWidth = 225;
|
|
253
253
|
this.splitWidget =
|
|
254
254
|
new UI.SplitWidget.SplitWidget(true, true, 'sources-panel-split-view-state', initialDebugSidebarWidth);
|
|
255
|
-
this.splitWidget.enableShowModeSaving();
|
|
256
255
|
this.splitWidget.show(this.element);
|
|
256
|
+
if (Root.Runtime.Runtime.isTraceApp()) {
|
|
257
|
+
this.splitWidget.hideSidebar();
|
|
258
|
+
} else {
|
|
259
|
+
this.splitWidget.enableShowModeSaving();
|
|
260
|
+
}
|
|
257
261
|
|
|
258
262
|
// Create scripts navigator
|
|
259
263
|
const initialNavigatorWidth = 225;
|
|
@@ -56,6 +56,7 @@ import imagePreviewStyles from '../../ui/legacy/components/utils/imagePreview.cs
|
|
|
56
56
|
import * as LegacyComponents from '../../ui/legacy/components/utils/utils.js';
|
|
57
57
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
58
58
|
import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
|
|
59
|
+
import * as PanelsCommon from '../common/common.js';
|
|
59
60
|
|
|
60
61
|
import {getDurationString} from './AppenderUtils.js';
|
|
61
62
|
import * as TimelineComponents from './components/components.js';
|
|
@@ -1483,7 +1484,7 @@ export class TimelineUIUtils {
|
|
|
1483
1484
|
const relatedNodes = relatedNodesMap?.values() || [];
|
|
1484
1485
|
for (const relatedNode of relatedNodes) {
|
|
1485
1486
|
if (relatedNode) {
|
|
1486
|
-
const nodeSpan =
|
|
1487
|
+
const nodeSpan = PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(relatedNode);
|
|
1487
1488
|
contentHelper.appendElementRow(relatedNodeLabel || i18nString(UIStrings.relatedNode), nodeSpan);
|
|
1488
1489
|
}
|
|
1489
1490
|
}
|
|
@@ -1845,7 +1846,7 @@ export class TimelineUIUtils {
|
|
|
1845
1846
|
null;
|
|
1846
1847
|
if (node) {
|
|
1847
1848
|
const nodeSpan = document.createElement('span');
|
|
1848
|
-
|
|
1849
|
+
nodeSpan.appendChild(PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(node));
|
|
1849
1850
|
return nodeSpan;
|
|
1850
1851
|
}
|
|
1851
1852
|
if (invalidation.args.data.nodeName) {
|
|
@@ -30,6 +30,7 @@ import * as uiI18n from '../../../ui/i18n/i18n.js';
|
|
|
30
30
|
import * as UI from '../../../ui/legacy/legacy.js';
|
|
31
31
|
import * as Lit from '../../../ui/lit/lit.js';
|
|
32
32
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
33
|
+
import * as PanelsCommon from '../../common/common.js';
|
|
33
34
|
import {getThrottlingRecommendations} from '../utils/Helpers.js';
|
|
34
35
|
|
|
35
36
|
import {CPUThrottlingSelector} from './CPUThrottlingSelector.js';
|
|
@@ -40,6 +41,7 @@ import metricValueStyles from './metricValueStyles.css.js';
|
|
|
40
41
|
import {CLS_THRESHOLDS, INP_THRESHOLDS, renderMetricValue} from './Utils.js';
|
|
41
42
|
|
|
42
43
|
const {html, nothing} = Lit;
|
|
44
|
+
const {widgetConfig} = UI.Widget;
|
|
43
45
|
|
|
44
46
|
type DeviceOption = CrUXManager.DeviceScope|'AUTO';
|
|
45
47
|
|
|
@@ -449,7 +451,8 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
|
|
|
449
451
|
|
|
450
452
|
#renderLcpCard(): Lit.LitTemplate {
|
|
451
453
|
const fieldData = this.#cruxManager.getSelectedFieldMetricData('largest_contentful_paint');
|
|
452
|
-
const nodeLink =
|
|
454
|
+
const nodeLink =
|
|
455
|
+
this.#lcpValue?.nodeRef && PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(this.#lcpValue?.nodeRef);
|
|
453
456
|
const phases = this.#lcpValue?.phases;
|
|
454
457
|
|
|
455
458
|
const fieldPhases = this.#getLcpFieldPhases();
|
|
@@ -473,7 +476,10 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
|
|
|
473
476
|
${nodeLink ? html`
|
|
474
477
|
<div class="related-info" slot="extra-info">
|
|
475
478
|
<span class="related-info-label">${i18nString(UIStrings.lcpElement)}</span>
|
|
476
|
-
<span class="related-info-link"
|
|
479
|
+
<span class="related-info-link">
|
|
480
|
+
<devtools-widget .widgetConfig=${widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {node: this.#lcpValue?.nodeRef})}>
|
|
481
|
+
</devtools-widget>
|
|
482
|
+
</span>
|
|
477
483
|
</div>
|
|
478
484
|
`
|
|
479
485
|
: nothing}
|
|
@@ -636,7 +642,7 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
|
|
|
636
642
|
</ul>
|
|
637
643
|
` : nothing}
|
|
638
644
|
<div class="environment-option">
|
|
639
|
-
<devtools-widget .widgetConfig=${
|
|
645
|
+
<devtools-widget .widgetConfig=${widgetConfig(CPUThrottlingSelector, {recommendedOption: recs.cpuOption})}></devtools-widget>
|
|
640
646
|
</div>
|
|
641
647
|
<div class="environment-option">
|
|
642
648
|
<devtools-network-throttling-selector .recommendedConditions=${recs.networkConditions}></devtools-network-throttling-selector>
|
|
@@ -956,7 +962,10 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
|
|
|
956
962
|
html`<span class="interaction-inp-chip" title=${i18nString(UIStrings.inpInteraction)}>INP</span>`
|
|
957
963
|
: nothing}
|
|
958
964
|
</span>
|
|
959
|
-
<span class="interaction-node"
|
|
965
|
+
<span class="interaction-node">
|
|
966
|
+
<devtools-widget .widgetConfig=${widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {node: interaction.nodeRef})}>
|
|
967
|
+
</devtools-widget>
|
|
968
|
+
</span>
|
|
960
969
|
${isP98Excluded ? html`<devtools-icon
|
|
961
970
|
class="interaction-info"
|
|
962
971
|
name="info"
|
|
@@ -1062,8 +1071,11 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
|
|
|
1062
1071
|
<li id=${layoutShift.uniqueLayoutShiftId} class="log-item layout-shift" tabindex="-1">
|
|
1063
1072
|
<div class="layout-shift-score">Layout shift score: ${metricValue}</div>
|
|
1064
1073
|
<div class="layout-shift-nodes">
|
|
1065
|
-
${layoutShift.affectedNodeRefs.map(
|
|
1066
|
-
<div class="layout-shift-node"
|
|
1074
|
+
${layoutShift.affectedNodeRefs.map(node => html`
|
|
1075
|
+
<div class="layout-shift-node">
|
|
1076
|
+
<devtools-widget .widgetConfig=${widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {node})}>
|
|
1077
|
+
</devtools-widget>
|
|
1078
|
+
</div>
|
|
1067
1079
|
`)}
|
|
1068
1080
|
</div>
|
|
1069
1081
|
</li>
|
|
@@ -9,7 +9,7 @@ import * as CrUXManager from '../../../models/crux-manager/crux-manager.js';
|
|
|
9
9
|
import type * as Trace from '../../../models/trace/trace.js';
|
|
10
10
|
import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
11
11
|
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
12
|
-
import * as
|
|
12
|
+
import * as UIHelpers from '../../../ui/helpers/helpers.js';
|
|
13
13
|
import * as Lit from '../../../ui/lit/lit.js';
|
|
14
14
|
|
|
15
15
|
import metricCardStyles from './metricCard.css.js';
|
|
@@ -622,7 +622,7 @@ export class MetricCard extends HTMLElement {
|
|
|
622
622
|
title=${this.#getHelpTooltip()}
|
|
623
623
|
.iconName=${'help'}
|
|
624
624
|
.variant=${Buttons.Button.Variant.ICON}
|
|
625
|
-
@click=${() =>
|
|
625
|
+
@click=${() => UIHelpers.openInNewTab(helpLink)}
|
|
626
626
|
></devtools-button>
|
|
627
627
|
</h3>
|
|
628
628
|
<div tabindex="0" class="metric-values-section"
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
// TODO: move to ui/components/node_link?
|
|
7
7
|
|
|
8
|
-
import * as Common from '../../../../core/common/common.js';
|
|
9
8
|
import type * as Platform from '../../../../core/platform/platform.js';
|
|
10
9
|
import * as SDK from '../../../../core/sdk/sdk.js';
|
|
11
10
|
import type * as Protocol from '../../../../generated/protocol.js';
|
|
@@ -13,13 +12,14 @@ import * as Buttons from '../../../../ui/components/buttons/buttons.js';
|
|
|
13
12
|
import * as ComponentHelpers from '../../../../ui/components/helpers/helpers.js';
|
|
14
13
|
import * as LegacyComponents from '../../../../ui/legacy/components/utils/utils.js';
|
|
15
14
|
import * as Lit from '../../../../ui/lit/lit.js';
|
|
15
|
+
import * as PanelsCommon from '../../../common/common.js';
|
|
16
16
|
|
|
17
17
|
const {html} = Lit;
|
|
18
18
|
|
|
19
19
|
export interface NodeLinkData {
|
|
20
20
|
backendNodeId: Protocol.DOM.BackendNodeId;
|
|
21
21
|
frame: string;
|
|
22
|
-
options?:
|
|
22
|
+
options?: PanelsCommon.DOMLinkifier.Options;
|
|
23
23
|
/**
|
|
24
24
|
* URL to display if backendNodeId cannot be resolved (ie for traces loaded from disk).
|
|
25
25
|
* Will be given to linkifyURL. Use this or one of the other fallback fields.
|
|
@@ -41,7 +41,7 @@ export class NodeLink extends HTMLElement {
|
|
|
41
41
|
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
42
42
|
#backendNodeId?: Protocol.DOM.BackendNodeId;
|
|
43
43
|
#frame?: string;
|
|
44
|
-
#options?:
|
|
44
|
+
#options?: PanelsCommon.DOMLinkifier.Options;
|
|
45
45
|
#fallbackUrl?: Platform.DevToolsPath.UrlString;
|
|
46
46
|
#fallbackHtmlSnippet?: string;
|
|
47
47
|
#fallbackText?: string;
|
|
@@ -92,7 +92,7 @@ export class NodeLink extends HTMLElement {
|
|
|
92
92
|
|
|
93
93
|
// TODO: it'd be nice if we could specify what attributes to render,
|
|
94
94
|
// ex for the Viewport insight: <meta content="..."> (instead of just <meta>)
|
|
95
|
-
const linkedNode =
|
|
95
|
+
const linkedNode = PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(node, this.#options);
|
|
96
96
|
this.#linkifiedNodeForBackendId.set(this.#backendNodeId, linkedNode);
|
|
97
97
|
return linkedNode;
|
|
98
98
|
}
|
|
@@ -15,6 +15,7 @@ import * as Root from '../../../../core/root/root.js';
|
|
|
15
15
|
import * as AiAssistanceModels from '../../../../models/ai_assistance/ai_assistance.js';
|
|
16
16
|
import * as Buttons from '../../../../ui/components/buttons/buttons.js';
|
|
17
17
|
import * as ComponentHelpers from '../../../../ui/components/helpers/helpers.js';
|
|
18
|
+
import * as UIHelpers from '../../../../ui/helpers/helpers.js';
|
|
18
19
|
import * as UI from '../../../../ui/legacy/legacy.js';
|
|
19
20
|
import * as ThemeSupport from '../../../../ui/legacy/theme_support/theme_support.js';
|
|
20
21
|
import * as Lit from '../../../../ui/lit/lit.js';
|
|
@@ -574,7 +575,7 @@ export class EntryLabelOverlay extends HTMLElement {
|
|
|
574
575
|
},
|
|
575
576
|
],
|
|
576
577
|
onLearnMoreClick: () => {
|
|
577
|
-
|
|
578
|
+
UIHelpers.openInNewTab('https://developer.chrome.com/docs/devtools/performance/annotations#auto-annotations');
|
|
578
579
|
},
|
|
579
580
|
learnMoreButtonText: UIStringsNotTranslate.learnMoreButton,
|
|
580
581
|
});
|
|
@@ -323,16 +323,6 @@ Common.Settings.registerSettingExtension({
|
|
|
323
323
|
defaultValue: false,
|
|
324
324
|
});
|
|
325
325
|
|
|
326
|
-
Common.Linkifier.registerLinkifier({
|
|
327
|
-
contextTypes() {
|
|
328
|
-
return maybeRetrieveContextTypes(Timeline => [Timeline.CLSLinkifier.CLSRect]);
|
|
329
|
-
},
|
|
330
|
-
async loadLinkifier() {
|
|
331
|
-
const Timeline = await loadTimelineModule();
|
|
332
|
-
return Timeline.CLSLinkifier.Linkifier.instance();
|
|
333
|
-
},
|
|
334
|
-
});
|
|
335
|
-
|
|
336
326
|
UI.ContextMenu.registerItem({
|
|
337
327
|
location: UI.ContextMenu.ItemLocation.TIMELINE_MENU_OPEN,
|
|
338
328
|
actionId: 'timeline.load-from-file',
|