chrome-devtools-frontend 1.0.1543082 → 1.0.1543472
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -0
- package/front_end/core/common/Gzip.ts +4 -4
- package/front_end/core/common/common.ts +0 -2
- package/front_end/core/root/DevToolsContext.ts +60 -0
- package/front_end/core/root/root.ts +6 -1
- package/front_end/core/sdk/TargetManager.ts +5 -6
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +1 -13
- package/front_end/entrypoints/main/MainImpl.ts +3 -5
- package/front_end/foundation/Universe.ts +13 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +11 -8
- package/front_end/models/trace/handlers/SamplesHandler.ts +64 -6
- package/front_end/models/trace/types/TraceEvents.ts +16 -0
- package/front_end/models/workspace/IgnoreListManager.ts +10 -9
- package/front_end/models/workspace/WorkspaceImpl.ts +5 -10
- package/front_end/panels/application/ApplicationPanelSidebar.ts +0 -1
- package/front_end/panels/application/OpenedWindowDetailsView.ts +0 -2
- package/front_end/panels/application/ServiceWorkersView.ts +0 -2
- package/front_end/panels/application/StorageView.ts +0 -1
- package/front_end/panels/application/components/FrameDetailsView.ts +468 -447
- package/front_end/panels/console/ConsoleView.ts +9 -7
- package/front_end/panels/console/ConsoleViewMessage.ts +19 -9
- package/front_end/panels/explain/components/ConsoleInsight.ts +314 -310
- package/front_end/panels/settings/SettingsScreen.ts +3 -6
- package/front_end/panels/settings/components/SyncSection.ts +218 -226
- package/front_end/panels/settings/components/syncSection.css +81 -80
- package/front_end/panels/sources/DebuggerPlugin.ts +3 -1
- package/front_end/panels/sources/ResourceOriginPlugin.ts +7 -3
- package/front_end/panels/timeline/TimelinePanel.ts +0 -21
- package/front_end/ui/components/docs/component_docs.ts +0 -4
- package/front_end/ui/components/report_view/ReportView.ts +4 -1
- package/front_end/ui/legacy/ReportView.ts +0 -5
- package/front_end/ui/legacy/TextPrompt.ts +65 -19
- package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +8 -4
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +90 -92
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +114 -184
- package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -1
- package/front_end/ui/{components/docs/theme_colors/basic.ts → legacy/theme_support/ThemeColors.docs.ts} +33 -23
- package/package.json +1 -1
- package/front_end/core/common/QueryParamHandler.ts +0 -7
- package/front_end/ui/components/docs/input/basic.html +0 -31
- package/front_end/ui/components/docs/input/basic.ts +0 -12
- package/front_end/ui/components/docs/report/basic.html +0 -27
- package/front_end/ui/components/docs/report/basic.ts +0 -48
- package/front_end/ui/components/docs/theme_colors/basic.html +0 -56
- package/front_end/ui/components/docs/toggle_dark_mode.ts +0 -36
- package/front_end/ui/components/docs/toggle_fonts.ts +0 -74
- package/front_end/ui/components/docs/user_agent_client_hints/basic.html +0 -25
- package/front_end/ui/components/docs/user_agent_client_hints/basic.ts +0 -26
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// Copyright 2015 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
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
7
6
|
import * as Platform from '../../../../core/platform/platform.js';
|
|
8
7
|
import * as SDK from '../../../../core/sdk/sdk.js';
|
|
9
8
|
import * as Protocol from '../../../../generated/protocol.js';
|
|
10
|
-
import
|
|
9
|
+
import {Directives, html, type LitTemplate, nothing} from '../../../lit/lit.js';
|
|
11
10
|
|
|
11
|
+
const {ifDefined, repeat} = Directives;
|
|
12
12
|
const UIStrings = {
|
|
13
13
|
/**
|
|
14
14
|
* @description Text shown in the console object preview. Shown when the user is inspecting a
|
|
@@ -31,6 +31,14 @@ const UIStrings = {
|
|
|
31
31
|
} as const;
|
|
32
32
|
const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts', UIStrings);
|
|
33
33
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
34
|
+
|
|
35
|
+
interface PropertyPreviewValue {
|
|
36
|
+
name?: string;
|
|
37
|
+
entry?: Protocol.Runtime.EntryPreview;
|
|
38
|
+
value?: Protocol.Runtime.PropertyPreview;
|
|
39
|
+
placeholder?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
export class RemoteObjectPreviewFormatter {
|
|
35
43
|
private static objectPropertyComparator(a: Protocol.Runtime.PropertyPreview, b: Protocol.Runtime.PropertyPreview):
|
|
36
44
|
number {
|
|
@@ -55,8 +63,7 @@ export class RemoteObjectPreviewFormatter {
|
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
65
|
|
|
58
|
-
|
|
59
|
-
parentElement: DocumentFragment|Element, preview: Protocol.Runtime.ObjectPreview, isEntry: boolean): void {
|
|
66
|
+
renderObjectPreview(preview: Protocol.Runtime.ObjectPreview): LitTemplate {
|
|
60
67
|
const description = preview.description;
|
|
61
68
|
const subTypesWithoutValuePreview = new Set<Protocol.Runtime.ObjectPreviewSubtype|'internal#entry'|'trustedtype'>([
|
|
62
69
|
Protocol.Runtime.ObjectPreviewSubtype.Arraybuffer,
|
|
@@ -69,92 +76,91 @@ export class RemoteObjectPreviewFormatter {
|
|
|
69
76
|
'trustedtype',
|
|
70
77
|
]);
|
|
71
78
|
if (preview.type !== Protocol.Runtime.ObjectPreviewType.Object ||
|
|
72
|
-
(preview.subtype && subTypesWithoutValuePreview.has(preview.subtype))
|
|
73
|
-
|
|
74
|
-
return;
|
|
79
|
+
(preview.subtype && subTypesWithoutValuePreview.has(preview.subtype))) {
|
|
80
|
+
return this.renderPropertyPreview(preview.type, preview.subtype, undefined, description);
|
|
75
81
|
}
|
|
76
82
|
const isArrayOrTypedArray = preview.subtype === Protocol.Runtime.ObjectPreviewSubtype.Array ||
|
|
77
83
|
preview.subtype === Protocol.Runtime.ObjectPreviewSubtype.Typedarray;
|
|
84
|
+
let objectDescription = '';
|
|
78
85
|
if (description) {
|
|
79
|
-
let text;
|
|
80
86
|
if (isArrayOrTypedArray) {
|
|
81
87
|
const arrayLength = SDK.RemoteObject.RemoteObject.arrayLength(preview);
|
|
82
88
|
const arrayLengthText = arrayLength > 1 ? ('(' + arrayLength + ')') : '';
|
|
83
89
|
const arrayName = SDK.RemoteObject.RemoteObject.arrayNameFromDescription(description);
|
|
84
|
-
|
|
90
|
+
objectDescription = arrayName === 'Array' ? arrayLengthText : (arrayName + arrayLengthText);
|
|
85
91
|
} else {
|
|
86
92
|
const hideDescription = description === 'Object';
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
if (text.length > 0) {
|
|
90
|
-
parentElement.createChild('span', 'object-description').textContent = text + '\xA0';
|
|
93
|
+
objectDescription = hideDescription ? '' : description;
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
const items = Array.from(
|
|
98
|
+
preview.entries ? this.renderEntries(preview) :
|
|
99
|
+
isArrayOrTypedArray ? this.renderArrayProperties(preview) :
|
|
100
|
+
this.renderObjectProperties(preview));
|
|
101
|
+
|
|
102
|
+
// clang-format off
|
|
103
|
+
const renderName = (name: string): LitTemplate => html`<span class=name>${
|
|
104
|
+
/^\s|\s$|^$|\n/.test(name)? '"' + name.replace(/\n/g, '\u21B5') + '"' : name}</span>`;
|
|
105
|
+
|
|
106
|
+
const renderPlaceholder = (placeholder: string): LitTemplate =>
|
|
107
|
+
html`<span class=object-value-undefined>${placeholder}</span>`;
|
|
108
|
+
|
|
109
|
+
const renderValue = (value: Protocol.Runtime.PropertyPreview): LitTemplate=>
|
|
110
|
+
this.renderPropertyPreview(value.type, value.subtype, value.name, value.value);
|
|
111
|
+
|
|
112
|
+
const renderEntry = (entry: Protocol.Runtime.EntryPreview): LitTemplate=> html`${entry.key &&
|
|
113
|
+
html`${this.renderPropertyPreview(entry.key.type, entry.key.subtype, undefined, entry.key.description)} => `}
|
|
114
|
+
${this.renderPropertyPreview(entry.value.type, entry.value.subtype, undefined, entry.value.description)}`;
|
|
115
|
+
|
|
116
|
+
const renderItem = ({name, entry, value, placeholder}: PropertyPreviewValue, index: number): LitTemplate => html`${
|
|
117
|
+
index > 0 ? ', ' : ''}${
|
|
118
|
+
placeholder !== undefined ? renderPlaceholder(placeholder) : nothing}${
|
|
119
|
+
name !== undefined ? renderName(name) : nothing}${
|
|
120
|
+
name !== undefined && value ? ': ' : ''}${
|
|
121
|
+
value ? renderValue(value) : nothing}${
|
|
122
|
+
entry ? renderEntry(entry) : nothing}`;
|
|
123
|
+
// clang-format on
|
|
124
|
+
|
|
125
|
+
return html`${
|
|
126
|
+
objectDescription.length > 0 ?
|
|
127
|
+
html`<span class=object-description>${objectDescription + '\xA0'}</span>` :
|
|
128
|
+
nothing}<span class=object-properties-preview>${isArrayOrTypedArray ? '[' : '{'}${
|
|
129
|
+
repeat(items, renderItem)}${preview.overflow ? html`<span>${items.length > 0 ? ',\xA0…' : '…'}</span>` : ''}
|
|
130
|
+
${isArrayOrTypedArray ? ']' : '}'}</span>`;
|
|
108
131
|
}
|
|
109
132
|
|
|
110
|
-
private
|
|
111
|
-
const abbreviatedDescription = description.split('.');
|
|
112
|
-
for (let i = 0; i < abbreviatedDescription.length - 1; ++i) {
|
|
113
|
-
abbreviatedDescription[i] = Platform.StringUtilities.trimMiddle(abbreviatedDescription[i], 3);
|
|
114
|
-
}
|
|
115
|
-
return abbreviatedDescription.join('.');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
private appendObjectPropertiesPreview(parentElement: Element, preview: Protocol.Runtime.ObjectPreview): void {
|
|
133
|
+
private * renderObjectProperties(preview: Protocol.Runtime.ObjectPreview): Generator<PropertyPreviewValue> {
|
|
119
134
|
const properties = preview.properties.filter(p => p.type !== 'accessor')
|
|
120
135
|
.sort(RemoteObjectPreviewFormatter.objectPropertyComparator);
|
|
121
136
|
for (let i = 0; i < properties.length; ++i) {
|
|
122
|
-
if (i > 0) {
|
|
123
|
-
UI.UIUtils.createTextChild(parentElement, ', ');
|
|
124
|
-
}
|
|
125
|
-
|
|
126
137
|
const property = properties[i];
|
|
127
138
|
const name = property.name;
|
|
128
139
|
// Internal properties are given special formatting, e.g. Promises `<rejected>: 123`.
|
|
129
140
|
if (preview.subtype === Protocol.Runtime.ObjectPreviewSubtype.Promise && name === InternalName.PROMISE_STATE) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (
|
|
133
|
-
if (property.value !== 'pending') {
|
|
134
|
-
UI.UIUtils.createTextChild(parentElement, ': ');
|
|
135
|
-
parentElement.appendChild(this.renderPropertyPreviewOrAccessor([nextProperty]));
|
|
136
|
-
}
|
|
141
|
+
const promiseResult =
|
|
142
|
+
properties.at(i + 1)?.name === InternalName.PROMISE_RESULT ? properties.at(i + 1) : undefined;
|
|
143
|
+
if (promiseResult) {
|
|
137
144
|
i++;
|
|
138
145
|
}
|
|
146
|
+
yield {name: '<' + property.value + '>', value: property.value !== 'pending' ? promiseResult : undefined};
|
|
139
147
|
} else if (preview.subtype === 'generator' && name === InternalName.GENERATOR_STATE) {
|
|
140
|
-
|
|
148
|
+
yield {name: '<' + property.value + '>'};
|
|
141
149
|
} else if (name === InternalName.PRIMITIVE_VALUE) {
|
|
142
|
-
|
|
150
|
+
yield {value: property};
|
|
143
151
|
} else if (name === InternalName.WEAK_REF_TARGET) {
|
|
144
152
|
if (property.type === Protocol.Runtime.PropertyPreviewType.Undefined) {
|
|
145
|
-
|
|
153
|
+
yield {name: '<cleared>'};
|
|
146
154
|
} else {
|
|
147
|
-
|
|
155
|
+
yield {value: property};
|
|
148
156
|
}
|
|
149
157
|
} else {
|
|
150
|
-
|
|
151
|
-
UI.UIUtils.createTextChild(parentElement, ': ');
|
|
152
|
-
parentElement.appendChild(this.renderPropertyPreviewOrAccessor([property]));
|
|
158
|
+
yield {name, value: property};
|
|
153
159
|
}
|
|
154
160
|
}
|
|
155
161
|
}
|
|
156
162
|
|
|
157
|
-
private
|
|
163
|
+
private * renderArrayProperties(preview: Protocol.Runtime.ObjectPreview): Generator<PropertyPreviewValue> {
|
|
158
164
|
const arrayLength = SDK.RemoteObject.RemoteObject.arrayLength(preview);
|
|
159
165
|
const indexProperties = preview.properties.filter(p => toArrayIndex(p.name) !== -1).sort(arrayEntryComparator);
|
|
160
166
|
const otherProperties = preview.properties.filter(p => toArrayIndex(p.name) === -1)
|
|
@@ -179,133 +185,65 @@ export class RemoteObjectPreviewFormatter {
|
|
|
179
185
|
|
|
180
186
|
// Gaps can be shown when all properties are guaranteed to be in the preview.
|
|
181
187
|
const canShowGaps = !preview.overflow;
|
|
182
|
-
let lastNonEmptyArrayIndex = -1;
|
|
183
|
-
let elementsAdded = false;
|
|
184
|
-
for (let i = 0; i < indexProperties.length; ++i) {
|
|
185
|
-
if (elementsAdded) {
|
|
186
|
-
UI.UIUtils.createTextChild(parentElement, ', ');
|
|
187
|
-
}
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
const indexedProperties:
|
|
190
|
+
Array<{property: Protocol.Runtime.PropertyPreview, index: number, gap: number, hasGaps: boolean}> = [];
|
|
191
|
+
for (const property of indexProperties) {
|
|
190
192
|
const index = toArrayIndex(property.name);
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
if (!canShowGaps && i !== index) {
|
|
196
|
-
parentElement.appendChild(this.renderDisplayName(property.name));
|
|
197
|
-
UI.UIUtils.createTextChild(parentElement, ': ');
|
|
198
|
-
}
|
|
199
|
-
parentElement.appendChild(this.renderPropertyPreviewOrAccessor([property]));
|
|
200
|
-
lastNonEmptyArrayIndex = index;
|
|
201
|
-
elementsAdded = true;
|
|
193
|
+
const gap = index - (indexedProperties.at(-1)?.index ?? -1) - 1;
|
|
194
|
+
const hasGaps = index !== indexedProperties.length;
|
|
195
|
+
indexedProperties.push({property, index, gap, hasGaps});
|
|
202
196
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
197
|
+
const trailingGap = arrayLength - (indexedProperties.at(-1)?.index ?? -1) - 1;
|
|
198
|
+
|
|
199
|
+
// TODO(l10n): Plurals. Tricky because of a bug in the presubmit check for plurals.
|
|
200
|
+
const renderGap = (count: number): {placeholder: string} =>
|
|
201
|
+
({placeholder: count !== 1 ? i18nString(UIStrings.emptyD, {PH1: count}) : i18nString(UIStrings.empty)});
|
|
202
|
+
for (const {property, gap, hasGaps} of indexedProperties) {
|
|
203
|
+
if (canShowGaps && gap > 0) {
|
|
204
|
+
yield renderGap(gap);
|
|
207
205
|
}
|
|
208
|
-
|
|
206
|
+
yield {name: !canShowGaps && hasGaps ? property.name : undefined, value: property};
|
|
209
207
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (elementsAdded) {
|
|
213
|
-
UI.UIUtils.createTextChild(parentElement, ', ');
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const property = otherProperties[i];
|
|
217
|
-
parentElement.appendChild(this.renderDisplayName(property.name));
|
|
218
|
-
UI.UIUtils.createTextChild(parentElement, ': ');
|
|
219
|
-
parentElement.appendChild(this.renderPropertyPreviewOrAccessor([property]));
|
|
220
|
-
elementsAdded = true;
|
|
208
|
+
if (canShowGaps && trailingGap > 0) {
|
|
209
|
+
yield renderGap(trailingGap);
|
|
221
210
|
}
|
|
222
211
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const count = index - lastNonEmptyArrayIndex - 1;
|
|
226
|
-
// TODO(l10n): Plurals. Tricky because of a bug in the presubmit check for plurals.
|
|
227
|
-
span.textContent = count !== 1 ? i18nString(UIStrings.emptyD, {PH1: count}) : i18nString(UIStrings.empty);
|
|
228
|
-
elementsAdded = true;
|
|
212
|
+
for (const property of otherProperties) {
|
|
213
|
+
yield {name: property.name, value: property};
|
|
229
214
|
}
|
|
230
215
|
}
|
|
231
216
|
|
|
232
|
-
private
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
for (let i = 0; i < preview.entries.length; ++i) {
|
|
237
|
-
if (i > 0) {
|
|
238
|
-
UI.UIUtils.createTextChild(parentElement, ', ');
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const entry = preview.entries[i];
|
|
242
|
-
if (entry.key) {
|
|
243
|
-
this.appendObjectPreview(parentElement, entry.key, true /* isEntry */);
|
|
244
|
-
UI.UIUtils.createTextChild(parentElement, ' => ');
|
|
245
|
-
}
|
|
246
|
-
this.appendObjectPreview(parentElement, entry.value, true /* isEntry */);
|
|
217
|
+
private * renderEntries(preview: Protocol.Runtime.ObjectPreview): Generator<PropertyPreviewValue> {
|
|
218
|
+
for (const entry of preview.entries ?? []) {
|
|
219
|
+
yield {entry};
|
|
247
220
|
}
|
|
248
221
|
}
|
|
249
222
|
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
result.textContent = needsQuotes ? '"' + name.replace(/\n/g, '\u21B5') + '"' : name;
|
|
255
|
-
return result;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
private renderPropertyPreviewOrAccessor(propertyPath: Protocol.Runtime.PropertyPreview[]): Element {
|
|
259
|
-
const property = propertyPath[propertyPath.length - 1];
|
|
260
|
-
if (!property) {
|
|
261
|
-
throw new Error('Could not find property');
|
|
262
|
-
}
|
|
263
|
-
return this.renderPropertyPreview(property.type, (property.subtype as string), property.name, property.value);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
renderPropertyPreview(type: string, subtype?: string, className?: string|null, description?: string): HTMLElement {
|
|
267
|
-
const span = document.createElement('span');
|
|
268
|
-
span.classList.add('object-value-' + (subtype || type));
|
|
269
|
-
description = description || '';
|
|
270
|
-
|
|
271
|
-
if (type === 'accessor') {
|
|
272
|
-
span.textContent = '(...)';
|
|
273
|
-
UI.Tooltip.Tooltip.install(span, i18nString(UIStrings.thePropertyIsComputedWithAGetter));
|
|
274
|
-
return span;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (type === 'function') {
|
|
278
|
-
span.textContent = '\u0192';
|
|
279
|
-
return span;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (type === 'object' && subtype === 'trustedtype' && className) {
|
|
283
|
-
createSpanForTrustedType(span, description, className);
|
|
284
|
-
return span;
|
|
285
|
-
}
|
|
223
|
+
renderPropertyPreview(type: string, subtype?: string, className?: string|null, description?: string): LitTemplate {
|
|
224
|
+
const title = type === 'accessor' ? i18nString(UIStrings.thePropertyIsComputedWithAGetter) :
|
|
225
|
+
(type === 'object' && !subtype) ? description :
|
|
226
|
+
undefined;
|
|
286
227
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
if (type === 'string') {
|
|
293
|
-
UI.UIUtils.createTextChildren(span, Platform.StringUtilities.formatAsJSLiteral(description));
|
|
294
|
-
return span;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (type === 'object' && !subtype) {
|
|
298
|
-
let preview = this.abbreviateFullQualifiedClassName(description);
|
|
299
|
-
if (preview === 'Object') {
|
|
300
|
-
preview = '{…}';
|
|
228
|
+
const abbreviateFullQualifiedClassName = (description: string): string => {
|
|
229
|
+
const abbreviatedDescription = description.split('.');
|
|
230
|
+
for (let i = 0; i < abbreviatedDescription.length - 1; ++i) {
|
|
231
|
+
abbreviatedDescription[i] = Platform.StringUtilities.trimMiddle(abbreviatedDescription[i], 3);
|
|
301
232
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
233
|
+
return abbreviatedDescription.length === 1 && abbreviatedDescription[0] === 'Object' ?
|
|
234
|
+
'{…}' :
|
|
235
|
+
abbreviatedDescription.join('.');
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const preview = (): string|LitTemplate|undefined|null => type === 'accessor' ? '(...)' :
|
|
239
|
+
type === 'function' ? '\u0192' :
|
|
240
|
+
type === 'object' && subtype === 'trustedtype' && className ? renderTrustedType(description ?? '', className) :
|
|
241
|
+
type === 'object' && subtype === 'node' && description ? renderNodeTitle(description) :
|
|
242
|
+
type === 'string' ? Platform.StringUtilities.formatAsJSLiteral(description ?? '') :
|
|
243
|
+
type === 'object' && !subtype ? abbreviateFullQualifiedClassName(description ?? '') :
|
|
244
|
+
description;
|
|
245
|
+
|
|
246
|
+
return html`<span class='object-value-${(subtype || type)}' title=${ifDefined(title)}>${preview()}</span>`;
|
|
309
247
|
}
|
|
310
248
|
}
|
|
311
249
|
|
|
@@ -317,24 +255,16 @@ const enum InternalName {
|
|
|
317
255
|
WEAK_REF_TARGET = '[[WeakRefTarget]]',
|
|
318
256
|
}
|
|
319
257
|
|
|
320
|
-
export
|
|
258
|
+
export function renderNodeTitle(nodeTitle: string): LitTemplate|null {
|
|
321
259
|
const match = nodeTitle.match(/([^#.]+)(#[^.]+)?(\..*)?/);
|
|
322
260
|
if (!match) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
container.createChild('span', 'webkit-html-tag-name').textContent = match[1];
|
|
326
|
-
if (match[2]) {
|
|
327
|
-
container.createChild('span', 'webkit-html-attribute-value').textContent = match[2];
|
|
328
|
-
}
|
|
329
|
-
if (match[3]) {
|
|
330
|
-
container.createChild('span', 'webkit-html-attribute-name').textContent = match[3];
|
|
261
|
+
return null;
|
|
331
262
|
}
|
|
332
|
-
}
|
|
263
|
+
return html`<span class=webkit-html-tag-name>${match[1]}</span>${
|
|
264
|
+
match[2] && html`<span class=webkit-html-attribute-value>${match[2]}</span>`}${
|
|
265
|
+
match[3] && html`<span class=webkit-html-attribute-name>${match[3]}</span>`}`;
|
|
266
|
+
}
|
|
333
267
|
|
|
334
|
-
export
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
trustedContentSpan.classList.add('object-value-string');
|
|
338
|
-
UI.UIUtils.createTextChildren(trustedContentSpan, '"', description.replace(/\n/g, '\u21B5'), '"');
|
|
339
|
-
span.appendChild(trustedContentSpan);
|
|
340
|
-
};
|
|
268
|
+
export function renderTrustedType(description: string, className: string): LitTemplate {
|
|
269
|
+
return html`${className} <span class=object-value-string>"${description.replace(/\n/g, '\u21B5')}"</span>`;
|
|
270
|
+
}
|
|
@@ -1139,7 +1139,7 @@ export interface LinkifyOptions {
|
|
|
1139
1139
|
className?: string;
|
|
1140
1140
|
columnNumber?: number;
|
|
1141
1141
|
showColumnNumber?: boolean;
|
|
1142
|
-
inlineFrameIndex
|
|
1142
|
+
inlineFrameIndex?: number;
|
|
1143
1143
|
tabStop?: boolean;
|
|
1144
1144
|
userMetric?: Host.UserMetrics.Action;
|
|
1145
1145
|
jslogContext?: string;
|
|
@@ -2,13 +2,10 @@
|
|
|
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 Lit from '
|
|
6
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
5
|
+
import * as Lit from '../../lit/lit.js';
|
|
7
6
|
|
|
8
7
|
const {html} = Lit;
|
|
9
8
|
|
|
10
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
11
|
-
|
|
12
9
|
const THEME_VARIABLES_NAMES = new Set([
|
|
13
10
|
'--sys-color-base',
|
|
14
11
|
'--sys-color-base-container',
|
|
@@ -30,6 +27,7 @@ const THEME_VARIABLES_NAMES = new Set([
|
|
|
30
27
|
'--sys-color-gradient-tertiary',
|
|
31
28
|
'--sys-color-green',
|
|
32
29
|
'--sys-color-green-bright',
|
|
30
|
+
'--sys-color-header-container',
|
|
33
31
|
'--sys-color-inverse-on-surface',
|
|
34
32
|
'--sys-color-inverse-primary',
|
|
35
33
|
'--sys-color-inverse-surface',
|
|
@@ -82,9 +80,12 @@ const THEME_VARIABLES_NAMES = new Set([
|
|
|
82
80
|
'--sys-color-state-hover-on-prominent',
|
|
83
81
|
'--sys-color-state-hover-on-subtle',
|
|
84
82
|
'--sys-color-state-on-header-hover',
|
|
83
|
+
'--sys-color-state-on-text-highlight',
|
|
85
84
|
'--sys-color-state-ripple-neutral-on-prominent',
|
|
86
85
|
'--sys-color-state-ripple-neutral-on-subtle',
|
|
87
86
|
'--sys-color-state-ripple-primary',
|
|
87
|
+
'--sys-color-state-scrim',
|
|
88
|
+
'--sys-color-state-text-highlight',
|
|
88
89
|
'--sys-color-surface',
|
|
89
90
|
'--sys-color-surface1',
|
|
90
91
|
'--sys-color-surface2',
|
|
@@ -125,34 +126,43 @@ const THEME_VARIABLES_NAMES = new Set([
|
|
|
125
126
|
'--sys-color-yellow-bright',
|
|
126
127
|
'--sys-color-yellow-container',
|
|
127
128
|
'--sys-color-yellow-outline',
|
|
128
|
-
'--sys-elevation-level1',
|
|
129
|
-
'--sys-elevation-level2',
|
|
130
|
-
'--sys-elevation-level3',
|
|
131
|
-
'--sys-elevation-level4',
|
|
132
|
-
'--sys-elevation-level5',
|
|
133
129
|
]);
|
|
134
130
|
|
|
135
|
-
function
|
|
136
|
-
const container = document.getElementById('container') as HTMLElement;
|
|
131
|
+
export function render(container: HTMLElement): void {
|
|
137
132
|
const items = Array.from(THEME_VARIABLES_NAMES).map(varName => {
|
|
138
133
|
const value = getComputedStyle(container).getPropertyValue(varName);
|
|
139
134
|
if (!value) {
|
|
140
135
|
throw new Error(`Could not find value for CSS variable ${varName}.`);
|
|
141
136
|
}
|
|
142
|
-
|
|
143
|
-
let styles = {};
|
|
144
|
-
if (varName.includes('--sys-elevation')) {
|
|
145
|
-
styles = {boxShadow: `var(${varName})`, borderBottomWidth: 0};
|
|
146
|
-
} else {
|
|
147
|
-
styles = {borderBottomColor: `var(${varName})`};
|
|
148
|
-
}
|
|
149
|
-
const style = Lit.Directives.styleMap(styles);
|
|
137
|
+
const style = Lit.Directives.styleMap({borderBottomColor: `var(${varName})`});
|
|
150
138
|
return html`
|
|
151
139
|
<div style=${style}><code>${varName}: ${value}</code></div>
|
|
152
|
-
<div style=${style} class='theme-with-dark-background'><code>${varName}: ${value}</code></div>
|
|
153
140
|
`;
|
|
154
141
|
});
|
|
155
|
-
Lit.render(
|
|
156
|
-
|
|
142
|
+
Lit.render(
|
|
143
|
+
html`
|
|
144
|
+
<style>
|
|
145
|
+
.theme {
|
|
146
|
+
width: 600px;
|
|
147
|
+
display: flex;
|
|
148
|
+
flex-direction: column;
|
|
149
|
+
row-gap: var(--sys-size-5);
|
|
150
|
+
|
|
151
|
+
> span {
|
|
152
|
+
font: var(--sys-typescale-headline1);
|
|
153
|
+
}
|
|
157
154
|
|
|
158
|
-
|
|
155
|
+
> div {
|
|
156
|
+
display: block;
|
|
157
|
+
border-bottom-width: var(--sys-size-9);
|
|
158
|
+
border-bottom-style: solid;
|
|
159
|
+
font: var(--sys-typescale-body1-regular);
|
|
160
|
+
margin-bottom: var(--sys-size-5);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
164
|
+
<div class="theme">
|
|
165
|
+
${items}
|
|
166
|
+
</div>`,
|
|
167
|
+
container);
|
|
168
|
+
}
|
package/package.json
CHANGED
|
@@ -1,31 +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>Input example</title>
|
|
12
|
-
<style>
|
|
13
|
-
#container {
|
|
14
|
-
padding: 25px;
|
|
15
|
-
width: 300px;
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
font-size: 16px;
|
|
19
|
-
}
|
|
20
|
-
#container > * {
|
|
21
|
-
margin-bottom: 10px;
|
|
22
|
-
}
|
|
23
|
-
</style>
|
|
24
|
-
</head>
|
|
25
|
-
<body>
|
|
26
|
-
<div id="container">
|
|
27
|
-
<input class="devtools-text-input" placeholder="placeholder" />
|
|
28
|
-
</div>
|
|
29
|
-
<script type="module" src="./basic.js"></script>
|
|
30
|
-
</body>
|
|
31
|
-
</html>
|
|
@@ -1,12 +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 Input from '../../input/input.js';
|
|
8
|
-
|
|
9
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
10
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
11
|
-
|
|
12
|
-
document.head.appendChild(document.createElement('style')).textContent = Input.textInputStyles;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2020 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 IssueLinkIcon example</title>
|
|
12
|
-
<style>
|
|
13
|
-
#container {
|
|
14
|
-
width: 80%;
|
|
15
|
-
border: 1px solid black;
|
|
16
|
-
height: 300px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
</style>
|
|
20
|
-
</head>
|
|
21
|
-
<body>
|
|
22
|
-
<div id="container">
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<script type="module" src="./basic.js"></script>
|
|
26
|
-
</body>
|
|
27
|
-
</html>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Copyright 2020 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 '../../report_view/report_view.js';
|
|
6
|
-
|
|
7
|
-
import * as Lit from '../../../lit/lit.js';
|
|
8
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
9
|
-
|
|
10
|
-
const {html} = Lit;
|
|
11
|
-
|
|
12
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
13
|
-
|
|
14
|
-
const exampleRenderHelper = (key: string, value: string) => html`
|
|
15
|
-
<devtools-report-key>${key}</devtools-report-key>
|
|
16
|
-
<devtools-report-value>${value}</devtools-report-value>
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
const container = document.querySelector<HTMLElement>('#container');
|
|
20
|
-
if (!container) {
|
|
21
|
-
throw new Error('Could not find container');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
Lit.render(
|
|
25
|
-
html`
|
|
26
|
-
<style>
|
|
27
|
-
.source-code {
|
|
28
|
-
font-family: monospace;
|
|
29
|
-
}
|
|
30
|
-
</style>
|
|
31
|
-
|
|
32
|
-
<devtools-report .data=${{
|
|
33
|
-
reportTitle:
|
|
34
|
-
'Optional Title',
|
|
35
|
-
}}>
|
|
36
|
-
<devtools-report-section-header>Section 1</devtools-report-section-header>
|
|
37
|
-
<devtools-report-key>Basic plain text field</devtools-report-key>
|
|
38
|
-
<devtools-report-value>And this is the value</devtools-report-value>
|
|
39
|
-
<devtools-report-key>A field with a code value</devtools-report-key>
|
|
40
|
-
<devtools-report-value class="source-code">SomeCodeValue</devtools-report-value>
|
|
41
|
-
<devtools-report-divider></devtools-report-divider>
|
|
42
|
-
<devtools-report-section-header>Section 2</devtools-report-section-header>
|
|
43
|
-
${exampleRenderHelper('Using a small helper', 'to render report rows')}
|
|
44
|
-
${exampleRenderHelper('This wide column defines the column width', 'for all rows')}
|
|
45
|
-
<devtools-report-divider></devtools-report-divider>
|
|
46
|
-
</devtools-report>
|
|
47
|
-
`,
|
|
48
|
-
container);
|