chrome-devtools-frontend 1.0.1611390 → 1.0.1613465
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/front_end/Images/src/flowsheet.svg +1 -0
- package/front_end/core/common/Color.ts +3 -2
- package/front_end/core/host/AidaClientTypes.ts +5 -0
- package/front_end/core/host/AidaGcaTranslation.ts +1 -0
- package/front_end/core/platform/StringUtilities.ts +5 -0
- package/front_end/core/sdk/NetworkManager.ts +7 -0
- package/front_end/core/sdk/ResourceTreeModel.ts +2 -1
- package/front_end/core/sdk/Target.ts +1 -3
- package/front_end/generated/InspectorBackendCommands.ts +3 -3
- package/front_end/generated/SupportedCSSProperties.js +4 -0
- package/front_end/generated/protocol.ts +12 -10
- package/front_end/models/greendev/Prototypes.ts +7 -4
- package/front_end/models/har/HARFormat.ts +30 -0
- package/front_end/models/har/Importer.ts +12 -1
- package/front_end/models/har/Log.ts +28 -0
- package/front_end/models/web_mcp/WebMCPModel.ts +73 -18
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +64 -25
- package/front_end/panels/ai_assistance/PatchWidget.ts +7 -23
- package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +3 -3
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +7 -0
- package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +21 -11
- package/front_end/panels/ai_assistance/components/ChatView.ts +4 -0
- package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +20 -10
- package/front_end/panels/ai_assistance/components/OptInChangeDialog.ts +179 -0
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +6 -2
- package/front_end/panels/ai_assistance/components/exportForAgentsDialog.css +1 -1
- package/front_end/panels/ai_assistance/components/optInChangeDialog.css +95 -0
- package/front_end/panels/ai_assistance/components/walkthroughView.css +19 -18
- package/front_end/panels/application/CookieItemsView.ts +3 -2
- package/front_end/panels/application/WebMCPView.ts +97 -6
- package/front_end/panels/application/webMCPView.css +7 -1
- package/front_end/panels/changes/ChangesView.ts +0 -12
- package/front_end/panels/common/common.ts +0 -1
- package/front_end/panels/console/ConsolePrompt.ts +2 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +2 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +3 -1
- package/front_end/panels/elements/elements-meta.ts +14 -0
- package/front_end/panels/network/NetworkLogView.ts +58 -28
- package/front_end/panels/recorder/RecorderController.ts +4 -4
- package/front_end/panels/settings/AISettingsTab.ts +39 -3
- package/front_end/panels/settings/SettingsScreen.ts +2 -2
- package/front_end/panels/sources/BreakpointEditDialog.ts +6 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/markdown_view/CodeBlock.ts +6 -0
- package/front_end/ui/legacy/SplitWidget.ts +9 -6
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +3 -3
- package/front_end/ui/legacy/components/source_frame/FontView.ts +101 -88
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +4 -4
- package/front_end/ui/visual_logging/KnownContextValues.ts +10 -0
- package/mcp/mcp.ts +1 -1
- package/package.json +1 -1
- package/front_end/panels/common/CopyChangesToPrompt.ts +0 -233
|
@@ -120,6 +120,29 @@ const UIStrings = {
|
|
|
120
120
|
*/
|
|
121
121
|
helpUnderstandStylingNetworkPerformanceAndFile:
|
|
122
122
|
'Get help with understanding CSS styles, network requests, performance, and files',
|
|
123
|
+
/**
|
|
124
|
+
* @description Text describing the 'AI assistance' feature when V2 is enabled
|
|
125
|
+
*/
|
|
126
|
+
aiAssistanceDescriptionV2: 'Get context-aware help on the inspected page',
|
|
127
|
+
/**
|
|
128
|
+
* @description First item in the description of the AI assistance feature when V2 is enabled
|
|
129
|
+
*/
|
|
130
|
+
aiAssistanceWhenOnItem1V2:
|
|
131
|
+
'Debug styling, network, performance, source code, accessibility and storage issues with DevTools AI assistance',
|
|
132
|
+
/**
|
|
133
|
+
* @description Second item in the description of the AI assistance feature when V2 is enabled
|
|
134
|
+
*/
|
|
135
|
+
aiAssistanceWhenOnItem2V2: 'Follow the agent\'s reasoning step-by-step and quickly jump to the relevant source data',
|
|
136
|
+
/**
|
|
137
|
+
* @description Explainer for which data is being sent by the AI assistance feature when V2 is enabled
|
|
138
|
+
*/
|
|
139
|
+
aiAssistanceThingsToConsiderV2:
|
|
140
|
+
'To generate explanations, chat messages, data accessible for this site via DevTools panels and Web APIs, and items you select such as network requests, files, and performance traces are sent to Google and may be seen by human reviewers to improve this feature. This is an experimental AI feature and won’t always get it right.',
|
|
141
|
+
/**
|
|
142
|
+
* @description Explainer for which data is being sent by the AI assistance feature when V2 is enabled and logging is disabled
|
|
143
|
+
*/
|
|
144
|
+
aiAssistanceThingsToConsiderNoLoggingV2:
|
|
145
|
+
'To generate explanations, chat messages, data accessible for this site via DevTools panels and Web APIs, and items you select such as network requests, files, and performance traces are sent to Google. The content you submit and that is generated by this feature will not be used to improve Google’s AI models. This is an experimental AI feature and won’t always get it right.',
|
|
123
146
|
/**
|
|
124
147
|
* @description Text describing the 'Code suggestions' feature
|
|
125
148
|
*/
|
|
@@ -480,6 +503,7 @@ export class AISettingsTab extends UI.Widget.VBox {
|
|
|
480
503
|
}
|
|
481
504
|
|
|
482
505
|
if (this.#aiAssistanceSetting) {
|
|
506
|
+
const isV2 = Root.Runtime.hostConfig.devToolsAiAssistanceV2?.enabled;
|
|
483
507
|
const aiAssistanceData: AiSettingParams = {
|
|
484
508
|
settingName: i18n.i18n.lockedString(
|
|
485
509
|
AiAssistanceModel.AiUtils.isGeminiBranding() ? 'Gemini in Chrome DevTools' : 'AI assistance'),
|
|
@@ -488,12 +512,18 @@ export class AISettingsTab extends UI.Widget.VBox {
|
|
|
488
512
|
enableSettingText: i18nString(UIStrings.enableAiAssistance),
|
|
489
513
|
settingItems: [
|
|
490
514
|
{iconName: 'info', text: this.#getAiAssistanceSettingInfo()},
|
|
491
|
-
{
|
|
515
|
+
{
|
|
516
|
+
iconName: 'pen-spark',
|
|
517
|
+
text: isV2 ? i18nString(UIStrings.aiAssistanceWhenOnItem2V2) :
|
|
518
|
+
i18nString(UIStrings.receiveStylingSuggestions),
|
|
519
|
+
},
|
|
492
520
|
],
|
|
493
521
|
toConsiderSettingItems: [{
|
|
494
522
|
iconName: 'google',
|
|
495
|
-
text: noLogging ? i18nString(UIStrings.
|
|
496
|
-
|
|
523
|
+
text: isV2 ? (noLogging ? i18nString(UIStrings.aiAssistanceThingsToConsiderNoLoggingV2) :
|
|
524
|
+
i18nString(UIStrings.aiAssistanceThingsToConsiderV2)) :
|
|
525
|
+
(noLogging ? i18nString(UIStrings.freestylerSendsDataNoLogging) :
|
|
526
|
+
i18nString(UIStrings.freestylerSendsData)),
|
|
497
527
|
}],
|
|
498
528
|
learnMoreLink: {
|
|
499
529
|
url: 'https://developer.chrome.com/docs/devtools/ai-assistance',
|
|
@@ -581,6 +611,9 @@ export class AISettingsTab extends UI.Widget.VBox {
|
|
|
581
611
|
|
|
582
612
|
#getAiAssistanceSettingDescription(): Platform.UIString.LocalizedString {
|
|
583
613
|
const {hostConfig} = Root.Runtime;
|
|
614
|
+
if (hostConfig.devToolsAiAssistanceV2?.enabled) {
|
|
615
|
+
return i18nString(UIStrings.aiAssistanceDescriptionV2);
|
|
616
|
+
}
|
|
584
617
|
if (hostConfig.devToolsAiAssistancePerformanceAgent?.enabled) {
|
|
585
618
|
return i18nString(UIStrings.helpUnderstandStylingNetworkPerformanceAndFile);
|
|
586
619
|
}
|
|
@@ -595,6 +628,9 @@ export class AISettingsTab extends UI.Widget.VBox {
|
|
|
595
628
|
|
|
596
629
|
#getAiAssistanceSettingInfo(): Platform.UIString.LocalizedString {
|
|
597
630
|
const {hostConfig} = Root.Runtime;
|
|
631
|
+
if (hostConfig.devToolsAiAssistanceV2?.enabled) {
|
|
632
|
+
return i18nString(UIStrings.aiAssistanceWhenOnItem1V2);
|
|
633
|
+
}
|
|
598
634
|
if (hostConfig.devToolsAiAssistancePerformanceAgent?.enabled) {
|
|
599
635
|
return i18nString(UIStrings.explainStylingNetworkPerformanceAndFile);
|
|
600
636
|
}
|
|
@@ -636,7 +636,7 @@ const GREENDEV_VIEW: View = (input, _output, target) => {
|
|
|
636
636
|
<span>${i18nString(UIStrings.greenDevUnstable)}</span>
|
|
637
637
|
</div>
|
|
638
638
|
<div class="settings-experiments-block">
|
|
639
|
-
${renderPrototypeCheckboxes(input.settings, ['aiAnnotations', '
|
|
639
|
+
${renderPrototypeCheckboxes(input.settings, ['aiAnnotations', 'beyondStyling', 'breakpointDebuggerAgent', 'emulationCapabilities'])}
|
|
640
640
|
</div>
|
|
641
641
|
</devtools-card>
|
|
642
642
|
</div>
|
|
@@ -646,7 +646,7 @@ const GREENDEV_VIEW: View = (input, _output, target) => {
|
|
|
646
646
|
|
|
647
647
|
const GREENDEV_PROTOTYPE_NAMES: Record<keyof GreenDev.GreenDevSettings, string> = {
|
|
648
648
|
aiAnnotations: 'AI auto-annotations',
|
|
649
|
-
|
|
649
|
+
beyondStyling: 'Beyond Styling',
|
|
650
650
|
breakpointDebuggerAgent: 'Breakpoint Debugger Agent',
|
|
651
651
|
emulationCapabilities: 'Emulation Capabilities',
|
|
652
652
|
};
|
|
@@ -208,6 +208,12 @@ export class BreakpointEditDialog extends UI.Widget.Widget {
|
|
|
208
208
|
this.requestUpdate();
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
override focus(): void {
|
|
212
|
+
void this.updateComplete.then(() => {
|
|
213
|
+
this.#editor?.focus();
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
211
217
|
override performUpdate(): void {
|
|
212
218
|
const input: ViewInput = {
|
|
213
219
|
state: this.#getEditorState(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Name: Dependencies sourced from the upstream `chromium` repository
|
|
2
2
|
URL: Internal
|
|
3
3
|
Version: N/A
|
|
4
|
-
Revision:
|
|
4
|
+
Revision: a287ca9049cc3727d680078c1d9275b32f721c2d
|
|
5
5
|
Update Mechanism: Manual (https://crbug.com/428069060)
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
License File: LICENSE
|
|
@@ -26,6 +26,11 @@ const UIStrings = {
|
|
|
26
26
|
* @description The title of the button to copy the codeblock from a Markdown view.
|
|
27
27
|
*/
|
|
28
28
|
copy: 'Copy code',
|
|
29
|
+
/**
|
|
30
|
+
* @description Accessible label for the button to copy the code block, referencing the specific content.
|
|
31
|
+
* @example {Data used} PH1
|
|
32
|
+
*/
|
|
33
|
+
copyCodeSnippet: 'Copy {PH1} code snippet',
|
|
29
34
|
/**
|
|
30
35
|
* @description The title of the button after it was pressed and the text was copied to clipboard.
|
|
31
36
|
*/
|
|
@@ -242,6 +247,7 @@ export class CodeBlock extends HTMLElement {
|
|
|
242
247
|
title: i18nString(UIStrings.copy),
|
|
243
248
|
} as Buttons.Button.ButtonData
|
|
244
249
|
}
|
|
250
|
+
.accessibleLabel=${this.#header ? i18nString(UIStrings.copyCodeSnippet, { PH1: this.#header }) : i18nString(UIStrings.copy)}
|
|
245
251
|
@click=${this.#onCopy}
|
|
246
252
|
></devtools-button>
|
|
247
253
|
${this.#copied ? html`<span>${i18nString(UIStrings.copied)}</span>` : Lit.nothing}
|
|
@@ -422,9 +422,9 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
|
|
|
422
422
|
*/
|
|
423
423
|
#totalSizeDIP(): number {
|
|
424
424
|
if (!this.#totalSizeCSS) {
|
|
425
|
-
|
|
426
|
-
this.#
|
|
427
|
-
|
|
425
|
+
const {width, height} = this.contentElement.getBoundingClientRect();
|
|
426
|
+
this.#totalSizeCSS = this.#isVertical ? width : height;
|
|
427
|
+
this.#totalSizeOtherDimensionCSS = this.#isVertical ? height : width;
|
|
428
428
|
}
|
|
429
429
|
return ZoomManager.instance().cssToDIP(this.#totalSizeCSS);
|
|
430
430
|
}
|
|
@@ -457,9 +457,12 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
|
|
|
457
457
|
this.#removeAllLayoutProperties();
|
|
458
458
|
|
|
459
459
|
// this.#totalSizeDIP is available below since we successfully applied constraints.
|
|
460
|
-
const
|
|
461
|
-
const sidebarSizeValue =
|
|
462
|
-
const mainSizeValue = (this.#totalSizeCSS -
|
|
460
|
+
const sizeCSS = ZoomManager.instance().dipToCSS(sizeDIP);
|
|
461
|
+
const sidebarSizeValue = sizeCSS + 'px';
|
|
462
|
+
const mainSizeValue = (this.#totalSizeCSS - sizeCSS) + 'px';
|
|
463
|
+
// With `box-sizing: border-box` on the sidebar (set in splitWidget.css),
|
|
464
|
+
// flex-basis, width, and height all include the border, so the sidebar's
|
|
465
|
+
// border does not steal space from the main pane.
|
|
463
466
|
this.#sidebarElement.style.flexBasis = sidebarSizeValue;
|
|
464
467
|
|
|
465
468
|
// Make both sides relayout boundaries.
|
|
@@ -105,7 +105,7 @@ export function renderSettingSelect(setting: Common.Settings.Setting<unknown>, s
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
export const renderControlForSetting = function(
|
|
108
|
-
setting: Common.Settings.Setting<unknown>, subtitle?: string): TemplateResult|
|
|
108
|
+
setting: Common.Settings.Setting<unknown>, subtitle?: string): TemplateResult|typeof nothing {
|
|
109
109
|
switch (setting.type()) {
|
|
110
110
|
case Common.Settings.SettingType.BOOLEAN: {
|
|
111
111
|
const onchange = (): void => {
|
|
@@ -123,14 +123,14 @@ export const renderControlForSetting = function(
|
|
|
123
123
|
}
|
|
124
124
|
default:
|
|
125
125
|
console.error('Invalid setting type: ' + setting.type());
|
|
126
|
-
return
|
|
126
|
+
return nothing;
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
export const createControlForSetting = function(
|
|
131
131
|
setting: Common.Settings.Setting<unknown>, subtitle?: string): HTMLElement|null {
|
|
132
132
|
const template = renderControlForSetting(setting, subtitle);
|
|
133
|
-
if (template ===
|
|
133
|
+
if (template === nothing) {
|
|
134
134
|
return null;
|
|
135
135
|
}
|
|
136
136
|
const fragment = document.createDocumentFragment();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
4
|
|
|
6
5
|
/*
|
|
7
6
|
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
|
|
@@ -34,6 +33,7 @@
|
|
|
34
33
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
35
34
|
import * as Platform from '../../../../core/platform/platform.js';
|
|
36
35
|
import * as TextUtils from '../../../../models/text_utils/text_utils.js';
|
|
36
|
+
import {Directives, html, render} from '../../../lit/lit.js';
|
|
37
37
|
import * as VisualLogging from '../../../visual_logging/visual_logging.js';
|
|
38
38
|
import * as UI from '../../legacy.js';
|
|
39
39
|
|
|
@@ -52,24 +52,70 @@ const UIStrings = {
|
|
|
52
52
|
} as const;
|
|
53
53
|
const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/source_frame/FontView.ts', UIStrings);
|
|
54
54
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
55
|
+
|
|
56
|
+
const FONT_PREVIEW_LINES = ['ABCDEFGHIJKLM', 'NOPQRSTUVWXYZ', 'abcdefghijklm', 'nopqrstuvwxyz', '1234567890'];
|
|
57
|
+
const MEASURE_FONT_SIZE = 50;
|
|
58
|
+
|
|
59
|
+
export interface ViewInput {
|
|
60
|
+
url: Platform.DevToolsPath.UrlString;
|
|
61
|
+
fontFaceRule: string;
|
|
62
|
+
fontFamily: string;
|
|
63
|
+
previewFontSize: string;
|
|
64
|
+
previewVisible: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ViewOutput {
|
|
68
|
+
measureDimensions?: () => {
|
|
69
|
+
width: number, height: number,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
|
|
74
|
+
|
|
75
|
+
// clang-format off
|
|
76
|
+
export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
77
|
+
let dummyEl: HTMLElement|undefined;
|
|
78
|
+
render(html`
|
|
79
|
+
<style>${fontViewStyles}</style>
|
|
80
|
+
<style>${input.fontFaceRule}</style>
|
|
81
|
+
<div class="font-view"
|
|
82
|
+
aria-label=${i18nString(UIStrings.previewOfFontFromS, {PH1: input.url})}
|
|
83
|
+
style="font-family: ${input.fontFamily}; font-size: ${input.previewFontSize}"
|
|
84
|
+
aria-hidden="true"
|
|
85
|
+
?hidden=${!input.previewVisible}
|
|
86
|
+
>${FONT_PREVIEW_LINES.map((line, i) => html`${i > 0 ? html`<br>` : ''}${line}`)}</div>
|
|
87
|
+
<div ${Directives.ref(el => { dummyEl = el as HTMLElement; })}
|
|
88
|
+
style="visibility: hidden; z-index: -1; display: inline; position: absolute; font-family: ${input.fontFamily}; font-size: ${MEASURE_FONT_SIZE}px"
|
|
89
|
+
>${FONT_PREVIEW_LINES.map((line, i) => html`${i > 0 ? html`<br>` : ''}${line}`)}</div>
|
|
90
|
+
`, target);
|
|
91
|
+
output.measureDimensions = () => {
|
|
92
|
+
if (!dummyEl) {
|
|
93
|
+
return {width: 0, height: 0};
|
|
94
|
+
}
|
|
95
|
+
return {width: dummyEl.offsetWidth, height: dummyEl.offsetHeight};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
// clang-format on
|
|
99
|
+
|
|
55
100
|
export class FontView extends UI.View.SimpleView {
|
|
56
101
|
private readonly url: Platform.DevToolsPath.UrlString;
|
|
57
102
|
private readonly contentProvider: TextUtils.ContentProvider.ContentProvider;
|
|
58
103
|
private readonly mimeTypeLabel: UI.Toolbar.ToolbarText;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
104
|
+
readonly #view: View;
|
|
105
|
+
#fontFaceRule = '';
|
|
106
|
+
#fontFamily = '';
|
|
107
|
+
#previewFontSize = '';
|
|
108
|
+
#previewVisible = false;
|
|
109
|
+
#contentLoaded = false;
|
|
110
|
+
|
|
111
|
+
constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider, view: View = DEFAULT_VIEW) {
|
|
64
112
|
super({
|
|
65
113
|
title: i18nString(UIStrings.font),
|
|
66
114
|
viewId: 'font',
|
|
67
115
|
jslog: `${VisualLogging.pane('font-view')}`,
|
|
68
116
|
});
|
|
69
|
-
this
|
|
70
|
-
this.element.classList.add('font-view');
|
|
117
|
+
this.#view = view;
|
|
71
118
|
this.url = contentProvider.contentURL();
|
|
72
|
-
UI.ARIAUtils.setLabel(this.element, i18nString(UIStrings.previewOfFontFromS, {PH1: this.url}));
|
|
73
119
|
this.contentProvider = contentProvider;
|
|
74
120
|
this.mimeTypeLabel = new UI.Toolbar.ToolbarText(mimeType);
|
|
75
121
|
}
|
|
@@ -78,96 +124,39 @@ export class FontView extends UI.View.SimpleView {
|
|
|
78
124
|
return [this.mimeTypeLabel];
|
|
79
125
|
}
|
|
80
126
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (!this.fontStyleElement) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
this.fontStyleElement.textContent =
|
|
87
|
-
Platform.StringUtilities.sprintf('@font-face { font-family: "%s"; src: url(%s); }', uniqueFontName, url);
|
|
88
|
-
this.updateFontPreviewSize();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private createContentIfNeeded(): void {
|
|
92
|
-
if (this.fontPreviewElement) {
|
|
127
|
+
#loadContentIfNeeded(): void {
|
|
128
|
+
if (this.#contentLoaded) {
|
|
93
129
|
return;
|
|
94
130
|
}
|
|
131
|
+
this.#contentLoaded = true;
|
|
95
132
|
|
|
96
|
-
|
|
97
|
-
this.fontStyleElement = document.createElement('style');
|
|
133
|
+
this.#fontFamily = `WebInspectorFontPreview${++fontId}`;
|
|
98
134
|
void this.contentProvider.requestContentData().then(contentData => {
|
|
99
|
-
|
|
135
|
+
const url = TextUtils.ContentData.ContentData.isError(contentData) ? this.url : contentData.asDataUrl();
|
|
136
|
+
this.#fontFaceRule =
|
|
137
|
+
Platform.StringUtilities.sprintf('@font-face { font-family: "%s"; src: url(%s); }', this.#fontFamily, url);
|
|
138
|
+
this.#previewVisible = true;
|
|
139
|
+
this.requestUpdate();
|
|
100
140
|
});
|
|
101
|
-
this.element.appendChild(this.fontStyleElement);
|
|
102
|
-
|
|
103
|
-
const fontPreview = document.createElement('div');
|
|
104
|
-
for (let i = 0; i < FONT_PREVIEW_LINES.length; ++i) {
|
|
105
|
-
if (i > 0) {
|
|
106
|
-
fontPreview.createChild('br');
|
|
107
|
-
}
|
|
108
|
-
UI.UIUtils.createTextChild(fontPreview, FONT_PREVIEW_LINES[i]);
|
|
109
|
-
}
|
|
110
|
-
this.fontPreviewElement = (fontPreview.cloneNode(true) as HTMLDivElement);
|
|
111
|
-
if (!this.fontPreviewElement) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
UI.ARIAUtils.setHidden(this.fontPreviewElement, true);
|
|
115
|
-
this.fontPreviewElement.style.overflow = 'hidden';
|
|
116
|
-
this.fontPreviewElement.style.setProperty('font-family', uniqueFontName);
|
|
117
|
-
this.fontPreviewElement.style.setProperty('visibility', 'hidden');
|
|
118
|
-
|
|
119
|
-
this.dummyElement = fontPreview;
|
|
120
|
-
this.dummyElement.style.visibility = 'hidden';
|
|
121
|
-
this.dummyElement.style.zIndex = '-1';
|
|
122
|
-
this.dummyElement.style.display = 'inline';
|
|
123
|
-
this.dummyElement.style.position = 'absolute';
|
|
124
|
-
this.dummyElement.style.setProperty('font-family', uniqueFontName);
|
|
125
|
-
this.dummyElement.style.setProperty('font-size', MEASUURE_FONT_SIZE + 'px');
|
|
126
|
-
|
|
127
|
-
this.element.appendChild(this.fontPreviewElement);
|
|
128
141
|
}
|
|
129
142
|
|
|
130
143
|
override wasShown(): void {
|
|
131
144
|
super.wasShown();
|
|
132
|
-
this
|
|
133
|
-
|
|
134
|
-
this.updateFontPreviewSize();
|
|
145
|
+
this.#loadContentIfNeeded();
|
|
146
|
+
this.requestUpdate();
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
override onResize(): void {
|
|
138
|
-
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
this.inResize = true;
|
|
143
|
-
try {
|
|
144
|
-
this.updateFontPreviewSize();
|
|
145
|
-
} finally {
|
|
146
|
-
this.inResize = null;
|
|
147
|
-
}
|
|
150
|
+
this.requestUpdate();
|
|
148
151
|
}
|
|
149
152
|
|
|
150
|
-
|
|
153
|
+
#calculateFontPreviewSize(dimension: {
|
|
151
154
|
width: number,
|
|
152
155
|
height: number,
|
|
153
|
-
} {
|
|
154
|
-
if (!this.
|
|
155
|
-
|
|
156
|
+
}): string {
|
|
157
|
+
if (!this.#previewVisible || !this.isShowing()) {
|
|
158
|
+
return '';
|
|
156
159
|
}
|
|
157
|
-
this.element.appendChild(this.dummyElement);
|
|
158
|
-
const result = {width: this.dummyElement.offsetWidth, height: this.dummyElement.offsetHeight};
|
|
159
|
-
this.element.removeChild(this.dummyElement);
|
|
160
|
-
|
|
161
|
-
return result;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
updateFontPreviewSize(): void {
|
|
165
|
-
if (!this.fontPreviewElement || !this.isShowing()) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
this.fontPreviewElement.style.removeProperty('visibility');
|
|
170
|
-
const dimension = this.measureElement();
|
|
171
160
|
|
|
172
161
|
const height = dimension.height;
|
|
173
162
|
const width = dimension.width;
|
|
@@ -177,18 +166,42 @@ export class FontView extends UI.View.SimpleView {
|
|
|
177
166
|
const containerHeight = this.element.offsetHeight - 30;
|
|
178
167
|
|
|
179
168
|
if (!height || !width || !containerWidth || !containerHeight) {
|
|
180
|
-
|
|
181
|
-
return;
|
|
169
|
+
return '';
|
|
182
170
|
}
|
|
183
171
|
|
|
184
172
|
const widthRatio = containerWidth / width;
|
|
185
173
|
const heightRatio = containerHeight / height;
|
|
186
|
-
const finalFontSize = Math.floor(
|
|
174
|
+
const finalFontSize = Math.floor(MEASURE_FONT_SIZE * Math.min(widthRatio, heightRatio)) - 2;
|
|
187
175
|
|
|
188
|
-
|
|
176
|
+
return `${finalFontSize}px`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
override performUpdate(): void {
|
|
180
|
+
const output: ViewOutput = {};
|
|
181
|
+
this.#view(
|
|
182
|
+
{
|
|
183
|
+
url: this.url,
|
|
184
|
+
fontFaceRule: this.#fontFaceRule,
|
|
185
|
+
fontFamily: this.#fontFamily,
|
|
186
|
+
previewFontSize: this.#previewFontSize,
|
|
187
|
+
previewVisible: this.#previewVisible,
|
|
188
|
+
},
|
|
189
|
+
output,
|
|
190
|
+
this.contentElement,
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
if (!output.measureDimensions) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const requestedFontSize = this.#calculateFontPreviewSize(output.measureDimensions());
|
|
198
|
+
if (requestedFontSize === this.#previewFontSize) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
this.#previewFontSize = requestedFontSize;
|
|
203
|
+
this.requestUpdate();
|
|
189
204
|
}
|
|
190
205
|
}
|
|
191
206
|
|
|
192
207
|
let fontId = 0;
|
|
193
|
-
const FONT_PREVIEW_LINES = ['ABCDEFGHIJKLM', 'NOPQRSTUVWXYZ', 'abcdefghijklm', 'nopqrstuvwxyz', '1234567890'];
|
|
194
|
-
const MEASUURE_FONT_SIZE = 50;
|
|
@@ -65,20 +65,20 @@ const UIStrings = {
|
|
|
65
65
|
*/
|
|
66
66
|
doYouTrustThisCode: 'Do you trust this code?',
|
|
67
67
|
/**
|
|
68
|
-
* @description Warning shown to users when pasting text/code into DevTools.
|
|
68
|
+
* @description Warning shown to users when pasting text/code into DevTools. IMPORTANT: keep double quotes around PH1 and do not use single quotes.
|
|
69
69
|
* @example {allow pasting} PH1
|
|
70
70
|
*/
|
|
71
71
|
doNotPaste:
|
|
72
|
-
'Don\'t paste code you do not understand or have not reviewed yourself into DevTools. This could allow attackers to steal your identity or take control of your computer. Please type
|
|
72
|
+
'Don\'t paste code you do not understand or have not reviewed yourself into DevTools. This could allow attackers to steal your identity or take control of your computer. Please type “{PH1}” below to allow pasting.',
|
|
73
73
|
/**
|
|
74
74
|
* @description Text a user needs to type in order to confirm that they are aware of the danger of pasting code into the DevTools console.
|
|
75
75
|
*/
|
|
76
76
|
allowPasting: 'allow pasting',
|
|
77
77
|
/**
|
|
78
|
-
* @description Input box placeholder which instructs the user to type 'allow pasting' into the input box.
|
|
78
|
+
* @description Input box placeholder which instructs the user to type 'allow pasting' into the input box. IMPORTANT: keep double quotes around PH1 and do not use single quotes.
|
|
79
79
|
* @example {allow pasting} PH1
|
|
80
80
|
*/
|
|
81
|
-
typeAllowPasting: 'Type
|
|
81
|
+
typeAllowPasting: 'Type “{PH1}”',
|
|
82
82
|
/**
|
|
83
83
|
* @description Error message shown when the user tries to open a file that contains non-readable data. "Editor" refers to
|
|
84
84
|
* a text editor.
|
|
@@ -345,6 +345,9 @@ export const knownContextValues = new Set([
|
|
|
345
345
|
'ai-assistance-history-images',
|
|
346
346
|
'ai-assistance-patching-fre-completed',
|
|
347
347
|
'ai-assistance-patching-selected-project-id',
|
|
348
|
+
'ai-assistance-v2-opt-in-change-dialog-seen',
|
|
349
|
+
'ai-assistance-v2-opt-in.got-it',
|
|
350
|
+
'ai-assistance-v2-opt-in.manage-settings',
|
|
348
351
|
'ai-code-completion-citations',
|
|
349
352
|
'ai-code-completion-citations.citation-link',
|
|
350
353
|
'ai-code-completion-disclaimer',
|
|
@@ -366,6 +369,7 @@ export const knownContextValues = new Set([
|
|
|
366
369
|
'ai-export-for-agents.save-as-markdown',
|
|
367
370
|
'ai-hide-walkthrough-sidebar',
|
|
368
371
|
'ai-show-walkthrough-sidebar',
|
|
372
|
+
'ai-v2-opt-in-change-dialog',
|
|
369
373
|
'ai_assistance',
|
|
370
374
|
'align-content',
|
|
371
375
|
'align-content-center',
|
|
@@ -1104,6 +1108,7 @@ export const knownContextValues = new Set([
|
|
|
1104
1108
|
'css',
|
|
1105
1109
|
'css-angle',
|
|
1106
1110
|
'css-animation-name',
|
|
1111
|
+
'css-animations-only-when-animations-tab-open',
|
|
1107
1112
|
'css-font-palette',
|
|
1108
1113
|
'css-function',
|
|
1109
1114
|
'css-layers',
|
|
@@ -1809,6 +1814,7 @@ export const knownContextValues = new Set([
|
|
|
1809
1814
|
'greendev',
|
|
1810
1815
|
'greendev-ai-annotations-enabled',
|
|
1811
1816
|
'greendev-artifact-viewer-enabled',
|
|
1817
|
+
'greendev-beyond-styling-enabled',
|
|
1812
1818
|
'greendev-breakpoint-debugger-agent-enabled',
|
|
1813
1819
|
'greendev-copy-to-gemini-enabled',
|
|
1814
1820
|
'greendev-emulation-capabilities-enabled',
|
|
@@ -4334,11 +4340,15 @@ export const knownContextValues = new Set([
|
|
|
4334
4340
|
'webauthn.remove-credential',
|
|
4335
4341
|
'webgl-error-fired',
|
|
4336
4342
|
'webgl-warning-fired',
|
|
4343
|
+
'webmcp.call-inputs',
|
|
4344
|
+
'webmcp.call-outputs',
|
|
4337
4345
|
'webmcp.declarative',
|
|
4338
4346
|
'webmcp.error',
|
|
4339
4347
|
'webmcp.imperative',
|
|
4340
4348
|
'webmcp.pending',
|
|
4349
|
+
'webmcp.status-types',
|
|
4341
4350
|
'webmcp.success',
|
|
4351
|
+
'webmcp.tool-details',
|
|
4342
4352
|
'webp-format-disabled',
|
|
4343
4353
|
'webp-format-disabled-true',
|
|
4344
4354
|
'websocket',
|
package/mcp/mcp.ts
CHANGED
|
@@ -28,7 +28,7 @@ export {Target} from '../front_end/core/sdk/Target.js';
|
|
|
28
28
|
export {TargetManager} from '../front_end/core/sdk/TargetManager.js';
|
|
29
29
|
export * as Foundation from '../front_end/foundation/foundation.js';
|
|
30
30
|
export * as Protocol from '../front_end/generated/protocol.js';
|
|
31
|
-
export
|
|
31
|
+
export * as NetworkRequestFormatter from '../front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.js';
|
|
32
32
|
export {
|
|
33
33
|
PerformanceInsightFormatter
|
|
34
34
|
} from '../front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js';
|
package/package.json
CHANGED