chrome-devtools-frontend 1.0.940714 → 1.0.942529
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 -57
- package/config/gni/devtools_grd_files.gni +55 -15
- package/config/gni/devtools_image_files.gni +2 -3
- package/front_end/.eslintrc.js +12 -1
- package/front_end/Images/src/feedback_button_icon.svg +3 -0
- package/front_end/Images/src/{feedback_thin_16x16_icon.svg → survey_feedback_icon.svg} +1 -1
- package/front_end/Tests.js +15 -0
- package/front_end/core/common/Color.ts +5 -0
- package/front_end/core/i18n/locales/en-US.json +31 -28
- package/front_end/core/i18n/locales/en-XL.json +31 -28
- package/front_end/core/sdk/DebuggerModel.ts +4 -14
- package/front_end/core/sdk/sdk-meta.ts +17 -3
- package/front_end/emulated_devices/module.json +1 -3
- package/front_end/entrypoints/devtools_app/devtools_app.json +1 -9
- package/front_end/entrypoints/main/MainImpl.ts +26 -0
- package/front_end/entrypoints/shell/shell.js +0 -11
- package/front_end/entrypoints/shell/shell.json +0 -2
- package/front_end/entrypoints/worker_app/worker_app.json +0 -4
- package/front_end/generated/InspectorBackendCommands.js +1 -0
- package/front_end/generated/protocol.d.ts +2 -0
- package/front_end/global_typings/global_defs.d.ts +5 -0
- package/front_end/legacy_test_runner/bindings_test_runner/IsolatedFilesystemTestRunner.js +2 -2
- package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +14 -2
- package/front_end/legacy_test_runner/legacy_test_runner.ts +10 -1
- package/front_end/legacy_test_runner/test_runner/TestRunner.js +11 -0
- package/front_end/models/formatter/SourceFormatter.ts +0 -10
- package/front_end/models/workspace/UISourceCode.ts +9 -42
- package/front_end/panels/animation/AnimationTimeline.ts +3 -3
- package/front_end/panels/application/ApplicationPanelSidebar.ts +3 -3
- package/front_end/panels/application/application-meta.ts +0 -3
- package/front_end/panels/application/components/EndpointsGrid.ts +1 -1
- package/front_end/panels/application/components/ReportsGrid.ts +1 -1
- package/front_end/panels/console/ConsolePinPane.ts +21 -26
- package/front_end/panels/coverage/CoverageDecorationManager.ts +4 -5
- package/front_end/panels/coverage/CoverageView.ts +2 -105
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +11 -56
- package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -8
- package/front_end/panels/elements/ElementsTreeElement.ts +4 -9
- package/front_end/panels/elements/components/StylePropertyEditor.ts +2 -0
- package/front_end/panels/elements/components/adornerSettingsPane.css +0 -4
- package/front_end/panels/emulation/DeviceModeToolbar.ts +3 -1
- package/front_end/panels/emulation/DeviceModeView.ts +2 -1
- package/front_end/panels/emulation/InspectedPagePlaceholder.ts +3 -1
- package/front_end/panels/emulation/MediaQueryInspector.ts +3 -1
- package/front_end/panels/emulation/emulation-meta.ts +2 -4
- package/front_end/panels/issues/issues-meta.ts +0 -2
- package/front_end/panels/layers/module.json +0 -1
- package/front_end/panels/lighthouse/LighthousePanel.ts +2 -4
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +1 -4
- package/front_end/panels/lighthouse/lighthouseStartView.css +4 -0
- package/front_end/panels/lighthouse/module.json +1 -4
- package/front_end/panels/media/media-meta.ts +0 -3
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -1
- package/front_end/panels/network/network-meta.ts +0 -3
- package/front_end/panels/profiler/module.json +1 -4
- package/front_end/panels/screencast/module.json +1 -4
- package/front_end/panels/security/security-meta.ts +0 -3
- package/front_end/panels/sources/BreakpointEditDialog.ts +16 -30
- package/front_end/panels/sources/CSSPlugin.ts +310 -331
- package/front_end/panels/sources/CallStackSidebarPane.ts +28 -34
- package/front_end/panels/sources/CoveragePlugin.ts +121 -6
- package/front_end/panels/sources/DebuggerPlugin.ts +1166 -1243
- package/front_end/panels/sources/EditingLocationHistoryManager.ts +71 -101
- package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -3
- package/front_end/panels/sources/InplaceFormatterEditorAction.ts +3 -3
- package/front_end/panels/sources/JavaScriptCompilerPlugin.ts +26 -23
- package/front_end/panels/sources/Plugin.ts +20 -4
- package/front_end/panels/sources/ProfilePlugin.ts +185 -0
- package/front_end/panels/sources/ScriptFormatterEditorAction.ts +3 -3
- package/front_end/panels/sources/ScriptOriginPlugin.ts +0 -10
- package/front_end/panels/sources/SnippetsPlugin.ts +1 -10
- package/front_end/panels/sources/SourcesPanel.ts +15 -10
- package/front_end/panels/sources/SourcesView.ts +10 -8
- package/front_end/panels/sources/TabbedEditorContainer.ts +31 -27
- package/front_end/panels/sources/UISourceCodeFrame.ts +335 -470
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -2
- package/front_end/panels/sources/sources-legacy.ts +0 -6
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/panels/timeline/module.json +0 -3
- package/front_end/third_party/codemirror.next/bundle.ts +9 -13
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/javascript.js +2 -2
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -6
- package/front_end/third_party/codemirror.next/chunk/php.js +2 -6
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js +2 -2
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +279 -198
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +13 -11
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1128 -1158
- package/front_end/third_party/lighthouse/locales/ar-XB.json +211 -79
- package/front_end/third_party/lighthouse/locales/ar.json +213 -81
- package/front_end/third_party/lighthouse/locales/bg.json +211 -79
- package/front_end/third_party/lighthouse/locales/ca.json +212 -80
- package/front_end/third_party/lighthouse/locales/cs.json +211 -79
- package/front_end/third_party/lighthouse/locales/da.json +211 -79
- package/front_end/third_party/lighthouse/locales/de.json +211 -79
- package/front_end/third_party/lighthouse/locales/el.json +213 -81
- package/front_end/third_party/lighthouse/locales/en-GB.json +211 -79
- package/front_end/third_party/lighthouse/locales/en-US.json +186 -75
- package/front_end/third_party/lighthouse/locales/en-XA.json +211 -79
- package/front_end/third_party/lighthouse/locales/en-XL.json +186 -75
- package/front_end/third_party/lighthouse/locales/es-419.json +211 -79
- package/front_end/third_party/lighthouse/locales/es.json +212 -80
- package/front_end/third_party/lighthouse/locales/fi.json +211 -79
- package/front_end/third_party/lighthouse/locales/fil.json +211 -79
- package/front_end/third_party/lighthouse/locales/fr.json +211 -79
- package/front_end/third_party/lighthouse/locales/he.json +212 -80
- package/front_end/third_party/lighthouse/locales/hi.json +214 -82
- package/front_end/third_party/lighthouse/locales/hr.json +211 -79
- package/front_end/third_party/lighthouse/locales/hu.json +211 -79
- package/front_end/third_party/lighthouse/locales/id.json +211 -79
- package/front_end/third_party/lighthouse/locales/it.json +211 -79
- package/front_end/third_party/lighthouse/locales/ja.json +211 -79
- package/front_end/third_party/lighthouse/locales/ko.json +211 -79
- package/front_end/third_party/lighthouse/locales/lt.json +211 -79
- package/front_end/third_party/lighthouse/locales/lv.json +214 -82
- package/front_end/third_party/lighthouse/locales/nl.json +211 -79
- package/front_end/third_party/lighthouse/locales/no.json +211 -79
- package/front_end/third_party/lighthouse/locales/pl.json +211 -79
- package/front_end/third_party/lighthouse/locales/pt-PT.json +211 -79
- package/front_end/third_party/lighthouse/locales/pt.json +211 -79
- package/front_end/third_party/lighthouse/locales/ro.json +212 -80
- package/front_end/third_party/lighthouse/locales/ru.json +211 -79
- package/front_end/third_party/lighthouse/locales/sk.json +211 -79
- package/front_end/third_party/lighthouse/locales/sl.json +211 -79
- package/front_end/third_party/lighthouse/locales/sr-Latn.json +211 -79
- package/front_end/third_party/lighthouse/locales/sr.json +211 -79
- package/front_end/third_party/lighthouse/locales/sv.json +211 -79
- package/front_end/third_party/lighthouse/locales/ta.json +218 -86
- package/front_end/third_party/lighthouse/locales/te.json +251 -119
- package/front_end/third_party/lighthouse/locales/th.json +211 -79
- package/front_end/third_party/lighthouse/locales/tr.json +211 -79
- package/front_end/third_party/lighthouse/locales/uk.json +212 -80
- package/front_end/third_party/lighthouse/locales/vi.json +211 -79
- package/front_end/third_party/lighthouse/locales/zh-HK.json +211 -79
- package/front_end/third_party/lighthouse/locales/zh-TW.json +211 -79
- package/front_end/third_party/lighthouse/locales/zh.json +211 -79
- package/front_end/third_party/lighthouse/report/bundle.d.ts +72 -34
- package/front_end/third_party/lighthouse/report/bundle.js +698 -492
- package/front_end/third_party/lighthouse/report-assets/report-generator.js +1 -2
- package/front_end/third_party/lighthouse/report-assets/report.js +40 -35
- package/front_end/third_party/lighthouse/report-assets/standalone-template.html +2 -4
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +60 -68
- package/front_end/ui/components/data_grid/dataGrid.css +12 -10
- package/front_end/ui/components/docs/css_overview/start_view.html +25 -0
- package/front_end/ui/components/docs/css_overview/start_view.ts +14 -0
- package/front_end/ui/components/docs/icon_button/basic.ts +3 -3
- package/front_end/ui/components/docs/panel_feedback/basic.html +25 -0
- package/front_end/ui/components/docs/panel_feedback/basic.ts +20 -0
- package/front_end/ui/components/docs/panel_feedback/button.html +25 -0
- package/front_end/ui/components/docs/panel_feedback/button.ts +18 -0
- package/front_end/ui/components/helpers/get-stylesheet.ts +0 -13
- package/front_end/ui/components/markdown_view/MarkdownImagesMap.ts +1 -1
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +67 -0
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +100 -0
- package/front_end/ui/components/panel_feedback/panelFeedback.css +76 -0
- package/front_end/ui/components/panel_feedback/panel_feedback.ts +6 -0
- package/front_end/ui/components/report_view/reportValue.css +1 -0
- package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
- package/front_end/ui/components/text_editor/TextEditor.ts +79 -36
- package/front_end/ui/components/text_editor/config.ts +42 -26
- package/front_end/ui/components/text_editor/javascript.ts +2 -3
- package/front_end/ui/components/text_editor/position.ts +17 -0
- package/front_end/ui/components/text_editor/text_editor.ts +1 -0
- package/front_end/ui/components/text_editor/theme.ts +5 -1
- package/front_end/ui/legacy/Dialog.ts +3 -1
- package/front_end/ui/legacy/DropTarget.ts +2 -1
- package/front_end/ui/legacy/EmptyWidget.ts +2 -1
- package/front_end/ui/legacy/FilterBar.ts +2 -1
- package/front_end/ui/legacy/GlassPane.ts +4 -2
- package/front_end/ui/legacy/Infobar.ts +5 -8
- package/front_end/ui/legacy/InspectorView.ts +6 -1
- package/front_end/ui/legacy/ListWidget.ts +2 -1
- package/front_end/ui/legacy/PopoverHelper.ts +2 -1
- package/front_end/ui/legacy/ProgressIndicator.ts +2 -1
- package/front_end/ui/legacy/RemoteDebuggingTerminatedScreen.ts +2 -1
- package/front_end/ui/legacy/ReportView.ts +2 -1
- package/front_end/ui/legacy/RootView.ts +2 -1
- package/front_end/ui/legacy/SearchableView.ts +2 -1
- package/front_end/ui/legacy/ShortcutRegistry.ts +11 -7
- package/front_end/ui/legacy/SoftContextMenu.ts +2 -1
- package/front_end/ui/legacy/SoftDropDown.ts +4 -2
- package/front_end/ui/legacy/SplitWidget.ts +2 -1
- package/front_end/ui/legacy/SuggestBox.ts +2 -1
- package/front_end/ui/legacy/TabbedPane.ts +2 -1
- package/front_end/ui/legacy/TargetCrashedScreen.ts +2 -1
- package/front_end/ui/legacy/TextPrompt.ts +2 -1
- package/front_end/ui/legacy/Toolbar.ts +3 -2
- package/front_end/ui/legacy/Treeoutline.ts +3 -2
- package/front_end/ui/legacy/UIUtils.ts +16 -13
- package/front_end/ui/legacy/ViewManager.ts +2 -1
- package/front_end/ui/legacy/Widget.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +2 -1
- package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +3 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +2 -1
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +35 -131
- package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +3 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -1
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +2 -2
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +3 -6
- package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +19 -14
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +502 -252
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -0
- package/front_end/ui/legacy/components/source_frame/module.json +0 -3
- package/front_end/ui/legacy/components/source_frame/source_frame-legacy.ts +0 -11
- package/front_end/ui/legacy/components/source_frame/source_frame.ts +0 -2
- package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +2 -0
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +3 -1
- package/front_end/ui/legacy/components/text_editor/module.json +0 -3
- package/front_end/ui/legacy/components/utils/Linkifier.ts +7 -15
- package/front_end/ui/legacy/radioButton.css +1 -13
- package/front_end/ui/legacy/softContextMenu.css +1 -0
- package/front_end/ui/legacy/themeColors.css +36 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +7 -9
- package/front_end/ui/legacy/utils/append-style.ts +9 -4
- package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +2 -2
- package/front_end/ui/legacy/utils/inject-core-styles.ts +7 -4
- package/package.json +1 -1
- package/scripts/build/generate_css_js_files.js +23 -9
- package/scripts/build/ninja/generate_css.gni +10 -1
- package/scripts/eslint_rules/lib/check_css_import.js +2 -2
- package/scripts/eslint_rules/tests/check_css_import_test.js +12 -0
- package/front_end/Images/radioDot-dark-theme.png +0 -0
- package/front_end/Images/radioDot.png +0 -0
- package/front_end/panels/application/module.json +0 -7
- package/front_end/panels/emulation/module.json +0 -11
- package/front_end/panels/issues/module.json +0 -6
- package/front_end/panels/layer_viewer/module.json +0 -6
- package/front_end/panels/media/module.json +0 -6
- package/front_end/panels/network/module.json +0 -6
- package/front_end/panels/security/module.json +0 -5
- package/front_end/third_party/lighthouse/report-assets/report.css +0 -1774
- package/front_end/ui/legacy/components/perf_ui/module.json +0 -13
- package/front_end/ui/legacy/components/source_frame/SourcesTextEditor.ts +0 -1030
- package/front_end/ui/legacy/module.json +0 -41
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Copyright 2021 Google LLC. All rights reserved.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.preview {
|
|
16
|
+
padding: 12px 16px;
|
|
17
|
+
border: 1px solid var(--color-details-hairline);
|
|
18
|
+
color: var(--color-text-primary);
|
|
19
|
+
font-size: 13px;
|
|
20
|
+
line-height: 20px;
|
|
21
|
+
border-radius: 12px;
|
|
22
|
+
margin: 42px 0;
|
|
23
|
+
letter-spacing: 0.01em;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
h2 {
|
|
27
|
+
color: var(--color-primary);
|
|
28
|
+
font-size: 13px;
|
|
29
|
+
line-height: 20px;
|
|
30
|
+
letter-spacing: 0.01em;
|
|
31
|
+
margin: 9px 0 14px;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 5px;
|
|
35
|
+
font-weight: normal;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
h3 {
|
|
39
|
+
font-size: 13px;
|
|
40
|
+
line-height: 20px;
|
|
41
|
+
letter-spacing: 0.04em;
|
|
42
|
+
color: var(--color-text-primary);
|
|
43
|
+
margin-bottom: 2px;
|
|
44
|
+
font-weight: normal;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.preview p {
|
|
48
|
+
margin-bottom: 24px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.thumbnail {
|
|
52
|
+
height: 92px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.video {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-flow: row wrap;
|
|
58
|
+
gap: 20px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
x-link { /* stylelint-disable-line selector-type-no-unknown */
|
|
62
|
+
color: var(--color-primary);
|
|
63
|
+
text-decoration-line: underline;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
x-link.quick-start-link { /* stylelint-disable-line selector-type-no-unknown */
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
line-height: 22px;
|
|
69
|
+
letter-spacing: 0.04em;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.video-description {
|
|
73
|
+
min-width: min-content;
|
|
74
|
+
flex-basis: min-content;
|
|
75
|
+
flex-grow: 1;
|
|
76
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Copyright 2021 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
|
+
export * as FeedbackButton from './FeedbackButton.js';
|
|
6
|
+
export * as PanelFeedback from './PanelFeedback.js';
|
|
@@ -124,7 +124,7 @@ export class SurveyLink extends HTMLElement {
|
|
|
124
124
|
// eslint-disable-next-line rulesdir/ban_style_tags_in_lit_html
|
|
125
125
|
const output = LitHtml.html`
|
|
126
126
|
<button class="link ${linkState}" tabindex=${ariaDisabled ? '-1' : '0'} .disabled=${ariaDisabled} aria-disabled=${ariaDisabled} @click=${this.sendSurvey}>
|
|
127
|
-
<${IconButton.Icon.Icon.litTagName} class="link-icon" .data=${{iconName: '
|
|
127
|
+
<${IconButton.Icon.Icon.litTagName} class="link-icon" .data=${{iconName: 'feedback_button_icon', color: 'var(--color-link)', width: 'var(--issue-link-icon-size, 16px)', height: 'var(--issue-link-icon-size, 16px)'} as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}><!--
|
|
128
128
|
-->${linkText}
|
|
129
129
|
</button>
|
|
130
130
|
`;
|
|
@@ -8,7 +8,8 @@ import * as LitHtml from '../../lit-html/lit-html.js';
|
|
|
8
8
|
import * as CodeHighlighter from '../code_highlighter/code_highlighter.js';
|
|
9
9
|
import * as ComponentHelpers from '../helpers/helpers.js';
|
|
10
10
|
|
|
11
|
-
import {baseConfiguration, dynamicSetting} from './config.js';
|
|
11
|
+
import {baseConfiguration, dynamicSetting, DynamicSetting} from './config.js';
|
|
12
|
+
import {toLineColumn, toOffset} from './position.js';
|
|
12
13
|
|
|
13
14
|
declare global {
|
|
14
15
|
interface HTMLElementTagNameMap {
|
|
@@ -21,6 +22,7 @@ export class TextEditor extends HTMLElement {
|
|
|
21
22
|
|
|
22
23
|
private readonly shadow = this.attachShadow({mode: 'open'});
|
|
23
24
|
private activeEditor: CodeMirror.EditorView|undefined = undefined;
|
|
25
|
+
private dynamicSettings: readonly DynamicSetting<unknown>[] = DynamicSetting.none;
|
|
24
26
|
private activeSettingListeners: [Common.Settings.Setting<unknown>, (event: {data: unknown}) => void][] = [];
|
|
25
27
|
private pendingState: CodeMirror.EditorState|undefined;
|
|
26
28
|
|
|
@@ -32,10 +34,17 @@ export class TextEditor extends HTMLElement {
|
|
|
32
34
|
|
|
33
35
|
private createEditor(): CodeMirror.EditorView {
|
|
34
36
|
this.activeEditor = new CodeMirror.EditorView({
|
|
35
|
-
state: this.
|
|
37
|
+
state: this.state,
|
|
36
38
|
parent: this.shadow,
|
|
37
39
|
root: this.shadow,
|
|
40
|
+
dispatch: (tr: CodeMirror.Transaction): void => {
|
|
41
|
+
this.editor.update([tr]);
|
|
42
|
+
if (tr.reconfigured) {
|
|
43
|
+
this.ensureSettingListeners();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
38
46
|
});
|
|
47
|
+
this.ensureSettingListeners();
|
|
39
48
|
return this.activeEditor;
|
|
40
49
|
}
|
|
41
50
|
|
|
@@ -43,6 +52,10 @@ export class TextEditor extends HTMLElement {
|
|
|
43
52
|
return this.activeEditor || this.createEditor();
|
|
44
53
|
}
|
|
45
54
|
|
|
55
|
+
dispatch(spec: CodeMirror.TransactionSpec): void {
|
|
56
|
+
return this.editor.dispatch(spec);
|
|
57
|
+
}
|
|
58
|
+
|
|
46
59
|
get state(): CodeMirror.EditorState {
|
|
47
60
|
if (this.activeEditor) {
|
|
48
61
|
return this.activeEditor.state;
|
|
@@ -65,7 +78,6 @@ export class TextEditor extends HTMLElement {
|
|
|
65
78
|
if (!this.activeEditor) {
|
|
66
79
|
this.createEditor();
|
|
67
80
|
}
|
|
68
|
-
this.registerSettingHandlers();
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
disconnectedCallback(): void {
|
|
@@ -73,63 +85,94 @@ export class TextEditor extends HTMLElement {
|
|
|
73
85
|
this.pendingState = this.activeEditor.state;
|
|
74
86
|
this.activeEditor.destroy();
|
|
75
87
|
this.activeEditor = undefined;
|
|
88
|
+
this.ensureSettingListeners();
|
|
76
89
|
}
|
|
77
|
-
for (const [setting, listener] of this.activeSettingListeners) {
|
|
78
|
-
setting.removeChangeListener(listener);
|
|
79
|
-
}
|
|
80
|
-
this.activeSettingListeners = [];
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
for (const opt of state.facet(dynamicSetting)) {
|
|
87
|
-
const mustUpdate = opt.sync(state, settings.moduleSetting(opt.settingName).get());
|
|
88
|
-
if (mustUpdate) {
|
|
89
|
-
changes.push(mustUpdate);
|
|
90
|
-
}
|
|
92
|
+
focus(): void {
|
|
93
|
+
if (this.activeEditor) {
|
|
94
|
+
this.activeEditor.focus();
|
|
91
95
|
}
|
|
92
|
-
return changes.length ? state.update({effects: changes}).state : state;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
private
|
|
98
|
+
private ensureSettingListeners(): void {
|
|
99
|
+
const dynamicSettings = this.activeEditor ? this.activeEditor.state.facet(dynamicSetting) : DynamicSetting.none;
|
|
100
|
+
if (dynamicSettings === this.dynamicSettings) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.dynamicSettings = dynamicSettings;
|
|
104
|
+
|
|
105
|
+
for (const [setting, listener] of this.activeSettingListeners) {
|
|
106
|
+
setting.removeChangeListener(listener);
|
|
107
|
+
}
|
|
108
|
+
this.activeSettingListeners = [];
|
|
109
|
+
|
|
96
110
|
const settings = Common.Settings.Settings.instance();
|
|
97
|
-
for (const
|
|
111
|
+
for (const dynamicSetting of dynamicSettings) {
|
|
98
112
|
const handler = ({data}: {data: unknown}): void => {
|
|
99
|
-
const change =
|
|
113
|
+
const change = dynamicSetting.sync(this.state, data);
|
|
100
114
|
if (change && this.activeEditor) {
|
|
101
115
|
this.activeEditor.dispatch({effects: change});
|
|
102
116
|
}
|
|
103
117
|
};
|
|
104
|
-
const setting = settings.moduleSetting(
|
|
118
|
+
const setting = settings.moduleSetting(dynamicSetting.settingName);
|
|
105
119
|
setting.addChangeListener(handler);
|
|
106
120
|
this.activeSettingListeners.push([setting, handler]);
|
|
107
121
|
}
|
|
108
122
|
}
|
|
109
123
|
|
|
110
|
-
revealPosition(
|
|
124
|
+
revealPosition(selection: CodeMirror.EditorSelection, highlight: boolean = true): void {
|
|
111
125
|
const view = this.activeEditor;
|
|
112
126
|
if (!view) {
|
|
113
127
|
return;
|
|
114
128
|
}
|
|
115
129
|
|
|
116
|
-
const line = view.state.doc.lineAt(
|
|
130
|
+
const line = view.state.doc.lineAt(selection.main.head);
|
|
131
|
+
const effects: CodeMirror.StateEffect<unknown>[] = [];
|
|
132
|
+
if (highlight) {
|
|
133
|
+
effects.push(
|
|
134
|
+
view.state.field(highlightState, false) ?
|
|
135
|
+
setHighlightLine.of(line.from) :
|
|
136
|
+
CodeMirror.StateEffect.appendConfig.of(highlightState.init(() => highlightDeco(line.from))));
|
|
137
|
+
}
|
|
138
|
+
const editorRect = view.scrollDOM.getBoundingClientRect();
|
|
139
|
+
const targetPos = view.coordsAtPos(selection.main.head);
|
|
140
|
+
if (!targetPos || targetPos.top < editorRect.top || targetPos.bottom > editorRect.bottom) {
|
|
141
|
+
effects.push(CodeMirror.EditorView.centerOn.of(selection.main));
|
|
142
|
+
}
|
|
143
|
+
|
|
117
144
|
view.dispatch({
|
|
118
|
-
selection
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
[view.state.field(highlightState, false) ?
|
|
122
|
-
setHighlightLine.of(line.from) :
|
|
123
|
-
CodeMirror.StateEffect.appendConfig.of(highlightState.init(() => highlightDeco(line.from)))],
|
|
145
|
+
selection,
|
|
146
|
+
effects,
|
|
147
|
+
userEvent: 'select.reveal',
|
|
124
148
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
view.
|
|
131
|
-
|
|
132
|
-
|
|
149
|
+
if (highlight) {
|
|
150
|
+
const {id} = view.state.field(highlightState);
|
|
151
|
+
// Reset the highlight state if, after 2 seconds (the animation
|
|
152
|
+
// duration) it is still showing this highlight.
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
if (view.state.field(highlightState).id === id) {
|
|
155
|
+
view.dispatch({effects: setHighlightLine.of(null)});
|
|
156
|
+
}
|
|
157
|
+
}, 2000);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
createSelection(head: {lineNumber: number, columnNumber: number}, anchor?: {
|
|
162
|
+
lineNumber: number,
|
|
163
|
+
columnNumber: number,
|
|
164
|
+
}): CodeMirror.EditorSelection {
|
|
165
|
+
const {doc} = this.state;
|
|
166
|
+
const headPos = toOffset(doc, head);
|
|
167
|
+
return CodeMirror.EditorSelection.single(anchor ? toOffset(doc, anchor) : headPos, headPos);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
toLineColumn(pos: number): {lineNumber: number, columnNumber: number} {
|
|
171
|
+
return toLineColumn(this.state.doc, pos);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
toOffset(pos: {lineNumber: number, columnNumber: number}): number {
|
|
175
|
+
return toOffset(this.state.doc, pos);
|
|
133
176
|
}
|
|
134
177
|
}
|
|
135
178
|
|
|
@@ -31,24 +31,35 @@ export const dynamicSetting = CM.Facet.define<DynamicSetting<unknown>>();
|
|
|
31
31
|
|
|
32
32
|
export class DynamicSetting<T> {
|
|
33
33
|
compartment = new CM.Compartment();
|
|
34
|
-
extension: CM.Extension;
|
|
35
34
|
|
|
36
35
|
constructor(
|
|
37
36
|
readonly settingName: string,
|
|
38
|
-
private readonly getExtension: (value: T
|
|
37
|
+
private readonly getExtension: (value: T) => CM.Extension,
|
|
39
38
|
) {
|
|
40
|
-
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
settingValue(): T {
|
|
42
|
+
return Common.Settings.Settings.instance().moduleSetting(this.settingName).get() as T;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
instance(): CM.Extension {
|
|
46
|
+
return [
|
|
47
|
+
this.compartment.of(this.getExtension(this.settingValue())),
|
|
48
|
+
dynamicSetting.of(this as DynamicSetting<unknown>),
|
|
49
|
+
];
|
|
41
50
|
}
|
|
42
51
|
|
|
43
52
|
sync(state: CM.EditorState, value: T): CM.StateEffect<unknown>|null {
|
|
44
53
|
const cur = this.compartment.get(state);
|
|
45
|
-
const needed = this.getExtension(value
|
|
54
|
+
const needed = this.getExtension(value);
|
|
46
55
|
return cur === needed ? null : this.compartment.reconfigure(needed);
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
static bool(name: string, enabled: CM.Extension, disabled: CM.Extension = empty): DynamicSetting<boolean> {
|
|
50
59
|
return new DynamicSetting<boolean>(name, val => val ? enabled : disabled);
|
|
51
60
|
}
|
|
61
|
+
|
|
62
|
+
static none: readonly DynamicSetting<unknown>[] = [];
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
export const tabMovesFocus = DynamicSetting.bool('textEditorTabMovesFocus', CM.keymap.of([{
|
|
@@ -82,23 +93,15 @@ export function guessIndent(doc: CM.Text): string {
|
|
|
82
93
|
values[space] = (values[space] || 0) + 1;
|
|
83
94
|
}
|
|
84
95
|
const minOccurrence = scanned * 0.05;
|
|
85
|
-
const
|
|
86
|
-
|
|
96
|
+
const shortest = Object.entries(values).reduce((shortest, [string, count]): string|null => {
|
|
97
|
+
return count < minOccurrence || shortest && shortest.length < string.length ? shortest : string;
|
|
98
|
+
}, null as string | null);
|
|
99
|
+
return shortest ?? Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
|
|
87
100
|
}
|
|
88
101
|
|
|
89
|
-
const
|
|
102
|
+
const deriveIndentUnit = CM.Prec.highest(CM.indentUnit.compute([], (state: CM.EditorState) => guessIndent(state.doc)));
|
|
90
103
|
|
|
91
|
-
|
|
92
|
-
let value = cachedIndentUnit[indent];
|
|
93
|
-
if (!value) {
|
|
94
|
-
value = cachedIndentUnit[indent] = CM.indentUnit.of(indent);
|
|
95
|
-
}
|
|
96
|
-
return value;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const autoDetectIndent = new DynamicSetting<boolean>('textEditorAutoDetectIndent', (on, state) => {
|
|
100
|
-
return on ? CM.Prec.override(getIndentUnit(guessIndent(state.doc))) : empty;
|
|
101
|
-
});
|
|
104
|
+
export const autoDetectIndent = DynamicSetting.bool('textEditorAutoDetectIndent', deriveIndentUnit);
|
|
102
105
|
|
|
103
106
|
function matcher(decorator: CM.MatchDecorator): CM.Extension {
|
|
104
107
|
return CM.ViewPlugin.define(
|
|
@@ -154,6 +157,16 @@ export const showWhitespace = new DynamicSetting<string>('showWhitespacesInEdito
|
|
|
154
157
|
|
|
155
158
|
export const allowScrollPastEof = DynamicSetting.bool('allowScrollPastEof', CM.scrollPastEnd());
|
|
156
159
|
|
|
160
|
+
const cachedIndentUnit: {[indent: string]: CM.Extension} = Object.create(null);
|
|
161
|
+
|
|
162
|
+
function getIndentUnit(indent: string): CM.Extension {
|
|
163
|
+
let value = cachedIndentUnit[indent];
|
|
164
|
+
if (!value) {
|
|
165
|
+
value = cachedIndentUnit[indent] = CM.indentUnit.of(indent);
|
|
166
|
+
}
|
|
167
|
+
return value;
|
|
168
|
+
}
|
|
169
|
+
|
|
157
170
|
export const indentUnit = new DynamicSetting<string>('textEditorIndent', getIndentUnit);
|
|
158
171
|
|
|
159
172
|
export const domWordWrap = DynamicSetting.bool('domWordWrap', CM.EditorView.lineWrapping);
|
|
@@ -184,22 +197,25 @@ function themeIsDark(): boolean {
|
|
|
184
197
|
|
|
185
198
|
const dummyDarkTheme = CM.EditorView.theme({}, {dark: true});
|
|
186
199
|
|
|
200
|
+
export function theme(): CM.Extension {
|
|
201
|
+
return [editorTheme, themeIsDark() ? dummyDarkTheme : []];
|
|
202
|
+
}
|
|
203
|
+
|
|
187
204
|
export function baseConfiguration(text: string): CM.Extension {
|
|
188
205
|
return [
|
|
189
|
-
|
|
190
|
-
themeIsDark() ? dummyDarkTheme : [],
|
|
206
|
+
theme(),
|
|
191
207
|
CM.highlightSpecialChars(),
|
|
192
208
|
CM.history(),
|
|
193
209
|
CM.drawSelection(),
|
|
194
210
|
CM.EditorState.allowMultipleSelections.of(true),
|
|
195
211
|
CM.indentOnInput(),
|
|
196
|
-
CodeHighlighter.CodeHighlighter.
|
|
212
|
+
CodeHighlighter.CodeHighlighter.highlightStyle,
|
|
197
213
|
CM.closeBrackets(),
|
|
198
214
|
baseKeymap,
|
|
199
|
-
tabMovesFocus,
|
|
200
|
-
bracketMatching,
|
|
201
|
-
indentUnit,
|
|
202
|
-
CM.Prec.
|
|
215
|
+
tabMovesFocus.instance(),
|
|
216
|
+
bracketMatching.instance(),
|
|
217
|
+
indentUnit.instance(),
|
|
218
|
+
CM.Prec.lowest(CM.EditorView.contentAttributes.of({'aria-label': i18nString(UIStrings.codeEditor)})),
|
|
203
219
|
detectLineSeparator(text),
|
|
204
220
|
autocompletion,
|
|
205
221
|
CM.tooltips({parent: getTooltipHost() as unknown as HTMLElement}),
|
|
@@ -221,7 +237,7 @@ function getTooltipHost(): ShadowRoot {
|
|
|
221
237
|
extensions: [
|
|
222
238
|
editorTheme,
|
|
223
239
|
themeIsDark() ? dummyDarkTheme : [],
|
|
224
|
-
CodeHighlighter.CodeHighlighter.
|
|
240
|
+
CodeHighlighter.CodeHighlighter.highlightStyle,
|
|
225
241
|
CM.showTooltip.of({
|
|
226
242
|
pos: 0,
|
|
227
243
|
create() {
|
|
@@ -9,9 +9,8 @@ import * as CodeMirror from '../../../third_party/codemirror.next/codemirror.nex
|
|
|
9
9
|
import * as UI from '../../legacy/legacy.js';
|
|
10
10
|
import {cursorTooltip} from './cursor_tooltip.js';
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
return javascriptLanguage.data.of({
|
|
12
|
+
export function completion(): CodeMirror.Extension {
|
|
13
|
+
return CodeMirror.javascript.javascriptLanguage.data.of({
|
|
15
14
|
autocomplete: javascriptCompletionSource,
|
|
16
15
|
});
|
|
17
16
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2021 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 * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
|
|
6
|
+
|
|
7
|
+
export function toOffset(
|
|
8
|
+
doc: CodeMirror.Text, {lineNumber, columnNumber}: {lineNumber: number, columnNumber: number}): number {
|
|
9
|
+
const line = doc.line(Math.max(1, Math.min(doc.lines, lineNumber + 1)));
|
|
10
|
+
return Math.max(line.from, Math.min(line.to, line.from + columnNumber));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function toLineColumn(doc: CodeMirror.Text, offset: number): {lineNumber: number, columnNumber: number} {
|
|
14
|
+
offset = Math.max(0, Math.min(offset, doc.length));
|
|
15
|
+
const line = doc.lineAt(offset);
|
|
16
|
+
return {lineNumber: line.number - 1, columnNumber: offset - line.from};
|
|
17
|
+
}
|
|
@@ -52,6 +52,10 @@ export const editorTheme = CM.EditorView.theme({
|
|
|
52
52
|
backgroundColor: 'var(--color-background)',
|
|
53
53
|
},
|
|
54
54
|
|
|
55
|
+
'.cm-lineNumbers': {
|
|
56
|
+
overflow: 'visible',
|
|
57
|
+
minWidth: '40px',
|
|
58
|
+
},
|
|
55
59
|
'.cm-lineNumbers .cm-gutterElement': {
|
|
56
60
|
color: 'var(--color-line-number)',
|
|
57
61
|
padding: '0 3px 0 9px',
|
|
@@ -74,7 +78,7 @@ export const editorTheme = CM.EditorView.theme({
|
|
|
74
78
|
},
|
|
75
79
|
|
|
76
80
|
'.cm-trailingWhitespace': {
|
|
77
|
-
backgroundColor: 'var(--color-
|
|
81
|
+
backgroundColor: 'var(--color-trailing-whitespace)',
|
|
78
82
|
},
|
|
79
83
|
|
|
80
84
|
'.cm-highlightedTab': {
|
|
@@ -39,6 +39,8 @@ import type {DevToolsCloseButton} from './UIUtils.js';
|
|
|
39
39
|
import type {WidgetElement} from './Widget.js';
|
|
40
40
|
import {WidgetFocusRestorer} from './Widget.js';
|
|
41
41
|
|
|
42
|
+
import dialogStyles from './dialog.css.legacy.js';
|
|
43
|
+
|
|
42
44
|
export class Dialog extends Common.ObjectWrapper.eventMixin<EventTypes, typeof GlassPane>(GlassPane) {
|
|
43
45
|
private tabIndexBehavior: OutsideTabIndexBehavior;
|
|
44
46
|
private tabIndexMap: Map<HTMLElement, number>;
|
|
@@ -50,7 +52,7 @@ export class Dialog extends Common.ObjectWrapper.eventMixin<EventTypes, typeof G
|
|
|
50
52
|
|
|
51
53
|
constructor() {
|
|
52
54
|
super();
|
|
53
|
-
this.registerRequiredCSS(
|
|
55
|
+
this.registerRequiredCSS(dialogStyles);
|
|
54
56
|
this.contentElement.tabIndex = 0;
|
|
55
57
|
this.contentElement.addEventListener('focus', () => this.widget().focus(), false);
|
|
56
58
|
this.widget().setDefaultFocusedElement(this.contentElement);
|
|
@@ -2,6 +2,7 @@
|
|
|
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 dropTargetStyles from './dropTarget.css.legacy.js';
|
|
5
6
|
import * as Utils from './utils/utils.js';
|
|
6
7
|
|
|
7
8
|
export class DropTarget {
|
|
@@ -71,7 +72,7 @@ export class DropTarget {
|
|
|
71
72
|
}
|
|
72
73
|
this.dragMaskElement = this.element.createChild('div', '');
|
|
73
74
|
const shadowRoot = Utils.createShadowRootWithCoreStyles(
|
|
74
|
-
this.dragMaskElement, {cssFile:
|
|
75
|
+
this.dragMaskElement, {cssFile: dropTargetStyles, delegatesFocus: undefined});
|
|
75
76
|
shadowRoot.createChild('div', 'drop-target-message').textContent = this.messageText;
|
|
76
77
|
this.dragMaskElement.addEventListener('drop', this.onDrop.bind(this), true);
|
|
77
78
|
this.dragMaskElement.addEventListener('dragleave', this.onDragLeave.bind(this), true);
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
32
32
|
|
|
33
|
+
import emptyWidgetStyles from './emptyWidget.css.legacy.js';
|
|
33
34
|
import {VBox} from './Widget.js';
|
|
34
35
|
import {XLink} from './XLink.js';
|
|
35
36
|
|
|
@@ -47,7 +48,7 @@ export class EmptyWidget extends VBox {
|
|
|
47
48
|
|
|
48
49
|
constructor(text: string) {
|
|
49
50
|
super();
|
|
50
|
-
this.registerRequiredCSS(
|
|
51
|
+
this.registerRequiredCSS(emptyWidgetStyles);
|
|
51
52
|
this.element.classList.add('empty-view-scroller');
|
|
52
53
|
this.contentElement = this.element.createChild('div', 'empty-view') as HTMLDivElement;
|
|
53
54
|
this.textElement = this.contentElement.createChild('div', 'empty-bold-text');
|
|
@@ -43,6 +43,7 @@ import {ToolbarSettingToggle} from './Toolbar.js';
|
|
|
43
43
|
import {Tooltip} from './Tooltip.js';
|
|
44
44
|
import {CheckboxLabel, createTextChild} from './UIUtils.js';
|
|
45
45
|
import {HBox} from './Widget.js';
|
|
46
|
+
import filterStyles from './filter.css.legacy.js';
|
|
46
47
|
|
|
47
48
|
const UIStrings = {
|
|
48
49
|
/**
|
|
@@ -79,7 +80,7 @@ export class FilterBar extends Common.ObjectWrapper.eventMixin<FilterBarEventTyp
|
|
|
79
80
|
|
|
80
81
|
constructor(name: string, visibleByDefault?: boolean) {
|
|
81
82
|
super();
|
|
82
|
-
this.registerRequiredCSS(
|
|
83
|
+
this.registerRequiredCSS(filterStyles);
|
|
83
84
|
this.enabled = true;
|
|
84
85
|
this.element.classList.add('filter-bar');
|
|
85
86
|
|
|
@@ -10,6 +10,7 @@ import {Icon} from './Icon.js';
|
|
|
10
10
|
import {deepElementFromEvent} from './UIUtils.js';
|
|
11
11
|
import type {WidgetElement} from './Widget.js';
|
|
12
12
|
import {Widget} from './Widget.js';
|
|
13
|
+
import glassPaneStyles from './glassPane.css.legacy.js';
|
|
13
14
|
|
|
14
15
|
export class GlassPane {
|
|
15
16
|
private readonly widgetInternal: Widget;
|
|
@@ -36,7 +37,7 @@ export class GlassPane {
|
|
|
36
37
|
this.element.shadowRoot.appendChild(this.arrowElement);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
this.registerRequiredCSS(
|
|
40
|
+
this.registerRequiredCSS(glassPaneStyles);
|
|
40
41
|
this.setPointerEventsBehavior(PointerEventsBehavior.PierceGlassPane);
|
|
41
42
|
|
|
42
43
|
this.onMouseDownBound = this.onMouseDown.bind(this);
|
|
@@ -54,7 +55,8 @@ export class GlassPane {
|
|
|
54
55
|
return this.widgetInternal.isShowing();
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
registerRequiredCSS(cssFile: string): void {
|
|
58
|
+
registerRequiredCSS(cssFile: string|{cssContent: string}): void {
|
|
59
|
+
// eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
|
|
58
60
|
this.widgetInternal.registerRequiredCSS(cssFile);
|
|
59
61
|
}
|
|
60
62
|
|
|
@@ -10,6 +10,7 @@ import * as ARIAUtils from './ARIAUtils.js';
|
|
|
10
10
|
import {Keys} from './KeyboardShortcut.js';
|
|
11
11
|
import {createTextButton} from './UIUtils.js';
|
|
12
12
|
import type {Widget} from './Widget.js';
|
|
13
|
+
import infobarStyles from './infobar.css.legacy.js';
|
|
13
14
|
|
|
14
15
|
const UIStrings = {
|
|
15
16
|
/**
|
|
@@ -46,9 +47,7 @@ export class Infobar {
|
|
|
46
47
|
private readonly closeContainer: HTMLElement;
|
|
47
48
|
private readonly toggleElement: HTMLButtonElement;
|
|
48
49
|
private readonly closeButton: HTMLElement;
|
|
49
|
-
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
-
private closeCallback: (() => any)|null;
|
|
50
|
+
private closeCallback: (() => void)|null;
|
|
52
51
|
private parentView?: Widget;
|
|
53
52
|
|
|
54
53
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
@@ -56,8 +55,8 @@ export class Infobar {
|
|
|
56
55
|
constructor(type: Type, text: string, actions?: InfobarAction[], disableSetting?: Common.Settings.Setting<any>) {
|
|
57
56
|
this.element = document.createElement('div');
|
|
58
57
|
this.element.classList.add('flex-none');
|
|
59
|
-
this.shadowRoot =
|
|
60
|
-
this.element, {cssFile:
|
|
58
|
+
this.shadowRoot =
|
|
59
|
+
Utils.createShadowRootWithCoreStyles(this.element, {cssFile: infobarStyles, delegatesFocus: undefined});
|
|
61
60
|
|
|
62
61
|
this.contentElement = this.shadowRoot.createChild('div', 'infobar infobar-' + type) as HTMLDivElement;
|
|
63
62
|
|
|
@@ -160,9 +159,7 @@ export class Infobar {
|
|
|
160
159
|
this.onResize();
|
|
161
160
|
}
|
|
162
161
|
|
|
163
|
-
|
|
164
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
165
|
-
setCloseCallback(callback: (() => any)|null): void {
|
|
162
|
+
setCloseCallback(callback: (() => void)|null): void {
|
|
166
163
|
this.closeCallback = callback;
|
|
167
164
|
}
|
|
168
165
|
|
|
@@ -52,6 +52,7 @@ import {ViewManager} from './ViewManager.js';
|
|
|
52
52
|
import type {Widget} from './Widget.js';
|
|
53
53
|
import {VBox, WidgetFocusRestorer} from './Widget.js';
|
|
54
54
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
55
|
+
import inspectorViewTabbedPaneStyles from './inspectorViewTabbedPane.css.legacy.js';
|
|
55
56
|
|
|
56
57
|
const UIStrings = {
|
|
57
58
|
/**
|
|
@@ -167,7 +168,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
|
|
|
167
168
|
|
|
168
169
|
this.tabbedPane = this.tabbedLocation.tabbedPane();
|
|
169
170
|
this.tabbedPane.element.classList.add('main-tabbed-pane');
|
|
170
|
-
this.tabbedPane.registerRequiredCSS(
|
|
171
|
+
this.tabbedPane.registerRequiredCSS(inspectorViewTabbedPaneStyles);
|
|
171
172
|
this.tabbedPane.addEventListener(TabbedPaneEvents.TabSelected, this.tabSelected, this);
|
|
172
173
|
this.tabbedPane.setAccessibleName(i18nString(UIStrings.panels));
|
|
173
174
|
this.tabbedPane.setTabDelegate(this.tabDelegate);
|
|
@@ -210,6 +211,10 @@ export class InspectorView extends VBox implements ViewLocationResolver {
|
|
|
210
211
|
return inspectorViewInstance;
|
|
211
212
|
}
|
|
212
213
|
|
|
214
|
+
static maybeGetInspectorViewInstance(): InspectorView|undefined {
|
|
215
|
+
return inspectorViewInstance;
|
|
216
|
+
}
|
|
217
|
+
|
|
213
218
|
wasShown(): void {
|
|
214
219
|
this.element.ownerDocument.addEventListener('keydown', this.keyDownBound, false);
|
|
215
220
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
6
6
|
|
|
7
7
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
8
|
+
import listWidgetStyles from './listWidget.css.legacy.js';
|
|
8
9
|
import {Toolbar, ToolbarButton} from './Toolbar.js';
|
|
9
10
|
import {Tooltip} from './Tooltip.js';
|
|
10
11
|
import {createInput, createTextButton, ElementFocusRestorer} from './UIUtils.js';
|
|
@@ -49,7 +50,7 @@ export class ListWidget<T> extends VBox {
|
|
|
49
50
|
private emptyPlaceholder: Element|null;
|
|
50
51
|
constructor(delegate: Delegate<T>, delegatesFocus: boolean|undefined = true) {
|
|
51
52
|
super(true, delegatesFocus);
|
|
52
|
-
this.registerRequiredCSS(
|
|
53
|
+
this.registerRequiredCSS(listWidgetStyles);
|
|
53
54
|
this.delegate = delegate;
|
|
54
55
|
|
|
55
56
|
this.list = this.contentElement.createChild('div', 'list');
|