chrome-devtools-frontend 1.0.1541552 → 1.0.1543082
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/docs/get_the_code.md +9 -0
- package/front_end/Tests.js +1 -0
- package/front_end/core/common/Settings.ts +38 -15
- package/front_end/core/host/InspectorFrontendHost.ts +0 -3
- package/front_end/core/host/UserMetrics.ts +5 -0
- package/front_end/core/root/Runtime.ts +0 -10
- package/front_end/core/sdk/IOModel.ts +1 -4
- package/front_end/core/sdk/NetworkManager.ts +0 -7
- package/front_end/core/sdk/NetworkRequest.ts +0 -10
- package/front_end/core/sdk/ServerSentEventsProtocol.ts +4 -0
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +5 -5
- package/front_end/entrypoints/main/MainImpl.ts +6 -3
- package/front_end/entrypoints/main/main-meta.ts +1 -5
- package/front_end/foundation/Universe.ts +2 -10
- package/front_end/generated/Deprecation.ts +0 -14
- package/front_end/generated/InspectorBackendCommands.ts +1 -1
- package/front_end/generated/SupportedCSSProperties.js +42 -42
- package/front_end/generated/protocol.ts +0 -1
- package/front_end/models/ai_assistance/BuiltInAi.ts +13 -7
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +72 -31
- package/front_end/models/bindings/CompilerScriptMapping.ts +3 -2
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +3 -1
- package/front_end/models/har/Importer.ts +14 -0
- package/front_end/models/issues_manager/IssuesManager.ts +0 -5
- package/front_end/models/javascript_metadata/NativeFunctions.js +0 -4
- package/front_end/models/trace/handlers/ScriptsHandler.ts +26 -0
- package/front_end/models/trace/types/TraceEvents.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +117 -103
- package/front_end/panels/ai_assistance/components/ChatView.ts +7 -31
- package/front_end/panels/ai_assistance/components/chatView.css +1 -1
- package/front_end/panels/application/components/BackForwardCacheView.ts +12 -9
- package/front_end/panels/console/ConsoleInsightTeaser.ts +5 -0
- package/front_end/panels/console/ConsolePrompt.ts +9 -2
- package/front_end/panels/console/ConsoleView.ts +3 -0
- package/front_end/panels/network/NetworkDataGridNode.ts +0 -7
- package/front_end/panels/network/NetworkLogView.ts +1 -45
- package/front_end/panels/security/SecurityPanel.ts +0 -2
- package/front_end/panels/security/SecurityPanelSidebar.ts +0 -16
- package/front_end/panels/security/security.ts +0 -2
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +17 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/expandable_list/ExpandableList.docs.ts +30 -0
- package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +0 -4
- package/front_end/ui/components/markdown_view/MarkdownView.docs.ts +95 -0
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +246 -13
- package/front_end/ui/components/text_editor/config.ts +1 -1
- package/front_end/ui/legacy/Widget.ts +13 -4
- package/front_end/ui/legacy/components/utils/Linkifier.ts +45 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +11 -0
- package/package.json +1 -1
- package/front_end/models/issues_manager/UserReidentificationIssue.ts +0 -72
- package/front_end/models/issues_manager/descriptions/userReidentificationBlocked.md +0 -5
- package/front_end/panels/security/IPProtectionTreeElement.ts +0 -21
- package/front_end/panels/security/IPProtectionView.ts +0 -287
- package/front_end/ui/components/docs/expandable_list/basic.html +0 -24
- package/front_end/ui/components/docs/expandable_list/basic.ts +0 -30
- package/front_end/ui/components/docs/markdown_image/basic.html +0 -19
- package/front_end/ui/components/docs/markdown_image/basic.ts +0 -38
- package/front_end/ui/components/docs/markdown_link/basic.html +0 -17
- package/front_end/ui/components/docs/markdown_link/basic.ts +0 -19
- package/front_end/ui/components/docs/markdown_view/basic.html +0 -25
- package/front_end/ui/components/docs/markdown_view/basic.ts +0 -67
- package/front_end/ui/components/docs/markdown_view/code-block.html +0 -30
- package/front_end/ui/components/docs/markdown_view/code-block.ts +0 -71
- package/front_end/ui/components/docs/text_prompt/basic.html +0 -35
- package/front_end/ui/components/docs/text_prompt/basic.ts +0 -19
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 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 '../../ui/components/switch/switch.js';
|
|
6
|
-
import '../../ui/components/cards/cards.js';
|
|
7
|
-
import '../../ui/legacy/components/data_grid/data_grid.js';
|
|
8
|
-
import '../../ui/components/buttons/buttons.js';
|
|
9
|
-
|
|
10
|
-
import * as i18n from '../../core/i18n/i18n.js';
|
|
11
|
-
import type * as Platform from '../../core/platform/platform.js';
|
|
12
|
-
import * as Root from '../../core/root/root.js';
|
|
13
|
-
import * as SDK from '../../core/sdk/sdk.js';
|
|
14
|
-
import * as Protocol from '../../generated/protocol.js';
|
|
15
|
-
import * as UI from '../../ui/legacy/legacy.js';
|
|
16
|
-
import * as Lit from '../../ui/lit/lit.js';
|
|
17
|
-
|
|
18
|
-
import ipProtectionViewStyles from './ipProtectionView.css.js';
|
|
19
|
-
|
|
20
|
-
const {render, html} = Lit;
|
|
21
|
-
const {widgetConfig} = UI.Widget;
|
|
22
|
-
|
|
23
|
-
const UIStrings = {
|
|
24
|
-
/**
|
|
25
|
-
*@description Title in the view's header for the IP Protection tool in the Privacy & Security panel
|
|
26
|
-
*/
|
|
27
|
-
viewTitle: 'IP Protection Proxy Controls',
|
|
28
|
-
/**
|
|
29
|
-
*@description Explanation in the view's header about the purpose of this IP Protection tool
|
|
30
|
-
*/
|
|
31
|
-
viewExplanation: 'Test how this site will perform if IP Proxy is enabled in Chrome',
|
|
32
|
-
/**
|
|
33
|
-
*@description Title in the card within the IP Protection tool
|
|
34
|
-
*/
|
|
35
|
-
cardTitle: 'IP Protection Proxy Status',
|
|
36
|
-
/**
|
|
37
|
-
*@description Subheading for bypassing IP protection toggle
|
|
38
|
-
*/
|
|
39
|
-
bypassTitle: 'Bypass IP Protection',
|
|
40
|
-
/**
|
|
41
|
-
*@description Description of bypass IP protection toggle
|
|
42
|
-
*/
|
|
43
|
-
bypassDescription: 'Temporarily bypass IP protection for testing',
|
|
44
|
-
/**
|
|
45
|
-
* @description Text informing the user that IP Proxy is not available
|
|
46
|
-
*/
|
|
47
|
-
notInIncognito: 'IP proxy unavailable',
|
|
48
|
-
/**
|
|
49
|
-
* @description Description in the widget instructing users to open site in incognito
|
|
50
|
-
*/
|
|
51
|
-
openIncognito: 'IP proxy is only available within incognito mode. Open site in incognito.',
|
|
52
|
-
/**
|
|
53
|
-
* @description Column header for the ID of a proxy request in the Proxy Request View panel.
|
|
54
|
-
*/
|
|
55
|
-
idColumn: 'ID',
|
|
56
|
-
/**
|
|
57
|
-
* @description Column header for the URL of a proxy request in the Proxy Request View panel.
|
|
58
|
-
*/
|
|
59
|
-
urlColumn: 'URL',
|
|
60
|
-
/**
|
|
61
|
-
* @description Column header for the HTTP method of a proxy request in the Proxy Request View panel.
|
|
62
|
-
*/
|
|
63
|
-
methodColumn: 'Method',
|
|
64
|
-
/**
|
|
65
|
-
* @description Column header for the status code of a proxy request in the Proxy Request View panel.
|
|
66
|
-
*/
|
|
67
|
-
statusColumn: 'Status',
|
|
68
|
-
/**
|
|
69
|
-
* @description Title for the grid of proxy requests.
|
|
70
|
-
*/
|
|
71
|
-
proxyRequests: 'Proxy Requests',
|
|
72
|
-
/**
|
|
73
|
-
* @description The status text for the available status of the IP protection proxy.
|
|
74
|
-
*/
|
|
75
|
-
Available: 'IP Protection is enabled and active.',
|
|
76
|
-
/**
|
|
77
|
-
* @description The status text for when the feature is not enabled.
|
|
78
|
-
*/
|
|
79
|
-
FeatureNotEnabled: 'IP Protection feature is not enabled.',
|
|
80
|
-
/**
|
|
81
|
-
* @description The status text for when the masked domain list is not enabled.
|
|
82
|
-
*/
|
|
83
|
-
MaskedDomainListNotEnabled: 'Masked Domain List feature is not enabled.',
|
|
84
|
-
/**
|
|
85
|
-
* @description The status text for when the masked domain list is not populated.
|
|
86
|
-
*/
|
|
87
|
-
MaskedDomainListNotPopulated: 'Masked Domain List is not populated.',
|
|
88
|
-
/**
|
|
89
|
-
* @description The status text for when authentication tokens are unavailable.
|
|
90
|
-
*/
|
|
91
|
-
AuthTokensUnavailable: 'Limit for authentication tokens was reached. IP Protection will be paused.',
|
|
92
|
-
/**
|
|
93
|
-
* @description The status text for when the proxy is unavailable for another reason.
|
|
94
|
-
*/
|
|
95
|
-
Unavailable: 'IP Protection is unavailable.',
|
|
96
|
-
/**
|
|
97
|
-
* @description The status text for when the proxy is bypassed by DevTools.
|
|
98
|
-
*/
|
|
99
|
-
BypassedByDevTools: 'IP Protection is being bypassed by DevTools.',
|
|
100
|
-
/**
|
|
101
|
-
* @description The status text for when the status is unknown or being loaded.
|
|
102
|
-
*/
|
|
103
|
-
statusUnknown: 'Status unknown',
|
|
104
|
-
} as const;
|
|
105
|
-
|
|
106
|
-
const str_ = i18n.i18n.registerUIStrings('panels/security/IPProtectionView.ts', UIStrings);
|
|
107
|
-
export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
108
|
-
|
|
109
|
-
// Explicitly reference dynamically referenced UIStrings to prevent the linter from removing
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
111
|
-
const allStatusStrings = [
|
|
112
|
-
UIStrings.Available,
|
|
113
|
-
UIStrings.FeatureNotEnabled,
|
|
114
|
-
UIStrings.MaskedDomainListNotEnabled,
|
|
115
|
-
UIStrings.MaskedDomainListNotPopulated,
|
|
116
|
-
UIStrings.AuthTokensUnavailable,
|
|
117
|
-
UIStrings.Unavailable,
|
|
118
|
-
UIStrings.BypassedByDevTools,
|
|
119
|
-
UIStrings.statusUnknown,
|
|
120
|
-
];
|
|
121
|
-
const INCOGNITO_EXPLANATION_URL = 'https://support.google.com/chrome/answer/95464?hl=en&co=GENIE.Platform%3DDesktop' as
|
|
122
|
-
Platform.DevToolsPath.UrlString;
|
|
123
|
-
|
|
124
|
-
/** A simplified representation of a network request for mock data. **/
|
|
125
|
-
interface MockNetworkRequest {
|
|
126
|
-
requestId: string;
|
|
127
|
-
url: string;
|
|
128
|
-
requestMethod: string;
|
|
129
|
-
statusCode: number;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface ViewInput {
|
|
133
|
-
status: Protocol.Network.IpProxyStatus|null;
|
|
134
|
-
proxyRequests: readonly MockNetworkRequest[];
|
|
135
|
-
}
|
|
136
|
-
export type View = (input: ViewInput, output: object, target: HTMLElement) => void;
|
|
137
|
-
|
|
138
|
-
export const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
139
|
-
const {status} = input;
|
|
140
|
-
const statusText = status ? i18nString(UIStrings[status]) : i18nString(UIStrings.statusUnknown);
|
|
141
|
-
|
|
142
|
-
// clang-format off
|
|
143
|
-
const cardHeader = html`
|
|
144
|
-
<div class="card-header">
|
|
145
|
-
<div class="lhs">
|
|
146
|
-
<div class="text">
|
|
147
|
-
<h2 class="main-text">${i18nString(UIStrings.cardTitle)}</h2>
|
|
148
|
-
<div class="body subtext">${statusText}</div>
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
<div class="status-badge">
|
|
152
|
-
${
|
|
153
|
-
status === Protocol.Network.IpProxyStatus.Available ?
|
|
154
|
-
html`<devtools-icon class="status-icon green-status-icon" role="presentation" name="check-circle"></devtools-icon>` :
|
|
155
|
-
html`<devtools-icon class="status-icon red-status-icon" role="presentation" name="cross-circle-filled"></devtools-icon>`}
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
158
|
-
`;
|
|
159
|
-
render(
|
|
160
|
-
html`
|
|
161
|
-
<style>
|
|
162
|
-
${ipProtectionViewStyles}
|
|
163
|
-
</style>
|
|
164
|
-
${
|
|
165
|
-
Root.Runtime.hostConfig.isOffTheRecord ? html`
|
|
166
|
-
<div class="overflow-auto">
|
|
167
|
-
<div class="ip-protection">
|
|
168
|
-
<div class="header">
|
|
169
|
-
<h1>${i18nString(UIStrings.viewTitle)}</h1>
|
|
170
|
-
<div class="body">${i18nString(UIStrings.viewExplanation)}</div>
|
|
171
|
-
</div>
|
|
172
|
-
<devtools-card class="card-container">
|
|
173
|
-
<div class="card">
|
|
174
|
-
${cardHeader}
|
|
175
|
-
<div>
|
|
176
|
-
<div class="card-row">
|
|
177
|
-
<div class="lhs">
|
|
178
|
-
<h3 class="main-text">${i18nString(UIStrings.bypassTitle)}</h3>
|
|
179
|
-
<div class="body subtext">${i18nString(UIStrings.bypassDescription)}</div>
|
|
180
|
-
</div>
|
|
181
|
-
<div>
|
|
182
|
-
<devtools-switch></devtools-switch>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
</devtools-card>
|
|
188
|
-
<devtools-data-grid striped name=${i18nString(UIStrings.proxyRequests)}>
|
|
189
|
-
<table>
|
|
190
|
-
<thead>
|
|
191
|
-
<tr>
|
|
192
|
-
<th id="id" sortable>${i18nString(UIStrings.idColumn)}</th>
|
|
193
|
-
<th id="url" sortable>${i18nString(UIStrings.urlColumn)}</th>
|
|
194
|
-
<th id="method" sortable>${i18nString(UIStrings.methodColumn)}</th>
|
|
195
|
-
<th id="status" sortable>${i18nString(UIStrings.statusColumn)}</th>
|
|
196
|
-
</tr>
|
|
197
|
-
</thead>
|
|
198
|
-
<tbody id="proxy-requests-body">
|
|
199
|
-
${input.proxyRequests.map((request, index) => html`
|
|
200
|
-
<tr data-request-id=${request.requestId}>
|
|
201
|
-
<td>${index + 1}</td>
|
|
202
|
-
<td>${request.url}</td>
|
|
203
|
-
<td>${request.requestMethod}</td>
|
|
204
|
-
<td>${String(request.statusCode)}</td>
|
|
205
|
-
</tr>
|
|
206
|
-
`)}
|
|
207
|
-
</tbody>
|
|
208
|
-
</table>
|
|
209
|
-
</devtools-data-grid>
|
|
210
|
-
</div>
|
|
211
|
-
</div>
|
|
212
|
-
` :
|
|
213
|
-
html`
|
|
214
|
-
<div class="empty-report">
|
|
215
|
-
<devtools-widget
|
|
216
|
-
class="learn-more"
|
|
217
|
-
.widgetConfig=${widgetConfig(UI.EmptyWidget.EmptyWidget, {
|
|
218
|
-
header: i18nString(UIStrings.notInIncognito),
|
|
219
|
-
text: i18nString(UIStrings.openIncognito),
|
|
220
|
-
link: INCOGNITO_EXPLANATION_URL,
|
|
221
|
-
})}>
|
|
222
|
-
</devtools-widget>
|
|
223
|
-
</div>
|
|
224
|
-
`}
|
|
225
|
-
`,
|
|
226
|
-
target);
|
|
227
|
-
// clang-format on
|
|
228
|
-
};
|
|
229
|
-
export class IPProtectionView extends UI.Widget.VBox {
|
|
230
|
-
#view: View;
|
|
231
|
-
#proxyRequests: MockNetworkRequest[] = [];
|
|
232
|
-
#status: Protocol.Network.IpProxyStatus|null = null;
|
|
233
|
-
|
|
234
|
-
constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
|
|
235
|
-
super(element, {useShadowDom: true});
|
|
236
|
-
this.#view = view;
|
|
237
|
-
|
|
238
|
-
// TODO(crbug.com/429153435): Replace with real data.
|
|
239
|
-
this.#proxyRequests = [
|
|
240
|
-
{requestId: '1', url: 'https://example.com/api/data', requestMethod: 'GET', statusCode: 200},
|
|
241
|
-
{requestId: '2', url: 'https://example.com/api/submit', requestMethod: 'POST', statusCode: 404},
|
|
242
|
-
{requestId: '3', url: 'https://example.com/assets/style.css', requestMethod: 'GET', statusCode: 200},
|
|
243
|
-
];
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
override async wasShown(): Promise<void> {
|
|
247
|
-
super.wasShown();
|
|
248
|
-
SDK.TargetManager.TargetManager.instance().addModelListener(
|
|
249
|
-
SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.PrimaryPageChanged,
|
|
250
|
-
this.#updateIpProtectionStatus, this);
|
|
251
|
-
await this.#updateIpProtectionStatus();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
override willHide(): void {
|
|
255
|
-
SDK.TargetManager.TargetManager.instance().removeModelListener(
|
|
256
|
-
SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.PrimaryPageChanged,
|
|
257
|
-
this.#updateIpProtectionStatus, this);
|
|
258
|
-
super.willHide();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
async #updateIpProtectionStatus(): Promise<void> {
|
|
262
|
-
const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
263
|
-
if (!target) {
|
|
264
|
-
this.#status = null;
|
|
265
|
-
this.requestUpdate();
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
const model = target.model(SDK.NetworkManager.NetworkManager);
|
|
269
|
-
if (!model) {
|
|
270
|
-
this.#status = null;
|
|
271
|
-
this.requestUpdate();
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
const status = await model.getIpProtectionProxyStatus();
|
|
275
|
-
this.#status = status;
|
|
276
|
-
this.requestUpdate();
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
get proxyRequests(): readonly MockNetworkRequest[] {
|
|
280
|
-
return this.#proxyRequests;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
override performUpdate(): void {
|
|
284
|
-
const input = {status: this.#status, proxyRequests: this.#proxyRequests};
|
|
285
|
-
this.#view(input, this, this.contentElement);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2021 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Basic Expandable List example</title>
|
|
12
|
-
<style>
|
|
13
|
-
#container {
|
|
14
|
-
padding: 20px;
|
|
15
|
-
font-size: 16px;
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
18
|
-
</head>
|
|
19
|
-
<body>
|
|
20
|
-
<div id="container">
|
|
21
|
-
</div>
|
|
22
|
-
<script type="module" src="./basic.js"></script>
|
|
23
|
-
</body>
|
|
24
|
-
</html>
|
|
@@ -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 FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
|
|
6
|
-
import * as Lit from '../../../lit/lit.js';
|
|
7
|
-
import * as ExpandableList from '../../expandable_list/expandable_list.js';
|
|
8
|
-
|
|
9
|
-
const {html} = Lit;
|
|
10
|
-
|
|
11
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
12
|
-
|
|
13
|
-
const component = new ExpandableList.ExpandableList.ExpandableList();
|
|
14
|
-
|
|
15
|
-
const rows = [];
|
|
16
|
-
rows.push(html`
|
|
17
|
-
<div>This is row 1. Click on the triangle icon to expand.</div>
|
|
18
|
-
`);
|
|
19
|
-
|
|
20
|
-
for (let rowNumber = 2; rowNumber < 11; rowNumber++) {
|
|
21
|
-
rows.push(html`
|
|
22
|
-
<div>This is row ${rowNumber}.</div>
|
|
23
|
-
`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
component.data = {
|
|
27
|
-
rows,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
document.getElementById('container')?.appendChild(component);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2021 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Basic Markdown Image example</title>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<div id="icon"></div>
|
|
15
|
-
<div id="image"></div>
|
|
16
|
-
|
|
17
|
-
<script type="module" src="./basic.js"></script>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -1,38 +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 FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
|
|
6
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
7
|
-
import * as MarkdownView from '../../markdown_view/markdown_view.js';
|
|
8
|
-
|
|
9
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
10
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
11
|
-
|
|
12
|
-
// Adding a couple image keys to the image map.
|
|
13
|
-
MarkdownView.MarkdownImagesMap.markdownImages.set('test-icon', {
|
|
14
|
-
src: '../../Images/issue-text-filled.svg',
|
|
15
|
-
isIcon: true,
|
|
16
|
-
width: '20px',
|
|
17
|
-
height: '20px',
|
|
18
|
-
});
|
|
19
|
-
MarkdownView.MarkdownImagesMap.markdownImages.set('test-image', {
|
|
20
|
-
src: '../../Images/lighthouse_logo.svg',
|
|
21
|
-
width: '200px',
|
|
22
|
-
height: '200px',
|
|
23
|
-
isIcon: false,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const iconComponent = new MarkdownView.MarkdownImage.MarkdownImage();
|
|
27
|
-
document.getElementById('icon')?.appendChild(iconComponent);
|
|
28
|
-
iconComponent.data = {
|
|
29
|
-
key: 'test-icon',
|
|
30
|
-
title: 'Test icon title',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const imageComponent = new MarkdownView.MarkdownImage.MarkdownImage();
|
|
34
|
-
document.getElementById('image')?.appendChild(imageComponent);
|
|
35
|
-
imageComponent.data = {
|
|
36
|
-
key: 'test-image',
|
|
37
|
-
title: 'Test image title',
|
|
38
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2021 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Basic Markdown Link example</title>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<div id="target"></div>
|
|
15
|
-
<script type="module" src="./basic.js"></script>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
|
@@ -1,19 +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 FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
|
|
6
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
7
|
-
import * as MarkdownView from '../../markdown_view/markdown_view.js';
|
|
8
|
-
|
|
9
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
10
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
11
|
-
|
|
12
|
-
MarkdownView.MarkdownLinksMap.markdownLinks.set('textLink', 'https://example.com/');
|
|
13
|
-
|
|
14
|
-
const link = new MarkdownView.MarkdownLink.MarkdownLink();
|
|
15
|
-
document.getElementById('target')?.appendChild(link);
|
|
16
|
-
link.data = {
|
|
17
|
-
key: 'textLink',
|
|
18
|
-
title: 'Test link title',
|
|
19
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2021 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Basic Markdown View example</title>
|
|
12
|
-
<style>
|
|
13
|
-
#container {
|
|
14
|
-
border: 1px solid;
|
|
15
|
-
width: 400px;
|
|
16
|
-
padding: 1em;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<div id="container"></div>
|
|
22
|
-
|
|
23
|
-
<script type="module" src="./basic.js"></script>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
|
@@ -1,67 +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 FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
|
|
6
|
-
import * as Marked from '../../../../third_party/marked/marked.js';
|
|
7
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
8
|
-
import * as MarkdownView from '../../markdown_view/markdown_view.js';
|
|
9
|
-
|
|
10
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
11
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
12
|
-
|
|
13
|
-
// Register images in the markdown image map.
|
|
14
|
-
MarkdownView.MarkdownImagesMap.markdownImages.set('lighthouse-icon', {
|
|
15
|
-
src: '../../Images/lighthouse_logo.svg',
|
|
16
|
-
width: '16px',
|
|
17
|
-
height: '16px',
|
|
18
|
-
isIcon: true,
|
|
19
|
-
});
|
|
20
|
-
MarkdownView.MarkdownImagesMap.markdownImages.set('baseline', {
|
|
21
|
-
src: '../../Images/align-items-baseline.svg',
|
|
22
|
-
width: '200px',
|
|
23
|
-
height: '200px',
|
|
24
|
-
isIcon: false,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// Register a link in the markdown link map.
|
|
28
|
-
MarkdownView.MarkdownLinksMap.markdownLinks.set('test-link', 'https://exampleLink.com/');
|
|
29
|
-
|
|
30
|
-
const component = new MarkdownView.MarkdownView.MarkdownView();
|
|
31
|
-
document.getElementById('container')?.appendChild(component);
|
|
32
|
-
|
|
33
|
-
const markdownAst = Marked.Marked.lexer(`
|
|
34
|
-
Lorem ipsum dolor sit amet,  consectetur adipiscing elit. [Phasellus tristique](test-link) metus velit, a laoreet sapien ultricies eu. Fusce facilisis, felis id ullamcorper placerat, enim magna porta justo, nec aliquet orci arcu eu velit. Ut quis maximus dolor. Morbi congue tempus porttitor. Duis ut lorem gravida, vehicula mi et, suscipit risus.
|
|
35
|
-
|
|
36
|
-
* Cras varius cursus eros.
|
|
37
|
-
* Mauris non blandit turpis.
|
|
38
|
-
|
|
39
|
-
Proin posuere varius risus, nec tristique urna elementum ut.
|
|
40
|
-
|
|
41
|
-
\`\`\`js
|
|
42
|
-
console.log('test')
|
|
43
|
-
\`\`\`
|
|
44
|
-
|
|
45
|
-
\`\`\`js
|
|
46
|
-
MarkdownView.MarkdownImagesMap.markdownImages.set('lighthouse-icon', {
|
|
47
|
-
src: '../../Images/lighthouse_logo.svg',
|
|
48
|
-
width: '16px',
|
|
49
|
-
height: '16px',
|
|
50
|
-
isIcon: true,
|
|
51
|
-
});
|
|
52
|
-
MarkdownView.MarkdownImagesMap.markdownImages.set('baseline', {
|
|
53
|
-
src: '../../Images/align-items-baseline.svg',
|
|
54
|
-
width: '200px',
|
|
55
|
-
height: '200px',
|
|
56
|
-
isIcon: false,
|
|
57
|
-
});
|
|
58
|
-
\`\`\`
|
|
59
|
-
|
|
60
|
-

|
|
61
|
-
|
|
62
|
-
\`Cras id elit at erat porttitor elementum\`. Donec purus nulla, suscipit eu hendrerit in, auctor eu erat. Proin ut accumsan mi, rhoncus interdum odio. Etiam dapibus posuere lorem.
|
|
63
|
-
`);
|
|
64
|
-
|
|
65
|
-
component.data = {
|
|
66
|
-
tokens: markdownAst,
|
|
67
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2021 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Code Block - Markdown View example</title>
|
|
12
|
-
<style>
|
|
13
|
-
#container {
|
|
14
|
-
max-width: 100vw;
|
|
15
|
-
max-height: 100vh;
|
|
16
|
-
border: 1px solid black;
|
|
17
|
-
padding: 24px;
|
|
18
|
-
overflow: auto;
|
|
19
|
-
display: grid;
|
|
20
|
-
grid-template-columns: 1fr 1fr;
|
|
21
|
-
grid-template-rows: auto;
|
|
22
|
-
}
|
|
23
|
-
</style>
|
|
24
|
-
</head>
|
|
25
|
-
<body>
|
|
26
|
-
<div id="container"></div>
|
|
27
|
-
|
|
28
|
-
<script type="module" src="./code-block.js"></script>
|
|
29
|
-
</body>
|
|
30
|
-
</html>
|
|
@@ -1,71 +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 FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
|
|
6
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
7
|
-
import * as MarkdownView from '../../markdown_view/markdown_view.js';
|
|
8
|
-
|
|
9
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
10
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
11
|
-
|
|
12
|
-
const container = document.getElementById('container');
|
|
13
|
-
|
|
14
|
-
function appendCodeBlock(data: {
|
|
15
|
-
displayNotice: boolean,
|
|
16
|
-
header?: string,
|
|
17
|
-
showCopyButton?: boolean,
|
|
18
|
-
}): void {
|
|
19
|
-
const component = new MarkdownView.CodeBlock.CodeBlock();
|
|
20
|
-
container?.appendChild(document.createTextNode(JSON.stringify(data)));
|
|
21
|
-
container?.appendChild(component);
|
|
22
|
-
component.codeLang = 'js';
|
|
23
|
-
component.code = `MarkdownView.MarkdownImagesMap.markdownImages.set('lighthouse-icon', {
|
|
24
|
-
src: '../../Images/lighthouse_logo.svg',
|
|
25
|
-
width: '16px',
|
|
26
|
-
height: '16px',
|
|
27
|
-
isIcon: true,
|
|
28
|
-
});
|
|
29
|
-
MarkdownView.MarkdownImagesMap.markdownImages.set('baseline', {
|
|
30
|
-
src: '../../Images/align-items-baseline.svg',
|
|
31
|
-
width: '200px',
|
|
32
|
-
height: '200px',
|
|
33
|
-
isIcon: false,
|
|
34
|
-
});`;
|
|
35
|
-
component.displayNotice = data.displayNotice;
|
|
36
|
-
if (data.header) {
|
|
37
|
-
component.header = data.header;
|
|
38
|
-
}
|
|
39
|
-
if (data.showCopyButton) {
|
|
40
|
-
component.showCopyButton = data.showCopyButton;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
appendCodeBlock({
|
|
45
|
-
displayNotice: true,
|
|
46
|
-
});
|
|
47
|
-
appendCodeBlock({
|
|
48
|
-
displayNotice: false,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
appendCodeBlock({
|
|
52
|
-
displayNotice: true,
|
|
53
|
-
header: 'Code executed',
|
|
54
|
-
showCopyButton: false,
|
|
55
|
-
});
|
|
56
|
-
appendCodeBlock({
|
|
57
|
-
displayNotice: false,
|
|
58
|
-
header: 'Code executed',
|
|
59
|
-
showCopyButton: false,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
appendCodeBlock({
|
|
63
|
-
displayNotice: true,
|
|
64
|
-
header: 'Code executed',
|
|
65
|
-
showCopyButton: true,
|
|
66
|
-
});
|
|
67
|
-
appendCodeBlock({
|
|
68
|
-
displayNotice: false,
|
|
69
|
-
header: 'Code executed',
|
|
70
|
-
showCopyButton: true,
|
|
71
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2021 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
|
|
9
|
-
<head>
|
|
10
|
-
<meta charset="UTF-8" />
|
|
11
|
-
<meta name="viewport" content="width=device-width" />
|
|
12
|
-
<title>Basic Text Prompt example</title>
|
|
13
|
-
<meta charset="UTF-8" />
|
|
14
|
-
<style>
|
|
15
|
-
#container {
|
|
16
|
-
width: 80%;
|
|
17
|
-
border: 1px solid black;
|
|
18
|
-
padding: 20px;
|
|
19
|
-
height: 300px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
#container > devtools-text-prompt {
|
|
23
|
-
vertical-align: middle;
|
|
24
|
-
font-size: 14px;
|
|
25
|
-
border: 1px solid #ccc;
|
|
26
|
-
}
|
|
27
|
-
</style>
|
|
28
|
-
</head>
|
|
29
|
-
|
|
30
|
-
<body>
|
|
31
|
-
<div id="container"></div>
|
|
32
|
-
<script type="module" src="./basic.js"></script>
|
|
33
|
-
</body>
|
|
34
|
-
|
|
35
|
-
</html>
|