chrome-devtools-frontend 1.0.930993 → 1.0.932348
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/config/gni/devtools_grd_files.gni +6 -2
- package/front_end/core/common/ParsedURL.ts +12 -10
- package/front_end/core/host/InspectorFrontendHostAPI.ts +8 -6
- package/front_end/core/i18n/locales/en-US.json +345 -12
- package/front_end/core/i18n/locales/en-XL.json +345 -12
- package/front_end/core/platform/DevToolsPath.ts +34 -0
- package/front_end/core/platform/platform.ts +2 -0
- package/front_end/core/protocol_client/NodeURL.ts +2 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +4 -2
- package/front_end/core/sdk/ChildTargetManager.ts +2 -0
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +4 -2
- package/front_end/core/sdk/DebuggerModel.ts +4 -3
- package/front_end/core/sdk/NetworkRequest.ts +3 -2
- package/front_end/core/sdk/Resource.ts +6 -5
- package/front_end/core/sdk/Script.ts +4 -2
- package/front_end/core/sdk/Target.ts +4 -0
- package/front_end/core/sdk/TracingModel.ts +8 -17
- package/front_end/entrypoint_template.html +1 -1
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +1 -1
- package/front_end/models/bindings/BreakpointManager.ts +6 -3
- package/front_end/models/bindings/ResourceMapping.ts +2 -1
- package/front_end/models/bindings/StylesSourceMapping.ts +2 -1
- package/front_end/models/emulation/DeviceModeModel.ts +1 -1
- package/front_end/models/persistence/IsolatedFileSystem.ts +9 -7
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +8 -7
- package/front_end/models/persistence/PersistenceActions.ts +1 -1
- package/front_end/models/persistence/PlatformFileSystem.ts +4 -3
- package/front_end/models/text_utils/ContentProvider.ts +2 -1
- package/front_end/models/text_utils/StaticContentProvider.ts +4 -2
- package/front_end/models/workspace/UISourceCode.ts +3 -2
- package/front_end/panels/animation/AnimationGroupPreviewUI.ts +25 -25
- package/front_end/panels/animation/AnimationModel.ts +157 -156
- package/front_end/panels/animation/AnimationScreenshotPopover.ts +26 -26
- package/front_end/panels/animation/AnimationTimeline.ts +274 -260
- package/front_end/panels/animation/AnimationUI.ts +155 -145
- package/front_end/panels/application/BackForwardCacheStrings.ts +621 -0
- package/front_end/panels/application/BackForwardCacheView.ts +24 -8
- package/front_end/panels/application/ReportingApiReportsView.ts +3 -2
- package/front_end/panels/application/ReportingApiView.ts +1 -2
- package/front_end/panels/application/backForwardCacheView.css +10 -0
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +48 -40
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +37 -37
- package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +23 -19
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +56 -56
- package/front_end/panels/changes/ChangesView.ts +42 -225
- package/front_end/panels/changes/changes-legacy.ts +0 -2
- package/front_end/panels/changes/changes.ts +0 -6
- package/front_end/panels/changes/changesView.css +2 -69
- package/front_end/panels/changes/module.json +1 -1
- package/front_end/panels/console/ConsolePinPane.ts +80 -75
- package/front_end/panels/console/ConsoleView.ts +1 -9
- package/front_end/panels/console/consolePinPane.css +4 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +2 -1
- package/front_end/panels/security/mainView.css +2 -1
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +2 -1
- package/front_end/panels/sources/NavigatorView.ts +5 -2
- package/front_end/panels/sources/SourcesPanel.ts +28 -1
- package/front_end/panels/sources/sources-meta.ts +1 -4
- package/front_end/third_party/codemirror.next/bundle.ts +6 -4
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +30 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -3
- package/front_end/ui/components/buttons/Button.ts +22 -6
- package/front_end/ui/components/buttons/button.css +50 -4
- package/front_end/ui/components/diff_view/DiffView.ts +288 -0
- package/front_end/ui/components/diff_view/diffView.css +73 -0
- package/front_end/ui/components/diff_view/diff_view.ts +5 -0
- package/front_end/ui/components/docs/button/basic.html +28 -0
- package/front_end/ui/components/docs/button/basic.ts +43 -2
- package/front_end/ui/components/report_view/report.css +1 -0
- package/front_end/ui/components/text_editor/config.ts +34 -1
- package/front_end/ui/legacy/ForwardedInputEventHandler.ts +5 -3
- package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -4
- package/front_end/ui/legacy/themeColors.css +4 -0
- package/package.json +1 -1
- package/scripts/build/generate_css_js_files.js +1 -0
- package/scripts/migration/class-fields/migrate.js +1 -3
- package/front_end/panels/changes/ChangesHighlighter.ts +0 -179
- package/front_end/panels/changes/ChangesTextEditor.ts +0 -96
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
// Copyright 2019 The Chromium Authors. All rights reserved.
|
|
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 i18n from '../../../core/i18n/i18n.js';
|
|
6
|
+
import * as Diff from '../../../third_party/diff/diff.js';
|
|
7
|
+
import * as LitHtml from '../../lit-html/lit-html.js';
|
|
8
|
+
import * as CodeHighlighter from '../code_highlighter/code_highlighter.js';
|
|
9
|
+
import * as ComponentHelpers from '../helpers/helpers.js';
|
|
10
|
+
|
|
11
|
+
import diffViewStyles from './diffView.css.js';
|
|
12
|
+
|
|
13
|
+
const UIStrings = {
|
|
14
|
+
/**
|
|
15
|
+
*@description Text prepended to a removed line in a diff in the Changes tool, viewable only by screen reader.
|
|
16
|
+
*/
|
|
17
|
+
deletions: 'Deletion:',
|
|
18
|
+
/**
|
|
19
|
+
*@description Text prepended to a new line in a diff in the Changes tool, viewable only by screen reader.
|
|
20
|
+
*/
|
|
21
|
+
additions: 'Addition:',
|
|
22
|
+
/**
|
|
23
|
+
*@description Screen-reader accessible name for the code editor in the Changes tool showing the user's changes.
|
|
24
|
+
*/
|
|
25
|
+
changesDiffViewer: 'Changes diff viewer',
|
|
26
|
+
/**
|
|
27
|
+
*@description Text in Changes View of the Changes tab
|
|
28
|
+
*@example {2} PH1
|
|
29
|
+
*/
|
|
30
|
+
SkippingDMatchingLines: '( … Skipping {PH1} matching lines … )',
|
|
31
|
+
};
|
|
32
|
+
const str_ = i18n.i18n.registerUIStrings('ui/components/diff_view/DiffView.ts', UIStrings);
|
|
33
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
34
|
+
|
|
35
|
+
interface Token {
|
|
36
|
+
text: string;
|
|
37
|
+
className: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface Row {
|
|
41
|
+
originalLineNumber: number;
|
|
42
|
+
currentLineNumber: number;
|
|
43
|
+
tokens: Token[];
|
|
44
|
+
type: RowType;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const enum RowType {
|
|
48
|
+
Deletion = 'deletion',
|
|
49
|
+
Addition = 'addition',
|
|
50
|
+
Equal = 'equal',
|
|
51
|
+
Spacer = 'spacer',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function buildDiffRows(diff: Diff.Diff.DiffArray): {
|
|
55
|
+
originalLines: readonly string[],
|
|
56
|
+
currentLines: readonly string[],
|
|
57
|
+
rows: readonly Row[],
|
|
58
|
+
} {
|
|
59
|
+
let currentLineNumber = 0;
|
|
60
|
+
let originalLineNumber = 0;
|
|
61
|
+
const paddingLines = 3;
|
|
62
|
+
|
|
63
|
+
const originalLines: string[] = [];
|
|
64
|
+
const currentLines: string[] = [];
|
|
65
|
+
const rows: Row[] = [];
|
|
66
|
+
|
|
67
|
+
for (let i = 0; i < diff.length; ++i) {
|
|
68
|
+
const token = diff[i];
|
|
69
|
+
switch (token[0]) {
|
|
70
|
+
case Diff.Diff.Operation.Equal:
|
|
71
|
+
rows.push(...createEqualRows(token[1], i === 0, i === diff.length - 1));
|
|
72
|
+
originalLines.push(...token[1]);
|
|
73
|
+
currentLines.push(...token[1]);
|
|
74
|
+
break;
|
|
75
|
+
case Diff.Diff.Operation.Insert:
|
|
76
|
+
for (const line of token[1]) {
|
|
77
|
+
rows.push(createRow(line, RowType.Addition));
|
|
78
|
+
}
|
|
79
|
+
currentLines.push(...token[1]);
|
|
80
|
+
break;
|
|
81
|
+
case Diff.Diff.Operation.Delete:
|
|
82
|
+
originalLines.push(...token[1]);
|
|
83
|
+
if (diff[i + 1] && diff[i + 1][0] === Diff.Diff.Operation.Insert) {
|
|
84
|
+
i++;
|
|
85
|
+
rows.push(...createModifyRows(token[1].join('\n'), diff[i][1].join('\n')));
|
|
86
|
+
currentLines.push(...diff[i][1]);
|
|
87
|
+
} else {
|
|
88
|
+
for (const line of token[1]) {
|
|
89
|
+
rows.push(createRow(line, RowType.Deletion));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {originalLines, currentLines, rows};
|
|
97
|
+
|
|
98
|
+
function createEqualRows(lines: string[], atStart: boolean, atEnd: boolean): Row[] {
|
|
99
|
+
const equalRows = [];
|
|
100
|
+
if (!atStart) {
|
|
101
|
+
for (let i = 0; i < paddingLines && i < lines.length; i++) {
|
|
102
|
+
equalRows.push(createRow(lines[i], RowType.Equal));
|
|
103
|
+
}
|
|
104
|
+
if (lines.length > paddingLines * 2 + 1 && !atEnd) {
|
|
105
|
+
equalRows.push(createRow(
|
|
106
|
+
i18nString(UIStrings.SkippingDMatchingLines, {PH1: (lines.length - paddingLines * 2)}), RowType.Spacer));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (!atEnd) {
|
|
110
|
+
const start = Math.max(lines.length - paddingLines - 1, atStart ? 0 : paddingLines);
|
|
111
|
+
let skip = lines.length - paddingLines - 1;
|
|
112
|
+
if (!atStart) {
|
|
113
|
+
skip -= paddingLines;
|
|
114
|
+
}
|
|
115
|
+
if (skip > 0) {
|
|
116
|
+
originalLineNumber += skip;
|
|
117
|
+
currentLineNumber += skip;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
for (let i = start; i < lines.length; i++) {
|
|
121
|
+
equalRows.push(createRow(lines[i], RowType.Equal));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return equalRows;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function createModifyRows(before: string, after: string): Row[] {
|
|
128
|
+
const internalDiff = Diff.Diff.DiffWrapper.charDiff(before, after, true /* cleanup diff */);
|
|
129
|
+
const deletionRows = [createRow('', RowType.Deletion)];
|
|
130
|
+
const insertionRows = [createRow('', RowType.Addition)];
|
|
131
|
+
|
|
132
|
+
for (const token of internalDiff) {
|
|
133
|
+
const text = token[1];
|
|
134
|
+
const type = token[0];
|
|
135
|
+
const className = type === Diff.Diff.Operation.Equal ? '' : 'inner-diff';
|
|
136
|
+
const lines = text.split('\n');
|
|
137
|
+
for (let i = 0; i < lines.length; i++) {
|
|
138
|
+
if (i > 0 && type !== Diff.Diff.Operation.Insert) {
|
|
139
|
+
deletionRows.push(createRow('', RowType.Deletion));
|
|
140
|
+
}
|
|
141
|
+
if (i > 0 && type !== Diff.Diff.Operation.Delete) {
|
|
142
|
+
insertionRows.push(createRow('', RowType.Addition));
|
|
143
|
+
}
|
|
144
|
+
if (!lines[i]) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (type !== Diff.Diff.Operation.Insert) {
|
|
148
|
+
deletionRows[deletionRows.length - 1].tokens.push({text: lines[i], className});
|
|
149
|
+
}
|
|
150
|
+
if (type !== Diff.Diff.Operation.Delete) {
|
|
151
|
+
insertionRows[insertionRows.length - 1].tokens.push({text: lines[i], className});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return deletionRows.concat(insertionRows);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function createRow(text: string, type: RowType): Row {
|
|
159
|
+
if (type === RowType.Addition) {
|
|
160
|
+
currentLineNumber++;
|
|
161
|
+
}
|
|
162
|
+
if (type === RowType.Deletion) {
|
|
163
|
+
originalLineNumber++;
|
|
164
|
+
}
|
|
165
|
+
if (type === RowType.Equal) {
|
|
166
|
+
originalLineNumber++;
|
|
167
|
+
currentLineNumber++;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return {originalLineNumber, currentLineNumber, tokens: text ? [{text, className: 'inner-diff'}] : [], type};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function documentMap(lines: readonly string[]): Map<number, number> {
|
|
175
|
+
const map = new Map<number, number>();
|
|
176
|
+
for (let pos = 0, lineNo = 0; lineNo < lines.length; lineNo++) {
|
|
177
|
+
map.set(lineNo + 1, pos);
|
|
178
|
+
pos += lines[lineNo].length + 1;
|
|
179
|
+
}
|
|
180
|
+
return map;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
class DiffRenderer {
|
|
184
|
+
private constructor(
|
|
185
|
+
readonly originalHighlighter: CodeHighlighter.CodeHighlighter.CodeHighlighter,
|
|
186
|
+
readonly originalMap: Map<number, number>,
|
|
187
|
+
readonly currentHighlighter: CodeHighlighter.CodeHighlighter.CodeHighlighter,
|
|
188
|
+
readonly currentMap: Map<number, number>,
|
|
189
|
+
) {
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private render(rows: readonly Row[]): LitHtml.TemplateResult {
|
|
193
|
+
return LitHtml.html`
|
|
194
|
+
<div class="diff-listing" aria-label="${i18nString(UIStrings.changesDiffViewer)}">
|
|
195
|
+
${rows.map(row => this.renderRow(row))}
|
|
196
|
+
</div>`;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private renderRow(row: Row): LitHtml.TemplateResult {
|
|
200
|
+
const baseNumber =
|
|
201
|
+
row.type === RowType.Equal || row.type === RowType.Deletion ? String(row.originalLineNumber) : '';
|
|
202
|
+
const curNumber = row.type === RowType.Equal || row.type === RowType.Addition ? String(row.currentLineNumber) : '';
|
|
203
|
+
let marker = '', markerClass = 'diff-line-marker', screenReaderText = null;
|
|
204
|
+
if (row.type === RowType.Addition) {
|
|
205
|
+
marker = '+';
|
|
206
|
+
markerClass += ' diff-line-addition';
|
|
207
|
+
screenReaderText = LitHtml.html`<span class="diff-hidden-text">${i18nString(UIStrings.additions)}</span>`;
|
|
208
|
+
} else if (row.type === RowType.Deletion) {
|
|
209
|
+
marker = '-';
|
|
210
|
+
markerClass += ' diff-line-deletion';
|
|
211
|
+
screenReaderText = LitHtml.html`<span class="diff-hidden-text">${i18nString(UIStrings.deletions)}</span>`;
|
|
212
|
+
}
|
|
213
|
+
return LitHtml.html`
|
|
214
|
+
<div class="diff-line-number" aria-hidden="true">${baseNumber}</div>
|
|
215
|
+
<div class="diff-line-number" aria-hidden="true">${curNumber}</div>
|
|
216
|
+
<div class="${markerClass}" aria-hidden="true">${marker}</div>
|
|
217
|
+
<div class="diff-line-content diff-line-${row.type}" data-line-number=${curNumber}>${screenReaderText}${
|
|
218
|
+
this.renderRowContent(row)}</div>`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
private renderRowContent(row: Row): LitHtml.TemplateResult[] {
|
|
222
|
+
if (row.type === RowType.Spacer) {
|
|
223
|
+
return row.tokens.map(tok => LitHtml.html`${tok.text}`);
|
|
224
|
+
}
|
|
225
|
+
const [doc, startPos] = row.type === RowType.Deletion ?
|
|
226
|
+
[this.originalHighlighter, this.originalMap.get(row.originalLineNumber) as number] :
|
|
227
|
+
[this.currentHighlighter, this.currentMap.get(row.currentLineNumber) as number];
|
|
228
|
+
const content: LitHtml.TemplateResult[] = [];
|
|
229
|
+
let pos = startPos;
|
|
230
|
+
for (const token of row.tokens) {
|
|
231
|
+
const tokenContent: (LitHtml.TemplateResult|string)[] = [];
|
|
232
|
+
doc.highlightRange(pos, pos + token.text.length, (text, style) => {
|
|
233
|
+
tokenContent.push(style ? LitHtml.html`<span class="${style}">${text}</span>` : text);
|
|
234
|
+
});
|
|
235
|
+
content.push(
|
|
236
|
+
token.className ? LitHtml.html`<span class="${token.className}">${tokenContent}</span>` :
|
|
237
|
+
LitHtml.html`${tokenContent}`);
|
|
238
|
+
pos += token.text.length;
|
|
239
|
+
}
|
|
240
|
+
return content;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
static async render(diff: Diff.Diff.DiffArray, mimeType: string, parent: HTMLElement|DocumentFragment):
|
|
244
|
+
Promise<void> {
|
|
245
|
+
const {originalLines, currentLines, rows} = buildDiffRows(diff);
|
|
246
|
+
const renderer = new DiffRenderer(
|
|
247
|
+
await CodeHighlighter.CodeHighlighter.create(originalLines.join('\n'), mimeType),
|
|
248
|
+
documentMap(originalLines),
|
|
249
|
+
await CodeHighlighter.CodeHighlighter.create(currentLines.join('\n'), mimeType),
|
|
250
|
+
documentMap(currentLines),
|
|
251
|
+
);
|
|
252
|
+
LitHtml.render(renderer.render(rows), parent, {host: this});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare global {
|
|
257
|
+
interface HTMLElementTagNameMap {
|
|
258
|
+
'devtools-diff-view': DiffView;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export type DiffViewData = {
|
|
263
|
+
diff: Diff.Diff.DiffArray,
|
|
264
|
+
mimeType: string,
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export class DiffView extends HTMLElement {
|
|
268
|
+
static readonly litTagName = LitHtml.literal`devtools-diff-view`;
|
|
269
|
+
|
|
270
|
+
private readonly shadow = this.attachShadow({mode: 'open'});
|
|
271
|
+
loaded: Promise<void>;
|
|
272
|
+
|
|
273
|
+
constructor(data?: DiffViewData) {
|
|
274
|
+
super();
|
|
275
|
+
this.shadow.adoptedStyleSheets = [diffViewStyles, CodeHighlighter.Style.default];
|
|
276
|
+
if (data) {
|
|
277
|
+
this.loaded = DiffRenderer.render(data.diff, data.mimeType, this.shadow);
|
|
278
|
+
} else {
|
|
279
|
+
this.loaded = Promise.resolve();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
set data(data: DiffViewData) {
|
|
284
|
+
this.loaded = DiffRenderer.render(data.diff, data.mimeType, this.shadow);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
ComponentHelpers.CustomElements.defineComponent('devtools-diff-view', DiffView);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 The Chromium Authors. All rights reserved.
|
|
3
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.diff-listing {
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: max-content max-content max-content auto;
|
|
10
|
+
font-family: var(--source-code-font-family);
|
|
11
|
+
font-size: var(--source-code-font-size);
|
|
12
|
+
white-space: pre;
|
|
13
|
+
line-height: 1.2em;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.diff-line-number {
|
|
17
|
+
color: var(--color-line-number);
|
|
18
|
+
padding: 0 3px 0 9px;
|
|
19
|
+
text-align: right;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.diff-line-marker {
|
|
23
|
+
border-right: 1px solid var(--color-details-hairline);
|
|
24
|
+
width: 20px;
|
|
25
|
+
text-align: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.diff-line-content {
|
|
29
|
+
padding: 0 4px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.diff-line-marker-addition,
|
|
33
|
+
.diff-line-addition {
|
|
34
|
+
--override-addition-background-color: hsl(144deg 55% 49% / 20%);
|
|
35
|
+
|
|
36
|
+
background-color: var(--override-addition-background-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.diff-line-marker-deletion,
|
|
40
|
+
.diff-line-deletion {
|
|
41
|
+
--override-deletion-background-color: rgb(255 0 0 / 20%);
|
|
42
|
+
|
|
43
|
+
background-color: var(--override-deletion-background-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.diff-line-addition .inner-diff {
|
|
47
|
+
--override-addition-inner-diff-background-color: hsl(144deg 55% 49% / 30%);
|
|
48
|
+
|
|
49
|
+
background-color: var(--override-addition-inner-diff-background-color);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.diff-line-deletion .inner-diff {
|
|
53
|
+
--override-deletion-inner-diff-background-color: rgb(255 0 0 / 30%);
|
|
54
|
+
|
|
55
|
+
background-color: var(--override-deletion-inner-diff-background-color);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.diff-hidden-text {
|
|
59
|
+
display: inline-block;
|
|
60
|
+
width: 0;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.diff-line-equal {
|
|
65
|
+
opacity: 50%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.diff-line-spacer {
|
|
69
|
+
--override-spacer-background-color: rgb(0 0 255 / 10%);
|
|
70
|
+
|
|
71
|
+
text-align: center;
|
|
72
|
+
background-color: var(--override-spacer-background-color);
|
|
73
|
+
}
|
|
@@ -19,11 +19,39 @@
|
|
|
19
19
|
#container > * {
|
|
20
20
|
margin-right: 10px;
|
|
21
21
|
}
|
|
22
|
+
#toolbar {
|
|
23
|
+
background-color: var(--color-background);
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
27
|
+
border-bottom: 1px solid var(--color-details-hairline);
|
|
28
|
+
padding: 0px 5px;
|
|
29
|
+
height: 29px;
|
|
30
|
+
}
|
|
31
|
+
#small-toolbar {
|
|
32
|
+
background-color: var(--color-background);
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
align-items: center;
|
|
36
|
+
border-bottom: 1px solid var(--color-details-hairline);
|
|
37
|
+
padding: 0px 5px;
|
|
38
|
+
height: 23px;
|
|
39
|
+
}
|
|
40
|
+
.separator {
|
|
41
|
+
background-color: var(--color-details-hairline);
|
|
42
|
+
width: 1px;
|
|
43
|
+
height: 17px;
|
|
44
|
+
margin: 0px 5px;
|
|
45
|
+
}
|
|
22
46
|
</style>
|
|
23
47
|
</head>
|
|
24
48
|
<body>
|
|
25
49
|
<div id="container">
|
|
26
50
|
</div>
|
|
51
|
+
<div id="toolbar">
|
|
52
|
+
</div>
|
|
53
|
+
<div id="small-toolbar">
|
|
54
|
+
</div>
|
|
27
55
|
<script type="module" src="./basic.js"></script>
|
|
28
56
|
</body>
|
|
29
57
|
</html>
|
|
@@ -15,6 +15,14 @@ function appendButton(button: Buttons.Button.Button): void {
|
|
|
15
15
|
document.querySelector('#container')?.appendChild(button);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
function appendToToolbar(element: HTMLElement): void {
|
|
19
|
+
document.querySelector('#toolbar')?.appendChild(element);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function appendToSmallToolbar(element: HTMLElement): void {
|
|
23
|
+
document.querySelector('#small-toolbar')?.appendChild(element);
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
// Primary
|
|
19
27
|
const primaryButton = new Buttons.Button.Button();
|
|
20
28
|
primaryButton.data = {
|
|
@@ -62,13 +70,13 @@ primaryIconOnlyButton.data = {
|
|
|
62
70
|
iconUrl: testIcon,
|
|
63
71
|
};
|
|
64
72
|
primaryIconOnlyButton.onclick = () => alert('clicked');
|
|
65
|
-
primaryIconOnlyButton.style.width = '
|
|
73
|
+
primaryIconOnlyButton.style.width = '24px';
|
|
66
74
|
appendButton(primaryIconOnlyButton);
|
|
67
75
|
|
|
68
76
|
// Secondary Icon Only
|
|
69
77
|
const secondaryIconOnlyButton = new Buttons.Button.Button();
|
|
70
78
|
secondaryIconOnlyButton.onclick = () => alert('clicked');
|
|
71
|
-
secondaryIconOnlyButton.style.width = '
|
|
79
|
+
secondaryIconOnlyButton.style.width = '24px';
|
|
72
80
|
secondaryIconOnlyButton.data = {
|
|
73
81
|
variant: Buttons.Button.Variant.SECONDARY,
|
|
74
82
|
iconUrl: testIcon,
|
|
@@ -96,3 +104,36 @@ smallSecondaryIconOnlyButton.data = {
|
|
|
96
104
|
size: Buttons.Button.Size.SMALL,
|
|
97
105
|
};
|
|
98
106
|
appendButton(smallSecondaryIconOnlyButton);
|
|
107
|
+
|
|
108
|
+
for (let i = 0; i < 6; i++) {
|
|
109
|
+
// Regular Toolbar Button
|
|
110
|
+
const toolbarButton = new Buttons.Button.Button();
|
|
111
|
+
toolbarButton.onclick = () => alert('clicked');
|
|
112
|
+
toolbarButton.data = {
|
|
113
|
+
variant: Buttons.Button.Variant.TOOLBAR,
|
|
114
|
+
iconUrl: testIcon,
|
|
115
|
+
};
|
|
116
|
+
appendToToolbar(toolbarButton);
|
|
117
|
+
if (i % 3 === 1) {
|
|
118
|
+
const sep = document.createElement('div');
|
|
119
|
+
sep.classList.add('separator');
|
|
120
|
+
appendToToolbar(sep);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
for (let i = 0; i < 6; i++) {
|
|
125
|
+
// Small Toolbar Button
|
|
126
|
+
const smallToolbarButton = new Buttons.Button.Button();
|
|
127
|
+
smallToolbarButton.onclick = () => alert('clicked');
|
|
128
|
+
smallToolbarButton.data = {
|
|
129
|
+
variant: Buttons.Button.Variant.TOOLBAR,
|
|
130
|
+
size: Buttons.Button.Size.SMALL,
|
|
131
|
+
iconUrl: testIcon,
|
|
132
|
+
};
|
|
133
|
+
appendToSmallToolbar(smallToolbarButton);
|
|
134
|
+
if (i % 3 === 1) {
|
|
135
|
+
const sep = document.createElement('div');
|
|
136
|
+
sep.classList.add('separator');
|
|
137
|
+
appendToSmallToolbar(sep);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -200,10 +200,43 @@ export function baseConfiguration(text: string): CM.Extension {
|
|
|
200
200
|
CM.Prec.fallback(CM.EditorView.contentAttributes.of({'aria-label': i18nString(UIStrings.codeEditor)})),
|
|
201
201
|
detectLineSeparator(text),
|
|
202
202
|
autocompletion,
|
|
203
|
-
CM.tooltips({
|
|
203
|
+
CM.tooltips({parent: getTooltipHost() as unknown as HTMLElement}),
|
|
204
204
|
];
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
// Root editor tooltips at the top of the document, creating a special
|
|
208
|
+
// element with the editor styles mounted in it for them. This is
|
|
209
|
+
// annoying, but necessary because a scrollable parent node clips them
|
|
210
|
+
// otherwise, `position: fixed` doesn't work due to `contain` styles,
|
|
211
|
+
// and appending them diretly to `document.body` doesn't work because
|
|
212
|
+
// the necessary style sheets aren't available there.
|
|
213
|
+
let tooltipHost: ShadowRoot|null = null;
|
|
214
|
+
|
|
215
|
+
function getTooltipHost(): ShadowRoot {
|
|
216
|
+
if (!tooltipHost) {
|
|
217
|
+
const styleModules = CM.EditorState
|
|
218
|
+
.create({
|
|
219
|
+
extensions: [
|
|
220
|
+
editorTheme,
|
|
221
|
+
themeIsDark() ? dummyDarkTheme : [],
|
|
222
|
+
CodeHighlighter.CodeHighlighter.getHighlightStyle(CM),
|
|
223
|
+
CM.showTooltip.of({
|
|
224
|
+
pos: 0,
|
|
225
|
+
create() {
|
|
226
|
+
return {dom: document.createElement('div')};
|
|
227
|
+
},
|
|
228
|
+
}),
|
|
229
|
+
],
|
|
230
|
+
})
|
|
231
|
+
.facet(CM.EditorView.styleModule);
|
|
232
|
+
const host = document.body.appendChild(document.createElement('div'));
|
|
233
|
+
host.className = 'editor-tooltip-host';
|
|
234
|
+
tooltipHost = host.attachShadow({mode: 'open'});
|
|
235
|
+
CM.StyleModule.mount(tooltipHost, styleModules);
|
|
236
|
+
}
|
|
237
|
+
return tooltipHost;
|
|
238
|
+
}
|
|
239
|
+
|
|
207
240
|
class CompletionHint extends CM.WidgetType {
|
|
208
241
|
constructor(readonly text: string) {
|
|
209
242
|
super();
|
|
@@ -9,14 +9,16 @@ import {Context} from './Context.js';
|
|
|
9
9
|
import {KeyboardShortcut} from './KeyboardShortcut.js';
|
|
10
10
|
import {ForwardedShortcut, ShortcutRegistry} from './ShortcutRegistry.js';
|
|
11
11
|
|
|
12
|
+
// This handler only forwards the keystrokes if DevTools front-end is
|
|
13
|
+
// not running in hosted mode.
|
|
12
14
|
export class ForwardedInputEventHandler {
|
|
13
15
|
constructor() {
|
|
14
16
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
|
|
15
17
|
Host.InspectorFrontendHostAPI.Events.KeyEventUnhandled, this.onKeyEventUnhandled, this);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
private onKeyEventUnhandled(
|
|
19
|
-
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.KeyEventUnhandledEvent>): void {
|
|
20
|
+
private async onKeyEventUnhandled(
|
|
21
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.KeyEventUnhandledEvent>): Promise<void> {
|
|
20
22
|
const {type, key, keyCode, modifiers} = event.data;
|
|
21
23
|
if (type !== 'keydown') {
|
|
22
24
|
return;
|
|
@@ -26,7 +28,7 @@ export class ForwardedInputEventHandler {
|
|
|
26
28
|
const shortcutRegistry = ShortcutRegistry.instance();
|
|
27
29
|
|
|
28
30
|
context.setFlavor(ForwardedShortcut, ForwardedShortcut.instance);
|
|
29
|
-
shortcutRegistry.handleKey(KeyboardShortcut.makeKey(keyCode, modifiers), key);
|
|
31
|
+
await shortcutRegistry.handleKey(KeyboardShortcut.makeKey(keyCode, modifiers), key);
|
|
30
32
|
context.setFlavor(ForwardedShortcut, null);
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -320,14 +320,12 @@
|
|
|
320
320
|
|
|
321
321
|
.swatch-overlay:hover,
|
|
322
322
|
.swatch-overlay:focus-visible {
|
|
323
|
-
background-color:
|
|
324
|
-
/* See: crbug.com/1152736 for color variable migration. */
|
|
323
|
+
background-color: var(--color-background-inverted-opacity-30);
|
|
325
324
|
opacity: 100%;
|
|
326
325
|
}
|
|
327
326
|
|
|
328
327
|
.swatch-overlay:active {
|
|
329
|
-
background-color:
|
|
330
|
-
/* See: crbug.com/1152736 for color variable migration. */
|
|
328
|
+
background-color: var(--color-background-inverted-opacity-50);
|
|
331
329
|
}
|
|
332
330
|
|
|
333
331
|
[is=ui-icon].icon-mask.copy-color-icon {
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
--color-primary-variant: rgb(66 133 244);
|
|
16
16
|
--color-background: rgb(255 255 255);
|
|
17
17
|
--color-background-inverted: rgb(0 0 0);
|
|
18
|
+
--color-background-inverted-opacity-30: rgb(0 0 0 / 30%);
|
|
19
|
+
--color-background-inverted-opacity-50: rgb(0 0 0 / 50%);
|
|
18
20
|
--color-background-opacity-50: rgb(255 255 255 / 50%);
|
|
19
21
|
--color-background-opacity-80: rgb(255 255 255 / 80%);
|
|
20
22
|
--color-background-elevation-0: rgb(248 249 249);
|
|
@@ -167,6 +169,8 @@
|
|
|
167
169
|
--color-primary-variant: rgb(102 157 246);
|
|
168
170
|
--color-background: rgb(32 33 36);
|
|
169
171
|
--color-background-inverted: rgb(255 255 255);
|
|
172
|
+
--color-background-inverted-opacity-30: rgb(255 255 255 / 30%);
|
|
173
|
+
--color-background-inverted-opacity-50: rgb(255 255 255 / 50%);
|
|
170
174
|
--color-background-opacity-50: rgb(32 33 36 / 50%);
|
|
171
175
|
--color-background-opacity-80: rgb(32 33 36 / 80%);
|
|
172
176
|
--color-background-elevation-0: rgb(32 32 35);
|
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ for (const fileName of filenames) {
|
|
|
22
22
|
// Use of this source code is governed by a BSD-style license that can be
|
|
23
23
|
// found in the LICENSE file.
|
|
24
24
|
// IMPORTANT: this file is auto generated. Please do not edit this file.
|
|
25
|
+
/* istanbul ignore file */
|
|
25
26
|
const styles = new CSSStyleSheet();
|
|
26
27
|
styles.replaceSync(
|
|
27
28
|
\`${isDebug ? output : cleanCSS.minify(output).styles}
|
|
@@ -48,9 +48,7 @@ for (const file of files) {
|
|
|
48
48
|
const newName = `SOME_STUPID_PREFIX_${name}`;
|
|
49
49
|
|
|
50
50
|
property.toggleModifier('private', false);
|
|
51
|
-
property.rename(newName
|
|
52
|
-
renameInComments: true,
|
|
53
|
-
});
|
|
51
|
+
property.rename(newName);
|
|
54
52
|
for (const reference of property.findReferencesAsNodes()) {
|
|
55
53
|
// The first ancestor is the property access on `this.`.
|
|
56
54
|
const containingNode = reference.getAncestors()[1];
|