chrome-devtools-frontend 1.0.943017 → 1.0.944427
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/all_devtools_files.gni +0 -9
- package/config/gni/devtools_grd_files.gni +6 -1
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/i18n/locales/af.json +455 -44
- package/front_end/core/i18n/locales/am.json +455 -44
- package/front_end/core/i18n/locales/ar.json +455 -44
- package/front_end/core/i18n/locales/as.json +455 -44
- package/front_end/core/i18n/locales/az.json +455 -44
- package/front_end/core/i18n/locales/be.json +456 -45
- package/front_end/core/i18n/locales/bg.json +455 -44
- package/front_end/core/i18n/locales/bn.json +455 -44
- package/front_end/core/i18n/locales/bs.json +455 -44
- package/front_end/core/i18n/locales/ca.json +457 -46
- package/front_end/core/i18n/locales/cs.json +458 -47
- package/front_end/core/i18n/locales/cy.json +455 -44
- package/front_end/core/i18n/locales/da.json +455 -44
- package/front_end/core/i18n/locales/de.json +455 -44
- package/front_end/core/i18n/locales/el.json +455 -44
- package/front_end/core/i18n/locales/en-GB.json +449 -38
- package/front_end/core/i18n/locales/en-US.json +7 -19
- package/front_end/core/i18n/locales/en-XL.json +7 -19
- package/front_end/core/i18n/locales/es-419.json +455 -44
- package/front_end/core/i18n/locales/es.json +455 -44
- package/front_end/core/i18n/locales/et.json +455 -44
- package/front_end/core/i18n/locales/eu.json +462 -51
- package/front_end/core/i18n/locales/fa.json +455 -44
- package/front_end/core/i18n/locales/fi.json +455 -44
- package/front_end/core/i18n/locales/fil.json +454 -43
- package/front_end/core/i18n/locales/fr-CA.json +455 -44
- package/front_end/core/i18n/locales/fr.json +456 -45
- package/front_end/core/i18n/locales/gl.json +455 -44
- package/front_end/core/i18n/locales/gu.json +456 -45
- package/front_end/core/i18n/locales/he.json +455 -44
- package/front_end/core/i18n/locales/hi.json +455 -44
- package/front_end/core/i18n/locales/hr.json +455 -44
- package/front_end/core/i18n/locales/hu.json +455 -44
- package/front_end/core/i18n/locales/hy.json +455 -44
- package/front_end/core/i18n/locales/id.json +455 -44
- package/front_end/core/i18n/locales/is.json +455 -44
- package/front_end/core/i18n/locales/it.json +502 -91
- package/front_end/core/i18n/locales/ja.json +456 -45
- package/front_end/core/i18n/locales/ka.json +455 -44
- package/front_end/core/i18n/locales/kk.json +456 -45
- package/front_end/core/i18n/locales/km.json +455 -44
- package/front_end/core/i18n/locales/kn.json +455 -44
- package/front_end/core/i18n/locales/ko.json +455 -44
- package/front_end/core/i18n/locales/ky.json +456 -45
- package/front_end/core/i18n/locales/lo.json +454 -43
- package/front_end/core/i18n/locales/lt.json +455 -44
- package/front_end/core/i18n/locales/lv.json +458 -47
- package/front_end/core/i18n/locales/mk.json +455 -44
- package/front_end/core/i18n/locales/ml.json +461 -50
- package/front_end/core/i18n/locales/mn.json +455 -44
- package/front_end/core/i18n/locales/mr.json +455 -44
- package/front_end/core/i18n/locales/ms.json +455 -44
- package/front_end/core/i18n/locales/my.json +456 -45
- package/front_end/core/i18n/locales/ne.json +456 -45
- package/front_end/core/i18n/locales/nl.json +532 -121
- package/front_end/core/i18n/locales/no.json +455 -44
- package/front_end/core/i18n/locales/or.json +455 -44
- package/front_end/core/i18n/locales/pa.json +455 -44
- package/front_end/core/i18n/locales/pl.json +455 -44
- package/front_end/core/i18n/locales/pt-PT.json +504 -93
- package/front_end/core/i18n/locales/pt.json +454 -43
- package/front_end/core/i18n/locales/ro.json +455 -44
- package/front_end/core/i18n/locales/ru.json +455 -44
- package/front_end/core/i18n/locales/si.json +455 -44
- package/front_end/core/i18n/locales/sk.json +456 -45
- package/front_end/core/i18n/locales/sl.json +455 -44
- package/front_end/core/i18n/locales/sq.json +455 -44
- package/front_end/core/i18n/locales/sr-Latn.json +455 -44
- package/front_end/core/i18n/locales/sr.json +455 -44
- package/front_end/core/i18n/locales/sv.json +456 -45
- package/front_end/core/i18n/locales/sw.json +455 -44
- package/front_end/core/i18n/locales/ta.json +456 -45
- package/front_end/core/i18n/locales/te.json +454 -43
- package/front_end/core/i18n/locales/th.json +455 -44
- package/front_end/core/i18n/locales/tr.json +455 -44
- package/front_end/core/i18n/locales/uk.json +455 -44
- package/front_end/core/i18n/locales/ur.json +455 -44
- package/front_end/core/i18n/locales/uz.json +455 -44
- package/front_end/core/i18n/locales/vi.json +455 -44
- package/front_end/core/i18n/locales/zh-HK.json +459 -48
- package/front_end/core/i18n/locales/zh-TW.json +457 -46
- package/front_end/core/i18n/locales/zh.json +460 -49
- package/front_end/core/i18n/locales/zu.json +455 -44
- package/front_end/core/protocol_client/InspectorBackend.ts +4 -0
- package/front_end/core/sdk/AccessibilityModel.ts +99 -78
- package/front_end/core/sdk/CSSStyleDeclaration.ts +4 -0
- package/front_end/core/sdk/ConsoleModel.ts +1 -5
- package/front_end/core/sdk/NetworkManager.ts +3 -0
- package/front_end/core/sdk/OverlayModel.ts +0 -9
- package/front_end/core/sdk/Script.ts +0 -4
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +13 -12
- package/front_end/core/sdk/sdk-meta.ts +0 -26
- package/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.ts +1 -1
- package/front_end/entrypoints/devtools_app/devtools_app.js +1 -1
- package/front_end/entrypoints/devtools_app/devtools_app.json +1 -2
- package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -1
- package/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.ts +1 -1
- package/front_end/entrypoints/inspector/inspector.js +1 -1
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +0 -13
- package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +2 -3
- package/front_end/entrypoints/js_app/js_app.js +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +2 -4
- package/front_end/entrypoints/main/main-meta.ts +1 -2
- package/front_end/entrypoints/ndb_app/ndb_app.js +1 -1
- package/front_end/entrypoints/node_app/node_app-meta.ts +0 -2
- package/front_end/entrypoints/node_app/node_app.js +1 -1
- package/front_end/entrypoints/node_main/node_main-meta.ts +0 -1
- package/front_end/entrypoints/shell/shell.json +1 -2
- package/front_end/entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.ts +1 -1
- package/front_end/entrypoints/worker_app/worker_app.js +1 -1
- package/front_end/generated/InspectorBackendCommands.js +3 -1
- package/front_end/generated/protocol-mapping.d.ts +1 -0
- package/front_end/generated/protocol-proxy-api.d.ts +2 -0
- package/front_end/generated/protocol.d.ts +40 -0
- package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +5 -1
- package/front_end/models/bindings/DefaultScriptMapping.ts +1 -9
- package/front_end/models/bindings/ResourceScriptMapping.ts +3 -11
- package/front_end/models/formatter/SourceFormatter.ts +0 -15
- package/front_end/models/persistence/persistence-meta.ts +0 -1
- package/front_end/models/timeline_model/TimelineJSProfile.ts +3 -16
- package/front_end/models/timeline_model/TimelineModel.ts +0 -1
- package/front_end/panels/accessibility/accessibility-meta.ts +0 -1
- package/front_end/panels/animation/animation-meta.ts +0 -1
- package/front_end/panels/application/ApplicationPanelCacheSection.ts +1 -1
- package/front_end/panels/application/BackForwardCacheView.ts +26 -26
- package/front_end/panels/application/application-meta.ts +0 -1
- package/front_end/panels/application/components/stackTraceRow.css +8 -0
- package/front_end/panels/browser_debugger/browser_debugger-meta.ts +1 -2
- package/front_end/panels/changes/changes-meta.ts +0 -1
- package/front_end/panels/console/ConsolePinPane.ts +3 -6
- package/front_end/panels/console/ConsolePrompt.ts +121 -171
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +8 -1
- package/front_end/panels/console/console-meta.ts +0 -1
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/console_counters/console_counters-meta.ts +0 -1
- package/front_end/panels/coverage/coverage-meta.ts +0 -1
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +2 -2
- package/front_end/panels/css_overview/css_overview-meta.ts +0 -1
- package/front_end/panels/developer_resources/developer_resources-meta.ts +0 -1
- package/front_end/panels/elements/AccessibilityTreeUtils.ts +98 -67
- package/front_end/panels/elements/AccessibilityTreeView.ts +76 -125
- package/front_end/panels/elements/ElementsPanel.ts +6 -7
- package/front_end/panels/elements/ElementsTreeElement.ts +1 -0
- package/front_end/panels/elements/StyleEditorWidget.ts +13 -2
- package/front_end/panels/elements/StylePropertyHighlighter.ts +29 -19
- package/front_end/panels/elements/StylePropertyTreeElement.ts +7 -4
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +27 -3
- package/front_end/panels/elements/elements-meta.ts +0 -1
- package/front_end/panels/emulation/emulation-meta.ts +0 -1
- package/front_end/panels/help/help-meta.ts +0 -1
- package/front_end/panels/input/input-meta.ts +0 -1
- package/front_end/panels/issues/issues-meta.ts +0 -1
- package/front_end/panels/js_profiler/js_profiler-meta.ts +0 -1
- package/front_end/panels/layers/layers-meta.ts +0 -4
- package/front_end/panels/lighthouse/lighthouse-meta.ts +0 -1
- package/front_end/panels/media/media-meta.ts +0 -1
- package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +0 -1
- package/front_end/panels/network/NetworkDataGridNode.ts +5 -1
- package/front_end/panels/network/network-meta.ts +1 -2
- package/front_end/panels/performance_monitor/performance_monitor-meta.ts +0 -1
- package/front_end/panels/profiler/profiler-meta.ts +0 -1
- package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +0 -1
- package/front_end/panels/screencast/screencast-meta.ts +0 -1
- package/front_end/panels/security/security-meta.ts +0 -1
- package/front_end/panels/sensors/sensors-meta.ts +0 -1
- package/front_end/panels/settings/emulation/emulation-meta.ts +0 -1
- package/front_end/panels/settings/settings-meta.ts +0 -1
- package/front_end/panels/sources/BreakpointEditDialog.ts +1 -0
- package/front_end/panels/sources/Plugin.ts +0 -3
- package/front_end/panels/sources/UISourceCodeFrame.ts +23 -49
- package/front_end/panels/sources/sources-meta.ts +1 -2
- package/front_end/panels/timeline/TimelineController.ts +0 -3
- package/front_end/panels/timeline/timeline-meta.ts +2 -4
- package/front_end/panels/web_audio/web_audio-meta.ts +0 -1
- package/front_end/panels/webauthn/webauthn-meta.ts +0 -1
- package/front_end/third_party/codemirror.next/bundle.ts +3 -2
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +32 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +3 -3
- package/front_end/ui/components/docs/component_docs.ts +14 -0
- package/front_end/ui/components/docs/create_breadcrumbs.ts +1 -1
- package/front_end/ui/components/docs/toggle_dark_mode.ts +1 -0
- package/front_end/ui/components/docs/toggle_fonts.ts +2 -0
- package/front_end/ui/components/helpers/get-stylesheet.ts +0 -1
- package/front_end/ui/components/linear_memory_inspector/linear_memory_inspector-meta.ts +1 -2
- package/front_end/ui/components/text_editor/config.ts +34 -14
- package/front_end/ui/components/text_editor/javascript.ts +14 -9
- package/front_end/ui/components/text_editor/theme.ts +29 -4
- package/front_end/ui/components/tree_outline/TreeOutline.ts +71 -8
- package/front_end/ui/components/tree_outline/TreeOutlineUtils.ts +8 -6
- package/front_end/ui/legacy/Dialog.ts +8 -3
- package/front_end/ui/legacy/SoftContextMenu.ts +1 -1
- package/front_end/ui/legacy/Treeoutline.ts +1 -1
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/components/inline_editor/CSSAngle.ts +1 -2
- package/front_end/ui/legacy/components/inline_editor/cssAngle.css +4 -0
- package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +2 -2
- package/front_end/ui/legacy/components/object_ui/object_ui-meta.ts +0 -1
- package/front_end/ui/legacy/components/perf_ui/perf_ui-meta.ts +0 -1
- package/front_end/ui/legacy/components/quick_open/quick_open-meta.ts +2 -3
- package/front_end/ui/legacy/components/source_frame/FontView.ts +3 -1
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +3 -1
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +3 -1
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +2 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +6 -4
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +5 -2
- package/front_end/ui/legacy/components/utils/Linkifier.ts +49 -79
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/inspector_overlay/css_grid_label_helpers.ts +1 -1
- package/inspector_overlay/highlight_common.ts +1 -1
- package/inspector_overlay/tool_highlight.ts +1 -1
- package/package.json +1 -1
- package/scripts/check_gn.js +0 -35
- package/scripts/eslint_rules/lib/es_modules_import.js +15 -24
- package/scripts/eslint_rules/tests/es_modules_import_test.js +8 -16
- package/front_end/panels/layers/module.json +0 -4
- package/front_end/ui/legacy/components/source_frame/messagesPopover.css +0 -32
- package/front_end/ui/legacy/components/source_frame/module.json +0 -11
|
@@ -6,9 +6,9 @@ import * as Common from '../../core/common/common.js';
|
|
|
6
6
|
import * as Host from '../../core/host/host.js';
|
|
7
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
8
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
9
|
-
import * as
|
|
9
|
+
import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
10
|
+
import * as TextEditor from '../../ui/components/text_editor/text_editor.js';
|
|
10
11
|
import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
|
|
11
|
-
import * as TextEditor from '../../ui/legacy/components/text_editor/text_editor.js';
|
|
12
12
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
13
13
|
|
|
14
14
|
import {ConsolePanel} from './ConsolePanel.js';
|
|
@@ -27,17 +27,17 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
|
27
27
|
private addCompletionsFromHistory: boolean;
|
|
28
28
|
private historyInternal: ConsoleHistoryManager;
|
|
29
29
|
private initialText: string;
|
|
30
|
-
private editor:
|
|
30
|
+
private editor: TextEditor.TextEditor.TextEditor;
|
|
31
31
|
private readonly eagerPreviewElement: HTMLDivElement;
|
|
32
32
|
private textChangeThrottler: Common.Throttler.Throttler;
|
|
33
33
|
private readonly formatter: ObjectUI.RemoteObjectPreviewFormatter.RemoteObjectPreviewFormatter;
|
|
34
34
|
private requestPreviewBound: () => Promise<void>;
|
|
35
|
+
private requestPreviewCurrent = 0;
|
|
35
36
|
private readonly innerPreviewElement: HTMLElement;
|
|
36
37
|
private readonly promptIcon: UI.Icon.Icon;
|
|
37
38
|
private readonly iconThrottler: Common.Throttler.Throttler;
|
|
38
39
|
private readonly eagerEvalSetting: Common.Settings.Setting<boolean>;
|
|
39
40
|
private previewRequestForTest: Promise<void>|null;
|
|
40
|
-
private defaultAutocompleteConfig: UI.TextEditor.AutocompleteConfig|null;
|
|
41
41
|
private highlightingNode: boolean;
|
|
42
42
|
|
|
43
43
|
constructor() {
|
|
@@ -46,7 +46,6 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
|
46
46
|
this.historyInternal = new ConsoleHistoryManager();
|
|
47
47
|
|
|
48
48
|
this.initialText = '';
|
|
49
|
-
this.editor = null;
|
|
50
49
|
this.eagerPreviewElement = document.createElement('div');
|
|
51
50
|
this.eagerPreviewElement.classList.add('console-eager-preview');
|
|
52
51
|
this.textChangeThrottler = new Common.Throttler.Throttler(150);
|
|
@@ -68,41 +67,41 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
|
68
67
|
|
|
69
68
|
this.element.tabIndex = 0;
|
|
70
69
|
this.previewRequestForTest = null;
|
|
70
|
+
this.highlightingNode = false;
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
const editorState = CodeMirror.EditorState.create({
|
|
73
|
+
doc: this.initialText,
|
|
74
|
+
extensions: [
|
|
75
|
+
CodeMirror.keymap.of(this.editorKeymap()),
|
|
76
|
+
CodeMirror.EditorView.updateListener.of(update => this.editorUpdate(update)),
|
|
77
|
+
TextEditor.JavaScript.argumentHints(),
|
|
78
|
+
TextEditor.JavaScript.completion(),
|
|
79
|
+
TextEditor.Config.showCompletionHint,
|
|
80
|
+
CodeMirror.javascript.javascript(),
|
|
81
|
+
TextEditor.Config.baseConfiguration(this.initialText),
|
|
82
|
+
TextEditor.Config.autocompletion,
|
|
83
|
+
CodeMirror.javascript.javascriptLanguage.data.of({
|
|
84
|
+
autocomplete: (context: CodeMirror.CompletionContext): CodeMirror.CompletionResult | null =>
|
|
85
|
+
this.historyCompletions(context),
|
|
86
|
+
}),
|
|
87
|
+
CodeMirror.EditorView.contentAttributes.of({'aria-label': i18nString(UIStrings.consolePrompt)}),
|
|
88
|
+
CodeMirror.EditorView.lineWrapping,
|
|
89
|
+
CodeMirror.autocompletion({aboveCursor: true}),
|
|
90
|
+
],
|
|
91
|
+
});
|
|
73
92
|
|
|
74
|
-
this.
|
|
93
|
+
this.editor = new TextEditor.TextEditor.TextEditor(editorState);
|
|
94
|
+
this.editor.addEventListener('keydown', (event): void => {
|
|
95
|
+
if (event.defaultPrevented) {
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
editorContainerElement.appendChild(this.editor);
|
|
75
100
|
|
|
76
|
-
const factory = TextEditor.CodeMirrorTextEditor.CodeMirrorTextEditorFactory.instance();
|
|
77
|
-
|
|
78
|
-
const options = {
|
|
79
|
-
devtoolsAccessibleName: (i18nString(UIStrings.consolePrompt) as string),
|
|
80
|
-
lineNumbers: false,
|
|
81
|
-
lineWrapping: true,
|
|
82
|
-
mimeType: 'javascript',
|
|
83
|
-
autoHeight: true,
|
|
84
|
-
};
|
|
85
|
-
this.editor = factory.createEditor((options as UI.TextEditor.Options));
|
|
86
|
-
|
|
87
|
-
this.defaultAutocompleteConfig =
|
|
88
|
-
ObjectUI.JavaScriptAutocomplete.JavaScriptAutocompleteConfig.createConfigForEditor(this.editor);
|
|
89
|
-
this.editor.configureAutocomplete(Object.assign({}, this.defaultAutocompleteConfig, {
|
|
90
|
-
suggestionsCallback: this.wordsWithQuery.bind(this),
|
|
91
|
-
anchorBehavior: UI.GlassPane.AnchorBehavior.PreferTop,
|
|
92
|
-
}));
|
|
93
|
-
this.editor.widget().element.addEventListener('keydown', this.editorKeyDown.bind(this), true);
|
|
94
|
-
this.editor.widget().show(editorContainerElement);
|
|
95
|
-
this.editor.addEventListener(UI.TextEditor.Events.CursorChanged, this.updatePromptIcon, this);
|
|
96
|
-
this.editor.addEventListener(UI.TextEditor.Events.TextChanged, this.onTextChanged, this);
|
|
97
|
-
this.editor.addEventListener(UI.TextEditor.Events.SuggestionChanged, this.onTextChanged, this);
|
|
98
|
-
|
|
99
|
-
this.setText(this.initialText);
|
|
100
|
-
this.initialText = '';
|
|
101
101
|
if (this.hasFocus()) {
|
|
102
102
|
this.focus();
|
|
103
103
|
}
|
|
104
104
|
this.element.removeAttribute('tabindex');
|
|
105
|
-
this.editor.widget().element.tabIndex = -1;
|
|
106
105
|
|
|
107
106
|
this.editorSetForTest();
|
|
108
107
|
|
|
@@ -126,7 +125,7 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
|
126
125
|
// ConsoleView and prompt both use a throttler, so we clear the preview
|
|
127
126
|
// ASAP to avoid inconsistency between a fresh viewport and stale preview.
|
|
128
127
|
if (this.eagerEvalSetting.get()) {
|
|
129
|
-
const asSoonAsPossible = !this.editor
|
|
128
|
+
const asSoonAsPossible = !TextEditor.Config.contentIncludingHint(this.editor.editor);
|
|
130
129
|
this.previewRequestForTest = this.textChangeThrottler.schedule(this.requestPreviewBound, asSoonAsPossible);
|
|
131
130
|
}
|
|
132
131
|
this.updatePromptIcon();
|
|
@@ -134,15 +133,16 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
private async requestPreview(): Promise<void> {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
const text = this.editor.textWithCurrentSuggestion().trim();
|
|
136
|
+
const id = ++this.requestPreviewCurrent;
|
|
137
|
+
const text = TextEditor.Config.contentIncludingHint(this.editor.editor).trim();
|
|
141
138
|
const executionContext = UI.Context.Context.instance().flavor(SDK.RuntimeModel.ExecutionContext);
|
|
142
139
|
const {preview, result} = await ObjectUI.JavaScriptREPL.JavaScriptREPL.evaluateAndBuildPreview(
|
|
143
140
|
text, true /* throwOnSideEffect */, true /* replMode */, 500 /* timeout */);
|
|
141
|
+
if (this.requestPreviewCurrent !== id) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
144
|
this.innerPreviewElement.removeChildren();
|
|
145
|
-
if (preview.deepTextContent() !== this.editor.
|
|
145
|
+
if (preview.deepTextContent() !== TextEditor.Config.contentIncludingHint(this.editor.editor).trim()) {
|
|
146
146
|
this.innerPreviewElement.appendChild(preview);
|
|
147
147
|
}
|
|
148
148
|
if (result && 'object' in result && result.object && result.object.subtype === 'node') {
|
|
@@ -174,149 +174,102 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
clearAutocomplete(): void {
|
|
177
|
-
|
|
178
|
-
this.editor.clearAutocomplete();
|
|
179
|
-
}
|
|
177
|
+
CodeMirror.closeCompletion(this.editor.editor);
|
|
180
178
|
}
|
|
181
179
|
|
|
182
180
|
private isCaretAtEndOfPrompt(): boolean {
|
|
183
|
-
return this.editor
|
|
184
|
-
this.editor.selection().collapseToEnd().equal(this.editor.fullRange().collapseToEnd());
|
|
181
|
+
return this.editor.state.selection.main.head === this.editor.state.doc.length;
|
|
185
182
|
}
|
|
186
183
|
|
|
187
184
|
moveCaretToEndOfPrompt(): void {
|
|
188
|
-
|
|
189
|
-
this.editor.
|
|
190
|
-
}
|
|
185
|
+
this.editor.dispatch({
|
|
186
|
+
selection: CodeMirror.EditorSelection.cursor(this.editor.state.doc.length),
|
|
187
|
+
});
|
|
191
188
|
}
|
|
192
189
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
this.editor.
|
|
196
|
-
}
|
|
197
|
-
this.initialText = text;
|
|
198
|
-
}
|
|
199
|
-
this.dispatchEventToListeners(Events.TextChanged);
|
|
190
|
+
clear(): void {
|
|
191
|
+
this.editor.dispatch({
|
|
192
|
+
changes: {from: 0, to: this.editor.state.doc.length},
|
|
193
|
+
});
|
|
200
194
|
}
|
|
201
195
|
|
|
202
196
|
text(): string {
|
|
203
|
-
return this.editor
|
|
197
|
+
return this.editor.state.doc.toString();
|
|
204
198
|
}
|
|
205
199
|
|
|
206
200
|
setAddCompletionsFromHistory(value: boolean): void {
|
|
207
201
|
this.addCompletionsFromHistory = value;
|
|
208
202
|
}
|
|
209
203
|
|
|
210
|
-
private
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
newText = this.historyInternal.previous(this.text());
|
|
228
|
-
isPrevious = true;
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
case UI.KeyboardShortcut.Keys.Down.code: {
|
|
232
|
-
const fullRange = this.editor.fullRange();
|
|
233
|
-
const endY = this.editor.visualCoordinates(fullRange.endLine, fullRange.endColumn).y;
|
|
234
|
-
if (keyboardEvent.shiftKey || !selection.isEmpty() || cursorY !== endY) {
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
newText = this.historyInternal.next();
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
case UI.KeyboardShortcut.Keys.P.code: { // Ctrl+P = Previous
|
|
241
|
-
if (Host.Platform.isMac() && keyboardEvent.ctrlKey && !keyboardEvent.metaKey && !keyboardEvent.altKey &&
|
|
242
|
-
!keyboardEvent.shiftKey) {
|
|
243
|
-
newText = this.historyInternal.previous(this.text());
|
|
244
|
-
isPrevious = true;
|
|
245
|
-
}
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
case UI.KeyboardShortcut.Keys.N.code: { // Ctrl+N = Next
|
|
249
|
-
if (Host.Platform.isMac() && keyboardEvent.ctrlKey && !keyboardEvent.metaKey && !keyboardEvent.altKey &&
|
|
250
|
-
!keyboardEvent.shiftKey) {
|
|
251
|
-
newText = this.historyInternal.next();
|
|
252
|
-
}
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
case UI.KeyboardShortcut.Keys.Enter.code: {
|
|
256
|
-
this.enterKeyPressed(keyboardEvent);
|
|
257
|
-
break;
|
|
204
|
+
private editorKeymap(): readonly CodeMirror.KeyBinding[] {
|
|
205
|
+
return [
|
|
206
|
+
{key: 'ArrowUp', run: (): boolean => this.moveHistory(-1)},
|
|
207
|
+
{key: 'ArrowDown', run: (): boolean => this.moveHistory(1)},
|
|
208
|
+
{mac: 'Ctrl-p', run: (): boolean => this.moveHistory(-1, true)},
|
|
209
|
+
{mac: 'Ctrl-n', run: (): boolean => this.moveHistory(1, true)},
|
|
210
|
+
{key: 'Enter', run: (): boolean => this.evaluate(), shift: CodeMirror.insertNewlineAndIndent},
|
|
211
|
+
];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private moveHistory(dir: -1|1, force = false): boolean {
|
|
215
|
+
const {editor} = this.editor, {main} = editor.state.selection;
|
|
216
|
+
if (!force) {
|
|
217
|
+
if (!main.empty) {
|
|
218
|
+
return false;
|
|
258
219
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
220
|
+
const cursorCoords = editor.coordsAtPos(main.head);
|
|
221
|
+
const endCoords = editor.coordsAtPos(dir < 0 ? 0 : editor.state.doc.length);
|
|
222
|
+
// Check if there are wrapped lines in this direction, and let
|
|
223
|
+
// the cursor move normally if there are.
|
|
224
|
+
if (cursorCoords && endCoords &&
|
|
225
|
+
(dir < 0 ? cursorCoords.top > endCoords.top + 5 : cursorCoords.bottom < endCoords.bottom - 5)) {
|
|
226
|
+
return false;
|
|
264
227
|
}
|
|
265
228
|
}
|
|
266
229
|
|
|
230
|
+
const history = this.historyInternal;
|
|
231
|
+
const newText = dir < 0 ? history.previous(this.text()) : history.next();
|
|
267
232
|
if (newText === undefined) {
|
|
268
|
-
return;
|
|
233
|
+
return false;
|
|
269
234
|
}
|
|
270
|
-
keyboardEvent.consume(true);
|
|
271
|
-
this.setText(newText);
|
|
272
235
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
236
|
+
const cursorPos = dir < 0 ? newText.search(/\n|$/) : newText.length;
|
|
237
|
+
this.editor.dispatch({
|
|
238
|
+
changes: {from: 0, to: this.editor.state.doc.length, insert: newText},
|
|
239
|
+
selection: CodeMirror.EditorSelection.cursor(cursorPos),
|
|
240
|
+
scrollIntoView: true,
|
|
241
|
+
});
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private enterWillEvaluate(): boolean {
|
|
246
|
+
const {state} = this.editor;
|
|
247
|
+
return state.doc.length > 0 && TextEditor.JavaScript.isExpressionComplete(state);
|
|
278
248
|
}
|
|
279
249
|
|
|
280
|
-
private
|
|
281
|
-
if (
|
|
282
|
-
|
|
250
|
+
private evaluate(): boolean {
|
|
251
|
+
if (this.enterWillEvaluate()) {
|
|
252
|
+
this.appendCommand(this.text(), true);
|
|
253
|
+
this.editor.dispatch({
|
|
254
|
+
changes: {from: 0, to: this.editor.state.doc.length},
|
|
255
|
+
scrollIntoView: true,
|
|
256
|
+
});
|
|
257
|
+
} else if (this.editor.state.doc.length) {
|
|
258
|
+
return CodeMirror.insertNewlineAndIndent(this.editor.editor);
|
|
259
|
+
} else {
|
|
260
|
+
this.editor.dispatch({scrollIntoView: true});
|
|
283
261
|
}
|
|
284
|
-
|
|
262
|
+
this.enterProcessedForTest();
|
|
263
|
+
return true;
|
|
285
264
|
}
|
|
286
265
|
|
|
287
266
|
private updatePromptIcon(): void {
|
|
288
267
|
this.iconThrottler.schedule(async () => {
|
|
289
|
-
|
|
290
|
-
this.promptIcon.classList.toggle('console-prompt-incomplete', !canComplete);
|
|
268
|
+
this.promptIcon.classList.toggle('console-prompt-incomplete', !this.enterWillEvaluate());
|
|
291
269
|
});
|
|
292
270
|
}
|
|
293
271
|
|
|
294
|
-
private
|
|
295
|
-
if (event.altKey || event.ctrlKey || event.shiftKey) {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
event.consume(true);
|
|
300
|
-
|
|
301
|
-
// Since we prevent default, manually emulate the native "scroll on key input" behavior.
|
|
302
|
-
this.element.scrollIntoView();
|
|
303
|
-
this.clearAutocomplete();
|
|
304
|
-
|
|
305
|
-
const str = this.text();
|
|
306
|
-
if (!str.length) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
if (await this.enterWillEvaluate()) {
|
|
311
|
-
await this.appendCommand(str, true);
|
|
312
|
-
} else if (this.editor) {
|
|
313
|
-
this.editor.newlineAndIndent();
|
|
314
|
-
}
|
|
315
|
-
this.enterProcessedForTest();
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
private async appendCommand(text: string, useCommandLineAPI: boolean): Promise<void> {
|
|
319
|
-
this.setText('');
|
|
272
|
+
private appendCommand(text: string, useCommandLineAPI: boolean): void {
|
|
320
273
|
const currentExecutionContext = UI.Context.Context.instance().flavor(SDK.RuntimeModel.ExecutionContext);
|
|
321
274
|
if (currentExecutionContext) {
|
|
322
275
|
const executionContext = currentExecutionContext;
|
|
@@ -333,10 +286,19 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
|
333
286
|
private enterProcessedForTest(): void {
|
|
334
287
|
}
|
|
335
288
|
|
|
336
|
-
private
|
|
289
|
+
private editorUpdate(update: CodeMirror.ViewUpdate): void {
|
|
290
|
+
if (update.docChanged ||
|
|
291
|
+
CodeMirror.selectedCompletion(update.state) !== CodeMirror.selectedCompletion(update.startState)) {
|
|
292
|
+
this.onTextChanged();
|
|
293
|
+
} else if (update.selectionSet) {
|
|
294
|
+
this.updatePromptIcon();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
private historyCompletions(context: CodeMirror.CompletionContext): CodeMirror.CompletionResult|null {
|
|
337
299
|
const text = this.text();
|
|
338
|
-
if (!this.addCompletionsFromHistory || !this.isCaretAtEndOfPrompt() || (!text && !
|
|
339
|
-
return
|
|
300
|
+
if (!this.addCompletionsFromHistory || !this.isCaretAtEndOfPrompt() || (!text.length && !context.explicit)) {
|
|
301
|
+
return null;
|
|
340
302
|
}
|
|
341
303
|
const result = [];
|
|
342
304
|
const set = new Set<string>();
|
|
@@ -350,30 +312,18 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
|
350
312
|
continue;
|
|
351
313
|
}
|
|
352
314
|
set.add(item);
|
|
353
|
-
result.push(
|
|
354
|
-
{text: item.substring(text.length - prefix.length), iconType: 'smallicon-text-prompt', isSecondary: true});
|
|
315
|
+
result.push({label: item, type: 'secondary', boost: -1e5});
|
|
355
316
|
}
|
|
356
|
-
return result
|
|
317
|
+
return result.length ? {
|
|
318
|
+
from: 0,
|
|
319
|
+
to: text.length,
|
|
320
|
+
options: result,
|
|
321
|
+
} :
|
|
322
|
+
null;
|
|
357
323
|
}
|
|
358
324
|
|
|
359
325
|
focus(): void {
|
|
360
|
-
|
|
361
|
-
this.editor.widget().focus();
|
|
362
|
-
} else {
|
|
363
|
-
this.element.focus();
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
private async wordsWithQuery(
|
|
368
|
-
queryRange: TextUtils.TextRange.TextRange, substituteRange: TextUtils.TextRange.TextRange,
|
|
369
|
-
force?: boolean): Promise<UI.SuggestBox.Suggestions> {
|
|
370
|
-
if (!this.editor || !this.defaultAutocompleteConfig || !this.defaultAutocompleteConfig.suggestionsCallback) {
|
|
371
|
-
return [];
|
|
372
|
-
}
|
|
373
|
-
const query = this.editor.text(queryRange);
|
|
374
|
-
const words = await this.defaultAutocompleteConfig.suggestionsCallback(queryRange, substituteRange, force);
|
|
375
|
-
const historyWords = this.historyCompletions(query, force);
|
|
376
|
-
return words ? words.concat(historyWords) : historyWords;
|
|
326
|
+
this.editor.focus();
|
|
377
327
|
}
|
|
378
328
|
|
|
379
329
|
private editorSetForTest(): void {
|
|
@@ -1218,7 +1218,7 @@ export class ConsoleView extends UI.Widget.VBox implements UI.SearchableView.Sea
|
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
1220
1220
|
private clearPromptBackwards(): void {
|
|
1221
|
-
this.prompt.
|
|
1221
|
+
this.prompt.clear();
|
|
1222
1222
|
}
|
|
1223
1223
|
|
|
1224
1224
|
private promptKeyDown(event: Event): void {
|
|
@@ -50,9 +50,12 @@ import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
|
|
|
50
50
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
51
51
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
52
52
|
import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
|
|
53
|
+
// eslint-disable-next-line rulesdir/es_modules_import
|
|
54
|
+
import objectValueStyles from '../../ui/legacy/components/object_ui/objectValue.css.js';
|
|
53
55
|
import type {Chrome} from '../../../extension-api/ExtensionAPI.js'; // eslint-disable-line rulesdir/es_modules_import
|
|
54
56
|
|
|
55
57
|
import type {ConsoleViewportElement} from './ConsoleViewport.js';
|
|
58
|
+
import consoleViewStyles from './consoleView.css.js';
|
|
56
59
|
|
|
57
60
|
const UIStrings = {
|
|
58
61
|
/**
|
|
@@ -2067,7 +2070,11 @@ export class ConsoleTableMessageView extends ConsoleViewMessage {
|
|
|
2067
2070
|
const tableElement = formattedResult.createChild('div', 'console-message-formatted-table');
|
|
2068
2071
|
const dataGridContainer = tableElement.createChild('span');
|
|
2069
2072
|
tableElement.appendChild(this.formatParameter(actualTable, true, false));
|
|
2070
|
-
dataGridContainer.
|
|
2073
|
+
const shadowRoot = dataGridContainer.attachShadow({mode: 'open'});
|
|
2074
|
+
const dataGridWidget = this.dataGrid.asWidget();
|
|
2075
|
+
dataGridWidget.markAsRoot();
|
|
2076
|
+
dataGridWidget.show(shadowRoot as unknown as Element);
|
|
2077
|
+
dataGridWidget.registerCSSFiles([consoleViewStyles, objectValueStyles]);
|
|
2071
2078
|
formattedMessage.appendChild(formattedResult);
|
|
2072
2079
|
this.dataGrid.renderInline();
|
|
2073
2080
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
7
7
|
|
|
8
|
-
// eslint-disable-next-line rulesdir/es_modules_import
|
|
9
8
|
import type * as Console from './console.js';
|
|
10
9
|
|
|
11
10
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
@@ -345,13 +345,13 @@
|
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
#console-messages .link {
|
|
348
|
+
cursor: pointer;
|
|
348
349
|
text-decoration: underline;
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
#console-messages .link,
|
|
352
353
|
#console-messages .devtools-link {
|
|
353
354
|
color: var(--color-text-secondary);
|
|
354
|
-
cursor: pointer;
|
|
355
355
|
word-break: break-all;
|
|
356
356
|
}
|
|
357
357
|
|
|
@@ -338,7 +338,7 @@
|
|
|
338
338
|
background: none;
|
|
339
339
|
border: none;
|
|
340
340
|
-webkit-mask-image: var(--image-file-ic_show_node_16x16);
|
|
341
|
-
background-color: var(--color-
|
|
341
|
+
background-color: var(--color-text-secondary);
|
|
342
342
|
width: 16px;
|
|
343
343
|
height: 16px;
|
|
344
344
|
display: none;
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
|
|
349
349
|
.show-element:focus,
|
|
350
350
|
.show-element:hover {
|
|
351
|
-
background-color: var(--color-
|
|
351
|
+
background-color: var(--color-primary);
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
.nodeId-column:focus-within .show-element,
|
|
@@ -6,7 +6,6 @@ import * as i18n from '../../core/i18n/i18n.js';
|
|
|
6
6
|
import * as Root from '../../core/root/root.js';
|
|
7
7
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
8
8
|
|
|
9
|
-
// eslint-disable-next-line rulesdir/es_modules_import
|
|
10
9
|
import type * as DeveloperResources from './developer_resources.js';
|
|
11
10
|
|
|
12
11
|
const UIStrings = {
|