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.
Files changed (81) hide show
  1. package/config/gni/devtools_grd_files.gni +6 -2
  2. package/front_end/core/common/ParsedURL.ts +12 -10
  3. package/front_end/core/host/InspectorFrontendHostAPI.ts +8 -6
  4. package/front_end/core/i18n/locales/en-US.json +345 -12
  5. package/front_end/core/i18n/locales/en-XL.json +345 -12
  6. package/front_end/core/platform/DevToolsPath.ts +34 -0
  7. package/front_end/core/platform/platform.ts +2 -0
  8. package/front_end/core/protocol_client/NodeURL.ts +2 -1
  9. package/front_end/core/sdk/CSSStyleSheetHeader.ts +4 -2
  10. package/front_end/core/sdk/ChildTargetManager.ts +2 -0
  11. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +4 -2
  12. package/front_end/core/sdk/DebuggerModel.ts +4 -3
  13. package/front_end/core/sdk/NetworkRequest.ts +3 -2
  14. package/front_end/core/sdk/Resource.ts +6 -5
  15. package/front_end/core/sdk/Script.ts +4 -2
  16. package/front_end/core/sdk/Target.ts +4 -0
  17. package/front_end/core/sdk/TracingModel.ts +8 -17
  18. package/front_end/entrypoint_template.html +1 -1
  19. package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +1 -1
  20. package/front_end/models/bindings/BreakpointManager.ts +6 -3
  21. package/front_end/models/bindings/ResourceMapping.ts +2 -1
  22. package/front_end/models/bindings/StylesSourceMapping.ts +2 -1
  23. package/front_end/models/emulation/DeviceModeModel.ts +1 -1
  24. package/front_end/models/persistence/IsolatedFileSystem.ts +9 -7
  25. package/front_end/models/persistence/IsolatedFileSystemManager.ts +8 -7
  26. package/front_end/models/persistence/PersistenceActions.ts +1 -1
  27. package/front_end/models/persistence/PlatformFileSystem.ts +4 -3
  28. package/front_end/models/text_utils/ContentProvider.ts +2 -1
  29. package/front_end/models/text_utils/StaticContentProvider.ts +4 -2
  30. package/front_end/models/workspace/UISourceCode.ts +3 -2
  31. package/front_end/panels/animation/AnimationGroupPreviewUI.ts +25 -25
  32. package/front_end/panels/animation/AnimationModel.ts +157 -156
  33. package/front_end/panels/animation/AnimationScreenshotPopover.ts +26 -26
  34. package/front_end/panels/animation/AnimationTimeline.ts +274 -260
  35. package/front_end/panels/animation/AnimationUI.ts +155 -145
  36. package/front_end/panels/application/BackForwardCacheStrings.ts +621 -0
  37. package/front_end/panels/application/BackForwardCacheView.ts +24 -8
  38. package/front_end/panels/application/ReportingApiReportsView.ts +3 -2
  39. package/front_end/panels/application/ReportingApiView.ts +1 -2
  40. package/front_end/panels/application/backForwardCacheView.css +10 -0
  41. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +48 -40
  42. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +37 -37
  43. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +23 -19
  44. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +56 -56
  45. package/front_end/panels/changes/ChangesView.ts +42 -225
  46. package/front_end/panels/changes/changes-legacy.ts +0 -2
  47. package/front_end/panels/changes/changes.ts +0 -6
  48. package/front_end/panels/changes/changesView.css +2 -69
  49. package/front_end/panels/changes/module.json +1 -1
  50. package/front_end/panels/console/ConsolePinPane.ts +80 -75
  51. package/front_end/panels/console/ConsoleView.ts +1 -9
  52. package/front_end/panels/console/consolePinPane.css +4 -1
  53. package/front_end/panels/elements/StylesSidebarPane.ts +2 -1
  54. package/front_end/panels/security/mainView.css +2 -1
  55. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +2 -1
  56. package/front_end/panels/sources/NavigatorView.ts +5 -2
  57. package/front_end/panels/sources/SourcesPanel.ts +28 -1
  58. package/front_end/panels/sources/sources-meta.ts +1 -4
  59. package/front_end/third_party/codemirror.next/bundle.ts +6 -4
  60. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  61. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  62. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +30 -1
  63. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  64. package/front_end/third_party/codemirror.next/package.json +4 -3
  65. package/front_end/ui/components/buttons/Button.ts +22 -6
  66. package/front_end/ui/components/buttons/button.css +50 -4
  67. package/front_end/ui/components/diff_view/DiffView.ts +288 -0
  68. package/front_end/ui/components/diff_view/diffView.css +73 -0
  69. package/front_end/ui/components/diff_view/diff_view.ts +5 -0
  70. package/front_end/ui/components/docs/button/basic.html +28 -0
  71. package/front_end/ui/components/docs/button/basic.ts +43 -2
  72. package/front_end/ui/components/report_view/report.css +1 -0
  73. package/front_end/ui/components/text_editor/config.ts +34 -1
  74. package/front_end/ui/legacy/ForwardedInputEventHandler.ts +5 -3
  75. package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -4
  76. package/front_end/ui/legacy/themeColors.css +4 -0
  77. package/package.json +1 -1
  78. package/scripts/build/generate_css_js_files.js +1 -0
  79. package/scripts/migration/class-fields/migrate.js +1 -3
  80. package/front_end/panels/changes/ChangesHighlighter.ts +0 -179
  81. package/front_end/panels/changes/ChangesTextEditor.ts +0 -96
@@ -1,179 +0,0 @@
1
- // Copyright 2017 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 type {Row} from './ChangesView.js';
6
- import {RowType} from './ChangesView.js';
7
-
8
- interface ParserConfig {
9
- diffRows: Array<Row>;
10
- baselineLines: Array<string>;
11
- currentLines: Array<string>;
12
- mimeType: string;
13
- }
14
-
15
- // eslint-disable-next-line @typescript-eslint/naming-convention
16
- export function ChangesHighlighter(config: Object, parserConfig: ParserConfig): {
17
- startState: () => DiffState,
18
- token: (arg0: typeof CodeMirror.StringStream, arg1: DiffState) => string,
19
- blankLine: (arg0: DiffState) => string,
20
- copyState: (arg0: DiffState) => DiffState,
21
- } {
22
- const diffRows = parserConfig.diffRows;
23
- const baselineLines = parserConfig.baselineLines;
24
- const currentLines = parserConfig.currentLines;
25
- const syntaxHighlightMode = CodeMirror.getMode({}, parserConfig.mimeType);
26
-
27
- function fastForward(state: DiffState, baselineLineNumber: number, currentLineNumber: number): void {
28
- if (baselineLineNumber > state.baselineLineNumber) {
29
- fastForwardSyntaxHighlighter(
30
- state.baselineSyntaxState, state.baselineLineNumber, baselineLineNumber, baselineLines);
31
- state.baselineLineNumber = baselineLineNumber;
32
- }
33
- if (currentLineNumber > state.currentLineNumber) {
34
- fastForwardSyntaxHighlighter(state.currentSyntaxState, state.currentLineNumber, currentLineNumber, currentLines);
35
- state.currentLineNumber = currentLineNumber;
36
- }
37
- }
38
-
39
- function fastForwardSyntaxHighlighter(syntaxState: Object, from: number, to: number, lines: string[]): void {
40
- let lineNumber = from;
41
- while (lineNumber < to && lineNumber < lines.length) {
42
- const stream = new CodeMirror.StringStream(lines[lineNumber]);
43
- if (stream.eol() && syntaxHighlightMode.blankLine) {
44
- syntaxHighlightMode.blankLine(syntaxState);
45
- }
46
- while (!stream.eol()) {
47
- if (syntaxHighlightMode.token) {
48
- syntaxHighlightMode.token(stream, syntaxState);
49
- }
50
- stream.start = stream.pos;
51
- }
52
- lineNumber++;
53
- }
54
- }
55
-
56
- return {
57
- startState: function(): DiffState {
58
- return {
59
- rowNumber: 0,
60
- diffTokenIndex: 0,
61
- currentLineNumber: 0,
62
- baselineLineNumber: 0,
63
- currentSyntaxState: CodeMirror.startState(syntaxHighlightMode),
64
- baselineSyntaxState: CodeMirror.startState(syntaxHighlightMode),
65
- syntaxPosition: 0,
66
- diffPosition: 0,
67
- syntaxStyle: '',
68
- diffStyle: '',
69
- };
70
- },
71
-
72
- token: function(stream: typeof CodeMirror.StringStream, state: DiffState): string {
73
- const diffRow = diffRows[state.rowNumber];
74
- if (!diffRow) {
75
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
76
- stream.next();
77
- return '';
78
- }
79
- fastForward(state, diffRow.baselineLineNumber - 1, diffRow.currentLineNumber - 1);
80
- let classes = '';
81
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
82
- if (stream.pos === 0) {
83
- classes += ' line-background-' + diffRow.type + ' line-' + diffRow.type;
84
- }
85
-
86
- const syntaxHighlighterNeedsRefresh = state.diffPosition >= state.syntaxPosition;
87
- if (state.diffPosition <= state.syntaxPosition) {
88
- state.diffPosition += diffRow.tokens[state.diffTokenIndex].text.length;
89
- state.diffStyle = diffRow.tokens[state.diffTokenIndex].className;
90
- state.diffTokenIndex++;
91
- }
92
-
93
- if (syntaxHighlighterNeedsRefresh) {
94
- if (syntaxHighlightMode.token &&
95
- (diffRow.type === RowType.Deletion || diffRow.type === RowType.Addition ||
96
- diffRow.type === RowType.Equal)) {
97
- state.syntaxStyle =
98
- syntaxHighlightMode.token(
99
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
100
- stream, diffRow.type === RowType.Deletion ? state.baselineSyntaxState : state.currentSyntaxState) ||
101
- '';
102
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
103
- state.syntaxPosition = stream.pos;
104
- } else {
105
- state.syntaxStyle = '';
106
- state.syntaxPosition = Infinity;
107
- }
108
- }
109
-
110
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
111
- stream.pos = Math.min(state.syntaxPosition, state.diffPosition);
112
- classes += ' ' + state.syntaxStyle;
113
- classes += ' ' + state.diffStyle;
114
-
115
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
116
- if (stream.eol()) {
117
- state.rowNumber++;
118
- if (diffRow.type === RowType.Deletion) {
119
- state.baselineLineNumber++;
120
- } else {
121
- state.currentLineNumber++;
122
- }
123
- state.diffPosition = 0;
124
- state.syntaxPosition = 0;
125
- state.diffTokenIndex = 0;
126
- }
127
- return classes;
128
- },
129
-
130
- blankLine: function(state: DiffState): string {
131
- const diffRow = diffRows[state.rowNumber];
132
- state.rowNumber++;
133
- state.syntaxPosition = 0;
134
- state.diffPosition = 0;
135
- state.diffTokenIndex = 0;
136
- if (!diffRow) {
137
- return '';
138
- }
139
-
140
- let style: void|'' = '';
141
- if (syntaxHighlightMode.blankLine) {
142
- if (diffRow.type === RowType.Equal || diffRow.type === RowType.Addition) {
143
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
144
- style = syntaxHighlightMode.blankLine(state.currentSyntaxState);
145
- state.currentLineNumber++;
146
- } else if (diffRow.type === RowType.Deletion) {
147
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
148
- style = syntaxHighlightMode.blankLine(state.baselineSyntaxState);
149
- state.baselineLineNumber++;
150
- }
151
- }
152
- return style + ' line-background-' + diffRow.type + ' line-' + diffRow.type;
153
- },
154
-
155
- copyState: function(state: DiffState): DiffState {
156
- const newState = Object.assign({}, state);
157
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
158
- newState.currentSyntaxState = CodeMirror.copyState(syntaxHighlightMode, state.currentSyntaxState);
159
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
160
- newState.baselineSyntaxState = CodeMirror.copyState(syntaxHighlightMode, state.baselineSyntaxState);
161
- return /** @type {!DiffState} */ newState as DiffState;
162
- },
163
- };
164
- }
165
-
166
- // @ts-ignore TODO(crbug.com/1011811): Fix after upstream CodeMirror type fixes
167
- CodeMirror.defineMode('devtools-diff', ChangesHighlighter);
168
- export interface DiffState {
169
- rowNumber: number;
170
- diffTokenIndex: number;
171
- currentLineNumber: number;
172
- baselineLineNumber: number;
173
- currentSyntaxState: Object;
174
- baselineSyntaxState: Object;
175
- syntaxPosition: number;
176
- diffPosition: number;
177
- syntaxStyle: string;
178
- diffStyle: string;
179
- }
@@ -1,96 +0,0 @@
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 TextEditor from '../../ui/legacy/components/text_editor/text_editor.js';
7
- import type * as UI from '../../ui/legacy/legacy.js';
8
-
9
- import type {Row} from './ChangesView.js';
10
- import {RowType} from './ChangesView.js';
11
-
12
- const UIStrings = {
13
- /**
14
- *@description Text prepended to a removed line in a diff in the Changes tool, viewable only by screen reader.
15
- *@example {function log () } PH1
16
- */
17
- deletions: 'Deletion:{PH1}',
18
- /**
19
- *@description Text prepended to a new line in a diff in the Changes tool, viewable only by screen reader.
20
- *@example {function log () } PH1
21
- */
22
- additions: 'Addition:{PH1}',
23
- };
24
- const str_ = i18n.i18n.registerUIStrings('panels/changes/ChangesTextEditor.ts', UIStrings);
25
- const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
26
-
27
- export class ChangesTextEditor extends TextEditor.CodeMirrorTextEditor.CodeMirrorTextEditor {
28
- constructor(options: UI.TextEditor.Options) {
29
- options.inputStyle = 'devToolsAccessibleDiffTextArea';
30
- super(options);
31
- this.codeMirror().setOption('gutters', ['CodeMirror-linenumbers', 'changes-diff-gutter']);
32
- this.codeMirror().setOption('extraKeys', {
33
- Enter: false,
34
- Space: false,
35
- Left: function(cm: CodeMirror.Editor): void {
36
- const scrollInfo = cm.getScrollInfo();
37
- // Left edge check required due to bug where line numbers would disappear when attempting to scroll left when the scrollbar is at the leftmost point.
38
- // CodeMirror Issue: https://github.com/codemirror/CodeMirror/issues/6139
39
- if (scrollInfo.left > 0) {
40
- cm.scrollTo(scrollInfo.left - Math.round(scrollInfo.clientWidth / 6), null);
41
- }
42
- },
43
- Right: function(cm: CodeMirror.Editor): void {
44
- const scrollInfo = cm.getScrollInfo();
45
- cm.scrollTo(scrollInfo.left + Math.round(scrollInfo.clientWidth / 6), null);
46
- },
47
- });
48
- }
49
-
50
- updateDiffGutter(diffRows: Row[]): void {
51
- this.codeMirror().eachLine((line: CodeMirror.LineHandle): void => {
52
- const lineNumber = this.codeMirror().getLineNumber(line);
53
- const row = diffRows[lineNumber];
54
- let gutterMarker;
55
- if (row.type === RowType.Deletion) {
56
- gutterMarker = document.createElement('div');
57
- gutterMarker.classList.add('deletion');
58
- gutterMarker.classList.add('changes-diff-gutter-marker');
59
- gutterMarker.textContent = '-';
60
- } else if (row.type === RowType.Addition) {
61
- gutterMarker = document.createElement('div');
62
- gutterMarker.classList.add('addition');
63
- gutterMarker.classList.add('changes-diff-gutter-marker');
64
- gutterMarker.textContent = '+';
65
- }
66
- if (gutterMarker) {
67
- this.codeMirror().setGutterMarker(line, 'changes-diff-gutter', gutterMarker);
68
- }
69
- });
70
- }
71
- }
72
-
73
- export class DevToolsAccessibleDiffTextArea extends TextEditor.CodeMirrorTextEditor.DevToolsAccessibleTextArea {
74
- reset(typing?: boolean): void {
75
- super.reset(typing);
76
- const doc = this.cm.doc;
77
- if (this.textAreaBusy(Boolean(typing)) || !(typeof doc.modeOption === 'object')) {
78
- return;
79
- }
80
-
81
- const diffRows = doc.modeOption.diffRows;
82
- const lineNumber = this.cm.getCursor().line;
83
- const rowType = diffRows[lineNumber].type;
84
-
85
- if (rowType === RowType.Deletion) {
86
- this.textarea.value = i18nString(UIStrings.deletions, {PH1: this.textarea.value});
87
- }
88
- if (rowType === RowType.Addition) {
89
- this.textarea.value = i18nString(UIStrings.additions, {PH1: this.textarea.value});
90
- }
91
- this.prevInput = this.textarea.value;
92
- }
93
- }
94
-
95
- // @ts-ignore CodeMirror integration with externals, not yet part of codemirror-legacy.d.ts
96
- CodeMirror.inputStyles.devToolsAccessibleDiffTextArea = DevToolsAccessibleDiffTextArea;